@cuemath/leap 3.5.39 → 3.5.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,105 +1,109 @@
1
- import { jsx as o, jsxs as $ } from "react/jsx-runtime";
2
- import { memo as j, forwardRef as A, useRef as P, useState as S, useCallback as l, useMemo as E, createRef as D, useImperativeHandle as F, useEffect as v } from "react";
3
- import u from "../../../../ui/hooks/use-click-handler.js";
4
- import { useCircleSounds as H } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
5
- import { CarouselItemContainer as K, ExtendedFlexView as N, CarouselIdicatorContainer as V, AllGreenTickLottieWrapper as W } from "./carousel-styled.js";
6
- import { CarouselIndicator as U } from "./carousel-indicator/carousel-indicator.js";
7
- import Y from "../../../../ui/lottie-animation/lottie-animation.js";
8
- import { LOTTIE as q } from "../../../../../assets/lottie/lottie.js";
9
- import { allGreenTickLottienAimationSettings as z } from "./constants.js";
10
- import { CircleSoundKey as B } from "../../../hooks/use-circle-sounds/use-circle-sounds-enums.js";
11
- import G from "../../../../ui/swipeable-carousel/swipeable-carousel.js";
12
- const J = ({
1
+ import { jsx as n, jsxs as A } from "react/jsx-runtime";
2
+ import { memo as D, forwardRef as F, useRef as E, useState as w, useCallback as a, useMemo as R, createRef as H, useImperativeHandle as K, useEffect as v } from "react";
3
+ import f from "../../../../ui/hooks/use-click-handler.js";
4
+ import { useCircleSounds as N } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
5
+ import { CarouselItemContainer as V, ExtendedFlexView as W, CarouselIdicatorContainer as U, AllGreenTickLottieWrapper as Y } from "./carousel-styled.js";
6
+ import { CarouselIndicator as q } from "./carousel-indicator/carousel-indicator.js";
7
+ import z from "../../../../ui/lottie-animation/lottie-animation.js";
8
+ import { LOTTIE as B } from "../../../../../assets/lottie/lottie.js";
9
+ import { allGreenTickLottienAimationSettings as G } from "./constants.js";
10
+ import { CircleSoundKey as J } from "../../../hooks/use-circle-sounds/use-circle-sounds-enums.js";
11
+ import Q from "../../../../ui/swipeable-carousel/swipeable-carousel.js";
12
+ const X = ({
13
13
  items: r,
14
- defaultIndex: p = 0,
15
- analyticsSwipeLeft: f,
16
- analyticsSwipeRight: m,
17
- analyticsIndicatorClick: d,
18
- playAllGreenTickAnimation: C,
19
- onAllGreenTickAnimationComplete: n
20
- }, w) => {
21
- var g;
22
- const { playSwipeSound: y, play: L } = H(), c = P(!0), i = P(null), [a, I] = S(((g = i.current) == null ? void 0 : g.currentIndex) ?? p), [R, h] = S(!1), { handleClick: O } = u({
23
- analyticsLabel: m.analyticsLabel,
24
- analyticsProps: m.analyticsProps
25
- }), { handleClick: _ } = u({
26
- analyticsLabel: f.analyticsLabel,
27
- analyticsProps: f.analyticsProps
28
- }), { handleClick: T } = u({
14
+ defaultIndex: m = 0,
15
+ analyticsSwipeLeft: d,
16
+ analyticsSwipeRight: C,
17
+ analyticsIndicatorClick: y,
18
+ playAllGreenTickAnimation: L,
19
+ onAllGreenTickAnimationComplete: c
20
+ }, O) => {
21
+ var S;
22
+ const { playSwipeSound: o, play: I } = N(), s = E(!0), u = E(null), [l, i] = w(((S = u.current) == null ? void 0 : S.currentIndex) ?? m), [_, h] = w(!1), { handleClick: g } = f({
23
+ analyticsLabel: C.analyticsLabel,
24
+ analyticsProps: C.analyticsProps
25
+ }), { handleClick: T } = f({
29
26
  analyticsLabel: d.analyticsLabel,
30
27
  analyticsProps: d.analyticsProps
31
- }), k = l(() => {
32
- h(!1), n == null || n();
33
- }, [n]), x = E(
28
+ }), { handleClick: k } = f({
29
+ analyticsLabel: y.analyticsLabel,
30
+ analyticsProps: y.analyticsProps
31
+ }), x = a(() => {
32
+ T(), i((t) => t < r.length - 1 ? t + 1 : r.length - 1), o();
33
+ }, [T, r.length, o]), M = a(() => {
34
+ g(), i((t) => t > 0 ? t - 1 : 0), o();
35
+ }, [g, o]), b = a(() => {
36
+ h(!1), c == null || c();
37
+ }, [c]), $ = R(
34
38
  () => ({
35
39
  name: "complete",
36
- callback: k
40
+ callback: b
37
41
  }),
38
- [k]
39
- ), b = E(() => r.map(() => D()), [r]), s = l(
40
- (e) => {
41
- var t;
42
- e < 0 || e >= r.length || e === a || ((t = i.current) == null || t.goToIndex(e), I(e));
42
+ [b]
43
+ ), P = R(() => r.map(() => H()), [r]), p = a(
44
+ (t) => {
45
+ var e;
46
+ t < 0 || t >= r.length || t === l || ((e = u.current) == null || e.goToIndex(t), i(t));
43
47
  },
44
- [a, r.length]
45
- ), M = l(
46
- (e) => {
47
- y(), T(), I(e), s(e);
48
+ [l, r.length]
49
+ ), j = a(
50
+ (t) => {
51
+ o(), k(), i(t), p(t);
48
52
  },
49
- [T, y, s]
53
+ [k, o, p]
50
54
  );
51
- return F(w, () => ({
52
- indicatorRefs: b,
53
- currentIndex: a,
54
- goToIndex: s
55
+ return K(O, () => ({
56
+ indicatorRefs: P,
57
+ currentIndex: l,
58
+ goToIndex: p
55
59
  })), v(() => {
56
- c.current && (c.current = !1);
60
+ s.current && (s.current = !1);
57
61
  }, []), v(() => {
58
- const e = r.every((t) => t.indicatorType === "green-tick");
59
- C && e && (L(B.ALL_ACTIVITIES_COMPLETE), h(!0));
60
- }, [C, L, r]), /* @__PURE__ */ o(
61
- G,
62
+ const t = r.every((e) => e.indicatorType === "green-tick");
63
+ L && t && (I(J.ALL_ACTIVITIES_COMPLETE), h(!0));
64
+ }, [L, I, r]), /* @__PURE__ */ n(
65
+ Q,
62
66
  {
63
- ref: i,
64
- items: r.map((e, t) => /* @__PURE__ */ o(K, { children: e.element }, t)),
65
- defaultIndex: p,
66
- transitionDuration: c.current ? 0 : 300,
67
- onSwipeLeft: _,
68
- onSwipeRight: O,
69
- customNavigation: /* @__PURE__ */ o(
70
- N,
67
+ ref: u,
68
+ items: r.map((t, e) => /* @__PURE__ */ n(V, { children: t.element }, e)),
69
+ defaultIndex: m,
70
+ transitionDuration: s.current ? 0 : 300,
71
+ onSwipeLeft: x,
72
+ onSwipeRight: M,
73
+ customNavigation: /* @__PURE__ */ n(
74
+ W,
71
75
  {
72
76
  $flexDirection: "row",
73
77
  $alignItems: "center",
74
78
  $justifyContent: "center",
75
79
  $position: "absolute",
76
- children: /* @__PURE__ */ $(V, { children: [
77
- R && /* @__PURE__ */ o(W, { children: /* @__PURE__ */ o(
78
- Y,
80
+ children: /* @__PURE__ */ A(U, { children: [
81
+ _ && /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(
82
+ z,
79
83
  {
80
- src: q.DAILY_WORK_OUT_COMPLETE,
81
- settings: z,
82
- eventListener: x
84
+ src: B.DAILY_WORK_OUT_COMPLETE,
85
+ settings: G,
86
+ eventListener: $
83
87
  }
84
88
  ) }),
85
- r.map((e, t) => /* @__PURE__ */ o(
86
- U,
89
+ r.map((t, e) => /* @__PURE__ */ n(
90
+ q,
87
91
  {
88
- ref: b[t],
89
- indicatorType: e.indicatorType,
90
- isActive: t === a,
91
- textToShowInsideIndicator: (t + 1).toString(),
92
- onClick: () => M(t)
92
+ ref: P[e],
93
+ indicatorType: t.indicatorType,
94
+ isActive: e === l,
95
+ textToShowInsideIndicator: (e + 1).toString(),
96
+ onClick: () => j(e)
93
97
  },
94
- t
98
+ e
95
99
  ))
96
100
  ] })
97
101
  }
98
102
  )
99
103
  }
100
104
  );
101
- }, se = j(A(J));
105
+ }, ut = D(F(X));
102
106
  export {
103
- se as Carousel
107
+ ut as Carousel
104
108
  };
105
109
  //# sourceMappingURL=carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import {\n type ForwardRefRenderFunction,\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\nimport { type AnimationEventName } from 'lottie-web';\n\nimport useClickHandler from '../../../../ui/hooks/use-click-handler';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport * as Styled from './carousel-styled';\nimport type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport { CarouselIndicator } from './carousel-indicator/carousel-indicator';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport { allGreenTickLottienAimationSettings } from './constants';\nimport { CircleSoundKey } from '../../../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport type { ISwipeableCarouselRefs } from '../../../../ui/swipeable-carousel/swipeable-carousel-types';\nimport SwipeableCarousel from '../../../../ui/swipeable-carousel/swipeable-carousel';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n {\n items,\n defaultIndex = 0,\n analyticsSwipeLeft,\n analyticsSwipeRight,\n analyticsIndicatorClick,\n playAllGreenTickAnimation,\n onAllGreenTickAnimationComplete,\n },\n ref,\n) => {\n const { playSwipeSound, play } = useCircleSounds();\n const isFirstMount = useRef(true);\n const carousalRef = useRef<ISwipeableCarouselRefs>(null);\n const [currIndex, setCurrIndex] = useState(carousalRef.current?.currentIndex ?? defaultIndex);\n const [playAllGreenTickAnimationLottie, setPlayAllGreenTickAnimationLottie] = useState(false);\n\n const { handleClick: handlePrevClick } = useClickHandler({\n analyticsLabel: analyticsSwipeRight.analyticsLabel,\n analyticsProps: analyticsSwipeRight.analyticsProps,\n });\n\n const { handleClick: handleNextClick } = useClickHandler({\n analyticsLabel: analyticsSwipeLeft.analyticsLabel,\n analyticsProps: analyticsSwipeLeft.analyticsProps,\n });\n\n const { handleClick: handleItemClick } = useClickHandler({\n analyticsLabel: analyticsIndicatorClick.analyticsLabel,\n analyticsProps: analyticsIndicatorClick.analyticsProps,\n });\n\n const onAllGreenTickLottieAnimationComplete = useCallback(() => {\n setPlayAllGreenTickAnimationLottie(false);\n onAllGreenTickAnimationComplete?.();\n }, [onAllGreenTickAnimationComplete]);\n\n const allGreenTickAnimationEvent = useMemo(\n () => ({\n name: 'complete' as AnimationEventName,\n callback: onAllGreenTickLottieAnimationComplete,\n }),\n [onAllGreenTickLottieAnimationComplete],\n );\n\n const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n const goToIndex = useCallback(\n (index: number) => {\n if (index < 0 || index >= items.length || index === currIndex) return;\n carousalRef.current?.goToIndex(index);\n setCurrIndex(index);\n },\n [currIndex, items.length],\n );\n\n const handleCarouselIndicatorClick = useCallback(\n (index: number) => {\n playSwipeSound();\n handleItemClick();\n setCurrIndex(index);\n goToIndex(index);\n },\n [handleItemClick, playSwipeSound, goToIndex],\n );\n\n useImperativeHandle(ref, () => ({\n indicatorRefs,\n currentIndex: currIndex,\n goToIndex,\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n useEffect(() => {\n const playAnimation = items.every(item => item.indicatorType === 'green-tick');\n\n if (playAllGreenTickAnimation && playAnimation) {\n play(CircleSoundKey.ALL_ACTIVITIES_COMPLETE);\n setPlayAllGreenTickAnimationLottie(true);\n }\n }, [playAllGreenTickAnimation, play, items]);\n\n return (\n <SwipeableCarousel\n ref={carousalRef}\n items={items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item.element}</Styled.CarouselItemContainer>\n ))}\n defaultIndex={defaultIndex}\n transitionDuration={isFirstMount.current ? 0 : 300}\n onSwipeLeft={handleNextClick}\n onSwipeRight={handlePrevClick}\n customNavigation={\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <Styled.CarouselIdicatorContainer>\n {playAllGreenTickAnimationLottie && (\n <Styled.AllGreenTickLottieWrapper>\n <LottieAnimation\n src={LOTTIE.DAILY_WORK_OUT_COMPLETE}\n settings={allGreenTickLottienAimationSettings}\n eventListener={allGreenTickAnimationEvent}\n />\n </Styled.AllGreenTickLottieWrapper>\n )}\n {items.map((item, index) => (\n <CarouselIndicator\n ref={indicatorRefs[index]}\n key={index}\n indicatorType={item.indicatorType}\n isActive={index === currIndex}\n textToShowInsideIndicator={(index + 1).toString()}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n </Styled.CarouselIdicatorContainer>\n </Styled.ExtendedFlexView>\n }\n />\n );\n};\n\nexport const Carousel = memo(forwardRef(CarouselComponent));\n"],"names":["CarouselComponent","items","defaultIndex","analyticsSwipeLeft","analyticsSwipeRight","analyticsIndicatorClick","playAllGreenTickAnimation","onAllGreenTickAnimationComplete","ref","playSwipeSound","play","useCircleSounds","isFirstMount","useRef","carousalRef","currIndex","setCurrIndex","useState","_a","playAllGreenTickAnimationLottie","setPlayAllGreenTickAnimationLottie","handlePrevClick","useClickHandler","handleNextClick","handleItemClick","onAllGreenTickLottieAnimationComplete","useCallback","allGreenTickAnimationEvent","useMemo","indicatorRefs","createRef","goToIndex","index","handleCarouselIndicatorClick","useImperativeHandle","useEffect","playAnimation","item","CircleSoundKey","jsx","SwipeableCarousel","Styled.CarouselItemContainer","Styled.ExtendedFlexView","jsxs","Styled.CarouselIdicatorContainer","Styled.AllGreenTickLottieWrapper","LottieAnimation","LOTTIE","allGreenTickLottienAimationSettings","CarouselIndicator","Carousel","memo","forwardRef"],"mappings":";;;;;;;;;;;AA0BA,MAAMA,IAA6E,CACjF;AAAA,EACE,OAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,iCAAAC;AACF,GACAC,MACG;;AACH,QAAM,EAAE,gBAAAC,GAAgB,MAAAC,EAAK,IAAIC,EAAgB,GAC3CC,IAAeC,EAAO,EAAI,GAC1BC,IAAcD,EAA+B,IAAI,GACjD,CAACE,GAAWC,CAAY,IAAIC,IAASC,IAAAJ,EAAY,YAAZ,gBAAAI,EAAqB,iBAAgBhB,CAAY,GACtF,CAACiB,GAAiCC,CAAkC,IAAIH,EAAS,EAAK,GAEtF,EAAE,aAAaI,EAAgB,IAAIC,EAAgB;AAAA,I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AKC,EAAWpD,CAAiB,CAAC;"}
1
+ {"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import {\n type ForwardRefRenderFunction,\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\nimport { type AnimationEventName } from 'lottie-web';\n\nimport useClickHandler from '../../../../ui/hooks/use-click-handler';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport * as Styled from './carousel-styled';\nimport type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport { CarouselIndicator } from './carousel-indicator/carousel-indicator';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport { allGreenTickLottienAimationSettings } from './constants';\nimport { CircleSoundKey } from '../../../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport type { ISwipeableCarouselRefs } from '../../../../ui/swipeable-carousel/swipeable-carousel-types';\nimport SwipeableCarousel from '../../../../ui/swipeable-carousel/swipeable-carousel';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n {\n items,\n defaultIndex = 0,\n analyticsSwipeLeft,\n analyticsSwipeRight,\n analyticsIndicatorClick,\n playAllGreenTickAnimation,\n onAllGreenTickAnimationComplete,\n },\n ref,\n) => {\n const { playSwipeSound, play } = useCircleSounds();\n const isFirstMount = useRef(true);\n const carousalRef = useRef<ISwipeableCarouselRefs>(null);\n const [currIndex, setCurrIndex] = useState(carousalRef.current?.currentIndex ?? defaultIndex);\n const [playAllGreenTickAnimationLottie, setPlayAllGreenTickAnimationLottie] = useState(false);\n\n const { handleClick: handlePrevClick } = useClickHandler({\n analyticsLabel: analyticsSwipeRight.analyticsLabel,\n analyticsProps: analyticsSwipeRight.analyticsProps,\n });\n\n const { handleClick: handleNextClick } = useClickHandler({\n analyticsLabel: analyticsSwipeLeft.analyticsLabel,\n analyticsProps: analyticsSwipeLeft.analyticsProps,\n });\n\n const { handleClick: handleItemClick } = useClickHandler({\n analyticsLabel: analyticsIndicatorClick.analyticsLabel,\n analyticsProps: analyticsIndicatorClick.analyticsProps,\n });\n\n const onSwipeLeft = useCallback(() => {\n handleNextClick();\n setCurrIndex(prev => (prev < items.length - 1 ? prev + 1 : items.length - 1));\n playSwipeSound();\n }, [handleNextClick, items.length, playSwipeSound]);\n\n const onSwipeRight = useCallback(() => {\n handlePrevClick();\n setCurrIndex(prev => (prev > 0 ? prev - 1 : 0));\n playSwipeSound();\n }, [handlePrevClick, playSwipeSound]);\n\n const onAllGreenTickLottieAnimationComplete = useCallback(() => {\n setPlayAllGreenTickAnimationLottie(false);\n onAllGreenTickAnimationComplete?.();\n }, [onAllGreenTickAnimationComplete]);\n\n const allGreenTickAnimationEvent = useMemo(\n () => ({\n name: 'complete' as AnimationEventName,\n callback: onAllGreenTickLottieAnimationComplete,\n }),\n [onAllGreenTickLottieAnimationComplete],\n );\n\n const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n const goToIndex = useCallback(\n (index: number) => {\n if (index < 0 || index >= items.length || index === currIndex) return;\n carousalRef.current?.goToIndex(index);\n setCurrIndex(index);\n },\n [currIndex, items.length],\n );\n\n const handleCarouselIndicatorClick = useCallback(\n (index: number) => {\n playSwipeSound();\n handleItemClick();\n setCurrIndex(index);\n goToIndex(index);\n },\n [handleItemClick, playSwipeSound, goToIndex],\n );\n\n useImperativeHandle(ref, () => ({\n indicatorRefs,\n currentIndex: currIndex,\n goToIndex,\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n useEffect(() => {\n const playAnimation = items.every(item => item.indicatorType === 'green-tick');\n\n if (playAllGreenTickAnimation && playAnimation) {\n play(CircleSoundKey.ALL_ACTIVITIES_COMPLETE);\n setPlayAllGreenTickAnimationLottie(true);\n }\n }, [playAllGreenTickAnimation, play, items]);\n\n return (\n <SwipeableCarousel\n ref={carousalRef}\n items={items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item.element}</Styled.CarouselItemContainer>\n ))}\n defaultIndex={defaultIndex}\n transitionDuration={isFirstMount.current ? 0 : 300}\n onSwipeLeft={onSwipeLeft}\n onSwipeRight={onSwipeRight}\n customNavigation={\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <Styled.CarouselIdicatorContainer>\n {playAllGreenTickAnimationLottie && (\n <Styled.AllGreenTickLottieWrapper>\n <LottieAnimation\n src={LOTTIE.DAILY_WORK_OUT_COMPLETE}\n settings={allGreenTickLottienAimationSettings}\n eventListener={allGreenTickAnimationEvent}\n />\n </Styled.AllGreenTickLottieWrapper>\n )}\n {items.map((item, index) => (\n <CarouselIndicator\n ref={indicatorRefs[index]}\n key={index}\n indicatorType={item.indicatorType}\n isActive={index === currIndex}\n textToShowInsideIndicator={(index + 1).toString()}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n </Styled.CarouselIdicatorContainer>\n </Styled.ExtendedFlexView>\n }\n />\n );\n};\n\nexport const Carousel = memo(forwardRef(CarouselComponent));\n"],"names":["CarouselComponent","items","defaultIndex","analyticsSwipeLeft","analyticsSwipeRight","analyticsIndicatorClick","playAllGreenTickAnimation","onAllGreenTickAnimationComplete","ref","playSwipeSound","play","useCircleSounds","isFirstMount","useRef","carousalRef","currIndex","setCurrIndex","useState","_a","playAllGreenTickAnimationLottie","setPlayAllGreenTickAnimationLottie","handlePrevClick","useClickHandler","handleNextClick","handleItemClick","onSwipeLeft","useCallback","prev","onSwipeRight","onAllGreenTickLottieAnimationComplete","allGreenTickAnimationEvent","useMemo","indicatorRefs","createRef","goToIndex","index","handleCarouselIndicatorClick","useImperativeHandle","useEffect","playAnimation","item","CircleSoundKey","jsx","SwipeableCarousel","Styled.CarouselItemContainer","Styled.ExtendedFlexView","jsxs","Styled.CarouselIdicatorContainer","Styled.AllGreenTickLottieWrapper","LottieAnimation","LOTTIE","allGreenTickLottienAimationSettings","CarouselIndicator","Carousel","memo","forwardRef"],"mappings":";;;;;;;;;;;AA0BA,MAAMA,IAA6E,CACjF;AAAA,EACE,OAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,iCAAAC;AACF,GACAC,MACG;;AACH,QAAM,EAAE,gBAAAC,GAAgB,MAAAC,EAAK,IAAIC,EAAgB,GAC3CC,IAAeC,EAAO,EAAI,GAC1BC,IAAcD,EAA+B,IAAI,GACjD,CAACE,GAAWC,CAAY,IAAIC,IAASC,IAAAJ,EAAY,YAAZ,gBAAAI,EAAqB,iBAAgBhB,CAAY,GACtF,CAACiB,GAAiCC,CAAkC,IAAIH,EAAS,EAAK,GAEtF,EAAE,aAAaI,EAAgB,IAAIC,EAAgB;AAAA,IACvD,gBAAgBlB,EAAoB;AAAA,IACpC,gBAAgBA,EAAoB;AAAA,EAAA,CACrC,GAEK,EAAE,aAAamB,EAAgB,IAAID,EAAgB;AAAA,IACvD,gBAAgBnB,EAAmB;AAAA,IACnC,gBAAgBA,EAAmB;AAAA,EAAA,CACpC,GAEK,EAAE,aAAaqB,EAAgB,IAAIF,EAAgB;AAAA,IACvD,gBAAgBjB,EAAwB;AAAA,IACxC,gBAAgBA,EAAwB;AAAA,EAAA,CACzC,GAEKoB,IAAcC,EAAY,MAAM;AACpB,IAAAH,KACHP,EAAA,CAAAW,MAASA,IAAO1B,EAAM,SAAS,IAAI0B,IAAO,IAAI1B,EAAM,SAAS,CAAE,GAC7DQ;KACd,CAACc,GAAiBtB,EAAM,QAAQQ,CAAc,CAAC,GAE5CmB,IAAeF,EAAY,MAAM;AACrB,IAAAL,KAChBL,EAAa,CAASW,MAAAA,IAAO,IAAIA,IAAO,IAAI,CAAE,GAC/BlB;EAAA,GACd,CAAC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AAA,MACL,OAAOb,EAAM,IAAI,CAACuC,GAAML,MACrB,gBAAAO,EAAAE,GAAA,EAA0C,UAAKJ,EAAA,QAAA,GAAbL,CAAqB,CACzD;AAAA,MACD,cAAAjC;AAAA,MACA,oBAAoBU,EAAa,UAAU,IAAI;AAAA,MAC/C,aAAAa;AAAA,MACA,cAAAG;AAAA,MACA,kBACE,gBAAAc;AAAA,QAACG;AAAAA,QAAA;AAAA,UACC,gBAAe;AAAA,UACf,aAAY;AAAA,UACZ,iBAAgB;AAAA,UAChB,WAAU;AAAA,UAEV,UAAA,gBAAAC,EAACC,GAAA,EACE,UAAA;AAAA,YACC5B,KAAA,gBAAAuB,EAACM,GAAA,EACC,UAAA,gBAAAN;AAAA,cAACO;AAAA,cAAA;AAAA,gBACC,KAAKC,EAAO;AAAA,gBACZ,UAAUC;AAAA,gBACV,eAAerB;AAAA,cAAA;AAAA,YAAA,GAEnB;AAAA,YAED7B,EAAM,IAAI,CAACuC,GAAML,MAChB,gBAAAO;AAAA,cAACU;AAAA,cAAA;AAAA,gBACC,KAAKpB,EAAcG,CAAK;AAAA,gBAExB,eAAeK,EAAK;AAAA,gBACpB,UAAUL,MAAUpB;AAAA,gBACpB,4BAA4BoB,IAAQ,GAAG,SAAS;AAAA,gBAChD,SAAS,MAAMC,EAA6BD,CAAK;AAAA,cAAA;AAAA,cAJ5CA;AAAA,YAAA,CAMR;AAAA,UAAA,GACH;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR,GAEakB,KAAWC,EAAKC,EAAWvD,CAAiB,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.5.39",
3
+ "version": "3.5.40",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"