alexsys-exam-renderer 0.1.13 → 0.1.15

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/index.js CHANGED
@@ -64,190 +64,196 @@ function Ce(e, t) {
64
64
  }
65
65
  function we(e, t, n) {
66
66
  if (e.length < 2 || t.length !== e.length - 1) return null;
67
- let r = e.map((e) => je(e, n));
67
+ let r = e.map((e) => Pe(e, n));
68
68
  if (r.some((e) => e === null)) return null;
69
69
  let i = [], a = [], o = r[0];
70
70
  for (let e = 0; e < t.length; e += 1) {
71
71
  let s = t[e], c = r[e + 1];
72
72
  if (s === "×") {
73
- o = Be(o, c, n);
73
+ o = Ue(o, c, n);
74
74
  continue;
75
75
  }
76
76
  if (s === "÷") {
77
77
  if (c.numerator === 0) return null;
78
- o = Ve(o, c, n);
78
+ o = We(o, c, n);
79
79
  continue;
80
80
  }
81
81
  i.push(o), a.push(s), o = c;
82
82
  }
83
83
  i.push(o);
84
84
  let s = i[0];
85
- for (let e = 1; e < i.length; e += 1) s = a[e - 1] === "+" ? Re(s, i[e], n) : ze(s, i[e], n);
86
- return Le(s, n);
85
+ for (let e = 1; e < i.length; e += 1) s = a[e - 1] === "+" ? Ve(s, i[e], n) : He(s, i[e], n);
86
+ return Be(s, n);
87
87
  }
88
88
  function Te(e, t) {
89
- let n = Me(e), r = Me(t);
89
+ let n = Fe(e), r = Fe(t);
90
90
  return !n || !r ? !1 : n.numerator * r.denominator === r.numerator * n.denominator;
91
91
  }
92
92
  function Ee(e) {
93
- let t = Pe(e.numerator), n = Pe(e.denominator);
94
- return t === null || n === null || n === 0 ? !1 : He(Math.abs(t), Math.abs(n)) === 1;
93
+ let t = Le(e.numerator), n = Le(e.denominator);
94
+ return t === null || n === null || n === 0 ? !1 : Ge(Math.abs(t), Math.abs(n)) === 1;
95
95
  }
96
96
  function De(e) {
97
- return e.workSteps?.length ? e.workSteps : e.intermediateResults.map((e) => ({
98
- expected: {
99
- denominator: e.denominator,
100
- numerator: e.numerator
101
- },
102
- id: e.id,
103
- type: "fraction"
97
+ return e.workSteps?.length ? e.workSteps.map(ke) : e.intermediateResults.map((e) => Oe(e.id, {
98
+ denominator: e.denominator,
99
+ numerator: e.numerator
104
100
  }));
105
101
  }
106
- function Oe(e, t) {
107
- let n = e.terms.filter((e) => e.kind === "fraction");
102
+ function Oe(e, t = {
103
+ denominator: "",
104
+ numerator: ""
105
+ }) {
108
106
  return {
109
- denominatorFactors: n.length === 0 ? ["", ""] : n.map((e) => e.denominator),
110
- id: t,
111
- numeratorFactors: n.length === 0 ? ["", ""] : n.map((e) => e.numerator),
112
- type: "product"
107
+ id: e,
108
+ fractions: [Me(`${e}:fraction-1`, t)],
109
+ type: "guided"
113
110
  };
114
111
  }
115
- function ke(e, t) {
116
- let n = e.terms[0] ? je(e.terms[0]) : null, r = e.terms[1] ? je(e.terms[1]) : null, i = e.operators[0], a = n && r ? Ue(n.denominator, r.denominator) : 1;
112
+ function ke(e) {
113
+ return e.type === "guided" ? e : e.type === "product" ? {
114
+ id: e.id,
115
+ fractions: [{
116
+ id: `${e.id}:fraction-1`,
117
+ numerator: Ne("factors", e.numeratorFactors, `${e.id}:numerator`),
118
+ denominator: Ne("factors", e.denominatorFactors, `${e.id}:denominator`)
119
+ }],
120
+ type: "guided"
121
+ } : e.type === "sum" ? {
122
+ id: e.id,
123
+ operator: e.operator,
124
+ fractions: [Me(`${e.id}:left`, e.left), Me(`${e.id}:right`, e.right)],
125
+ type: "guided"
126
+ } : Oe(e.id, e.expected);
127
+ }
128
+ function Ae(e) {
129
+ let t = Math.max(e.fractions.length - 1, 0);
130
+ return Array.from({ length: t }, (t, n) => e.operators?.[n] ?? e.operator ?? "+");
131
+ }
132
+ function je(e) {
133
+ let t = Math.max(e.cells.length - 1, 0), n = e.mode === "factors" ? "×" : "+";
134
+ return Array.from({ length: t }, (t, r) => e.operators?.[r] ?? n);
135
+ }
136
+ function Me(e, t) {
117
137
  return {
118
- id: t,
119
- left: n ? {
120
- denominator: String(a),
121
- numerator: String(n.numerator * (a / n.denominator))
122
- } : {
123
- denominator: "",
124
- numerator: ""
125
- },
126
- operator: i === "-" ? "-" : "+",
127
- right: r ? {
128
- denominator: String(a),
129
- numerator: String(r.numerator * (a / r.denominator))
130
- } : {
131
- denominator: "",
132
- numerator: ""
133
- },
134
- type: "sum"
138
+ id: e,
139
+ numerator: Ne("number", [t.numerator], `${e}:numerator`),
140
+ denominator: Ne("number", [t.denominator], `${e}:denominator`)
135
141
  };
136
142
  }
137
- function Ae(e, t) {
143
+ function Ne(e, t, n) {
138
144
  return {
139
- expected: Se(e.terms, e.operators) ?? {
140
- denominator: "",
141
- numerator: ""
142
- },
143
- id: t,
144
- type: "fraction"
145
+ mode: e,
146
+ operators: e === "factors" ? Array.from({ length: Math.max(t.length - 1, 0) }, () => "×") : [],
147
+ cells: (t.length > 0 ? t : [""]).map((e, t) => ({
148
+ id: `${n}:${t + 1}`,
149
+ expectedValue: e
150
+ }))
145
151
  };
146
152
  }
147
- function je(e, t = !0) {
148
- if (e.kind === "fraction") return Me({
153
+ function Pe(e, t = !0) {
154
+ if (e.kind === "fraction") return Fe({
149
155
  denominator: e.denominator ?? "",
150
156
  numerator: e.numerator ?? ""
151
157
  }, t);
152
158
  if (e.kind === "integer") {
153
- let t = Pe(e.value ?? "");
159
+ let t = Le(e.value ?? "");
154
160
  return t === null ? null : {
155
161
  denominator: 1,
156
162
  numerator: t
157
163
  };
158
164
  }
159
- return Ne(e.value ?? "", t);
165
+ return Ie(e.value ?? "", t);
160
166
  }
161
- function Me(e, t = !0) {
162
- let n = Pe(e.numerator), r = Pe(e.denominator);
163
- return n === null || r === null || r === 0 ? null : t ? Fe({
167
+ function Fe(e, t = !0) {
168
+ let n = Le(e.numerator), r = Le(e.denominator);
169
+ return n === null || r === null || r === 0 ? null : t ? Re({
164
170
  denominator: r,
165
171
  numerator: n
166
- }) : Ie({
172
+ }) : ze({
167
173
  denominator: r,
168
174
  numerator: n
169
175
  });
170
176
  }
171
- function Ne(e, t = !0) {
172
- let n = We(e).replace(".", ",");
177
+ function Ie(e, t = !0) {
178
+ let n = qe(e).replace(".", ",");
173
179
  if (!/^-?\d+(,\d+)?$/.test(n)) return null;
174
180
  let r = n.startsWith("-") ? -1 : 1, [i, a = ""] = (r < 0 ? n.slice(1) : n).split(","), o = 10 ** a.length, s = r * (Number(i) * o + Number(a || "0"));
175
- return t ? Fe({
181
+ return t ? Re({
176
182
  denominator: o,
177
183
  numerator: s
178
- }) : Ie({
184
+ }) : ze({
179
185
  denominator: o,
180
186
  numerator: s
181
187
  });
182
188
  }
183
- function Pe(e) {
184
- let t = We(e);
189
+ function Le(e) {
190
+ let t = qe(e);
185
191
  if (!/^-?\d+$/.test(t)) return null;
186
192
  let n = Number(t);
187
193
  return Number.isSafeInteger(n) ? n : null;
188
194
  }
189
- function Fe(e) {
190
- let t = Ie(e), n = He(Math.abs(t.numerator), t.denominator);
195
+ function Re(e) {
196
+ let t = ze(e), n = Ge(Math.abs(t.numerator), t.denominator);
191
197
  return {
192
198
  denominator: t.denominator / n,
193
199
  numerator: t.numerator / n
194
200
  };
195
201
  }
196
- function Ie(e) {
202
+ function ze(e) {
197
203
  let t = e.denominator < 0 ? -1 : 1, n = e.numerator * t;
198
204
  return {
199
205
  denominator: Math.abs(e.denominator),
200
206
  numerator: n
201
207
  };
202
208
  }
203
- function Le(e, t = !0) {
204
- let n = t ? Fe(e) : Ie(e);
209
+ function Be(e, t = !0) {
210
+ let n = t ? Re(e) : ze(e);
205
211
  return {
206
212
  denominator: String(n.denominator),
207
213
  numerator: String(n.numerator)
208
214
  };
209
215
  }
210
- function Re(e, t, n = !0) {
216
+ function Ve(e, t, n = !0) {
211
217
  if (!n) {
212
- let n = Ue(e.denominator, t.denominator);
213
- return Ie({
218
+ let n = Ke(e.denominator, t.denominator);
219
+ return ze({
214
220
  denominator: n,
215
221
  numerator: e.numerator * (n / e.denominator) + t.numerator * (n / t.denominator)
216
222
  });
217
223
  }
218
- return Fe({
224
+ return Re({
219
225
  denominator: e.denominator * t.denominator,
220
226
  numerator: e.numerator * t.denominator + t.numerator * e.denominator
221
227
  });
222
228
  }
223
- function ze(e, t, n = !0) {
229
+ function He(e, t, n = !0) {
224
230
  if (!n) {
225
- let n = Ue(e.denominator, t.denominator);
226
- return Ie({
231
+ let n = Ke(e.denominator, t.denominator);
232
+ return ze({
227
233
  denominator: n,
228
234
  numerator: e.numerator * (n / e.denominator) - t.numerator * (n / t.denominator)
229
235
  });
230
236
  }
231
- return Fe({
237
+ return Re({
232
238
  denominator: e.denominator * t.denominator,
233
239
  numerator: e.numerator * t.denominator - t.numerator * e.denominator
234
240
  });
235
241
  }
236
- function Be(e, t, n = !0) {
242
+ function Ue(e, t, n = !0) {
237
243
  let r = {
238
244
  denominator: e.denominator * t.denominator,
239
245
  numerator: e.numerator * t.numerator
240
246
  };
241
- return n ? Fe(r) : Ie(r);
247
+ return n ? Re(r) : ze(r);
242
248
  }
243
- function Ve(e, t, n = !0) {
249
+ function We(e, t, n = !0) {
244
250
  let r = {
245
251
  denominator: e.denominator * t.numerator,
246
252
  numerator: e.numerator * t.denominator
247
253
  };
248
- return n ? Fe(r) : Ie(r);
254
+ return n ? Re(r) : ze(r);
249
255
  }
250
- function He(e, t) {
256
+ function Ge(e, t) {
251
257
  let n = Math.abs(e), r = Math.abs(t);
252
258
  for (; r !== 0;) {
253
259
  let e = n % r;
@@ -255,44 +261,44 @@ function He(e, t) {
255
261
  }
256
262
  return n || 1;
257
263
  }
258
- function Ue(e, t) {
259
- return e === 0 || t === 0 ? 0 : Math.abs(e * t) / He(e, t);
264
+ function Ke(e, t) {
265
+ return e === 0 || t === 0 ? 0 : Math.abs(e * t) / Ge(e, t);
260
266
  }
261
- function We(e) {
267
+ function qe(e) {
262
268
  return e.trim().replace(/[٠-٩]/g, (e) => `${e.charCodeAt(0) - 1632}`).replace(/[۰-۹]/g, (e) => `${e.charCodeAt(0) - 1776}`);
263
269
  }
264
270
  //#endregion
265
271
  //#region src/exam-session/primeFactorization.ts
266
- function Ge(e) {
267
- let t = Je(e);
272
+ function Je(e) {
273
+ let t = Ze(e);
268
274
  if (t === null) return [];
269
275
  let n = [], r = t;
270
276
  for (let e = 2; e * e <= r; e += e === 2 ? 1 : 2) for (; r % e === 0;) n.push(e), r /= e;
271
277
  return r > 1 && n.push(r), n;
272
278
  }
273
- function Ke(e) {
274
- return Math.max(Ge(e).length, 1);
279
+ function Ye(e) {
280
+ return Math.max(Je(e).length, 1);
275
281
  }
276
- function qe(e) {
282
+ function Xe(e) {
277
283
  if (e < 2) return !1;
278
284
  if (e === 2) return !0;
279
285
  if (e % 2 == 0) return !1;
280
286
  for (let t = 3; t * t <= e; t += 2) if (e % t === 0) return !1;
281
287
  return !0;
282
288
  }
283
- function Je(e) {
284
- let t = Ye(e);
289
+ function Ze(e) {
290
+ let t = Qe(e);
285
291
  if (!/^\d+$/.test(t)) return null;
286
292
  let n = Number(t);
287
293
  return Number.isSafeInteger(n) && n >= 2 ? n : null;
288
294
  }
289
- function Ye(e) {
295
+ function Qe(e) {
290
296
  return e.trim().replace(/[٠-٩]/g, (e) => `${e.charCodeAt(0) - 1632}`).replace(/[۰-۹]/g, (e) => `${e.charCodeAt(0) - 1776}`);
291
297
  }
292
298
  //#endregion
293
299
  //#region src/exam-session/operationSolving.ts
294
- function Xe(e) {
295
- return e.items?.length ? e.items : [{
300
+ function $e(e) {
301
+ return e.items ? e.items : [{
296
302
  correctAnswer: e.correctAnswer,
297
303
  id: "legacy",
298
304
  layout: e.layout,
@@ -303,21 +309,21 @@ function Xe(e) {
303
309
  solutionMode: e.solutionMode
304
310
  }];
305
311
  }
306
- function Ze(e, t) {
312
+ function et(e, t) {
307
313
  return e.items?.length ? `${e.id}:${t.id}` : e.id;
308
314
  }
309
- function Qe(e, t) {
315
+ function tt(e, t) {
310
316
  return {
311
317
  ...e,
312
318
  ...t,
313
- id: Ze(e, t)
319
+ id: et(e, t)
314
320
  };
315
321
  }
316
322
  //#endregion
317
323
  //#region src/exam-session/examScoring.ts
318
- var $e = 1e3, et = 600, tt = 70;
319
- function nt(e, t) {
320
- let n = e.sections.filter((e) => e.isScored !== !1).map((e) => rt(e, t)), r = J(n, (e) => e.correctCount), i = J(n, (e) => e.incorrectCount), a = J(n, (e) => e.unansweredCount), o = i + a, s = J(n, (e) => e.totalUnits), c = kt(J(n, (e) => e.maxScore)), l = kt(J(n, (e) => e.score));
324
+ var nt = 1e3, rt = 600, it = 70;
325
+ function at(e, t) {
326
+ let n = e.sections.filter((e) => e.isScored !== !1).map((e) => ot(e, t)), r = J(n, (e) => e.correctCount), i = J(n, (e) => e.incorrectCount), a = J(n, (e) => e.unansweredCount), o = i + a, s = J(n, (e) => e.totalUnits), c = Mt(J(n, (e) => e.maxScore)), l = Mt(J(n, (e) => e.score));
321
327
  return {
322
328
  attentionLivesLost: 0,
323
329
  attentionLivesRemaining: 5,
@@ -327,7 +333,7 @@ function nt(e, t) {
327
333
  incorrectCount: i,
328
334
  maxScore: c,
329
335
  notCorrectCount: o,
330
- percentage: c > 0 ? kt(l / c * 100) : 0,
336
+ percentage: c > 0 ? Mt(l / c * 100) : 0,
331
337
  score: l,
332
338
  sections: n,
333
339
  subject: e.subject,
@@ -336,14 +342,14 @@ function nt(e, t) {
336
342
  unansweredCount: a
337
343
  };
338
344
  }
339
- function rt(e, t) {
345
+ function ot(e, t) {
340
346
  let n = me(e), r = he(e), i = e.questions.map((e) => ({
341
347
  maxScore: n ? W(e) : 0,
342
- units: it(e, t)
348
+ units: st(e, t)
343
349
  })), a = !n && J(i, (e) => e.units.length) > 0 ? r / J(i, (e) => e.units.length) : 0, o = i.flatMap((t) => {
344
350
  let r = n ? t.units.length > 0 ? t.maxScore / t.units.length : 0 : a;
345
351
  return t.units.map((t) => {
346
- let n = kt(t.maxScore ?? r);
352
+ let n = Mt(t.maxScore ?? r);
347
353
  return {
348
354
  ...t,
349
355
  maxScore: n,
@@ -351,7 +357,7 @@ function rt(e, t) {
351
357
  sectionId: e.id
352
358
  };
353
359
  });
354
- }), s = Ot(o, "correct"), c = Ot(o, "incorrect"), l = Ot(o, "unanswered"), u = c + l;
360
+ }), s = jt(o, "correct"), c = jt(o, "incorrect"), l = jt(o, "unanswered"), u = c + l;
355
361
  return {
356
362
  badge: e.badge,
357
363
  correctCount: s,
@@ -359,7 +365,7 @@ function rt(e, t) {
359
365
  incorrectCount: c,
360
366
  maxScore: r,
361
367
  notCorrectCount: u,
362
- score: kt(J(o, (e) => e.score)),
368
+ score: Mt(J(o, (e) => e.score)),
363
369
  title: e.title,
364
370
  tone: e.tone,
365
371
  totalUnits: o.length,
@@ -367,7 +373,7 @@ function rt(e, t) {
367
373
  units: o
368
374
  };
369
375
  }
370
- function it(e, t) {
376
+ function st(e, t) {
371
377
  switch (e.type) {
372
378
  case "inline-inputs":
373
379
  case "equation-inputs": return e.items.flatMap((n) => {
@@ -381,18 +387,18 @@ function it(e, t) {
381
387
  return [K(r, e.id, n.before, n.correctAnswer, t[r])];
382
388
  });
383
389
  case "number-line": return [K(e.id, e.id, e.expression, e.correctAnswer, t[e.id])];
384
- case "prime-factorization": return lt(e, t[e.id]);
390
+ case "prime-factorization": return ft(e, t[e.id]);
385
391
  case "fraction-operations": return e.items.flatMap((n, r) => {
386
392
  let i = `${e.id}:${n.id}`;
387
- return De(n).flatMap((n, a) => dt(i, e.id, `${e.prompt} ${r + 1}.${a + 1}`, n, t)).concat(ut(`${i}:result`, e.id, `${e.prompt} ${r + 1}`, n.correctResult, n.requireSimplified, t[`${i}:result`]));
393
+ return De(n).flatMap((n, a) => mt(i, e.id, `${e.prompt} ${r + 1}.${a + 1}`, n, t)).concat(pt(`${i}:result`, e.id, `${e.prompt} ${r + 1}`, n.correctResult, n.requireSimplified, t[`${i}:result`]));
388
394
  });
389
395
  case "operation-solving": {
390
396
  if (e.items?.length) {
391
- let n = Xe(e), r = ct(W(e), n.length);
397
+ let n = $e(e), r = dt(W(e), n.length);
392
398
  return n.flatMap((n, i) => {
393
- let a = Qe(e, n), o = Ze(e, n), s = st(a, r[i] ?? 0);
399
+ let a = tt(e, n), o = et(e, n), s = ut(a, r[i] ?? 0);
394
400
  return [{
395
- ...K(o, e.id, ot(a), n.correctAnswer, t[o]),
401
+ ...K(o, e.id, lt(a), n.correctAnswer, t[o]),
396
402
  maxScore: s.resultMaxScore
397
403
  }, ...s.reasoningMaxScore > 0 ? [{
398
404
  id: `${o}:reasoning`,
@@ -403,9 +409,9 @@ function it(e, t) {
403
409
  }] : []];
404
410
  });
405
411
  }
406
- let n = st(e);
412
+ let n = ut(e);
407
413
  return [{
408
- ...K(e.id, e.id, ot(e), e.correctAnswer, t[e.id]),
414
+ ...K(e.id, e.id, lt(e), e.correctAnswer, t[e.id]),
409
415
  maxScore: n.resultMaxScore
410
416
  }, ...n.reasoningMaxScore > 0 ? [{
411
417
  id: `${e.id}:reasoning`,
@@ -415,49 +421,49 @@ function it(e, t) {
415
421
  status: "unanswered"
416
422
  }] : []];
417
423
  }
418
- case "visual-choice": return ft(e.id, e.id, e.grading.pairs, t[e.id]);
419
- case "length-estimation": return pt(e, t);
420
- case "shape-choice": return ft(e.id, e.id, e.grading.pairs, t[e.id]);
421
- case "drag-match": return ft(e.id, e.id, e.grading?.pairs, t[e.id]);
422
- case "drawing-grid": return [yt(e, t[e.id])];
423
- case "table-response": return ht(e, t[e.id]);
424
+ case "visual-choice": return ht(e.id, e.id, e.grading.pairs, t[e.id]);
425
+ case "length-estimation": return gt(e, t);
426
+ case "shape-choice": return ht(e.id, e.id, e.grading.pairs, t[e.id]);
427
+ case "drag-match": return ht(e.id, e.id, e.grading?.pairs, t[e.id]);
428
+ case "drawing-grid": return [St(e, t[e.id])];
429
+ case "table-response": return vt(e, t[e.id]);
424
430
  case "text-input": return e.correctAnswer ? [K(e.id, e.id, e.prompt, e.correctAnswer, t[e.id])] : [];
425
431
  case "word-problem": return e.parts.flatMap((n) => {
426
432
  let r = `${e.id}:${n.id}`;
427
- return n.type === "coin-table" ? gt(e.id, n, t[r]) : n.type === "table" ? _t(e.id, n, t) : n.correctAnswer ? [K(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
433
+ return n.type === "coin-table" ? yt(e.id, n, t[r]) : n.type === "table" ? bt(e.id, n, t) : n.correctAnswer ? [K(r, e.id, n.prompt, n.correctAnswer, t[r])] : [];
428
434
  });
429
435
  case "sortable-answer": return [];
430
- case "label-placement": return vt(e.id, e.grading?.targetsByLabelId, t[e.id]);
431
- case "audio-recording": return [at(e, t[e.id])];
436
+ case "label-placement": return xt(e.id, e.grading?.targetsByLabelId, t[e.id]);
437
+ case "audio-recording": return [ct(e, t[e.id])];
432
438
  }
433
439
  }
434
- function at(e, t) {
440
+ function ct(e, t) {
435
441
  return t?.kind === "audio-recording" ? q(e.id, e.id, e.expectedAnswer, t.evaluation.isCorrect ? "correct" : "incorrect") : q(e.id, e.id, e.expectedAnswer, "unanswered");
436
442
  }
437
- function ot(e) {
443
+ function lt(e) {
438
444
  return `${G(e.leftOperand)} ${e.operator} ${G(e.rightOperand)} =`;
439
445
  }
440
- function st(e, t = W(e)) {
446
+ function ut(e, t = W(e)) {
441
447
  let n = t, r = (e.operator === "÷" || e.layout === "equation-card-grid" || e.solutionMode === "full-process") && e.reasoningScore?.enabled ? fe(e.reasoningScore.maxScore) : 0, i = Math.min(Math.max(r, 0), n);
442
448
  return {
443
449
  reasoningMaxScore: i,
444
450
  resultMaxScore: Math.max(n - i, 0)
445
451
  };
446
452
  }
447
- function ct(e, t) {
453
+ function dt(e, t) {
448
454
  if (t <= 0) return [];
449
- let n = kt(e / t), r = Array.from({ length: t }, () => n), i = kt(J(r, (e) => e));
450
- return r[t - 1] = kt(r[t - 1] + (e - i)), r;
455
+ let n = Mt(e / t), r = Array.from({ length: t }, () => n), i = Mt(J(r, (e) => e));
456
+ return r[t - 1] = Mt(r[t - 1] + (e - i)), r;
451
457
  }
452
- function lt(e, t) {
458
+ function ft(e, t) {
453
459
  return e.targets.map((n) => {
454
- let r = t?.kind === "prime-factorization" ? t.factorsByTargetId[n.id] ?? [] : [], i = Ge(n.value), a = r.filter((e) => e.strokes.length > 0), o = `${e.id}:${n.id}`, s = `${n.value} =`;
460
+ let r = t?.kind === "prime-factorization" ? t.factorsByTargetId[n.id] ?? [] : [], i = Je(n.value), a = r.filter((e) => e.strokes.length > 0), o = `${e.id}:${n.id}`, s = `${n.value} =`;
455
461
  if (a.length === 0) return q(o, e.id, s, "unanswered");
456
- let c = Je(n.value), l = a.map((e) => e.recognizedValue === void 0 ? null : Je(e.recognizedValue)), u = c !== null && a.length === i.length && l.every((e) => e !== null && qe(e)) && l.reduce((e, t) => e * (t ?? 0), 1) === c;
462
+ let c = Ze(n.value), l = a.map((e) => e.recognizedValue === void 0 ? null : Ze(e.recognizedValue)), u = c !== null && a.length === i.length && l.every((e) => e !== null && Xe(e)) && l.reduce((e, t) => e * (t ?? 0), 1) === c;
457
463
  return q(o, e.id, s, u ? "correct" : "incorrect");
458
464
  });
459
465
  }
460
- function ut(e, t, n, r, i, a) {
466
+ function pt(e, t, n, r, i, a) {
461
467
  if (a?.kind !== "fraction") return q(e, t, n, "unanswered");
462
468
  let o = a.numerator.strokes.length > 0, s = a.denominator.strokes.length > 0;
463
469
  if (!o && !s) return q(e, t, n, "unanswered");
@@ -469,75 +475,83 @@ function ut(e, t, n, r, i, a) {
469
475
  };
470
476
  return q(e, t, n, Te(u, r) && (!i || Ee(u)) ? "correct" : "incorrect");
471
477
  }
472
- function dt(e, t, n, r, i) {
478
+ function mt(e, t, n, r, i) {
473
479
  let a = `${e}:${r.id}`;
480
+ if (r.type === "guided") return r.fractions.flatMap((e, r) => {
481
+ let o = (o, s) => o.cells.map((o, c) => K(`${a}:${e.id}:${s}:${o.id}`, t, `${n} - fraction ${r + 1}, ${s} ${c + 1}`, o.expectedValue, i[`${a}:${e.id}:${s}:${o.id}`])), s = o(e.numerator, "numerator"), c = o(e.denominator, "denominator"), l = s.concat(c);
482
+ if (e.numerator.mode === "number" && e.denominator.mode === "number") {
483
+ let i = l.some((e) => e.status === "incorrect") ? "incorrect" : l.some((e) => e.status === "unanswered") ? "unanswered" : "correct";
484
+ return [q(`${a}:${e.id}`, t, `${n} - fraction ${r + 1}`, i)];
485
+ }
486
+ return l;
487
+ });
474
488
  if (r.type === "product") {
475
489
  let e = r.numeratorFactors.map((e, r) => K(`${a}:numerator:${r}`, t, `${n} - numérateur ${r + 1}`, e, i[`${a}:numerator:${r}`])), o = r.denominatorFactors.map((e, r) => K(`${a}:denominator:${r}`, t, `${n} - dénominateur ${r + 1}`, e, i[`${a}:denominator:${r}`]));
476
490
  return e.concat(o);
477
491
  }
478
- return r.type === "sum" ? [ut(`${a}:left`, t, `${n} - fraction 1`, r.left, !1, i[`${a}:left`]), ut(`${a}:right`, t, `${n} - fraction 2`, r.right, !1, i[`${a}:right`])] : [ut(a, t, n, r.expected, !1, i[a])];
492
+ return r.type === "sum" ? [pt(`${a}:left`, t, `${n} - fraction 1`, r.left, !1, i[`${a}:left`]), pt(`${a}:right`, t, `${n} - fraction 2`, r.right, !1, i[`${a}:right`])] : [pt(a, t, n, r.expected, !1, i[a])];
479
493
  }
480
494
  function K(e, t, n, r, i) {
481
- return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? q(e, t, n, "unanswered") : q(e, t, n, i.recognizedValue && Et(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || Dt(i.value) === "" ? q(e, t, n, "unanswered") : q(e, t, n, Et(i.value, r) ? "correct" : "incorrect") : q(e, t, n, "incorrect");
495
+ return r ? i?.kind === "handwritten-number" ? i.strokes.length === 0 ? q(e, t, n, "unanswered") : q(e, t, n, i.recognizedValue && kt(i.recognizedValue, r) ? "correct" : "incorrect") : i?.kind !== "text" || At(i.value) === "" ? q(e, t, n, "unanswered") : q(e, t, n, kt(i.value, r) ? "correct" : "incorrect") : q(e, t, n, "incorrect");
482
496
  }
483
- function ft(e, t, n, r) {
497
+ function ht(e, t, n, r) {
484
498
  return n ? Object.entries(n).map(([n, i]) => {
485
499
  let a = r?.kind === "matches" ? r.pairs[n] : void 0, o = a ? a === i ? "correct" : "incorrect" : "unanswered";
486
500
  return q(`${e}:${n}`, t, n, o);
487
501
  }) : [];
488
502
  }
489
- function pt(e, t) {
503
+ function gt(e, t) {
490
504
  let n = e.items.map((n) => {
491
505
  let r = `${e.id}:squares:${n.id}`;
492
506
  return K(r, e.id, n.label, n.squareLength.toString(), t[r]);
493
507
  }), r = e.items.flatMap((n) => {
494
508
  if (!n.correctColorId) return [];
495
509
  let r = `${e.id}:color:${n.id}`;
496
- return [mt(r, e.id, n.label, n.correctColorId, t[r])];
510
+ return [_t(r, e.id, n.label, n.correctColorId, t[r])];
497
511
  });
498
512
  return n.concat(r);
499
513
  }
500
- function mt(e, t, n, r, i) {
514
+ function _t(e, t, n, r, i) {
501
515
  return i?.kind !== "choice" || !i.choiceId ? q(e, t, n, "unanswered") : q(e, t, n, i.choiceId === r ? "correct" : "incorrect");
502
516
  }
503
- function ht(e, t) {
517
+ function vt(e, t) {
504
518
  return e.columns.flatMap((n) => {
505
519
  if (typeof n.correctCount != "number") return [];
506
520
  let r = t?.kind === "coin-table" ? t.counts[n.id] : void 0, i = r === void 0 ? "unanswered" : r === n.correctCount ? "correct" : "incorrect";
507
521
  return q(`${e.id}:${n.id}`, e.id, n.title, i);
508
522
  });
509
523
  }
510
- function gt(e, t, n) {
524
+ function yt(e, t, n) {
511
525
  return t.columns.flatMap((r) => {
512
526
  if (typeof r.correctCount != "number") return [];
513
527
  let i = n?.kind === "coin-table" ? n.counts[r.id] : void 0, a = i === void 0 ? "unanswered" : i === r.correctCount ? "correct" : "incorrect";
514
528
  return q(`${e}:${t.id}:${r.id}`, e, r.title, a);
515
529
  });
516
530
  }
517
- function _t(e, t, n) {
531
+ function bt(e, t, n) {
518
532
  return t.cells.flatMap((r) => {
519
533
  if (t.hasHeaderRow && r.row === 0 || r.mode === "static" || !r.correctAnswer?.trim()) return [];
520
534
  let i = `${e}:${t.id}:${r.id}`;
521
535
  return [K(i, e, `${t.prompt} ${r.initialText}`.trim(), r.correctAnswer, n[i])];
522
536
  });
523
537
  }
524
- function vt(e, t, n) {
538
+ function xt(e, t, n) {
525
539
  return t ? Object.entries(t).map(([t, r]) => {
526
540
  let i = n?.kind === "placements" ? n.placements[t]?.targetId : void 0, a = i ? i === r ? "correct" : "incorrect" : "unanswered";
527
541
  return q(`${e}:${t}`, e, t, a);
528
542
  }) : [];
529
543
  }
530
- function yt(e, t) {
544
+ function St(e, t) {
531
545
  let n = e.grading.expectedSegments, r = t?.kind === "drawing" && ((t.elements?.length ?? 0) > 0 || (t.strokes?.length ?? 0) > 0);
532
546
  if (t?.kind !== "drawing" || !r) return q(e.id, e.id, e.prompt, "unanswered");
533
- let i = n.every((n) => bt(t, e, n));
547
+ let i = n.every((n) => Ct(t, e, n));
534
548
  return q(e.id, e.id, e.prompt, i ? "correct" : "incorrect");
535
549
  }
536
- function bt(e, t, n) {
537
- let r = wt(t, n.from), i = wt(t, n.to);
538
- return !r || !i ? !1 : xt(e).some((e) => St(e, r, i));
550
+ function Ct(e, t, n) {
551
+ let r = Dt(t, n.from), i = Dt(t, n.to);
552
+ return !r || !i ? !1 : wt(e).some((e) => Tt(e, r, i));
539
553
  }
540
- function xt(e) {
554
+ function wt(e) {
541
555
  let t = e.elements.flatMap((e) => e.type === "line" ? [{
542
556
  end: {
543
557
  x: e.points[2],
@@ -571,28 +585,28 @@ function xt(e) {
571
585
  }]) ?? [];
572
586
  return t.concat(n);
573
587
  }
574
- function St(e, t, n) {
575
- let r = At(e.start, t) <= tt && At(e.end, n) <= tt, i = At(e.start, n) <= tt && At(e.end, t) <= tt;
576
- return !r && !i ? !1 : Ct(e.points, t, n, tt);
588
+ function Tt(e, t, n) {
589
+ let r = Nt(e.start, t) <= it && Nt(e.end, n) <= it, i = Nt(e.start, n) <= it && Nt(e.end, t) <= it;
590
+ return !r && !i ? !1 : Et(e.points, t, n, it);
577
591
  }
578
- function Ct(e, t, n, r) {
579
- for (let i = 0; i < e.length - 1; i += 4) if (jt({
592
+ function Et(e, t, n, r) {
593
+ for (let i = 0; i < e.length - 1; i += 4) if (Pt({
580
594
  x: e[i],
581
595
  y: e[i + 1]
582
596
  }, t, n) > r) return !1;
583
597
  return !0;
584
598
  }
585
- function wt(e, t) {
599
+ function Dt(e, t) {
586
600
  if ("pointId" in t) {
587
601
  let n = e.points.find((e) => e.id === t.pointId);
588
- return n ? Tt(n.x, n.y) : null;
602
+ return n ? Ot(n.x, n.y) : null;
589
603
  }
590
- return Tt(t.percentX, t.percentY);
604
+ return Ot(t.percentX, t.percentY);
591
605
  }
592
- function Tt(e, t) {
606
+ function Ot(e, t) {
593
607
  return {
594
- x: e / 100 * $e,
595
- y: t / 100 * et
608
+ x: e / 100 * nt,
609
+ y: t / 100 * rt
596
610
  };
597
611
  }
598
612
  function q(e, t, n, r) {
@@ -603,41 +617,41 @@ function q(e, t, n, r) {
603
617
  status: r
604
618
  };
605
619
  }
606
- function Et(e, t) {
607
- let n = Dt(e), r = Dt(t), i = be(n), a = be(r);
620
+ function kt(e, t) {
621
+ let n = At(e), r = At(t), i = be(n), a = be(r);
608
622
  return i !== null && a !== null ? i === a : n === r;
609
623
  }
610
- function Dt(e) {
624
+ function At(e) {
611
625
  return e.trim().replace(/[٠-٩]/g, (e) => `${e.charCodeAt(0) - 1632}`).replace(/[۰-۹]/g, (e) => `${e.charCodeAt(0) - 1776}`);
612
626
  }
613
- function Ot(e, t) {
627
+ function jt(e, t) {
614
628
  return e.filter((e) => e.status === t).length;
615
629
  }
616
630
  function J(e, t) {
617
631
  return e.reduce((e, n) => e + t(n), 0);
618
632
  }
619
- function kt(e) {
633
+ function Mt(e) {
620
634
  return Math.round(e * 100) / 100;
621
635
  }
622
- function At(e, t) {
636
+ function Nt(e, t) {
623
637
  return Math.hypot(e.x - t.x, e.y - t.y);
624
638
  }
625
- function jt(e, t, n) {
639
+ function Pt(e, t, n) {
626
640
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
627
- if (a === 0) return At(e, t);
641
+ if (a === 0) return Nt(e, t);
628
642
  let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a));
629
- return At(e, {
643
+ return Nt(e, {
630
644
  x: t.x + o * r,
631
645
  y: t.y + o * i
632
646
  });
633
647
  }
634
648
  //#endregion
635
649
  //#region src/exam-session/interactions/CoinTableResponse.tsx
636
- var Mt = 0, Nt = 12;
637
- function Pt({ columns: e, value: t, onChange: n, showCountAnswer: r = !0 }) {
650
+ var Ft = 0, It = 12;
651
+ function Lt({ columns: e, value: t, onChange: n, showCountAnswer: r = !0 }) {
638
652
  let i = t?.counts ?? {};
639
653
  function a(e, t) {
640
- let r = e.maxCoins ?? Nt, a = Math.max(Mt, Math.min(r, t));
654
+ let r = e.maxCoins ?? It, a = Math.max(Ft, Math.min(r, t));
641
655
  n({
642
656
  kind: "coin-table",
643
657
  counts: {
@@ -649,7 +663,7 @@ function Pt({ columns: e, value: t, onChange: n, showCountAnswer: r = !0 }) {
649
663
  return /* @__PURE__ */ s("div", {
650
664
  className: "response-table",
651
665
  children: e.map((e) => {
652
- let t = i[e.id] ?? 0, n = e.maxCoins ?? Nt;
666
+ let t = i[e.id] ?? 0, n = e.maxCoins ?? It;
653
667
  return /* @__PURE__ */ c("div", {
654
668
  className: "response-column",
655
669
  children: [
@@ -674,7 +688,7 @@ function Pt({ columns: e, value: t, onChange: n, showCountAnswer: r = !0 }) {
674
688
  children: "إِضافَةٌ"
675
689
  }), /* @__PURE__ */ s("button", {
676
690
  className: "coin-action coin-action--secondary",
677
- disabled: t <= Mt,
691
+ disabled: t <= Ft,
678
692
  onClick: () => a(e, t - 1),
679
693
  type: "button",
680
694
  children: "حَذْفٌ"
@@ -701,7 +715,7 @@ function Pt({ columns: e, value: t, onChange: n, showCountAnswer: r = !0 }) {
701
715
  }
702
716
  //#endregion
703
717
  //#region src/renderer/shapeCatalog.tsx
704
- var Ft = {
718
+ var Rt = {
705
719
  circle: m,
706
720
  diamond: h,
707
721
  heart: v,
@@ -711,7 +725,7 @@ var Ft = {
711
725
  square: A,
712
726
  star: j,
713
727
  triangle: P
714
- }, It = {
728
+ }, zt = {
715
729
  circle: "Cercle",
716
730
  diamond: "Losange",
717
731
  heart: "Coeur",
@@ -721,15 +735,15 @@ var Ft = {
721
735
  square: "Carre",
722
736
  star: "Etoile",
723
737
  triangle: "Triangle"
724
- }, Lt = Object.keys(It).map((e) => ({
725
- label: It[e],
738
+ }, Bt = Object.keys(zt).map((e) => ({
739
+ label: zt[e],
726
740
  value: e
727
741
  }));
728
- function Rt(e) {
729
- return It[e];
742
+ function Vt(e) {
743
+ return zt[e];
730
744
  }
731
- function zt({ shapeId: e, title: t }) {
732
- let n = Ft[e];
745
+ function Ht({ shapeId: e, title: t }) {
746
+ let n = Rt[e];
733
747
  return /* @__PURE__ */ s("span", {
734
748
  "aria-label": t,
735
749
  role: t ? "img" : void 0,
@@ -739,7 +753,7 @@ function zt({ shapeId: e, title: t }) {
739
753
  }
740
754
  //#endregion
741
755
  //#region src/exam-session/interactions/DragMatch.tsx
742
- function Bt({ items: e, targets: t, value: n, onChange: r }) {
756
+ function Ut({ items: e, targets: t, value: n, onChange: r }) {
743
757
  let i = n?.pairs ?? {}, a = new Set(Object.values(i));
744
758
  return /* @__PURE__ */ s(l, {
745
759
  onDragEnd: (e) => {
@@ -757,10 +771,10 @@ function Bt({ items: e, targets: t, value: n, onChange: r }) {
757
771
  className: "drag-match",
758
772
  children: [/* @__PURE__ */ s("div", {
759
773
  className: "drag-match__items",
760
- children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ s(Vt, { item: e }, e.id))
774
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ s(Wt, { item: e }, e.id))
761
775
  }), /* @__PURE__ */ s("div", {
762
776
  className: "drag-match__targets",
763
- children: t.map((t) => /* @__PURE__ */ s(Ht, {
777
+ children: t.map((t) => /* @__PURE__ */ s(Gt, {
764
778
  assignedItem: e.find((e) => e.id === i[t.id]),
765
779
  target: t
766
780
  }, t.id))
@@ -768,7 +782,7 @@ function Bt({ items: e, targets: t, value: n, onChange: r }) {
768
782
  })
769
783
  });
770
784
  }
771
- function Vt({ item: e }) {
785
+ function Wt({ item: e }) {
772
786
  let { ref: t, isDragging: n } = u({ id: e.id });
773
787
  return /* @__PURE__ */ s("button", {
774
788
  className: n ? "drag-pill drag-pill--dragging" : "drag-pill",
@@ -777,24 +791,24 @@ function Vt({ item: e }) {
777
791
  children: e.label
778
792
  });
779
793
  }
780
- function Ht({ assignedItem: e, target: t }) {
794
+ function Gt({ assignedItem: e, target: t }) {
781
795
  let { ref: n, isDropTarget: r } = d({ id: t.id });
782
796
  return /* @__PURE__ */ c("div", {
783
797
  className: r ? "drop-slot drop-slot--active" : "drop-slot",
784
798
  ref: n,
785
799
  children: [/* @__PURE__ */ s("span", {
786
800
  className: t.shapeId ? "drop-slot__visual drop-slot__visual--shape" : "drop-slot__visual",
787
- children: t.shapeId ? /* @__PURE__ */ s(zt, {
801
+ children: t.shapeId ? /* @__PURE__ */ s(Ht, {
788
802
  shapeId: t.shapeId,
789
803
  title: t.label
790
804
  }) : t.label
791
- }), e ? /* @__PURE__ */ s(Vt, { item: e }) : /* @__PURE__ */ s("span", { children: "ضع الإجابة هنا" })]
805
+ }), e ? /* @__PURE__ */ s(Wt, { item: e }) : /* @__PURE__ */ s("span", { children: "ضع الإجابة هنا" })]
792
806
  });
793
807
  }
794
808
  //#endregion
795
809
  //#region src/exam-session/interactions/HandwrittenNumberAnswer.tsx
796
- var Ut = 132, Wt = 88, Gt = 650;
797
- function Y({ ariaLabel: e, canvasHeight: n = Wt, canvasWidth: r = Ut, onChange: o, onClear: l, recognizer: u, value: d }) {
810
+ var Kt = 132, qt = 88, Jt = 650;
811
+ function Y({ ariaLabel: e, canvasHeight: n = qt, canvasWidth: r = Kt, onChange: o, onClear: l, recognizer: u, value: d }) {
798
812
  let f = d?.strokes ?? [], p = f.length === 0, m = i(o), [h, _] = a(!1), [v, y] = a(!1), b = !!u?.isAvailable(), x = u?.getStatus?.() ?? (b ? "ready" : "unavailable"), S = x === "preparing" || x === "error", C = x === "preparing" ? "preparing-model" : x === "error" ? "model-error" : p || h ? "idle" : d?.recognizedValue === void 0 ? !b || x === "unavailable" ? "unavailable" : v ? "unrecognized" : "recognizing" : "recognized";
799
813
  t(() => {
800
814
  m.current = o;
@@ -812,7 +826,7 @@ function Y({ ariaLabel: e, canvasHeight: n = Wt, canvasWidth: r = Ut, onChange:
812
826
  }).catch(() => {
813
827
  e || y(!0);
814
828
  });
815
- }, Gt);
829
+ }, Jt);
816
830
  return () => {
817
831
  e = !0, window.clearTimeout(t);
818
832
  };
@@ -935,12 +949,12 @@ function Y({ ariaLabel: e, canvasHeight: n = Wt, canvasWidth: r = Ut, onChange:
935
949
  "aria-live": "polite",
936
950
  className: "handwritten-number-status",
937
951
  "data-state": C,
938
- children: Kt(C, d?.recognizedValue)
952
+ children: Yt(C, d?.recognizedValue)
939
953
  })
940
954
  ]
941
955
  });
942
956
  }
943
- function Kt(e, t) {
957
+ function Yt(e, t) {
944
958
  switch (e) {
945
959
  case "recognizing": return "جارٍ التعرّف على الرقم…";
946
960
  case "recognized": return `تمّ التعرّف: ${t ?? ""}`;
@@ -953,13 +967,13 @@ function Kt(e, t) {
953
967
  }
954
968
  //#endregion
955
969
  //#region src/exam-session/interactions/HandwrittenFractionAnswer.tsx
956
- var qt = 104, Jt = 58;
957
- function Yt({ ariaLabel: e, onChange: t, recognizer: n, value: r }) {
970
+ var Xt = 104, Zt = 58;
971
+ function Qt({ ariaLabel: e, onChange: t, recognizer: n, value: r }) {
958
972
  function i(e, n) {
959
973
  t({
960
- denominator: e === "denominator" ? n : r?.denominator ?? Xt(),
974
+ denominator: e === "denominator" ? n : r?.denominator ?? $t(),
961
975
  kind: "fraction",
962
- numerator: e === "numerator" ? n : r?.numerator ?? Xt()
976
+ numerator: e === "numerator" ? n : r?.numerator ?? $t()
963
977
  });
964
978
  }
965
979
  return /* @__PURE__ */ c("div", {
@@ -969,8 +983,8 @@ function Yt({ ariaLabel: e, onChange: t, recognizer: n, value: r }) {
969
983
  children: [
970
984
  /* @__PURE__ */ s(Y, {
971
985
  ariaLabel: `${e} numerator`,
972
- canvasHeight: Jt,
973
- canvasWidth: qt,
986
+ canvasHeight: Zt,
987
+ canvasWidth: Xt,
974
988
  onChange: (e) => i("numerator", e),
975
989
  recognizer: n,
976
990
  value: r?.numerator
@@ -981,8 +995,8 @@ function Yt({ ariaLabel: e, onChange: t, recognizer: n, value: r }) {
981
995
  }),
982
996
  /* @__PURE__ */ s(Y, {
983
997
  ariaLabel: `${e} denominator`,
984
- canvasHeight: Jt,
985
- canvasWidth: qt,
998
+ canvasHeight: Zt,
999
+ canvasWidth: Xt,
986
1000
  onChange: (e) => i("denominator", e),
987
1001
  recognizer: n,
988
1002
  value: r?.denominator
@@ -990,17 +1004,17 @@ function Yt({ ariaLabel: e, onChange: t, recognizer: n, value: r }) {
990
1004
  ]
991
1005
  });
992
1006
  }
993
- function Xt() {
1007
+ function $t() {
994
1008
  return {
995
- canvasHeight: Jt,
996
- canvasWidth: qt,
1009
+ canvasHeight: Zt,
1010
+ canvasWidth: Xt,
997
1011
  kind: "handwritten-number",
998
1012
  strokes: []
999
1013
  };
1000
1014
  }
1001
1015
  //#endregion
1002
1016
  //#region src/exam-session/interactions/ColorPenPicker.tsx
1003
- function Zt({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
1017
+ function en({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onChange: i, selectedColorId: a }) {
1004
1018
  return /* @__PURE__ */ s("div", {
1005
1019
  "aria-label": e,
1006
1020
  className: ["color-pen-picker", t].filter(Boolean).join(" "),
@@ -1024,7 +1038,7 @@ function Zt({ ariaLabel: e, className: t = "", colors: n, disabled: r = !1, onCh
1024
1038
  }
1025
1039
  //#endregion
1026
1040
  //#region src/exam-session/interactions/geometryColors.ts
1027
- var Qt = [
1041
+ var tn = [
1028
1042
  {
1029
1043
  id: "green",
1030
1044
  label: "أَخْضَرُ",
@@ -1045,28 +1059,28 @@ var Qt = [
1045
1059
  label: "أَسْوَدُ",
1046
1060
  value: "#17212b"
1047
1061
  }
1048
- ], $t = {
1062
+ ], nn = {
1049
1063
  black: "#17212b",
1050
1064
  blue: "#256fd2",
1051
1065
  green: "#0b7f45",
1052
1066
  red: "#e34a58"
1053
1067
  };
1054
- function en(e, t) {
1068
+ function rn(e, t) {
1055
1069
  return t ? e.find((e) => e.id === t || e.value === t)?.id ?? e[0]?.id ?? "green" : e[0]?.id ?? "green";
1056
1070
  }
1057
- function tn(e, t) {
1058
- return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? Qt[0].value;
1071
+ function an(e, t) {
1072
+ return e.find((e) => e.id === t)?.value ?? e[0]?.value ?? tn[0].value;
1059
1073
  }
1060
- function nn(e) {
1074
+ function on(e) {
1061
1075
  return e.map((e) => ({
1062
1076
  id: e.id,
1063
1077
  label: e.label,
1064
- value: $t[e.id] ?? Qt[0].value
1078
+ value: nn[e.id] ?? tn[0].value
1065
1079
  }));
1066
1080
  }
1067
1081
  //#endregion
1068
1082
  //#region src/exam-session/interactions/GeometryCanvas.tsx
1069
- var rn = 1e3, an = 600, on = 30, sn = 240, cn = 12, ln = Qt[0].value, X = "#0a8f55", un = [
1083
+ var sn = 1e3, cn = 600, ln = 30, un = 240, dn = 12, fn = tn[0].value, X = "#0a8f55", pn = [
1070
1084
  {
1071
1085
  id: "pen",
1072
1086
  icon: "✎",
@@ -1097,15 +1111,15 @@ var rn = 1e3, an = 600, on = 30, sn = 240, cn = 12, ln = Qt[0].value, X = "#0a8f
1097
1111
  icon: "⌖",
1098
1112
  label: "بَرْكارٌ"
1099
1113
  }
1100
- ], dn = /* @__PURE__ */ new Set([
1114
+ ], mn = /* @__PURE__ */ new Set([
1101
1115
  "ruler",
1102
1116
  "protractor",
1103
1117
  "compass"
1104
- ]), fn = {
1118
+ ]), hn = {
1105
1119
  icon: "T",
1106
1120
  id: "text",
1107
1121
  label: "Text"
1108
- }, pn = [
1122
+ }, gn = [
1109
1123
  "pen",
1110
1124
  "eraser",
1111
1125
  "line",
@@ -1113,23 +1127,23 @@ var rn = 1e3, an = 600, on = 30, sn = 240, cn = 12, ln = Qt[0].value, X = "#0a8f
1113
1127
  "protractor",
1114
1128
  "compass"
1115
1129
  ];
1116
- function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWidth: r = rn, className: o = "", colorOptions: l = Qt, defaultColor: u, disabled: d = !1, minStageWidth: f = sn, onChange: p, paper: m = "squared", points: h = [], showColorPalette: g = !0, value: _, variant: v = "question" }) {
1117
- let y = l.length > 0 ? l : Qt, [b, x] = a(null), [S, C] = a([]), [w, T] = a(() => en(y, u ?? "black")), [E, D] = a(() => wn(_)), [O, ee] = a(() => _?.guides ?? Cn(r, n)), [k, A] = a(null), [j, M] = a(null), [N, P] = a({
1130
+ function _n({ actionLabel: e, availableTools: t, canvasHeight: n = cn, canvasWidth: r = sn, className: o = "", colorOptions: l = tn, defaultColor: u, disabled: d = !1, minStageWidth: f = un, onChange: p, paper: m = "squared", points: h = [], showColorPalette: g = !0, value: _, variant: v = "question" }) {
1131
+ let y = l.length > 0 ? l : tn, [b, x] = a(null), [S, C] = a([]), [w, T] = a(() => rn(y, u ?? "black")), [E, D] = a(() => Dn(_)), [O, ee] = a(() => _?.guides ?? En(r, n)), [k, A] = a(null), [j, M] = a(null), [N, P] = a({
1118
1132
  height: n,
1119
1133
  scale: 1,
1120
1134
  width: r
1121
1135
  }), [te, F] = a({
1122
1136
  canRedo: !1,
1123
1137
  canUndo: !1
1124
- }), I = i(null), ne = i([En(E)]), L = i(0), R = i(0), z = i(null);
1125
- hn(I, r, n, f, P);
1126
- let B = Dn(h, r, n), re = [
1138
+ }), I = i(null), ne = i([kn(E)]), L = i(0), R = i(0), z = i(null);
1139
+ vn(I, r, n, f, P);
1140
+ let B = An(h, r, n), re = [
1127
1141
  "geometry-canvas",
1128
1142
  `geometry-canvas--${v}`,
1129
1143
  o
1130
- ].filter(Boolean).join(" "), V = y.some((e) => e.id === w) ? w : en(y, "black"), ae = tn(y, V), se = un.concat(fn).filter((e) => (t ?? pn).includes(e.id)), U = An(b);
1144
+ ].filter(Boolean).join(" "), V = y.some((e) => e.id === w) ? w : rn(y, "black"), ae = an(y, V), se = pn.concat(hn).filter((e) => (t ?? gn).includes(e.id)), U = Nn(b);
1131
1145
  function ce(e) {
1132
- return dn.has(e) ? !U && S.includes(e) : b === e || S.includes(e);
1146
+ return mn.has(e) ? !U && S.includes(e) : b === e || S.includes(e);
1133
1147
  }
1134
1148
  function le(e) {
1135
1149
  C((t) => t.includes(e) ? t.filter((t) => t !== e) : t.concat(e));
@@ -1158,10 +1172,10 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1158
1172
  }
1159
1173
  function fe(e, t = O) {
1160
1174
  p({
1161
- elements: En(e),
1175
+ elements: kn(e),
1162
1176
  guides: t,
1163
1177
  kind: "drawing",
1164
- strokes: Tn(e)
1178
+ strokes: On(e)
1165
1179
  });
1166
1180
  }
1167
1181
  function pe() {
@@ -1171,7 +1185,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1171
1185
  });
1172
1186
  }
1173
1187
  function W(e, t = O) {
1174
- let n = En(e), r = ne.current.slice(0, L.current + 1);
1188
+ let n = kn(e), r = ne.current.slice(0, L.current + 1);
1175
1189
  r.push(n), ne.current = r, L.current = r.length - 1, D(n), fe(n, t), pe();
1176
1190
  }
1177
1191
  function me(e) {
@@ -1180,13 +1194,13 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1180
1194
  function he() {
1181
1195
  if (!te.canUndo || d) return;
1182
1196
  --L.current;
1183
- let e = En(ne.current[L.current]);
1197
+ let e = kn(ne.current[L.current]);
1184
1198
  D(e), fe(e), pe();
1185
1199
  }
1186
1200
  function ge() {
1187
1201
  if (!te.canRedo || d) return;
1188
1202
  L.current += 1;
1189
- let e = En(ne.current[L.current]);
1203
+ let e = kn(ne.current[L.current]);
1190
1204
  D(e), fe(e), pe();
1191
1205
  }
1192
1206
  function _e() {
@@ -1195,19 +1209,19 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1195
1209
  function ve(e) {
1196
1210
  let t = e.target.getStage()?.getPointerPosition();
1197
1211
  return t ? {
1198
- x: Vn(t.x / N.scale, 0, r),
1199
- y: Vn(t.y / N.scale, 0, n)
1212
+ x: Wn(t.x / N.scale, 0, r),
1213
+ y: Wn(t.y / N.scale, 0, n)
1200
1214
  } : null;
1201
1215
  }
1202
1216
  function ye(e) {
1203
- if (d || !U && kn(e.target)) return;
1217
+ if (d || !U && Mn(e.target)) return;
1204
1218
  let t = ve(e);
1205
1219
  if (!t || !b) return;
1206
1220
  if (b === "eraser") {
1207
1221
  xe(t);
1208
1222
  return;
1209
1223
  }
1210
- let n = On(t, B);
1224
+ let n = jn(t, B);
1211
1225
  if (b === "text") {
1212
1226
  M({
1213
1227
  color: ae,
@@ -1267,7 +1281,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1267
1281
  return;
1268
1282
  }
1269
1283
  if (k.type === "line") {
1270
- let e = On(t, B);
1284
+ let e = jn(t, B);
1271
1285
  A({
1272
1286
  ...k,
1273
1287
  points: [
@@ -1281,7 +1295,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1281
1295
  }
1282
1296
  k.type === "circle" && A({
1283
1297
  ...k,
1284
- radius: Bn(k.center, t)
1298
+ radius: Un(k.center, t)
1285
1299
  });
1286
1300
  }
1287
1301
  }
@@ -1292,7 +1306,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1292
1306
  return;
1293
1307
  }
1294
1308
  let e = k;
1295
- if (z.current = null, A(null), Mn(e)) {
1309
+ if (z.current = null, A(null), Fn(e)) {
1296
1310
  if (e.type === "circle") {
1297
1311
  let t = {
1298
1312
  ...O,
@@ -1309,7 +1323,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1309
1323
  }
1310
1324
  function xe(e) {
1311
1325
  if (E.length === 0) return;
1312
- let t = Nn(E, e);
1326
+ let t = In(E, e);
1313
1327
  t < 0 || W(E.filter((e, n) => n !== t));
1314
1328
  }
1315
1329
  function Se() {
@@ -1341,7 +1355,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1341
1355
  className: [
1342
1356
  "geometry-tool-button",
1343
1357
  ce(e.id) ? "geometry-tool-button--active" : "",
1344
- dn.has(e.id) ? "geometry-tool-button--guide" : ""
1358
+ mn.has(e.id) ? "geometry-tool-button--guide" : ""
1345
1359
  ].filter(Boolean).join(" "),
1346
1360
  disabled: d,
1347
1361
  onClick: () => ue(e.id),
@@ -1352,7 +1366,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1352
1366
  }), /* @__PURE__ */ s("span", { children: e.label })]
1353
1367
  }, e.id))
1354
1368
  }),
1355
- g ? /* @__PURE__ */ s(Zt, {
1369
+ g ? /* @__PURE__ */ s(en, {
1356
1370
  ariaLabel: "أَلْوانُ الأَقْلامِ",
1357
1371
  className: "geometry-color-picker",
1358
1372
  colors: y,
@@ -1384,19 +1398,19 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1384
1398
  strokeWidth: 1,
1385
1399
  width: r
1386
1400
  }),
1387
- /* @__PURE__ */ s(gn, {
1401
+ /* @__PURE__ */ s(yn, {
1388
1402
  canvasHeight: n,
1389
1403
  canvasWidth: r,
1390
1404
  paper: m
1391
1405
  }),
1392
- h.map((e, t) => e.hidden ? null : /* @__PURE__ */ s(_n, {
1393
- label: vn(e, t),
1406
+ h.map((e, t) => e.hidden ? null : /* @__PURE__ */ s(bn, {
1407
+ label: xn(e, t),
1394
1408
  x: e.x / 100 * r,
1395
1409
  y: e.y / 100 * n
1396
1410
  }, e.id)),
1397
- E.map((e) => Sn(e)),
1398
- k ? Sn(k, !0) : null,
1399
- S.includes("ruler") ? /* @__PURE__ */ s(yn, {
1411
+ E.map((e) => Tn(e)),
1412
+ k ? Tn(k, !0) : null,
1413
+ S.includes("ruler") ? /* @__PURE__ */ s(Sn, {
1400
1414
  disabled: d,
1401
1415
  guide: O.ruler,
1402
1416
  locked: U,
@@ -1405,7 +1419,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1405
1419
  ruler: e
1406
1420
  })
1407
1421
  }, `${O.ruler.x}:${O.ruler.y}:${O.ruler.length}:${O.ruler.rotation}`) : null,
1408
- S.includes("protractor") ? /* @__PURE__ */ s(bn, {
1422
+ S.includes("protractor") ? /* @__PURE__ */ s(Cn, {
1409
1423
  disabled: d,
1410
1424
  guide: O.protractor,
1411
1425
  locked: U,
@@ -1414,7 +1428,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1414
1428
  protractor: e
1415
1429
  })
1416
1430
  }) : null,
1417
- S.includes("compass") ? /* @__PURE__ */ s(xn, {
1431
+ S.includes("compass") ? /* @__PURE__ */ s(wn, {
1418
1432
  disabled: d,
1419
1433
  guide: O.compass,
1420
1434
  locked: U,
@@ -1474,7 +1488,7 @@ function mn({ actionLabel: e, availableTools: t, canvasHeight: n = an, canvasWid
1474
1488
  ]
1475
1489
  });
1476
1490
  }
1477
- function hn(e, n, r, i, a) {
1491
+ function vn(e, n, r, i, a) {
1478
1492
  t(() => {
1479
1493
  let t = e.current;
1480
1494
  if (!t) return;
@@ -1500,7 +1514,7 @@ function hn(e, n, r, i, a) {
1500
1514
  a
1501
1515
  ]);
1502
1516
  }
1503
- function gn({ canvasHeight: e, canvasWidth: t, paper: n }) {
1517
+ function yn({ canvasHeight: e, canvasWidth: t, paper: n }) {
1504
1518
  if (n === "blank") return null;
1505
1519
  if (n === "ruled") {
1506
1520
  let n = Math.floor(e / 46);
@@ -1515,12 +1529,12 @@ function gn({ canvasHeight: e, canvasWidth: t, paper: n }) {
1515
1529
  strokeWidth: 1.4
1516
1530
  }, `ruled-${n}`)) });
1517
1531
  }
1518
- let r = Math.floor(t / on), i = Math.floor(e / on);
1532
+ let r = Math.floor(t / ln), i = Math.floor(e / ln);
1519
1533
  return /* @__PURE__ */ c(o, { children: [Array.from({ length: r + 1 }, (t, n) => /* @__PURE__ */ s(V, {
1520
1534
  points: [
1521
- n * on,
1535
+ n * ln,
1522
1536
  0,
1523
- n * on,
1537
+ n * ln,
1524
1538
  e
1525
1539
  ],
1526
1540
  stroke: "#d2ded8",
@@ -1528,15 +1542,15 @@ function gn({ canvasHeight: e, canvasWidth: t, paper: n }) {
1528
1542
  }, `vertical-${n}`)), Array.from({ length: i + 1 }, (e, n) => /* @__PURE__ */ s(V, {
1529
1543
  points: [
1530
1544
  0,
1531
- n * on,
1545
+ n * ln,
1532
1546
  t,
1533
- n * on
1547
+ n * ln
1534
1548
  ],
1535
1549
  stroke: "#d2ded8",
1536
1550
  strokeWidth: 1
1537
1551
  }, `horizontal-${n}`))] });
1538
1552
  }
1539
- function _n({ label: e, x: t, y: n }) {
1553
+ function bn({ label: e, x: t, y: n }) {
1540
1554
  return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(R, {
1541
1555
  fill: "#e63542",
1542
1556
  radius: 4.75,
@@ -1555,18 +1569,18 @@ function _n({ label: e, x: t, y: n }) {
1555
1569
  y: n - 18
1556
1570
  })] });
1557
1571
  }
1558
- function vn(e, t) {
1572
+ function xn(e, t) {
1559
1573
  let n = e.label?.trim();
1560
1574
  return n && n.length > 0 ? n : String(t + 1);
1561
1575
  }
1562
- function yn({ disabled: e, guide: t, locked: n, onCommit: r }) {
1576
+ function Sn({ disabled: e, guide: t, locked: n, onCommit: r }) {
1563
1577
  let [l, u] = a(t), d = i(t), f = l.length / 2, p = f + 44, m = -f - 44, h = f + 8, g = -f - 8, _ = !e && !n;
1564
1578
  function v(e) {
1565
1579
  d.current = e, u(e);
1566
1580
  }
1567
1581
  function y(e) {
1568
1582
  e.cancelBubble = !0;
1569
- let t = jn(e);
1583
+ let t = Pn(e);
1570
1584
  t && (v({
1571
1585
  ...d.current,
1572
1586
  x: t.x,
@@ -1584,8 +1598,8 @@ function yn({ disabled: e, guide: t, locked: n, onCommit: r }) {
1584
1598
  }
1585
1599
  function x(e, t) {
1586
1600
  e.cancelBubble = !0;
1587
- let n = jn(e);
1588
- n && (v(Rn(d.current, n, t)), e.currentTarget.position({
1601
+ let n = Pn(e);
1602
+ n && (v(Vn(d.current, n, t)), e.currentTarget.position({
1589
1603
  x: 0,
1590
1604
  y: 0
1591
1605
  }));
@@ -1593,7 +1607,7 @@ function yn({ disabled: e, guide: t, locked: n, onCommit: r }) {
1593
1607
  function S() {
1594
1608
  let e = {
1595
1609
  ...d.current,
1596
- rotation: Hn(d.current.rotation + 90)
1610
+ rotation: Gn(d.current.rotation + 90)
1597
1611
  };
1598
1612
  v(e), r(e);
1599
1613
  }
@@ -1755,8 +1769,8 @@ function yn({ disabled: e, guide: t, locked: n, onCommit: r }) {
1755
1769
  ]
1756
1770
  }) });
1757
1771
  }
1758
- function bn({ disabled: e, guide: t, locked: n, onChange: r }) {
1759
- let i = !e && !n, a = In({
1772
+ function Cn({ disabled: e, guide: t, locked: n, onChange: r }) {
1773
+ let i = !e && !n, a = zn({
1760
1774
  x: 136,
1761
1775
  y: 0
1762
1776
  }, t.rotation, {
@@ -1849,7 +1863,7 @@ function bn({ disabled: e, guide: t, locked: n, onChange: r }) {
1849
1863
  y: a.y
1850
1864
  })] });
1851
1865
  }
1852
- function xn({ disabled: e, guide: t, locked: n, onChange: r }) {
1866
+ function wn({ disabled: e, guide: t, locked: n, onChange: r }) {
1853
1867
  let i = !e && !n, a = {
1854
1868
  x: t.center.x + t.radius,
1855
1869
  y: t.center.y
@@ -1923,7 +1937,7 @@ function xn({ disabled: e, guide: t, locked: n, onChange: r }) {
1923
1937
  let n = e.target.position();
1924
1938
  r({
1925
1939
  ...t,
1926
- radius: Math.max(14, Bn(t.center, n))
1940
+ radius: Math.max(14, Un(t.center, n))
1927
1941
  });
1928
1942
  },
1929
1943
  radius: 9,
@@ -1934,7 +1948,7 @@ function xn({ disabled: e, guide: t, locked: n, onChange: r }) {
1934
1948
  })
1935
1949
  ] });
1936
1950
  }
1937
- function Sn(e, t = !1) {
1951
+ function Tn(e, t = !1) {
1938
1952
  let n = t ? .58 : 1;
1939
1953
  return e.type === "freehand" ? /* @__PURE__ */ s(V, {
1940
1954
  lineCap: "round",
@@ -1968,7 +1982,7 @@ function Sn(e, t = !1) {
1968
1982
  y: e.center.y
1969
1983
  }, e.id);
1970
1984
  }
1971
- function Cn(e, t) {
1985
+ function En(e, t) {
1972
1986
  return {
1973
1987
  compass: {
1974
1988
  center: {
@@ -1990,16 +2004,16 @@ function Cn(e, t) {
1990
2004
  }
1991
2005
  };
1992
2006
  }
1993
- function wn(e) {
1994
- return e?.elements?.length ? En(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
1995
- color: ln,
2007
+ function Dn(e) {
2008
+ return e?.elements?.length ? kn(e.elements) : (e?.strokes ?? []).filter((e) => e.tool === "pen" && e.points.length >= 4).map((e) => ({
2009
+ color: fn,
1996
2010
  id: e.id,
1997
2011
  points: e.points.slice(),
1998
2012
  strokeWidth: 4,
1999
2013
  type: "freehand"
2000
2014
  }));
2001
2015
  }
2002
- function Tn(e) {
2016
+ function On(e) {
2003
2017
  return e.flatMap((e) => e.type === "freehand" ? [{
2004
2018
  id: e.id,
2005
2019
  points: e.points.slice(),
@@ -2010,7 +2024,7 @@ function Tn(e) {
2010
2024
  tool: "pen"
2011
2025
  }] : []);
2012
2026
  }
2013
- function En(e) {
2027
+ function kn(e) {
2014
2028
  return e.map((e) => e.type === "freehand" ? {
2015
2029
  ...e,
2016
2030
  points: e.points.slice()
@@ -2027,25 +2041,25 @@ function En(e) {
2027
2041
  center: { ...e.center }
2028
2042
  });
2029
2043
  }
2030
- function Dn(e, t, n) {
2044
+ function An(e, t, n) {
2031
2045
  let r = e.map((e) => ({
2032
2046
  x: e.x / 100 * t,
2033
2047
  y: e.y / 100 * n
2034
2048
  })), i = [];
2035
- for (let e = 0; e <= t; e += on) for (let t = 0; t <= n; t += on) i.push({
2049
+ for (let e = 0; e <= t; e += ln) for (let t = 0; t <= n; t += ln) i.push({
2036
2050
  x: e,
2037
2051
  y: t
2038
2052
  });
2039
2053
  return r.concat(i);
2040
2054
  }
2041
- function On(e, t) {
2042
- let n = e, r = cn;
2055
+ function jn(e, t) {
2056
+ let n = e, r = dn;
2043
2057
  return t.forEach((t) => {
2044
- let i = Bn(e, t);
2058
+ let i = Un(e, t);
2045
2059
  i < r && (n = t, r = i);
2046
2060
  }), n;
2047
2061
  }
2048
- function kn(e) {
2062
+ function Mn(e) {
2049
2063
  let t = e;
2050
2064
  for (; t;) {
2051
2065
  if (t.name().split(" ").includes("geometry-guide")) return !0;
@@ -2053,10 +2067,10 @@ function kn(e) {
2053
2067
  }
2054
2068
  return !1;
2055
2069
  }
2056
- function An(e) {
2070
+ function Nn(e) {
2057
2071
  return e === "pen" || e === "line" || e === "eraser";
2058
2072
  }
2059
- function jn(e) {
2073
+ function Pn(e) {
2060
2074
  let t = e.target.getStage()?.getPointerPosition();
2061
2075
  if (!t) return null;
2062
2076
  let n = e.target.getLayer(), r = n?.scaleX() || 1, i = n?.scaleY() || r;
@@ -2065,20 +2079,20 @@ function jn(e) {
2065
2079
  y: t.y / i
2066
2080
  };
2067
2081
  }
2068
- function Mn(e) {
2069
- return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? zn(e.points) > 6 : e.type === "text" ? e.text.trim().length > 0 : e.radius > 6;
2082
+ function Fn(e) {
2083
+ return e.type === "freehand" ? e.points.length >= 4 : e.type === "line" ? Hn(e.points) > 6 : e.type === "text" ? e.text.trim().length > 0 : e.radius > 6;
2070
2084
  }
2071
- function Nn(e, t) {
2072
- for (let n = e.length - 1; n >= 0; --n) if (Pn(e[n], t)) return n;
2085
+ function In(e, t) {
2086
+ for (let n = e.length - 1; n >= 0; --n) if (Ln(e[n], t)) return n;
2073
2087
  return -1;
2074
2088
  }
2075
- function Pn(e, t) {
2076
- if (e.type === "circle") return Math.abs(Bn(e.center, t) - e.radius) <= 14;
2089
+ function Ln(e, t) {
2090
+ if (e.type === "circle") return Math.abs(Un(e.center, t) - e.radius) <= 14;
2077
2091
  if (e.type === "text") {
2078
2092
  let n = Math.max(56, e.text.length * e.fontSize * .58), r = e.fontSize * 1.5;
2079
2093
  return t.x >= e.x - 12 && t.x <= e.x + n + 12 && t.y >= e.y - 12 && t.y <= e.y + r + 12;
2080
2094
  }
2081
- for (let n = 0; n < e.points.length - 2; n += 2) if (Fn(t, {
2095
+ for (let n = 0; n < e.points.length - 2; n += 2) if (Rn(t, {
2082
2096
  x1: e.points[n],
2083
2097
  x2: e.points[n + 2],
2084
2098
  y1: e.points[n + 1],
@@ -2086,27 +2100,27 @@ function Pn(e, t) {
2086
2100
  }) <= 14) return !0;
2087
2101
  return !1;
2088
2102
  }
2089
- function Fn(e, t) {
2103
+ function Rn(e, t) {
2090
2104
  let n = t.x2 - t.x1, r = t.y2 - t.y1, i = n * n + r * r;
2091
- if (i === 0) return Bn(e, {
2105
+ if (i === 0) return Un(e, {
2092
2106
  x: t.x1,
2093
2107
  y: t.y1
2094
2108
  });
2095
- let a = Vn(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
2096
- return Bn(e, {
2109
+ let a = Wn(((e.x - t.x1) * n + (e.y - t.y1) * r) / i, 0, 1);
2110
+ return Un(e, {
2097
2111
  x: t.x1 + a * n,
2098
2112
  y: t.y1 + a * r
2099
2113
  });
2100
2114
  }
2101
- function In(e, t, n) {
2115
+ function zn(e, t, n) {
2102
2116
  let r = t * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
2103
2117
  return {
2104
2118
  x: n.x + e.x * i - e.y * a,
2105
2119
  y: n.y + e.x * a + e.y * i
2106
2120
  };
2107
2121
  }
2108
- function Ln(e, t) {
2109
- return In({
2122
+ function Bn(e, t) {
2123
+ return zn({
2110
2124
  x: t === "left" ? -e.length / 2 : e.length / 2,
2111
2125
  y: 0
2112
2126
  }, e.rotation, {
@@ -2114,8 +2128,8 @@ function Ln(e, t) {
2114
2128
  y: e.y
2115
2129
  });
2116
2130
  }
2117
- function Rn(e, t, n) {
2118
- let r = n === "right" ? "left" : "right", i = Ln(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = Hn(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
2131
+ function Vn(e, t, n) {
2132
+ let r = n === "right" ? "left" : "right", i = Bn(e, r), a = Math.atan2(t.y - i.y, t.x - i.x) * 180 / Math.PI, o = Gn(n === "right" ? a : a + 180), s = o * Math.PI / 180, c = e.length / 2, l = r === "left" ? 1 : -1;
2119
2133
  return {
2120
2134
  ...e,
2121
2135
  rotation: o,
@@ -2123,8 +2137,8 @@ function Rn(e, t, n) {
2123
2137
  y: i.y + Math.sin(s) * c * l
2124
2138
  };
2125
2139
  }
2126
- function zn(e) {
2127
- return Bn({
2140
+ function Hn(e) {
2141
+ return Un({
2128
2142
  x: e[0],
2129
2143
  y: e[1]
2130
2144
  }, {
@@ -2132,19 +2146,19 @@ function zn(e) {
2132
2146
  y: e[3]
2133
2147
  });
2134
2148
  }
2135
- function Bn(e, t) {
2149
+ function Un(e, t) {
2136
2150
  return Math.hypot(e.x - t.x, e.y - t.y);
2137
2151
  }
2138
- function Vn(e, t, n) {
2152
+ function Wn(e, t, n) {
2139
2153
  return Math.min(Math.max(e, t), n);
2140
2154
  }
2141
- function Hn(e) {
2155
+ function Gn(e) {
2142
2156
  return (e % 360 + 360) % 360;
2143
2157
  }
2144
2158
  //#endregion
2145
2159
  //#region src/exam-session/interactions/KonvaDrawingGrid.tsx
2146
- function Un({ points: e, value: t, onChange: n }) {
2147
- return /* @__PURE__ */ s(mn, {
2160
+ function Kn({ points: e, value: t, onChange: n }) {
2161
+ return /* @__PURE__ */ s(_n, {
2148
2162
  onChange: n,
2149
2163
  points: e,
2150
2164
  value: t,
@@ -2153,7 +2167,7 @@ function Un({ points: e, value: t, onChange: n }) {
2153
2167
  }
2154
2168
  //#endregion
2155
2169
  //#region src/exam-session/interactions/LabelPlacement.tsx
2156
- function Wn({ labels: e, targets: t, value: n, onChange: r }) {
2170
+ function qn({ labels: e, targets: t, value: n, onChange: r }) {
2157
2171
  let i = n?.placements ?? {}, a = new Set(Object.keys(i));
2158
2172
  return /* @__PURE__ */ s(l, {
2159
2173
  onDragEnd: (e) => {
@@ -2176,10 +2190,10 @@ function Wn({ labels: e, targets: t, value: n, onChange: r }) {
2176
2190
  className: "label-placement",
2177
2191
  children: [/* @__PURE__ */ s("div", {
2178
2192
  className: "label-placement__bank",
2179
- children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ s(Gn, { label: e }, e.id))
2193
+ children: e.filter((e) => !a.has(e.id)).map((e) => /* @__PURE__ */ s(Jn, { label: e }, e.id))
2180
2194
  }), /* @__PURE__ */ s("div", {
2181
2195
  className: "label-placement__diagram",
2182
- children: t.map((t) => /* @__PURE__ */ s(Kn, {
2196
+ children: t.map((t) => /* @__PURE__ */ s(Yn, {
2183
2197
  label: e.find((e) => i[e.id]?.targetId === t.id),
2184
2198
  target: t
2185
2199
  }, t.id))
@@ -2187,7 +2201,7 @@ function Wn({ labels: e, targets: t, value: n, onChange: r }) {
2187
2201
  })
2188
2202
  });
2189
2203
  }
2190
- function Gn({ label: e }) {
2204
+ function Jn({ label: e }) {
2191
2205
  let { ref: t, isDragging: n } = u({ id: e.id });
2192
2206
  return /* @__PURE__ */ s("button", {
2193
2207
  className: n ? "placement-label placement-label--dragging" : "placement-label",
@@ -2196,7 +2210,7 @@ function Gn({ label: e }) {
2196
2210
  children: e.label
2197
2211
  });
2198
2212
  }
2199
- function Kn({ label: e, target: t }) {
2213
+ function Yn({ label: e, target: t }) {
2200
2214
  let { ref: n, isDropTarget: r } = d({ id: t.id });
2201
2215
  return /* @__PURE__ */ c("div", {
2202
2216
  className: r ? "placement-target placement-target--active" : "placement-target",
@@ -2208,15 +2222,15 @@ function Kn({ label: e, target: t }) {
2208
2222
  children: [/* @__PURE__ */ s("span", {
2209
2223
  "aria-hidden": "true",
2210
2224
  children: t.label
2211
- }), e ? /* @__PURE__ */ s(Gn, { label: e }) : null]
2225
+ }), e ? /* @__PURE__ */ s(Jn, { label: e }) : null]
2212
2226
  });
2213
2227
  }
2214
2228
  //#endregion
2215
2229
  //#region src/exam-session/interactions/NumberLineAnswer.tsx
2216
- function qn({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
2230
+ function Xn({ answerId: e, expression: t, value: n, onChange: r, onClear: i, recognizer: a }) {
2217
2231
  return /* @__PURE__ */ c("div", {
2218
2232
  className: "number-line-layout",
2219
- children: [/* @__PURE__ */ s(Jn, {}), /* @__PURE__ */ c("div", {
2233
+ children: [/* @__PURE__ */ s(Zn, {}), /* @__PURE__ */ c("div", {
2220
2234
  className: "compact-answer",
2221
2235
  children: [/* @__PURE__ */ s("span", { children: t }), /* @__PURE__ */ s(Y, {
2222
2236
  ariaLabel: t,
@@ -2228,7 +2242,7 @@ function qn({ answerId: e, expression: t, value: n, onChange: r, onClear: i, rec
2228
2242
  })]
2229
2243
  });
2230
2244
  }
2231
- function Jn() {
2245
+ function Zn() {
2232
2246
  return /* @__PURE__ */ c("svg", {
2233
2247
  className: "number-line",
2234
2248
  viewBox: "0 0 520 86",
@@ -2256,26 +2270,60 @@ function Jn() {
2256
2270
  }
2257
2271
  //#endregion
2258
2272
  //#region src/exam-session/interactions/OperationWorkArea.tsx
2259
- var Z = 900, Yn = 300, Xn = 510, Zn = 960, Qn = 260, $n = .15, er = 1.45, tr = 1;
2260
- function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onChange: l, onClear: u, operation: d = "+", placeholder: f = "اكتب خطوات العملية هنا", value: p }) {
2261
- let m = r === "operation-worksheet" || r === "division-worksheet" || r === "division-workspace" ? Xn : r === "reasoning-workspace" ? Zn : Yn, h = r === "reasoning-workspace", _ = i(null), [v, y] = a(() => sr(p)), b = i(v), S = i(!1), w = i(null), [T, E] = a(tr), [D, O] = a({
2262
- height: m,
2273
+ var Z = 900, Qn = 300, $n = 510, er = 620, tr = 260, nr = 700, rr = .15, ir = 1.45, ar = 1;
2274
+ function or({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onChange: l, onClear: u, operation: d = "+", placeholder: f = "اكتب خطوات العملية هنا", recognizer: p, value: m }) {
2275
+ let h = r === "operation-worksheet" || r === "division-worksheet" || r === "division-workspace" ? $n : r === "reasoning-workspace" ? er : Qn, _ = r === "reasoning-workspace", v = i(null), [y, b] = a(() => dr(m)), S = i(y), w = i(!1), T = i(null), [E, D] = a(ar), [O, ee] = a({
2276
+ height: h,
2263
2277
  scale: 1,
2264
2278
  width: Z
2265
- }), ee = v.length === 0;
2279
+ }), k = y.length === 0;
2280
+ t(() => {
2281
+ if (w.current) return;
2282
+ let e = dr(m);
2283
+ S.current = e, b(e);
2284
+ }, [m]), t(() => () => {
2285
+ T.current !== null && window.cancelAnimationFrame(T.current);
2286
+ }, []);
2287
+ let A = !!p?.isAvailable(), j = p?.getStatus?.() ?? (A ? "ready" : "unavailable");
2266
2288
  t(() => {
2267
- if (S.current) return;
2268
- let e = sr(p);
2269
- b.current = e, y(e);
2270
- }, [p]), t(() => () => {
2271
- w.current !== null && window.cancelAnimationFrame(w.current);
2272
- }, []), t(() => {
2273
- let e = _.current;
2289
+ if (k || !p || !A || j !== "ready" || m?.recognizedText !== void 0) return;
2290
+ let e = !1, t = window.setTimeout(() => {
2291
+ if (w.current) return;
2292
+ let t = fr(S.current);
2293
+ t.length !== 0 && p.recognize({
2294
+ canvasHeight: h,
2295
+ canvasWidth: Z,
2296
+ kind: "handwritten-number",
2297
+ strokes: t
2298
+ }).then((t) => {
2299
+ if (e) return;
2300
+ let n = t.recognizedValue ?? t.recognitionCandidates?.[0];
2301
+ n === void 0 || n === "" || l({
2302
+ elements: S.current,
2303
+ kind: "drawing",
2304
+ recognizedText: n
2305
+ });
2306
+ }).catch(() => void 0);
2307
+ }, nr);
2308
+ return () => {
2309
+ e = !0, window.clearTimeout(t);
2310
+ };
2311
+ }, [
2312
+ h,
2313
+ y,
2314
+ k,
2315
+ l,
2316
+ A,
2317
+ j,
2318
+ p,
2319
+ m?.recognizedText
2320
+ ]), t(() => {
2321
+ let e = v.current;
2274
2322
  if (!e) return;
2275
2323
  function t() {
2276
- let t = Math.max(Qn, Math.min(Z, e?.clientWidth ?? Z)) * (h ? T : 1), n = t / Z;
2277
- O({
2278
- height: m * n,
2324
+ let t = Math.max(tr, Math.min(Z, e?.clientWidth ?? Z)) * (_ ? E : 1), n = t / Z;
2325
+ ee({
2326
+ height: h * n,
2279
2327
  scale: n,
2280
2328
  width: t
2281
2329
  });
@@ -2284,51 +2332,51 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2284
2332
  let n = new ResizeObserver(t);
2285
2333
  return n.observe(e), () => n.disconnect();
2286
2334
  }, [
2287
- m,
2288
2335
  h,
2289
- T
2336
+ _,
2337
+ E
2290
2338
  ]);
2291
- function k(e) {
2339
+ function M(e) {
2292
2340
  l({
2293
2341
  elements: e,
2294
2342
  kind: "drawing"
2295
2343
  });
2296
2344
  }
2297
- function A(e) {
2298
- b.current = e, w.current === null && (w.current = window.requestAnimationFrame(() => {
2299
- w.current = null, y(b.current);
2345
+ function N(e) {
2346
+ S.current = e, T.current === null && (T.current = window.requestAnimationFrame(() => {
2347
+ T.current = null, b(S.current);
2300
2348
  }));
2301
2349
  }
2302
- function j(e = b.current) {
2303
- w.current !== null && (window.cancelAnimationFrame(w.current), w.current = null), b.current = e, y(e);
2350
+ function P(e = S.current) {
2351
+ T.current !== null && (window.cancelAnimationFrame(T.current), T.current = null), S.current = e, b(e);
2304
2352
  }
2305
- function M(e) {
2353
+ function te(e) {
2306
2354
  let t = e?.getPointerPosition();
2307
2355
  return t ? {
2308
- x: t.x / D.scale,
2309
- y: t.y / D.scale
2356
+ x: t.x / O.scale,
2357
+ y: t.y / O.scale
2310
2358
  } : null;
2311
2359
  }
2312
- function N(e) {
2360
+ function I(e) {
2313
2361
  e.evt.preventDefault();
2314
- let t = M(e.target.getStage());
2362
+ let t = te(e.target.getStage());
2315
2363
  if (!t) return;
2316
- let n = [...b.current, {
2364
+ let n = [...S.current, {
2317
2365
  color: "#061013",
2318
2366
  id: `operation-stroke-${Date.now()}-${Math.round(t.x)}-${Math.round(t.y)}`,
2319
2367
  points: [t.x, t.y],
2320
2368
  strokeWidth: 8,
2321
2369
  type: "freehand"
2322
2370
  }];
2323
- S.current = !0, j(n), k(n);
2371
+ w.current = !0, P(n), M(n);
2324
2372
  }
2325
- function P(e) {
2326
- if (!S.current || !b.current.length || !e.evt.buttons && e.evt.pointerType === "mouse") return;
2373
+ function ne(e) {
2374
+ if (!w.current || !S.current.length || !e.evt.buttons && e.evt.pointerType === "mouse") return;
2327
2375
  e.evt.preventDefault();
2328
- let t = M(e.target.getStage());
2376
+ let t = te(e.target.getStage());
2329
2377
  if (!t) return;
2330
- let n = b.current, r = n[n.length - 1], i = r.points[r.points.length - 2], a = r.points[r.points.length - 1];
2331
- Math.hypot(t.x - i, t.y - a) < .75 || A(n.map((e, r) => r === n.length - 1 ? {
2378
+ let n = S.current, r = n[n.length - 1], i = r.points[r.points.length - 2], a = r.points[r.points.length - 1];
2379
+ Math.hypot(t.x - i, t.y - a) < .75 || N(n.map((e, r) => r === n.length - 1 ? {
2332
2380
  ...e,
2333
2381
  points: [
2334
2382
  ...e.points,
@@ -2337,60 +2385,60 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2337
2385
  ]
2338
2386
  } : e));
2339
2387
  }
2340
- function te(e) {
2341
- e.evt.preventDefault(), S.current && (S.current = !1, j(), k(b.current));
2388
+ function L(e) {
2389
+ e.evt.preventDefault(), w.current && (w.current = !1, P(), M(S.current));
2342
2390
  }
2343
- function I() {
2344
- S.current = !1, j([]), k([]), u?.();
2391
+ function R() {
2392
+ w.current = !1, P([]), M([]), u?.();
2345
2393
  }
2346
- function ne() {
2347
- if (!b.current.length) return;
2348
- S.current = !1;
2349
- let e = b.current.slice(0, -1);
2350
- j(e), k(e);
2394
+ function z() {
2395
+ if (!S.current.length) return;
2396
+ w.current = !1;
2397
+ let e = S.current.slice(0, -1);
2398
+ P(e), M(e);
2351
2399
  }
2352
- let L = v.length > 0, R = T < er, z = T > tr;
2400
+ let B = y.length > 0, re = E < ir, ae = E > ar;
2353
2401
  return /* @__PURE__ */ c("div", {
2354
2402
  "aria-label": e,
2355
2403
  className: ["operation-work-area", r === "operation-worksheet" ? "operation-work-area--operation-worksheet" : r === "reasoning-workspace" ? "operation-work-area--reasoning-workspace" : r === "division-worksheet" || r === "division-workspace" ? "operation-work-area--division-worksheet" : ""].filter(Boolean).join(" "),
2356
- ref: _,
2404
+ ref: v,
2357
2405
  children: [/* @__PURE__ */ s(oe, {
2358
2406
  className: ["operation-work-area__stage", r === "operation-worksheet" ? "operation-work-area__stage--operation-worksheet" : r === "reasoning-workspace" ? "operation-work-area__stage--reasoning-workspace" : r === "division-worksheet" || r === "division-workspace" ? "operation-work-area__stage--division-worksheet" : ""].filter(Boolean).join(" "),
2359
- height: D.height,
2360
- onPointerCancel: te,
2361
- onPointerDown: N,
2362
- onPointerMove: P,
2363
- onPointerUp: te,
2407
+ height: O.height,
2408
+ onPointerCancel: L,
2409
+ onPointerDown: I,
2410
+ onPointerMove: ne,
2411
+ onPointerUp: L,
2364
2412
  role: "img",
2365
- width: D.width,
2413
+ width: O.width,
2366
2414
  children: /* @__PURE__ */ c(ie, {
2367
- scaleX: D.scale,
2368
- scaleY: D.scale,
2415
+ scaleX: O.scale,
2416
+ scaleY: O.scale,
2369
2417
  children: [
2370
2418
  /* @__PURE__ */ s(H, {
2371
2419
  cornerRadius: 22,
2372
2420
  fill: "#fff",
2373
- height: m,
2421
+ height: h,
2374
2422
  stroke: "#cfe3d9",
2375
2423
  strokeWidth: 2,
2376
2424
  width: Z,
2377
2425
  x: 0,
2378
2426
  y: 0
2379
2427
  }),
2380
- r === "division-worksheet" ? /* @__PURE__ */ s(ar, {
2428
+ r === "division-worksheet" ? /* @__PURE__ */ s(lr, {
2381
2429
  dividend: n?.dividend,
2382
2430
  divisor: n?.divisor,
2383
- height: m,
2431
+ height: h,
2384
2432
  width: Z
2385
- }) : r === "division-workspace" ? /* @__PURE__ */ s(or, {
2386
- height: m,
2433
+ }) : r === "division-workspace" ? /* @__PURE__ */ s(ur, {
2434
+ height: h,
2387
2435
  width: Z
2388
- }) : r === "operation-worksheet" ? /* @__PURE__ */ s(rr, {
2389
- height: m,
2436
+ }) : r === "operation-worksheet" ? /* @__PURE__ */ s(sr, {
2437
+ height: h,
2390
2438
  operation: d,
2391
2439
  width: Z
2392
- }) : r === "reasoning-workspace" ? /* @__PURE__ */ s(ir, {
2393
- height: m,
2440
+ }) : r === "reasoning-workspace" ? /* @__PURE__ */ s(cr, {
2441
+ height: h,
2394
2442
  width: Z
2395
2443
  }) : r === "squared" ? /* @__PURE__ */ c(o, { children: [Array.from({ length: 13 }, (e, t) => /* @__PURE__ */ s(V, {
2396
2444
  points: [
@@ -2406,7 +2454,7 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2406
2454
  t * 75,
2407
2455
  0,
2408
2456
  t * 75,
2409
- Yn
2457
+ Qn
2410
2458
  ],
2411
2459
  stroke: "#4e68ff",
2412
2460
  strokeWidth: 1.5
@@ -2421,20 +2469,20 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2421
2469
  stroke: "#edf3ef",
2422
2470
  strokeWidth: 2
2423
2471
  }, `line-${t}`)),
2424
- ee && f ? /* @__PURE__ */ s(U, {
2472
+ k && f ? /* @__PURE__ */ s(U, {
2425
2473
  align: "center",
2426
2474
  fill: "#8fa39a",
2427
2475
  fontFamily: "Arial, sans-serif",
2428
2476
  fontSize: 24,
2429
2477
  fontStyle: "bold",
2430
- height: m,
2478
+ height: h,
2431
2479
  text: f,
2432
2480
  verticalAlign: "middle",
2433
2481
  width: Z,
2434
2482
  x: 0,
2435
2483
  y: 0
2436
2484
  }) : null,
2437
- v.map((e) => /* @__PURE__ */ s(V, {
2485
+ y.map((e) => /* @__PURE__ */ s(V, {
2438
2486
  globalCompositeOperation: "source-over",
2439
2487
  lineCap: "round",
2440
2488
  lineJoin: "round",
@@ -2453,18 +2501,18 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2453
2501
  /* @__PURE__ */ s("button", {
2454
2502
  "aria-label": "Annuler le dernier trait",
2455
2503
  className: "operation-work-area__control",
2456
- disabled: !L,
2457
- onClick: ne,
2504
+ disabled: !B,
2505
+ onClick: z,
2458
2506
  title: "Annuler le dernier trait",
2459
2507
  type: "button",
2460
2508
  children: /* @__PURE__ */ s(F, { "aria-hidden": "true" })
2461
2509
  }),
2462
- h ? /* @__PURE__ */ c(o, { children: [
2510
+ _ ? /* @__PURE__ */ c(o, { children: [
2463
2511
  /* @__PURE__ */ s("button", {
2464
2512
  "aria-label": "Reduire l espace de raisonnement",
2465
2513
  className: "operation-work-area__control",
2466
- disabled: !z,
2467
- onClick: () => E((e) => Math.max(tr, e - $n)),
2514
+ disabled: !ae,
2515
+ onClick: () => D((e) => Math.max(ar, e - rr)),
2468
2516
  title: "Reduire l espace",
2469
2517
  type: "button",
2470
2518
  children: /* @__PURE__ */ s(C, { "aria-hidden": "true" })
@@ -2472,13 +2520,13 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2472
2520
  /* @__PURE__ */ c("output", {
2473
2521
  className: "operation-work-area__zoom",
2474
2522
  "aria-label": "Taille de l espace",
2475
- children: [Math.round(T * 100), "%"]
2523
+ children: [Math.round(E * 100), "%"]
2476
2524
  }),
2477
2525
  /* @__PURE__ */ s("button", {
2478
2526
  "aria-label": "Agrandir l espace de raisonnement",
2479
2527
  className: "operation-work-area__control",
2480
- disabled: !R,
2481
- onClick: () => E((e) => Math.min(er, e + $n)),
2528
+ disabled: !re,
2529
+ onClick: () => D((e) => Math.min(ir, e + rr)),
2482
2530
  title: "Agrandir l espace",
2483
2531
  type: "button",
2484
2532
  children: /* @__PURE__ */ s(x, { "aria-hidden": "true" })
@@ -2487,8 +2535,8 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2487
2535
  /* @__PURE__ */ s("button", {
2488
2536
  "aria-label": "Effacer l espace de travail",
2489
2537
  className: "operation-work-area__clear",
2490
- disabled: ee,
2491
- onClick: I,
2538
+ disabled: k,
2539
+ onClick: R,
2492
2540
  title: "Effacer l espace",
2493
2541
  type: "button",
2494
2542
  children: /* @__PURE__ */ s(g, { "aria-hidden": "true" })
@@ -2497,7 +2545,7 @@ function nr({ ariaLabel: e, divisionOperands: n, gridVariant: r = "ruled", onCha
2497
2545
  })]
2498
2546
  });
2499
2547
  }
2500
- function rr({ height: e, operation: t, width: n }) {
2548
+ function sr({ height: e, operation: t, width: n }) {
2501
2549
  let r = n - 166 - 94;
2502
2550
  return /* @__PURE__ */ c(o, { children: [
2503
2551
  Array.from({ length: Math.floor(e / 24) + 1 }, (e, t) => /* @__PURE__ */ s(V, {
@@ -2576,7 +2624,7 @@ function rr({ height: e, operation: t, width: n }) {
2576
2624
  })
2577
2625
  ] });
2578
2626
  }
2579
- function ir({ height: e, width: t }) {
2627
+ function cr({ height: e, width: t }) {
2580
2628
  return /* @__PURE__ */ c(o, { children: [Array.from({ length: Math.floor(e / 42) + 1 }, (e, n) => /* @__PURE__ */ s(V, {
2581
2629
  points: [
2582
2630
  28,
@@ -2597,10 +2645,10 @@ function ir({ height: e, width: t }) {
2597
2645
  strokeWidth: 2
2598
2646
  })] });
2599
2647
  }
2600
- function ar({ dividend: e, divisor: t, height: n, width: r }) {
2648
+ function lr({ dividend: e, divisor: t, height: n, width: r }) {
2601
2649
  let i = r - 588 - 70;
2602
2650
  return /* @__PURE__ */ c(o, { children: [
2603
- /* @__PURE__ */ s(or, {
2651
+ /* @__PURE__ */ s(ur, {
2604
2652
  height: n,
2605
2653
  width: r
2606
2654
  }),
@@ -2685,7 +2733,7 @@ function ar({ dividend: e, divisor: t, height: n, width: r }) {
2685
2733
  })
2686
2734
  ] });
2687
2735
  }
2688
- function or({ height: e, width: t }) {
2736
+ function ur({ height: e, width: t }) {
2689
2737
  return /* @__PURE__ */ c(o, { children: [Array.from({ length: Math.floor(e / 24) + 1 }, (e, n) => /* @__PURE__ */ s(V, {
2690
2738
  points: [
2691
2739
  0,
@@ -2706,13 +2754,19 @@ function or({ height: e, width: t }) {
2706
2754
  strokeWidth: 1.5
2707
2755
  }, `division-x-${n}`))] });
2708
2756
  }
2709
- function sr(e) {
2757
+ function dr(e) {
2710
2758
  return e?.elements?.filter((e) => e.type === "freehand") ?? [];
2711
2759
  }
2760
+ function fr(e) {
2761
+ return e.filter((e) => e.points.length >= 2).map((e) => ({
2762
+ id: e.id,
2763
+ points: e.points
2764
+ }));
2765
+ }
2712
2766
  //#endregion
2713
2767
  //#region src/exam-session/interactions/PrimeFactorizationAnswer.tsx
2714
- var cr = 104;
2715
- function lr({ onChange: e, recognizer: t, targets: n, value: r }) {
2768
+ var pr = 104;
2769
+ function mr({ onChange: e, recognizer: t, targets: n, value: r }) {
2716
2770
  function i(t, n) {
2717
2771
  e({
2718
2772
  factorsByTargetId: {
@@ -2726,7 +2780,7 @@ function lr({ onChange: e, recognizer: t, targets: n, value: r }) {
2726
2780
  className: "prime-factorization",
2727
2781
  dir: "ltr",
2728
2782
  children: n.map((e) => {
2729
- let n = ur(r?.factorsByTargetId[e.id], e.value);
2783
+ let n = hr(r?.factorsByTargetId[e.id], e.value);
2730
2784
  return /* @__PURE__ */ s("section", {
2731
2785
  className: "prime-factorization__target",
2732
2786
  children: /* @__PURE__ */ c("div", {
@@ -2740,7 +2794,7 @@ function lr({ onChange: e, recognizer: t, targets: n, value: r }) {
2740
2794
  children: "×"
2741
2795
  }) : null, /* @__PURE__ */ s(Y, {
2742
2796
  ariaLabel: `عامل أولي للعدد ${e.value || "المطلوب"}`,
2743
- canvasWidth: cr,
2797
+ canvasWidth: pr,
2744
2798
  onChange: (t) => {
2745
2799
  let r = [...n];
2746
2800
  r[a] = t, i(e.id, r);
@@ -2755,22 +2809,22 @@ function lr({ onChange: e, recognizer: t, targets: n, value: r }) {
2755
2809
  })
2756
2810
  });
2757
2811
  }
2758
- function ur(e, t) {
2759
- let n = Ke(t), r = [...e ?? []].slice(0, n);
2760
- for (; r.length < n;) r.push(dr());
2812
+ function hr(e, t) {
2813
+ let n = Ye(t), r = [...e ?? []].slice(0, n);
2814
+ for (; r.length < n;) r.push(gr());
2761
2815
  return r;
2762
2816
  }
2763
- function dr() {
2817
+ function gr() {
2764
2818
  return {
2765
2819
  canvasHeight: 88,
2766
- canvasWidth: cr,
2820
+ canvasWidth: pr,
2767
2821
  kind: "handwritten-number",
2768
2822
  strokes: []
2769
2823
  };
2770
2824
  }
2771
2825
  //#endregion
2772
2826
  //#region src/exam-session/interactions/ProblemSheetShape.tsx
2773
- var fr = [
2827
+ var _r = [
2774
2828
  {
2775
2829
  id: "basic",
2776
2830
  label: "Formes",
@@ -2812,7 +2866,7 @@ var fr = [
2812
2866
  "arc"
2813
2867
  ]
2814
2868
  }
2815
- ], pr = {
2869
+ ], vr = {
2816
2870
  arc: "Arc",
2817
2871
  "arrow-down": "Flèche vers le bas",
2818
2872
  "arrow-left": "Flèche vers la gauche",
@@ -2837,13 +2891,13 @@ var fr = [
2837
2891
  triangle: "Triangle",
2838
2892
  wedge: "Secteur"
2839
2893
  };
2840
- function mr(e) {
2841
- return pr[e];
2894
+ function yr(e) {
2895
+ return vr[e];
2842
2896
  }
2843
- function hr(e) {
2897
+ function br(e) {
2844
2898
  return e === "circle";
2845
2899
  }
2846
- function gr({ element: e, hitStrokeWidth: t }) {
2900
+ function xr({ element: e, hitStrokeWidth: t }) {
2847
2901
  let n = e.fill ?? "#e8f1ff", r = e.stroke ?? "#0f172a", i = e.strokeWidth ?? 3, a = Math.max(1, e.width), l = Math.max(1, e.height), u = Math.min(a, l) / 2, d = {
2848
2902
  fill: n,
2849
2903
  stroke: r,
@@ -2900,7 +2954,7 @@ function gr({ element: e, hitStrokeWidth: t }) {
2900
2954
  scaleY: l / 2,
2901
2955
  x: a / 2,
2902
2956
  y: l / 2
2903
- }) : e.shape === "diamond" ? /* @__PURE__ */ s(_r, {
2957
+ }) : e.shape === "diamond" ? /* @__PURE__ */ s(Sr, {
2904
2958
  ...d,
2905
2959
  points: [
2906
2960
  a / 2,
@@ -2912,7 +2966,7 @@ function gr({ element: e, hitStrokeWidth: t }) {
2912
2966
  0,
2913
2967
  l / 2
2914
2968
  ]
2915
- }) : e.shape === "parallelogram" ? /* @__PURE__ */ s(_r, {
2969
+ }) : e.shape === "parallelogram" ? /* @__PURE__ */ s(Sr, {
2916
2970
  ...d,
2917
2971
  points: [
2918
2972
  a * .22,
@@ -2924,7 +2978,7 @@ function gr({ element: e, hitStrokeWidth: t }) {
2924
2978
  0,
2925
2979
  l
2926
2980
  ]
2927
- }) : e.shape === "trapezoid" ? /* @__PURE__ */ s(_r, {
2981
+ }) : e.shape === "trapezoid" ? /* @__PURE__ */ s(Sr, {
2928
2982
  ...d,
2929
2983
  points: [
2930
2984
  a * .18,
@@ -2936,10 +2990,10 @@ function gr({ element: e, hitStrokeWidth: t }) {
2936
2990
  0,
2937
2991
  l
2938
2992
  ]
2939
- }) : e.shape === "arrow-right" || e.shape === "arrow-left" || e.shape === "arrow-up" || e.shape === "arrow-down" ? /* @__PURE__ */ s(_r, {
2993
+ }) : e.shape === "arrow-right" || e.shape === "arrow-left" || e.shape === "arrow-up" || e.shape === "arrow-down" ? /* @__PURE__ */ s(Sr, {
2940
2994
  ...d,
2941
- points: vr(e.shape, a, l)
2942
- }) : e.shape === "chevron" ? /* @__PURE__ */ s(_r, {
2995
+ points: Cr(e.shape, a, l)
2996
+ }) : e.shape === "chevron" ? /* @__PURE__ */ s(Sr, {
2943
2997
  ...d,
2944
2998
  points: [
2945
2999
  0,
@@ -3018,7 +3072,7 @@ function gr({ element: e, hitStrokeWidth: t }) {
3018
3072
  cornerRadius: Math.min(22, u / 2),
3019
3073
  height: l * .76,
3020
3074
  width: a
3021
- }), /* @__PURE__ */ s(_r, {
3075
+ }), /* @__PURE__ */ s(Sr, {
3022
3076
  ...d,
3023
3077
  points: [
3024
3078
  a * .2,
@@ -3045,7 +3099,7 @@ function gr({ element: e, hitStrokeWidth: t }) {
3045
3099
  y: l / 2
3046
3100
  });
3047
3101
  }
3048
- function _r({ points: e, ...t }) {
3102
+ function Sr({ points: e, ...t }) {
3049
3103
  return /* @__PURE__ */ s(V, {
3050
3104
  ...t,
3051
3105
  closed: !0,
@@ -3053,7 +3107,7 @@ function _r({ points: e, ...t }) {
3053
3107
  points: e
3054
3108
  });
3055
3109
  }
3056
- function vr(e, t, n) {
3110
+ function Cr(e, t, n) {
3057
3111
  return {
3058
3112
  "arrow-right": [
3059
3113
  0,
@@ -3123,8 +3177,8 @@ function vr(e, t, n) {
3123
3177
  }
3124
3178
  //#endregion
3125
3179
  //#region src/exam-session/interactions/problemSheetCanvas.tsx
3126
- var Q = 1e3, yr = 40;
3127
- function br(e) {
3180
+ var Q = 1e3, wr = 40;
3181
+ function Tr(e) {
3128
3182
  switch (e) {
3129
3183
  case "blue": return "#eef7ff";
3130
3184
  case "green": return "#f0fbf5";
@@ -3132,10 +3186,10 @@ function br(e) {
3132
3186
  default: return "#ffffff";
3133
3187
  }
3134
3188
  }
3135
- function xr({ height: e, paper: t }) {
3189
+ function Er({ height: e, paper: t }) {
3136
3190
  if (t === "blank") return null;
3137
3191
  let n = [];
3138
- for (let r = 0; r <= e; r += yr) n.push(/* @__PURE__ */ s(V, {
3192
+ for (let r = 0; r <= e; r += wr) n.push(/* @__PURE__ */ s(V, {
3139
3193
  points: [
3140
3194
  0,
3141
3195
  r,
@@ -3145,7 +3199,7 @@ function xr({ height: e, paper: t }) {
3145
3199
  stroke: t === "ruled" ? "#9fc0e9" : "#bad5f0",
3146
3200
  strokeWidth: t === "ruled" ? 1.4 : 1
3147
3201
  }, `h-${r}`));
3148
- if (t === "squared") for (let t = 0; t <= Q; t += yr) n.push(/* @__PURE__ */ s(V, {
3202
+ if (t === "squared") for (let t = 0; t <= Q; t += wr) n.push(/* @__PURE__ */ s(V, {
3149
3203
  points: [
3150
3204
  t,
3151
3205
  0,
@@ -3157,8 +3211,8 @@ function xr({ height: e, paper: t }) {
3157
3211
  }, `v-${t}`));
3158
3212
  return /* @__PURE__ */ s(o, { children: n });
3159
3213
  }
3160
- function Sr({ element: e }) {
3161
- return e.type === "image" ? /* @__PURE__ */ s(Cr, { element: e }) : e.type === "drawing" ? /* @__PURE__ */ s(V, {
3214
+ function Dr({ element: e }) {
3215
+ return e.type === "image" ? /* @__PURE__ */ s(Or, { element: e }) : e.type === "drawing" ? /* @__PURE__ */ s(V, {
3162
3216
  lineCap: "round",
3163
3217
  lineJoin: "round",
3164
3218
  points: e.points,
@@ -3179,13 +3233,13 @@ function Sr({ element: e }) {
3179
3233
  rotation: e.rotation ?? 0,
3180
3234
  x: e.x,
3181
3235
  y: e.y,
3182
- children: /* @__PURE__ */ s(gr, { element: e })
3236
+ children: /* @__PURE__ */ s(xr, { element: e })
3183
3237
  });
3184
3238
  }
3185
- function Cr({ element: e }) {
3186
- let t = wr(e.source);
3239
+ function Or({ element: e }) {
3240
+ let t = kr(e.source);
3187
3241
  return t ? /* @__PURE__ */ s(re, {
3188
- crop: Tr(t, e.crop),
3242
+ crop: Ar(t, e.crop),
3189
3243
  height: e.height,
3190
3244
  image: t,
3191
3245
  rotation: e.rotation ?? 0,
@@ -3194,7 +3248,7 @@ function Cr({ element: e }) {
3194
3248
  y: e.y
3195
3249
  }) : null;
3196
3250
  }
3197
- function wr(e) {
3251
+ function kr(e) {
3198
3252
  let [n, r] = a(null);
3199
3253
  return t(() => {
3200
3254
  let t = !0, n = new Image();
@@ -3207,7 +3261,7 @@ function wr(e) {
3207
3261
  };
3208
3262
  }, [e]), n;
3209
3263
  }
3210
- function Tr(e, t) {
3264
+ function Ar(e, t) {
3211
3265
  if (t) return {
3212
3266
  height: Math.max(1, e.naturalHeight * t.height),
3213
3267
  width: Math.max(1, e.naturalWidth * t.width),
@@ -3215,7 +3269,7 @@ function Tr(e, t) {
3215
3269
  y: e.naturalHeight * t.y
3216
3270
  };
3217
3271
  }
3218
- function Er({ element: e }) {
3272
+ function jr({ element: e }) {
3219
3273
  return e.type === "freehand" ? /* @__PURE__ */ s(V, {
3220
3274
  lineCap: "round",
3221
3275
  lineJoin: "round",
@@ -3244,7 +3298,7 @@ function Er({ element: e }) {
3244
3298
  y: e.center.y
3245
3299
  });
3246
3300
  }
3247
- function Dr(e) {
3301
+ function Mr(e) {
3248
3302
  return e?.elements?.length ? e.elements : (e?.strokes ?? []).map((e) => ({
3249
3303
  color: "#111827",
3250
3304
  id: e.id,
@@ -3255,9 +3309,9 @@ function Dr(e) {
3255
3309
  }
3256
3310
  //#endregion
3257
3311
  //#region src/exam-session/interactions/ProblemSheet.tsx
3258
- var Or = 460;
3259
- function kr({ className: e, config: t, height: r }) {
3260
- let o = i(null), [l, u] = a(Q), d = Ar(r ?? t?.height);
3312
+ var Nr = 460;
3313
+ function Pr({ className: e, config: t, height: r }) {
3314
+ let o = i(null), [l, u] = a(Q), d = Fr(r ?? t?.height);
3261
3315
  if (n(() => {
3262
3316
  let e = o.current;
3263
3317
  if (!e) return;
@@ -3266,7 +3320,7 @@ function kr({ className: e, config: t, height: r }) {
3266
3320
  let n = new ResizeObserver(t);
3267
3321
  return n.observe(e), () => n.disconnect();
3268
3322
  }, []), !t?.enabled) return null;
3269
- let f = Math.min(Q, l), p = f / Q, m = Dr(t.content), h = ["problem-sheet", e].filter(Boolean).join(" "), g = t.title?.trim();
3323
+ let f = Math.min(Q, l), p = f / Q, m = Mr(t.content), h = ["problem-sheet", e].filter(Boolean).join(" "), g = t.title?.trim();
3270
3324
  return /* @__PURE__ */ c("section", {
3271
3325
  className: h,
3272
3326
  dir: "rtl",
@@ -3285,28 +3339,28 @@ function kr({ className: e, config: t, height: r }) {
3285
3339
  scaleY: p,
3286
3340
  children: [
3287
3341
  /* @__PURE__ */ s(H, {
3288
- fill: br(t.background),
3342
+ fill: Tr(t.background),
3289
3343
  height: d,
3290
3344
  width: Q
3291
3345
  }),
3292
- /* @__PURE__ */ s(xr, {
3346
+ /* @__PURE__ */ s(Er, {
3293
3347
  height: d,
3294
3348
  paper: t.paper ?? "squared"
3295
3349
  }),
3296
- t.elements?.map((e) => /* @__PURE__ */ s(Sr, { element: e }, e.id)),
3297
- m.map((e) => /* @__PURE__ */ s(Er, { element: e }, e.id))
3350
+ t.elements?.map((e) => /* @__PURE__ */ s(Dr, { element: e }, e.id)),
3351
+ m.map((e) => /* @__PURE__ */ s(jr, { element: e }, e.id))
3298
3352
  ]
3299
3353
  })
3300
3354
  })
3301
3355
  })]
3302
3356
  });
3303
3357
  }
3304
- function Ar(e) {
3305
- return Number.isFinite(e) ? Math.min(900, Math.max(220, Math.round(e ?? Or))) : Or;
3358
+ function Fr(e) {
3359
+ return Number.isFinite(e) ? Math.min(900, Math.max(220, Math.round(e ?? Nr))) : Nr;
3306
3360
  }
3307
3361
  //#endregion
3308
3362
  //#region src/voice/evaluateVoiceAiResult.ts
3309
- var jr = {
3363
+ var Ir = {
3310
3364
  audioConfig: {
3311
3365
  bitDepth: 16,
3312
3366
  channels: 1,
@@ -3316,18 +3370,18 @@ var jr = {
3316
3370
  lang: "fr",
3317
3371
  useModelAi: !0
3318
3372
  };
3319
- function Mr(e, t, n) {
3320
- let r = Ir([t, ...n.acceptedPronunciations ?? []]), i = r.map(Nr), a = Nr(e.transcript), o = i.map((e, t) => ({
3373
+ function Lr(e, t, n) {
3374
+ let r = Vr([t, ...n.acceptedPronunciations ?? []]), i = r.map(Rr), a = Rr(e.transcript), o = i.map((e, t) => ({
3321
3375
  index: t,
3322
- similarity: Fr(a, e)
3376
+ similarity: Br(a, e)
3323
3377
  })).reduce((e, t) => t.similarity > e.similarity ? t : e, {
3324
3378
  index: -1,
3325
3379
  similarity: 0
3326
- }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = Lr(n.minimumSimilarity ?? Pr(s), 0, 1), u = e.language === n.expectedLanguage, d = a.length > 0, f = d && u && o.similarity >= l, p = d ? u ? f ? "correct" : "incorrect" : "language-mismatch" : "no-speech";
3380
+ }), s = o.index >= 0 ? r[o.index] : null, c = o.similarity === 1, l = Hr(n.minimumSimilarity ?? zr(s), 0, 1), u = e.language === n.expectedLanguage, d = a.length > 0, f = d && u && o.similarity >= l, p = d ? u ? f ? "correct" : "incorrect" : "language-mismatch" : "no-speech";
3327
3381
  return {
3328
3382
  acceptedPronunciations: r,
3329
3383
  confidence: e.confidence,
3330
- confidencePercent: Math.round(Lr(e.confidence, 0, 1) * 100),
3384
+ confidencePercent: Math.round(Hr(e.confidence, 0, 1) * 100),
3331
3385
  detectedPronunciation: e.transcript,
3332
3386
  expectedLanguage: n.expectedLanguage,
3333
3387
  expectedText: t,
@@ -3346,13 +3400,13 @@ function Mr(e, t, n) {
3346
3400
  timestamps: e.timestamps ?? []
3347
3401
  };
3348
3402
  }
3349
- function Nr(e) {
3403
+ function Rr(e) {
3350
3404
  return e.toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\u064b-\u065f\u0670]/g, "").replace(/[|]+/g, " ").replace(/[^\p{Letter}\p{Number}\s]/gu, " ").replace(/\s+/g, " ").trim();
3351
3405
  }
3352
- function Pr(e) {
3353
- return (e ? Nr(e).length : 0) <= 4 ? 1 : .85;
3406
+ function zr(e) {
3407
+ return (e ? Rr(e).length : 0) <= 4 ? 1 : .85;
3354
3408
  }
3355
- function Fr(e, t) {
3409
+ function Br(e, t) {
3356
3410
  let n = Array.from(e), r = Array.from(t), i = Math.max(n.length, r.length);
3357
3411
  if (i === 0) return 0;
3358
3412
  let a = Array.from({ length: r.length + 1 }, (e, t) => t);
@@ -3364,22 +3418,22 @@ function Fr(e, t) {
3364
3418
  }
3365
3419
  a.splice(0, a.length, ...t);
3366
3420
  }
3367
- return Lr(1 - a[r.length] / i, 0, 1);
3421
+ return Hr(1 - a[r.length] / i, 0, 1);
3368
3422
  }
3369
- function Ir(e) {
3423
+ function Vr(e) {
3370
3424
  let t = /* @__PURE__ */ new Set();
3371
3425
  return e.filter((e) => {
3372
- let n = Nr(e);
3426
+ let n = Rr(e);
3373
3427
  return !n || t.has(n) ? !1 : (t.add(n), !0);
3374
3428
  });
3375
3429
  }
3376
- function Lr(e, t, n) {
3430
+ function Hr(e, t, n) {
3377
3431
  return Math.min(n, Math.max(t, e));
3378
3432
  }
3379
3433
  //#endregion
3380
3434
  //#region src/exam-session/interactions/PronunciationRecorder.tsx
3381
- function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
3382
- let [_, v] = a("idle"), [y, b] = a(null), [x, C] = a(0), w = i(null), T = i(!1), E = r(() => g ? Mr(g.result.modelAiResult, n, {
3435
+ function Ur({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc: l, instruction: u, language: d, minimumSimilarity: f, onChange: p, onReset: m, recorder: h, value: g }) {
3436
+ let [_, v] = a("idle"), [y, b] = a(null), [x, C] = a(0), w = i(null), T = i(!1), E = r(() => g ? Lr(g.result.modelAiResult, n, {
3383
3437
  acceptedPronunciations: e,
3384
3438
  expectedLanguage: d,
3385
3439
  minimumSimilarity: f
@@ -3406,14 +3460,14 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3406
3460
  try {
3407
3461
  if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
3408
3462
  let e = {
3409
- ...jr,
3463
+ ...Ir,
3410
3464
  lang: d,
3411
3465
  maxDuration: 10
3412
3466
  };
3413
3467
  if (!(await h.startRecording(e)).started) throw Error("تعذّر بدء التسجيل الصوتي.");
3414
3468
  T.current = !0, w.current = Date.now(), C(0), v("recording");
3415
3469
  } catch (e) {
3416
- T.current = !1, w.current = null, b(Ur(e)), v("error");
3470
+ T.current = !1, w.current = null, b(Jr(e)), v("error");
3417
3471
  }
3418
3472
  }
3419
3473
  }
@@ -3422,7 +3476,7 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3422
3476
  v("processing"), b(null);
3423
3477
  try {
3424
3478
  if (!h) throw Error("مُسجِّل الصَّوت غَير مُتاحٍ فِي هذا التَّطبِيق.");
3425
- let t = await h.stopRecording(), r = Mr(t.modelAiResult, n, {
3479
+ let t = await h.stopRecording(), r = Lr(t.modelAiResult, n, {
3426
3480
  acceptedPronunciations: e,
3427
3481
  expectedLanguage: d,
3428
3482
  minimumSimilarity: f
@@ -3433,7 +3487,7 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3433
3487
  result: t
3434
3488
  }), v("idle");
3435
3489
  } catch (e) {
3436
- T.current = !1, w.current = null, b(Ur(e)), v("error");
3490
+ T.current = !1, w.current = null, b(Jr(e)), v("error");
3437
3491
  }
3438
3492
  }
3439
3493
  }
@@ -3458,7 +3512,7 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3458
3512
  children: [
3459
3513
  /* @__PURE__ */ c("span", { children: [
3460
3514
  "اُنْطِقِ الكَلِمَةَ بِـ",
3461
- Hr(d),
3515
+ qr(d),
3462
3516
  ":"
3463
3517
  ] }),
3464
3518
  /* @__PURE__ */ s("strong", {
@@ -3476,7 +3530,7 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3476
3530
  className: "audio-debug-card__icon",
3477
3531
  "aria-hidden": "true",
3478
3532
  children: /* @__PURE__ */ s(S, {})
3479
- }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("strong", { children: Wr(_, !!g) }), /* @__PURE__ */ s("span", { children: Vr(M) })] })]
3533
+ }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("strong", { children: Yr(_, !!g) }), /* @__PURE__ */ s("span", { children: Kr(M) })] })]
3480
3534
  }),
3481
3535
  /* @__PURE__ */ c("div", {
3482
3536
  className: "audio-debug-actions",
@@ -3516,31 +3570,31 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3516
3570
  role: "status",
3517
3571
  children: [/* @__PURE__ */ c("div", {
3518
3572
  className: "audio-pronunciation-feedback__headline",
3519
- children: [/* @__PURE__ */ s(zr, { status: E.status }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("strong", { children: Gr(E.status) }), /* @__PURE__ */ s("span", { children: Kr(E.status, n) })] })]
3573
+ children: [/* @__PURE__ */ s(Wr, { status: E.status }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("strong", { children: Xr(E.status) }), /* @__PURE__ */ s("span", { children: Zr(E.status, n) })] })]
3520
3574
  }), /* @__PURE__ */ c("div", {
3521
3575
  className: "audio-debug-metadata",
3522
3576
  children: [
3523
- /* @__PURE__ */ s(Br, {
3577
+ /* @__PURE__ */ s(Gr, {
3524
3578
  label: "ما تَعَرَّفَ عَلَيْهِ النَّمُوذَجُ",
3525
3579
  value: E.detectedPronunciation || "—"
3526
3580
  }),
3527
- /* @__PURE__ */ s(Br, {
3581
+ /* @__PURE__ */ s(Gr, {
3528
3582
  label: "نِسْبَةُ التَّطابُقِ",
3529
3583
  value: `${E.similarityPercent}%`
3530
3584
  }),
3531
- /* @__PURE__ */ s(Br, {
3585
+ /* @__PURE__ */ s(Gr, {
3532
3586
  label: "ثِقَةُ النَّمُوذَجِ",
3533
3587
  value: `${E.confidencePercent}%`
3534
3588
  }),
3535
- /* @__PURE__ */ s(Br, {
3589
+ /* @__PURE__ */ s(Gr, {
3536
3590
  label: "اللُّغَةُ",
3537
3591
  value: E.language.toUpperCase()
3538
3592
  }),
3539
- /* @__PURE__ */ s(Br, {
3593
+ /* @__PURE__ */ s(Gr, {
3540
3594
  label: "زَمَنُ التَّحْلِيلِ",
3541
3595
  value: `${E.latencyMs} ms`
3542
3596
  }),
3543
- /* @__PURE__ */ s(Br, {
3597
+ /* @__PURE__ */ s(Gr, {
3544
3598
  label: "عَدَدُ الرُّمُوزِ الصَّوْتِيَّةِ",
3545
3599
  value: E.timestamps.length.toString()
3546
3600
  })
@@ -3550,10 +3604,10 @@ function Rr({ acceptedPronunciations: e, expectedText: n, imageAlt: o, imageSrc:
3550
3604
  ]
3551
3605
  });
3552
3606
  }
3553
- function zr({ status: e }) {
3607
+ function Wr({ status: e }) {
3554
3608
  return s(e === "correct" ? p : e === "no-speech" ? I : ne, { "aria-hidden": "true" });
3555
3609
  }
3556
- function Br({ label: e, value: t }) {
3610
+ function Gr({ label: e, value: t }) {
3557
3611
  return /* @__PURE__ */ c("span", {
3558
3612
  className: "audio-debug-meta-card",
3559
3613
  children: [/* @__PURE__ */ s("small", { children: e }), /* @__PURE__ */ s("strong", {
@@ -3562,29 +3616,29 @@ function Br({ label: e, value: t }) {
3562
3616
  })]
3563
3617
  });
3564
3618
  }
3565
- function Vr(e) {
3619
+ function Kr(e) {
3566
3620
  let t = Math.max(0, Math.round(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
3567
3621
  return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
3568
3622
  }
3569
- function Hr(e) {
3623
+ function qr(e) {
3570
3624
  return e === "fr" ? "الفَرَنْسِيَّةِ" : "العَرَبِيَّةِ";
3571
3625
  }
3572
- function Ur(e) {
3626
+ function Jr(e) {
3573
3627
  let t = e;
3574
3628
  return t.code === "MISSING_PERMISSION" ? "يَجِبُ السَّماحُ بِاسْتِعْمالِ المِيكْرُوفُونِ لِتَسْجِيلِ الإِجابَةِ." : t.code === "MODEL_VOCAB_MISMATCH" ? "مَلَفُّ نَمُوذَجِ اللُّغَةِ لا يُطابِقُ قامُوسَهُ. يُرْجى تَصْحِيحُ مَلَفِّ النَّمُوذَجِ." : t.message ? t.message : typeof e == "string" ? e : "حَدَثَ خَطَأٌ أَثْناءَ تَسْجِيلِ الإِجابَةِ الصَّوْتِيَّةِ.";
3575
3629
  }
3576
- function Wr(e, t) {
3630
+ function Yr(e, t) {
3577
3631
  return e === "checking" ? "جارِي تَجْهِيزُ المِيكْرُوفُونِ" : e === "recording" ? "جارِي التَّسْجِيلُ... تَكَلَّمِ الآنَ" : e === "processing" ? "جارِي تَحْلِيلُ النُّطْقِ" : e === "error" ? "تَعَذَّرَ تَحْلِيلُ التَّسْجِيلِ" : t ? "اِكْتَمَلَ تَحْلِيلُ الإِجابَةِ" : "المِيكْرُوفُونُ جاهِزٌ";
3578
3632
  }
3579
- function Gr(e) {
3633
+ function Xr(e) {
3580
3634
  return e === "correct" ? "أَحْسَنْتَ! إِجابَةٌ صَحِيحَةٌ" : e === "no-speech" ? "لَمْ نَسْمَعْ كَلِمَةً واضِحَةً" : e === "language-mismatch" ? "اُسْتُعْمِلَ نَمُوذَجُ لُغَةٍ مُخْتَلِفَةٍ" : "حاوِلْ مَرَّةً أُخْرى";
3581
3635
  }
3582
- function Kr(e, t) {
3636
+ function Zr(e, t) {
3583
3637
  return e === "correct" ? `نَطَقْتَ «${t}» بِشَكْلٍ صَحِيحٍ.` : e === "no-speech" ? `قَرِّبْ فَمَكَ مِنَ المِيكْرُوفُونِ وَقُلْ «${t}».` : `اِسْتَمِعْ إِلى نُطْقِ «${t}» ثُمَّ أَعِدِ المُحاوَلَةَ.`;
3584
3638
  }
3585
3639
  //#endregion
3586
3640
  //#region src/exam-session/interactions/SortableAnswer.tsx
3587
- function qr({ answerId: e, items: t, value: n, onChange: r }) {
3641
+ function Qr({ answerId: e, items: t, value: n, onChange: r }) {
3588
3642
  let i = new Map(t.map((e) => [e.id, e])), a = n?.itemIds.length === t.length ? n.itemIds.filter((e) => i.has(e)) : t.map((e) => e.id);
3589
3643
  return /* @__PURE__ */ s(l, {
3590
3644
  onDragEnd: (e) => {
@@ -3597,7 +3651,7 @@ function qr({ answerId: e, items: t, value: n, onChange: r }) {
3597
3651
  className: "sortable-answer",
3598
3652
  children: a.map((t, n) => {
3599
3653
  let r = i.get(t);
3600
- return r ? /* @__PURE__ */ s(Jr, {
3654
+ return r ? /* @__PURE__ */ s($r, {
3601
3655
  group: e,
3602
3656
  index: n,
3603
3657
  item: r
@@ -3606,7 +3660,7 @@ function qr({ answerId: e, items: t, value: n, onChange: r }) {
3606
3660
  })
3607
3661
  });
3608
3662
  }
3609
- function Jr({ group: e, index: t, item: n }) {
3663
+ function $r({ group: e, index: t, item: n }) {
3610
3664
  let { ref: r, isDragging: i, isDropTarget: a } = de({
3611
3665
  id: n.id,
3612
3666
  index: t,
@@ -3626,7 +3680,7 @@ function Jr({ group: e, index: t, item: n }) {
3626
3680
  }
3627
3681
  //#endregion
3628
3682
  //#region src/exam-session/interactions/TextAnswer.tsx
3629
- function Yr({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
3683
+ function ei({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onChange: i }) {
3630
3684
  return /* @__PURE__ */ s("input", {
3631
3685
  "aria-label": e,
3632
3686
  className: t,
@@ -3640,7 +3694,7 @@ function Yr({ ariaLabel: e, className: t, inputMode: n = "text", value: r, onCha
3640
3694
  }
3641
3695
  //#endregion
3642
3696
  //#region src/renderer/visualScene.tsx
3643
- var Xr = {
3697
+ var ti = {
3644
3698
  apple: f,
3645
3699
  circle: m,
3646
3700
  flower: _,
@@ -3650,7 +3704,7 @@ var Xr = {
3650
3704
  star: j,
3651
3705
  sun: M,
3652
3706
  triangle: P
3653
- }, Zr = {
3707
+ }, ni = {
3654
3708
  blue: "#4d89d9",
3655
3709
  gray: "#8c97a0",
3656
3710
  green: "#1f9d63",
@@ -3658,7 +3712,7 @@ var Xr = {
3658
3712
  purple: "#8a63d2",
3659
3713
  red: "#eb5b5b",
3660
3714
  yellow: "#f2c641"
3661
- }, Qr = {
3715
+ }, ri = {
3662
3716
  "counter-rows": { rows: [{
3663
3717
  color: "yellow",
3664
3718
  count: 5,
@@ -3685,7 +3739,7 @@ var Xr = {
3685
3739
  id: "star-row",
3686
3740
  state: "plain"
3687
3741
  }] }
3688
- }, $r = [
3742
+ }, ii = [
3689
3743
  {
3690
3744
  label: "Cercle",
3691
3745
  value: "circle"
@@ -3722,7 +3776,7 @@ var Xr = {
3722
3776
  label: "Hexagone",
3723
3777
  value: "hexagon"
3724
3778
  }
3725
- ], ei = [
3779
+ ], ai = [
3726
3780
  {
3727
3781
  label: "Jaune",
3728
3782
  value: "yellow"
@@ -3751,20 +3805,20 @@ var Xr = {
3751
3805
  label: "Gris",
3752
3806
  value: "gray"
3753
3807
  }
3754
- ], ti = [{
3808
+ ], oi = [{
3755
3809
  label: "Normal",
3756
3810
  value: "plain"
3757
3811
  }, {
3758
3812
  label: "Barre",
3759
3813
  value: "crossed"
3760
3814
  }];
3761
- function ni(e) {
3762
- return { rows: Qr[e].rows.map((e) => ({ ...e })) };
3815
+ function si(e) {
3816
+ return { rows: ri[e].rows.map((e) => ({ ...e })) };
3763
3817
  }
3764
- function ri(e) {
3765
- return Zr[e];
3818
+ function ci(e) {
3819
+ return ni[e];
3766
3820
  }
3767
- function ii({ scene: e }) {
3821
+ function li({ scene: e }) {
3768
3822
  return /* @__PURE__ */ s("div", {
3769
3823
  className: "visual-panel visual-panel--custom",
3770
3824
  "aria-hidden": "true",
@@ -3772,7 +3826,7 @@ function ii({ scene: e }) {
3772
3826
  className: "visual-scene",
3773
3827
  children: e.rows.map((e) => /* @__PURE__ */ s("div", {
3774
3828
  className: "visual-scene-row",
3775
- children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ s(ai, {
3829
+ children: Array.from({ length: Math.max(1, Math.floor(e.count) || 1) }, (t, n) => /* @__PURE__ */ s(ui, {
3776
3830
  color: e.color,
3777
3831
  icon: e.icon,
3778
3832
  state: e.state
@@ -3781,31 +3835,31 @@ function ii({ scene: e }) {
3781
3835
  })
3782
3836
  });
3783
3837
  }
3784
- function ai({ color: e, icon: t, state: n }) {
3785
- let r = Xr[t];
3838
+ function ui({ color: e, icon: t, state: n }) {
3839
+ let r = ti[t];
3786
3840
  return /* @__PURE__ */ s("span", {
3787
3841
  className: n === "crossed" ? "visual-scene-icon visual-scene-icon--crossed" : "visual-scene-icon",
3788
- style: { color: ri(e) },
3842
+ style: { color: ci(e) },
3789
3843
  children: /* @__PURE__ */ s(r, { "aria-hidden": "true" })
3790
3844
  });
3791
3845
  }
3792
3846
  //#endregion
3793
3847
  //#region src/renderer/contentDirection.ts
3794
- var oi = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufeff]/, si = /[A-Za-z\u00c0-\u024f]/;
3795
- function ci(e) {
3848
+ var di = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufeff]/, fi = /[A-Za-z\u00c0-\u024f]/;
3849
+ function pi(e) {
3796
3850
  return e === "rtl" || e === "ltr" || e === "auto" ? e : "auto";
3797
3851
  }
3798
- function li(e) {
3799
- let t = ci(e.contentDirection);
3800
- return t === "auto" ? ui(di(e)) ?? "ltr" : t;
3852
+ function mi(e) {
3853
+ let t = pi(e.contentDirection);
3854
+ return t === "auto" ? hi(gi(e)) ?? "ltr" : t;
3801
3855
  }
3802
- function ui(e) {
3856
+ function hi(e) {
3803
3857
  for (let t of e) for (let e of t) {
3804
- if (oi.test(e)) return "rtl";
3805
- if (si.test(e)) return "ltr";
3858
+ if (di.test(e)) return "rtl";
3859
+ if (fi.test(e)) return "ltr";
3806
3860
  }
3807
3861
  }
3808
- function di(e) {
3862
+ function gi(e) {
3809
3863
  let t = [e.prompt];
3810
3864
  switch (e.type) {
3811
3865
  case "inline-inputs":
@@ -3843,19 +3897,19 @@ function di(e) {
3843
3897
  }
3844
3898
  //#endregion
3845
3899
  //#region src/renderer/QuestionRenderer.tsx
3846
- function fi({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
3847
- let a = li(n);
3900
+ function _i({ adapters: e, clearAnswer: t, question: n, getAnswer: r, updateAnswer: i }) {
3901
+ let a = mi(n);
3848
3902
  return /* @__PURE__ */ c("article", {
3849
3903
  className: `question-block question-block--${n.type} question-block--${a}`,
3850
3904
  dir: a,
3851
3905
  lang: a === "rtl" ? "ar" : "fr",
3852
- children: [/* @__PURE__ */ s(mi, {
3906
+ children: [/* @__PURE__ */ s(yi, {
3853
3907
  number: n.number,
3854
3908
  prompt: n.prompt
3855
- }), hi(n, r, i, t, e)]
3909
+ }), bi(n, r, i, t, e)]
3856
3910
  });
3857
3911
  }
3858
- function pi({ adapters: e, clearAnswer: t, section: n, getAnswer: r, readOnly: i = !1, updateAnswer: a }) {
3912
+ function vi({ adapters: e, clearAnswer: t, section: n, getAnswer: r, readOnly: i = !1, updateAnswer: a }) {
3859
3913
  return /* @__PURE__ */ c("section", {
3860
3914
  "aria-readonly": i,
3861
3915
  className: `question-section question-section--${n.tone}`,
@@ -3876,7 +3930,7 @@ function pi({ adapters: e, clearAnswer: t, section: n, getAnswer: r, readOnly: i
3876
3930
  }), /* @__PURE__ */ s("div", {
3877
3931
  className: "section-body",
3878
3932
  inert: i,
3879
- children: n.questions.map((n) => /* @__PURE__ */ s(fi, {
3933
+ children: n.questions.map((n) => /* @__PURE__ */ s(_i, {
3880
3934
  adapters: e,
3881
3935
  clearAnswer: t,
3882
3936
  getAnswer: r,
@@ -3886,17 +3940,17 @@ function pi({ adapters: e, clearAnswer: t, section: n, getAnswer: r, readOnly: i
3886
3940
  })]
3887
3941
  });
3888
3942
  }
3889
- function mi({ number: e, prompt: t }) {
3943
+ function yi({ number: e, prompt: t }) {
3890
3944
  return /* @__PURE__ */ c("div", {
3891
3945
  className: "question-prompt",
3892
3946
  children: [e > 0 ? /* @__PURE__ */ s("span", { children: e }) : null, /* @__PURE__ */ s("strong", { children: t })]
3893
3947
  });
3894
3948
  }
3895
- function hi(e, t, n, r, i) {
3949
+ function bi(e, t, n, r, i) {
3896
3950
  switch (e.type) {
3897
3951
  case "inline-inputs": return /* @__PURE__ */ s("div", {
3898
3952
  className: "inline-equation-grid",
3899
- children: e.items.map((a) => gi({
3953
+ children: e.items.map((a) => xi({
3900
3954
  adapters: i,
3901
3955
  className: "equation-card",
3902
3956
  clearAnswer: r,
@@ -3906,11 +3960,11 @@ function hi(e, t, n, r, i) {
3906
3960
  updateAnswer: n
3907
3961
  }))
3908
3962
  });
3909
- case "visual-choice": return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(qi, {
3963
+ case "visual-choice": return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(ea, {
3910
3964
  choices: e.choices,
3911
3965
  onChange: (t) => n(e.id, t),
3912
3966
  scene: e.scene,
3913
- value: Si(t(e.id)),
3967
+ value: Di(t(e.id)),
3914
3968
  visual: e.visual
3915
3969
  }), e.inputLabel ? /* @__PURE__ */ c("div", {
3916
3970
  className: "compact-answer",
@@ -3919,27 +3973,27 @@ function hi(e, t, n, r, i) {
3919
3973
  onChange: (t) => n(`${e.id}:input`, t),
3920
3974
  onClear: () => r(`${e.id}:input`),
3921
3975
  recognizer: i?.handwritingRecognizer,
3922
- value: vi(t(`${e.id}:input`))
3976
+ value: Ci(t(`${e.id}:input`))
3923
3977
  })]
3924
3978
  }) : null] });
3925
- case "number-line": return /* @__PURE__ */ s(qn, {
3979
+ case "number-line": return /* @__PURE__ */ s(Xn, {
3926
3980
  answerId: e.id,
3927
3981
  expression: e.expression,
3928
3982
  onClear: r,
3929
3983
  onChange: n,
3930
3984
  recognizer: i?.handwritingRecognizer,
3931
- value: vi(t(e.id))
3985
+ value: Ci(t(e.id))
3932
3986
  });
3933
- case "prime-factorization": return /* @__PURE__ */ s(lr, {
3987
+ case "prime-factorization": return /* @__PURE__ */ s(mr, {
3934
3988
  onChange: (t) => n(e.id, t),
3935
3989
  recognizer: i?.handwritingRecognizer,
3936
3990
  targets: e.targets,
3937
- value: yi(t(e.id))
3991
+ value: wi(t(e.id))
3938
3992
  });
3939
3993
  case "fraction-operations": return /* @__PURE__ */ s("div", {
3940
3994
  className: "fraction-operations",
3941
3995
  "data-count": e.items.length,
3942
- children: e.items.map((r) => /* @__PURE__ */ s(zi, {
3996
+ children: e.items.map((r) => /* @__PURE__ */ s(Wi, {
3943
3997
  adapters: i,
3944
3998
  getAnswer: t,
3945
3999
  item: r,
@@ -3949,18 +4003,18 @@ function hi(e, t, n, r, i) {
3949
4003
  });
3950
4004
  case "operation-solving": return /* @__PURE__ */ s("div", {
3951
4005
  className: "operation-solving-list",
3952
- children: Xe(e).map((a, o) => {
3953
- let l = Qe(e, a), u = ki(l);
4006
+ children: $e(e).map((a, o) => {
4007
+ let l = tt(e, a), u = Pi(l);
3954
4008
  return /* @__PURE__ */ c("section", {
3955
4009
  className: [
3956
4010
  "operation-solving",
3957
4011
  `operation-solving--${l.solutionMode}`,
3958
4012
  `operation-solving--${u}`
3959
4013
  ].join(" "),
3960
- children: [Xe(e).length > 1 ? /* @__PURE__ */ s("span", {
4014
+ children: [$e(e).length > 1 ? /* @__PURE__ */ s("span", {
3961
4015
  className: "operation-solving__index",
3962
4016
  children: o + 1
3963
- }) : null, s(u === "equation-card-grid" ? Mi : Ai, {
4017
+ }) : null, s(u === "equation-card-grid" ? Li : Fi, {
3964
4018
  adapters: i,
3965
4019
  clearAnswer: r,
3966
4020
  getAnswer: t,
@@ -3972,7 +4026,7 @@ function hi(e, t, n, r, i) {
3972
4026
  });
3973
4027
  case "equation-inputs": return /* @__PURE__ */ s("div", {
3974
4028
  className: "stacked-equations",
3975
- children: e.items.map((a) => gi({
4029
+ children: e.items.map((a) => xi({
3976
4030
  adapters: i,
3977
4031
  ariaPrefix: e.prompt,
3978
4032
  className: "wide-equation-card",
@@ -3983,7 +4037,7 @@ function hi(e, t, n, r, i) {
3983
4037
  updateAnswer: n
3984
4038
  }))
3985
4039
  });
3986
- case "length-estimation": return /* @__PURE__ */ s(Ji, {
4040
+ case "length-estimation": return /* @__PURE__ */ s(ta, {
3987
4041
  answerId: e.id,
3988
4042
  choices: e.choices,
3989
4043
  getAnswer: t,
@@ -3992,7 +4046,7 @@ function hi(e, t, n, r, i) {
3992
4046
  });
3993
4047
  case "shape-choice": return /* @__PURE__ */ c("div", {
3994
4048
  className: "shape-choice-layout",
3995
- children: [/* @__PURE__ */ s(Bt, {
4049
+ children: [/* @__PURE__ */ s(Ut, {
3996
4050
  items: e.choices.map((e) => ({
3997
4051
  id: `${e.id}-label`,
3998
4052
  label: e.label
@@ -4000,24 +4054,24 @@ function hi(e, t, n, r, i) {
4000
4054
  onChange: (t) => n(e.id, t),
4001
4055
  targets: e.choices.map((e) => ({
4002
4056
  id: `${e.id}-target`,
4003
- label: Gi(e.id)
4057
+ label: Qi(e.id)
4004
4058
  })),
4005
- value: Si(t(e.id))
4059
+ value: Di(t(e.id))
4006
4060
  }), /* @__PURE__ */ s("div", {
4007
4061
  className: "shape-row",
4008
4062
  "aria-hidden": "true",
4009
4063
  children: e.choices.map((e) => /* @__PURE__ */ s("span", { className: `shape-drawing shape-drawing--${e.id}` }, e.id))
4010
4064
  })]
4011
4065
  });
4012
- case "drawing-grid": return /* @__PURE__ */ s(Un, {
4066
+ case "drawing-grid": return /* @__PURE__ */ s(Kn, {
4013
4067
  onChange: (t) => n(e.id, t),
4014
4068
  points: e.points,
4015
- value: Ti(t(e.id))
4069
+ value: Ai(t(e.id))
4016
4070
  });
4017
- case "table-response": return /* @__PURE__ */ s(Pt, {
4071
+ case "table-response": return /* @__PURE__ */ s(Lt, {
4018
4072
  columns: e.columns,
4019
4073
  onChange: (t) => n(e.id, t),
4020
- value: Ei(t(e.id))
4074
+ value: ji(t(e.id))
4021
4075
  });
4022
4076
  case "text-input": return e.before && !e.after && e.number === 0 ? /* @__PURE__ */ s("p", {
4023
4077
  className: "problem-statement",
@@ -4031,7 +4085,7 @@ function hi(e, t, n, r, i) {
4031
4085
  onChange: (t) => n(e.id, t),
4032
4086
  onClear: () => r(e.id),
4033
4087
  recognizer: i?.handwritingRecognizer,
4034
- value: vi(t(e.id))
4088
+ value: Ci(t(e.id))
4035
4089
  }),
4036
4090
  e.after ? /* @__PURE__ */ s("span", { children: e.after }) : null
4037
4091
  ]
@@ -4045,10 +4099,10 @@ function hi(e, t, n, r, i) {
4045
4099
  className: "problem-statement word-problem__situation",
4046
4100
  children: e.situation
4047
4101
  }),
4048
- /* @__PURE__ */ s(kr, { config: a }),
4102
+ /* @__PURE__ */ s(Pr, { config: a }),
4049
4103
  /* @__PURE__ */ s("div", {
4050
4104
  className: "word-problem__parts",
4051
- children: e.parts.map((a, o) => /* @__PURE__ */ s(Ui, {
4105
+ children: e.parts.map((a, o) => /* @__PURE__ */ s(Xi, {
4052
4106
  adapters: i,
4053
4107
  clearAnswer: r,
4054
4108
  getAnswer: t,
@@ -4061,25 +4115,25 @@ function hi(e, t, n, r, i) {
4061
4115
  ]
4062
4116
  });
4063
4117
  }
4064
- case "drag-match": return /* @__PURE__ */ s(Bt, {
4118
+ case "drag-match": return /* @__PURE__ */ s(Ut, {
4065
4119
  items: e.items,
4066
4120
  onChange: (t) => n(e.id, t),
4067
4121
  targets: e.targets,
4068
- value: Si(t(e.id))
4122
+ value: Di(t(e.id))
4069
4123
  });
4070
- case "sortable-answer": return /* @__PURE__ */ s(qr, {
4124
+ case "sortable-answer": return /* @__PURE__ */ s(Qr, {
4071
4125
  answerId: e.id,
4072
4126
  items: e.items,
4073
4127
  onChange: (t) => n(e.id, t),
4074
- value: Ci(t(e.id))
4128
+ value: Oi(t(e.id))
4075
4129
  });
4076
- case "label-placement": return /* @__PURE__ */ s(Wn, {
4130
+ case "label-placement": return /* @__PURE__ */ s(qn, {
4077
4131
  labels: e.labels,
4078
4132
  onChange: (t) => n(e.id, t),
4079
4133
  targets: e.targets,
4080
- value: wi(t(e.id))
4134
+ value: ki(t(e.id))
4081
4135
  });
4082
- case "audio-recording": return /* @__PURE__ */ s(Rr, {
4136
+ case "audio-recording": return /* @__PURE__ */ s(Ur, {
4083
4137
  acceptedPronunciations: e.acceptedPronunciations,
4084
4138
  expectedText: e.expectedAnswer,
4085
4139
  imageAlt: e.imageAlt,
@@ -4090,11 +4144,11 @@ function hi(e, t, n, r, i) {
4090
4144
  onChange: (t) => n(e.id, t),
4091
4145
  onReset: () => r(e.id),
4092
4146
  recorder: i?.audioRecorder,
4093
- value: Di(t(e.id))
4147
+ value: Mi(t(e.id))
4094
4148
  });
4095
4149
  }
4096
4150
  }
4097
- function gi({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: o, questionId: l, updateAnswer: u }) {
4151
+ function xi({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswer: a, item: o, questionId: l, updateAnswer: u }) {
4098
4152
  if (o.answers?.length) return /* @__PURE__ */ c("div", {
4099
4153
  className: r,
4100
4154
  children: [o.answers.map((r) => {
@@ -4104,7 +4158,7 @@ function gi({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswe
4104
4158
  onChange: (e) => u(d, e),
4105
4159
  onClear: () => i(d),
4106
4160
  recognizer: t?.handwritingRecognizer,
4107
- value: vi(a(d))
4161
+ value: Ci(a(d))
4108
4162
  })] }, r.id);
4109
4163
  }), o.after ? /* @__PURE__ */ s("span", { children: o.after }) : null]
4110
4164
  }, o.id);
@@ -4122,57 +4176,57 @@ function gi({ adapters: t, ariaPrefix: n, className: r, clearAnswer: i, getAnswe
4122
4176
  onChange: (e) => u(d, e),
4123
4177
  onClear: () => i(d),
4124
4178
  recognizer: t?.handwritingRecognizer,
4125
- value: vi(a(d))
4179
+ value: Ci(a(d))
4126
4180
  }),
4127
4181
  o.after ? /* @__PURE__ */ s("span", { children: o.after }) : null
4128
4182
  ]
4129
4183
  }, o.id);
4130
4184
  }
4131
- function _i(e) {
4185
+ function Si(e) {
4132
4186
  return e?.kind === "text" ? e : void 0;
4133
4187
  }
4134
- function vi(e) {
4188
+ function Ci(e) {
4135
4189
  return e?.kind === "handwritten-number" ? e : void 0;
4136
4190
  }
4137
- function yi(e) {
4191
+ function wi(e) {
4138
4192
  return e?.kind === "prime-factorization" ? e : void 0;
4139
4193
  }
4140
- function bi(e) {
4194
+ function Ti(e) {
4141
4195
  return e?.kind === "fraction" ? e : void 0;
4142
4196
  }
4143
- function xi(e) {
4197
+ function Ei(e) {
4144
4198
  return e?.kind === "choice" ? e : void 0;
4145
4199
  }
4146
- function Si(e) {
4200
+ function Di(e) {
4147
4201
  return e?.kind === "matches" ? e : void 0;
4148
4202
  }
4149
- function Ci(e) {
4203
+ function Oi(e) {
4150
4204
  return e?.kind === "order" ? e : void 0;
4151
4205
  }
4152
- function wi(e) {
4206
+ function ki(e) {
4153
4207
  return e?.kind === "placements" ? e : void 0;
4154
4208
  }
4155
- function Ti(e) {
4209
+ function Ai(e) {
4156
4210
  return e?.kind === "drawing" ? e : void 0;
4157
4211
  }
4158
- function Ei(e) {
4212
+ function ji(e) {
4159
4213
  return e?.kind === "coin-table" ? e : void 0;
4160
4214
  }
4161
- function Di(e) {
4215
+ function Mi(e) {
4162
4216
  return e?.kind === "audio-recording" ? e : void 0;
4163
4217
  }
4164
- function Oi(e) {
4218
+ function Ni(e) {
4165
4219
  return `${G(e.leftOperand)} ${e.operator} ${G(e.rightOperand)} =`;
4166
4220
  }
4167
- function ki(e) {
4221
+ function Pi(e) {
4168
4222
  return e.operator === "÷" || e.layout === "equation-card-grid" || e.solutionMode === "full-process" ? "equation-card-grid" : "vertical-operation";
4169
4223
  }
4170
- function Ai({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnswer: i }) {
4171
- let a = Pi([
4224
+ function Fi({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnswer: i }) {
4225
+ let a = zi([
4172
4226
  G(r.leftOperand),
4173
4227
  G(r.rightOperand),
4174
4228
  G(r.correctAnswer)
4175
- ]), o = a.columns, l = Fi(G(r.leftOperand), a, o), u = Fi(G(r.rightOperand), a, o), d = Ri(r, o);
4229
+ ]), o = a.columns, l = Bi(G(r.leftOperand), a, o), u = Bi(G(r.rightOperand), a, o), d = Ui(r, o);
4176
4230
  return /* @__PURE__ */ c("div", {
4177
4231
  className: "vertical-operation vertical-operation--with-operands",
4178
4232
  style: { "--operation-columns": o },
@@ -4201,7 +4255,7 @@ function Ai({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnsw
4201
4255
  className: "vertical-operation__rule",
4202
4256
  "aria-hidden": "true"
4203
4257
  }),
4204
- /* @__PURE__ */ s(ji, {
4258
+ /* @__PURE__ */ s(Ii, {
4205
4259
  adapters: e,
4206
4260
  canvasWidth: d,
4207
4261
  className: "vertical-operation__answer-lane",
@@ -4213,7 +4267,7 @@ function Ai({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnsw
4213
4267
  ]
4214
4268
  });
4215
4269
  }
4216
- function ji({ adapters: e, canvasWidth: t, className: n = "operation-solving__final-answer", clearAnswer: r, getAnswer: i, question: a, updateAnswer: o }) {
4270
+ function Ii({ adapters: e, canvasWidth: t, className: n = "operation-solving__final-answer", clearAnswer: r, getAnswer: i, question: a, updateAnswer: o }) {
4217
4271
  return /* @__PURE__ */ c("div", {
4218
4272
  className: n,
4219
4273
  children: [/* @__PURE__ */ s("span", {
@@ -4225,44 +4279,45 @@ function ji({ adapters: e, canvasWidth: t, className: n = "operation-solving__fi
4225
4279
  onChange: (e) => o(a.id, e),
4226
4280
  onClear: () => r(a.id),
4227
4281
  recognizer: e?.handwritingRecognizer,
4228
- value: vi(i(a.id))
4282
+ value: Ci(i(a.id))
4229
4283
  })]
4230
4284
  });
4231
4285
  }
4232
- function Mi({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnswer: i }) {
4233
- let a = Oi(r);
4286
+ function Li({ adapters: e, clearAnswer: t, getAnswer: n, question: r, updateAnswer: i }) {
4287
+ let a = Ni(r);
4234
4288
  return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c("div", {
4235
4289
  className: "operation-solving__response-row",
4236
4290
  children: [/* @__PURE__ */ s("div", {
4237
4291
  className: "operation-solving__equation-card",
4238
4292
  children: /* @__PURE__ */ s("span", {
4239
- "data-size": Ni(a),
4293
+ "data-size": Ri(a),
4240
4294
  children: a
4241
4295
  })
4242
- }), /* @__PURE__ */ s(ji, {
4296
+ }), /* @__PURE__ */ s(Ii, {
4243
4297
  adapters: e,
4244
- canvasWidth: 260,
4298
+ canvasWidth: 180,
4245
4299
  clearAnswer: t,
4246
4300
  getAnswer: n,
4247
4301
  question: r,
4248
4302
  updateAnswer: i
4249
4303
  })]
4250
- }), /* @__PURE__ */ s(nr, {
4304
+ }), /* @__PURE__ */ s(or, {
4251
4305
  ariaLabel: "مساحة التفكير وإنجاز العملية",
4252
4306
  gridVariant: "reasoning-workspace",
4253
4307
  onChange: (e) => i(`${r.id}:work`, e),
4254
4308
  onClear: () => t(`${r.id}:work`),
4255
4309
  operation: r.operator,
4256
4310
  placeholder: "",
4257
- value: Ti(n(`${r.id}:work`))
4311
+ recognizer: e?.handwritingRecognizer,
4312
+ value: Ai(n(`${r.id}:work`))
4258
4313
  })] });
4259
4314
  }
4260
- function Ni(e) {
4315
+ function Ri(e) {
4261
4316
  let t = e.replace(/\s/g, "").length;
4262
4317
  return t <= 8 ? "short" : t <= 12 ? "medium" : "long";
4263
4318
  }
4264
- function Pi(e) {
4265
- let t = e.map(Li), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
4319
+ function zi(e) {
4320
+ let t = e.map(Hi), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
4266
4321
  return {
4267
4322
  columns: Math.max(n ? r + 1 + i : r, 2),
4268
4323
  fractionColumns: i,
@@ -4270,8 +4325,8 @@ function Pi(e) {
4270
4325
  wholeColumns: r
4271
4326
  };
4272
4327
  }
4273
- function Fi(e, t, n = t.columns) {
4274
- let r = Li(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
4328
+ function Bi(e, t, n = t.columns) {
4329
+ let r = Hi(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
4275
4330
  ...Array.from({ length: i }, () => ""),
4276
4331
  ...Array.from(r.whole),
4277
4332
  r.separator,
@@ -4280,11 +4335,11 @@ function Fi(e, t, n = t.columns) {
4280
4335
  ] : [...Array.from({ length: i }, () => ""), ...Array.from(r.whole)];
4281
4336
  return [...Array.from({ length: Math.max(0, n - a.length) }, () => ""), ...a];
4282
4337
  }
4283
- function Ii(e) {
4338
+ function Vi(e) {
4284
4339
  let t = G(e).trim();
4285
4340
  return t.length > 0 ? Array.from(t) : [""];
4286
4341
  }
4287
- function Li(e) {
4342
+ function Hi(e) {
4288
4343
  let t = G(e).trim(), n = t.indexOf(",");
4289
4344
  return n < 0 ? {
4290
4345
  fraction: "",
@@ -4296,11 +4351,11 @@ function Li(e) {
4296
4351
  whole: t.slice(0, n)
4297
4352
  };
4298
4353
  }
4299
- function Ri(e, t) {
4300
- let n = Ii(e.correctAnswer).length;
4354
+ function Ui(e, t) {
4355
+ let n = Vi(e.correctAnswer).length;
4301
4356
  return Math.min(640, Math.max(220, Math.max(t, n, 2) * 102));
4302
4357
  }
4303
- function zi({ adapters: t, getAnswer: n, item: r, questionId: i, updateAnswer: a }) {
4358
+ function Wi({ adapters: t, getAnswer: n, item: r, questionId: i, updateAnswer: a }) {
4304
4359
  let o = `${i}:${r.id}`, l = De(r);
4305
4360
  return /* @__PURE__ */ c("div", {
4306
4361
  className: "fraction-operation-card",
@@ -4310,14 +4365,14 @@ function zi({ adapters: t, getAnswer: n, item: r, questionId: i, updateAnswer: a
4310
4365
  children: r.terms.map((t, n) => /* @__PURE__ */ c(e, { children: [n > 0 ? /* @__PURE__ */ s("span", {
4311
4366
  className: "fraction-operation-card__operator",
4312
4367
  children: r.operators[n - 1] ?? "+"
4313
- }) : null, /* @__PURE__ */ s(Hi, { term: t })] }, t.id))
4368
+ }) : null, /* @__PURE__ */ s(Yi, { term: t })] }, t.id))
4314
4369
  }), /* @__PURE__ */ c("div", {
4315
4370
  className: "fraction-operation-card__answers",
4316
4371
  children: [
4317
4372
  l.map((r) => /* @__PURE__ */ c(e, { children: [/* @__PURE__ */ s("span", {
4318
4373
  className: "fraction-operation-card__equals",
4319
4374
  children: "="
4320
- }), /* @__PURE__ */ s(Bi, {
4375
+ }), /* @__PURE__ */ s(Gi, {
4321
4376
  adapters: t,
4322
4377
  answerPrefix: o,
4323
4378
  getAnswer: n,
@@ -4328,80 +4383,146 @@ function zi({ adapters: t, getAnswer: n, item: r, questionId: i, updateAnswer: a
4328
4383
  className: "fraction-operation-card__equals",
4329
4384
  children: "="
4330
4385
  }),
4331
- /* @__PURE__ */ s(Yt, {
4386
+ /* @__PURE__ */ s(Qt, {
4332
4387
  ariaLabel: "اكتب النتيجة النهائية",
4333
4388
  onChange: (e) => a(`${o}:result`, e),
4334
4389
  recognizer: t?.handwritingRecognizer,
4335
- value: bi(n(`${o}:result`))
4390
+ value: Ti(n(`${o}:result`))
4336
4391
  })
4337
4392
  ]
4338
4393
  })]
4339
4394
  });
4340
4395
  }
4341
- function Bi({ adapters: e, answerPrefix: t, getAnswer: n, step: r, updateAnswer: i }) {
4342
- let a = `${t}:${r.id}`;
4343
- if (r.type === "product") return /* @__PURE__ */ c("div", {
4396
+ function Gi({ adapters: t, answerPrefix: n, getAnswer: r, step: i, updateAnswer: a }) {
4397
+ let o = `${n}:${i.id}`;
4398
+ if (i.type === "guided") {
4399
+ let n = Ae(i);
4400
+ return /* @__PURE__ */ s("div", {
4401
+ "aria-label": "Write the guided fraction step",
4402
+ className: "fraction-guided-answer",
4403
+ dir: "ltr",
4404
+ children: i.fractions.map((i, l) => /* @__PURE__ */ c(e, { children: [l > 0 ? /* @__PURE__ */ s("span", {
4405
+ "aria-hidden": "true",
4406
+ className: "fraction-operation-card__operator",
4407
+ children: n[l - 1] ?? "+"
4408
+ }) : null, /* @__PURE__ */ s(Ki, {
4409
+ adapters: t,
4410
+ answerPrefix: `${o}:${i.id}`,
4411
+ fraction: i,
4412
+ getAnswer: r,
4413
+ updateAnswer: a
4414
+ })] }, i.id))
4415
+ });
4416
+ }
4417
+ if (i.type === "product") return /* @__PURE__ */ c("div", {
4344
4418
  "aria-label": "اكتب جداء البسط والمقام",
4345
4419
  className: "fraction-product-answer",
4346
4420
  dir: "ltr",
4347
4421
  children: [
4348
- /* @__PURE__ */ s(Vi, {
4349
- adapters: e,
4350
- answerPrefix: `${a}:numerator`,
4351
- getAnswer: n,
4422
+ /* @__PURE__ */ s(Ji, {
4423
+ adapters: t,
4424
+ answerPrefix: `${o}:numerator`,
4425
+ getAnswer: r,
4352
4426
  label: "بسط",
4353
- updateAnswer: i,
4354
- values: r.numeratorFactors
4427
+ updateAnswer: a,
4428
+ values: i.numeratorFactors
4355
4429
  }),
4356
4430
  /* @__PURE__ */ s("span", {
4357
4431
  "aria-hidden": "true",
4358
4432
  className: "fraction-product-answer__bar"
4359
4433
  }),
4360
- /* @__PURE__ */ s(Vi, {
4361
- adapters: e,
4362
- answerPrefix: `${a}:denominator`,
4363
- getAnswer: n,
4434
+ /* @__PURE__ */ s(Ji, {
4435
+ adapters: t,
4436
+ answerPrefix: `${o}:denominator`,
4437
+ getAnswer: r,
4364
4438
  label: "مقام",
4365
- updateAnswer: i,
4366
- values: r.denominatorFactors
4439
+ updateAnswer: a,
4440
+ values: i.denominatorFactors
4367
4441
  })
4368
4442
  ]
4369
4443
  });
4370
- if (r.type === "sum") {
4371
- let t = `${a}:left`, o = `${a}:right`;
4444
+ if (i.type === "sum") {
4445
+ let e = `${o}:left`, n = `${o}:right`;
4372
4446
  return /* @__PURE__ */ c("div", {
4373
4447
  "aria-label": "اكتب الكسور المتكافئة",
4374
4448
  className: "fraction-sum-answer",
4375
4449
  dir: "ltr",
4376
4450
  children: [
4377
- /* @__PURE__ */ s(Yt, {
4451
+ /* @__PURE__ */ s(Qt, {
4378
4452
  ariaLabel: "الكسر الأول",
4379
- onChange: (e) => i(t, e),
4380
- recognizer: e?.handwritingRecognizer,
4381
- value: bi(n(t))
4453
+ onChange: (t) => a(e, t),
4454
+ recognizer: t?.handwritingRecognizer,
4455
+ value: Ti(r(e))
4382
4456
  }),
4383
4457
  /* @__PURE__ */ s("span", {
4384
4458
  "aria-hidden": "true",
4385
4459
  className: "fraction-operation-card__operator",
4386
- children: r.operator
4460
+ children: i.operator
4387
4461
  }),
4388
- /* @__PURE__ */ s(Yt, {
4462
+ /* @__PURE__ */ s(Qt, {
4389
4463
  ariaLabel: "الكسر الثاني",
4390
- onChange: (e) => i(o, e),
4391
- recognizer: e?.handwritingRecognizer,
4392
- value: bi(n(o))
4464
+ onChange: (e) => a(n, e),
4465
+ recognizer: t?.handwritingRecognizer,
4466
+ value: Ti(r(n))
4393
4467
  })
4394
4468
  ]
4395
4469
  });
4396
4470
  }
4397
- return /* @__PURE__ */ s(Yt, {
4471
+ return /* @__PURE__ */ s(Qt, {
4398
4472
  ariaLabel: "اكتب النتيجة الوسيطة",
4399
- onChange: (e) => i(a, e),
4400
- recognizer: e?.handwritingRecognizer,
4401
- value: bi(n(a))
4473
+ onChange: (e) => a(o, e),
4474
+ recognizer: t?.handwritingRecognizer,
4475
+ value: Ti(r(o))
4476
+ });
4477
+ }
4478
+ function Ki({ adapters: e, answerPrefix: t, fraction: n, getAnswer: r, updateAnswer: i }) {
4479
+ return /* @__PURE__ */ c("span", {
4480
+ className: "fraction-guided-answer__fraction",
4481
+ children: [
4482
+ /* @__PURE__ */ s(qi, {
4483
+ adapters: e,
4484
+ answerPrefix: `${t}:numerator`,
4485
+ getAnswer: r,
4486
+ label: "Numerator",
4487
+ lane: n.numerator,
4488
+ updateAnswer: i
4489
+ }),
4490
+ /* @__PURE__ */ s("i", {
4491
+ "aria-hidden": "true",
4492
+ className: "fraction-guided-answer__bar"
4493
+ }),
4494
+ /* @__PURE__ */ s(qi, {
4495
+ adapters: e,
4496
+ answerPrefix: `${t}:denominator`,
4497
+ getAnswer: r,
4498
+ label: "Denominator",
4499
+ lane: n.denominator,
4500
+ updateAnswer: i
4501
+ })
4502
+ ]
4402
4503
  });
4403
4504
  }
4404
- function Vi({ adapters: t, answerPrefix: n, getAnswer: r, label: i, updateAnswer: a, values: o }) {
4505
+ function qi({ adapters: t, answerPrefix: n, getAnswer: r, label: i, lane: a, updateAnswer: o }) {
4506
+ let l = je(a);
4507
+ return /* @__PURE__ */ s("span", {
4508
+ className: "fraction-guided-answer__lane",
4509
+ children: a.cells.map((a, u) => {
4510
+ let d = `${n}:${a.id}`;
4511
+ return /* @__PURE__ */ c(e, { children: [u > 0 ? /* @__PURE__ */ s("b", {
4512
+ "aria-hidden": "true",
4513
+ children: l[u - 1] ?? "×"
4514
+ }) : null, /* @__PURE__ */ s(Y, {
4515
+ ariaLabel: `${i} ${u + 1}`,
4516
+ canvasHeight: 48,
4517
+ canvasWidth: 68,
4518
+ onChange: (e) => o(d, e),
4519
+ recognizer: t?.handwritingRecognizer,
4520
+ value: Ci(r(d))
4521
+ })] }, a.id);
4522
+ })
4523
+ });
4524
+ }
4525
+ function Ji({ adapters: t, answerPrefix: n, getAnswer: r, label: i, updateAnswer: a, values: o }) {
4405
4526
  return /* @__PURE__ */ s("div", {
4406
4527
  className: "fraction-product-answer__row",
4407
4528
  children: o.map((o, l) => {
@@ -4415,12 +4536,12 @@ function Vi({ adapters: t, answerPrefix: n, getAnswer: r, label: i, updateAnswer
4415
4536
  canvasWidth: 68,
4416
4537
  onChange: (e) => a(u, e),
4417
4538
  recognizer: t?.handwritingRecognizer,
4418
- value: vi(r(u))
4539
+ value: Ci(r(u))
4419
4540
  })] }, u);
4420
4541
  })
4421
4542
  });
4422
4543
  }
4423
- function Hi({ term: e }) {
4544
+ function Yi({ term: e }) {
4424
4545
  return e.kind === "fraction" ? /* @__PURE__ */ c("span", {
4425
4546
  className: "fraction-display",
4426
4547
  "aria-label": `${e.numerator ?? ""} sur ${e.denominator ?? ""}`,
@@ -4434,21 +4555,21 @@ function Hi({ term: e }) {
4434
4555
  children: e.value || "…"
4435
4556
  });
4436
4557
  }
4437
- function Ui({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: o }) {
4558
+ function Xi({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, part: i, partNumber: a, updateAnswer: o }) {
4438
4559
  let l = `${r}:${i.id}`;
4439
4560
  return /* @__PURE__ */ c("section", {
4440
4561
  className: "word-problem-part",
4441
4562
  children: [/* @__PURE__ */ c("div", {
4442
4563
  className: "word-problem-part__prompt",
4443
4564
  children: [/* @__PURE__ */ s("span", { children: a }), /* @__PURE__ */ s("strong", { children: i.prompt })]
4444
- }), i.type === "coin-table" ? /* @__PURE__ */ s(Pt, {
4565
+ }), i.type === "coin-table" ? /* @__PURE__ */ s(Lt, {
4445
4566
  columns: i.columns,
4446
4567
  onChange: (e) => o(l, e),
4447
4568
  showCountAnswer: !1,
4448
- value: Ei(n(l))
4569
+ value: ji(n(l))
4449
4570
  }) : i.type === "table" ? /* @__PURE__ */ s("div", {
4450
4571
  className: "word-problem-table",
4451
- style: Wi(i),
4572
+ style: Zi(i),
4452
4573
  children: i.cells.map((e) => {
4453
4574
  let t = `${l}:${e.id}`, r = i.hasHeaderRow && e.row === 0, a = !r && e.mode !== "static";
4454
4575
  return /* @__PURE__ */ c("div", {
@@ -4461,11 +4582,11 @@ function Ui({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, pa
4461
4582
  gridColumn: e.column + 1,
4462
4583
  gridRow: e.row + 1
4463
4584
  },
4464
- children: [(r || e.mode !== "student") && e.initialText ? /* @__PURE__ */ s("span", { children: e.initialText }) : null, a ? /* @__PURE__ */ s(Yr, {
4585
+ children: [(r || e.mode !== "student") && e.initialText ? /* @__PURE__ */ s("span", { children: e.initialText }) : null, a ? /* @__PURE__ */ s(ei, {
4465
4586
  ariaLabel: `${i.prompt} ${e.row + 1}-${e.column + 1}`,
4466
4587
  className: "word-problem-table__answer",
4467
4588
  onChange: (e) => o(t, e),
4468
- value: _i(n(t))
4589
+ value: Si(n(t))
4469
4590
  }) : null]
4470
4591
  }, e.id);
4471
4592
  })
@@ -4478,26 +4599,26 @@ function Ui({ adapters: e, clearAnswer: t, getAnswer: n, parentQuestionId: r, pa
4478
4599
  onChange: (e) => o(l, e),
4479
4600
  onClear: () => t(l),
4480
4601
  recognizer: e?.handwritingRecognizer,
4481
- value: vi(n(l))
4602
+ value: Ci(n(l))
4482
4603
  }),
4483
4604
  i.after ? /* @__PURE__ */ s("span", { children: i.after }) : null
4484
4605
  ]
4485
4606
  })]
4486
4607
  });
4487
4608
  }
4488
- function Wi(e) {
4609
+ function Zi(e) {
4489
4610
  let t = Array.from({ length: e.columnCount }, (t, n) => Math.max(1, e.columnWidths[n] ?? 1)), n = Array.from({ length: e.rowCount }, (t, n) => Math.max(44, e.rowHeights[n] ?? 64));
4490
4611
  return {
4491
4612
  gridTemplateColumns: t.map((e) => `minmax(78px, ${e}fr)`).join(" "),
4492
4613
  gridTemplateRows: n.map((e) => `${e}px`).join(" ")
4493
4614
  };
4494
4615
  }
4495
- function Gi(e) {
4616
+ function Qi(e) {
4496
4617
  return e === "triangle" ? "△" : e === "square" ? "□" : e === "rectangle" ? "▭" : e;
4497
4618
  }
4498
- var Ki = "picture";
4499
- function qi({ choices: e, onChange: n, scene: r, value: o, visual: l }) {
4500
- let u = i(null), d = i(null), f = i(null), p = i({}), m = i(null), h = o?.pairs[Ki], [g, _] = a(null), [v, y] = a(null);
4619
+ var $i = "picture";
4620
+ function ea({ choices: e, onChange: n, scene: r, value: o, visual: l }) {
4621
+ let u = i(null), d = i(null), f = i(null), p = i({}), m = i(null), h = o?.pairs[$i], [g, _] = a(null), [v, y] = a(null);
4501
4622
  function b(e, t) {
4502
4623
  let n = d.current;
4503
4624
  if (n) {
@@ -4572,7 +4693,7 @@ function qi({ choices: e, onChange: n, scene: r, value: o, visual: l }) {
4572
4693
  let r = E(e.clientX, e.clientY);
4573
4694
  r && n({
4574
4695
  kind: "matches",
4575
- pairs: { [Ki]: r }
4696
+ pairs: { [$i]: r }
4576
4697
  }), m.current = null, y(null);
4577
4698
  }
4578
4699
  function T(e, t, n) {
@@ -4607,7 +4728,7 @@ function qi({ choices: e, onChange: n, scene: r, value: o, visual: l }) {
4607
4728
  }),
4608
4729
  /* @__PURE__ */ c("div", {
4609
4730
  className: "visual-match-picture",
4610
- children: [/* @__PURE__ */ s(ii, { scene: r ?? ni(l) }), /* @__PURE__ */ s("button", {
4731
+ children: [/* @__PURE__ */ s(li, { scene: r ?? si(l) }), /* @__PURE__ */ s("button", {
4611
4732
  "aria-label": "اربط الصورة بالإجابة",
4612
4733
  className: h ? "visual-match-point visual-match-point--target visual-match-point--target-active" : "visual-match-point visual-match-point--target",
4613
4734
  onPointerCancel: w,
@@ -4639,8 +4760,8 @@ function qi({ choices: e, onChange: n, scene: r, value: o, visual: l }) {
4639
4760
  ]
4640
4761
  });
4641
4762
  }
4642
- function Ji({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }) {
4643
- let l = Math.max(...r.map((e) => e.squareLength)) + 2, u = nn(t), [d, f] = a(null), [p, m] = a(!1), [h, g] = a({}), _ = i(null);
4763
+ function ta({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }) {
4764
+ let l = Math.max(...r.map((e) => e.squareLength)) + 2, u = on(t), [d, f] = a(null), [p, m] = a(!1), [h, g] = a({}), _ = i(null);
4644
4765
  function v(e, t, n) {
4645
4766
  let r = d;
4646
4767
  r && g((i) => {
@@ -4682,7 +4803,7 @@ function Ji({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }
4682
4803
  "data-coloring": p ? "true" : "false",
4683
4804
  onPointerCancel: () => x(),
4684
4805
  onPointerUp: () => x(),
4685
- children: [/* @__PURE__ */ s(Zt, {
4806
+ children: [/* @__PURE__ */ s(en, {
4686
4807
  ariaLabel: "ألوان الأقلام",
4687
4808
  className: "length-color-picker",
4688
4809
  colors: u,
@@ -4691,7 +4812,7 @@ function Ji({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }
4691
4812
  }), /* @__PURE__ */ s("div", {
4692
4813
  className: "length-card-row",
4693
4814
  children: r.map((t) => {
4694
- let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = xi(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? tn(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
4815
+ let r = `${e}:squares:${t.id}`, i = `${e}:color:${t.id}`, a = Ei(n(i)), d = h[t.id], f = d?.colorId ?? a?.choiceId, p = d?.fill ?? +!!a?.choiceId, m = f ? an(u, f) : "#9aa3a8", g = `${16 + Math.min(p, 1) * 68}%`;
4695
4816
  return /* @__PURE__ */ c("div", {
4696
4817
  className: "length-card",
4697
4818
  children: [/* @__PURE__ */ s("div", {
@@ -4726,11 +4847,11 @@ function Ji({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }
4726
4847
  className: "length-value-row",
4727
4848
  children: [
4728
4849
  /* @__PURE__ */ s("span", { children: t.label }),
4729
- /* @__PURE__ */ s(Yr, {
4850
+ /* @__PURE__ */ s(ei, {
4730
4851
  ariaLabel: `طول ${t.label} بالمربعات`,
4731
4852
  inputMode: "numeric",
4732
4853
  onChange: (e) => o(r, e),
4733
- value: _i(n(r))
4854
+ value: Si(n(r))
4734
4855
  }),
4735
4856
  /* @__PURE__ */ s("span", { children: "مربعات" })
4736
4857
  ]
@@ -4742,7 +4863,7 @@ function Ji({ answerId: e, choices: t, getAnswer: n, items: r, updateAnswer: o }
4742
4863
  }
4743
4864
  //#endregion
4744
4865
  //#region src/renderer/QuestionPreviewPanel.tsx
4745
- function Yi({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
4866
+ function na({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
4746
4867
  let [i, o] = a({}), c = t ?? i;
4747
4868
  function l(e) {
4748
4869
  if (t !== void 0) {
@@ -4765,7 +4886,7 @@ function Yi({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
4765
4886
  }
4766
4887
  return /* @__PURE__ */ s("div", {
4767
4888
  className: "exam-renderer-preview",
4768
- children: /* @__PURE__ */ s(fi, {
4889
+ children: /* @__PURE__ */ s(_i, {
4769
4890
  adapters: e,
4770
4891
  clearAnswer: d,
4771
4892
  getAnswer: (e) => c[e],
@@ -4776,7 +4897,7 @@ function Yi({ adapters: e, answers: t, onAnswersChange: n, question: r }) {
4776
4897
  }
4777
4898
  //#endregion
4778
4899
  //#region src/renderer/PrintableExamDocument.tsx
4779
- var Xi = {
4900
+ var ra = {
4780
4901
  ariaLabel: "معلومات المؤسسة",
4781
4902
  logoAlt: "شعار المملكة المغربية",
4782
4903
  logoSrc: "/logo/morocco-logo.png",
@@ -4787,39 +4908,39 @@ var Xi = {
4787
4908
  "المديرية الإقليمية"
4788
4909
  ]
4789
4910
  };
4790
- function Zi({ exam: e, locale: t = "fr", variant: n }) {
4791
- let r = Fa(t), i = ia(e);
4911
+ function ia({ exam: e, locale: t = "fr", variant: n }) {
4912
+ let r = Ua(t), i = da(e);
4792
4913
  return /* @__PURE__ */ c("article", {
4793
4914
  className: `printable-exam printable-exam--${n}`,
4794
- dir: Pa(t) ? "rtl" : "ltr",
4915
+ dir: Ha(t) ? "rtl" : "ltr",
4795
4916
  children: [/* @__PURE__ */ c("div", {
4796
4917
  className: "printable-exam__top",
4797
4918
  children: [/* @__PURE__ */ c("header", {
4798
4919
  className: "printable-exam__header",
4799
4920
  children: [/* @__PURE__ */ c("div", {
4800
4921
  className: "printable-exam__title-row",
4801
- children: [/* @__PURE__ */ s(ra, { totalPoints: i }), /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("h1", { children: e.title }) })]
4922
+ children: [/* @__PURE__ */ s(ua, { totalPoints: i }), /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("h1", { children: e.title }) })]
4802
4923
  }), /* @__PURE__ */ c("div", {
4803
4924
  className: "printable-exam__meta",
4804
4925
  children: [
4805
- /* @__PURE__ */ s(na, {
4926
+ /* @__PURE__ */ s(la, {
4806
4927
  label: r.duration,
4807
4928
  value: e.timer
4808
4929
  }),
4809
- /* @__PURE__ */ s(na, {
4930
+ /* @__PURE__ */ s(la, {
4810
4931
  label: r.level,
4811
4932
  value: e.level
4812
4933
  }),
4813
- /* @__PURE__ */ s(na, {
4814
- label: Pa(t) ? "المادة" : r.subject ?? "Matiere",
4934
+ /* @__PURE__ */ s(la, {
4935
+ label: Ha(t) ? "المادة" : r.subject ?? "Matiere",
4815
4936
  value: e.subject
4816
4937
  })
4817
4938
  ]
4818
4939
  })]
4819
- }), /* @__PURE__ */ s(Qi, {})]
4940
+ }), /* @__PURE__ */ s(aa, {})]
4820
4941
  }), /* @__PURE__ */ s("div", {
4821
4942
  className: "printable-exam__sections",
4822
- children: e.sections.map((e) => /* @__PURE__ */ s($i, {
4943
+ children: e.sections.map((e) => /* @__PURE__ */ s(oa, {
4823
4944
  locale: t,
4824
4945
  section: e,
4825
4946
  variant: n
@@ -4827,24 +4948,24 @@ function Zi({ exam: e, locale: t = "fr", variant: n }) {
4827
4948
  })]
4828
4949
  });
4829
4950
  }
4830
- function Qi() {
4951
+ function aa() {
4831
4952
  return /* @__PURE__ */ c("section", {
4832
- "aria-label": Xi.ariaLabel,
4953
+ "aria-label": ra.ariaLabel,
4833
4954
  className: "printable-institution-header",
4834
4955
  dir: "rtl",
4835
4956
  children: [
4836
4957
  /* @__PURE__ */ s("img", {
4837
- alt: Xi.logoAlt,
4958
+ alt: ra.logoAlt,
4838
4959
  className: "printable-institution-header__logo",
4839
- src: Xi.logoSrc
4960
+ src: ra.logoSrc
4840
4961
  }),
4841
- /* @__PURE__ */ s("h1", { children: Xi.title }),
4842
- Xi.lines.map((e) => /* @__PURE__ */ s("p", { children: e }, e))
4962
+ /* @__PURE__ */ s("h1", { children: ra.title }),
4963
+ ra.lines.map((e) => /* @__PURE__ */ s("p", { children: e }, e))
4843
4964
  ]
4844
4965
  });
4845
4966
  }
4846
- function $i({ locale: e = "fr", section: t, variant: n }) {
4847
- let r = Fa(e);
4967
+ function oa({ locale: e = "fr", section: t, variant: n }) {
4968
+ let r = Ua(e);
4848
4969
  return /* @__PURE__ */ c("section", {
4849
4970
  className: `printable-section printable-section--${t.tone}`,
4850
4971
  "data-variant": n,
@@ -4866,7 +4987,7 @@ function $i({ locale: e = "fr", section: t, variant: n }) {
4866
4987
  ]
4867
4988
  }), /* @__PURE__ */ s("div", {
4868
4989
  className: "printable-section__body",
4869
- children: t.questions.map((t) => /* @__PURE__ */ s(ea, {
4990
+ children: t.questions.map((t) => /* @__PURE__ */ s(sa, {
4870
4991
  locale: e,
4871
4992
  question: t,
4872
4993
  variant: n
@@ -4874,8 +4995,8 @@ function $i({ locale: e = "fr", section: t, variant: n }) {
4874
4995
  })]
4875
4996
  });
4876
4997
  }
4877
- function ea({ locale: e = "fr", question: t, variant: n }) {
4878
- let r = Fa(e), i = li(t), a = W(t), o = a > 0 ? pe(a) : "";
4998
+ function sa({ locale: e = "fr", question: t, variant: n }) {
4999
+ let r = Ua(e), i = mi(t), a = W(t), o = a > 0 ? pe(a) : "";
4879
5000
  return /* @__PURE__ */ c("article", {
4880
5001
  className: `printable-question printable-question--${t.type} printable-question--${i}`,
4881
5002
  dir: i,
@@ -4900,25 +5021,25 @@ function ea({ locale: e = "fr", question: t, variant: n }) {
4900
5021
  }) : null
4901
5022
  ]
4902
5023
  })
4903
- }), ta(t, n, r, e)]
5024
+ }), ca(t, n, r, e)]
4904
5025
  });
4905
5026
  }
4906
- function ta(t, n, r, i) {
5027
+ function ca(t, n, r, i) {
4907
5028
  switch (t.type) {
4908
5029
  case "inline-inputs":
4909
5030
  case "equation-inputs": return /* @__PURE__ */ s("div", {
4910
5031
  className: "printable-equation-grid",
4911
5032
  children: t.items.map((e) => /* @__PURE__ */ s("div", {
4912
5033
  className: "printable-equation-card",
4913
- children: /* @__PURE__ */ s(Ma, { item: e })
5034
+ children: /* @__PURE__ */ s(Ba, { item: e })
4914
5035
  }, e.id))
4915
5036
  });
4916
5037
  case "number-line": return /* @__PURE__ */ c("div", {
4917
5038
  className: "printable-number-line-layout",
4918
5039
  children: [/* @__PURE__ */ c("div", {
4919
5040
  className: "printable-number-line-expression",
4920
- children: [/* @__PURE__ */ s("span", { children: t.expression }), /* @__PURE__ */ s(Na, {})]
4921
- }), /* @__PURE__ */ s(Da, {})]
5041
+ children: [/* @__PURE__ */ s("span", { children: t.expression }), /* @__PURE__ */ s(Va, {})]
5042
+ }), /* @__PURE__ */ s(Fa, {})]
4922
5043
  });
4923
5044
  case "prime-factorization": return /* @__PURE__ */ s("div", {
4924
5045
  className: "printable-prime-factorization",
@@ -4927,7 +5048,7 @@ function ta(t, n, r, i) {
4927
5048
  className: "printable-prime-factorization__target",
4928
5049
  children: [/* @__PURE__ */ c("strong", { children: [t.value || "…", " ="] }), /* @__PURE__ */ s("div", {
4929
5050
  className: "printable-prime-factorization__factors",
4930
- children: Array.from({ length: Ke(t.value) }, (n, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("span", {
5051
+ children: Array.from({ length: Ye(t.value) }, (n, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("span", {
4931
5052
  "aria-hidden": "true",
4932
5053
  children: "×"
4933
5054
  }) : null, /* @__PURE__ */ s($, {})] }, `${t.id}-${r}`))
@@ -4937,23 +5058,23 @@ function ta(t, n, r, i) {
4937
5058
  case "fraction-operations": return /* @__PURE__ */ s("div", {
4938
5059
  className: "printable-fraction-operations",
4939
5060
  dir: "ltr",
4940
- children: t.items.map((e) => /* @__PURE__ */ s(la, { item: e }, e.id))
5061
+ children: t.items.map((e) => /* @__PURE__ */ s(ga, { item: e }, e.id))
4941
5062
  });
4942
5063
  case "operation-solving": {
4943
5064
  if (t.items?.length) return /* @__PURE__ */ s("div", {
4944
5065
  className: "printable-operation-solving-list",
4945
- children: Xe(t).map((e, a) => {
5066
+ children: $e(t).map((e, a) => {
4946
5067
  let o = {
4947
- ...Qe(t, e),
5068
+ ...tt(t, e),
4948
5069
  items: void 0
4949
5070
  };
4950
5071
  return /* @__PURE__ */ c("div", {
4951
5072
  className: "printable-operation-solving-list__item",
4952
- children: [/* @__PURE__ */ c("span", { children: [a + 1, "."] }), ta(o, n, r, i)]
5073
+ children: [/* @__PURE__ */ c("span", { children: [a + 1, "."] }), ca(o, n, r, i)]
4953
5074
  }, e.id);
4954
5075
  })
4955
5076
  });
4956
- let e = sa(t);
5077
+ let e = ma(t);
4957
5078
  return /* @__PURE__ */ c("div", {
4958
5079
  className: [
4959
5080
  "printable-operation-solving",
@@ -4962,8 +5083,8 @@ function ta(t, n, r, i) {
4962
5083
  ].join(" "),
4963
5084
  children: [e === "equation-card-grid" ? /* @__PURE__ */ s(o, { children: /* @__PURE__ */ s("div", {
4964
5085
  className: "printable-operation-solving__equation",
4965
- children: /* @__PURE__ */ s(oa, { question: t })
4966
- }) }) : null, t.operator === "÷" ? /* @__PURE__ */ s(ma, {}) : /* @__PURE__ */ s(ca, {
5086
+ children: /* @__PURE__ */ s(pa, { question: t })
5087
+ }) }) : null, t.operator === "÷" ? /* @__PURE__ */ s(Sa, {}) : /* @__PURE__ */ s(ha, {
4967
5088
  question: t,
4968
5089
  showOperands: e === "vertical-operation"
4969
5090
  })]
@@ -4971,9 +5092,9 @@ function ta(t, n, r, i) {
4971
5092
  }
4972
5093
  case "visual-choice": return /* @__PURE__ */ c("div", {
4973
5094
  className: "printable-visual-match",
4974
- children: [/* @__PURE__ */ s(ba, {
5095
+ children: [/* @__PURE__ */ s(Oa, {
4975
5096
  choices: t.choices,
4976
- scene: t.scene ?? ni(t.visual)
5097
+ scene: t.scene ?? si(t.visual)
4977
5098
  }), t.inputLabel ? /* @__PURE__ */ c("div", {
4978
5099
  className: "printable-inline-answer",
4979
5100
  children: [/* @__PURE__ */ s("span", { children: t.inputLabel }), /* @__PURE__ */ s($, {})]
@@ -4983,9 +5104,9 @@ function ta(t, n, r, i) {
4983
5104
  className: "printable-length-task",
4984
5105
  children: /* @__PURE__ */ s("div", {
4985
5106
  className: "printable-length-list",
4986
- children: t.items.map((e) => /* @__PURE__ */ s(Oa, {
5107
+ children: t.items.map((e) => /* @__PURE__ */ s(Ia, {
4987
5108
  item: e,
4988
- squareUnit: Pa(i) ? "مربعات" : "carres",
5109
+ squareUnit: Ha(i) ? "مربعات" : "carres",
4989
5110
  variant: n
4990
5111
  }, e.id))
4991
5112
  })
@@ -4997,7 +5118,7 @@ function ta(t, n, r, i) {
4997
5118
  className: "printable-shape-bank",
4998
5119
  children: t.choices.map((e) => /* @__PURE__ */ s("div", {
4999
5120
  className: "printable-shape-card",
5000
- children: /* @__PURE__ */ s(zt, { shapeId: e.id })
5121
+ children: /* @__PURE__ */ s(Ht, { shapeId: e.id })
5001
5122
  }, e.id))
5002
5123
  }),
5003
5124
  /* @__PURE__ */ s("div", {
@@ -5007,12 +5128,12 @@ function ta(t, n, r, i) {
5007
5128
  children: [/* @__PURE__ */ c("span", { children: [t + 1, "."] }), /* @__PURE__ */ s("strong", { children: e.label })]
5008
5129
  }, e.id))
5009
5130
  }),
5010
- /* @__PURE__ */ s(aa, { label: r.dragArea })
5131
+ /* @__PURE__ */ s(fa, { label: r.dragArea })
5011
5132
  ]
5012
5133
  });
5013
5134
  case "drawing-grid": return /* @__PURE__ */ s("div", {
5014
5135
  className: "printable-drawing-block",
5015
- children: /* @__PURE__ */ s(Ea, { points: t.points })
5136
+ children: /* @__PURE__ */ s(Pa, { points: t.points })
5016
5137
  });
5017
5138
  case "table-response": return /* @__PURE__ */ s("div", {
5018
5139
  className: "printable-table-response",
@@ -5048,10 +5169,10 @@ function ta(t, n, r, i) {
5048
5169
  className: "printable-statement printable-word-problem__situation",
5049
5170
  children: t.situation
5050
5171
  }),
5051
- e?.enabled ? /* @__PURE__ */ s(Aa, { config: e }) : null,
5172
+ e?.enabled ? /* @__PURE__ */ s(Ra, { config: e }) : null,
5052
5173
  /* @__PURE__ */ s("div", {
5053
5174
  className: "printable-word-problem__parts",
5054
- children: t.parts.map((e, t) => /* @__PURE__ */ s(ka, {
5175
+ children: t.parts.map((e, t) => /* @__PURE__ */ s(La, {
5055
5176
  part: e,
5056
5177
  partNumber: t + 1
5057
5178
  }, e.id))
@@ -5059,7 +5180,7 @@ function ta(t, n, r, i) {
5059
5180
  ]
5060
5181
  });
5061
5182
  }
5062
- case "drag-match": return /* @__PURE__ */ s(Sa, {
5183
+ case "drag-match": return /* @__PURE__ */ s(Aa, {
5063
5184
  items: t.items,
5064
5185
  targets: t.targets
5065
5186
  });
@@ -5082,7 +5203,7 @@ function ta(t, n, r, i) {
5082
5203
  case "label-placement": return /* @__PURE__ */ c("div", {
5083
5204
  className: "printable-label-placement",
5084
5205
  children: [
5085
- /* @__PURE__ */ s(Ta, { targets: t.targets }),
5206
+ /* @__PURE__ */ s(Na, { targets: t.targets }),
5086
5207
  /* @__PURE__ */ s("div", {
5087
5208
  className: "printable-placement-labels",
5088
5209
  children: t.labels.map((e) => /* @__PURE__ */ s("span", {
@@ -5090,7 +5211,7 @@ function ta(t, n, r, i) {
5090
5211
  children: /* @__PURE__ */ s("strong", { children: e.label })
5091
5212
  }, e.id))
5092
5213
  }),
5093
- /* @__PURE__ */ s(aa, { label: r.placeLabels })
5214
+ /* @__PURE__ */ s(fa, { label: r.placeLabels })
5094
5215
  ]
5095
5216
  });
5096
5217
  case "audio-recording": return /* @__PURE__ */ c("div", {
@@ -5115,49 +5236,49 @@ function ta(t, n, r, i) {
5115
5236
  });
5116
5237
  }
5117
5238
  }
5118
- function na({ label: e, value: t }) {
5239
+ function la({ label: e, value: t }) {
5119
5240
  return /* @__PURE__ */ c("div", {
5120
5241
  className: "printable-meta-pill",
5121
5242
  children: [/* @__PURE__ */ s("span", { children: e }), /* @__PURE__ */ s("strong", { children: t })]
5122
5243
  });
5123
5244
  }
5124
- function ra({ totalPoints: e }) {
5245
+ function ua({ totalPoints: e }) {
5125
5246
  return /* @__PURE__ */ s("div", {
5126
5247
  className: "printable-note-box",
5127
5248
  children: /* @__PURE__ */ c("strong", { children: [/* @__PURE__ */ s("i", { "aria-hidden": "true" }), /* @__PURE__ */ c("b", { children: ["/ ", e] })] })
5128
5249
  });
5129
5250
  }
5130
- function ia(e) {
5251
+ function da(e) {
5131
5252
  let t = e.sections.filter((e) => e.isScored !== !1).map((e) => he(e)).filter((e) => Number.isFinite(e));
5132
5253
  if (t.length === 0) return "";
5133
5254
  let n = t.reduce((e, t) => e + t, 0);
5134
5255
  return String(Number.isInteger(n) ? n : Number(n.toFixed(2)));
5135
5256
  }
5136
- function aa({ label: e }) {
5257
+ function fa({ label: e }) {
5137
5258
  return /* @__PURE__ */ c("div", {
5138
5259
  className: "printable-hint-line",
5139
5260
  children: [/* @__PURE__ */ s("span", { children: e }), /* @__PURE__ */ s($, {})]
5140
5261
  });
5141
5262
  }
5142
- function oa({ question: e }) {
5263
+ function pa({ question: e }) {
5143
5264
  return /* @__PURE__ */ c(o, { children: [
5144
5265
  /* @__PURE__ */ s("span", { children: G(e.leftOperand) }),
5145
- /* @__PURE__ */ s(ha, {
5266
+ /* @__PURE__ */ s(Ca, {
5146
5267
  className: "printable-operation-solving__symbol",
5147
5268
  operator: e.operator
5148
5269
  }),
5149
5270
  /* @__PURE__ */ c("span", { children: [G(e.rightOperand), " ="] })
5150
5271
  ] });
5151
5272
  }
5152
- function sa(e) {
5273
+ function ma(e) {
5153
5274
  return e.operator === "÷" || e.layout === "equation-card-grid" || e.solutionMode === "full-process" ? "equation-card-grid" : "vertical-operation";
5154
5275
  }
5155
- function ca({ question: e, showOperands: t }) {
5156
- let n = _a([
5276
+ function ha({ question: e, showOperands: t }) {
5277
+ let n = Ta([
5157
5278
  G(e.leftOperand),
5158
5279
  G(e.rightOperand),
5159
5280
  G(e.correctAnswer)
5160
- ]), r = n.columns, i = Math.max(r, 5), a = Math.max(r, ga(G(e.correctAnswer)).length, 2), o = va(G(e.leftOperand), n, i), l = va(G(e.rightOperand), n, i);
5281
+ ]), r = n.columns, i = Math.max(r, 5), a = Math.max(r, wa(G(e.correctAnswer)).length, 2), o = Ea(G(e.leftOperand), n, i), l = Ea(G(e.rightOperand), n, i);
5161
5282
  return /* @__PURE__ */ c("div", {
5162
5283
  className: ["printable-vertical-operation", t ? "printable-vertical-operation--with-operands" : "printable-vertical-operation--blank-operands"].filter(Boolean).join(" "),
5163
5284
  style: {
@@ -5177,7 +5298,7 @@ function ca({ question: e, showOperands: t }) {
5177
5298
  }),
5178
5299
  /* @__PURE__ */ c("div", {
5179
5300
  className: "printable-vertical-operation__row",
5180
- children: [/* @__PURE__ */ s(ha, {
5301
+ children: [/* @__PURE__ */ s(Ca, {
5181
5302
  className: "printable-vertical-operation__operator",
5182
5303
  operator: e.operator
5183
5304
  }), l.map((e, n) => /* @__PURE__ */ s("span", {
@@ -5196,49 +5317,71 @@ function ca({ question: e, showOperands: t }) {
5196
5317
  ]
5197
5318
  });
5198
5319
  }
5199
- function la({ item: t }) {
5320
+ function ga({ item: t }) {
5200
5321
  let n = De(t);
5201
5322
  return /* @__PURE__ */ c("div", {
5202
5323
  className: "printable-fraction-operation",
5203
5324
  children: [/* @__PURE__ */ s("div", {
5204
5325
  className: "printable-fraction-operation__expression",
5205
- children: t.terms.map((n, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("span", { children: t.operators[r - 1] ?? "+" }) : null, /* @__PURE__ */ s(fa, { term: n })] }, n.id))
5326
+ children: t.terms.map((n, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("span", { children: t.operators[r - 1] ?? "+" }) : null, /* @__PURE__ */ s(ba, { term: n })] }, n.id))
5206
5327
  }), /* @__PURE__ */ c("div", {
5207
5328
  className: "printable-fraction-operation__answers",
5208
5329
  children: [
5209
- n.map((t) => /* @__PURE__ */ c(e, { children: [/* @__PURE__ */ s("span", { children: "=" }), /* @__PURE__ */ s(ua, { step: t })] }, t.id)),
5330
+ n.map((t) => /* @__PURE__ */ c(e, { children: [/* @__PURE__ */ s("span", { children: "=" }), /* @__PURE__ */ s(_a, { step: t })] }, t.id)),
5210
5331
  /* @__PURE__ */ s("span", { children: "=" }),
5211
- /* @__PURE__ */ s(pa, {})
5332
+ /* @__PURE__ */ s(xa, {})
5212
5333
  ]
5213
5334
  })]
5214
5335
  });
5215
5336
  }
5216
- function ua({ step: e }) {
5217
- return e.type === "product" ? /* @__PURE__ */ c("span", {
5337
+ function _a({ step: t }) {
5338
+ if (t.type === "guided") {
5339
+ let n = Ae(t);
5340
+ return /* @__PURE__ */ s("span", {
5341
+ className: "printable-fraction-guided-step",
5342
+ "aria-hidden": "true",
5343
+ children: t.fractions.map((t, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("strong", { children: n[r - 1] ?? "+" }) : null, /* @__PURE__ */ c("span", {
5344
+ className: "printable-fraction-guided-step__fraction",
5345
+ children: [
5346
+ /* @__PURE__ */ s(va, { lane: t.numerator }),
5347
+ /* @__PURE__ */ s("i", {}),
5348
+ /* @__PURE__ */ s(va, { lane: t.denominator })
5349
+ ]
5350
+ })] }, t.id))
5351
+ });
5352
+ }
5353
+ return t.type === "product" ? /* @__PURE__ */ c("span", {
5218
5354
  className: "printable-fraction-product",
5219
5355
  "aria-hidden": "true",
5220
5356
  children: [
5221
- /* @__PURE__ */ s(da, { count: e.numeratorFactors.length }),
5357
+ /* @__PURE__ */ s(ya, { count: t.numeratorFactors.length }),
5222
5358
  /* @__PURE__ */ s("i", {}),
5223
- /* @__PURE__ */ s(da, { count: e.denominatorFactors.length })
5359
+ /* @__PURE__ */ s(ya, { count: t.denominatorFactors.length })
5224
5360
  ]
5225
- }) : e.type === "sum" ? /* @__PURE__ */ c("span", {
5361
+ }) : t.type === "sum" ? /* @__PURE__ */ c("span", {
5226
5362
  className: "printable-fraction-sum",
5227
5363
  "aria-hidden": "true",
5228
5364
  children: [
5229
- /* @__PURE__ */ s(pa, {}),
5230
- /* @__PURE__ */ s("strong", { children: e.operator }),
5231
- /* @__PURE__ */ s(pa, {})
5365
+ /* @__PURE__ */ s(xa, {}),
5366
+ /* @__PURE__ */ s("strong", { children: t.operator }),
5367
+ /* @__PURE__ */ s(xa, {})
5232
5368
  ]
5233
- }) : /* @__PURE__ */ s(pa, {});
5369
+ }) : /* @__PURE__ */ s(xa, {});
5234
5370
  }
5235
- function da({ count: t }) {
5371
+ function va({ lane: t }) {
5372
+ let n = je(t);
5373
+ return /* @__PURE__ */ s("span", {
5374
+ className: "printable-fraction-guided-step__lane",
5375
+ children: t.cells.map((t, r) => /* @__PURE__ */ c(e, { children: [r > 0 ? /* @__PURE__ */ s("b", { children: n[r - 1] ?? "×" }) : null, /* @__PURE__ */ s($, {})] }, t.id))
5376
+ });
5377
+ }
5378
+ function ya({ count: t }) {
5236
5379
  return /* @__PURE__ */ s("span", {
5237
5380
  className: "printable-fraction-product__row",
5238
5381
  children: Array.from({ length: Math.max(t, 1) }, (t, n) => /* @__PURE__ */ c(e, { children: [n > 0 ? /* @__PURE__ */ s("b", { children: "×" }) : null, /* @__PURE__ */ s($, {})] }, n))
5239
5382
  });
5240
5383
  }
5241
- function fa({ term: e }) {
5384
+ function ba({ term: e }) {
5242
5385
  return e.kind === "fraction" ? /* @__PURE__ */ c("span", {
5243
5386
  className: "printable-fraction-value",
5244
5387
  children: [
@@ -5248,7 +5391,7 @@ function fa({ term: e }) {
5248
5391
  ]
5249
5392
  }) : /* @__PURE__ */ s("span", { children: e.value || "…" });
5250
5393
  }
5251
- function pa() {
5394
+ function xa() {
5252
5395
  return /* @__PURE__ */ c("span", {
5253
5396
  className: "printable-fraction-blank",
5254
5397
  "aria-hidden": "true",
@@ -5259,10 +5402,10 @@ function pa() {
5259
5402
  ]
5260
5403
  });
5261
5404
  }
5262
- function ma() {
5405
+ function Sa() {
5263
5406
  return /* @__PURE__ */ s("div", { className: "printable-division-operation" });
5264
5407
  }
5265
- function ha({ className: e, operator: t }) {
5408
+ function Ca({ className: e, operator: t }) {
5266
5409
  let n = t.trim();
5267
5410
  return /* @__PURE__ */ c("span", {
5268
5411
  "aria-hidden": "true",
@@ -5274,12 +5417,12 @@ function ha({ className: e, operator: t }) {
5274
5417
  ]
5275
5418
  });
5276
5419
  }
5277
- function ga(e) {
5420
+ function wa(e) {
5278
5421
  let t = G(e).trim();
5279
5422
  return t.length > 0 ? Array.from(t) : [""];
5280
5423
  }
5281
- function _a(e) {
5282
- let t = e.map(ya), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
5424
+ function Ta(e) {
5425
+ let t = e.map(Da), n = t.some((e) => e.separator.length > 0), r = Math.max(...t.map((e) => e.whole.length), 1), i = n ? Math.max(...t.map((e) => e.fraction.length), 0) : 0;
5283
5426
  return {
5284
5427
  columns: Math.max(n ? r + 1 + i : r, 2),
5285
5428
  fractionColumns: i,
@@ -5287,8 +5430,8 @@ function _a(e) {
5287
5430
  wholeColumns: r
5288
5431
  };
5289
5432
  }
5290
- function va(e, t, n = t.columns) {
5291
- let r = ya(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
5433
+ function Ea(e, t, n = t.columns) {
5434
+ let r = Da(e), i = Math.max(0, t.wholeColumns - r.whole.length), a = t.hasDecimal ? [
5292
5435
  ...Array.from({ length: i }, () => ""),
5293
5436
  ...Array.from(r.whole),
5294
5437
  r.separator,
@@ -5297,7 +5440,7 @@ function va(e, t, n = t.columns) {
5297
5440
  ] : [...Array.from({ length: i }, () => ""), ...Array.from(r.whole)];
5298
5441
  return [...Array.from({ length: Math.max(0, n - a.length) }, () => ""), ...a];
5299
5442
  }
5300
- function ya(e) {
5443
+ function Da(e) {
5301
5444
  let t = G(e).trim(), n = t.indexOf(",");
5302
5445
  return n < 0 ? {
5303
5446
  fraction: "",
@@ -5309,25 +5452,25 @@ function ya(e) {
5309
5452
  whole: t.slice(0, n)
5310
5453
  };
5311
5454
  }
5312
- function ba({ choices: e, scene: t }) {
5455
+ function Oa({ choices: e, scene: t }) {
5313
5456
  return /* @__PURE__ */ s("div", {
5314
5457
  className: "printable-visual-match__preview",
5315
5458
  children: /* @__PURE__ */ c("div", {
5316
5459
  className: "visual-line-match printable-visual-line-match",
5317
5460
  children: [/* @__PURE__ */ c("div", {
5318
5461
  className: "visual-match-picture printable-visual-match-picture",
5319
- children: [/* @__PURE__ */ s(ii, { scene: t }), /* @__PURE__ */ s("span", {
5462
+ children: [/* @__PURE__ */ s(li, { scene: t }), /* @__PURE__ */ s("span", {
5320
5463
  "aria-hidden": "true",
5321
5464
  className: "visual-match-point visual-match-point--target printable-match-point printable-match-point--target"
5322
5465
  })]
5323
5466
  }), /* @__PURE__ */ s("div", {
5324
5467
  className: "visual-line-match__answers printable-visual-line-match__answers",
5325
- children: e.map((e) => /* @__PURE__ */ s(xa, { choice: e }, e.id))
5468
+ children: e.map((e) => /* @__PURE__ */ s(ka, { choice: e }, e.id))
5326
5469
  })]
5327
5470
  })
5328
5471
  });
5329
5472
  }
5330
- function xa({ choice: e }) {
5473
+ function ka({ choice: e }) {
5331
5474
  return /* @__PURE__ */ c("div", {
5332
5475
  className: "visual-match-answer printable-visual-match-answer",
5333
5476
  children: [/* @__PURE__ */ s("span", {
@@ -5339,25 +5482,25 @@ function xa({ choice: e }) {
5339
5482
  })]
5340
5483
  });
5341
5484
  }
5342
- function Sa({ items: e, targets: t }) {
5485
+ function Aa({ items: e, targets: t }) {
5343
5486
  return /* @__PURE__ */ c("div", {
5344
5487
  className: "printable-drag-match-board",
5345
5488
  children: [/* @__PURE__ */ s("div", {
5346
5489
  className: "printable-drag-match-row printable-drag-match-row--answers",
5347
- children: e.map((e, t) => /* @__PURE__ */ s(wa, {
5490
+ children: e.map((e, t) => /* @__PURE__ */ s(Ma, {
5348
5491
  index: t,
5349
5492
  item: e
5350
5493
  }, e.id))
5351
5494
  }), /* @__PURE__ */ s("div", {
5352
5495
  className: "printable-drag-match-row printable-drag-match-row--targets",
5353
- children: t.map((e, t) => /* @__PURE__ */ s(Ca, {
5496
+ children: t.map((e, t) => /* @__PURE__ */ s(ja, {
5354
5497
  index: t,
5355
5498
  target: e
5356
5499
  }, e.id))
5357
5500
  })]
5358
5501
  });
5359
5502
  }
5360
- function Ca({ index: e, target: t }) {
5503
+ function ja({ index: e, target: t }) {
5361
5504
  return /* @__PURE__ */ c("div", {
5362
5505
  className: "printable-drag-match-card printable-drag-match-card--target",
5363
5506
  children: [/* @__PURE__ */ s("span", {
@@ -5365,11 +5508,11 @@ function Ca({ index: e, target: t }) {
5365
5508
  children: String.fromCharCode(65 + e)
5366
5509
  }), /* @__PURE__ */ s("div", {
5367
5510
  className: "printable-drag-match-content",
5368
- children: t.shapeId ? /* @__PURE__ */ s(zt, { shapeId: t.shapeId }) : /* @__PURE__ */ s("strong", { children: t.label })
5511
+ children: t.shapeId ? /* @__PURE__ */ s(Ht, { shapeId: t.shapeId }) : /* @__PURE__ */ s("strong", { children: t.label })
5369
5512
  })]
5370
5513
  });
5371
5514
  }
5372
- function wa({ index: e, item: t }) {
5515
+ function Ma({ index: e, item: t }) {
5373
5516
  return /* @__PURE__ */ c("div", {
5374
5517
  className: "printable-drag-match-card printable-drag-match-card--answer",
5375
5518
  children: [/* @__PURE__ */ s("div", {
@@ -5381,7 +5524,7 @@ function wa({ index: e, item: t }) {
5381
5524
  })]
5382
5525
  });
5383
5526
  }
5384
- function Ta({ targets: e }) {
5527
+ function Na({ targets: e }) {
5385
5528
  return /* @__PURE__ */ s("div", {
5386
5529
  className: "printable-placement-board",
5387
5530
  children: e.map((e, t) => /* @__PURE__ */ s("div", {
@@ -5394,7 +5537,7 @@ function Ta({ targets: e }) {
5394
5537
  }, e.id))
5395
5538
  });
5396
5539
  }
5397
- function Ea({ points: e }) {
5540
+ function Pa({ points: e }) {
5398
5541
  return /* @__PURE__ */ c("svg", {
5399
5542
  className: "printable-drawing-grid",
5400
5543
  viewBox: "0 0 1000 420",
@@ -5425,7 +5568,7 @@ function Ea({ points: e }) {
5425
5568
  ]
5426
5569
  });
5427
5570
  }
5428
- function Da() {
5571
+ function Fa() {
5429
5572
  return /* @__PURE__ */ c("svg", {
5430
5573
  className: "printable-number-line",
5431
5574
  viewBox: "0 0 420 90",
@@ -5449,7 +5592,7 @@ function Da() {
5449
5592
  }, t))]
5450
5593
  });
5451
5594
  }
5452
- function Oa({ item: e, squareUnit: t, variant: n }) {
5595
+ function Ia({ item: e, squareUnit: t, variant: n }) {
5453
5596
  return /* @__PURE__ */ c("div", {
5454
5597
  className: "length-card printable-length-card",
5455
5598
  children: [/* @__PURE__ */ s("div", {
@@ -5478,13 +5621,13 @@ function Oa({ item: e, squareUnit: t, variant: n }) {
5478
5621
  className: "length-value-row printable-length-value-row",
5479
5622
  children: [
5480
5623
  /* @__PURE__ */ s("span", { children: e.label }),
5481
- /* @__PURE__ */ s(Na, {}),
5624
+ /* @__PURE__ */ s(Va, {}),
5482
5625
  /* @__PURE__ */ s("span", { children: t })
5483
5626
  ]
5484
5627
  })]
5485
5628
  });
5486
5629
  }
5487
- function ka({ part: e, partNumber: t }) {
5630
+ function La({ part: e, partNumber: t }) {
5488
5631
  return /* @__PURE__ */ c("section", {
5489
5632
  className: "printable-word-problem__part",
5490
5633
  children: [/* @__PURE__ */ c("div", {
@@ -5498,7 +5641,7 @@ function ka({ part: e, partNumber: t }) {
5498
5641
  }, e.id))
5499
5642
  }) : e.type === "table" ? /* @__PURE__ */ s("div", {
5500
5643
  className: "printable-word-problem-table",
5501
- style: ja(e),
5644
+ style: za(e),
5502
5645
  children: e.cells.map((t) => {
5503
5646
  let n = e.hasHeaderRow && t.row === 0, r = !n && t.mode !== "static";
5504
5647
  return /* @__PURE__ */ c("div", {
@@ -5527,23 +5670,23 @@ function ka({ part: e, partNumber: t }) {
5527
5670
  })]
5528
5671
  });
5529
5672
  }
5530
- function Aa({ config: e }) {
5531
- return /* @__PURE__ */ s(kr, {
5673
+ function Ra({ config: e }) {
5674
+ return /* @__PURE__ */ s(Pr, {
5532
5675
  className: "printable-problem-sheet",
5533
5676
  config: e
5534
5677
  });
5535
5678
  }
5536
- function ja(e) {
5679
+ function za(e) {
5537
5680
  let t = Array.from({ length: e.columnCount }, (t, n) => Math.max(1, e.columnWidths[n] ?? 1)), n = Array.from({ length: e.rowCount }, (t, n) => Math.max(26, Math.round((e.rowHeights[n] ?? 64) * .58)));
5538
5681
  return {
5539
5682
  gridTemplateColumns: t.map((e) => `minmax(18mm, ${e}fr)`).join(" "),
5540
5683
  gridTemplateRows: n.map((e) => `${e}px`).join(" ")
5541
5684
  };
5542
5685
  }
5543
- function Ma({ item: t }) {
5544
- return t.answers?.length ? /* @__PURE__ */ c(o, { children: [t.answers.map((t) => /* @__PURE__ */ c(e, { children: [t.before ? /* @__PURE__ */ s("span", { children: t.before }) : null, /* @__PURE__ */ s(Na, {})] }, t.id)), t.after ? /* @__PURE__ */ s("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ c(o, { children: [
5686
+ function Ba({ item: t }) {
5687
+ return t.answers?.length ? /* @__PURE__ */ c(o, { children: [t.answers.map((t) => /* @__PURE__ */ c(e, { children: [t.before ? /* @__PURE__ */ s("span", { children: t.before }) : null, /* @__PURE__ */ s(Va, {})] }, t.id)), t.after ? /* @__PURE__ */ s("span", { children: t.after }) : null] }) : t.correctAnswer ? /* @__PURE__ */ c(o, { children: [
5545
5688
  /* @__PURE__ */ s("span", { children: t.before }),
5546
- /* @__PURE__ */ s(Na, {}),
5689
+ /* @__PURE__ */ s(Va, {}),
5547
5690
  t.after ? /* @__PURE__ */ s("span", { children: t.after }) : null
5548
5691
  ] }) : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("span", { children: t.before }), t.after ? /* @__PURE__ */ s("span", { children: t.after }) : null] });
5549
5692
  }
@@ -5553,17 +5696,17 @@ function $() {
5553
5696
  "aria-hidden": "true"
5554
5697
  });
5555
5698
  }
5556
- function Na() {
5699
+ function Va() {
5557
5700
  return /* @__PURE__ */ s("span", {
5558
5701
  className: "printable-blank-box",
5559
5702
  "aria-hidden": "true"
5560
5703
  });
5561
5704
  }
5562
- function Pa(e) {
5705
+ function Ha(e) {
5563
5706
  return e.startsWith("ar");
5564
5707
  }
5565
- function Fa(e) {
5566
- return Pa(e) ? {
5708
+ function Ua(e) {
5709
+ return Ha(e) ? {
5567
5710
  answerArea: "مساحة الجواب",
5568
5711
  countShort: "عدد",
5569
5712
  dragArea: "اربط أو اكتب الجواب",
@@ -5600,7 +5743,7 @@ function Fa(e) {
5600
5743
  }
5601
5744
  //#endregion
5602
5745
  //#region src/exam-session/interactions/DraftSheet.tsx
5603
- function Ia({ disabled: e, onChange: t, value: n }) {
5746
+ function Wa({ disabled: e, onChange: t, value: n }) {
5604
5747
  let [r, i] = a(!1);
5605
5748
  return /* @__PURE__ */ s("aside", {
5606
5749
  className: "draft-sheet",
@@ -5617,7 +5760,7 @@ function Ia({ disabled: e, onChange: t, value: n }) {
5617
5760
  type: "button",
5618
5761
  children: "إِغْلاقٌ"
5619
5762
  })]
5620
- }), /* @__PURE__ */ s(mn, {
5763
+ }), /* @__PURE__ */ s(_n, {
5621
5764
  actionLabel: "مساحة ورقة وساخ",
5622
5765
  canvasHeight: 430,
5623
5766
  disabled: e,
@@ -5636,7 +5779,7 @@ function Ia({ disabled: e, onChange: t, value: n }) {
5636
5779
  }
5637
5780
  //#endregion
5638
5781
  //#region src/exam-session/interactions/ProblemSheetComposer.tsx
5639
- var La = 460, Ra = [
5782
+ var Ga = 460, Ka = [
5640
5783
  "#0f172a",
5641
5784
  "#0b5ed7",
5642
5785
  "#18c7c9",
@@ -5644,7 +5787,7 @@ var La = 460, Ra = [
5644
5787
  "#f59e0b",
5645
5788
  "#ef4444",
5646
5789
  "#7c3aed"
5647
- ], za = {
5790
+ ], qa = {
5648
5791
  delete: "Supprimer l’élément",
5649
5792
  eraser: "Gomme",
5650
5793
  fillColor: "Remplissage",
@@ -5670,11 +5813,11 @@ var La = 460, Ra = [
5670
5813
  textColor: "Couleur du texte",
5671
5814
  textPlaceholder: "Écrivez le texte à placer sur la feuille"
5672
5815
  };
5673
- function Ba({ config: e, labels: t, onChange: l }) {
5816
+ function Ja({ config: e, labels: t, onChange: l }) {
5674
5817
  let u = r(() => ({
5675
- ...za,
5818
+ ...qa,
5676
5819
  ...t
5677
- }), [t]), d = i(null), f = i(null), [p, m] = a(Q), [h, _] = a("select"), [v, y] = a(!1), [x, S] = a(null), [C, E] = a(""), [D, O] = a(Ra[0]), [ee, A] = a(4), [j, M] = a(null), P = ro(e.height), F = e.elements ?? [], I = F.find((e) => e.id === x);
5820
+ }), [t]), d = i(null), f = i(null), [p, m] = a(Q), [h, _] = a("select"), [v, y] = a(!1), [x, S] = a(null), [C, E] = a(""), [D, O] = a(Ka[0]), [ee, A] = a(4), [j, M] = a(null), P = fo(e.height), F = e.elements ?? [], I = F.find((e) => e.id === x);
5678
5821
  n(() => {
5679
5822
  let e = d.current;
5680
5823
  if (!e) return;
@@ -5697,10 +5840,10 @@ function Ba({ config: e, labels: t, onChange: l }) {
5697
5840
  } : n));
5698
5841
  }
5699
5842
  function B(e) {
5700
- let t = to(e), n = {
5843
+ let t = lo(e), n = {
5701
5844
  fill: "#e8f1ff",
5702
5845
  height: t.height,
5703
- id: $a(e),
5846
+ id: so(e),
5704
5847
  rotation: 0,
5705
5848
  shape: e,
5706
5849
  stroke: "#0f172a",
@@ -5708,13 +5851,13 @@ function Ba({ config: e, labels: t, onChange: l }) {
5708
5851
  type: "shape",
5709
5852
  width: t.width,
5710
5853
  x: 140,
5711
- y: eo(F.length, P)
5854
+ y: co(F.length, P)
5712
5855
  };
5713
5856
  R(F.concat(n)), S(n.id), _("select"), y(!1);
5714
5857
  }
5715
5858
  async function re(e) {
5716
5859
  if (!e || !e.type.startsWith("image/")) return;
5717
- let { height: t, source: n, width: r } = await ao(e), i = Math.min(320, Math.max(140, r)), a = {
5860
+ let { height: t, source: n, width: r } = await mo(e), i = Math.min(320, Math.max(140, r)), a = {
5718
5861
  crop: {
5719
5862
  height: 1,
5720
5863
  width: 1,
@@ -5722,18 +5865,18 @@ function Ba({ config: e, labels: t, onChange: l }) {
5722
5865
  y: 0
5723
5866
  },
5724
5867
  height: Math.min(300, Math.max(90, Math.round(t / r * i))),
5725
- id: $a("image"),
5868
+ id: so("image"),
5726
5869
  rotation: 0,
5727
5870
  source: n,
5728
5871
  type: "image",
5729
5872
  width: i,
5730
5873
  x: 140,
5731
- y: eo(F.length, P)
5874
+ y: co(F.length, P)
5732
5875
  };
5733
5876
  R(F.concat(a)), S(a.id), _("select");
5734
5877
  }
5735
5878
  function V(e, t) {
5736
- let n = io({
5879
+ let n = po({
5737
5880
  height: 1,
5738
5881
  width: 1,
5739
5882
  x: 0,
@@ -5753,13 +5896,13 @@ function Ba({ config: e, labels: t, onChange: l }) {
5753
5896
  }
5754
5897
  if (E(e), h !== "text" || !e) return;
5755
5898
  let t = {
5756
- color: Ra[0],
5899
+ color: Ka[0],
5757
5900
  fontSize: 28,
5758
- id: $a("text"),
5901
+ id: so("text"),
5759
5902
  text: e,
5760
5903
  type: "text",
5761
5904
  x: 120,
5762
- y: eo(F.length, P)
5905
+ y: co(F.length, P)
5763
5906
  };
5764
5907
  R(F.concat(t)), S(t.id), _("select");
5765
5908
  }
@@ -5769,8 +5912,8 @@ function Ba({ config: e, labels: t, onChange: l }) {
5769
5912
  function ce(e) {
5770
5913
  let t = e.target.getStage()?.getPointerPosition();
5771
5914
  return t ? {
5772
- x: no(t.x / L, 0, Q),
5773
- y: no(t.y / L, 0, P)
5915
+ x: uo(t.x / L, 0, Q),
5916
+ y: uo(t.y / L, 0, P)
5774
5917
  } : null;
5775
5918
  }
5776
5919
  function le(e) {
@@ -5782,7 +5925,7 @@ function Ba({ config: e, labels: t, onChange: l }) {
5782
5925
  let t = ce(e);
5783
5926
  t && (S(null), M({
5784
5927
  color: D,
5785
- id: $a("drawing"),
5928
+ id: so("drawing"),
5786
5929
  points: [0, 0],
5787
5930
  strokeWidth: ee,
5788
5931
  type: "drawing",
@@ -5824,7 +5967,7 @@ function Ba({ config: e, labels: t, onChange: l }) {
5824
5967
  function pe(e) {
5825
5968
  let t = ce(e);
5826
5969
  if (t) {
5827
- for (let e = F.length - 1; e >= 0; --e) if (Za(F[e], t)) {
5970
+ for (let e = F.length - 1; e >= 0; --e) if (ao(F[e], t)) {
5828
5971
  R(F.filter((t, n) => n !== e)), S(null);
5829
5972
  return;
5830
5973
  }
@@ -5838,13 +5981,13 @@ function Ba({ config: e, labels: t, onChange: l }) {
5838
5981
  className: "problem-sheet-composer__toolbar",
5839
5982
  role: "toolbar",
5840
5983
  children: [
5841
- /* @__PURE__ */ s(Va, {
5984
+ /* @__PURE__ */ s(Ya, {
5842
5985
  active: h === "select",
5843
5986
  label: u.move,
5844
5987
  onClick: () => _("select"),
5845
5988
  children: /* @__PURE__ */ s(w, { "aria-hidden": "true" })
5846
5989
  }),
5847
- /* @__PURE__ */ s(Va, {
5990
+ /* @__PURE__ */ s(Ya, {
5848
5991
  active: h === "text",
5849
5992
  label: u.text,
5850
5993
  onClick: ae,
@@ -5852,7 +5995,7 @@ function Ba({ config: e, labels: t, onChange: l }) {
5852
5995
  }),
5853
5996
  /* @__PURE__ */ c("div", {
5854
5997
  className: "problem-sheet-composer__shape-menu",
5855
- children: [/* @__PURE__ */ s(Va, {
5998
+ children: [/* @__PURE__ */ s(Ya, {
5856
5999
  active: v,
5857
6000
  label: u.shapeLibrary,
5858
6001
  onClick: () => y((e) => !e),
@@ -5861,40 +6004,40 @@ function Ba({ config: e, labels: t, onChange: l }) {
5861
6004
  "aria-label": u.shapeLibrary,
5862
6005
  className: "problem-sheet-composer__shape-picker",
5863
6006
  role: "menu",
5864
- children: fr.map((e) => /* @__PURE__ */ c("section", {
6007
+ children: _r.map((e) => /* @__PURE__ */ c("section", {
5865
6008
  className: "problem-sheet-composer__shape-group",
5866
6009
  children: [/* @__PURE__ */ s("span", { children: e.label }), /* @__PURE__ */ s("div", { children: e.shapes.map((e) => {
5867
- let t = u.shapes[e] ?? mr(e);
6010
+ let t = u.shapes[e] ?? yr(e);
5868
6011
  return /* @__PURE__ */ c("button", {
5869
6012
  "aria-label": t,
5870
6013
  onClick: () => B(e),
5871
6014
  title: t,
5872
6015
  type: "button",
5873
- children: [/* @__PURE__ */ s(Ha, { shape: e }), /* @__PURE__ */ s("span", { children: t })]
6016
+ children: [/* @__PURE__ */ s(Xa, { shape: e }), /* @__PURE__ */ s("span", { children: t })]
5874
6017
  }, e);
5875
6018
  }) })]
5876
6019
  }, e.id))
5877
6020
  }) : null]
5878
6021
  }),
5879
- /* @__PURE__ */ s(Va, {
6022
+ /* @__PURE__ */ s(Ya, {
5880
6023
  label: u.image,
5881
6024
  onClick: () => f.current?.click(),
5882
6025
  children: /* @__PURE__ */ s(b, { "aria-hidden": "true" })
5883
6026
  }),
5884
- /* @__PURE__ */ s(Va, {
6027
+ /* @__PURE__ */ s(Ya, {
5885
6028
  active: h === "pen",
5886
6029
  label: u.pen,
5887
6030
  onClick: () => _((e) => e === "pen" ? "select" : "pen"),
5888
6031
  children: /* @__PURE__ */ s(T, { "aria-hidden": "true" })
5889
6032
  }),
5890
- /* @__PURE__ */ s(Va, {
6033
+ /* @__PURE__ */ s(Ya, {
5891
6034
  active: h === "eraser",
5892
6035
  label: u.eraser,
5893
6036
  onClick: () => _((e) => e === "eraser" ? "select" : "eraser"),
5894
6037
  children: /* @__PURE__ */ s(g, { "aria-hidden": "true" })
5895
6038
  }),
5896
6039
  /* @__PURE__ */ s("span", { className: "problem-sheet-composer__toolbar-divider" }),
5897
- /* @__PURE__ */ s(Va, {
6040
+ /* @__PURE__ */ s(Ya, {
5898
6041
  disabled: !I,
5899
6042
  label: u.delete,
5900
6043
  onClick: U,
@@ -5913,11 +6056,11 @@ function Ba({ config: e, labels: t, onChange: l }) {
5913
6056
  rows: 3,
5914
6057
  value: I?.type === "text" ? I.text : C
5915
6058
  })]
5916
- }), I?.type === "text" ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(Ua, {
6059
+ }), I?.type === "text" ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(Za, {
5917
6060
  label: u.textColor,
5918
6061
  onSelect: (e) => z(I.id, { color: e }),
5919
- value: I.color ?? Ra[0]
5920
- }), /* @__PURE__ */ s(Wa, {
6062
+ value: I.color ?? Ka[0]
6063
+ }), /* @__PURE__ */ s(Qa, {
5921
6064
  label: u.fontSize,
5922
6065
  max: 72,
5923
6066
  min: 12,
@@ -5928,38 +6071,38 @@ function Ba({ config: e, labels: t, onChange: l }) {
5928
6071
  I?.type === "shape" ? /* @__PURE__ */ c("div", {
5929
6072
  className: "problem-sheet-composer__inspector problem-sheet-composer__inspector--shape",
5930
6073
  children: [
5931
- /* @__PURE__ */ s(Ua, {
6074
+ /* @__PURE__ */ s(Za, {
5932
6075
  label: u.fillColor,
5933
6076
  onSelect: (e) => z(I.id, { fill: e }),
5934
6077
  value: I.fill ?? "#e8f1ff"
5935
6078
  }),
5936
- /* @__PURE__ */ s(Ua, {
6079
+ /* @__PURE__ */ s(Za, {
5937
6080
  label: u.strokeColor,
5938
6081
  onSelect: (e) => z(I.id, { stroke: e }),
5939
- value: I.stroke ?? Ra[0]
6082
+ value: I.stroke ?? Ka[0]
5940
6083
  }),
5941
- /* @__PURE__ */ s(Wa, {
6084
+ /* @__PURE__ */ s(Qa, {
5942
6085
  label: u.strokeWidth,
5943
6086
  max: 12,
5944
6087
  min: 1,
5945
6088
  onChange: (e) => z(I.id, { strokeWidth: e }),
5946
6089
  value: I.strokeWidth ?? 3
5947
6090
  }),
5948
- /* @__PURE__ */ s(Wa, {
6091
+ /* @__PURE__ */ s(Qa, {
5949
6092
  label: I.shape === "line" ? u.lineLength : u.shapeWidth,
5950
6093
  max: 500,
5951
6094
  min: 40,
5952
- onChange: (e) => z(I.id, hr(I.shape) ? {
6095
+ onChange: (e) => z(I.id, br(I.shape) ? {
5953
6096
  height: e,
5954
6097
  width: e
5955
6098
  } : { width: e }),
5956
6099
  value: I.width
5957
6100
  }),
5958
- /* @__PURE__ */ s(Wa, {
6101
+ /* @__PURE__ */ s(Qa, {
5959
6102
  label: I.shape === "line" ? u.lineSlope : u.shapeHeight,
5960
6103
  max: I.shape === "line" ? 300 : 500,
5961
6104
  min: I.shape === "line" ? -300 : 40,
5962
- onChange: (e) => z(I.id, hr(I.shape) ? {
6105
+ onChange: (e) => z(I.id, br(I.shape) ? {
5963
6106
  height: e,
5964
6107
  width: e
5965
6108
  } : { height: e }),
@@ -5970,28 +6113,28 @@ function Ba({ config: e, labels: t, onChange: l }) {
5970
6113
  I?.type === "image" ? /* @__PURE__ */ c("div", {
5971
6114
  className: "problem-sheet-composer__inspector problem-sheet-composer__inspector--image",
5972
6115
  children: [
5973
- /* @__PURE__ */ s(Wa, {
6116
+ /* @__PURE__ */ s(Qa, {
5974
6117
  label: u.cropX,
5975
6118
  max: 100,
5976
6119
  min: 0,
5977
6120
  onChange: (e) => V(I, { x: e / 100 }),
5978
6121
  value: (I.crop?.x ?? 0) * 100
5979
6122
  }),
5980
- /* @__PURE__ */ s(Wa, {
6123
+ /* @__PURE__ */ s(Qa, {
5981
6124
  label: u.cropY,
5982
6125
  max: 100,
5983
6126
  min: 0,
5984
6127
  onChange: (e) => V(I, { y: e / 100 }),
5985
6128
  value: (I.crop?.y ?? 0) * 100
5986
6129
  }),
5987
- /* @__PURE__ */ s(Wa, {
6130
+ /* @__PURE__ */ s(Qa, {
5988
6131
  label: u.cropWidth,
5989
6132
  max: 100,
5990
6133
  min: 5,
5991
6134
  onChange: (e) => V(I, { width: e / 100 }),
5992
6135
  value: (I.crop?.width ?? 1) * 100
5993
6136
  }),
5994
- /* @__PURE__ */ s(Wa, {
6137
+ /* @__PURE__ */ s(Qa, {
5995
6138
  label: u.cropHeight,
5996
6139
  max: 100,
5997
6140
  min: 5,
@@ -6002,11 +6145,11 @@ function Ba({ config: e, labels: t, onChange: l }) {
6002
6145
  }) : null,
6003
6146
  h === "pen" ? /* @__PURE__ */ c("div", {
6004
6147
  className: "problem-sheet-composer__inspector problem-sheet-composer__inspector--pen",
6005
- children: [/* @__PURE__ */ s(Ua, {
6148
+ children: [/* @__PURE__ */ s(Za, {
6006
6149
  label: u.penColor,
6007
6150
  onSelect: O,
6008
6151
  value: D
6009
- }), /* @__PURE__ */ s(Wa, {
6152
+ }), /* @__PURE__ */ s(Qa, {
6010
6153
  label: u.penWidth,
6011
6154
  max: 12,
6012
6155
  min: 1,
@@ -6040,15 +6183,15 @@ function Ba({ config: e, labels: t, onChange: l }) {
6040
6183
  scaleY: L,
6041
6184
  children: [
6042
6185
  /* @__PURE__ */ s(H, {
6043
- fill: br(e.background),
6186
+ fill: Tr(e.background),
6044
6187
  height: P,
6045
6188
  width: Q
6046
6189
  }),
6047
- /* @__PURE__ */ s(xr, {
6190
+ /* @__PURE__ */ s(Er, {
6048
6191
  height: P,
6049
6192
  paper: e.paper ?? "squared"
6050
6193
  }),
6051
- F.map((e) => /* @__PURE__ */ s(Ga, {
6194
+ F.map((e) => /* @__PURE__ */ s($a, {
6052
6195
  draggable: h === "select",
6053
6196
  element: e,
6054
6197
  onDragEnd: (t) => z(e.id, {
@@ -6061,7 +6204,7 @@ function Ba({ config: e, labels: t, onChange: l }) {
6061
6204
  onShapeTransform: (e, t) => z(e.id, t),
6062
6205
  selected: e.id === x
6063
6206
  }, e.id)),
6064
- j ? /* @__PURE__ */ s(Ja, { element: j }) : null
6207
+ j ? /* @__PURE__ */ s(no, { element: j }) : null
6065
6208
  ]
6066
6209
  })
6067
6210
  })]
@@ -6069,7 +6212,7 @@ function Ba({ config: e, labels: t, onChange: l }) {
6069
6212
  ]
6070
6213
  });
6071
6214
  }
6072
- function Va({ active: e = !1, children: t, disabled: n = !1, label: r, onClick: i }) {
6215
+ function Ya({ active: e = !1, children: t, disabled: n = !1, label: r, onClick: i }) {
6073
6216
  return /* @__PURE__ */ s("button", {
6074
6217
  "aria-label": r,
6075
6218
  className: e ? "problem-sheet-composer__tool problem-sheet-composer__tool--active" : "problem-sheet-composer__tool",
@@ -6080,18 +6223,18 @@ function Va({ active: e = !1, children: t, disabled: n = !1, label: r, onClick:
6080
6223
  children: t
6081
6224
  });
6082
6225
  }
6083
- function Ha({ shape: e }) {
6226
+ function Xa({ shape: e }) {
6084
6227
  return /* @__PURE__ */ s("span", {
6085
6228
  "aria-hidden": "true",
6086
6229
  className: `problem-sheet-composer__shape-preview problem-sheet-composer__shape-preview--${e}`
6087
6230
  });
6088
6231
  }
6089
- function Ua({ label: e, onSelect: t, value: n }) {
6232
+ function Za({ label: e, onSelect: t, value: n }) {
6090
6233
  return /* @__PURE__ */ c("div", {
6091
6234
  className: "problem-sheet-composer__color-control",
6092
6235
  children: [/* @__PURE__ */ s("span", { children: e }), /* @__PURE__ */ c("div", {
6093
6236
  className: "problem-sheet-composer__swatches",
6094
- children: [Ra.map((r) => /* @__PURE__ */ s("button", {
6237
+ children: [Ka.map((r) => /* @__PURE__ */ s("button", {
6095
6238
  "aria-label": `${e}: ${r}`,
6096
6239
  className: n.toLowerCase() === r ? "is-selected" : "",
6097
6240
  onClick: () => t(r),
@@ -6106,7 +6249,7 @@ function Ua({ label: e, onSelect: t, value: n }) {
6106
6249
  })]
6107
6250
  });
6108
6251
  }
6109
- function Wa({ label: e, max: t, min: n, onChange: r, value: i }) {
6252
+ function Qa({ label: e, max: t, min: n, onChange: r, value: i }) {
6110
6253
  return /* @__PURE__ */ c("label", {
6111
6254
  className: "problem-sheet-composer__range-control",
6112
6255
  children: [/* @__PURE__ */ c("span", { children: [
@@ -6122,8 +6265,8 @@ function Wa({ label: e, max: t, min: n, onChange: r, value: i }) {
6122
6265
  })]
6123
6266
  });
6124
6267
  }
6125
- function Ga({ draggable: e, element: n, onDragEnd: r, onImageTransform: a, onLineEndpointChange: l, onShapeTransform: u, onSelect: d, selected: f }) {
6126
- let p = Xa(n), m = i(null), h = i(null), g = n.type === "image" || n.type === "shape" && n.shape !== "line", _ = f && g;
6268
+ function $a({ draggable: e, element: n, onDragEnd: r, onImageTransform: a, onLineEndpointChange: l, onShapeTransform: u, onSelect: d, selected: f }) {
6269
+ let p = io(n), m = i(null), h = i(null), g = n.type === "image" || n.type === "shape" && n.shape !== "line", _ = f && g;
6127
6270
  t(() => {
6128
6271
  !_ || !m.current || !h.current || (h.current.nodes([m.current]), h.current.getLayer()?.batchDraw());
6129
6272
  }, [n.id, _]);
@@ -6159,20 +6302,20 @@ function Ga({ draggable: e, element: n, onDragEnd: r, onImageTransform: a, onLin
6159
6302
  y: n.y,
6160
6303
  children: [
6161
6304
  n.type === "text" ? /* @__PURE__ */ s(U, {
6162
- fill: n.color ?? Ra[0],
6305
+ fill: n.color ?? Ka[0],
6163
6306
  fontFamily: "Arial, sans-serif",
6164
6307
  fontSize: n.fontSize ?? 28,
6165
6308
  text: n.text,
6166
6309
  width: 320
6167
- }) : n.type === "drawing" ? /* @__PURE__ */ s(Ja, { element: {
6310
+ }) : n.type === "drawing" ? /* @__PURE__ */ s(no, { element: {
6168
6311
  ...n,
6169
6312
  x: 0,
6170
6313
  y: 0
6171
- } }) : n.type === "image" ? /* @__PURE__ */ s(Ka, { element: {
6314
+ } }) : n.type === "image" ? /* @__PURE__ */ s(eo, { element: {
6172
6315
  ...n,
6173
6316
  x: 0,
6174
6317
  y: 0
6175
- } }) : /* @__PURE__ */ s(Ya, { element: n }),
6318
+ } }) : /* @__PURE__ */ s(ro, { element: n }),
6176
6319
  f && n.type !== "image" && !g ? /* @__PURE__ */ s(H, {
6177
6320
  dash: [8, 5],
6178
6321
  height: p.height + 14,
@@ -6183,7 +6326,7 @@ function Ga({ draggable: e, element: n, onDragEnd: r, onImageTransform: a, onLin
6183
6326
  x: p.x - 7,
6184
6327
  y: p.y - 7
6185
6328
  }) : null,
6186
- f && n.type === "shape" && n.shape === "line" ? /* @__PURE__ */ s(qa, {
6329
+ f && n.type === "shape" && n.shape === "line" ? /* @__PURE__ */ s(to, {
6187
6330
  element: n,
6188
6331
  onChange: l
6189
6332
  }) : null
@@ -6206,17 +6349,17 @@ function Ga({ draggable: e, element: n, onDragEnd: r, onImageTransform: a, onLin
6206
6349
  "middle-left"
6207
6350
  ],
6208
6351
  flipEnabled: !1,
6209
- keepRatio: n.type === "shape" && hr(n.shape),
6352
+ keepRatio: n.type === "shape" && br(n.shape),
6210
6353
  onTransformEnd: v,
6211
6354
  ref: h,
6212
6355
  rotateEnabled: !0,
6213
6356
  rotateLineVisible: !0
6214
6357
  }) : null] });
6215
6358
  }
6216
- function Ka({ element: e }) {
6217
- let t = wr(e.source);
6359
+ function eo({ element: e }) {
6360
+ let t = kr(e.source);
6218
6361
  return t ? /* @__PURE__ */ s(re, {
6219
- crop: Tr(t, e.crop),
6362
+ crop: Ar(t, e.crop),
6220
6363
  height: e.height,
6221
6364
  image: t,
6222
6365
  width: e.width,
@@ -6224,7 +6367,7 @@ function Ka({ element: e }) {
6224
6367
  y: e.y
6225
6368
  }) : null;
6226
6369
  }
6227
- function qa({ element: e, onChange: t }) {
6370
+ function to({ element: e, onChange: t }) {
6228
6371
  function n(n, r) {
6229
6372
  r.cancelBubble = !0, t(e, n, r.target.x(), r.target.y());
6230
6373
  }
@@ -6255,25 +6398,25 @@ function qa({ element: e, onChange: t }) {
6255
6398
  y: e.height
6256
6399
  })] });
6257
6400
  }
6258
- function Ja({ element: e }) {
6401
+ function no({ element: e }) {
6259
6402
  return /* @__PURE__ */ s(V, {
6260
6403
  lineCap: "round",
6261
6404
  lineJoin: "round",
6262
6405
  points: e.points,
6263
- stroke: e.color ?? Ra[0],
6406
+ stroke: e.color ?? Ka[0],
6264
6407
  strokeWidth: e.strokeWidth ?? 4,
6265
6408
  tension: .38,
6266
6409
  x: e.x,
6267
6410
  y: e.y
6268
6411
  });
6269
6412
  }
6270
- function Ya({ element: e }) {
6271
- return /* @__PURE__ */ s(gr, {
6413
+ function ro({ element: e }) {
6414
+ return /* @__PURE__ */ s(xr, {
6272
6415
  element: e,
6273
6416
  hitStrokeWidth: 32
6274
6417
  });
6275
6418
  }
6276
- function Xa(e) {
6419
+ function io(e) {
6277
6420
  if (e.type === "text") return {
6278
6421
  height: (e.fontSize ?? 28) * 1.5,
6279
6422
  width: 320,
@@ -6311,12 +6454,12 @@ function Xa(e) {
6311
6454
  y: a
6312
6455
  };
6313
6456
  }
6314
- function Za(e, t) {
6457
+ function ao(e, t) {
6315
6458
  if (e.type === "text") {
6316
6459
  let n = (e.fontSize ?? 28) * 1.5;
6317
6460
  return t.x >= e.x - 12 && t.x <= e.x + 332 && t.y >= e.y - 12 && t.y <= e.y + n + 12;
6318
6461
  }
6319
- if (e.type === "shape") return e.shape === "line" ? Qa(t, {
6462
+ if (e.type === "shape") return e.shape === "line" ? oo(t, {
6320
6463
  x: e.x,
6321
6464
  y: e.y
6322
6465
  }, {
@@ -6324,7 +6467,7 @@ function Za(e, t) {
6324
6467
  y: e.y + e.height
6325
6468
  }) <= 16 : t.x >= e.x - 12 && t.x <= e.x + e.width + 12 && t.y >= e.y - 12 && t.y <= e.y + e.height + 12;
6326
6469
  if (e.type === "image") return t.x >= e.x - 12 && t.x <= e.x + e.width + 12 && t.y >= e.y - 12 && t.y <= e.y + e.height + 12;
6327
- for (let n = 0; n < e.points.length - 2; n += 2) if (Qa(t, {
6470
+ for (let n = 0; n < e.points.length - 2; n += 2) if (oo(t, {
6328
6471
  x: e.x + e.points[n],
6329
6472
  y: e.y + e.points[n + 1]
6330
6473
  }, {
@@ -6333,19 +6476,19 @@ function Za(e, t) {
6333
6476
  }) <= 16) return !0;
6334
6477
  return !1;
6335
6478
  }
6336
- function Qa(e, t, n) {
6479
+ function oo(e, t, n) {
6337
6480
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
6338
6481
  if (a === 0) return Math.hypot(e.x - t.x, e.y - t.y);
6339
- let o = no(((e.x - t.x) * r + (e.y - t.y) * i) / a, 0, 1), s = t.x + o * r, c = t.y + o * i;
6482
+ let o = uo(((e.x - t.x) * r + (e.y - t.y) * i) / a, 0, 1), s = t.x + o * r, c = t.y + o * i;
6340
6483
  return Math.hypot(e.x - s, e.y - c);
6341
6484
  }
6342
- function $a(e) {
6485
+ function so(e) {
6343
6486
  return `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
6344
6487
  }
6345
- function eo(e, t) {
6488
+ function co(e, t) {
6346
6489
  return Math.min(t - 140, 80 + e % 5 * 70);
6347
6490
  }
6348
- function to(e) {
6491
+ function lo(e) {
6349
6492
  return e === "line" ? {
6350
6493
  height: 0,
6351
6494
  width: 210
@@ -6363,22 +6506,22 @@ function to(e) {
6363
6506
  width: 180
6364
6507
  };
6365
6508
  }
6366
- function no(e, t, n) {
6509
+ function uo(e, t, n) {
6367
6510
  return Math.min(n, Math.max(t, e));
6368
6511
  }
6369
- function ro(e) {
6370
- return Number.isFinite(e) ? Math.min(900, Math.max(220, Math.round(e ?? La))) : La;
6512
+ function fo(e) {
6513
+ return Number.isFinite(e) ? Math.min(900, Math.max(220, Math.round(e ?? Ga))) : Ga;
6371
6514
  }
6372
- function io(e) {
6373
- let t = no(e.width, .05, 1), n = no(e.height, .05, 1);
6515
+ function po(e) {
6516
+ let t = uo(e.width, .05, 1), n = uo(e.height, .05, 1);
6374
6517
  return {
6375
6518
  height: n,
6376
6519
  width: t,
6377
- x: no(e.x, 0, 1 - t),
6378
- y: no(e.y, 0, 1 - n)
6520
+ x: uo(e.x, 0, 1 - t),
6521
+ y: uo(e.y, 0, 1 - n)
6379
6522
  };
6380
6523
  }
6381
- async function ao(e) {
6524
+ async function mo(e) {
6382
6525
  let t = await new Promise((t, n) => {
6383
6526
  let r = new FileReader();
6384
6527
  r.onerror = () => n(/* @__PURE__ */ Error("Unable to read image file.")), r.onload = () => t(String(r.result)), r.readAsDataURL(e);
@@ -6396,7 +6539,7 @@ async function ao(e) {
6396
6539
  }
6397
6540
  //#endregion
6398
6541
  //#region src/exam-session/interactions/SingleChoice.tsx
6399
- function oo({ answerId: e, choices: t, value: n, onChange: r }) {
6542
+ function ho({ answerId: e, choices: t, value: n, onChange: r }) {
6400
6543
  return /* @__PURE__ */ s("div", {
6401
6544
  className: "choice-group",
6402
6545
  role: "radiogroup",
@@ -6421,4 +6564,4 @@ function oo({ answerId: e, choices: t, value: n, onChange: r }) {
6421
6564
  });
6422
6565
  }
6423
6566
  //#endregion
6424
- export { Pt as CoinTableResponse, Zt as ColorPenPicker, Qt as DEFAULT_GEOMETRY_COLORS, jr as DEFAULT_NATIVE_VOICE_AI_CONFIG, Ia as DraftSheet, Bt as DragMatch, pi as ExamSectionRenderer, mn as GeometryCanvas, Yt as HandwrittenFractionAnswer, Y as HandwrittenNumberAnswer, Un as KonvaDrawingGrid, Wn as LabelPlacement, qn as NumberLineAnswer, fr as OFFICE_SHAPE_GROUPS, nr as OperationWorkArea, lr as PrimeFactorizationAnswer, Zi as PrintableExamDocument, ea as PrintableQuestionRenderer, $i as PrintableSectionRenderer, kr as ProblemSheet, Ba as ProblemSheetComposer, gr as ProblemSheetShapeNode, Rr as PronunciationRecorder, Yi as QuestionPreviewPanel, fi as QuestionRenderer, zt as ShapeGlyph, oo as SingleChoice, qr as SortableAnswer, Yr as TextAnswer, ii as VisualSceneGraphic, Te as areEquivalentFractions, nt as calculateExamResult, Oe as createSuggestedFractionProductStep, Ae as createSuggestedFractionResultStep, ke as createSuggestedFractionSumStep, ni as createVisualSceneFromVariant, Se as evaluateFractionExpression, Ce as evaluateFractionExpressionUnreduced, Mr as evaluateVoiceAiResult, Lt as examShapeOptions, xe as formatOperationDecimal, pe as formatScoreValue, tn as getColorValue, en as getDefaultColorId, Rt as getExamShapeLabel, De as getFractionWorkSteps, Ze as getOperationAnswerId, Xe as getOperationSolvingItems, Ke as getPrimeFactorSlotCount, Ge as getPrimeFactors, mr as getProblemSheetShapeLabel, W as getQuestionMaxScore, he as getSectionMaxScore, ge as getSectionMaxScoreLabel, ri as getVisualSceneColorValue, qe as isPrimeNumber, hr as isProblemSheetSquareShape, Ee as isSimplifiedFraction, nn as mapChoicesToGeometryColors, G as normalizeOperationDecimal, ci as normalizeQuestionContentDirection, Nr as normalizeVoiceText, be as parseOperationDecimal, Je as parsePositiveWholeNumber, fe as parseScoreValue, li as resolveQuestionContentDirection, me as sectionHasQuestionScores, Qe as toOperationSolvingQuestion, ei as visualSceneColorOptions, $r as visualSceneIconOptions, ti as visualSceneStateOptions, _e as withDerivedSectionScore };
6567
+ export { Lt as CoinTableResponse, en as ColorPenPicker, tn as DEFAULT_GEOMETRY_COLORS, Ir as DEFAULT_NATIVE_VOICE_AI_CONFIG, Wa as DraftSheet, Ut as DragMatch, vi as ExamSectionRenderer, _n as GeometryCanvas, Qt as HandwrittenFractionAnswer, Y as HandwrittenNumberAnswer, Kn as KonvaDrawingGrid, qn as LabelPlacement, Xn as NumberLineAnswer, _r as OFFICE_SHAPE_GROUPS, or as OperationWorkArea, mr as PrimeFactorizationAnswer, ia as PrintableExamDocument, sa as PrintableQuestionRenderer, oa as PrintableSectionRenderer, Pr as ProblemSheet, Ja as ProblemSheetComposer, xr as ProblemSheetShapeNode, Ur as PronunciationRecorder, na as QuestionPreviewPanel, _i as QuestionRenderer, Ht as ShapeGlyph, ho as SingleChoice, Qr as SortableAnswer, ei as TextAnswer, li as VisualSceneGraphic, Te as areEquivalentFractions, at as calculateExamResult, Oe as createFractionGuidedWorkStep, si as createVisualSceneFromVariant, Se as evaluateFractionExpression, Ce as evaluateFractionExpressionUnreduced, Lr as evaluateVoiceAiResult, Bt as examShapeOptions, xe as formatOperationDecimal, pe as formatScoreValue, an as getColorValue, rn as getDefaultColorId, Vt as getExamShapeLabel, je as getFractionGuidedLaneOperators, Ae as getFractionGuidedStepOperators, De as getFractionWorkSteps, et as getOperationAnswerId, $e as getOperationSolvingItems, Ye as getPrimeFactorSlotCount, Je as getPrimeFactors, yr as getProblemSheetShapeLabel, W as getQuestionMaxScore, he as getSectionMaxScore, ge as getSectionMaxScoreLabel, ci as getVisualSceneColorValue, Xe as isPrimeNumber, br as isProblemSheetSquareShape, Ee as isSimplifiedFraction, on as mapChoicesToGeometryColors, ke as normalizeFractionWorkStep, G as normalizeOperationDecimal, pi as normalizeQuestionContentDirection, Rr as normalizeVoiceText, be as parseOperationDecimal, Ze as parsePositiveWholeNumber, fe as parseScoreValue, mi as resolveQuestionContentDirection, me as sectionHasQuestionScores, tt as toOperationSolvingQuestion, ai as visualSceneColorOptions, ii as visualSceneIconOptions, oi as visualSceneStateOptions, _e as withDerivedSectionScore };