@pie-qti/item-player 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (547) hide show
  1. package/README.md +22 -19
  2. package/dist/catalog/applyGlossaryTriggers.d.ts +15 -0
  3. package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -0
  4. package/dist/catalog/applyGlossaryTriggers.js +193 -0
  5. package/dist/catalog/catalogExtractor.d.ts +18 -0
  6. package/dist/catalog/catalogExtractor.d.ts.map +1 -0
  7. package/dist/catalog/catalogExtractor.js +114 -0
  8. package/dist/catalog/catalogLookup.d.ts +18 -0
  9. package/dist/catalog/catalogLookup.d.ts.map +1 -0
  10. package/dist/catalog/catalogLookup.js +44 -0
  11. package/dist/catalog/glossaryAction.d.ts +17 -0
  12. package/dist/catalog/glossaryAction.d.ts.map +1 -0
  13. package/dist/catalog/glossaryAction.js +21 -0
  14. package/dist/catalog/types.d.ts +26 -0
  15. package/dist/catalog/types.d.ts.map +1 -0
  16. package/dist/catalog/types.js +6 -0
  17. package/dist/components/actions/typesetAction.d.ts +24 -0
  18. package/dist/components/actions/typesetAction.d.ts.map +1 -0
  19. package/dist/components/actions/typesetAction.js +59 -0
  20. package/dist/components/utils/assignProps.d.ts +2 -0
  21. package/dist/components/utils/assignProps.d.ts.map +1 -0
  22. package/dist/components/utils/assignProps.js +1 -0
  23. package/dist/components/utils/feedbackUtils.d.ts +73 -0
  24. package/dist/components/utils/feedbackUtils.d.ts.map +1 -0
  25. package/dist/components/utils/feedbackUtils.js +93 -0
  26. package/dist/components/utils/index.d.ts +6 -0
  27. package/dist/components/utils/index.d.ts.map +1 -0
  28. package/dist/components/utils/index.js +5 -0
  29. package/dist/core/ComponentRegistry.d.ts +128 -0
  30. package/dist/core/ComponentRegistry.d.ts.map +1 -0
  31. package/dist/core/ComponentRegistry.js +137 -0
  32. package/dist/core/ItemRenderer.d.ts +91 -0
  33. package/dist/core/ItemRenderer.d.ts.map +1 -0
  34. package/dist/core/ItemRenderer.js +261 -0
  35. package/dist/core/Player.d.ts +195 -0
  36. package/dist/core/Player.d.ts.map +1 -0
  37. package/dist/core/Player.js +1235 -0
  38. package/dist/core/Plugin.d.ts +105 -0
  39. package/dist/core/Plugin.d.ts.map +1 -0
  40. package/dist/core/Plugin.js +7 -0
  41. package/dist/core/PluginManager.d.ts +56 -0
  42. package/dist/core/PluginManager.d.ts.map +1 -0
  43. package/dist/core/PluginManager.js +147 -0
  44. package/dist/core/constants.d.ts +68 -0
  45. package/dist/core/constants.d.ts.map +1 -0
  46. package/dist/core/constants.js +106 -0
  47. package/dist/core/declarations.d.ts +45 -0
  48. package/dist/core/declarations.d.ts.map +1 -0
  49. package/dist/core/declarations.js +133 -0
  50. package/dist/core/parsingLimits.d.ts +12 -0
  51. package/dist/core/parsingLimits.d.ts.map +1 -0
  52. package/dist/core/parsingLimits.js +45 -0
  53. package/dist/core/random.d.ts +12 -0
  54. package/dist/core/random.d.ts.map +1 -0
  55. package/dist/core/random.js +21 -0
  56. package/dist/core/rolePolicy.d.ts +16 -0
  57. package/dist/core/rolePolicy.d.ts.map +1 -0
  58. package/dist/core/rolePolicy.js +15 -0
  59. package/dist/core/sanitizer.d.ts +34 -0
  60. package/dist/core/sanitizer.d.ts.map +1 -0
  61. package/dist/core/sanitizer.js +198 -0
  62. package/dist/core/trustedTypes.d.ts +16 -0
  63. package/dist/core/trustedTypes.d.ts.map +1 -0
  64. package/dist/core/trustedTypes.js +55 -0
  65. package/dist/core/urlPolicy.d.ts +8 -0
  66. package/dist/core/urlPolicy.d.ts.map +1 -0
  67. package/dist/core/urlPolicy.js +90 -0
  68. package/dist/element.d.ts +22 -0
  69. package/dist/element.js +5327 -0
  70. package/dist/element.js.map +1 -0
  71. package/dist/extensions/MathLiveEditor.d.ts +32 -0
  72. package/dist/extensions/MathLiveEditor.d.ts.map +1 -0
  73. package/dist/extensions/MathLiveEditor.js +249 -0
  74. package/dist/extraction/ExtractionRegistry.d.ts +112 -0
  75. package/dist/extraction/ExtractionRegistry.d.ts.map +1 -0
  76. package/dist/extraction/ExtractionRegistry.js +260 -0
  77. package/dist/extraction/createContext.d.ts +30 -0
  78. package/dist/extraction/createContext.d.ts.map +1 -0
  79. package/dist/extraction/createContext.js +39 -0
  80. package/dist/extraction/extractors/associateExtractor.d.ts +29 -0
  81. package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -0
  82. package/dist/extraction/extractors/associateExtractor.js +97 -0
  83. package/dist/extraction/extractors/choiceExtractor.d.ts +27 -0
  84. package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -0
  85. package/dist/extraction/extractors/choiceExtractor.js +93 -0
  86. package/dist/extraction/extractors/customExtractor.d.ts +20 -0
  87. package/dist/extraction/extractors/customExtractor.d.ts.map +1 -0
  88. package/dist/extraction/extractors/customExtractor.js +51 -0
  89. package/dist/extraction/extractors/drawingExtractor.d.ts +30 -0
  90. package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -0
  91. package/dist/extraction/extractors/drawingExtractor.js +78 -0
  92. package/dist/extraction/extractors/endAttemptExtractor.d.ts +20 -0
  93. package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -0
  94. package/dist/extraction/extractors/endAttemptExtractor.js +53 -0
  95. package/dist/extraction/extractors/extendedTextExtractor.d.ts +21 -0
  96. package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -0
  97. package/dist/extraction/extractors/extendedTextExtractor.js +63 -0
  98. package/dist/extraction/extractors/gapMatchExtractor.d.ts +29 -0
  99. package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -0
  100. package/dist/extraction/extractors/gapMatchExtractor.js +155 -0
  101. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +41 -0
  102. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -0
  103. package/dist/extraction/extractors/graphicAssociateExtractor.js +143 -0
  104. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +53 -0
  105. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -0
  106. package/dist/extraction/extractors/graphicGapMatchExtractor.js +205 -0
  107. package/dist/extraction/extractors/graphicOrderExtractor.d.ts +37 -0
  108. package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -0
  109. package/dist/extraction/extractors/graphicOrderExtractor.js +121 -0
  110. package/dist/extraction/extractors/hotspotExtractor.d.ts +38 -0
  111. package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -0
  112. package/dist/extraction/extractors/hotspotExtractor.js +159 -0
  113. package/dist/extraction/extractors/hottextExtractor.d.ts +26 -0
  114. package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -0
  115. package/dist/extraction/extractors/hottextExtractor.js +128 -0
  116. package/dist/extraction/extractors/index.d.ts +63 -0
  117. package/dist/extraction/extractors/index.d.ts.map +1 -0
  118. package/dist/extraction/extractors/index.js +88 -0
  119. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +25 -0
  120. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -0
  121. package/dist/extraction/extractors/inlineChoiceExtractor.js +80 -0
  122. package/dist/extraction/extractors/matchExtractor.d.ts +37 -0
  123. package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -0
  124. package/dist/extraction/extractors/matchExtractor.js +160 -0
  125. package/dist/extraction/extractors/mediaExtractor.d.ts +33 -0
  126. package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -0
  127. package/dist/extraction/extractors/mediaExtractor.js +125 -0
  128. package/dist/extraction/extractors/orderExtractor.d.ts +28 -0
  129. package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -0
  130. package/dist/extraction/extractors/orderExtractor.js +90 -0
  131. package/dist/extraction/extractors/portableCustomExtractor.d.ts +14 -0
  132. package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -0
  133. package/dist/extraction/extractors/portableCustomExtractor.js +96 -0
  134. package/dist/extraction/extractors/positionObjectExtractor.d.ts +59 -0
  135. package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -0
  136. package/dist/extraction/extractors/positionObjectExtractor.js +191 -0
  137. package/dist/extraction/extractors/selectPointExtractor.d.ts +31 -0
  138. package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -0
  139. package/dist/extraction/extractors/selectPointExtractor.js +109 -0
  140. package/dist/extraction/extractors/sliderExtractor.d.ts +24 -0
  141. package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -0
  142. package/dist/extraction/extractors/sliderExtractor.js +73 -0
  143. package/dist/extraction/extractors/textEntryExtractor.d.ts +21 -0
  144. package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -0
  145. package/dist/extraction/extractors/textEntryExtractor.js +54 -0
  146. package/dist/extraction/extractors/uploadExtractor.d.ts +20 -0
  147. package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -0
  148. package/dist/extraction/extractors/uploadExtractor.js +59 -0
  149. package/dist/extraction/index.d.ts +49 -0
  150. package/dist/extraction/index.d.ts.map +1 -0
  151. package/dist/extraction/index.js +49 -0
  152. package/dist/extraction/types.d.ts +209 -0
  153. package/dist/extraction/types.d.ts.map +1 -0
  154. package/dist/extraction/types.js +30 -0
  155. package/dist/extraction/utils.d.ts +15 -0
  156. package/dist/extraction/utils.d.ts.map +1 -0
  157. package/dist/extraction/utils.js +178 -0
  158. package/dist/iframe/IFramePlayerHost.d.ts +122 -0
  159. package/dist/iframe/IFramePlayerHost.d.ts.map +1 -0
  160. package/dist/iframe/IFramePlayerHost.js +172 -0
  161. package/dist/iframe/index.d.ts +9 -0
  162. package/dist/iframe/index.d.ts.map +1 -0
  163. package/dist/iframe/index.js +8 -0
  164. package/dist/iframe/protocol.d.ts +75 -0
  165. package/dist/iframe/protocol.d.ts.map +1 -0
  166. package/dist/iframe/protocol.js +53 -0
  167. package/dist/index.d.ts +38 -0
  168. package/dist/index.d.ts.map +1 -0
  169. package/dist/index.js +42 -0
  170. package/dist/pci/PciHost.d.ts +53 -0
  171. package/dist/pci/PciHost.d.ts.map +1 -0
  172. package/dist/pci/PciHost.js +116 -0
  173. package/dist/pci/types.d.ts +57 -0
  174. package/dist/pci/types.d.ts.map +1 -0
  175. package/dist/pci/types.js +19 -0
  176. package/dist/pnp/applyPnp.d.ts +9 -0
  177. package/dist/pnp/applyPnp.d.ts.map +1 -0
  178. package/dist/pnp/applyPnp.js +19 -0
  179. package/dist/pnp/parsePnpXml.d.ts +9 -0
  180. package/dist/pnp/parsePnpXml.d.ts.map +1 -0
  181. package/dist/pnp/parsePnpXml.js +101 -0
  182. package/dist/pnp/types.d.ts +40 -0
  183. package/dist/pnp/types.d.ts.map +1 -0
  184. package/dist/pnp/types.js +1 -0
  185. package/dist/server.d.ts +10 -0
  186. package/dist/server.d.ts.map +1 -0
  187. package/dist/server.js +10 -0
  188. package/dist/types/index.d.ts +304 -0
  189. package/dist/types/index.d.ts.map +1 -0
  190. package/dist/types/index.js +7 -0
  191. package/dist/types/interactions.d.ts +412 -0
  192. package/dist/types/interactions.d.ts.map +1 -0
  193. package/dist/types/interactions.js +7 -0
  194. package/dist/types/responseValidation.d.ts +25 -0
  195. package/dist/types/responseValidation.d.ts.map +1 -0
  196. package/dist/types/responseValidation.js +1 -0
  197. package/dist/utils/PerformanceMonitor.d.ts +170 -0
  198. package/dist/utils/PerformanceMonitor.d.ts.map +1 -0
  199. package/dist/utils/PerformanceMonitor.js +242 -0
  200. package/dist/utils/drawingUtils.d.ts +39 -0
  201. package/dist/utils/drawingUtils.d.ts.map +1 -0
  202. package/dist/utils/drawingUtils.js +57 -0
  203. package/dist/utils/responseUtils.d.ts +16 -0
  204. package/dist/utils/responseUtils.d.ts.map +1 -0
  205. package/dist/utils/responseUtils.js +45 -0
  206. package/dist/utils/touchDragHelper.d.ts +2 -0
  207. package/dist/utils/touchDragHelper.d.ts.map +1 -0
  208. package/dist/utils/touchDragHelper.js +1 -0
  209. package/dist/web-components/QTIInteractionBase.d.ts +120 -0
  210. package/dist/web-components/QTIInteractionBase.d.ts.map +1 -0
  211. package/dist/web-components/QTIInteractionBase.js +243 -0
  212. package/dist/web-components/QTIInteractionElement.d.ts +77 -0
  213. package/dist/web-components/QTIInteractionElement.d.ts.map +1 -0
  214. package/dist/web-components/QTIInteractionElement.js +61 -0
  215. package/dist/web-components/index.d.ts +8 -0
  216. package/dist/web-components/index.d.ts.map +1 -0
  217. package/dist/web-components/index.js +10 -0
  218. package/package.json +104 -76
  219. package/src/__tests__/catalog.test.ts +267 -0
  220. package/src/__tests__/fixtures/pci/echo-pci.js +49 -0
  221. package/src/__tests__/glossaryTriggers.test.ts +411 -0
  222. package/src/__tests__/pci.test.ts +353 -0
  223. package/src/__tests__/pnp.test.ts +250 -0
  224. package/src/__tests__/qti3-attribute-extraction.test.ts +174 -0
  225. package/src/__tests__/qti3-debug.test.ts +140 -0
  226. package/src/__tests__/qti3-extraction.test.ts +309 -0
  227. package/src/catalog/applyGlossaryTriggers.ts +232 -0
  228. package/src/catalog/catalogExtractor.ts +130 -0
  229. package/src/catalog/catalogLookup.ts +53 -0
  230. package/src/catalog/glossaryAction.ts +28 -0
  231. package/src/catalog/types.ts +37 -0
  232. package/src/components/ItemBody.svelte +136 -26
  233. package/src/components/ItemPlayer.svelte +6 -2
  234. package/src/components/index.ts +3 -0
  235. package/src/components/utils/assignProps.ts +1 -23
  236. package/src/core/ComponentRegistry.ts +14 -0
  237. package/src/core/ItemRenderer.ts +4 -0
  238. package/src/core/Player.ts +312 -38
  239. package/src/core/parsingLimits.ts +1 -1
  240. package/src/core/rolePolicy.ts +34 -0
  241. package/src/core/urlPolicy.ts +5 -2
  242. package/src/element.ts +128 -0
  243. package/src/extensions/MathLiveEditor.ts +6 -3
  244. package/src/extraction/ExtractionRegistry.ts +51 -11
  245. package/src/extraction/createContext.ts +6 -1
  246. package/src/extraction/extractors/associateExtractor.ts +4 -0
  247. package/src/extraction/extractors/choiceExtractor.ts +12 -1
  248. package/src/extraction/extractors/conformance-qti3-advanced.test.ts +239 -0
  249. package/src/extraction/extractors/conformance-qti3-basic.test.ts +82 -0
  250. package/src/extraction/extractors/conformance.test.ts +208 -0
  251. package/src/extraction/extractors/extendedTextExtractor.ts +11 -2
  252. package/src/extraction/extractors/gapMatchExtractor.ts +36 -21
  253. package/src/extraction/extractors/graphicAssociateExtractor.ts +4 -0
  254. package/src/extraction/extractors/graphicGapMatchExtractor.ts +82 -10
  255. package/src/extraction/extractors/hotspotExtractor.ts +26 -8
  256. package/src/extraction/extractors/hottextExtractor.ts +15 -5
  257. package/src/extraction/extractors/index.ts +4 -0
  258. package/src/extraction/extractors/inlineChoiceExtractor.ts +22 -5
  259. package/src/extraction/extractors/matchExtractor.ts +33 -6
  260. package/src/extraction/extractors/orderExtractor.ts +6 -0
  261. package/src/extraction/extractors/portableCustomExtractor.ts +122 -0
  262. package/src/extraction/extractors/selectPointExtractor.ts +5 -5
  263. package/src/extraction/extractors/textEntryExtractor.ts +11 -2
  264. package/src/extraction/extractors/uploadExtractor.ts +10 -2
  265. package/src/extraction/utils.ts +99 -16
  266. package/src/index.ts +19 -1
  267. package/src/pci/PciHost.ts +138 -0
  268. package/src/pci/types.ts +70 -0
  269. package/src/pnp/applyPnp.ts +23 -0
  270. package/src/pnp/parsePnpXml.ts +118 -0
  271. package/src/pnp/types.ts +33 -0
  272. package/src/types/index.ts +50 -16
  273. package/src/types/interactions.ts +81 -6
  274. package/src/types/xmldom.d.ts +12 -0
  275. package/src/utils/drawingUtils.ts +73 -0
  276. package/src/utils/touchDragHelper.ts +1 -211
  277. package/.turbo/turbo-build.log +0 -1
  278. package/CHANGELOG.md +0 -9
  279. package/docs/QTI-COMPLIANCE.md +0 -197
  280. package/docs/WCAG-2.2-COMPLIANCE.md +0 -466
  281. package/docs/custom-extractors.md +0 -679
  282. package/docs/iframe-mode.md +0 -78
  283. package/docs/security-audit.md +0 -236
  284. package/docs/server-api.md +0 -691
  285. package/tests/conformance/FIXTURE_POLICY.md +0 -29
  286. package/tests/conformance/README.md +0 -70
  287. package/tests/conformance/fixtures/baseTypes_all/cases.json +0 -61
  288. package/tests/conformance/fixtures/baseTypes_all/item.xml +0 -131
  289. package/tests/conformance/fixtures/baseTypes_all/manifest.json +0 -7
  290. package/tests/conformance/fixtures/choice_match_correct/cases.json +0 -17
  291. package/tests/conformance/fixtures/choice_match_correct/item.xml +0 -55
  292. package/tests/conformance/fixtures/choice_match_correct/manifest.json +0 -14
  293. package/tests/conformance/fixtures/contains_multiple/cases.json +0 -12
  294. package/tests/conformance/fixtures/contains_multiple/item.xml +0 -37
  295. package/tests/conformance/fixtures/contains_multiple/manifest.json +0 -13
  296. package/tests/conformance/fixtures/isNull_isNotNull/cases.json +0 -9
  297. package/tests/conformance/fixtures/isNull_isNotNull/item.xml +0 -41
  298. package/tests/conformance/fixtures/isNull_isNotNull/manifest.json +0 -23
  299. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/cases.json +0 -27
  300. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/item.xml +0 -30
  301. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/manifest.json +0 -15
  302. package/tests/conformance/fixtures/mapResponse_integer_mapKey/cases.json +0 -11
  303. package/tests/conformance/fixtures/mapResponse_integer_mapKey/item.xml +0 -26
  304. package/tests/conformance/fixtures/mapResponse_integer_mapKey/manifest.json +0 -13
  305. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/cases.json +0 -27
  306. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/item.xml +0 -32
  307. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/manifest.json +0 -7
  308. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/cases.json +0 -9
  309. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/item.xml +0 -25
  310. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/manifest.json +0 -12
  311. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/cases.json +0 -12
  312. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/item.xml +0 -35
  313. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/manifest.json +0 -11
  314. package/tests/conformance/fixtures/mapping_bounds_upperLower/cases.json +0 -12
  315. package/tests/conformance/fixtures/mapping_bounds_upperLower/item.xml +0 -37
  316. package/tests/conformance/fixtures/mapping_bounds_upperLower/manifest.json +0 -11
  317. package/tests/conformance/fixtures/mapping_mapResponse/cases.json +0 -22
  318. package/tests/conformance/fixtures/mapping_mapResponse/item.xml +0 -53
  319. package/tests/conformance/fixtures/mapping_mapResponse/manifest.json +0 -16
  320. package/tests/conformance/fixtures/member_multiple/cases.json +0 -12
  321. package/tests/conformance/fixtures/member_multiple/item.xml +0 -37
  322. package/tests/conformance/fixtures/member_multiple/manifest.json +0 -13
  323. package/tests/conformance/fixtures/modalFeedback_basic/cases.json +0 -17
  324. package/tests/conformance/fixtures/modalFeedback_basic/item.xml +0 -52
  325. package/tests/conformance/fixtures/modalFeedback_basic/manifest.json +0 -13
  326. package/tests/conformance/fixtures/multiple_unordered_match/cases.json +0 -17
  327. package/tests/conformance/fixtures/multiple_unordered_match/item.xml +0 -44
  328. package/tests/conformance/fixtures/multiple_unordered_match/manifest.json +0 -11
  329. package/tests/conformance/fixtures/ordered_match/cases.json +0 -17
  330. package/tests/conformance/fixtures/ordered_match/item.xml +0 -48
  331. package/tests/conformance/fixtures/ordered_match/manifest.json +0 -13
  332. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/cases.json +0 -27
  333. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/item.xml +0 -103
  334. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/manifest.json +0 -7
  335. package/tests/conformance/fixtures/outcomeProcessing_exitTest/cases.json +0 -15
  336. package/tests/conformance/fixtures/outcomeProcessing_exitTest/item.xml +0 -33
  337. package/tests/conformance/fixtures/outcomeProcessing_exitTest/manifest.json +0 -10
  338. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/cases.json +0 -14
  339. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/item.xml +0 -26
  340. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/manifest.json +0 -8
  341. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/cases.json +0 -17
  342. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/item.xml +0 -43
  343. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/manifest.json +0 -16
  344. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/cases.json +0 -27
  345. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/item.xml +0 -37
  346. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/manifest.json +0 -16
  347. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/cases.json +0 -14
  348. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/item.xml +0 -35
  349. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/manifest.json +0 -8
  350. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/cases.json +0 -14
  351. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/item.xml +0 -35
  352. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/manifest.json +0 -8
  353. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/cases.json +0 -15
  354. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/item.xml +0 -39
  355. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/manifest.json +0 -11
  356. package/tests/conformance/fixtures/outcomeProcessing_testVariables/cases.json +0 -14
  357. package/tests/conformance/fixtures/outcomeProcessing_testVariables/item.xml +0 -35
  358. package/tests/conformance/fixtures/outcomeProcessing_testVariables/manifest.json +0 -8
  359. package/tests/conformance/fixtures/pair_unordered_match/cases.json +0 -22
  360. package/tests/conformance/fixtures/pair_unordered_match/item.xml +0 -44
  361. package/tests/conformance/fixtures/pair_unordered_match/manifest.json +0 -13
  362. package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/cases.json +0 -95
  363. package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/item.xml +0 -53
  364. package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/cases.json +0 -115
  365. package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/item.xml +0 -45
  366. package/tests/conformance/fixtures/positionObject_mapResponse_wrong/cases.json +0 -29
  367. package/tests/conformance/fixtures/positionObject_mapResponse_wrong/item.xml +0 -40
  368. package/tests/conformance/fixtures/responseCondition_elseIf_chain/cases.json +0 -10
  369. package/tests/conformance/fixtures/responseCondition_elseIf_chain/item.xml +0 -49
  370. package/tests/conformance/fixtures/responseCondition_elseIf_chain/manifest.json +0 -15
  371. package/tests/conformance/fixtures/responseProcessing_anyN/cases.json +0 -27
  372. package/tests/conformance/fixtures/responseProcessing_anyN/item.xml +0 -47
  373. package/tests/conformance/fixtures/responseProcessing_anyN/manifest.json +0 -16
  374. package/tests/conformance/fixtures/responseProcessing_anyN_allN/cases.json +0 -27
  375. package/tests/conformance/fixtures/responseProcessing_anyN_allN/item.xml +0 -69
  376. package/tests/conformance/fixtures/responseProcessing_anyN_allN/manifest.json +0 -23
  377. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/cases.json +0 -15
  378. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/item.xml +0 -58
  379. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/manifest.json +0 -15
  380. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/cases.json +0 -37
  381. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/item.xml +0 -94
  382. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/manifest.json +0 -27
  383. package/tests/conformance/fixtures/responseProcessing_containerSize_index/cases.json +0 -33
  384. package/tests/conformance/fixtures/responseProcessing_containerSize_index/item.xml +0 -79
  385. package/tests/conformance/fixtures/responseProcessing_containerSize_index/manifest.json +0 -16
  386. package/tests/conformance/fixtures/responseProcessing_customOperator/cases.json +0 -15
  387. package/tests/conformance/fixtures/responseProcessing_customOperator/item.xml +0 -30
  388. package/tests/conformance/fixtures/responseProcessing_customOperator/manifest.json +0 -12
  389. package/tests/conformance/fixtures/responseProcessing_default_expression/cases.json +0 -12
  390. package/tests/conformance/fixtures/responseProcessing_default_expression/item.xml +0 -48
  391. package/tests/conformance/fixtures/responseProcessing_default_expression/manifest.json +0 -13
  392. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/cases.json +0 -29
  393. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/item.xml +0 -68
  394. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/manifest.json +0 -17
  395. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/cases.json +0 -39
  396. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/item.xml +0 -39
  397. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/manifest.json +0 -17
  398. package/tests/conformance/fixtures/responseProcessing_exitResponse/cases.json +0 -12
  399. package/tests/conformance/fixtures/responseProcessing_exitResponse/item.xml +0 -25
  400. package/tests/conformance/fixtures/responseProcessing_exitResponse/manifest.json +0 -12
  401. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/cases.json +0 -26
  402. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/item.xml +0 -134
  403. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/manifest.json +0 -16
  404. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/cases.json +0 -27
  405. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/item.xml +0 -33
  406. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/manifest.json +0 -13
  407. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/cases.json +0 -22
  408. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/item.xml +0 -33
  409. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/manifest.json +0 -13
  410. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/cases.json +0 -27
  411. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/item.xml +0 -40
  412. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/manifest.json +0 -18
  413. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/cases.json +0 -22
  414. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/item.xml +0 -33
  415. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/manifest.json +0 -12
  416. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/cases.json +0 -29
  417. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/item.xml +0 -26
  418. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/manifest.json +0 -7
  419. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/cases.json +0 -23
  420. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/item.xml +0 -28
  421. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/manifest.json +0 -11
  422. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/cases.json +0 -29
  423. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/item.xml +0 -26
  424. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/manifest.json +0 -7
  425. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/cases.json +0 -31
  426. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/item.xml +0 -102
  427. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/manifest.json +0 -18
  428. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/cases.json +0 -22
  429. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/item.xml +0 -45
  430. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/manifest.json +0 -21
  431. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/cases.json +0 -26
  432. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/item.xml +0 -157
  433. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/manifest.json +0 -22
  434. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/cases.json +0 -22
  435. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/item.xml +0 -39
  436. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/manifest.json +0 -18
  437. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/cases.json +0 -22
  438. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/item.xml +0 -51
  439. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/manifest.json +0 -19
  440. package/tests/conformance/fixtures/responseProcessing_preCondition/cases.json +0 -31
  441. package/tests/conformance/fixtures/responseProcessing_preCondition/item.xml +0 -44
  442. package/tests/conformance/fixtures/responseProcessing_preCondition/manifest.json +0 -12
  443. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/cases.json +0 -27
  444. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/item.xml +0 -42
  445. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/manifest.json +0 -14
  446. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/cases.json +0 -12
  447. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/item.xml +0 -40
  448. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/manifest.json +0 -17
  449. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/cases.json +0 -17
  450. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/item.xml +0 -63
  451. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/manifest.json +0 -9
  452. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/cases.json +0 -12
  453. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/item.xml +0 -40
  454. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/manifest.json +0 -13
  455. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/cases.json +0 -15
  456. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/item.xml +0 -67
  457. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/manifest.json +0 -9
  458. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/cases.json +0 -27
  459. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/item.xml +0 -69
  460. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/manifest.json +0 -10
  461. package/tests/conformance/fixtures/responseProcessing_subtract_divide/cases.json +0 -15
  462. package/tests/conformance/fixtures/responseProcessing_subtract_divide/item.xml +0 -35
  463. package/tests/conformance/fixtures/responseProcessing_subtract_divide/manifest.json +0 -11
  464. package/tests/conformance/fixtures/responseProcessing_template_map_response/cases.json +0 -17
  465. package/tests/conformance/fixtures/responseProcessing_template_map_response/item.xml +0 -31
  466. package/tests/conformance/fixtures/responseProcessing_template_map_response/manifest.json +0 -8
  467. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/cases.json +0 -22
  468. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/item.xml +0 -27
  469. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/manifest.json +0 -8
  470. package/tests/conformance/fixtures/responseProcessing_template_match_correct/cases.json +0 -17
  471. package/tests/conformance/fixtures/responseProcessing_template_match_correct/item.xml +0 -34
  472. package/tests/conformance/fixtures/responseProcessing_template_match_correct/manifest.json +0 -8
  473. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/cases.json +0 -22
  474. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/item.xml +0 -30
  475. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/manifest.json +0 -7
  476. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/cases.json +0 -17
  477. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/item.xml +0 -30
  478. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/manifest.json +0 -9
  479. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/cases.json +0 -17
  480. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/item.xml +0 -30
  481. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/manifest.json +0 -8
  482. package/tests/conformance/fixtures/responseProcessing_xiInclude/cases.json +0 -14
  483. package/tests/conformance/fixtures/responseProcessing_xiInclude/item.xml +0 -25
  484. package/tests/conformance/fixtures/responseProcessing_xiInclude/manifest.json +0 -9
  485. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/cases.json +0 -12
  486. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/item.xml +0 -52
  487. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/manifest.json +0 -14
  488. package/tests/conformance/fixtures/templateProcessing_exitTemplate/cases.json +0 -12
  489. package/tests/conformance/fixtures/templateProcessing_exitTemplate/item.xml +0 -48
  490. package/tests/conformance/fixtures/templateProcessing_exitTemplate/manifest.json +0 -13
  491. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/cases.json +0 -27
  492. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/item.xml +0 -74
  493. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/manifest.json +0 -22
  494. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/cases.json +0 -17
  495. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/item.xml +0 -133
  496. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/manifest.json +0 -22
  497. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/cases.json +0 -12
  498. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/item.xml +0 -107
  499. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/manifest.json +0 -16
  500. package/tests/conformance/fixtures/templateProcessing_templateConstraint/cases.json +0 -15
  501. package/tests/conformance/fixtures/templateProcessing_templateConstraint/item.xml +0 -52
  502. package/tests/conformance/fixtures/templateProcessing_templateConstraint/manifest.json +0 -14
  503. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/cases.json +0 -16
  504. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/item.xml +0 -49
  505. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/manifest.json +0 -15
  506. package/tests/conformance/fixtures/template_randomInteger_printedVariable/cases.json +0 -16
  507. package/tests/conformance/fixtures/template_randomInteger_printedVariable/item.xml +0 -38
  508. package/tests/conformance/fixtures/template_randomInteger_printedVariable/manifest.json +0 -13
  509. package/tests/conformance/harness.ts +0 -84
  510. package/tests/conformance/run-fixtures.test.ts +0 -127
  511. package/tests/conformance/scripts/normalize-covers.ts +0 -152
  512. package/tests/conformance/types.ts +0 -53
  513. package/tests/core/Player.test.ts +0 -563
  514. package/tests/core/adaptiveItems.test.ts +0 -442
  515. package/tests/core/correctResponse.test.ts +0 -280
  516. package/tests/core/interaction-plumbing.test.ts +0 -141
  517. package/tests/core/modalFeedback.test.ts +0 -308
  518. package/tests/core/outcome-reset.test.ts +0 -43
  519. package/tests/extraction/extractors/associateExtractor.test.ts +0 -182
  520. package/tests/extraction/extractors/choiceExtractor.test.ts +0 -239
  521. package/tests/extraction/extractors/customExtractor.test.ts +0 -83
  522. package/tests/extraction/extractors/drawingExtractor.test.ts +0 -94
  523. package/tests/extraction/extractors/endAttemptExtractor.test.ts +0 -188
  524. package/tests/extraction/extractors/extendedTextExtractor.test.ts +0 -178
  525. package/tests/extraction/extractors/gapMatchExtractor.test.ts +0 -318
  526. package/tests/extraction/extractors/graphicAssociateExtractor.test.ts +0 -260
  527. package/tests/extraction/extractors/graphicGapMatchExtractor.test.ts +0 -320
  528. package/tests/extraction/extractors/graphicOrderExtractor.test.ts +0 -223
  529. package/tests/extraction/extractors/hotspotExtractor.test.ts +0 -298
  530. package/tests/extraction/extractors/hottextExtractor.test.ts +0 -240
  531. package/tests/extraction/extractors/inlineChoiceExtractor.test.ts +0 -292
  532. package/tests/extraction/extractors/matchExtractor.test.ts +0 -241
  533. package/tests/extraction/extractors/mediaExtractor.test.ts +0 -295
  534. package/tests/extraction/extractors/orderExtractor.test.ts +0 -212
  535. package/tests/extraction/extractors/positionObjectExtractor.test.ts +0 -363
  536. package/tests/extraction/extractors/selectPointExtractor.test.ts +0 -214
  537. package/tests/extraction/extractors/sliderExtractor.test.ts +0 -293
  538. package/tests/extraction/extractors/textEntryExtractor.test.ts +0 -133
  539. package/tests/extraction/extractors/uploadExtractor.test.ts +0 -119
  540. package/tests/extraction/test-utils.ts +0 -57
  541. package/tests/iframe/host.test.ts +0 -145
  542. package/tests/iframe/protocol.test.ts +0 -42
  543. package/tests/performance/player-benchmarks.bench.ts +0 -191
  544. package/tests/security/dos-limits.test.ts +0 -56
  545. package/tests/security/xss-prevention.test.ts +0 -522
  546. package/tsconfig.json +0 -20
  547. package/tsconfig.svelte.json +0 -14
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Standard QTI mediaInteraction extractor
3
+ *
4
+ * Extracts data from mediaInteraction elements (video/audio playback)
5
+ */
6
+ /**
7
+ * Standard QTI media interaction extractor
8
+ * Handles mediaInteraction elements (video/audio playback with interaction)
9
+ */
10
+ export const standardMediaExtractor = {
11
+ id: 'qti:media-interaction',
12
+ name: 'QTI Standard Media Interaction',
13
+ priority: 10,
14
+ elementTypes: ['mediaInteraction'],
15
+ description: 'Extracts standard QTI mediaInteraction (video/audio playback)',
16
+ canHandle(element, _context) {
17
+ // All mediaInteraction elements are standard
18
+ return element.rawTagName === 'mediaInteraction';
19
+ },
20
+ extract(element, context) {
21
+ const { utils } = context;
22
+ // Extract attributes
23
+ const autostart = utils.getBooleanAttribute(element, 'autostart', false);
24
+ const minPlays = utils.getNumberAttribute(element, 'minPlays', 0);
25
+ const maxPlays = utils.getNumberAttribute(element, 'maxPlays', 0);
26
+ const loop = utils.getBooleanAttribute(element, 'loop', false);
27
+ // Extract prompt (optional)
28
+ const promptElements = utils.getChildrenByTag(element, 'prompt');
29
+ const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
30
+ // Extract media element (audio, video, or object)
31
+ let mediaElement = null;
32
+ // Check for audio element
33
+ const audioElements = utils.getChildrenByTag(element, 'audio');
34
+ if (audioElements.length > 0) {
35
+ const audioElement = audioElements[0];
36
+ const sourceElements = utils.getChildrenByTag(audioElement, 'source');
37
+ if (sourceElements.length === 0) {
38
+ throw new Error('audio element must contain at least one source element');
39
+ }
40
+ const firstSource = sourceElements[0];
41
+ mediaElement = {
42
+ type: 'audio',
43
+ src: utils.getAttribute(firstSource, 'src', ''),
44
+ mimeType: utils.getAttribute(firstSource, 'type', ''),
45
+ };
46
+ }
47
+ // Check for video element
48
+ const videoElements = utils.getChildrenByTag(element, 'video');
49
+ if (videoElements.length > 0) {
50
+ const videoElement = videoElements[0];
51
+ const sourceElements = utils.getChildrenByTag(videoElement, 'source');
52
+ if (sourceElements.length === 0) {
53
+ throw new Error('video element must contain at least one source element');
54
+ }
55
+ const firstSource = sourceElements[0];
56
+ const width = utils.getNumberAttribute(videoElement, 'width', 640);
57
+ const height = utils.getNumberAttribute(videoElement, 'height', 480);
58
+ mediaElement = {
59
+ type: 'video',
60
+ src: utils.getAttribute(firstSource, 'src', ''),
61
+ mimeType: utils.getAttribute(firstSource, 'type', ''),
62
+ width,
63
+ height,
64
+ };
65
+ }
66
+ // Check for object element
67
+ const objectElements = utils.getChildrenByTag(element, 'object');
68
+ if (objectElements.length > 0) {
69
+ const objectElement = objectElements[0];
70
+ const data = utils.getAttribute(objectElement, 'data', '');
71
+ if (!data) {
72
+ throw new Error('object element must have data attribute');
73
+ }
74
+ const width = utils.getNumberAttribute(objectElement, 'width', 0);
75
+ const height = utils.getNumberAttribute(objectElement, 'height', 0);
76
+ mediaElement = {
77
+ type: 'object',
78
+ src: data,
79
+ mimeType: utils.getAttribute(objectElement, 'type', ''),
80
+ ...(width > 0 ? { width } : {}),
81
+ ...(height > 0 ? { height } : {}),
82
+ };
83
+ }
84
+ // Throw error if no media element found
85
+ if (!mediaElement) {
86
+ throw new Error('mediaInteraction must contain audio, video, or object element');
87
+ }
88
+ return {
89
+ mediaElement,
90
+ autostart,
91
+ minPlays,
92
+ maxPlays,
93
+ loop,
94
+ prompt,
95
+ };
96
+ },
97
+ validate(data) {
98
+ const errors = [];
99
+ const warnings = [];
100
+ // Validate media element exists
101
+ if (!data.mediaElement) {
102
+ errors.push('mediaInteraction must have a mediaElement');
103
+ }
104
+ // Validate play constraints
105
+ if (data.minPlays < 0) {
106
+ errors.push('minPlays must be non-negative');
107
+ }
108
+ if (data.maxPlays < 0) {
109
+ errors.push('maxPlays must be non-negative');
110
+ }
111
+ // Validate minPlays <= maxPlays (when maxPlays > 0, as 0 means unlimited)
112
+ if (data.maxPlays > 0 && data.minPlays > data.maxPlays) {
113
+ errors.push(`maxPlays (${data.maxPlays}) must be greater than or equal to minPlays (${data.minPlays})`);
114
+ }
115
+ // Warn if loop is true with maxPlays
116
+ if (data.loop && data.maxPlays > 0) {
117
+ warnings.push('mediaInteraction has loop=true with maxPlays - loop may be ignored');
118
+ }
119
+ return {
120
+ valid: errors.length === 0,
121
+ errors: errors.length > 0 ? errors : undefined,
122
+ warnings: warnings.length > 0 ? warnings : undefined,
123
+ };
124
+ },
125
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Standard QTI orderInteraction extractor
3
+ *
4
+ * Extracts data from orderInteraction elements (ordering/ranking tasks)
5
+ */
6
+ import type { ElementExtractor } from '../types.js';
7
+ /**
8
+ * Order data extracted from orderInteraction elements
9
+ */
10
+ export interface OrderData {
11
+ choices: Array<{
12
+ identifier: string;
13
+ text: string;
14
+ fixed?: boolean;
15
+ classes?: string[];
16
+ }>;
17
+ shuffle: boolean;
18
+ minChoices: number;
19
+ maxChoices: number;
20
+ orientation?: string;
21
+ prompt: string | null;
22
+ }
23
+ /**
24
+ * Standard QTI order interaction extractor
25
+ * Handles orderInteraction elements with simpleChoice children
26
+ */
27
+ export declare const standardOrderExtractor: ElementExtractor<OrderData>;
28
+ //# sourceMappingURL=orderExtractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/orderExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC1F,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,SAAS,CA+F9D,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Standard QTI orderInteraction extractor
3
+ *
4
+ * Extracts data from orderInteraction elements (ordering/ranking tasks)
5
+ */
6
+ /**
7
+ * Standard QTI order interaction extractor
8
+ * Handles orderInteraction elements with simpleChoice children
9
+ */
10
+ export const standardOrderExtractor = {
11
+ id: 'qti:order-interaction',
12
+ name: 'QTI Standard Order Interaction',
13
+ priority: 10,
14
+ elementTypes: ['orderInteraction'],
15
+ description: 'Extracts standard QTI orderInteraction (ordering/ranking tasks)',
16
+ canHandle(element, context) {
17
+ // Standard QTI order interactions have simpleChoice children
18
+ return context.utils.hasChildWithTag(element, 'simpleChoice');
19
+ },
20
+ extract(element, context) {
21
+ const { utils } = context;
22
+ // Extract choices
23
+ const simpleChoices = utils.getChildrenByTag(element, 'simpleChoice');
24
+ const choices = simpleChoices.map((choice) => {
25
+ const classes = utils.getClasses(choice);
26
+ const fixed = utils.getBooleanAttribute(choice, 'fixed');
27
+ return {
28
+ identifier: utils.getAttribute(choice, 'identifier', ''),
29
+ text: utils.getHtmlContent(choice),
30
+ ...(fixed ? { fixed } : {}),
31
+ ...(classes.length > 0 ? { classes } : {}),
32
+ };
33
+ });
34
+ // Extract prompt
35
+ const promptElement = utils.querySelector(element, 'prompt');
36
+ const prompt = promptElement ? utils.getHtmlContent(promptElement) : null;
37
+ // Extract attributes
38
+ const shuffle = utils.getBooleanAttribute(element, 'shuffle');
39
+ const orientation = utils.getAttribute(element, 'orientation', 'vertical');
40
+ const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
41
+ const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
42
+ return {
43
+ choices,
44
+ shuffle,
45
+ orientation,
46
+ minChoices,
47
+ maxChoices,
48
+ prompt,
49
+ };
50
+ },
51
+ validate(data) {
52
+ const errors = [];
53
+ const warnings = [];
54
+ // Validate choices exist
55
+ if (!data.choices || data.choices.length < 2) {
56
+ errors.push('orderInteraction must have at least 2 choices');
57
+ }
58
+ // Warn if too many choices (difficult to order)
59
+ if (data.choices && data.choices.length > 10) {
60
+ warnings.push(`orderInteraction has ${data.choices.length} choices - this may be difficult for users to order`);
61
+ }
62
+ // Validate choice identifiers
63
+ if (data.choices) {
64
+ const identifiers = new Set();
65
+ for (const choice of data.choices) {
66
+ if (!choice.identifier) {
67
+ errors.push('All choices must have an identifier');
68
+ }
69
+ else if (identifiers.has(choice.identifier)) {
70
+ errors.push(`Duplicate choice identifier: ${choice.identifier}`);
71
+ }
72
+ else {
73
+ identifiers.add(choice.identifier);
74
+ }
75
+ }
76
+ }
77
+ // Validate orientation (only if provided)
78
+ if (data.orientation) {
79
+ const validOrientations = ['vertical', 'horizontal'];
80
+ if (!validOrientations.includes(data.orientation)) {
81
+ warnings.push(`orientation '${data.orientation}' is not standard (expected: ${validOrientations.join(', ')})`);
82
+ }
83
+ }
84
+ return {
85
+ valid: errors.length === 0,
86
+ errors: errors.length > 0 ? errors : undefined,
87
+ warnings: warnings.length > 0 ? warnings : undefined,
88
+ };
89
+ },
90
+ };
@@ -0,0 +1,14 @@
1
+ import type { ElementExtractor } from '../types.js';
2
+ import type { ExtractedPci } from '../../pci/types.js';
3
+ /**
4
+ * Extractor for <qti-portable-custom-interaction> (QTI 3.0) and
5
+ * <portableCustomInteraction> (QTI 2.x vendor extension).
6
+ *
7
+ * Extracts the module paths, markup, and config properties needed by PciHost
8
+ * to load and initialize the PCI JavaScript module.
9
+ *
10
+ * Priority 20 > standardCustomExtractor priority 10, so this runs first when
11
+ * both would match the same element.
12
+ */
13
+ export declare const portableCustomExtractor: ElementExtractor<ExtractedPci>;
14
+ //# sourceMappingURL=portableCustomExtractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portableCustomExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/portableCustomExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,YAAY,CA4GlE,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Extractor for <qti-portable-custom-interaction> (QTI 3.0) and
3
+ * <portableCustomInteraction> (QTI 2.x vendor extension).
4
+ *
5
+ * Extracts the module paths, markup, and config properties needed by PciHost
6
+ * to load and initialize the PCI JavaScript module.
7
+ *
8
+ * Priority 20 > standardCustomExtractor priority 10, so this runs first when
9
+ * both would match the same element.
10
+ */
11
+ export const portableCustomExtractor = {
12
+ id: 'qti:portable-custom-interaction',
13
+ name: 'QTI Portable Custom Interaction',
14
+ priority: 20,
15
+ elementTypes: [
16
+ 'portableCustomInteraction',
17
+ 'qti-portable-custom-interaction',
18
+ ],
19
+ description: 'Extracts QTI 3.0 portable custom interaction module paths, markup, and config',
20
+ canHandle(element, _context) {
21
+ const tag = element.rawTagName?.toLowerCase() ?? '';
22
+ return (tag === 'qti-portable-custom-interaction' ||
23
+ tag === 'portablecustominteraction');
24
+ },
25
+ extract(element, context) {
26
+ const { utils } = context;
27
+ const responseIdentifier = utils.getAttribute(element, 'responseIdentifier') ||
28
+ utils.getAttribute(element, 'response-identifier') || '';
29
+ const customInteractionTypeIdentifier = utils.getAttribute(element, 'customInteractionTypeIdentifier') ||
30
+ utils.getAttribute(element, 'custom-interaction-type-identifier') || '';
31
+ // --- Module paths from <qti-interaction-modules>/<qti-interaction-module> ---
32
+ // These element names ARE in the standard QTI 3.0 element mapper so utils.querySelector works.
33
+ let primaryPath = '';
34
+ let fallbackPath;
35
+ const modulesEl = utils.querySelector(element, 'qti-interaction-modules') ??
36
+ utils.querySelector(element, 'interactionmodules');
37
+ if (modulesEl) {
38
+ const moduleEl = utils.querySelector(modulesEl, 'qti-interaction-module') ??
39
+ utils.querySelector(modulesEl, 'interactionmodule');
40
+ if (moduleEl) {
41
+ primaryPath =
42
+ utils.getAttribute(moduleEl, 'primaryPath') ||
43
+ utils.getAttribute(moduleEl, 'primary-path') || '';
44
+ const fb = utils.getAttribute(moduleEl, 'fallbackPath') ||
45
+ utils.getAttribute(moduleEl, 'fallback-path') || '';
46
+ if (fb)
47
+ fallbackPath = fb;
48
+ }
49
+ }
50
+ // --- Markup from <qti-interaction-markup> ---
51
+ const markupEl = utils.querySelector(element, 'qti-interaction-markup') ??
52
+ utils.querySelector(element, 'interactionmarkup');
53
+ const markup = markupEl ? utils.getHtmlContent(markupEl) : '';
54
+ // --- Config from <qti-pci-properties>/<qti-pci-property> ---
55
+ // qti-pci-properties is NOT in the standard QTI 3.0 element mapper, so we use the
56
+ // native node-html-parser querySelector (available as element.querySelector on the raw element).
57
+ const config = {};
58
+ const rawEl = element;
59
+ const propsEl = rawEl.querySelector?.('qti-pci-properties') ??
60
+ rawEl.querySelector?.('pciproperties');
61
+ if (propsEl) {
62
+ const propEls = [
63
+ ...(propsEl.querySelectorAll?.('qti-pci-property') ?? []),
64
+ ...(propsEl.querySelectorAll?.('pciproperty') ?? []),
65
+ ];
66
+ for (const propEl of propEls) {
67
+ const key = propEl.getAttribute?.('key') || propEl.getAttribute?.('name') || '';
68
+ const value = propEl.getAttribute?.('value') || (propEl.textContent ?? '').trim() || '';
69
+ if (key)
70
+ config[key] = value;
71
+ }
72
+ }
73
+ return {
74
+ responseIdentifier,
75
+ customInteractionTypeIdentifier,
76
+ primaryPath,
77
+ fallbackPath,
78
+ markup,
79
+ config,
80
+ };
81
+ },
82
+ validate(data) {
83
+ const errors = [];
84
+ const warnings = [];
85
+ if (!data.responseIdentifier) {
86
+ errors.push('portableCustomInteraction is missing responseIdentifier');
87
+ }
88
+ if (!data.customInteractionTypeIdentifier) {
89
+ warnings.push('portableCustomInteraction is missing customInteractionTypeIdentifier');
90
+ }
91
+ if (!data.primaryPath) {
92
+ errors.push('portableCustomInteraction has no primaryPath in qti-interaction-modules');
93
+ }
94
+ return { valid: errors.length === 0, errors: errors.length ? errors : undefined, warnings: warnings.length ? warnings : undefined };
95
+ },
96
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Standard QTI positionObjectInteraction extractor
3
+ *
4
+ * Extracts data from positionObjectInteraction elements (drag objects to positions)
5
+ *
6
+ * ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations
7
+ *
8
+ * This interaction has severe limitations that make it impractical for most educational scenarios:
9
+ *
10
+ * 1. Response format is baseType="point" - only stores coordinates ["158 168"]
11
+ * 2. NO way to track which specific object was placed where
12
+ * 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)
13
+ * 4. Cannot support "place labeled objects on map" use cases
14
+ *
15
+ * The official QTI 2.2 spec example shows:
16
+ * - ONE positionObjectStage (container) with background image
17
+ * - ONE positionObjectInteraction with ONE draggable object
18
+ * - maxChoices determines how many times the object can be placed
19
+ * - Scoring uses areaMapping to check if ANY placement hits target zones
20
+ *
21
+ * This extractor supports a NON-STANDARD extension with multiple positionObjectStage
22
+ * elements (each with identifiers), but the response format cannot preserve object identity.
23
+ * For labeled-object placement, use graphicGapMatchInteraction instead.
24
+ */
25
+ import type { ElementExtractor } from '../types.js';
26
+ /**
27
+ * Image data for position object interaction
28
+ */
29
+ export interface ImageData {
30
+ type: 'image' | 'svg';
31
+ src?: string;
32
+ content?: string;
33
+ width?: string;
34
+ height?: string;
35
+ }
36
+ /**
37
+ * Position object data extracted from positionObjectInteraction elements
38
+ */
39
+ export interface PositionObjectData {
40
+ imageData: ImageData | null;
41
+ positionObjectStages: Array<{
42
+ identifier: string;
43
+ label: string;
44
+ matchMax: number;
45
+ matchMin?: number;
46
+ objectData: ImageData | null;
47
+ classes?: string[];
48
+ }>;
49
+ centerPoint: boolean;
50
+ maxChoices: number;
51
+ minChoices: number;
52
+ prompt: string | null;
53
+ }
54
+ /**
55
+ * Standard QTI position object interaction extractor
56
+ * Handles positionObjectInteraction elements (dragging an object to a position)
57
+ */
58
+ export declare const standardPositionObjectExtractor: ElementExtractor<PositionObjectData>;
59
+ //# sourceMappingURL=positionObjectExtractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionObjectExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/positionObjectExtractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,oBAAoB,EAAE,KAAK,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;QAC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,gBAAgB,CAAC,kBAAkB,CAqLhF,CAAC"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Standard QTI positionObjectInteraction extractor
3
+ *
4
+ * Extracts data from positionObjectInteraction elements (drag objects to positions)
5
+ *
6
+ * ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations
7
+ *
8
+ * This interaction has severe limitations that make it impractical for most educational scenarios:
9
+ *
10
+ * 1. Response format is baseType="point" - only stores coordinates ["158 168"]
11
+ * 2. NO way to track which specific object was placed where
12
+ * 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)
13
+ * 4. Cannot support "place labeled objects on map" use cases
14
+ *
15
+ * The official QTI 2.2 spec example shows:
16
+ * - ONE positionObjectStage (container) with background image
17
+ * - ONE positionObjectInteraction with ONE draggable object
18
+ * - maxChoices determines how many times the object can be placed
19
+ * - Scoring uses areaMapping to check if ANY placement hits target zones
20
+ *
21
+ * This extractor supports a NON-STANDARD extension with multiple positionObjectStage
22
+ * elements (each with identifiers), but the response format cannot preserve object identity.
23
+ * For labeled-object placement, use graphicGapMatchInteraction instead.
24
+ */
25
+ /**
26
+ * Standard QTI position object interaction extractor
27
+ * Handles positionObjectInteraction elements (dragging an object to a position)
28
+ */
29
+ export const standardPositionObjectExtractor = {
30
+ id: 'qti:position-object-interaction',
31
+ name: 'QTI Standard Position Object Interaction',
32
+ priority: 10,
33
+ elementTypes: ['positionObjectInteraction'],
34
+ description: 'Extracts standard QTI positionObjectInteraction (drag object to position)',
35
+ canHandle(element, _context) {
36
+ // All positionObjectInteraction elements are standard
37
+ return element.rawTagName === 'positionObjectInteraction';
38
+ },
39
+ extract(element, context) {
40
+ const { utils } = context;
41
+ // Extract background image data from object element (direct child)
42
+ const objectElements = utils.getChildrenByTag(element, 'object');
43
+ let imageData = null;
44
+ if (objectElements.length > 0) {
45
+ const objectElement = objectElements[0];
46
+ const type = utils.getAttribute(objectElement, 'type', '');
47
+ const data = utils.getAttribute(objectElement, 'data', '');
48
+ const width = utils.getAttribute(objectElement, 'width', '500');
49
+ const height = utils.getAttribute(objectElement, 'height', '300');
50
+ if (type.startsWith('image/svg')) {
51
+ // Extract inline SVG content - get full content including <svg> tag
52
+ const content = utils.getHtmlContent(objectElement);
53
+ imageData = {
54
+ type: 'svg',
55
+ content,
56
+ width,
57
+ height,
58
+ };
59
+ }
60
+ else {
61
+ // External image reference
62
+ imageData = {
63
+ type: 'image',
64
+ src: data,
65
+ width,
66
+ height,
67
+ };
68
+ }
69
+ }
70
+ // Extract positionObjectStage children
71
+ const stageElements = utils.getChildrenByTag(element, 'positionObjectStage');
72
+ const positionObjectStages = stageElements.map((stage) => {
73
+ const classes = utils.getClasses(stage);
74
+ const identifier = utils.getAttribute(stage, 'identifier', '');
75
+ const matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);
76
+ const matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);
77
+ // Get text content as label, use identifier as fallback
78
+ const textContent = utils.getTextContent(stage).trim();
79
+ const label = textContent || identifier;
80
+ // Extract object data from nested object element
81
+ const stageObjectElements = utils.getChildrenByTag(stage, 'object');
82
+ let objectData = null;
83
+ if (stageObjectElements.length > 0) {
84
+ const objElement = stageObjectElements[0];
85
+ const objType = utils.getAttribute(objElement, 'type', '');
86
+ const objData = utils.getAttribute(objElement, 'data', '');
87
+ const objWidth = utils.getAttribute(objElement, 'width', '50');
88
+ const objHeight = utils.getAttribute(objElement, 'height', '50');
89
+ if (objType.startsWith('image/svg')) {
90
+ // Extract inline SVG content
91
+ const content = utils.getHtmlContent(objElement);
92
+ objectData = {
93
+ type: 'svg',
94
+ content,
95
+ width: objWidth,
96
+ height: objHeight,
97
+ };
98
+ }
99
+ else {
100
+ // External image reference
101
+ objectData = {
102
+ type: 'image',
103
+ src: objData,
104
+ width: objWidth,
105
+ height: objHeight,
106
+ };
107
+ }
108
+ }
109
+ return {
110
+ identifier,
111
+ label,
112
+ matchMax,
113
+ ...(matchMin > 0 ? { matchMin } : {}),
114
+ objectData,
115
+ ...(classes.length > 0 ? { classes } : {}),
116
+ };
117
+ });
118
+ // Extract attributes
119
+ // centerPoint defaults to true when not specified
120
+ const centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);
121
+ const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
122
+ const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
123
+ // Extract prompt (optional)
124
+ const promptElements = utils.getChildrenByTag(element, 'prompt');
125
+ const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
126
+ return {
127
+ imageData,
128
+ positionObjectStages,
129
+ centerPoint,
130
+ maxChoices,
131
+ minChoices,
132
+ prompt,
133
+ };
134
+ },
135
+ validate(data) {
136
+ const errors = [];
137
+ const warnings = [];
138
+ // Validate image data
139
+ if (!data.imageData) {
140
+ warnings.push('positionObjectInteraction has no background image');
141
+ }
142
+ else if (data.imageData.type === 'image' && !data.imageData.src) {
143
+ errors.push('positionObjectInteraction must have an image URL');
144
+ }
145
+ else if (data.imageData.type === 'svg' && !data.imageData.content) {
146
+ errors.push('positionObjectInteraction must have SVG content');
147
+ }
148
+ // Warn about dimension consistency (cannot verify actual file dimensions at extraction time)
149
+ if (data.imageData && data.imageData.type === 'image') {
150
+ warnings.push('IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +
151
+ 'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +
152
+ `Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`);
153
+ }
154
+ // Validate positionObjectStages exist
155
+ if (!data.positionObjectStages || data.positionObjectStages.length === 0) {
156
+ errors.push('positionObjectInteraction must have at least one positionObjectStage');
157
+ }
158
+ // Validate positionObjectStage identifiers
159
+ if (data.positionObjectStages) {
160
+ const identifiers = new Set();
161
+ for (const stage of data.positionObjectStages) {
162
+ if (!stage.identifier) {
163
+ errors.push('All positionObjectStages must have an identifier');
164
+ }
165
+ else if (identifiers.has(stage.identifier)) {
166
+ errors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);
167
+ }
168
+ else {
169
+ identifiers.add(stage.identifier);
170
+ }
171
+ }
172
+ }
173
+ // Validate maxChoices
174
+ if (data.maxChoices < 0) {
175
+ errors.push('maxChoices must be non-negative');
176
+ }
177
+ // Validate minChoices
178
+ if (data.minChoices < 0) {
179
+ errors.push('minChoices must be non-negative');
180
+ }
181
+ // Validate minChoices <= maxChoices
182
+ if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
183
+ errors.push('minChoices cannot exceed maxChoices');
184
+ }
185
+ return {
186
+ valid: errors.length === 0,
187
+ errors: errors.length > 0 ? errors : undefined,
188
+ warnings: warnings.length > 0 ? warnings : undefined,
189
+ };
190
+ },
191
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Standard QTI selectPointInteraction extractor
3
+ *
4
+ * Extracts data from selectPointInteraction elements (click point on image)
5
+ */
6
+ import type { ElementExtractor } from '../types.js';
7
+ /**
8
+ * Image data for select point interaction
9
+ */
10
+ export interface ImageData {
11
+ type: 'image' | 'svg';
12
+ src?: string;
13
+ content?: string;
14
+ width?: string;
15
+ height?: string;
16
+ }
17
+ /**
18
+ * Select point data extracted from selectPointInteraction elements
19
+ */
20
+ export interface SelectPointData {
21
+ imageData: ImageData | null;
22
+ maxChoices: number;
23
+ minChoices: number;
24
+ prompt: string | null;
25
+ }
26
+ /**
27
+ * Standard QTI select point interaction extractor
28
+ * Handles selectPointInteraction elements (clicking points on an image)
29
+ */
30
+ export declare const standardSelectPointExtractor: ElementExtractor<SelectPointData>;
31
+ //# sourceMappingURL=selectPointExtractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectPointExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/selectPointExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,gBAAgB,CAAC,eAAe,CA6G1E,CAAC"}