@pie-element/ebsr 14.1.0 → 14.1.1-next.2

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 (233) hide show
  1. package/dist/author/defaults.d.ts +67 -0
  2. package/dist/author/defaults.d.ts.map +1 -0
  3. package/dist/author/defaults.js +161 -0
  4. package/dist/author/index.d.ts +35 -0
  5. package/dist/author/index.d.ts.map +1 -0
  6. package/dist/author/index.js +78 -0
  7. package/dist/author/main.d.ts +23 -0
  8. package/dist/author/main.d.ts.map +1 -0
  9. package/dist/author/main.js +121 -0
  10. package/dist/controller/defaults.d.ts +16 -0
  11. package/dist/controller/defaults.d.ts.map +1 -0
  12. package/dist/controller/defaults.js +26 -0
  13. package/dist/controller/index.d.ts +43 -0
  14. package/dist/controller/index.d.ts.map +1 -0
  15. package/dist/controller/index.js +186 -0
  16. package/dist/controller/utils.d.ts +11 -0
  17. package/dist/controller/utils.d.ts.map +1 -0
  18. package/dist/controller/utils.js +8 -0
  19. package/dist/delivery/index.d.ts +27 -0
  20. package/dist/delivery/index.d.ts.map +1 -0
  21. package/dist/delivery/index.js +132 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.iife.d.ts +9 -0
  25. package/dist/index.iife.d.ts.map +1 -0
  26. package/dist/index.iife.js +165 -0
  27. package/dist/index.js +2 -0
  28. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  29. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  30. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  31. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  32. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  33. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  34. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  35. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  36. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  37. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  38. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  39. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  40. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  41. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  42. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  43. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  44. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
  45. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  46. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  47. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  48. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  49. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  50. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  51. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  52. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  53. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  54. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
  73. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  74. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  75. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  76. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  77. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  78. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  79. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  80. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  81. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  82. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  83. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  84. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  85. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  86. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  87. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  88. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  89. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  90. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  91. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  92. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  93. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  94. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  95. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  96. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
  172. package/dist/print/index.d.ts +26 -0
  173. package/dist/print/index.d.ts.map +1 -0
  174. package/dist/print/index.js +107 -0
  175. package/package.json +59 -18
  176. package/{configure/src/defaults.js → src/author/defaults.ts} +10 -0
  177. package/{configure/src/index.js → src/author/index.ts} +16 -6
  178. package/{configure/src/main.jsx → src/author/main.tsx} +14 -4
  179. package/{controller/src/defaults.js → src/controller/defaults.ts} +10 -0
  180. package/{controller/src/index.js → src/controller/index.ts} +13 -3
  181. package/{controller/src/utils.js → src/controller/utils.ts} +10 -0
  182. package/src/{index.js → delivery/index.tsx} +12 -2
  183. package/src/index.iife.ts +16 -0
  184. package/src/index.ts +1 -0
  185. package/src/{print.js → print/index.tsx} +12 -2
  186. package/CHANGELOG.json +0 -1547
  187. package/CHANGELOG.md +0 -2265
  188. package/LICENSE.md +0 -5
  189. package/README.md +0 -62
  190. package/configure/CHANGELOG.json +0 -992
  191. package/configure/CHANGELOG.md +0 -2130
  192. package/configure/lib/defaults.js +0 -229
  193. package/configure/lib/defaults.js.map +0 -1
  194. package/configure/lib/index.js +0 -154
  195. package/configure/lib/index.js.map +0 -1
  196. package/configure/lib/main.js +0 -222
  197. package/configure/lib/main.js.map +0 -1
  198. package/configure/package.json +0 -23
  199. package/configure/src/__tests__/index.test.js +0 -492
  200. package/controller/CHANGELOG.json +0 -552
  201. package/controller/CHANGELOG.md +0 -1269
  202. package/controller/lib/defaults.js +0 -31
  203. package/controller/lib/defaults.js.map +0 -1
  204. package/controller/lib/index.js +0 -448
  205. package/controller/lib/index.js.map +0 -1
  206. package/controller/lib/utils.js +0 -18
  207. package/controller/lib/utils.js.map +0 -1
  208. package/controller/package.json +0 -18
  209. package/controller/src/__tests__/index.test.js +0 -591
  210. package/controller/src/__tests__/utils.test.js +0 -48
  211. package/docs/config-schema.json +0 -5787
  212. package/docs/config-schema.json.md +0 -4278
  213. package/docs/demo/config.js +0 -8
  214. package/docs/demo/generate.js +0 -52
  215. package/docs/demo/index.html +0 -2
  216. package/docs/demo/session.js +0 -14
  217. package/docs/pie-schema.json +0 -2911
  218. package/docs/pie-schema.json.md +0 -2142
  219. package/ebsr.png +0 -0
  220. package/lib/index.js +0 -207
  221. package/lib/index.js.map +0 -1
  222. package/lib/print.js +0 -186
  223. package/lib/print.js.map +0 -1
  224. package/module/configure.js +0 -1
  225. package/module/controller.js +0 -5664
  226. package/module/demo.js +0 -77
  227. package/module/element.js +0 -1
  228. package/module/index.html +0 -21
  229. package/module/manifest.json +0 -14
  230. package/module/print-demo.js +0 -115
  231. package/module/print.html +0 -18
  232. package/module/print.js +0 -1
  233. package/src/__tests__/index.test.js +0 -129
@@ -0,0 +1,186 @@
1
+ import e from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js";
2
+ import t from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js";
3
+ import n from "./defaults.js";
4
+ import { isResponseCorrect as r } from "./utils.js";
5
+ import { getShuffledChoices as i, lockChoices as a, partialScoring as o } from "@pie-element/shared-controller-utils";
6
+ import s from "@pie-lib/translator";
7
+ //#region src/controller/index.ts
8
+ var { translator: c } = s, l = (e, t, n) => (r) => {
9
+ let i = {
10
+ label: r.label,
11
+ value: r.value
12
+ };
13
+ if (t.role === "instructor" && (t.mode === "view" || t.mode === "evaluate") ? i.rationale = e.rationaleEnabled ? r.rationale : null : i.rationale = null, t.mode === "evaluate" && (i.correct = !!r.correct, e.feedbackEnabled)) {
14
+ let e = r.feedback && r.feedback.type || "none";
15
+ e === "default" ? i.feedback = n[r.correct ? "correct" : "incorrect"] : e === "custom" && (i.feedback = r.feedback.value);
16
+ }
17
+ return i;
18
+ }, u = (e, t, n, i) => {
19
+ let a = Object.assign({
20
+ correct: "Correct",
21
+ incorrect: "Incorrect"
22
+ }, e.defaultFeedback), o = e.choices ? e.choices.map(l(e, i, a)) : [];
23
+ return {
24
+ ...e,
25
+ choices: o,
26
+ disabled: i.mode !== "gather",
27
+ complete: { min: e.choices.filter((e) => e.correct).length },
28
+ responseCorrect: i.mode === "evaluate" ? r(e, t, n) : void 0
29
+ };
30
+ }, d = (e, t) => ({
31
+ ...t,
32
+ ...e,
33
+ choicesLayout: e.choicesLayout || e.verticalMode === !1 && "horizontal" || "vertical"
34
+ }), f = ({ partA: e = {}, partB: t = {}, language: r, ...i }) => ({
35
+ ...n,
36
+ ...i,
37
+ partA: d(e, {
38
+ ...n.partA,
39
+ language: r
40
+ }),
41
+ partB: d(t, {
42
+ ...n.partB,
43
+ language: r
44
+ })
45
+ });
46
+ async function p(n, r, o, s) {
47
+ let l = f(n), d = u(l.partA, "partA", r, o), p = u(l.partB, "partB", r, o), m = {}, h = (e) => (t, n, r) => new Promise((t) => {
48
+ m[e] = r.shuffledValues, t();
49
+ }), g = e(r, "value.partA"), _ = a(l.partA, g, o), { choices: v } = d || {}, { choices: y } = p || {};
50
+ !_ && v && v.length && (d.choices = await i(v, { shuffledValues: (r.shuffledValues || {}).partA }, h("partA"), "value"));
51
+ let b = e(r, "value.partB");
52
+ if (!a(l.partB, b, o) && y && y.length && (p.choices = await i(y, { shuffledValues: (r.shuffledValues || {}).partB }, h("partB"), "value")), t(m) || s && typeof s == "function" && s(r.id, r.element, { shuffledValues: m }).catch((e) => {
53
+ console.error("update session failed", e);
54
+ }), l.partLabels) {
55
+ let e = l.language;
56
+ d.partLabel = c.t("ebsr.part", {
57
+ lng: e,
58
+ index: l.partLabelType === "Letters" ? "A" : "1"
59
+ }), p.partLabel = c.t("ebsr.part", {
60
+ lng: e,
61
+ index: l.partLabelType === "Letters" ? "B" : "2"
62
+ });
63
+ } else d.partLabel = void 0, p.partLabel = void 0;
64
+ return o.role === "instructor" && (o.mode === "view" || o.mode === "evaluate") ? (d.teacherInstructions = l.partA.teacherInstructionsEnabled ? l.partA.teacherInstructions : null, p.teacherInstructions = l.partB.teacherInstructionsEnabled ? l.partB.teacherInstructions : null) : (d.teacherInstructions = null, p.teacherInstructions = null), d.prompt = l.partA.promptEnabled ? l.partA.prompt : null, p.prompt = l.partB.promptEnabled ? l.partB.prompt : null, new Promise((e) => {
65
+ e({
66
+ disabled: o.mode !== "gather",
67
+ mode: o.mode,
68
+ extraCSSRules: l.extraCSSRules,
69
+ partA: d,
70
+ partB: p
71
+ });
72
+ });
73
+ }
74
+ var m = (e = {}) => new Promise((t) => {
75
+ t({
76
+ ...n,
77
+ ...e
78
+ });
79
+ }), h = (e) => e.correct === !0, g = (e, t, n, r) => {
80
+ let { choices: i = [] } = e && e[n] || {}, a = i.length, { value: o } = t || {}, s = (e) => !!(o || []).find((t) => t === e.value), c = (e) => h(e) && !s(e), l = (e) => !h(e) && s(e), u = i.reduce((e, t) => c(t) || l(t) ? e - 1 : e, i.length);
81
+ return !r && u < a ? 0 : parseFloat(a ? (u / a).toFixed(2) : 0);
82
+ }, _ = (e, t, n) => {
83
+ let r = [];
84
+ if (!t || !t.value) return r.push("Student did not answer the question."), r;
85
+ let { value: i } = t, { partA: a, partB: s } = i, c = o.enabled(e, n);
86
+ r.push(`Scoring method: ${c ? "partial scoring" : "all-or-nothing scoring"}.`);
87
+ let l = e.partA.choiceMode === "radio" ? "multiple-choice (radio)" : "multiple-select (checkbox)";
88
+ r.push(`Part A question type: ${l}.`);
89
+ let u = a?.value || [], d = (e.partA.choices || []).filter((e) => e.correct).map((e) => e.value), f = u.filter((e) => d.includes(e)), p = u.filter((e) => !d.includes(e));
90
+ u.length && r.push(`Part A: student selected ${u.length} choice(s) (${f.length} correct, ${p.length} incorrect).`);
91
+ let m = g(e, a, "partA", c);
92
+ r.push(`Part A score: ${m}.`);
93
+ let h = e.partB.choiceMode === "radio" ? "multiple-choice (radio)" : "multiple-select (checkbox)";
94
+ r.push(`Part B question type: ${h}.`);
95
+ let _ = s?.value || [], v = (e.partB.choices || []).filter((e) => e.correct).map((e) => e.value), y = _.filter((e) => v.includes(e)), b = _.filter((e) => !v.includes(e));
96
+ _.length && r.push(`Part B: student selected ${_.length} choice(s) (${y.length} correct, ${b.length} incorrect).`);
97
+ let x = g(e, s, "partB", c);
98
+ if (r.push(`Part B score: ${x}.`), !c) r.push("Final score is awarded only if both Part A and Part B are completely correct."), r.push(`Final score: ${m === 1 && x === 1 ? 1 : 0}.`);
99
+ else {
100
+ r.push("With partial scoring enabled, Part A must be correct to earn any credit.");
101
+ let e = 0;
102
+ m === 1 && x === 1 ? e = 2 : m === 1 && x < 1 && (e = 1), r.push(`Final score: ${e}.`);
103
+ }
104
+ return r;
105
+ };
106
+ function v(e, t, n) {
107
+ return new Promise((r) => {
108
+ let { value: i } = t || {};
109
+ if ((!t || !i) && r({
110
+ score: 0,
111
+ scoreA: 0,
112
+ scoreB: 0,
113
+ empty: !0,
114
+ logTrace: ["Student did not answer the question."]
115
+ }), i) {
116
+ let { partA: a, partB: s } = i || {}, c = o.enabled(e, n), l = g(e, a, "partA", c), u = g(e, s, "partB", c), d = _(e, t, n);
117
+ r(c ? l === 1 ? u === 1 ? {
118
+ score: 2,
119
+ scoreA: l,
120
+ scoreB: u,
121
+ max: 2,
122
+ logTrace: d
123
+ } : {
124
+ score: 1,
125
+ scoreA: l,
126
+ scoreB: u,
127
+ max: 2,
128
+ logTrace: d
129
+ } : {
130
+ score: 0,
131
+ scoreA: l,
132
+ scoreB: u,
133
+ max: 2,
134
+ logTrace: d
135
+ } : {
136
+ score: l === 1 && u === 1 ? 1 : 0,
137
+ scoreA: l,
138
+ scoreB: u,
139
+ max: 1,
140
+ logTrace: d
141
+ });
142
+ }
143
+ });
144
+ }
145
+ var y = (e) => {
146
+ let t = [];
147
+ return e.forEach((e) => {
148
+ let { correct: n, value: r } = e;
149
+ n && t.push(r);
150
+ }), t;
151
+ }, b = (e, t) => new Promise((n) => {
152
+ if (t.mode !== "evaluate" && t.role === "instructor") {
153
+ let { partA: t, partB: r } = e, i = y(t.choices), a = y(r.choices);
154
+ n({
155
+ value: {
156
+ partA: {
157
+ id: "partA",
158
+ value: i
159
+ },
160
+ partB: {
161
+ id: "partB",
162
+ value: a
163
+ }
164
+ },
165
+ id: "1"
166
+ });
167
+ } else n(null);
168
+ }), x = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), S = (e = {}, n = {}) => {
169
+ let { choices: r } = e, { minAnswerChoices: i = 2, maxAnswerChoices: a } = n, o = [...r || []].reverse(), s = {}, c = {}, l = {}, u = !1;
170
+ ["teacherInstructions", "prompt"].forEach((t) => {
171
+ n[t]?.required && !x(e[t]) && (s[t] = "This field is required.");
172
+ }), o.forEach((e, t) => {
173
+ let { correct: r, value: i, label: a, rationale: s } = e;
174
+ r && (u = !0), x(a) ? o.slice(t + 1).some((e) => e.label === a) && (c[i] = "Content should be unique.") : c[i] = "Content should not be empty.", n.rationale?.required && !x(s) && (l[i] = "This field is required.");
175
+ });
176
+ let d = (r || []).length;
177
+ return d < i ? s.answerChoices = `There should be at least ${i} choices defined.` : d > a && (s.answerChoices = `No more than ${a} choices should be defined.`), u || (s.correctResponse = "No correct response defined."), t(c) || (s.choices = c), t(l) || (s.rationale = l), s;
178
+ }, C = (e = {}, t = {}) => {
179
+ let { partA: n, partB: r } = e || {}, { partA: i, partB: a } = t || {};
180
+ return {
181
+ partA: S(n, i),
182
+ partB: S(r, a)
183
+ };
184
+ };
185
+ //#endregion
186
+ export { b as createCorrectResponseSession, m as createDefaultModel, _ as getLogTrace, p as model, f as normalize, v as outcome, C as validate };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/ebsr/controller/src/utils.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare const getCorrectResponse: (choices: any) => any;
10
+ export declare const isResponseCorrect: (question: any, key: any, session: any) => any;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/controller/utils.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAIH,eAAO,MAAM,kBAAkB,GAAI,YAAO,QAK/B,CAAC;AAEZ,eAAO,MAAM,iBAAiB,GAAI,aAAQ,EAAE,QAAG,EAAE,YAAO,QAQvD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import e from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js";
2
+ //#region src/controller/utils.ts
3
+ var t = (e) => e && e.filter((e) => e.correct).map((e) => e.value).sort(), n = (n, r, i) => {
4
+ let a = t(n.choices);
5
+ return i && i.value ? e((i.value[r].value || []).sort(), a) : !1;
6
+ };
7
+ //#endregion
8
+ export { n as isResponseCorrect };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/ebsr/src/index.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare const isSessionComplete: (session: any) => boolean;
10
+ export default class Ebsr extends HTMLElement {
11
+ constructor();
12
+ onSessionUpdated: any;
13
+ set model(m: any);
14
+ set session(s: any);
15
+ get session(): any;
16
+ setPartModel(part: any, key: any): void;
17
+ setPartSession(part: any, key: any): void;
18
+ dispatchSessionChanged(partSession: any, key: any): void;
19
+ get partA(): Element | null;
20
+ get partB(): Element | null;
21
+ connectedCallback(): void;
22
+ disconnectedCallback(): void;
23
+ _initPlayerObserver(): void;
24
+ _disconnectPlayerObserver(): void;
25
+ _render(): void;
26
+ }
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delivery/index.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAuBH,eAAO,MAAM,iBAAiB,GAAI,YAAO,YAKxC,CAAC;AAkCF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW;;IAO3C,gBAAgB,EAAE,GAAG,CAmBnB;IAEF,IAAI,KAAK,CAAC,CAAC,KAAA,EAOV;IAED,IAAI,OAAO,CAAC,CAAC,KAAA,EAOZ;IAED,IAAI,OAAO,QAEV;IAED,YAAY,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA;IAkBtB,cAAc,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA;IAOxB,sBAAsB,CAAC,WAAW,KAAA,EAAE,GAAG,KAAA;IAWvC,IAAI,KAAK,mBAER;IAED,IAAI,KAAK,mBAER;IAED,iBAAiB;IAMjB,oBAAoB;IAKpB,mBAAmB;IAanB,yBAAyB;IAOzB,OAAO;CAoCR"}
@@ -0,0 +1,132 @@
1
+ import e from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js";
2
+ import { SessionChangedEvent as t } from "@pie-element/shared-player-events";
3
+ import n from "@pie-element/multiple-choice";
4
+ import r from "debug";
5
+ //#region src/delivery/index.tsx
6
+ var i = t.TYPE, a = "ebsr-multiple-choice", o = r("pie-elements:ebsr"), s = class extends n {};
7
+ customElements.get(a) || customElements.define(a, s);
8
+ var c = (e) => Array.isArray(e) && e.length > 0, l = (t) => {
9
+ let n = e(t, "value.partA.value"), r = e(t, "value.partB.value");
10
+ return c(n) && c(r);
11
+ };
12
+ function u(e) {
13
+ let t = e.closest("pie-player") || e.closest("pie-item-player");
14
+ if (!t) return {
15
+ baseHeadingLevel: void 0,
16
+ includeSrHeading: !0
17
+ };
18
+ let n = (e, n, r) => {
19
+ let i = t[e];
20
+ return i ??= t.getAttribute(n) ?? t.getAttribute(r), i;
21
+ }, r = n("baseHeadingLevel", "base-heading-level", "baseheadinglevel"), i = parseInt(r, 10), a = Number.isFinite(i) && i >= 1 && i <= 6 ? i : void 0, o = n("includeSrHeading", "include-sr-heading", "includesrheading");
22
+ return {
23
+ baseHeadingLevel: a,
24
+ includeSrHeading: o == null ? !0 : o !== !1 && o !== "false"
25
+ };
26
+ }
27
+ var d = class extends HTMLElement {
28
+ constructor() {
29
+ super(), this._model = {}, this._session = {};
30
+ }
31
+ onSessionUpdated = (e) => {
32
+ if (e.target === this) return;
33
+ e.preventDefault(), e.stopImmediatePropagation();
34
+ let t = e.target.getAttribute("id");
35
+ if (t) {
36
+ let n = `part${t.toUpperCase()}`;
37
+ e.update && (this._model[n] = e.update), this.dispatchSessionChanged(e.srcElement._session, n);
38
+ }
39
+ };
40
+ set model(e) {
41
+ this._model = e, customElements.whenDefined(a).then(() => {
42
+ this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB");
43
+ });
44
+ }
45
+ set session(e) {
46
+ this._session = e, customElements.whenDefined(a).then(() => {
47
+ this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB");
48
+ });
49
+ }
50
+ get session() {
51
+ return this._session;
52
+ }
53
+ setPartModel(e, t) {
54
+ if (this._model && this._model[t] && e) {
55
+ let { mode: n } = this._model;
56
+ e.model = {
57
+ ...this._model[t],
58
+ mode: n,
59
+ keyMode: this._model[t].choicePrefix
60
+ };
61
+ let { includeSrHeading: r, baseHeadingLevel: i } = u(this);
62
+ e.includeSrHeading = r, e.baseHeadingLevel = i === void 0 ? void 0 : Math.min(6, i + (r ? 1 : 0));
63
+ }
64
+ }
65
+ setPartSession(e, t) {
66
+ if (this._session && this._model && e) {
67
+ let { value: n } = this._session;
68
+ e.session = n && n[t] ? n[t] : { id: t };
69
+ }
70
+ }
71
+ dispatchSessionChanged(e, n) {
72
+ this._session.value = {
73
+ ...this._session.value,
74
+ [n]: e
75
+ }, o("[onSessionChanged] session: ", this._session);
76
+ let r = l(this._session);
77
+ this.dispatchEvent(new t(this.tagName.toLowerCase(), r));
78
+ }
79
+ get partA() {
80
+ return this.querySelector(`${a}#a`);
81
+ }
82
+ get partB() {
83
+ return this.querySelector(`${a}#b`);
84
+ }
85
+ connectedCallback() {
86
+ this._render(), this._initPlayerObserver(), this.addEventListener(i, this.onSessionUpdated);
87
+ }
88
+ disconnectedCallback() {
89
+ this._disconnectPlayerObserver(), this.removeEventListener(i, this.onSessionUpdated);
90
+ }
91
+ _initPlayerObserver() {
92
+ let e = this.closest("pie-player") || this.closest("pie-item-player");
93
+ e && (this._playerObserver = new MutationObserver(() => {
94
+ this._render();
95
+ }), this._playerObserver.observe(e, {
96
+ attributes: !0,
97
+ attributeFilter: [
98
+ "base-heading-level",
99
+ "baseheadinglevel",
100
+ "include-sr-heading",
101
+ "includesrheading"
102
+ ]
103
+ }));
104
+ }
105
+ _disconnectPlayerObserver() {
106
+ this._playerObserver &&= (this._playerObserver.disconnect(), null);
107
+ }
108
+ _render() {
109
+ this.ariaLabel = "Two-Part Question", this.role = "region";
110
+ let { baseHeadingLevel: e, includeSrHeading: t } = u(this), n = e ? `h${Math.min(6, e)}` : "h2", r = t ? `<${n} class="srOnly">Two-Part Question</${n}>` : "";
111
+ this.innerHTML = `
112
+ <style>
113
+ .srOnly {
114
+ position: absolute;
115
+ width: 1px;
116
+ height: 1px;
117
+ padding: 0;
118
+ margin: -1px;
119
+ overflow: hidden;
120
+ left: -10000px;
121
+ top: auto;
122
+ }
123
+ ${this._model?.extraCSSRules?.rules}
124
+ </style>
125
+ ${r}
126
+ <${a} id="a"></${a}>
127
+ <${a} id="b"></${a}>
128
+ `, customElements.get(a) && (this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB"), this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB"));
129
+ }
130
+ };
131
+ //#endregion
132
+ export { d as default, l as isSessionComplete };
@@ -0,0 +1,2 @@
1
+ export { default } from './delivery/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * IIFE entry point for ebsr element
3
+ * This file is only used for IIFE builds and includes auto-registration
4
+ *
5
+ * @sync-generated - Auto-generated during sync from pie-elements
6
+ */
7
+ import Element from './index.js';
8
+ export default Element;
9
+ //# sourceMappingURL=index.iife.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.iife.d.ts","sourceRoot":"","sources":["../src/index.iife.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,OAAO,MAAM,YAAY,CAAC;AAQjC,eAAe,OAAO,CAAC"}