@citolab/qti-components 7.0.9 → 7.0.10
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-22SOGZF4.js +1 -0
- package/cdn/chunks/chunk-2TYVSDOR.js +10 -0
- package/cdn/chunks/chunk-2UE47PDO.js +8 -0
- package/cdn/chunks/chunk-3AZDOXQ2.js +1 -0
- package/cdn/chunks/chunk-3JYWJ2NK.js +7 -0
- package/cdn/chunks/chunk-46LUBNDT.js +1 -0
- package/cdn/chunks/chunk-4AQLM6EU.js +1 -0
- package/cdn/chunks/chunk-4F3SWHSX.js +3537 -0
- package/cdn/chunks/chunk-4JDR4LHD.js +7 -0
- package/cdn/chunks/chunk-4PRM73PT.js +3530 -0
- package/cdn/chunks/chunk-4PWQZQY3.js +17 -0
- package/cdn/chunks/chunk-5A43OJRS.js +24 -0
- package/cdn/chunks/chunk-5E2MIJGV.js +0 -0
- package/cdn/chunks/chunk-5ETOPNVH.js +1 -0
- package/cdn/chunks/chunk-5HNHSP7A.js +3530 -0
- package/cdn/chunks/chunk-5JUDXKGO.js +7 -0
- package/cdn/chunks/chunk-6A2O5DS7.js +1 -0
- package/cdn/chunks/chunk-6FKGN7HB.js +1 -0
- package/cdn/chunks/chunk-7AZEP5VB.js +8 -0
- package/cdn/chunks/chunk-7CQK5FSF.js +3530 -0
- package/cdn/chunks/chunk-APXB6KK5.js +8 -0
- package/cdn/chunks/chunk-AV37OE2S.js +1 -0
- package/cdn/chunks/chunk-AWIOWT4I.js +1 -0
- package/cdn/chunks/chunk-BB6R7AIH.js +8 -0
- package/cdn/chunks/chunk-CKOTA237.js +1 -0
- package/cdn/chunks/chunk-CZTZFTHC.js +8 -0
- package/cdn/chunks/chunk-D3JZV5XV.js +1 -0
- package/cdn/chunks/chunk-DI3XOGVR.js +951 -0
- package/cdn/chunks/chunk-DSZDMYQL.js +1 -0
- package/cdn/chunks/chunk-ELG6OUC7.js +1 -0
- package/cdn/chunks/chunk-EQNTO3QG.js +8 -0
- package/cdn/chunks/chunk-ESTNU24A.js +1 -0
- package/cdn/chunks/chunk-EUHRWJ5R.js +48 -0
- package/cdn/chunks/chunk-EVPWT7PO.js +1 -0
- package/cdn/chunks/chunk-EXAWEKDS.js +1 -0
- package/cdn/chunks/chunk-FCESHSJ3.js +73 -0
- package/cdn/chunks/chunk-G457CJP5.js +1 -0
- package/cdn/chunks/chunk-GIFBDBLN.js +8 -0
- package/cdn/chunks/chunk-GIYY5ZKS.js +939 -0
- package/cdn/chunks/chunk-GTFFARVB.js +8 -0
- package/cdn/chunks/chunk-GYPMDM7U.js +41 -0
- package/cdn/chunks/chunk-HG75NNFK.js +1 -0
- package/cdn/chunks/chunk-HV4JN3XB.js +1 -0
- package/cdn/chunks/chunk-HXPYDFGQ.js +8 -0
- package/cdn/chunks/chunk-IDGQY66Q.js +8 -0
- package/cdn/chunks/chunk-J5BEBS4Y.js +1 -0
- package/cdn/chunks/chunk-JLT3S3BD.js +1 -0
- package/cdn/chunks/chunk-K2TKSKEN.js +1 -0
- package/cdn/chunks/chunk-K4LCPCDE.js +1 -0
- package/cdn/chunks/chunk-KFA5RO3O.js +1 -0
- package/cdn/chunks/chunk-KFLS5ISA.js +1 -0
- package/cdn/chunks/chunk-KJEXS4DB.js +1 -0
- package/cdn/chunks/chunk-L33RHCU4.js +1 -0
- package/cdn/chunks/chunk-LPXDIJR2.js +1 -0
- package/cdn/chunks/chunk-LQ3DVN7N.js +1 -0
- package/cdn/chunks/chunk-LXNE62HZ.js +1 -0
- package/cdn/chunks/chunk-M2YG5XJI.js +8 -0
- package/cdn/chunks/chunk-M5OZ7YYR.js +3537 -0
- package/cdn/chunks/chunk-MCB43U5P.js +1 -0
- package/cdn/chunks/chunk-NFO577XB.js +939 -0
- package/cdn/chunks/chunk-NXTUDFAR.js +8 -0
- package/cdn/chunks/chunk-PAQSIIBJ.js +939 -0
- package/cdn/chunks/chunk-PAWTFMTX.js +8 -0
- package/cdn/chunks/chunk-PP4PDVVF.js +1 -0
- package/cdn/chunks/chunk-PZ7WEWHR.js +41 -0
- package/cdn/chunks/chunk-QEQPGKII.js +939 -0
- package/cdn/chunks/chunk-QICNOCJ6.js +1 -0
- package/cdn/chunks/chunk-QII27W7O.js +1 -0
- package/cdn/chunks/chunk-QYXRVCGM.js +6 -0
- package/cdn/chunks/chunk-REVF4YJC.js +8 -0
- package/cdn/chunks/chunk-S7SSPYIM.js +1 -0
- package/cdn/chunks/chunk-SCAVRW3H.js +1 -0
- package/cdn/chunks/chunk-TAJ4OCKW.js +3530 -0
- package/cdn/chunks/chunk-TH2YUX3A.js +17 -0
- package/cdn/chunks/chunk-TV7GYNJO.js +1 -0
- package/cdn/chunks/chunk-UXPSLBXO.js +1 -0
- package/cdn/chunks/chunk-VCH5D4D5.js +1 -0
- package/cdn/chunks/chunk-VE4IM4WS.js +8 -0
- package/cdn/chunks/chunk-VQPS5EII.js +939 -0
- package/cdn/chunks/chunk-WIDUHBF5.js +8 -0
- package/cdn/chunks/chunk-WTMZDTN4.js +1 -0
- package/cdn/chunks/chunk-X6XFTJQH.js +8 -0
- package/cdn/chunks/chunk-XEXDWGVU.js +939 -0
- package/cdn/chunks/chunk-XHBOTQFL.js +1 -0
- package/cdn/chunks/chunk-Y3GKQGXZ.js +8 -0
- package/cdn/chunks/chunk-YM6G2V57.js +8 -0
- package/cdn/chunks/chunk-YWZPZLWC.js +1 -0
- package/cdn/chunks/chunk-YYGAT2GT.js +1 -0
- package/cdn/chunks/chunk-Z7NL2OYT.js +1 -0
- package/cdn/chunks/chunk-ZCSHWAC6.js +1 -0
- package/cdn/chunks/chunk-ZILMGYR5.js +1 -0
- package/cdn/chunks/chunk-ZJMQOR5E.js +0 -0
- package/cdn/chunks/chunk-ZXVHR32G.js +1 -0
- package/cdn/exports/config.context.js +1 -1
- package/cdn/exports/interaction.js +1 -1
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-container.js +1 -1
- package/cdn/qti-test/components/test-end-attempt.js +1 -1
- package/cdn/qti-test/components/test-item-link.js +1 -1
- package/cdn/qti-test/components/test-navigation.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp copy.js +1 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp.stories copy.css +1 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.stories copy.js +264 -0
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-print-item-variables.js +1 -0
- package/cdn/qti-test/components/test-section-buttons-stamp.js +1 -0
- package/cdn/qti-test/components/test-section-link.js +1 -0
- package/cdn/qti-test/components/test-show-correct-response.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-25BRPHJE.js +630 -0
- package/dist/chunks/chunk-25BRPHJE.js.map +1 -0
- package/dist/chunks/chunk-25ZCG5KD.js +6432 -0
- package/dist/chunks/chunk-25ZCG5KD.js.map +1 -0
- package/dist/chunks/chunk-2Q7RXYGX.js +213 -0
- package/dist/chunks/chunk-2Q7RXYGX.js.map +1 -0
- package/dist/chunks/chunk-2VA7CRTS.js +30 -0
- package/dist/chunks/chunk-2VA7CRTS.js.map +1 -0
- package/dist/chunks/chunk-36RGXVXQ.js +3634 -0
- package/dist/chunks/chunk-36RGXVXQ.js.map +1 -0
- package/dist/chunks/chunk-3F566AXX.js +210 -0
- package/dist/chunks/chunk-3F566AXX.js.map +1 -0
- package/dist/chunks/chunk-4475MTP7.js +630 -0
- package/dist/chunks/chunk-4475MTP7.js.map +1 -0
- package/dist/chunks/chunk-4GJ5LAU5.js +631 -0
- package/dist/chunks/chunk-4GJ5LAU5.js.map +1 -0
- package/dist/chunks/chunk-4HI4Q5TO.js +3641 -0
- package/dist/chunks/chunk-4HI4Q5TO.js.map +1 -0
- package/dist/chunks/chunk-4L5S7AON.js +621 -0
- package/dist/chunks/chunk-4L5S7AON.js.map +1 -0
- package/dist/chunks/chunk-52EWQN42.js +634 -0
- package/dist/chunks/chunk-52EWQN42.js.map +1 -0
- package/dist/chunks/chunk-5BSOZZMV.js +621 -0
- package/dist/chunks/chunk-5BSOZZMV.js.map +1 -0
- package/dist/chunks/chunk-5DFTIWBN.js +95 -0
- package/dist/chunks/chunk-5DFTIWBN.js.map +1 -0
- package/dist/chunks/chunk-5DZX4TPP.js +45 -0
- package/dist/chunks/chunk-5DZX4TPP.js.map +1 -0
- package/dist/chunks/chunk-5FQYXHVK.js +213 -0
- package/dist/chunks/chunk-5FQYXHVK.js.map +1 -0
- package/dist/chunks/chunk-5JJ7ELEU.js +39 -0
- package/dist/chunks/chunk-5JJ7ELEU.js.map +1 -0
- package/dist/chunks/chunk-5OMC3DTZ.js +3628 -0
- package/dist/chunks/chunk-5OMC3DTZ.js.map +1 -0
- package/dist/chunks/chunk-63WMM765.js +30 -0
- package/dist/chunks/chunk-63WMM765.js.map +1 -0
- package/dist/chunks/chunk-7ABTMTDB.js +86 -0
- package/dist/chunks/chunk-7ABTMTDB.js.map +1 -0
- package/dist/chunks/chunk-7K6TWSAK.js +626 -0
- package/dist/chunks/chunk-7K6TWSAK.js.map +1 -0
- package/dist/chunks/chunk-7QZ4E5WZ.js +210 -0
- package/dist/chunks/chunk-7QZ4E5WZ.js.map +1 -0
- package/dist/chunks/chunk-7RB2AUJE.js +622 -0
- package/dist/chunks/chunk-7RB2AUJE.js.map +1 -0
- package/dist/chunks/chunk-7WZH7TKG.js +210 -0
- package/dist/chunks/chunk-7WZH7TKG.js.map +1 -0
- package/dist/chunks/chunk-7YREO7KD.js +214 -0
- package/dist/chunks/chunk-7YREO7KD.js.map +1 -0
- package/dist/chunks/chunk-AI3BVEE3.js +102 -0
- package/dist/chunks/chunk-AI3BVEE3.js.map +1 -0
- package/dist/chunks/chunk-AZOWZY7V.js +95 -0
- package/dist/chunks/chunk-AZOWZY7V.js.map +1 -0
- package/dist/chunks/chunk-AZZW7WYD.js +3634 -0
- package/dist/chunks/chunk-AZZW7WYD.js.map +1 -0
- package/dist/chunks/chunk-B4YBRGOO.js +72 -0
- package/dist/chunks/chunk-B4YBRGOO.js.map +1 -0
- package/dist/chunks/chunk-BBFU7KGH.js +6432 -0
- package/dist/chunks/chunk-BBFU7KGH.js.map +1 -0
- package/dist/chunks/chunk-BCX6AQCQ.js +210 -0
- package/dist/chunks/chunk-BCX6AQCQ.js.map +1 -0
- package/dist/chunks/chunk-BJHVTP5W.js +95 -0
- package/dist/chunks/chunk-BJHVTP5W.js.map +1 -0
- package/dist/chunks/chunk-BOMM6A7V.js +19 -0
- package/dist/chunks/chunk-BOMM6A7V.js.map +1 -0
- package/dist/chunks/chunk-C5Q3SNXK.js +623 -0
- package/dist/chunks/chunk-C5Q3SNXK.js.map +1 -0
- package/dist/chunks/chunk-CONPNDHF.js +6416 -0
- package/dist/chunks/chunk-CONPNDHF.js.map +1 -0
- package/dist/chunks/chunk-CP63JV6J.js +56 -0
- package/dist/chunks/chunk-CP63JV6J.js.map +1 -0
- package/dist/chunks/chunk-DRATSVXW.js +99 -0
- package/dist/chunks/chunk-DRATSVXW.js.map +1 -0
- package/dist/chunks/chunk-E7UCMQNT.js +98 -0
- package/dist/chunks/chunk-E7UCMQNT.js.map +1 -0
- package/dist/chunks/chunk-ECTTGUKY.js +72 -0
- package/dist/chunks/chunk-ECTTGUKY.js.map +1 -0
- package/dist/chunks/chunk-F3JNWOBS.js +630 -0
- package/dist/chunks/chunk-F3JNWOBS.js.map +1 -0
- package/dist/chunks/chunk-FKOHVQD5.js +565 -0
- package/dist/chunks/chunk-FKOHVQD5.js.map +1 -0
- package/dist/chunks/chunk-FKYQ474Y.js +634 -0
- package/dist/chunks/chunk-FKYQ474Y.js.map +1 -0
- package/dist/chunks/chunk-FRNEKC5E.js +211 -0
- package/dist/chunks/chunk-FRNEKC5E.js.map +1 -0
- package/dist/chunks/chunk-GM2VH33L.js +214 -0
- package/dist/chunks/chunk-GM2VH33L.js.map +1 -0
- package/dist/chunks/chunk-HRCCW6MA.js +8 -0
- package/dist/chunks/chunk-HRCCW6MA.js.map +1 -0
- package/dist/chunks/chunk-ILL4KEGU.js +616 -0
- package/dist/chunks/chunk-ILL4KEGU.js.map +1 -0
- package/dist/chunks/chunk-IPWVQUFB.js +641 -0
- package/dist/chunks/chunk-IPWVQUFB.js.map +1 -0
- package/dist/chunks/chunk-IQVU7D3B.js +1 -0
- package/dist/chunks/chunk-IQVU7D3B.js.map +1 -0
- package/dist/chunks/chunk-JCEYFPPV.js +100 -0
- package/dist/chunks/chunk-JCEYFPPV.js.map +1 -0
- package/dist/chunks/chunk-JMIFSDZ7.js +52 -0
- package/dist/chunks/chunk-JMIFSDZ7.js.map +1 -0
- package/dist/chunks/chunk-JPATXTKN.js +629 -0
- package/dist/chunks/chunk-JPATXTKN.js.map +1 -0
- package/dist/chunks/chunk-KB5LRYDB.js +1 -0
- package/dist/chunks/chunk-KB5LRYDB.js.map +1 -0
- package/dist/chunks/chunk-KEF7X2OE.js +3621 -0
- package/dist/chunks/chunk-KEF7X2OE.js.map +1 -0
- package/dist/chunks/chunk-L5B7J2ZT.js +43 -0
- package/dist/chunks/chunk-L5B7J2ZT.js.map +1 -0
- package/dist/chunks/chunk-LU3O7U7W.js +45 -0
- package/dist/chunks/chunk-LU3O7U7W.js.map +1 -0
- package/dist/chunks/chunk-M3ONQ3OO.js +45 -0
- package/dist/chunks/chunk-M3ONQ3OO.js.map +1 -0
- package/dist/chunks/chunk-MBF6HEKO.js +39 -0
- package/dist/chunks/chunk-MBF6HEKO.js.map +1 -0
- package/dist/chunks/chunk-NW6WMWBC.js +94 -0
- package/dist/chunks/chunk-NW6WMWBC.js.map +1 -0
- package/dist/chunks/chunk-NXSALC5S.js +633 -0
- package/dist/chunks/chunk-NXSALC5S.js.map +1 -0
- package/dist/chunks/chunk-OTLH5OUZ.js +44 -0
- package/dist/chunks/chunk-OTLH5OUZ.js.map +1 -0
- package/dist/chunks/chunk-P7CW3RY4.js +6538 -0
- package/dist/chunks/chunk-P7CW3RY4.js.map +1 -0
- package/dist/chunks/chunk-PWOPGMKY.js +210 -0
- package/dist/chunks/chunk-PWOPGMKY.js.map +1 -0
- package/dist/chunks/chunk-QC5NBP3D.js +44 -0
- package/dist/chunks/chunk-QC5NBP3D.js.map +1 -0
- package/dist/chunks/chunk-QHWSY3K6.js +30 -0
- package/dist/chunks/chunk-QHWSY3K6.js.map +1 -0
- package/dist/chunks/chunk-QL3I5UMG.js +43 -0
- package/dist/chunks/chunk-QL3I5UMG.js.map +1 -0
- package/dist/chunks/chunk-QV4U5W67.js +43 -0
- package/dist/chunks/chunk-QV4U5W67.js.map +1 -0
- package/dist/chunks/chunk-R7HYOALH.js +213 -0
- package/dist/chunks/chunk-R7HYOALH.js.map +1 -0
- package/dist/chunks/chunk-SC5PDBVU.js +629 -0
- package/dist/chunks/chunk-SC5PDBVU.js.map +1 -0
- package/dist/chunks/chunk-SFRILOXM.js +624 -0
- package/dist/chunks/chunk-SFRILOXM.js.map +1 -0
- package/dist/chunks/chunk-ST5C4HZG.js +3621 -0
- package/dist/chunks/chunk-ST5C4HZG.js.map +1 -0
- package/dist/chunks/chunk-T524XBVZ.js +45 -0
- package/dist/chunks/chunk-T524XBVZ.js.map +1 -0
- package/dist/chunks/chunk-TN5UCQIV.js +614 -0
- package/dist/chunks/chunk-TN5UCQIV.js.map +1 -0
- package/dist/chunks/chunk-TWGONQQT.js +44 -0
- package/dist/chunks/chunk-TWGONQQT.js.map +1 -0
- package/dist/chunks/chunk-UDDWTISS.js +615 -0
- package/dist/chunks/chunk-UDDWTISS.js.map +1 -0
- package/dist/chunks/chunk-URMN5M77.js +36 -0
- package/dist/chunks/chunk-URMN5M77.js.map +1 -0
- package/dist/chunks/chunk-VPMLJM47.js +621 -0
- package/dist/chunks/chunk-VPMLJM47.js.map +1 -0
- package/dist/chunks/chunk-WYIX3HQR.js +634 -0
- package/dist/chunks/chunk-WYIX3HQR.js.map +1 -0
- package/dist/chunks/chunk-XISZU4KI.js +614 -0
- package/dist/chunks/chunk-XISZU4KI.js.map +1 -0
- package/dist/chunks/chunk-Y32L6VYU.js +91 -0
- package/dist/chunks/chunk-Y32L6VYU.js.map +1 -0
- package/dist/chunks/chunk-Y35P6GUT.js +99 -0
- package/dist/chunks/chunk-Y35P6GUT.js.map +1 -0
- package/dist/chunks/chunk-YUWIMPXO.js +75 -0
- package/dist/chunks/chunk-YUWIMPXO.js.map +1 -0
- package/dist/chunks/chunk-ZJHKJMHR.js +52 -0
- package/dist/chunks/chunk-ZJHKJMHR.js.map +1 -0
- package/dist/chunks/chunk-ZO73DF5R.js +36 -0
- package/dist/chunks/chunk-ZO73DF5R.js.map +1 -0
- package/dist/chunks/chunk-ZRA43QD3.js +52 -0
- package/dist/chunks/chunk-ZRA43QD3.js.map +1 -0
- package/dist/exports/computed.context.d.ts +3 -1
- package/dist/exports/computed.context.js +1 -1
- package/dist/exports/config.context.d.ts +1 -0
- package/dist/exports/config.context.js +4 -3
- package/dist/exports/config.context.js.map +1 -1
- package/dist/exports/interaction.d.ts +5 -2
- package/dist/exports/interaction.js +1 -1
- package/dist/exports/item.context.d.ts +1 -1
- package/dist/exports/qti-assessment-item.context.d.ts +1 -1
- package/dist/exports/qti-condition-expression.d.ts +1 -1
- package/dist/exports/qti-expression.d.ts +1 -1
- package/dist/exports/session.context.d.ts +3 -3
- package/dist/exports/test.context.d.ts +1 -1
- package/dist/exports/variables.d.ts +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +26 -15
- package/dist/item.css +14 -1
- package/dist/qti-components/index.d.ts +4 -4
- package/dist/qti-components/index.js +2 -2
- package/dist/qti-components-jsx.d.ts +82 -36
- package/dist/qti-item/core/index.js +1 -1
- package/dist/qti-loader/index.d.ts +3 -3
- package/dist/qti-response-declaration-BwciEk5R.d.ts +1022 -0
- package/dist/qti-response-declaration-CCx746w0.d.ts +1023 -0
- package/dist/qti-response-declaration-CRGM9w_b.d.ts +1023 -0
- package/dist/qti-response-declaration-CbWRpo5c.d.ts +1033 -0
- package/dist/qti-test/components/index.d.ts +10 -8
- package/dist/qti-test/components/index.js +22 -11
- package/dist/qti-test/components/test-container.js +1 -1
- package/dist/qti-test/components/test-end-attempt.d.ts +0 -3
- package/dist/qti-test/components/test-end-attempt.js +1 -3
- package/dist/qti-test/components/test-item-link.js +1 -1
- package/dist/qti-test/components/test-navigation.d.ts +21 -8
- package/dist/qti-test/components/test-navigation.js +2 -3
- package/dist/qti-test/components/test-next.js +2 -2
- package/dist/qti-test/components/test-paging-buttons-stamp copy.js +44 -0
- package/dist/qti-test/components/test-paging-buttons-stamp copy.js.map +1 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.js +2 -2
- package/dist/qti-test/components/test-paging-buttons-stamp.stories copy.css +93 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.stories copy.css.map +1 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.stories copy.js +9774 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.stories copy.js.map +1 -0
- package/dist/qti-test/components/test-prev.js +2 -2
- package/dist/qti-test/components/test-print-item-variables.d.ts +15 -0
- package/dist/qti-test/components/test-print-item-variables.js +9 -0
- package/dist/qti-test/components/test-print-item-variables.js.map +1 -0
- package/dist/qti-test/components/test-section-buttons-stamp.d.ts +20 -0
- package/dist/qti-test/components/test-section-buttons-stamp.js +9 -0
- package/dist/qti-test/components/test-section-buttons-stamp.js.map +1 -0
- package/dist/qti-test/components/test-section-link.d.ts +18 -0
- package/dist/qti-test/components/test-section-link.js +9 -0
- package/dist/qti-test/components/test-section-link.js.map +1 -0
- package/dist/qti-test/components/test-show-correct-response.d.ts +0 -3
- package/dist/qti-test/components/test-show-correct-response.js +1 -3
- package/dist/qti-test/core/index.d.ts +5 -5
- package/dist/qti-test/core/index.js +1 -1
- package/dist/qti-test-part-8W7-lWmu.d.ts +85 -0
- package/dist/qti-test-part-BEPYFFNO.d.ts +85 -0
- package/dist/qti-test-part-CTzSuEgA.d.ts +85 -0
- package/dist/qti-test-part-CcFpkf1G.d.ts +85 -0
- package/dist/variables-D70AFbp2.d.ts +47 -0
- package/dist/vscode.html-custom-data.json +35 -10
- package/package.json +2 -1
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
import{a as le,b as J,c as ce,e as pe,f as K,g as Pt,h as Ft,i as Xe,j as zt}from"./chunk-5BR5CJFH.js";import{a as je}from"./chunk-EHK76KRT.js";import{a as R}from"./chunk-XUJ7TXHW.js";import{a as V}from"./chunk-R45JL2ZY.js";import{a as q}from"./chunk-YIYKK4RV.js";import{a as It}from"./chunk-5FCXUJAG.js";import{a as C}from"./chunk-UJP4TGD3.js";import{a as h,b as u,c as E,d as Ue,e as Nt}from"./chunk-5GCSZ3CH.js";import{a as b,d as m,e as pt,f as ae,g as D,i as v}from"./chunk-LZZB4VGC.js";import{a as Ot}from"./chunk-KWPDTFYH.js";import{a as M}from"./chunk-QQCGUVEV.js";import{a as $t,b as _}from"./chunk-M5PPZ5M3.js";import{a as n}from"./chunk-IAP2CEE7.js";var k=class extends v{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:Ot};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.detail.interactionElement)}),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 m`<slot></slot>`}showCorrectResponse(e){let t=this._context.variables.filter(r=>"correctResponse"in r&&r.correctResponse).map(r=>({responseIdentifier:r.identifier,response:r.correctResponse||""}));for(let{responseIdentifier:r,response:i}of t){let l=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r);l&&(l.correctResponse=e?i:"")}}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(e=!0){return this._interactionElements.every(t=>t.validate())?!0:this._interactionElements.some(t=>t.validate())?!1:(e&&this.reportValidity(),null)}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}_emit(e,t=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}};n([u({type:String})],k.prototype,"title",2),n([u({type:String})],k.prototype,"identifier",2),n([u({type:String})],k.prototype,"adaptive",2),n([u({type:String})],k.prototype,"timeDependent",2),n([u({type:Boolean})],k.prototype,"disabled",2),n([R("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),n([u({type:Boolean})],k.prototype,"readonly",2),n([R("readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),n([$t({context:M})],k.prototype,"_context",2),k=n([h("qti-assessment-item")],k);var de=class extends v{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 It().load(this.href).then(r=>r.htmlDoc());if(t){let r=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...r)}}};n([u({type:String})],de.prototype,"identifier",2),n([u({type:String})],de.prototype,"href",2),de=n([h("qti-assessment-stimulus-ref")],de);var We=class extends v{};We=n([h("qti-companion-materials-info")],We);var Ce=class extends v{render(){return m`<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)}};n([_({context:M,subscribe:!0}),E()],Ce.prototype,"_context",2),Ce=n([h("qti-custom-operator")],Ce);var hr=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),qe=p=>{if(typeof p=="string")return p;let s=hr();return s==="."?p.toLocaleString():p.toString().replace(".","").replace(s,".")};function dt(p){return p==null}function Te(p){return p.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var L=class extends v{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=!dt(this.identifier)&&!dt(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(s){this.showStatus=s&&this.showHide==="show"||!s&&this.showHide==="hide"?"on":"off"}};n([u({type:String,attribute:"show-hide"})],L.prototype,"showHide",2),n([u({type:String,attribute:"outcome-identifier"})],L.prototype,"outcomeIdentifier",2),n([u({type:String})],L.prototype,"identifier",2),n([u({type:String,attribute:!1})],L.prototype,"showStatus",2),n([_({context:M,subscribe:!0}),E()],L.prototype,"_context",2);var we=class extends L{render(){return m` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(s){this.checkShowFeedback(this.outcomeIdentifier)}};we.styles=b`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
.on {
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
.off {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
`,we=n([h("qti-feedback-block")],we);var Me=class extends L{constructor(){super(...arguments);this.render=()=>m` <slot part="feedback" class="${this.showStatus}"></slot> `}};Me.styles=b`
|
|
12
|
+
.on {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
}
|
|
15
|
+
.off {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
`,Me=n([h("qti-feedback-inline")],Me);var Se=class extends L{render(){return m`
|
|
19
|
+
<dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
|
|
20
|
+
<slot></slot>
|
|
21
|
+
<div style="margin-top: var(--qti-gap-size); text-align: center;">
|
|
22
|
+
<button class="button close-button" @click="${this.closeFeedback}"></button>
|
|
23
|
+
</div>
|
|
24
|
+
</dialog>
|
|
25
|
+
`}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())}};Se.styles=b`
|
|
26
|
+
.qti-dialog {
|
|
27
|
+
background: var(--qti-bg);
|
|
28
|
+
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
29
|
+
border-radius: var(--qti-border-radius);
|
|
30
|
+
padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
|
|
31
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
32
|
+
position: fixed;
|
|
33
|
+
top: 50%;
|
|
34
|
+
left: 50%;
|
|
35
|
+
transform: translate(-50%, -50%);
|
|
36
|
+
z-index: 1000;
|
|
37
|
+
width: auto;
|
|
38
|
+
max-width: 90%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button {
|
|
42
|
+
border-radius: var(--qti-border-radius);
|
|
43
|
+
padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
|
|
44
|
+
background-color: var(--qti-bg-active);
|
|
45
|
+
border: var(--qti-border-active);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
position: relative;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.button:hover {
|
|
52
|
+
background-color: var(--qti-hover-bg);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.button:disabled {
|
|
56
|
+
background-color: var(--qti-disabled-bg);
|
|
57
|
+
color: var(--qti-disabled-color);
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.button:focus {
|
|
62
|
+
outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Text content of the button */
|
|
66
|
+
.button::after {
|
|
67
|
+
content: var(--qti-close-text, 'Close');
|
|
68
|
+
color: inherit;
|
|
69
|
+
font-size: inherit;
|
|
70
|
+
text-align: center;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
line-height: 1.5;
|
|
73
|
+
}
|
|
74
|
+
`,Se=n([h("qti-modal-feedback")],Se);var _e=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return m` <slot name="drags"></slot> `}};_e.styles=b`
|
|
75
|
+
:host {
|
|
76
|
+
display: flex;
|
|
77
|
+
user-select: none;
|
|
78
|
+
position: absolute;
|
|
79
|
+
}
|
|
80
|
+
`,_e=n([h("qti-associable-hotspot")],_e);var Bt=(p,s,e)=>{class t extends p{}return t};var H=(p,s,e,t)=>{class r extends Bt(p,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.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(o,a){this.data[o]=a},getData(o){return this.data[o]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.draggablesModified=(o,a)=>{for(let d of a)this.draggables.includes(d)&&(this.draggables=this.draggables.filter(f=>f!==d),d.removeAttribute("tabindex"),d.removeEventListener("touchstart",this.handleTouchStart.bind(this)),d.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let d of o)this.draggables.includes(d)||(this.draggables.push(d),d.setAttribute("tabindex","0"),d.hasTouchStartListener||(d.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),d.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),d.hasTouchStartListener=!0));let c=0;this.draggables.forEach(d=>{d.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,d.setAttribute("qti-draggable","true"),c++})};this.droppablesModified=(o,a)=>{for(let c of a)this.droppables.includes(c)&&(this.droppables=this.droppables.filter(d=>d!==c),this.allDropzones=this.allDropzones.filter(d=>d!==c));for(let c of o)this.droppables.includes(c)||(this.droppables.push(c),this.allDropzones.push(c));for(let c of this.droppables)this.dataset.choicesContainerWidth&&(c.style.width=`${this.dataset.choicesContainerWidth}px`,c.style.boxSizing="border-box")}}handleDraggableContainerChange(o,a){this.isMatchTabular()||(o.length>0||a.length>0)&&this.dragContainersModified(o||[],a||[])}dragContainersModified(o,a){for(let c of a)this.dragContainers.includes(c)&&(this.dragContainers=this.dragContainers.filter(d=>d!==c),this.allDropzones=this.allDropzones.filter(d=>d!==c));for(let c of o)this.dragContainers.includes(c)||(this.dragContainers.push(c),this.allDropzones.push(c))}handleDraggablesChange(o,a){this.isMatchTabular()||(o.length>0||a.length>0)&&this.draggablesModified(o||[],a||[])}handleDroppablesChange(o,a){this.isMatchTabular()||(o.length>0||a.length>0)&&this.droppablesModified(o||[],a||[])}firstUpdated(o){super.firstUpdated(o),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 c=Array.from(this.querySelectorAll(s)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(s)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),f=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(f,[]),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(y=>this.resizeObserver?.observe(y))}async moveDraggableToDroppable(o,a){(()=>{o.style.transform="translate(0, 0)",a.tagName==="SLOT"?o.setAttribute("slot",a.getAttribute("name")):a.appendChild(o),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(o){this.dragContainers.includes(o)?(this._internals.states.add("--dragzone-active"),o.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),o.setAttribute("active",""))}deactivateDroppable(o,a=!0){a&&this._internals.states.add("--dragzone-active"),o.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}updateMinDimensionsForDropZones(){let o=this.querySelectorAll(s),a=Array.from(this.querySelectorAll(e)).map(g=>g),c=0,d=0;o.forEach(g=>{let y=g.getBoundingClientRect();c=Math.max(c,y.height),d=Math.max(d,y.width)});let f=this.querySelector(t)||this.shadowRoot?.querySelector(t);f&&(f.style.minHeight=`${c}px`,f.style.minWidth=`${d}px`);for(let g of a)g.style.minHeight=`${c}px`,g.style.minWidth=`${d}px`}activateDroppables(o){this.dragContainers.forEach(c=>{c.setAttribute("enabled",""),c.hasAttribute("disabled")&&(c.contains(o)||c.shadowRoot&&c.shadowRoot.contains(o))&&c.removeAttribute("disabled")}),this.droppables.forEach(c=>{c.setAttribute("enabled",""),c.hasAttribute("disabled")&&(c.contains(o)||c.shadowRoot&&c.shadowRoot.contains(o))&&c.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(a=>{a.removeAttribute("enabled"),a.removeAttribute("active")}),this.droppables.forEach(a=>{a.removeAttribute("enabled"),a.removeAttribute("active")})}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(o){if(this.isDraggable&&this.dragClone){let{x:a,y:c}=this.getEventCoordinates(o),d={clientX:a,clientY:c};this.calculateDragDistance(d)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(d));let f=this.findClosestDropzone();this.currentDropTarget=f,f!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),f&&(this.activateDroppable(f),this.dispatchCustomEvent(f,"dragenter")),this.lastTarget=f),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),o.preventDefault()}}handleTouchEnd(o){this.isDragging&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(a=>{a.removeAttribute("dragging")}),o.preventDefault()}handleTouchCancel(o){this.resetDragState()}validate(){if(!this.shadowRoot)return!1;let o=this.getValidAssociations(),a=!0,c="";this.maxAssociations>0&&o>this.maxAssociations?(a=!1,c=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&o<this.minAssociations&&(a=!1,c=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let d=this.lastElementChild;return this._internals.setValidity(a?{}:{customError:!0},c,d),a}reportValidity(){let o=this.shadowRoot.querySelector("#validationMessage");return o&&(this._internals.validity.valid?(o.textContent="",o.style.display="none"):(o.textContent=this._internals.validationMessage,o.style.display="block")),this._internals.validity.valid}checkMaxAssociations(o){let a=this.getMatchMaxValue(o),c=o.querySelectorAll('[qti-draggable="true"]').length;return!(a===0)&&c>=a}dropDraggableInDroppable(o,a){let c=o.cloneNode(!0);c.removeAttribute("style"),this.moveDraggableToDroppable(c,a),this.draggablesModified([c],[]);let d=this.getMatchMaxValue(o),f=this.draggables.filter(g=>g.getAttribute("identifier")===o.getAttribute("identifier"));d!==0&&f.length>=d?(o.style.opacity="0.0",o.style.pointerEvents="none"):o.style.opacity="1.0"}resetDragState(){if(this.dragClone){let o=this.currentDropTarget!==null,a=!o||this.dragContainers.includes(this.currentDropTarget);o&&this.currentDropTarget&&!a&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),a&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.deactivateDroppables()}checkAllMaxAssociations(){let o=this.getValidAssociations(),a=this.maxAssociations!==0&&o>=this.maxAssociations;this.droppables.forEach(c=>{a?this.disableDroppable(c):this.checkMaxAssociations(c)?this.disableDroppable(c):this.enableDroppable(c)})}getMatchMaxValue(o){let a=o.getAttribute("match-max");return a?parseInt(a,10):1}disableDroppable(o){o.setAttribute("disabled","")}enableDroppable(o){o.removeAttribute("disabled")}get value(){return this.collectResponseData()}set value(o){if(!this.isMatchTabular())if(Array.isArray(o)){this.reset(),o?.forEach(c=>this.placeResponse(c));let a=new FormData;o.forEach(c=>{a.append(this.responseIdentifier,c)}),this._internals.setFormValue(a)}else this._internals.setFormValue(o||"")}placeResponse(o){let[a,...c]=o.split(" ").reverse(),d=Array.from(this.draggables),f=Array.from(this.droppables);c.forEach(g=>{let y=d.find(x=>x.getAttribute("identifier")===g),T=f.find(x=>x.getAttribute("identifier")===a);this.dropDraggableInDroppable(y,T)})}getValidAssociations(){let o=0;for(let a of this.droppables)o=o+this.getDraggablesFromDroppable(a).length;return o}saveResponse(){let o=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:o}}))}collectResponseData(){return this.droppables.map(a=>{let d=this.getDraggablesFromDroppable(a).map(g=>g.getAttribute("identifier")),f=a.getAttribute("identifier");return d.map(g=>`${g} ${f}`)}).flat()}getDraggablesFromDroppable(o){return this.draggables.map(d=>d.getAttribute("identifier")).filter((d,f,g)=>g.indexOf(d)===f).flatMap(d=>Array.from(o.querySelectorAll(`[identifier='${d}']`))).filter(d=>!!d).map(d=>d)}reset(o=!1){this.droppables.forEach(a=>{this.getDraggablesFromDroppable(a).forEach(d=>{d.remove(),this.draggablesModified([],[d])})}),this.dragContainers.forEach(a=>{Array.from(a.querySelectorAll('[qti-draggable="true"]')).forEach(d=>{d.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,o&&this.saveResponse()}updateDragClonePosition(o){if(!this.isDragging||!this.dragClone)return;let a=o.clientX-this.cloneOffset.x,c=o.clientY-this.cloneOffset.y,{newLeft:d,newTop:f}=this.applyInteractionBoundaries(a,c,this.dragClone);this.dragClone.style.left=`${d}px`,this.dragClone.style.top=`${f}px`}applyInteractionBoundaries(o,a,c){let d=this.getBoundingClientRect(),f=c.getBoundingClientRect(),g=f.width,y=f.height,T=Math.max(d.left,Math.min(o,d.right-g)),x=Math.max(d.top,Math.min(a,d.bottom-y));return{newLeft:T,newTop:x}}getEventCoordinates(o,a=!1){let c=o.touches?o.touches[0]:o;return{x:a?c.pageX:c.clientX,y:a?c.pageY:c.clientY}}calculateDragDistance(o){let a=Math.abs(o.clientX-this.touchStartPoint.x),c=Math.abs(o.clientY-this.touchStartPoint.y);return a+c}findClosestDropzone(){let o=this.allDropzones.filter(f=>!f.hasAttribute("disabled"));if(!this.dragClone||o.length===0)return null;let a=this.dragClone.getBoundingClientRect(),c=null,d=0;for(let f of o){let g=f.getBoundingClientRect(),y=this.calculateOverlapArea(a,g);y>d&&(d=y,c=f)}if(!c){let f=200;for(let g of o){let y=g.getBoundingClientRect(),T=Math.sqrt(Math.pow(a.left-y.left,2)+Math.pow(a.top-y.top,2));T<f&&(f=T,c=g)}}return c}calculateOverlapArea(o,a){let c=Math.max(0,Math.min(o.right,a.right)-Math.max(o.left,a.left)),d=Math.max(0,Math.min(o.bottom,a.bottom)-Math.max(o.top,a.top));return c*d}dispatchCustomEvent(o,a,c=!0){if(!o)return;let d=new CustomEvent(a,{bubbles:c,cancelable:!0});d.dataTransfer=this.dataTransfer,o.dispatchEvent(d)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(o){if(this.isDragging)return;let{x:a,y:c}=this.getEventCoordinates(o);this.touchStartPoint={x:a,y:c},this.dragSource=o.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let d=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),f=this.droppables.some(w=>Array.from(w.children).some(W=>W===this.dragSource)),g=this.dragSource.getBoundingClientRect();f&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=d),this.cloneOffset.x=a-g.left,this.cloneOffset.y=c-g.top,this.dragClone=d.cloneNode(!0);let y=window.getComputedStyle(d);for(let w=0;w<y.length;w++){let W=y[w];this.dragClone.style.setProperty(W,y.getPropertyValue(W))}let T=d.getBoundingClientRect();this.dragClone.style.width=`${T.width}px`,this.dragClone.style.height=`${T.height}px`,g&&this.setDragCloneStyles(g),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone();let x=this.getMatchMaxValue(this.dragSource),X=this.draggables.filter(w=>w.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));x!==0&&X.length>=x?(d.style.opacity="0.0",d.style.pointerEvents="none"):d.style.opacity="1.0",o.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(o){let a=this.dragContainers.flat();for(let c of a){if(c.getAttribute("identifier")===o)return c;let d;c instanceof HTMLSlotElement?d=Array.from(c?.assignedElements()||[]):d=Array.from(c.querySelectorAll(s));let f=d.find(g=>g.getAttribute("identifier")===o);if(f)return f}}setDragCloneStyles(o){this.dragClone.style.position="fixed",this.dragClone.style.top=`${o.top}px`,this.dragClone.style.left=`${o.left}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 n([u({attribute:!1,type:Object})],r.prototype,"configuration",2),n([u({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),n([u({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),n([je(t)],r.prototype,"handleDraggableContainerChange",1),n([je(s)],r.prototype,"handleDraggablesChange",1),n([je(e)],r.prototype,"handleDroppablesChange",1),r};var Yt=b`
|
|
81
|
+
:host {
|
|
82
|
+
display: block; /* necessary to calculate scaling position */
|
|
83
|
+
}
|
|
84
|
+
slot[name='qti-simple-associable-choice'] {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: flex-start;
|
|
87
|
+
flex: 1;
|
|
88
|
+
border: 2px solid transparent;
|
|
89
|
+
padding: 0.3rem;
|
|
90
|
+
border-radius: 0.3rem;
|
|
91
|
+
gap: 0.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host::part(associables-container) {
|
|
95
|
+
display: flex;
|
|
96
|
+
padding: 0.5rem;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
background: linear-gradient(
|
|
99
|
+
180deg,
|
|
100
|
+
rgb(0 0 0 / 0%) calc(50% - 1px),
|
|
101
|
+
var(--qti-border-color-gray) calc(50%),
|
|
102
|
+
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
`;var ue=class extends H(C,"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 m` <slot name="prompt"></slot>
|
|
106
|
+
<slot name="qti-simple-associable-choice"></slot>
|
|
107
|
+
<div part="drop-container">
|
|
108
|
+
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>m`<div part="associables-container">
|
|
109
|
+
<div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
|
|
110
|
+
<div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
|
|
111
|
+
</div>`)}
|
|
112
|
+
|
|
113
|
+
<div role="alert" id="validationMessage"></div>
|
|
114
|
+
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ue.styles=Yt,n([E()],ue.prototype,"_childrenMap",2),ue=n([h("qti-associate-interaction")],ue);var Z=(p,s)=>{class e extends p{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(i,l)=>{this._choiceElements.forEach(o=>o.disabled=l)};this._handleReadonlyChange=(i,l)=>{this._choiceElements.forEach(o=>o.readonly=l)};this._value=""}_handleMaxChoicesChange(i,l){this._determineInputType()}get value(){return Array.isArray(this._value)&&this._value.length===0||this._value===""?null:Array.isArray(this._value)?this._value.join(","):this._value}set value(i){if(this.maxChoices>1&&(typeof i=="string"||i===null)?this._value=i?i.toString().split(","):[]:this._value=i||"",Array.isArray(this._value)){let l=new FormData;this._value.forEach(o=>{l.append(this.responseIdentifier,o)}),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(o=>{o.internals.states.delete("correct-response"),o.internals.states.delete("incorrect-response"),l.length>0&&(l.includes(o.identifier)?o.internals.states.add("correct-response"):o.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(c=>this._getChoiceChecked(c)),l=i.length,o=!0,a="";return this.maxChoices!==0&&l>this.maxChoices?(o=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):l<this.minChoices&&(o=!1,a=`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`),i.length>0&&this._internals.setValidity(o?{}:{customError:!0},a,i[l-1]||this._choiceElements[0]||this),o}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(o=>o!==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(o=>this._getChoiceChecked(o)).map(o=>o.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 o=i.includes(l.identifier);this._setChoiceChecked(l,o)})}}return n([Ue("#validationMessage")],e.prototype,"_validationMessageElement",2),n([u({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),n([u({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),n([R("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),n([R("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),n([R("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var Je=(p,s)=>{class e extends p{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(g=>g.hasAttribute("fixed")),o=i.filter(g=>!g.hasAttribute("fixed"));if(o.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let a=[...o],c=!1,d=0;for(;!c&&d<10;){d++;for(let g=o.length-1;g>0;g--){let y=Math.floor(Math.random()*(g+1));[o[g],o[y]]=[o[y],o[g]]}c=!o.every((g,y)=>g===a[y])}c||console.warn("Failed to shuffle the choices after multiple attempts.");let f=1;[...l,...o].forEach(g=>{g.style.setProperty("order",String(f++))})}_resetShuffleChoices(){this.querySelectorAll(s).forEach(i=>{i.style.setProperty("order","initial")})}}return n([u({type:String,reflect:!0})],e.prototype,"shuffle",2),e};var Ut=(p,s)=>{class e extends p{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(o=>this._allLabels.includes(o)||this._allLabelSuffixes.includes(o)),l=o=>!isNaN(+o);if(i){let a=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c).map((c,d)=>({el:c,order:l(c.style.order)?+c.style.order:d+1})).sort((c,d)=>c.order-d.order).map(c=>c.el);for(let c=0;c<a.length;c++)a[c].marker=this._getLabel(c+1)}}_getLabel(i){let l=this._classes.filter(c=>this._allLabels.includes(c)).pop(),o=this._classes.filter(c=>this._allLabelSuffixes.includes(c)).pop();!l&&o&&(l="qti-labels-upper-alpha");let a="";switch(l){case"qti-labels-decimal":a=`${i}`;break;case"qti-labels-lower-alpha":a=`${String.fromCharCode(97+i-1)}`;break;case"qti-labels-upper-alpha":a=`${String.fromCharCode(65+i-1)}`;break}return o==="qti-labels-suffix-period"?a+=".":o==="qti-labels-suffix-parenthesis"&&(a+=")"),a}}return n([u({type:String,reflect:!0})],e.prototype,"class",1),e};var jt=b`
|
|
115
|
+
[part='slot'] {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--qti-gap-size);
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
::slotted(qti-simple-choice) {
|
|
123
|
+
flex: 0 0
|
|
124
|
+
calc((100% - (var(--qti-gap-size) * var(--choice-interactions-stacking))) / var(--choice-interactions-stacking)) !important;
|
|
125
|
+
box-sizing: border-box !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host(.qti-choices-stacking-1) [part='slot'] {
|
|
129
|
+
flex-direction: row;
|
|
130
|
+
--choice-interactions-stacking: 1;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host(.qti-choices-stacking-2) [part='slot'] {
|
|
134
|
+
flex-direction: row;
|
|
135
|
+
--choice-interactions-stacking: 2;
|
|
136
|
+
}
|
|
137
|
+
:host(.qti-choices-stacking-3) [part='slot'] {
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
--choice-interactions-stacking: 3;
|
|
140
|
+
}
|
|
141
|
+
:host(.qti-choices-stacking-4) [part='slot'] {
|
|
142
|
+
flex-direction: row;
|
|
143
|
+
--choice-interactions-stacking: 4;
|
|
144
|
+
}
|
|
145
|
+
:host(.qti-choices-stacking-5) [part='slot'] {
|
|
146
|
+
flex-direction: row;
|
|
147
|
+
--choice-interactions-stacking: 5;
|
|
148
|
+
}
|
|
149
|
+
:host([orientation='horizontal']) [part='slot'] {
|
|
150
|
+
flex-direction: row;
|
|
151
|
+
}
|
|
152
|
+
`;var me=class extends Ut(Je(Z(C,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){constructor(){super(),this._internals.role="group"}render(){return m`
|
|
153
|
+
<slot part="prompt" name="prompt"></slot><slot part="slot"></slot>
|
|
154
|
+
<div part="message" role="alert" id="validationMessage"></div>
|
|
155
|
+
`}};me.styles=jt,n([u({type:String})],me.prototype,"orientation",2),me=n([h("qti-choice-interaction")],me);var z=class extends C{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:Te(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(`
|
|
156
|
+
<html>
|
|
157
|
+
<head>
|
|
158
|
+
<link href='${Te(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
159
|
+
<script src='${Te(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
|
|
160
|
+
</head>
|
|
161
|
+
<body></body>
|
|
162
|
+
</html>
|
|
163
|
+
`),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 a=i.contentDocument||i.contentWindow.document;a&&this.getInnerIFrames(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}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 a=i.contentDocument||i.contentWindow.document;this.getInnerIFrames(a,t)}catch(a){console.error("Error accessing nested iframe:",a)}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:Te(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 m`<iframe
|
|
164
|
+
width=${this.getAttribute("width")}
|
|
165
|
+
height=${this.getAttribute("height")}
|
|
166
|
+
frameborder="0"
|
|
167
|
+
title="pciContainer"
|
|
168
|
+
id="pciContainer"
|
|
169
|
+
>
|
|
170
|
+
</iframe>
|
|
171
|
+
${this._errorMessage&&m`<div style="color:red">
|
|
172
|
+
<h1>Error</h1>
|
|
173
|
+
${this._errorMessage}
|
|
174
|
+
</div>`}`}};n([u({type:String,attribute:"data"})],z.prototype,"data",2),n([u({type:String,attribute:"data-base-item"})],z.prototype,"baseItemUrl",2),n([u({type:String,attribute:"data-base-ref"})],z.prototype,"baseRefUrl",2),n([u({type:String,attribute:"id"})],z.prototype,"id",2),n([E()],z.prototype,"_errorMessage",2),z=n([h("qti-custom-interaction")],z);var G=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return m`<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"}}))}};n([u({type:String,attribute:"response-identifier"})],G.prototype,"responseIdentifier",2),n([u({reflect:!0,type:Boolean})],G.prototype,"disabled",2),n([u({type:String,attribute:"count-attempt"})],G.prototype,"countAttempt",2),n([u({type:String})],G.prototype,"title",2),G=n([h("qti-end-attempt-interaction")],G);var Q=p=>p??D;var Xt=b`
|
|
175
|
+
/* PK: display host as block, else design will be collapsed */
|
|
176
|
+
:host {
|
|
177
|
+
display: block;
|
|
178
|
+
}
|
|
179
|
+
textarea {
|
|
180
|
+
box-sizing: border-box;
|
|
181
|
+
width: 100%;
|
|
182
|
+
height: 100%;
|
|
183
|
+
border: 0;
|
|
184
|
+
}
|
|
185
|
+
`;var A=class extends C{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 o=l.replace("qti-height-lines-","");this._rows=parseInt(o),i=!0}}),!i&&this.expectedLength){let l=Math.ceil(this.expectedLength/50);this._rows=l}}get value(){return this._value||null}set value(e){if(typeof e=="string"||e===null){this._value=e||"";let t=new FormData;t.append(this.responseIdentifier,this._value),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 m`<slot name="prompt"></slot
|
|
186
|
+
><textarea
|
|
187
|
+
part="textarea"
|
|
188
|
+
name="${this.responseIdentifier}"
|
|
189
|
+
spellcheck="false"
|
|
190
|
+
autocomplete="off"
|
|
191
|
+
maxlength="${5e3}"
|
|
192
|
+
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
193
|
+
@keyup="${this.textChanged}"
|
|
194
|
+
@change="${this.textChanged}"
|
|
195
|
+
@blur="${e=>{this.reportValidity()}}"
|
|
196
|
+
placeholder="${Q(this.placeholderText?this.placeholderText:void 0)}"
|
|
197
|
+
rows="${this._rows}"
|
|
198
|
+
?disabled="${this.disabled}"
|
|
199
|
+
?readonly="${this.readonly}"
|
|
200
|
+
.value=${this._value}
|
|
201
|
+
></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")}};A.styles=Xt,n([E()],A.prototype,"_rows",2),n([u({type:Number,attribute:"expected-length"})],A.prototype,"expectedLength",2),n([u({type:String,attribute:"pattern-mask"})],A.prototype,"patternMask",2),n([u({type:String,attribute:"placeholder-text"})],A.prototype,"placeholderText",2),n([u({type:String,attribute:"data-patternmask-message"})],A.prototype,"dataPatternmaskMessage",2),n([E()],A.prototype,"_value",2),n([u({type:String,attribute:"class"})],A.prototype,"classNames",2),n([R("classNames")],A.prototype,"handleclassNamesChange",1),A=n([h("qti-extended-text-interaction")],A);var he=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};he.styles=b`
|
|
202
|
+
:host {
|
|
203
|
+
display: flex;
|
|
204
|
+
user-select: none;
|
|
205
|
+
}
|
|
206
|
+
`,n([u({type:Number,reflect:!0})],he.prototype,"tabindex",2),he=n([h("qti-gap-img")],he);var Wt=b`
|
|
207
|
+
:host {
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: flex-start;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
flex-wrap: wrap;
|
|
212
|
+
gap: 0.5rem;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:host(.qti-choices-top) {
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
}
|
|
218
|
+
:host(.qti-choices-bottom) {
|
|
219
|
+
flex-direction: column-reverse;
|
|
220
|
+
}
|
|
221
|
+
:host(.qti-choices-left) {
|
|
222
|
+
flex-direction: row;
|
|
223
|
+
}
|
|
224
|
+
:host(.qti-choices-right) {
|
|
225
|
+
flex-direction: row-reverse;
|
|
226
|
+
}
|
|
227
|
+
/* [part='drops'] , */
|
|
228
|
+
[name='prompt'] {
|
|
229
|
+
width: 100%;
|
|
230
|
+
}
|
|
231
|
+
[name='drags'] {
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: flex-start;
|
|
234
|
+
flex: 1;
|
|
235
|
+
border: 2px solid transparent;
|
|
236
|
+
padding: 0.3rem;
|
|
237
|
+
border-radius: 0.3rem;
|
|
238
|
+
gap: 0.5rem;
|
|
239
|
+
}
|
|
240
|
+
`;var Re=class extends H(C,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return m`<slot name="prompt"> </slot>
|
|
241
|
+
<slot part="drags" name="drags"></slot>
|
|
242
|
+
<slot part="drops"></slot>
|
|
243
|
+
<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"),o=e.find(c=>c.gap===l)?.text,a=this.querySelector(`qti-gap-text[identifier="${o}"]`)?.textContent.trim();if(o&&a){if(!i.nextElementSibling?.classList.contains("correct-option")){let c=document.createElement("span");c.classList.add("correct-option"),c.textContent=a,i.insertAdjacentElement("afterend",c)}}else i.nextElementSibling?.classList.contains("correct-option")&&i.nextElementSibling.remove()})}};Re.styles=Wt,Re=n([h("qti-gap-match-interaction")],Re);var Jt={toAttribute:p=>p?"true":"false",fromAttribute:p=>p==="true"};function $(p,s){class e extends p{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 m`<slot></slot>`}}return n([u({type:String})],e.prototype,"identifier",2),n([u({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),n([u({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Jt})],e.prototype,"disabled",2),n([u({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Jt})],e.prototype,"readonly",2),n([R("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var fe=class extends $(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return m`<slot></slot>`}};fe.styles=b`
|
|
244
|
+
:host {
|
|
245
|
+
display: inline-flex;
|
|
246
|
+
user-select: none;
|
|
247
|
+
}
|
|
248
|
+
`,n([u({type:Number,reflect:!0})],fe.prototype,"tabindex",2),fe=n([h("qti-gap-text")],fe);var ge=class extends v{constructor(){super(...arguments);this.tabindex=0}render(){return m` <slot name="drags"></slot>`}};ge.styles=b`
|
|
249
|
+
:host {
|
|
250
|
+
display: flex;
|
|
251
|
+
user-select: none;
|
|
252
|
+
}
|
|
253
|
+
`,n([u({type:Number,reflect:!0})],ge.prototype,"tabindex",2),ge=n([h("qti-gap")],ge);var Kt=(p,s,e)=>{let t=new Map;for(let r=s;r<=e;r++)t.set(p[r],r);return t},Ke=J(class extends ce{constructor(p){if(super(p),p.type!==le.CHILD)throw Error("repeat() can only be used in text expressions")}dt(p,s,e){let t;e===void 0?e=s:s!==void 0&&(t=s);let r=[],i=[],l=0;for(let o of p)r[l]=t?t(o,l):l,i[l]=e(o,l),l++;return{values:i,keys:r}}render(p,s,e){return this.dt(p,s,e).values}update(p,[s,e,t]){let r=Ft(p),{values:i,keys:l}=this.dt(s,e,t);if(!Array.isArray(r))return this.ut=l,i;let o=this.ut??(this.ut=[]),a=[],c,d,f=0,g=r.length-1,y=0,T=i.length-1;for(;f<=g&&y<=T;)if(r[f]===null)f++;else if(r[g]===null)g--;else if(o[f]===l[y])a[y]=K(r[f],i[y]),f++,y++;else if(o[g]===l[T])a[T]=K(r[g],i[T]),g--,T--;else if(o[f]===l[T])a[T]=K(r[f],i[T]),pe(p,a[T+1],r[f]),f++,T--;else if(o[g]===l[y])a[y]=K(r[g],i[y]),pe(p,r[f],r[g]),g--,y++;else if(c===void 0&&(c=Kt(l,y,T),d=Kt(o,f,g)),c.has(o[f]))if(c.has(o[g])){let x=d.get(l[y]),X=x!==void 0?r[x]:null;if(X===null){let w=pe(p,r[f]);K(w,i[y]),a[y]=w}else a[y]=K(X,i[y]),pe(p,r[f],X),r[x]=null;y++}else Xe(r[g]),g--;else Xe(r[f]),f++;for(;y<=T;){let x=pe(p,a[T+1]);K(x,i[y]),a[y++]=x}for(;f<=g;){let x=r[f++];x!==null&&Xe(x)}return this.ut=l,Pt(p,a),ae}});function be(p,s,e,t){switch(p){case"circle":{let[r,i,l]=s,o=r/e.width*100,a=i/e.height*100,c=l/e.width*100;t.style.left=o-c+"%",t.style.top=a-c+"%",t.style.width=t.style.height=4*c+"px",t.style.borderRadius="9999px"}break;case"rect":{let[r,i,l,o]=s,a=r/e.width*100,c=i/e.height*100,d=l/e.width*100,f=o/e.height*100;t.style.left=a+"%",t.style.top=c+"%",t.style.width=d-a+"%",t.style.height=f-c+"%"}break;case"ellipse":{let[r,i,l,o]=s,a=r/e.width*100,c=i/e.height*100,d=l/e.width*100,f=o/e.height*100;t.style.left=a-d+"%",t.style.top=c-f+"%",t.style.width=2*d+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"poly":{let r=[];for(let x=0;x<s.length;x+=2)r.push({x:s[x],y:s[x+1]});let i=Math.min(...r.map(x=>x.x)),l=Math.max(...r.map(x=>x.x)),o=Math.min(...r.map(x=>x.y)),a=Math.max(...r.map(x=>x.y)),c=i/e.width*100,d=o/e.height*100,f=l/e.width*100,g=a/e.height*100;t.style.left=c+"%",t.style.top=d+"%",t.style.width=f-c+"%",t.style.height=g-d+"%";let T=r.map(x=>({x:(x.x-i)/(l-i)*100,y:(x.y-o)/(a-o)*100})).map(x=>`${x.x}% ${x.y}%`).join(",");t.style.clipPath=`polygon(${T})`}break;default:console.error(`Unsupported shape: ${p}`);break}}var Zt=b`
|
|
254
|
+
slot:not([name='prompt']) {
|
|
255
|
+
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
256
|
+
display: block;
|
|
257
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
258
|
+
}
|
|
259
|
+
::slotted(img) {
|
|
260
|
+
/* image not selectable anymore */
|
|
261
|
+
pointer-events: none;
|
|
262
|
+
user-select: none;
|
|
263
|
+
}
|
|
264
|
+
::slotted(qti-associable-hotspot) {
|
|
265
|
+
transform: translate(-50%, -50%);
|
|
266
|
+
}
|
|
267
|
+
line-container {
|
|
268
|
+
display: block;
|
|
269
|
+
position: relative;
|
|
270
|
+
}
|
|
271
|
+
svg {
|
|
272
|
+
position: absolute;
|
|
273
|
+
top: 0px;
|
|
274
|
+
left: 0px;
|
|
275
|
+
}
|
|
276
|
+
`;var B=class extends C{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 m`<slot name="prompt"></slot>
|
|
277
|
+
<line-container>
|
|
278
|
+
<svg
|
|
279
|
+
width=${Q(this.grImage[0]?.width)}
|
|
280
|
+
height=${Q(this.grImage[0]?.height)}
|
|
281
|
+
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
282
|
+
>
|
|
283
|
+
${Ke(this._lines,e=>e,(e,t)=>pt`
|
|
284
|
+
<line
|
|
285
|
+
part="line"
|
|
286
|
+
x1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.left)}
|
|
287
|
+
y1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.top)}
|
|
288
|
+
x2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.left)}
|
|
289
|
+
y2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.top)}
|
|
290
|
+
stroke="red"
|
|
291
|
+
stroke-width="3"
|
|
292
|
+
@click=${r=>{r.stopPropagation(),this._lines=this._lines.filter((i,l)=>l!==t),this.saveResponse(this._lines)}}
|
|
293
|
+
/>
|
|
294
|
+
`)}
|
|
295
|
+
${this.startPoint&&pt`<line
|
|
296
|
+
part="point"
|
|
297
|
+
x1=${this.startCoord.x}
|
|
298
|
+
y1=${this.startCoord.y}
|
|
299
|
+
x2=${this.mouseCoord.x}
|
|
300
|
+
y2=${this.mouseCoord.y}
|
|
301
|
+
stroke="red"
|
|
302
|
+
stroke-width="3"
|
|
303
|
+
/>`}
|
|
304
|
+
</svg>
|
|
305
|
+
<slot></slot>
|
|
306
|
+
</line-container>
|
|
307
|
+
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),l=r.getAttribute("shape"),o=i.split(",").map(a=>parseInt(a));be(l,o,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)}};B.styles=Zt,n([E()],B.prototype,"_lines",2),n([E()],B.prototype,"startCoord",2),n([E()],B.prototype,"mouseCoord",2),n([Nt({selector:"img"})],B.prototype,"grImage",2),B=n([h("qti-graphic-associate-interaction")],B);var Gt=b`
|
|
308
|
+
:host {
|
|
309
|
+
display: flex;
|
|
310
|
+
align-items: flex-start;
|
|
311
|
+
flex-direction: column;
|
|
312
|
+
flex-wrap: wrap;
|
|
313
|
+
gap: 0.5rem;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
:host(.qti-choices-top) {
|
|
317
|
+
flex-direction: column-reverse;
|
|
318
|
+
}
|
|
319
|
+
:host(.qti-choices-bottom) {
|
|
320
|
+
flex-direction: column;
|
|
321
|
+
}
|
|
322
|
+
:host(.qti-choices-left) {
|
|
323
|
+
flex-direction: row-reverse;
|
|
324
|
+
& [name='drags'] {
|
|
325
|
+
width: 25%;
|
|
326
|
+
}
|
|
327
|
+
& [part='image'] {
|
|
328
|
+
width: 75%;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
:host(.qti-choices-right) {
|
|
332
|
+
flex-direction: row;
|
|
333
|
+
& [name='drags'] {
|
|
334
|
+
width: 25%;
|
|
335
|
+
}
|
|
336
|
+
& [part='image'] {
|
|
337
|
+
width: 75%;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
[part='image'] {
|
|
341
|
+
display: block;
|
|
342
|
+
position: relative;
|
|
343
|
+
}
|
|
344
|
+
/* [part='drops'] , */
|
|
345
|
+
|
|
346
|
+
[name='drags'] {
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: flex-start;
|
|
349
|
+
flex-wrap: wrap;
|
|
350
|
+
flex: 1;
|
|
351
|
+
border: 2px solid transparent;
|
|
352
|
+
padding: 0.3rem;
|
|
353
|
+
border-radius: 0.3rem;
|
|
354
|
+
gap: 0.5rem;
|
|
355
|
+
}
|
|
356
|
+
::slotted(img) {
|
|
357
|
+
display: inline-block;
|
|
358
|
+
user-select: none;
|
|
359
|
+
pointer-events: none;
|
|
360
|
+
}
|
|
361
|
+
`;var ke=class extends H(C,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){render(){return m` <slot name="prompt"></slot>
|
|
362
|
+
<slot part="image"></slot>
|
|
363
|
+
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
364
|
+
<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,o,a]=i;e.style.left=l-a+"px",e.style.top=o-a+"px",e.style.width=e.style.height=2*a+"px"}break;case"rect":{let[l,o,a,c]=i;e.style.left=l+"px",e.style.top=o+"px",e.style.width=a-l+"px",e.style.height=c-o+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};ke.styles=Gt,ke=n([h("qti-graphic-gap-match-interaction")],ke);var Qt=b`
|
|
365
|
+
slot:not([name='prompt']) {
|
|
366
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
367
|
+
display: block;
|
|
368
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
369
|
+
}
|
|
370
|
+
::slotted(img) {
|
|
371
|
+
/* image not selectable anymore */
|
|
372
|
+
pointer-events: none;
|
|
373
|
+
user-select: none;
|
|
374
|
+
}
|
|
375
|
+
`;var Le=class extends Z(C,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return m`
|
|
376
|
+
<slot name="prompt"></slot>
|
|
377
|
+
<slot></slot>
|
|
378
|
+
<div role="alert" id="validationMessage"></div>
|
|
379
|
+
`}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(l=>l.getAttribute("identifier")===t);if(!r)return;let i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let l=this._choiceElements.filter(o=>o.order!=null).length;if(l>=i){this.choiceOrdering=!1;return}r.order=l+1}else{let l=r.order;r.order=null,this._choiceElements.forEach(o=>{o.order!=null&&o.order>l&&o.order--})}this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),l=r.getAttribute("shape"),o=i.split(",").map(a=>parseInt(a));be(l,o,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)}};Le.styles=Qt,Le=n([h("qti-graphic-order-interaction")],Le);var ve=class extends $(v,"qti-hotspot-choice"){};ve.styles=b`
|
|
380
|
+
:host {
|
|
381
|
+
display: flex;
|
|
382
|
+
user-select: none;
|
|
383
|
+
position: absolute;
|
|
384
|
+
}
|
|
385
|
+
`,n([u({attribute:"aria-ordervalue",type:Number,reflect:!0})],ve.prototype,"order",2),ve=n([h("qti-hotspot-choice")],ve);var er=b`
|
|
386
|
+
slot:not([name='prompt']) {
|
|
387
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
388
|
+
display: block;
|
|
389
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
390
|
+
}
|
|
391
|
+
::slotted(img) {
|
|
392
|
+
/* image not selectable anymore */
|
|
393
|
+
pointer-events: none;
|
|
394
|
+
user-select: none;
|
|
395
|
+
/* width:100%; */
|
|
396
|
+
}
|
|
397
|
+
`;var Ae=class extends Z(C,"qti-hotspot-choice"){render(){return m`
|
|
398
|
+
<slot name="prompt"></slot>
|
|
399
|
+
<slot></slot>
|
|
400
|
+
`}positionHotspotOnRegister(s){let e=this.querySelector("img"),t=s.target,r=t.getAttribute("coords"),i=t.getAttribute("shape"),l=r.split(",").map(o=>parseInt(o));be(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)}};Ae.styles=er,Ae=n([h("qti-hotspot-interaction")],Ae);var Ze=class extends Z(C,"qti-hottext"){constructor(){super(...arguments);this.render=()=>m`<slot></slot>`}};Ze=n([h("qti-hottext-interaction")],Ze);var De=class extends $(v,"qti-hottext"){render(){return m`<div part="ch"><div part="cha"></div></div>
|
|
401
|
+
<slot></slot> `}};De.styles=b`
|
|
402
|
+
:host {
|
|
403
|
+
display: flex;
|
|
404
|
+
user-select: none;
|
|
405
|
+
}
|
|
406
|
+
`,De=n([h("qti-hottext")],De);var Ve=class extends ce{constructor(s){if(super(s),this.it=D,s.type!==le.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(s){if(s===D||s==null)return this._t=void 0,this.it=s;if(s===ae)return s;if(typeof s!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(s===this.it)return this._t;this.it=s;let e=[s];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ve.directiveName="unsafeHTML",Ve.resultType=1;var ee=J(Ve);var te=class extends C{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
|
|
407
|
+
:host {
|
|
408
|
+
display: inline-block;
|
|
409
|
+
}
|
|
410
|
+
slot {
|
|
411
|
+
display: flex;
|
|
412
|
+
flex-direction: column;
|
|
413
|
+
}
|
|
414
|
+
[role='menu'] {
|
|
415
|
+
position: absolute;
|
|
416
|
+
z-index: 1000;
|
|
417
|
+
}
|
|
418
|
+
.anchor {
|
|
419
|
+
/* anchor-name: --infobox; */
|
|
420
|
+
width: fit-content;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.positionedElement {
|
|
424
|
+
position: absolute;
|
|
425
|
+
/* position-anchor: --infobox; */
|
|
426
|
+
/* top: anchor(bottom); */
|
|
427
|
+
}
|
|
428
|
+
`]}render(){return m`
|
|
429
|
+
<select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
|
|
430
|
+
${this.options.map(e=>m`
|
|
431
|
+
<option value="${e.value}" ?selected="${e.selected}">${ee(e.textContent)}</option>
|
|
432
|
+
`)}
|
|
433
|
+
</select>
|
|
434
|
+
|
|
435
|
+
${ee(this.correctOption)}
|
|
436
|
+
`}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&&e===t.value&&(t.selected=!0),t))}get value(){return this.options.find(e=>e.selected)?.value||null}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)}};te.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"],n([E()],te.prototype,"options",2),n([E()],te.prototype,"correctOption",2),n([u({attribute:"data-prompt",type:String})],te.prototype,"dataPrompt",2),te=n([h("qti-inline-choice-interaction")],te);var He=class extends v{static get styles(){return[b`
|
|
437
|
+
:host {
|
|
438
|
+
display: block;
|
|
439
|
+
cursor: pointer;
|
|
440
|
+
}
|
|
441
|
+
`]}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 m` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};n([u({type:String})],He.prototype,"identifier",2),He=n([h("qti-inline-choice")],He);var re=class extends $(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 m`
|
|
442
|
+
<slot part="slot"></slot>
|
|
443
|
+
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
444
|
+
`}};re.styles=b`
|
|
445
|
+
:host {
|
|
446
|
+
display: flex;
|
|
447
|
+
user-select: none;
|
|
448
|
+
}
|
|
449
|
+
slot {
|
|
450
|
+
width: 100%;
|
|
451
|
+
display: block;
|
|
452
|
+
}
|
|
453
|
+
slot[name='qti-simple-associable-choice'] {
|
|
454
|
+
width: 100%;
|
|
455
|
+
}
|
|
456
|
+
`,n([u({type:Number,attribute:"match-min"})],re.prototype,"matchMin",2),n([u({type:Number,attribute:"match-max"})],re.prototype,"matchMax",2),n([u({type:Boolean,attribute:"fixed"})],re.prototype,"fixed",2),re=n([h("qti-simple-associable-choice")],re);var tr=b`
|
|
457
|
+
slot:not([hidden]) {
|
|
458
|
+
/* slot where the */
|
|
459
|
+
display: flex;
|
|
460
|
+
flex-direction: column;
|
|
461
|
+
gap: 0.5rem;
|
|
462
|
+
align-items: flex-start; /* prevents the drag and drop container slots having the same height */
|
|
463
|
+
}
|
|
464
|
+
:host(.qti-choices-top) slot {
|
|
465
|
+
flex-direction: column;
|
|
466
|
+
}
|
|
467
|
+
:host(.qti-choices-bottom) slot {
|
|
468
|
+
flex-direction: column-reverse;
|
|
469
|
+
}
|
|
470
|
+
:host(.qti-choices-left) slot {
|
|
471
|
+
flex-direction: row;
|
|
472
|
+
}
|
|
473
|
+
:host(.qti-choices-right) slot {
|
|
474
|
+
flex-direction: row-reverse;
|
|
475
|
+
}
|
|
476
|
+
slot[name='prompt'] {
|
|
477
|
+
display: block;
|
|
478
|
+
}
|
|
479
|
+
::slotted(qti-simple-match-set) {
|
|
480
|
+
/* Make sure the drag and drop container slots have the same width */
|
|
481
|
+
flex: 1;
|
|
482
|
+
}
|
|
483
|
+
`;var Y=class extends H(C,"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(o=>o.indexOf(i)===-1)),this.value=[...this.value,r]):this.value=[r],this.lastCheckedRadio=t):(this.value=this.value.filter(o=>o!==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,this.class.split(" ").includes("qti-match-tabular")||(this.value=e))}render(){let e=this.class.split(" ").includes("qti-match-tabular");return m`
|
|
484
|
+
<slot name="prompt"></slot>
|
|
485
|
+
<slot ?hidden=${e}></slot>
|
|
486
|
+
|
|
487
|
+
${e?m`
|
|
488
|
+
<table>
|
|
489
|
+
<tr>
|
|
490
|
+
<td></td>
|
|
491
|
+
${this.cols.map(t=>m`<th part="r-header">${ee(t.innerHTML)}</th>`)}
|
|
492
|
+
</tr>
|
|
493
|
+
|
|
494
|
+
${this.rows.map(t=>m`<tr>
|
|
495
|
+
<td part="c-header">${ee(t.innerHTML)}</td>
|
|
496
|
+
${this.cols.map(r=>{let i=t.getAttribute("identifier"),l=r.getAttribute("identifier"),o=`${i} ${l}`,a=this.value.filter(g=>g.split(" ")[0]===i).length||0,c=this.value.includes(o),d=`rb ${c?"rb-checked":""} ${this.correctOptions.includes(o)?"rb-correct":""}`,f=this.correctOptions.length>0?!0:t.matchMax===1?!1:t.matchMax!==0&&a>=t.matchMax&&!c;return m`<td>
|
|
497
|
+
<input
|
|
498
|
+
type=${t.matchMax===1?"radio":"checkbox"}
|
|
499
|
+
part=${d}
|
|
500
|
+
name=${i}
|
|
501
|
+
value=${o}
|
|
502
|
+
.disabled=${f}
|
|
503
|
+
@change=${g=>this.handleRadioChange(g)}
|
|
504
|
+
@click=${g=>t.matchMax===1?this.handleRadioClick(g):null}
|
|
505
|
+
/>
|
|
506
|
+
</td>`})}
|
|
507
|
+
</tr>`)}
|
|
508
|
+
</table>
|
|
509
|
+
`:D}
|
|
510
|
+
|
|
511
|
+
<div role="alert" id="validationMessage"></div>
|
|
512
|
+
`}};Y.styles=tr,n([u({type:String})],Y.prototype,"class",2),n([E()],Y.prototype,"_response",2),n([u({type:String,attribute:"response-identifier"})],Y.prototype,"responseIdentifier",2),n([E()],Y.prototype,"correctOptions",2),Y=n([h("qti-match-interaction")],Y);var $e=class extends C{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{...C.properties,step:{type:Number,attribute:"step",default:10}}}render(){return m` <slot name="prompt"></slot>
|
|
513
|
+
<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)})}};$e.styles=[b``],$e=n([h("qti-media-interaction")],$e);var rr=b`
|
|
514
|
+
[part='drags'] {
|
|
515
|
+
display: flex;
|
|
516
|
+
align-items: flex-start;
|
|
517
|
+
flex: 1;
|
|
518
|
+
border: 2px solid transparent;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
[part='drops'] {
|
|
522
|
+
flex: 1;
|
|
523
|
+
display: grid;
|
|
524
|
+
grid-auto-flow: column;
|
|
525
|
+
grid-auto-columns: 1fr;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
:host([orientation='horizontal']) [part='drags'] {
|
|
529
|
+
flex-direction: row;
|
|
530
|
+
}
|
|
531
|
+
:host([orientation='horizontal']) [part='drops'] {
|
|
532
|
+
grid-auto-flow: column;
|
|
533
|
+
}
|
|
534
|
+
:host([orientation='vertical']) [part='drags'] {
|
|
535
|
+
flex-direction: column;
|
|
536
|
+
}
|
|
537
|
+
:host([orientation='vertical']) [part='drops'] {
|
|
538
|
+
grid-auto-flow: row;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
[part='drop-list'] {
|
|
542
|
+
display: block;
|
|
543
|
+
flex: 1;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
[part='container'] {
|
|
547
|
+
display: flex;
|
|
548
|
+
gap: 0.5rem;
|
|
549
|
+
}
|
|
550
|
+
:host(.qti-choices-top) [part='container'] {
|
|
551
|
+
flex-direction: column;
|
|
552
|
+
}
|
|
553
|
+
:host(.qti-choices-bottom) [part='container'] {
|
|
554
|
+
flex-direction: column-reverse;
|
|
555
|
+
}
|
|
556
|
+
:host(.qti-choices-left) [part='container'] {
|
|
557
|
+
flex-direction: row;
|
|
558
|
+
}
|
|
559
|
+
:host(.qti-choices-right) [part='container'] {
|
|
560
|
+
flex-direction: row-reverse;
|
|
561
|
+
}
|
|
562
|
+
`;var U=class extends Je(H(C,"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),m` <slot name="prompt"> </slot>
|
|
563
|
+
<div part="container">
|
|
564
|
+
<slot part="drags"> </slot>
|
|
565
|
+
<div part="drops">
|
|
566
|
+
${Array.from(Array(this.nrChoices)).map((t,r)=>m`<drop-list part="drop-list" identifier="droplist${r}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>r?ee(`<span part='correct-response'>${this.correctResponses[r]}</span>`):""}`)}
|
|
567
|
+
</div>
|
|
568
|
+
</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(o=>o.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"))}};U.styles=rr,n([E()],U.prototype,"nrChoices",2),n([E()],U.prototype,"correctResponses",2),n([E()],U.prototype,"showCorrectResponses",2),n([u({type:String})],U.prototype,"orientation",2),U=n([h("qti-order-interaction")],U);var ie=class extends C{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 o in l.paths)t&&(l.paths[o]=this.getResolvablePath(l.paths[o],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}addHyphenatedKeys(e){let t={...e};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=r.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`);t[i]=e[r]}return t}responseVariablesToQtiVariableJSON(e,t,r){if(t!=="single"){let i={list:{}};return i.list[r]=e,i}else{let i={base:{}};return i.base[r]=e,i}}validate(){return!0}set value(e){this._value=e}get value(){let e=this.pci?.getResponse();return e?this.convertQtiVariableJSON(e):this._value}set boundTo(e){let t=this.convertQtiVariableJSON(e);this._value=t,this.saveResponse(t)}get boundTo(){let e=this.responseVariablesToQtiVariableJSON(this._value,this.context.variables?.find(r=>r.identifier===this.responseIdentifier)?.cardinality||"single",this.context.variables?.find(r=>r.identifier===this.responseIdentifier)?.baseType||"string"),t={};return t[this.responseIdentifier]=e,t}register(e){this.pci=e;let t=this.querySelector("qti-interaction-markup");t.classList.add("qti-customInteraction"),this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let r={properties:this.addHyphenatedKeys({...this.dataset}),onready:i=>{this.pci=i},ondone:(i,l,o,a)=>{this.value=this.convertQtiVariableJSON(l),this.saveResponse(this.value)},responseIdentifier:this.responseIdentifier,boundTo:this.boundTo};if(e.getInstance)e.getInstance(t,r,void 0);else{let l=(o=>{let a={},d=(f=>{let g={};Object.entries(f.dataset).forEach(([T,x])=>{T.includes("__")||(g[T]=x)});let y={};return Object.entries(f.dataset).forEach(([T,x])=>{let X=T.split("__");if(X.length>1){let[w,W,mr]=X;y[w]=y[w]||{},y[w][W]=y[w][W]||{},y[w][W][mr]=x}}),Object.entries(y).forEach(([T,x])=>{g[T]=Object.values(x)}),g})(o);for(let f in d)if(Object.prototype.hasOwnProperty.call(d,f)){let g=d[f];f==="config"?a[f]=JSON.parse(g):a[f]=g}return a})(this);e.initialize(this.customInteractionTypeIdentifier,t.firstElementChild,Object.keys(l).length?l:null)}}connectedCallback(){super.connectedCallback(),console.log("connectedCallback"),define("qtiCustomInteractionContext",()=>({register:r=>{this.register(r)},notifyReady:()=>{}}));let e=this.buildRequireConfig(),t=requirejs.config(e);requirejs.onError=function(r){throw console.error("RequireJS error:",r),r.requireType==="timeout"&&console.error("Modules that timed out:",r.requireModules),r},t(["require"],r=>{try{r([this.module],()=>{},i=>{console.error("Error loading module:",i)})}catch(i){console.error("Error in require call:",i)}})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier]}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 o=l.getAttribute("id"),a=l.getAttribute("primary-path"),c=l.getAttribute("fallback-path");if(o&&a){let d=c?this.combineRequireResolvePaths(this.getResolvablePath(a,t),this.getResolvablePath(c,t)):this.getResolvablePath(a,t),f=e.paths[o]||[];e.paths[o]=this.combineRequireResolvePaths(f,d)}}}return e}combineRequireResolvePaths(e,t){let r=Array.isArray(e)?e:[e],i=Array.isArray(t)?t:[t];return r.concat(i).filter((l,o,a)=>a.indexOf(l)===o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return m`<slot></slot>${this._errorMessage&&m`<div style="color:red">
|
|
569
|
+
<h1>Error</h1>
|
|
570
|
+
${this._errorMessage}
|
|
571
|
+
</div>`}`}};n([u({type:String,attribute:"module"})],ie.prototype,"module",2),n([u({type:String,attribute:"custom-interaction-type-identifier"})],ie.prototype,"customInteractionTypeIdentifier",2),n([E()],ie.prototype,"_errorMessage",2),n([_({context:M,subscribe:!0}),E()],ie.prototype,"context",2),ie=n([h("qti-portable-custom-interaction")],ie);var Ge=class extends v{render(){return m`<slot></slot>`}};Ge.styles=[b`
|
|
572
|
+
:host {
|
|
573
|
+
display: block;
|
|
574
|
+
}
|
|
575
|
+
::slotted(img) {
|
|
576
|
+
position: absolute;
|
|
577
|
+
cursor: move;
|
|
578
|
+
user-select: none;
|
|
579
|
+
left: 50%;
|
|
580
|
+
transform: translateX(-50%);
|
|
581
|
+
}
|
|
582
|
+
`];customElements.define("qti-position-object-interaction",Ge);var Ne=class extends v{render(){return m`<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)}};Ne.styles=[b`
|
|
583
|
+
:host {
|
|
584
|
+
display: inline-block;
|
|
585
|
+
position: relative;
|
|
586
|
+
}
|
|
587
|
+
`],Ne=n([h("qti-position-object-stage")],Ne);var ir="important",fr=" !"+ir,sr=J(class extends ce{constructor(p){if(super(p),p.type!==le.ATTRIBUTE||p.name!=="style"||p.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(p){return Object.keys(p).reduce((s,e)=>{let t=p[e];return t==null?s:s+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(p,[s]){let{style:e}=p.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(s)),this.render(s);for(let t of this.ft)s[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in s){let r=s[t];if(r!=null){this.ft.add(t);let i=typeof r=="string"&&r.endsWith(fr);t.includes("-")||i?e.setProperty(t,i?r.slice(0,-11):r,i?ir:""):e[t]=r}}return ae}});var se=class extends C{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this.maxChoices===0||this._points.length<this.maxChoices){let t=e.offsetX,r=e.offsetY;this._points=[...this._points,`${t} ${r}`],this.saveResponse(this._points)}}}render(){return m` <slot name="prompt"></slot>
|
|
588
|
+
<point-container>
|
|
589
|
+
${Ke(this._points.filter(e=>e),e=>e,(e,t)=>m`
|
|
590
|
+
<button
|
|
591
|
+
part="point"
|
|
592
|
+
style=${sr({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
593
|
+
aria-label="Remove point at ${e}"
|
|
594
|
+
@click=${r=>{r.stopPropagation(),this._points=this._points.filter((i,l)=>l!==t),this.saveResponse(this._points)}}
|
|
595
|
+
></button>
|
|
596
|
+
`)}
|
|
597
|
+
<slot></slot>
|
|
598
|
+
</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)}};se.styles=[b`
|
|
599
|
+
:host {
|
|
600
|
+
display: block;
|
|
601
|
+
}
|
|
602
|
+
point-container {
|
|
603
|
+
display: block;
|
|
604
|
+
position: relative;
|
|
605
|
+
}
|
|
606
|
+
`],n([u({type:Number,attribute:"max-choices"})],se.prototype,"maxChoices",2),n([u({type:Number,attribute:"min-choices"})],se.prototype,"minChoices",2),n([E()],se.prototype,"_points",2),se=n([h("qti-select-point-interaction")],se);var ye=class extends $(v,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return m`<div part="ch">
|
|
607
|
+
<div part="cha"></div>
|
|
608
|
+
</div>
|
|
609
|
+
${this.marker?m`<div id="label">${this.marker}</div>`:D}
|
|
610
|
+
<slot part="slot"></slot> `}};ye.styles=b`
|
|
611
|
+
:host {
|
|
612
|
+
display: flex;
|
|
613
|
+
align-items: center;
|
|
614
|
+
user-select: none;
|
|
615
|
+
}
|
|
616
|
+
slot {
|
|
617
|
+
width: 100%;
|
|
618
|
+
display: flex;
|
|
619
|
+
align-items: center;
|
|
620
|
+
}
|
|
621
|
+
[part='ch'] {
|
|
622
|
+
display: flex;
|
|
623
|
+
flex-shrink: 0;
|
|
624
|
+
align-items: center;
|
|
625
|
+
justify-content: center;
|
|
626
|
+
}
|
|
627
|
+
`,n([u({type:String,attribute:!1})],ye.prototype,"marker",2),ye=n([h("qti-simple-choice")],ye);var or=b`
|
|
628
|
+
:host {
|
|
629
|
+
display: block;
|
|
630
|
+
--show-bounds: true;
|
|
631
|
+
--show-ticks: true;
|
|
632
|
+
--show-value: true;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
[part='slider'] {
|
|
636
|
+
margin-left: 2rem; /* mx-8 */
|
|
637
|
+
margin-right: 2rem;
|
|
638
|
+
padding-bottom: 1rem; /* pb-4 */
|
|
639
|
+
padding-top: 1.25rem; /* pt-5 */
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
[part='bounds'] {
|
|
643
|
+
display: flex;
|
|
644
|
+
width: 100%;
|
|
645
|
+
justify-content: space-between;
|
|
646
|
+
margin-bottom: 0.5rem; /* mb-2 */
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
[part='ticks'] {
|
|
650
|
+
margin-left: 0.125rem; /* mx-0.5 */
|
|
651
|
+
margin-right: 0.125rem;
|
|
652
|
+
margin-bottom: 0.25rem; /* mb-1 */
|
|
653
|
+
height: 0.5rem; /* h-2 */
|
|
654
|
+
background: linear-gradient(to right, var(--qti-border-color) var(--qti-border-thickness), transparent 1px) repeat-x
|
|
655
|
+
0 center / calc(calc(100% - var(--qti-border-thickness)) / ((var(--max) - var(--min)) / var(--step))) 100%;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
[part='rail'] {
|
|
659
|
+
display: flex;
|
|
660
|
+
align-items: center;
|
|
661
|
+
box-sizing: border-box;
|
|
662
|
+
height: 0.375rem; /* h-1.5 */
|
|
663
|
+
width: 100%;
|
|
664
|
+
cursor: pointer;
|
|
665
|
+
border-radius: 9999px; /* rounded-full */
|
|
666
|
+
border: 1px solid #d1d5db; /* border-gray-300 */
|
|
667
|
+
background-color: #e5e7eb; /* bg-gray-200 */
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
[part='knob'] {
|
|
671
|
+
background-color: var(--qti-bg-active);
|
|
672
|
+
border: 2px solid var(--qti-border-active);
|
|
673
|
+
position: relative;
|
|
674
|
+
height: 1rem; /* h-4 */
|
|
675
|
+
width: 1rem; /* w-4 */
|
|
676
|
+
transform-origin: center;
|
|
677
|
+
transform: translateX(-50%);
|
|
678
|
+
cursor: pointer;
|
|
679
|
+
border-radius: 9999px; /* rounded-full */
|
|
680
|
+
left: var(--value-percentage);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
[part='value'] {
|
|
684
|
+
position: absolute;
|
|
685
|
+
bottom: 2rem; /* bottom-8 */
|
|
686
|
+
left: 0.5rem; /* left-2 */
|
|
687
|
+
transform: translateX(-50%);
|
|
688
|
+
cursor: pointer;
|
|
689
|
+
border-radius: 0.25rem; /* rounded */
|
|
690
|
+
background-color: #f3f4f6; /* bg-gray-100 */
|
|
691
|
+
padding: 0.25rem 0.5rem; /* px-2 py-1 */
|
|
692
|
+
text-align: center;
|
|
693
|
+
color: #6b7280; /* text-gray-500 */
|
|
694
|
+
}
|
|
695
|
+
`;var N=class extends v{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 m`
|
|
696
|
+
<slot name="prompt"></slot>
|
|
697
|
+
<div id="slider" part="slider">
|
|
698
|
+
<div id="bounds" part="bounds">
|
|
699
|
+
<div>${this.min}</div>
|
|
700
|
+
<div>${this.max}</div>
|
|
701
|
+
</div>
|
|
702
|
+
|
|
703
|
+
<div id="ticks" part="ticks"></div>
|
|
704
|
+
|
|
705
|
+
<div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchStart}>
|
|
706
|
+
<div id="knob" part="knob"><div id="value" part="value">${this.value}</div></div>
|
|
707
|
+
</div>
|
|
708
|
+
</div>
|
|
709
|
+
`}_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}))}};N.formAssociated=!0,N.styles=or,n([Ue("#rail")],N.prototype,"_rail",2),n([u({type:Number,attribute:"lower-bound"})],N.prototype,"min",2),n([u({type:Number,attribute:"upper-bound"})],N.prototype,"max",2),n([u({type:Number,attribute:"step"})],N.prototype,"step",2),N=n([h("qti-slider-interaction")],N);var nr=()=>new mt,mt=class{},ut=new WeakMap,Ya=J(class extends zt{render(p){return D}update(p,[s]){let e=s!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=s,this.ht=p.options?.host,this.rt(this.ct=p.element)),D}rt(p){if(this.isConnected||(p=void 0),typeof this.Y=="function"){let s=this.ht??globalThis,e=ut.get(s);e===void 0&&(e=new WeakMap,ut.set(s,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,p),p!==void 0&&this.Y.call(this.ht,p)}else this.Y.value=p}get lt(){return typeof this.Y=="function"?ut.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ar=b`
|
|
710
|
+
:host {
|
|
711
|
+
display: inline-block;
|
|
712
|
+
}
|
|
713
|
+
[part='correct'] {
|
|
714
|
+
position: absolute;
|
|
715
|
+
width: 100%;
|
|
716
|
+
}
|
|
717
|
+
:host(.qti-input-width-1) [part='input'] {
|
|
718
|
+
width: 1.1rem;
|
|
719
|
+
min-width: 1.1rem;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
:host(.qti-input-width-2) [part='input'] {
|
|
723
|
+
width: 2.3rem;
|
|
724
|
+
min-width: 2.3rem;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
:host(.qti-input-width-3) [part='input'] {
|
|
728
|
+
width: 3.3rem;
|
|
729
|
+
min-width: 3.3rem;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
:host(.qti-input-width-4) [part='input'] {
|
|
733
|
+
width: 4.2rem;
|
|
734
|
+
min-width: 4.2rem;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
:host(.qti-input-width-6) [part='input'] {
|
|
738
|
+
width: 6.6rem;
|
|
739
|
+
min-width: 6.6rem;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
:host(.qti-input-width-10) [part='input'] {
|
|
743
|
+
width: 8rem;
|
|
744
|
+
min-width: 8rem;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
:host(.qti-input-width-15) [part='input'] {
|
|
748
|
+
width: 12rem;
|
|
749
|
+
min-width: 12rem;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
:host(.qti-input-width-20) [part='input'] {
|
|
753
|
+
width: 17rem;
|
|
754
|
+
min-width: 17rem;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
:host(.qti-input-width-25) [part='input'] {
|
|
758
|
+
width: 20rem;
|
|
759
|
+
min-width: 20rem;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
:host(.qti-input-width-30) [part='input'] {
|
|
763
|
+
width: 24rem;
|
|
764
|
+
min-width: 24rem;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
:host(.qti-input-width-35) [part='input'] {
|
|
768
|
+
width: 28rem;
|
|
769
|
+
min-width: 28rem;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
:host(.qti-input-width-40) [part='input'] {
|
|
773
|
+
width: 32rem;
|
|
774
|
+
min-width: 32rem;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
:host(.qti-input-width-45) [part='input'] {
|
|
778
|
+
width: 36rem;
|
|
779
|
+
min-width: 36rem;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
:host(.qti-input-width-50) [part='input'] {
|
|
783
|
+
width: 40rem;
|
|
784
|
+
min-width: 40rem;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
:host(.qti-input-width-72) [part='input'] {
|
|
788
|
+
width: 57rem;
|
|
789
|
+
min-width: 57rem;
|
|
790
|
+
}
|
|
791
|
+
`;var O=class extends C{constructor(){super(...arguments);this._value="";this.inputRef=nr()}get value(){return this._value||null}set value(e){if(typeof e=="string"||e===null){this._value=e||"";let t=new FormData;t.append(this.responseIdentifier,this._value),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 m`
|
|
792
|
+
<input
|
|
793
|
+
part="input"
|
|
794
|
+
name="${this.responseIdentifier}"
|
|
795
|
+
spellcheck="false"
|
|
796
|
+
autocomplete="off"
|
|
797
|
+
@blur="${e=>{this.reportValidity()}}"
|
|
798
|
+
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
799
|
+
@keyup="${this.textChanged}"
|
|
800
|
+
@change="${this.textChanged}"
|
|
801
|
+
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
802
|
+
placeholder="${Q(this.placeholderText?this.placeholderText:void 0)}"
|
|
803
|
+
.value="${this._value}"
|
|
804
|
+
pattern="${Q(this.patternMask?this.patternMask:void 0)}"
|
|
805
|
+
maxlength=${1e3}
|
|
806
|
+
?disabled="${this.disabled}"
|
|
807
|
+
?readonly="${this.readonly}"
|
|
808
|
+
/>
|
|
809
|
+
<div part="correct">${this._correctResponse}</div>
|
|
810
|
+
`}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")}};O.styles=ar,n([u({type:Number,attribute:"expected-length"})],O.prototype,"expectedLength",2),n([u({type:String,attribute:"pattern-mask"})],O.prototype,"patternMask",2),n([u({type:String,attribute:"placeholder-text"})],O.prototype,"placeholderText",2),n([u({type:String,attribute:"data-patternmask-message"})],O.prototype,"dataPatternmaskMessage",2),n([E()],O.prototype,"_value",2),O=n([h("qti-text-entry-interaction")],O);var Oe=class extends C{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{...C.properties}}render(){return m`
|
|
811
|
+
<div>
|
|
812
|
+
<slot name="prompt"></slot>
|
|
813
|
+
<input type="file" @change="${this._onFileChange}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
814
|
+
</div>
|
|
815
|
+
`}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)})}};Oe.styles=[b`
|
|
816
|
+
:host {
|
|
817
|
+
display: block;
|
|
818
|
+
margin: 1em 0;
|
|
819
|
+
}
|
|
820
|
+
input[type='file'] {
|
|
821
|
+
display: block;
|
|
822
|
+
margin-top: 0.5em;
|
|
823
|
+
}
|
|
824
|
+
`],Oe=n([h("qti-upload-interaction")],Oe);var lr=b`
|
|
825
|
+
:host {
|
|
826
|
+
display: block;
|
|
827
|
+
}
|
|
828
|
+
`;var Ie=class extends v{render(){return m`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ie.styles=lr,Ie=n([h("qti-item-body")],Ie);var Pe=class extends v{render(){return m`<slot></slot>`}process(){let s=new ht,e=[...this.children];s.process(e)}};Pe.styles=[b`
|
|
829
|
+
:host {
|
|
830
|
+
display: none;
|
|
831
|
+
}
|
|
832
|
+
`],Pe=n([h("qti-outcome-processing")],Pe);var ht=class{process(s){for(let e of s)e.process()}};var Qe=class extends v{render(){return m`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Qe=n([h("qti-prompt")],Qe);var cr=`<qti-response-processing>
|
|
833
|
+
<qti-response-condition>
|
|
834
|
+
<qti-response-if>
|
|
835
|
+
<qti-match>
|
|
836
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
837
|
+
<qti-correct identifier="RESPONSE"></qti-correct>
|
|
838
|
+
</qti-match>
|
|
839
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
840
|
+
<qti-base-value base-type="float">1</qti-base-value>
|
|
841
|
+
</qti-set-outcome-value>
|
|
842
|
+
</qti-response-if>
|
|
843
|
+
<qti-response-else>
|
|
844
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
845
|
+
<qti-base-value base-type="float">0</qti-base-value>
|
|
846
|
+
</qti-set-outcome-value>
|
|
847
|
+
</qti-response-else>
|
|
848
|
+
</qti-response-condition>
|
|
849
|
+
</qti-response-processing>`,pr=`<qti-response-processing>
|
|
850
|
+
<qti-response-condition>
|
|
851
|
+
<qti-response-if>
|
|
852
|
+
<qti-is-null>
|
|
853
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
854
|
+
</qti-is-null>
|
|
855
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
856
|
+
<qti-base-value base-type="float">0.0</qti-base-value>
|
|
857
|
+
</qti-set-outcome-value>
|
|
858
|
+
</qti-response-if>
|
|
859
|
+
<qti-response-else>
|
|
860
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
861
|
+
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
862
|
+
</qti-set-outcome-value>
|
|
863
|
+
</qti-response-else>
|
|
864
|
+
</qti-response-condition>
|
|
865
|
+
</qti-response-processing>`,dr=`<qti-response-processing>
|
|
866
|
+
<qti-response-condition>
|
|
867
|
+
<qti-response-if>
|
|
868
|
+
<qti-is-null>
|
|
869
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
870
|
+
</qti-is-null>
|
|
871
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
872
|
+
<qti-base-value base-type="float">0</qti-base-value>
|
|
873
|
+
</qti-set-outcome-value>
|
|
874
|
+
</qti-response-if>
|
|
875
|
+
<qti-response-else>
|
|
876
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
877
|
+
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
878
|
+
</qti-set-outcome-value>
|
|
879
|
+
</qti-response-else>
|
|
880
|
+
</qti-response-condition>
|
|
881
|
+
</qti-response-processing>`;var Fe=class extends v{render(){return m`<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(pr).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(dr).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(cr).firstElementChild.firstElementChild);break}}}fragmentFromString(s){return document.createRange().createContextualFragment(s)}};Fe.styles=[b`
|
|
882
|
+
:host {
|
|
883
|
+
display: none;
|
|
884
|
+
}
|
|
885
|
+
`],Fe=n([h("qti-response-processing")],Fe);var I=class extends v{render(){return m`<slot></slot>`}process(){throw new Error("Not implemented")}};I=n([h("qti-rule")],I);var et=class extends I{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:qe(t)}})),t)}};n([u({type:String})],et.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",et);var ft=class extends I{render(){return m`<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",ft);var gt=class extends I{process(){let s=this.getAttribute("identifier"),e=this.firstElementChild,r=new bt(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:Array.isArray(r)?r.map(i=>qe(i)):qe(r)}}))}},bt=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",gt);var ze=class extends v{render(){return m`<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",ze);var Be=class extends ze{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",Be);var vt=class extends Be{render(){return m`${super.render()}`}};customElements.define("qti-response-else-if",vt);var ur=class extends gr(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function gr(p){return class extends p{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(),o=!1;if(typeof l=="string")if(l==="true")o=!0;else if(l==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof l=="boolean"&&(o=l);return o}).every(r=>typeof r=="boolean"&&r)}}}var tt=class extends q{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};n([u({type:String,attribute:"base-type"})],tt.prototype,"baseType",2);customElements.define("qti-base-value",tt);var yt=class extends V{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(a=>i.includes(a)).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",yt);var xt=class extends q{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",xt);var rt=class extends q{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}};n([u({type:String})],rt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",rt);var S=class{static isPointInArea(s,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[r,i]=s.split(" ").map(Number),[l,...o]=e.split(","),a=o.map(Number);switch(l.toLowerCase()){case"circle":case"default":{let[c,d,f]=a;return a.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((r-c)**2+(i-d)**2)<=f}case"rect":{let[c,d,f,g]=a;return a.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):r>=c&&r<=f&&i>=d&&i<=g}case"ellipse":{let[c,d,f,g]=a;if(a.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let y=(r-c)**2/f**2,T=(i-d)**2/g**2;return y+T<=1}case"poly":{if(a.length<6||a.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<a.length;d+=2)c.push({x:a[d],y:a[d+1]});return this.isPointInPolygon({x:r,y:i},c)}default:return console.warn(`Unsupported shape type: ${l}`),!1}}static isPointInPolygon(s,e){let t=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let l=e[r].x,o=e[r].y,a=e[i].x,c=e[i].y;o>s.y!=c>s.y&&s.x<(a-l)*(s.y-o)/(c-o)+l&&(t=!t)}return t}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 it=class extends q{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):S.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};n([u({type:String})],it.prototype,"toleranceMode",2);customElements.define("qti-equal",it);var Et=class extends q{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",Et);var Ct=class extends V{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",Ct);var qt=class extends q{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",qt);var Tt=class extends q{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",Tt);var wt=class extends V{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);var st=class extends q{getResult(){let s=this.context.variables.find(i=>i.identifier===this.identifier);if(!s||!s.mapping)return console.error(`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 o=e.mapEntries.filter(a=>s.baseType==="string"&&!a.caseSensitive?S.compareSingleValues(a.mapKey.toLowerCase(),i.toLowerCase(),s.baseType):S.compareSingleValues(a.mapKey,i,s.baseType)).reduce((a,c)=>a.mappedValue>c.mappedValue?a:c,{mapKey:null,mappedValue:null});o==null||o.mappedValue==null?r+=e.defaultValue:r+=o.mappedValue}return e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};n([u({type:String})],st.prototype,"identifier",2);customElements.define("qti-map-response",st);var ne=class extends v{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 m`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
886
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};ne.styles=b`
|
|
887
|
+
slot {
|
|
888
|
+
display: none;
|
|
889
|
+
}
|
|
890
|
+
`,n([E()],ne.prototype,"result",2),n([_({context:M,subscribe:!0}),E()],ne.prototype,"context",2);var ot=class extends ne{getResult(){let s=this.context.variables.find(l=>l.identifier===this.identifier);if(!s)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=s.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(s.value)?s.value:[s.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,i=new Set;for(let l of t)for(let o of e.mapEntries){if(i.has(o.coords))continue;S.isPointInArea(l,`${o.shape},${o.coords}`,s.baseType)&&(r+=o.mappedValue??0,i.add(o.coords))}return i.size<t.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};n([u({type:String})],ot.prototype,"identifier",2);customElements.define("qti-map-response-point",ot);var xe=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>{let t=e.hasAttribute("case-sensitive")?e.getAttribute("case-sensitive")!=="false":!0;return{mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value"),caseSensitive:t}})}};n([u({attribute:"default-value",type:Number})],xe.prototype,"defaultValue",2),n([u({attribute:"lower-bound",type:Number})],xe.prototype,"lowerBound",2),n([u({attribute:"upper-bound",type:Number})],xe.prototype,"upperBound",2);customElements.define("qti-mapping",xe);var Ee=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-area-map-entry")).map(e=>({shape:e.getAttribute("shape"),coords:e.getAttribute("coords"),mappedValue:+e.getAttribute("mapped-value"),defaultValue:e.getAttribute("default-value")?+e.getAttribute("default-value"):0}))}};n([u({attribute:"default-value",type:Number})],Ee.prototype,"defaultValue",2),n([u({attribute:"lower-bound",type:Number})],Ee.prototype,"lowerBound",2),n([u({attribute:"upper-bound",type:Number})],Ee.prototype,"upperBound",2);customElements.define("qti-area-mapping",Ee);var Mt=class p extends q{getResult(){if(this.children.length===2){let s=this.getVariables(),e=s[0],t=s[1];return p.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):S.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(!S.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 o of l)if(S.compareSingleValues(r,o,e.baseType)){i=o;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",Mt);var St=class extends q{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",St);var _t=class extends q{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",_t);var Rt=class extends q{render(){return m`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Rt);var kt=class extends V{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",kt);var Lt=class extends q{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",Lt);var Ye=class extends v{render(){let s=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return m`${JSON.stringify(s,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};n([u({type:String})],Ye.prototype,"identifier",2),n([_({context:M,subscribe:!0}),E()],Ye.prototype,"context",2);customElements.define("qti-printed-variable",Ye);var At=class extends q{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",At);var nt=class extends br(q){getResult(){return this.calculateChildren(Array.from(this.children))}};function br(p){return class extends p{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",nt);var at=class extends q{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 S.compareSingleValues(i,l,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};n([u({type:String,attribute:"case-sensitive"})],at.prototype,"caseSensitive",2);customElements.define("qti-string-match",at);var Dt=class extends q{constructor(){super(),this._expression=new Vt(Array.from(this.children))}getResult(){return this._expression.calculate()}},Vt=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",Dt);var Ht=class extends q{getResult(){let s=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===s).value}};customElements.define("qti-variable",Ht);var lt=class extends v{render(){return m`<slot></slot>`}};lt=n([h("qti-content-body")],lt);var P=class extends v{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 m`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};P.styles=b`
|
|
891
|
+
:host {
|
|
892
|
+
display: block;
|
|
893
|
+
}
|
|
894
|
+
`,n([u({type:String})],P.prototype,"id",2),n([u({type:String})],P.prototype,"use",2),n([u({type:String})],P.prototype,"view",2),n([u({type:String,attribute:"class"})],P.prototype,"classNames",2),n([R("classNames",{waitUntilFirstUpdate:!0})],P.prototype,"handleclassNamesChange",1),P=n([h("qti-rubric-block")],P);var ct=class extends v{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()}};ct=n([h("qti-stylesheet")],ct);var oe=class extends v{render(){return m`<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]}};oe=n([h("qti-variabledeclaration")],oe);var F=class extends oe{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return m`${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}}))}};F.styles=[b`
|
|
895
|
+
:host {
|
|
896
|
+
display: none;
|
|
897
|
+
}
|
|
898
|
+
`],n([u({type:String,attribute:"base-type"})],F.prototype,"baseType",2),n([u({type:String,attribute:"external-scored"})],F.prototype,"externalScored",2),n([u({type:String})],F.prototype,"identifier",2),n([u({type:String})],F.prototype,"cardinality",2),n([_({context:M,subscribe:!0}),E()],F.prototype,"itemContext",2),F=n([h("qti-outcome-declaration")],F);var j=class extends oe{render(){let s=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return m`${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,areaMapping:this.areaMapping,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.trim(),t[0].remove();else if(this.cardinality!=="single"){s=[];for(let r=0;r<t.length;r++)s.push(t[r].textContent.trim()),t[r].remove()}}return s}get mapping(){return this.querySelector("qti-mapping")}get areaMapping(){return this.querySelector("qti-area-mapping")}};j.styles=[b`
|
|
899
|
+
:host {
|
|
900
|
+
display: none;
|
|
901
|
+
}
|
|
902
|
+
`],n([u({type:String,attribute:"base-type"})],j.prototype,"baseType",2),n([u({type:String})],j.prototype,"identifier",2),n([u({type:String})],j.prototype,"cardinality",2),n([_({context:M,subscribe:!0}),E()],j.prototype,"itemContext",2),j=n([h("qti-response-declaration")],j);export{k as a,de as b,We as c,Ce as d,we as e,Me as f,Se as g,_e as h,ue as i,me as j,z as k,G as l,A as m,he as n,Re as o,fe as p,ge as q,B as r,ke as s,Le as t,ve as u,Ae as v,Ze as w,De as x,te as y,He as z,re as A,Y as B,$e as C,U as D,ie as E,Ge as F,Ne as G,se as H,ye as I,N as J,O as K,Oe as L,Ie as M,Pe as N,ht as O,Qe as P,Fe as Q,I as R,et as S,ft as T,gt as U,bt as V,ze as W,Be as X,vt as Y,ur as Z,gr as _,tt as $,yt as aa,xt as ba,rt as ca,it as da,Et as ea,Ct as fa,qt as ga,Tt as ha,wt as ia,st as ja,ot as ka,xe as la,Ee as ma,Mt as na,St as oa,_t as pa,Rt as qa,kt as ra,Lt as sa,Ye as ta,At as ua,nt as va,br as wa,at as xa,Dt as ya,Vt as za,Ht as Aa,lt as Ba,P as Ca,ct as Da,F as Ea,j as Fa};
|
|
903
|
+
/*! Bundled license information:
|
|
904
|
+
|
|
905
|
+
lit-html/node/directives/if-defined.js:
|
|
906
|
+
(**
|
|
907
|
+
* @license
|
|
908
|
+
* Copyright 2018 Google LLC
|
|
909
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
910
|
+
*)
|
|
911
|
+
|
|
912
|
+
lit-html/node/directives/repeat.js:
|
|
913
|
+
(**
|
|
914
|
+
* @license
|
|
915
|
+
* Copyright 2017 Google LLC
|
|
916
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
917
|
+
*)
|
|
918
|
+
|
|
919
|
+
lit-html/node/directives/unsafe-html.js:
|
|
920
|
+
(**
|
|
921
|
+
* @license
|
|
922
|
+
* Copyright 2017 Google LLC
|
|
923
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
924
|
+
*)
|
|
925
|
+
|
|
926
|
+
lit-html/node/directives/style-map.js:
|
|
927
|
+
(**
|
|
928
|
+
* @license
|
|
929
|
+
* Copyright 2018 Google LLC
|
|
930
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
931
|
+
*)
|
|
932
|
+
|
|
933
|
+
lit-html/node/directives/ref.js:
|
|
934
|
+
(**
|
|
935
|
+
* @license
|
|
936
|
+
* Copyright 2020 Google LLC
|
|
937
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
938
|
+
*)
|
|
939
|
+
*/
|