@pie-element/match 12.1.2-next.0 → 12.1.2-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/answer-config-block.js +33 -33
- package/dist/author/index.js +15 -17
- package/dist/browser/{Typography-CbSskKxx.js → Typography-DSiRJjOv.js} +337 -330
- package/dist/browser/Typography-DSiRJjOv.js.map +1 -0
- package/dist/browser/author/index.js +6460 -6944
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/browser-kkT1XVKw.js +13 -4
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +27 -27
- package/dist/browser/dist-i687VHmY.js +100 -0
- package/dist/browser/dist-i687VHmY.js.map +1 -0
- package/dist/controller/index.js +26 -28
- package/dist/index.iife.js +21 -21
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +13 -10
- package/dist/browser/Typography-CbSskKxx.js.map +0 -1
- package/dist/browser/isEqual-xtQxYITi.js +0 -856
- package/dist/browser/isEqual-xtQxYITi.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSet.js +0 -22
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/set.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import * as __pieBrowserCjsReactRequire from "react";
|
|
2
|
+
const __pieBrowserCjsRequire = (specifier) => {
|
|
3
|
+
switch (specifier) {
|
|
4
|
+
case "react": return __pieBrowserCjsReactRequire;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
default:
|
|
10
|
+
throw new Error(`Unsupported browser CJS require: ${specifier}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
1
13
|
//#region \0rolldown/runtime.js
|
|
2
14
|
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
3
15
|
let r = {};
|
|
@@ -15,10 +27,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
15
27
|
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
16
28
|
value: n,
|
|
17
29
|
enumerable: !0
|
|
18
|
-
}) : a, n)), u = /* @__PURE__ */ ((
|
|
19
|
-
if (typeof require < "u") return require.apply(this, arguments);
|
|
20
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
21
|
-
}), d = /* @__PURE__ */ o(((e, t) => {
|
|
30
|
+
}) : a, n)), u = __pieBrowserCjsRequire, d = /* @__PURE__ */ o(((e, t) => {
|
|
22
31
|
var n = 1e3, r = n * 60, i = r * 60, a = i * 24, o = a * 7, s = a * 365.25;
|
|
23
32
|
t.exports = function(e, t) {
|
|
24
33
|
t ||= {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/feedback/dist/index.js","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region src/defaults.ts\nvar e = {\n\tcorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Correct\",\n\t\tcustom: \"Correct\"\n\t},\n\tincorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Incorrect\",\n\t\tcustom: \"Incorrect\"\n\t},\n\tpartial: {\n\t\ttype: \"default\",\n\t\tdefault: \"Nearly\",\n\t\tcustom: \"Nearly\"\n\t},\n\tunanswered: {\n\t\ttype: \"default\",\n\t\tdefault: \"You have not entered a response\",\n\t\tcustom: \"You have not entered a response\"\n\t}\n};\n//#endregion\n//#region src/utils.ts\nfunction t(e) {\n\treturn e === \"partially-correct\" ? \"partial\" : e;\n}\n//#endregion\n//#region src/index.ts\nfunction n(n, i = {}) {\n\treturn new Promise((a) => {\n\t\tlet o = {\n\t\t\t...e,\n\t\t\t...i\n\t\t}, s = t(n), c = o[s], l = e[s];\n\t\tr(c, l[c.type]).then(a);\n\t});\n}\nfunction r(e, t) {\n\treturn new Promise((n) => {\n\t\tif (!e || e.type === \"none\") {\n\t\t\tn(void 0);\n\t\t\treturn;\n\t\t}\n\t\tn(e[e.type] || t);\n\t});\n}\nfunction i(n, r = {}) {\n\tlet i = {\n\t\t...e,\n\t\t...r\n\t}, o = t(n), s = i[o], c = e[o];\n\treturn a(s, c[s.type]);\n}\nfunction a(e, t) {\n\tif (!(!e || e.type === \"none\")) return e[e.type] || t;\n}\n//#endregion\nexport { e as defaultFeedback, a as getActualFeedback, i as getActualFeedbackForCorrectness, r as getFeedback, n as getFeedbackForCorrectness, t as normalizeCorrectness };\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/match/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n choiceMode: 'radio',\n feedbackEnabled: false,\n headers: ['Column 1', 'Column 2', 'Column 3'],\n layout: 3,\n lockChoiceOrder: true,\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n rows: [],\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/match/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { cloneDeep, isEmpty, isEqual } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-element/shared-feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport debug from 'debug';\n\nconst log = debug('@pie-element:match:controller');\n\nimport defaults from './defaults.js';\n\nconst getResponseCorrectness = (model, answers, env = {}) => {\n const isPartialScoring = partialScoring.enabled(model, env);\n const rows = model.rows;\n const checkboxMode = model.choiceMode === 'checkbox';\n\n if (!answers || Object.keys(answers).length === 0) {\n return 'unanswered';\n }\n\n const totalCorrectAnswers = checkboxMode ? getTotalCorrectAnswers(model) : getTotalCorrect(model);\n let correctAnswers;\n let incorrectAnswers = 0;\n\n if (checkboxMode) {\n const checkboxes = getCheckboxes(rows, answers);\n\n correctAnswers = checkboxes.correctAnswers;\n incorrectAnswers = checkboxes.incorrectAnswers;\n } else {\n correctAnswers = getCorrectRadios(rows, answers);\n }\n\n if (totalCorrectAnswers === correctAnswers && !incorrectAnswers) {\n return 'correct';\n } else if (correctAnswers === 0) {\n return 'incorrect';\n } else if (isPartialScoring) {\n return 'partial';\n }\n\n return 'incorrect';\n};\n\nconst getCorrectness = (question, env, answers = {}) => {\n if (env.mode === 'evaluate') {\n return getResponseCorrectness(question, answers, env);\n }\n};\n\nconst getCheckboxes = (rows, answers) => {\n let correctAnswers = 0;\n let incorrectAnswers = 0;\n\n rows.forEach((row) => {\n const answer = answers[row.id];\n\n if (answer) {\n row.values.forEach((v, i) => {\n if (answer[i] && answer[i] === v) {\n correctAnswers += 1;\n } else if (answer[i] && answer[i] !== v) {\n incorrectAnswers += 1;\n }\n });\n }\n });\n\n return { correctAnswers, incorrectAnswers };\n};\n\nconst getCorrectRadios = (rows, answers) => {\n let correctAnswers = 0;\n\n rows.forEach((row) => {\n if (isEqual(row.values, answers[row.id])) {\n correctAnswers += 1;\n }\n });\n\n return correctAnswers;\n};\n\nconst getTotalCorrect = (question) => {\n const checkboxMode = question.choiceMode === 'checkbox';\n const matchingTable = checkboxMode ? question.layout - 1 : 1;\n return (question.rows.length || 0) * matchingTable;\n};\n\nconst getTotalCorrectAnswers = (question) => {\n let noOfTotalCorrectAnswers = 0;\n\n question.rows.forEach((row) => {\n row.values.forEach((value) => {\n if (value) {\n noOfTotalCorrectAnswers += 1;\n }\n });\n });\n\n return noOfTotalCorrectAnswers;\n};\n\nconst getPartialScore = (question, answers) => {\n const checkboxMode = question.choiceMode === 'checkbox';\n\n if (checkboxMode) {\n const { correctAnswers, incorrectAnswers } = getCheckboxes(question.rows, answers);\n const totalCorrect = getTotalCorrectAnswers(question);\n\n const total = totalCorrect === 0 ? 1 : totalCorrect;\n\n if (correctAnswers + incorrectAnswers > totalCorrect) {\n const extraAnswers = correctAnswers + incorrectAnswers - totalCorrect;\n const score = parseFloat(((correctAnswers - extraAnswers) / total).toFixed(2));\n\n return score < 0 ? 0 : score;\n } else {\n return parseFloat((correctAnswers / total).toFixed(2));\n }\n } else {\n const correctAnswers = getCorrectRadios(question.rows, answers);\n const totalCorrect = getTotalCorrect(question) === 0 ? 1 : getTotalCorrect(question);\n\n return parseFloat((correctAnswers / totalCorrect).toFixed(2));\n }\n};\n\nconst getOutComeScore = (question, env, answers = {}) => {\n const correctness = getCorrectness(question, env, answers);\n const isPartialScoring = partialScoring.enabled(question, env);\n\n return correctness === 'correct'\n ? 1\n : correctness === 'partial' && isPartialScoring\n ? getPartialScore(question, answers)\n : 0;\n};\n\n/**\n * Generates detailed trace log for match item scoring evaluation\n * @param {Object} question\n * @param {Object} session\n * @param {Object} env\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n const answers = session?.answers || {};\n const rows = question?.rows || [];\n const checkboxMode = question.choiceMode === 'checkbox';\n\n if (!answers || Object.keys(answers).length === 0) {\n traceLog.push('Student did not provide any answer.');\n return traceLog;\n }\n\n traceLog.push(`Match item contains ${rows.length} row(s).`);\n traceLog.push(`Matching mode: ${checkboxMode ? 'checkbox (multiple matches allowed)' : 'radio (single match per row)'}.`);\n\n let correctCount = 0;\n let incorrectCount = 0;\n let totalCorrect = 0;\n\n rows.forEach((row) => {\n const studentAnswer = answers[row.id];\n const correctValues = row.values || [];\n\n if (checkboxMode) {\n correctValues.forEach((v, idx) => {\n if (v) {\n totalCorrect++;\n }\n\n if (studentAnswer && studentAnswer[idx]) {\n if (studentAnswer[idx] === v) {\n correctCount++;\n } else {\n incorrectCount++;\n }\n }\n });\n } else {\n totalCorrect++;\n if (studentAnswer) {\n if (isEqual(correctValues, studentAnswer)) {\n correctCount++;\n } else {\n incorrectCount++;\n }\n }\n }\n });\n\n if (correctCount > 0) {\n traceLog.push(`${correctCount} correct match(es) selected.`);\n }\n\n if (incorrectCount > 0) {\n traceLog.push(`${incorrectCount} incorrect match(es) selected.`);\n }\n\n if (correctCount === 0 && incorrectCount === 0) {\n traceLog.push('Student provided answers, but none matched the correct responses.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(question, env);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n\n if (checkboxMode) {\n traceLog.push(\n 'Score is based on the number of correct minus extra incorrect matches, divided by the total number of correct matches.',\n );\n\n if (correctCount + incorrectCount > totalCorrect) {\n traceLog.push('Extra selected matches beyond the correct set reduce the score.');\n }\n } else {\n traceLog.push(\n 'Score is based on the number of correctly matched rows divided by the total number of rows.',\n );\n }\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push('Student must match all rows correctly to receive full credit.');\n }\n\n const rawScore = getOutComeScore(question, env, answers);\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport const outcome = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined, logTrace: [] });\n } else {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not provide any answer.'] });\n }\n\n const out = {\n score: getOutComeScore(question, env, session.answers),\n empty: false,\n logTrace: getLogTrace(question, session, env),\n };\n\n resolve(out);\n }\n });\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\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 async function model(question, session, env, updateSession) {\n const normalizedQuestion = cloneDeep(normalize(question));\n let correctness, score;\n\n if ((!session || isEmpty(session)) && env.mode === 'evaluate') {\n correctness = 'unanswered';\n score = '0%';\n } else {\n correctness = getCorrectness(normalizedQuestion, env, session && session.answers);\n score = `${getOutComeScore(normalizedQuestion, env, session && session.answers) * 100}%`;\n }\n\n const correctResponse = {};\n const correctInfo = {\n score,\n correctness,\n };\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n normalizedQuestion.rows = await getShuffledChoices(normalizedQuestion.rows, session, updateSession, 'id');\n }\n\n normalizedQuestion.rows.forEach((row) => {\n correctResponse[row.id] = row.values;\n\n if (env.mode !== 'evaluate') {\n delete row.values;\n }\n });\n\n const feedback =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? await getFeedbackForCorrectness(correctInfo.correctness, normalizedQuestion.feedback)\n : undefined;\n\n const {\n extraCSSRules,\n feedbackEnabled,\n promptEnabled,\n prompt,\n lockChoiceOrder: _,\n ...essentials\n } = normalizedQuestion;\n const out = {\n ...essentials,\n extraCSSRules,\n allowFeedback: feedbackEnabled,\n prompt: promptEnabled ? prompt : null,\n shuffled: !lockChoiceOrder,\n feedback,\n disabled: env.mode !== 'gather',\n view: env.mode === 'view',\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n if (env.mode === 'evaluate') {\n Object.assign(out, {\n correctResponse,\n correctness: correctInfo,\n });\n }\n\n log('out: ', out);\n return out;\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { rows } = question;\n const answers = {};\n\n rows.forEach((r) => {\n answers[r.id] = r.values;\n });\n\n resolve({\n answers,\n id: '1',\n });\n } else {\n 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 { rows, choiceMode, headers } = model;\n const {\n minQuestions,\n maxQuestions,\n maxLengthQuestionsHeading,\n maxAnswers,\n maxLengthAnswers,\n maxLengthFirstColumnHeading,\n } = config;\n const rowsErrors = {};\n const columnsErrors = {};\n const errors = {};\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 if (rows.length < minQuestions) {\n errors.noOfRowsError = `There should be at least ${minQuestions} question rows.`;\n } else if (rows.length > maxQuestions) {\n errors.noOfRowsError = `No more than ${maxQuestions} question rows should be defined.`;\n }\n\n (rows || []).forEach((row, index) => {\n const { id, values = [], title } = row;\n rowsErrors[id] = '';\n\n if (maxLengthQuestionsHeading && getInnerText(title).length > maxLengthQuestionsHeading) {\n rowsErrors[id] += `Content length should be maximum ${maxLengthQuestionsHeading} characters. `;\n }\n\n if (!getContent(title)) {\n rowsErrors[id] += 'Content should not be empty. ';\n } else {\n // check for identical content with the previous answers\n const identicalAnswer = rows.slice(0, index).some((r) => getContent(r.title) === getContent(title));\n\n if (identicalAnswer) {\n rowsErrors[id] += 'Content should be unique. ';\n }\n }\n\n const hasCorrectResponse = values.some((value) => !!value);\n\n if (!hasCorrectResponse) {\n rowsErrors[id] += 'No correct response defined.';\n }\n });\n\n if (maxAnswers && headers.length - 1 > maxAnswers) {\n errors.columnsLengthError = `There should be maximum ${maxAnswers} answers.`;\n }\n\n if (maxLengthFirstColumnHeading && headers[0].length > maxLengthFirstColumnHeading) {\n columnsErrors[0] = `Content length should be maximum ${maxLengthFirstColumnHeading} characters.`;\n }\n\n const headersContent = (headers || []).map((heading) => getContent(heading));\n headersContent.shift(); // remove first column since it does not require validation\n\n headersContent.forEach((heading, index) => {\n const headerIndex = index + 1; // we need to add 1 because we removed first header from validation\n columnsErrors[headerIndex] = '';\n\n if (maxLengthAnswers && getInnerText(heading).length > maxLengthAnswers) {\n columnsErrors[headerIndex] += `Content length should be maximum ${maxLengthAnswers} characters. `;\n }\n\n if (!heading) {\n columnsErrors[headerIndex] += 'Content should not be empty.';\n } else {\n // check for identical content with the previous headers\n const identicalAnswer = headersContent.slice(0, index).some((head) => head === heading);\n\n if (identicalAnswer) {\n columnsErrors[index + 1] += 'Content should be unique.';\n }\n }\n });\n\n const hasRowErrors = Object.values(rowsErrors).some((error) => (error || '').length);\n\n if (hasRowErrors) {\n errors.rowsErrors = rowsErrors;\n\n const noCorrectAnswer = Object.values(rowsErrors).some((error) =>\n (error || '').includes('No correct response defined.'),\n );\n\n if (noCorrectAnswer) {\n errors.correctResponseError =\n choiceMode === 'radio'\n ? 'There should be a correct response defined for every row.'\n : 'There should be at least one correct response defined for every row.';\n }\n }\n\n const hasColumnErrors = Object.values(columnsErrors).some((error) => (error || '').length);\n\n if (hasColumnErrors) {\n errors.columnsErrors = columnsErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;AACA,IAAI,IAAI;CACP,SAAS;EACR,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,WAAW;EACV,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,SAAS;EACR,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,YAAY;EACX,MAAM;EACN,SAAS;EACT,QAAQ;CACT;AACD;AAGA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,sBAAsB,YAAY;AAChD;AAGA,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG;CACrB,OAAO,IAAI,SAAS,MAAM;EACzB,IAAI,IAAI;GACP,GAAG;GACH,GAAG;EACJ,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,IAAI,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AAW,aAGhE,KAA+B,EAAQ,GAAG,SAAS,MACrD,EAAc,KAAK,oCAAoC,EAA4B;CAGrF,IAAM,KAAkB,KAAW,CAAC,GAAG,KAAK,MAAY,EAAW,CAAO,CAAC;CA8C3E,OA7CA,EAAe,MAAM,GAErB,EAAe,SAAS,GAAS,MAAU;EACzC,IAAM,IAAc,IAAQ;EAO5B,AANA,EAAc,KAAe,IAEzB,KAAoB,EAAa,CAAO,EAAE,SAAS,MACrD,EAAc,MAAgB,oCAAoC,EAAiB,iBAGhF,IAIqB,EAAe,MAAM,GAAG,CAAK,EAAE,MAAM,MAAS,MAAS,CAE3E,MACF,EAAc,IAAQ,MAAM,+BAN9B,EAAc,MAAgB;CASlC,CAAC,GAEoB,OAAO,OAAO,CAAU,EAAE,MAAM,OAAW,KAAS,IAAI,MAEzE,MACF,EAAO,aAAa,GAEI,OAAO,OAAO,CAAU,EAAE,MAAM,OACrD,KAAS,IAAI,SAAS,8BAA8B,CAGnD,MACF,EAAO,uBACL,MAAe,UACX,8DACA,0EAIc,OAAO,OAAO,CAAa,EAAE,MAAM,OAAW,KAAS,IAAI,MAE/E,MACF,EAAO,gBAAgB,IAGlB;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/feedback/dist/index.js","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region src/defaults.ts\nvar e = {\n\tcorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Correct\",\n\t\tcustom: \"Correct\"\n\t},\n\tincorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Incorrect\",\n\t\tcustom: \"Incorrect\"\n\t},\n\tpartial: {\n\t\ttype: \"default\",\n\t\tdefault: \"Nearly\",\n\t\tcustom: \"Nearly\"\n\t},\n\tunanswered: {\n\t\ttype: \"default\",\n\t\tdefault: \"You have not entered a response\",\n\t\tcustom: \"You have not entered a response\"\n\t}\n};\n//#endregion\n//#region src/utils.ts\nfunction t(e) {\n\treturn e === \"partially-correct\" ? \"partial\" : e;\n}\n//#endregion\n//#region src/index.ts\nfunction n(n, i = {}) {\n\treturn new Promise((a) => {\n\t\tlet o = {\n\t\t\t...e,\n\t\t\t...i\n\t\t}, s = t(n), c = o[s], l = e[s];\n\t\tr(c, l[c.type]).then(a);\n\t});\n}\nfunction r(e, t) {\n\treturn new Promise((n) => {\n\t\tif (!e || e.type === \"none\") {\n\t\t\tn(void 0);\n\t\t\treturn;\n\t\t}\n\t\tn(e[e.type] || t);\n\t});\n}\nfunction i(n, r = {}) {\n\tlet i = {\n\t\t...e,\n\t\t...r\n\t}, o = t(n), s = i[o], c = e[o];\n\treturn a(s, c[s.type]);\n}\nfunction a(e, t) {\n\tif (!(!e || e.type === \"none\")) return e[e.type] || t;\n}\n//#endregion\nexport { e as defaultFeedback, a as getActualFeedback, i as getActualFeedbackForCorrectness, r as getFeedback, n as getFeedbackForCorrectness, t as normalizeCorrectness };\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/match/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n choiceMode: 'radio',\n feedbackEnabled: false,\n headers: ['Column 1', 'Column 2', 'Column 3'],\n layout: 3,\n lockChoiceOrder: true,\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n rows: [],\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/match/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { cloneDeep, isEmpty, isEqual } from '@pie-element/shared-lodash';\nimport { getFeedbackForCorrectness } from '@pie-element/shared-feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport debug from 'debug';\n\nconst log = debug('@pie-element:match:controller');\n\nimport defaults from './defaults.js';\n\nconst getResponseCorrectness = (model, answers, env = {}) => {\n const isPartialScoring = partialScoring.enabled(model, env);\n const rows = model.rows;\n const checkboxMode = model.choiceMode === 'checkbox';\n\n if (!answers || Object.keys(answers).length === 0) {\n return 'unanswered';\n }\n\n const totalCorrectAnswers = checkboxMode ? getTotalCorrectAnswers(model) : getTotalCorrect(model);\n let correctAnswers;\n let incorrectAnswers = 0;\n\n if (checkboxMode) {\n const checkboxes = getCheckboxes(rows, answers);\n\n correctAnswers = checkboxes.correctAnswers;\n incorrectAnswers = checkboxes.incorrectAnswers;\n } else {\n correctAnswers = getCorrectRadios(rows, answers);\n }\n\n if (totalCorrectAnswers === correctAnswers && !incorrectAnswers) {\n return 'correct';\n } else if (correctAnswers === 0) {\n return 'incorrect';\n } else if (isPartialScoring) {\n return 'partial';\n }\n\n return 'incorrect';\n};\n\nconst getCorrectness = (question, env, answers = {}) => {\n if (env.mode === 'evaluate') {\n return getResponseCorrectness(question, answers, env);\n }\n};\n\nconst getCheckboxes = (rows, answers) => {\n let correctAnswers = 0;\n let incorrectAnswers = 0;\n\n rows.forEach((row) => {\n const answer = answers[row.id];\n\n if (answer) {\n row.values.forEach((v, i) => {\n if (answer[i] && answer[i] === v) {\n correctAnswers += 1;\n } else if (answer[i] && answer[i] !== v) {\n incorrectAnswers += 1;\n }\n });\n }\n });\n\n return { correctAnswers, incorrectAnswers };\n};\n\nconst getCorrectRadios = (rows, answers) => {\n let correctAnswers = 0;\n\n rows.forEach((row) => {\n if (isEqual(row.values, answers[row.id])) {\n correctAnswers += 1;\n }\n });\n\n return correctAnswers;\n};\n\nconst getTotalCorrect = (question) => {\n const checkboxMode = question.choiceMode === 'checkbox';\n const matchingTable = checkboxMode ? question.layout - 1 : 1;\n return (question.rows.length || 0) * matchingTable;\n};\n\nconst getTotalCorrectAnswers = (question) => {\n let noOfTotalCorrectAnswers = 0;\n\n question.rows.forEach((row) => {\n row.values.forEach((value) => {\n if (value) {\n noOfTotalCorrectAnswers += 1;\n }\n });\n });\n\n return noOfTotalCorrectAnswers;\n};\n\nconst getPartialScore = (question, answers) => {\n const checkboxMode = question.choiceMode === 'checkbox';\n\n if (checkboxMode) {\n const { correctAnswers, incorrectAnswers } = getCheckboxes(question.rows, answers);\n const totalCorrect = getTotalCorrectAnswers(question);\n\n const total = totalCorrect === 0 ? 1 : totalCorrect;\n\n if (correctAnswers + incorrectAnswers > totalCorrect) {\n const extraAnswers = correctAnswers + incorrectAnswers - totalCorrect;\n const score = parseFloat(((correctAnswers - extraAnswers) / total).toFixed(2));\n\n return score < 0 ? 0 : score;\n } else {\n return parseFloat((correctAnswers / total).toFixed(2));\n }\n } else {\n const correctAnswers = getCorrectRadios(question.rows, answers);\n const totalCorrect = getTotalCorrect(question) === 0 ? 1 : getTotalCorrect(question);\n\n return parseFloat((correctAnswers / totalCorrect).toFixed(2));\n }\n};\n\nconst getOutComeScore = (question, env, answers = {}) => {\n const correctness = getCorrectness(question, env, answers);\n const isPartialScoring = partialScoring.enabled(question, env);\n\n return correctness === 'correct'\n ? 1\n : correctness === 'partial' && isPartialScoring\n ? getPartialScore(question, answers)\n : 0;\n};\n\n/**\n * Generates detailed trace log for match item scoring evaluation\n * @param {Object} question\n * @param {Object} session\n * @param {Object} env\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n const answers = session?.answers || {};\n const rows = question?.rows || [];\n const checkboxMode = question.choiceMode === 'checkbox';\n\n if (!answers || Object.keys(answers).length === 0) {\n traceLog.push('Student did not provide any answer.');\n return traceLog;\n }\n\n traceLog.push(`Match item contains ${rows.length} row(s).`);\n traceLog.push(`Matching mode: ${checkboxMode ? 'checkbox (multiple matches allowed)' : 'radio (single match per row)'}.`);\n\n let correctCount = 0;\n let incorrectCount = 0;\n let totalCorrect = 0;\n\n rows.forEach((row) => {\n const studentAnswer = answers[row.id];\n const correctValues = row.values || [];\n\n if (checkboxMode) {\n correctValues.forEach((v, idx) => {\n if (v) {\n totalCorrect++;\n }\n\n if (studentAnswer && studentAnswer[idx]) {\n if (studentAnswer[idx] === v) {\n correctCount++;\n } else {\n incorrectCount++;\n }\n }\n });\n } else {\n totalCorrect++;\n if (studentAnswer) {\n if (isEqual(correctValues, studentAnswer)) {\n correctCount++;\n } else {\n incorrectCount++;\n }\n }\n }\n });\n\n if (correctCount > 0) {\n traceLog.push(`${correctCount} correct match(es) selected.`);\n }\n\n if (incorrectCount > 0) {\n traceLog.push(`${incorrectCount} incorrect match(es) selected.`);\n }\n\n if (correctCount === 0 && incorrectCount === 0) {\n traceLog.push('Student provided answers, but none matched the correct responses.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(question, env);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n\n if (checkboxMode) {\n traceLog.push(\n 'Score is based on the number of correct minus extra incorrect matches, divided by the total number of correct matches.',\n );\n\n if (correctCount + incorrectCount > totalCorrect) {\n traceLog.push('Extra selected matches beyond the correct set reduce the score.');\n }\n } else {\n traceLog.push(\n 'Score is based on the number of correctly matched rows divided by the total number of rows.',\n );\n }\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push('Student must match all rows correctly to receive full credit.');\n }\n\n const rawScore = getOutComeScore(question, env, answers);\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport const outcome = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined, logTrace: [] });\n } else {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not provide any answer.'] });\n }\n\n const out = {\n score: getOutComeScore(question, env, session.answers),\n empty: false,\n logTrace: getLogTrace(question, session, env),\n };\n\n resolve(out);\n }\n });\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\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 async function model(question, session, env, updateSession) {\n const normalizedQuestion = cloneDeep(normalize(question));\n let correctness, score;\n\n if ((!session || isEmpty(session)) && env.mode === 'evaluate') {\n correctness = 'unanswered';\n score = '0%';\n } else {\n correctness = getCorrectness(normalizedQuestion, env, session && session.answers);\n score = `${getOutComeScore(normalizedQuestion, env, session && session.answers) * 100}%`;\n }\n\n const correctResponse = {};\n const correctInfo = {\n score,\n correctness,\n };\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n normalizedQuestion.rows = await getShuffledChoices(normalizedQuestion.rows, session, updateSession, 'id');\n }\n\n normalizedQuestion.rows.forEach((row) => {\n correctResponse[row.id] = row.values;\n\n if (env.mode !== 'evaluate') {\n delete row.values;\n }\n });\n\n const feedback =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? await getFeedbackForCorrectness(correctInfo.correctness, normalizedQuestion.feedback)\n : undefined;\n\n const {\n extraCSSRules,\n feedbackEnabled,\n promptEnabled,\n prompt,\n lockChoiceOrder: _,\n ...essentials\n } = normalizedQuestion;\n const out = {\n ...essentials,\n extraCSSRules,\n allowFeedback: feedbackEnabled,\n prompt: promptEnabled ? prompt : null,\n shuffled: !lockChoiceOrder,\n feedback,\n disabled: env.mode !== 'gather',\n view: env.mode === 'view',\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n if (env.mode === 'evaluate') {\n Object.assign(out, {\n correctResponse,\n correctness: correctInfo,\n });\n }\n\n log('out: ', out);\n return out;\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { rows } = question;\n const answers = {};\n\n rows.forEach((r) => {\n answers[r.id] = r.values;\n });\n\n resolve({\n answers,\n id: '1',\n });\n } else {\n 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 { rows, choiceMode, headers } = model;\n const {\n minQuestions,\n maxQuestions,\n maxLengthQuestionsHeading,\n maxAnswers,\n maxLengthAnswers,\n maxLengthFirstColumnHeading,\n } = config;\n const rowsErrors = {};\n const columnsErrors = {};\n const errors = {};\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 if (rows.length < minQuestions) {\n errors.noOfRowsError = `There should be at least ${minQuestions} question rows.`;\n } else if (rows.length > maxQuestions) {\n errors.noOfRowsError = `No more than ${maxQuestions} question rows should be defined.`;\n }\n\n (rows || []).forEach((row, index) => {\n const { id, values = [], title } = row;\n rowsErrors[id] = '';\n\n if (maxLengthQuestionsHeading && getInnerText(title).length > maxLengthQuestionsHeading) {\n rowsErrors[id] += `Content length should be maximum ${maxLengthQuestionsHeading} characters. `;\n }\n\n if (!getContent(title)) {\n rowsErrors[id] += 'Content should not be empty. ';\n } else {\n // check for identical content with the previous answers\n const identicalAnswer = rows.slice(0, index).some((r) => getContent(r.title) === getContent(title));\n\n if (identicalAnswer) {\n rowsErrors[id] += 'Content should be unique. ';\n }\n }\n\n const hasCorrectResponse = values.some((value) => !!value);\n\n if (!hasCorrectResponse) {\n rowsErrors[id] += 'No correct response defined.';\n }\n });\n\n if (maxAnswers && headers.length - 1 > maxAnswers) {\n errors.columnsLengthError = `There should be maximum ${maxAnswers} answers.`;\n }\n\n if (maxLengthFirstColumnHeading && headers[0].length > maxLengthFirstColumnHeading) {\n columnsErrors[0] = `Content length should be maximum ${maxLengthFirstColumnHeading} characters.`;\n }\n\n const headersContent = (headers || []).map((heading) => getContent(heading));\n headersContent.shift(); // remove first column since it does not require validation\n\n headersContent.forEach((heading, index) => {\n const headerIndex = index + 1; // we need to add 1 because we removed first header from validation\n columnsErrors[headerIndex] = '';\n\n if (maxLengthAnswers && getInnerText(heading).length > maxLengthAnswers) {\n columnsErrors[headerIndex] += `Content length should be maximum ${maxLengthAnswers} characters. `;\n }\n\n if (!heading) {\n columnsErrors[headerIndex] += 'Content should not be empty.';\n } else {\n // check for identical content with the previous headers\n const identicalAnswer = headersContent.slice(0, index).some((head) => head === heading);\n\n if (identicalAnswer) {\n columnsErrors[index + 1] += 'Content should be unique.';\n }\n }\n });\n\n const hasRowErrors = Object.values(rowsErrors).some((error) => (error || '').length);\n\n if (hasRowErrors) {\n errors.rowsErrors = rowsErrors;\n\n const noCorrectAnswer = Object.values(rowsErrors).some((error) =>\n (error || '').includes('No correct response defined.'),\n );\n\n if (noCorrectAnswer) {\n errors.correctResponseError =\n choiceMode === 'radio'\n ? 'There should be a correct response defined for every row.'\n : 'There should be at least one correct response defined for every row.';\n }\n }\n\n const hasColumnErrors = Object.values(columnsErrors).some((error) => (error || '').length);\n\n if (hasColumnErrors) {\n errors.columnsErrors = columnsErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;AACA,IAAI,IAAI;CACP,SAAS;EACR,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,WAAW;EACV,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,SAAS;EAC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AAS,MAC5D,EAAW,MAAO,oCAAoC,EAA0B,iBAG7E,EAAW,CAAK,IAIK,EAAK,MAAM,GAAG,CAAK,EAAE,MAAM,MAAM,EAAW,EAAE,KAAK,MAAM,EAAW,CAAK,CAE7F,MACF,EAAW,MAAO,gCANpB,EAAW,MAAO,iCAUO,EAAO,MAAM,MAAU,CAAC,CAAC,CAE/C,MACH,EAAW,MAAO;CAEtB,CAAC,GAEG,KAAc,EAAQ,SAAS,IAAI,MACrC,EAAO,qBAAqB,2BAA2B,EAAW,aAGhE,KAA+B,EAAQ,GAAG,SAAS,MACrD,EAAc,KAAK,oCAAoC,EAA4B;CAGrF,IAAM,KAAkB,KAAW,CAAC,GAAG,KAAK,MAAY,EAAW,CAAO,CAAC;CA8C3E,OA7CA,EAAe,MAAM,GAErB,EAAe,SAAS,GAAS,MAAU;EACzC,IAAM,IAAc,IAAQ;EAO5B,AANA,EAAc,KAAe,IAEzB,KAAoB,EAAa,CAAO,EAAE,SAAS,MACrD,EAAc,MAAgB,oCAAoC,EAAiB,iBAGhF,IAIqB,EAAe,MAAM,GAAG,CAAK,EAAE,MAAM,MAAS,MAAS,CAE3E,MACF,EAAc,IAAQ,MAAM,+BAN9B,EAAc,MAAgB;CASlC,CAAC,GAEoB,OAAO,OAAO,CAAU,EAAE,MAAM,OAAW,KAAS,IAAI,MAEzE,MACF,EAAO,aAAa,GAEI,OAAO,OAAO,CAAU,EAAE,MAAM,OACrD,KAAS,IAAI,SAAS,8BAA8B,CAGnD,MACF,EAAO,uBACL,MAAe,UACX,8DACA,0EAIc,OAAO,OAAO,CAAa,EAAE,MAAM,OAAW,KAAS,IAAI,MAE/E,MACF,EAAO,gBAAgB,IAGlB;AACT"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as e } from "../browser-kkT1XVKw.js";
|
|
2
|
-
import {
|
|
2
|
+
import { A as t, Nt as n, O as r, a as i, d as a, dt as o, f as s, ft as c, ht as l, n as u, p as d, pt as f, r as p, t as m, u as h, x as g } from "../Typography-DSiRJjOv.js";
|
|
3
3
|
import _, { useRef as v } from "react";
|
|
4
4
|
import { createRoot as y } from "react-dom/client";
|
|
5
5
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
6
6
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
7
|
-
var S = /* @__PURE__ */ e(
|
|
7
|
+
var S = /* @__PURE__ */ e(n(), 1), C = "height ease-in 300ms, opacity ease-in 300ms", w = l("div")(() => ({
|
|
8
8
|
position: "relative",
|
|
9
9
|
height: 0,
|
|
10
10
|
overflow: "hidden",
|
|
@@ -137,7 +137,7 @@ D.propTypes = {
|
|
|
137
137
|
fgFill: S.default.string.isRequired,
|
|
138
138
|
borderFill: S.default.string.isRequired
|
|
139
139
|
};
|
|
140
|
-
var ee =
|
|
140
|
+
var ee = l("div")(({ size: e }) => ({
|
|
141
141
|
width: e || "25px",
|
|
142
142
|
height: e || "25px"
|
|
143
143
|
})), O = ({ open: e, size: t }) => /* @__PURE__ */ b(ee, {
|
|
@@ -1586,29 +1586,29 @@ function G(e) {
|
|
|
1586
1586
|
function Ue(e, t) {
|
|
1587
1587
|
return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
|
|
1588
1588
|
}
|
|
1589
|
-
var We = Ue(
|
|
1589
|
+
var We = Ue(s, "Readable") || Ue(Ke.Readable, "Readable"), Ge = i, K = Ge.default, Ke = K && typeof K == "object" ? K : Ge, { translator: q } = He, qe = {
|
|
1590
1590
|
WebkitTouchCallout: "none",
|
|
1591
1591
|
WebkitUserSelect: "none",
|
|
1592
1592
|
KhtmlUserSelect: "none",
|
|
1593
1593
|
MozUserSelect: "none",
|
|
1594
1594
|
msUserSelect: "none",
|
|
1595
1595
|
userSelect: "none"
|
|
1596
|
-
}, Je =
|
|
1596
|
+
}, Je = l("div")(() => ({
|
|
1597
1597
|
width: "100%",
|
|
1598
1598
|
cursor: "pointer"
|
|
1599
|
-
})), Ye =
|
|
1599
|
+
})), Ye = l("div")(() => ({
|
|
1600
1600
|
margin: "0 auto",
|
|
1601
1601
|
textAlign: "center",
|
|
1602
1602
|
display: "flex"
|
|
1603
|
-
})), Xe =
|
|
1603
|
+
})), Xe = l("div")(() => ({
|
|
1604
1604
|
width: "fit-content",
|
|
1605
1605
|
minWidth: "140px",
|
|
1606
1606
|
alignSelf: "center",
|
|
1607
1607
|
verticalAlign: "middle",
|
|
1608
|
-
color: `var(--correct-answer-toggle-label-color, ${
|
|
1608
|
+
color: `var(--correct-answer-toggle-label-color, ${c.text()})`,
|
|
1609
1609
|
fontWeight: "normal",
|
|
1610
1610
|
...qe
|
|
1611
|
-
})), Ze =
|
|
1611
|
+
})), Ze = l("div")(() => ({
|
|
1612
1612
|
position: "absolute",
|
|
1613
1613
|
width: "25px",
|
|
1614
1614
|
"&.enter": { opacity: "0" },
|
|
@@ -1621,7 +1621,7 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
|
|
|
1621
1621
|
opacity: "0",
|
|
1622
1622
|
transition: "opacity 0.3s ease-in"
|
|
1623
1623
|
}
|
|
1624
|
-
})), Qe =
|
|
1624
|
+
})), Qe = l("div")(() => ({
|
|
1625
1625
|
width: "25px",
|
|
1626
1626
|
marginRight: "5px",
|
|
1627
1627
|
display: "flex",
|
|
@@ -1712,21 +1712,21 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
|
|
|
1712
1712
|
})
|
|
1713
1713
|
});
|
|
1714
1714
|
}
|
|
1715
|
-
}, et =
|
|
1715
|
+
}, et = l("div")(({ theme: e }) => ({
|
|
1716
1716
|
marginLeft: "auto",
|
|
1717
1717
|
marginRight: "auto",
|
|
1718
1718
|
marginTop: e.spacing(1),
|
|
1719
1719
|
marginBottom: e.spacing(1)
|
|
1720
|
-
})), tt =
|
|
1720
|
+
})), tt = l("td")({ padding: "5px 0" }), nt = l(m)(({ theme: e }) => ({ margin: e.spacing(2) })), rt = l("th")({ padding: 0 }), J = l("div")(({ theme: e, isQuestionText: t }) => ({
|
|
1721
1721
|
padding: e.spacing(1.5),
|
|
1722
1722
|
textAlign: t ? "left" : "center"
|
|
1723
|
-
})), it =
|
|
1723
|
+
})), it = l("tr")({
|
|
1724
1724
|
border: 0,
|
|
1725
|
-
borderTop: `2.5px solid ${
|
|
1725
|
+
borderTop: `2.5px solid ${c.primaryLight()}`,
|
|
1726
1726
|
width: "100%"
|
|
1727
|
-
}), at =
|
|
1728
|
-
color:
|
|
1729
|
-
backgroundColor:
|
|
1727
|
+
}), at = l("table")({
|
|
1728
|
+
color: c.text(),
|
|
1729
|
+
backgroundColor: c.background(),
|
|
1730
1730
|
borderCollapse: "collapse",
|
|
1731
1731
|
borderSpacing: 0,
|
|
1732
1732
|
marginBottom: 0
|
|
@@ -1756,7 +1756,7 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
|
|
|
1756
1756
|
return r[e][n] === !0 && t === !1 || r[e][n] === !1 && t === !0;
|
|
1757
1757
|
};
|
|
1758
1758
|
render() {
|
|
1759
|
-
let { showCorrect: e, headers: t, rows: n, choiceMode: r, answers: i, disabled: a, view: o } = this.props,
|
|
1759
|
+
let { showCorrect: e, headers: t, rows: n, choiceMode: r, answers: i, disabled: a, view: o } = this.props, s = r === "radio" ? p : u, l = a && !o;
|
|
1760
1760
|
return !n || n.length === 0 ? /* @__PURE__ */ b(et, { children: /* @__PURE__ */ b(nt, {
|
|
1761
1761
|
component: "div",
|
|
1762
1762
|
children: "There are currently no questions to show."
|
|
@@ -1780,16 +1780,16 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
|
|
|
1780
1780
|
})
|
|
1781
1781
|
}, `td-title-${n}`), (i[t.id] || []).map((r, i) => /* @__PURE__ */ b(tt, {
|
|
1782
1782
|
"data-colno": `${i + 1}`,
|
|
1783
|
-
children: /* @__PURE__ */ b(J, { children: /* @__PURE__ */ b(
|
|
1783
|
+
children: /* @__PURE__ */ b(J, { children: /* @__PURE__ */ b(s, {
|
|
1784
1784
|
sx: {
|
|
1785
1785
|
padding: "6px",
|
|
1786
|
-
color: e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ?
|
|
1786
|
+
color: e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ? c.correct() : l && this.answerIsIncorrect(t.id, r, i) ? c.incorrect() : r === !0 && !l ? c.primary() : a ? c.disabled() : c.text(),
|
|
1787
1787
|
cursor: a ? "not-allowed" : "pointer",
|
|
1788
1788
|
pointerEvents: a ? "initial" : "auto",
|
|
1789
1789
|
opacity: a ? .7 : 1,
|
|
1790
1790
|
"& input": { width: "100% !important" },
|
|
1791
|
-
"&:hover": { color: a ?
|
|
1792
|
-
"&.Mui-disabled": { color: `${e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ?
|
|
1791
|
+
"&:hover": { color: a ? c.disabled() : c.primaryLight() },
|
|
1792
|
+
"&.Mui-disabled": { color: `${e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ? c.correct() : l && this.answerIsIncorrect(t.id, r, i) ? c.incorrect() : r === !0 && !l ? c.primary() : c.disabled()}` }
|
|
1793
1793
|
},
|
|
1794
1794
|
disabled: a,
|
|
1795
1795
|
onChange: this.onRowValueChange(t.id, i),
|
|
@@ -1808,7 +1808,7 @@ function Y(e) {
|
|
|
1808
1808
|
function X(e, t) {
|
|
1809
1809
|
return !e || Y(e) ? e : Y(e.default) ? e.default : t && Y(e[t]) ? e[t] : t && Y(e[t]?.default) ? e[t].default : e;
|
|
1810
1810
|
}
|
|
1811
|
-
var st = X(g, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(d, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), ct = X(
|
|
1811
|
+
var st = X(g, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(d, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), ct = X(o, "Feedback") || X($.Feedback, "Feedback"), lt = X(r, "Collapsible") || X($.Collapsible, "Collapsible"), ut = i, Q = ut.default, $ = Q && typeof Q == "object" ? Q : ut, dt = l("div")({ verticalAlign: "middle" }), ft = l(lt)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), pt = class extends _.Component {
|
|
1812
1812
|
static propTypes = {
|
|
1813
1813
|
session: S.default.object.isRequired,
|
|
1814
1814
|
onSessionChange: S.default.func,
|
|
@@ -1859,11 +1859,11 @@ var st = X(g, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(d, "PreviewPrompt"
|
|
|
1859
1859
|
} }), this.callOnSessionChange);
|
|
1860
1860
|
};
|
|
1861
1861
|
render() {
|
|
1862
|
-
let { model: e } = this.props, { showCorrect: t, session: n } = this.state, { correctness: r = {}, extraCSSRules:
|
|
1862
|
+
let { model: e } = this.props, { showCorrect: t, session: n } = this.state, { correctness: r = {}, extraCSSRules: i, language: o } = e, s = r.correctness && r.correctness !== "correct", c = e.rationale && (a(e.rationale) || h(e.rationale));
|
|
1863
1863
|
return /* @__PURE__ */ x(st, {
|
|
1864
|
-
extraCSSRules:
|
|
1864
|
+
extraCSSRules: i,
|
|
1865
1865
|
children: [
|
|
1866
|
-
e.teacherInstructions && (
|
|
1866
|
+
e.teacherInstructions && (a(e.teacherInstructions) || h(e.teacherInstructions)) && /* @__PURE__ */ b(ft, {
|
|
1867
1867
|
labels: {
|
|
1868
1868
|
hidden: "Show Teacher Instructions",
|
|
1869
1869
|
visible: "Hide Teacher Instructions"
|
|
@@ -1971,7 +1971,7 @@ var mt = class e extends CustomEvent {
|
|
|
1971
1971
|
onSessionChange: this.sessionChanged.bind(this)
|
|
1972
1972
|
});
|
|
1973
1973
|
this._root ||= y(this), this._root.render(e), queueMicrotask(() => {
|
|
1974
|
-
|
|
1974
|
+
t(this);
|
|
1975
1975
|
});
|
|
1976
1976
|
}
|
|
1977
1977
|
disconnectedCallback() {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region ../../shared/lodash/dist/index.js
|
|
2
|
+
var e = Object.prototype;
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "object" && !!e;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
if (!t(e)) return e;
|
|
11
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
12
|
+
if (Array.isArray(e)) return e.map((e) => r(e));
|
|
13
|
+
let n = {};
|
|
14
|
+
for (let [t, i] of Object.entries(e)) n[t] = r(i);
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function i(e) {
|
|
18
|
+
return (e ?? []).filter(Boolean);
|
|
19
|
+
}
|
|
20
|
+
function a(e, t = 0, n = {}) {
|
|
21
|
+
let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
|
|
22
|
+
if (!a) return s;
|
|
23
|
+
let t = a, n = o;
|
|
24
|
+
return a = void 0, o = void 0, s = e.apply(n, t), s;
|
|
25
|
+
}, d = () => {
|
|
26
|
+
r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
|
|
27
|
+
}, f = function(...e) {
|
|
28
|
+
let d = c && !r;
|
|
29
|
+
return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
|
|
30
|
+
r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
|
|
31
|
+
}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
|
|
32
|
+
r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
|
|
33
|
+
}, n.maxWait)), s;
|
|
34
|
+
};
|
|
35
|
+
return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
|
|
36
|
+
}
|
|
37
|
+
function o(e) {
|
|
38
|
+
let t = [];
|
|
39
|
+
for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
function s(e, t, r) {
|
|
43
|
+
let i = e;
|
|
44
|
+
for (let e of n(t)) {
|
|
45
|
+
if (i == null) return r;
|
|
46
|
+
i = i[e];
|
|
47
|
+
}
|
|
48
|
+
return i === void 0 ? r : i;
|
|
49
|
+
}
|
|
50
|
+
function c(e) {
|
|
51
|
+
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : t(e) ? Object.keys(e).length === 0 : !0;
|
|
52
|
+
}
|
|
53
|
+
function l(n, r, i) {
|
|
54
|
+
let a = i?.(n, r);
|
|
55
|
+
if (a !== void 0) return !!a;
|
|
56
|
+
if (Object.is(n, r)) return !0;
|
|
57
|
+
if (!t(n) || !t(r)) return !1;
|
|
58
|
+
if (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();
|
|
59
|
+
if (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => l(e, r[t], i));
|
|
60
|
+
let o = Object.keys(n), s = Object.keys(r);
|
|
61
|
+
return o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && l(n[t], r[t], i));
|
|
62
|
+
}
|
|
63
|
+
function u(e, t) {
|
|
64
|
+
return l(e, t);
|
|
65
|
+
}
|
|
66
|
+
function d(e) {
|
|
67
|
+
return Number.isFinite(e);
|
|
68
|
+
}
|
|
69
|
+
function f(e, ...n) {
|
|
70
|
+
for (let i of n) if (i) for (let [n, a] of Object.entries(i)) t(a) && !Array.isArray(a) && t(e[n]) ? f(e[n], a) : e[n] = r(a);
|
|
71
|
+
return e;
|
|
72
|
+
}
|
|
73
|
+
function p(e, t) {
|
|
74
|
+
let n = { ...e ?? {} };
|
|
75
|
+
for (let e of Array.isArray(t) ? t : [t]) delete n[e];
|
|
76
|
+
return n;
|
|
77
|
+
}
|
|
78
|
+
function m(e, t, r) {
|
|
79
|
+
let i = n(t), a = e;
|
|
80
|
+
return i.forEach((e, t) => {
|
|
81
|
+
if (t === i.length - 1) {
|
|
82
|
+
a[e] = r;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let n = i[t + 1];
|
|
86
|
+
a[e] ??= typeof n == "number" || /^\d+$/.test(String(n)) ? [] : {}, a = a[e];
|
|
87
|
+
}), e;
|
|
88
|
+
}
|
|
89
|
+
function h(e, t) {
|
|
90
|
+
let n = t ?? ((e) => e);
|
|
91
|
+
return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
|
|
92
|
+
}
|
|
93
|
+
function g(...e) {
|
|
94
|
+
let t = Math.max(0, ...e.map((e) => e.length));
|
|
95
|
+
return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { c as a, r as c, i as d, s as f, d as i, h as l, f as n, p as o, o as p, m as r, a as s, u as t, g as u };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=dist-i687VHmY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-i687VHmY.js","names":[],"sources":["../../../../shared/lodash/dist/index.js"],"sourcesContent":["//#region src/index.ts\nvar e = Object.prototype;\nfunction t(e) {\n\treturn typeof e == \"object\" && !!e;\n}\nfunction n(e) {\n\treturn Array.isArray(e) ? e : typeof e == \"number\" ? [e] : e.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\").filter(Boolean);\n}\nfunction r(e) {\n\treturn (t) => x(t, e);\n}\nfunction i(e) {\n\treturn (n) => t(n) ? Object.entries(e).every(([e, t]) => A(n[e], t)) : !1;\n}\nfunction a(e) {\n\treturn typeof e == \"function\" ? e : typeof e == \"string\" ? r(e) : t(e) ? i(e) : ((e) => e);\n}\nfunction o(e, ...t) {\n\treturn Object.assign(e, ...t.filter(Boolean));\n}\nfunction s(e, t = 1) {\n\tif (!e?.length || t < 1) return [];\n\tlet n = [];\n\tfor (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));\n\treturn n;\n}\nfunction c(e) {\n\treturn Array.isArray(e) ? e.slice() : t(e) ? { ...e } : e;\n}\nfunction l(e) {\n\tif (!t(e)) return e;\n\tif (e instanceof Date) return new Date(e.getTime());\n\tif (Array.isArray(e)) return e.map((e) => l(e));\n\tlet n = {};\n\tfor (let [t, r] of Object.entries(e)) n[t] = l(r);\n\treturn n;\n}\nfunction u(e) {\n\treturn (e ?? []).filter(Boolean);\n}\nfunction d(e, ...t) {\n\tlet n = [...e ?? []];\n\tfor (let e of t) Array.isArray(e) ? n.push(...e) : n.push(e);\n\treturn n;\n}\nfunction f(e, t = 0, n = {}) {\n\tlet r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {\n\t\tif (!a) return s;\n\t\tlet t = a, n = o;\n\t\treturn a = void 0, o = void 0, s = e.apply(n, t), s;\n\t}, d = () => {\n\t\tr && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;\n\t}, f = function(...e) {\n\t\tlet d = c && !r;\n\t\treturn a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {\n\t\t\tr = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);\n\t\t}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {\n\t\t\tr && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);\n\t\t}, n.maxWait)), s;\n\t};\n\treturn f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;\n}\nfunction p(e, ...t) {\n\tfor (let n of t) if (n) for (let [t, r] of Object.entries(n)) e[t] === void 0 && (e[t] = r);\n\treturn e;\n}\nfunction m(e, ...t) {\n\tlet n = new Set(t.flat());\n\treturn (e ?? []).filter((e) => !n.has(e));\n}\nfunction h(e, t, n) {\n\treturn (e ?? []).filter((e) => !(t ?? []).some((t) => n(e, t)));\n}\nfunction g(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (!n(i, t, e)) return !1;\n\treturn !0;\n}\nfunction ee(e) {\n\treturn String(e).replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\");\n}\nfunction _(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (n(i, t, e)) return i;\n}\nfunction v(e, t) {\n\tlet n = a(t);\n\tfor (let [t, r] of Object.entries(e ?? {})) if (n(r, t, e)) return t;\n}\nfunction y(e) {\n\tlet t = [];\n\tfor (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);\n\treturn t;\n}\nfunction te(e, t) {\n\treturn R(e, t).flat();\n}\nfunction b(e, t) {\n\tlet n = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [r, i] of n) t(i, r, e);\n\treturn e;\n}\nfunction x(e, t, r) {\n\tlet i = e;\n\tfor (let e of n(t)) {\n\t\tif (i == null) return r;\n\t\ti = i[e];\n\t}\n\treturn i === void 0 ? r : i;\n}\nfunction S(e, t) {\n\tlet n = a(t);\n\treturn K(e, (t, r, i) => {\n\t\tlet a = String(n(r, i, e));\n\t\treturn (t[a] ??= []).push(r), t;\n\t}, {});\n}\nfunction C(e) {\n\treturn e?.[0];\n}\nfunction w(e) {\n\treturn (e ?? []).slice(0, -1);\n}\nfunction T(e, t) {\n\treturn typeof e == \"string\" ? e.includes(String(t)) : Array.isArray(e) ? e.includes(t) : Object.values(e ?? {}).includes(t);\n}\nfunction E(...e) {\n\tlet [t, ...n] = e;\n\treturn $((t ?? []).filter((e) => n.every((t) => (t ?? []).includes(e))));\n}\nfunction D(e) {\n\treturn Array.isArray(e);\n}\nfunction O(e) {\n\treturn e == null ? !0 : typeof e == \"string\" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : t(e) ? Object.keys(e).length === 0 : !0;\n}\nfunction k(n, r, i) {\n\tlet a = i?.(n, r);\n\tif (a !== void 0) return !!a;\n\tif (Object.is(n, r)) return !0;\n\tif (!t(n) || !t(r)) return !1;\n\tif (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();\n\tif (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => k(e, r[t], i));\n\tlet o = Object.keys(n), s = Object.keys(r);\n\treturn o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && k(n[t], r[t], i));\n}\nfunction A(e, t) {\n\treturn k(e, t);\n}\nfunction j(e, t, n) {\n\treturn k(e, t, n);\n}\nfunction M(e) {\n\treturn Number.isFinite(e);\n}\nfunction N(e) {\n\treturn typeof e == \"function\";\n}\nfunction P(e) {\n\treturn typeof e == \"number\" || e instanceof Number;\n}\nfunction F(e) {\n\treturn typeof e == \"object\" && !!e || typeof e == \"function\";\n}\nfunction I(e) {\n\treturn typeof e == \"string\" || e instanceof String;\n}\nfunction L(e) {\n\treturn e === void 0;\n}\nfunction R(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {}), i = [];\n\tfor (let [t, a] of r) i.push(n(a, t, e));\n\treturn i;\n}\nfunction z(e) {\n\treturn e?.length ? Math.max(...e) : void 0;\n}\nfunction B(e, ...n) {\n\tfor (let r of n) if (r) for (let [n, i] of Object.entries(r)) t(i) && !Array.isArray(i) && t(e[n]) ? B(e[n], i) : e[n] = l(i);\n\treturn e;\n}\nfunction V(e, t) {\n\tlet n = { ...e ?? {} };\n\tfor (let e of Array.isArray(t) ? t : [t]) delete n[e];\n\treturn n;\n}\nfunction H(e, t) {\n\tlet n = a(t), r = {};\n\tfor (let [t, i] of Object.entries(e ?? {})) n(i, t, e) || (r[t] = i);\n\treturn r;\n}\nfunction U(e, ...t) {\n\tlet n = {};\n\tfor (let r of t.flat()) e && r in e && (n[r] = e[r]);\n\treturn n;\n}\nfunction W(e, t, n = 1) {\n\tlet r = t ?? e, i = t === void 0 ? 0 : e;\n\tif (n === 0) return [];\n\tlet a = [], o = n > 0;\n\tfor (let e = i; o ? e < r : e > r; e += n) a.push(e);\n\treturn a;\n}\nfunction G(e, t, n = 1) {\n\treturn W(e, t, n).reverse();\n}\nfunction K(e, t, n) {\n\tlet r = n, i = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [n, a] of i) r = t(r, a, n, e);\n\treturn r;\n}\nfunction q(e, t) {\n\tlet n = a(t), r = [];\n\tfor (let t = e.length - 1; t >= 0; t--) n(e[t], t, e) && r.unshift(...e.splice(t, 1));\n\treturn r;\n}\nfunction J(e, t, r) {\n\tlet i = n(t), a = e;\n\treturn i.forEach((e, t) => {\n\t\tif (t === i.length - 1) {\n\t\t\ta[e] = r;\n\t\t\treturn;\n\t\t}\n\t\tlet n = i[t + 1];\n\t\ta[e] ??= typeof n == \"number\" || /^\\d+$/.test(String(n)) ? [] : {}, a = a[e];\n\t}), e;\n}\nfunction Y(e) {\n\tlet t = [...e ?? []];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction X(e) {\n\treturn (e ?? []).slice(1);\n}\nfunction Z(e, t = 1) {\n\treturn t <= 0 ? [] : (e ?? []).slice(-t);\n}\nfunction Q(e, t = 0, n = {}) {\n\treturn f(e, t, {\n\t\tleading: n.leading !== !1,\n\t\ttrailing: n.trailing !== !1,\n\t\tmaxWait: t\n\t});\n}\nfunction ne(e, t) {\n\tlet n = t ?? ((e) => e);\n\treturn Array.from({ length: Math.max(0, e) }, (e, t) => n(t));\n}\nvar re = 0;\nfunction ie(e = \"\") {\n\treturn re += 1, `${e}${re}`;\n}\nfunction $(e) {\n\treturn Array.from(new Set(e ?? []));\n}\nfunction ae(e, t) {\n\tlet n = [];\n\tfor (let r of e ?? []) n.some((e) => t(r, e)) || n.push(r);\n\treturn n;\n}\nfunction oe(...e) {\n\tlet t = Math.max(0, ...e.map((e) => e.length));\n\treturn Array.from({ length: t }, (t, n) => e.map((e) => e[n]));\n}\nvar se = {\n\tassign: o,\n\tchunk: s,\n\tclone: c,\n\tcloneDeep: l,\n\tcompact: u,\n\tconcat: d,\n\tdebounce: f,\n\tdefaults: p,\n\tdifference: m,\n\tdifferenceWith: h,\n\tevery: g,\n\tescape: ee,\n\tfind: _,\n\tfindKey: v,\n\tflatten: y,\n\tflatMap: te,\n\tforEach: b,\n\tget: x,\n\tgroupBy: S,\n\thead: C,\n\tincludes: T,\n\tinitial: w,\n\tintersection: E,\n\tisArray: D,\n\tisEmpty: O,\n\tisEqual: A,\n\tisEqualWith: j,\n\tisFinite: M,\n\tisFunction: N,\n\tisNumber: P,\n\tisObject: F,\n\tisString: I,\n\tisUndefined: L,\n\tmap: R,\n\tmax: z,\n\tmerge: B,\n\tomit: V,\n\tomitBy: H,\n\tpick: U,\n\trange: W,\n\trangeRight: G,\n\treduce: K,\n\tremove: q,\n\tset: J,\n\tshuffle: Y,\n\ttail: X,\n\ttakeRight: Z,\n\tthrottle: Q,\n\ttimes: ne,\n\tuniqueId: ie,\n\tuniq: $,\n\tuniqWith: ae,\n\tzip: oe\n};\n//#endregion\nexport { o as assign, s as chunk, c as clone, l as cloneDeep, u as compact, d as concat, f as debounce, se as default, p as defaults, m as difference, h as differenceWith, ee as escape, g as every, _ as find, v as findKey, te as flatMap, y as flatten, b as forEach, x as get, S as groupBy, C as head, T as includes, w as initial, E as intersection, D as isArray, O as isEmpty, A as isEqual, j as isEqualWith, M as isFinite, N as isFunction, P as isNumber, F as isObject, I as isString, L as isUndefined, R as map, z as max, B as merge, V as omit, H as omitBy, U as pick, W as range, G as rangeRight, K as reduce, q as remove, J as set, Y as shuffle, X as tail, Z as takeRight, Q as throttle, ne as times, $ as uniq, ae as uniqWith, ie as uniqueId, oe as zip };\n"],"mappings":";AACA,IAAI,IAAI,OAAO;AACf,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,KAAK,YAAY,CAAC,CAAC;AAClC;AACA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,IAAI,OAAO,KAAK,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,cAAc,KAAK,EAAE,MAAM,GAAG,EAAE,OAAO,OAAO;AACpH;AAsBA,SAAS,EAAE,GAAG;CACb,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO;CAClB,IAAI,aAAa,MAAM,OAAO,IAAI,KAAK,EAAE,QAAQ,CAAC;CAClD,IAAI,MAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CAC9C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;CAChD,OAAO;AACR;AACA,SAAS,EAAE,GAAG;CACb,QAAQ,KAAK,CAAC,GAAG,OAAO,OAAO;AAChC;AAMA,SAAS,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG;CAC5B,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,EAAE,YAAY,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,GAAG,UAAU;EACzE,IAAI,CAAC,GAAG,OAAO;EACf,IAAI,IAAI,GAAG,IAAI;EACf,OAAO,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG;CACnD,GAAG,UAAU;EACZ,KAAK,aAAa,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IA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,GAAG,KAAK,CAAC,EAAE;CACrB,KAAK,IAAI,KAAK,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE;CACnD,OAAO;AACR;AA+BA,SAAS,EAAE,GAAG,GAAG,GAAG;CACnB,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI;CAClB,OAAO,EAAE,SAAS,GAAG,MAAM;EAC1B,IAAI,MAAM,EAAE,SAAS,GAAG;GACvB,EAAE,KAAK;GACP;EACD;EACA,IAAI,IAAI,EAAE,IAAI;EACd,EAAE,OAAO,OAAO,KAAK,YAAY,QAAQ,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;CAC3E,CAAC,GAAG;AACL;AAsBA,SAAS,EAAG,GAAG,GAAG;CACjB,IAAI,IAAI,OAAO,MAAM;CACrB,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,CAAC,CAAC;AAC7D;AAaA,SAAS,EAAG,GAAG,GAAG;CACjB,IAAI,IAAI,KAAK,IAAI,GAAG,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,CAAC;CAC7C,OAAO,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;AAC9D"}
|
package/dist/controller/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js";
|
|
4
|
-
import r from "./defaults.js";
|
|
1
|
+
import e from "./defaults.js";
|
|
2
|
+
import { cloneDeep as t, isEmpty as n, isEqual as r } from "@pie-element/shared-lodash";
|
|
5
3
|
import { getFeedbackForCorrectness as i } from "@pie-element/shared-feedback";
|
|
6
4
|
import { getShuffledChoices as a, lockChoices as o, partialScoring as s } from "@pie-element/shared-controller-utils";
|
|
7
5
|
import c from "debug";
|
|
@@ -29,10 +27,10 @@ var l = c("@pie-element:match:controller"), u = (e, t, n = {}) => {
|
|
|
29
27
|
incorrectAnswers: r
|
|
30
28
|
};
|
|
31
29
|
}, p = (e, t) => {
|
|
32
|
-
let
|
|
30
|
+
let n = 0;
|
|
33
31
|
return e.forEach((e) => {
|
|
34
|
-
|
|
35
|
-
}),
|
|
32
|
+
r(e.values, t[e.id]) && (n += 1);
|
|
33
|
+
}), n;
|
|
36
34
|
}, m = (e) => {
|
|
37
35
|
let t = e.choiceMode === "checkbox" ? e.layout - 1 : 1;
|
|
38
36
|
return (e.rows.length || 0) * t;
|
|
@@ -57,51 +55,51 @@ var l = c("@pie-element:match:controller"), u = (e, t, n = {}) => {
|
|
|
57
55
|
}, _ = (e, t, n = {}) => {
|
|
58
56
|
let r = d(e, t, n), i = s.enabled(e, t);
|
|
59
57
|
return r === "correct" ? 1 : r === "partial" && i ? g(e, n) : 0;
|
|
60
|
-
}, v = (e, t,
|
|
58
|
+
}, v = (e, t, n) => {
|
|
61
59
|
let i = [], a = t?.answers || {}, o = e?.rows || [], c = e.choiceMode === "checkbox";
|
|
62
60
|
if (!a || Object.keys(a).length === 0) return i.push("Student did not provide any answer."), i;
|
|
63
61
|
i.push(`Match item contains ${o.length} row(s).`), i.push(`Matching mode: ${c ? "checkbox (multiple matches allowed)" : "radio (single match per row)"}.`);
|
|
64
62
|
let l = 0, u = 0, d = 0;
|
|
65
63
|
o.forEach((e) => {
|
|
66
|
-
let t = a[e.id],
|
|
67
|
-
c ?
|
|
64
|
+
let t = a[e.id], n = e.values || [];
|
|
65
|
+
c ? n.forEach((e, n) => {
|
|
68
66
|
e && d++, t && t[n] && (t[n] === e ? l++ : u++);
|
|
69
|
-
}) : (d++, t && (n
|
|
67
|
+
}) : (d++, t && (r(n, t) ? l++ : u++));
|
|
70
68
|
}), l > 0 && i.push(`${l} correct match(es) selected.`), u > 0 && i.push(`${u} incorrect match(es) selected.`), l === 0 && u === 0 && i.push("Student provided answers, but none matched the correct responses.");
|
|
71
|
-
let f = s.enabled(e,
|
|
69
|
+
let f = s.enabled(e, n);
|
|
72
70
|
f ? (i.push("Score calculated using partial scoring."), c ? (i.push("Score is based on the number of correct minus extra incorrect matches, divided by the total number of correct matches."), l + u > d && i.push("Extra selected matches beyond the correct set reduce the score.")) : i.push("Score is based on the number of correctly matched rows divided by the total number of rows.")) : (i.push("Score calculated using all-or-nothing scoring."), i.push("Student must match all rows correctly to receive full credit."));
|
|
73
|
-
let p = _(e,
|
|
71
|
+
let p = _(e, n, a), m = f ? p : +(p === 1);
|
|
74
72
|
return i.push(`Final score: ${m}.`), i;
|
|
75
|
-
}, y = (e,
|
|
76
|
-
r.mode === "evaluate" ? ((!
|
|
73
|
+
}, y = (e, t, r) => new Promise((i) => {
|
|
74
|
+
r.mode === "evaluate" ? ((!t || n(t)) && i({
|
|
77
75
|
score: 0,
|
|
78
76
|
empty: !0,
|
|
79
77
|
logTrace: ["Student did not provide any answer."]
|
|
80
78
|
}), i({
|
|
81
|
-
score: _(e, r,
|
|
79
|
+
score: _(e, r, t.answers),
|
|
82
80
|
empty: !1,
|
|
83
|
-
logTrace: v(e,
|
|
81
|
+
logTrace: v(e, t, r)
|
|
84
82
|
})) : i({
|
|
85
83
|
score: void 0,
|
|
86
84
|
completed: void 0,
|
|
87
85
|
logTrace: []
|
|
88
86
|
});
|
|
89
87
|
});
|
|
90
|
-
function b(
|
|
91
|
-
return new Promise((
|
|
92
|
-
|
|
93
|
-
...
|
|
94
|
-
...
|
|
88
|
+
function b(t = {}) {
|
|
89
|
+
return new Promise((n) => {
|
|
90
|
+
n({
|
|
91
|
+
...e,
|
|
92
|
+
...t
|
|
95
93
|
});
|
|
96
94
|
});
|
|
97
95
|
}
|
|
98
|
-
var x = (
|
|
99
|
-
...
|
|
100
|
-
...
|
|
96
|
+
var x = (t) => ({
|
|
97
|
+
...e,
|
|
98
|
+
...t
|
|
101
99
|
});
|
|
102
|
-
async function S(
|
|
103
|
-
let u =
|
|
104
|
-
(!r ||
|
|
100
|
+
async function S(e, r, s, c) {
|
|
101
|
+
let u = t(x(e)), f, p;
|
|
102
|
+
(!r || n(r)) && s.mode === "evaluate" ? (f = "unanswered", p = "0%") : (f = d(u, s, r && r.answers), p = `${_(u, s, r && r.answers) * 100}%`);
|
|
105
103
|
let m = {}, h = {
|
|
106
104
|
score: p,
|
|
107
105
|
correctness: f
|