@cuemath/leap 2.8.58 → 2.8.60-aa0
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/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.js +18 -18
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.js.map +1 -1
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.js +10 -10
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js +62 -75
- package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/tables-card/tables-card.js +127 -110
- package/dist/features/circle-games/game-launcher/comps/tables-card/tables-card.js.map +1 -1
- package/dist/features/sheets/lessons-list/lesson-item/lesson-item-cta-info.js +41 -41
- package/dist/features/sheets/lessons-list/lesson-item/lesson-item-cta-info.js.map +1 -1
- package/dist/features/sheets/resources-list/resource-item/resource-item.js +20 -20
- package/dist/features/sheets/resources-list/resource-item/resource-item.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/student-actions/student-actions.js +33 -33
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/student-actions/student-actions.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions.js +30 -30
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/sheets/utils/is-v3-worksheet.js +6 -15
- package/dist/features/sheets/utils/is-v3-worksheet.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +39 -24
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +74 -75
- package/package.json +1 -1
@@ -10,7 +10,7 @@ import K from "../../context-menu-helper/menu-element.js";
|
|
10
10
|
import Q from "../../context-menu-helper/target-element.js";
|
11
11
|
import { StyledButton as N, RewardImage as Y, RewardAccuracy as ee } from "../reward-n-actions-styled.js";
|
12
12
|
import { getPrimaryCtaLabel as te } from "./student-actions-utils.js";
|
13
|
-
const we = ({ sheet:
|
13
|
+
const we = ({ sheet: n, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
14
14
|
var A;
|
15
15
|
const { onEvent: w } = H(), {
|
16
16
|
permissions: S,
|
@@ -29,14 +29,14 @@ const we = ({ sheet: t, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
|
29
29
|
ceremony_completed_on_ts: R,
|
30
30
|
can_reattempt_block: U,
|
31
31
|
node_id: b,
|
32
|
-
id:
|
33
|
-
} =
|
32
|
+
id: C
|
33
|
+
} = n, { access: h } = S.can_do, t = J(d), r = W || t, k = a && Z(a), z = a && ((A = a[0]) == null ? void 0 : A.performance), L = !o && !c && typeof y == "number" && !(F && _ && _ === "WAIT_FOR_REVIEW"), v = U && !g, I = o || c || j || V, X = h && I || !r && v, p = !!(i && g && !R), s = f(
|
34
34
|
() => ({
|
35
|
-
user_node_id:
|
35
|
+
user_node_id: C,
|
36
36
|
nodeId: b
|
37
37
|
}),
|
38
|
-
[b,
|
39
|
-
),
|
38
|
+
[b, C]
|
39
|
+
), T = f(
|
40
40
|
() => te({
|
41
41
|
canStart: o,
|
42
42
|
canResume: c,
|
@@ -48,34 +48,34 @@ const we = ({ sheet: t, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
|
48
48
|
), x = $(() => {
|
49
49
|
if (typeof m != "function")
|
50
50
|
throw new Error("onStartOrResume is not a function");
|
51
|
-
m(
|
52
|
-
}, [m,
|
51
|
+
m(n, P());
|
52
|
+
}, [m, n]), E = $(() => {
|
53
53
|
if (typeof l != "function")
|
54
54
|
throw new Error("onReview is not a function");
|
55
55
|
w("clicked", {
|
56
|
-
cta:
|
56
|
+
cta: t ? "View" : "Review sheet",
|
57
57
|
...s
|
58
|
-
}), l(
|
59
|
-
}, [s,
|
58
|
+
}), l(n, P());
|
59
|
+
}, [s, t, l, n, w]), D = r ? !!R : i, G = f(
|
60
60
|
() => [
|
61
61
|
{
|
62
62
|
key: "review-sheet",
|
63
|
-
label:
|
63
|
+
label: t ? "View" : "Review sheet",
|
64
64
|
visible: !!i,
|
65
65
|
onClick: E
|
66
66
|
}
|
67
67
|
],
|
68
|
-
[i, E,
|
68
|
+
[i, E, t]
|
69
69
|
);
|
70
|
-
return
|
71
|
-
|
70
|
+
return t ? null : /* @__PURE__ */ u(M, { $flexDirection: "row", $alignItems: "center", $flexGap: 8, children: [
|
71
|
+
h && r ? /* @__PURE__ */ e(B, { children: (I || p) && /* @__PURE__ */ e(
|
72
72
|
N,
|
73
73
|
{
|
74
74
|
renderAs: "primary",
|
75
75
|
size: "small",
|
76
76
|
widthX: 6,
|
77
77
|
onClick: x,
|
78
|
-
label:
|
78
|
+
label: T,
|
79
79
|
analyticsProps: s
|
80
80
|
}
|
81
81
|
) }) : /* @__PURE__ */ u(B, { children: [
|
@@ -89,8 +89,8 @@ const we = ({ sheet: t, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
|
89
89
|
renderAs: "primary",
|
90
90
|
size: "small",
|
91
91
|
widthX: 6,
|
92
|
-
label:
|
93
|
-
disabled:
|
92
|
+
label: T,
|
93
|
+
disabled: v,
|
94
94
|
onClick: x,
|
95
95
|
analyticsProps: s
|
96
96
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"student-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport { isV3Worksheet } from '../../../../../../sheets/utils/is-v3-worksheet';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledButton } from '../reward-n-actions-styled';\nimport { getPrimaryCtaLabel } from './student-actions-utils';\n\ninterface IStudentActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isLastSheet: boolean;\n isClassOngoing: boolean;\n}\n\nconst StudentActions: FC<IStudentActions> = ({ sheet, isLastSheet, onStartOrResume, onReview }) => {\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n permissions,\n can_start: canStart,\n can_resume: canResume,\n can_review: canReview,\n can_reattempt: canReattempt,\n accuracy,\n can_redo: canRedo,\n rewards,\n attempt_state: attemptState,\n is_subjective: isSubjective,\n is_turing: isTuring,\n completed_on: completedOn,\n node_type: nodeType,\n ceremony_completed_on_ts: ceremonyCompletedOnTS,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n id: userNodeId,\n } = sheet;\n const { access } = permissions.can_do;\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const isInstructionNodeType = isTuring || isPPTNodeType;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n\n const performance = rewards && rewards[0]?.performance;\n const isWaitingForReview = isSubjective && attemptState && attemptState === 'WAIT_FOR_REVIEW';\n const renderAccuracy =\n !canStart && !canResume && typeof accuracy === 'number' && !isWaitingForReview;\n const reattemptBlocked = canReattemptBlock && !completedOn;\n const canStartOrResume = canStart || canResume || canRedo || canReattempt;\n const renderAccuracyNPrimaryCta =\n (access && canStartOrResume) || (!isInstructionNodeType && reattemptBlocked);\n const reviewInstructionNodeType = Boolean(canReview && completedOn && !ceremonyCompletedOnTS);\n\n const analyticsProps = useMemo(\n () => ({\n user_node_id: userNodeId,\n nodeId: nodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const primaryCtaLabel = useMemo(\n () =>\n getPrimaryCtaLabel({\n canStart,\n canResume,\n isInstructionNodeType,\n reviewInstructionNodeType,\n nodeType,\n }),\n [canResume, canStart, isInstructionNodeType, nodeType, reviewInstructionNodeType],\n );\n\n const handleOnActionClick = useCallback(() => {\n if (typeof onStartOrResume !== 'function') {\n throw new Error(`onStartOrResume is not a function`);\n }\n\n onStartOrResume(sheet, isV3Worksheet(sheet));\n }, [onStartOrResume, sheet]);\n\n const handleOnReview = useCallback(() => {\n if (typeof onReview !== 'function') {\n throw new Error(`onReview is not a function`);\n }\n\n trackEvent('clicked', {\n cta: isPPTNodeType ? 'View' : 'Review sheet',\n ...analyticsProps,\n });\n\n onReview(sheet, isV3Worksheet(sheet, 'review'));\n }, [analyticsProps, isPPTNodeType, onReview, sheet, trackEvent]);\n\n const isMenuVisible = isInstructionNodeType ? Boolean(ceremonyCompletedOnTS) : canReview;\n const options = useMemo(\n () => [\n {\n key: 'review-sheet',\n label: isPPTNodeType ? 'View' : 'Review sheet',\n visible: Boolean(canReview),\n onClick: handleOnReview,\n },\n ],\n [canReview, handleOnReview, isPPTNodeType],\n );\n\n if (isPPTNodeType) return null;\n\n return (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGap={8}>\n {access && isInstructionNodeType ? (\n <>\n {(canStartOrResume || reviewInstructionNodeType) && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n onClick={handleOnActionClick}\n label={primaryCtaLabel}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n ) : (\n <>\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {renderAccuracyNPrimaryCta && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n label={primaryCtaLabel}\n disabled={reattemptBlocked}\n onClick={handleOnActionClick}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n )}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default StudentActions;\n"],"names":["StudentActions","sheet","isLastSheet","onStartOrResume","onReview","trackEvent","useUIContext","permissions","canStart","canResume","canReview","canReattempt","accuracy","canRedo","rewards","attemptState","isSubjective","isTuring","completedOn","nodeType","ceremonyCompletedOnTS","canReattemptBlock","nodeId","userNodeId","access","isPPTNodeType","checkIfPPTNodeType","isInstructionNodeType","rewardsBadgeUrl","getRewardsBadgeUrl","performance","_a","renderAccuracy","reattemptBlocked","canStartOrResume","renderAccuracyNPrimaryCta","reviewInstructionNodeType","analyticsProps","useMemo","primaryCtaLabel","getPrimaryCtaLabel","handleOnActionClick","useCallback","isV3Worksheet","handleOnReview","isMenuVisible","options","FlexView","jsx","Fragment","StyledButton","jsxs","RewardImage","RewardAccuracy","ContextMenu","ContextMenuTargetElement","ContextMenuElement"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,KAAsC,CAAC,EAAE,OAAAC,GAAO,aAAAC,GAAa,iBAAAC,GAAiB,UAAAC,QAAe;;AACjG,QAAM,EAAE,SAASC,EAAW,IAAIC,EAAa,GAEvC;AAAA,IACJ,aAAAC;AAAA,IACA,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,YAAYC;AAAA,IACZ,eAAeC;AAAA,IACf,UAAAC;AAAA,IACA,UAAUC;AAAA,IACV,SAAAC;AAAA,IACA,eAAeC;AAAA,IACf,eAAeC;AAAA,IACf,WAAWC;AAAA,IACX,cAAcC;AAAA,IACd,WAAWC;AAAA,IACX,0BAA0BC;AAAA,IAC1B,qBAAqBC;AAAA,IACrB,SAASC;AAAA,IACT,IAAIC;AAAA,EACF,IAAAtB,GACE,EAAE,QAAAuB,EAAO,IAAIjB,EAAY,QACzBkB,IAAgBC,EAAmBP,CAAQ,GAC3CQ,IAAwBV,KAAYQ,GACpCG,IAAkBd,KAAWe,EAAmBf,CAAO,GAEvDgB,IAAchB,OAAWiB,IAAAjB,EAAQ,CAAC,MAAT,gBAAAiB,EAAY,cAErCC,IACJ,CAACxB,KAAY,CAACC,KAAa,OAAOG,KAAa,YAAY,EAFlCI,KAAgBD,KAAgBA,MAAiB,oBAGtEkB,IAAmBZ,KAAqB,CAACH,GACzCgB,IAAmB1B,KAAYC,KAAaI,KAAWF,GACvDwB,IACHX,KAAUU,KAAsB,CAACP,KAAyBM,GACvDG,IAA4B,GAAQ1B,KAAaQ,KAAe,CAACE,IAEjEiB,IAAiBC;AAAA,IACrB,OAAO;AAAA,MACL,cAAcf;AAAA,MACd,QAAAD;AAAA,IAAA;AAAA,IAEF,CAACA,GAAQC,CAAU;AAAA,EAAA,GAGfgB,IAAkBD;AAAA,IACtB,MACEE,GAAmB;AAAA,MACjB,UAAAhC;AAAA,MACA,WAAAC;AAAA,MACA,uBAAAkB;AAAA,MACA,2BAAAS;AAAA,MACA,UAAAjB;AAAA,IAAA,CACD;AAAA,IACH,CAACV,GAAWD,GAAUmB,GAAuBR,GAAUiB,CAAyB;AAAA,EAAA,GAG5EK,IAAsBC,EAAY,MAAM;AACxC,QAAA,OAAOvC,KAAoB;AACvB,YAAA,IAAI,MAAM,mCAAmC;AAGrC,IAAAA,EAAAF,GAAO0C,
|
1
|
+
{"version":3,"file":"student-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport { isV3Worksheet } from '../../../../../../sheets/utils/is-v3-worksheet';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledButton } from '../reward-n-actions-styled';\nimport { getPrimaryCtaLabel } from './student-actions-utils';\n\ninterface IStudentActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isLastSheet: boolean;\n isClassOngoing: boolean;\n}\n\nconst StudentActions: FC<IStudentActions> = ({ sheet, isLastSheet, onStartOrResume, onReview }) => {\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n permissions,\n can_start: canStart,\n can_resume: canResume,\n can_review: canReview,\n can_reattempt: canReattempt,\n accuracy,\n can_redo: canRedo,\n rewards,\n attempt_state: attemptState,\n is_subjective: isSubjective,\n is_turing: isTuring,\n completed_on: completedOn,\n node_type: nodeType,\n ceremony_completed_on_ts: ceremonyCompletedOnTS,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n id: userNodeId,\n } = sheet;\n const { access } = permissions.can_do;\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const isInstructionNodeType = isTuring || isPPTNodeType;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n\n const performance = rewards && rewards[0]?.performance;\n const isWaitingForReview = isSubjective && attemptState && attemptState === 'WAIT_FOR_REVIEW';\n const renderAccuracy =\n !canStart && !canResume && typeof accuracy === 'number' && !isWaitingForReview;\n const reattemptBlocked = canReattemptBlock && !completedOn;\n const canStartOrResume = canStart || canResume || canRedo || canReattempt;\n const renderAccuracyNPrimaryCta =\n (access && canStartOrResume) || (!isInstructionNodeType && reattemptBlocked);\n const reviewInstructionNodeType = Boolean(canReview && completedOn && !ceremonyCompletedOnTS);\n\n const analyticsProps = useMemo(\n () => ({\n user_node_id: userNodeId,\n nodeId: nodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const primaryCtaLabel = useMemo(\n () =>\n getPrimaryCtaLabel({\n canStart,\n canResume,\n isInstructionNodeType,\n reviewInstructionNodeType,\n nodeType,\n }),\n [canResume, canStart, isInstructionNodeType, nodeType, reviewInstructionNodeType],\n );\n\n const handleOnActionClick = useCallback(() => {\n if (typeof onStartOrResume !== 'function') {\n throw new Error(`onStartOrResume is not a function`);\n }\n\n onStartOrResume(sheet, isV3Worksheet(sheet));\n }, [onStartOrResume, sheet]);\n\n const handleOnReview = useCallback(() => {\n if (typeof onReview !== 'function') {\n throw new Error(`onReview is not a function`);\n }\n\n trackEvent('clicked', {\n cta: isPPTNodeType ? 'View' : 'Review sheet',\n ...analyticsProps,\n });\n\n onReview(sheet, isV3Worksheet(sheet, 'review'));\n }, [analyticsProps, isPPTNodeType, onReview, sheet, trackEvent]);\n\n const isMenuVisible = isInstructionNodeType ? Boolean(ceremonyCompletedOnTS) : canReview;\n const options = useMemo(\n () => [\n {\n key: 'review-sheet',\n label: isPPTNodeType ? 'View' : 'Review sheet',\n visible: Boolean(canReview),\n onClick: handleOnReview,\n },\n ],\n [canReview, handleOnReview, isPPTNodeType],\n );\n\n if (isPPTNodeType) return null;\n\n return (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGap={8}>\n {access && isInstructionNodeType ? (\n <>\n {(canStartOrResume || reviewInstructionNodeType) && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n onClick={handleOnActionClick}\n label={primaryCtaLabel}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n ) : (\n <>\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {renderAccuracyNPrimaryCta && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n label={primaryCtaLabel}\n disabled={reattemptBlocked}\n onClick={handleOnActionClick}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n )}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default StudentActions;\n"],"names":["StudentActions","sheet","isLastSheet","onStartOrResume","onReview","trackEvent","useUIContext","permissions","canStart","canResume","canReview","canReattempt","accuracy","canRedo","rewards","attemptState","isSubjective","isTuring","completedOn","nodeType","ceremonyCompletedOnTS","canReattemptBlock","nodeId","userNodeId","access","isPPTNodeType","checkIfPPTNodeType","isInstructionNodeType","rewardsBadgeUrl","getRewardsBadgeUrl","performance","_a","renderAccuracy","reattemptBlocked","canStartOrResume","renderAccuracyNPrimaryCta","reviewInstructionNodeType","analyticsProps","useMemo","primaryCtaLabel","getPrimaryCtaLabel","handleOnActionClick","useCallback","isV3Worksheet","handleOnReview","isMenuVisible","options","FlexView","jsx","Fragment","StyledButton","jsxs","RewardImage","RewardAccuracy","ContextMenu","ContextMenuTargetElement","ContextMenuElement"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,KAAsC,CAAC,EAAE,OAAAC,GAAO,aAAAC,GAAa,iBAAAC,GAAiB,UAAAC,QAAe;;AACjG,QAAM,EAAE,SAASC,EAAW,IAAIC,EAAa,GAEvC;AAAA,IACJ,aAAAC;AAAA,IACA,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,YAAYC;AAAA,IACZ,eAAeC;AAAA,IACf,UAAAC;AAAA,IACA,UAAUC;AAAA,IACV,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,UACC,UAAS;AAAA,UACT,MAAK;AAAA,UACL,QAAQ;AAAA,UACR,OAAOX;AAAA,UACP,UAAUN;AAAA,UACV,SAASQ;AAAA,UACT,gBAAAJ;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAEJ;AAAA,IAGDQ,KACC,gBAAAG;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,iCAAgBC,GAAyB,EAAA;AAAA,QACzC,aAAc,gBAAAP,EAAAQ,GAAA,EAAmB,SAAAV,EAAkB,CAAA;AAAA,QACnD,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU5C;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
@@ -14,7 +14,7 @@ import { StyledEyeIcon as $, RewardImage as Z, RewardAccuracy as q } from "../re
|
|
14
14
|
const se = ({
|
15
15
|
isLastSheet: M,
|
16
16
|
isClassOngoing: N,
|
17
|
-
sheet:
|
17
|
+
sheet: n,
|
18
18
|
...v
|
19
19
|
}) => {
|
20
20
|
var h;
|
@@ -29,7 +29,7 @@ const se = ({
|
|
29
29
|
completed_on: y,
|
30
30
|
can_reattempt_block: _,
|
31
31
|
node_id: g
|
32
|
-
} =
|
32
|
+
} = n, { code: p } = P.can_do, I = i === D.HIDDEN_BASIC, S = c && ((h = c[0]) == null ? void 0 : h.performance), A = c && G(c), C = W(i), B = k && typeof f == "number" && !C, U = d && !I, b = C && N && p === "IN_PROGRESS", O = !!(p && L(p)), t = E(
|
33
33
|
() => ({
|
34
34
|
node_id: g,
|
35
35
|
user_node_id: d
|
@@ -39,12 +39,12 @@ const se = ({
|
|
39
39
|
(o) => {
|
40
40
|
if (r("clicked", {
|
41
41
|
cta: o,
|
42
|
-
...
|
42
|
+
...t
|
43
43
|
}), typeof m != "function")
|
44
44
|
throw new Error("onMenuActionAttempt must be a function");
|
45
|
-
m(o,
|
45
|
+
m(o, n);
|
46
46
|
},
|
47
|
-
[
|
47
|
+
[t, m, n, r]
|
48
48
|
), V = E(
|
49
49
|
() => [
|
50
50
|
{
|
@@ -69,11 +69,11 @@ const se = ({
|
|
69
69
|
[_, y, w, i, l]
|
70
70
|
), a = T(
|
71
71
|
(o) => {
|
72
|
-
if (o && r(o,
|
72
|
+
if (o && r(o, t), typeof s != "function")
|
73
73
|
throw new Error("onView must be a function");
|
74
|
-
s(
|
74
|
+
s(n, H());
|
75
75
|
},
|
76
|
-
[
|
76
|
+
[t, s, n, r]
|
77
77
|
);
|
78
78
|
return I ? /* @__PURE__ */ e(u, { $flexGap: 8, $flexDirection: "row", $alignItems: "center", children: O ? /* @__PURE__ */ e($, { onClick: () => a("clicked") }) : /* @__PURE__ */ e(
|
79
79
|
R,
|
@@ -82,7 +82,7 @@ const se = ({
|
|
82
82
|
size: "small",
|
83
83
|
label: "Start",
|
84
84
|
onClick: a,
|
85
|
-
analyticsProps:
|
85
|
+
analyticsProps: t
|
86
86
|
}
|
87
87
|
) }) : /* @__PURE__ */ x(u, { $flexGap: 8, $flexDirection: "row", $alignItems: "center", children: [
|
88
88
|
B && /* @__PURE__ */ x(u, { $justifyContent: "center", $alignItems: "center", children: [
|
@@ -96,7 +96,7 @@ const se = ({
|
|
96
96
|
size: "small",
|
97
97
|
label: "Resume",
|
98
98
|
onClick: a,
|
99
|
-
analyticsProps:
|
99
|
+
analyticsProps: t
|
100
100
|
}
|
101
101
|
),
|
102
102
|
!b && /* @__PURE__ */ e($, { onClick: () => a("clicked") }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { NODE_TYPE } from '../../../../../../sheets/constants/sheet';\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport { isV3Worksheet } from '../../../../../../sheets/utils/is-v3-worksheet';\nimport Button from '../../../../../../ui/buttons/button/button';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfIsHiddenUnlocked, checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledEyeIcon } from '../reward-n-actions-styled';\n\nexport interface ITeacherActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isClassOngoing: boolean;\n isLastSheet: boolean;\n}\n\nconst TeacherActions: FC<ITeacherActions> = ({\n isLastSheet,\n isClassOngoing,\n sheet,\n ...restTeacherActionsProps\n}) => {\n const { onView, onMenuActionAttempt } = restTeacherActionsProps;\n\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n accuracy,\n can_teacher_review: canTeacherReview,\n id: userNodeId,\n node_type: nodeType,\n permissions,\n rewards,\n is_turing: isTuring,\n completed_on: completedOn,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n } = sheet;\n const { code } = permissions.can_do;\n const isHiddenNode = nodeType === NODE_TYPE.HIDDEN_BASIC;\n const performance = rewards && rewards[0]?.performance;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const renderAccuracy = canTeacherReview && typeof accuracy === 'number' && !isPPTNodeType;\n const isMenuVisible = userNodeId && !isHiddenNode;\n const pptNodeTypeSheetInProgress = isPPTNodeType && isClassOngoing && code === 'IN_PROGRESS';\n const isHiddenUnlocked = Boolean(code && checkIfIsHiddenUnlocked(code));\n\n const analyticsProps = useMemo(\n () => ({\n node_id: nodeId,\n user_node_id: userNodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const handleOnMenuActionAttempt = useCallback(\n (action: string) => {\n trackEvent('clicked', {\n cta: action,\n ...analyticsProps,\n });\n\n if (typeof onMenuActionAttempt !== 'function') {\n throw new Error('onMenuActionAttempt must be a function');\n }\n\n onMenuActionAttempt(action, sheet);\n },\n [analyticsProps, onMenuActionAttempt, sheet, trackEvent],\n );\n\n const options = useMemo(\n () => [\n {\n key: 'change-location',\n label: 'Change Location',\n visible: true,\n onClick: () => handleOnMenuActionAttempt('change_attempt_location'),\n },\n {\n key: 'turing-option',\n label: completedOn && nodeType !== 'TURING_BASIC' ? 'Student Work Url' : 'Activity Link',\n visible: isTuring,\n onClick: () => handleOnMenuActionAttempt('turing_attempt'),\n },\n {\n key: 'allow-reattempt',\n label: 'Allow Reattempt',\n visible: canReattemptBlock,\n onClick: () => handleOnMenuActionAttempt('allow_reattempt'),\n },\n ],\n [canReattemptBlock, completedOn, isTuring, nodeType, handleOnMenuActionAttempt],\n );\n\n const handleOnView = useCallback(\n (action?: string) => {\n if (action) {\n trackEvent(action, analyticsProps);\n }\n\n if (typeof onView !== 'function') {\n throw new Error('onView must be a function');\n }\n\n onView(sheet, isV3Worksheet(sheet));\n },\n [analyticsProps, onView, sheet, trackEvent],\n );\n\n if (isHiddenNode) {\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {isHiddenUnlocked ? (\n <StyledEyeIcon onClick={() => handleOnView('clicked')} />\n ) : (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Start\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {canTeacherReview && pptNodeTypeSheetInProgress && (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Resume\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n\n {!pptNodeTypeSheetInProgress && <StyledEyeIcon onClick={() => handleOnView('clicked')} />}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default TeacherActions;\n"],"names":["TeacherActions","isLastSheet","isClassOngoing","sheet","restTeacherActionsProps","onView","onMenuActionAttempt","trackEvent","useUIContext","accuracy","canTeacherReview","userNodeId","nodeType","permissions","rewards","isTuring","completedOn","canReattemptBlock","nodeId","code","isHiddenNode","NODE_TYPE","performance","_a","rewardsBadgeUrl","getRewardsBadgeUrl","isPPTNodeType","checkIfPPTNodeType","renderAccuracy","isMenuVisible","pptNodeTypeSheetInProgress","isHiddenUnlocked","checkIfIsHiddenUnlocked","analyticsProps","useMemo","handleOnMenuActionAttempt","useCallback","action","options","handleOnView","isV3Worksheet","FlexView","jsx","StyledEyeIcon","Button","jsxs","RewardImage","RewardAccuracy","ContextMenu","ContextMenuTargetElement","ContextMenuElement"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMA,KAAsC,CAAC;AAAA,EAC3C,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAM;;AACE,QAAA,EAAE,QAAAC,GAAQ,qBAAAC,EAAwB,IAAAF,GAElC,EAAE,SAASG,EAAW,IAAIC,EAAa,GAEvC;AAAA,IACJ,UAAAC;AAAA,IACA,oBAAoBC;AAAA,IACpB,IAAIC;AAAA,IACJ,WAAWC;AAAA,IACX,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAWC;AAAA,IACX,cAAcC;AAAA,IACd,qBAAqBC;AAAA,IACrB,SAASC;AAAA,EACP,IAAAf,GACE,EAAE,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,GAAaD,GAAUH,GAAUuB,CAAyB;AAAA,EAAA,GAG1EI,IAAeH;AAAA,IACnB,CAACC,MAAoB;AAKf,UAJAA,KACF9B,EAAW8B,GAAQJ,CAAc,GAG/B,OAAO5B,KAAW;AACd,cAAA,IAAI,MAAM,2BAA2B;AAGtC,MAAAA,EAAAF,GAAOqC,
|
1
|
+
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { NODE_TYPE } from '../../../../../../sheets/constants/sheet';\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport { isV3Worksheet } from '../../../../../../sheets/utils/is-v3-worksheet';\nimport Button from '../../../../../../ui/buttons/button/button';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfIsHiddenUnlocked, checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledEyeIcon } from '../reward-n-actions-styled';\n\nexport interface ITeacherActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isClassOngoing: boolean;\n isLastSheet: boolean;\n}\n\nconst TeacherActions: FC<ITeacherActions> = ({\n isLastSheet,\n isClassOngoing,\n sheet,\n ...restTeacherActionsProps\n}) => {\n const { onView, onMenuActionAttempt } = restTeacherActionsProps;\n\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n accuracy,\n can_teacher_review: canTeacherReview,\n id: userNodeId,\n node_type: nodeType,\n permissions,\n rewards,\n is_turing: isTuring,\n completed_on: completedOn,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n } = sheet;\n const { code } = permissions.can_do;\n const isHiddenNode = nodeType === NODE_TYPE.HIDDEN_BASIC;\n const performance = rewards && rewards[0]?.performance;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const renderAccuracy = canTeacherReview && typeof accuracy === 'number' && !isPPTNodeType;\n const isMenuVisible = userNodeId && !isHiddenNode;\n const pptNodeTypeSheetInProgress = isPPTNodeType && isClassOngoing && code === 'IN_PROGRESS';\n const isHiddenUnlocked = Boolean(code && checkIfIsHiddenUnlocked(code));\n\n const analyticsProps = useMemo(\n () => ({\n node_id: nodeId,\n user_node_id: userNodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const handleOnMenuActionAttempt = useCallback(\n (action: string) => {\n trackEvent('clicked', {\n cta: action,\n ...analyticsProps,\n });\n\n if (typeof onMenuActionAttempt !== 'function') {\n throw new Error('onMenuActionAttempt must be a function');\n }\n\n onMenuActionAttempt(action, sheet);\n },\n [analyticsProps, onMenuActionAttempt, sheet, trackEvent],\n );\n\n const options = useMemo(\n () => [\n {\n key: 'change-location',\n label: 'Change Location',\n visible: true,\n onClick: () => handleOnMenuActionAttempt('change_attempt_location'),\n },\n {\n key: 'turing-option',\n label: completedOn && nodeType !== 'TURING_BASIC' ? 'Student Work Url' : 'Activity Link',\n visible: isTuring,\n onClick: () => handleOnMenuActionAttempt('turing_attempt'),\n },\n {\n key: 'allow-reattempt',\n label: 'Allow Reattempt',\n visible: canReattemptBlock,\n onClick: () => handleOnMenuActionAttempt('allow_reattempt'),\n },\n ],\n [canReattemptBlock, completedOn, isTuring, nodeType, handleOnMenuActionAttempt],\n );\n\n const handleOnView = useCallback(\n (action?: string) => {\n if (action) {\n trackEvent(action, analyticsProps);\n }\n\n if (typeof onView !== 'function') {\n throw new Error('onView must be a function');\n }\n\n onView(sheet, isV3Worksheet(sheet));\n },\n [analyticsProps, onView, sheet, trackEvent],\n );\n\n if (isHiddenNode) {\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {isHiddenUnlocked ? (\n <StyledEyeIcon onClick={() => handleOnView('clicked')} />\n ) : (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Start\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {canTeacherReview && pptNodeTypeSheetInProgress && (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Resume\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n\n {!pptNodeTypeSheetInProgress && <StyledEyeIcon onClick={() => handleOnView('clicked')} />}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default TeacherActions;\n"],"names":["TeacherActions","isLastSheet","isClassOngoing","sheet","restTeacherActionsProps","onView","onMenuActionAttempt","trackEvent","useUIContext","accuracy","canTeacherReview","userNodeId","nodeType","permissions","rewards","isTuring","completedOn","canReattemptBlock","nodeId","code","isHiddenNode","NODE_TYPE","performance","_a","rewardsBadgeUrl","getRewardsBadgeUrl","isPPTNodeType","checkIfPPTNodeType","renderAccuracy","isMenuVisible","pptNodeTypeSheetInProgress","isHiddenUnlocked","checkIfIsHiddenUnlocked","analyticsProps","useMemo","handleOnMenuActionAttempt","useCallback","action","options","handleOnView","isV3Worksheet","FlexView","jsx","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AA,EAAS,iBAAgB,UAAS,aAAY,UAC5C,UAAA;AAAA,MAAAjB,KAAoB,gBAAAkB,EAAAI,GAAA,EAAY,KAAKtB,GAAiB,KAAI,UAAS;AAAA,MACnE,gBAAAkB,EAAAK,GAAA,EAAe,WAAU,YAAW,QAAO,UACzC,UAAezB,KAAA,GAAG,KAAK,KAAKb,CAAQ,CAAC,KACxC;AAAA,IAAA,GACF;AAAA,IAGDC,KAAoBoB,KACnB,gBAAAY;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,UAAS;AAAA,QACT,MAAK;AAAA,QACL,OAAM;AAAA,QACN,SAASL;AAAA,QACT,gBAAAN;AAAA,MAAA;AAAA,IACF;AAAA,IAGD,CAACH,KAA+B,gBAAAY,EAAAC,GAAA,EAAc,SAAS,MAAMJ,EAAa,SAAS,GAAG;AAAA,IAEtFV,KACC,gBAAAa;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,iCAAgBC,GAAyB,EAAA;AAAA,QACzC,aAAc,gBAAAP,EAAAQ,GAAA,EAAmB,SAAAZ,EAAkB,CAAA;AAAA,QACnD,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAUrC;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js
CHANGED
@@ -1,118 +1,105 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import $ from "../../../../../assets/
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
import U from "
|
8
|
-
|
9
|
-
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}) => {
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
loop: !0,
|
26
|
-
autoplay: !0,
|
27
|
-
animationData: p
|
28
|
-
});
|
29
|
-
})(), () => o == null ? void 0 : o.destroy();
|
30
|
-
}, [m]);
|
31
|
-
const d = c(() => s(l), [s, l]);
|
32
|
-
return /* @__PURE__ */ t(z, { children: /* @__PURE__ */ I(J, { $segmentType: e, onMouseEnter: d, children: [
|
33
|
-
/* @__PURE__ */ t(K, { ref: a, $segmentType: e }),
|
34
|
-
i && /* @__PURE__ */ t(Q, { $segmentType: e, children: /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t($, { color: "#fff", height: 40, width: 40 }) }) })
|
35
|
-
] }) });
|
36
|
-
}, Y = ({ data: e, label: i, initialValue: m = 0, value: l, maxValue: s = 1 }, a) => {
|
37
|
-
const d = T(null), o = T(null), [u, p] = h(i), [L, y] = h(!1), [R, P] = h("WHITE_T_87"), _ = u !== i, C = c((n) => {
|
38
|
-
p(n);
|
39
|
-
}, []), b = c(() => {
|
40
|
-
p(i);
|
41
|
-
}, [i]), g = c(
|
42
|
-
(n) => {
|
43
|
-
var r, f;
|
44
|
-
(f = (r = e[n]) == null ? void 0 : r.onPress) == null || f.call(r);
|
1
|
+
import { jsx as n, jsxs as L } from "react/jsx-runtime";
|
2
|
+
import { memo as P, useCallback as m, forwardRef as O, useRef as E, useState as f, useImperativeHandle as F, useMemo as A } from "react";
|
3
|
+
import G from "../../../../../assets/line-icons/icons/check.js";
|
4
|
+
import { LOTTIE as $ } from "../../../../../assets/lottie/lottie.js";
|
5
|
+
import R from "../../../../ui/lottie-animation/lottie-animation.js";
|
6
|
+
import { CardContainer as j } from "../card-container/card-container.js";
|
7
|
+
import { SegmentContainer as w, SegmentContentContainer as U, SegmentAssetContainer as x, SegmentOverlay as B, IconWrapper as N, CircularProgressLottieContainer as q, SegmentLeft as z, SegmentRight as D, SegmentBottom as J } from "./segmented-game-card-styled.js";
|
8
|
+
const K = { renderer: "canvas", loop: !0 }, C = P(
|
9
|
+
({ segmentType: e, isCompleted: o, card: c, name: i, onMouseEnter: s }) => {
|
10
|
+
const a = m(() => s(i), [s, i]);
|
11
|
+
return /* @__PURE__ */ n(w, { children: /* @__PURE__ */ L(U, { $segmentType: e, onMouseEnter: a, children: [
|
12
|
+
/* @__PURE__ */ n(x, { $segmentType: e, children: /* @__PURE__ */ n(R, { src: c, settings: K, animateOnIntersect: !0 }) }),
|
13
|
+
o && /* @__PURE__ */ n(B, { $segmentType: e, children: /* @__PURE__ */ n(N, { children: /* @__PURE__ */ n(G, { color: "#fff", height: 40, width: 40 }) }) })
|
14
|
+
] }) });
|
15
|
+
}
|
16
|
+
), Q = ({ data: e, label: o, initialValue: c = 0, value: i, maxValue: s = 1 }, a) => {
|
17
|
+
const g = E(null), h = E(null), [u, S] = f(o), [T, _] = f(!1), [b, M] = f("WHITE_T_87"), W = u !== o, d = m((t) => {
|
18
|
+
S(t);
|
19
|
+
}, []), k = m(() => {
|
20
|
+
S(o);
|
21
|
+
}, [o]), p = m(
|
22
|
+
(t) => {
|
23
|
+
var r, l;
|
24
|
+
(l = (r = e[t]) == null ? void 0 : r.onPress) == null || l.call(r);
|
45
25
|
},
|
46
26
|
[e]
|
47
|
-
),
|
48
|
-
|
27
|
+
), v = m((t) => {
|
28
|
+
_(!0), M(t);
|
49
29
|
}, []);
|
50
30
|
F(a, () => ({
|
51
|
-
labelRef:
|
52
|
-
segmentedCardWrapperRef:
|
53
|
-
startLabelAnimation:
|
31
|
+
labelRef: g,
|
32
|
+
segmentedCardWrapperRef: h,
|
33
|
+
startLabelAnimation: v
|
54
34
|
}));
|
55
|
-
const
|
35
|
+
const I = A(() => {
|
56
36
|
if (s <= 0)
|
57
37
|
return;
|
58
|
-
const
|
59
|
-
return [
|
60
|
-
}, [
|
38
|
+
const t = 92, r = t / s, l = Math.min(r * c, t), H = Math.min(r * i + 1, t);
|
39
|
+
return [l, H];
|
40
|
+
}, [c, s, i]), y = A(
|
61
41
|
() => ({
|
62
42
|
renderer: "canvas",
|
63
43
|
autoplay: !0,
|
64
44
|
loop: !1,
|
65
|
-
initialSegment:
|
45
|
+
initialSegment: I
|
66
46
|
}),
|
67
|
-
[
|
47
|
+
[I]
|
68
48
|
);
|
69
|
-
return /* @__PURE__ */
|
70
|
-
|
49
|
+
return /* @__PURE__ */ L(
|
50
|
+
j,
|
71
51
|
{
|
72
|
-
ref:
|
73
|
-
labelRef:
|
52
|
+
ref: h,
|
53
|
+
labelRef: g,
|
74
54
|
label: u,
|
75
|
-
isAnimated:
|
76
|
-
onMouseLeave:
|
77
|
-
labelColor:
|
55
|
+
isAnimated: T,
|
56
|
+
onMouseLeave: k,
|
57
|
+
labelColor: T ? b : W ? "WHITE_T_87" : "WHITE_T_60",
|
78
58
|
children: [
|
79
|
-
/* @__PURE__ */
|
80
|
-
|
81
|
-
|
59
|
+
/* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(
|
60
|
+
R,
|
61
|
+
{
|
62
|
+
src: $.LEVELUP_RINGS,
|
63
|
+
settings: y,
|
64
|
+
animateOnIntersect: !0
|
65
|
+
}
|
66
|
+
) }),
|
67
|
+
/* @__PURE__ */ n(z, { onClick: () => p(0), children: /* @__PURE__ */ n(
|
68
|
+
C,
|
82
69
|
{
|
83
70
|
segmentType: "left",
|
84
71
|
card: e[0].card,
|
85
72
|
name: e[0].name,
|
86
73
|
isCompleted: e[0].isCompleted,
|
87
|
-
onMouseEnter:
|
74
|
+
onMouseEnter: d
|
88
75
|
}
|
89
76
|
) }),
|
90
|
-
/* @__PURE__ */
|
91
|
-
|
77
|
+
/* @__PURE__ */ n(D, { onClick: () => p(1), children: /* @__PURE__ */ n(
|
78
|
+
C,
|
92
79
|
{
|
93
80
|
segmentType: "right",
|
94
81
|
card: e[1].card,
|
95
82
|
name: e[1].name,
|
96
83
|
isCompleted: e[1].isCompleted,
|
97
|
-
onMouseEnter:
|
84
|
+
onMouseEnter: d
|
98
85
|
}
|
99
86
|
) }),
|
100
|
-
/* @__PURE__ */
|
101
|
-
|
87
|
+
/* @__PURE__ */ n(J, { onClick: () => p(2), children: /* @__PURE__ */ n(
|
88
|
+
C,
|
102
89
|
{
|
103
90
|
segmentType: "bottom",
|
104
91
|
card: e[2].card,
|
105
92
|
name: e[2].name,
|
106
93
|
isCompleted: e[2].isCompleted,
|
107
|
-
onMouseEnter:
|
94
|
+
onMouseEnter: d
|
108
95
|
}
|
109
96
|
) })
|
110
97
|
]
|
111
98
|
}
|
112
99
|
);
|
113
|
-
},
|
100
|
+
}, re = P(O(Q));
|
114
101
|
export {
|
115
|
-
|
116
|
-
|
102
|
+
C as SegmentContent,
|
103
|
+
re as SegmentedGameCard
|
117
104
|
};
|
118
105
|
//# sourceMappingURL=segmented-game-card.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"segmented-game-card.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.tsx"],"sourcesContent":["import type { TColorNames } from '../../../../ui/types';\nimport type {\n IGameCardSegmentContentProps,\n ISegmentedGameCardProps,\n ISegmentedGameCardRefs,\n} from './segmented-game-card-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC, ForwardRefRenderFunction } from 'react';\n\nimport Lottie from 'lottie-web';\nimport {\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport CheckIcon from '../../../../../assets/line-icons/icons/check';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport { fetchLottie } from '../../../../ui/lottie-animation/helper';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { CardContainer } from '../card-container/card-container';\nimport * as Styled from './segmented-game-card-styled';\n\nexport const SegmentContent: FC<IGameCardSegmentContentProps> = ({\n segmentType,\n isCompleted,\n card,\n name,\n onMouseEnter,\n}) => {\n const lottieAnimationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let animation: AnimationItem | null = null;\n\n const loadLottie = async () => {\n const lottie = await fetchLottie(card);\n\n animation = Lottie.loadAnimation({\n container: lottieAnimationRef.current as Element,\n renderer: 'canvas',\n loop: true,\n autoplay: true,\n animationData: lottie,\n });\n };\n\n loadLottie();\n\n return () => {\n return animation?.destroy();\n };\n }, [card]);\n\n const handleMouseEnter = useCallback(() => onMouseEnter(name), [onMouseEnter, name]);\n\n return (\n <Styled.SegmentContainer>\n <Styled.SegmentContentContainer $segmentType={segmentType} onMouseEnter={handleMouseEnter}>\n <Styled.SegmentAssetContainer ref={lottieAnimationRef} $segmentType={segmentType} />\n {isCompleted && (\n <Styled.SegmentOverlay $segmentType={segmentType}>\n <Styled.IconWrapper>\n <CheckIcon color=\"#fff\" height={40} width={40} />\n </Styled.IconWrapper>\n </Styled.SegmentOverlay>\n )}\n </Styled.SegmentContentContainer>\n </Styled.SegmentContainer>\n );\n};\n\nconst SegmentedGameCardComponent: ForwardRefRenderFunction<\n ISegmentedGameCardRefs,\n ISegmentedGameCardProps\n> = ({ data, label: gameCategoryLabel, initialValue = 0, value, maxValue = 1 }, ref) => {\n const labelRef = useRef<HTMLDivElement>(null);\n const cardWrapperRef = useRef<HTMLDivElement>(null);\n\n const [label, setLabel] = useState<string>(gameCategoryLabel);\n const [isAnimated, setIsAnimated] = useState(false);\n const [animatedColor, setAnimatedColor] = useState<TColorNames>('WHITE_T_87');\n\n const isLabelHighlighted = label !== gameCategoryLabel;\n\n const onMouseEnter = useCallback((gameName: string) => {\n setLabel(gameName);\n }, []);\n\n const onMouseLeave = useCallback(() => {\n setLabel(gameCategoryLabel);\n }, [gameCategoryLabel]);\n\n const onSegmentPress = useCallback(\n (index: number) => {\n data[index]?.onPress?.();\n },\n [data],\n );\n\n const startLabelAnimation = useCallback((color: TColorNames) => {\n setIsAnimated(true);\n setAnimatedColor(color);\n }, []);\n\n useImperativeHandle(ref, () => ({\n labelRef,\n segmentedCardWrapperRef: cardWrapperRef,\n startLabelAnimation,\n }));\n\n const animationSegments: [number, number] | undefined = useMemo(() => {\n if (maxValue <= 0) {\n return;\n }\n\n const totalFrames = 92;\n const framesPerValue = totalFrames / maxValue;\n\n const initialFrameToPlay = Math.min(framesPerValue * initialValue, totalFrames);\n const finalFrameToPlay = Math.min(framesPerValue * value + 1, totalFrames);\n\n return [initialFrameToPlay, finalFrameToPlay];\n }, [initialValue, maxValue, value]);\n\n const levelUpAnimationSettings = useMemo(\n () => ({\n renderer: 'canvas',\n autoplay: true,\n loop: false,\n initialSegment: animationSegments,\n }),\n [animationSegments],\n );\n\n return (\n <CardContainer\n ref={cardWrapperRef}\n labelRef={labelRef}\n label={label}\n isAnimated={isAnimated}\n onMouseLeave={onMouseLeave}\n labelColor={isAnimated ? animatedColor : isLabelHighlighted ? 'WHITE_T_87' : 'WHITE_T_60'}\n >\n <Styled.CircularProgressLottieContainer>\n <LottieAnimation src={LOTTIE.LEVELUP_RINGS} settings={levelUpAnimationSettings} />\n </Styled.CircularProgressLottieContainer>\n {/* left segment */}\n <Styled.SegmentLeft onClick={() => onSegmentPress(0)}>\n <SegmentContent\n segmentType={'left'}\n card={data[0]!.card}\n name={data[0]!.name}\n isCompleted={data[0]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentLeft>\n\n {/* right segment */}\n <Styled.SegmentRight onClick={() => onSegmentPress(1)}>\n <SegmentContent\n segmentType={'right'}\n card={data[1]!.card}\n name={data[1]!.name}\n isCompleted={data[1]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentRight>\n\n {/* bottom segment */}\n <Styled.SegmentBottom onClick={() => onSegmentPress(2)}>\n <SegmentContent\n segmentType={'bottom'}\n card={data[2]!.card}\n name={data[2]!.name}\n isCompleted={data[2]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentBottom>\n </CardContainer>\n );\n};\n\nexport const SegmentedGameCard = memo(forwardRef(SegmentedGameCardComponent));\n"],"names":["SegmentContent","segmentType","isCompleted","card","name","onMouseEnter","lottieAnimationRef","useRef","useEffect","animation","lottie","fetchLottie","Lottie","handleMouseEnter","useCallback","jsx","Styled.SegmentContainer","jsxs","Styled.SegmentContentContainer","Styled.SegmentAssetContainer","Styled.SegmentOverlay","Styled.IconWrapper","CheckIcon","SegmentedGameCardComponent","data","gameCategoryLabel","initialValue","value","maxValue","ref","labelRef","cardWrapperRef","label","setLabel","useState","isAnimated","setIsAnimated","animatedColor","setAnimatedColor","isLabelHighlighted","gameName","onMouseLeave","onSegmentPress","index","_b","_a","startLabelAnimation","color","useImperativeHandle","animationSegments","useMemo","totalFrames","framesPerValue","initialFrameToPlay","finalFrameToPlay","levelUpAnimationSettings","CardContainer","Styled.CircularProgressLottieContainer","LottieAnimation","LOTTIE","Styled.SegmentLeft","Styled.SegmentRight","Styled.SegmentBottom","SegmentedGameCard","memo","forwardRef"],"mappings":";;;;;;;;;AA4BO,MAAMA,IAAmD,CAAC;AAAA,EAC/D,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AACF,MAAM;AACE,QAAAC,IAAqBC,EAAuB,IAAI;AAEtD,EAAAC,EAAU,MAAM;AACd,QAAIC,IAAkC;AAc3B,YAZQ,YAAY;AACvB,YAAAC,IAAS,MAAMC,EAAYR,CAAI;AAErC,MAAAM,IAAYG,EAAO,cAAc;AAAA,QAC/B,WAAWN,EAAmB;AAAA,QAC9B,UAAU;AAAA,QACV,MAAM;AAAA,QACN,UAAU;AAAA,QACV,eAAeI;AAAA,MAAA,CAChB;AAAA,IAAA,MAKI,MACED,KAAA,gBAAAA,EAAW;AAAA,EACpB,GACC,CAACN,CAAI,CAAC;AAEH,QAAAU,IAAmBC,EAAY,MAAMT,EAAaD,CAAI,GAAG,CAACC,GAAcD,CAAI,CAAC;AAGjF,SAAA,gBAAAW,EAACC,GAAA,EACC,UAAA,gBAAAC,EAACC,GAAA,EAA+B,cAAcjB,GAAa,cAAcY,GACvE,UAAA;AAAA,IAAA,gBAAAE,EAACI,GAAA,EAA6B,KAAKb,GAAoB,cAAcL,GAAa;AAAA,IACjFC,uBACEkB,GAAA,EAAsB,cAAcnB,GACnC,4BAACoB,GAAA,EACC,UAAC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GAEJ;AAAA,QAGA,gBAAAU,EAAC+C,GAAA,EAAqB,SAAS,MAAMpB,EAAe,CAAC,GACnD,UAAA,gBAAA3B;AAAA,UAACf;AAAA,UAAA;AAAA,YACC,aAAa;AAAA,YACb,MAAMwB,EAAK,CAAC,EAAG;AAAA,YACf,MAAMA,EAAK,CAAC,EAAG;AAAA,YACf,aAAaA,EAAK,CAAC,EAAG;AAAA,YACtB,cAAAnB;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,GAEa0D,KAAoBC,EAAKC,EAAW1C,CAA0B,CAAC;"}
|
1
|
+
{"version":3,"file":"segmented-game-card.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.tsx"],"sourcesContent":["import type { TColorNames } from '../../../../ui/types';\nimport type {\n IGameCardSegmentContentProps,\n ISegmentedGameCardProps,\n ISegmentedGameCardRefs,\n} from './segmented-game-card-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport CheckIcon from '../../../../../assets/line-icons/icons/check';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { CardContainer } from '../card-container/card-container';\nimport * as Styled from './segmented-game-card-styled';\n\nconst renderSettings = { renderer: 'canvas', loop: true };\n\nexport const SegmentContent = memo(\n ({ segmentType, isCompleted, card, name, onMouseEnter }: IGameCardSegmentContentProps) => {\n const handleMouseEnter = useCallback(() => onMouseEnter(name), [onMouseEnter, name]);\n\n return (\n <Styled.SegmentContainer>\n <Styled.SegmentContentContainer $segmentType={segmentType} onMouseEnter={handleMouseEnter}>\n <Styled.SegmentAssetContainer $segmentType={segmentType}>\n <LottieAnimation src={card} settings={renderSettings} animateOnIntersect />\n </Styled.SegmentAssetContainer>\n\n {isCompleted && (\n <Styled.SegmentOverlay $segmentType={segmentType}>\n <Styled.IconWrapper>\n <CheckIcon color=\"#fff\" height={40} width={40} />\n </Styled.IconWrapper>\n </Styled.SegmentOverlay>\n )}\n </Styled.SegmentContentContainer>\n </Styled.SegmentContainer>\n );\n },\n);\n\nconst SegmentedGameCardComponent: ForwardRefRenderFunction<\n ISegmentedGameCardRefs,\n ISegmentedGameCardProps\n> = ({ data, label: gameCategoryLabel, initialValue = 0, value, maxValue = 1 }, ref) => {\n const labelRef = useRef<HTMLDivElement>(null);\n const cardWrapperRef = useRef<HTMLDivElement>(null);\n\n const [label, setLabel] = useState<string>(gameCategoryLabel);\n const [isAnimated, setIsAnimated] = useState(false);\n const [animatedColor, setAnimatedColor] = useState<TColorNames>('WHITE_T_87');\n\n const isLabelHighlighted = label !== gameCategoryLabel;\n\n const onMouseEnter = useCallback((gameName: string) => {\n setLabel(gameName);\n }, []);\n\n const onMouseLeave = useCallback(() => {\n setLabel(gameCategoryLabel);\n }, [gameCategoryLabel]);\n\n const onSegmentPress = useCallback(\n (index: number) => {\n data[index]?.onPress?.();\n },\n [data],\n );\n\n const startLabelAnimation = useCallback((color: TColorNames) => {\n setIsAnimated(true);\n setAnimatedColor(color);\n }, []);\n\n useImperativeHandle(ref, () => ({\n labelRef,\n segmentedCardWrapperRef: cardWrapperRef,\n startLabelAnimation,\n }));\n\n const animationSegments: [number, number] | undefined = useMemo(() => {\n if (maxValue <= 0) {\n return;\n }\n\n const totalFrames = 92;\n const framesPerValue = totalFrames / maxValue;\n\n const initialFrameToPlay = Math.min(framesPerValue * initialValue, totalFrames);\n const finalFrameToPlay = Math.min(framesPerValue * value + 1, totalFrames);\n\n return [initialFrameToPlay, finalFrameToPlay];\n }, [initialValue, maxValue, value]);\n\n const levelUpAnimationSettings = useMemo(\n () => ({\n renderer: 'canvas',\n autoplay: true,\n loop: false,\n initialSegment: animationSegments,\n }),\n [animationSegments],\n );\n\n return (\n <CardContainer\n ref={cardWrapperRef}\n labelRef={labelRef}\n label={label}\n isAnimated={isAnimated}\n onMouseLeave={onMouseLeave}\n labelColor={isAnimated ? animatedColor : isLabelHighlighted ? 'WHITE_T_87' : 'WHITE_T_60'}\n >\n <Styled.CircularProgressLottieContainer>\n <LottieAnimation\n src={LOTTIE.LEVELUP_RINGS}\n settings={levelUpAnimationSettings}\n animateOnIntersect\n />\n </Styled.CircularProgressLottieContainer>\n {/* left segment */}\n <Styled.SegmentLeft onClick={() => onSegmentPress(0)}>\n <SegmentContent\n segmentType={'left'}\n card={data[0]!.card}\n name={data[0]!.name}\n isCompleted={data[0]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentLeft>\n\n {/* right segment */}\n <Styled.SegmentRight onClick={() => onSegmentPress(1)}>\n <SegmentContent\n segmentType={'right'}\n card={data[1]!.card}\n name={data[1]!.name}\n isCompleted={data[1]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentRight>\n\n {/* bottom segment */}\n <Styled.SegmentBottom onClick={() => onSegmentPress(2)}>\n <SegmentContent\n segmentType={'bottom'}\n card={data[2]!.card}\n name={data[2]!.name}\n isCompleted={data[2]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentBottom>\n </CardContainer>\n );\n};\n\nexport const SegmentedGameCard = memo(forwardRef(SegmentedGameCardComponent));\n"],"names":["renderSettings","SegmentContent","memo","segmentType","isCompleted","card","name","onMouseEnter","handleMouseEnter","useCallback","jsx","Styled.SegmentContainer","jsxs","Styled.SegmentContentContainer","Styled.SegmentAssetContainer","LottieAnimation","Styled.SegmentOverlay","Styled.IconWrapper","CheckIcon","SegmentedGameCardComponent","data","gameCategoryLabel","initialValue","value","maxValue","ref","labelRef","useRef","cardWrapperRef","label","setLabel","useState","isAnimated","setIsAnimated","animatedColor","setAnimatedColor","isLabelHighlighted","gameName","onMouseLeave","onSegmentPress","index","_b","_a","startLabelAnimation","color","useImperativeHandle","animationSegments","useMemo","totalFrames","framesPerValue","initialFrameToPlay","finalFrameToPlay","levelUpAnimationSettings","CardContainer","Styled.CircularProgressLottieContainer","LOTTIE","Styled.SegmentLeft","Styled.SegmentRight","Styled.SegmentBottom","SegmentedGameCard","forwardRef"],"mappings":";;;;;;;AAwBA,MAAMA,IAAiB,EAAE,UAAU,UAAU,MAAM,GAAK,GAE3CC,IAAiBC;AAAA,EAC5B,CAAC,EAAE,aAAAC,GAAa,aAAAC,GAAa,MAAAC,GAAM,MAAAC,GAAM,cAAAC,QAAiD;AAClF,UAAAC,IAAmBC,EAAY,MAAMF,EAAaD,CAAI,GAAG,CAACC,GAAcD,CAAI,CAAC;AAGjF,WAAA,gBAAAI,EAACC,GAAA,EACC,UAAA,gBAAAC,EAACC,GAAA,EAA+B,cAAcV,GAAa,cAAcK,GACvE,UAAA;AAAA,MAAA,gBAAAE,EAACI,GAAA,EAA6B,cAAcX,GAC1C,UAAA,gBAAAO,EAACK,GAAgB,EAAA,KAAKV,GAAM,UAAUL,GAAgB,oBAAkB,GAAC,CAAA,GAC3E;AAAA,MAECI,uBACEY,GAAA,EAAsB,cAAcb,GACnC,4BAACc,GAAA,EACC,UAAC,gBAAAP,EAAAQ,GAAA,EAAU,OAAM,QAAO,QAAQ,IAAI,OAAO,GAAA,CAAI,EACjD,CAAA,GACF;AAAA,IAAA,EAEJ,CAAA,EACF,CAAA;AAAA,EAEJ;AACF,GAEMC,IAGF,CAAC,EAAE,MAAAC,GAAM,OAAOC,GAAmB,cAAAC,IAAe,GAAG,OAAAC,GAAO,UAAAC,IAAW,EAAE,GAAGC,MAAQ;AAChF,QAAAC,IAAWC,EAAuB,IAAI,GACtCC,IAAiBD,EAAuB,IAAI,GAE5C,CAACE,GAAOC,CAAQ,IAAIC,EAAiBV,CAAiB,GACtD,CAACW,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5C,CAACG,GAAeC,CAAgB,IAAIJ,EAAsB,YAAY,GAEtEK,IAAqBP,MAAUR,GAE/Bd,IAAeE,EAAY,CAAC4B,MAAqB;AACrD,IA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