@intellectif/lk-react 23.0.1 → 23.1.1

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 (369) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +13 -9
  3. package/dist/ActivityErrorBoundary-B379hvtL.cjs +39 -0
  4. package/dist/ActivityErrorBoundary-B379hvtL.cjs.map +1 -0
  5. package/dist/ActivityErrorBoundary-Dw6SbWv3.js +34 -0
  6. package/dist/ActivityErrorBoundary-Dw6SbWv3.js.map +1 -0
  7. package/dist/ActivityMedia-CQQTRNl7.cjs +641 -0
  8. package/dist/ActivityMedia-CQQTRNl7.cjs.map +1 -0
  9. package/dist/ActivityMedia-vDiP-Psa.js +636 -0
  10. package/dist/ActivityMedia-vDiP-Psa.js.map +1 -0
  11. package/dist/ActivityPreview-1hhTkYuj.js +240 -0
  12. package/dist/ActivityPreview-1hhTkYuj.js.map +1 -0
  13. package/dist/ActivityPreview-BKr34exz.cjs +245 -0
  14. package/dist/ActivityPreview-BKr34exz.cjs.map +1 -0
  15. package/dist/ActivitySequence-CkX87pfB.js +839 -0
  16. package/dist/ActivitySequence-CkX87pfB.js.map +1 -0
  17. package/dist/ActivitySequence-CmoSyDnp.cjs +844 -0
  18. package/dist/ActivitySequence-CmoSyDnp.cjs.map +1 -0
  19. package/dist/Dictation-BlxRp-3k.js +926 -0
  20. package/dist/Dictation-BlxRp-3k.js.map +1 -0
  21. package/dist/Dictation-jECzL88E.cjs +931 -0
  22. package/dist/Dictation-jECzL88E.cjs.map +1 -0
  23. package/dist/FeedbackRegion-BNNMtTY-.cjs +108 -0
  24. package/dist/FeedbackRegion-BNNMtTY-.cjs.map +1 -0
  25. package/dist/FeedbackRegion-CyPSp8bA.js +85 -0
  26. package/dist/FeedbackRegion-CyPSp8bA.js.map +1 -0
  27. package/dist/FillInTheBlanks-B6xzqYXx.js +474 -0
  28. package/dist/FillInTheBlanks-B6xzqYXx.js.map +1 -0
  29. package/dist/FillInTheBlanks-BpKhdHg2.cjs +479 -0
  30. package/dist/FillInTheBlanks-BpKhdHg2.cjs.map +1 -0
  31. package/dist/GapSelect-DUSiaEQH.js +441 -0
  32. package/dist/GapSelect-DUSiaEQH.js.map +1 -0
  33. package/dist/GapSelect-payTq_Zn.cjs +446 -0
  34. package/dist/GapSelect-payTq_Zn.cjs.map +1 -0
  35. package/dist/InteractiveVideo-BguGv-HA.cjs +2955 -0
  36. package/dist/InteractiveVideo-BguGv-HA.cjs.map +1 -0
  37. package/dist/InteractiveVideo-Cg2jbU3j.js +2944 -0
  38. package/dist/InteractiveVideo-Cg2jbU3j.js.map +1 -0
  39. package/dist/LkAiProvider-DAPpA3PQ.d.cts +84 -0
  40. package/dist/LkAiProvider-DAPpA3PQ.d.cts.map +1 -0
  41. package/dist/LkAiProvider-QdEcIhoo.d.ts +84 -0
  42. package/dist/LkAiProvider-QdEcIhoo.d.ts.map +1 -0
  43. package/dist/LkIntlProvider-D_FdYXjQ.js +375 -0
  44. package/dist/LkIntlProvider-D_FdYXjQ.js.map +1 -0
  45. package/dist/LkIntlProvider-oi57lYB0.cjs +410 -0
  46. package/dist/LkIntlProvider-oi57lYB0.cjs.map +1 -0
  47. package/dist/MultipleChoice-COn5MtKY.cjs +433 -0
  48. package/dist/MultipleChoice-COn5MtKY.cjs.map +1 -0
  49. package/dist/MultipleChoice-Dra0_KYD.js +428 -0
  50. package/dist/MultipleChoice-Dra0_KYD.js.map +1 -0
  51. package/dist/PronunciationFeedback-DlMPGjkR.cjs +831 -0
  52. package/dist/PronunciationFeedback-DlMPGjkR.cjs.map +1 -0
  53. package/dist/PronunciationFeedback-Dxd6XPkO.js +772 -0
  54. package/dist/PronunciationFeedback-Dxd6XPkO.js.map +1 -0
  55. package/dist/ReadAloud-C8RhaUqV.js +1092 -0
  56. package/dist/ReadAloud-C8RhaUqV.js.map +1 -0
  57. package/dist/ReadAloud-akDehitT.cjs +1103 -0
  58. package/dist/ReadAloud-akDehitT.cjs.map +1 -0
  59. package/dist/StimulusPanel-BgzByfkb.js +74 -0
  60. package/dist/StimulusPanel-BgzByfkb.js.map +1 -0
  61. package/dist/StimulusPanel-b66gaN3i.cjs +79 -0
  62. package/dist/StimulusPanel-b66gaN3i.cjs.map +1 -0
  63. package/dist/ThemeProvider-BRN1tj4n.cjs +187 -0
  64. package/dist/ThemeProvider-BRN1tj4n.cjs.map +1 -0
  65. package/dist/ThemeProvider-C7K9iMLX.js +158 -0
  66. package/dist/ThemeProvider-C7K9iMLX.js.map +1 -0
  67. package/dist/ThemeProvider-CocC8ODJ.d.ts +62 -0
  68. package/dist/ThemeProvider-CocC8ODJ.d.ts.map +1 -0
  69. package/dist/ThemeProvider-DS4KOL86.d.cts +62 -0
  70. package/dist/ThemeProvider-DS4KOL86.d.cts.map +1 -0
  71. package/dist/WrittenResponse-Bj3eFmGl.cjs +491 -0
  72. package/dist/WrittenResponse-Bj3eFmGl.cjs.map +1 -0
  73. package/dist/WrittenResponse-Cl8G6nO_.js +486 -0
  74. package/dist/WrittenResponse-Cl8G6nO_.js.map +1 -0
  75. package/dist/ai/LkAiProvider.cjs +34 -14
  76. package/dist/ai/LkAiProvider.cjs.map +1 -1
  77. package/dist/ai/LkAiProvider.d.cts +2 -73
  78. package/dist/ai/LkAiProvider.d.ts +2 -73
  79. package/dist/ai/LkAiProvider.js +33 -2
  80. package/dist/ai/LkAiProvider.js.map +1 -1
  81. package/dist/ai/useAiHelp.cjs +7 -23
  82. package/dist/ai/useAiHelp.d.cts +198 -121
  83. package/dist/ai/useAiHelp.d.cts.map +1 -0
  84. package/dist/ai/useAiHelp.d.ts +198 -121
  85. package/dist/ai/useAiHelp.d.ts.map +1 -0
  86. package/dist/ai/useAiHelp.js +3 -6
  87. package/dist/components/ActivityPreview.cjs +3 -31
  88. package/dist/components/ActivityPreview.d.cts +2 -81
  89. package/dist/components/ActivityPreview.d.ts +2 -81
  90. package/dist/components/ActivityPreview.js +2 -22
  91. package/dist/components/ActivitySequence.cjs +3 -32
  92. package/dist/components/ActivitySequence.d.cts +2 -432
  93. package/dist/components/ActivitySequence.d.ts +2 -432
  94. package/dist/components/ActivitySequence.js +2 -23
  95. package/dist/components/Dictation.cjs +4 -23
  96. package/dist/components/Dictation.d.cts +2 -19
  97. package/dist/components/Dictation.d.ts +2 -19
  98. package/dist/components/Dictation.js +3 -14
  99. package/dist/components/FillInTheBlanks.cjs +4 -22
  100. package/dist/components/FillInTheBlanks.d.cts +2 -30
  101. package/dist/components/FillInTheBlanks.d.ts +2 -30
  102. package/dist/components/FillInTheBlanks.js +3 -13
  103. package/dist/components/GapSelect.cjs +4 -22
  104. package/dist/components/GapSelect.d.cts +2 -27
  105. package/dist/components/GapSelect.d.ts +2 -27
  106. package/dist/components/GapSelect.js +3 -13
  107. package/dist/components/InteractiveVideo.cjs +5 -34
  108. package/dist/components/InteractiveVideo.d.cts +3 -291
  109. package/dist/components/InteractiveVideo.d.ts +3 -291
  110. package/dist/components/InteractiveVideo.js +3 -21
  111. package/dist/components/MultipleChoice.cjs +4 -22
  112. package/dist/components/MultipleChoice.d.cts +2 -26
  113. package/dist/components/MultipleChoice.d.ts +2 -26
  114. package/dist/components/MultipleChoice.js +3 -13
  115. package/dist/components/PronunciationFeedback.cjs +4 -16
  116. package/dist/components/PronunciationFeedback.d.cts +2 -69
  117. package/dist/components/PronunciationFeedback.d.ts +2 -69
  118. package/dist/components/PronunciationFeedback.js +3 -7
  119. package/dist/components/ReadAloud.cjs +4 -22
  120. package/dist/components/ReadAloud.d.cts +7 -11
  121. package/dist/components/ReadAloud.d.cts.map +1 -0
  122. package/dist/components/ReadAloud.d.ts +7 -11
  123. package/dist/components/ReadAloud.d.ts.map +1 -0
  124. package/dist/components/ReadAloud.js +3 -13
  125. package/dist/components/StimulusPanel.cjs +3 -14
  126. package/dist/components/StimulusPanel.d.cts +2 -51
  127. package/dist/components/StimulusPanel.d.ts +2 -51
  128. package/dist/components/StimulusPanel.js +2 -5
  129. package/dist/components/WrittenResponse.cjs +4 -21
  130. package/dist/components/WrittenResponse.d.cts +3 -18
  131. package/dist/components/WrittenResponse.d.ts +3 -18
  132. package/dist/components/WrittenResponse.js +3 -12
  133. package/dist/direction-Dq0_HtA5.js +183 -0
  134. package/dist/direction-Dq0_HtA5.js.map +1 -0
  135. package/dist/direction-K1pj0HCA.cjs +200 -0
  136. package/dist/direction-K1pj0HCA.cjs.map +1 -0
  137. package/dist/hooks/useActivityState.cjs +28 -10
  138. package/dist/hooks/useActivityState.cjs.map +1 -1
  139. package/dist/hooks/useActivityState.d.cts +25 -24
  140. package/dist/hooks/useActivityState.d.cts.map +1 -0
  141. package/dist/hooks/useActivityState.d.ts +25 -24
  142. package/dist/hooks/useActivityState.d.ts.map +1 -0
  143. package/dist/hooks/useActivityState.js +28 -2
  144. package/dist/hooks/useActivityState.js.map +1 -1
  145. package/dist/hooks/useSpeechRecorder.cjs +5 -16
  146. package/dist/hooks/useSpeechRecorder.d.cts +2 -127
  147. package/dist/hooks/useSpeechRecorder.d.ts +2 -127
  148. package/dist/hooks/useSpeechRecorder.js +3 -3
  149. package/dist/hooks/useXAPI.cjs +126 -10
  150. package/dist/hooks/useXAPI.cjs.map +1 -1
  151. package/dist/hooks/useXAPI.d.cts +14 -14
  152. package/dist/hooks/useXAPI.d.cts.map +1 -0
  153. package/dist/hooks/useXAPI.d.ts +14 -14
  154. package/dist/hooks/useXAPI.d.ts.map +1 -0
  155. package/dist/hooks/useXAPI.js +126 -2
  156. package/dist/hooks/useXAPI.js.map +1 -1
  157. package/dist/i18n/LkIntlProvider.cjs +9 -32
  158. package/dist/i18n/LkIntlProvider.d.cts +34 -38
  159. package/dist/i18n/LkIntlProvider.d.cts.map +1 -0
  160. package/dist/i18n/LkIntlProvider.d.ts +34 -38
  161. package/dist/i18n/LkIntlProvider.d.ts.map +1 -0
  162. package/dist/i18n/LkIntlProvider.js +3 -3
  163. package/dist/index-2iDJohip.d.cts +90 -0
  164. package/dist/index-2iDJohip.d.cts.map +1 -0
  165. package/dist/index-BAqT5tXN.d.ts +90 -0
  166. package/dist/index-BAqT5tXN.d.ts.map +1 -0
  167. package/dist/index-BRbEfXgE.d.ts +78 -0
  168. package/dist/index-BRbEfXgE.d.ts.map +1 -0
  169. package/dist/index-BW7aA5eN.d.cts +25 -0
  170. package/dist/index-BW7aA5eN.d.cts.map +1 -0
  171. package/dist/index-BeiVd-qe.d.ts +124 -0
  172. package/dist/index-BeiVd-qe.d.ts.map +1 -0
  173. package/dist/index-C1KGpD1k.d.ts +49 -0
  174. package/dist/index-C1KGpD1k.d.ts.map +1 -0
  175. package/dist/index-C7cCHEze.d.cts +24 -0
  176. package/dist/index-C7cCHEze.d.cts.map +1 -0
  177. package/dist/index-CKTpYTCC.d.cts +49 -0
  178. package/dist/index-CKTpYTCC.d.cts.map +1 -0
  179. package/dist/index-CN3_TwDL.d.ts +28 -0
  180. package/dist/index-CN3_TwDL.d.ts.map +1 -0
  181. package/dist/index-CNoAqj5I.d.ts +16 -0
  182. package/dist/index-CNoAqj5I.d.ts.map +1 -0
  183. package/dist/index-CTlht6OV.d.cts +432 -0
  184. package/dist/index-CTlht6OV.d.cts.map +1 -0
  185. package/dist/index-CmgSzapt.d.cts +124 -0
  186. package/dist/index-CmgSzapt.d.cts.map +1 -0
  187. package/dist/index-D4WYDN_p.d.cts +28 -0
  188. package/dist/index-D4WYDN_p.d.cts.map +1 -0
  189. package/dist/index-DAJ6KK49.d.ts +25 -0
  190. package/dist/index-DAJ6KK49.d.ts.map +1 -0
  191. package/dist/index-DIiacP_z.d.cts +78 -0
  192. package/dist/index-DIiacP_z.d.cts.map +1 -0
  193. package/dist/index-DR0SOJig.d.ts +291 -0
  194. package/dist/index-DR0SOJig.d.ts.map +1 -0
  195. package/dist/index-DRMauOVH.d.ts +432 -0
  196. package/dist/index-DRMauOVH.d.ts.map +1 -0
  197. package/dist/index-bmmRfGad.d.cts +16 -0
  198. package/dist/index-bmmRfGad.d.cts.map +1 -0
  199. package/dist/index-n9PKZm7W.d.cts +291 -0
  200. package/dist/index-n9PKZm7W.d.cts.map +1 -0
  201. package/dist/index-zu9H7owf.d.ts +24 -0
  202. package/dist/index-zu9H7owf.d.ts.map +1 -0
  203. package/dist/index.cjs +118 -161
  204. package/dist/index.cjs.map +1 -1
  205. package/dist/index.d.cts +20 -24
  206. package/dist/index.d.ts +20 -24
  207. package/dist/index.js +84 -31
  208. package/dist/index.js.map +1 -1
  209. package/dist/theme/ThemeProvider.cjs +8 -28
  210. package/dist/theme/ThemeProvider.d.cts +2 -59
  211. package/dist/theme/ThemeProvider.d.ts +2 -59
  212. package/dist/theme/ThemeProvider.js +3 -3
  213. package/dist/theme/skin.css +46 -1
  214. package/dist/tries-CbbtZkdG.cjs +363 -0
  215. package/dist/{chunk-W6UMY7PF.cjs.map → tries-CbbtZkdG.cjs.map} +1 -1
  216. package/dist/tries-DTHSrLCm.js +310 -0
  217. package/dist/tries-DTHSrLCm.js.map +1 -0
  218. package/dist/types-BOQd93x3.d.cts +994 -0
  219. package/dist/types-BOQd93x3.d.cts.map +1 -0
  220. package/dist/types-HIrgF_mS.d.ts +994 -0
  221. package/dist/types-HIrgF_mS.d.ts.map +1 -0
  222. package/dist/useAiHelp-B-ccDL5Q.js +906 -0
  223. package/dist/useAiHelp-B-ccDL5Q.js.map +1 -0
  224. package/dist/useAiHelp-h9yOLFqt.cjs +995 -0
  225. package/dist/useAiHelp-h9yOLFqt.cjs.map +1 -0
  226. package/dist/useSpeechRecorder--O_f-xvt.cjs +720 -0
  227. package/dist/useSpeechRecorder--O_f-xvt.cjs.map +1 -0
  228. package/dist/useSpeechRecorder-DtAYvl02.d.cts +154 -0
  229. package/dist/useSpeechRecorder-DtAYvl02.d.cts.map +1 -0
  230. package/dist/useSpeechRecorder-DtAYvl02.d.ts +154 -0
  231. package/dist/useSpeechRecorder-DtAYvl02.d.ts.map +1 -0
  232. package/dist/useSpeechRecorder-zIi9Dlw8.js +709 -0
  233. package/dist/useSpeechRecorder-zIi9Dlw8.js.map +1 -0
  234. package/package.json +10 -11
  235. package/dist/WrittenResponse-CgRrjM4S.d.ts +0 -115
  236. package/dist/WrittenResponse-D2K1VW_V.d.cts +0 -115
  237. package/dist/ai/useAiHelp.cjs.map +0 -1
  238. package/dist/ai/useAiHelp.js.map +0 -1
  239. package/dist/chunk-2OP5YHRR.js +0 -543
  240. package/dist/chunk-2OP5YHRR.js.map +0 -1
  241. package/dist/chunk-2TW6WLBC.js +0 -80
  242. package/dist/chunk-2TW6WLBC.js.map +0 -1
  243. package/dist/chunk-4MXECBZT.js +0 -888
  244. package/dist/chunk-4MXECBZT.js.map +0 -1
  245. package/dist/chunk-54DX6SLS.cjs +0 -42
  246. package/dist/chunk-54DX6SLS.cjs.map +0 -1
  247. package/dist/chunk-6GQLCCGN.js +0 -858
  248. package/dist/chunk-6GQLCCGN.js.map +0 -1
  249. package/dist/chunk-6N43WDVG.js +0 -29
  250. package/dist/chunk-6N43WDVG.js.map +0 -1
  251. package/dist/chunk-6RIM5EQP.cjs +0 -393
  252. package/dist/chunk-6RIM5EQP.cjs.map +0 -1
  253. package/dist/chunk-7F2YQWMW.cjs +0 -553
  254. package/dist/chunk-7F2YQWMW.cjs.map +0 -1
  255. package/dist/chunk-B4JRBV56.cjs +0 -63
  256. package/dist/chunk-B4JRBV56.cjs.map +0 -1
  257. package/dist/chunk-B7JU52YQ.cjs +0 -437
  258. package/dist/chunk-B7JU52YQ.cjs.map +0 -1
  259. package/dist/chunk-C4PSJ3ZC.js +0 -329
  260. package/dist/chunk-C4PSJ3ZC.js.map +0 -1
  261. package/dist/chunk-CXIP7ERK.js +0 -389
  262. package/dist/chunk-CXIP7ERK.js.map +0 -1
  263. package/dist/chunk-DPNCCWOV.js +0 -395
  264. package/dist/chunk-DPNCCWOV.js.map +0 -1
  265. package/dist/chunk-DXFCYNST.js +0 -35
  266. package/dist/chunk-DXFCYNST.js.map +0 -1
  267. package/dist/chunk-DZ7VLLDQ.cjs +0 -891
  268. package/dist/chunk-DZ7VLLDQ.cjs.map +0 -1
  269. package/dist/chunk-E4UF4XZM.js +0 -29
  270. package/dist/chunk-E4UF4XZM.js.map +0 -1
  271. package/dist/chunk-ERV666AR.js +0 -435
  272. package/dist/chunk-ERV666AR.js.map +0 -1
  273. package/dist/chunk-FISEZBLF.cjs +0 -31
  274. package/dist/chunk-FISEZBLF.cjs.map +0 -1
  275. package/dist/chunk-HYOUMTPW.js +0 -597
  276. package/dist/chunk-HYOUMTPW.js.map +0 -1
  277. package/dist/chunk-HZIT24BK.js +0 -61
  278. package/dist/chunk-HZIT24BK.js.map +0 -1
  279. package/dist/chunk-IYGF7PZY.cjs +0 -2938
  280. package/dist/chunk-IYGF7PZY.cjs.map +0 -1
  281. package/dist/chunk-J2QIHZ3H.cjs +0 -27
  282. package/dist/chunk-J2QIHZ3H.cjs.map +0 -1
  283. package/dist/chunk-JMEZYYCE.js +0 -2935
  284. package/dist/chunk-JMEZYYCE.js.map +0 -1
  285. package/dist/chunk-K63VPFOV.cjs +0 -134
  286. package/dist/chunk-K63VPFOV.cjs.map +0 -1
  287. package/dist/chunk-KI6DJ5ZF.js +0 -495
  288. package/dist/chunk-KI6DJ5ZF.js.map +0 -1
  289. package/dist/chunk-MCO52PV5.js +0 -520
  290. package/dist/chunk-MCO52PV5.js.map +0 -1
  291. package/dist/chunk-MXZHL4U5.cjs +0 -860
  292. package/dist/chunk-MXZHL4U5.cjs.map +0 -1
  293. package/dist/chunk-NFGUJ52G.cjs +0 -336
  294. package/dist/chunk-NFGUJ52G.cjs.map +0 -1
  295. package/dist/chunk-O7MINPKZ.js +0 -431
  296. package/dist/chunk-O7MINPKZ.js.map +0 -1
  297. package/dist/chunk-OD65OZIW.cjs +0 -159
  298. package/dist/chunk-OD65OZIW.cjs.map +0 -1
  299. package/dist/chunk-OJGTJOWI.cjs +0 -20
  300. package/dist/chunk-OJGTJOWI.cjs.map +0 -1
  301. package/dist/chunk-PGAPZ6UE.cjs +0 -497
  302. package/dist/chunk-PGAPZ6UE.cjs.map +0 -1
  303. package/dist/chunk-PNNUPUH4.cjs +0 -82
  304. package/dist/chunk-PNNUPUH4.cjs.map +0 -1
  305. package/dist/chunk-QAZO3ANW.cjs +0 -433
  306. package/dist/chunk-QAZO3ANW.cjs.map +0 -1
  307. package/dist/chunk-RX3A6KIY.js +0 -17
  308. package/dist/chunk-RX3A6KIY.js.map +0 -1
  309. package/dist/chunk-SHDSOOBF.cjs +0 -826
  310. package/dist/chunk-SHDSOOBF.cjs.map +0 -1
  311. package/dist/chunk-SPSKDNEE.js +0 -824
  312. package/dist/chunk-SPSKDNEE.js.map +0 -1
  313. package/dist/chunk-TGTP5DKF.js +0 -234
  314. package/dist/chunk-TGTP5DKF.js.map +0 -1
  315. package/dist/chunk-U4KTOH7C.js +0 -22
  316. package/dist/chunk-U4KTOH7C.js.map +0 -1
  317. package/dist/chunk-U5VFJVQ2.js +0 -241
  318. package/dist/chunk-U5VFJVQ2.js.map +0 -1
  319. package/dist/chunk-UDCQTOVU.cjs +0 -523
  320. package/dist/chunk-UDCQTOVU.cjs.map +0 -1
  321. package/dist/chunk-UHKZXOXD.js +0 -128
  322. package/dist/chunk-UHKZXOXD.js.map +0 -1
  323. package/dist/chunk-UKUHVCZX.cjs +0 -599
  324. package/dist/chunk-UKUHVCZX.cjs.map +0 -1
  325. package/dist/chunk-VPU6UY4O.cjs +0 -55
  326. package/dist/chunk-VPU6UY4O.cjs.map +0 -1
  327. package/dist/chunk-W6UMY7PF.cjs +0 -251
  328. package/dist/chunk-WZ2TBXVB.cjs +0 -236
  329. package/dist/chunk-WZ2TBXVB.cjs.map +0 -1
  330. package/dist/chunk-XOR4MPEN.cjs +0 -31
  331. package/dist/chunk-XOR4MPEN.cjs.map +0 -1
  332. package/dist/chunk-XS6OYYVR.cjs +0 -397
  333. package/dist/chunk-XS6OYYVR.cjs.map +0 -1
  334. package/dist/chunk-XYJBRKBZ.js +0 -51
  335. package/dist/chunk-XYJBRKBZ.js.map +0 -1
  336. package/dist/chunk-YORQQXGO.js +0 -155
  337. package/dist/chunk-YORQQXGO.js.map +0 -1
  338. package/dist/components/ActivityPreview.cjs.map +0 -1
  339. package/dist/components/ActivityPreview.js.map +0 -1
  340. package/dist/components/ActivitySequence.cjs.map +0 -1
  341. package/dist/components/ActivitySequence.js.map +0 -1
  342. package/dist/components/Dictation.cjs.map +0 -1
  343. package/dist/components/Dictation.js.map +0 -1
  344. package/dist/components/FillInTheBlanks.cjs.map +0 -1
  345. package/dist/components/FillInTheBlanks.js.map +0 -1
  346. package/dist/components/GapSelect.cjs.map +0 -1
  347. package/dist/components/GapSelect.js.map +0 -1
  348. package/dist/components/InteractiveVideo.cjs.map +0 -1
  349. package/dist/components/InteractiveVideo.js.map +0 -1
  350. package/dist/components/MultipleChoice.cjs.map +0 -1
  351. package/dist/components/MultipleChoice.js.map +0 -1
  352. package/dist/components/PronunciationFeedback.cjs.map +0 -1
  353. package/dist/components/PronunciationFeedback.js.map +0 -1
  354. package/dist/components/ReadAloud.cjs.map +0 -1
  355. package/dist/components/ReadAloud.js.map +0 -1
  356. package/dist/components/StimulusPanel.cjs.map +0 -1
  357. package/dist/components/StimulusPanel.js.map +0 -1
  358. package/dist/components/WrittenResponse.cjs.map +0 -1
  359. package/dist/components/WrittenResponse.js.map +0 -1
  360. package/dist/hooks/useSpeechRecorder.cjs.map +0 -1
  361. package/dist/hooks/useSpeechRecorder.js.map +0 -1
  362. package/dist/i18n/LkIntlProvider.cjs.map +0 -1
  363. package/dist/i18n/LkIntlProvider.js.map +0 -1
  364. package/dist/machine-CuwKqWXC.d.cts +0 -26
  365. package/dist/machine-CuwKqWXC.d.ts +0 -26
  366. package/dist/theme/ThemeProvider.cjs.map +0 -1
  367. package/dist/theme/ThemeProvider.js.map +0 -1
  368. package/dist/types-CO0XLEN6.d.cts +0 -973
  369. package/dist/types-CrtIcRcK.d.ts +0 -973
@@ -1,891 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var chunk7F2YQWMW_cjs = require('./chunk-7F2YQWMW.cjs');
5
- var chunkUDCQTOVU_cjs = require('./chunk-UDCQTOVU.cjs');
6
- var chunkOD65OZIW_cjs = require('./chunk-OD65OZIW.cjs');
7
- var chunkVPU6UY4O_cjs = require('./chunk-VPU6UY4O.cjs');
8
- var chunkJ2QIHZ3H_cjs = require('./chunk-J2QIHZ3H.cjs');
9
- var chunkFISEZBLF_cjs = require('./chunk-FISEZBLF.cjs');
10
- var chunk54DX6SLS_cjs = require('./chunk-54DX6SLS.cjs');
11
- var chunkUKUHVCZX_cjs = require('./chunk-UKUHVCZX.cjs');
12
- var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.cjs');
13
- var chunkNFGUJ52G_cjs = require('./chunk-NFGUJ52G.cjs');
14
- var lkCore = require('@intellectif/lk-core');
15
- var react = require('react');
16
- var jsxRuntime = require('react/jsx-runtime');
17
-
18
- // src/components/shared/capture-registry.ts
19
- var groups = /* @__PURE__ */ new Map();
20
- function joinCaptureGroup(group, stop) {
21
- let members = groups.get(group);
22
- if (members === void 0) {
23
- members = /* @__PURE__ */ new Set();
24
- groups.set(group, members);
25
- }
26
- members.add(stop);
27
- return () => {
28
- const current = groups.get(group);
29
- if (current === void 0) {
30
- return;
31
- }
32
- current.delete(stop);
33
- if (current.size === 0) {
34
- groups.delete(group);
35
- }
36
- };
37
- }
38
- function stopCaptureGroup(group) {
39
- const members = groups.get(group);
40
- if (members === void 0) {
41
- return;
42
- }
43
- for (const stop of [...members]) {
44
- stop();
45
- }
46
- }
47
- var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
48
- function readRecordingBounds(recording) {
49
- const bounds = typeof recording === "object" && recording !== null ? recording : {};
50
- const maxSeconds = isNumber(bounds.maxSeconds) && bounds.maxSeconds > 0 ? Math.min(bounds.maxSeconds, lkCore.READ_ALOUD_MAX_SECONDS) : lkCore.READ_ALOUD_MAX_SECONDS;
51
- const minSeconds = isNumber(bounds.minSeconds) && bounds.minSeconds >= 0 && bounds.minSeconds < maxSeconds ? bounds.minSeconds : void 0;
52
- const takes = bounds.maxTakes;
53
- const maxTakes = takes === void 0 || takes === null ? void 0 : isNumber(takes) ? Math.min(Math.max(1, Math.floor(takes)), lkCore.READ_ALOUD_MAX_TAKES) : lkCore.READ_ALOUD_MAX_TAKES;
54
- return { maxSeconds, minSeconds, maxTakes };
55
- }
56
- function secondsWithin(milliseconds, maxSeconds, rounding) {
57
- const seconds = milliseconds / 1e3;
58
- const whole = rounding === "nearest" ? Math.round(seconds) : Math.floor(seconds);
59
- return Math.min(Math.max(0, whole), maxSeconds);
60
- }
61
- var modelsGroupCount = 0;
62
- var VISIBLE_TEXT_RE = /[^\p{White_Space}\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/u;
63
- var MARK_ID_RE = /^w\d+$/;
64
- var STORED_STATES = [
65
- "correct",
66
- "mispronounced",
67
- "omitted"
68
- ];
69
- var LEVEL_STEPS = 10;
70
- function offersRetry(phase, uploaded) {
71
- return phase.kind === "upload-failed" || phase.kind === "assess-failed" && phase.retryable && uploaded !== null;
72
- }
73
- function takeStateOf(phase, uploaded) {
74
- if (phase.kind === "uploading" || phase.kind === "assessing") {
75
- return "in-flight";
76
- }
77
- return offersRetry(phase, uploaded) ? "retryable" : "settled";
78
- }
79
- function capturing(status) {
80
- return status === "recording" || status === "requesting-permission";
81
- }
82
- function readingKeyOf(data, bounds) {
83
- const text = (value) => typeof value === "string" ? value : null;
84
- return JSON.stringify([
85
- text(data.id),
86
- text(data.referenceText),
87
- text(data.locale),
88
- String(bounds.maxSeconds),
89
- String(bounds.minSeconds),
90
- String(bounds.maxTakes)
91
- ]);
92
- }
93
- function slowMediaFor(data, label) {
94
- const slow = data.slowMedia;
95
- if (slow === void 0) {
96
- return void 0;
97
- }
98
- const policy = data.media?.playback ?? {};
99
- const { maxPlays: _budget, ...inherited } = policy;
100
- const hasPolicy = Object.values(inherited).some((value) => value !== void 0);
101
- return {
102
- type: "audio",
103
- url: slow.url,
104
- alt: slow.alt ?? label,
105
- ...hasPolicy ? { playback: inherited } : {}
106
- };
107
- }
108
- function marksFromDetails(details) {
109
- if (details.length === 0 || !details.every((detail) => MARK_ID_RE.test(detail.itemId))) {
110
- return null;
111
- }
112
- return details.map((detail) => {
113
- const heard = Array.isArray(detail.learnerResponse) ? detail.learnerResponse.join(" ") : detail.learnerResponse;
114
- const reference = Array.isArray(detail.correctResponse) ? detail.correctResponse.join(" ") : detail.correctResponse;
115
- const correct = chunk54DX6SLS_cjs.detailIsRight(detail);
116
- const state = correct ? "correct" : detail.outcome === "incorrect-omission" ? "omitted" : "mispronounced";
117
- return {
118
- itemId: detail.itemId,
119
- reference,
120
- heard,
121
- state,
122
- // `ScoringDetail.score` is the word's accuracy divided by 100; the marks
123
- // carry it back in the units the assessment used.
124
- ...typeof detail.score === "number" ? { accuracy: detail.score * 100 } : {}
125
- };
126
- });
127
- }
128
- function recordingOf(response) {
129
- return response !== void 0 && response.type === "read-aloud" ? response.recording : null;
130
- }
131
- function responseOf(recording, takes) {
132
- return { type: "read-aloud", recording, ...takes > 0 ? { takes } : {} };
133
- }
134
- function unscorableMessage(code, s) {
135
- return code === "no_speech" || code === "insufficient_voiced_time" ? s.readAloudNotHeard : s.readAloudNotAssessed;
136
- }
137
- function AnnouncementText({ announcement }) {
138
- if (announcement === null) {
139
- return null;
140
- }
141
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
142
- announcement.text,
143
- announcement.feedback ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
144
- " ",
145
- /* @__PURE__ */ jsxRuntime.jsx("span", { dir: "auto", children: announcement.feedback })
146
- ] }) : null
147
- ] });
148
- }
149
- function OutcomeSummary({
150
- reading,
151
- s,
152
- scoreShown
153
- }) {
154
- switch (reading.kind) {
155
- case "graded":
156
- return /* @__PURE__ */ jsxRuntime.jsx(
157
- "div",
158
- {
159
- className: "lk-ra-outcome",
160
- "data-status": reading.status,
161
- "data-passed": String(reading.grade.passed),
162
- children: scoreShown ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
163
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.scoreAnnouncement(chunk7F2YQWMW_cjs.percentOfGrade(reading.grade), reading.grade.passed) }),
164
- reading.grade.feedback ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade-feedback", dir: "auto", children: reading.grade.feedback }) : null
165
- ] })
166
- }
167
- );
168
- case "deferred":
169
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lk-ra-outcome", "data-status": "deferred", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.awaitingGrade }) });
170
- case "unscorable":
171
- return /* @__PURE__ */ jsxRuntime.jsx(
172
- "div",
173
- {
174
- className: "lk-ra-outcome",
175
- "data-status": "unscorable",
176
- ...reading.code !== void 0 ? { "data-code": reading.code } : {},
177
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.couldNotBeGraded })
178
- }
179
- );
180
- default:
181
- return /* @__PURE__ */ jsxRuntime.jsx(
182
- "div",
183
- {
184
- className: "lk-ra-outcome",
185
- ...reading.status !== void 0 ? { "data-status": reading.status } : {},
186
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.couldNotBeGraded })
187
- }
188
- );
189
- }
190
- }
191
- function ReadAloud({
192
- data,
193
- onComplete,
194
- onSubmit,
195
- onInteraction,
196
- value,
197
- defaultValue,
198
- defaultSubmitted,
199
- renderMode = "practice",
200
- outcome,
201
- mediaBudget,
202
- mediaStrings,
203
- strings,
204
- theme,
205
- locale,
206
- disabled,
207
- recordingBinding,
208
- assessment,
209
- breakThreshold,
210
- monotoneThreshold,
211
- workletUrl,
212
- delivery
213
- }) {
214
- const isExam = renderMode === "exam";
215
- const policy = chunkVPU6UY4O_cjs.useDeliveryPolicy(delivery);
216
- const isReview = renderMode === "review";
217
- const s = chunkNFGUJ52G_cjs.useLkStrings(strings);
218
- const slot = react.useContext(chunkJ2QIHZ3H_cjs.SequenceSlotContext);
219
- const captureGroup = slot?.captureGroup;
220
- const devError = react.useMemo(() => {
221
- if (!chunk54DX6SLS_cjs.isDevelopment()) {
222
- return null;
223
- }
224
- if (data.redacted === true) {
225
- try {
226
- lkCore.assertRedacted(data);
227
- return null;
228
- } catch (error) {
229
- return error instanceof Error ? error : new Error(String(error));
230
- }
231
- }
232
- const result = lkCore.validateActivity("read-aloud", data);
233
- return result.success ? null : new lkCore.ActivitySchemaError("read-aloud", result.errors);
234
- }, [data]);
235
- const { maxSeconds, minSeconds, maxTakes } = readRecordingBounds(data.recording);
236
- const readingKey = readingKeyOf(data, { maxSeconds, minSeconds, maxTakes });
237
- const recorder = chunkUDCQTOVU_cjs.useSpeechRecorder(
238
- react.useMemo(
239
- () => ({
240
- maxDurationMs: maxSeconds * 1e3,
241
- ...minSeconds !== void 0 ? { minDurationMs: minSeconds * 1e3 } : {},
242
- ...maxTakes !== void 0 ? { maxTakes } : {},
243
- // Forwarded, never defaulted: without it the recorder mints its own
244
- // `blob:` module, which is the one a strict policy refuses.
245
- ...workletUrl !== void 0 ? { workletUrl } : {}
246
- }),
247
- [maxSeconds, minSeconds, maxTakes, workletUrl]
248
- )
249
- );
250
- const { state, start, complete, getTimeSpent, reset } = chunkXOR4MPEN_cjs.useActivityState(
251
- defaultSubmitted === true ? "completed" : "idle"
252
- );
253
- const [phase, setPhase] = react.useState({ kind: "idle" });
254
- const [uploaded, setUploaded] = react.useState(null);
255
- const [takeUrl, setTakeUrl] = react.useState(null);
256
- const [playbackUrl, setPlaybackUrl] = react.useState(null);
257
- const [errorNonce, setErrorNonce] = react.useState(0);
258
- const ids = react.useId();
259
- const titleId = `${ids}-title`;
260
- const [modelsGroup] = react.useState(() => {
261
- modelsGroupCount += 1;
262
- return `lk-ra-models-${modelsGroupCount}`;
263
- });
264
- const interactionRef = react.useRef(onInteraction);
265
- interactionRef.current = onInteraction;
266
- const bindingRef = react.useRef(recordingBinding);
267
- bindingRef.current = recordingBinding;
268
- const submittingRef = react.useRef(false);
269
- const runRef = react.useRef(0);
270
- const slotRef = react.useRef(slot);
271
- slotRef.current = slot;
272
- const reportedTakeRef = react.useRef(null);
273
- react.useEffect(
274
- () => () => {
275
- runRef.current += 1;
276
- const take2 = reportedTakeRef.current;
277
- if (take2 !== null) {
278
- slotRef.current?.takeState(take2, "settled");
279
- }
280
- },
281
- []
282
- );
283
- const fire = react.useCallback(
284
- (type, payload) => {
285
- interactionRef.current?.({ type, activityId: data.id, timestamp: Date.now(), payload });
286
- },
287
- [data.id]
288
- );
289
- const lastStatusRef = react.useRef(recorder.status);
290
- react.useEffect(() => {
291
- if (lastStatusRef.current === recorder.status) {
292
- return;
293
- }
294
- lastStatusRef.current = recorder.status;
295
- if (recorder.status === "recording") {
296
- fire("recording-started", { takes: recorder.takesUsed, durationMs: 0 });
297
- } else if (recorder.status === "recorded" && recorder.take !== null) {
298
- fire("recording-stopped", {
299
- takes: recorder.takesUsed,
300
- durationMs: recorder.take.durationMs
301
- });
302
- }
303
- }, [recorder.status, recorder.take, recorder.takesUsed, fire]);
304
- react.useEffect(() => {
305
- if (recorder.error !== null) {
306
- setErrorNonce((nonce) => nonce + 1);
307
- }
308
- }, [recorder.error]);
309
- const take = recorder.take;
310
- react.useEffect(() => {
311
- if (take === null || typeof URL.createObjectURL !== "function") {
312
- return;
313
- }
314
- const url = URL.createObjectURL(take.blob);
315
- setTakeUrl(url);
316
- return () => {
317
- URL.revokeObjectURL(url);
318
- setTakeUrl(null);
319
- };
320
- }, [take]);
321
- const restored = recordingOf(value ?? defaultValue);
322
- const restoredKey = restored?.key ?? null;
323
- react.useEffect(() => {
324
- const binding = bindingRef.current;
325
- if (!isReview || restored === null || binding?.playbackUrl === void 0) {
326
- return;
327
- }
328
- let live = true;
329
- void Promise.resolve(binding.playbackUrl(restored)).then(
330
- (url) => {
331
- if (live) {
332
- setPlaybackUrl(url);
333
- }
334
- },
335
- () => {
336
- }
337
- );
338
- return () => {
339
- live = false;
340
- };
341
- }, [isReview, restoredKey, readingKey]);
342
- const statusRef = react.useRef(recorder.status);
343
- statusRef.current = recorder.status;
344
- const releaseMicrophone = react.useCallback(() => {
345
- if (capturing(statusRef.current)) {
346
- recorder.discard();
347
- }
348
- }, [recorder.discard]);
349
- react.useEffect(() => {
350
- if (captureGroup === void 0) {
351
- return;
352
- }
353
- return joinCaptureGroup(captureGroup, releaseMicrophone);
354
- }, [captureGroup, releaseMicrophone]);
355
- const defaultSubmittedRef = react.useRef(defaultSubmitted);
356
- react.useEffect(() => {
357
- defaultSubmittedRef.current = defaultSubmitted;
358
- }, [defaultSubmitted]);
359
- const lastReadingRef = react.useRef(readingKey);
360
- react.useEffect(() => {
361
- if (lastReadingRef.current === readingKey) {
362
- return;
363
- }
364
- lastReadingRef.current = readingKey;
365
- submittingRef.current = false;
366
- runRef.current += 1;
367
- setPhase({ kind: "idle" });
368
- setUploaded(null);
369
- setPlaybackUrl(null);
370
- recorder.reset();
371
- reset(defaultSubmittedRef.current === true ? "completed" : "idle");
372
- }, [readingKey, reset, recorder.reset]);
373
- const phaseTake = phase.kind === "idle" ? null : phase.take;
374
- const phaseTakeState = takeStateOf(phase, uploaded);
375
- react.useEffect(() => {
376
- const take2 = phaseTake ?? reportedTakeRef.current;
377
- if (slot === null || take2 === null) {
378
- return;
379
- }
380
- reportedTakeRef.current = take2;
381
- slot.takeState(take2, phaseTakeState);
382
- }, [slot, phaseTake, phaseTakeState]);
383
- const modelsRef = react.useRef(null);
384
- const isCapturing = capturing(recorder.status);
385
- react.useEffect(() => {
386
- if (!isCapturing) {
387
- return;
388
- }
389
- const node = modelsRef.current;
390
- if (node === null) {
391
- return;
392
- }
393
- const hush = () => {
394
- for (const media of node.querySelectorAll("audio, video")) {
395
- const element = media;
396
- if (!element.paused) {
397
- element.pause();
398
- }
399
- }
400
- };
401
- hush();
402
- node.addEventListener("play", hush, true);
403
- return () => {
404
- node.removeEventListener("play", hush, true);
405
- };
406
- }, [isCapturing]);
407
- const slowMedia = react.useMemo(
408
- () => slowMediaFor(data, s.readAloudSlowRecording),
409
- [data, s.readAloudSlowRecording]
410
- );
411
- const takeAudio = isReview ? playbackUrl : takeUrl;
412
- const playback = chunk7F2YQWMW_cjs.usePlaybackRefusal(takeAudio);
413
- const submitRef = react.useRef(null);
414
- if (devError) {
415
- throw devError;
416
- }
417
- if (!isReview && recordingBinding?.upload === void 0) {
418
- throw new Error(
419
- `ReadAloud "${data.id}" was rendered in renderMode "${renderMode}" without \`recordingBinding.upload\`. The learner could record a take that is stored nowhere and submitted as nothing, which looks like a working activity the whole way through. Pass a \`recordingBinding\` whose \`upload\` puts the take in your storage and returns its key. \`assess\` is optional: without it the take is still recorded, uploaded and submitted, and a notice replaces the feedback.`
420
- );
421
- }
422
- const submitted = state === "completed";
423
- const inactive = disabled === true || submitted || isReview;
424
- const busy = phase.kind === "uploading" || phase.kind === "assessing";
425
- const takesLeft = maxTakes === void 0 ? void 0 : Math.max(0, maxTakes - recorder.takesUsed);
426
- const raise = (next) => {
427
- setErrorNonce((nonce) => nonce + 1);
428
- setPhase(next);
429
- };
430
- const beginTakeReport = (take2) => {
431
- reportedTakeRef.current = take2;
432
- slot?.takeState(take2, "in-flight");
433
- };
434
- const runAssess = async (ref, current, take2) => {
435
- const assess = bindingRef.current?.assess;
436
- const durationMs = current?.durationMs ?? 0;
437
- const takes = recorder.takesUsed;
438
- const run = runRef.current;
439
- if (assess === void 0) {
440
- setPhase({ kind: "unassessed", take: take2 });
441
- return;
442
- }
443
- setPhase({ kind: "assessing", take: take2 });
444
- fire("assessment-requested", { takes, durationMs });
445
- let answer;
446
- try {
447
- answer = await assess(ref);
448
- } catch {
449
- if (run !== runRef.current) {
450
- return;
451
- }
452
- raise({ kind: "assess-failed", take: take2, retryable: true });
453
- fire("assessment-failed", { takes, durationMs, retryable: true });
454
- return;
455
- }
456
- if (run !== runRef.current) {
457
- return;
458
- }
459
- const result = chunk7F2YQWMW_cjs.readAssessResult(answer);
460
- if (result.status === "failed") {
461
- raise({ kind: "assess-failed", take: take2, retryable: result.retryable });
462
- fire("assessment-failed", { takes, durationMs, retryable: result.retryable });
463
- return;
464
- }
465
- if (result.status === "unscorable") {
466
- setPhase({ kind: "unscorable", take: take2, code: result.code });
467
- fire("assessment-failed", {
468
- takes,
469
- durationMs,
470
- retryable: true,
471
- ...result.code !== void 0 ? { code: result.code } : {}
472
- });
473
- return;
474
- }
475
- const timeSpent = getTimeSpent();
476
- setPhase({ kind: "graded", take: take2, assessment: result.assessment, grade: result.grade });
477
- const grade = result.grade;
478
- if (grade === null) {
479
- fire("assessment-failed", { takes, durationMs, retryable: true });
480
- return;
481
- }
482
- onComplete?.(
483
- chunkJ2QIHZ3H_cjs.stampTake(
484
- {
485
- score: grade.score,
486
- maxScore: grade.maxScore,
487
- passed: grade.passed,
488
- timeSpent,
489
- xapiStatement: lkCore.xAPIBuilder.buildAnsweredStatement({
490
- actor: chunk54DX6SLS_cjs.ANONYMOUS_ACTOR,
491
- object: {
492
- id: chunk54DX6SLS_cjs.objectIdFor(data.id),
493
- name: { [data.locale ?? "en-US"]: data.title },
494
- ...lkCore.xapiDefinitionFor(data)
495
- },
496
- timeSpentMs: timeSpent,
497
- response: result.recognizedText ?? "",
498
- // `ScoringResult.details` is required where `GradeRecord.details` is
499
- // optional, and an empty list is the honest reading of "no per-word
500
- // marks were stored" — never a mark of its own.
501
- scoringResult: {
502
- score: chunk7F2YQWMW_cjs.fractionOfGrade(grade),
503
- maxScore: 1,
504
- passed: grade.passed,
505
- feedback: grade.feedback,
506
- details: grade.details ?? []
507
- }
508
- })
509
- },
510
- take2
511
- )
512
- );
513
- };
514
- const submitTake = async (current) => {
515
- const binding = bindingRef.current;
516
- if (inactive || submittingRef.current || binding === void 0) {
517
- return;
518
- }
519
- submittingRef.current = true;
520
- const takes = recorder.takesUsed;
521
- const run = runRef.current;
522
- const take2 = chunkJ2QIHZ3H_cjs.mintTake();
523
- beginTakeReport(take2);
524
- try {
525
- let ref = null;
526
- if (current !== null) {
527
- setPhase({ kind: "uploading", take: take2 });
528
- try {
529
- ref = await binding.upload(current);
530
- } catch {
531
- if (run !== runRef.current) {
532
- return;
533
- }
534
- raise({ kind: "upload-failed", take: take2 });
535
- fire("recording-upload-failed", {
536
- takes,
537
- durationMs: current.durationMs,
538
- retryable: true
539
- });
540
- return;
541
- }
542
- if (run !== runRef.current) {
543
- return;
544
- }
545
- setUploaded(ref);
546
- fire("recording-uploaded", { takes, durationMs: current.durationMs });
547
- }
548
- onSubmit?.(chunkJ2QIHZ3H_cjs.stampTake(responseOf(ref, takes), take2));
549
- fire("submitted", { takes, durationMs: current?.durationMs ?? 0 });
550
- if (isExam || ref === null) {
551
- complete();
552
- setPhase({ kind: "submitted", take: take2 });
553
- return;
554
- }
555
- await runAssess(ref, current, take2);
556
- } finally {
557
- submittingRef.current = false;
558
- }
559
- };
560
- const retryAssess = async (ref, take2) => {
561
- if (submittingRef.current) {
562
- return;
563
- }
564
- submittingRef.current = true;
565
- beginTakeReport(take2);
566
- try {
567
- await runAssess(ref, recorder.take, take2);
568
- } finally {
569
- submittingRef.current = false;
570
- }
571
- };
572
- const handleSubmit = (event) => {
573
- event.preventDefault();
574
- if (inactive || busy || recorder.take === null || phase.kind !== "idle") {
575
- return;
576
- }
577
- void submitTake(recorder.take);
578
- };
579
- const beginTake = () => {
580
- if (inactive || busy || !recorder.canRecord) {
581
- return;
582
- }
583
- if (recorder.take !== null) {
584
- fire("recording-discarded", {
585
- takes: recorder.takesUsed,
586
- durationMs: recorder.take.durationMs
587
- });
588
- }
589
- setPhase({ kind: "idle" });
590
- setUploaded(null);
591
- start();
592
- void recorder.start();
593
- };
594
- const contentLang = typeof data.locale === "string" ? data.locale : void 0;
595
- const contentDir = chunkOD65OZIW_cjs.localeDirectionOf(data.locale);
596
- const outcomeReading = react.useMemo(() => chunk7F2YQWMW_cjs.readOutcome(outcome), [outcome]);
597
- const keptEvidence = react.useMemo(() => chunk7F2YQWMW_cjs.readEvidence(assessment), [assessment]);
598
- const storedGrade = outcomeReading?.kind === "graded" && outcomeReading.status === "graded" ? outcomeReading.grade : null;
599
- const storedMarks = react.useMemo(
600
- () => policy.feedback && isReview && keptEvidence === null && storedGrade?.details !== void 0 ? marksFromDetails(storedGrade.details) : null,
601
- [policy.feedback, isReview, keptEvidence, storedGrade]
602
- );
603
- const feedbackAssessment = !policy.feedback ? null : isReview ? keptEvidence : phase.kind === "graded" ? phase.assessment : null;
604
- const feedbackGrade = isReview ? storedGrade : phase.kind === "graded" ? phase.grade : null;
605
- const feedbackAudio = playback.refused ? null : takeAudio;
606
- const rootRef = react.useRef(null);
607
- const [panelLostTheGrade, setPanelLostTheGrade] = react.useState(false);
608
- const panelHasGrade = feedbackAssessment !== null && feedbackGrade !== null;
609
- const gradeShownInPanel = panelHasGrade && !panelLostTheGrade;
610
- react.useEffect(() => {
611
- const root = rootRef.current;
612
- const lost = panelHasGrade && (root === null || root.querySelector(".lk-pf-grade") === null);
613
- setPanelLostTheGrade((was) => was === lost ? was : lost);
614
- });
615
- const announcement = react.useMemo(() => {
616
- if (isReview) {
617
- return null;
618
- }
619
- if (recorder.status === "recording") {
620
- return { text: s.readAloudRecordingStarted, feedback: null };
621
- }
622
- const stopped = recorder.status === "recorded" && take !== null ? {
623
- text: s.readAloudRecordingStopped(
624
- secondsWithin(take.durationMs, maxSeconds, "nearest"),
625
- maxSeconds
626
- ),
627
- feedback: null
628
- } : null;
629
- if (isExam) {
630
- if (phase.kind === "submitted" || submitted) {
631
- return { text: s.answerSubmitted, feedback: null };
632
- }
633
- return phase.kind === "idle" ? stopped : null;
634
- }
635
- switch (phase.kind) {
636
- case "graded": {
637
- const grade = phase.grade;
638
- if (grade === null) {
639
- return { text: `${s.answerSubmitted} ${s.couldNotBeGraded}`, feedback: null };
640
- }
641
- if (!policy.feedback) {
642
- return { text: s.answerSubmitted, feedback: null };
643
- }
644
- return {
645
- text: `${s.answerSubmitted} ${s.scoreAnnouncement(chunk7F2YQWMW_cjs.percentOfGrade(grade), grade.passed)}`,
646
- feedback: grade.feedback
647
- };
648
- }
649
- case "unscorable":
650
- return { text: unscorableMessage(phase.code, s), feedback: null };
651
- case "unassessed":
652
- return { text: s.readAloudAssessmentUnavailable, feedback: null };
653
- case "idle":
654
- return stopped;
655
- default:
656
- return null;
657
- }
658
- }, [isReview, isExam, phase, submitted, s, recorder.status, take, maxSeconds, policy.feedback]);
659
- const alertText = recorder.error !== null ? s.readAloudRecorderError(recorder.error) : phase.kind === "upload-failed" ? s.readAloudUploadFailed : phase.kind === "assess-failed" ? s.readAloudAssessmentFailed : null;
660
- return /* @__PURE__ */ jsxRuntime.jsxs(
661
- "form",
662
- {
663
- className: "lk-ra",
664
- ref: rootRef,
665
- "aria-labelledby": VISIBLE_TEXT_RE.test(data.title) ? titleId : void 0,
666
- lang: locale,
667
- "data-render-mode": renderMode,
668
- style: theme,
669
- onSubmit: handleSubmit,
670
- children: [
671
- /* @__PURE__ */ jsxRuntime.jsx("p", { id: titleId, className: "lk-ra-title", dir: contentDir ?? "auto", lang: contentLang, children: data.title }),
672
- typeof data.instructions === "string" && data.instructions !== "" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-instructions", dir: contentDir ?? "auto", lang: contentLang, children: data.instructions }) : null,
673
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-reference", dir: contentDir ?? "auto", lang: contentLang, children: data.referenceText }),
674
- data.media !== void 0 || slowMedia !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-ra-models", ref: modelsRef, children: [
675
- data.media !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-ra-model", children: [
676
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-ra-model-label", children: s.readAloudModelRecording }),
677
- /* @__PURE__ */ jsxRuntime.jsx(
678
- chunkUKUHVCZX_cjs.ActivityMedia,
679
- {
680
- media: data.media,
681
- renderMode,
682
- playbackGroup: modelsGroup,
683
- ...mediaBudget !== void 0 ? { mediaBudget } : {},
684
- ...mediaStrings !== void 0 ? { mediaStrings } : {},
685
- ...strings !== void 0 ? { strings } : {},
686
- ...onInteraction !== void 0 ? { onInteraction } : {},
687
- ...locale !== void 0 ? { locale } : {},
688
- ...disabled === true || isCapturing ? { disabled: true } : {}
689
- }
690
- )
691
- ] }) : null,
692
- slowMedia !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-ra-model", "data-slow": "true", children: [
693
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-ra-model-label", children: s.readAloudSlowRecording }),
694
- /* @__PURE__ */ jsxRuntime.jsx(
695
- chunkUKUHVCZX_cjs.ActivityMedia,
696
- {
697
- media: slowMedia,
698
- renderMode,
699
- playbackGroup: modelsGroup,
700
- ...mediaStrings !== void 0 ? { mediaStrings } : {},
701
- ...strings !== void 0 ? { strings } : {},
702
- ...locale !== void 0 ? { locale } : {},
703
- ...disabled === true || isCapturing ? { disabled: true } : {}
704
- }
705
- )
706
- ] }) : null
707
- ] }) : null,
708
- isReview || submitted ? null : /* @__PURE__ */ jsxRuntime.jsxs(
709
- "div",
710
- {
711
- className: "lk-ra-recorder",
712
- "data-status": recorder.status,
713
- "data-level": recorder.status === "recording" ? Math.min(LEVEL_STEPS, Math.round(recorder.level * LEVEL_STEPS)) : void 0,
714
- children: [
715
- recorder.status === "recording" ? /* @__PURE__ */ jsxRuntime.jsx(
716
- "button",
717
- {
718
- type: "button",
719
- className: "lk-ra-stop",
720
- disabled: inactive,
721
- onClick: () => recorder.stop(),
722
- children: s.readAloudStop
723
- }
724
- ) : (
725
- // aria-disabled, never disabled, once the takes are spent: a
726
- // natively disabled button drops keyboard focus to the page body,
727
- // and this is the control a learner comes back to.
728
- /* @__PURE__ */ jsxRuntime.jsx(
729
- "button",
730
- {
731
- type: "button",
732
- className: "lk-ra-record",
733
- disabled: inactive,
734
- "aria-disabled": !recorder.canRecord || busy || void 0,
735
- onClick: beginTake,
736
- children: recorder.take === null ? s.readAloudRecord : s.readAloudRerecord
737
- }
738
- )
739
- ),
740
- recorder.status === "recording" ? (
741
- // Visible, and hidden from assistive technology, beside the level
742
- // meter the recorder's `data-level` drives. Its text changes every
743
- // whole second, so as a live region it announced ten times in a
744
- // ten-second take — into the microphone. What a screen-reader
745
- // learner needs instead is said once each, below.
746
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-progress", "aria-hidden": "true", children: s.readAloudRecordingProgress(
747
- secondsWithin(recorder.elapsedMs, maxSeconds, "down"),
748
- maxSeconds
749
- ) })
750
- ) : null,
751
- takesLeft !== void 0 && maxTakes !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-takes", children: s.readAloudTakesRemaining(takesLeft, maxTakes) }) : null
752
- ]
753
- }
754
- ),
755
- takeAudio === null ? null : playback.refused ? (
756
- // In the player's place, not beside it: a player the page will not
757
- // load looks exactly like one that works until it is pressed, and then
758
- // does nothing. A note rather than an alert — the learner can still
759
- // submit, and nothing here asks them to act.
760
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-take-unavailable", role: "note", children: s.readAloudPlaybackUnavailable })
761
- ) : (
762
- // biome-ignore lint/a11y/useMediaCaption: the learner's own take has no caption track to offer; its accessible name says whose recording it is
763
- /* @__PURE__ */ jsxRuntime.jsx(
764
- "audio",
765
- {
766
- className: "lk-ra-take",
767
- controls: true,
768
- src: takeAudio,
769
- "aria-label": s.readAloudYourRecording,
770
- onError: (event) => playback.refuse(event.currentTarget),
771
- ...isReview ? {} : { "data-take": recorder.takesUsed }
772
- }
773
- )
774
- ),
775
- isReview || submitted ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-ra-actions", children: [
776
- /* @__PURE__ */ jsxRuntime.jsx(
777
- "button",
778
- {
779
- ref: submitRef,
780
- type: "submit",
781
- className: "lk-ra-submit",
782
- disabled: disabled === true,
783
- "aria-disabled": recorder.take === null || phase.kind !== "idle" || void 0,
784
- "aria-busy": busy || void 0,
785
- children: s.submit
786
- }
787
- ),
788
- isExam ? (
789
- // Explicit, and only here: an exam answer with no recording is a
790
- // decision a learner takes, never something a failed upload does
791
- // for them.
792
- /* @__PURE__ */ jsxRuntime.jsx(
793
- "button",
794
- {
795
- type: "button",
796
- className: "lk-ra-submit-blank",
797
- disabled: inactive,
798
- "aria-disabled": busy || void 0,
799
- onClick: () => {
800
- if (!busy) {
801
- void submitTake(null);
802
- }
803
- },
804
- children: s.readAloudSubmitWithoutRecording
805
- }
806
- )
807
- ) : null,
808
- offersRetry(phase, uploaded) ? /* @__PURE__ */ jsxRuntime.jsx(
809
- "button",
810
- {
811
- type: "button",
812
- className: "lk-ra-retry",
813
- onClick: () => {
814
- submitRef.current?.focus();
815
- if (phase.kind === "upload-failed") {
816
- void submitTake(recorder.take);
817
- } else if (phase.kind === "assess-failed" && uploaded !== null) {
818
- void retryAssess(uploaded, phase.take);
819
- }
820
- },
821
- children: s.readAloudTryAgain
822
- }
823
- ) : null
824
- ] }),
825
- busy ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-pending", role: "status", "aria-busy": "true", children: phase.kind === "uploading" ? s.readAloudUploading : s.readAloudAssessing }) : null,
826
- alertText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-alert", role: "alert", children: alertText }, errorNonce) : null,
827
- feedbackAssessment !== null ? /* @__PURE__ */ jsxRuntime.jsx(
828
- chunk7F2YQWMW_cjs.PronunciationFeedback,
829
- {
830
- data: { referenceText: data.referenceText, locale: data.locale },
831
- assessment: feedbackAssessment,
832
- ...feedbackGrade !== null ? { grade: feedbackGrade } : {},
833
- ...feedbackAudio !== null ? { audioUrl: feedbackAudio } : {},
834
- ...breakThreshold !== void 0 ? { breakThreshold } : {},
835
- ...monotoneThreshold !== void 0 ? { monotoneThreshold } : {},
836
- ...locale !== void 0 ? { locale } : {},
837
- ...strings !== void 0 ? { strings } : {}
838
- }
839
- ) : null,
840
- storedMarks !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-ra-marks", children: [
841
- /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "lk-ra-words", "aria-label": s.pronunciationWordsLabel, dir: contentDir, children: storedMarks.map((entry, index) => {
842
- const sentence = chunk7F2YQWMW_cjs.markSentence(entry, s);
843
- return /* @__PURE__ */ jsxRuntime.jsxs(
844
- "li",
845
- {
846
- className: "lk-ra-word",
847
- "data-state": entry.state,
848
- children: [
849
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunk7F2YQWMW_cjs.VISUALLY_HIDDEN, children: sentence }),
850
- /* @__PURE__ */ jsxRuntime.jsx(
851
- "span",
852
- {
853
- className: "lk-ra-word-text",
854
- "aria-hidden": "true",
855
- dir: contentDir ?? "auto",
856
- lang: contentLang,
857
- children: entry.reference
858
- }
859
- )
860
- ]
861
- },
862
- index
863
- );
864
- }) }),
865
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "lk-ra-legend", children: STORED_STATES.map((state2) => /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": state2, children: s.pronunciationLegend(state2) }, state2)) })
866
- ] }) : null,
867
- /* @__PURE__ */ jsxRuntime.jsx(chunkVPU6UY4O_cjs.FeedbackRegion, { id: `${data.id}-feedback`, children: isReview ? (
868
- // A grade read back is feedback; "not graded yet" and a grade that
869
- // could not be read are not.
870
- outcomeReading !== void 0 && (policy.feedback || outcomeReading.kind !== "graded") ? /* @__PURE__ */ jsxRuntime.jsx(OutcomeSummary, { reading: outcomeReading, s, scoreShown: gradeShownInPanel }) : null
871
- ) : gradeShownInPanel ? (
872
- // Announced, not repeated. A grade the feedback panel is already
873
- // showing would otherwise be read on screen twice, feedback and all —
874
- // but a live region is the only thing that TELLS a screen-reader
875
- // learner a grade arrived, since nothing takes focus. Clipped rather
876
- // than `display: none`, which would stop it being announced at all.
877
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunk7F2YQWMW_cjs.VISUALLY_HIDDEN, children: /* @__PURE__ */ jsxRuntime.jsx(AnnouncementText, { announcement }) })
878
- ) : /* @__PURE__ */ jsxRuntime.jsx(AnnouncementText, { announcement }) })
879
- ]
880
- }
881
- );
882
- }
883
- function ReadAloud2(props) {
884
- const strings = chunkNFGUJ52G_cjs.useLkStrings(props.strings);
885
- return /* @__PURE__ */ jsxRuntime.jsx(chunkFISEZBLF_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(ReadAloud, { ...props }) });
886
- }
887
-
888
- exports.ReadAloud = ReadAloud2;
889
- exports.stopCaptureGroup = stopCaptureGroup;
890
- //# sourceMappingURL=chunk-DZ7VLLDQ.cjs.map
891
- //# sourceMappingURL=chunk-DZ7VLLDQ.cjs.map