@pie-element/categorize 13.1.0-next.19 → 13.1.1-next.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 (252) hide show
  1. package/dist/author/defaults.d.ts +223 -0
  2. package/dist/author/defaults.js +170 -0
  3. package/dist/author/design/builder.d.ts +10 -0
  4. package/dist/author/design/builder.js +24 -0
  5. package/dist/author/design/buttons.d.ts +28 -0
  6. package/dist/author/design/buttons.js +36 -0
  7. package/dist/author/design/categories/RowLabel.d.ts +23 -0
  8. package/dist/author/design/categories/RowLabel.js +47 -0
  9. package/dist/author/design/categories/alternateResponses.d.ts +31 -0
  10. package/dist/author/design/categories/alternateResponses.js +62 -0
  11. package/dist/author/design/categories/category.d.ts +44 -0
  12. package/dist/author/design/categories/category.js +98 -0
  13. package/dist/author/design/categories/choice-preview.d.ts +25 -0
  14. package/dist/author/design/categories/choice-preview.js +60 -0
  15. package/dist/author/design/categories/droppable-placeholder.d.ts +11 -0
  16. package/dist/author/design/categories/droppable-placeholder.js +71 -0
  17. package/dist/author/design/categories/index.d.ts +41 -0
  18. package/dist/author/design/categories/index.js +146 -0
  19. package/dist/author/design/choices/choice.d.ts +11 -0
  20. package/dist/author/design/choices/choice.js +129 -0
  21. package/dist/author/design/choices/config.d.ts +21 -0
  22. package/dist/author/design/choices/config.js +33 -0
  23. package/dist/author/design/choices/index.d.ts +41 -0
  24. package/dist/author/design/choices/index.js +110 -0
  25. package/dist/author/design/header.d.ts +24 -0
  26. package/dist/author/design/header.js +49 -0
  27. package/dist/author/design/index.d.ts +52 -0
  28. package/dist/author/design/index.js +417 -0
  29. package/dist/author/design/input-header.d.ts +39 -0
  30. package/dist/author/design/input-header.js +69 -0
  31. package/dist/author/design/utils.d.ts +9 -0
  32. package/dist/author/design/utils.js +7 -0
  33. package/dist/author/index.d.ts +51 -0
  34. package/dist/author/index.js +87 -0
  35. package/dist/author/main.d.ts +23 -0
  36. package/dist/author/main.js +30 -0
  37. package/dist/author/utils.d.ts +16 -0
  38. package/dist/author/utils.js +17 -0
  39. package/dist/controller/defaults.d.ts +34 -0
  40. package/dist/controller/defaults.js +29 -0
  41. package/dist/controller/index.d.ts +61 -0
  42. package/dist/controller/index.js +155 -0
  43. package/dist/controller/utils.d.ts +20 -0
  44. package/dist/controller/utils.js +35 -0
  45. package/dist/delivery/categorize/categories.d.ts +34 -0
  46. package/dist/delivery/categorize/categories.js +66 -0
  47. package/dist/delivery/categorize/category.d.ts +28 -0
  48. package/dist/delivery/categorize/category.js +48 -0
  49. package/dist/delivery/categorize/choice.d.ts +27 -0
  50. package/dist/delivery/categorize/choice.js +94 -0
  51. package/dist/delivery/categorize/choices.d.ts +39 -0
  52. package/dist/delivery/categorize/choices.js +51 -0
  53. package/dist/delivery/categorize/droppable-placeholder.d.ts +32 -0
  54. package/dist/delivery/categorize/droppable-placeholder.js +64 -0
  55. package/dist/delivery/categorize/grid-content.d.ts +25 -0
  56. package/dist/delivery/categorize/grid-content.js +39 -0
  57. package/dist/delivery/categorize/index.d.ts +57 -0
  58. package/dist/delivery/categorize/index.js +260 -0
  59. package/dist/delivery/index.d.ts +27 -0
  60. package/dist/delivery/index.js +152 -0
  61. package/dist/index.d.ts +1 -0
  62. package/dist/index.iife.d.ts +8 -0
  63. package/dist/index.iife.js +152 -0
  64. package/dist/index.js +2 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  174. package/package.json +53 -17
  175. package/CHANGELOG.json +0 -1637
  176. package/CHANGELOG.md +0 -2524
  177. package/LICENSE.md +0 -5
  178. package/README.md +0 -5
  179. package/configure/CHANGELOG.json +0 -1202
  180. package/configure/CHANGELOG.md +0 -2107
  181. package/configure/lib/defaults.js +0 -222
  182. package/configure/lib/defaults.js.map +0 -1
  183. package/configure/lib/design/builder.js +0 -55
  184. package/configure/lib/design/builder.js.map +0 -1
  185. package/configure/lib/design/buttons.js +0 -59
  186. package/configure/lib/design/buttons.js.map +0 -1
  187. package/configure/lib/design/categories/RowLabel.js +0 -66
  188. package/configure/lib/design/categories/RowLabel.js.map +0 -1
  189. package/configure/lib/design/categories/alternateResponses.js +0 -116
  190. package/configure/lib/design/categories/alternateResponses.js.map +0 -1
  191. package/configure/lib/design/categories/category.js +0 -153
  192. package/configure/lib/design/categories/category.js.map +0 -1
  193. package/configure/lib/design/categories/choice-preview.js +0 -79
  194. package/configure/lib/design/categories/choice-preview.js.map +0 -1
  195. package/configure/lib/design/categories/droppable-placeholder.js +0 -93
  196. package/configure/lib/design/categories/droppable-placeholder.js.map +0 -1
  197. package/configure/lib/design/categories/index.js +0 -256
  198. package/configure/lib/design/categories/index.js.map +0 -1
  199. package/configure/lib/design/choices/choice.js +0 -187
  200. package/configure/lib/design/choices/choice.js.map +0 -1
  201. package/configure/lib/design/choices/config.js +0 -58
  202. package/configure/lib/design/choices/config.js.map +0 -1
  203. package/configure/lib/design/choices/index.js +0 -197
  204. package/configure/lib/design/choices/index.js.map +0 -1
  205. package/configure/lib/design/header.js +0 -71
  206. package/configure/lib/design/header.js.map +0 -1
  207. package/configure/lib/design/index.js +0 -727
  208. package/configure/lib/design/index.js.map +0 -1
  209. package/configure/lib/design/input-header.js +0 -105
  210. package/configure/lib/design/input-header.js.map +0 -1
  211. package/configure/lib/design/utils.js +0 -12
  212. package/configure/lib/design/utils.js.map +0 -1
  213. package/configure/lib/index.js +0 -147
  214. package/configure/lib/index.js.map +0 -1
  215. package/configure/lib/main.js +0 -44
  216. package/configure/lib/main.js.map +0 -1
  217. package/configure/lib/utils.js +0 -43
  218. package/configure/lib/utils.js.map +0 -1
  219. package/configure/package.json +0 -32
  220. package/controller/CHANGELOG.json +0 -452
  221. package/controller/CHANGELOG.md +0 -1366
  222. package/controller/lib/defaults.js +0 -33
  223. package/controller/lib/defaults.js.map +0 -1
  224. package/controller/lib/index.js +0 -479
  225. package/controller/lib/index.js.map +0 -1
  226. package/controller/lib/utils.js +0 -69
  227. package/controller/lib/utils.js.map +0 -1
  228. package/controller/package.json +0 -18
  229. package/docs/config-schema.json +0 -2897
  230. package/docs/config-schema.json.md +0 -2138
  231. package/docs/demo/config.js +0 -8
  232. package/docs/demo/generate.js +0 -357
  233. package/docs/demo/index.html +0 -1
  234. package/docs/demo/session.js +0 -12
  235. package/docs/pie-schema.json +0 -1784
  236. package/docs/pie-schema.json.md +0 -1046
  237. package/lib/categorize/categories.js +0 -135
  238. package/lib/categorize/categories.js.map +0 -1
  239. package/lib/categorize/category.js +0 -67
  240. package/lib/categorize/category.js.map +0 -1
  241. package/lib/categorize/choice.js +0 -140
  242. package/lib/categorize/choice.js.map +0 -1
  243. package/lib/categorize/choices.js +0 -99
  244. package/lib/categorize/choices.js.map +0 -1
  245. package/lib/categorize/droppable-placeholder.js +0 -84
  246. package/lib/categorize/droppable-placeholder.js.map +0 -1
  247. package/lib/categorize/grid-content.js +0 -55
  248. package/lib/categorize/grid-content.js.map +0 -1
  249. package/lib/categorize/index.js +0 -450
  250. package/lib/categorize/index.js.map +0 -1
  251. package/lib/index.js +0 -316
  252. package/lib/index.js.map +0 -1
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _utils = require("./utils");
8
- var _default = exports.default = {
9
- allowMultiplePlacementsEnabled: _utils.multiplePlacements.enabled,
10
- alternates: [],
11
- categories: [],
12
- categoriesPerRow: 2,
13
- choices: [],
14
- choicesLabel: '',
15
- choicesPosition: 'below',
16
- correctResponse: [],
17
- feedbackEnabled: false,
18
- lockChoiceOrder: true,
19
- maxAnswerChoices: 6,
20
- maxChoicesPerCategory: 0,
21
- partialScoring: true,
22
- prompt: '',
23
- promptEnabled: true,
24
- rationale: '',
25
- rationaleEnabled: true,
26
- rowLabels: [''],
27
- studentInstructionsEnabled: true,
28
- teacherInstructions: '',
29
- teacherInstructionsEnabled: true,
30
- toolbarEditorPosition: 'bottom',
31
- minRowHeight: '80px'
32
- };
33
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","names":["_utils","require","_default","exports","default","allowMultiplePlacementsEnabled","multiplePlacements","enabled","alternates","categories","categoriesPerRow","choices","choicesLabel","choicesPosition","correctResponse","feedbackEnabled","lockChoiceOrder","maxAnswerChoices","maxChoicesPerCategory","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","rowLabels","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","minRowHeight"],"sources":["../src/defaults.js"],"sourcesContent":["import { multiplePlacements } from './utils';\n\nexport default {\n allowMultiplePlacementsEnabled: multiplePlacements.enabled,\n alternates: [],\n categories: [],\n categoriesPerRow: 2,\n choices: [],\n choicesLabel: '',\n choicesPosition: 'below',\n correctResponse: [],\n feedbackEnabled: false,\n lockChoiceOrder: true,\n maxAnswerChoices: 6,\n maxChoicesPerCategory: 0,\n partialScoring: true,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n rowLabels: [''],\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n minRowHeight: '80px',\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAA6C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9B;EACbC,8BAA8B,EAAEC,yBAAkB,CAACC,OAAO;EAC1DC,UAAU,EAAE,EAAE;EACdC,UAAU,EAAE,EAAE;EACdC,gBAAgB,EAAE,CAAC;EACnBC,OAAO,EAAE,EAAE;EACXC,YAAY,EAAE,EAAE;EAChBC,eAAe,EAAE,OAAO;EACxBC,eAAe,EAAE,EAAE;EACnBC,eAAe,EAAE,KAAK;EACtBC,eAAe,EAAE,IAAI;EACrBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,cAAc,EAAE,IAAI;EACpBC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,IAAI;EACtBC,SAAS,EAAE,CAAC,EAAE,CAAC;EACfC,0BAA0B,EAAE,IAAI;EAChCC,mBAAmB,EAAE,EAAE;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,qBAAqB,EAAE,QAAQ;EAC/BC,YAAY,EAAE;AAChB,CAAC","ignoreList":[]}
@@ -1,479 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.outcome = exports.normalize = exports.model = exports.getTotalScore = exports.getPartialScore = exports.getLogTrace = exports.getCorrectness = exports.createDefaultModel = exports.createCorrectResponseSession = void 0;
8
- Object.defineProperty(exports, "score", {
9
- enumerable: true,
10
- get: function () {
11
- return _categorize.score;
12
- }
13
- });
14
- exports.validate = void 0;
15
- var _lodashEs = require("lodash-es");
16
- var _categorize = require("@pie-lib/categorize");
17
- var _feedback = require("@pie-lib/feedback");
18
- var _controllerUtils = require("@pie-lib/controller-utils");
19
- var _translator = _interopRequireDefault(require("@pie-lib/translator"));
20
- var _defaults = _interopRequireDefault(require("./defaults"));
21
- var _utils = require("./utils");
22
- const {
23
- translator
24
- } = _translator.default;
25
-
26
- // eslint-disable-next-line no-console
27
-
28
- const getPartialScore = (correctResponse, builtCategories) => {
29
- // in the resulted best scenario we make a sum with all the correct responses
30
- // and all the placements
31
- const {
32
- placements,
33
- score
34
- } = builtCategories.reduce((acc, {
35
- choices = []
36
- }) => ({
37
- placements: acc.placements + choices.length,
38
- score: acc.score + choices.filter(ch => ch.correct).length
39
- }), {
40
- placements: 0,
41
- score: 0
42
- });
43
-
44
- // in the correct response, we make a sum of the max possible score
45
- const {
46
- maxScore
47
- } = correctResponse.reduce((acc, {
48
- choices
49
- }) => ({
50
- maxScore: acc.maxScore + choices.length
51
- }), {
52
- maxScore: 0
53
- });
54
-
55
- // if there are any extra placements, we subtract from the obtained score
56
- const extraPlacements = placements > maxScore ? placements - maxScore : 0;
57
- const totalScore = (score - extraPlacements) / maxScore;
58
- return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));
59
- };
60
- exports.getPartialScore = getPartialScore;
61
- const getAlternates = correctResponse => correctResponse.map(c => c.alternateResponses).filter(alternate => alternate);
62
- const getTotalScore = (question, session, env) => {
63
- if (!session) {
64
- return 0;
65
- }
66
- if (Object.keys(session).length === 0) {
67
- return 0;
68
- }
69
- const {
70
- categories,
71
- choices
72
- } = question || {};
73
- let {
74
- correctResponse
75
- } = question || {};
76
- let {
77
- answers
78
- } = session || {};
79
- answers = answers || [];
80
- correctResponse = correctResponse || [];
81
-
82
- // this function is used in pie-ui/categorize as well, in order to get the best scenario
83
- // so we get the best scenario and calculate the score
84
- const {
85
- categories: builtCategories,
86
- correct
87
- } = (0, _categorize.buildState)(categories, choices, answers, correctResponse);
88
- const alternates = getAlternates(correctResponse);
89
- const enabled = _controllerUtils.partialScoring.enabled(question, env);
90
-
91
- // if there are any alternates, there will be no partial scoring!
92
- if (enabled && !alternates.length) {
93
- // we apply partial scoring
94
- return getPartialScore(correctResponse, builtCategories);
95
- }
96
-
97
- // else we apply dichotomous
98
- return correct ? 1 : 0;
99
- };
100
- exports.getTotalScore = getTotalScore;
101
- const getCorrectness = (question, session, env) => {
102
- return new Promise(resolve => {
103
- if (env.mode === 'evaluate') {
104
- const score = getTotalScore(question, session, env);
105
- if (score === 1) {
106
- resolve('correct');
107
- } else if (score === 0) {
108
- resolve('incorrect');
109
- } else {
110
- resolve('partially-correct');
111
- }
112
- } else {
113
- resolve(undefined);
114
- }
115
- });
116
- };
117
- exports.getCorrectness = getCorrectness;
118
- const createDefaultModel = (model = {}) => new Promise(resolve => {
119
- resolve({
120
- ..._defaults.default,
121
- ...model
122
- });
123
- });
124
- exports.createDefaultModel = createDefaultModel;
125
- const normalize = question => ({
126
- ..._defaults.default,
127
- ...question
128
- });
129
-
130
- /**
131
- *
132
- * @param {*} question
133
- * @param {*} session
134
- * @param {*} env
135
- * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
136
- */
137
- exports.normalize = normalize;
138
- const model = async (question, session, env, updateSession) => {
139
- const normalizedQuestion = normalize(question);
140
- const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);
141
- const {
142
- mode,
143
- role
144
- } = env || {};
145
- const {
146
- categories,
147
- categoriesPerRow,
148
- choicesLabel,
149
- choicesPosition,
150
- correctResponse,
151
- feedback,
152
- feedbackEnabled,
153
- promptEnabled,
154
- prompt,
155
- rowLabels,
156
- rationaleEnabled,
157
- rationale,
158
- teacherInstructionsEnabled,
159
- teacherInstructions,
160
- language,
161
- maxChoicesPerCategory,
162
- extraCSSRules,
163
- minRowHeight,
164
- fontSizeFactor,
165
- autoplayAudioEnabled,
166
- completeAudioEnabled,
167
- customAudioButton
168
- } = normalizedQuestion;
169
- let {
170
- choices,
171
- note
172
- } = normalizedQuestion;
173
- let fb;
174
- const lockChoiceOrder = (0, _controllerUtils.lockChoices)(normalizedQuestion, session, env);
175
- const filteredCorrectResponse = correctResponse.map(response => {
176
- const filteredChoices = (response.choices || []).filter(choice => choice !== 'null');
177
- return {
178
- ...response,
179
- choices: filteredChoices
180
- };
181
- });
182
- if (mode === 'evaluate' && feedbackEnabled) {
183
- fb = await (0, _feedback.getFeedbackForCorrectness)(answerCorrectness, feedback);
184
- }
185
- if (!lockChoiceOrder) {
186
- choices = await (0, _controllerUtils.getShuffledChoices)(choices, session, updateSession, 'id');
187
- }
188
- if (!note) {
189
- note = translator.t('common:commonCorrectAnswerWithAlternates', {
190
- lng: language
191
- });
192
- }
193
- const alternates = getAlternates(filteredCorrectResponse);
194
- const {
195
- responseAreasToBeFilled,
196
- possibleResponses,
197
- hasUnplacedChoices
198
- } = (0, _utils.getCompleteResponseDetails)(filteredCorrectResponse, normalizedQuestion.allowAlternateEnabled ? alternates : [], normalizedQuestion.choices);
199
- const out = {
200
- categories: categories || [],
201
- categoriesPerRow: categoriesPerRow || 2,
202
- maxChoicesPerCategory,
203
- correctness: answerCorrectness,
204
- choices: choices || [],
205
- choicesLabel: choicesLabel || '',
206
- choicesPosition,
207
- disabled: mode !== 'gather',
208
- feedback: fb,
209
- lockChoiceOrder,
210
- prompt: promptEnabled ? prompt : null,
211
- rowLabels,
212
- note,
213
- env,
214
- showNote: alternates && alternates.length > 0,
215
- correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,
216
- language,
217
- extraCSSRules,
218
- fontSizeFactor,
219
- minRowHeight: minRowHeight,
220
- autoplayAudioEnabled,
221
- completeAudioEnabled,
222
- customAudioButton,
223
- possibleResponses,
224
- responseAreasToBeFilled,
225
- hasUnplacedChoices
226
- };
227
- if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
228
- out.rationale = rationaleEnabled ? rationale : null;
229
- out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;
230
- } else {
231
- out.rationale = null;
232
- out.teacherInstructions = null;
233
- }
234
- return out;
235
- };
236
-
237
- /**
238
- * Generates detailed trace log for scoring evaluation
239
- * @param {Object} model - the question model
240
- * @param {Object} session - the student session
241
- * @param {Object} env - the environment
242
- * @returns {Array} traceLog - array of trace messages
243
- */
244
- exports.model = model;
245
- const getLogTrace = (model, session, env) => {
246
- const traceLog = [];
247
- const {
248
- answers
249
- } = session || {};
250
- const {
251
- categories,
252
- choices,
253
- correctResponse
254
- } = model || {};
255
- const draggedChoices = answers.reduce((sum, a) => sum + (a.choices?.length || 0), 0);
256
- const alternates = getAlternates(correctResponse);
257
- const hasAlternates = alternates.length > 0;
258
- const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
259
- const builtState = draggedChoices > 0 ? (0, _categorize.buildState)(categories, choices, answers, correctResponse) : null;
260
- const builtCategories = builtState?.categories || [];
261
- if (draggedChoices > 0) {
262
- traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);
263
- (categories || []).forEach((category, categoryIndex) => {
264
- const categoryId = category.id;
265
- const builtCategory = builtCategories.find(c => c.id === categoryId);
266
- const studentChoices = builtCategory ? builtCategory.choices || [] : [];
267
- const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);
268
- const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];
269
- if (expectedChoices.length > 0) {
270
- if (studentChoices.length === 0) {
271
- traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);
272
- } else {
273
- const correctCount = studentChoices.filter(choice => choice.correct).length;
274
- const incorrectCount = studentChoices.length - correctCount;
275
- if (correctCount > 0 && incorrectCount === 0) {
276
- traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);
277
- } else if (correctCount === 0 && incorrectCount > 0) {
278
- traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);
279
- } else {
280
- traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);
281
- }
282
- }
283
- }
284
- });
285
- } else {
286
- traceLog.push('Student did not place any choices into categories.');
287
- }
288
- if (hasAlternates) {
289
- traceLog.push(`Alternate response combinations are accepted for this question.`);
290
- }
291
- if (hasAlternates) {
292
- traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);
293
- traceLog.push(`Student must get all categories completely correct to receive full credit.`);
294
- } else if (partialScoringEnabled) {
295
- traceLog.push(`Score calculated using partial scoring.`);
296
- traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);
297
- if (draggedChoices > 0) {
298
- const totalCorrect = builtCategories.reduce((sum, cat) => sum + (cat.choices || []).filter(choice => choice.correct).length, 0);
299
- const totalIncorrect = draggedChoices - totalCorrect;
300
- const maxPossible = (correctResponse || []).reduce((sum, cat) => sum + (cat.choices || []).length, 0);
301
- traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);
302
- if (draggedChoices > maxPossible) {
303
- const extraPlacements = draggedChoices - maxPossible;
304
- traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);
305
- }
306
- }
307
- } else {
308
- traceLog.push(`Score calculated using all-or-nothing scoring.`);
309
- traceLog.push(`Student must get all categories completely correct to receive full credit.`);
310
- }
311
- const score = getTotalScore(model, session, env);
312
- traceLog.push(`Final score: ${score}.`);
313
- return traceLog;
314
- };
315
- exports.getLogTrace = getLogTrace;
316
- const outcome = (question, session, env) => {
317
- if (env.mode !== 'evaluate') {
318
- return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));
319
- } else {
320
- return new Promise(resolve => {
321
- if (!session || (0, _lodashEs.isEmpty)(session)) {
322
- resolve({
323
- score: 0,
324
- empty: true,
325
- traceLog: ['Student did not place any choices into categories. Score is 0.']
326
- });
327
- } else {
328
- const traceLog = getLogTrace(question, session, env);
329
- const score = getTotalScore(question, session, env);
330
- resolve({
331
- score,
332
- empty: false,
333
- traceLog
334
- });
335
- }
336
- });
337
- }
338
- };
339
- exports.outcome = outcome;
340
- const createCorrectResponseSession = (question, env) => {
341
- return new Promise(resolve => {
342
- const {
343
- mode,
344
- role
345
- } = env || {};
346
- if (mode !== 'evaluate' && role === 'instructor') {
347
- const {
348
- correctResponse
349
- } = question;
350
- resolve({
351
- answers: correctResponse,
352
- id: 1
353
- });
354
- } else {
355
- return resolve(null);
356
- }
357
- });
358
- };
359
-
360
- // remove all html tags
361
- exports.createCorrectResponseSession = createCorrectResponseSession;
362
- const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
363
-
364
- // remove all html tags except img, iframe and source tag for audio
365
- const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
366
- const validate = (model = {}, config = {}) => {
367
- const {
368
- categories,
369
- choices,
370
- correctResponse,
371
- maxAnswerChoices
372
- } = model;
373
- const {
374
- minChoices = 1,
375
- minCategories = 1,
376
- maxCategories = 12,
377
- maxLengthPerChoice = 300,
378
- maxLengthPerCategory = 150
379
- } = config;
380
- const reversedChoices = [...(choices || [])].reverse();
381
- const errors = {};
382
- const choicesErrors = {};
383
- const categoriesErrors = {};
384
- ['teacherInstructions', 'prompt', 'rationale'].forEach(field => {
385
- if (config[field]?.required && !getContent(model[field])) {
386
- errors[field] = 'This field is required.';
387
- }
388
- });
389
- (categories || []).forEach(category => {
390
- const {
391
- id,
392
- label
393
- } = category;
394
- if (getInnerText(label).length > maxLengthPerCategory) {
395
- categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;
396
- }
397
- });
398
- (reversedChoices || []).forEach((choice, index) => {
399
- const {
400
- id,
401
- content
402
- } = choice;
403
- if (getInnerText(content).length > maxLengthPerChoice) {
404
- choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;
405
- }
406
- if (!getContent(content)) {
407
- choicesErrors[id] = 'Tokens should not be empty.';
408
- } else {
409
- const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.content === content);
410
- if (identicalAnswer) {
411
- choicesErrors[id] = 'Tokens content should be unique.';
412
- }
413
- }
414
- });
415
- const nbOfCategories = (categories || []).length;
416
- const nbOfChoices = (choices || []).length;
417
- if (nbOfCategories > maxCategories) {
418
- errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;
419
- } else if (nbOfCategories < minCategories) {
420
- errors.categoriesError = `There should be at least ${minCategories} category defined.`;
421
- }
422
- if (nbOfChoices < minChoices) {
423
- errors.choicesError = `There should be at least ${minChoices} choices defined.`;
424
- } else if (nbOfChoices > maxAnswerChoices) {
425
- errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;
426
- }
427
- if (nbOfChoices && nbOfCategories) {
428
- let hasAssociations = false;
429
- (correctResponse || []).forEach(response => {
430
- const {
431
- choices = [],
432
- alternateResponses = []
433
- } = response;
434
- if (choices.length) {
435
- hasAssociations = true;
436
- } else {
437
- alternateResponses.forEach(alternate => {
438
- if ((alternate || []).length) {
439
- hasAssociations = true;
440
- }
441
- });
442
- }
443
- });
444
- let duplicateAlternateIndex = -1;
445
- let duplicateCategory = '';
446
- (correctResponse || []).forEach(response => {
447
- const {
448
- choices = [],
449
- alternateResponses = [],
450
- category
451
- } = response;
452
- if (duplicateAlternateIndex === -1) {
453
- duplicateAlternateIndex = (0, _utils.isCorrectResponseDuplicated)(choices, alternateResponses);
454
- if (duplicateAlternateIndex === -1) {
455
- duplicateAlternateIndex = (0, _utils.isAlternateDuplicated)(alternateResponses);
456
- }
457
- duplicateCategory = category;
458
- }
459
- });
460
- if (duplicateAlternateIndex > -1) {
461
- errors.duplicateAlternate = {
462
- index: duplicateAlternateIndex,
463
- category: duplicateCategory
464
- };
465
- }
466
- if (!hasAssociations) {
467
- errors.associationError = 'At least one token should be assigned to at least one category.';
468
- }
469
- }
470
- if (!(0, _lodashEs.isEmpty)(choicesErrors)) {
471
- errors.choicesErrors = choicesErrors;
472
- }
473
- if (!(0, _lodashEs.isEmpty)(categoriesErrors)) {
474
- errors.categoriesErrors = categoriesErrors;
475
- }
476
- return errors;
477
- };
478
- exports.validate = validate;
479
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_lodashEs","require","_categorize","_feedback","_controllerUtils","_translator","_interopRequireDefault","_defaults","_utils","translator","Translator","getPartialScore","correctResponse","builtCategories","placements","score","reduce","acc","choices","length","filter","ch","correct","maxScore","extraPlacements","totalScore","parseFloat","toFixed","exports","getAlternates","map","c","alternateResponses","alternate","getTotalScore","question","session","env","Object","keys","categories","answers","buildState","alternates","enabled","partialScoring","getCorrectness","Promise","resolve","mode","undefined","createDefaultModel","model","defaults","normalize","updateSession","normalizedQuestion","answerCorrectness","role","categoriesPerRow","choicesLabel","choicesPosition","feedback","feedbackEnabled","promptEnabled","prompt","rowLabels","rationaleEnabled","rationale","teacherInstructionsEnabled","teacherInstructions","language","maxChoicesPerCategory","extraCSSRules","minRowHeight","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","note","fb","lockChoiceOrder","lockChoices","filteredCorrectResponse","response","filteredChoices","choice","getFeedbackForCorrectness","getShuffledChoices","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","disabled","showNote","getLogTrace","traceLog","draggedChoices","sum","a","hasAlternates","partialScoringEnabled","builtState","push","forEach","category","categoryIndex","categoryId","id","builtCategory","find","studentChoices","correctResponseForCategory","cr","expectedChoices","correctCount","incorrectCount","totalCorrect","cat","totalIncorrect","maxPossible","outcome","reject","Error","isEmpty","empty","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","config","maxAnswerChoices","minChoices","minCategories","maxCategories","maxLengthPerChoice","maxLengthPerCategory","reversedChoices","reverse","errors","choicesErrors","categoriesErrors","field","required","label","index","content","identicalAnswer","slice","some","nbOfCategories","nbOfChoices","categoriesError","choicesError","hasAssociations","duplicateAlternateIndex","duplicateCategory","isCorrectResponseDuplicated","isAlternateDuplicated","duplicateAlternate","associationError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { buildState, score } from '@pie-lib/categorize';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\nimport defaults from './defaults';\nimport { getCompleteResponseDetails, isAlternateDuplicated, isCorrectResponseDuplicated } from './utils';\n\n// eslint-disable-next-line no-console\n\nexport { score };\n\nexport const getPartialScore = (correctResponse, builtCategories) => {\n // in the resulted best scenario we make a sum with all the correct responses\n // and all the placements\n const { placements, score } = builtCategories.reduce(\n (acc, { choices = [] }) => ({\n placements: acc.placements + choices.length,\n score: acc.score + choices.filter((ch) => ch.correct).length,\n }),\n { placements: 0, score: 0 },\n );\n\n // in the correct response, we make a sum of the max possible score\n const { maxScore } = correctResponse.reduce(\n (acc, { choices }) => ({\n maxScore: acc.maxScore + choices.length,\n }),\n { maxScore: 0 },\n );\n\n // if there are any extra placements, we subtract from the obtained score\n const extraPlacements = placements > maxScore ? placements - maxScore : 0;\n const totalScore = (score - extraPlacements) / maxScore;\n\n return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));\n};\n\nconst getAlternates = (correctResponse) =>\n correctResponse.map((c) => c.alternateResponses).filter((alternate) => alternate);\n\nexport const getTotalScore = (question, session, env) => {\n if (!session) {\n return 0;\n }\n\n if (Object.keys(session).length === 0) {\n return 0;\n }\n const { categories, choices } = question || {};\n let { correctResponse } = question || {};\n let { answers } = session || {};\n answers = answers || [];\n correctResponse = correctResponse || [];\n\n // this function is used in pie-ui/categorize as well, in order to get the best scenario\n // so we get the best scenario and calculate the score\n const { categories: builtCategories, correct } = buildState(categories, choices, answers, correctResponse);\n\n const alternates = getAlternates(correctResponse);\n const enabled = partialScoring.enabled(question, env);\n\n // if there are any alternates, there will be no partial scoring!\n if (enabled && !alternates.length) {\n // we apply partial scoring\n return getPartialScore(correctResponse, builtCategories);\n }\n\n // else we apply dichotomous\n return correct ? 1 : 0;\n};\n\nexport const getCorrectness = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode === 'evaluate') {\n const score = getTotalScore(question, session, env);\n if (score === 1) {\n resolve('correct');\n } else if (score === 0) {\n resolve('incorrect');\n } else {\n resolve('partially-correct');\n }\n } else {\n resolve(undefined);\n }\n });\n};\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport const model = async (question, session, env, updateSession) => {\n const normalizedQuestion = normalize(question);\n const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);\n\n const { mode, role } = env || {};\n\n const {\n categories,\n categoriesPerRow,\n choicesLabel,\n choicesPosition,\n correctResponse,\n feedback,\n feedbackEnabled,\n promptEnabled,\n prompt,\n rowLabels,\n rationaleEnabled,\n rationale,\n teacherInstructionsEnabled,\n teacherInstructions,\n language,\n maxChoicesPerCategory,\n extraCSSRules,\n minRowHeight,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n let { choices, note } = normalizedQuestion;\n let fb;\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n const filteredCorrectResponse = correctResponse.map((response) => {\n const filteredChoices = (response.choices || []).filter((choice) => choice !== 'null');\n return { ...response, choices: filteredChoices };\n });\n\n if (mode === 'evaluate' && feedbackEnabled) {\n fb = await getFeedbackForCorrectness(answerCorrectness, feedback);\n }\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n if (!note) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: language });\n }\n\n const alternates = getAlternates(filteredCorrectResponse);\n const { responseAreasToBeFilled, possibleResponses, hasUnplacedChoices } = getCompleteResponseDetails(\n filteredCorrectResponse,\n normalizedQuestion.allowAlternateEnabled ? alternates : [],\n normalizedQuestion.choices,\n );\n const out = {\n categories: categories || [],\n categoriesPerRow: categoriesPerRow || 2,\n maxChoicesPerCategory,\n correctness: answerCorrectness,\n choices: choices || [],\n choicesLabel: choicesLabel || '',\n choicesPosition,\n disabled: mode !== 'gather',\n feedback: fb,\n lockChoiceOrder,\n prompt: promptEnabled ? prompt : null,\n rowLabels,\n note,\n env,\n showNote: alternates && alternates.length > 0,\n correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,\n language,\n extraCSSRules,\n fontSizeFactor,\n minRowHeight: minRowHeight,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n possibleResponses,\n responseAreasToBeFilled,\n hasUnplacedChoices,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = rationaleEnabled ? rationale : null;\n out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\n};\n\n /**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { answers } = session || {};\n const { categories, choices, correctResponse } = model || {};\n\n const draggedChoices = answers.reduce(\n (sum, a) => sum + (a.choices?.length || 0),\n 0\n );\n\n const alternates = getAlternates(correctResponse);\n const hasAlternates = alternates.length > 0;\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n const builtState =\n draggedChoices > 0\n ? buildState(categories, choices, answers, correctResponse)\n : null;\n\n const builtCategories = builtState?.categories || [];\n \n if (draggedChoices > 0) {\n traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);\n \n (categories || []).forEach((category, categoryIndex) => {\n const categoryId = category.id;\n const builtCategory = builtCategories.find(c => c.id === categoryId);\n const studentChoices = builtCategory ? builtCategory.choices || [] : [];\n const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);\n const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];\n \n if (expectedChoices.length > 0) {\n if (studentChoices.length === 0) {\n traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);\n } else {\n const correctCount = studentChoices.filter(choice => choice.correct).length;\n const incorrectCount = studentChoices.length - correctCount;\n \n if (correctCount > 0 && incorrectCount === 0) {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);\n } else if (correctCount === 0 && incorrectCount > 0) {\n traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);\n } else {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);\n }\n }\n }\n });\n } else {\n traceLog.push('Student did not place any choices into categories.');\n }\n\n if (hasAlternates) {\n traceLog.push(`Alternate response combinations are accepted for this question.`);\n }\n\n if (hasAlternates) {\n traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n } else if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);\n \n if (draggedChoices > 0) {\n const totalCorrect = builtCategories.reduce((sum, cat) => \n sum + (cat.choices || []).filter(choice => choice.correct).length, 0);\n const totalIncorrect = draggedChoices - totalCorrect;\n const maxPossible = (correctResponse || []).reduce((sum, cat) => \n sum + (cat.choices || []).length, 0);\n \n traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);\n \n if (draggedChoices > maxPossible) {\n const extraPlacements = draggedChoices - maxPossible;\n traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);\n }\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n }\n\n const score = getTotalScore(model, session, env);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\nexport const outcome = (question, session, env) => {\n if (env.mode !== 'evaluate') {\n return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));\n } else {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not place any choices into categories. Score is 0.'],\n });\n } else {\n const traceLog = getLogTrace(question, session, env);\n const score = getTotalScore(question, session, env);\n \n resolve({\n score,\n empty: false,\n traceLog,\n });\n }\n });\n }\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n const { mode, role } = env || {};\n\n if (mode !== 'evaluate' && role === 'instructor') {\n const { correctResponse } = question;\n\n resolve({ answers: correctResponse, id: 1 });\n } else {\n return resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { categories, choices, correctResponse, maxAnswerChoices } = model;\n const {\n minChoices = 1,\n minCategories = 1,\n maxCategories = 12,\n maxLengthPerChoice = 300,\n maxLengthPerCategory = 150,\n } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const categoriesErrors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n (categories || []).forEach((category) => {\n const { id, label } = category;\n\n if (getInnerText(label).length > maxLengthPerCategory) {\n categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;\n }\n });\n\n (reversedChoices || []).forEach((choice, index) => {\n const { id, content } = choice;\n\n if (getInnerText(content).length > maxLengthPerChoice) {\n choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;\n }\n\n if (!getContent(content)) {\n choicesErrors[id] = 'Tokens should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.content === content);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Tokens content should be unique.';\n }\n }\n });\n\n const nbOfCategories = (categories || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfCategories > maxCategories) {\n errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;\n } else if (nbOfCategories < minCategories) {\n errors.categoriesError = `There should be at least ${minCategories} category defined.`;\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (nbOfChoices && nbOfCategories) {\n let hasAssociations = false;\n\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [] } = response;\n\n if (choices.length) {\n hasAssociations = true;\n } else {\n alternateResponses.forEach((alternate) => {\n if ((alternate || []).length) {\n hasAssociations = true;\n }\n });\n }\n });\n\n let duplicateAlternateIndex = -1;\n let duplicateCategory = '';\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [], category } = response;\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isCorrectResponseDuplicated(choices, alternateResponses);\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isAlternateDuplicated(alternateResponses);\n }\n\n duplicateCategory = category;\n }\n });\n\n if (duplicateAlternateIndex > -1) {\n errors.duplicateAlternate = { index: duplicateAlternateIndex, category: duplicateCategory };\n }\n\n if (!hasAssociations) {\n errors.associationError = 'At least one token should be assigned to at least one category.';\n }\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n if (!isEmpty(categoriesErrors)) {\n errors.categoriesErrors = categoriesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAGA,IAAAM,SAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAFA,MAAM;EAAEQ;AAAW,CAAC,GAAGC,mBAAU;;AAIjC;;AAIO,MAAMC,eAAe,GAAGA,CAACC,eAAe,EAAEC,eAAe,KAAK;EACnE;EACA;EACA,MAAM;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGF,eAAe,CAACG,MAAM,CAClD,CAACC,GAAG,EAAE;IAAEC,OAAO,GAAG;EAAG,CAAC,MAAM;IAC1BJ,UAAU,EAAEG,GAAG,CAACH,UAAU,GAAGI,OAAO,CAACC,MAAM;IAC3CJ,KAAK,EAAEE,GAAG,CAACF,KAAK,GAAGG,OAAO,CAACE,MAAM,CAAEC,EAAE,IAAKA,EAAE,CAACC,OAAO,CAAC,CAACH;EACxD,CAAC,CAAC,EACF;IAAEL,UAAU,EAAE,CAAC;IAAEC,KAAK,EAAE;EAAE,CAC5B,CAAC;;EAED;EACA,MAAM;IAAEQ;EAAS,CAAC,GAAGX,eAAe,CAACI,MAAM,CACzC,CAACC,GAAG,EAAE;IAAEC;EAAQ,CAAC,MAAM;IACrBK,QAAQ,EAAEN,GAAG,CAACM,QAAQ,GAAGL,OAAO,CAACC;EACnC,CAAC,CAAC,EACF;IAAEI,QAAQ,EAAE;EAAE,CAChB,C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ports.multiplePlacements = exports.isCorrectResponseDuplicated = exports.isAlternateDuplicated = exports.getCompleteResponseDetails = void 0;
7
- // used in configure too, for consistency modify it there too
8
- const multiplePlacements = exports.multiplePlacements = {
9
- enabled: 'Yes',
10
- disabled: 'No',
11
- perChoice: 'Set Per Choice'
12
- };
13
-
14
- // used to validate the config
15
- const isCorrectResponseDuplicated = (choices, alternate) => {
16
- if (choices.length < 1 || alternate.length < 1) {
17
- return -1;
18
- }
19
- const stringChoices = JSON.stringify(choices.sort());
20
- const stringAlternate = alternate.reduce((total, current) => current.length > 0 ? [...total, JSON.stringify(current.sort())] : total, []);
21
- const foundIndexDuplicate = stringAlternate.findIndex(alternate => alternate.length && alternate === stringChoices);
22
- return foundIndexDuplicate;
23
- };
24
- exports.isCorrectResponseDuplicated = isCorrectResponseDuplicated;
25
- const isAlternateDuplicated = alternate => {
26
- if (alternate.length <= 1) {
27
- return -1;
28
- }
29
- const elementSet = new Set();
30
- const stringAlternate = alternate.reduce((total, current) => current.length > 0 ? [...total, JSON.stringify(current.sort())] : total, []);
31
- for (let i = 0; i < stringAlternate.length; i++) {
32
- if (elementSet.has(stringAlternate[i]) && stringAlternate[i]) {
33
- return i;
34
- }
35
- elementSet.add(stringAlternate[i]);
36
- }
37
- return -1;
38
- };
39
-
40
- // calculate the minimum number of populated response areas (categories) in the correct answer or alternates
41
- // and create an array with the possible responses ids
42
- exports.isAlternateDuplicated = isAlternateDuplicated;
43
- const getCompleteResponseDetails = (correctResponse, alternates, allChoices) => {
44
- const choicesPerCategory = correctResponse.map(category => category.choices);
45
- const possibleResponses = [choicesPerCategory.flat()];
46
- let responseAreasToBeFilled = choicesPerCategory.filter(choices => choices.length).length;
47
- if (alternates.length) {
48
- const alternatesPerChoice = alternates[0]?.length || 0; // number of alternates
49
-
50
- [...Array(alternatesPerChoice).keys()].forEach(index => {
51
- const alternatesPerResponse = alternates.map(alternate => alternate[index]);
52
- const filledCategories = alternatesPerResponse.filter(category => category?.length).length;
53
- possibleResponses.push(alternatesPerResponse.flat());
54
- if (filledCategories < responseAreasToBeFilled) {
55
- responseAreasToBeFilled = filledCategories;
56
- }
57
- });
58
- }
59
-
60
- // check if any correct answer have any unplaced answer choices
61
- const hasUnplacedChoices = possibleResponses.some(response => !allChoices.every(val => response.includes(val?.id)));
62
- return {
63
- responseAreasToBeFilled,
64
- possibleResponses,
65
- hasUnplacedChoices
66
- };
67
- };
68
- exports.getCompleteResponseDetails = getCompleteResponseDetails;
69
- //# sourceMappingURL=utils.js.map