@pie-element/categorize 13.1.1-next.0 → 13.1.1-next.101

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/CHANGELOG.json +1637 -0
  2. package/CHANGELOG.md +2532 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +5 -0
  5. package/configure/CHANGELOG.json +1202 -0
  6. package/configure/CHANGELOG.md +2115 -0
  7. package/configure/lib/defaults.js +220 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/design/builder.js +55 -0
  10. package/configure/lib/design/builder.js.map +1 -0
  11. package/configure/lib/design/buttons.js +59 -0
  12. package/configure/lib/design/buttons.js.map +1 -0
  13. package/configure/lib/design/categories/RowLabel.js +66 -0
  14. package/configure/lib/design/categories/RowLabel.js.map +1 -0
  15. package/configure/lib/design/categories/alternateResponses.js +116 -0
  16. package/configure/lib/design/categories/alternateResponses.js.map +1 -0
  17. package/configure/lib/design/categories/category.js +153 -0
  18. package/configure/lib/design/categories/category.js.map +1 -0
  19. package/configure/lib/design/categories/choice-preview.js +79 -0
  20. package/configure/lib/design/categories/choice-preview.js.map +1 -0
  21. package/configure/lib/design/categories/droppable-placeholder.js +93 -0
  22. package/configure/lib/design/categories/droppable-placeholder.js.map +1 -0
  23. package/configure/lib/design/categories/index.js +256 -0
  24. package/configure/lib/design/categories/index.js.map +1 -0
  25. package/configure/lib/design/choices/choice.js +187 -0
  26. package/configure/lib/design/choices/choice.js.map +1 -0
  27. package/configure/lib/design/choices/config.js +58 -0
  28. package/configure/lib/design/choices/config.js.map +1 -0
  29. package/configure/lib/design/choices/index.js +197 -0
  30. package/configure/lib/design/choices/index.js.map +1 -0
  31. package/configure/lib/design/header.js +71 -0
  32. package/configure/lib/design/header.js.map +1 -0
  33. package/configure/lib/design/index.js +741 -0
  34. package/configure/lib/design/index.js.map +1 -0
  35. package/configure/lib/design/input-header.js +105 -0
  36. package/configure/lib/design/input-header.js.map +1 -0
  37. package/configure/lib/design/utils.js +12 -0
  38. package/configure/lib/design/utils.js.map +1 -0
  39. package/configure/lib/index.js +148 -0
  40. package/configure/lib/index.js.map +1 -0
  41. package/configure/lib/main.js +44 -0
  42. package/configure/lib/main.js.map +1 -0
  43. package/configure/lib/utils.js +43 -0
  44. package/configure/lib/utils.js.map +1 -0
  45. package/configure/package.json +32 -0
  46. package/controller/CHANGELOG.json +452 -0
  47. package/controller/CHANGELOG.md +1373 -0
  48. package/controller/lib/defaults.js +31 -0
  49. package/controller/lib/defaults.js.map +1 -0
  50. package/controller/lib/index.js +506 -0
  51. package/controller/lib/index.js.map +1 -0
  52. package/controller/lib/utils.js +69 -0
  53. package/controller/lib/utils.js.map +1 -0
  54. package/controller/package.json +18 -0
  55. package/docs/config-schema.json +2897 -0
  56. package/docs/config-schema.json.md +2138 -0
  57. package/docs/demo/config.js +8 -0
  58. package/docs/demo/generate.js +357 -0
  59. package/docs/demo/index.html +1 -0
  60. package/docs/demo/session.js +12 -0
  61. package/docs/pie-schema.json +1784 -0
  62. package/docs/pie-schema.json.md +1046 -0
  63. package/lib/categorize/categories.js +135 -0
  64. package/lib/categorize/categories.js.map +1 -0
  65. package/lib/categorize/category.js +67 -0
  66. package/lib/categorize/category.js.map +1 -0
  67. package/lib/categorize/choice.js +140 -0
  68. package/lib/categorize/choice.js.map +1 -0
  69. package/lib/categorize/choices.js +99 -0
  70. package/lib/categorize/choices.js.map +1 -0
  71. package/lib/categorize/droppable-placeholder.js +84 -0
  72. package/lib/categorize/droppable-placeholder.js.map +1 -0
  73. package/lib/categorize/grid-content.js +55 -0
  74. package/lib/categorize/grid-content.js.map +1 -0
  75. package/lib/categorize/index.js +450 -0
  76. package/lib/categorize/index.js.map +1 -0
  77. package/lib/index.js +316 -0
  78. package/lib/index.js.map +1 -0
  79. package/package.json +21 -57
  80. package/dist/author/defaults.d.ts +0 -223
  81. package/dist/author/defaults.js +0 -170
  82. package/dist/author/design/builder.d.ts +0 -10
  83. package/dist/author/design/builder.js +0 -24
  84. package/dist/author/design/buttons.d.ts +0 -28
  85. package/dist/author/design/buttons.js +0 -36
  86. package/dist/author/design/categories/RowLabel.d.ts +0 -23
  87. package/dist/author/design/categories/RowLabel.js +0 -47
  88. package/dist/author/design/categories/alternateResponses.d.ts +0 -31
  89. package/dist/author/design/categories/alternateResponses.js +0 -62
  90. package/dist/author/design/categories/category.d.ts +0 -44
  91. package/dist/author/design/categories/category.js +0 -98
  92. package/dist/author/design/categories/choice-preview.d.ts +0 -25
  93. package/dist/author/design/categories/choice-preview.js +0 -60
  94. package/dist/author/design/categories/droppable-placeholder.d.ts +0 -11
  95. package/dist/author/design/categories/droppable-placeholder.js +0 -71
  96. package/dist/author/design/categories/index.d.ts +0 -41
  97. package/dist/author/design/categories/index.js +0 -146
  98. package/dist/author/design/choices/choice.d.ts +0 -11
  99. package/dist/author/design/choices/choice.js +0 -129
  100. package/dist/author/design/choices/config.d.ts +0 -21
  101. package/dist/author/design/choices/config.js +0 -33
  102. package/dist/author/design/choices/index.d.ts +0 -41
  103. package/dist/author/design/choices/index.js +0 -110
  104. package/dist/author/design/header.d.ts +0 -24
  105. package/dist/author/design/header.js +0 -49
  106. package/dist/author/design/index.d.ts +0 -52
  107. package/dist/author/design/index.js +0 -417
  108. package/dist/author/design/input-header.d.ts +0 -39
  109. package/dist/author/design/input-header.js +0 -69
  110. package/dist/author/design/utils.d.ts +0 -9
  111. package/dist/author/design/utils.js +0 -7
  112. package/dist/author/index.d.ts +0 -51
  113. package/dist/author/index.js +0 -87
  114. package/dist/author/main.d.ts +0 -23
  115. package/dist/author/main.js +0 -30
  116. package/dist/author/utils.d.ts +0 -16
  117. package/dist/author/utils.js +0 -17
  118. package/dist/controller/defaults.d.ts +0 -34
  119. package/dist/controller/defaults.js +0 -29
  120. package/dist/controller/index.d.ts +0 -61
  121. package/dist/controller/index.js +0 -155
  122. package/dist/controller/utils.d.ts +0 -20
  123. package/dist/controller/utils.js +0 -35
  124. package/dist/delivery/categorize/categories.d.ts +0 -34
  125. package/dist/delivery/categorize/categories.js +0 -66
  126. package/dist/delivery/categorize/category.d.ts +0 -28
  127. package/dist/delivery/categorize/category.js +0 -48
  128. package/dist/delivery/categorize/choice.d.ts +0 -27
  129. package/dist/delivery/categorize/choice.js +0 -94
  130. package/dist/delivery/categorize/choices.d.ts +0 -39
  131. package/dist/delivery/categorize/choices.js +0 -51
  132. package/dist/delivery/categorize/droppable-placeholder.d.ts +0 -32
  133. package/dist/delivery/categorize/droppable-placeholder.js +0 -64
  134. package/dist/delivery/categorize/grid-content.d.ts +0 -25
  135. package/dist/delivery/categorize/grid-content.js +0 -39
  136. package/dist/delivery/categorize/index.d.ts +0 -57
  137. package/dist/delivery/categorize/index.js +0 -260
  138. package/dist/delivery/index.d.ts +0 -27
  139. package/dist/delivery/index.js +0 -152
  140. package/dist/index.d.ts +0 -1
  141. package/dist/index.iife.d.ts +0 -8
  142. package/dist/index.iife.js +0 -152
  143. package/dist/index.js +0 -2
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  174. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  175. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  176. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  177. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  178. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  179. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  180. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  181. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  182. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  183. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  184. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  185. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  186. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  187. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  188. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  189. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  190. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  191. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  192. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  193. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  194. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  195. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  196. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  197. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  198. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  199. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  200. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  201. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  202. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  203. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  204. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  205. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  206. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  207. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  208. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  209. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  210. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  211. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  212. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  213. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  214. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  215. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  216. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  217. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  218. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  219. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  220. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  221. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  222. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  223. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  224. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  225. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  226. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  227. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  228. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  229. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  230. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  231. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  232. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  233. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  234. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  235. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  236. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  237. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  238. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  239. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  240. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  241. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  242. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  243. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  244. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  245. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  246. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  247. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  248. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  249. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  250. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  251. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  252. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ alternates: [],
9
+ categories: [],
10
+ categoriesPerRow: 2,
11
+ choices: [],
12
+ choicesLabel: '',
13
+ choicesPosition: 'below',
14
+ correctResponse: [],
15
+ feedbackEnabled: false,
16
+ lockChoiceOrder: true,
17
+ maxAnswerChoices: 6,
18
+ maxChoicesPerCategory: 0,
19
+ partialScoring: true,
20
+ prompt: '',
21
+ promptEnabled: true,
22
+ rationale: '',
23
+ rationaleEnabled: true,
24
+ rowLabels: [''],
25
+ studentInstructionsEnabled: true,
26
+ teacherInstructions: '',
27
+ teacherInstructionsEnabled: true,
28
+ toolbarEditorPosition: 'bottom',
29
+ minRowHeight: '80px'
30
+ };
31
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","names":["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":["export default {\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":";;;;;;iCAAe;EACbA,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":[]}
@@ -0,0 +1,506 @@
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
+ const resolvedAllowMultiple = (() => {
189
+ if (question.allowMultiplePlacementsEnabled != null) {
190
+ return question.allowMultiplePlacementsEnabled;
191
+ }
192
+ // Derive from correct response: if any choice id appears in more than one category, reuse is required
193
+ const allChoiceIds = (correctResponse || []).flatMap(cr => cr.choices || []);
194
+ const isExclusive = allChoiceIds.length === new Set(allChoiceIds).size;
195
+ return isExclusive ? _utils.multiplePlacements.disabled : _utils.multiplePlacements.enabled;
196
+ })();
197
+ choices = (choices || []).map(c => {
198
+ let categoryCount;
199
+ if (resolvedAllowMultiple === _utils.multiplePlacements.enabled) {
200
+ categoryCount = 0;
201
+ } else if (resolvedAllowMultiple === _utils.multiplePlacements.disabled) {
202
+ categoryCount = 1;
203
+ } else {
204
+ // perChoice — use the value set on each choice individually
205
+ categoryCount = c.categoryCount || 0;
206
+ }
207
+ return {
208
+ ...c,
209
+ categoryCount
210
+ };
211
+ });
212
+ if (!note) {
213
+ note = translator.t('common:commonCorrectAnswerWithAlternates', {
214
+ lng: language
215
+ });
216
+ }
217
+ const alternates = getAlternates(filteredCorrectResponse);
218
+ const {
219
+ responseAreasToBeFilled,
220
+ possibleResponses,
221
+ hasUnplacedChoices
222
+ } = (0, _utils.getCompleteResponseDetails)(filteredCorrectResponse, normalizedQuestion.allowAlternateEnabled ? alternates : [], normalizedQuestion.choices);
223
+ const out = {
224
+ categories: categories || [],
225
+ categoriesPerRow: categoriesPerRow || 2,
226
+ maxChoicesPerCategory,
227
+ correctness: answerCorrectness,
228
+ choices: choices || [],
229
+ choicesLabel: choicesLabel || '',
230
+ choicesPosition,
231
+ disabled: mode !== 'gather',
232
+ feedback: fb,
233
+ lockChoiceOrder,
234
+ prompt: promptEnabled ? prompt : null,
235
+ rowLabels,
236
+ note,
237
+ env,
238
+ showNote: alternates && alternates.length > 0,
239
+ correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,
240
+ language,
241
+ extraCSSRules,
242
+ fontSizeFactor,
243
+ minRowHeight: minRowHeight,
244
+ autoplayAudioEnabled,
245
+ completeAudioEnabled,
246
+ customAudioButton,
247
+ possibleResponses,
248
+ responseAreasToBeFilled,
249
+ hasUnplacedChoices,
250
+ ...(question.allowMultiplePlacementsEnabled == null && {
251
+ allowMultiplePlacementsEnabled: resolvedAllowMultiple
252
+ })
253
+ };
254
+ if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
255
+ out.rationale = rationaleEnabled ? rationale : null;
256
+ out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;
257
+ } else {
258
+ out.rationale = null;
259
+ out.teacherInstructions = null;
260
+ }
261
+ return out;
262
+ };
263
+
264
+ /**
265
+ * Generates detailed trace log for scoring evaluation
266
+ * @param {Object} model - the question model
267
+ * @param {Object} session - the student session
268
+ * @param {Object} env - the environment
269
+ * @returns {Array} traceLog - array of trace messages
270
+ */
271
+ exports.model = model;
272
+ const getLogTrace = (model, session, env) => {
273
+ const traceLog = [];
274
+ const {
275
+ answers
276
+ } = session || {};
277
+ const {
278
+ categories,
279
+ choices,
280
+ correctResponse
281
+ } = model || {};
282
+ const draggedChoices = answers.reduce((sum, a) => sum + (a.choices?.length || 0), 0);
283
+ const alternates = getAlternates(correctResponse);
284
+ const hasAlternates = alternates.length > 0;
285
+ const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
286
+ const builtState = draggedChoices > 0 ? (0, _categorize.buildState)(categories, choices, answers, correctResponse) : null;
287
+ const builtCategories = builtState?.categories || [];
288
+ if (draggedChoices > 0) {
289
+ traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);
290
+ (categories || []).forEach(category => {
291
+ const categoryId = category.id;
292
+ const builtCategory = builtCategories.find(c => c.id === categoryId);
293
+ const studentChoices = builtCategory ? builtCategory.choices || [] : [];
294
+ const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);
295
+ const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];
296
+ if (expectedChoices.length > 0) {
297
+ if (studentChoices.length === 0) {
298
+ traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);
299
+ } else {
300
+ const correctCount = studentChoices.filter(choice => choice.correct).length;
301
+ const incorrectCount = studentChoices.length - correctCount;
302
+ if (correctCount > 0 && incorrectCount === 0) {
303
+ traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);
304
+ } else if (correctCount === 0 && incorrectCount > 0) {
305
+ traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);
306
+ } else {
307
+ traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);
308
+ }
309
+ }
310
+ }
311
+ });
312
+ } else {
313
+ traceLog.push('Student did not place any choices into categories.');
314
+ }
315
+ if (hasAlternates) {
316
+ traceLog.push('Alternate response combinations are accepted for this question.');
317
+ }
318
+ if (hasAlternates) {
319
+ traceLog.push('Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).');
320
+ traceLog.push('Student must get all categories completely correct to receive full credit.');
321
+ } else if (partialScoringEnabled) {
322
+ traceLog.push('Score calculated using partial scoring.');
323
+ traceLog.push('Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.');
324
+ if (draggedChoices > 0) {
325
+ const totalCorrect = builtCategories.reduce((sum, cat) => sum + (cat.choices || []).filter(choice => choice.correct).length, 0);
326
+ const totalIncorrect = draggedChoices - totalCorrect;
327
+ const maxPossible = (correctResponse || []).reduce((sum, cat) => sum + (cat.choices || []).length, 0);
328
+ traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);
329
+ if (draggedChoices > maxPossible) {
330
+ const extraPlacements = draggedChoices - maxPossible;
331
+ traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);
332
+ }
333
+ }
334
+ } else {
335
+ traceLog.push('Score calculated using all-or-nothing scoring.');
336
+ traceLog.push('Student must get all categories completely correct to receive full credit.');
337
+ }
338
+ const score = getTotalScore(model, session, env);
339
+ traceLog.push(`Final score: ${score}.`);
340
+ return traceLog;
341
+ };
342
+ exports.getLogTrace = getLogTrace;
343
+ const outcome = (question, session, env) => {
344
+ if (env.mode !== 'evaluate') {
345
+ return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));
346
+ } else {
347
+ return new Promise(resolve => {
348
+ if (!session || (0, _lodashEs.isEmpty)(session)) {
349
+ resolve({
350
+ score: 0,
351
+ empty: true,
352
+ traceLog: ['Student did not place any choices into categories. Score is 0.']
353
+ });
354
+ } else {
355
+ const traceLog = getLogTrace(question, session, env);
356
+ const score = getTotalScore(question, session, env);
357
+ resolve({
358
+ score,
359
+ empty: false,
360
+ traceLog
361
+ });
362
+ }
363
+ });
364
+ }
365
+ };
366
+ exports.outcome = outcome;
367
+ const createCorrectResponseSession = (question, env) => {
368
+ return new Promise(resolve => {
369
+ const {
370
+ mode,
371
+ role
372
+ } = env || {};
373
+ if (mode !== 'evaluate' && role === 'instructor') {
374
+ const {
375
+ correctResponse
376
+ } = question;
377
+ resolve({
378
+ answers: correctResponse,
379
+ id: 1
380
+ });
381
+ } else {
382
+ return resolve(null);
383
+ }
384
+ });
385
+ };
386
+
387
+ // remove all html tags
388
+ exports.createCorrectResponseSession = createCorrectResponseSession;
389
+ const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
390
+
391
+ // remove all html tags except img, iframe and source tag for audio
392
+ const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
393
+ const validate = (model = {}, config = {}) => {
394
+ const {
395
+ categories,
396
+ choices,
397
+ correctResponse,
398
+ maxAnswerChoices
399
+ } = model;
400
+ const {
401
+ minChoices = 1,
402
+ minCategories = 1,
403
+ maxCategories = 12,
404
+ maxLengthPerChoice = 300,
405
+ maxLengthPerCategory = 150
406
+ } = config;
407
+ const reversedChoices = [...(choices || [])].reverse();
408
+ const errors = {};
409
+ const choicesErrors = {};
410
+ const categoriesErrors = {};
411
+ ['teacherInstructions', 'prompt', 'rationale'].forEach(field => {
412
+ if (config[field]?.required && !getContent(model[field])) {
413
+ errors[field] = 'This field is required.';
414
+ }
415
+ });
416
+ (categories || []).forEach(category => {
417
+ const {
418
+ id,
419
+ label
420
+ } = category;
421
+ if (getInnerText(label).length > maxLengthPerCategory) {
422
+ categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;
423
+ }
424
+ });
425
+ (reversedChoices || []).forEach((choice, index) => {
426
+ const {
427
+ id,
428
+ content
429
+ } = choice;
430
+ if (getInnerText(content).length > maxLengthPerChoice) {
431
+ choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;
432
+ }
433
+ if (!getContent(content)) {
434
+ choicesErrors[id] = 'Tokens should not be empty.';
435
+ } else {
436
+ const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.content === content);
437
+ if (identicalAnswer) {
438
+ choicesErrors[id] = 'Tokens content should be unique.';
439
+ }
440
+ }
441
+ });
442
+ const nbOfCategories = (categories || []).length;
443
+ const nbOfChoices = (choices || []).length;
444
+ if (nbOfCategories > maxCategories) {
445
+ errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;
446
+ } else if (nbOfCategories < minCategories) {
447
+ errors.categoriesError = `There should be at least ${minCategories} category defined.`;
448
+ }
449
+ if (nbOfChoices < minChoices) {
450
+ errors.choicesError = `There should be at least ${minChoices} choices defined.`;
451
+ } else if (nbOfChoices > maxAnswerChoices) {
452
+ errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;
453
+ }
454
+ if (nbOfChoices && nbOfCategories) {
455
+ let hasAssociations = false;
456
+ (correctResponse || []).forEach(response => {
457
+ const {
458
+ choices = [],
459
+ alternateResponses = []
460
+ } = response;
461
+ if (choices.length) {
462
+ hasAssociations = true;
463
+ } else {
464
+ alternateResponses.forEach(alternate => {
465
+ if ((alternate || []).length) {
466
+ hasAssociations = true;
467
+ }
468
+ });
469
+ }
470
+ });
471
+ let duplicateAlternateIndex = -1;
472
+ let duplicateCategory = '';
473
+ (correctResponse || []).forEach(response => {
474
+ const {
475
+ choices = [],
476
+ alternateResponses = [],
477
+ category
478
+ } = response;
479
+ if (duplicateAlternateIndex === -1) {
480
+ duplicateAlternateIndex = (0, _utils.isCorrectResponseDuplicated)(choices, alternateResponses);
481
+ if (duplicateAlternateIndex === -1) {
482
+ duplicateAlternateIndex = (0, _utils.isAlternateDuplicated)(alternateResponses);
483
+ }
484
+ duplicateCategory = category;
485
+ }
486
+ });
487
+ if (duplicateAlternateIndex > -1) {
488
+ errors.duplicateAlternate = {
489
+ index: duplicateAlternateIndex,
490
+ category: duplicateCategory
491
+ };
492
+ }
493
+ if (!hasAssociations) {
494
+ errors.associationError = 'At least one token should be assigned to at least one category.';
495
+ }
496
+ }
497
+ if (!(0, _lodashEs.isEmpty)(choicesErrors)) {
498
+ errors.choicesErrors = choicesErrors;
499
+ }
500
+ if (!(0, _lodashEs.isEmpty)(categoriesErrors)) {
501
+ errors.categoriesErrors = categoriesErrors;
502
+ }
503
+ return errors;
504
+ };
505
+ exports.validate = validate;
506
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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","resolvedAllowMultiple","allowMultiplePlacementsEnabled","allChoiceIds","flatMap","cr","isExclusive","Set","size","multiplePlacements","disabled","categoryCount","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","showNote","getLogTrace","traceLog","draggedChoices","sum","a","hasAlternates","partialScoringEnabled","builtState","push","forEach","category","categoryId","id","builtCategory","find","studentChoices","correctResponseForCategory","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, multiplePlacements } 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 const resolvedAllowMultiple = (() => {\n if (question.allowMultiplePlacementsEnabled != null) {\n return question.allowMultiplePlacementsEnabled;\n }\n // Derive from correct response: if any choice id appears in more than one category, reuse is required\n const allChoiceIds = (correctResponse || []).flatMap((cr) => cr.choices || []);\n const isExclusive = allChoiceIds.length === new Set(allChoiceIds).size;\n return isExclusive ? multiplePlacements.disabled : multiplePlacements.enabled;\n })();\n\n choices = (choices || []).map((c) => {\n let categoryCount;\n if (resolvedAllowMultiple === multiplePlacements.enabled) {\n categoryCount = 0;\n } else if (resolvedAllowMultiple === multiplePlacements.disabled) {\n categoryCount = 1;\n } else {\n // perChoice — use the value set on each choice individually\n categoryCount = c.categoryCount || 0;\n }\n return { ...c, categoryCount };\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 ...(question.allowMultiplePlacementsEnabled == null && { allowMultiplePlacementsEnabled: resolvedAllowMultiple }),\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) => {\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;I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