@cuemath/leap 3.5.30-as11 → 3.5.30-as13
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/timeline/monthly-report/comps/attendance/attendance-utils.js +38 -29
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,13 +6,22 @@ import _ from "../../../../../assets/line-icons/icons/pause-icon.js";
|
|
|
6
6
|
import { ATTENDANCE_STATUS as a } from "./attendance-constants.js";
|
|
7
7
|
import { StatusSymbol as C } from "./attendance.styled.js";
|
|
8
8
|
import T from "../../../../ui/theme/clrs.js";
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const m = T(), R = (t, e) => {
|
|
10
|
+
if ((t == null ? void 0 : t.length) === 1 && t[0]) {
|
|
11
|
+
if (!t[0].status) return "";
|
|
12
|
+
const r = new Date(t[0].time * 1e3).getHours(), s = r >= 12 ? "PM" : "AM", i = r % 12 || 12;
|
|
13
|
+
return [`${e} / ${i} ${s}`, t[0].status].join(`
|
|
14
|
+
`);
|
|
15
|
+
}
|
|
16
|
+
return [e, ...(t == null ? void 0 : t.map((o) => $(o))) || []].join(`
|
|
17
|
+
`);
|
|
18
|
+
}, b = (t) => t.is_present ? a.ATTENDED : t.is_paused ? a.PAUSED : a.MISSED, P = (t) => {
|
|
19
|
+
let e = 0, o = 0, r = 0;
|
|
11
20
|
Object.values(t).forEach((i) => {
|
|
12
|
-
i.forEach((
|
|
13
|
-
switch (b(
|
|
21
|
+
i.forEach((n) => {
|
|
22
|
+
switch (b(n)) {
|
|
14
23
|
case a.ATTENDED:
|
|
15
|
-
|
|
24
|
+
e++;
|
|
16
25
|
break;
|
|
17
26
|
case a.PAUSED:
|
|
18
27
|
r++;
|
|
@@ -23,8 +32,8 @@ const l = T(), w = (t, s) => [s, ...(t == null ? void 0 : t.map((o) => I(o))) ||
|
|
|
23
32
|
}
|
|
24
33
|
});
|
|
25
34
|
});
|
|
26
|
-
const
|
|
27
|
-
return
|
|
35
|
+
const s = [];
|
|
36
|
+
return e > 0 && s.push(`${e} attended`), o > 0 && s.push(`${o} missed`), r > 0 && s.push(`${r} paused`), `${s.join(", ")}.`;
|
|
28
37
|
}, A = (t) => {
|
|
29
38
|
if (t.length === 0)
|
|
30
39
|
return {
|
|
@@ -38,57 +47,57 @@ const l = T(), w = (t, s) => [s, ...(t == null ? void 0 : t.map((o) => I(o))) ||
|
|
|
38
47
|
themeColor: "WHITE_4",
|
|
39
48
|
statusSymbol: /* @__PURE__ */ u(C, { $top: "2px", $right: "2px", children: /* @__PURE__ */ u(D, { color: "GREEN_6", width: 8, height: 8 }) }),
|
|
40
49
|
tooltipBgColor: "WHITE_5",
|
|
41
|
-
snackbarBg:
|
|
50
|
+
snackbarBg: m.WHITE_5
|
|
42
51
|
};
|
|
43
|
-
const
|
|
44
|
-
return
|
|
52
|
+
const e = t.find((r) => r.is_present), o = t.find((r) => r.is_paused);
|
|
53
|
+
return e ? {
|
|
45
54
|
status: a.ATTENDED,
|
|
46
55
|
themeColor: "GREEN_1",
|
|
47
56
|
statusSymbol: /* @__PURE__ */ u(S, { color: "GREEN_6", width: 14, height: 14 }),
|
|
48
57
|
tooltipBgColor: "GREEN_2",
|
|
49
|
-
snackbarBg:
|
|
58
|
+
snackbarBg: m.GREEN_2
|
|
50
59
|
} : o ? {
|
|
51
60
|
status: a.PAUSED,
|
|
52
61
|
themeColor: "WHITE_4",
|
|
53
62
|
statusSymbol: /* @__PURE__ */ u(_, { color: "BLACK_T_60", width: 8, height: 8 }),
|
|
54
63
|
tooltipBgColor: "WHITE_5",
|
|
55
|
-
snackbarBg:
|
|
64
|
+
snackbarBg: m.WHITE_5
|
|
56
65
|
} : {
|
|
57
66
|
status: a.MISSED,
|
|
58
67
|
themeColor: "ORANGE_1",
|
|
59
68
|
statusSymbol: /* @__PURE__ */ u(f, { color: "RED", width: 12, height: 12 }),
|
|
60
69
|
tooltipBgColor: "ORANGE_2",
|
|
61
|
-
snackbarBg:
|
|
70
|
+
snackbarBg: m.ORANGE_2
|
|
62
71
|
};
|
|
63
|
-
},
|
|
64
|
-
const r = new Date(o,
|
|
65
|
-
for (let
|
|
72
|
+
}, x = (t, e, o) => {
|
|
73
|
+
const r = new Date(o, e - 1, 1).getDay(), s = new Date(o, e, 0).getDate(), i = [];
|
|
74
|
+
for (let n = 0; n < r; n++)
|
|
66
75
|
i.push(null);
|
|
67
|
-
for (let
|
|
68
|
-
const
|
|
76
|
+
for (let n = 1; n <= s; n++) {
|
|
77
|
+
const c = `${o}-${e.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}`, l = t[c] || [], { status: d, themeColor: h, statusSymbol: g, tooltipBgColor: p, snackbarBg: E } = A(l);
|
|
69
78
|
i.push({
|
|
70
|
-
date:
|
|
79
|
+
date: n,
|
|
71
80
|
status: d,
|
|
72
|
-
hasClasses:
|
|
73
|
-
classes:
|
|
81
|
+
hasClasses: l.length > 0,
|
|
82
|
+
classes: l,
|
|
74
83
|
themeColor: h,
|
|
75
|
-
statusSymbol:
|
|
76
|
-
tooltipBgColor:
|
|
77
|
-
snackbarBg:
|
|
84
|
+
statusSymbol: g,
|
|
85
|
+
tooltipBgColor: p,
|
|
86
|
+
snackbarBg: E
|
|
78
87
|
});
|
|
79
88
|
}
|
|
80
89
|
return i;
|
|
81
|
-
},
|
|
90
|
+
}, $ = (t) => {
|
|
82
91
|
if (!t.status) return "";
|
|
83
92
|
const o = new Date(t.time * 1e3).getHours(), r = o >= 12 ? "PM" : "AM";
|
|
84
93
|
return `${`${o % 12 || 12} ${r}`}: ${t.status}`;
|
|
85
94
|
};
|
|
86
95
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
P as attendanceStatsText,
|
|
97
|
+
x as generateCalendarGrid,
|
|
89
98
|
b as getClassStatus,
|
|
90
99
|
A as getDayStatusInfo,
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
R as getSnackbarMsg,
|
|
101
|
+
$ as getStatusText
|
|
93
102
|
};
|
|
94
103
|
//# sourceMappingURL=attendance-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendance-utils.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendance-utils.tsx"],"sourcesContent":["import type { JSX } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport CrossIcon from '../../../../../assets/line-icons/icons/cross';\nimport DotIcon from '../../../../../assets/line-icons/icons/dots-icon';\nimport PauseIcon from '../../../../../assets/line-icons/icons/pause-icon';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { IClassEvent, TCalendarData } from '../../monthly-report-types';\nimport { ATTENDANCE_STATUS } from './attendance-constants';\nimport type { ICalendarDay, TAttendanceStatus } from './attendance-types';\nimport * as Styled from './attendance.styled';\nimport getColors from '../../../../ui/theme/clrs';\n\nconst colors = getColors();\n\nexport const getSnackbarMsg = (classes: IClassEvent[] | undefined,
|
|
1
|
+
{"version":3,"file":"attendance-utils.js","sources":["../../../../../../src/features/timeline/monthly-report/comps/attendance/attendance-utils.tsx"],"sourcesContent":["import type { JSX } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport CrossIcon from '../../../../../assets/line-icons/icons/cross';\nimport DotIcon from '../../../../../assets/line-icons/icons/dots-icon';\nimport PauseIcon from '../../../../../assets/line-icons/icons/pause-icon';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { IClassEvent, TCalendarData } from '../../monthly-report-types';\nimport { ATTENDANCE_STATUS } from './attendance-constants';\nimport type { ICalendarDay, TAttendanceStatus } from './attendance-types';\nimport * as Styled from './attendance.styled';\nimport getColors from '../../../../ui/theme/clrs';\n\nconst colors = getColors();\n\nexport const getSnackbarMsg = (classes: IClassEvent[] | undefined, d: string) => {\n if (classes?.length === 1 && classes[0]) {\n if (!classes[0].status) return '';\n\n const date = new Date(classes[0].time * 1000);\n const hours = date.getHours();\n const ampm = hours >= 12 ? 'PM' : 'AM';\n const displayHours = hours % 12 || 12;\n\n const timeStr = `${d} / ${displayHours} ${ampm}`;\n\n return [timeStr, classes[0].status].join('\\n');\n }\n\n return [d, ...(classes?.map(item => getStatusText(item)) || [])].join('\\n');\n};\n\nexport const getClassStatus = (classEvent: IClassEvent): TAttendanceStatus => {\n if (classEvent.is_present) {\n return ATTENDANCE_STATUS.ATTENDED;\n }\n\n if (classEvent.is_paused) {\n return ATTENDANCE_STATUS.PAUSED;\n }\n\n return ATTENDANCE_STATUS.MISSED;\n};\n\nexport const attendanceStatsText = (calendarData: TCalendarData) => {\n let attended = 0;\n let missed = 0;\n let paused = 0;\n\n Object.values(calendarData).forEach(dayClasses => {\n dayClasses.forEach(classEvent => {\n const status = getClassStatus(classEvent);\n\n switch (status) {\n case ATTENDANCE_STATUS.ATTENDED:\n attended++;\n break;\n case ATTENDANCE_STATUS.PAUSED:\n paused++;\n break;\n default:\n missed++;\n break;\n }\n });\n });\n\n const parts: string[] = [];\n\n if (attended > 0) parts.push(`${attended} attended`);\n\n if (missed > 0) parts.push(`${missed} missed`);\n\n if (paused > 0) parts.push(`${paused} paused`);\n\n return `${parts.join(', ')}.`;\n};\n\nexport const getDayStatusInfo = (dayClasses: IClassEvent[]) => {\n if (dayClasses.length === 0) {\n return {\n status: null,\n themeColor: null,\n statusSymbol: '',\n };\n }\n\n if (dayClasses.length > 1) {\n return {\n status: ATTENDANCE_STATUS.PAUSED,\n themeColor: 'WHITE_4',\n statusSymbol: (\n <Styled.StatusSymbol $top=\"2px\" $right=\"2px\">\n <DotIcon color=\"GREEN_6\" width={8} height={8} />\n </Styled.StatusSymbol>\n ),\n tooltipBgColor: 'WHITE_5',\n snackbarBg: colors.WHITE_5,\n };\n }\n\n const attendedClass = dayClasses.find(cls => cls.is_present);\n const pausedClass = dayClasses.find(cls => cls.is_paused);\n\n if (attendedClass) {\n return {\n status: ATTENDANCE_STATUS.ATTENDED,\n themeColor: 'GREEN_1',\n statusSymbol: <Check2Icon color=\"GREEN_6\" width={14} height={14} />,\n tooltipBgColor: 'GREEN_2',\n snackbarBg: colors.GREEN_2,\n };\n }\n\n if (pausedClass) {\n return {\n status: ATTENDANCE_STATUS.PAUSED,\n themeColor: 'WHITE_4',\n statusSymbol: <PauseIcon color=\"BLACK_T_60\" width={8} height={8} />,\n tooltipBgColor: 'WHITE_5',\n snackbarBg: colors.WHITE_5,\n };\n }\n\n return {\n status: ATTENDANCE_STATUS.MISSED,\n themeColor: 'ORANGE_1',\n statusSymbol: <CrossIcon color=\"RED\" width={12} height={12} />,\n tooltipBgColor: 'ORANGE_2',\n snackbarBg: colors.ORANGE_2,\n };\n};\n\nexport const generateCalendarGrid = (\n calendarData: TCalendarData,\n reportMonth: number,\n reportYear: number,\n): (ICalendarDay | null)[] => {\n const firstDay = new Date(reportYear, reportMonth - 1, 1).getDay();\n const daysInMonth = new Date(reportYear, reportMonth, 0).getDate();\n const grid: (ICalendarDay | null)[] = [];\n\n // Add empty cells for days before the first day of the month\n for (let i = 0; i < firstDay; i++) {\n grid.push(null);\n }\n\n // Add all days of the month\n for (let day = 1; day <= daysInMonth; day++) {\n const dateString = `${reportYear}-${reportMonth.toString().padStart(2, '0')}-${day\n .toString()\n .padStart(2, '0')}`;\n const dayClasses = calendarData[dateString] || [];\n const { status, themeColor, statusSymbol, tooltipBgColor, snackbarBg } =\n getDayStatusInfo(dayClasses);\n\n grid.push({\n date: day,\n status,\n hasClasses: dayClasses.length > 0,\n classes: dayClasses,\n themeColor: themeColor as TColorNames | null,\n statusSymbol: statusSymbol as JSX.Element,\n tooltipBgColor: tooltipBgColor as TColorNames | null,\n snackbarBg,\n });\n }\n\n return grid;\n};\n\nexport const getStatusText = (classEvent: IClassEvent) => {\n if (!classEvent.status) return '';\n\n const date = new Date(classEvent.time * 1000);\n const hours = date.getHours();\n const ampm = hours >= 12 ? 'PM' : 'AM';\n const displayHours = hours % 12 || 12;\n\n const timeStr = `${displayHours} ${ampm}`;\n\n return `${timeStr}: ${classEvent.status}`;\n};\n"],"names":["colors","getColors","getSnackbarMsg","classes","d","hours","ampm","displayHours","item","getStatusText","getClassStatus","classEvent","ATTENDANCE_STATUS","attendanceStatsText","calendarData","attended","missed","paused","dayClasses","parts","getDayStatusInfo","jsx","Styled.StatusSymbol","DotIcon","attendedClass","cls","pausedClass","Check2Icon","PauseIcon","CrossIcon","generateCalendarGrid","reportMonth","reportYear","firstDay","daysInMonth","grid","i","day","dateString","status","themeColor","statusSymbol","tooltipBgColor","snackbarBg"],"mappings":";;;;;;;;AAaA,MAAMA,IAASC,EAAU,GAEZC,IAAiB,CAACC,GAAoCC,MAAc;AAC/E,OAAID,KAAA,gBAAAA,EAAS,YAAW,KAAKA,EAAQ,CAAC,GAAG;AACvC,QAAI,CAACA,EAAQ,CAAC,EAAE,OAAe,QAAA;AAGzB,UAAAE,IADO,IAAI,KAAKF,EAAQ,CAAC,EAAE,OAAO,GAAI,EACzB,YACbG,IAAOD,KAAS,KAAK,OAAO,MAC5BE,IAAeF,IAAQ,MAAM;AAI5B,WAAA,CAFS,GAAGD,CAAC,MAAMG,CAAY,IAAID,CAAI,IAE7BH,EAAQ,CAAC,EAAE,MAAM,EAAE,KAAK;AAAA,CAAI;AAAA,EAC/C;AAEA,SAAO,CAACC,GAAG,IAAID,KAAA,gBAAAA,EAAS,IAAI,CAAQK,MAAAC,EAAcD,CAAI,OAAM,CAAA,CAAG,EAAE,KAAK;AAAA,CAAI;AAC5E,GAEaE,IAAiB,CAACC,MACzBA,EAAW,aACNC,EAAkB,WAGvBD,EAAW,YACNC,EAAkB,SAGpBA,EAAkB,QAGdC,IAAsB,CAACC,MAAgC;AAClE,MAAIC,IAAW,GACXC,IAAS,GACTC,IAAS;AAEb,SAAO,OAAOH,CAAY,EAAE,QAAQ,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IADO,IAAI,KAAKM,EAAW,OAAO,GAAI,EACzB,YACbL,IAAOD,KAAS,KAAK,OAAO;AAKlC,SAAO,GAFS,GAFKA,IAAQ,MAAM,EAEJ,IAAIC,CAAI,EAEtB,KAAKK,EAAW,MAAM;AACzC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-monthly-timeline-get.js","sources":["../../../../../src/features/timeline/monthly-timeline/api/use-monthly-timeline-get.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../../constants/api';\nimport { type IMonthlyTimeline } from '../monthly-timeline-types';\nimport { stringify } from '../../../../helpers/query-string';\n\ninterface MonthlyTimelineParams {\n
|
|
1
|
+
{"version":3,"file":"use-monthly-timeline-get.js","sources":["../../../../../src/features/timeline/monthly-timeline/api/use-monthly-timeline-get.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../../constants/api';\nimport { type IMonthlyTimeline } from '../monthly-timeline-types';\nimport { stringify } from '../../../../helpers/query-string';\n\ninterface MonthlyTimelineParams {\n course_streams?: string[];\n timezone?: string;\n}\n\nconst { useGet: useMonthlyTimelineGet } = createGetAPI<IMonthlyTimeline[], MonthlyTimelineParams>({\n getURL: (studentId, params: MonthlyTimelineParams) => {\n return `${BASE_URL_V1}/users/${studentId}/reports/?${stringify(params)}`;\n },\n});\n\nexport { useMonthlyTimelineGet };\n"],"names":["useMonthlyTimelineGet","createGetAPI","studentId","params","BASE_URL_V1","stringify"],"mappings":";;;AAWA,MAAM,EAAE,QAAQA,EAAsB,IAAIC,EAAwD;AAAA,EAChG,QAAQ,CAACC,GAAWC,MACX,GAAGC,CAAW,UAAUF,CAAS,aAAaG,EAAUF,CAAM,CAAC;AAE1E,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { useMonthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n}) => {\n const {\n get: getTimeline,\n data: timelineData,\n isProcessing,\n isProcessingFailed,\n } = useMonthlyTimelineGet();\n\n const fetchData = useCallback(() => {\n getTimeline(studentId, {\n
|
|
1
|
+
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { useMonthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n}) => {\n const {\n get: getTimeline,\n data: timelineData,\n isProcessing,\n isProcessingFailed,\n } = useMonthlyTimelineGet();\n\n const fetchData = useCallback(() => {\n getTimeline(studentId, {\n course_streams: userType === 'TEACHER' ? courseStreams : [],\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n });\n }, [getTimeline, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isProcessing || !timelineData) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flex={1} $alignItems=\"center\" $justifyContent=\"center\">\n <Error onTryAgain={fetchData} />\n </FlexView>\n );\n }\n\n return (\n <FlexView $gapX={2}>\n {timelineData.map((item, index) => {\n const isFirstItem = index === 0;\n const isDecember = item.month === 12;\n const showYearImage = !isFirstItem && isDecember;\n const yearImage = yearImages[item.year];\n\n return (\n <FlexView key={`${item.month}-${item.year}`} $width=\"100%\">\n {!isFirstItem && !showYearImage && <Separator heightX={2} />}\n {showYearImage && yearImage && (\n <Styled.ImageContainer $marginBottom={-122}>\n <Image src={yearImage} alt={item.year.toString()} height=\"248px\" />\n </Styled.ImageContainer>\n )}\n <FlexView $gutterX={1}>\n <Text $renderAs=\"ac4\" $color=\"BLACK_T_60\">\n {monthNames[item.month - 1]}\n </Text>\n <Separator heightX={1} />\n <MonthlyTimelineView\n reports={item.reports}\n month={item.month}\n year={item.year}\n onReportClick={onReportClick}\n />\n </FlexView>\n </FlexView>\n );\n })}\n </FlexView>\n );\n};\n\nexport default memo(MonthlyTimeline);\n"],"names":["MonthlyTimeline","userType","studentId","courseStreams","onReportClick","getTimeline","timelineData","isProcessing","isProcessingFailed","useMonthlyTimelineGet","fetchData","useCallback","useEffect","jsx","AppLoader","FlexView","Error","item","index","isFirstItem","isDecember","showYearImage","yearImage","yearImages","jsxs","Separator","Styled.ImageContainer","Image","Text","monthNames","MonthlyTimelineView","monthlyTimeline","memo"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,IAA6C,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACE,QAAA;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,oBAAAC;AAAA,MAC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