@cuemath/leap 2.9.7-akm-1 → 2.9.7-gg1

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.
@@ -1,30 +1,30 @@
1
- import { jsxs as I, jsx as r, Fragment as Ut } from "react/jsx-runtime";
2
- import { memo as Kt, useMemo as R, useState as A, useRef as U, useCallback as Vt, useEffect as E, useLayoutEffect as Xt } from "react";
3
- import { IMAGES as Pt } from "../../../../assets/images/images.js";
4
- import jt from "../../../cue-canvas/cue-canvas.js";
5
- import Gt from "../../../pointer-sync/pointer.js";
6
- import bt from "../../../ui/layout/flex-view.js";
7
- import Yt from "../../constants/events.js";
8
- import { QUESTIONS_GAP as Zt, LEARNOSITY_KEYBOARD_HEIGHT as St } from "../constants.js";
9
- import { getPaperColorByQuestion as Jt, isConceptIntroWidget as qt, scrollToQuestion as Wt } from "../worksheet-helpers.js";
10
- import kt from "./header/header.js";
11
- import te from "./learnosity-question.js";
12
- import ee from "./question-backdrop/question-backdrop.js";
13
- import re from "./subjective-review.js";
14
- import ie from "./system-intros/advanced-practice-intro.js";
15
- import oe from "./system-intros/basic-practice-intro.js";
16
- import ne from "./system-intros/exit-ticket-intro.js";
17
- import ce from "./system-intros/regular-practice-intro.js";
18
- import { QuestionContainerWrapper as ae, StimulusReview as se, QuestionContainer as le, QuestionWrapper as me, LessonOverviewBanner as ue, CueCanvasWrapper as fe, Hint as he, Solution as de } from "./worksheet-question-styled.js";
19
- const Ie = Kt(
1
+ import { jsxs as I, jsx as e, Fragment as Kt } from "react/jsx-runtime";
2
+ import { memo as Vt, useMemo as R, useState as A, useRef as U, useCallback as Xt, useEffect as E, useLayoutEffect as Pt } from "react";
3
+ import { IMAGES as jt } from "../../../../assets/images/images.js";
4
+ import Gt from "../../../cue-canvas/cue-canvas.js";
5
+ import Yt from "../../../pointer-sync/pointer.js";
6
+ import Ht from "../../../ui/layout/flex-view.js";
7
+ import Zt from "../../constants/events.js";
8
+ import { QUESTIONS_GAP as Jt, LEARNOSITY_KEYBOARD_HEIGHT as bt } from "../constants.js";
9
+ import { getPaperColorByQuestion as qt, isConceptIntroWidget as kt, scrollToQuestion as Wt } from "../worksheet-helpers.js";
10
+ import ti from "./header/header.js";
11
+ import ii from "./learnosity-question.js";
12
+ import ei from "./question-backdrop/question-backdrop.js";
13
+ import ri from "./subjective-review.js";
14
+ import oi from "./system-intros/advanced-practice-intro.js";
15
+ import ni from "./system-intros/basic-practice-intro.js";
16
+ import ci from "./system-intros/exit-ticket-intro.js";
17
+ import ai from "./system-intros/regular-practice-intro.js";
18
+ import { QuestionContainerWrapper as si, StimulusReview as mi, QuestionContainer as li, QuestionWrapper as ui, LessonOverviewBanner as fi, CueCanvasWrapper as hi, Hint as di, Solution as gi } from "./worksheet-question-styled.js";
19
+ const Ai = Vt(
20
20
  ({
21
21
  userType: c,
22
22
  signedRequest: Ct,
23
23
  worksheetCompleted: f,
24
24
  question: n,
25
- response: e,
26
- nextQuestionId: v,
27
- isActive: w,
25
+ response: i,
26
+ nextQuestionId: S,
27
+ isActive: v,
28
28
  isHidden: M,
29
29
  canRender: K,
30
30
  loggerRef: O,
@@ -33,11 +33,12 @@ const Ie = Kt(
33
33
  behavior: X,
34
34
  layout: P,
35
35
  actionbarHeight: yt,
36
- learnosity: H,
36
+ learnosity: w,
37
37
  intersectionObserver: j,
38
38
  background: G = "paper",
39
- onMarkForReview: Bt,
40
- userId: xt,
39
+ onMediaStateChange: Bt,
40
+ onMarkForReview: xt,
41
+ userId: Lt,
41
42
  onPublishStrokes: Y,
42
43
  onReceiveStrokes: Z,
43
44
  isScribblingEnabled: J,
@@ -45,61 +46,61 @@ const Ie = Kt(
45
46
  isCanvasEnabled: q,
46
47
  onPublishMouseMove: k,
47
48
  onSubscribeMouseMove: tt,
48
- setActiveQuestionId: et,
49
- canResolveDoubt: Lt,
50
- onResolveDoubt: Tt,
51
- studentId: It,
52
- responses: At,
53
- subjectiveProps: rt
49
+ setActiveQuestionId: it,
50
+ canResolveDoubt: Tt,
51
+ onResolveDoubt: It,
52
+ studentId: At,
53
+ responses: Mt,
54
+ subjectiveProps: et
54
55
  }) => {
55
56
  const C = R(
56
- () => G === "paper" ? Jt(n) : void 0,
57
+ () => G === "paper" ? qt(n) : void 0,
57
58
  [G, n]
58
- ), [y, Mt] = A(), [it, Ot] = A(), {
59
+ ), [y, Ot] = A(), [rt, Nt] = A(), {
59
60
  validation: ot,
60
61
  review: Q,
61
62
  maximumAttempts: nt,
62
63
  canExceedAttempts: ct,
63
- teacherValidationEnabled: b,
64
+ teacherValidationEnabled: H,
64
65
  solutionHidden: at
65
- } = X, { minQuestionHeight: Nt, topOffset: st, questionsScrollable: B } = P, {
66
+ } = X, { minQuestionHeight: Qt, topOffset: st, questionsScrollable: B } = P, {
66
67
  type: _,
67
- response_id: i,
68
+ response_id: r,
68
69
  stimulus_review: $,
69
70
  item_type: h,
70
- instructor_stimulus: lt,
71
- metadata: { hints: d, solution: S, widget_reference: mt },
71
+ instructor_stimulus: mt,
72
+ metadata: { hints: d, solution: b, widget_reference: lt },
72
73
  item_reference: ut,
73
74
  question_number: ft,
74
75
  item_number: ht,
75
76
  item_display_number: dt
76
- } = n, gt = !!$, x = h === "overview", m = qt(lt), g = lt === "SystemIntro", Et = m || g, _t = e == null ? void 0 : e.responseEdited, Qt = R(() => {
77
+ } = n, gt = !!$, x = h === "overview", l = kt(mt), g = mt === "SystemIntro", Et = l || g, _t = i == null ? void 0 : i.responseEdited, Ft = R(() => {
77
78
  const t = [];
78
- return _t && c === "TEACHER" && t.push("attempting"), a || t.push("hidden"), _ === "hotspot" && t.push("correct-answers-hidden"), a && b && _ === "clozetext" && (!m || c === "STUDENT" ? t.push("response-hidden") : t.push("response-code-hidden")), x && t.push("lesson-overview"), m && t.push("concept-intro"), g && t.push("system-intro"), t.join(" ");
79
+ return _t && c === "TEACHER" && t.push("attempting"), a || t.push("hidden"), _ === "hotspot" && t.push("correct-answers-hidden"), a && H && _ === "clozetext" && (!l || c === "STUDENT" ? t.push("response-hidden") : t.push("response-code-hidden")), x && t.push("lesson-overview"), l && t.push("concept-intro"), g && t.push("system-intro"), t.join(" ");
79
80
  }, [
80
81
  a,
81
- m,
82
+ l,
82
83
  x,
83
84
  g,
84
85
  _,
85
86
  _t,
86
- b,
87
+ H,
87
88
  c
88
- ]), F = U({}), L = (e == null ? void 0 : e.hintsUsed) ?? 0, [$t] = A((e == null ? void 0 : e.validatedByTeacher) ?? !1), T = U(null), z = U(null), D = R(() => d == null ? void 0 : d.slice(0, L), [d, L]), pt = R(() => c === "TEACHER" || f ? !0 : !e || !e.response || e.responseEdited ? !1 : ot, [e, c, ot, f]), Rt = R(() => {
89
+ ]), F = U({}), L = (i == null ? void 0 : i.hintsUsed) ?? 0, [$t] = A((i == null ? void 0 : i.validatedByTeacher) ?? !1), T = U(null), z = U(null), D = R(() => d == null ? void 0 : d.slice(0, L), [d, L]), pt = R(() => c === "TEACHER" || f ? !0 : !i || !i.response || i.responseEdited ? !1 : ot, [i, c, ot, f]), Rt = R(() => {
89
90
  if (c === "TEACHER") return !0;
90
91
  if (Q) {
91
- const { attemptsHistory: t } = e ?? {};
92
+ const { attemptsHistory: t } = i ?? {};
92
93
  return ((t == null ? void 0 : t.length) ?? 0) >= nt && !ct;
93
94
  }
94
95
  return !1;
95
- }, [ct, nt, e, Q, c]), Ft = R(
96
- () => S && f && !at,
97
- [at, S, f]
98
- ), [vt, zt] = A({
96
+ }, [ct, nt, i, Q, c]), zt = R(
97
+ () => b && f && !at,
98
+ [at, b, f]
99
+ ), [St, Dt] = A({
99
100
  width: 0,
100
101
  height: 0
101
- }), Dt = Vt((t) => {
102
- Ot(t);
102
+ }), Ut = Xt((t) => {
103
+ Nt(t);
103
104
  }, []);
104
105
  return E(() => {
105
106
  T.current && j.observe(T.current);
@@ -109,46 +110,46 @@ const Ie = Kt(
109
110
  `.widget-${n.response_id} .lrn_draggable`
110
111
  );
111
112
  let s = 0, o = 0;
112
- t.forEach((l) => {
113
- s = Math.max(s, l.clientWidth + 33), o = Math.max(o, l.clientHeight + 1);
114
- }), zt({
113
+ t.forEach((m) => {
114
+ s = Math.max(s, m.clientWidth + 33), o = Math.max(o, m.clientHeight + 1);
115
+ }), Dt({
115
116
  width: n.type !== "association" ? s : 0,
116
117
  height: o
117
118
  });
118
119
  }
119
120
  }, [a, n.response_id, n.type]), E(() => {
120
121
  if (a && pt) {
121
- const t = H.question(i);
122
+ const t = w.question(r);
122
123
  t && t.validate({
123
124
  showCorrectAnswers: Rt
124
125
  });
125
126
  }
126
- }, [a, H, i, Q, Rt, c, pt]), E(() => {
127
+ }, [a, w, r, Q, Rt, c, pt]), E(() => {
127
128
  const t = z.current;
128
- if (a && t && O.current && F.current[i] === void 0 && !m && !g) {
129
+ if (a && t && O.current && F.current[r] === void 0 && !l && !g) {
129
130
  const s = t.clientWidth, o = t.querySelectorAll("*");
130
- for (let l = 0; l < o.length; l++) {
131
- const u = o[l];
131
+ for (let m = 0; m < o.length; m++) {
132
+ const u = o[m];
132
133
  if (u != null && u.closest(".resize-sensor"))
133
134
  continue;
134
135
  if (((u == null ? void 0 : u.clientWidth) ?? 0) > s) {
135
- F.current[i] = !0, O.current(Yt.WORKSHEET_V3_GREATER_WIDTH_ELEMENT, {
136
+ F.current[r] = !0, O.current(Zt.WORKSHEET_V3_GREATER_WIDTH_ELEMENT, {
136
137
  item_reference: ut,
137
- widget_reference: mt,
138
+ widget_reference: lt,
138
139
  question_type: _,
139
140
  question_number: ft,
140
- responseId: i,
141
+ responseId: r,
141
142
  item_number: ht,
142
143
  item_display_number: dt
143
144
  });
144
145
  break;
145
146
  }
146
147
  }
147
- F.current[i] = !1;
148
+ F.current[r] = !1;
148
149
  }
149
150
  }, [
150
151
  a,
151
- m,
152
+ l,
152
153
  g,
153
154
  dt,
154
155
  ht,
@@ -156,64 +157,64 @@ const Ie = Kt(
156
157
  O,
157
158
  _,
158
159
  ft,
159
- i,
160
- mt
160
+ r,
161
+ lt
161
162
  ]), E(() => {
162
163
  const t = T.current, s = (o) => {
163
- const l = o.querySelector(".lrn_response_wrapper");
164
- if (!l)
164
+ const m = o.querySelector(".lrn_response_wrapper");
165
+ if (!m)
165
166
  return 0;
166
- const u = o.getBoundingClientRect().bottom, W = l.getBoundingClientRect().bottom, p = Math.abs(u - W);
167
- return p < St ? St - p : 0;
167
+ const u = o.getBoundingClientRect().bottom, W = m.getBoundingClientRect().bottom, p = Math.abs(u - W);
168
+ return p < bt ? bt - p : 0;
168
169
  };
169
- a && t && Mt((o) => {
170
- var Ht;
171
- const W = ((Ht = n.ui_style) == null ? void 0 : Ht.type) === "floating-keyboard" && !(b && _ === "clozetext"), p = t.clientHeight;
170
+ a && t && Ot((o) => {
171
+ var wt;
172
+ const W = ((wt = n.ui_style) == null ? void 0 : wt.type) === "floating-keyboard" && !(H && _ === "clozetext"), p = t.clientHeight;
172
173
  if (p === 0)
173
174
  return o;
174
175
  if (!o)
175
176
  return Math.ceil(
176
177
  p + (W ? s(t) : 0)
177
178
  );
178
- const wt = Math.ceil(
179
+ const vt = Math.ceil(
179
180
  p + (W ? s(t) : 0)
180
181
  );
181
- return Math.abs(wt - o) > 4 ? wt : o;
182
+ return Math.abs(vt - o) > 4 ? vt : o;
182
183
  });
183
- }), Xt(() => {
184
- !B && !M && Wt(i);
185
- }, [M, B, i, st]), E(() => {
186
- (L || gt || S && f) && H.renderMath("mathjax");
187
- }, [gt, L, H, S, f]), E(() => {
188
- if (b && v && !$t && (e != null && e.validatedByTeacher)) {
184
+ }), Pt(() => {
185
+ !B && !M && Wt(r);
186
+ }, [M, B, r, st]), E(() => {
187
+ (L || gt || b && f) && w.renderMath("mathjax");
188
+ }, [gt, L, w, b, f]), E(() => {
189
+ if (H && S && !$t && (i != null && i.validatedByTeacher)) {
189
190
  const t = setTimeout(() => {
190
- B ? Wt(v) : et(v);
191
+ B ? Wt(S) : it(S);
191
192
  }, 1e3);
192
193
  return () => {
193
194
  clearTimeout(t);
194
195
  };
195
196
  }
196
197
  }, [
197
- v,
198
- b,
198
+ S,
199
+ H,
199
200
  $t,
200
201
  B,
201
- et,
202
- e == null ? void 0 : e.validatedByTeacher
202
+ it,
203
+ i == null ? void 0 : i.validatedByTeacher
203
204
  ]), /* @__PURE__ */ I(
204
- ae,
205
+ si,
205
206
  {
206
- "data-response-id": i,
207
- className: `widget-${i}`,
207
+ "data-response-id": r,
208
+ className: `widget-${r}`,
208
209
  ref: T,
209
210
  $topOffset: st,
210
211
  $flexDirection: $ ? "row" : "column",
211
212
  $alignItems: $ ? "flex-start" : "center",
212
213
  $hidden: M,
213
- $marginBottom: Zt,
214
+ $marginBottom: Jt,
214
215
  children: [
215
- $ && /* @__PURE__ */ r(
216
- se,
216
+ $ && /* @__PURE__ */ e(
217
+ mi,
217
218
  {
218
219
  dangerouslySetInnerHTML: {
219
220
  __html: $
@@ -221,95 +222,97 @@ const Ie = Kt(
221
222
  }
222
223
  ),
223
224
  /* @__PURE__ */ I(
224
- le,
225
+ li,
225
226
  {
226
227
  ref: z,
227
228
  $width: $ ? "50%" : `${V}px`,
228
- $minHeight: y ? Math.max(y - 72, it ?? 0) : Nt,
229
- $isActive: w,
229
+ $minHeight: y ? Math.max(y - 72, rt ?? 0) : Qt,
230
+ $isActive: v,
230
231
  $paperColor: C,
231
- $opacity: w ? 1 : 0.2,
232
+ $opacity: v ? 1 : 0.2,
232
233
  children: [
233
- w && !!k && !!tt && q && /* @__PURE__ */ r(
234
- Gt,
234
+ v && !!k && !!tt && q && /* @__PURE__ */ e(
235
+ Yt,
235
236
  {
236
237
  containerRef: z,
237
238
  onPublish: k,
238
239
  onSubscribe: tt,
239
- responseId: i
240
+ responseId: r
240
241
  }
241
242
  ),
242
243
  /* @__PURE__ */ I(
243
- me,
244
+ ui,
244
245
  {
245
- className: Qt,
246
- $dropzoneMinWidth: vt.width,
247
- $dropzoneMinHeight: vt.height,
246
+ className: Ft,
247
+ $dropzoneMinWidth: St.width,
248
+ $dropzoneMinHeight: St.height,
248
249
  children: [
249
- !(x || m || g) && /* @__PURE__ */ r(
250
- kt,
250
+ !(x || l || g) && /* @__PURE__ */ e(
251
+ ti,
251
252
  {
252
253
  userType: c,
253
254
  question: n,
254
- response: e,
255
+ response: i,
255
256
  behavior: X,
256
257
  layout: P,
257
258
  paperColor: C,
258
- onMarkForReview: Bt,
259
+ onMarkForReview: xt,
259
260
  actionbarHeight: yt,
260
- canResolveDoubt: Lt,
261
- onResolveDoubt: Tt,
261
+ canResolveDoubt: Tt,
262
+ onResolveDoubt: It,
262
263
  worksheetCompleted: f
263
264
  }
264
265
  ),
265
- x && /* @__PURE__ */ r(ue, { src: Pt.LESSON_OVERVIEW_BANNER }),
266
- m && C && /* @__PURE__ */ r(ee, { paperColor: C }),
267
- g ? /* @__PURE__ */ I(Ut, { children: [
268
- h === "practice-basic" && /* @__PURE__ */ r(oe, {}),
269
- h === "practice-regular" && /* @__PURE__ */ r(ce, {}),
270
- h === "exit-ticket" && /* @__PURE__ */ r(ne, {}),
271
- (h == null ? void 0 : h.startsWith("advanced-")) && /* @__PURE__ */ r(ie, {})
266
+ x && /* @__PURE__ */ e(fi, { src: jt.LESSON_OVERVIEW_BANNER }),
267
+ l && C && /* @__PURE__ */ e(ei, { paperColor: C }),
268
+ g ? /* @__PURE__ */ I(Kt, { children: [
269
+ h === "practice-basic" && /* @__PURE__ */ e(ni, {}),
270
+ h === "practice-regular" && /* @__PURE__ */ e(ai, {}),
271
+ h === "exit-ticket" && /* @__PURE__ */ e(ci, {}),
272
+ (h == null ? void 0 : h.startsWith("advanced-")) && /* @__PURE__ */ e(oi, {})
272
273
  ] }) : void 0,
273
- /* @__PURE__ */ r(
274
- te,
274
+ /* @__PURE__ */ e(
275
+ ii,
275
276
  {
276
277
  signedRequest: Ct,
277
278
  appended: a,
278
279
  question: n,
279
- response: e == null ? void 0 : e.response,
280
- canRender: K || w,
281
- learnosity: H,
280
+ response: i == null ? void 0 : i.response,
281
+ canRender: K || v,
282
+ learnosity: w,
282
283
  canForceAppend: c === "TEACHER",
283
- isConceptIntro: m
284
+ isConceptIntro: l,
285
+ simState: i == null ? void 0 : i.simState,
286
+ onMediaStateChange: Bt
284
287
  }
285
288
  ),
286
- !Et && q && Y && Z && y !== void 0 && /* @__PURE__ */ r(fe, { $canScribble: J, children: /* @__PURE__ */ r(
287
- jt,
289
+ !Et && q && Y && Z && y !== void 0 && /* @__PURE__ */ e(hi, { $canScribble: J, children: /* @__PURE__ */ e(
290
+ Gt,
288
291
  {
289
292
  canRender: K,
290
- canScribble: J && w,
293
+ canScribble: J && v,
291
294
  appended: a,
292
- responseId: i,
295
+ responseId: r,
293
296
  width: V,
294
- height: Math.max(y, it ?? 0),
295
- onUpdateHeight: Dt,
297
+ height: Math.max(y, rt ?? 0),
298
+ onUpdateHeight: Ut,
296
299
  onPublish: Y,
297
300
  onSubscribe: Z,
298
- userId: xt,
299
- initialData: N == null ? void 0 : N[i],
301
+ userId: Lt,
302
+ initialData: N == null ? void 0 : N[r],
300
303
  userType: c
301
304
  }
302
305
  ) }),
303
- !Et && D && D.length > 0 && /* @__PURE__ */ r(
304
- bt,
306
+ !Et && D && D.length > 0 && /* @__PURE__ */ e(
307
+ Ht,
305
308
  {
306
309
  $background: "BLUE_1",
307
310
  $gutterX: 1,
308
311
  $gapX: 0.5,
309
312
  $borderRadiusX: 0,
310
313
  $borderColor: "BLUE_2",
311
- children: D.map((t, s) => /* @__PURE__ */ r(
312
- he,
314
+ children: D.map((t, s) => /* @__PURE__ */ e(
315
+ di,
313
316
  {
314
317
  dangerouslySetInnerHTML: {
315
318
  __html: `<span style="color: #DA5107; font-weight: 600;">Hint${((d == null ? void 0 : d.length) ?? 0) > 1 ? ` ${s + 1}` : ""}:</span>&nbsp;${t}`
@@ -319,34 +322,34 @@ const Ie = Kt(
319
322
  ))
320
323
  }
321
324
  ),
322
- Ft && /* @__PURE__ */ r(
323
- bt,
325
+ zt && /* @__PURE__ */ e(
326
+ Ht,
324
327
  {
325
328
  $background: "YELLOW_1",
326
329
  $gutterX: 1,
327
330
  $gapX: 0.875,
328
331
  $borderRadiusX: 0,
329
332
  $borderColor: "YELLOW_2",
330
- children: /* @__PURE__ */ r(
331
- de,
333
+ children: /* @__PURE__ */ e(
334
+ gi,
332
335
  {
333
336
  dangerouslySetInnerHTML: {
334
- __html: `<div style="color: #DA5107; font-weight: 600;">Solution:</div>${S}`
337
+ __html: `<div style="color: #DA5107; font-weight: 600;">Solution:</div>${b}`
335
338
  }
336
339
  }
337
340
  )
338
341
  }
339
342
  ),
340
- !!rt && /* @__PURE__ */ r(
341
- re,
343
+ !!et && /* @__PURE__ */ e(
344
+ ri,
342
345
  {
343
- responses: At,
344
- response: e,
345
- nextQuestionId: v,
346
- responseId: i,
347
- studentId: It,
346
+ responses: Mt,
347
+ response: i,
348
+ nextQuestionId: S,
349
+ responseId: r,
350
+ studentId: At,
348
351
  userType: c,
349
- ...rt
352
+ ...et
350
353
  }
351
354
  )
352
355
  ]
@@ -361,6 +364,6 @@ const Ie = Kt(
361
364
  }
362
365
  );
363
366
  export {
364
- Ie as default
367
+ Ai as default
365
368
  };
366
369
  //# sourceMappingURL=worksheet-question.js.map