@pie-element/graphing 11.0.4-next.20261011174919 → 11.0.4
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/configure.d.ts +23 -13
- package/dist/author/configure.js +84 -93
- package/dist/author/correct-response.d.ts +2 -0
- package/dist/author/correct-response.js +2 -0
- package/dist/author/defaults.d.ts +196 -80
- package/dist/author/graphing-config.d.ts +2 -0
- package/dist/author/graphing-config.js +2 -0
- package/dist/author/index.d.ts +18 -46
- package/dist/author/index.js +7 -2
- package/dist/browser/author/index.js +17 -19
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +125 -135
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +17 -19
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +125 -135
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +18 -17
- package/dist/controller/index.d.ts +56 -16
- package/dist/controller/index.js +23 -20
- package/dist/controller/utils.d.ts +24 -28
- package/dist/controller/utils.js +77 -90
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +757 -0
- package/dist/schemas/model.schema.json +702 -0
- package/dist/schemas/session.schema.json +127 -0
- package/dist/types.d.ts +346 -0
- package/package.json +20 -16
|
@@ -58,80 +58,71 @@ var f = /* @__PURE__ */ d(c(), 1), p = {
|
|
|
58
58
|
"sine",
|
|
59
59
|
"vector"
|
|
60
60
|
]
|
|
61
|
-
}, m = (e, t) => (e = { ...e }, t = { ...t }, n(e.x, t.x) && n(e.y, t.y)),
|
|
61
|
+
}, m = (e) => ({ ...e }), h = (e, t) => (e = { ...e }, t = { ...t }, n(e.x, t.x) && n(e.y, t.y)), g = (e, t) => {
|
|
62
62
|
let r = !0;
|
|
63
63
|
return e = { ...e }, t = { ...t }, (e.label || t.label) && (r = n(e.label, t.label)), n(e.x, t.x) && n(e.y, t.y) && r;
|
|
64
|
-
},
|
|
65
|
-
e =
|
|
66
|
-
...e,
|
|
67
|
-
to: { ...e.to },
|
|
68
|
-
from: { ...e.from }
|
|
69
|
-
};
|
|
70
|
-
let t = e.from.x, n = e.from.y, r = e.to.x, i = e.to.y;
|
|
64
|
+
}, _ = (e, t) => n(e.from, t.from) && n(e.to, t.to) || n(e.to, t.from) && n(e.from, t.to), v = (e, t) => n(e.from, t.from) && n(e.to, t.to), y = (e) => Object.keys(e || {}).sort().reduce((t, n) => (e && n !== "correctAnswer" && (t[n] = e[n]), t), {}), b = (e) => {
|
|
65
|
+
let t = m(e.from), n = m(e.to), r = t.x, i = t.y, a = n.x, o = n.y;
|
|
71
66
|
return {
|
|
72
|
-
a:
|
|
73
|
-
b:
|
|
74
|
-
c:
|
|
67
|
+
a: o - i,
|
|
68
|
+
b: r - a,
|
|
69
|
+
c: a * i - r * o
|
|
75
70
|
};
|
|
76
|
-
},
|
|
77
|
-
let { a: n, b: i, c: a } =
|
|
78
|
-
if (o !== 0) l.push(
|
|
71
|
+
}, x = (e) => Math.round(e * 1e4) / 1e4, S = (e, t) => {
|
|
72
|
+
let { a: n, b: i, c: a } = b(e), { a: o, b: s, c } = b(t), l = [];
|
|
73
|
+
if (o !== 0) l.push(x(n / o));
|
|
79
74
|
else if (n !== o) return !1;
|
|
80
|
-
if (s !== 0) l.push(
|
|
75
|
+
if (s !== 0) l.push(x(i / s));
|
|
81
76
|
else if (i !== s) return !1;
|
|
82
|
-
if (c !== 0) l.push(
|
|
77
|
+
if (c !== 0) l.push(x(a / c));
|
|
83
78
|
else if (a !== c) return !1;
|
|
84
79
|
return r(l).length === 1;
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
to:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
let
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
let { points: n } = e, { points: r } = t, i =
|
|
80
|
+
}, C = (e, t) => {
|
|
81
|
+
let n = {
|
|
82
|
+
from: m(e.from),
|
|
83
|
+
to: m(e.to)
|
|
84
|
+
}, r = {
|
|
85
|
+
from: m(t.from),
|
|
86
|
+
to: m(t.to)
|
|
87
|
+
}, i = (n.to.y - n.from.y) / (n.to.x - n.from.x), a = (r.to.y - r.from.y) / (r.to.x - r.from.x), o = Math.atan2(n.to.y - n.from.y, n.to.x - n.from.x) * 180 / Math.PI, s = Math.atan2(r.to.y - r.from.y, r.to.x - r.from.x) * 180 / Math.PI;
|
|
88
|
+
return i === a && n.from.x === r.from.x && n.from.y === r.from.y && o === s;
|
|
89
|
+
}, w = (e) => {
|
|
90
|
+
let t = e || [];
|
|
91
|
+
return t.map((e, n) => ({
|
|
92
|
+
from: e,
|
|
93
|
+
to: t[(n + 1) % t.length]
|
|
94
|
+
}));
|
|
95
|
+
}, T = (e) => (e ||= [], l(e, (e, t) => _(e, t))), E = (e) => (e ||= [], e.filter((e) => !n(e.from, e.to))), D = (e, t) => {
|
|
96
|
+
let { points: n } = e, { points: r } = t, i = w(n), a = w(r), o = T(E(i)), s = T(E(a)), c = u(o, s, _), l = u(s, o, _);
|
|
102
97
|
return (!c || !c.length) && (!l || !l.length);
|
|
103
|
-
}, D = (e, t) => {
|
|
104
|
-
if (e = {
|
|
105
|
-
...e,
|
|
106
|
-
root: { ...e.root },
|
|
107
|
-
edge: { ...e.edge }
|
|
108
|
-
}, t = {
|
|
109
|
-
...t,
|
|
110
|
-
root: { ...t.root },
|
|
111
|
-
edge: { ...t.edge }
|
|
112
|
-
}, n(t.edge, e.edge) && n(t.root, e.root)) return !0;
|
|
113
|
-
let r = Math.sqrt((e.edge.x - e.root.x) ** 2 + (e.edge.y - e.root.y) ** 2), i = Math.sqrt((t.edge.x - t.root.x) ** 2 + (t.edge.y - t.root.y) ** 2);
|
|
114
|
-
return n(t.root, e.root) && n(r, i);
|
|
115
98
|
}, O = (e, t) => {
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
let r = {
|
|
100
|
+
root: m(e.root),
|
|
101
|
+
edge: m(e.edge)
|
|
102
|
+
}, i = {
|
|
103
|
+
root: m(t.root),
|
|
104
|
+
edge: m(t.edge)
|
|
105
|
+
};
|
|
106
|
+
if (n(i.edge, r.edge) && n(i.root, r.root)) return !0;
|
|
107
|
+
let a = Math.sqrt((r.edge.x - r.root.x) ** 2 + (r.edge.y - r.root.y) ** 2), o = Math.sqrt((i.edge.x - i.root.x) ** 2 + (i.edge.y - i.root.y) ** 2);
|
|
108
|
+
return n(i.root, r.root) && n(a, o);
|
|
109
|
+
}, k = (e, t) => {
|
|
110
|
+
let n = (e) => {
|
|
111
|
+
let t = m(e.root), n = m(e.edge), { amplitude: r, freq: i } = s(t, n), a = Math.abs(t.y - n.y) * 2, o = Math.abs(t.x - n.x) * 2, c = n.x, l = n.y;
|
|
112
|
+
for (; c < 0 && o !== 0;) c += o, l = l < t.y ? l + a : l - a;
|
|
113
|
+
for (; c - o > 0 && o !== 0;) c -= o, l = l < t.y ? l + a : l - a;
|
|
121
114
|
return {
|
|
122
|
-
amplitude:
|
|
123
|
-
freq:
|
|
124
|
-
min:
|
|
125
|
-
max:
|
|
126
|
-
edgeAboveZeroX:
|
|
127
|
-
edgeAboveZeroY:
|
|
115
|
+
amplitude: x(r),
|
|
116
|
+
freq: x(i),
|
|
117
|
+
min: x(n.y < t.y ? n.y : n.y - a),
|
|
118
|
+
max: x(n.y < t.y ? n.y + a : n.y),
|
|
119
|
+
edgeAboveZeroX: x(c),
|
|
120
|
+
edgeAboveZeroY: x(l)
|
|
128
121
|
};
|
|
129
|
-
}, r = n(e), i = n(t), { amplitude: a, freq: o, min: c, max: l, edgeAboveZeroX: u, edgeAboveZeroY: d } = r, { amplitude: f, freq: p, min:
|
|
130
|
-
return Math.abs(a) === Math.abs(f) && Math.abs(o) === Math.abs(p) && c ===
|
|
131
|
-
},
|
|
132
|
-
let { edge: n } = e, { edge: r } = t,
|
|
133
|
-
i = { ...i }, a = { ...a };
|
|
134
|
-
let s = n || { ...i }, c = r || { ...a }, l = {
|
|
122
|
+
}, r = n(e), i = n(t), { amplitude: a, freq: o, min: c, max: l, edgeAboveZeroX: u, edgeAboveZeroY: d } = r, { amplitude: f, freq: p, min: h, max: g, edgeAboveZeroX: _, edgeAboveZeroY: v } = i;
|
|
123
|
+
return Math.abs(a) === Math.abs(f) && Math.abs(o) === Math.abs(p) && c === h && l === g && u === _ && d === v;
|
|
124
|
+
}, A = (e, t) => {
|
|
125
|
+
let { edge: n } = e, { edge: r } = t, i = m(e.root), a = m(t.root), s = n || { ...i }, c = r || { ...a }, l = {
|
|
135
126
|
x: i.x - (s.x - i.x),
|
|
136
127
|
y: s.y
|
|
137
128
|
}, u = {
|
|
@@ -139,44 +130,40 @@ var f = /* @__PURE__ */ d(c(), 1), p = {
|
|
|
139
130
|
y: c.y
|
|
140
131
|
};
|
|
141
132
|
if (!n || !r) return !1;
|
|
142
|
-
let { a: d, b: f, c: p } = o(i, n, l), { a:
|
|
143
|
-
return
|
|
144
|
-
},
|
|
145
|
-
let { edge: i } = e, { edge: a } = r,
|
|
146
|
-
o = { ...o }, s = { ...s };
|
|
147
|
-
let c = i || { ...o }, l = a || { ...s }, u = t(o, c), d = t(s, l);
|
|
133
|
+
let { a: d, b: f, c: p } = o(i, n, l), { a: h, b: g, c: _ } = o(a, r, u), v = (e) => Math.round(e * 1e4) / 1e4;
|
|
134
|
+
return v(d) === v(h) && v(f) === v(g) && v(p) === v(_);
|
|
135
|
+
}, j = (e, r) => {
|
|
136
|
+
let { edge: i } = e, { edge: a } = r, o = m(e.root), s = m(r.root), c = i || { ...o }, l = a || { ...s }, u = t(o, c), d = t(s, l);
|
|
148
137
|
return n(s, o) && n(d, u);
|
|
149
|
-
},
|
|
150
|
-
let { edge: r } = e, { edge: a } = t,
|
|
151
|
-
o = { ...o }, s = { ...s };
|
|
152
|
-
let c = r || { ...o }, l = a || { ...s }, { a: u, b: d } = i(o, c), { a: f, b: p } = i(s, l);
|
|
138
|
+
}, M = (e, t) => {
|
|
139
|
+
let { edge: r } = e, { edge: a } = t, o = m(e.root), s = m(t.root), c = r || { ...o }, l = a || { ...s }, { a: u, b: d } = i(o, c), { a: f, b: p } = i(s, l);
|
|
153
140
|
return n(f, u) && n(p, d);
|
|
154
|
-
},
|
|
155
|
-
circle: (e, t) =>
|
|
156
|
-
line: (e, t) =>
|
|
157
|
-
parabola: (e, t) =>
|
|
158
|
-
absolute: (e, t) =>
|
|
159
|
-
exponential: (e, t) =>
|
|
160
|
-
point: (e, t) =>
|
|
161
|
-
polygon: (e, t) =>
|
|
162
|
-
ray: (e, t) =>
|
|
163
|
-
segment: (e, t) =>
|
|
164
|
-
sine: (e, t) =>
|
|
165
|
-
vector: (e, t) =>
|
|
166
|
-
},
|
|
141
|
+
}, N = {
|
|
142
|
+
circle: (e, t) => O(e, t),
|
|
143
|
+
line: (e, t) => S(e, t),
|
|
144
|
+
parabola: (e, t) => A(e, t),
|
|
145
|
+
absolute: (e, t) => j(e, t),
|
|
146
|
+
exponential: (e, t) => M(e, t),
|
|
147
|
+
point: (e, t) => h(e, t),
|
|
148
|
+
polygon: (e, t) => D(e, t),
|
|
149
|
+
ray: (e, t) => C(e, t),
|
|
150
|
+
segment: (e, t) => _(e, t),
|
|
151
|
+
sine: (e, t) => k(e, t),
|
|
152
|
+
vector: (e, t) => v(e, t)
|
|
153
|
+
}, P = Object.defineProperty, F = /* @__PURE__ */ ((e, t) => {
|
|
167
154
|
let n = {};
|
|
168
|
-
for (var r in e)
|
|
155
|
+
for (var r in e) P(n, r, {
|
|
169
156
|
get: e[r],
|
|
170
157
|
enumerable: !0
|
|
171
158
|
});
|
|
172
|
-
return t ||
|
|
173
|
-
})({ enabled: () =>
|
|
174
|
-
function
|
|
159
|
+
return t || P(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
160
|
+
})({ enabled: () => I });
|
|
161
|
+
function I(e, t, n) {
|
|
175
162
|
return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != "boolean" || n;
|
|
176
163
|
}
|
|
177
164
|
//#endregion
|
|
178
165
|
//#region src/controller/index.ts
|
|
179
|
-
var
|
|
166
|
+
var L = (0, f.default)("@pie-element:graphing:controller"), R = () => ({
|
|
180
167
|
point: [],
|
|
181
168
|
segment: [],
|
|
182
169
|
line: [],
|
|
@@ -188,66 +175,69 @@ var I = (0, f.default)("@pie-element:graphing:controller"), L = () => ({
|
|
|
188
175
|
parabola: [],
|
|
189
176
|
absolute: [],
|
|
190
177
|
exponential: []
|
|
191
|
-
}),
|
|
178
|
+
}), z = {
|
|
192
179
|
incorrect: 0,
|
|
193
180
|
correct: 1,
|
|
194
181
|
missing: 2
|
|
195
|
-
},
|
|
196
|
-
t
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
...n,
|
|
182
|
+
}, B = (e, t) => !!(e && t && e.type === t.type && N[e.type] && N[e.type](e, t)), V = (e, t) => e.label === t.label ? "correct" : "incorrect", H = ({ sessionAnswers: t, marks: n, withPointLabel: r = !1 }) => {
|
|
183
|
+
let i = t || [], a = n || [], o = e(i).reduce((e, t) => {
|
|
184
|
+
let n = a.find((e) => B(t, e)), i = (n && t.type === "point" && r ? g(t, n) : n) ? "correct" : "incorrect", o = Object.assign(t, { correctness: i });
|
|
185
|
+
return n && (o.correctnesslabel = V(o, n), o.correctlabel = n.label ? n.label : "", o.label = o.label ? o.label : ""), [...e, o];
|
|
186
|
+
}, []), s = e(a).reduce((e, t) => i.find((e) => B(t, e)) ? e : [...e, {
|
|
187
|
+
...t,
|
|
202
188
|
correctness: "missing"
|
|
203
189
|
}], []);
|
|
204
|
-
return [...
|
|
205
|
-
},
|
|
206
|
-
let n
|
|
207
|
-
return e && (n = e === "partial scoring"),
|
|
208
|
-
},
|
|
209
|
-
let
|
|
190
|
+
return [...o, ...s];
|
|
191
|
+
}, U = ({ scoringType: e, env: t }) => {
|
|
192
|
+
let n;
|
|
193
|
+
return e && (n = e === "partial scoring"), F.enabled({ partialScoring: n }, t);
|
|
194
|
+
}, W = (t, n, r = {}) => {
|
|
195
|
+
let i = t?.answers ?? {}, o = t?.scoringType, { answer: s } = n || {};
|
|
210
196
|
Object.entries(i || {}).forEach(([e, t]) => i[e] = {
|
|
211
197
|
...t,
|
|
212
198
|
marks: t?.marks.filter((e) => !e.building)
|
|
213
|
-
})
|
|
199
|
+
});
|
|
200
|
+
let c = s || [];
|
|
201
|
+
c = c.filter((e) => !e.building);
|
|
202
|
+
let u;
|
|
203
|
+
u = a(i) ? { correctAnswer: R() } : {
|
|
214
204
|
correctAnswer: i.correctAnswer,
|
|
215
|
-
...
|
|
205
|
+
...y(i)
|
|
216
206
|
};
|
|
217
|
-
let
|
|
207
|
+
let d = U({
|
|
218
208
|
scoringType: o,
|
|
219
209
|
env: r
|
|
220
|
-
}),
|
|
221
|
-
return Object.entries(
|
|
210
|
+
}), f = l(c, B);
|
|
211
|
+
return Object.entries(u).reduce((e, t) => {
|
|
222
212
|
let n = t[0], { marks: r } = t[1] || {};
|
|
223
213
|
if (!r || !r.length) return e;
|
|
224
|
-
let i =
|
|
225
|
-
sessionAnswers:
|
|
214
|
+
let i = H({
|
|
215
|
+
sessionAnswers: f,
|
|
226
216
|
marks: r
|
|
227
|
-
}), a =
|
|
228
|
-
sessionAnswers:
|
|
217
|
+
}), a = H({
|
|
218
|
+
sessionAnswers: f,
|
|
229
219
|
marks: r,
|
|
230
220
|
withPointLabel: !0
|
|
231
|
-
}), o = a.filter((e) => e.correctness === "correct"), s = a.filter((e) => e.correctness !== "missing"),
|
|
232
|
-
return s.length >
|
|
221
|
+
}), o = a.filter((e) => e.correctness === "correct"), s = a.filter((e) => e.correctness !== "missing"), c = r.length, l = o.length;
|
|
222
|
+
return s.length > c && (l -= s.length - c), l < 0 && (l = 0), (l / c > e.bestScore || !e.foundOneSolution) && (d ? e.bestScore = parseFloat((l / c).toFixed(2)) : e.bestScore = Math.floor(l / c), e.bestScoreAnswerKey = n, e.answersCorrected = i, e.foundOneSolution = !0), e;
|
|
233
223
|
}, {
|
|
234
224
|
bestScore: 0,
|
|
235
225
|
bestScoreAnswerKey: null,
|
|
236
|
-
answersCorrected: e(
|
|
226
|
+
answersCorrected: e(f).map((e) => ({
|
|
237
227
|
...e,
|
|
238
228
|
correctness: "incorrect"
|
|
239
229
|
})),
|
|
240
230
|
foundOneSolution: !1
|
|
241
231
|
});
|
|
242
|
-
},
|
|
232
|
+
}, G = (e) => ({
|
|
243
233
|
...p,
|
|
244
234
|
...e
|
|
245
235
|
});
|
|
246
|
-
function
|
|
236
|
+
function K(e, t, n) {
|
|
247
237
|
return new Promise((r) => {
|
|
248
|
-
let i =
|
|
238
|
+
let i = G(e);
|
|
249
239
|
t ??= {};
|
|
250
|
-
let { defaultTool: o, extraCSSRules: s, prompt: c, promptEnabled: l, graph: u, answers: d, toolbarTools: f, ...p } = i
|
|
240
|
+
let { defaultTool: o, extraCSSRules: s, prompt: c, promptEnabled: l, graph: u, answers: d, toolbarTools: f, ...p } = i, { arrows: m } = i, h = n?.mode, g = n?.role;
|
|
251
241
|
typeof m == "boolean" && (m = m ? {
|
|
252
242
|
left: !0,
|
|
253
243
|
right: !0,
|
|
@@ -275,24 +265,24 @@ function G(e, t, n) {
|
|
|
275
265
|
extraCSSRules: s
|
|
276
266
|
};
|
|
277
267
|
if (g === "instructor" && (h === "view" || h === "evaluate")) {
|
|
278
|
-
let { rationale: e, rationaleEnabled: t, teacherInstructions: n, teacherInstructionsEnabled: r } = i
|
|
268
|
+
let { rationale: e, rationaleEnabled: t, teacherInstructions: n, teacherInstructionsEnabled: r } = i;
|
|
279
269
|
y.rationale = t ? e : null, y.teacherInstructions = r ? n : null;
|
|
280
270
|
}
|
|
281
271
|
if (h === "evaluate") if (!a(d) && d.correctAnswer && d.correctAnswer.marks && !a(d.correctAnswer.marks)) {
|
|
282
|
-
let { answersCorrected: e, bestScoreAnswerKey: r, bestScore: a } =
|
|
283
|
-
y.answersCorrected = e.sort((e, t) =>
|
|
272
|
+
let { answersCorrected: e, bestScoreAnswerKey: r, bestScore: a } = W(i, t, n);
|
|
273
|
+
y.answersCorrected = e.sort((e, t) => z[e.correctness] - z[t.correctness]), y.correctResponse = r ? (d[r] || {}).marks : [], y.showToggle = y.showToggle && a !== 1;
|
|
284
274
|
} else y.answersCorrected = t && t.answer || [], y.correctResponse = [];
|
|
285
|
-
|
|
275
|
+
L("base: ", y), r(y);
|
|
286
276
|
});
|
|
287
277
|
}
|
|
288
|
-
var
|
|
289
|
-
let r = [],
|
|
278
|
+
var q = (e, t, n) => {
|
|
279
|
+
let r = [], i = e?.answers ?? {}, a = e?.scoringType, o = t && t.answer || [];
|
|
290
280
|
if (!o.length) return ["Student did not interact with the graph."];
|
|
291
281
|
r.push(`Student added ${o.length} object(s) to the graph.`);
|
|
292
|
-
let s =
|
|
282
|
+
let s = U({
|
|
293
283
|
scoringType: a,
|
|
294
284
|
env: n
|
|
295
|
-
}), { answersCorrected: c, bestScore: l, bestScoreAnswerKey: u } =
|
|
285
|
+
}), { answersCorrected: c, bestScore: l, bestScoreAnswerKey: u } = W(e, t, n), d = u && i[u] && i[u].marks || [], f = 0, p = 0, m = 0;
|
|
296
286
|
for (let e = 0; e < c.length; e++) {
|
|
297
287
|
let t = c[e].correctness;
|
|
298
288
|
t === "correct" ? f++ : t === "incorrect" ? p++ : t === "missing" && m++;
|
|
@@ -306,7 +296,7 @@ var K = (e, t, n) => {
|
|
|
306
296
|
}
|
|
307
297
|
return s ? r.push("Score calculated using partial scoring.") : r.push("Score calculated using all-or-nothing scoring."), r.push(`Final score: ${l}.`), r;
|
|
308
298
|
};
|
|
309
|
-
function
|
|
299
|
+
function J(e, t, n = {}) {
|
|
310
300
|
return new Promise((r) => {
|
|
311
301
|
(!t || a(t)) && r({
|
|
312
302
|
score: 0,
|
|
@@ -317,15 +307,15 @@ function q(e, t, n = {}) {
|
|
|
317
307
|
empty: !0,
|
|
318
308
|
logTrace: ["Student did not interact with the graph."]
|
|
319
309
|
});
|
|
320
|
-
let { bestScore: i } =
|
|
310
|
+
let { bestScore: i } = W(e, t, n);
|
|
321
311
|
r({
|
|
322
312
|
score: i,
|
|
323
313
|
empty: !1,
|
|
324
|
-
logTrace:
|
|
314
|
+
logTrace: q(e, t, n)
|
|
325
315
|
});
|
|
326
316
|
});
|
|
327
317
|
}
|
|
328
|
-
var
|
|
318
|
+
var Y = (e, t) => new Promise((n) => {
|
|
329
319
|
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
330
320
|
let { answers: t } = e || {}, r = [];
|
|
331
321
|
t && Object.values(t) && (r = (t.correctAnswer || Object.values(t)[0] || {}).marks || []), n({
|
|
@@ -333,14 +323,14 @@ var J = (e, t) => new Promise((n) => {
|
|
|
333
323
|
id: "1"
|
|
334
324
|
});
|
|
335
325
|
} else n(null);
|
|
336
|
-
}),
|
|
326
|
+
}), X = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), Z = (e = {}, t = {}) => {
|
|
337
327
|
let { answers: n, toolbarTools: r } = e, i = {}, o = {};
|
|
338
328
|
return (r || []).filter((e) => e !== "label").length || (i.toolbarToolsError = "There should be at least 1 tool defined."), [
|
|
339
329
|
"teacherInstructions",
|
|
340
330
|
"prompt",
|
|
341
331
|
"rationale"
|
|
342
332
|
].forEach((n) => {
|
|
343
|
-
t[n]?.required && !
|
|
333
|
+
t[n]?.required && !X(e[n]) && (i[n] = "This field is required.");
|
|
344
334
|
}), Object.entries(n || {}).forEach(([e, t]) => {
|
|
345
335
|
t.marks.length || (o[e] = "At least 1 graph object should be defined."), t.marks.length > 0 && t.marks.forEach((t) => {
|
|
346
336
|
t.building && (o[e] = "At least 1 graph object is not correctly defined.");
|
|
@@ -348,6 +338,6 @@ var J = (e, t) => new Promise((n) => {
|
|
|
348
338
|
}), a(o) || (i.correctAnswerErrors = o), i;
|
|
349
339
|
};
|
|
350
340
|
//#endregion
|
|
351
|
-
export {
|
|
341
|
+
export { V as comparLabelMarks, B as compareMarks, Y as createCorrectResponseSession, H as getAnswerCorrected, W as getBestAnswer, q as getLogTrace, K as model, G as normalize, J as outcome, Z as validate };
|
|
352
342
|
|
|
353
343
|
//# sourceMappingURL=index.js.map
|