@cuemath/leap 3.5.52-as1 → 3.5.53-j1
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/homework/homework-card.js +122 -121
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js +66 -61
- package/dist/features/milestone/create/comps/add-custom-chapter/add-custom-chapter.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js +56 -55
- package/dist/features/milestone/create/comps/add-custom-chapter/course-catalog.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/search-chapter/search-chapters.js +32 -25
- package/dist/features/milestone/create/comps/add-custom-chapter/search-chapter/search-chapters.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/selected-chapter-item.js +16 -15
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/selected-chapter-item.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/selected-chapters.js +17 -10
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/selected-chapters.js.map +1 -1
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/tags-render.js +6 -6
- package/dist/features/milestone/create/comps/add-custom-chapter/selected-chapters/tags-render.js.map +1 -1
- package/dist/features/milestone/create/comps/body-layout/body-layout.js +30 -29
- package/dist/features/milestone/create/comps/body-layout/body-layout.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js +77 -74
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js.map +1 -1
- package/dist/features/milestone/create/comps/goal-completion-date-selector/goal-completion-date-selector.js +82 -79
- package/dist/features/milestone/create/comps/goal-completion-date-selector/goal-completion-date-selector.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-styled.js +8 -8
- package/dist/features/milestone/create/milestone-create-styled.js.map +1 -1
- package/dist/features/milestone/create/milestone-create.js +48 -46
- package/dist/features/milestone/create/milestone-create.js.map +1 -1
- package/dist/features/milestone/edit/goal-draft-edit-sync.js +26 -0
- package/dist/features/milestone/edit/goal-draft-edit-sync.js.map +1 -0
- package/dist/features/milestone/edit/goal-drafts/goal-draft-edit-container.js +72 -66
- package/dist/features/milestone/edit/goal-drafts/goal-draft-edit-container.js.map +1 -1
- package/dist/features/milestone/edit/hooks/use-milestone-edit-sync.js +82 -0
- package/dist/features/milestone/edit/hooks/use-milestone-edit-sync.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/hooks/use-milestone-list-sync.js +49 -0
- package/dist/features/milestone/milestone-list-container/hooks/use-milestone-list-sync.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +109 -105
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.js +2 -2
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs-styled.js +21 -16
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs-styled.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +106 -98
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +136 -117
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +96 -92
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-sync.js +25 -0
- package/dist/features/milestone/milestone-list-container/milestone-list-sync.js.map +1 -0
- package/dist/features/milestone/milestone-resources/resources-assign/added-resource-and-filters.js +78 -81
- package/dist/features/milestone/milestone-resources/resources-assign/added-resource-and-filters.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item.js +28 -25
- package/dist/features/milestone/milestone-resources/resources-assign/comps/filter-item/filter-item.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/comps/resource-item/resource-item.js +39 -33
- package/dist/features/milestone/milestone-resources/resources-assign/comps/resource-item/resource-item.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/hooks/use-resource-assign-sync.js +50 -0
- package/dist/features/milestone/milestone-resources/resources-assign/hooks/use-resource-assign-sync.js.map +1 -0
- package/dist/features/milestone/milestone-resources/resources-assign/resource-assign-sync.js +25 -0
- package/dist/features/milestone/milestone-resources/resources-assign/resource-assign-sync.js.map +1 -0
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.js +43 -53
- package/dist/features/milestone/milestone-resources/resources-assign/resource-items/resource-items.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign.js +218 -174
- package/dist/features/milestone/milestone-resources/resources-assign/resources-assign.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-assign/store/resource-assign-store.js +198 -0
- package/dist/features/milestone/milestone-resources/resources-assign/store/resource-assign-store.js.map +1 -0
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js +69 -67
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +46 -45
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +34 -32
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-creation/hooks/use-tests-creation-sync.js +52 -0
- package/dist/features/milestone/milestone-tests/tests-creation/hooks/use-tests-creation-sync.js.map +1 -0
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/chapter-selection/chapter-selection.js +51 -41
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/chapter-selection/chapter-selection.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/difficulty-and-duration-selection/difficulty-and-duration-selection.js +85 -71
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/difficulty-and-duration-selection/difficulty-and-duration-selection.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/test-preview/test-preview-styled.js +5 -5
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/test-preview/test-preview-styled.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/test-preview/test-preview.js +36 -26
- package/dist/features/milestone/milestone-tests/tests-creation/test-stages/test-preview/test-preview.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation-sync.js +25 -0
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation-sync.js.map +1 -0
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation-types.js +5 -0
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation-types.js.map +1 -0
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation.js +150 -89
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation.js.map +1 -1
- package/dist/features/sheet-v2/resource-list/resource-list.js +26 -24
- package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -1
- package/dist/features/trial-session/comps/learning-plan/index.js +218 -91
- package/dist/features/trial-session/comps/learning-plan/index.js.map +1 -1
- package/dist/features/trial-session/comps/learning-plan/learning-plan-styled.js +7 -6
- package/dist/features/trial-session/comps/learning-plan/learning-plan-styled.js.map +1 -1
- package/dist/features/trial-session/hooks/use-learning-plan-scroll-sync.js +75 -0
- package/dist/features/trial-session/hooks/use-learning-plan-scroll-sync.js.map +1 -0
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +125 -115
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js +3 -2
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +69 -54
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +44 -33
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +25 -22
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js +48 -44
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js +2 -2
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js.map +1 -1
- package/dist/index.d.ts +138 -2
- package/dist/node_modules/decode-uri-component/index.js.map +1 -0
- package/dist/node_modules/query-string/base.js +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +7 -0
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +3 -2
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +6 -10
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +12 -9
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/trial-session/comps/learning-plan/use-learning-plan-scroll-sync.js +0 -37
- package/dist/features/trial-session/comps/learning-plan/use-learning-plan-scroll-sync.js.map +0 -1
- package/dist/node_modules/query-string/node_modules/decode-uri-component/index.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +0 -5
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +0 -8
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +0 -1
- /package/dist/node_modules/{query-string/node_modules/decode-uri-component → decode-uri-component}/index.js +0 -0
|
@@ -1,139 +1,147 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import { useUIContext as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getGoalCategoryBasedColorTheme as
|
|
9
|
-
import { NoPlanCardWrapper as
|
|
10
|
-
const
|
|
11
|
-
var
|
|
1
|
+
import { jsx as t, jsxs as J, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import { memo as Q, useState as Y, useRef as Z, useEffect as ee, useCallback as te } from "react";
|
|
3
|
+
import oe from "../../../../../chapters/chapters-list/chapters-list.js";
|
|
4
|
+
import { useUIContext as se } from "../../../../../ui/context/context.js";
|
|
5
|
+
import ne from "../../../../../ui/text/text.js";
|
|
6
|
+
import re from "../../../../milestone-resources/resources-list/resources-list.js";
|
|
7
|
+
import ae from "../../../../milestone-tests/test-list-v2/test-list-container.js";
|
|
8
|
+
import { getGoalCategoryBasedColorTheme as ie } from "../milestone-utils.js";
|
|
9
|
+
import { NoPlanCardWrapper as le, TabsWrapper as ce, TabsText as de, TabComponentWrapper as me } from "./milestone-tabs-styled.js";
|
|
10
|
+
const Ae = Q(function(h) {
|
|
11
|
+
var k;
|
|
12
12
|
const {
|
|
13
|
-
goalCategory:
|
|
14
|
-
isDraftMilestone:
|
|
15
|
-
isGoalCreation:
|
|
16
|
-
isMilestoneActive:
|
|
13
|
+
goalCategory: M,
|
|
14
|
+
isDraftMilestone: a,
|
|
15
|
+
isGoalCreation: S,
|
|
16
|
+
isMilestoneActive: d,
|
|
17
17
|
userMilestoneId: e,
|
|
18
|
-
chapters:
|
|
19
|
-
userType:
|
|
20
|
-
canUpdatePlan:
|
|
21
|
-
studentId:
|
|
22
|
-
milestoneState:
|
|
23
|
-
milestonePermissions:
|
|
24
|
-
activeMilestoneId:
|
|
25
|
-
activeTabId:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
chapters: m,
|
|
19
|
+
userType: p,
|
|
20
|
+
canUpdatePlan: b,
|
|
21
|
+
studentId: C,
|
|
22
|
+
milestoneState: x,
|
|
23
|
+
milestonePermissions: w,
|
|
24
|
+
activeMilestoneId: u,
|
|
25
|
+
activeTabId: E,
|
|
26
|
+
selectedTabName: o,
|
|
27
|
+
isTrialSession: i
|
|
28
|
+
} = h, {
|
|
29
|
+
onAddChapter: P,
|
|
30
|
+
onAssignResources: U,
|
|
31
|
+
onChapterClick: j,
|
|
32
|
+
onCreateMilestoneTest: W,
|
|
33
|
+
onNodeAttempt: _,
|
|
34
|
+
onNodeView: y,
|
|
35
|
+
onNodeReview: B,
|
|
36
|
+
onNodeReattempt: f,
|
|
37
|
+
onNodeReset: D,
|
|
38
|
+
onNodeUnassign: F,
|
|
39
|
+
onNodeAssignAsHomework: g,
|
|
40
|
+
onTestPreview: G,
|
|
41
|
+
onTestReview: O,
|
|
42
|
+
onTestStart: H,
|
|
43
|
+
onWidgetTabSelection: l,
|
|
44
|
+
onCardClick: L
|
|
45
|
+
} = h, { visible_tabs: N } = w, { onEvent: v } = se(), { backgroundColor: V } = ie(M, a), T = {
|
|
44
46
|
chapters: {
|
|
45
47
|
label: "Chapters",
|
|
46
48
|
component: /* @__PURE__ */ t(
|
|
47
|
-
|
|
49
|
+
oe,
|
|
48
50
|
{
|
|
49
51
|
milestoneId: e,
|
|
50
|
-
chapters:
|
|
51
|
-
userType:
|
|
52
|
-
isGoalCreation:
|
|
53
|
-
onChapterClick:
|
|
54
|
-
onAddChapter:
|
|
55
|
-
canUpdatePlan: !!(
|
|
56
|
-
isMilestoneActive:
|
|
52
|
+
chapters: m,
|
|
53
|
+
userType: p,
|
|
54
|
+
isGoalCreation: S,
|
|
55
|
+
onChapterClick: j,
|
|
56
|
+
onAddChapter: P,
|
|
57
|
+
canUpdatePlan: !!(x !== "DRAFT" && b),
|
|
58
|
+
isMilestoneActive: d
|
|
57
59
|
}
|
|
58
60
|
)
|
|
59
61
|
},
|
|
60
62
|
tests: {
|
|
61
63
|
label: "Tests",
|
|
62
64
|
component: /* @__PURE__ */ t(
|
|
63
|
-
|
|
65
|
+
ae,
|
|
64
66
|
{
|
|
65
|
-
isDraftMilestone:
|
|
66
|
-
isChaptersAvailable:
|
|
67
|
-
isMilestoneActive:
|
|
68
|
-
studentId:
|
|
67
|
+
isDraftMilestone: a,
|
|
68
|
+
isChaptersAvailable: m.length > 0,
|
|
69
|
+
isMilestoneActive: d,
|
|
70
|
+
studentId: C,
|
|
69
71
|
userMilestoneId: e,
|
|
70
|
-
userType:
|
|
71
|
-
canUpdatePlan:
|
|
72
|
-
onCreateMilestoneTest:
|
|
73
|
-
onNodeReattempt:
|
|
74
|
-
onTestPreview:
|
|
75
|
-
onTestStart:
|
|
76
|
-
onTestReview:
|
|
77
|
-
onNodeAssignAsHomework:
|
|
78
|
-
|
|
72
|
+
userType: p,
|
|
73
|
+
canUpdatePlan: b,
|
|
74
|
+
onCreateMilestoneTest: W,
|
|
75
|
+
onNodeReattempt: f,
|
|
76
|
+
onTestPreview: G,
|
|
77
|
+
onTestStart: H,
|
|
78
|
+
onTestReview: O,
|
|
79
|
+
onNodeAssignAsHomework: g,
|
|
80
|
+
isTrialSession: i,
|
|
81
|
+
onCardClick: L
|
|
79
82
|
}
|
|
80
83
|
)
|
|
81
84
|
},
|
|
82
85
|
resources: {
|
|
83
86
|
label: "Resources",
|
|
84
87
|
component: /* @__PURE__ */ t(
|
|
85
|
-
|
|
88
|
+
re,
|
|
86
89
|
{
|
|
87
|
-
isDraftMilestone:
|
|
88
|
-
isMilestoneActive:
|
|
90
|
+
isDraftMilestone: a,
|
|
91
|
+
isMilestoneActive: d,
|
|
89
92
|
userMilestoneId: e,
|
|
90
|
-
canUpdatePlan:
|
|
91
|
-
studentId:
|
|
92
|
-
userType:
|
|
93
|
-
onAssignResources:
|
|
94
|
-
onNodeAttempt:
|
|
95
|
-
onNodeView:
|
|
96
|
-
onNodeReview:
|
|
97
|
-
onNodeReattempt:
|
|
98
|
-
onNodeReset:
|
|
99
|
-
onNodeUnassign:
|
|
100
|
-
onNodeAssignAsHomework:
|
|
93
|
+
canUpdatePlan: b,
|
|
94
|
+
studentId: C,
|
|
95
|
+
userType: p,
|
|
96
|
+
onAssignResources: U,
|
|
97
|
+
onNodeAttempt: _,
|
|
98
|
+
onNodeView: y,
|
|
99
|
+
onNodeReview: B,
|
|
100
|
+
onNodeReattempt: f,
|
|
101
|
+
onNodeReset: D,
|
|
102
|
+
onNodeUnassign: F,
|
|
103
|
+
onNodeAssignAsHomework: g,
|
|
104
|
+
isTrialSession: i
|
|
101
105
|
}
|
|
102
106
|
)
|
|
103
107
|
}
|
|
104
|
-
}, n = (
|
|
105
|
-
([
|
|
106
|
-
), [
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
}, n = (N ?? []).length === 0 || i ? Object.entries(T) : Object.entries(T).filter(
|
|
109
|
+
([s]) => (N ?? []).includes(s.toUpperCase())
|
|
110
|
+
), X = e === u ? E : ((k = n == null ? void 0 : n[0]) == null ? void 0 : k[0]) || "chapters", [c, A] = Y(
|
|
111
|
+
o ?? X
|
|
112
|
+
), R = Z(o);
|
|
113
|
+
ee(() => {
|
|
114
|
+
o && o !== R.current && (R.current = o, A(o));
|
|
115
|
+
}, [o]);
|
|
116
|
+
const q = te(
|
|
117
|
+
(s, r) => {
|
|
118
|
+
if (u === e && s === c) return null;
|
|
119
|
+
A(s), l == null || l(e, s), v("clicked", {
|
|
120
|
+
cta: r,
|
|
113
121
|
milestone_id: e
|
|
114
122
|
});
|
|
115
123
|
},
|
|
116
|
-
[
|
|
124
|
+
[u, e, c, l, v]
|
|
117
125
|
);
|
|
118
|
-
return
|
|
119
|
-
/* @__PURE__ */ t(
|
|
120
|
-
const [
|
|
126
|
+
return a && m.length === 0 ? /* @__PURE__ */ t(le, { $gutterX: 2, $background: "WHITE_3", children: /* @__PURE__ */ t(ne, { $renderAs: "ab2", $color: "RED", children: "No chapter has been assigned" }) }) : /* @__PURE__ */ J(K, { children: [
|
|
127
|
+
/* @__PURE__ */ t(ce, { $backgroundColor: V, $frames: n.length, children: n.map((s) => {
|
|
128
|
+
const [r, z] = s, { label: $ } = z, I = r === c;
|
|
121
129
|
return /* @__PURE__ */ t(
|
|
122
|
-
|
|
130
|
+
de,
|
|
123
131
|
{
|
|
124
|
-
$renderAs:
|
|
132
|
+
$renderAs: I ? "ub3-bold" : "ub3",
|
|
125
133
|
$align: "center",
|
|
126
|
-
$selected:
|
|
127
|
-
onClick: () =>
|
|
128
|
-
children:
|
|
134
|
+
$selected: I,
|
|
135
|
+
onClick: () => q(r, $),
|
|
136
|
+
children: $
|
|
129
137
|
},
|
|
130
|
-
|
|
138
|
+
r
|
|
131
139
|
);
|
|
132
140
|
}) }),
|
|
133
|
-
/* @__PURE__ */ t(
|
|
141
|
+
/* @__PURE__ */ t(me, { $isTrialSession: i, children: T[c].component })
|
|
134
142
|
] });
|
|
135
143
|
});
|
|
136
144
|
export {
|
|
137
|
-
|
|
145
|
+
Ae as default
|
|
138
146
|
};
|
|
139
147
|
//# sourceMappingURL=milestone-tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-tabs.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.tsx"],"sourcesContent":["import { memo, useCallback, useState, type FC } from 'react';\n\nimport ChaptersList from '../../../../../chapters/chapters-list/chapters-list';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport Text from '../../../../../ui/text/text';\nimport MilestoneWidgetResources from '../../../../milestone-resources/resources-list/resources-list';\nimport MilestoneTestsList from '../../../../milestone-tests/test-list-v2/test-list-container';\nimport { getGoalCategoryBasedColorTheme } from '../milestone-utils';\nimport * as Styled from './milestone-tabs-styled';\nimport type { IMilestoneTabConfig, IMilestoneTabsProps } from './milestone-tabs-types';\n\nconst MilestoneTabs: FC<IMilestoneTabsProps> = memo(function MilestoneTabs(props) {\n const {\n goalCategory,\n isDraftMilestone,\n isGoalCreation,\n isMilestoneActive,\n userMilestoneId,\n chapters,\n userType,\n canUpdatePlan,\n studentId,\n milestoneState,\n milestonePermissions,\n activeMilestoneId,\n activeTabId,\n } = props;\n const {\n onAddChapter,\n onAssignResources,\n onChapterClick,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n onCardClick,\n } = props;\n const { visible_tabs: visibleTabs } = milestonePermissions;\n const { onEvent: trackEvent } = useUIContext();\n\n const { backgroundColor } = getGoalCategoryBasedColorTheme(goalCategory, isDraftMilestone);\n\n const TAB_CONFIG: IMilestoneTabConfig = {\n chapters: {\n label: 'Chapters',\n component: (\n <ChaptersList\n milestoneId={userMilestoneId}\n chapters={chapters}\n userType={userType}\n isGoalCreation={isGoalCreation}\n onChapterClick={onChapterClick}\n onAddChapter={onAddChapter}\n canUpdatePlan={Boolean(milestoneState !== 'DRAFT' && canUpdatePlan)}\n isMilestoneActive={isMilestoneActive}\n />\n ),\n },\n tests: {\n label: 'Tests',\n component: (\n <MilestoneTestsList\n isDraftMilestone={isDraftMilestone}\n isChaptersAvailable={chapters.length > 0}\n isMilestoneActive={isMilestoneActive}\n studentId={studentId}\n userMilestoneId={userMilestoneId}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onNodeReattempt={onNodeReattempt}\n onTestPreview={onTestPreview}\n onTestStart={onTestStart}\n onTestReview={onTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n onCardClick={onCardClick}\n />\n ),\n },\n resources: {\n label: 'Resources',\n component: (\n <MilestoneWidgetResources\n isDraftMilestone={isDraftMilestone}\n isMilestoneActive={isMilestoneActive}\n userMilestoneId={userMilestoneId}\n canUpdatePlan={canUpdatePlan}\n studentId={studentId}\n userType={userType}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n />\n ),\n },\n };\n\n const filteredTabConfig =\n (visibleTabs ?? []).length === 0\n ? Object.entries(TAB_CONFIG)\n : Object.entries(TAB_CONFIG).filter(([tabName]) =>\n (visibleTabs ?? []).includes(tabName.toUpperCase()),\n );\n const [selectedTabName, setSelectedTabName] = useState(\n userMilestoneId === activeMilestoneId ? activeTabId : filteredTabConfig?.[0]?.[0] || 'chapters',\n );\n\n const handleTabChange = useCallback(\n (tabName: keyof IMilestoneTabConfig, ctaLabel: string) => {\n if (activeMilestoneId === userMilestoneId && tabName === selectedTabName) return null;\n\n setSelectedTabName(tabName);\n\n onWidgetTabSelection?.(userMilestoneId, tabName);\n\n trackEvent('clicked', {\n cta: ctaLabel,\n milestone_id: userMilestoneId,\n });\n },\n [activeMilestoneId, userMilestoneId, selectedTabName, onWidgetTabSelection, trackEvent],\n );\n\n if (isDraftMilestone && chapters.length === 0) {\n return (\n <Styled.NoPlanCardWrapper $gutterX={2} $background=\"WHITE_3\">\n <Text $renderAs=\"ab2\" $color=\"RED\">\n No chapter has been assigned\n </Text>\n </Styled.NoPlanCardWrapper>\n );\n }\n\n return (\n <>\n <Styled.TabsWrapper $backgroundColor={backgroundColor} $frames={filteredTabConfig.length}>\n {filteredTabConfig.map(tabConfig => {\n const [tabName, tabInfo] = tabConfig;\n const { label } = tabInfo;\n const isSelected = tabName === selectedTabName;\n\n return (\n <Styled.TabsText\n $renderAs={isSelected ? 'ub3-bold' : 'ub3'}\n $align=\"center\"\n key={tabName}\n $selected={isSelected}\n onClick={() => handleTabChange(tabName as keyof IMilestoneTabConfig, label)}\n >\n {label}\n </Styled.TabsText>\n );\n })}\n </Styled.TabsWrapper>\n\n <Styled.TabComponentWrapper>\n {TAB_CONFIG[selectedTabName as keyof typeof TAB_CONFIG].component}\n </Styled.TabComponentWrapper>\n </>\n );\n});\n\nexport default MilestoneTabs;\n"],"names":["MilestoneTabs","memo","props","goalCategory","isDraftMilestone","isGoalCreation","isMilestoneActive","userMilestoneId","chapters","userType","canUpdatePlan","studentId","milestoneState","milestonePermissions","activeMilestoneId","activeTabId","onAddChapter","onAssignResources","onChapterClick","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","onCardClick","visibleTabs","trackEvent","useUIContext","backgroundColor","getGoalCategoryBasedColorTheme","TAB_CONFIG","jsx","ChaptersList","MilestoneTestsList","MilestoneWidgetResources","filteredTabConfig","tabName","selectedTabName","setSelectedTabName","useState","_a","handleTabChange","useCallback","ctaLabel","Styled.NoPlanCardWrapper","Text","jsxs","Fragment","Styled.TabsWrapper","tabConfig","tabInfo","label","isSelected","Styled.TabsText","Styled.TabComponentWrapper"],"mappings":";;;;;;;;;AAWA,MAAMA,KAAyCC,EAAK,SAAuBC,GAAO;;AAC1E,QAAA;AAAA,IACJ,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;A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,WAAU,OAAM,QAAO,OAAM,0CAEnC,EACF,CAAA,IAMA,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAC,gBAAAhB,EAAAiB,IAAA,EAAmB,kBAAkBpB,GAAiB,SAASO,EAAkB,QAC/E,UAAkBA,EAAA,IAAI,CAAac,MAAA;AAC5B,YAAA,CAACb,GAASc,CAAO,IAAID,GACrB,EAAE,OAAAE,EAAU,IAAAD,GACZE,IAAahB,MAAYC;AAG7B,aAAA,gBAAAN;AAAA,QAACsB;AAAAA,QAAA;AAAA,UACC,WAAWD,IAAa,aAAa;AAAA,UACrC,QAAO;AAAA,UAEP,WAAWA;AAAA,UACX,SAAS,MAAMX,EAAgBL,GAAsCe,CAAK;AAAA,UAEzE,UAAAA;AAAA,QAAA;AAAA,QAJIf;AAAA,MAAA;AAAA,IAOV,CAAA,GACH;AAAA,sBAECkB,IAAA,EACE,UAAWxB,EAAAO,CAA0C,EAAE,WAC1D;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"milestone-tabs.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useRef, useState, type FC } from 'react';\n\nimport ChaptersList from '../../../../../chapters/chapters-list/chapters-list';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport Text from '../../../../../ui/text/text';\nimport MilestoneWidgetResources from '../../../../milestone-resources/resources-list/resources-list';\nimport MilestoneTestsList from '../../../../milestone-tests/test-list-v2/test-list-container';\nimport { getGoalCategoryBasedColorTheme } from '../milestone-utils';\nimport * as Styled from './milestone-tabs-styled';\nimport type {\n IMilestoneTabConfig,\n IMilestoneTabsProps,\n TMilestoneTabName,\n} from './milestone-tabs-types';\n\nconst MilestoneTabs: FC<IMilestoneTabsProps> = memo(function MilestoneTabs(props) {\n const {\n goalCategory,\n isDraftMilestone,\n isGoalCreation,\n isMilestoneActive,\n userMilestoneId,\n chapters,\n userType,\n canUpdatePlan,\n studentId,\n milestoneState,\n milestonePermissions,\n activeMilestoneId,\n activeTabId,\n selectedTabName: controlledSelectedTabName,\n isTrialSession,\n } = props;\n const {\n onAddChapter,\n onAssignResources,\n onChapterClick,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n onCardClick,\n } = props;\n const { visible_tabs: visibleTabs } = milestonePermissions;\n const { onEvent: trackEvent } = useUIContext();\n\n const { backgroundColor } = getGoalCategoryBasedColorTheme(goalCategory, isDraftMilestone);\n\n const TAB_CONFIG: IMilestoneTabConfig = {\n chapters: {\n label: 'Chapters',\n component: (\n <ChaptersList\n milestoneId={userMilestoneId}\n chapters={chapters}\n userType={userType}\n isGoalCreation={isGoalCreation}\n onChapterClick={onChapterClick}\n onAddChapter={onAddChapter}\n canUpdatePlan={Boolean(milestoneState !== 'DRAFT' && canUpdatePlan)}\n isMilestoneActive={isMilestoneActive}\n />\n ),\n },\n tests: {\n label: 'Tests',\n component: (\n <MilestoneTestsList\n isDraftMilestone={isDraftMilestone}\n isChaptersAvailable={chapters.length > 0}\n isMilestoneActive={isMilestoneActive}\n studentId={studentId}\n userMilestoneId={userMilestoneId}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onNodeReattempt={onNodeReattempt}\n onTestPreview={onTestPreview}\n onTestStart={onTestStart}\n onTestReview={onTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n isTrialSession={isTrialSession}\n onCardClick={onCardClick}\n />\n ),\n },\n resources: {\n label: 'Resources',\n component: (\n <MilestoneWidgetResources\n isDraftMilestone={isDraftMilestone}\n isMilestoneActive={isMilestoneActive}\n userMilestoneId={userMilestoneId}\n canUpdatePlan={canUpdatePlan}\n studentId={studentId}\n userType={userType}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n isTrialSession={isTrialSession}\n />\n ),\n },\n };\n\n const filteredTabConfig =\n (visibleTabs ?? []).length === 0 || isTrialSession\n ? Object.entries(TAB_CONFIG)\n : Object.entries(TAB_CONFIG).filter(([tabName]) =>\n (visibleTabs ?? []).includes(tabName.toUpperCase()),\n );\n\n const defaultTabName =\n userMilestoneId === activeMilestoneId ? activeTabId : filteredTabConfig?.[0]?.[0] || 'chapters';\n\n const [selectedTabName, setSelectedTabName] = useState<TMilestoneTabName>(\n (controlledSelectedTabName ?? defaultTabName) as TMilestoneTabName,\n );\n\n const prevControlledTabNameRef = useRef(controlledSelectedTabName);\n\n useEffect(() => {\n if (!controlledSelectedTabName) return;\n\n if (controlledSelectedTabName === prevControlledTabNameRef.current) return;\n\n prevControlledTabNameRef.current = controlledSelectedTabName;\n setSelectedTabName(controlledSelectedTabName);\n }, [controlledSelectedTabName]);\n\n const handleTabChange = useCallback(\n (tabName: TMilestoneTabName, ctaLabel: string) => {\n if (activeMilestoneId === userMilestoneId && tabName === selectedTabName) return null;\n\n setSelectedTabName(tabName);\n\n onWidgetTabSelection?.(userMilestoneId, tabName);\n\n trackEvent('clicked', {\n cta: ctaLabel,\n milestone_id: userMilestoneId,\n });\n },\n [activeMilestoneId, userMilestoneId, selectedTabName, onWidgetTabSelection, trackEvent],\n );\n\n if (isDraftMilestone && chapters.length === 0) {\n return (\n <Styled.NoPlanCardWrapper $gutterX={2} $background=\"WHITE_3\">\n <Text $renderAs=\"ab2\" $color=\"RED\">\n No chapter has been assigned\n </Text>\n </Styled.NoPlanCardWrapper>\n );\n }\n\n return (\n <>\n <Styled.TabsWrapper $backgroundColor={backgroundColor} $frames={filteredTabConfig.length}>\n {filteredTabConfig.map(tabConfig => {\n const [tabName, tabInfo] = tabConfig;\n const { label } = tabInfo;\n const isSelected = tabName === selectedTabName;\n\n return (\n <Styled.TabsText\n $renderAs={isSelected ? 'ub3-bold' : 'ub3'}\n $align=\"center\"\n key={tabName}\n $selected={isSelected}\n onClick={() => handleTabChange(tabName as TMilestoneTabName, label)}\n >\n {label}\n </Styled.TabsText>\n );\n })}\n </Styled.TabsWrapper>\n\n <Styled.TabComponentWrapper $isTrialSession={isTrialSession}>\n {TAB_CONFIG[selectedTabName as keyof typeof TAB_CONFIG].component}\n </Styled.TabComponentWrapper>\n </>\n );\n});\n\nexport default MilestoneTabs;\n"],"names":["MilestoneTabs","memo","props","goalCategory","isDraftMilestone","isGoalCreation","isMilestoneActive","userMilestoneId","chapters","userType","canUpdatePlan","studentId","milestoneState","milestonePermissions","activeMilestoneId","activeTabId","controlledSelectedTabName","isTrialSession","onAddChapter","onAssignResources","onChapterClick","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","onCardClick","visibleTabs","trackEvent","useUIContext","backgroundColor","getGoalCategoryBasedColorTheme","TAB_CONFIG","jsx","ChaptersList","MilestoneTestsList","MilestoneWidgetResources","filteredTabConfig","tabName","defaultTabName","_a","selectedTabName","setSelectedTabName","useState","prevControlledTabNameRef","useRef","useEffect","handleTabChange","useCallback","ctaLabel","Styled.NoPlanCardWrapper","Text","jsxs","Fragment","Styled.TabsWrapper","tabConfig","tabInfo","label","isSelected","Styled.TabsText","Styled.TabComponentWrapper"],"mappings":";;;;;;;;;AAeA,MAAMA,KAAyCC,EAAK,SAAuBC,GAAO;;AAC1E,QAAA;AAAA,IACJ,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,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EAAuBzB,GAAiBsC,IAExCV,EAAW,WAAW;AAAA,QACpB,KAAKqB;AAAA,QACL,cAAcjD;AAAA,MAAA,CACf;AAAA,IACH;AAAA,IACA,CAACO,GAAmBP,GAAiByC,GAAiBhB,GAAsBG,CAAU;AAAA,EAAA;AAGpF,SAAA/B,KAAoBI,EAAS,WAAW,IAEvC,gBAAAgC,EAAAiB,IAAA,EAAyB,UAAU,GAAG,aAAY,WACjD,UAAA,gBAAAjB,EAACkB,MAAK,WAAU,OAAM,QAAO,OAAM,0CAEnC,EACF,CAAA,IAMA,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAC,gBAAApB,EAAAqB,IAAA,EAAmB,kBAAkBxB,GAAiB,SAASO,EAAkB,QAC/E,UAAkBA,EAAA,IAAI,CAAakB,MAAA;AAC5B,YAAA,CAACjB,GAASkB,CAAO,IAAID,GACrB,EAAE,OAAAE,EAAU,IAAAD,GACZE,IAAapB,MAAYG;AAG7B,aAAA,gBAAAR;AAAA,QAAC0B;AAAAA,QAAA;AAAA,UACC,WAAWD,IAAa,aAAa;AAAA,UACrC,QAAO;AAAA,UAEP,WAAWA;AAAA,UACX,SAAS,MAAMX,EAAgBT,GAA8BmB,CAAK;AAAA,UAEjE,UAAAA;AAAA,QAAA;AAAA,QAJInB;AAAA,MAAA;AAAA,IAOV,CAAA,GACH;AAAA,IAEA,gBAAAL,EAAC2B,IAAA,EAA2B,iBAAiBlD,GAC1C,UAAAsB,EAAWS,CAA0C,EAAE,WAC1D;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,134 +1,153 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getGoalCategoryBasedColorTheme as
|
|
7
|
-
import { MainContainer as
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import { jsxs as re, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { memo as ce, useState as pe, useCallback as c, useEffect as N } from "react";
|
|
3
|
+
import me from "../../../../ui/layout/flex-view.js";
|
|
4
|
+
import le from "./milestone-info.js";
|
|
5
|
+
import ue from "./milestone-tabs/milestone-tabs.js";
|
|
6
|
+
import { getGoalCategoryBasedColorTheme as ge } from "./milestone-utils.js";
|
|
7
|
+
import { MainContainer as Ce, Wrapper as Ee, ContentWrapper as fe, Content as xe } from "./milestone-widget-styled.js";
|
|
8
|
+
const We = ce(function(b) {
|
|
9
|
+
const {
|
|
10
|
+
milestone: p,
|
|
11
|
+
studentId: m,
|
|
12
|
+
isMilestoneActive: l,
|
|
13
|
+
state: e,
|
|
14
|
+
onStateChange: n,
|
|
15
|
+
..._
|
|
16
|
+
} = b, {
|
|
17
|
+
isStudentPresent: w,
|
|
18
|
+
isClassOngoing: D,
|
|
19
|
+
userType: u,
|
|
20
|
+
studentName: W,
|
|
21
|
+
parentName: k,
|
|
22
|
+
teacherName: v,
|
|
23
|
+
courseStream: I,
|
|
24
|
+
activeMilestoneId: g,
|
|
25
|
+
activeTabId: P,
|
|
26
|
+
isTrialSession: C,
|
|
27
|
+
onAddOutcome: R,
|
|
28
|
+
onChapterClick: $,
|
|
29
|
+
onEdit: O,
|
|
30
|
+
onCreateMilestoneTest: y,
|
|
31
|
+
onDraftPublish: M,
|
|
32
|
+
onAddChapter: B,
|
|
33
|
+
onAssignResources: G,
|
|
34
|
+
onNodeAttempt: V,
|
|
35
|
+
onNodeView: F,
|
|
36
|
+
onNodeReview: U,
|
|
37
|
+
onNodeReattempt: j,
|
|
38
|
+
onNodeReset: X,
|
|
39
|
+
onNodeUnassign: H,
|
|
40
|
+
onNodeAssignAsHomework: Y,
|
|
41
|
+
onWidgetTabSelection: t,
|
|
35
42
|
//* Test sheet callbacks
|
|
36
|
-
onTestPreview:
|
|
37
|
-
onTestReview:
|
|
38
|
-
onTestStart:
|
|
39
|
-
onCardClick:
|
|
40
|
-
milestoneType:
|
|
41
|
-
} =
|
|
42
|
-
id:
|
|
43
|
-
user_milestone_plan:
|
|
44
|
-
outcome_data:
|
|
45
|
-
milestone_state:
|
|
46
|
-
permissions:
|
|
47
|
-
goal_code:
|
|
48
|
-
goal_category:
|
|
49
|
-
} =
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
|
|
53
|
-
}, []),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
e && e.
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
onTestPreview: q,
|
|
44
|
+
onTestReview: z,
|
|
45
|
+
onTestStart: J,
|
|
46
|
+
onCardClick: K,
|
|
47
|
+
milestoneType: L
|
|
48
|
+
} = _, {
|
|
49
|
+
id: a,
|
|
50
|
+
user_milestone_plan: E,
|
|
51
|
+
outcome_data: Q,
|
|
52
|
+
milestone_state: i,
|
|
53
|
+
permissions: f,
|
|
54
|
+
goal_code: x,
|
|
55
|
+
goal_category: T
|
|
56
|
+
} = p, Z = l && i === "ACTIVE" || L === "DRAFT", [d, r] = pe(
|
|
57
|
+
(e == null ? void 0 : e.isExpanded) ?? Z
|
|
58
|
+
), S = !!E, { can_update_plan: ee } = f, { outcomes: oe } = Q || {}, { user_chapters: ne = [] } = E || {}, se = c(() => {
|
|
59
|
+
r((o) => !o);
|
|
60
|
+
}, []), h = i === "DRAFT", te = i === "OUTCOME_ADDED", { backgroundColor: ae } = ge(
|
|
61
|
+
T,
|
|
62
|
+
h
|
|
63
|
+
), ie = c(() => {
|
|
64
|
+
const o = !d;
|
|
65
|
+
r(o), n == null || n(a, { isExpanded: o });
|
|
66
|
+
}, [d, n, a]);
|
|
67
|
+
N(() => {
|
|
68
|
+
(e == null ? void 0 : e.isExpanded) !== void 0 && r(e.isExpanded);
|
|
69
|
+
}, [e == null ? void 0 : e.isExpanded]);
|
|
70
|
+
const de = c(
|
|
71
|
+
(o, A) => {
|
|
72
|
+
n == null || n(o, { selectedTab: A }), t == null || t(o, A);
|
|
73
|
+
},
|
|
74
|
+
[n, t]
|
|
75
|
+
);
|
|
76
|
+
return N(() => {
|
|
77
|
+
const o = document.getElementById(`milestone-${g}`);
|
|
78
|
+
o && o.scrollIntoView();
|
|
79
|
+
}, []), /* @__PURE__ */ re(Ce, { id: `milestone-${a}`, children: [
|
|
80
|
+
/* @__PURE__ */ s(
|
|
81
|
+
Ee,
|
|
65
82
|
{
|
|
66
|
-
onClick:
|
|
67
|
-
$background:
|
|
83
|
+
onClick: ie,
|
|
84
|
+
$background: ae,
|
|
68
85
|
$gapX: 1.5,
|
|
69
86
|
$borderColor: "GREY_2",
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
|
|
87
|
+
children: /* @__PURE__ */ s(me, { $flexGapX: x ? 1.5 : 1, children: /* @__PURE__ */ s(
|
|
88
|
+
le,
|
|
72
89
|
{
|
|
73
|
-
milestone:
|
|
74
|
-
onEdit:
|
|
75
|
-
isExpanded:
|
|
76
|
-
toggleExpand:
|
|
77
|
-
userType:
|
|
78
|
-
isClassOngoing:
|
|
79
|
-
isStudentPresent:
|
|
80
|
-
onAddOutcome:
|
|
81
|
-
studentId:
|
|
82
|
-
studentName:
|
|
83
|
-
teacherName:
|
|
84
|
-
parentName:
|
|
85
|
-
onDraftPublish:
|
|
86
|
-
courseStream:
|
|
87
|
-
outcomes:
|
|
88
|
-
isTrialSession:
|
|
90
|
+
milestone: p,
|
|
91
|
+
onEdit: O,
|
|
92
|
+
isExpanded: d,
|
|
93
|
+
toggleExpand: se,
|
|
94
|
+
userType: u,
|
|
95
|
+
isClassOngoing: D,
|
|
96
|
+
isStudentPresent: w,
|
|
97
|
+
onAddOutcome: R,
|
|
98
|
+
studentId: m,
|
|
99
|
+
studentName: W,
|
|
100
|
+
teacherName: v ?? "",
|
|
101
|
+
parentName: k ?? "",
|
|
102
|
+
onDraftPublish: M,
|
|
103
|
+
courseStream: I,
|
|
104
|
+
outcomes: oe,
|
|
105
|
+
isTrialSession: C
|
|
89
106
|
}
|
|
90
107
|
) })
|
|
91
108
|
}
|
|
92
109
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
110
|
+
/* @__PURE__ */ s(fe, { $expanded: d, children: /* @__PURE__ */ s(xe, { children: /* @__PURE__ */ s(
|
|
111
|
+
ue,
|
|
95
112
|
{
|
|
96
|
-
goalCategory:
|
|
97
|
-
isGoalCreation: !!
|
|
98
|
-
isDraftMilestone:
|
|
99
|
-
isOutcomeAdded:
|
|
100
|
-
isMilestoneActive:
|
|
101
|
-
isPlanAvailable:
|
|
102
|
-
userMilestoneId:
|
|
103
|
-
chapters:
|
|
104
|
-
userType:
|
|
105
|
-
canUpdatePlan:
|
|
106
|
-
milestoneState:
|
|
107
|
-
studentId:
|
|
108
|
-
onAddChapter:
|
|
109
|
-
onAssignResources:
|
|
110
|
-
onChapterClick:
|
|
111
|
-
onCreateMilestoneTest:
|
|
112
|
-
onTestPreview:
|
|
113
|
-
onTestReview:
|
|
114
|
-
onTestStart:
|
|
115
|
-
onNodeAttempt:
|
|
116
|
-
onNodeView:
|
|
117
|
-
onNodeReview:
|
|
118
|
-
onNodeReattempt:
|
|
119
|
-
onNodeReset:
|
|
120
|
-
onNodeUnassign:
|
|
121
|
-
onNodeAssignAsHomework:
|
|
122
|
-
milestonePermissions:
|
|
123
|
-
activeMilestoneId:
|
|
124
|
-
activeTabId:
|
|
125
|
-
onWidgetTabSelection:
|
|
126
|
-
|
|
113
|
+
goalCategory: T,
|
|
114
|
+
isGoalCreation: !!x,
|
|
115
|
+
isDraftMilestone: h,
|
|
116
|
+
isOutcomeAdded: te,
|
|
117
|
+
isMilestoneActive: l,
|
|
118
|
+
isPlanAvailable: S,
|
|
119
|
+
userMilestoneId: a,
|
|
120
|
+
chapters: ne,
|
|
121
|
+
userType: u,
|
|
122
|
+
canUpdatePlan: ee,
|
|
123
|
+
milestoneState: i,
|
|
124
|
+
studentId: m,
|
|
125
|
+
onAddChapter: B,
|
|
126
|
+
onAssignResources: G,
|
|
127
|
+
onChapterClick: $,
|
|
128
|
+
onCreateMilestoneTest: y,
|
|
129
|
+
onTestPreview: q,
|
|
130
|
+
onTestReview: z,
|
|
131
|
+
onTestStart: J,
|
|
132
|
+
onNodeAttempt: V,
|
|
133
|
+
onNodeView: F,
|
|
134
|
+
onNodeReview: U,
|
|
135
|
+
onNodeReattempt: j,
|
|
136
|
+
onNodeReset: X,
|
|
137
|
+
onNodeUnassign: H,
|
|
138
|
+
onNodeAssignAsHomework: Y,
|
|
139
|
+
milestonePermissions: f,
|
|
140
|
+
activeMilestoneId: g,
|
|
141
|
+
activeTabId: P,
|
|
142
|
+
onWidgetTabSelection: de,
|
|
143
|
+
selectedTabName: e == null ? void 0 : e.selectedTab,
|
|
144
|
+
isTrialSession: C,
|
|
145
|
+
onCardClick: K
|
|
127
146
|
}
|
|
128
147
|
) }) })
|
|
129
148
|
] });
|
|
130
149
|
});
|
|
131
150
|
export {
|
|
132
|
-
|
|
151
|
+
We as default
|
|
133
152
|
};
|
|
134
153
|
//# sourceMappingURL=milestone-widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-widget.js","sources":["../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport FlexView from '../../../../ui/layout/flex-view';\nimport MilestoneInfoWrapper from './milestone-info';\nimport MilestoneTabs from './milestone-tabs/milestone-tabs';\nimport { getGoalCategoryBasedColorTheme } from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport type { IMilestoneWidgetProps } from './milestone-widget-types';\n\nconst MilestoneWidget: FC<IMilestoneWidgetProps> = memo(function MilestoneWidget(props) {\n const { milestone, studentId, isMilestoneActive, ...restMilestoneWidgetProps } = props;\n const {\n isStudentPresent,\n isClassOngoing,\n userType,\n studentName,\n parentName,\n teacherName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n isTrialSession,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onWidgetTabSelection,\n //* Test sheet callbacks\n onTestPreview,\n onTestReview,\n onTestStart,\n onCardClick,\n milestoneType,\n } = restMilestoneWidgetProps;\n\n const {\n id: milestoneId,\n user_milestone_plan: userMileStonePlan,\n outcome_data: outcomeData,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_code: goalCode,\n goal_category: goalCategory,\n } = milestone;\n\n const [widgetExpanded, setWidgetExpanded] = useState(\n (isMilestoneActive && milestoneState === 'ACTIVE') || milestoneType === 'DRAFT',\n );\n\n const isPlanAvailable = Boolean(userMileStonePlan);\n\n const { can_update_plan: canUpdatePlan } = milestonePermissions;\n const { outcomes } = outcomeData || {};\n\n const { user_chapters: chaptersData = [] } = userMileStonePlan || {};\n\n const toggleExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, []);\n\n const isDraftMilestone = milestoneState === 'DRAFT';\n const isOutcomeAdded = milestoneState === 'OUTCOME_ADDED';\n\n const { backgroundColor: goalBackgroundColor } = getGoalCategoryBasedColorTheme(\n goalCategory,\n isDraftMilestone,\n );\n\n const handleOnWidgetExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, [setWidgetExpanded]);\n\n useEffect(() => {\n const $element = document.getElementById(`milestone-${activeMilestoneId}`);\n\n if ($element) {\n $element.scrollIntoView();\n }\n //* Disabling the exhaustive-deps rule as we want to run this effect only once\n //* We don't want this to run when activeMilestoneId changes, as it will cause component to scroll into the view every time.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Styled.MainContainer id={`milestone-${milestoneId}`}>\n <Styled.Wrapper\n onClick={handleOnWidgetExpand}\n $background={goalBackgroundColor}\n $gapX={1.5}\n $borderColor=\"GREY_2\"\n >\n <FlexView $flexGapX={goalCode ? 1.5 : 1}>\n <MilestoneInfoWrapper\n milestone={milestone}\n onEdit={onEdit}\n isExpanded={widgetExpanded}\n toggleExpand={toggleExpand}\n userType={userType}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAddOutcome={onAddOutcome}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onDraftPublish={onDraftPublish}\n courseStream={courseStream}\n outcomes={outcomes}\n isTrialSession={isTrialSession}\n />\n </FlexView>\n </Styled.Wrapper>\n\n <Styled.ContentWrapper $expanded={widgetExpanded}>\n <Styled.Content>\n <MilestoneTabs\n goalCategory={goalCategory}\n isGoalCreation={!!goalCode}\n isDraftMilestone={isDraftMilestone}\n isOutcomeAdded={isOutcomeAdded}\n isMilestoneActive={isMilestoneActive}\n isPlanAvailable={isPlanAvailable}\n userMilestoneId={milestoneId}\n chapters={chaptersData}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n milestoneState={milestoneState}\n studentId={studentId}\n onAddChapter={onAddChapter}\n onAssignResources={onAssignResources}\n onChapterClick={onChapterClick}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestonePermissions={milestonePermissions}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n onCardClick={onCardClick}\n />\n </Styled.Content>\n </Styled.ContentWrapper>\n </Styled.MainContainer>\n );\n});\n\nexport default MilestoneWidget;\n"],"names":["MilestoneWidget","memo","props","milestone","studentId","isMilestoneActive","restMilestoneWidgetProps","isStudentPresent","isClassOngoing","userType","studentName","parentName","teacherName","courseStream","activeMilestoneId","activeTabId","isTrialSession","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onWidgetTabSelection","onTestPreview","onTestReview","onTestStart","onCardClick","milestoneType","milestoneId","userMileStonePlan","outcomeData","milestoneState","milestonePermissions","goalCode","goalCategory","widgetExpanded","setWidgetExpanded","useState","isPlanAvailable","canUpdatePlan","outcomes","chaptersData","toggleExpand","useCallback","prev","isDraftMilestone","isOutcomeAdded","goalBackgroundColor","getGoalCategoryBasedColorTheme","handleOnWidgetExpand","useEffect","$element","Styled.MainContainer","jsx","Styled.Wrapper","FlexView","MilestoneInfoWrapper","Styled.ContentWrapper","Styled.Content","MilestoneTabs"],"mappings":";;;;;;;AASA,MAAMA,KAA6CC,GAAK,SAAyBC,GAAO;AACtF,QAAM,EAAE,WAAAC,GAAW,WAAAC,GAAW,mBAAAC,GAAmB,GAAGC,EAA6B,IAAAJ,GAC3E;AAAA,IACJ,kBAAAK;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAA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,QACA,iBAAAC;AAAA,QACA,aAAAC;AAAA,QACA,gBAAAC;AAAA,QACA,wBAAAC;AAAA,QACA,sBAAAW;AAAA,QACA,mBAAA3B;AAAA,QACA,aAAAC;AAAA,QACA,sBAAAgB;AAAA,QACA,aAAAI;AAAA,MAAA;AAAA,OAEJ,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"milestone-widget.js","sources":["../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport FlexView from '../../../../ui/layout/flex-view';\nimport MilestoneInfoWrapper from './milestone-info';\nimport MilestoneTabs from './milestone-tabs/milestone-tabs';\nimport type { TMilestoneTabName } from './milestone-tabs/milestone-tabs-types';\nimport { getGoalCategoryBasedColorTheme } from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport type { IMilestoneWidgetProps } from './milestone-widget-types';\n\nconst MilestoneWidget: FC<IMilestoneWidgetProps> = memo(function MilestoneWidget(props) {\n const {\n milestone,\n studentId,\n isMilestoneActive,\n state: controlledMilestoneState,\n onStateChange,\n ...restMilestoneWidgetProps\n } = props;\n const {\n isStudentPresent,\n isClassOngoing,\n userType,\n studentName,\n parentName,\n teacherName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n isTrialSession,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onWidgetTabSelection,\n //* Test sheet callbacks\n onTestPreview,\n onTestReview,\n onTestStart,\n onCardClick,\n milestoneType,\n } = restMilestoneWidgetProps;\n\n const {\n id: milestoneId,\n user_milestone_plan: userMileStonePlan,\n outcome_data: outcomeData,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_code: goalCode,\n goal_category: goalCategory,\n } = milestone;\n\n const defaultExpanded =\n (isMilestoneActive && milestoneState === 'ACTIVE') || milestoneType === 'DRAFT';\n\n const [widgetExpanded, setWidgetExpanded] = useState(\n controlledMilestoneState?.isExpanded ?? defaultExpanded,\n );\n\n const isPlanAvailable = Boolean(userMileStonePlan);\n\n const { can_update_plan: canUpdatePlan } = milestonePermissions;\n const { outcomes } = outcomeData || {};\n\n const { user_chapters: chaptersData = [] } = userMileStonePlan || {};\n\n const toggleExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, []);\n\n const isDraftMilestone = milestoneState === 'DRAFT';\n const isOutcomeAdded = milestoneState === 'OUTCOME_ADDED';\n\n const { backgroundColor: goalBackgroundColor } = getGoalCategoryBasedColorTheme(\n goalCategory,\n isDraftMilestone,\n );\n\n const handleOnWidgetExpand = useCallback(() => {\n const newExpanded = !widgetExpanded;\n\n setWidgetExpanded(newExpanded);\n\n onStateChange?.(milestoneId, { isExpanded: newExpanded });\n }, [widgetExpanded, onStateChange, milestoneId]);\n\n useEffect(() => {\n if (controlledMilestoneState?.isExpanded !== undefined) {\n setWidgetExpanded(controlledMilestoneState.isExpanded);\n }\n }, [controlledMilestoneState?.isExpanded]);\n\n const handleOnWidgetTabSelection = useCallback(\n (selectedMilestoneId: string, tabName: TMilestoneTabName) => {\n onStateChange?.(selectedMilestoneId, { selectedTab: tabName });\n onWidgetTabSelection?.(selectedMilestoneId, tabName);\n },\n [onStateChange, onWidgetTabSelection],\n );\n\n useEffect(() => {\n const $element = document.getElementById(`milestone-${activeMilestoneId}`);\n\n if ($element) {\n $element.scrollIntoView();\n }\n //* Disabling the exhaustive-deps rule as we want to run this effect only once\n //* We don't want this to run when activeMilestoneId changes, as it will cause component to scroll into the view every time.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Styled.MainContainer id={`milestone-${milestoneId}`}>\n <Styled.Wrapper\n onClick={handleOnWidgetExpand}\n $background={goalBackgroundColor}\n $gapX={1.5}\n $borderColor=\"GREY_2\"\n >\n <FlexView $flexGapX={goalCode ? 1.5 : 1}>\n <MilestoneInfoWrapper\n milestone={milestone}\n onEdit={onEdit}\n isExpanded={widgetExpanded}\n toggleExpand={toggleExpand}\n userType={userType}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAddOutcome={onAddOutcome}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onDraftPublish={onDraftPublish}\n courseStream={courseStream}\n outcomes={outcomes}\n isTrialSession={isTrialSession}\n />\n </FlexView>\n </Styled.Wrapper>\n\n <Styled.ContentWrapper $expanded={widgetExpanded}>\n <Styled.Content>\n <MilestoneTabs\n goalCategory={goalCategory}\n isGoalCreation={!!goalCode}\n isDraftMilestone={isDraftMilestone}\n isOutcomeAdded={isOutcomeAdded}\n isMilestoneActive={isMilestoneActive}\n isPlanAvailable={isPlanAvailable}\n userMilestoneId={milestoneId}\n chapters={chaptersData}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n milestoneState={milestoneState}\n studentId={studentId}\n onAddChapter={onAddChapter}\n onAssignResources={onAssignResources}\n onChapterClick={onChapterClick}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestonePermissions={milestonePermissions}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={handleOnWidgetTabSelection}\n selectedTabName={controlledMilestoneState?.selectedTab as TMilestoneTabName}\n isTrialSession={isTrialSession}\n onCardClick={onCardClick}\n />\n </Styled.Content>\n </Styled.ContentWrapper>\n </Styled.MainContainer>\n );\n});\n\nexport default MilestoneWidget;\n"],"names":["MilestoneWidget","memo","props","milestone","studentId","isMilestoneActive","controlledMilestoneState","onStateChange","restMilestoneWidgetProps","isStudentPresent","isClassOngoing","userType","studentName","parentName","teacherName","courseStream","activeMilestoneId","activeTabId","isTrialSession","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onWidgetTabSelection","onTestPreview","onTestReview","onTestStart","onCardClick","milestoneType","milestoneId","userMileStonePlan","outcomeData","milestoneState","milestonePermissions","goalCode","goalCategory","defaultExpanded","widgetExpanded","setWidgetExpanded","useState","isPlanAvailable","canUpdatePlan","outcomes","chaptersData","toggleExpand","useCallback","prev","isDraftMilestone","isOutcomeAdded","goalBackgroundColor","getGoalCategoryBasedColorTheme","handleOnWidgetExpand","newExpanded","useEffect","handleOnWidgetTabSelection","selectedMilestoneId","tabName","$element","Styled.MainContainer","jsx","Styled.Wrapper","FlexView","MilestoneInfoWrapper","Styled.ContentWrapper","Styled.Content","MilestoneTabs"],"mappings":";;;;;;;AAUA,MAAMA,KAA6CC,GAAK,SAAyBC,GAAO;AAChF,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,OAAOC;AAAA,IACP,eAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAAN,GACE;AAAA,IACJ,kBAAAO;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA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