@cuemath/leap 3.1.45 → 3.1.46-beta-0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/worksheet/worksheet/worksheet-action-bar/worksheet-action-bar.js +55 -51
- package/dist/features/worksheet/worksheet/worksheet-action-bar/worksheet-action-bar.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +108 -91
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js +66 -66
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js +249 -204
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +314 -302
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/dynamic-worksheet-preview/dynamic-worksheet-preview.js +29 -27
- package/dist/features/worksheet/worksheet-preview/dynamic-worksheet-preview/dynamic-worksheet-preview.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +32 -26
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-styled.js +22 -15
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-styled.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js +79 -69
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js +54 -33
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as e, jsxs as b, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { scrollToQuestion as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { IconContainer as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
2
|
+
import { memo as Y, useState as Z, useCallback as i } from "react";
|
|
3
|
+
import ee from "../../../../assets/line-icons/icons/calculator.js";
|
|
4
|
+
import oe from "../../../../assets/line-icons/icons/down.js";
|
|
5
|
+
import ne from "../../../../assets/line-icons/icons/up.js";
|
|
6
|
+
import te from "../../../cue-canvas/toolbar/toolbar.js";
|
|
7
|
+
import se from "../../../ui/buttons/button/button.js";
|
|
8
|
+
import ie from "../../../ui/layout/flex-view.js";
|
|
9
|
+
import { scrollToQuestion as re } from "../worksheet-helpers.js";
|
|
10
|
+
import ae from "../worksheet-questions-controller/scribble-switch.js";
|
|
11
|
+
import le from "../worksheet-questions-controller/worksheet-questions-controller.js";
|
|
12
|
+
import me from "../worksheet-questions-summary/worksheet-questions-summary.js";
|
|
13
|
+
import { IconContainer as ce, SummaryWrapper as ue } from "../worksheet-styled.js";
|
|
14
|
+
import pe from "../worksheet-summary-controller/worksheet-summary-controller.js";
|
|
15
|
+
const Te = Y(($) => {
|
|
16
16
|
const {
|
|
17
17
|
userType: m,
|
|
18
18
|
layout: f,
|
|
@@ -22,9 +22,9 @@ const ve = L(($) => {
|
|
|
22
22
|
responses: t,
|
|
23
23
|
activeQuestionIndex: s,
|
|
24
24
|
lastUnlockedQuestionIndex: h,
|
|
25
|
-
appendedQuestionIds:
|
|
26
|
-
learnosity:
|
|
27
|
-
isCanvasEnabled:
|
|
25
|
+
appendedQuestionIds: R,
|
|
26
|
+
learnosity: W,
|
|
27
|
+
isCanvasEnabled: q,
|
|
28
28
|
isScribblingEnabled: S,
|
|
29
29
|
isSummaryVisible: k,
|
|
30
30
|
setIsScribblingEnabled: O,
|
|
@@ -37,113 +37,117 @@ const ve = L(($) => {
|
|
|
37
37
|
onItemNumberClick: C,
|
|
38
38
|
onTeacherValidation: N,
|
|
39
39
|
onGoToReview: I,
|
|
40
|
-
onResponseChange:
|
|
41
|
-
onHelp:
|
|
40
|
+
onResponseChange: U,
|
|
41
|
+
onHelp: D,
|
|
42
42
|
onSubmit: a,
|
|
43
|
-
onCalculatorOpen:
|
|
43
|
+
onCalculatorOpen: E,
|
|
44
44
|
canSubmitWorksheet: g,
|
|
45
45
|
loggerRef: y,
|
|
46
46
|
onSkip: _,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
onUnassign: z,
|
|
48
|
+
onReview: H,
|
|
49
|
+
canToggleScribbling: P
|
|
50
|
+
} = $, { navigationBar: X, questionsScrollable: w } = f, p = o[s], { response_id: l } = p ?? {}, [v, d] = Z(!1), J = l ? R.includes(l) : !1, K = i(
|
|
49
51
|
(n) => {
|
|
50
52
|
d(!1), C(n);
|
|
51
53
|
},
|
|
52
54
|
[C]
|
|
53
|
-
),
|
|
55
|
+
), L = i(() => {
|
|
54
56
|
d(!1), I();
|
|
55
|
-
}, [I]),
|
|
57
|
+
}, [I]), Q = i(() => {
|
|
56
58
|
d((n) => !n);
|
|
57
|
-
}, []),
|
|
59
|
+
}, []), M = i(() => {
|
|
58
60
|
var T;
|
|
59
61
|
u(!1);
|
|
60
62
|
const n = (T = o[o.length - 1]) == null ? void 0 : T.response_id;
|
|
61
|
-
n && (w ? requestAnimationFrame(() =>
|
|
63
|
+
n && (w ? requestAnimationFrame(() => re(n)) : c(n));
|
|
62
64
|
}, [o, w, c, u]), x = i(() => {
|
|
63
65
|
a == null || a(t);
|
|
64
66
|
}, [a, t]);
|
|
65
67
|
return k ? /* @__PURE__ */ e(
|
|
66
|
-
|
|
68
|
+
pe,
|
|
67
69
|
{
|
|
68
|
-
onBack:
|
|
70
|
+
onBack: M,
|
|
69
71
|
behavior: r,
|
|
70
72
|
onSubmit: x,
|
|
71
73
|
canSubmitWorksheet: !!g
|
|
72
74
|
}
|
|
73
75
|
) : /* @__PURE__ */ b(B, { children: [
|
|
74
|
-
/* @__PURE__ */ b(
|
|
76
|
+
/* @__PURE__ */ b(ie, { $flexDirection: "row", $flexGap: 12, children: [
|
|
75
77
|
/* @__PURE__ */ e(
|
|
76
|
-
|
|
78
|
+
ae,
|
|
77
79
|
{
|
|
78
80
|
isScribblingEnabled: S,
|
|
79
81
|
setIsScribblingEnabled: O,
|
|
80
|
-
isCanvasEnabled:
|
|
82
|
+
isCanvasEnabled: q,
|
|
81
83
|
loggerRef: y,
|
|
82
|
-
canToggleScribbling:
|
|
84
|
+
canToggleScribbling: P
|
|
83
85
|
}
|
|
84
86
|
),
|
|
85
87
|
r.canShowDesmosCalc && /* @__PURE__ */ e(
|
|
86
|
-
|
|
88
|
+
ce,
|
|
87
89
|
{
|
|
88
90
|
$active: G,
|
|
89
91
|
$alignItems: "center",
|
|
90
92
|
$justifyContent: "space-between",
|
|
91
|
-
onClick:
|
|
92
|
-
children: /* @__PURE__ */ e(
|
|
93
|
+
onClick: E,
|
|
94
|
+
children: /* @__PURE__ */ e(ee, {})
|
|
93
95
|
}
|
|
94
96
|
)
|
|
95
97
|
] }),
|
|
96
|
-
S && /* @__PURE__ */ e(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
S && /* @__PURE__ */ e(te, { userType: m, renderAs: "canvas" }),
|
|
99
|
+
X === "bottom" && /* @__PURE__ */ b(B, { children: [
|
|
100
|
+
v && /* @__PURE__ */ e(ue, { $alignItems: "center", children: /* @__PURE__ */ e(
|
|
101
|
+
me,
|
|
100
102
|
{
|
|
101
103
|
activeQuestionIndex: s,
|
|
102
104
|
lastUnlockedQuestionIndex: h,
|
|
103
|
-
onItemNumberClick:
|
|
105
|
+
onItemNumberClick: K,
|
|
104
106
|
questions: o,
|
|
105
107
|
responses: t,
|
|
106
108
|
worksheetName: A,
|
|
107
109
|
behavior: r,
|
|
108
110
|
userType: m,
|
|
109
|
-
onClose:
|
|
110
|
-
onGoToReview:
|
|
111
|
+
onClose: Q,
|
|
112
|
+
onGoToReview: L,
|
|
111
113
|
summaryVisible: k
|
|
112
114
|
}
|
|
113
115
|
) }),
|
|
114
116
|
/* @__PURE__ */ e(
|
|
115
|
-
|
|
117
|
+
se,
|
|
116
118
|
{
|
|
117
119
|
renderAs: "secondary",
|
|
118
120
|
widthX: 13.25,
|
|
119
121
|
label: `Question ${s + 1} of ${o.length}`,
|
|
120
122
|
size: "small",
|
|
121
|
-
Icon:
|
|
123
|
+
Icon: v ? oe : ne,
|
|
122
124
|
iconPosition: "right",
|
|
123
125
|
justifyContent: "space-between",
|
|
124
|
-
onClick:
|
|
126
|
+
onClick: Q
|
|
125
127
|
}
|
|
126
128
|
)
|
|
127
129
|
] }),
|
|
128
130
|
p && l && /* @__PURE__ */ e(
|
|
129
|
-
|
|
131
|
+
le,
|
|
130
132
|
{
|
|
131
|
-
learnosity:
|
|
133
|
+
learnosity: W,
|
|
132
134
|
question: p,
|
|
133
135
|
questions: o,
|
|
134
136
|
responses: t,
|
|
135
137
|
canSubmitWorksheet: g,
|
|
136
138
|
questionIndex: s,
|
|
137
|
-
isQuestionAppended:
|
|
139
|
+
isQuestionAppended: J,
|
|
138
140
|
isQuestionUnlocked: s <= h,
|
|
139
141
|
response: t[l],
|
|
140
142
|
behavior: r,
|
|
141
143
|
userType: m,
|
|
142
144
|
layout: f,
|
|
143
|
-
onResponseChange:
|
|
145
|
+
onResponseChange: U,
|
|
144
146
|
onTeacherValidation: N,
|
|
145
|
-
onHelp:
|
|
147
|
+
onHelp: D,
|
|
146
148
|
onSubmit: x,
|
|
149
|
+
onUnassign: z,
|
|
150
|
+
onReview: H,
|
|
147
151
|
setActiveQuestionId: c,
|
|
148
152
|
setBlocker: F,
|
|
149
153
|
setSummaryVisible: u,
|
|
@@ -156,6 +160,6 @@ const ve = L(($) => {
|
|
|
156
160
|
] });
|
|
157
161
|
});
|
|
158
162
|
export {
|
|
159
|
-
|
|
163
|
+
Te as default
|
|
160
164
|
};
|
|
161
165
|
//# sourceMappingURL=worksheet-action-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet-action-bar.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-action-bar/worksheet-action-bar.tsx"],"sourcesContent":["import type { IWorksheetActionBarProps } from './worksheet-action-bar-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useState } from 'react';\n\nimport CalculatorIcon from '../../../../assets/line-icons/icons/calculator';\nimport DownIcon from '../../../../assets/line-icons/icons/down';\nimport UpIcon from '../../../../assets/line-icons/icons/up';\nimport Toolbar from '../../../cue-canvas/toolbar/toolbar';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport { scrollToQuestion } from '../worksheet-helpers';\nimport ScribbleSwitch from '../worksheet-questions-controller/scribble-switch';\nimport WorksheetQuestionsController from '../worksheet-questions-controller/worksheet-questions-controller';\nimport WorksheetQuestionsSummary from '../worksheet-questions-summary/worksheet-questions-summary';\nimport * as Styled from '../worksheet-styled';\nimport WorksheetSummaryController from '../worksheet-summary-controller/worksheet-summary-controller';\n\nconst WorksheetActionBar: FC<IWorksheetActionBarProps> = memo(props => {\n const {\n userType,\n layout,\n behavior,\n worksheetName,\n questions,\n responses,\n activeQuestionIndex,\n lastUnlockedQuestionIndex,\n appendedQuestionIds,\n learnosity,\n isCanvasEnabled,\n isScribblingEnabled,\n isSummaryVisible,\n setIsScribblingEnabled,\n setActiveQuestionId,\n setResponses,\n getTimeSpentOnQuestion,\n setBlocker,\n setSummaryVisible,\n showCalculator,\n onItemNumberClick,\n onTeacherValidation,\n onGoToReview,\n onResponseChange,\n onHelp,\n onSubmit,\n onCalculatorOpen,\n canSubmitWorksheet,\n loggerRef,\n onSkip,\n canToggleScribbling,\n } = props;\n const { navigationBar, questionsScrollable } = layout;\n const activeQuestion = questions[activeQuestionIndex];\n const { response_id: activeQuestionId } = activeQuestion ?? {};\n const [isSummaryOpened, setIsSummaryOpened] = useState(false);\n const isAppended = activeQuestionId ? appendedQuestionIds.includes(activeQuestionId) : false;\n\n const handleItemNumberClick = useCallback(\n (questionId: string) => {\n setIsSummaryOpened(false);\n onItemNumberClick(questionId);\n },\n [onItemNumberClick],\n );\n\n const handleOnGoToReview = useCallback(() => {\n setIsSummaryOpened(false);\n onGoToReview();\n }, [onGoToReview]);\n\n const handleSummaryButtonClick = useCallback(() => {\n setIsSummaryOpened(prev => !prev);\n }, []);\n\n const handleBackFromSummary = useCallback(() => {\n setSummaryVisible(false);\n\n const questionId = questions[questions.length - 1]?.response_id;\n\n if (questionId) {\n if (questionsScrollable) {\n requestAnimationFrame(() => scrollToQuestion(questionId));\n } else {\n setActiveQuestionId(questionId);\n }\n }\n }, [questions, questionsScrollable, setActiveQuestionId, setSummaryVisible]);\n\n const handleSheetSubmitButtonClick = useCallback(() => {\n onSubmit?.(responses);\n }, [onSubmit, responses]);\n\n if (isSummaryVisible) {\n return (\n <WorksheetSummaryController\n onBack={handleBackFromSummary}\n behavior={behavior}\n onSubmit={handleSheetSubmitButtonClick}\n canSubmitWorksheet={!!canSubmitWorksheet}\n />\n );\n }\n\n return (\n <>\n <FlexView $flexDirection=\"row\" $flexGap={12}>\n <ScribbleSwitch\n isScribblingEnabled={isScribblingEnabled}\n setIsScribblingEnabled={setIsScribblingEnabled}\n isCanvasEnabled={isCanvasEnabled}\n loggerRef={loggerRef}\n canToggleScribbling={canToggleScribbling}\n />\n {behavior.canShowDesmosCalc && (\n <Styled.IconContainer\n $active={showCalculator}\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n onClick={onCalculatorOpen}\n >\n <CalculatorIcon />\n </Styled.IconContainer>\n )}\n </FlexView>\n {isScribblingEnabled && <Toolbar userType={userType} renderAs=\"canvas\" />}\n {navigationBar === 'bottom' && (\n <>\n {isSummaryOpened && (\n <Styled.SummaryWrapper $alignItems=\"center\">\n <WorksheetQuestionsSummary\n activeQuestionIndex={activeQuestionIndex}\n lastUnlockedQuestionIndex={lastUnlockedQuestionIndex}\n onItemNumberClick={handleItemNumberClick}\n questions={questions}\n responses={responses}\n worksheetName={worksheetName}\n behavior={behavior}\n userType={userType}\n onClose={handleSummaryButtonClick}\n onGoToReview={handleOnGoToReview}\n summaryVisible={isSummaryVisible}\n />\n </Styled.SummaryWrapper>\n )}\n <Button\n renderAs=\"secondary\"\n widthX={13.25}\n label={`Question ${activeQuestionIndex + 1} of ${questions.length}`}\n size=\"small\"\n Icon={isSummaryOpened ? DownIcon : UpIcon}\n iconPosition=\"right\"\n justifyContent=\"space-between\"\n onClick={handleSummaryButtonClick}\n />\n </>\n )}\n {activeQuestion && activeQuestionId && (\n <WorksheetQuestionsController\n learnosity={learnosity}\n question={activeQuestion}\n questions={questions}\n responses={responses}\n canSubmitWorksheet={canSubmitWorksheet}\n questionIndex={activeQuestionIndex}\n isQuestionAppended={isAppended}\n isQuestionUnlocked={activeQuestionIndex <= lastUnlockedQuestionIndex}\n response={responses[activeQuestionId]}\n behavior={behavior}\n userType={userType}\n layout={layout}\n onResponseChange={onResponseChange}\n onTeacherValidation={onTeacherValidation}\n onHelp={onHelp}\n onSubmit={handleSheetSubmitButtonClick}\n setActiveQuestionId={setActiveQuestionId}\n setBlocker={setBlocker}\n setSummaryVisible={setSummaryVisible}\n setResponses={setResponses}\n getTimeSpentOnQuestion={getTimeSpentOnQuestion}\n loggerRef={loggerRef}\n onSkip={onSkip}\n />\n )}\n </>\n );\n});\n\nexport default WorksheetActionBar;\n"],"names":["WorksheetActionBar","memo","props","userType","layout","behavior","worksheetName","questions","responses","activeQuestionIndex","lastUnlockedQuestionIndex","appendedQuestionIds","learnosity","isCanvasEnabled","isScribblingEnabled","isSummaryVisible","setIsScribblingEnabled","setActiveQuestionId","setResponses","getTimeSpentOnQuestion","setBlocker","setSummaryVisible","showCalculator","onItemNumberClick","onTeacherValidation","onGoToReview","onResponseChange","onHelp","onSubmit","onCalculatorOpen","canSubmitWorksheet","loggerRef","onSkip","canToggleScribbling","navigationBar","questionsScrollable","activeQuestion","activeQuestionId","isSummaryOpened","setIsSummaryOpened","useState","isAppended","handleItemNumberClick","useCallback","questionId","handleOnGoToReview","handleSummaryButtonClick","prev","handleBackFromSummary","_a","scrollToQuestion","handleSheetSubmitButtonClick","jsx","WorksheetSummaryController","jsxs","Fragment","FlexView","ScribbleSwitch","Styled.IconContainer","CalculatorIcon","Toolbar","Styled.SummaryWrapper","WorksheetQuestionsSummary","Button","DownIcon","UpIcon","WorksheetQuestionsController"],"mappings":";;;;;;;;;;;;;;AAkBM,MAAAA,KAAmDC,EAAK,CAASC,MAAA;AAC/D,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,qBAAAC;AAAA,EACE,IAAA/B,GACE,EAAE,eAAAgC,GAAe,qBAAAC,EAAwB,IAAA/B,GACzCgC,IAAiB7B,EAAUE,CAAmB,GAC9C,EAAE,aAAa4B,MAAqBD,KAAkB,CAAA,GACtD,CAACE,GAAiBC,CAAkB,IAAIC,EAAS,E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F,EAAU6B,CAAgB;AAAA,QACpC,UAAAhC;AAAA,QACA,UAAAF;AAAA,QACA,QAAAC;AAAA,QACA,kBAAAsB;AAAA,QACA,qBAAAF;AAAA,QACA,QAAAG;AAAA,QACA,UAAUwB;AAAA,QACV,qBAAAlC;AAAA,QACA,YAAAG;AAAA,QACA,mBAAAC;AAAA,QACA,cAAAH;AAAA,QACA,wBAAAC;AAAA,QACA,WAAAY;AAAA,QACA,QAAAC;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"worksheet-action-bar.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-action-bar/worksheet-action-bar.tsx"],"sourcesContent":["import type { IWorksheetActionBarProps } from './worksheet-action-bar-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useState } from 'react';\n\nimport CalculatorIcon from '../../../../assets/line-icons/icons/calculator';\nimport DownIcon from '../../../../assets/line-icons/icons/down';\nimport UpIcon from '../../../../assets/line-icons/icons/up';\nimport Toolbar from '../../../cue-canvas/toolbar/toolbar';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport { scrollToQuestion } from '../worksheet-helpers';\nimport ScribbleSwitch from '../worksheet-questions-controller/scribble-switch';\nimport WorksheetQuestionsController from '../worksheet-questions-controller/worksheet-questions-controller';\nimport WorksheetQuestionsSummary from '../worksheet-questions-summary/worksheet-questions-summary';\nimport * as Styled from '../worksheet-styled';\nimport WorksheetSummaryController from '../worksheet-summary-controller/worksheet-summary-controller';\n\nconst WorksheetActionBar: FC<IWorksheetActionBarProps> = memo(props => {\n const {\n userType,\n layout,\n behavior,\n worksheetName,\n questions,\n responses,\n activeQuestionIndex,\n lastUnlockedQuestionIndex,\n appendedQuestionIds,\n learnosity,\n isCanvasEnabled,\n isScribblingEnabled,\n isSummaryVisible,\n setIsScribblingEnabled,\n setActiveQuestionId,\n setResponses,\n getTimeSpentOnQuestion,\n setBlocker,\n setSummaryVisible,\n showCalculator,\n onItemNumberClick,\n onTeacherValidation,\n onGoToReview,\n onResponseChange,\n onHelp,\n onSubmit,\n onCalculatorOpen,\n canSubmitWorksheet,\n loggerRef,\n onSkip,\n onUnassign,\n onReview,\n canToggleScribbling,\n } = props;\n const { navigationBar, questionsScrollable } = layout;\n const activeQuestion = questions[activeQuestionIndex];\n const { response_id: activeQuestionId } = activeQuestion ?? {};\n const [isSummaryOpened, setIsSummaryOpened] = useState(false);\n const isAppended = activeQuestionId ? appendedQuestionIds.includes(activeQuestionId) : false;\n\n const handleItemNumberClick = useCallback(\n (questionId: string) => {\n setIsSummaryOpened(false);\n onItemNumberClick(questionId);\n },\n [onItemNumberClick],\n );\n\n const handleOnGoToReview = useCallback(() => {\n setIsSummaryOpened(false);\n onGoToReview();\n }, [onGoToReview]);\n\n const handleSummaryButtonClick = useCallback(() => {\n setIsSummaryOpened(prev => !prev);\n }, []);\n\n const handleBackFromSummary = useCallback(() => {\n setSummaryVisible(false);\n\n const questionId = questions[questions.length - 1]?.response_id;\n\n if (questionId) {\n if (questionsScrollable) {\n requestAnimationFrame(() => scrollToQuestion(questionId));\n } else {\n setActiveQuestionId(questionId);\n }\n }\n }, [questions, questionsScrollable, setActiveQuestionId, setSummaryVisible]);\n\n const handleSheetSubmitButtonClick = useCallback(() => {\n onSubmit?.(responses);\n }, [onSubmit, responses]);\n\n if (isSummaryVisible) {\n return (\n <WorksheetSummaryController\n onBack={handleBackFromSummary}\n behavior={behavior}\n onSubmit={handleSheetSubmitButtonClick}\n canSubmitWorksheet={!!canSubmitWorksheet}\n />\n );\n }\n\n return (\n <>\n <FlexView $flexDirection=\"row\" $flexGap={12}>\n <ScribbleSwitch\n isScribblingEnabled={isScribblingEnabled}\n setIsScribblingEnabled={setIsScribblingEnabled}\n isCanvasEnabled={isCanvasEnabled}\n loggerRef={loggerRef}\n canToggleScribbling={canToggleScribbling}\n />\n {behavior.canShowDesmosCalc && (\n <Styled.IconContainer\n $active={showCalculator}\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n onClick={onCalculatorOpen}\n >\n <CalculatorIcon />\n </Styled.IconContainer>\n )}\n </FlexView>\n {isScribblingEnabled && <Toolbar userType={userType} renderAs=\"canvas\" />}\n {navigationBar === 'bottom' && (\n <>\n {isSummaryOpened && (\n <Styled.SummaryWrapper $alignItems=\"center\">\n <WorksheetQuestionsSummary\n activeQuestionIndex={activeQuestionIndex}\n lastUnlockedQuestionIndex={lastUnlockedQuestionIndex}\n onItemNumberClick={handleItemNumberClick}\n questions={questions}\n responses={responses}\n worksheetName={worksheetName}\n behavior={behavior}\n userType={userType}\n onClose={handleSummaryButtonClick}\n onGoToReview={handleOnGoToReview}\n summaryVisible={isSummaryVisible}\n />\n </Styled.SummaryWrapper>\n )}\n <Button\n renderAs=\"secondary\"\n widthX={13.25}\n label={`Question ${activeQuestionIndex + 1} of ${questions.length}`}\n size=\"small\"\n Icon={isSummaryOpened ? DownIcon : UpIcon}\n iconPosition=\"right\"\n justifyContent=\"space-between\"\n onClick={handleSummaryButtonClick}\n />\n </>\n )}\n {activeQuestion && activeQuestionId && (\n <WorksheetQuestionsController\n learnosity={learnosity}\n question={activeQuestion}\n questions={questions}\n responses={responses}\n canSubmitWorksheet={canSubmitWorksheet}\n questionIndex={activeQuestionIndex}\n isQuestionAppended={isAppended}\n isQuestionUnlocked={activeQuestionIndex <= lastUnlockedQuestionIndex}\n response={responses[activeQuestionId]}\n behavior={behavior}\n userType={userType}\n layout={layout}\n onResponseChange={onResponseChange}\n onTeacherValidation={onTeacherValidation}\n onHelp={onHelp}\n onSubmit={handleSheetSubmitButtonClick}\n onUnassign={onUnassign}\n onReview={onReview}\n setActiveQuestionId={setActiveQuestionId}\n setBlocker={setBlocker}\n setSummaryVisible={setSummaryVisible}\n setResponses={setResponses}\n getTimeSpentOnQuestion={getTimeSpentOnQuestion}\n loggerRef={loggerRef}\n onSkip={onSkip}\n />\n )}\n </>\n );\n});\n\nexport default WorksheetActionBar;\n"],"names":["WorksheetActionBar","memo","props","userType","layout","behavior","worksheetName","questions","responses","activeQuestionIndex","lastUnlockedQuestionIndex","appendedQuestionIds","learnosity","isCanvasEnabled","isScribblingEnabled","isSummaryVisible","setIsScribblingEnabled","setActiveQuestionId","setResponses","getTimeSpentOnQuestion","setBlocker","setSummaryVisible","showCalculator","onItemNumberClick","onTeacherValidation","onGoToReview","onResponseChange","onHelp","onSubmit","onCalculatorOpen","canSubmitWorksheet","loggerRef","onSkip","onUnassign","onReview","canToggleScribbling","navigationBar","questionsScrollable","activeQuestion","activeQuestionId","isSummaryOpened","setIsSummaryOpened","useState","isAppended","handleItemNumberClick","useCallback","questionId","handleOnGoToReview","handleSummaryButtonClick","prev","handleBackFromSummary","_a","scrollToQuestion","handleSheetSubmitButtonClick","jsx","WorksheetSummaryController","jsxs","Fragment","FlexView","ScribbleSwitch","Styled.IconContainer","CalculatorIcon","Toolbar","Styled.SummaryWrapper","WorksheetQuestionsSummary","Button","DownIcon","UpIcon","WorksheetQuestionsController"],"mappings":";;;;;;;;;;;;;;AAkBM,MAAAA,KAAmDC,EAAK,CAASC,MAAA;AAC/D,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,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SAASnB;AAAA,QAAA;AAAA,MACX;AAAA,IAAA,GACF;AAAA,IAEDV,KAAkBC,KACjB,gBAAAe;AAAA,MAACc;AAAA,MAAA;AAAA,QACC,YAAAxD;AAAA,QACA,UAAU0B;AAAA,QACV,WAAA/B;AAAA,QACA,WAAAC;AAAA,QACA,oBAAAsB;AAAA,QACA,eAAerB;AAAA,QACf,oBAAoBkC;AAAA,QACpB,oBAAoBlC,KAAuBC;AAAA,QAC3C,UAAUF,EAAU+B,CAAgB;AAAA,QACpC,UAAAlC;AAAA,QACA,UAAAF;AAAA,QACA,QAAAC;AAAA,QACA,kBAAAsB;AAAA,QACA,qBAAAF;AAAA,QACA,QAAAG;AAAA,QACA,UAAU0B;AAAA,QACV,YAAApB;AAAA,QACA,UAAAC;AAAA,QACA,qBAAAjB;AAAA,QACA,YAAAG;AAAA,QACA,mBAAAC;AAAA,QACA,cAAAH;AAAA,QACA,wBAAAC;AAAA,QACA,WAAAY;AAAA,QACA,QAAAC;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { OPTIONAL_ITEM_TYPES as
|
|
1
|
+
import w from "../../../assets/line-icons/icons/bulb2.js";
|
|
2
|
+
import S from "../../../assets/line-icons/icons/edit-star.js";
|
|
3
|
+
import A from "../../../assets/line-icons/icons/edit2.js";
|
|
4
|
+
import O from "../../../assets/line-icons/icons/question-letter.js";
|
|
5
|
+
import R from "../../../assets/line-icons/icons/star2.js";
|
|
6
|
+
import b from "../constants/events.js";
|
|
7
|
+
import { OPTIONAL_ITEM_TYPES as L, ACTION_BAR_HEIGHT as k, QUESTION_WIDTH as y, SPLIT_QUESTION_WIDTH as N, CLOZE_FORMULA_RESPONSE_LIMIT as x } from "./constants.js";
|
|
8
8
|
import { QUESTION_TAGS as E } from "./worksheet-types.js";
|
|
9
|
-
const
|
|
9
|
+
const Q = (e) => {
|
|
10
10
|
switch (e) {
|
|
11
11
|
case "overview":
|
|
12
12
|
return "overview";
|
|
@@ -30,100 +30,100 @@ const x = (e) => {
|
|
|
30
30
|
default:
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, B = (e) => {
|
|
34
34
|
if (!e)
|
|
35
35
|
return !1;
|
|
36
36
|
const r = e.toLowerCase();
|
|
37
37
|
return r === "intro" || r === "concept-intro";
|
|
38
|
-
},
|
|
39
|
-
const [n, s] = t.split(":"),
|
|
40
|
-
return !
|
|
38
|
+
}, C = (e) => e.reduce((r, t) => {
|
|
39
|
+
const [n, s] = t.split(":"), a = n == null ? void 0 : n.trim(), c = s == null ? void 0 : s.trim();
|
|
40
|
+
return !a || !c ? r : {
|
|
41
41
|
...r,
|
|
42
|
-
[
|
|
42
|
+
[a.toLowerCase()]: c
|
|
43
43
|
};
|
|
44
|
-
}, {}),
|
|
44
|
+
}, {}), Y = (e, { sectioned: r = !1, adaptive: t = !1 }) => {
|
|
45
45
|
if (r)
|
|
46
|
-
return e.reduce((s,
|
|
46
|
+
return e.reduce((s, a, c) => {
|
|
47
47
|
var T;
|
|
48
48
|
let d = !1;
|
|
49
|
-
const { content: u, questions: i, itemType:
|
|
49
|
+
const { content: u, questions: i, itemType: o } = a, l = Q(o), m = s[s.length - 1], g = l === (m == null ? void 0 : m.section_name) && (m != null && m.item_display_number) ? m.item_display_number + 1 : 1, _ = u.match(/question-[^"]*/g), p = _ == null ? void 0 : _.map((f, h) => {
|
|
50
50
|
const v = i.find(
|
|
51
|
-
({ response_id:
|
|
51
|
+
({ response_id: I }) => I === f.replace("question-", "")
|
|
52
52
|
);
|
|
53
53
|
if (!v)
|
|
54
54
|
throw new Error(`Question not found for the response id: ${f}`);
|
|
55
|
-
return d = d ||
|
|
55
|
+
return d = d || B(v.instructor_stimulus), {
|
|
56
56
|
...v,
|
|
57
57
|
// Some questions are set to limited number of attempts which can show feedback which is causing the question to be stuck in the errored state
|
|
58
58
|
feedback_attempts: void 0,
|
|
59
|
-
item_reference:
|
|
59
|
+
item_reference: a.reference,
|
|
60
60
|
item_number: c,
|
|
61
61
|
item_display_number: g,
|
|
62
62
|
section_name: l,
|
|
63
|
-
item_type: r ?
|
|
64
|
-
is_optional:
|
|
65
|
-
item_tags:
|
|
66
|
-
item_tags_map:
|
|
63
|
+
item_type: r ? o : void 0,
|
|
64
|
+
is_optional: o ? L.includes(o) : !1,
|
|
65
|
+
item_tags: a.tags ?? [],
|
|
66
|
+
item_tags_map: C(a.tags ?? []),
|
|
67
67
|
question_number: h - (d ? 1 : 0),
|
|
68
|
-
total_questions:
|
|
68
|
+
total_questions: _.length
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
|
-
if (d = !1,
|
|
72
|
-
const f = (T = e[c - 1]) == null ? void 0 : T.itemType, h =
|
|
71
|
+
if (d = !1, p != null && p[0] && c > 0 && e.length > 0) {
|
|
72
|
+
const f = (T = e[c - 1]) == null ? void 0 : T.itemType, h = o != null && o.startsWith("advanced-") ? "advanced" : o, v = f != null && f.startsWith("advanced-") ? "advanced" : f;
|
|
73
73
|
if ((h === "practice-basic" || h === "practice-regular" || h === "exit-ticket" || h === "advanced") && h !== v)
|
|
74
74
|
return [
|
|
75
75
|
...s,
|
|
76
76
|
{
|
|
77
|
-
...
|
|
77
|
+
...p[0],
|
|
78
78
|
metadata: {
|
|
79
|
-
...
|
|
79
|
+
...p[0].metadata,
|
|
80
80
|
teacher_tips: void 0,
|
|
81
81
|
hints: void 0,
|
|
82
82
|
solution: void 0
|
|
83
83
|
},
|
|
84
84
|
instructor_stimulus: "SystemIntro",
|
|
85
|
-
response_id: `${
|
|
86
|
-
is_optional:
|
|
85
|
+
response_id: `${o}-system-intro`,
|
|
86
|
+
is_optional: o == null ? void 0 : o.startsWith("advanced-")
|
|
87
87
|
},
|
|
88
|
-
...
|
|
88
|
+
...p ?? []
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
return [...s, ...
|
|
91
|
+
return [...s, ...p ?? []];
|
|
92
92
|
}, []);
|
|
93
|
-
const n = e.reduce((s,
|
|
94
|
-
const { content: d, questions: u } =
|
|
93
|
+
const n = e.reduce((s, a, c) => {
|
|
94
|
+
const { content: d, questions: u } = a, i = d.match(/question-[^"]*/g), o = i == null ? void 0 : i.map(
|
|
95
95
|
(l, m) => {
|
|
96
96
|
const g = u.find(
|
|
97
|
-
({ response_id:
|
|
97
|
+
({ response_id: _ }) => _ === l.replace("question-", "")
|
|
98
98
|
);
|
|
99
99
|
if (!g)
|
|
100
100
|
throw new Error(`Question not found for the response id: ${l}`);
|
|
101
101
|
return {
|
|
102
102
|
...g,
|
|
103
103
|
feedback_attempts: void 0,
|
|
104
|
-
item_reference:
|
|
104
|
+
item_reference: a.reference,
|
|
105
105
|
item_number: c,
|
|
106
106
|
item_display_number: c + 1,
|
|
107
|
-
item_tags:
|
|
108
|
-
item_tags_map:
|
|
107
|
+
item_tags: a.tags ?? [],
|
|
108
|
+
item_tags_map: C(a.tags ?? []),
|
|
109
109
|
question_number: m,
|
|
110
110
|
total_questions: i.length
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
|
-
return [...s, ...
|
|
114
|
+
return [...s, ...o ?? []];
|
|
115
115
|
}, []);
|
|
116
116
|
if (t) {
|
|
117
|
-
const s = [],
|
|
117
|
+
const s = [], a = {};
|
|
118
118
|
return n.sort((c, d) => {
|
|
119
119
|
var m, g;
|
|
120
120
|
const u = c.item_tags_map[E.TRIAL_TOPIC], i = d.item_tags_map[E.TRIAL_TOPIC];
|
|
121
|
-
if (u &&
|
|
121
|
+
if (u && a[u] === void 0 && (a[u] = s.length, s.push(u)), i && a[i] === void 0 && (a[i] = s.length, s.push(i)), !u || !i)
|
|
122
122
|
return 0;
|
|
123
|
-
const
|
|
124
|
-
return
|
|
123
|
+
const o = `${a[u]}-${((m = c.item_tags_map[E.QUESTION_CODE]) == null ? void 0 : m.length) ?? 0}`, l = `${a[i]}-${((g = d.item_tags_map[E.QUESTION_CODE]) == null ? void 0 : g.length) ?? 0}`;
|
|
124
|
+
return o > l ? 1 : -1;
|
|
125
125
|
}).map((c) => {
|
|
126
|
-
const d =
|
|
126
|
+
const d = a[c.item_tags_map[E.TRIAL_TOPIC] ?? ""] ?? 0, u = c.item_tags_map[E.QUESTION_CODE] ?? "";
|
|
127
127
|
return {
|
|
128
128
|
...c,
|
|
129
129
|
item_display_number: d * 3 + u.length
|
|
@@ -131,7 +131,7 @@ const x = (e) => {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
return n;
|
|
134
|
-
},
|
|
134
|
+
}, J = ({
|
|
135
135
|
questions: e,
|
|
136
136
|
initialQuestion: r,
|
|
137
137
|
initialResponseId: t,
|
|
@@ -139,11 +139,11 @@ const x = (e) => {
|
|
|
139
139
|
lastUnlockedQuestionIndex: s
|
|
140
140
|
}) => {
|
|
141
141
|
var d, u;
|
|
142
|
-
const
|
|
143
|
-
if (t &&
|
|
142
|
+
const a = e.slice(0, s + 1), c = e[s];
|
|
143
|
+
if (t && a.find((i) => i.response_id === t))
|
|
144
144
|
return t;
|
|
145
145
|
if (typeof n == "number" && n <= c.item_number) {
|
|
146
|
-
const i = e.find((
|
|
146
|
+
const i = e.find((o) => o.item_number === n);
|
|
147
147
|
if (i != null && i.response_id)
|
|
148
148
|
return i.response_id;
|
|
149
149
|
}
|
|
@@ -154,41 +154,41 @@ const x = (e) => {
|
|
|
154
154
|
if ((u = e[0]) != null && u.response_id)
|
|
155
155
|
return e[0].response_id;
|
|
156
156
|
throw new Error("Initial question not found");
|
|
157
|
-
},
|
|
157
|
+
}, V = ({
|
|
158
158
|
questions: e,
|
|
159
159
|
responses: r,
|
|
160
160
|
behavior: t,
|
|
161
161
|
userType: n
|
|
162
162
|
}) => {
|
|
163
|
-
const { maximumAttempts: s, teacherValidationEnabled:
|
|
164
|
-
var
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
163
|
+
const { maximumAttempts: s, teacherValidationEnabled: a, validation: c, navigationMode: d } = t, u = [...e].reverse().findIndex((i) => {
|
|
164
|
+
var p;
|
|
165
|
+
const o = r[i.response_id], { attemptsHistory: l, validatedByTeacher: m, assignStatus: g } = o ?? {};
|
|
166
|
+
if (a)
|
|
167
167
|
return !!(m || g === "skipped");
|
|
168
|
-
const
|
|
169
|
-
return
|
|
168
|
+
const _ = (p = l == null ? void 0 : l.slice(-1)[0]) == null ? void 0 : p.score;
|
|
169
|
+
return _ ? (_.score ?? 0) === _.max_score ? !0 : ((l == null ? void 0 : l.length) ?? 0) >= s : !!(!c && d === "LINEAR" && (o != null && o.response || o != null && o.skipped));
|
|
170
170
|
});
|
|
171
171
|
if (u === -1)
|
|
172
172
|
return 0;
|
|
173
173
|
if (u === 0) {
|
|
174
|
-
if (
|
|
175
|
-
const i = [...e].reverse().findIndex((
|
|
174
|
+
if (a) {
|
|
175
|
+
const i = [...e].reverse().findIndex((o) => {
|
|
176
176
|
var l;
|
|
177
|
-
return ((l = r[
|
|
177
|
+
return ((l = r[o.response_id]) == null ? void 0 : l.assignStatus) !== "skipped";
|
|
178
178
|
});
|
|
179
179
|
return e.length - i - 1;
|
|
180
180
|
}
|
|
181
181
|
return e.length - 1;
|
|
182
182
|
}
|
|
183
|
-
if (
|
|
184
|
-
const i = e.length - u,
|
|
185
|
-
return
|
|
183
|
+
if (a && n === "STUDENT") {
|
|
184
|
+
const i = e.length - u, o = e[i], { assignStatus: l } = r[o.response_id] ?? {};
|
|
185
|
+
return o.is_optional && !l ? i - 1 : i;
|
|
186
186
|
}
|
|
187
187
|
return e.length - u;
|
|
188
188
|
};
|
|
189
|
-
function
|
|
189
|
+
function M(e, r) {
|
|
190
190
|
var n, s;
|
|
191
|
-
const t = Array.isArray(e) ? e.find((
|
|
191
|
+
const t = Array.isArray(e) ? e.find((a) => a.response_id === r) : e;
|
|
192
192
|
if (!t)
|
|
193
193
|
throw new Error(`Question with id ${r} not found`);
|
|
194
194
|
return {
|
|
@@ -196,7 +196,7 @@ function U(e, r) {
|
|
|
196
196
|
itemReference: t.item_reference,
|
|
197
197
|
itemPosition: t.item_number,
|
|
198
198
|
questionPosition: t.question_number,
|
|
199
|
-
isOkayTypeQuestion:
|
|
199
|
+
isOkayTypeQuestion: W(t),
|
|
200
200
|
score: {
|
|
201
201
|
max_score: ((s = (n = t == null ? void 0 : t.validation) == null ? void 0 : n.valid_response) == null ? void 0 : s.score) ?? 0 * t.metadata.valid_response_count
|
|
202
202
|
},
|
|
@@ -206,20 +206,20 @@ function U(e, r) {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
const
|
|
209
|
+
const z = (e) => e.reduce(
|
|
210
210
|
(r, t) => ({
|
|
211
211
|
...r,
|
|
212
|
-
[t.response_id]:
|
|
212
|
+
[t.response_id]: M(e, t.response_id)
|
|
213
213
|
}),
|
|
214
214
|
{}
|
|
215
215
|
), X = (e, r) => {
|
|
216
216
|
const { actionBar: t } = r;
|
|
217
217
|
return {
|
|
218
218
|
questionsContainerWidth: !e.some(
|
|
219
|
-
(
|
|
220
|
-
) ? y :
|
|
219
|
+
(a) => a.questions.some((c) => c.stimulus_review)
|
|
220
|
+
) ? y : N,
|
|
221
221
|
maxQuestionWidth: y,
|
|
222
|
-
actionbarHeight: t === "bottom" ?
|
|
222
|
+
actionbarHeight: t === "bottom" ? k : 0
|
|
223
223
|
};
|
|
224
224
|
}, Z = ({
|
|
225
225
|
questions: e,
|
|
@@ -231,7 +231,7 @@ const K = (e) => e.reduce(
|
|
|
231
231
|
block: "start",
|
|
232
232
|
behavior: r ? "smooth" : "instant"
|
|
233
233
|
});
|
|
234
|
-
},
|
|
234
|
+
}, W = (e) => {
|
|
235
235
|
const { type: r, options: t, instructor_stimulus: n } = e;
|
|
236
236
|
return ("item_type" in e ? e.item_type : void 0) === "overview" || n === "Intro" || n === "SystemIntro" || n === "Concept-Intro" ? !0 : r === "mcq" && (t == null ? void 0 : t.length) === 1;
|
|
237
237
|
}, q = (e) => {
|
|
@@ -240,10 +240,10 @@ const K = (e) => e.reduce(
|
|
|
240
240
|
enableMenu: !1,
|
|
241
241
|
ignoreHtmlClass: "lrn_noMath",
|
|
242
242
|
compileError: function(r, t, n) {
|
|
243
|
-
e(
|
|
243
|
+
e(b.MATHJAX_COMPILE_ERROR), r.compileError(t, n);
|
|
244
244
|
},
|
|
245
245
|
typesetError: function(r, t, n) {
|
|
246
|
-
e(
|
|
246
|
+
e(b.MATHJAX_TYPESET_ERROR), r.typesetError(t, n);
|
|
247
247
|
}
|
|
248
248
|
},
|
|
249
249
|
tex: {
|
|
@@ -266,7 +266,7 @@ const K = (e) => e.reduce(
|
|
|
266
266
|
overarc: ["{\\overparen{#1}}", 1]
|
|
267
267
|
},
|
|
268
268
|
formatError: (r, t) => {
|
|
269
|
-
e(
|
|
269
|
+
e(b.MATHJAX_FORMAT_ERROR, {
|
|
270
270
|
id: t.id,
|
|
271
271
|
message: t.message
|
|
272
272
|
}), r.formatError(t);
|
|
@@ -328,7 +328,7 @@ const K = (e) => e.reduce(
|
|
|
328
328
|
default:
|
|
329
329
|
return "YELLOW_1";
|
|
330
330
|
}
|
|
331
|
-
},
|
|
331
|
+
}, oe = (e) => {
|
|
332
332
|
switch (e) {
|
|
333
333
|
case "learning":
|
|
334
334
|
return "Learning";
|
|
@@ -343,23 +343,23 @@ const K = (e) => e.reduce(
|
|
|
343
343
|
default:
|
|
344
344
|
return "";
|
|
345
345
|
}
|
|
346
|
-
},
|
|
346
|
+
}, ae = (e) => {
|
|
347
347
|
switch (e) {
|
|
348
348
|
case "learning":
|
|
349
|
-
return
|
|
349
|
+
return w;
|
|
350
350
|
case "practice-basic":
|
|
351
|
-
return
|
|
351
|
+
return A;
|
|
352
352
|
case "practice-regular":
|
|
353
|
-
return
|
|
353
|
+
return S;
|
|
354
354
|
case "exit-ticket":
|
|
355
|
-
return
|
|
355
|
+
return O;
|
|
356
356
|
case "advanced":
|
|
357
|
-
return
|
|
357
|
+
return R;
|
|
358
358
|
default:
|
|
359
|
-
return
|
|
359
|
+
return w;
|
|
360
360
|
}
|
|
361
361
|
}, ie = (e) => Array.isArray(e.value) ? e.value.some(
|
|
362
|
-
(t) => typeof t == "string" && t.length >
|
|
362
|
+
(t) => typeof t == "string" && t.length > x
|
|
363
363
|
) : !1, se = (e, r) => {
|
|
364
364
|
const t = e === "TEACHER";
|
|
365
365
|
return r ? {
|
|
@@ -369,25 +369,42 @@ const K = (e) => e.reduce(
|
|
|
369
369
|
bannerBackgroundColor: "ORANGE_2",
|
|
370
370
|
label: "Complete this with your tutor in class"
|
|
371
371
|
};
|
|
372
|
+
}, ce = ({
|
|
373
|
+
isPuzzleWorksheet: e,
|
|
374
|
+
isTestWorksheet: r,
|
|
375
|
+
imageHue: t = "BLUE"
|
|
376
|
+
}) => e ? {
|
|
377
|
+
bgColor: `${t}_3`,
|
|
378
|
+
borderColor: `${t}_4`,
|
|
379
|
+
textColor: "BLACK_T_87"
|
|
380
|
+
} : r ? {
|
|
381
|
+
bgColor: "WHITE_3",
|
|
382
|
+
borderColor: "WHITE_4",
|
|
383
|
+
textColor: "BLACK_T_87"
|
|
384
|
+
} : {
|
|
385
|
+
bgColor: "BLACK",
|
|
386
|
+
borderColor: "BLACK_4",
|
|
387
|
+
textColor: "WHITE"
|
|
372
388
|
};
|
|
373
389
|
export {
|
|
374
390
|
ie as checkIsClozeFormulaResponseInvalid,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
391
|
+
J as getInitialQuestionId,
|
|
392
|
+
z as getInitialResponses,
|
|
393
|
+
V as getLastUnlockedQuestionIndex,
|
|
378
394
|
ne as getNavigationSectionBackgroundColor,
|
|
379
|
-
|
|
380
|
-
|
|
395
|
+
ae as getNavigationSectionIcon,
|
|
396
|
+
oe as getNavigationSectionName,
|
|
381
397
|
ee as getPaperColorByQuestion,
|
|
382
398
|
te as getQuestionBackgroundImage,
|
|
383
399
|
re as getQuestionBorderColor,
|
|
384
|
-
|
|
385
|
-
|
|
400
|
+
M as getQuestionMetadata,
|
|
401
|
+
Y as getQuestionsFromItems,
|
|
386
402
|
Z as getRenderableQuestions,
|
|
387
403
|
X as getWorksheetDimensions,
|
|
404
|
+
ce as getWorksheetHeaderLayout,
|
|
388
405
|
se as getWorksheetNudgeBannerInfo,
|
|
389
|
-
|
|
390
|
-
|
|
406
|
+
B as isConceptIntroWidget,
|
|
407
|
+
W as isOkayTypeQuestion,
|
|
391
408
|
j as scrollToQuestion,
|
|
392
409
|
q as setMathJaxConfigInWindow
|
|
393
410
|
};
|