@cuemath/leap 3.2.0-aa2 → 3.2.0

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,52 +1,51 @@
1
- import { jsx as c, jsxs as E } from "react/jsx-runtime";
2
- import { memo as b, useState as f, useRef as S, useCallback as u, useMemo as x, useEffect as p, Suspense as D } from "react";
3
- import I from "../loader/app-loader/app-loader.js";
4
- import g from "./modal.js";
5
- import L from "./modal-context.js";
1
+ import { jsxs as E, jsx as b } from "react/jsx-runtime";
2
+ import { memo as h, useState as c, useRef as x, useCallback as f, useMemo as D, useEffect as w } from "react";
3
+ import I from "./modal.js";
4
+ import S from "./modal-context.js";
6
5
  import { lockScroll as R, unlockScroll as T } from "./modal-helpers.js";
7
- const $ = 500, j = b(({ children: h, modals: m, isUserAuthenticated: t }) => {
8
- const [o, M] = f(null), [v, k] = f(void 0), [r, i] = f(!1), l = S(void 0), w = u(
6
+ const $ = 500, g = h(({ children: p, modals: u, isUserAuthenticated: t }) => {
7
+ const [o, M] = c(null), [m, C] = c(void 0), [r, i] = c(!1), l = x(void 0), v = f(
9
8
  (e, s, P) => {
10
- const d = m.find((y) => y.name === e);
9
+ const d = u.find((y) => y.name === e);
11
10
  if (!d)
12
11
  throw new Error(`Modal with name "${e}" not found`);
13
12
  if (d.isPrivate && !t)
14
13
  throw new Error(
15
14
  `Access violation: Modal "${e}" is private and user is not authenticated`
16
15
  );
17
- l.current = P, i(!1), M(d), k(s), document.body.style.overflow !== "hidden" && R();
16
+ l.current = P, i(!1), M(d), C(s), document.body.style.overflow !== "hidden" && R();
18
17
  },
19
- [t, m]
20
- ), n = u(() => {
18
+ [t, u]
19
+ ), n = f(() => {
21
20
  i(!0), T(), setTimeout(() => {
22
21
  M(null), i(!1);
23
22
  }, $);
24
- }, []), C = x(
23
+ }, []), k = D(
25
24
  () => ({
26
25
  modal: o,
27
- modalParams: v,
28
- openModal: w,
26
+ modalParams: m,
27
+ openModal: v,
29
28
  closeModal: n,
30
29
  isClosing: r
31
30
  }),
32
- [o, v, w, n, r]
33
- ), a = u(() => {
31
+ [o, m, v, n, r]
32
+ ), a = f(() => {
34
33
  var e, s;
35
34
  (o == null ? void 0 : o.isDismissable) !== !1 && !r && (n(), l.current && ((s = (e = l.current).onCloseModal) == null || s.call(e), l.current.onCloseModal = void 0));
36
35
  }, [o, n, r]);
37
- return p(() => {
36
+ return w(() => {
38
37
  !t && (o != null && o.isPrivate) && n();
39
- }, [t, o, n]), p(() => {
38
+ }, [t, o, n]), w(() => {
40
39
  const e = (s) => {
41
40
  s.key === "Escape" && a();
42
41
  };
43
42
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
44
- }, [a]), /* @__PURE__ */ c(D, { fallback: /* @__PURE__ */ c(I, { height: "100vh" }), children: /* @__PURE__ */ E(L.Provider, { value: C, children: [
45
- h,
46
- o && /* @__PURE__ */ c(g, { modal: o, isClosing: r, onClose: a })
47
- ] }) });
48
- }), z = j;
43
+ }, [a]), /* @__PURE__ */ E(S.Provider, { value: k, children: [
44
+ p,
45
+ o && /* @__PURE__ */ b(I, { modal: o, isClosing: r, onClose: a })
46
+ ] });
47
+ }), K = g;
49
48
  export {
50
- z as default
49
+ K as default
51
50
  };
52
51
  //# sourceMappingURL=modal-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal-provider.js","sources":["../../../../src/features/ui/modals/modal-provider.tsx"],"sourcesContent":["import type { IModal, IModalCallbacks, IModalContext, IModalProviderProps } from './modal-types';\nimport type { FC } from 'react';\n\nimport { memo, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport AppLoader from '../loader/app-loader/app-loader';\nimport Modal from './modal';\nimport ModalContext from './modal-context';\nimport { lockScroll, unlockScroll } from './modal-helpers';\n\nconst ANIMATION_DURATION_MS = 500; // Match the animation duration in modal.tsx\n\n/**\n * Provider component that manages modal state and provides modal context to child components\n */\nconst ModalProvider: FC<IModalProviderProps> = memo(({ children, modals, isUserAuthenticated }) => {\n const [modal, setModal] = useState<IModal | null>(null);\n const [modalParams, setModalParams] = useState<Record<string, unknown> | undefined>(undefined);\n const [isClosing, setIsClosing] = useState(false);\n const callbacksRef = useRef<IModalCallbacks | undefined>(undefined);\n /**\n * Opens a modal by name with optional parameters\n * Handles authentication check for private modals\n */\n const openModal = useCallback<IModalContext['openModal']>(\n (modalName, newModalParams, callbacks) => {\n const newModal = modals.find(m => m.name === modalName);\n\n if (!newModal) {\n throw new Error(`Modal with name \"${modalName}\" not found`);\n }\n\n if (newModal.isPrivate && !isUserAuthenticated) {\n throw new Error(\n `Access violation: Modal \"${modalName}\" is private and user is not authenticated`,\n );\n }\n\n callbacksRef.current = callbacks;\n setIsClosing(false);\n setModal(newModal);\n setModalParams(newModalParams as unknown as Record<string, unknown> | undefined);\n if (document.body.style.overflow !== 'hidden') {\n lockScroll();\n }\n },\n [isUserAuthenticated, modals],\n );\n\n const closeModal = useCallback(() => {\n setIsClosing(true);\n // Wait for the animation to complete before removing the modal\n unlockScroll();\n setTimeout(() => {\n setModal(null);\n setIsClosing(false);\n }, ANIMATION_DURATION_MS);\n }, []);\n\n const modalContent = useMemo<IModalContext>(\n () => ({\n modal,\n modalParams,\n openModal,\n closeModal,\n isClosing,\n }),\n [modal, modalParams, openModal, closeModal, isClosing],\n );\n\n const onModalDismiss = useCallback(() => {\n if (modal?.isDismissable !== false && !isClosing) {\n closeModal();\n if (callbacksRef.current) {\n callbacksRef.current.onCloseModal?.();\n callbacksRef.current.onCloseModal = undefined; // Clear callback reference\n }\n }\n }, [modal, closeModal, isClosing]);\n\n useEffect(() => {\n if (!isUserAuthenticated && modal?.isPrivate) {\n // If the modal is private and user is not authenticated, close it\n closeModal();\n }\n }, [isUserAuthenticated, modal, closeModal]);\n\n // Handle ESC key\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onModalDismiss();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [onModalDismiss]);\n\n return (\n <Suspense fallback={<AppLoader height=\"100vh\" />}>\n <ModalContext.Provider value={modalContent}>\n {children}\n {modal && <Modal modal={modal} isClosing={isClosing} onClose={onModalDismiss} />}\n </ModalContext.Provider>\n </Suspense>\n );\n});\n\nexport default ModalProvider;\n"],"names":["ANIMATION_DURATION_MS","ModalProvider","memo","children","modals","isUserAuthenticated","modal","setModal","useState","modalParams","setModalParams","isClosing","setIsClosing","callbacksRef","useRef","openModal","useCallback","modalName","newModalParams","callbacks","newModal","m","lockScroll","closeModal","unlockScroll","modalContent","useMemo","onModalDismiss","_b","_a","useEffect","handleKeyDown","e","jsx","Suspense","AppLoader","jsxs","ModalContext","Modal","ModalProvider$1"],"mappings":";;;;;;AAUA,MAAMA,IAAwB,KAKxBC,IAAyCC,EAAK,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,qBAAAC,QAA0B;AACjG,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAwB,IAAI,GAChD,CAACC,GAAaC,CAAc,IAAIF,EAA8C,MAAS,GACvF,CAACG,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1CK,IAAeC,EAAoC,MAAS,GAK5DC,IAAYC;AAAA,IAChB,CAACC,GAAWC,GAAgBC,MAAc;AACxC,YAAMC,IAAWhB,EAAO,KAAK,CAAKiB,MAAAA,EAAE,SAASJ,CAAS;AAEtD,UAAI,CAACG;AACH,cAAM,IAAI,MAAM,oBAAoBH,CAAS,aAAa;AAGxD,UAAAG,EAAS,aAAa,CAACf;AACzB,cAAM,IAAI;AAAA,UACR,4BAA4BY,CAAS;AAAA,QAAA;AAIzC,MAAAJ,EAAa,UAAUM,GACvBP,EAAa,EAAK,GAClBL,EAASa,CAAQ,GACjBV,EAAeQ,CAAgE,GAC3E,SAAS,KAAK,MAAM,aAAa,YACxBI;IAEf;AAAA,IACA,CAACjB,GAAqBD,CAAM;AAAA,EAAA,GAGxBmB,IAAaP,E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A,EACF,CAAA;AAEJ,CAAC,GAEDY,IAAetC;"}
1
+ {"version":3,"file":"modal-provider.js","sources":["../../../../src/features/ui/modals/modal-provider.tsx"],"sourcesContent":["import type { IModal, IModalCallbacks, IModalContext, IModalProviderProps } from './modal-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport Modal from './modal';\nimport ModalContext from './modal-context';\nimport { lockScroll, unlockScroll } from './modal-helpers';\n\nconst ANIMATION_DURATION_MS = 500; // Match the animation duration in modal.tsx\n\n/**\n * Provider component that manages modal state and provides modal context to child components\n */\nconst ModalProvider: FC<IModalProviderProps> = memo(({ children, modals, isUserAuthenticated }) => {\n const [modal, setModal] = useState<IModal | null>(null);\n const [modalParams, setModalParams] = useState<Record<string, unknown> | undefined>(undefined);\n const [isClosing, setIsClosing] = useState(false);\n const callbacksRef = useRef<IModalCallbacks | undefined>(undefined);\n /**\n * Opens a modal by name with optional parameters\n * Handles authentication check for private modals\n */\n const openModal = useCallback<IModalContext['openModal']>(\n (modalName, newModalParams, callbacks) => {\n const newModal = modals.find(m => m.name === modalName);\n\n if (!newModal) {\n throw new Error(`Modal with name \"${modalName}\" not found`);\n }\n\n if (newModal.isPrivate && !isUserAuthenticated) {\n throw new Error(\n `Access violation: Modal \"${modalName}\" is private and user is not authenticated`,\n );\n }\n\n callbacksRef.current = callbacks;\n setIsClosing(false);\n setModal(newModal);\n setModalParams(newModalParams as unknown as Record<string, unknown> | undefined);\n if (document.body.style.overflow !== 'hidden') {\n lockScroll();\n }\n },\n [isUserAuthenticated, modals],\n );\n\n const closeModal = useCallback(() => {\n setIsClosing(true);\n // Wait for the animation to complete before removing the modal\n unlockScroll();\n setTimeout(() => {\n setModal(null);\n setIsClosing(false);\n }, ANIMATION_DURATION_MS);\n }, []);\n\n const modalContent = useMemo<IModalContext>(\n () => ({\n modal,\n modalParams,\n openModal,\n closeModal,\n isClosing,\n }),\n [modal, modalParams, openModal, closeModal, isClosing],\n );\n\n const onModalDismiss = useCallback(() => {\n if (modal?.isDismissable !== false && !isClosing) {\n closeModal();\n if (callbacksRef.current) {\n callbacksRef.current.onCloseModal?.();\n callbacksRef.current.onCloseModal = undefined; // Clear callback reference\n }\n }\n }, [modal, closeModal, isClosing]);\n\n useEffect(() => {\n if (!isUserAuthenticated && modal?.isPrivate) {\n // If the modal is private and user is not authenticated, close it\n closeModal();\n }\n }, [isUserAuthenticated, modal, closeModal]);\n\n // Handle ESC key\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onModalDismiss();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [onModalDismiss]);\n\n return (\n <ModalContext.Provider value={modalContent}>\n {children}\n {modal && <Modal modal={modal} isClosing={isClosing} onClose={onModalDismiss} />}\n </ModalContext.Provider>\n );\n});\n\nexport default ModalProvider;\n"],"names":["ANIMATION_DURATION_MS","ModalProvider","memo","children","modals","isUserAuthenticated","modal","setModal","useState","modalParams","setModalParams","isClosing","setIsClosing","callbacksRef","useRef","openModal","useCallback","modalName","newModalParams","callbacks","newModal","m","lockScroll","closeModal","unlockScroll","modalContent","useMemo","onModalDismiss","_b","_a","useEffect","handleKeyDown","e","jsxs","ModalContext","jsx","Modal","ModalProvider$1"],"mappings":";;;;;AASA,MAAMA,IAAwB,KAKxBC,IAAyCC,EAAK,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,qBAAAC,QAA0B;AACjG,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAwB,IAAI,GAChD,CAACC,GAAaC,CAAc,IAAIF,EAA8C,MAAS,GACvF,CAACG,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1CK,IAAeC,EAAoC,MAAS,GAK5DC,IAAYC;AAAA,IAChB,CAACC,GAAWC,GAAgBC,MAAc;AACxC,YAAMC,IAAWhB,EAAO,KAAK,CAAKiB,MAAAA,EAAE,SAASJ,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C,MAAM,OAAO,oBAAoB,WAAWA,CAAa;AAAA,EAAA,GAC/D,CAACJ,CAAc,CAAC,GAGhB,gBAAAM,EAAAC,EAAa,UAAb,EAAsB,OAAOT,GAC3B,UAAA;AAAA,IAAAtB;AAAA,IACAG,KAAU,gBAAA6B,EAAAC,GAAA,EAAM,OAAA9B,GAAc,WAAAK,GAAsB,SAASgB,GAAgB;AAAA,EAChF,EAAA,CAAA;AAEJ,CAAC,GAEDU,IAAepC;"}
@@ -1,26 +1,26 @@
1
- import { jsxs as T, jsx as i, Fragment as Vt } from "react/jsx-runtime";
2
- import { memo as Xt, useMemo as R, useState as L, useRef as K, useCallback as Pt, useEffect as g } 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";
1
+ import { jsxs as L, jsx as i, Fragment as Vt } from "react/jsx-runtime";
2
+ import { memo as Xt, useMemo as p, useState as T, useRef as K, useCallback as Pt, useEffect as R, useLayoutEffect as jt } from "react";
3
+ import { IMAGES as Gt } from "../../../../assets/images/images.js";
4
+ import Yt from "../../../cue-canvas/cue-canvas.js";
5
+ import Zt from "../../../pointer-sync/pointer.js";
6
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 St } from "../constants.js";
9
- import { getPaperColorByQuestion as kt, isConceptIntroWidget as qt, scrollToQuestion as bt } from "../worksheet-helpers.js";
10
- import te from "./header/header.js";
11
- import ee from "./learnosity-question.js";
12
- import ie from "./question-backdrop/question-backdrop.js";
13
- import re from "./subjective-review.js";
14
- import oe from "./system-intros/advanced-practice-intro.js";
15
- import ne from "./system-intros/basic-practice-intro.js";
16
- import ce from "./system-intros/exit-ticket-intro.js";
17
- import ae from "./system-intros/regular-practice-intro.js";
18
- import { QuestionContainerWrapper as se, StimulusReview as le, QuestionContainer as me, QuestionWrapper as ue, LessonOverviewBanner as he, CueCanvasWrapper as de, Hint as fe, Solution as ge } from "./worksheet-question-styled.js";
19
- const Ae = Xt(
7
+ import Jt from "../../constants/events.js";
8
+ import { QUESTIONS_GAP as kt, LEARNOSITY_KEYBOARD_HEIGHT as St } from "../constants.js";
9
+ import { getPaperColorByQuestion as qt, isConceptIntroWidget as te, scrollToQuestion as bt } from "../worksheet-helpers.js";
10
+ import ee from "./header/header.js";
11
+ import ie from "./learnosity-question.js";
12
+ import re from "./question-backdrop/question-backdrop.js";
13
+ import oe from "./subjective-review.js";
14
+ import ne from "./system-intros/advanced-practice-intro.js";
15
+ import ce from "./system-intros/basic-practice-intro.js";
16
+ import ae from "./system-intros/exit-ticket-intro.js";
17
+ import se from "./system-intros/regular-practice-intro.js";
18
+ import { QuestionContainerWrapper as le, StimulusReview as me, QuestionContainer as ue, QuestionWrapper as fe, LessonOverviewBanner as he, CueCanvasWrapper as de, Hint as ge, Solution as Ee } from "./worksheet-question-styled.js";
19
+ const Me = Xt(
20
20
  ({
21
21
  userType: c,
22
22
  signedRequest: Ct,
23
- worksheetCompleted: E,
23
+ worksheetCompleted: g,
24
24
  question: n,
25
25
  response: e,
26
26
  nextQuestionId: v,
@@ -48,15 +48,15 @@ const Ae = Xt(
48
48
  onSubscribeMouseMove: et,
49
49
  setActiveQuestionId: it,
50
50
  canResolveDoubt: It,
51
- onResolveDoubt: Tt,
52
- studentId: Lt,
51
+ onResolveDoubt: Lt,
52
+ studentId: Tt,
53
53
  responses: At,
54
54
  subjectiveProps: rt
55
55
  }) => {
56
- const C = R(
57
- () => Y === "paper" ? kt(n) : void 0,
56
+ const C = p(
57
+ () => Y === "paper" ? qt(n) : void 0,
58
58
  [Y, n]
59
- ), [W, Mt] = L(), [ot, Ot] = L(), {
59
+ ), [W, Mt] = T(), [ot, Ot] = T(), {
60
60
  validation: nt,
61
61
  review: N,
62
62
  maximumAttempts: ct,
@@ -64,47 +64,47 @@ const Ae = Xt(
64
64
  teacherValidationEnabled: H,
65
65
  solutionHidden: st
66
66
  } = P, { minQuestionHeight: Nt, topOffset: lt, questionsScrollable: y, renderQuestionHeader: Qt } = j, {
67
- type: _,
67
+ type: E,
68
68
  response_id: r,
69
- stimulus_review: $,
70
- item_type: h,
69
+ stimulus_review: _,
70
+ item_type: f,
71
71
  instructor_stimulus: mt,
72
- metadata: { hints: d, solution: B, widget_reference: ut },
73
- item_reference: ht,
74
- question_number: dt,
75
- item_number: ft,
72
+ metadata: { hints: h, solution: B, widget_reference: ut },
73
+ item_reference: ft,
74
+ question_number: ht,
75
+ item_number: dt,
76
76
  item_display_number: gt
77
- } = n, Ft = !!$, x = h === "overview", m = qt(mt), f = mt === "SystemIntro", Q = m || f, Et = e == null ? void 0 : e.responseEdited, zt = R(() => {
77
+ } = n, Ft = !!_, x = f === "overview", m = te(mt), d = mt === "SystemIntro", Q = m || d, Et = e == null ? void 0 : e.responseEdited, zt = p(() => {
78
78
  const t = [];
79
- return Et && c === "TEACHER" && t.push("attempting"), a || t.push("hidden"), _ === "hotspot" && t.push("correct-answers-hidden"), a && H && _ === "clozetext" && (!m || c === "STUDENT" ? t.push("response-hidden") : t.push("response-code-hidden")), x && t.push("lesson-overview"), m && t.push("concept-intro"), f && t.push("system-intro"), t.join(" ");
79
+ return Et && c === "TEACHER" && t.push("attempting"), a || t.push("hidden"), E === "hotspot" && t.push("correct-answers-hidden"), a && H && E === "clozetext" && (!m || c === "STUDENT" ? t.push("response-hidden") : t.push("response-code-hidden")), x && t.push("lesson-overview"), m && t.push("concept-intro"), d && t.push("system-intro"), t.join(" ");
80
80
  }, [
81
81
  a,
82
82
  m,
83
83
  x,
84
- f,
85
- _,
84
+ d,
85
+ E,
86
86
  Et,
87
87
  H,
88
88
  c
89
- ]), F = K({}), z = (e == null ? void 0 : e.hintsUsed) ?? 0, [_t] = L((e == null ? void 0 : e.validatedByTeacher) ?? !1), I = K(null), D = K(null), U = R(() => d == null ? void 0 : d.slice(0, z), [d, z]), $t = R(() => c === "TEACHER" || E ? !0 : !e || !e.response || e.responseEdited ? !1 : nt, [e, c, nt, E]), pt = R(() => {
89
+ ]), F = K({}), z = (e == null ? void 0 : e.hintsUsed) ?? 0, [_t] = T((e == null ? void 0 : e.validatedByTeacher) ?? !1), I = K(null), D = K(null), U = p(() => h == null ? void 0 : h.slice(0, z), [h, z]), $t = p(() => c === "TEACHER" || g ? !0 : !e || !e.response || e.responseEdited ? !1 : nt, [e, c, nt, g]), pt = p(() => {
90
90
  if (c === "TEACHER") return !0;
91
91
  if (N) {
92
92
  const { attemptsHistory: t } = e ?? {};
93
93
  return ((t == null ? void 0 : t.length) ?? 0) >= ct && !at;
94
94
  }
95
95
  return !1;
96
- }, [at, ct, e, N, c]), Dt = R(
97
- () => B && E && !st,
98
- [st, B, E]
99
- ), [Rt, Ut] = L({
96
+ }, [at, ct, e, N, c]), Dt = p(
97
+ () => B && g && !st,
98
+ [st, B, g]
99
+ ), [Rt, Ut] = T({
100
100
  width: 0,
101
101
  height: 0
102
102
  }), Kt = Pt((t) => {
103
103
  Ot(t);
104
104
  }, []);
105
- return g(() => {
105
+ return R(() => {
106
106
  I.current && G.observe(I.current);
107
- }, [G]), g(() => {
107
+ }, [G]), R(() => {
108
108
  if (a && (n.type === "clozeassociation" || n.type === "association" || n.type === "clozeformula")) {
109
109
  const t = document.querySelectorAll(
110
110
  `.widget-${n.response_id} .lrn_draggable`
@@ -117,29 +117,29 @@ const Ae = Xt(
117
117
  height: o
118
118
  });
119
119
  }
120
- }, [a, n.response_id, n.type]), g(() => {
120
+ }, [a, n.response_id, n.type]), R(() => {
121
121
  if (a && $t) {
122
122
  const t = b.question(r);
123
123
  t && t.validate({
124
124
  showCorrectAnswers: pt
125
125
  });
126
126
  }
127
- }, [a, b, r, N, pt, c, $t]), g(() => {
127
+ }, [a, b, r, N, pt, c, $t]), R(() => {
128
128
  const t = D.current;
129
- if (a && t && M.current && F.current[r] === void 0 && !m && !f) {
129
+ if (a && t && M.current && F.current[r] === void 0 && !m && !d) {
130
130
  const s = t.clientWidth, o = t.querySelectorAll("*");
131
131
  for (let l = 0; l < o.length; l++) {
132
132
  const u = o[l];
133
133
  if (u != null && u.closest(".resize-sensor"))
134
134
  continue;
135
135
  if (((u == null ? void 0 : u.clientWidth) ?? 0) > s) {
136
- F.current[r] = !0, M.current(Zt.WORKSHEET_V3_GREATER_WIDTH_ELEMENT, {
137
- item_reference: ht,
136
+ F.current[r] = !0, M.current(Jt.WORKSHEET_V3_GREATER_WIDTH_ELEMENT, {
137
+ item_reference: ft,
138
138
  widget_reference: ut,
139
- question_type: _,
140
- question_number: dt,
139
+ question_type: E,
140
+ question_number: ht,
141
141
  responseId: r,
142
- item_number: ft,
142
+ item_number: dt,
143
143
  item_display_number: gt
144
144
  });
145
145
  break;
@@ -150,40 +150,40 @@ const Ae = Xt(
150
150
  }, [
151
151
  a,
152
152
  m,
153
- f,
153
+ d,
154
154
  gt,
155
+ dt,
155
156
  ft,
156
- ht,
157
157
  M,
158
- _,
159
- dt,
158
+ E,
159
+ ht,
160
160
  r,
161
161
  ut
162
- ]), g(() => {
162
+ ]), R(() => {
163
163
  const t = I.current, s = (o) => {
164
164
  const l = o.querySelector(".lrn_response_wrapper");
165
165
  if (Q || !l)
166
166
  return 0;
167
- const u = o.getBoundingClientRect().bottom, S = l.getBoundingClientRect().bottom, p = Math.abs(u - S);
168
- return p < St ? St - p : 0;
167
+ const u = o.getBoundingClientRect().bottom, S = l.getBoundingClientRect().bottom, $ = Math.abs(u - S);
168
+ return $ < St ? St - $ : 0;
169
169
  };
170
170
  a && t && Mt((o) => {
171
171
  var wt;
172
- const S = ((wt = n.ui_style) == null ? void 0 : wt.type) === "floating-keyboard" && !(H && _ === "clozetext"), p = t.clientHeight;
173
- if (p === 0)
172
+ const S = ((wt = n.ui_style) == null ? void 0 : wt.type) === "floating-keyboard" && !(H && E === "clozetext"), $ = t.clientHeight;
173
+ if ($ === 0)
174
174
  return o;
175
175
  if (!o)
176
176
  return Math.ceil(
177
- p + (S ? s(t) : 0)
177
+ $ + (S ? s(t) : 0)
178
178
  );
179
179
  const vt = Math.ceil(
180
- p + (S ? s(t) : 0)
180
+ $ + (S ? s(t) : 0)
181
181
  );
182
182
  return Math.abs(vt - o) > 4 ? vt : o;
183
- }), (z || Ft || B && E) && b.renderMath("mathjax");
184
- }), g(() => {
183
+ }), (z || Ft || B && g) && b.renderMath("mathjax");
184
+ }), jt(() => {
185
185
  !y && !A && bt(r);
186
- }, [A, y, r, lt]), g(() => {
186
+ }, [A, y, r, lt]), R(() => {
187
187
  if (H && v && !_t && (e != null && e.validatedByTeacher)) {
188
188
  const t = setTimeout(() => {
189
189
  y ? bt(v) : it(v);
@@ -199,38 +199,38 @@ const Ae = Xt(
199
199
  y,
200
200
  it,
201
201
  e == null ? void 0 : e.validatedByTeacher
202
- ]), /* @__PURE__ */ T(
203
- se,
202
+ ]), /* @__PURE__ */ L(
203
+ le,
204
204
  {
205
205
  "data-response-id": r,
206
206
  className: `widget-${r}`,
207
207
  ref: I,
208
208
  $topOffset: lt,
209
- $flexDirection: $ ? "row" : "column",
210
- $alignItems: $ ? "flex-start" : "center",
209
+ $flexDirection: _ ? "row" : "column",
210
+ $alignItems: _ ? "flex-start" : "center",
211
211
  $hidden: A,
212
- $marginBottom: Jt,
212
+ $marginBottom: kt,
213
213
  children: [
214
- $ && /* @__PURE__ */ i(
215
- le,
214
+ _ && /* @__PURE__ */ i(
215
+ me,
216
216
  {
217
217
  dangerouslySetInnerHTML: {
218
- __html: $
218
+ __html: _
219
219
  }
220
220
  }
221
221
  ),
222
- /* @__PURE__ */ T(
223
- me,
222
+ /* @__PURE__ */ L(
223
+ ue,
224
224
  {
225
225
  ref: D,
226
- $width: $ ? "50%" : `${X}px`,
226
+ $width: _ ? "50%" : `${X}px`,
227
227
  $minHeight: W ? Math.max(W - 72, ot ?? 0) : Nt,
228
228
  $isActive: w,
229
229
  $paperColor: C,
230
230
  $opacity: w ? 1 : 0.2,
231
231
  children: [
232
232
  w && !!tt && !!et && q && /* @__PURE__ */ i(
233
- Yt,
233
+ Zt,
234
234
  {
235
235
  containerRef: D,
236
236
  onPublish: tt,
@@ -238,15 +238,15 @@ const Ae = Xt(
238
238
  responseId: r
239
239
  }
240
240
  ),
241
- /* @__PURE__ */ T(
242
- ue,
241
+ /* @__PURE__ */ L(
242
+ fe,
243
243
  {
244
244
  className: zt,
245
245
  $dropzoneMinWidth: Rt.width,
246
246
  $dropzoneMinHeight: Rt.height,
247
247
  children: [
248
- Qt && !(x || m || f) && /* @__PURE__ */ i(
249
- te,
248
+ Qt && !(x || m || d) && /* @__PURE__ */ i(
249
+ ee,
250
250
  {
251
251
  userType: c,
252
252
  question: n,
@@ -257,20 +257,20 @@ const Ae = Xt(
257
257
  onMarkForReview: Bt,
258
258
  actionbarHeight: Wt,
259
259
  canResolveDoubt: It,
260
- onResolveDoubt: Tt,
261
- worksheetCompleted: E
260
+ onResolveDoubt: Lt,
261
+ worksheetCompleted: g
262
262
  }
263
263
  ),
264
- x && /* @__PURE__ */ i(he, { src: jt.LESSON_OVERVIEW_BANNER }),
265
- m && C && /* @__PURE__ */ i(ie, { paperColor: C }),
266
- f ? /* @__PURE__ */ T(Vt, { children: [
267
- h === "practice-basic" && /* @__PURE__ */ i(ne, {}),
268
- h === "practice-regular" && /* @__PURE__ */ i(ae, {}),
269
- h === "exit-ticket" && /* @__PURE__ */ i(ce, {}),
270
- (h == null ? void 0 : h.startsWith("advanced-")) && /* @__PURE__ */ i(oe, {})
264
+ x && /* @__PURE__ */ i(he, { src: Gt.LESSON_OVERVIEW_BANNER }),
265
+ m && C && /* @__PURE__ */ i(re, { paperColor: C }),
266
+ d ? /* @__PURE__ */ L(Vt, { children: [
267
+ f === "practice-basic" && /* @__PURE__ */ i(ce, {}),
268
+ f === "practice-regular" && /* @__PURE__ */ i(se, {}),
269
+ f === "exit-ticket" && /* @__PURE__ */ i(ae, {}),
270
+ (f == null ? void 0 : f.startsWith("advanced-")) && /* @__PURE__ */ i(ne, {})
271
271
  ] }) : void 0,
272
272
  /* @__PURE__ */ i(
273
- ee,
273
+ ie,
274
274
  {
275
275
  signedRequest: Ct,
276
276
  appended: a,
@@ -285,7 +285,7 @@ const Ae = Xt(
285
285
  }
286
286
  ),
287
287
  !Q && q && Z && J && W !== void 0 && /* @__PURE__ */ i(de, { $canScribble: k, children: /* @__PURE__ */ i(
288
- Gt,
288
+ Yt,
289
289
  {
290
290
  canRender: V,
291
291
  canScribble: k && w,
@@ -310,10 +310,10 @@ const Ae = Xt(
310
310
  $borderRadiusX: 0,
311
311
  $borderColor: "BLUE_2",
312
312
  children: U.map((t, s) => /* @__PURE__ */ i(
313
- fe,
313
+ ge,
314
314
  {
315
315
  dangerouslySetInnerHTML: {
316
- __html: `<span style="color: #DA5107; font-weight: 600;">Hint${((d == null ? void 0 : d.length) ?? 0) > 1 ? ` ${s + 1}` : ""}:</span>&nbsp;${t}`
316
+ __html: `<span style="color: #DA5107; font-weight: 600;">Hint${((h == null ? void 0 : h.length) ?? 0) > 1 ? ` ${s + 1}` : ""}:</span>&nbsp;${t}`
317
317
  }
318
318
  },
319
319
  t
@@ -329,7 +329,7 @@ const Ae = Xt(
329
329
  $borderRadiusX: 0,
330
330
  $borderColor: "YELLOW_2",
331
331
  children: /* @__PURE__ */ i(
332
- ge,
332
+ Ee,
333
333
  {
334
334
  dangerouslySetInnerHTML: {
335
335
  __html: `<div style="color: #DA5107; font-weight: 600;">Solution:</div>${B}`
@@ -339,13 +339,13 @@ const Ae = Xt(
339
339
  }
340
340
  ),
341
341
  !!rt && /* @__PURE__ */ i(
342
- re,
342
+ oe,
343
343
  {
344
344
  responses: At,
345
345
  response: e,
346
346
  nextQuestionId: v,
347
347
  responseId: r,
348
- studentId: Lt,
348
+ studentId: Tt,
349
349
  userType: c,
350
350
  ...rt
351
351
  }
@@ -362,6 +362,6 @@ const Ae = Xt(
362
362
  }
363
363
  );
364
364
  export {
365
- Ae as default
365
+ Me as default
366
366
  };
367
367
  //# sourceMappingURL=worksheet-question.js.map