@citolab/qti-components 7.0.4 → 7.0.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.
- package/cdn/chunks/chunk-4UJBK6JO.js +1 -0
- package/cdn/chunks/chunk-5FCXUJAG.js +23 -0
- package/cdn/chunks/chunk-5O3Z7TDV.js +1 -0
- package/cdn/chunks/chunk-65LFT33L.js +8 -0
- package/cdn/chunks/chunk-6D25UFJR.js +8 -0
- package/cdn/chunks/chunk-6DMSHH5X.js +0 -0
- package/cdn/chunks/chunk-6UGPNL7M.js +1 -0
- package/cdn/chunks/chunk-CFXQCNG6.js +3523 -0
- package/cdn/chunks/chunk-CSUKVUZF.js +3 -0
- package/cdn/chunks/chunk-CSY3WI5A.js +1 -0
- package/cdn/chunks/chunk-DAZR7RUI.js +0 -0
- package/cdn/chunks/chunk-EHK76KRT.js +1 -0
- package/cdn/chunks/chunk-EOPEMJS3.js +0 -0
- package/cdn/chunks/chunk-G5O7EN45.js +5 -0
- package/cdn/chunks/chunk-GEFUIFM7.js +0 -0
- package/cdn/chunks/chunk-JLNHEMQG.js +1 -0
- package/cdn/chunks/chunk-LPWIM7QJ.js +902 -0
- package/cdn/chunks/chunk-M3YRM3AV.js +1 -0
- package/cdn/chunks/chunk-M6BOWL2U.js +1 -0
- package/cdn/chunks/chunk-P5IE36FO.js +8 -0
- package/cdn/chunks/chunk-PXH5KN5O.js +1 -0
- package/cdn/chunks/chunk-RBEI6NIF.js +1 -0
- package/cdn/chunks/chunk-SMKIYFFI.js +1 -0
- package/cdn/chunks/chunk-SRLMW23F.js +0 -0
- package/cdn/chunks/chunk-T3YDLD2H.js +11 -0
- package/cdn/chunks/chunk-T4HD2C4F.js +1 -0
- package/cdn/chunks/chunk-T6IXJ4W4.js +1 -0
- package/cdn/chunks/chunk-TFAUBGP2.js +0 -0
- package/cdn/chunks/chunk-UIEC4LXR.js +17 -0
- package/cdn/chunks/chunk-V44O3GTW.js +0 -0
- package/cdn/chunks/chunk-V6B54FQW.js +5 -0
- package/cdn/chunks/chunk-V6KX6BQN.js +1 -0
- package/cdn/chunks/chunk-VYANBI35.js +1 -0
- package/cdn/chunks/chunk-XUJ7TXHW.js +1 -0
- package/cdn/chunks/chunk-ZIZLFFSG.js +0 -0
- package/cdn/index.css +1 -0
- package/cdn/index.global.js +45 -45
- package/cdn/index.js +196 -476
- package/cdn/qti-components/index.global.js +226 -0
- package/cdn/qti-components/index.js +924 -0
- package/cdn/qti-item/components/index.css +1 -0
- package/cdn/qti-item/components/index.global.js +149 -0
- package/cdn/qti-item/components/index.js +3549 -0
- package/cdn/qti-item/components/item-container.css +1 -0
- package/cdn/qti-item/components/item-container.global.js +149 -0
- package/cdn/qti-item/components/item-container.js +3549 -0
- package/cdn/qti-item/index.css +1 -0
- package/cdn/qti-item/index.global.js +149 -0
- package/cdn/qti-item/index.js +3549 -0
- package/cdn/qti-item/qti-item.global.js +114 -0
- package/cdn/qti-item/qti-item.js +1 -0
- package/cdn/qti-loader/index.global.js +1 -0
- package/cdn/qti-loader/index.js +23 -0
- package/cdn/qti-test/components/index.css +1 -0
- package/cdn/qti-test/components/index.global.js +242 -0
- package/cdn/qti-test/components/index.js +3598 -0
- package/cdn/qti-test/components/styles.global.js +44 -0
- package/cdn/qti-test/components/styles.js +17 -0
- package/cdn/qti-test/components/test-component.abstract.global.js +170 -0
- package/cdn/qti-test/components/test-component.abstract.js +1 -0
- package/cdn/qti-test/components/test-container.css +1 -0
- package/cdn/qti-test/components/test-container.global.js +149 -0
- package/cdn/qti-test/components/test-container.js +3549 -0
- package/cdn/qti-test/components/test-item-link.global.js +170 -0
- package/cdn/qti-test/components/test-item-link.js +24 -0
- package/cdn/qti-test/components/test-next.global.js +170 -0
- package/cdn/qti-test/components/test-next.js +24 -0
- package/cdn/qti-test/components/test-next.spec.css +1 -0
- package/cdn/qti-test/components/test-next.spec.global.js +297 -0
- package/cdn/qti-test/components/test-next.spec.js +5215 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.global.js +207 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +3 -0
- package/cdn/qti-test/components/test-prev.global.js +170 -0
- package/cdn/qti-test/components/test-prev.js +24 -0
- package/cdn/qti-test/components/test-view.global.js +170 -0
- package/cdn/qti-test/components/test-view.js +11 -0
- package/cdn/qti-test/context/index.global.js +58 -0
- package/cdn/qti-test/context/index.js +1 -0
- package/cdn/qti-test/context/test.context.global.js +58 -0
- package/cdn/qti-test/context/test.context.js +1 -0
- package/cdn/qti-test/index.css +1 -0
- package/cdn/qti-test/index.global.js +242 -0
- package/cdn/qti-test/index.js +3598 -0
- package/cdn/qti-test/mixins/index.global.js +1 -0
- package/cdn/qti-test/mixins/index.js +23 -0
- package/cdn/qti-test/mixins/test-loader.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-loader.mixin.js +23 -0
- package/cdn/qti-test/mixins/test-navigation.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-navigation.mixin.js +1 -0
- package/cdn/qti-test/mixins/test-view.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-view.mixin.js +1 -0
- package/cdn/qti-test/qti-assessment-test/index.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/index.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-test-part.global.js +114 -0
- package/cdn/qti-test/qti-assessment-test/qti-test-part.js +1 -0
- package/cdn/qti-test/qti-test.global.js +170 -0
- package/cdn/qti-test/qti-test.js +23 -0
- package/cdn/qti-test/test-base.global.js +170 -0
- package/cdn/qti-test/test-base.js +1 -0
- package/cdn/qti-transformers/index.global.js +1 -0
- package/cdn/qti-transformers/index.js +23 -0
- package/dist/chunks/chunk-3G2DDBJW.js +44 -0
- package/dist/chunks/chunk-3G2DDBJW.js.map +1 -0
- package/dist/chunks/chunk-3NLCJYSX.js +1 -0
- package/dist/chunks/chunk-3NLCJYSX.js.map +1 -0
- package/dist/chunks/chunk-3OXGDCSU.js +6253 -0
- package/dist/chunks/chunk-3OXGDCSU.js.map +1 -0
- package/dist/chunks/chunk-3ROZMGAN.js +43 -0
- package/dist/chunks/chunk-3ROZMGAN.js.map +1 -0
- package/dist/chunks/chunk-4O5F7WV7.js +30 -0
- package/dist/chunks/chunk-4O5F7WV7.js.map +1 -0
- package/dist/chunks/chunk-6YE2KJ4C.js +55 -0
- package/dist/chunks/chunk-6YE2KJ4C.js.map +1 -0
- package/dist/chunks/chunk-AAQCM2FP.js +56 -0
- package/dist/chunks/chunk-AAQCM2FP.js.map +1 -0
- package/dist/chunks/chunk-D3RGDWKP.js +37 -0
- package/dist/chunks/chunk-D3RGDWKP.js.map +1 -0
- package/dist/chunks/chunk-DJLE6EV2.js +36 -0
- package/dist/chunks/chunk-DJLE6EV2.js.map +1 -0
- package/dist/chunks/chunk-ELDMXTUQ.js +31 -0
- package/dist/chunks/chunk-ELDMXTUQ.js.map +1 -0
- package/dist/chunks/chunk-EW5CTHAD.js +1 -0
- package/dist/chunks/chunk-EW5CTHAD.js.map +1 -0
- package/dist/chunks/chunk-HWA4A3SR.js +50 -0
- package/dist/chunks/chunk-HWA4A3SR.js.map +1 -0
- package/dist/chunks/chunk-IKZWK2C5.js +1 -0
- package/dist/chunks/chunk-IKZWK2C5.js.map +1 -0
- package/dist/chunks/chunk-IP7JSYO6.js +1 -0
- package/dist/chunks/chunk-IP7JSYO6.js.map +1 -0
- package/dist/chunks/chunk-JE6BMXZU.js +94 -0
- package/dist/chunks/chunk-JE6BMXZU.js.map +1 -0
- package/dist/chunks/chunk-JSPJGWGT.js +20 -0
- package/dist/chunks/chunk-JSPJGWGT.js.map +1 -0
- package/dist/chunks/chunk-LKINC6JO.js +118 -0
- package/dist/chunks/chunk-LKINC6JO.js.map +1 -0
- package/dist/chunks/chunk-LROTNPC2.js +94 -0
- package/dist/chunks/chunk-LROTNPC2.js.map +1 -0
- package/dist/chunks/chunk-MTMT2RMF.js +63 -0
- package/dist/chunks/chunk-MTMT2RMF.js.map +1 -0
- package/dist/chunks/chunk-NDJZGJUR.js +65 -0
- package/dist/chunks/chunk-NDJZGJUR.js.map +1 -0
- package/dist/chunks/chunk-OE2LFIH2.js +1 -0
- package/dist/chunks/chunk-OE2LFIH2.js.map +1 -0
- package/dist/chunks/chunk-OJ2XGDWK.js +1 -0
- package/dist/chunks/chunk-OJ2XGDWK.js.map +1 -0
- package/dist/chunks/chunk-PUBGXXTM.js +50 -0
- package/dist/chunks/chunk-PUBGXXTM.js.map +1 -0
- package/dist/chunks/chunk-QRCUNRP5.js +75 -0
- package/dist/chunks/chunk-QRCUNRP5.js.map +1 -0
- package/dist/chunks/chunk-S6JJYCO7.js +51 -0
- package/dist/chunks/chunk-S6JJYCO7.js.map +1 -0
- package/dist/chunks/chunk-U3AALKEP.js +1 -0
- package/dist/chunks/chunk-U3AALKEP.js.map +1 -0
- package/dist/chunks/chunk-UCQFSRYF.js +34 -0
- package/dist/chunks/chunk-UCQFSRYF.js.map +1 -0
- package/dist/chunks/chunk-URGVQ64M.js +1 -0
- package/dist/chunks/chunk-URGVQ64M.js.map +1 -0
- package/dist/chunks/chunk-V4FXK4TP.js +128 -0
- package/dist/chunks/chunk-V4FXK4TP.js.map +1 -0
- package/dist/chunks/chunk-W4B23OIP.js +72 -0
- package/dist/chunks/chunk-W4B23OIP.js.map +1 -0
- package/dist/chunks/chunk-XDFXD3BI.js +10 -0
- package/dist/chunks/chunk-XDFXD3BI.js.map +1 -0
- package/dist/chunks/chunk-XDMSEAYC.js +294 -0
- package/dist/chunks/chunk-XPDS72XY.js +29 -0
- package/dist/chunks/chunk-XPDS72XY.js.map +1 -0
- package/dist/chunks/chunk-Y6UWSECL.js +3529 -0
- package/dist/chunks/chunk-Y6UWSECL.js.map +1 -0
- package/dist/chunks/chunk-ZEFOMZNY.js +78 -0
- package/dist/chunks/chunk-ZEFOMZNY.js.map +1 -0
- package/dist/index-Cvrd4KQA.d.ts +109 -0
- package/dist/index.d.ts +18 -503
- package/dist/index.js +1666 -4206
- package/dist/index.js.map +1 -1
- package/dist/item.css +10 -10
- package/dist/qti-components/index.d.ts +150 -0
- package/dist/qti-components/index.js +6525 -0
- package/dist/qti-components/index.js.map +1 -0
- package/dist/qti-components-jsx.d.ts +93 -147
- package/dist/qti-item/components/index.d.ts +3 -0
- package/dist/qti-item/components/index.js +3856 -0
- package/dist/qti-item/components/index.js.map +1 -0
- package/dist/qti-item/components/item-container.d.ts +40 -0
- package/dist/qti-item/components/item-container.js +3856 -0
- package/dist/qti-item/components/item-container.js.map +1 -0
- package/dist/qti-item/index.d.ts +4 -0
- package/dist/qti-item/index.js +3869 -0
- package/dist/qti-item/index.js.map +1 -0
- package/dist/qti-item/qti-item.d.ts +25 -0
- package/dist/qti-item/qti-item.js +26 -0
- package/dist/qti-item/qti-item.js.map +1 -0
- package/dist/{loader → qti-loader}/index.d.ts +1 -1
- package/dist/{qti-simple-choice-D0GiMrqD.d.ts → qti-simple-choice-DxWcdKHi.d.ts} +30 -40
- package/dist/qti-test/components/index.d.ts +13 -0
- package/dist/qti-test/components/index.js +4144 -0
- package/dist/qti-test/components/index.js.map +1 -0
- package/dist/qti-test/components/styles.d.ts +8 -0
- package/dist/qti-test/components/styles.js +29 -0
- package/dist/qti-test/components/styles.js.map +1 -0
- package/dist/qti-test/components/test-component.abstract.d.ts +23 -0
- package/dist/qti-test/components/test-component.abstract.js +149 -0
- package/dist/qti-test/components/test-component.abstract.js.map +1 -0
- package/dist/qti-test/components/test-container.d.ts +37 -0
- package/dist/qti-test/components/test-container.js +3782 -0
- package/dist/qti-test/components/test-container.js.map +1 -0
- package/dist/qti-test/components/test-item-link.d.ts +21 -0
- package/dist/qti-test/components/test-item-link.js +202 -0
- package/dist/qti-test/components/test-item-link.js.map +1 -0
- package/dist/qti-test/components/test-next.d.ts +32 -0
- package/dist/qti-test/components/test-next.js +209 -0
- package/dist/qti-test/components/test-next.js.map +1 -0
- package/dist/qti-test/components/test-next.spec.d.ts +16 -0
- package/dist/qti-test/components/test-next.spec.js +56915 -0
- package/dist/qti-test/components/test-next.spec.js.map +1 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +22 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.js +218 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.js.map +1 -0
- package/dist/qti-test/components/test-prev.d.ts +32 -0
- package/dist/qti-test/components/test-prev.js +209 -0
- package/dist/qti-test/components/test-prev.js.map +1 -0
- package/dist/qti-test/components/test-view.d.ts +27 -0
- package/dist/qti-test/components/test-view.js +209 -0
- package/dist/qti-test/components/test-view.js.map +1 -0
- package/dist/qti-test/context/index.d.ts +6 -0
- package/dist/qti-test/context/index.js +9 -0
- package/dist/qti-test/context/index.js.map +1 -0
- package/dist/qti-test/context/test.context.d.ts +6 -0
- package/dist/qti-test/context/test.context.js +9 -0
- package/dist/qti-test/context/test.context.js.map +1 -0
- package/dist/qti-test/index.d.ts +14 -0
- package/dist/qti-test/index.js +4746 -0
- package/dist/qti-test/index.js.map +1 -0
- package/dist/qti-test/mixins/index.d.ts +8 -0
- package/dist/qti-test/mixins/index.js +350 -0
- package/dist/qti-test/mixins/index.js.map +1 -0
- package/dist/qti-test/mixins/test-loader.mixin.d.ts +8 -0
- package/dist/qti-test/mixins/test-loader.mixin.js +240 -0
- package/dist/qti-test/mixins/test-loader.mixin.js.map +1 -0
- package/dist/qti-test/mixins/test-navigation.mixin.d.ts +22 -0
- package/dist/qti-test/mixins/test-navigation.mixin.js +64 -0
- package/dist/qti-test/mixins/test-navigation.mixin.js.map +1 -0
- package/dist/qti-test/mixins/test-view.mixin.d.ts +6 -0
- package/dist/qti-test/mixins/test-view.mixin.js +50 -0
- package/dist/qti-test/mixins/test-view.mixin.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/index.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/index.js +221 -0
- package/dist/qti-test/qti-assessment-test/index.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js +85 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js +73 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js +54 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.d.ts +19 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.js +62 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.js.map +1 -0
- package/dist/qti-test/qti-test.d.ts +68 -0
- package/dist/qti-test/qti-test.js +500 -0
- package/dist/qti-test/qti-test.js.map +1 -0
- package/dist/qti-test/test-base.d.ts +6 -0
- package/dist/qti-test/test-base.js +137 -0
- package/dist/qti-test/test-base.js.map +1 -0
- package/dist/qti-transformers/index.js.map +1 -0
- package/dist/test-base-BJwG9Ie8.d.ts +109 -0
- package/dist/vscode.html-custom-data.json +49 -38
- package/package.json +28 -51
- package/dist/custom-element-eslint-rules.js +0 -329
- package/dist/custom-elements.json +0 -27271
- package/dist/qti-simple-choice-CfgBEvdI.d.ts +0 -1143
- package/dist/qti-simple-choice-UTrFa_RQ.d.ts +0 -1177
- package/dist/qti-simple-choice-zEsDq3c0.d.ts +0 -1147
- /package/dist/{transformers/index.js.map → chunks/chunk-XDMSEAYC.js.map} +0 -0
- /package/dist/{loader → qti-loader}/index.js +0 -0
- /package/dist/{loader → qti-loader}/index.js.map +0 -0
- /package/dist/{transformers → qti-transformers}/index.d.ts +0 -0
- /package/dist/{transformers → qti-transformers}/index.js +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]})}get(t){return this.__definitions.get(t)?.ctor}},Gs=Ys;var Ri=new Gs;var nt=globalThis,jt=nt.ShadowRoot&&(nt.ShadyCSS===void 0||nt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nr=Symbol(),Li=new WeakMap,at=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Nr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(jt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Li.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Li.set(e,t))}return t}toString(){return this.cssText}},$i=s=>new at(typeof s=="string"?s:s+"",void 0,Nr),b=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new at(e,s,Nr)},Hr=(s,t)=>{if(jt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=nt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},Wt=jt||nt.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return $i(e)})(s):s;var{is:Ks,defineProperty:Js,getOwnPropertyDescriptor:Zs,getOwnPropertyNames:Qs,getOwnPropertySymbols:eo,getPrototypeOf:to}=Object,z=globalThis;z.customElements??(z.customElements=Ri);var Di=z.trustedTypes,ro=Di?Di.emptyScript:"",io=z.reactiveElementPolyfillSupport,lt=(s,t)=>s,ct={toAttribute(s,t){switch(t){case Boolean:s=s?ro:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Yt=(s,t)=>!Ks(s,t),Ii={attribute:!0,type:String,converter:ct,reflect:!1,hasChanged:Yt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),z.litPropertyMetadata??(z.litPropertyMetadata=new WeakMap);var se=class extends(globalThis.HTMLElement??Mi){static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ii){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Js(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=Zs(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i?.call(this)},set(n){let a=i?.call(this);o.call(this,n),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ii}static _$Ei(){if(this.hasOwnProperty(lt("elementProperties")))return;let t=to(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(lt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(lt("properties"))){let e=this.properties,r=[...Qs(e),...eo(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Wt(i))}else t!==void 0&&e.push(Wt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ct).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ct;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Yt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se[lt("elementProperties")]=new Map,se[lt("finalized")]=new Map,io?.({ReactiveElement:se}),(z.reactiveElementVersions??(z.reactiveElementVersions=[])).push("2.0.4");var Ne=globalThis,Gt=Ne.trustedTypes,Ni=Gt?Gt.createPolicy("lit-html",{createHTML:s=>s}):void 0,Vr="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Pr="?"+oe,so=`<${Pr}>`,ke=Ne.document===void 0?{createTreeWalker:()=>({})}:document,pt=()=>ke.createComment(""),ht=s=>s===null||typeof s!="object"&&typeof s!="function",zr=Array.isArray,Ui=s=>zr(s)||typeof s?.[Symbol.iterator]=="function",Or=`[
|
|
3
|
-
\f\r]`,dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hi=/-->/g,Oi=/>/g,Ce=RegExp(`>|${Or}(?:([^\\s"'>=/]+)(${Or}*=${Or}*(?:[^
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vi=/'/g,Pi=/"/g,Fi=/^(?:script|style|textarea|title)$/i,Ur=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),h=Ur(1),Fr=Ur(2),Tn=Ur(3),M=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),zi=new WeakMap,_e=ke.createTreeWalker(ke,129);function Bi(s,t){if(!zr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ni!==void 0?Ni.createHTML(t):t}var Xi=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=dt;for(let a=0;a<e;a++){let c=s[a],d,m,g=-1,f=0;for(;f<c.length&&(n.lastIndex=f,m=n.exec(c),m!==null);)f=n.lastIndex,n===dt?m[1]==="!--"?n=Hi:m[1]!==void 0?n=Oi:m[2]!==void 0?(Fi.test(m[2])&&(i=RegExp("</"+m[2],"g")),n=Ce):m[3]!==void 0&&(n=Ce):n===Ce?m[0]===">"?(n=i??dt,g=-1):m[1]===void 0?g=-2:(g=n.lastIndex-m[2].length,d=m[1],n=m[3]===void 0?Ce:m[3]==='"'?Pi:Vi):n===Pi||n===Vi?n=Ce:n===Hi||n===Oi?n=dt:(n=Ce,i=void 0);let y=n===Ce&&s[a+1].startsWith("/>")?" ":"";o+=n===dt?c+so:g>=0?(r.push(d),c.slice(0,g)+Vr+c.slice(g)+oe+y):c+oe+(g===-2?a:y)}return[Bi(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ut=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[d,m]=Xi(t,e);if(this.el=s.createElement(d,r),_e.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=_e.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let g of i.getAttributeNames())if(g.endsWith(Vr)){let f=m[n++],y=i.getAttribute(g).split(oe),x=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:x[2],strings:y,ctor:x[1]==="."?Jt:x[1]==="?"?Zt:x[1]==="@"?Qt:Ae}),i.removeAttribute(g)}else g.startsWith(oe)&&(c.push({type:6,index:o}),i.removeAttribute(g));if(Fi.test(i.tagName)){let g=i.textContent.split(oe),f=g.length-1;if(f>0){i.textContent=Gt?Gt.emptyScript:"";for(let y=0;y<f;y++)i.append(g[y],pt()),_e.nextNode(),c.push({type:2,index:++o});i.append(g[f],pt())}}}else if(i.nodeType===8)if(i.data===Pr)c.push({type:2,index:o});else{let g=-1;for(;(g=i.data.indexOf(oe,g+1))!==-1;)c.push({type:7,index:o}),g+=oe.length-1}o++}}static createElement(t,e){let r=ke.createElement("template");return r.innerHTML=t,r}};function Te(s,t,e=s,r){if(t===M)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=ht(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Te(s,i._$AS(s,t.values),i,r)),t}var Kt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??ke).importNode(e,!0);_e.currentNode=i;let o=_e.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new He(o,o.nextSibling,this,t):c.type===1?d=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(d=new er(o,this,t)),this._$AV.push(d),c=r[++a]}n!==c?.index&&(o=_e.nextNode(),n++)}return _e.currentNode=ke,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},He=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Te(this,t,e),ht(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ui(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==k&&ht(this._$AH)?this._$AA.nextSibling.data=t:this.T(ke.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ut.createElement(Bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new Kt(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=zi.get(t.strings);return e===void 0&&zi.set(t.strings,e=new ut(t)),e}k(t){zr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(pt()),this.O(pt()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ae=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=k}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=Te(this,t,e,0),n=!ht(t)||t!==this._$AH&&t!==M,n&&(this._$AH=t);else{let a=t,c,d;for(t=o[0],c=0;c<o.length-1;c++)d=Te(this,a[r+c],e,c),d===M&&(d=this._$AH[c]),n||(n=!ht(d)||d!==this._$AH[c]),d===k?t=k:t!==k&&(t+=(d??"")+o[c+1]),this._$AH[c]=d}n&&!i&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Jt=class extends Ae{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},Zt=class extends Ae{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},Qt=class extends Ae{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=Te(this,t,e,0)??k)===M)return;let r=this._$AH,i=t===k&&r!==k||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==k&&(r===k||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},er=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Te(this,t)}},R={M:Vr,P:oe,A:Pr,C:1,L:Xi,R:Kt,D:Ui,V:Te,I:He,H:Ae,N:Zt,U:Qt,B:Jt,F:er},oo=Ne.litHtmlPolyfillSupport;oo?.(ut,He),(Ne.litHtmlVersions??(Ne.litHtmlVersions=[])).push("3.2.1");var Br=(s,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new He(t.insertBefore(pt(),o),o,void 0,e??{})}return i._$AI(s),i};var v=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Br(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return M}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var no=globalThis.litElementPolyfillSupport;no?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var u=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var ao={attribute:!0,type:String,converter:ct,reflect:!1,hasChanged:Yt},lo=(s=ao,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=e;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function p(s){return(t,e)=>typeof e=="object"?lo(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}function q(s){return p({...s,state:!0,attribute:!1})}var me=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function Oe(s,t){return(e,r,i)=>{let o=n=>n.renderRoot?.querySelector(s)??null;if(t){let{get:n,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(d){this[c]=d}}})();return me(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return me(e,r,{get(){return o(this)}})}}function ji(s){return(t,e)=>{let{slot:r,selector:i}=s??{},o="slot"+(r?`[name=${r}]`:":not([name])");return me(t,e,{get(){let n=this.renderRoot?.querySelector(o),a=n?.assignedElements(s)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var F=Symbol("test"),tr=Symbol("testElement");var Wi={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},B=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return h`${this.xmlDoc}`}};l([p({type:String})],B.prototype,"category",2),l([p({type:String})],B.prototype,"identifier",2),l([p({type:Boolean,converter:Wi})],B.prototype,"required",2),l([p({type:Boolean,converter:Wi})],B.prototype,"fixed",2),l([p({type:String})],B.prototype,"href",2),l([A({context:F,subscribe:!0})],B.prototype,"_testContext",2),l([p({type:Object,attribute:!1})],B.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",B);var Xr={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},X=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};l([p({type:String})],X.prototype,"identifier",2),l([p({type:String})],X.prototype,"required",2),l([p({type:Boolean,converter:Xr})],X.prototype,"fixed",2),l([p({type:String})],X.prototype,"title",2),l([p({type:Boolean,converter:Xr})],X.prototype,"visible",2),l([p({type:Boolean,converter:Xr,attribute:"keep-together"})],X.prototype,"keepTogether",2),l([A({context:F,subscribe:!0})],X.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",X);var Se=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],Se.prototype,"identifier",2),l([p({type:String})],Se.prototype,"title",2),l([A({context:F,subscribe:!0})],Se.prototype,"_testContext",2),Se=l([u("qti-assessment-test")],Se);var j=class extends v{constructor(){super(...arguments);this.identifier="";this.title="";this.class="";this.NavigationMode="nonlinear";this.submissionMode="individual"}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],j.prototype,"identifier",2),l([p({type:String})],j.prototype,"title",2),l([p({type:String})],j.prototype,"class",2),l([p({type:String,attribute:"navigation-mode"})],j.prototype,"NavigationMode",2),l([p({type:String,attribute:"submission-mode"})],j.prototype,"submissionMode",2),j=l([u("qti-test-part")],j);customElements.get("qti-test-part")||customElements.define("qti-test-part",j);var co=String.raw,po=co`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1
|
+
var wi=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var o=(n,s,e,t)=>{for(var r=t>1?void 0:t?Ei(s,e):s,i=n.length-1,l;i>=0;i--)(l=n[i])&&(r=(t?l(s,e,r):l(r))||r);return t&&r&&wi(s,e,r),r};import{html as Mi}from"lit";import{customElement as Si}from"lit/decorators.js";var Ci=String.raw,ki=Ci`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
5
2
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
6
3
|
<xsl:template match="@*|node()">
|
|
7
4
|
<xsl:copy>
|
|
@@ -23,54 +20,54 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
23
20
|
<xsl:apply-templates/>
|
|
24
21
|
</xsl:element>
|
|
25
22
|
</xsl:template>
|
|
26
|
-
</xsl:stylesheet>`;function Yi(s,t,e){s.querySelectorAll(t).forEach(r=>{let i=`${t}-${e}`,o=Ki(r,i);r.replaceWith(o)})}function Gi(s,t){s.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),n=`${e.nodeName}-${o}`,a=Ki(e,n);e.replaceWith(a)}})})}function Ki(s,t){let e=document.createElement(t);for(let r of s.attributes)e.setAttribute(r.name,r.value);for(;s.firstChild;)e.appendChild(s.firstChild);return e}function Ji(s){let t=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var jr=null;function mt(s,t=!1){return t&&jr!==null&&jr.abort(),new Promise((e,r)=>{let i=new XMLHttpRequest;jr=i,i.open("GET",s,!0),i.responseType="document",i.onload=()=>{i.status>=200&&i.status<300?e(i.responseXML):r(i.statusText)},i.onerror=()=>{r(i.statusText)},i.send()})}function gt(s){return new DOMParser().parseFromString(s,"text/xml")}function Ve(s){let t=new XSLTProcessor,e=new DOMParser().parseFromString(po,"text/xml");return t.importStylesheet(e),t.transformToFragment(s,document)}function rr(s,t){t.endsWith("/")||(t+="/"),s.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");let i=e.getAttribute(r)?.trim();if(!i.startsWith("data:")&&!i.startsWith("http")){let o=t+encodeURI(i);e.setAttribute(r,o)}})}function Zi(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function Qi(s){s.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Me=()=>{let s,t={async load(e,r=!1){return new Promise(i=>{mt(e,r).then(o=>(s=o,t.path(e.substring(0,e.lastIndexOf("/"))),i(t)))})},parse(e){return s=gt(e),t},path:e=>(rr(s,e),t),fn(e){return e(s),t},pciHooks(e){let r=["hook","module"],i=e.substring(0,e.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",i+"/"+encodeURI(c+(c.endsWith(".js")?"":".js"))))});return t},extendElementName:(e,r)=>(Yi(s,e,r),t),extendElementsWithClass:(e="extend")=>(Gi(s,e),t),customInteraction(e,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",e),i.setAttribute("data-base-item",e+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),t},convertCDATAtoComment(){return Zi(s),t},stripStyleSheets(){return Qi(s),t},html(){return new XMLSerializer().serializeToString(Ve(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ve(s)},xmlDoc(){return s}};return t};var Wr=()=>{let s,t={async load(e){return new Promise((r,i)=>{mt(e).then(o=>(s=o,t.path(e.substring(0,e.lastIndexOf("/"))),r(t)))})},parse(e){return s=gt(e),t},path:e=>(rr(s,e),t),fn(e){return e(s),t},items(){return Ji(s)},html(){return new XMLSerializer().serializeToString(Ve(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ve(s)},xmlDoc(){return s}};return t};var es=s=>{class t extends s{constructor(...i){super(...i);this.testURL="";this.addEventListener("qti-assessment-test-connected",()=>{}),this.addEventListener("qti-load-item-request",({detail:o})=>{o.promise=(async()=>(await Me().load(`${o.href}`,o.cancelPreviousRequest)).htmlDoc())()}),this.addEventListener("qti-interaction-changed",o=>{}),this.addEventListener("qti-outcome-changed",()=>{})}}return t};var ts=s=>{class t extends s{constructor(...r){super(...r),this.addEventListener("qti-request-test-item",({detail:i})=>{if(!i)return;this._clearLoadedItems();let o=this.testElement.el.querySelector(`qti-assessment-item-ref[identifier="${i}"]`),n=this._loadItemRequest(o.href,!1),a=o.closest("qti-test-part").identifier,c=o.closest("qti-assessment-section").identifier;this._testContext={...this._testContext,navPartId:a,navSectionId:c,navItemId:i,navItemLoading:!0},n?n.then(d=>{o.xmlDoc=d,requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0}))),this._testContext={...this._testContext,navItemLoading:!1}}).catch(d=>console.error("Failed to load item:",d)):console.info("Load item request was not handled:",o.href)}),this.addEventListener("qti-assessment-test-connected",()=>{let i=this._testContext.navItemId;i||(i=this.testElement.el.querySelector("qti-assessment-item-ref").identifier),this.dispatchEvent(new CustomEvent("qti-request-test-item",{detail:i,bubbles:!0,composed:!0}))})}_clearLoadedItems(){let r=this.testElement.el.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(r).forEach(i=>{i.xmlDoc=null})}_loadItemRequest(r,i=!0){let o=new CustomEvent("qti-load-item-request",{bubbles:!0,composed:!0,detail:{href:r,promise:null,cancelPreviousRequest:i}});return this.dispatchEvent(o),o.detail.promise}}return t};var rs=s=>{class t extends s{constructor(...r){super(...r),this._testContext={...this._testContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this._testContext={...this._testContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("_testContext")&&this._updateElementView()}_updateElementView(){if(this.testElement&&this.testElement.el){Array.from(this.testElement.el.querySelectorAll("[view]")).forEach(o=>{o.classList.toggle("show",o.getAttribute("view")===this._testContext.view)});let i=this.testElement.el.querySelector(`qti-assessment-item[identifier="${this._testContext.navItemId}"]`);i&&i.showCorrectResponse(this._testContext.view==="scorer")}}_setCorrectResponseVisibility(r){r.showCorrectResponse(this._testContext.view==="scorer")}}return t};var Pe=class extends v{constructor(){super();this._testContext={items:[],testOutcomeVariables:[]};this.testElement={el:null};this._updateItemInTestContext=e=>{let{identifier:r,variables:i}=e,o=this._testContext.items.find(n=>n?.identifier===r);if(!o){console.warn(`Item IDs between assessment.xml and item.xml should match: ${r} is not found!`);return}o.variables?.length===1?this._updateItemVariablesInTestContext(r,i):e.variables=[...o.variables||[]]};this.addEventListener("qti-assessment-test-connected",e=>{let r=e.detail,i=Array.from(r.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testElement={el:r},this._testContext={...this._testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",e=>{this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-outcome-changed",e=>{let r=e.composedPath()[0];this._updateItemVariablesInTestContext(r.identifier,r.variables)})}get context(){return this._testContext}set context(e){e!=null&&(this._testContext={...e},e.items?.forEach(r=>{let i=this._testContext.items.find(o=>o.identifier===r.identifier);i?i.variables=r.variables:this._testContext.items.push(r)}))}_updateItemVariablesInTestContext(e,r){this._testContext={...this._testContext,items:this._testContext.items.map(i=>i.identifier!==e?i:{...i,variables:r.map(o=>{let n=i.variables.find(a=>a.identifier===o.identifier);return n?{...n,...o}:o})})}}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-test","")}};l([q(),Ie({context:F})],Pe.prototype,"_testContext",2),l([q(),Ie({context:tr})],Pe.prototype,"testElement",2);var ir=class extends es(ts(rs(Pe))){render(){return h`<slot></slot>`}};ir=l([u("qti-test")],ir);var is=b`
|
|
23
|
+
</xsl:stylesheet>`;function pr(n,s,e){n.querySelectorAll(s).forEach(t=>{let r=`${s}-${e}`,i=hr(t,r);t.replaceWith(i)})}function mr(n,s){n.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(r=>{if(r.startsWith(`${s}:`)){let i=r.slice(`${s}:`.length),l=`${e.nodeName}-${i}`,a=hr(e,l);e.replaceWith(a)}})})}function hr(n,s){let e=document.createElement(s);for(let t of n.attributes)e.setAttribute(t.name,t.value);for(;n.firstChild;)e.appendChild(n.firstChild);return e}function ur(n){let s=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),r=e.getAttribute("href"),i=e.getAttribute("category");s.push({identifier:t,href:r,category:i})}),s}var St=null;function re(n,s=!1){return s&&St!==null&&St.abort(),new Promise((e,t)=>{let r=new XMLHttpRequest;St=r,r.open("GET",n,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?e(r.responseXML):t(r.statusText)},r.onerror=()=>{t(r.statusText)},r.send()})}function ie(n){return new DOMParser().parseFromString(n,"text/xml")}function oe(n){let s=new XSLTProcessor,e=new DOMParser().parseFromString(ki,"text/xml");return s.importStylesheet(e),s.transformToFragment(n,document)}function Qe(n,s){s.endsWith("/")||(s+="/"),n.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let r=e.getAttribute(t)?.trim();if(!r.startsWith("data:")&&!r.startsWith("http")){let i=s+encodeURI(r);e.setAttribute(t,i)}})}function gr(n){n.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function br(n){n.querySelectorAll("qti-stylesheet").forEach(s=>s.remove())}var z=()=>{let n,s={async load(e,t=!1){return new Promise(r=>{re(e,t).then(i=>(n=i,s.path(e.substring(0,e.lastIndexOf("/"))),r(s)))})},parse(e){return n=ie(e),s},path:e=>(Qe(n,e),s),fn(e){return e(n),s},pciHooks(e){let t=["hook","module"],r=e.substring(0,e.lastIndexOf("/"));for(let i of t)n.querySelectorAll("["+i+"]").forEach(a=>{let c=a.getAttribute(i);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",r+"/"+encodeURI(c+(c.endsWith(".js")?"":".js"))))});return s},extendElementName:(e,t)=>(pr(n,e,t),s),extendElementsWithClass:(e="extend")=>(mr(n,e),s),customInteraction(e,t){let r=n.querySelector("qti-custom-interaction"),i=r.querySelector("object");return r.setAttribute("data-base-ref",e),r.setAttribute("data-base-item",e+t),r.setAttribute("data",i.getAttribute("data")),r.setAttribute("width",i.getAttribute("width")),r.setAttribute("height",i.getAttribute("height")),r.removeChild(i),s},convertCDATAtoComment(){return gr(n),s},stripStyleSheets(){return br(n),s},html(){return new XMLSerializer().serializeToString(oe(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(){return oe(n)},xmlDoc(){return n}};return s};var fr=()=>{let n,s={async load(e){return new Promise(t=>{re(e).then(r=>(n=r,t(s)))})},parse(e){n=ie(e)},assessmentTest(){let e=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return s};var se=()=>{let n,s={async load(e){return new Promise((t,r)=>{re(e).then(i=>(n=i,s.path(e.substring(0,e.lastIndexOf("/"))),t(s)))})},parse(e){return n=ie(e),s},path:e=>(Qe(n,e),s),fn(e){return e(n),s},items(){return ur(n)},html(){return new XMLSerializer().serializeToString(oe(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(){return oe(n)},xmlDoc(){return n}};return s};var vr=n=>{class s extends n{constructor(...t){super(...t),this.addEventListener("qti-assessment-test-connected",()=>{}),this.addEventListener("qti-load-item-request",({detail:r})=>{r.promise=(async()=>(await z().load(`${r.href}`,r.cancelPreviousRequest)).htmlDoc())()}),this.addEventListener("qti-interaction-changed",r=>{}),this.addEventListener("qti-outcome-changed",()=>{})}}return s};var yr=n=>{class s extends n{constructor(...t){super(...t),this.addEventListener("qti-request-test-item",({detail:r})=>{if(!r)return;this._clearLoadedItems();let i=this.testElement.el.querySelector(`qti-assessment-item-ref[identifier="${r}"]`),l=this._loadItemRequest(i.href,!1),a=i.closest("qti-test-part").identifier,c=i.closest("qti-assessment-section").identifier;this._testContext={...this._testContext,navPartId:a,navSectionId:c,navItemId:r,navItemLoading:!0},l?l.then(d=>{i.xmlDoc=d,requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0}))),this._testContext={...this._testContext,navItemLoading:!1}}).catch(d=>console.error("Failed to load item:",d)):console.info("Load item request was not handled:",i.href)}),this.addEventListener("qti-assessment-test-connected",()=>{let r=this._testContext.navItemId;r||(r=this.testElement.el.querySelector("qti-assessment-item-ref").identifier),this.dispatchEvent(new CustomEvent("qti-request-test-item",{detail:r,bubbles:!0,composed:!0}))})}_clearLoadedItems(){let t=this.testElement.el.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t).forEach(r=>{r.xmlDoc=null})}_loadItemRequest(t,r=!0){let i=new CustomEvent("qti-load-item-request",{bubbles:!0,composed:!0,detail:{href:t,promise:null,cancelPreviousRequest:r}});return this.dispatchEvent(i),i.detail.promise}}return s};var qr=n=>{class s extends n{constructor(...t){super(...t),this._testContext={...this._testContext,view:"candidate"},this.addEventListener("on-test-switch-view",r=>{this._testContext={...this._testContext,view:r.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(t){super.willUpdate(t),t.has("_testContext")&&this._updateElementView()}_updateElementView(){if(this.testElement&&this.testElement.el){Array.from(this.testElement.el.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this._testContext.view)});let r=this.testElement.el.querySelector(`qti-assessment-item[identifier="${this._testContext.navItemId}"]`);r&&r.showCorrectResponse(this._testContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this._testContext.view==="scorer")}}return s};import{provide as wr}from"@lit/context";import{LitElement as Ti}from"lit";import{state as Er}from"lit/decorators.js";import{createContext as xr}from"@lit/context";var S=xr(Symbol("test")),et=xr(Symbol("testElement"));var ae=class extends Ti{constructor(){super();this._testContext={items:[],testOutcomeVariables:[]};this.testElement={el:null};this._updateItemInTestContext=e=>{let{identifier:t,variables:r}=e,i=this._testContext.items.find(l=>l?.identifier===t);if(!i){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}i.variables?.length===1?this._updateItemVariablesInTestContext(t,r):e.variables=[...i.variables||[]]};this.addEventListener("qti-assessment-test-connected",e=>{let t=e.detail,r=Array.from(t.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testElement={el:t},this._testContext={...this._testContext,items:r}}),this.addEventListener("qti-assessment-item-connected",e=>{this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-outcome-changed",e=>{let t=e.composedPath()[0];this._updateItemVariablesInTestContext(t.identifier,t.variables)})}get context(){return this._testContext}set context(e){e!=null&&(this._testContext={...e},e.items?.forEach(t=>{let r=this._testContext.items.find(i=>i.identifier===t.identifier);r?r.variables=t.variables:this._testContext.items.push(t)}))}_updateItemVariablesInTestContext(e,t){this._testContext={...this._testContext,items:this._testContext.items.map(r=>r.identifier!==e?r:{...r,variables:t.map(i=>{let l=r.variables.find(a=>a.identifier===i.identifier);return l?{...l,...i}:i})})}}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-test","")}};o([Er(),wr({context:S})],ae.prototype,"_testContext",2),o([Er(),wr({context:et})],ae.prototype,"testElement",2);var tt=class extends vr(yr(qr(ae))){render(){return Mi`<slot></slot>`}};tt=o([Si("qti-test")],tt);import{consume as Li}from"@lit/context";import{html as _i,LitElement as Ai}from"lit";import{property as ne}from"lit/decorators.js";var Cr={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},L=class extends Ai{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return _i`${this.xmlDoc}`}};o([ne({type:String})],L.prototype,"category",2),o([ne({type:String})],L.prototype,"identifier",2),o([ne({type:Boolean,converter:Cr})],L.prototype,"required",2),o([ne({type:Boolean,converter:Cr})],L.prototype,"fixed",2),o([ne({type:String})],L.prototype,"href",2),o([Li({context:S,subscribe:!0})],L.prototype,"_testContext",2),o([ne({type:Object,attribute:!1})],L.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",L);import{consume as Ri}from"@lit/context";import{html as Di,LitElement as Ii}from"lit";import{property as le}from"lit/decorators.js";var Lt={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},_=class extends Ii{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return Di`<slot name="qti-rubric-block"></slot><slot></slot>`}};o([le({type:String})],_.prototype,"identifier",2),o([le({type:String})],_.prototype,"required",2),o([le({type:Boolean,converter:Lt})],_.prototype,"fixed",2),o([le({type:String})],_.prototype,"title",2),o([le({type:Boolean,converter:Lt})],_.prototype,"visible",2),o([le({type:Boolean,converter:Lt,attribute:"keep-together"})],_.prototype,"keepTogether",2),o([Ri({context:S,subscribe:!0})],_.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",_);import{consume as Vi}from"@lit/context";import{html as Hi,LitElement as Ni}from"lit";import{customElement as $i,property as kr}from"lit/decorators.js";var Q=class extends Ni{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return Hi` <slot></slot>`}};o([kr({type:String})],Q.prototype,"identifier",2),o([kr({type:String})],Q.prototype,"title",2),o([Vi({context:S,subscribe:!0})],Q.prototype,"_testContext",2),Q=o([$i("qti-assessment-test")],Q);import{html as zi,LitElement as Oi}from"lit";import{customElement as Fi,property as Te}from"lit/decorators.js";var A=class extends Oi{constructor(){super(...arguments);this.identifier="";this.title="";this.class="";this.NavigationMode="nonlinear";this.submissionMode="individual"}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return zi` <slot></slot>`}};o([Te({type:String})],A.prototype,"identifier",2),o([Te({type:String})],A.prototype,"title",2),o([Te({type:String})],A.prototype,"class",2),o([Te({type:String,attribute:"navigation-mode"})],A.prototype,"NavigationMode",2),o([Te({type:String,attribute:"submission-mode"})],A.prototype,"submissionMode",2),A=o([Fi("qti-test-part")],A);customElements.get("qti-test-part")||customElements.define("qti-test-part",A);import{consume as Mr}from"@lit/context";import{LitElement as Ui}from"lit";import{state as Sr}from"lit/decorators.js";function rt(n,s){let e;return(t,r)=>{let{connectedCallback:i,disconnectedCallback:l}=t;t.connectedCallback=function(){i.call(this);let a=d=>{let p=Array.from(this.querySelectorAll(n)).concat(Array.from(this.shadowRoot?.querySelectorAll(n)||[]));for(let m of d){let h=Array.from(m.addedNodes).map(y=>y),b=Array.from(m.addedNodes).map(y=>y);m.type==="childList"&&h.find(y=>p.includes(y))&&this[r](h,b)}};e=new MutationObserver(a),e.observe(this,{childList:!0,subtree:!0});let c=Array.from(this.querySelectorAll(n)).concat(Array.from(this.shadowRoot?.querySelectorAll(n)||[]));this[r](Array.from(c),[])},t.disconnectedCallback=function(){l.call(this),e.disconnect()}}}function v(n,s){let e={waitUntilFirstUpdate:!1,...s};return(t,r)=>{let{update:i}=t,l=Array.isArray(n)?n:[n];t.update=function(a){l.forEach(c=>{let d=c;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[r](p,m)}}),i.call(this,a)}}}import{property as Pi}from"lit/decorators.js";function Tr(n){return(s,e)=>{Pi(n)(s,e);let t=`__${e}`;Object.defineProperty(s,e,{get(){return this[t]},set(r){let i=this[t];if(this[t]=r,i!==r){if(this._internals?.states){let l=e.toLowerCase();r?this._internals.states.add(`--${l}`):this._internals.states.delete(`--${l}`)}if(n.aria&&this._internals){let l=n.aria;r?this._internals[l]="true":this._internals[l]=null}this.requestUpdate(e,i)}},configurable:!0,enumerable:!0})}}var q=class extends Ui{constructor(){super();this.disabled=!0;this._internals=this.attachInternals()}_handleTestElementChange(e,t){t.el&&(this.disabled=!1)}willUpdate(e){if(e.has("_testContext")){let{items:t=[],navItemId:r}=this._testContext??{};this.itemIndex=t.findIndex(i=>i.identifier===r),this.items=t,this.view=this._testContext?.view}}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-test-item",{composed:!0,bubbles:!0,detail:e}))}};o([Tr({type:Boolean,reflect:!0,aria:"ariaDisabled"})],q.prototype,"disabled",2),o([Sr(),Mr({context:S,subscribe:!0})],q.prototype,"_testContext",2),o([Sr(),Mr({context:et,subscribe:!0})],q.prototype,"_testElement",2),o([v("_testElement")],q.prototype,"_handleTestElementChange",1);import{css as Xi,html as Bi}from"lit";import{customElement as ji}from"lit/decorators.js";import{css as it}from"lit";var Lr=it`
|
|
27
24
|
display: inline-flex;
|
|
28
25
|
align-items: center;
|
|
29
26
|
cursor: pointer;
|
|
30
27
|
padding: 0.5rem 1rem;
|
|
31
28
|
border-radius: 0.25rem;
|
|
32
29
|
user-select: none;
|
|
33
|
-
`,
|
|
30
|
+
`,ce=it`
|
|
34
31
|
background-color: lightgray;
|
|
35
|
-
${
|
|
36
|
-
`,
|
|
32
|
+
${Lr};
|
|
33
|
+
`,de=it`
|
|
37
34
|
cursor: not-allowed;
|
|
38
35
|
opacity: 0.5;
|
|
39
|
-
`,
|
|
40
|
-
${
|
|
36
|
+
`,Wc=it`
|
|
37
|
+
${Lr};
|
|
41
38
|
border: 1px solid gray;
|
|
42
|
-
`;
|
|
39
|
+
`;var Me=class extends q{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",s=>{s.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex+1].identifier)})}willUpdate(s){super.willUpdate(s),s.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex<0||this.itemIndex>=this.items.length-1)}render(){return Bi`<slot></slot>`}};Me.styles=Xi`
|
|
43
40
|
:host {
|
|
44
|
-
${
|
|
41
|
+
${ce};
|
|
45
42
|
}
|
|
46
43
|
:host([disabled]) {
|
|
47
|
-
${
|
|
44
|
+
${de};
|
|
48
45
|
}
|
|
49
|
-
`,
|
|
46
|
+
`,Me=o([ji("test-next")],Me);import{css as Wi,html as Yi}from"lit";import{customElement as Ki}from"lit/decorators.js";var Se=class extends q{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",s=>{s.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex-1].identifier)})}willUpdate(s){super.willUpdate(s),s.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex===0||this.itemIndex===-1)}render(){return Yi`<slot></slot>`}};Se.styles=Wi`
|
|
50
47
|
:host {
|
|
51
|
-
${
|
|
48
|
+
${ce};
|
|
52
49
|
}
|
|
53
50
|
:host([disabled]) {
|
|
54
|
-
${
|
|
51
|
+
${de};
|
|
55
52
|
}
|
|
56
|
-
`,
|
|
53
|
+
`,Se=o([Ki("test-prev")],Se);import{html as _r}from"lit";import{customElement as Gi,property as Ar,state as Ji}from"lit/decorators.js";var w=class extends q{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=w.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>w.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=w.DEFAULT_VIEW_OPTIONS}render(){return _r`
|
|
57
54
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
58
55
|
<select
|
|
59
56
|
part="select"
|
|
60
57
|
id="viewSelect"
|
|
61
58
|
.disabled=${this.disabled}
|
|
62
|
-
@change=${e=>{let
|
|
59
|
+
@change=${e=>{let t=e.target;this._switchView(t.value)}}
|
|
63
60
|
>
|
|
64
|
-
${this._viewOptions.map(e=>
|
|
61
|
+
${this._viewOptions.map(e=>_r`<option value="${e}" ?selected=${e===this.view}>${e}</option>`)}
|
|
65
62
|
</select>
|
|
66
|
-
`}};
|
|
63
|
+
`}};w.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],o([Ar({type:String})],w.prototype,"label",2),o([Ar({type:String,attribute:"view-options"})],w.prototype,"viewOptions",2),o([v("viewOptions",{waitUntilFirstUpdate:!0})],w.prototype,"_handleViewOptionsChange",2),o([Ji()],w.prototype,"_viewOptions",2),w=o([Gi("test-view")],w);import{css as Zi,html as Qi}from"lit";import{customElement as eo,property as to}from"lit/decorators.js";var pe=class extends q{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}render(){return Qi` <slot></slot> `}};pe.styles=Zi`
|
|
67
64
|
:host {
|
|
68
|
-
${
|
|
65
|
+
${ce};
|
|
69
66
|
}
|
|
70
67
|
:host([disabled]) {
|
|
71
|
-
${
|
|
68
|
+
${de};
|
|
72
69
|
}
|
|
73
|
-
`,
|
|
70
|
+
`,o([to({type:String,attribute:"item-id"})],pe.prototype,"itemId",2),pe=o([eo("test-item-link")],pe);import{LitElement as io,html as At}from"lit";import{customElement as oo,property as so,state as Rr}from"lit/decorators.js";import{until as ao}from"lit/directives/until.js";var ot=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
74
71
|
|
|
75
72
|
:root,
|
|
76
73
|
:host {
|
|
@@ -2221,12 +2218,12 @@ qti-response-declaration {
|
|
|
2221
2218
|
&[enabled] {
|
|
2222
2219
|
|
|
2223
2220
|
/* Light theme override */
|
|
2224
|
-
.qti-selections-light
|
|
2221
|
+
.qti-selections-light {
|
|
2225
2222
|
background-color: var(--qti-light-bg-active);
|
|
2226
2223
|
}
|
|
2227
2224
|
|
|
2228
2225
|
/* Dark theme override */
|
|
2229
|
-
.qti-selections-dark
|
|
2226
|
+
.qti-selections-dark {
|
|
2230
2227
|
background-color: var(--qti-dark-bg-active);
|
|
2231
2228
|
}
|
|
2232
2229
|
background-color: var(--qti-bg-active)
|
|
@@ -2235,13 +2232,13 @@ qti-response-declaration {
|
|
|
2235
2232
|
&[active] {
|
|
2236
2233
|
|
|
2237
2234
|
/* Light theme override */
|
|
2238
|
-
.qti-selections-light
|
|
2235
|
+
.qti-selections-light {
|
|
2239
2236
|
background-color: var(--qti-light-bg-active);
|
|
2240
2237
|
border-color: var(--qti-light-border-active);
|
|
2241
2238
|
}
|
|
2242
2239
|
|
|
2243
2240
|
/* Dark theme override */
|
|
2244
|
-
.qti-selections-dark
|
|
2241
|
+
.qti-selections-dark {
|
|
2245
2242
|
background-color: var(--qti-dark-bg-active);
|
|
2246
2243
|
border-color: var(--qti-dark-border-active);
|
|
2247
2244
|
}
|
|
@@ -2438,12 +2435,12 @@ qti-response-declaration {
|
|
|
2438
2435
|
&[enabled] {
|
|
2439
2436
|
|
|
2440
2437
|
/* Light theme override */
|
|
2441
|
-
.qti-selections-light
|
|
2438
|
+
.qti-selections-light {
|
|
2442
2439
|
border-color: var(--qti-light-border-active);
|
|
2443
2440
|
}
|
|
2444
2441
|
|
|
2445
2442
|
/* Dark theme override */
|
|
2446
|
-
.qti-selections-dark
|
|
2443
|
+
.qti-selections-dark {
|
|
2447
2444
|
border-color: var(--qti-dark-border-active);
|
|
2448
2445
|
}
|
|
2449
2446
|
background-color: var(--qti-bg-active)
|
|
@@ -2452,13 +2449,13 @@ qti-response-declaration {
|
|
|
2452
2449
|
&[active] {
|
|
2453
2450
|
|
|
2454
2451
|
/* Light theme override */
|
|
2455
|
-
.qti-selections-light
|
|
2452
|
+
.qti-selections-light {
|
|
2456
2453
|
background-color: var(--qti-light-bg-active);
|
|
2457
2454
|
border-color: var(--qti-light-border-active);
|
|
2458
2455
|
}
|
|
2459
2456
|
|
|
2460
2457
|
/* Dark theme override */
|
|
2461
|
-
.qti-selections-dark
|
|
2458
|
+
.qti-selections-dark {
|
|
2462
2459
|
background-color: var(--qti-dark-bg-active);
|
|
2463
2460
|
border-color: var(--qti-dark-border-active);
|
|
2464
2461
|
}
|
|
@@ -3113,12 +3110,12 @@ qti-response-declaration {
|
|
|
3113
3110
|
&[enabled] {
|
|
3114
3111
|
|
|
3115
3112
|
/* Light theme override */
|
|
3116
|
-
.qti-selections-light
|
|
3113
|
+
.qti-selections-light {
|
|
3117
3114
|
border-color: var(--qti-light-border-active);
|
|
3118
3115
|
}
|
|
3119
3116
|
|
|
3120
3117
|
/* Dark theme override */
|
|
3121
|
-
.qti-selections-dark
|
|
3118
|
+
.qti-selections-dark {
|
|
3122
3119
|
border-color: var(--qti-dark-border-active);
|
|
3123
3120
|
}
|
|
3124
3121
|
background-color: var(--qti-bg-active)
|
|
@@ -3592,34 +3589,33 @@ qti-response-declaration {
|
|
|
3592
3589
|
width: 100%;
|
|
3593
3590
|
}
|
|
3594
3591
|
}
|
|
3595
|
-
`;var
|
|
3592
|
+
`;var O=class extends io{constructor(){super(...arguments);this.testURL=null;this.testDoc=null;this.testXML=null;this.templateContent=null}async handleTestURLChange(){if(this.testURL)try{let e=await se().load(this.testURL);this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=se().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:At``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(ot),this.shadowRoot.adoptedStyleSheets=[e]}render(){return At`
|
|
3596
3593
|
${this.templateContent}
|
|
3597
3594
|
<slot></slot>
|
|
3598
|
-
${
|
|
3599
|
-
`}};
|
|
3600
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ur=class{constructor(t){P(this,"_input");P(this,"_index",-1);P(this,"_tokenStart",0);P(this,"_next");this._input=t,this._advance()}nextToken(){for(;xo(this._next);)this._advance(!0);if(wo(this._next))return this._tokenizeString();if(gs(this._next))return this._tokenizeIdentOrKeyword();if(yt(this._next))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(Co(this._next))return this._tokenizeOperator();if(_o(this._next))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw new Error(`Expected end of input, got ${this._next}`)}_advance(t){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),t===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(t=0){let e=this._input.substring(this._tokenStart,this._index+t);return t===0&&this._clearValue(),e}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let t="unterminated string",e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0)throw new Error(t);if(this._next===92&&(this._advance(),this._next===void 0))throw new Error(t);this._advance()}let r=G(E.STRING,ko(this._getValue()));return this._advance(),r}_tokenizeIdentOrKeyword(){do this._advance();while(qo(this._next));let t=this._getValue(),e=Eo(t)?E.KEYWORD:E.IDENTIFIER;return G(e,t)}_tokenizeNumber(){do this._advance();while(yt(this._next));return this._next===46?this._tokenizeDot():G(E.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),yt(this._next)?this._tokenizeFraction():(this._clearValue(),G(E.DOT,".",hr))}_tokenizeComma(){return this._advance(!0),G(E.COMMA,",")}_tokenizeColon(){return this._advance(!0),G(E.COLON,":")}_tokenizeFraction(){do this._advance();while(yt(this._next));return G(E.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let t=this._getValue(2);if(yo.indexOf(t)!==-1)this._advance(),this._advance();else{if(t=this._getValue(1),t==="=>")return this._advance(),G(E.ARROW,t);vo.indexOf(t)!==-1&&this._advance()}return t=this._getValue(),G(E.OPERATOR,t,Kr[t])}_tokenizeGrouper(){let t=String.fromCharCode(this._next),e=G(E.GROUPER,t,Kr[t]);return this._advance(!0),e}};var Jr=(s,t)=>new xt(s,t).parse(),xt=class{constructor(t,e){P(this,"_kind");P(this,"_tokenizer");P(this,"_ast");P(this,"_token");P(this,"_value");this._tokenizer=new ur(t),this._ast=e}parse(){return this._advance(),this._parseExpression()}_advance(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this._token?.kind} (${this._token?.value})`);let r=this._tokenizer.nextToken();this._token=r,this._kind=r?.kind,this._value=r?.value}_matches(t,e){return!(t&&this._kind!==t||e&&this._value!==e)}_parseExpression(){if(!this._token)return this._ast.empty();let t=this._parseUnary();return t===void 0?void 0:this._parsePrecedence(t,0)}_parsePrecedence(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(E.GROUPER,"(")){let r=this._parseArguments();t=this._ast.invoke(t,void 0,r)}else if(this._matches(E.GROUPER,"[")){let r=this._parseIndex();t=this._ast.index(t,r)}else if(this._matches(E.DOT)){this._advance();let r=this._parseUnary();t=this._makeInvokeOrGetter(t,r)}else{if(this._matches(E.KEYWORD))break;if(this._matches(E.OPERATOR)&&this._token.precedence>=e)t=this._value==="?"?this._parseTernary(t):this._parseBinary(t,this._token);else break}return t}_makeInvokeOrGetter(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this._ast.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this._ast.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}_parseBinary(t,e){if(ms.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===E.OPERATOR||this._kind===E.DOT||this._kind===E.GROUPER)&&this._token.precedence>e.precedence;)r=this._parsePrecedence(r,this._token.precedence);return this._ast.binary(t,e.value,r)}_parseUnary(){if(this._matches(E.OPERATOR)){let t=this._value;if(this._advance(),t==="+"||t==="-"){if(this._matches(E.INTEGER))return this._parseInteger(t);if(this._matches(E.DECIMAL))return this._parseDecimal(t)}if(us.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this._parsePrecedence(this._parsePrimary(),hr);return this._ast.unary(t,e)}return this._parsePrimary()}_parseTernary(t){this._advance(E.OPERATOR,"?");let e=this._parseExpression();this._advance(E.COLON);let r=this._parseExpression();return this._ast.ternary(t,e,r)}_parsePrimary(){switch(this._kind){case E.KEYWORD:let t=this._value;if(t==="this")return this._advance(),this._ast.id(t);throw pr.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case E.IDENTIFIER:return this._parseInvokeOrIdentifier();case E.STRING:return this._parseString();case E.INTEGER:return this._parseInteger();case E.DECIMAL:return this._parseDecimal();case E.GROUPER:return this._value==="("?this._parseParenOrFunction():this._value==="{"?this._parseMap():this._value==="["?this._parseList():void 0;case E.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){let t=[];do{if(this._advance(),this._matches(E.GROUPER,"]"))break;t.push(this._parseExpression())}while(this._matches(E.COMMA));return this._advance(E.GROUPER,"]"),this._ast.list(t)}_parseMap(){let t={};do{if(this._advance(),this._matches(E.GROUPER,"}"))break;let e=this._value;(this._matches(E.STRING)||this._matches(E.IDENTIFIER))&&this._advance(),this._advance(E.COLON),t[e]=this._parseExpression()}while(this._matches(E.COMMA));return this._advance(E.GROUPER,"}"),this._ast.map(t)}_parseInvokeOrIdentifier(){let t=this._value;if(t==="true")return this._advance(),this._ast.literal(!0);if(t==="false")return this._advance(),this._ast.literal(!1);if(t==="null")return this._advance(),this._ast.literal(null);if(t==="undefined")return this._advance(),this._ast.literal(void 0);let e=this._parseIdentifier(),r=this._parseArguments();return r?this._ast.invoke(e,void 0,r):e}_parseIdentifier(){if(!this._matches(E.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);let t=this._value;return this._advance(),this._ast.id(t)}_parseArguments(){if(!this._matches(E.GROUPER,"("))return;let t=[];do{if(this._advance(),this._matches(E.GROUPER,")"))break;let e=this._parseExpression();t.push(e)}while(this._matches(E.COMMA));return this._advance(E.GROUPER,")"),t}_parseIndex(){this._advance();let t=this._parseExpression();return this._advance(E.GROUPER,"]"),t}_parseParenOrFunction(){let t=this._parseArguments();if(this._matches(E.ARROW)){this._advance();let e=this._parseExpression(),r=t?.map(i=>i.value)??[];return this._ast.arrowFunction(r,e)}else return this._ast.paren(t[0])}_parseString(){let t=this._ast.literal(this._value);return this._advance(),t}_parseInteger(t=""){let e=this._ast.literal(parseInt(`${t}${this._value}`,10));return this._advance(),e}_parseDecimal(t=""){let e=this._ast.literal(parseFloat(`${t}${this._value}`));return this._advance(),e}};var To={"+":(s,t)=>s+t,"-":(s,t)=>s-t,"*":(s,t)=>s*t,"/":(s,t)=>s/t,"%":(s,t)=>s%t,"==":(s,t)=>s==t,"!=":(s,t)=>s!=t,"===":(s,t)=>s===t,"!==":(s,t)=>s!==t,">":(s,t)=>s>t,">=":(s,t)=>s>=t,"<":(s,t)=>s<t,"<=":(s,t)=>s<=t,"||":(s,t)=>s||t,"&&":(s,t)=>s&&t,"??":(s,t)=>s??t,"|":(s,t)=>t(s),"|>":(s,t)=>t(s)},Ao={"+":s=>s,"-":s=>-s,"!":s=>!s},mr=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Ao[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=To[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(o){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(o),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),c=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,c=this.left.value),a===void 0?void 0:a[c]=n}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),n=this.method?o:i?.this??i,a=this.method?o?.[e]:o,d=(this.arguments??[]).map(m=>m?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let o=this.entries[i];o&&(r[i]=o.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,o=this.body;return function(...n){let a=Object.fromEntries(i.map((d,m)=>[d,n[m]])),c=new Proxy(r??{},{set(d,m,g){return a.hasOwnProperty(m)&&(a[m]=g),d[m]=g},get(d,m){return a.hasOwnProperty(m)?a[m]:d[m]}});return o.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Zr=null,fs={boundAttributeSuffix:R.M,marker:R.P,markerMatch:R.A,HTML_RESULT:R.C,getTemplateHtml:R.L,overrideDirectiveResolve:(s,t)=>class extends s{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(s,t)=>{if(s.prototype._$AS!==t){Zr??(Zr=s.prototype._$AS.name);for(let e=s.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Zr))return void(e[Zr]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(s,t){s._$litDirective$=t},getAttributePartCommittedValue:(s,t,e)=>{let r=M;return s.j=i=>r=i,s._$AI(t,s,e),r},connectedDisconnectable:s=>({...s,_$AU:!0}),resolveDirective:R.V,AttributePart:R.H,PropertyPart:R.B,BooleanAttributePart:R.N,EventPart:R.U,ElementPart:R.F,TemplateInstance:R.R,isIterable:R.D,ChildPart:R.I};var{AttributePart:So,PropertyPart:Mo,BooleanAttributePart:Ro,EventPart:Lo}=fs,ei=new mr,Qr=new Map,bs=s=>s.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),gr=(s,t)=>{let e=Qr.get(s);if(e===void 0){if(Qr.has(s))return;if(s=s.trim(),s.startsWith("{{")&&s.endsWith("}}")){let r=s.substring(2,s.length-2).trim();e=new xt(r,ei).parse(),Qr.set(s,e)}}return e?.evaluate(t)},$o=(s,t,e,r)=>{let i=s.getAttribute("if");if(i!==null&&gr(i,t))return fr(s,t,e,r)},vs=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,ys=s=>/(?:\\{{)|(?:\\}})/g.test(s),qt=s=>s.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Do=(s,t,e,r)=>{let i=s.getAttribute("repeat");if(i!==null){let o=gr(i,t);if(!o[Symbol.iterator])return k;let n=Et(s),a=-1,c=[];for(let d of o){a++;let m=Object.create(t);m.item=d,m.index=a,m.this=t.this??t;let g=[];for(let y of n.parts){let x=y.update(m,e,r);y.type===1?g.push(...x):g.push(x)}let f={_$litType$:n,values:g};c.push(f)}return c}},qs={if:$o,repeat:Do},Es=(s,t=qs,e={},r)=>{let o=Et(s).renderers;if(r){let a=Et(r).renderers,c=o.super;c!==void 0?e={...o,...e,super:(d,m,g)=>(g={...a,...g,super:(f,y,x)=>fr(r,f,y,x)},c(d,m,g))}:(e={...a,...o,...e},s=r)}else e={...o,...e};return n=>fr(s,n,t,e)};var fr=(s,t,e=qs,r={})=>{let i=Et(s),o=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?o.push(...c):o.push(c)}return{_$litType$:i,values:o}},xs=new Map,Et=s=>{let t=xs.get(s);return t===void 0&&xs.set(s,t=Io(s)),t},Io=s=>{let t={h:void 0,el:s.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,o=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.ELEMENT_NODE){i++;let n=r;if(n.tagName==="TEMPLATE"){let c=n.getAttribute("type"),d=n.getAttribute("name"),m=n.getAttribute("call");if(m!==null||c!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),o.push(n);let g;if(m!==null){let f=m.trim(),y=f.startsWith("{{")&&f.endsWith("}}");g=(x,C,S)=>{let D=n.getAttribute("data"),st=D===null?void 0:gr(D,x);return(y?gr(f,x):S[m])?.(st,C,S)}}else c!==null?g=(f,y,x)=>{let C=y[c];return C?.(n,f,y,x)}:(d==="super"?t.renderers.super=(f,y,x)=>{let C=x.super,S=Et(n);return x={...x,...S.renderers},C(f,y,x)}:t.renderers[d]=(f,y,x)=>fr(n,f,y,x),g=(f,y,x)=>{let C=x[d];return C?.(f,y,x)});t.parts.push({type:2,index:i,update:g});continue}}let a=n.getAttributeNames();for(let c of a){let d=n.getAttribute(c),m=d.split(vs);if(m.length===1){ys(d)&&n.setAttribute(c,qt(d));continue}n.removeAttribute(c);let g=c,f=So,y=c[0];y==="."?(g=bs(c.substring(1)),f=Mo):y==="?"?(g=c.substring(1),f=Ro):y==="@"&&(g=bs(c.substring(1)),f=Lo);let x=[qt(m[0])],C=[];for(let S=1;S<m.length;S+=2){let D=m[S];C.push(Jr(D,ei)),x.push(qt(m[S+1]))}t.parts.push({type:1,index:i,name:g,strings:x,ctor:f,update:(S,D,st)=>C.map(he=>he.evaluate(S))})}}else if(r.nodeType===Node.TEXT_NODE){let n=r,a=n.textContent,c=a.split(vs);c.length>1?n.textContent=qt(c[0]):ys(a)&&(n.textContent=qt(a));for(let d=1;d<c.length;d+=2){let m=c[d],g=Jr(m,ei);t.parts.push({type:2,index:++i,update:(y,x)=>g.evaluate(y)});let f=new Text(c[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of o)n.remove();return t};var je=class extends L{constructor(){super();this.maxDisplayedItems=2;this.skipOnCategory="dep-informational";this._internals.ariaLabel="pagination"}createRenderRoot(){return this}render(){let e=this._testContext.items.reduce((a,c)=>{let m=c.category?.split(" ").includes(this.skipOnCategory)?"i":a.counter++;return a.result.push({...c,newIndex:m}),a},{counter:0,result:[]}).result,r=e.findIndex(a=>a.identifier===this._testContext.navItemId),i=Math.max(0,r-this.maxDisplayedItems),o=Math.min(e.length,r+this.maxDisplayedItems+1),n=e.slice(i,o);return h`
|
|
3601
|
-
|
|
3602
|
-
`}};l([p({type:Number,attribute:"max-displayed-items"})],je.prototype,"maxDisplayedItems",2),l([p({type:String,attribute:"skip-on-category"})],je.prototype,"skipOnCategory",2),je=l([u("test-paging-buttons-stamp")],je);var br=class extends v{render(){return h`<slot></slot>`}};br=l([u("qti-item")],br);var ae=class extends v{constructor(){super(...arguments);this.itemURL=null;this.itemDoc=null;this.itemXML=null;this.templateContent=null}async handleItemURLChange(){if(this.itemURL)try{let e=await Me().load(this.itemURL);this.itemDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Me().parse(this.itemXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:h``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(dr),this.shadowRoot.adoptedStyleSheets=[e]}render(){return h`
|
|
3595
|
+
${ao(this.testDoc,At`<span>Loading...</span>`)}
|
|
3596
|
+
`}};o([so({type:String,attribute:"test-url"})],O.prototype,"testURL",2),o([Rr()],O.prototype,"testDoc",2),o([Rr()],O.prototype,"testXML",2),o([v("testURL",{waitUntilFirstUpdate:!0})],O.prototype,"handleTestURLChange",1),o([v("testXML",{waitUntilFirstUpdate:!0})],O.prototype,"handleTestXMLChange",1),O=o([oo("test-container")],O);import{html as no}from"lit";import{customElement as lo,property as Dr}from"lit/decorators.js";import{prepareTemplate as co}from"stampino";var me=class extends q{constructor(){super();this.maxDisplayedItems=2;this.skipOnCategory="dep-informational";this._internals.ariaLabel="pagination"}createRenderRoot(){return this}render(){let e=this._testContext.items.reduce((a,c)=>{let p=c.category?.split(" ").includes(this.skipOnCategory)?"i":a.counter++;return a.result.push({...c,newIndex:p}),a},{counter:0,result:[]}).result,t=e.findIndex(a=>a.identifier===this._testContext.navItemId),r=Math.max(0,t-this.maxDisplayedItems),i=Math.min(e.length,t+this.maxDisplayedItems+1),l=e.slice(r,i);return no`
|
|
3597
|
+
${l.map(a=>{let c=a.variables.find(ke=>ke.identifier=="SCORE"),d=parseInt(c?.value?.toString()),p=a.variables.find(ke=>ke.identifier==="completionStatus")?.value,m=a.category!==this.skipOnCategory?"regular":"info",h=this._testContext.navItemId===a.identifier,b=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d>0,y=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d<=0,f=this._testContext.view==="candidate"&&p==="completed"&&a.category!==this.skipOnCategory,Ce={...a,type:m,active:h,correct:b,incorrect:y,answered:f},Ze=this.firstElementChild;return co(Ze)({item:Ce})})}
|
|
3598
|
+
`}};o([Dr({type:Number,attribute:"max-displayed-items"})],me.prototype,"maxDisplayedItems",2),o([Dr({type:String,attribute:"skip-on-category"})],me.prototype,"skipOnCategory",2),me=o([lo("test-paging-buttons-stamp")],me);import{html as po,LitElement as mo}from"lit";import{customElement as ho}from"lit/decorators.js";var st=class extends mo{render(){return po`<slot></slot>`}};st=o([ho("qti-item")],st);import{LitElement as uo,html as Rt}from"lit";import{customElement as go,property as bo,state as Ir}from"lit/decorators.js";import{until as fo}from"lit/directives/until.js";var F=class extends uo{constructor(){super(...arguments);this.itemURL=null;this.itemDoc=null;this.itemXML=null;this.templateContent=null}async handleItemURLChange(){if(this.itemURL)try{let e=await z().load(this.itemURL);this.itemDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=z().parse(this.itemXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:Rt``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(ot),this.shadowRoot.adoptedStyleSheets=[e]}render(){return Rt`
|
|
3603
3599
|
${this.templateContent}
|
|
3604
3600
|
<slot></slot>
|
|
3605
|
-
${
|
|
3606
|
-
`}};
|
|
3601
|
+
${fo(this.itemDoc,Rt`<span>Loading...</span>`)}
|
|
3602
|
+
`}};o([bo({type:String,attribute:"item-url"})],F.prototype,"itemURL",2),o([Ir()],F.prototype,"itemDoc",2),o([Ir()],F.prototype,"itemXML",2),o([v("itemURL",{waitUntilFirstUpdate:!0})],F.prototype,"handleItemURLChange",1),o([v("itemXML",{waitUntilFirstUpdate:!0})],F.prototype,"handleItemXMLChange",1),F=o([go("item-container")],F);import{provide as yo}from"@lit/context";import{LitElement as qo,html as xo}from"lit";import{customElement as wo,property as he}from"lit/decorators.js";import{createContext as vo}from"@lit/context";var Vr=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],x=vo(Symbol("item"));var E=class extends qo{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(r=>r.readonly=t);this._context={identifier:this.getAttribute("identifier"),variables:Vr};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:t,countAttempt:r}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(r)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let r=e.find(i=>i.identifier===t.identifier);return r?{...t,...r}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let r=this._interactionElements.find(i=>i.responseIdentifier===t.identifier);r&&(r.value=t.value)}})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let i=this._interactionElements.find(l=>l.getAttribute("response-identifier")===t.responseIdentifier);i&&(i.value=t.response)}}render(){return xo`<slot></slot>`}showCorrectResponse(e){let r=this._context.variables.filter(i=>"correctResponse"in i&&i.correctResponse).map(i=>({responseIdentifier:i.identifier,response:i.correctResponse}));for(let i of r){let l=this._interactionElements.find(a=>a.getAttribute("response-identifier")===i.responseIdentifier);l&&(l.correctResponse=e?i.response:"")}}processResponse(e=!0){this.validate();let t=this.querySelector("qti-response-processing");return!t||!t.process?!1:(t.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(r=>r.identifier==="numAttempts")?.value+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:t,response:r}=e.detail;this.updateResponseVariable(t,r)}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==e?r:{...r,value:t})},this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,t){let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:r.cardinality==="single"?t:[...i.value,t]})},this._feedbackElements.forEach(i=>i.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(i=>i.identifier===e)?.value})}validate(){return this._interactionElements.every(e=>e.validate())?!0:this._interactionElements.some(e=>e.validate())?!1:null}_getCompletionStatus(){let e=this.validate();return e===!0?"completed":e===!1?"incomplete":"not_attempted"}_emit(e,t=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}};o([he({type:String})],E.prototype,"title",2),o([he({type:String})],E.prototype,"identifier",2),o([he({type:String})],E.prototype,"adaptive",2),o([he({type:String})],E.prototype,"timeDependent",2),o([he({type:Boolean})],E.prototype,"disabled",2),o([v("disabled",{waitUntilFirstUpdate:!0})],E.prototype,"_handleDisabledChange",2),o([he({type:Boolean})],E.prototype,"readonly",2),o([v("readonly",{waitUntilFirstUpdate:!0})],E.prototype,"_handleReadonlyChange",2),o([yo({context:x})],E.prototype,"_context",2),E=o([wo("qti-assessment-item")],E);import{LitElement as Eo}from"lit";import{customElement as Co,property as Hr}from"lit/decorators.js";var ue=class extends Eo{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let i=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);i?await this.updateStimulusRef(i):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await z().load(this.href).then(r=>r.htmlDoc());if(t){let r=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...r)}}};o([Hr({type:String})],ue.prototype,"identifier",2),o([Hr({type:String})],ue.prototype,"href",2),ue=o([Co("qti-assessment-stimulus-ref")],ue);import{html as ko}from"lit";import{property as at}from"lit/decorators.js";var Nr={toAttribute:n=>n?"true":"false",fromAttribute:n=>n==="true"};function R(n,s){class e extends n{constructor(...i){super(...i);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(i,l){this.tabIndex=l?-1:0,l&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${s}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${s}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||i.code==="Space"&&(i.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${s}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return ko`<slot></slot>`}}return o([at({type:String})],e.prototype,"identifier",2),o([at({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),o([at({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Nr})],e.prototype,"disabled",2),o([at({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Nr})],e.prototype,"readonly",2),o([v("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}import{customElement as Mo}from"lit/decorators.js";import{html as So,LitElement as Lo}from"lit";import{css as To}from"lit";var $r=To`
|
|
3607
3603
|
:host {
|
|
3608
3604
|
display: block;
|
|
3609
3605
|
}
|
|
3610
|
-
`;var
|
|
3606
|
+
`;var Le=class extends Lo{render(){return So`<slot name="qti-rubric-block"></slot><slot></slot>`}};Le.styles=$r,Le=o([Mo("qti-item-body")],Le);import{html as _o,LitElement as Ao}from"lit";import{customElement as Ro}from"lit/decorators.js";var nt=class extends Ao{render(){return _o`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};nt=o([Ro("qti-prompt")],nt);import{LitElement as Do}from"lit";import{customElement as Io}from"lit/decorators.js";var lt=class extends Do{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(r=>r.text()).then(r=>{let i=this.minifyCss(r);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};lt=o([Io("qti-stylesheet")],lt);import{consume as $o}from"@lit/context";import{css as zo,html as Oo}from"lit";import{customElement as Fo,property as ct,state as Po}from"lit/decorators.js";import{html as Vo,LitElement as Ho}from"lit";import{customElement as No}from"lit/decorators.js";var W=class extends Ho{render(){return Vo`<slot></slot>`}defaultValues(s){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(r=>r.innerHTML.trim());return t.length>1||s.cardinality==="multiple"||s.cardinality==="ordered"?t:t[0]}};W=o([No("qti-variabledeclaration")],W);var D=class extends W{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return Oo`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let i=parseInt(r.getAttribute("source-value")),l=parseInt(r.getAttribute("target-value"));(isNaN(i)||isNaN(l))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(i,l)}return t}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};D.styles=[zo`
|
|
3611
3607
|
:host {
|
|
3612
3608
|
display: none;
|
|
3613
3609
|
}
|
|
3614
|
-
`],
|
|
3610
|
+
`],o([ct({type:String,attribute:"base-type"})],D.prototype,"baseType",2),o([ct({type:String,attribute:"external-scored"})],D.prototype,"externalScored",2),o([ct({type:String})],D.prototype,"identifier",2),o([ct({type:String})],D.prototype,"cardinality",2),o([$o({context:x,subscribe:!0}),Po()],D.prototype,"itemContext",2),D=o([Fo("qti-outcome-declaration")],D);import{consume as Uo}from"@lit/context";import{css as Xo,html as Bo}from"lit";import{customElement as jo,property as Dt,state as Wo}from"lit/decorators.js";var P=class extends W{render(){let s=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return Bo`${JSON.stringify(s,null,2)}`}connectedCallback(){super.connectedCallback();let s={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};s.value=this.defaultValues(s),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:s}}))}get correctResponse(){let s,e=this.querySelector("qti-correct-response");if(e){let t=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&t.length>0)s=t[0].textContent,t[0].remove();else if(this.cardinality!=="single"){s=[];for(let r=0;r<t.length;r++)s.push(t[r].textContent),t[r].remove()}}return s}get mapping(){return this.querySelector("qti-mapping")}};P.styles=[Xo`
|
|
3615
3611
|
:host {
|
|
3616
3612
|
display: none;
|
|
3617
3613
|
}
|
|
3618
|
-
`],
|
|
3614
|
+
`],o([Dt({type:String,attribute:"base-type"})],P.prototype,"baseType",2),o([Dt({type:String})],P.prototype,"identifier",2),o([Dt({type:String})],P.prototype,"cardinality",2),o([Uo({context:x,subscribe:!0}),Wo()],P.prototype,"itemContext",2),P=o([jo("qti-response-declaration")],P);import{LitElement as Yo}from"lit";import{customElement as Ko}from"lit/decorators.js";var dt=class extends Yo{};dt=o([Ko("qti-companion-materials-info")],dt);import{LitElement as Go,html as Jo}from"lit";import{customElement as Zo}from"lit/decorators.js";var pt=class extends Go{render(){return Jo`<slot></slot>`}};pt=o([Zo("qti-content-body")],pt);import{LitElement as Qo,css as es,html as ts}from"lit";import{customElement as rs,property as mt}from"lit/decorators.js";var I=class extends Qo{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return ts`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};I.styles=es`
|
|
3619
3615
|
:host {
|
|
3620
3616
|
display: block;
|
|
3621
3617
|
}
|
|
3622
|
-
`,
|
|
3618
|
+
`,o([mt({type:String})],I.prototype,"id",2),o([mt({type:String})],I.prototype,"use",2),o([mt({type:String})],I.prototype,"view",2),o([mt({type:String,attribute:"class"})],I.prototype,"classNames",2),o([v("classNames",{waitUntilFirstUpdate:!0})],I.prototype,"handleclassNamesChange",1),I=o([rs("qti-rubric-block")],I);import{css as ns,html as ls}from"lit";import{customElement as cs}from"lit/decorators.js";import{consume as os}from"@lit/context";import{LitElement as ss}from"lit";import{property as ht,state as as}from"lit/decorators.js";var is=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),_e=n=>{if(typeof n=="string")return n;let s=is();return s==="."?n.toLocaleString():n.toString().replace(".","").replace(s,".")};function It(n){return n==null}function Ae(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var C=class extends ss{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(s){let e=this._context.variables.find(r=>r.identifier===s)||null;if(this.outcomeIdentifier!==s||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!It(this.identifier)&&!It(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(s){this.showStatus=s&&this.showHide==="show"||!s&&this.showHide==="hide"?"on":"off"}};o([ht({type:String,attribute:"show-hide"})],C.prototype,"showHide",2),o([ht({type:String,attribute:"outcome-identifier"})],C.prototype,"outcomeIdentifier",2),o([ht({type:String})],C.prototype,"identifier",2),o([ht({type:String,attribute:!1})],C.prototype,"showStatus",2),o([os({context:x,subscribe:!0}),as()],C.prototype,"_context",2);var Re=class extends C{render(){return ls` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(s){this.checkShowFeedback(this.outcomeIdentifier)}};Re.styles=ns`
|
|
3623
3619
|
:host {
|
|
3624
3620
|
display: block;
|
|
3625
3621
|
}
|
|
@@ -3629,21 +3625,21 @@ qti-response-declaration {
|
|
|
3629
3625
|
.off {
|
|
3630
3626
|
display: none;
|
|
3631
3627
|
}
|
|
3632
|
-
`,
|
|
3628
|
+
`,Re=o([cs("qti-feedback-block")],Re);import{css as ds,html as ps}from"lit";import{customElement as ms}from"lit/decorators.js";var De=class extends C{constructor(){super(...arguments);this.render=()=>ps` <slot part="feedback" class="${this.showStatus}"></slot> `}};De.styles=ds`
|
|
3633
3629
|
.on {
|
|
3634
3630
|
display: inline-block;
|
|
3635
3631
|
}
|
|
3636
3632
|
.off {
|
|
3637
3633
|
display: none;
|
|
3638
3634
|
}
|
|
3639
|
-
`,
|
|
3635
|
+
`,De=o([ms("qti-feedback-inline")],De);import{css as hs,html as us}from"lit";import{customElement as gs}from"lit/decorators.js";var Ie=class extends C{render(){return us`
|
|
3640
3636
|
<dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
|
|
3641
3637
|
<slot></slot>
|
|
3642
3638
|
<div style="margin-top: var(--qti-gap-size); text-align: center;">
|
|
3643
3639
|
<button class="button close-button" @click="${this.closeFeedback}"></button>
|
|
3644
3640
|
</div>
|
|
3645
3641
|
</dialog>
|
|
3646
|
-
`}openFeedback(){let
|
|
3642
|
+
`}openFeedback(){let s=this.shadowRoot?.querySelector("dialog");s&&!s.open&&s.showModal()}closeFeedback(){let s=this.shadowRoot?.querySelector("dialog");s&&s.open&&(s.close(),this.showStatus="off")}firstUpdated(){this.showStatus==="on"&&this.openFeedback()}updated(s){s.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};Ie.styles=hs`
|
|
3647
3643
|
.qti-dialog {
|
|
3648
3644
|
background: var(--qti-bg);
|
|
3649
3645
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -3692,18 +3688,18 @@ qti-response-declaration {
|
|
|
3692
3688
|
display: inline-block;
|
|
3693
3689
|
line-height: 1.5;
|
|
3694
3690
|
}
|
|
3695
|
-
`,
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3691
|
+
`,Ie=o([gs("qti-modal-feedback")],Ie);import{html as ys}from"lit";import{ifDefined as qs}from"lit/directives/if-defined.js";import{property as Vt,state as bs}from"lit/decorators.js";import{LitElement as fs}from"lit";var u=class extends fs{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}reportValidity(){return this._internals.reportValidity()}reset(){this.value=""}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier}}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};u.formAssociated=!0,o([Vt({type:String,attribute:"response-identifier"})],u.prototype,"responseIdentifier",2),o([Vt({reflect:!0,type:Boolean})],u.prototype,"disabled",2),o([Vt({reflect:!0,type:Boolean})],u.prototype,"readonly",2),o([bs()],u.prototype,"_correctResponse",2);import{customElement as xs,property as Ve,state as Or}from"lit/decorators.js";import{css as vs}from"lit";var zr=vs`
|
|
3692
|
+
/* PK: display host as block, else design will be collapsed */
|
|
3693
|
+
:host {
|
|
3694
|
+
display: block;
|
|
3695
|
+
}
|
|
3696
|
+
textarea {
|
|
3697
|
+
box-sizing: border-box;
|
|
3698
|
+
width: 100%;
|
|
3699
|
+
height: 100%;
|
|
3700
|
+
border: 0;
|
|
3701
|
+
}
|
|
3702
|
+
`;var k=class extends u{constructor(){super(...arguments);this._rows=5;this._value=""}handleclassNamesChange(e,t){let r=t.split(" "),i=!1;if(r.forEach(l=>{if(l.startsWith("qti-height-lines-")){let a=l.replace("qti-height-lines-","");this._rows=parseInt(a),i=!0}}),!i&&this.expectedLength){let l=Math.ceil(this.expectedLength/50);this._rows=l}}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let t=new FormData;t.append(this.responseIdentifier,e),this._internals.setFormValue(t),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,r=new RegExp(t);e.checkValidity()&&r.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return ys`<slot name="prompt"></slot
|
|
3707
3703
|
><textarea
|
|
3708
3704
|
part="textarea"
|
|
3709
3705
|
name="${this.responseIdentifier}"
|
|
@@ -3714,12 +3710,12 @@ qti-response-declaration {
|
|
|
3714
3710
|
@keyup="${this.textChanged}"
|
|
3715
3711
|
@change="${this.textChanged}"
|
|
3716
3712
|
@blur="${e=>{this.reportValidity()}}"
|
|
3717
|
-
placeholder="${
|
|
3713
|
+
placeholder="${qs(this.placeholderText?this.placeholderText:void 0)}"
|
|
3718
3714
|
rows="${this._rows}"
|
|
3719
3715
|
?disabled="${this.disabled}"
|
|
3720
3716
|
?readonly="${this.readonly}"
|
|
3721
3717
|
.value=${this._value}
|
|
3722
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let
|
|
3718
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};k.styles=zr,o([Or()],k.prototype,"_rows",2),o([Ve({type:Number,attribute:"expected-length"})],k.prototype,"expectedLength",2),o([Ve({type:String,attribute:"pattern-mask"})],k.prototype,"patternMask",2),o([Ve({type:String,attribute:"placeholder-text"})],k.prototype,"placeholderText",2),o([Ve({type:String,attribute:"data-patternmask-message"})],k.prototype,"dataPatternmaskMessage",2),o([Or()],k.prototype,"_value",2),o([Ve({type:String,attribute:"class"})],k.prototype,"classNames",2),o([v("classNames")],k.prototype,"handleclassNamesChange",1),k=o([xs("qti-extended-text-interaction")],k);import{html as Es}from"lit";import{customElement as Cs,property as ut,state as ks}from"lit/decorators.js";import{ifDefined as Pr}from"lit/directives/if-defined.js";import{createRef as Ts}from"lit/directives/ref.js";import{css as ws}from"lit";var Fr=ws`
|
|
3723
3719
|
:host {
|
|
3724
3720
|
display: inline-block;
|
|
3725
3721
|
}
|
|
@@ -3801,7 +3797,7 @@ qti-response-declaration {
|
|
|
3801
3797
|
width: 57rem;
|
|
3802
3798
|
min-width: 57rem;
|
|
3803
3799
|
}
|
|
3804
|
-
`;var
|
|
3800
|
+
`;var V=class extends u{constructor(){super(...arguments);this._value="";this.inputRef=Ts()}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let t=new FormData;t.append(this.responseIdentifier,e),this._internals.setFormValue(t),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),e.setCustomValidity(""),e.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage));else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}render(){return Es`
|
|
3805
3801
|
<input
|
|
3806
3802
|
part="input"
|
|
3807
3803
|
name="${this.responseIdentifier}"
|
|
@@ -3812,15 +3808,15 @@ qti-response-declaration {
|
|
|
3812
3808
|
@keyup="${this.textChanged}"
|
|
3813
3809
|
@change="${this.textChanged}"
|
|
3814
3810
|
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
3815
|
-
placeholder="${
|
|
3811
|
+
placeholder="${Pr(this.placeholderText?this.placeholderText:void 0)}"
|
|
3816
3812
|
.value="${this._value}"
|
|
3817
|
-
pattern="${
|
|
3813
|
+
pattern="${Pr(this.patternMask?this.patternMask:void 0)}"
|
|
3818
3814
|
maxlength=${1e3}
|
|
3819
3815
|
?disabled="${this.disabled}"
|
|
3820
3816
|
?readonly="${this.readonly}"
|
|
3821
3817
|
/>
|
|
3822
3818
|
<div part="correct">${this._correctResponse}</div>
|
|
3823
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let
|
|
3819
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};V.styles=Fr,o([ut({type:Number,attribute:"expected-length"})],V.prototype,"expectedLength",2),o([ut({type:String,attribute:"pattern-mask"})],V.prototype,"patternMask",2),o([ut({type:String,attribute:"placeholder-text"})],V.prototype,"placeholderText",2),o([ut({type:String,attribute:"data-patternmask-message"})],V.prototype,"dataPatternmaskMessage",2),o([ks()],V.prototype,"_value",2),V=o([Cs("qti-text-entry-interaction")],V);import{html as Ss}from"lit";import{customElement as Ls}from"lit/decorators.js";import{property as Ur,query as Ms}from"lit/decorators.js";var Y=(n,s)=>{class e extends n{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(i,l)=>{this._choiceElements.forEach(a=>a.disabled=l)};this._handleReadonlyChange=(i,l)=>{this._choiceElements.forEach(a=>a.readonly=l)};this._value=""}_handleMaxChoicesChange(i,l){this._determineInputType()}get value(){return Array.isArray(this._value)?this._value.join(","):this._value}set value(i){if(this.maxChoices>1&&typeof i=="string"?this._value=i.split(","):this._value=i,Array.isArray(this._value)){let l=new FormData;this._value.forEach(a=>{l.append(this.responseIdentifier,a)}),this._internals.setFormValue(l)}else this._internals.setFormValue(this._value);this._updateChoiceSelection()}get correctResponse(){return this._correctResponse}set correctResponse(i){this._correctResponse=i;let l=Array.isArray(i)?i:[i];this._choiceElements.forEach(a=>{a.internals.states.delete("correct-response"),a.internals.states.delete("incorrect-response"),l.length>0&&(l.includes(a.identifier)?a.internals.states.add("correct-response"):a.internals.states.add("incorrect-response"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${s}`,this._registerChoiceElement),this.addEventListener(`unregister-${s}`,this._unregisterChoiceElement),this.addEventListener(`activate-${s}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${s}`,this._registerChoiceElement),this.removeEventListener(`unregister-${s}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${s}`,this._choiceElementSelectedHandler)}validate(){let i=this._choiceElements.filter(d=>this._getChoiceChecked(d)),l=i.length,a=!0,c="";return this.maxChoices!==0&&l>this.maxChoices?(a=!1,c=this.dataset.maxSelectionsMessage||`You can select at most ${this.maxChoices} choices.`):l<this.minChoices&&(a=!1,c=this.dataset.minSelectionsMessage||`You must select at least ${this.minChoices} choices.`),i.length>0&&this._internals.setValidity(a?{}:{customError:!0},c,i[l-1]||this._choiceElements[0]||this),this.reportValidity(),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(i){i.stopPropagation();let l=i.target;l.disabled=this.disabled,this._choiceElements.push(l),this._setInputType(l)}_unregisterChoiceElement(i){i.stopPropagation();let l=i.target;this._choiceElements=this._choiceElements.filter(a=>a!==l)}_determineInputType(){this._choiceElements.forEach(i=>{this._setInputType(i)})}_setInputType(i){this._internals.ariaLabel=this.maxChoices===1?"radio-group":"checkbox-group";let l=this.maxChoices===1?"radio":"checkbox";i.internals.role=l,i.internals.states.delete(l==="radio"?"checkbox":"radio"),i.internals.states.add(l)}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target),this.maxChoices===1&&this._choiceElements.forEach(l=>{l.identifier!==i.detail.identifier&&this._setChoiceChecked(l,!1)}),this._handleChoiceSelection()}_setChoiceChecked(i,l){i.internals?.states&&(l?(i.internals.states.add("--checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("--checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("--checked")}_toggleChoiceChecked(i){let l=this._getChoiceChecked(i);this._setChoiceChecked(i,!l)}_handleChoiceSelection(){let l=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.value=this.maxChoices===1?l[0]||"":l,this.validate(),this.saveResponse(this._value)}_updateChoiceSelection(){let i=Array.isArray(this._value)?this._value:[this._value];this._choiceElements.forEach(l=>{let a=i.includes(l.identifier);this._setChoiceChecked(l,a)})}}return o([Ms("#validationMessage")],e.prototype,"_validationMessageElement",2),o([Ur({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),o([Ur({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),o([v("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),o([v("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),o([v("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var gt=class extends Y(u,"qti-hottext"){constructor(){super(...arguments);this.render=()=>Ss`<slot></slot>`}};gt=o([Ls("qti-hottext-interaction")],gt);import{css as _s,html as Xr}from"lit";import{customElement as As,property as Rs,state as Br}from"lit/decorators.js";import{unsafeHTML as jr}from"lit/directives/unsafe-html.js";var K=class extends u{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[_s`
|
|
3824
3820
|
:host {
|
|
3825
3821
|
display: inline-block;
|
|
3826
3822
|
}
|
|
@@ -3842,15 +3838,15 @@ qti-response-declaration {
|
|
|
3842
3838
|
/* position-anchor: --infobox; */
|
|
3843
3839
|
/* top: anchor(bottom); */
|
|
3844
3840
|
}
|
|
3845
|
-
`]}render(){return
|
|
3841
|
+
`]}render(){return Xr`
|
|
3846
3842
|
<select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
|
|
3847
|
-
${this.options.map(e=>
|
|
3848
|
-
<option value="${e.value}" ?selected="${e.selected}">${
|
|
3843
|
+
${this.options.map(e=>Xr`
|
|
3844
|
+
<option value="${e.value}" ?selected="${e.selected}">${jr(e.textContent)}</option>
|
|
3849
3845
|
`)}
|
|
3850
3846
|
</select>
|
|
3851
3847
|
|
|
3852
|
-
${
|
|
3853
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(
|
|
3848
|
+
${jr(this.correctOption)}
|
|
3849
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set value(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}get value(){return this.options.find(e=>e.selected).value}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(t=>e===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>({...r,selected:r.value===t})),this.saveResponse(t)}};K.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"],o([Br()],K.prototype,"options",2),o([Br()],K.prototype,"correctOption",2),o([Rs({attribute:"data-prompt",type:String})],K.prototype,"dataPrompt",2),K=o([As("qti-inline-choice-interaction")],K);import{html as Hs}from"lit";import{customElement as Ns,property as $s}from"lit/decorators.js";import{property as Ds}from"lit/decorators.js";var bt=(n,s)=>{class e extends n{constructor(){super(...arguments);this.shuffle="false"}connectedCallback(){super.connectedCallback(),this._applyShuffle()}updated(i){i.has("shuffle")&&this._applyShuffle()}_applyShuffle(){this.shuffle==="true"?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let i=Array.from(this.querySelectorAll(s)),l=i.filter(h=>h.hasAttribute("fixed")),a=i.filter(h=>!h.hasAttribute("fixed"));if(a.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let c=[...a],d=!1,p=0;for(;!d&&p<10;){p++;for(let h=a.length-1;h>0;h--){let b=Math.floor(Math.random()*(h+1));[a[h],a[b]]=[a[b],a[h]]}d=!a.every((h,b)=>h===c[b])}d||console.warn("Failed to shuffle the choices after multiple attempts.");let m=1;[...l,...a].forEach(h=>{h.style.setProperty("order",String(m++))})}_resetShuffleChoices(){this.querySelectorAll(s).forEach(i=>{i.style.setProperty("order","initial")})}}return o([Ds({type:String,reflect:!0})],e.prototype,"shuffle",2),e};import{property as Is}from"lit/decorators.js";var Wr=(n,s)=>{class e extends n{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(i){i&&(this._classes=i.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(i){super.updated(i),i.has("shuffle")&&this._addLabels()}_addLabels(){let i=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),l=a=>!isNaN(+a);if(i){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(d=>d).map((d,p)=>({el:d,order:l(d.style.order)?+d.style.order:p+1})).sort((d,p)=>d.order-p.order).map(d=>d.el);for(let d=0;d<c.length;d++)c[d].marker=this._getLabel(d+1)}}_getLabel(i){let l=this._classes.filter(d=>this._allLabels.includes(d)).pop(),a=this._classes.filter(d=>this._allLabelSuffixes.includes(d)).pop();!l&&a&&(l="qti-labels-upper-alpha");let c="";switch(l){case"qti-labels-decimal":c=`${i}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+i-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+i-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return o([Is({type:String,reflect:!0})],e.prototype,"class",1),e};import{css as Vs}from"lit";var Yr=Vs`
|
|
3854
3850
|
[part='slot'] {
|
|
3855
3851
|
display: flex;
|
|
3856
3852
|
flex-direction: column;
|
|
@@ -3888,15 +3884,15 @@ qti-response-declaration {
|
|
|
3888
3884
|
:host([orientation='horizontal']) [part='slot'] {
|
|
3889
3885
|
flex-direction: row;
|
|
3890
3886
|
}
|
|
3891
|
-
`;var
|
|
3887
|
+
`;var ge=class extends Wr(bt(Y(u,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){constructor(){super(),this._internals.role="group"}render(){return Hs`
|
|
3892
3888
|
<slot part="prompt" name="prompt"></slot><slot part="slot"></slot>
|
|
3893
3889
|
<div part="message" role="alert" id="validationMessage"></div>
|
|
3894
|
-
`}};
|
|
3890
|
+
`}};ge.styles=Yr,o([$s({type:String})],ge.prototype,"orientation",2),ge=o([Ns("qti-choice-interaction")],ge);import{css as zs,html as Os}from"lit";import{customElement as Fs}from"lit/decorators.js";var He=class extends u{constructor(){super(...arguments);this._file=null;this._base64=null}reset(){this._file=null,this._base64=null,this.saveResponse(null)}validate(){return this._base64!==null}get value(){return this._base64}set value(e){if(typeof e=="string")this._base64=e,this.saveResponse(e);else if(e===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...u.properties}}render(){return Os`
|
|
3895
3891
|
<div>
|
|
3896
3892
|
<slot name="prompt"></slot>
|
|
3897
3893
|
<input type="file" @change="${this._onFileChange}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
3898
3894
|
</div>
|
|
3899
|
-
`}async _onFileChange(e){let
|
|
3895
|
+
`}async _onFileChange(e){let t=e.target;t.files&&t.files.length>0&&(this._file=t.files[0],this._base64=await this._convertToBase64(this._file),this.saveResponse(this._base64),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this._base64}})))}_convertToBase64(e){return new Promise((t,r)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(e)})}};He.styles=[zs`
|
|
3900
3896
|
:host {
|
|
3901
3897
|
display: block;
|
|
3902
3898
|
margin: 1em 0;
|
|
@@ -3905,11 +3901,11 @@ qti-response-declaration {
|
|
|
3905
3901
|
display: block;
|
|
3906
3902
|
margin-top: 0.5em;
|
|
3907
3903
|
}
|
|
3908
|
-
`],
|
|
3904
|
+
`],He=o([Fs("qti-upload-interaction")],He);import{css as Ps,html as Us,LitElement as Xs}from"lit";import{customElement as Bs}from"lit/decorators.js";var Ne=class extends Xs{render(){return Us`<slot></slot>`}process(){let s=new Ht,e=[...this.children];s.process(e)}};Ne.styles=[Ps`
|
|
3909
3905
|
:host {
|
|
3910
3906
|
display: none;
|
|
3911
3907
|
}
|
|
3912
|
-
`],
|
|
3908
|
+
`],Ne=o([Bs("qti-outcome-processing")],Ne);var Ht=class{process(s){for(let e of s)e.process()}};import{css as js,html as Ws,LitElement as Ys}from"lit";import{customElement as Ks}from"lit/decorators.js";var Kr=`<qti-response-processing>
|
|
3913
3909
|
<qti-response-condition>
|
|
3914
3910
|
<qti-response-if>
|
|
3915
3911
|
<qti-match>
|
|
@@ -3926,7 +3922,7 @@ qti-response-declaration {
|
|
|
3926
3922
|
</qti-set-outcome-value>
|
|
3927
3923
|
</qti-response-else>
|
|
3928
3924
|
</qti-response-condition>
|
|
3929
|
-
</qti-response-processing>`,
|
|
3925
|
+
</qti-response-processing>`,Gr=`<qti-response-processing>
|
|
3930
3926
|
<qti-response-condition>
|
|
3931
3927
|
<qti-response-if>
|
|
3932
3928
|
<qti-is-null>
|
|
@@ -3942,7 +3938,7 @@ qti-response-declaration {
|
|
|
3942
3938
|
</qti-set-outcome-value>
|
|
3943
3939
|
</qti-response-else>
|
|
3944
3940
|
</qti-response-condition>
|
|
3945
|
-
</qti-response-processing>`,
|
|
3941
|
+
</qti-response-processing>`,Jr=`<qti-response-processing>
|
|
3946
3942
|
<qti-response-condition>
|
|
3947
3943
|
<qti-response-if>
|
|
3948
3944
|
<qti-is-null>
|
|
@@ -3958,31 +3954,35 @@ qti-response-declaration {
|
|
|
3958
3954
|
</qti-set-outcome-value>
|
|
3959
3955
|
</qti-response-else>
|
|
3960
3956
|
</qti-response-condition>
|
|
3961
|
-
</qti-response-processing>`;var
|
|
3957
|
+
</qti-response-processing>`;var ee=class extends Ys{render(){return Ws`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let t of e)t.process()}firstUpdated(s){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(Gr).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Jr).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Kr).firstElementChild.firstElementChild);break}}}fragmentFromString(s){return document.createRange().createContextualFragment(s)}};ee.styles=[js`
|
|
3962
3958
|
:host {
|
|
3963
3959
|
display: none;
|
|
3964
3960
|
}
|
|
3965
|
-
`],
|
|
3966
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};
|
|
3961
|
+
`],ee=o([Ks("qti-response-processing")],ee);import{property as Qs}from"lit/decorators.js";import{customElement as Gs}from"lit/decorators.js";import{html as Js,LitElement as Zs}from"lit";var H=class extends Zs{render(){return Js`<slot></slot>`}process(){throw new Error("Not implemented")}};H=o([Gs("qti-rule")],H);var ft=class extends H{get childExpression(){return this.firstElementChild}process(){let s=this.getAttribute("identifier"),e=this.closest("qti-assessment-item").getVariable(s),t;return e.interpolationTable&&(t=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:_e(t)}})),t)}};o([Qs({type:String})],ft.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",ft);import{html as ea}from"lit";var Nt=class extends H{render(){return ea`<slot></slot>`}process(){let s=[...this.children];for(let e=0;e<s.length;e++){let t=s[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Nt);var $t=class extends H{process(){let s=this.getAttribute("identifier"),e=this.firstElementChild,r=new zt(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:Array.isArray(r)?r.map(i=>_e(i)):_e(r)}}))}},zt=class{constructor(s){this.expression=s}process(){let s=this.expression?this.expression.calculate():null;if(s==null){console.warn("setOutcomeValue: value is null or undefined");return}return s}};customElements.define("qti-set-outcome-value",$t);import{LitElement as ta,html as ra}from"lit";var $e=class extends ta{render(){return ra`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let s=this.getSubRules();for(let e=0;e<s.length;e++)s[e].process()}};customElements.define("qti-response-else",$e);import{html as ia}from"lit";var ze=class extends $e{calculate(){return this.firstElementChild.calculate()}getSubRules(){let s=[];for(let e=1;e<this.children.length;e++)s.push(this.children[e]);return s}};customElements.define("qti-response-if",ze);var Ot=class extends ze{render(){return ia`${super.render()}`}};customElements.define("qti-response-else-if",Ot);import{consume as oa}from"@lit/context";import{css as sa,html as aa,LitElement as na}from"lit";import{state as Zr}from"lit/decorators.js";var g=class extends na{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return this.context.variables.find(i=>i.identifier===t)||null}case"qti-multiple":{let r=e.getResult();return r.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.context.variables.find(i=>i.identifier===t)||null;return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return aa`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
3962
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};g.styles=sa`
|
|
3967
3963
|
slot {
|
|
3968
3964
|
display: none;
|
|
3969
3965
|
}
|
|
3970
|
-
`,l([q()],_.prototype,"result",2),l([A({context:$,subscribe:!0}),q()],_.prototype,"context",2);var O=class extends _{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var _r=class extends Ho(O){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ho(s){return class extends s{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",_r);var kr=class extends _{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([p({type:String,attribute:"base-type"})],kr.prototype,"baseType",2);customElements.define("qti-base-value",kr);var ci=class extends O{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",ci);var di=class extends _{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",di);var Tr=class extends _{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(i.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([p({type:String})],Tr.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Tr);var V=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ar=class extends _{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):V.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([p({type:String})],Ar.prototype,"toleranceMode",2);customElements.define("qti-equal",Ar);var pi=class extends _{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",pi);var hi=class extends O{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",hi);var ui=class extends _{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ui);var mi=class extends _{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",mi);var gi=class extends O{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",gi);var Sr=class extends _{getResult(){let t=this.context.variables.find(o=>o.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let n=e.mapEntries.find(a=>V.compareSingleValues(a.mapKey,o,t.baseType));n==null||n.mappedValue==null?i+=e.defaultValue:i+=n.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([p({type:String})],Sr.prototype,"identifier",2);customElements.define("qti-map-response",Sr);var Ge=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};l([p({attribute:"default-value",type:Number})],Ge.prototype,"defaultValue",2),l([p({attribute:"lower-bound",type:Number})],Ge.prototype,"lowerBound",2),l([p({attribute:"upper-bound",type:Number})],Ge.prototype,"upperBound",2);customElements.define("qti-mapping",Ge);var fi=class s extends _{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return s.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){switch(e.cardinality){case"single":return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):V.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!V.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let o=null,n=[...t.value];for(let a of n)if(V.compareSingleValues(i,a,e.baseType)){o=a;break}if(o!==null)n.splice(n.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",fi);var bi=class extends _{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};customElements.define("qti-member",bi);var vi=class extends _{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};customElements.define("qti-multiple",vi);var yi=class extends _{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",yi);var xi=class extends O{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",xi);var qi=class extends _{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};customElements.define("qti-ordered",qi);var Dt=class extends v{render(){let t=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(t,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};l([p({type:String})],Dt.prototype,"identifier",2),l([A({context:$,subscribe:!0}),q()],Dt.prototype,"context",2);customElements.define("qti-printed-variable",Dt);var Ei=class extends _{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",Ei);var Mr=class extends Oo(_){getResult(){return this.calculateChildren(Array.from(this.children))}};function Oo(s){return class extends s{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}customElements.define("qti-subtract",Mr);var Rr=class extends _{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return V.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([p({type:String,attribute:"case-sensitive"})],Rr.prototype,"caseSensitive",2);customElements.define("qti-string-match",Rr);var wi=class extends _{constructor(){super(),this._expression=new Ci(Array.from(this.children))}getResult(){return this._expression.calculate()}},Ci=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",wi);var _i=class extends _{getResult(){let t=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===t).value}};customElements.define("qti-variable",_i);var Le=class extends w{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch{}return null};this.getResolvablePathString=(e,r)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`));this.getResolvablePath=(e,r)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(e,r)}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.value=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(e){}get value(){return this.rawResponse}getTAOConfig(e){let r=e.querySelectorAll("properties"),i={},o=a=>{let c={},d=a.getAttribute("key");if(d){let m=Array.from(a.children),g=m.map(y=>y.getAttribute("key"));g.length>0&&!g.find(y=>!Number.isInteger(+y))?c[d]=m.map(y=>n(y)):c[d]=a.textContent}return c},n=a=>{if(a){let c={};for(let d of a.children)c={...c,...o(d)};return c}};for(let a of r)return a.getAttribute("key")||(i={...i,...n(a)}),i;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(i,o,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),d=n.getAttribute("fallback-path");if(a&&c){let m=d?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(d,r)):this.getResolvablePath(c,r),g=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(g,m)}}}return e}combineRequireResolvePaths(e,r){let i=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return h`<slot></slot>${this._errorMessage&&h`<div style="color:red">
|
|
3966
|
+
`,o([Zr()],g.prototype,"result",2),o([oa({context:x,subscribe:!0}),Zr()],g.prototype,"context",2);var T=class extends g{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var vt=class extends la(T){calculate(){return this.calculateChildren(Array.from(this.children))}};function la(n){return class extends n{calculateChildren(e){return e.map(r=>{let i=r;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let l=i.calculate(),a=!1;if(typeof l=="string")if(l==="true")a=!0;else if(l==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof l=="boolean"&&(a=l);return a}).every(r=>typeof r=="boolean"&&r)}}}customElements.define("qti-and",vt);import{property as ca}from"lit/decorators.js";var yt=class extends g{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};o([ca({type:String,attribute:"base-type"})],yt.prototype,"baseType",2);customElements.define("qti-base-value",yt);var Ft=class extends T{getResult(){let s=this.getVariables();if(this.children.length===2){let e=s[0],t=s[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,i=t.value;return r.filter(c=>i.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Ft);var Pt=class extends g{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let s=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===s)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Pt);import{property as da}from"lit/decorators.js";var qt=class extends g{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let i=parseFloat(t.value),l=parseFloat(r.value);if(!isNaN(i)&&!isNaN(l))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===l.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(l*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${l}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};o([da({type:String})],qt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",qt);import{property as pa}from"lit/decorators.js";var M=class{static compareSingleValues(s,e,t){switch(t){case"identifier":case"string":return s===e;case"integer":{let r=parseInt(s,10),i=parseInt(e,10);if(!isNaN(r)&&!isNaN(i))return r===i;console.error(`Cannot convert ${s} and/or ${e} to int.`);break}case"float":{let r=parseFloat(s),i=parseFloat(e);if(!isNaN(r)&&!isNaN(i))return r===i;console.error(`couldn't convert ${s} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=s.split(" ").sort(),i=e.split(" ").sort();if(r.length===2&&i.length===2)return t==="pair"&&(r.sort(),i.sort()),r.join(" ")===i.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${s} 2: ${e}`);break}}return!1}};var xt=class extends g{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):M.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};o([pa({type:String})],xt.prototype,"toleranceMode",2);customElements.define("qti-equal",xt);var Ut=class extends g{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Ut);var Xt=class extends T{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Xt);var Bt=class extends g{getResult(){if(this.children.length===1){let s=this.getVariables();if(!s)return!0;let e=s[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",Bt);var jt=class extends g{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",jt);var Wt=class extends T{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",Wt);import{property as ma}from"lit/decorators.js";var wt=class extends g{getResult(){let s=this.context.variables.find(i=>i.identifier===this.identifier);if(!s)return console.warn(`Response ${this.identifier} can not be found`),null;let e=s.mapping,t=Array.isArray(s.value)?s.value:[s.value],r=0;for(let i of t){let l=e.mapEntries.find(a=>M.compareSingleValues(a.mapKey,i,s.baseType));l==null||l.mappedValue==null?r+=e.defaultValue:r+=l.mappedValue}return e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};o([ma({type:String})],wt.prototype,"identifier",2);customElements.define("qti-map-response",wt);import{property as Yt}from"lit/decorators.js";import{LitElement as ha}from"lit";var be=class extends ha{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};o([Yt({attribute:"default-value",type:Number})],be.prototype,"defaultValue",2),o([Yt({attribute:"lower-bound",type:Number})],be.prototype,"lowerBound",2),o([Yt({attribute:"upper-bound",type:Number})],be.prototype,"upperBound",2);customElements.define("qti-mapping",be);var Kt=class n extends g{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];return n.match(e,t)}return console.error("unexpected number of children in match"),null}static match(s,e){switch(e.cardinality){case"single":return s.value===null?!1:Array.isArray(s.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):M.compareSingleValues(s.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(s.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(s.value.length!==e.value.length)return!1;for(let t=0;t<s.value.length;t++)if(!M.compareSingleValues(e.value[t],s.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(s.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(s.value.length!==e.value.length)return!1;let t=0;for(let r of e.value){let i=null,l=[...s.value];for(let a of l)if(M.compareSingleValues(r,a,e.baseType)){i=a;break}if(i!==null)l.splice(l.indexOf(i),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Kt);var Gt=class extends g{getResult(){let s=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=s;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",Gt);var Jt=class extends g{getResult(){let s=this.getVariables();if(s.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of s)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return s}};customElements.define("qti-multiple",Jt);import{html as ua}from"lit";var Zt=class extends g{render(){return ua`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Zt);var Qt=class extends T{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate(),i=!1;if(typeof r=="string")if(r==="true")i=!0;else if(r==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(i=r);return i}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Qt);var er=class extends g{getResult(){let s=this.getVariables();if(s.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of s)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return s}};customElements.define("qti-ordered",er);import{consume as ga}from"@lit/context";import{LitElement as ba,html as fa}from"lit";import{property as va,state as ya}from"lit/decorators.js";var Oe=class extends ba{render(){let s=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return fa`${JSON.stringify(s,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};o([va({type:String})],Oe.prototype,"identifier",2),o([ga({context:x,subscribe:!0}),ya()],Oe.prototype,"context",2);customElements.define("qti-printed-variable",Oe);var tr=class extends g{getResult(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",tr);var Et=class extends qa(g){getResult(){return this.calculateChildren(Array.from(this.children))}};function qa(n){return class extends n{calculateChildren(e){let t=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return t.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",Et);import{property as xa}from"lit/decorators.js";var Ct=class extends g{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),l=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return M.compareSingleValues(i,l,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};o([xa({type:String,attribute:"case-sensitive"})],Ct.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ct);var rr=class extends g{constructor(){super(),this._expression=new ir(Array.from(this.children))}getResult(){return this._expression.calculate()}},ir=class{constructor(s){this.expressions=s}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let t=e.calculate();return Number.isNaN(t)?(console.error("unexpected value in qti-sum, expected number"),null):Number(t)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",rr);var or=class extends g{getResult(){let s=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===s).value}};customElements.define("qti-variable",or);import{html as Qr}from"lit";import{customElement as wa,property as ei,state as Ea}from"lit/decorators.js";var te=class extends u{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,t)=>{e=this.removeDoubleSlashes(e);try{let r=await fetch(e);if(r.ok){let l=await r.json();for(let a in l.paths)t&&(l.paths[a]=this.getResolvablePath(l.paths[a],t));return l}}catch{}return null};this.getResolvablePathString=(e,t)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!t?e:this.removeDoubleSlashes(`${t}/${e}`));this.getResolvablePath=(e,t)=>Array.isArray(e)?e.map(r=>this.getResolvablePathString(r,t)):this.getResolvablePathString(e,t)}convertQtiVariableJSON(e){for(let t in e)if(e.hasOwnProperty(t)){let r=e[t];if(r){for(let i in r)if(r.hasOwnProperty(i)){let l=r[i];if(Array.isArray(l))return l.map(String);if(l!=null)return String(l)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),t=this.pci.getResponse(),r=JSON.stringify(e);if(r!==this.rawResponse){this.rawResponse=r;let i=this.convertQtiVariableJSON(t);this.value=i,this.saveResponse(i)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(e){}get value(){return this.rawResponse}getTAOConfig(e){let t=e.querySelectorAll("properties"),r={},i=a=>{let c={},d=a.getAttribute("key");if(d){let p=Array.from(a.children),m=p.map(b=>b.getAttribute("key"));m.length>0&&!m.find(b=>!Number.isInteger(+b))?c[d]=p.map(b=>l(b)):c[d]=a.textContent}return c},l=a=>{if(a){let c={};for(let d of a.children)c={...c,...i(d)};return c}};for(let a of t)return a.getAttribute("key")||(r={...r,...l(a)}),r;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",r=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");r.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let i=t=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);t=="IMS"?e.getInstance(r,i,void 0):e.initialize(this.customInteractionTypeIdentifier,r.firstElementChild,i),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,r.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:r=>{this.register(r)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],r=>{r([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let t=this.getAttribute("data-base-url"),r=this.querySelector("qti-interaction-modules");if(r){let i=r.querySelectorAll("qti-interaction-module");for(let l of i){let a=l.getAttribute("id"),c=l.getAttribute("primary-path"),d=l.getAttribute("fallback-path");if(a&&c){let p=d?this.combineRequireResolvePaths(this.getResolvablePath(c,t),this.getResolvablePath(d,t)):this.getResolvablePath(c,t),m=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(m,p)}}}return e}combineRequireResolvePaths(e,t){let r=Array.isArray(e)?e:[e],i=Array.isArray(t)?t:[t];return r.concat(i)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return Qr`<slot></slot>${this._errorMessage&&Qr`<div style="color:red">
|
|
3971
3967
|
<h1>Error</h1>
|
|
3972
3968
|
${this._errorMessage}
|
|
3973
|
-
</div>`}`}};l([p({type:String,attribute:"module"})],Le.prototype,"module",2),l([p({type:String,attribute:"custom-interaction-type-identifier"})],Le.prototype,"customInteractionTypeIdentifier",2),l([q()],Le.prototype,"_errorMessage",2),Le=l([u("qti-portable-custom-interaction")],Le);var Lr=class s{constructor(){this.draggables=[];this.droppables=[];this.dragContainers=[];this.touchStartPoint=null;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.allDropzones=[];this.dataTransfer={data:{},setData(t,e){this.data[t]=e},getData(t){return this.data[t]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1})}dragContainersModified(t,e){for(let r of e)this.dragContainers.includes(r)&&(this.dragContainers=this.dragContainers.filter(i=>i!==r),this.allDropzones=this.allDropzones.filter(i=>i!==r));for(let r of t)this.dragContainers.includes(r)||(this.dragContainers.push(r),this.allDropzones.push(r))}draggablesModified(t,e){for(let r of e)this.draggables.includes(r)&&(this.draggables=this.draggables.filter(i=>i!==r),r.removeAttribute("tabindex"),r.removeEventListener("touchstart",this.handleTouchStart.bind(this)),r.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let r of t)this.draggables.includes(r)||(this.draggables.push(r),r.setAttribute("tabindex","0"),r.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),r.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}))}droppablesModified(t,e){for(let r of e)this.droppables.includes(r)&&(this.droppables=this.droppables.filter(i=>i!==r),this.allDropzones=this.allDropzones.filter(i=>i!==r));for(let r of t)this.droppables.includes(r)||(this.droppables.push(r),this.allDropzones.push(r))}handleTouchStart(t){let{x:e,y:r}=this.getEventCoordinates(t);if(this.touchStartPoint={x:e,y:r},this.dragSource=t.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(t,{clientX:e,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}t.preventDefault()}handleTouchMove(t){if(this.isDraggable&&this.dragSource){let{x:e,y:r}=this.getEventCoordinates(t),i={clientX:e,clientY:r};this.calculateDragDistance(i)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(t,i),t.preventDefault();let o=this.findClosestDropzone();this.currentDropTarget=o,o!==this.lastTarget&&(this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragleave"),o&&this.dispatchCustomEvent(o,"dragenter"),this.lastTarget=o),this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragover")}}createDragClone(t,e){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(e),this.setDragCloneStyles(e),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(e)}else if(this.touchStartPoint){let i=e.clientX-this.touchStartPoint.x,o=e.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.currentDropTarget;r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(t){this.touchEndTriggered=!0,this.isDraggable=!1;let e=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),e=!0;else if(this.isDragging){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},this.dragSource?.dispatchEvent(r)}this.resetDragState(e)}handleTouchCancel(t){this.resetDragState()}findClosestDropzone(){if(!this.dragSource||this.allDropzones.length===0)return null;let t=this.dragSource.getBoundingClientRect(),e=null,r=0;for(let i of this.allDropzones){let o=i.getBoundingClientRect(),n=this.calculateOverlapArea(t,o);n>r&&(r=n,e=i)}if(r===0){let i=this.getCenter(t),o=1/0;for(let n of this.allDropzones){let a=this.getCenter(n.getBoundingClientRect()),c=this.calculateDistance(i,a);c<o&&(o=c,e=n)}}return e}calculateOverlapArea(t,e){let r=Math.max(0,Math.min(t.right,e.right)-Math.max(t.left,e.left)),i=Math.max(0,Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top));return r*i}getCenter(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}calculateDistance(t,e){let r=t.x-e.x,i=t.y-e.y;return Math.sqrt(r*r+i*i)}getEventCoordinates(t,e=!1){let r=t.touches?t.touches[0]:t;return{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}calculateClonePosition(t){let e=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t.clientX-e.left,this.cloneOffset.y=t.clientY-e.top}setDragCloneStyles(t){this.dragClone.style.position="fixed",this.dragClone.style.top=`${t.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${t.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(t){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let e=t.clientX-this.cloneOffset.x,r=t.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(e,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyBoundaries(t,e,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(t,i.right-n)),d=Math.max(i.top,Math.min(e,i.bottom-a));return{newLeft:c,newTop:d}}calculateDragDistance(t){let e=Math.abs(t.clientX-this.touchStartPoint.x),r=Math.abs(t.clientY-this.touchStartPoint.y);return e+r}dispatchCustomEvent(t,e,r=!0){if(!t)return;let i=new CustomEvent(e,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,t.dispatchEvent(i)}resetDragState(t=!1){this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",this.dragClone?.parentElement.removeChild(this.dragClone)):(t||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartPoint=null,this.touchEndTriggered=!1,this.dataTransfer={data:{},setData(e,r){this.data[e]=r},getData(e){return this.data[e]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var $s=(s,t)=>{class e extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(o){if(this.isMatchTabular())return;super.firstUpdated(o);let n=this.getDroppableElements();this.initializeEventHandlers(),n.forEach(a=>{this.prepareDroppable(a),this.observeDroppableAttributes(a)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(this.shadowRoot?.querySelectorAll(t)||[]).concat(Array.from(this.querySelectorAll(t)||[]))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(o){o.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(o)}observeDroppableAttributes(o){this.observer=new MutationObserver(n=>{n.forEach(({attributeName:a})=>{a==="disabled"&&this.toggleDroppableHandlers(o)})}),this.observer.observe(o,{attributes:!0})}toggleDroppableHandlers(o){o.hasAttribute("disabled")?this.removeEventListeners(o):this.attachEventListeners(o)}attachEventListeners(o){o.addEventListener("dragover",this.dragoverHandler),o.addEventListener("dragenter",this.dragenterHandler),o.addEventListener("drop",this.dropHandler)}removeEventListeners(o){o.removeEventListener("dragover",this.dragoverHandler),o.removeEventListener("dragenter",this.dragenterHandler),o.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){this.isMatchTabular()||(super.disconnectedCallback(),this.observer?.disconnect())}dragenterHandler(o){o.preventDefault()}dragoverHandler(o){return o.preventDefault(),this.activateDroppable(o.currentTarget),o.dataTransfer.dropEffect="move",!1}activateDroppable(o){this._internals.states.delete("--dragzone-active"),o.setAttribute("active","")}async dropHandler(o){o.preventDefault();let n=o.currentTarget,a=o.dataTransfer.getData("text"),c=o.dataTransfer.getData("responseIdentifier"),d=this.findDraggable(c,a);return d?d&&!this.isValidDrop(n,d,c)?(d.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(d,n),this.deactivateDroppable(n,!1),!1):!1}findDraggable(o,n){return n?this.querySelector(`[identifier=${n}]`)||this.shadowRoot.querySelector(`[identifier=${n}]`):null}isValidDrop(o,n,a){return!0}async moveDraggableToDroppable(o,n){console.log(`moveDraggableToDroppable, draggable: ${o.tagName}, droppable: ${n.tagName}`);let a=()=>{o.style.transform="translate(0, 0)",n.tagName==="SLOT"?o.setAttribute("slot",n.getAttribute("name")):n.appendChild(o),this.checkMaxAssociations(),this.saveResponse(null)};if(!document.startViewTransition){a();return}await document.startViewTransition(a).finished}deactivateDroppable(o,n=!0){n&&this._internals.states.add("--dragzone-active"),o.removeAttribute("active")}dragleaveHandler(o){return o.preventDefault(),this.deactivateDroppable(o.currentTarget),o.dataTransfer.dropEffect="none",!1}}return l([p({type:Boolean,reflect:!0})],e.prototype,"disabled",2),e};var Ds=(s,t,e)=>{class r extends s{}return r};var te=(s,t,e,r)=>{class i extends Ds($s(s,e),e,t){constructor(){super(...arguments);this.draggables=new Map;this.observer=null;this.resizeObserver=null;this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.dragContainersModified=(a,c)=>{this.dragDropApi.dragContainersModified(a,c)};this.draggablesModified=(a,c)=>{this.dragDropApi.draggablesModified(a,c),this.dragDropApi.draggables.forEach(d=>{this.storeDraggable(d)})};this.droppablesModified=(a,c)=>{this.dragDropApi.droppablesModified(a,c);for(let d of this.dragDropApi.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box")};this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),this.responseIdentifier&&a.dataTransfer.setData("responseIdentifier",this.responseIdentifier),this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),c.setAttribute("dragging",""),this.activateDragLocation(),this.activateDroppables(c)};this.handleDragEnd=async a=>{a.preventDefault();let c=a.currentTarget;this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),c.removeAttribute("dragging"),await this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c)}}handleDraggableContainerChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.dragContainersModified(a||[],c||[])}handleDraggablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.draggablesModified(a||[],c||[])}handleDroppablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.droppablesModified(a||[],c||[])}firstUpdated(a){super.firstUpdated(a);let c=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),m=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[]));this.dragContainersModified(m,[]),this.droppablesModified(d,[]),this.draggablesModified(c,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(f=>this.resizeObserver?.observe(f))}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new Lr,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.has(a)||this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}updateMinDimensionsForDropZones(){let a=this.querySelectorAll(t),c=Array.from(this.querySelectorAll(e)).map(f=>f),d=0,m=0;a.forEach(f=>{let y=f.getBoundingClientRect();d=Math.max(d,y.height),m=Math.max(m,y.width)});let g=this.querySelector(r)||this.shadowRoot?.querySelector(r);g&&(g.style.minHeight=`${d}px`,g.style.minWidth=`${m}px`);for(let f of c)f.style.minHeight=`${d}px`,f.style.minWidth=`${m}px`}activateDroppables(a){this.dragDropApi.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.dragDropApi.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragDropApi.dragContainers.forEach(c=>{c.removeAttribute("enabled")}),this.dragDropApi.droppables.forEach(c=>c.removeAttribute("enabled"))}wasDropped(a){return a.dataTransfer.dropEffect&&a.dataTransfer.dropEffect!=="none"}async restoreInitialDraggablePosition(a){let{parent:c,index:d}=this.draggables.get(a),m=(f,y,x)=>{let C=Math.min(x,y.children.length);y.insertBefore(f,y.children[C]),f.style.transform="translate(0, 0)",this.checkMaxAssociations()};if(!document.startViewTransition){m(a,c,d);return}let g=document.startViewTransition(()=>{a.style.transform="",m(a,c,d)})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}validate(){if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let m=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,m),this.reportValidity(),c}reportValidity(){let a=this.shadowRoot.querySelector("#validationMessage");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.display="block")),this._internals.validity.valid}checkMaxAssociations(){this.dragDropApi.droppables.forEach(a=>{let c=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=c?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get value(){return this.collectResponseData()}set value(a){if(!this.isMatchTabular())if(this.resetDroppables(),Array.isArray(a)){a?.forEach(d=>this.placeResponse(d));let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a)}placeResponse(a){let[c,...d]=a.split(" ").reverse(),m=this.findDroppableById(c);d.forEach(g=>this.placeDraggableInDroppable(g,m))}findDroppableById(a){return this.dragDropApi.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let d=this.querySelector(`[identifier=${a}]`);if(!c||!d){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let m=()=>{d.style.transform="translate(0, 0)",c.appendChild(d),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(m).finished:m()}getValidAssociations(){return this.dragDropApi.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){this.validate();let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.dragDropApi.droppables.map(c=>{let d=c.querySelectorAll('[qti-draggable="true"]'),m=Array.from(d).map(f=>f.getAttribute("identifier")),g=c.getAttribute("identifier");return m.map(f=>`${f} ${g}`)}).flat()}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(d,m,g)=>{d.style.transform="translate(0, 0)";let f=Math.min(g,m.children.length);m.insertBefore(d,m.children[f])};if(!document.startViewTransition){this.draggables.forEach(({parent:d,index:m},g)=>{a(g,d,m)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:d,index:m},g)=>{a(g,d,m)})}).finished}}return l([p({attribute:!1,type:Object})],i.prototype,"configuration",2),l([p({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([p({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([sr(r)],i.prototype,"handleDraggableContainerChange",1),l([sr(t)],i.prototype,"handleDraggablesChange",1),l([sr(e)],i.prototype,"handleDroppablesChange",1),i};var Is=b`
|
|
3969
|
+
</div>`}`}};o([ei({type:String,attribute:"module"})],te.prototype,"module",2),o([ei({type:String,attribute:"custom-interaction-type-identifier"})],te.prototype,"customInteractionTypeIdentifier",2),o([Ea()],te.prototype,"_errorMessage",2),te=o([wa("qti-portable-custom-interaction")],te);import{html as ii}from"lit";import{customElement as ka,state as Ta}from"lit/decorators.js";var ti=(n,s,e)=>{class t extends n{}return t};import{property as sr}from"lit/decorators.js";var N=(n,s,e,t)=>{class r extends ti(n,e,s){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.rootNode=null;this.allDropzones=[];this.lastTarget=null;this.dropzoneOriginalParent=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(a,c){this.data[a]=c},getData(a){return this.data[a]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.draggablesModified=(a,c)=>{for(let p of c)this.draggables.includes(p)&&(this.draggables=this.draggables.filter(m=>m!==p),p.removeAttribute("tabindex"),p.removeEventListener("touchstart",this.handleTouchStart.bind(this)),p.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let p of a)this.draggables.includes(p)||(this.draggables.push(p),p.setAttribute("tabindex","0"),p.hasTouchStartListener||(p.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),p.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),p.hasTouchStartListener=!0));let d=0;this.draggables.forEach(p=>{p.style.viewTransitionName=`drag-${d}-${this.getAttribute("identifier")||crypto.randomUUID()}`,p.setAttribute("qti-draggable","true"),p.addEventListener("dragstart",this.handleDragStart),p.addEventListener("dragend",this.handleDragEnd),d++})};this.droppablesModified=(a,c)=>{for(let d of c)this.droppables.includes(d)&&(this.droppables=this.droppables.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.droppables.includes(d)||(this.droppables.push(d),this.allDropzones.push(d));for(let d of this.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box")};this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),this.responseIdentifier&&a.dataTransfer.setData("responseIdentifier",this.responseIdentifier),this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),c.setAttribute("dragging",""),this.activateDragLocation(),this.activateDroppables(c)};this.handleDragEnd=async a=>{a.preventDefault();let c=a.currentTarget;this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),c.removeAttribute("dragging")}}handleDraggableContainerChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.dragContainersModified(a||[],c||[])}dragContainersModified(a,c){for(let d of c)this.dragContainers.includes(d)&&(this.dragContainers=this.dragContainers.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.dragContainers.includes(d)||(this.dragContainers.push(d),this.allDropzones.push(d))}handleDraggablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.draggablesModified(a||[],c||[])}handleDroppablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.droppablesModified(a||[],c||[])}firstUpdated(a){super.firstUpdated(a),this.hasAttribute("disabled")||(document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}));let d=Array.from(this.querySelectorAll(s)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(s)||[])),p=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),m=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(m,[]),this.droppablesModified(p,[]),this.draggablesModified(d,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(b=>this.resizeObserver?.observe(b))}async moveDraggableToDroppable(a,c){(()=>{a.style.transform="translate(0, 0)",c.tagName==="SLOT"?a.setAttribute("slot",c.getAttribute("name")):c.appendChild(a),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(a){this.dragContainers.includes(a)?(this._internals.states.add("--dragzone-active"),a.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),a.setAttribute("active",""))}deactivateDroppable(a,c=!0){c&&this._internals.states.add("--dragzone-active"),a.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}updateMinDimensionsForDropZones(){let a=this.querySelectorAll(s),c=Array.from(this.querySelectorAll(e)).map(h=>h),d=0,p=0;a.forEach(h=>{let b=h.getBoundingClientRect();d=Math.max(d,b.height),p=Math.max(p,b.width)});let m=this.querySelector(t)||this.shadowRoot?.querySelector(t);m&&(m.style.minHeight=`${d}px`,m.style.minWidth=`${p}px`);for(let h of c)h.style.minHeight=`${d}px`,h.style.minWidth=`${p}px`}activateDroppables(a){this.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(c=>{c.removeAttribute("enabled")}),this.droppables.forEach(c=>c.removeAttribute("enabled"))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mouseup",this.handleTouchEnd),document.removeEventListener("touchcancel",this.handleTouchCancel)}handleTouchMove(a){if(this.isDraggable&&this.dragClone){let{x:c,y:d}=this.getEventCoordinates(a),p={clientX:c,clientY:d};this.calculateDragDistance(p)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(p));let m=this.findClosestDropzone();this.currentDropTarget=m,m!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),m&&(this.activateDroppable(m),this.dispatchCustomEvent(m,"dragenter")),this.lastTarget=m),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),a.preventDefault()}}handleTouchEnd(a){if(this.isDragging){if(this.currentDropTarget){let c=this.dragClone;this.moveDraggableToDroppable(c,this.currentDropTarget)}this.resetDragState()}this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),a.preventDefault()}handleTouchCancel(a){this.resetDragState()}validate(){if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let p=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,p),this.reportValidity(),c}reportValidity(){let a=this.shadowRoot.querySelector("#validationMessage");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.display="block")),this._internals.validity.valid}checkMaxAssociations(a){let c=this.getMatchMaxValue(a),d=a.querySelectorAll('[qti-draggable="true"]').length;return c===0||d>=c}resetDragState(){if(this.dragClone)if(!(this.currentDropTarget!==null)||this.dragContainers.includes(this.currentDropTarget))this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.pointerEvents="auto",this.dragClone.remove();else{let d=window.getComputedStyle(this.dragSource);for(let p=0;p<d.length;p++){let m=d[p];this.dragClone.style.setProperty(m,d.getPropertyValue(m))}this.dragClone.style.opacity="1.0",this.dragClone.style.display="block",this.dragClone.style.pointerEvents="auto"}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null}checkAllMaxAssociations(){this.droppables.forEach(a=>{this.checkMaxAssociations(a)?this.disableDroppable(a):this.enableDroppable(a)})}getMatchMaxValue(a){let c=a.getAttribute("match-max");return c?parseInt(c,10):1}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get value(){return this.collectResponseData()}set value(a){if(!this.isMatchTabular())if(Array.isArray(a)){a?.forEach(d=>this.placeResponse(d));let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a)}placeResponse(a){let[c,...d]=a.split(" ").reverse(),p=this.findDroppableById(c);d.forEach(m=>this.placeDraggableInDroppable(m,p))}findDroppableById(a){return this.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let d=this.querySelector(`[identifier=${a}]`);if(!c||!d){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let p=()=>{d.style.transform="translate(0, 0)",console.log("droppable",c),c.appendChild(d),this.checkAllMaxAssociations()};document.startViewTransition?await document.startViewTransition(p).finished:p()}getValidAssociations(){return this.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){this.validate();let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(c=>{let d=c.querySelectorAll('[qti-draggable="true"]'),p=Array.from(d).map(h=>h.getAttribute("identifier")),m=c.getAttribute("identifier");return p.map(h=>`${h} ${m}`)}).flat()}reset(a=!0){a&&this.saveResponse()}updateDragClonePosition(a){if(!this.isDragging||!this.dragClone)return;let c=a.clientX-this.cloneOffset.x,d=a.clientY-this.cloneOffset.y,{newLeft:p,newTop:m}=this.applyBoundaries(c,d,this.dragClone);this.dragClone.style.left=`${p}px`,this.dragClone.style.top=`${m}px`}getEventCoordinates(a,c=!1){let d=a.touches?a.touches[0]:a;return{x:c?d.pageX:d.clientX,y:c?d.pageY:d.clientY}}calculateDragDistance(a){let c=Math.abs(a.clientX-this.touchStartPoint.x),d=Math.abs(a.clientY-this.touchStartPoint.y);return c+d}applyBoundaries(a,c,d){let p=new DOMRect(0,0,window.innerWidth,window.innerHeight);this.rootNode instanceof ShadowRoot?p=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document&&(p=document.documentElement.getBoundingClientRect());let m=d.getBoundingClientRect(),h=m.width,b=m.height,y=Math.max(p.left,Math.min(a,p.right-h)),f=Math.max(p.top,Math.min(c,p.bottom-b));return{newLeft:y,newTop:f}}findClosestDropzone(){let a=this.allDropzones.filter(m=>!m.hasAttribute("disabled"));if(!this.dragClone||a.length===0)return null;let c=this.dragClone.getBoundingClientRect(),d=null,p=0;for(let m of a){let h=m.getBoundingClientRect(),b=this.calculateOverlapArea(c,h);b>p&&(p=b,d=m)}if(!d){let m=200;for(let h of a){let b=h.getBoundingClientRect(),y=Math.sqrt(Math.pow(c.left-b.left,2)+Math.pow(c.top-b.top,2));y<m&&(m=y,d=h)}}return d}calculateOverlapArea(a,c){let d=Math.max(0,Math.min(a.right,c.right)-Math.max(a.left,c.left)),p=Math.max(0,Math.min(a.bottom,c.bottom)-Math.max(a.top,c.top));return d*p}dispatchCustomEvent(a,c,d=!0){if(!a)return;let p=new CustomEvent(c,{bubbles:d,cancelable:!0});p.dataTransfer=this.dataTransfer,a.dispatchEvent(p)}handleTouchStart(a){let{x:c,y:d}=this.getEventCoordinates(a);this.dropzoneOriginalParent=a.currentTarget.parentElement,this.touchStartPoint={x:c,y:d},this.dragSource=a.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode();let p=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),m=this.dragSource.parentElement;if(this.droppables.includes(m)){this.enableDroppable(m),this.dragClone=this.dragSource,this.dragSource=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier"));let h=this.findParentInteractionElement(this.dragSource),b=this.dragClone.getBoundingClientRect();h?h.appendChild(this.dragClone):this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),b&&this.setDragCloneStyles(b)}else{let h=p.getBoundingClientRect();this.cloneOffset.x=c-h.left,this.cloneOffset.y=d-h.top,this.dragClone=p.cloneNode(!0),h&&this.setDragCloneStyles(h);let b=this.findParentInteractionElement(this.dragSource);b?b.appendChild(this.dragClone):this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone);let y=this.getMatchMaxValue(this.dragSource),f=this.draggables.filter(Ce=>Ce.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));y!==0&&f.length>=y?(p.style.opacity="0.0",p.style.pointerEvents="none"):p.style.opacity="1.0",a.preventDefault()}}findParentInteractionElement(a){let c=a.parentElement;for(;c&&!c.tagName?.toLowerCase().endsWith("-interaction");)c=c.parentElement;return c}findDraggableInDraggableContainer(a){let c=this.dragContainers.flat();for(let d of c){if(d.getAttribute("identifier")===a)return d;let m=Array.from(d.assignedElements()||[]).find(h=>h.getAttribute("identifier")===a);if(m)return m}}setDragCloneStyles(a){this.dragClone.style.position="fixed",this.dragClone.style.top=`${a.top}px`,this.dragClone.style.left=`${a.left}px`,this.dragClone.style.width=`${a.width}px`,this.dragClone.style.height=`${a.height}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return o([sr({attribute:!1,type:Object})],r.prototype,"configuration",2),o([sr({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),o([sr({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),o([rt(t)],r.prototype,"handleDraggableContainerChange",1),o([rt(s)],r.prototype,"handleDraggablesChange",1),o([rt(e)],r.prototype,"handleDroppablesChange",1),r};import{css as Ca}from"lit";var ri=Ca`
|
|
3974
3970
|
:host {
|
|
3975
3971
|
display: block; /* necessary to calculate scaling position */
|
|
3976
3972
|
}
|
|
3977
3973
|
slot[name='qti-simple-associable-choice'] {
|
|
3978
3974
|
display: flex;
|
|
3979
|
-
|
|
3980
|
-
|
|
3975
|
+
align-items: flex-start;
|
|
3976
|
+
flex: 1;
|
|
3981
3977
|
border: 2px solid transparent;
|
|
3978
|
+
padding: 0.3rem;
|
|
3979
|
+
border-radius: 0.3rem;
|
|
3980
|
+
gap: 0.5rem;
|
|
3982
3981
|
}
|
|
3983
3982
|
|
|
3984
3983
|
:host::part(associables-container) {
|
|
3985
3984
|
display: flex;
|
|
3985
|
+
padding: 0.5rem;
|
|
3986
3986
|
justify-content: space-between;
|
|
3987
3987
|
background: linear-gradient(
|
|
3988
3988
|
180deg,
|
|
@@ -3991,23 +3991,24 @@ qti-response-declaration {
|
|
|
3991
3991
|
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
3992
3992
|
);
|
|
3993
3993
|
}
|
|
3994
|
-
`;var
|
|
3994
|
+
`;var fe=class extends N(u,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.target;this._childrenMap.push(t)}render(){return ii` <slot name="prompt"></slot>
|
|
3995
3995
|
<slot name="qti-simple-associable-choice"></slot>
|
|
3996
3996
|
<div part="drop-container">
|
|
3997
|
-
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
3997
|
+
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>ii`<div part="associables-container">
|
|
3998
|
+
<div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
|
|
3999
|
+
<div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
|
|
4000
|
+
</div>`)}
|
|
4001
|
+
|
|
4002
|
+
<div role="alert" id="validationMessage"></div>
|
|
4003
|
+
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};fe.styles=ri,o([Ta()],fe.prototype,"_childrenMap",2),fe=o([ka("qti-associate-interaction")],fe);import{html as oi}from"lit";import{customElement as Ma,property as kt,state as Sa}from"lit/decorators.js";var U=class extends u{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:Ae(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),t=e.contentDocument;window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
|
|
4003
4004
|
<html>
|
|
4004
4005
|
<head>
|
|
4005
|
-
<link href='${
|
|
4006
|
-
<script src='${
|
|
4006
|
+
<link href='${Ae(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
4007
|
+
<script src='${Ae(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
|
|
4007
4008
|
</head>
|
|
4008
4009
|
<body></body>
|
|
4009
4010
|
</html>
|
|
4010
|
-
`),
|
|
4011
|
+
`),t.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),r=[...e,...t];for(let i of r){let l=i.src;if(new URL(l,window.location.href).origin===window.location.origin)try{let c=i.contentDocument||i.contentWindow.document;c&&this.getInnerIFrames(c,r)}catch(c){console.error("Error accessing nested iframe:",c)}}return r.forEach((i,l)=>{r.indexOf(i)!==l&&r.splice(l,1)}),r}getInnerIFrames(e,t=[]){return e.querySelectorAll("iframe").forEach(i=>{t.push(i);let l=i.src;if(new URL(l,window.location.href).origin===window.location.origin)try{let c=i.contentDocument||i.contentWindow.document;this.getInnerIFrames(c,t)}catch(c){console.error("Error accessing nested iframe:",c)}else console.warn("Skipped cross-origin iframe:",l)}),t}postToWindowAndIframes(e,t){window.postMessage({type:e,data:t},"*");let r=this.getIFrames();for(let i of r)i.contentWindow&&i.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:r}=e.data;switch(t){case"setResponse":this.rawResponse=r,this.saveResponse(r);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let i=this.manifest.media.map(l=>l.startsWith("http")?l:Ae(this.baseRefUrl+"/"+l));this.postToWindowAndIframes("mediaData",i);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get value(){return this.rawResponse}set value(e){if(typeof e=="string")this.rawResponse=e,this.saveResponse(e);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return oi`<iframe
|
|
4011
4012
|
width=${this.getAttribute("width")}
|
|
4012
4013
|
height=${this.getAttribute("height")}
|
|
4013
4014
|
frameborder="0"
|
|
@@ -4015,10 +4016,10 @@ qti-response-declaration {
|
|
|
4015
4016
|
id="pciContainer"
|
|
4016
4017
|
>
|
|
4017
4018
|
</iframe>
|
|
4018
|
-
${this._errorMessage&&
|
|
4019
|
+
${this._errorMessage&&oi`<div style="color:red">
|
|
4019
4020
|
<h1>Error</h1>
|
|
4020
4021
|
${this._errorMessage}
|
|
4021
|
-
</div>`}`}};
|
|
4022
|
+
</div>`}`}};o([kt({type:String,attribute:"data"})],U.prototype,"data",2),o([kt({type:String,attribute:"data-base-item"})],U.prototype,"baseItemUrl",2),o([kt({type:String,attribute:"data-base-ref"})],U.prototype,"baseRefUrl",2),o([kt({type:String,attribute:"id"})],U.prototype,"id",2),o([Sa()],U.prototype,"_errorMessage",2),U=o([Ma("qti-custom-interaction")],U);import{html as La,LitElement as _a}from"lit";import{customElement as Aa,property as Tt}from"lit/decorators.js";var G=class extends _a{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return La`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};o([Tt({type:String,attribute:"response-identifier"})],G.prototype,"responseIdentifier",2),o([Tt({reflect:!0,type:Boolean})],G.prototype,"disabled",2),o([Tt({type:String,attribute:"count-attempt"})],G.prototype,"countAttempt",2),o([Tt({type:String})],G.prototype,"title",2),G=o([Aa("qti-end-attempt-interaction")],G);import{html as Da}from"lit";import{customElement as Ia}from"lit/decorators.js";import{css as Ra}from"lit";var si=Ra`
|
|
4022
4023
|
:host {
|
|
4023
4024
|
display: flex;
|
|
4024
4025
|
align-items: flex-start;
|
|
@@ -4052,17 +4053,40 @@ qti-response-declaration {
|
|
|
4052
4053
|
border-radius: 0.3rem;
|
|
4053
4054
|
gap: 0.5rem;
|
|
4054
4055
|
}
|
|
4055
|
-
`;var
|
|
4056
|
+
`;var Fe=class extends N(u,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return Da`<slot name="prompt"> </slot>
|
|
4056
4057
|
<slot part="drags" name="drags"></slot>
|
|
4057
4058
|
<slot part="drops"></slot>
|
|
4058
|
-
<div role="alert" id="validationMessage"></div>`}set correctResponse(
|
|
4059
|
+
<div role="alert" id="validationMessage"></div>`}set correctResponse(s){let e=[],t=Array.isArray(s)?s:[s];t&&(e=t.map(i=>{let l=i.split(" ");return{text:l[0],gap:l[1]}})),this.querySelectorAll("qti-gap").forEach(i=>{let l=i.getAttribute("identifier"),a=e.find(d=>d.gap===l)?.text,c=this.querySelector(`qti-gap-text[identifier="${a}"]`)?.textContent.trim();if(a&&c){if(!i.nextElementSibling?.classList.contains("correct-option")){let d=document.createElement("span");d.classList.add("correct-option"),d.textContent=c,i.insertAdjacentElement("afterend",d)}}else i.nextElementSibling?.classList.contains("correct-option")&&i.nextElementSibling.remove()})}};Fe.styles=si,Fe=o([Ia("qti-gap-match-interaction")],Fe);import{html as Ha,svg as ni}from"lit";import{customElement as Na,queryAssignedElements as $a,state as ar}from"lit/decorators.js";import{ifDefined as li}from"lit/directives/if-defined.js";import{repeat as za}from"lit/directives/repeat.js";function ve(n,s,e,t){switch(n){case"circle":{let[r,i,l]=s,a=r/e.width*100,c=i/e.height*100,d=l/e.width*100;t.style.left=a-d+"%",t.style.top=c-d+"%",t.style.width=t.style.height=4*d+"px",t.style.borderRadius="9999px"}break;case"rect":{let[r,i,l,a]=s,c=r/e.width*100,d=i/e.height*100,p=l/e.width*100,m=a/e.height*100;t.style.left=c+"%",t.style.top=d+"%",t.style.width=p-c+"%",t.style.height=m-d+"%"}break;case"poly":{let r=s.reduce((f,Ce,Ze,dr)=>{if(Ze%2===1){let ke=f.pop();f[f.length]={x:ke,y:dr[Ze]}}else f.push(Ce);return f},[]),i=Math.min(...r.map(f=>f.x)),l=Math.max(...r.map(f=>f.x)),a=Math.min(...r.map(f=>f.y)),c=Math.max(...r.map(f=>f.y)),d=i/e.width*100,p=a/e.height*100,m=l/e.width*100,h=c/e.height*100;t.style.left=i/e.width*100+"%",t.style.top=a/e.height*100+"%",t.style.width=m-d+"%",t.style.height=h-p+"%";let y=r.map(f=>({x:(f.x-i)/(l-i)*100,y:(f.y-a)/(c-a)*100})).map(f=>Math.round(f.x)+"% "+Math.round(f.y)+"%").join(",");t.style.clipPath=`polygon(${y})`}break;default:break}}import{css as Va}from"lit";var ai=Va`
|
|
4060
|
+
slot:not([name='prompt']) {
|
|
4061
|
+
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4062
|
+
display: block;
|
|
4063
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
4064
|
+
}
|
|
4065
|
+
::slotted(img) {
|
|
4066
|
+
/* image not selectable anymore */
|
|
4067
|
+
pointer-events: none;
|
|
4068
|
+
user-select: none;
|
|
4069
|
+
}
|
|
4070
|
+
::slotted(qti-associable-hotspot) {
|
|
4071
|
+
transform: translate(-50%, -50%);
|
|
4072
|
+
}
|
|
4073
|
+
line-container {
|
|
4074
|
+
display: block;
|
|
4075
|
+
position: relative;
|
|
4076
|
+
}
|
|
4077
|
+
svg {
|
|
4078
|
+
position: absolute;
|
|
4079
|
+
top: 0px;
|
|
4080
|
+
left: 0px;
|
|
4081
|
+
}
|
|
4082
|
+
`;var X=class extends u{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set value(e){Array.isArray(e)&&(this._lines=e)}get value(){return this._lines}render(){return Ha`<slot name="prompt"></slot>
|
|
4059
4083
|
<line-container>
|
|
4060
4084
|
<svg
|
|
4061
|
-
width=${
|
|
4062
|
-
height=${
|
|
4085
|
+
width=${li(this.grImage[0]?.width)}
|
|
4086
|
+
height=${li(this.grImage[0]?.height)}
|
|
4063
4087
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
4064
4088
|
>
|
|
4065
|
-
${
|
|
4089
|
+
${za(this._lines,e=>e,(e,t)=>ni`
|
|
4066
4090
|
<line
|
|
4067
4091
|
part="line"
|
|
4068
4092
|
x1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.left)}
|
|
@@ -4071,10 +4095,10 @@ qti-response-declaration {
|
|
|
4071
4095
|
y2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.top)}
|
|
4072
4096
|
stroke="red"
|
|
4073
4097
|
stroke-width="3"
|
|
4074
|
-
@click=${
|
|
4098
|
+
@click=${r=>{r.stopPropagation(),this._lines=this._lines.filter((i,l)=>l!==t),this.saveResponse(this._lines)}}
|
|
4075
4099
|
/>
|
|
4076
4100
|
`)}
|
|
4077
|
-
${this.startPoint&&
|
|
4101
|
+
${this.startPoint&&ni`<line
|
|
4078
4102
|
part="point"
|
|
4079
4103
|
x1=${this.startCoord.x}
|
|
4080
4104
|
y1=${this.startCoord.y}
|
|
@@ -4086,30 +4110,7 @@ qti-response-declaration {
|
|
|
4086
4110
|
</svg>
|
|
4087
4111
|
<slot></slot>
|
|
4088
4112
|
</line-container>
|
|
4089
|
-
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let
|
|
4090
|
-
slot:not([name='prompt']) {
|
|
4091
|
-
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4092
|
-
display: block;
|
|
4093
|
-
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
4094
|
-
}
|
|
4095
|
-
::slotted(img) {
|
|
4096
|
-
/* image not selectable anymore */
|
|
4097
|
-
pointer-events: none;
|
|
4098
|
-
user-select: none;
|
|
4099
|
-
}
|
|
4100
|
-
::slotted(qti-associable-hotspot) {
|
|
4101
|
-
transform: translate(-50%, -50%);
|
|
4102
|
-
}
|
|
4103
|
-
line-container {
|
|
4104
|
-
display: block;
|
|
4105
|
-
position: relative;
|
|
4106
|
-
}
|
|
4107
|
-
svg {
|
|
4108
|
-
position: absolute;
|
|
4109
|
-
top: 0px;
|
|
4110
|
-
left: 0px;
|
|
4111
|
-
}
|
|
4112
|
-
`],l([q()],re.prototype,"_lines",2),l([q()],re.prototype,"startCoord",2),l([q()],re.prototype,"mouseCoord",2),l([Oe("svg")],re.prototype,"svgContainer",2),l([ji({selector:"img"})],re.prototype,"grImage",2),re=l([u("qti-graphic-associate-interaction")],re);var Os=b`
|
|
4113
|
+
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),l=r.getAttribute("shape"),a=i.split(",").map(c=>parseInt(c));ve(l,a,t,r)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",t=>{this.mouseCoord={x:t.clientX-this.grImage[0].getBoundingClientRect().left,y:t.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",r=>{this.startPoint?this.endPoint||(this.endPoint=r.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=r.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};X.styles=ai,o([ar()],X.prototype,"_lines",2),o([ar()],X.prototype,"startCoord",2),o([ar()],X.prototype,"mouseCoord",2),o([$a({selector:"img"})],X.prototype,"grImage",2),X=o([Na("qti-graphic-associate-interaction")],X);import{html as Fa}from"lit";import{customElement as Pa}from"lit/decorators.js";import{css as Oa}from"lit";var ci=Oa`
|
|
4113
4114
|
:host {
|
|
4114
4115
|
display: flex;
|
|
4115
4116
|
align-items: flex-start;
|
|
@@ -4163,47 +4164,43 @@ qti-response-declaration {
|
|
|
4163
4164
|
user-select: none;
|
|
4164
4165
|
pointer-events: none;
|
|
4165
4166
|
}
|
|
4166
|
-
`;var
|
|
4167
|
+
`;var Pe=class extends N(u,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){render(){return Fa` <slot name="prompt"></slot>
|
|
4167
4168
|
<slot part="image"></slot>
|
|
4168
4169
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
4169
|
-
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(
|
|
4170
|
+
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(s){let e=s.target,t=e.getAttribute("coords"),r=e.getAttribute("shape"),i=t.split(",").map(l=>parseInt(l));switch(r){case"circle":{let[l,a,c]=i;e.style.left=l-c+"px",e.style.top=a-c+"px",e.style.width=e.style.height=2*c+"px"}break;case"rect":{let[l,a,c,d]=i;e.style.left=l+"px",e.style.top=a+"px",e.style.width=c-l+"px",e.style.height=d-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Pe.styles=ci,Pe=o([Pa("qti-graphic-gap-match-interaction")],Pe);import{html as Xa}from"lit";import{customElement as Ba}from"lit/decorators.js";import{css as Ua}from"lit";var di=Ua`
|
|
4171
|
+
slot:not([name='prompt']) {
|
|
4172
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4173
|
+
display: block;
|
|
4174
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
4175
|
+
}
|
|
4176
|
+
::slotted(img) {
|
|
4177
|
+
/* image not selectable anymore */
|
|
4178
|
+
pointer-events: none;
|
|
4179
|
+
user-select: none;
|
|
4180
|
+
}
|
|
4181
|
+
`;var Ue=class extends Y(u,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return Xa`
|
|
4170
4182
|
<slot name="prompt"></slot>
|
|
4171
|
-
<!-- slot for the prompt -->
|
|
4172
4183
|
<slot></slot>
|
|
4173
|
-
<!-- slot for the image and hotspots -->
|
|
4174
4184
|
<div role="alert" id="validationMessage"></div>
|
|
4175
|
-
`}setHotspotOrder(e){let{identifier:
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4185
|
+
`}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(l=>l.getAttribute("identifier")===t),i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(l=>l.order>0).length>=i){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(l=>!!l.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(l=>(l.order>l.order&&l.order--,l)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),l=r.getAttribute("shape"),a=i.split(",").map(c=>parseInt(c));ve(l,a,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};Ue.styles=di,Ue=o([Ba("qti-graphic-order-interaction")],Ue);import{html as Wa}from"lit";import{customElement as Ya}from"lit/decorators.js";import{css as ja}from"lit";var pi=ja`
|
|
4186
|
+
slot:not([name='prompt']) {
|
|
4187
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4188
|
+
display: block;
|
|
4189
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
4190
|
+
}
|
|
4191
|
+
::slotted(img) {
|
|
4192
|
+
/* image not selectable anymore */
|
|
4193
|
+
pointer-events: none;
|
|
4194
|
+
user-select: none;
|
|
4195
|
+
/* width:100%; */
|
|
4196
|
+
}
|
|
4197
|
+
`;var Xe=class extends Y(u,"qti-hotspot-choice"){render(){return Wa`
|
|
4187
4198
|
<slot name="prompt"></slot>
|
|
4188
|
-
<!-- slot for the prompt -->
|
|
4189
4199
|
<slot></slot>
|
|
4190
|
-
|
|
4191
|
-
`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));Ze(o,n,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};Ot.styles=[b`
|
|
4192
|
-
slot:not([name='prompt']) {
|
|
4193
|
-
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4194
|
-
display: block;
|
|
4195
|
-
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
4196
|
-
}
|
|
4197
|
-
::slotted(img) {
|
|
4198
|
-
/* image not selectable anymore */
|
|
4199
|
-
pointer-events: none;
|
|
4200
|
-
user-select: none;
|
|
4201
|
-
/* width:100%; */
|
|
4202
|
-
}
|
|
4203
|
-
`],Ot=l([u("qti-hotspot-interaction")],Ot);var Ee=class extends K(v,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return h`
|
|
4200
|
+
`}positionHotspotOnRegister(s){let e=this.querySelector("img"),t=s.target,r=t.getAttribute("coords"),i=t.getAttribute("shape"),l=r.split(",").map(a=>parseInt(a));ve(i,l,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};Xe.styles=pi,Xe=o([Ya("qti-hotspot-interaction")],Xe);import{html as Be,nothing as en}from"lit";import{customElement as tn,property as hi,state as ui}from"lit/decorators.js";import{unsafeHTML as gi}from"lit/directives/unsafe-html.js";import{css as Ka,html as Ga,LitElement as Ja}from"lit";import{customElement as Za,property as nr}from"lit/decorators.js";var J=class extends R(Ja,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return Ga`
|
|
4204
4201
|
<slot part="slot"></slot>
|
|
4205
4202
|
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
4206
|
-
`}};
|
|
4203
|
+
`}};J.styles=Ka`
|
|
4207
4204
|
:host {
|
|
4208
4205
|
display: flex;
|
|
4209
4206
|
user-select: none;
|
|
@@ -4215,7 +4212,7 @@ qti-response-declaration {
|
|
|
4215
4212
|
slot[name='qti-simple-associable-choice'] {
|
|
4216
4213
|
width: 100%;
|
|
4217
4214
|
}
|
|
4218
|
-
`,
|
|
4215
|
+
`,o([nr({type:Number,attribute:"match-min"})],J.prototype,"matchMin",2),o([nr({type:Number,attribute:"match-max"})],J.prototype,"matchMax",2),o([nr({type:Boolean,attribute:"fixed"})],J.prototype,"fixed",2),J=o([Za("qti-simple-associable-choice")],J);import{css as Qa}from"lit";var mi=Qa`
|
|
4219
4216
|
slot:not([hidden]) {
|
|
4220
4217
|
/* slot where the */
|
|
4221
4218
|
display: flex;
|
|
@@ -4242,37 +4239,37 @@ qti-response-declaration {
|
|
|
4242
4239
|
/* Make sure the drag and drop container slots have the same width */
|
|
4243
4240
|
flex: 1;
|
|
4244
4241
|
}
|
|
4245
|
-
`;var
|
|
4242
|
+
`;var B=class extends N(u,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=[];this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,r=t.value,i=t.name,l=t.type;t.checked?(this.value?this.value.indexOf(r)===-1&&(l==="radio"&&(this.value=this.value.filter(a=>a.indexOf(i)===-1)),this.value=[...this.value,r]):this.value=[r],this.lastCheckedRadio=t):(this.value=this.value.filter(a=>a!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.value)?[...this.value]:this.value}}))}}get value(){return this.classList.contains("qti-match-tabular")?this._response:super.value}set value(e){this.classList.contains("qti-match-tabular")?this._response=e:super.value=e}async connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.value=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){let e=this.class.split(" ").includes("qti-match-tabular");return Be`
|
|
4246
4243
|
<slot name="prompt"></slot>
|
|
4247
4244
|
<slot ?hidden=${e}></slot>
|
|
4248
4245
|
|
|
4249
|
-
${e?
|
|
4246
|
+
${e?Be`
|
|
4250
4247
|
<table>
|
|
4251
4248
|
<tr>
|
|
4252
4249
|
<td></td>
|
|
4253
|
-
${this.cols.map(
|
|
4250
|
+
${this.cols.map(t=>Be`<th part="r-header">${gi(t.innerHTML)}</th>`)}
|
|
4254
4251
|
</tr>
|
|
4255
4252
|
|
|
4256
|
-
${this.rows.map(
|
|
4257
|
-
<td part="c-header">${
|
|
4258
|
-
${this.cols.map(
|
|
4253
|
+
${this.rows.map(t=>Be`<tr>
|
|
4254
|
+
<td part="c-header">${gi(t.innerHTML)}</td>
|
|
4255
|
+
${this.cols.map(r=>{let i=t.getAttribute("identifier"),l=r.getAttribute("identifier"),a=`${i} ${l}`,c=this.value.filter(h=>h.split(" ")[0]===i).length||0,d=this.value.includes(a),p=`rb ${d?"rb-checked":""} ${this.correctOptions.includes(a)?"rb-correct":""}`,m=this.correctOptions.length>0?!0:t.matchMax===1?!1:c>=t.matchMax&&!d;return Be`<td>
|
|
4259
4256
|
<input
|
|
4260
|
-
type=${
|
|
4261
|
-
part=${
|
|
4262
|
-
name=${
|
|
4257
|
+
type=${t.matchMax===1?"radio":"checkbox"}
|
|
4258
|
+
part=${p}
|
|
4259
|
+
name=${i}
|
|
4263
4260
|
value=${a}
|
|
4264
|
-
.disabled=${
|
|
4265
|
-
@change=${
|
|
4266
|
-
@click=${
|
|
4261
|
+
.disabled=${m}
|
|
4262
|
+
@change=${h=>this.handleRadioChange(h)}
|
|
4263
|
+
@click=${h=>t.matchMax===1?this.handleRadioClick(h):null}
|
|
4267
4264
|
/>
|
|
4268
4265
|
</td>`})}
|
|
4269
4266
|
</tr>`)}
|
|
4270
4267
|
</table>
|
|
4271
|
-
`:
|
|
4268
|
+
`:en}
|
|
4272
4269
|
|
|
4273
4270
|
<div role="alert" id="validationMessage"></div>
|
|
4274
|
-
`}};
|
|
4275
|
-
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};
|
|
4271
|
+
`}};B.styles=mi,o([hi({type:String})],B.prototype,"class",2),o([ui()],B.prototype,"_response",2),o([hi({type:String,attribute:"response-identifier"})],B.prototype,"responseIdentifier",2),o([ui()],B.prototype,"correctOptions",2),B=o([tn("qti-match-interaction")],B);import{css as rn,html as on}from"lit";import{customElement as sn}from"lit/decorators.js";var je=class extends u{constructor(){super();this._value=0}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}static get properties(){return{...u.properties,step:{type:Number,attribute:"step",default:10}}}render(){return on` <slot name="prompt"></slot>
|
|
4272
|
+
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};je.styles=[rn``],je=o([sn("qti-media-interaction")],je);import{html as fi}from"lit";import{customElement as nn,property as ln,state as lr}from"lit/decorators.js";import{unsafeHTML as cn}from"lit/directives/unsafe-html.js";import{css as an}from"lit";var bi=an`
|
|
4276
4273
|
[part='drags'] {
|
|
4277
4274
|
display: flex;
|
|
4278
4275
|
align-items: flex-start;
|
|
@@ -4321,13 +4318,13 @@ qti-response-declaration {
|
|
|
4321
4318
|
:host(.qti-choices-right) [part='container'] {
|
|
4322
4319
|
flex-direction: row-reverse;
|
|
4323
4320
|
}
|
|
4324
|
-
`;var
|
|
4321
|
+
`;var j=class extends bt(N(u,"qti-simple-choice","drop-list","slot[part='drags']"),"qti-simple-choice"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),fi` <slot name="prompt"> </slot>
|
|
4325
4322
|
<div part="container">
|
|
4326
4323
|
<slot part="drags"> </slot>
|
|
4327
4324
|
<div part="drops">
|
|
4328
|
-
${Array.from(Array(this.nrChoices)).map((r
|
|
4325
|
+
${Array.from(Array(this.nrChoices)).map((t,r)=>fi`<drop-list part="drop-list" identifier="droplist${r}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>r?cn(`<span part='correct-response'>${this.correctResponses[r]}</span>`):""}`)}
|
|
4329
4326
|
</div>
|
|
4330
|
-
</div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach(
|
|
4327
|
+
</div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach(r=>{let i=this.querySelector(`qti-simple-choice[identifier="${r}"]`);i||(i=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${r}"]`));let l=i?.textContent.trim();this.correctResponses=[...this.correctResponses,l]}),this.showCorrectResponses=!0}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(r=>{let i=r.querySelectorAll('[qti-draggable="true"]');return[...Array.from(i).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};j.styles=bi,o([lr()],j.prototype,"nrChoices",2),o([lr()],j.prototype,"correctResponses",2),o([lr()],j.prototype,"showCorrectResponses",2),o([ln({type:String})],j.prototype,"orientation",2),j=o([nn("qti-order-interaction")],j);import{LitElement as dn,css as pn,html as mn}from"lit";var Mt=class extends dn{render(){return mn`<slot></slot>`}};Mt.styles=[pn`
|
|
4331
4328
|
:host {
|
|
4332
4329
|
display: block;
|
|
4333
4330
|
}
|
|
@@ -4338,23 +4335,23 @@ qti-response-declaration {
|
|
|
4338
4335
|
left: 50%;
|
|
4339
4336
|
transform: translateX(-50%);
|
|
4340
4337
|
}
|
|
4341
|
-
`];customElements.define("qti-position-object-interaction",
|
|
4338
|
+
`];customElements.define("qti-position-object-interaction",Mt);import{LitElement as hn,css as un,html as gn}from"lit";import{customElement as bn}from"lit/decorators.js";var We=class extends hn{render(){return gn`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(s){s.preventDefault();let e=s.clientX-this.startX,t=s.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=s.clientX,this.startY=s.clientY}firstUpdated(s){super.firstUpdated(s),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};We.styles=[un`
|
|
4342
4339
|
:host {
|
|
4343
4340
|
display: inline-block;
|
|
4344
4341
|
position: relative;
|
|
4345
4342
|
}
|
|
4346
|
-
`],
|
|
4343
|
+
`],We=o([bn("qti-position-object-stage")],We);import{css as fn,html as vi}from"lit";import{customElement as vn,property as yi,state as yn}from"lit/decorators.js";import{repeat as qn}from"lit/directives/repeat.js";import{styleMap as xn}from"lit/directives/style-map.js";var Z=class extends u{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this._points.length<this.maxChoices){let t=e.offsetX,r=e.offsetY;this._points=[...this._points,`${t} ${r}`],this.saveResponse(this._points)}}}render(){return vi` <slot name="prompt"></slot>
|
|
4347
4344
|
<point-container>
|
|
4348
|
-
${
|
|
4345
|
+
${qn(this._points,e=>e,(e,t)=>vi`
|
|
4349
4346
|
<button
|
|
4350
4347
|
part="point"
|
|
4351
|
-
style=${
|
|
4348
|
+
style=${xn({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
4352
4349
|
aria-label="Remove point at ${e}"
|
|
4353
|
-
@click=${
|
|
4350
|
+
@click=${r=>{r.stopPropagation(),this._points=this._points.filter((i,l)=>l!==t),this.saveResponse(this._points)}}
|
|
4354
4351
|
></button>
|
|
4355
4352
|
`)}
|
|
4356
4353
|
<slot></slot>
|
|
4357
|
-
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(e){this._points=Array.isArray(e)?e:[e]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};
|
|
4354
|
+
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(e){this._points=Array.isArray(e)?e:[e]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};Z.styles=[fn`
|
|
4358
4355
|
:host {
|
|
4359
4356
|
display: block;
|
|
4360
4357
|
}
|
|
@@ -4362,7 +4359,7 @@ qti-response-declaration {
|
|
|
4362
4359
|
display: block;
|
|
4363
4360
|
position: relative;
|
|
4364
4361
|
}
|
|
4365
|
-
`],
|
|
4362
|
+
`],o([yi({type:Number,attribute:"max-choices"})],Z.prototype,"maxChoices",2),o([yi({type:Number,attribute:"min-choices"})],Z.prototype,"minChoices",2),o([yn()],Z.prototype,"_points",2),Z=o([vn("qti-select-point-interaction")],Z);import{html as En,LitElement as Cn}from"lit";import{customElement as kn,property as cr,query as Tn}from"lit/decorators.js";import{css as wn}from"lit";var qi=wn`
|
|
4366
4363
|
:host {
|
|
4367
4364
|
display: block;
|
|
4368
4365
|
--show-bounds: true;
|
|
@@ -4430,7 +4427,7 @@ qti-response-declaration {
|
|
|
4430
4427
|
text-align: center;
|
|
4431
4428
|
color: #6b7280; /* text-gray-500 */
|
|
4432
4429
|
}
|
|
4433
|
-
`;var
|
|
4430
|
+
`;var $=class extends Cn{constructor(){super();this._value=0;this.min=0;this.max=100;this.step=1;this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get value(){return this._value.toString()}set value(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}_updateValue(e){this._value=Math.min(this.max,Math.max(this.min,e));let t=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${t}%`),this._internals.setFormValue(this.value),this.requestUpdate()}render(){return En`
|
|
4434
4431
|
<slot name="prompt"></slot>
|
|
4435
4432
|
<div id="slider" part="slider">
|
|
4436
4433
|
<div id="bounds" part="bounds">
|
|
@@ -4444,49 +4441,49 @@ qti-response-declaration {
|
|
|
4444
4441
|
<div id="knob" part="knob"><div id="value" part="value">${this.value}</div></div>
|
|
4445
4442
|
</div>
|
|
4446
4443
|
</div>
|
|
4447
|
-
`}_onMouseDown(e){this._startDrag(e.pageX);let
|
|
4444
|
+
`}_onMouseDown(e){this._startDrag(e.pageX);let t=i=>this._onDrag(i.pageX),r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=i=>this._onDrag(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",r)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),r=e-t.left,i=Math.min(1,Math.max(0,r/t.width)),l=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this._updateValue(l)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};$.formAssociated=!0,$.styles=qi,o([Tn("#rail")],$.prototype,"_rail",2),o([cr({type:Number,attribute:"lower-bound"})],$.prototype,"min",2),o([cr({type:Number,attribute:"upper-bound"})],$.prototype,"max",2),o([cr({type:Number,attribute:"step"})],$.prototype,"step",2),$=o([kn("qti-slider-interaction")],$);import{consume as Mn}from"@lit/context";import{LitElement as Sn,html as Ln}from"lit";import{customElement as _n,state as An}from"lit/decorators.js";var Ye=class extends Sn{render(){return Ln`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let s=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",s?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let s={variable:t=>this._context?.variables.find(r=>r.identifier===t)?.value??"",correct:t=>this._context?.variables.find(r=>r.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(r=>r.identifier===t),updateOutcomeVariable:(t,r)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:r}}))},updateResponseVariable:(t,r)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:r}}))}};return this.operatorFunction(this._context,s,e)}};o([Mn({context:x,subscribe:!0}),An()],Ye.prototype,"_context",2),Ye=o([_n("qti-custom-operator")],Ye);import{LitElement as Rn,css as Dn,html as In}from"lit";import{customElement as Vn}from"lit/decorators.js";var Ke=class extends Rn{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return In` <slot name="drags"></slot> `}};Ke.styles=Dn`
|
|
4448
4445
|
:host {
|
|
4449
4446
|
display: flex;
|
|
4450
4447
|
user-select: none;
|
|
4451
4448
|
position: absolute;
|
|
4452
4449
|
}
|
|
4453
|
-
`,
|
|
4450
|
+
`,Ke=o([Vn("qti-associable-hotspot")],Ke);import{css as Hn,html as Nn,LitElement as $n}from"lit";import{customElement as zn,property as On}from"lit/decorators.js";var ye=class extends $n{constructor(){super(...arguments);this.tabindex=0}render(){return Nn` <slot name="drags"></slot>`}};ye.styles=Hn`
|
|
4454
4451
|
:host {
|
|
4455
4452
|
display: flex;
|
|
4456
4453
|
user-select: none;
|
|
4457
4454
|
}
|
|
4458
|
-
`,
|
|
4455
|
+
`,o([On({type:Number,reflect:!0})],ye.prototype,"tabindex",2),ye=o([zn("qti-gap")],ye);import{css as Fn,LitElement as Pn}from"lit";import{customElement as Un,property as Xn}from"lit/decorators.js";var qe=class extends Pn{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};qe.styles=Fn`
|
|
4459
4456
|
:host {
|
|
4460
4457
|
display: flex;
|
|
4461
4458
|
user-select: none;
|
|
4462
4459
|
}
|
|
4463
|
-
`,
|
|
4460
|
+
`,o([Xn({type:Number,reflect:!0})],qe.prototype,"tabindex",2),qe=o([Un("qti-gap-img")],qe);import{css as Bn,html as jn,LitElement as Wn}from"lit";import{customElement as Yn,property as Kn}from"lit/decorators.js";var xe=class extends R(Wn,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return jn`<slot></slot>`}};xe.styles=Bn`
|
|
4464
4461
|
:host {
|
|
4465
4462
|
display: inline-flex;
|
|
4466
4463
|
user-select: none;
|
|
4467
4464
|
}
|
|
4468
|
-
`,
|
|
4465
|
+
`,o([Kn({type:Number,reflect:!0})],xe.prototype,"tabindex",2),xe=o([Yn("qti-gap-text")],xe);import{css as Gn,LitElement as Jn}from"lit";import{customElement as Zn,property as Qn}from"lit/decorators.js";var we=class extends R(Jn,"qti-hotspot-choice"){};we.styles=Gn`
|
|
4469
4466
|
:host {
|
|
4470
4467
|
display: flex;
|
|
4471
4468
|
user-select: none;
|
|
4472
4469
|
position: absolute;
|
|
4473
4470
|
}
|
|
4474
|
-
`,
|
|
4475
|
-
<slot></slot> `}};
|
|
4471
|
+
`,o([Qn({attribute:"aria-ordervalue",type:Number,reflect:!0})],we.prototype,"order",2),we=o([Zn("qti-hotspot-choice")],we);import{css as el,html as tl,LitElement as rl}from"lit";import{customElement as il}from"lit/decorators.js";var Ge=class extends R(rl,"qti-hottext"){render(){return tl`<div part="ch"><div part="cha"></div></div>
|
|
4472
|
+
<slot></slot> `}};Ge.styles=el`
|
|
4476
4473
|
:host {
|
|
4477
4474
|
display: flex;
|
|
4478
4475
|
user-select: none;
|
|
4479
4476
|
}
|
|
4480
|
-
`,
|
|
4477
|
+
`,Ge=o([il("qti-hottext")],Ge);import{css as ol,html as sl,LitElement as al}from"lit";import{customElement as nl,property as ll}from"lit/decorators.js";var Je=class extends al{static get styles(){return[ol`
|
|
4481
4478
|
:host {
|
|
4482
4479
|
display: block;
|
|
4483
4480
|
cursor: pointer;
|
|
4484
4481
|
}
|
|
4485
|
-
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return
|
|
4482
|
+
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return sl` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};o([ll({type:String})],Je.prototype,"identifier",2),Je=o([nl("qti-inline-choice")],Je);import{css as cl,html as xi,LitElement as dl,nothing as pl}from"lit";import{customElement as ml,property as hl}from"lit/decorators.js";var Ee=class extends R(dl,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return xi`<div part="ch">
|
|
4486
4483
|
<div part="cha"></div>
|
|
4487
4484
|
</div>
|
|
4488
|
-
${this.marker?
|
|
4489
|
-
<slot part="slot"></slot> `}};
|
|
4485
|
+
${this.marker?xi`<div id="label">${this.marker}</div>`:pl}
|
|
4486
|
+
<slot part="slot"></slot> `}};Ee.styles=cl`
|
|
4490
4487
|
:host {
|
|
4491
4488
|
display: flex;
|
|
4492
4489
|
align-items: center;
|
|
@@ -4503,281 +4500,4 @@ qti-response-declaration {
|
|
|
4503
4500
|
align-items: center;
|
|
4504
4501
|
justify-content: center;
|
|
4505
4502
|
}
|
|
4506
|
-
`,
|
|
4507
|
-
/*! Bundled license information:
|
|
4508
|
-
|
|
4509
|
-
@lit/context/lib/context-request-event.js:
|
|
4510
|
-
(**
|
|
4511
|
-
* @license
|
|
4512
|
-
* Copyright 2021 Google LLC
|
|
4513
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4514
|
-
*)
|
|
4515
|
-
|
|
4516
|
-
@lit/context/lib/create-context.js:
|
|
4517
|
-
(**
|
|
4518
|
-
* @license
|
|
4519
|
-
* Copyright 2021 Google LLC
|
|
4520
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4521
|
-
*)
|
|
4522
|
-
|
|
4523
|
-
@lit/context/lib/controllers/context-consumer.js:
|
|
4524
|
-
(**
|
|
4525
|
-
* @license
|
|
4526
|
-
* Copyright 2021 Google LLC
|
|
4527
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4528
|
-
*)
|
|
4529
|
-
|
|
4530
|
-
@lit/context/lib/value-notifier.js:
|
|
4531
|
-
(**
|
|
4532
|
-
* @license
|
|
4533
|
-
* Copyright 2021 Google LLC
|
|
4534
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4535
|
-
*)
|
|
4536
|
-
|
|
4537
|
-
@lit/context/lib/controllers/context-provider.js:
|
|
4538
|
-
(**
|
|
4539
|
-
* @license
|
|
4540
|
-
* Copyright 2021 Google LLC
|
|
4541
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4542
|
-
*)
|
|
4543
|
-
|
|
4544
|
-
@lit/context/lib/context-root.js:
|
|
4545
|
-
(**
|
|
4546
|
-
* @license
|
|
4547
|
-
* Copyright 2021 Google LLC
|
|
4548
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4549
|
-
*)
|
|
4550
|
-
|
|
4551
|
-
@lit/context/lib/decorators/provide.js:
|
|
4552
|
-
(**
|
|
4553
|
-
* @license
|
|
4554
|
-
* Copyright 2017 Google LLC
|
|
4555
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4556
|
-
*)
|
|
4557
|
-
|
|
4558
|
-
@lit/context/lib/decorators/consume.js:
|
|
4559
|
-
(**
|
|
4560
|
-
* @license
|
|
4561
|
-
* Copyright 2022 Google LLC
|
|
4562
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4563
|
-
*)
|
|
4564
|
-
|
|
4565
|
-
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
4566
|
-
(**
|
|
4567
|
-
* @license
|
|
4568
|
-
* Copyright 2023 Google LLC
|
|
4569
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4570
|
-
*)
|
|
4571
|
-
|
|
4572
|
-
@lit-labs/ssr-dom-shim/index.js:
|
|
4573
|
-
(**
|
|
4574
|
-
* @license
|
|
4575
|
-
* Copyright 2019 Google LLC
|
|
4576
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4577
|
-
*)
|
|
4578
|
-
|
|
4579
|
-
@lit/reactive-element/node/css-tag.js:
|
|
4580
|
-
(**
|
|
4581
|
-
* @license
|
|
4582
|
-
* Copyright 2019 Google LLC
|
|
4583
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4584
|
-
*)
|
|
4585
|
-
|
|
4586
|
-
lit-html/node/lit-html.js:
|
|
4587
|
-
(**
|
|
4588
|
-
* @license
|
|
4589
|
-
* Copyright 2017 Google LLC
|
|
4590
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4591
|
-
*)
|
|
4592
|
-
|
|
4593
|
-
lit-element/lit-element.js:
|
|
4594
|
-
(**
|
|
4595
|
-
* @license
|
|
4596
|
-
* Copyright 2017 Google LLC
|
|
4597
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4598
|
-
*)
|
|
4599
|
-
|
|
4600
|
-
lit-html/node/is-server.js:
|
|
4601
|
-
(**
|
|
4602
|
-
* @license
|
|
4603
|
-
* Copyright 2022 Google LLC
|
|
4604
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4605
|
-
*)
|
|
4606
|
-
|
|
4607
|
-
@lit/reactive-element/node/decorators/custom-element.js:
|
|
4608
|
-
(**
|
|
4609
|
-
* @license
|
|
4610
|
-
* Copyright 2017 Google LLC
|
|
4611
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4612
|
-
*)
|
|
4613
|
-
|
|
4614
|
-
@lit/reactive-element/node/decorators/property.js:
|
|
4615
|
-
(**
|
|
4616
|
-
* @license
|
|
4617
|
-
* Copyright 2017 Google LLC
|
|
4618
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4619
|
-
*)
|
|
4620
|
-
|
|
4621
|
-
@lit/reactive-element/node/decorators/state.js:
|
|
4622
|
-
(**
|
|
4623
|
-
* @license
|
|
4624
|
-
* Copyright 2017 Google LLC
|
|
4625
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4626
|
-
*)
|
|
4627
|
-
|
|
4628
|
-
@lit/reactive-element/node/decorators/event-options.js:
|
|
4629
|
-
(**
|
|
4630
|
-
* @license
|
|
4631
|
-
* Copyright 2017 Google LLC
|
|
4632
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4633
|
-
*)
|
|
4634
|
-
|
|
4635
|
-
@lit/reactive-element/node/decorators/base.js:
|
|
4636
|
-
(**
|
|
4637
|
-
* @license
|
|
4638
|
-
* Copyright 2017 Google LLC
|
|
4639
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4640
|
-
*)
|
|
4641
|
-
|
|
4642
|
-
@lit/reactive-element/node/decorators/query.js:
|
|
4643
|
-
(**
|
|
4644
|
-
* @license
|
|
4645
|
-
* Copyright 2017 Google LLC
|
|
4646
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4647
|
-
*)
|
|
4648
|
-
|
|
4649
|
-
@lit/reactive-element/node/decorators/query-all.js:
|
|
4650
|
-
(**
|
|
4651
|
-
* @license
|
|
4652
|
-
* Copyright 2017 Google LLC
|
|
4653
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4654
|
-
*)
|
|
4655
|
-
|
|
4656
|
-
@lit/reactive-element/node/decorators/query-async.js:
|
|
4657
|
-
(**
|
|
4658
|
-
* @license
|
|
4659
|
-
* Copyright 2017 Google LLC
|
|
4660
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4661
|
-
*)
|
|
4662
|
-
|
|
4663
|
-
@lit/reactive-element/node/decorators/query-assigned-elements.js:
|
|
4664
|
-
(**
|
|
4665
|
-
* @license
|
|
4666
|
-
* Copyright 2021 Google LLC
|
|
4667
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4668
|
-
*)
|
|
4669
|
-
|
|
4670
|
-
@lit/reactive-element/node/decorators/query-assigned-nodes.js:
|
|
4671
|
-
(**
|
|
4672
|
-
* @license
|
|
4673
|
-
* Copyright 2017 Google LLC
|
|
4674
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4675
|
-
*)
|
|
4676
|
-
|
|
4677
|
-
lit-html/node/directive-helpers.js:
|
|
4678
|
-
(**
|
|
4679
|
-
* @license
|
|
4680
|
-
* Copyright 2020 Google LLC
|
|
4681
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4682
|
-
*)
|
|
4683
|
-
|
|
4684
|
-
lit-html/node/directive.js:
|
|
4685
|
-
(**
|
|
4686
|
-
* @license
|
|
4687
|
-
* Copyright 2017 Google LLC
|
|
4688
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4689
|
-
*)
|
|
4690
|
-
|
|
4691
|
-
lit-html/node/async-directive.js:
|
|
4692
|
-
(**
|
|
4693
|
-
* @license
|
|
4694
|
-
* Copyright 2017 Google LLC
|
|
4695
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4696
|
-
*)
|
|
4697
|
-
|
|
4698
|
-
lit-html/node/directives/private-async-helpers.js:
|
|
4699
|
-
(**
|
|
4700
|
-
* @license
|
|
4701
|
-
* Copyright 2021 Google LLC
|
|
4702
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4703
|
-
*)
|
|
4704
|
-
|
|
4705
|
-
lit-html/node/directives/until.js:
|
|
4706
|
-
(**
|
|
4707
|
-
* @license
|
|
4708
|
-
* Copyright 2017 Google LLC
|
|
4709
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4710
|
-
*)
|
|
4711
|
-
|
|
4712
|
-
jexpr/lib/constants.js:
|
|
4713
|
-
(*
|
|
4714
|
-
* @license
|
|
4715
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4716
|
-
*)
|
|
4717
|
-
|
|
4718
|
-
jexpr/lib/tokenizer.js:
|
|
4719
|
-
(*
|
|
4720
|
-
* @license
|
|
4721
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4722
|
-
*)
|
|
4723
|
-
|
|
4724
|
-
jexpr/lib/parser.js:
|
|
4725
|
-
(*
|
|
4726
|
-
* @license
|
|
4727
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4728
|
-
*)
|
|
4729
|
-
|
|
4730
|
-
jexpr/lib/ast_factory.js:
|
|
4731
|
-
(*
|
|
4732
|
-
* @license
|
|
4733
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4734
|
-
*)
|
|
4735
|
-
|
|
4736
|
-
jexpr/lib/eval.js:
|
|
4737
|
-
(*
|
|
4738
|
-
* @license
|
|
4739
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4740
|
-
*)
|
|
4741
|
-
|
|
4742
|
-
lit-html/node/private-ssr-support.js:
|
|
4743
|
-
(**
|
|
4744
|
-
* @license
|
|
4745
|
-
* Copyright 2019 Google LLC
|
|
4746
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4747
|
-
*)
|
|
4748
|
-
|
|
4749
|
-
lit-html/node/directives/if-defined.js:
|
|
4750
|
-
(**
|
|
4751
|
-
* @license
|
|
4752
|
-
* Copyright 2018 Google LLC
|
|
4753
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4754
|
-
*)
|
|
4755
|
-
|
|
4756
|
-
lit-html/node/directives/ref.js:
|
|
4757
|
-
(**
|
|
4758
|
-
* @license
|
|
4759
|
-
* Copyright 2020 Google LLC
|
|
4760
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4761
|
-
*)
|
|
4762
|
-
|
|
4763
|
-
lit-html/node/directives/unsafe-html.js:
|
|
4764
|
-
(**
|
|
4765
|
-
* @license
|
|
4766
|
-
* Copyright 2017 Google LLC
|
|
4767
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4768
|
-
*)
|
|
4769
|
-
|
|
4770
|
-
lit-html/node/directives/repeat.js:
|
|
4771
|
-
(**
|
|
4772
|
-
* @license
|
|
4773
|
-
* Copyright 2017 Google LLC
|
|
4774
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4775
|
-
*)
|
|
4776
|
-
|
|
4777
|
-
lit-html/node/directives/style-map.js:
|
|
4778
|
-
(**
|
|
4779
|
-
* @license
|
|
4780
|
-
* Copyright 2018 Google LLC
|
|
4781
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4782
|
-
*)
|
|
4783
|
-
*/
|
|
4503
|
+
`,o([hl({type:String,attribute:!1})],Ee.prototype,"marker",2),Ee=o([ml("qti-simple-choice")],Ee);var zx=async n=>{let s=n.substring(0,n.lastIndexOf("/")),e=await fr().load(`${n}`).then(a=>a.assessmentTest()),t=await se().load(`${s}/${e.href}`).then(a=>a.htmlDoc()),r=await se().load(`${s}/${e.href}`).then(a=>a.items()),i=`${s}/${e.href}`,l=`${s}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:l,testURL:i,items:r,testIdentifier:e.identifier}},Ox=async n=>z().load(n).then(s=>s.htmlDoc().firstElementChild);export{R as ActiveElementMixin,u as Interaction,F as ItemContainer,vt as QtiAnd,E as QtiAssessmentItem,L as QtiAssessmentItemRef,_ as QtiAssessmentSection,ue as QtiAssessmentStimulusRef,Q as QtiAssessmentTest,Ke as QtiAssociableHotspot,fe as QtiAssociateInteraction,yt as QtiBaseValue,ge as QtiChoiceInteraction,dt as QtiCompanionMaterialsInfo,T as QtiConditionExpression,Ft as QtiContains,pt as QtiContentBody,Pt as QtiCorrect,U as QtiCustomInteraction,Ye as QtiCustomOperator,G as QtiEndAttemptInteraction,xt as QtiEqual,qt as QtiEqualRounded,g as QtiExpression,k as QtiExtendedTextInteraction,Re as QtiFeedbackBlock,De as QtiFeedbackInline,ye as QtiGap,qe as QtiGapImg,Fe as QtiGapMatchInteraction,xe as QtiGapText,X as QtiGraphicAssociateInteraction,Pe as QtiGraphicGapMatchInteraction,Ue as QtiGraphicOrderInteraction,Ut as QtiGt,Xt as QtiGte,we as QtiHotspotChoice,Xe as QtiHotspotInteraction,Ge as QtiHottext,gt as QtiHottextInteraction,Je as QtiInlineChoice,K as QtiInlineChoiceInteraction,Bt as QtiIsNull,st as QtiItem,Le as QtiItemBody,ft as QtiLookupOutcomeValue,jt as QtiLt,Wt as QtiLte,wt as QtiMapResponse,be as QtiMapping,Kt as QtiMatch,B as QtiMatchInteraction,je as QtiMediaInteraction,Gt as QtiMember,Ie as QtiModalFeedback,Jt as QtiMultiple,Zt as QtiNot,Qt as QtiOr,j as QtiOrderInteraction,er as QtiOrdered,D as QtiOutcomeDeclaration,Ne as QtiOutcomeProcessing,Ht as QtiOutcomeProcessingProcessor,te as QtiPortableCustomInteraction,Mt as QtiPositionObjectInteraction,We as QtiPositionObjectStage,Oe as QtiPrintedVariable,tr as QtiProduct,nt as QtiPrompt,Nt as QtiResponseCondition,P as QtiResponseDeclaration,$e as QtiResponseElse,Ot as QtiResponseElseIf,ze as QtiResponseIf,ee as QtiResponseProcessing,I as QtiRubricBlock,H as QtiRule,Z as QtiSelectPointInteraction,$t as QtiSetOutcomeValue,zt as QtiSetOutcomeValueRule,J as QtiSimpleAssociableChoice,Ee as QtiSimpleChoice,$ as QtiSliderInteraction,Ct as QtiStringMatch,lt as QtiStylesheet,Et as QtiSubtract,rr as QtiSum,ir as QtiSumExpression,tt as QtiTest,A as QtiTestPart,V as QtiTextEntryInteraction,He as QtiUploadInteraction,or as QtiVariable,q as TestComponent,O as TestContainer,pe as TestItemLink,Me as TestNext,me as TestPagingButtonsStamp,Se as TestPrev,w as TestView,Ox as getItemByUri,zx as getManifestInfo,x as itemContext,Vr as itemContextVariables,la as qtiAndMixin,qa as qtiSubtractMixin,z as qtiTransformItem,fr as qtiTransformManifest,se as qtiTransformTest,S as testContext,et as testElement};
|