fansunited-frontend-components 0.0.98 → 1.0.0

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.
Files changed (68) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +952 -1467
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +405 -1163
  5. package/CompetitionStatistics.js +2042 -2215
  6. package/CompetitorCard.js +4251 -5085
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +6062 -7544
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +556 -849
  12. package/List.js +689 -718
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +50 -42
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +925 -1824
  17. package/PlayerOfTheMatch.js +2106 -2207
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +4208 -18675
  20. package/README.md +1 -1
  21. package/Standings.js +1014 -1336
  22. package/TopX.js +3223 -17005
  23. package/chunks/{ChanceGameEmbedVariant-CVys-3Zh.js → ChanceGameEmbedVariant-z8XYzgDW.js} +2 -2
  24. package/chunks/OddsSkeleton-DP5Yfqpr.js +522 -0
  25. package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
  26. package/chunks/index-BNl8scz6.js +4 -0
  27. package/chunks/index-CSa2JU4m.js +4 -0
  28. package/chunks/index-CVRI82Gb.js +4 -0
  29. package/chunks/index-Cd1dg0KI.js +4 -0
  30. package/chunks/index-Cei2fzi7.js +4 -0
  31. package/chunks/index-Cxb4wEJU.js +4 -0
  32. package/chunks/index-w1LGN5dz.js +4 -0
  33. package/chunks/main-07vzblS8.js +2091 -0
  34. package/chunks/main-C7X4dM_P.js +4827 -0
  35. package/chunks/main-D_QDfmAw.js +6417 -0
  36. package/chunks/main-DdL0UekL.js +4775 -0
  37. package/chunks/main-DmBfwyb4.js +2992 -0
  38. package/chunks/main-LEE8n2cG.js +3117 -0
  39. package/chunks/main-P2WNvBZE.js +1804 -0
  40. package/chunks/main-gV165E-A.js +1928 -0
  41. package/chunks/predictionsHelpers-fwXaMadu.js +10063 -0
  42. package/chunks/{withVersionStamp-T8seRk9h.js → withVersionStamp-CPDfSE5H.js} +1 -1
  43. package/package.json +2 -6
  44. package/withVersionStamp.d.ts.map +1 -1
  45. package/chunks/OddsSkeleton-ClJE2xhR.js +0 -26
  46. package/chunks/OddsStrip-BnSp5TXa.js +0 -383
  47. package/chunks/PickOneOfX-DaJtkbCw.js +0 -4206
  48. package/chunks/chevron-left-CxfCSZcr.js +0 -13
  49. package/chunks/chevron-right-BEQMacFn.js +0 -13
  50. package/chunks/chevrons-right-CXSpQt9w.js +0 -25
  51. package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
  52. package/chunks/index-Aq5MbUB9.js +0 -4
  53. package/chunks/index-BBQm_8LD.js +0 -4
  54. package/chunks/index-BC_sWWgc.js +0 -4
  55. package/chunks/index-DXKDJ1Vp.js +0 -4
  56. package/chunks/index-DjT5NrbA.js +0 -4
  57. package/chunks/index-DvLRehH6.js +0 -4
  58. package/chunks/index-aIMaxR-p.js +0 -4
  59. package/chunks/main-52Wff7qC.js +0 -11441
  60. package/chunks/main-65WcUqAl.js +0 -4013
  61. package/chunks/main-B58mi9jx.js +0 -5622
  62. package/chunks/main-BIdXUTZS.js +0 -7308
  63. package/chunks/main-DD-NEzC7.js +0 -8241
  64. package/chunks/main-DUnfJPzY.js +0 -3608
  65. package/chunks/main-DpCBqqg_.js +0 -1950
  66. package/chunks/main-Drznt1ak.js +0 -1790
  67. package/chunks/users-wbJRbqW8.js +0 -16
  68. package/chunks/x-CK4GYo7T.js +0 -14
@@ -1,4013 +0,0 @@
1
- import { jsx as t, jsxs as g, Fragment as Qe } from "react/jsx-runtime";
2
- import { useDisableCache as Lt, useFontFamily as Te, isExtraSmall as He, getBrandingClickUrl as Kt, isMobile as Se, useColors as K, useCornerRadius as pe, useSpacingScale as Pe, hexToRgb as le, ConsentPanel as rt, DirectionalIcon as ct, busyButtonStyles as Ot, useImageUrl as Xt, AdditionalCTA as Zt, useIntlLocale as Jt, useInternalTheme as Ne, Spinner as ot, useBorderSize as Qt, useImageVariant as it, WidgetTemplate as ve, StandardSkeleton as en, NotFoundSkeleton as tn, StandardSignInSkeleton as nn, extractBrandingModelProperties as lt, StandardApiErrorSkeleton as zt, CollectLeadForm as rn, StandardLeadAfterCollection as Bt, sanitizeBackgroundUrl as Dt, useImageBackgroundGradient as $t, OverlayScoreStateWrapperSkeleton as on, OverlaySkeleton as ln, defaultBgVertical as dt, defaultBg as ut, OverlaySignInSkeleton as an, OverlayApiErrorSkeleton as sn, OverlayLeadAfterCollection as Ft, ConsentCta as Et, useConsents as cn, initializeI18n as dn, extractSdkError as un, Portal as mn } from "fansunited-frontend-core";
3
- import { useState as z, useEffect as he, useRef as mt, useCallback as Me } from "react";
4
- import { EitherOrFullModel as gn } from "fansunited-sdk-esm/models";
5
- import gt from "@mui/icons-material/ArrowRightAlt";
6
- import { Timer as fn, Favorite as hn, EmojiEvents as xn, CheckCircle as wt, Cancel as Rt } from "@mui/icons-material";
7
- import { Box as r, Typography as C, Button as ye, Stack as je, Sheet as bn, Table as yn, Avatar as pn, tabClasses as Ut, Tabs as Wt, TabList as Mt, Tab as et, TabPanel as tt } from "@mui/joy";
8
- import { useTranslation as ee } from "react-i18next";
9
- import jt from "@mui/icons-material/CompareArrows";
10
- import Sn from "@mui/icons-material/SwapVert";
11
- import at from "@mui/icons-material/Favorite";
12
- import Gt from "@mui/icons-material/FavoriteBorder";
13
- import { keyframes as Cn } from "@emotion/react";
14
- import In from "@mui/icons-material/TimerOutlined";
15
- import kn from "@mui/icons-material/CheckCircle";
16
- import Tn from "@mui/icons-material/Cancel";
17
- import Pn from "@mui/icons-material/AccessTime";
18
- import Ge from "@mui/icons-material/EmojiEvents";
19
- import vn from "@mui/icons-material/WorkspacePremium";
20
- import An from "@mui/icons-material/Person";
21
- import Ht from "@mui/icons-material/Leaderboard";
22
- import wn from "@mui/icons-material/Timer";
23
- const Rn = (e, n) => {
24
- const [l, i] = z(null), s = Lt(), f = async () => {
25
- try {
26
- const o = await n.miniGames.getEitherOrById(e, s);
27
- i(o);
28
- } catch (o) {
29
- console.error(o), i(new gn());
30
- }
31
- };
32
- return he(() => (f(), () => i(null)), [e, n, s]), l;
33
- }, Ln = (e, n, l = !1) => {
34
- const [i, s] = z(null), [f, o] = z(!1), [m, c] = z(!1), u = async () => {
35
- try {
36
- const h = await n.miniGames.getMyEitherOrStats(e);
37
- s(h);
38
- } catch (h) {
39
- if (s(null), n.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
40
- const x = h;
41
- if (x.error.code === 404)
42
- return;
43
- if (x.error.code === 401 || x.error.code === 403) {
44
- o(!0);
45
- return;
46
- }
47
- c(!0);
48
- return;
49
- }
50
- const p = h;
51
- if (p.data.error.code === 404)
52
- return;
53
- if (p.data.error.code === 401 || p.data.error.code === 403) {
54
- o(!0);
55
- return;
56
- }
57
- c(!0);
58
- }
59
- };
60
- return he(() => (u(), () => {
61
- s(null), o(!1), c(!1);
62
- }), [e, n, l]), {
63
- myStats: i,
64
- setMyStats: s,
65
- isUnauthorized: f,
66
- isApiError: m,
67
- setIsUnauthorized: o,
68
- setIsApiError: c
69
- };
70
- }, q = {
71
- LOADING: "loading",
72
- TUTORIAL: "tutorial",
73
- PLAYING: "playing",
74
- RESULTS: "results"
75
- }, me = (e) => {
76
- const n = Te().secondary, l = He(), i = Kt(
77
- e.primaryUrl,
78
- e.secondaryUrl,
79
- "logo"
80
- );
81
- if (!e.brandingLogo)
82
- return null;
83
- const s = () => {
84
- i && window.open(i, "_blank", "noopener,noreferrer");
85
- }, f = /* @__PURE__ */ t(
86
- "img",
87
- {
88
- src: e.brandingLogo,
89
- alt: "branding-logo",
90
- style: { maxHeight: "50px", maxWidth: "100px" }
91
- }
92
- ), o = i ? typeof window > "u" ? /* @__PURE__ */ t(
93
- r,
94
- {
95
- component: "a",
96
- href: i,
97
- target: "_blank",
98
- rel: "noopener noreferrer",
99
- sx: {
100
- cursor: "pointer",
101
- textDecoration: "none",
102
- display: "inline-flex"
103
- },
104
- children: f
105
- }
106
- ) : /* @__PURE__ */ t(
107
- r,
108
- {
109
- onClick: s,
110
- sx: { cursor: "pointer", display: "inline-flex" },
111
- children: f
112
- }
113
- ) : f;
114
- return e.isCentered || l ? /* @__PURE__ */ g(
115
- r,
116
- {
117
- sx: {
118
- display: "flex",
119
- flexDirection: "column",
120
- gap: "8px",
121
- alignItems: "center",
122
- minWidth: "180px",
123
- fontSize: "1em",
124
- zIndex: 1
125
- },
126
- children: [
127
- e.label && /* @__PURE__ */ t(
128
- C,
129
- {
130
- level: "body-sm",
131
- sx: {
132
- fontWeight: 400,
133
- lineHeight: "166%",
134
- letterSpacing: "0.4px",
135
- fontSize: "1em",
136
- color: e.textColor,
137
- textAlign: "right",
138
- fontFamily: n
139
- },
140
- children: e.label
141
- }
142
- ),
143
- o
144
- ]
145
- }
146
- ) : /* @__PURE__ */ g(
147
- r,
148
- {
149
- sx: {
150
- minWidth: "180px",
151
- display: "flex",
152
- gap: "8px",
153
- alignItems: "center",
154
- zIndex: 10,
155
- fontSize: "1em"
156
- },
157
- children: [
158
- e.label && /* @__PURE__ */ t(
159
- C,
160
- {
161
- level: "body-sm",
162
- sx: {
163
- fontWeight: 400,
164
- lineHeight: "166%",
165
- letterSpacing: "0.4px",
166
- textAlign: "right",
167
- fontSize: "1em",
168
- color: e.textColor,
169
- fontFamily: n
170
- },
171
- children: e.label
172
- }
173
- ),
174
- o
175
- ]
176
- }
177
- );
178
- }, On = ({
179
- onStart: e,
180
- game: n,
181
- signInCTA: l,
182
- showSignInCTA: i,
183
- consents: s,
184
- isSubmitting: f
185
- }) => {
186
- var B, v, D, O, V, $, R, k, G, M, H;
187
- const { t: o } = ee(), m = Se(), c = He(), u = ((B = n == null ? void 0 : n.branding) == null ? void 0 : B.colors) || null, h = (u == null ? void 0 : u.primaryColor) || K().palette.primary.plainColor, b = K().palette.primary.onPrimary, p = (u == null ? void 0 : u.contentColor) || K().textColor, x = K().surfaceVariant, A = Te().primary, E = pe().xl, w = pe().md, I = Pe(), y = le(h || ""), d = le(x || ""), L = y ? `rgba(${y.replace(/[^\d,]/g, "")}, 0.12)` : `${h}20`, S = m ? ((D = (v = n == null ? void 0 : n.branding) == null ? void 0 : v.images) == null ? void 0 : D.mobileLogo) || ((V = (O = n == null ? void 0 : n.branding) == null ? void 0 : O.images) == null ? void 0 : V.mainLogo) || "" : ((R = ($ = n == null ? void 0 : n.branding) == null ? void 0 : $.images) == null ? void 0 : R.mainLogo) || "", P = [
188
- {
189
- icon: /* @__PURE__ */ t(fn, { sx: { fontSize: "1.1em" } }),
190
- title: o("eitherOr.tutorial.step1Title"),
191
- description: o("eitherOr.tutorial.step1Description", {
192
- seconds: (n == null ? void 0 : n.time) ?? 10
193
- })
194
- },
195
- {
196
- icon: /* @__PURE__ */ t(hn, { sx: { fontSize: "1.1em" } }),
197
- title: o("eitherOr.tutorial.step2Title", {
198
- lives: (n == null ? void 0 : n.lives) ?? 3,
199
- context: String((n == null ? void 0 : n.lives) ?? 3)
200
- }),
201
- description: o("eitherOr.tutorial.step2Description", {
202
- lives: (n == null ? void 0 : n.lives) ?? 3,
203
- context: String((n == null ? void 0 : n.lives) ?? 3)
204
- })
205
- },
206
- {
207
- icon: /* @__PURE__ */ t(xn, { sx: { fontSize: "1.1em" } }),
208
- title: o("eitherOr.tutorial.step3Title"),
209
- description: o("eitherOr.tutorial.step3Description")
210
- }
211
- ];
212
- return n ? /* @__PURE__ */ t(r, { sx: { display: "flex", flexDirection: "column", p: I.md }, children: /* @__PURE__ */ g(
213
- r,
214
- {
215
- sx: {
216
- display: "flex",
217
- flexDirection: "column",
218
- gap: m ? I.lg : I.md
219
- },
220
- children: [
221
- /* @__PURE__ */ t(
222
- r,
223
- {
224
- sx: {
225
- borderRadius: w,
226
- overflow: "hidden",
227
- bgcolor: d ? `rgba(${d.replace(/[^\d,]/g, "")}, 0.5)` : x,
228
- display: "flex",
229
- flexDirection: "column",
230
- backdropFilter: "blur(4px)"
231
- },
232
- children: P.map((a, Y) => {
233
- const T = Y === P.length - 1;
234
- return /* @__PURE__ */ g(r, { children: [
235
- /* @__PURE__ */ g(
236
- r,
237
- {
238
- sx: {
239
- display: "flex",
240
- alignItems: "flex-start",
241
- gap: I.md,
242
- px: I.md,
243
- py: I.md
244
- },
245
- children: [
246
- /* @__PURE__ */ t(
247
- r,
248
- {
249
- sx: {
250
- width: 36,
251
- height: 36,
252
- borderRadius: "50%",
253
- bgcolor: L,
254
- color: h,
255
- display: "flex",
256
- alignItems: "center",
257
- justifyContent: "center",
258
- flexShrink: 0
259
- },
260
- children: a.icon
261
- }
262
- ),
263
- /* @__PURE__ */ g(r, { sx: { flex: 1, minWidth: 0, pt: "2px" }, children: [
264
- /* @__PURE__ */ t(
265
- C,
266
- {
267
- sx: {
268
- fontFamily: A,
269
- fontWeight: 700,
270
- fontSize: "0.875em",
271
- lineHeight: 1.3,
272
- color: p
273
- },
274
- children: a.title
275
- }
276
- ),
277
- /* @__PURE__ */ t(
278
- C,
279
- {
280
- sx: {
281
- fontFamily: A,
282
- fontWeight: 400,
283
- fontSize: "0.75em",
284
- lineHeight: 1.6,
285
- color: p,
286
- opacity: 0.65,
287
- mt: I["2xs"]
288
- },
289
- children: a.description
290
- }
291
- )
292
- ] })
293
- ]
294
- }
295
- ),
296
- !T && /* @__PURE__ */ t(
297
- r,
298
- {
299
- sx: {
300
- height: "1px",
301
- mx: I.md,
302
- bgcolor: y ? `rgba(${y.replace(/[^\d,]/g, "")}, 0.1)` : `${h}1A`
303
- }
304
- }
305
- )
306
- ] }, Y);
307
- })
308
- }
309
- ),
310
- s != null && s.items.length ? /* @__PURE__ */ t(
311
- r,
312
- {
313
- sx: {
314
- borderRadius: w,
315
- bgcolor: d ? `rgba(${d.replace(/[^\d,]/g, "")}, 0.5)` : x,
316
- p: I.md,
317
- display: "flex",
318
- flexDirection: "column",
319
- backdropFilter: "blur(4px)"
320
- },
321
- children: /* @__PURE__ */ t(
322
- rt,
323
- {
324
- consents: s,
325
- primaryColor: h,
326
- textColor: p,
327
- brandingUrls: (k = n == null ? void 0 : n.branding) == null ? void 0 : k.urls,
328
- align: "center"
329
- }
330
- )
331
- }
332
- ) : null,
333
- /* @__PURE__ */ g(
334
- r,
335
- {
336
- sx: {
337
- display: "flex",
338
- flexDirection: c ? "column" : "row",
339
- justifyContent: S ? "space-between" : "flex-end",
340
- alignItems: "center",
341
- gap: I.lg
342
- },
343
- children: [
344
- S && !c && /* @__PURE__ */ t(
345
- me,
346
- {
347
- brandingLogo: S,
348
- textColor: p,
349
- label: ((G = n == null ? void 0 : n.labels) == null ? void 0 : G.sponsor) || null
350
- }
351
- ),
352
- /* @__PURE__ */ t(
353
- ye,
354
- {
355
- variant: "soft",
356
- loading: f,
357
- endDecorator: /* @__PURE__ */ t(ct, { children: /* @__PURE__ */ t(gt, {}) }),
358
- onClick: i && l ? l.onClick : e,
359
- sx: {
360
- borderRadius: E,
361
- py: "10px",
362
- pr: "12px",
363
- pl: "16px",
364
- bgcolor: h,
365
- color: b,
366
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
367
- transform: "scale(1)",
368
- alignSelf: "center",
369
- "&:hover": { bgcolor: h, transform: "scale(1.02)" },
370
- "&:active": { color: b, transform: "scale(0.98)" },
371
- "&:disabled": {
372
- bgcolor: h,
373
- color: b,
374
- opacity: "12%"
375
- },
376
- "--Icon-color": b,
377
- "@keyframes pulse": {
378
- "0%": { transform: "scale(1)" },
379
- "50%": { transform: "scale(1.05)" },
380
- "100%": { transform: "scale(1)" }
381
- },
382
- animation: "pulse 1s infinite",
383
- fontSize: "0.9375em",
384
- ...f ? Ot(h, b) : {}
385
- },
386
- children: /* @__PURE__ */ t(
387
- C,
388
- {
389
- sx: {
390
- fontFamily: A,
391
- fontWeight: 500,
392
- fontSize: "0.9375em",
393
- lineHeight: "24px",
394
- letterSpacing: "0.46px",
395
- textTransform: "uppercase",
396
- color: f ? "transparent" : b,
397
- gap: I.xs,
398
- display: "flex",
399
- alignItems: "center"
400
- },
401
- children: i && l ? l.defaultLabel : ((M = s == null ? void 0 : s.labels) == null ? void 0 : M.ctaLabel) || o("eitherOr.buttons.start")
402
- }
403
- )
404
- }
405
- ),
406
- S && c && /* @__PURE__ */ t(
407
- me,
408
- {
409
- brandingLogo: S,
410
- textColor: p,
411
- label: ((H = n == null ? void 0 : n.labels) == null ? void 0 : H.sponsor) || null
412
- }
413
- )
414
- ]
415
- }
416
- )
417
- ]
418
- }
419
- ) }) : null;
420
- }, zn = Cn`
421
- 0% {
422
- opacity: 1;
423
- transform: translateY(0);
424
- }
425
- 100% {
426
- opacity: 0;
427
- transform: translateY(-20px);
428
- }
429
- `, Nt = {
430
- pointsAdded: {
431
- position: "absolute",
432
- top: -20,
433
- right: 0,
434
- color: "primary.500",
435
- animation: `${zn} 1s ease-out forwards`
436
- },
437
- optionWrapper: {
438
- position: "relative",
439
- flex: 1,
440
- transition: "transform 0.2s"
441
- },
442
- dividerWrapper: {
443
- width: { xs: "100%", sm: "40px" },
444
- my: { xs: 2, sm: 0 }
445
- },
446
- dividerButton: {
447
- borderRadius: "50%",
448
- bgcolor: "background.surface",
449
- boxShadow: "sm",
450
- width: "30px",
451
- height: "30px",
452
- "&:hover": { bgcolor: "background.level1" }
453
- },
454
- dividerText: {
455
- fontWeight: "lg",
456
- color: "text.secondary",
457
- display: { xs: "none", sm: "block" },
458
- textTransform: "uppercase",
459
- fontSize: "0.675em !important"
460
- },
461
- timerProgressWrapper: {
462
- position: "relative",
463
- width: "100%",
464
- height: 8,
465
- bgcolor: "neutral.200",
466
- borderRadius: "4px",
467
- overflow: "hidden"
468
- },
469
- timerProgress: {
470
- position: "absolute",
471
- left: 0,
472
- top: 0,
473
- height: "100%",
474
- transition: "width 1s linear, background-color 0.3s ease",
475
- borderRadius: "inherit",
476
- transform: "translateZ(0)"
477
- }
478
- }, nt = ({
479
- option: e,
480
- selected: n,
481
- feedback: l,
482
- onSelect: i,
483
- pairId: s,
484
- brandingPrimaryColor: f,
485
- optionIndex: o = 0
486
- }) => {
487
- const m = K(), c = Pe(), u = f || m.palette.primary.plainColor, h = m.palette.primary.onPrimary, b = m.palette.success.plainColor, p = m.palette.danger.plainColor, x = le(u || ""), A = x ? x.replace(/[^\d,]/g, "") : null, E = Xt(e.images ?? null), w = !!E, I = o === 0 ? "A" : "B", y = l.selectedOption === e.id, d = y && !!l.isCorrect || e.id === l.correctOptionId, L = y && !l.isCorrect || !!l.timedOut && e.id !== l.correctOptionId;
488
- if (!w) {
489
- const S = o === 0 ? "135deg" : "225deg", P = d ? `linear-gradient(${S}, ${b}20 0%, ${b}0D 100%)` : L ? `linear-gradient(${S}, ${p}20 0%, ${p}0D 100%)` : A ? `linear-gradient(${S}, rgba(${A}, 0.22) 0%, rgba(${A}, 0.08) 60%, rgba(${A}, 0.14) 100%)` : `linear-gradient(${S}, ${u}38 0%, ${u}14 60%, ${u}24 100%)`, B = A ? `repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(${A}, 0.04) 10px, rgba(${A}, 0.04) 11px)` : "none", v = d ? b : L ? p : A ? `rgba(${A}, 0.3)` : `${u}4D`, D = d ? b : L ? p : u;
490
- return /* @__PURE__ */ g(
491
- r,
492
- {
493
- onClick: () => !n && i(s, e.id),
494
- sx: {
495
- position: "relative",
496
- height: "100px",
497
- borderRadius: "sm",
498
- overflow: "hidden",
499
- cursor: n ? "default" : "pointer",
500
- background: P,
501
- border: "1.5px solid",
502
- borderColor: v,
503
- display: "flex",
504
- alignItems: "center",
505
- gap: "14px",
506
- px: c.md,
507
- transition: "transform 0.2s, box-shadow 0.2s, border-color 0.25s",
508
- boxShadow: d ? `0 0 0 3px ${b}30` : L ? `0 0 0 3px ${p}30` : "none",
509
- "&:hover": n ? {} : {
510
- transform: "scale(1.01)",
511
- boxShadow: `0 4px 16px ${A ? `rgba(${A}, 0.2)` : `${u}33`}`
512
- }
513
- },
514
- children: [
515
- /* @__PURE__ */ t(
516
- r,
517
- {
518
- sx: {
519
- position: "absolute",
520
- inset: 0,
521
- background: B,
522
- zIndex: 0
523
- }
524
- }
525
- ),
526
- /* @__PURE__ */ t(
527
- r,
528
- {
529
- sx: {
530
- width: 40,
531
- height: 40,
532
- borderRadius: "50%",
533
- bgcolor: D,
534
- display: "flex",
535
- alignItems: "center",
536
- justifyContent: "center",
537
- flexShrink: 0,
538
- zIndex: 2,
539
- transition: "background-color 0.25s",
540
- boxShadow: d ? `0 2px 8px ${b}59` : L ? `0 2px 8px ${p}59` : `0 2px 8px ${A ? `rgba(${A}, 0.35)` : `${u}59`}`
541
- },
542
- children: d ? /* @__PURE__ */ t(wt, { sx: { fontSize: "1.3em", color: "#fff" } }) : L ? /* @__PURE__ */ t(Rt, { sx: { fontSize: "1.3em", color: "#fff" } }) : /* @__PURE__ */ t(
543
- C,
544
- {
545
- sx: {
546
- color: h,
547
- fontWeight: 800,
548
- fontSize: "1em",
549
- lineHeight: 1,
550
- userSelect: "none"
551
- },
552
- children: I
553
- }
554
- )
555
- }
556
- ),
557
- /* @__PURE__ */ t(
558
- C,
559
- {
560
- sx: {
561
- fontWeight: 700,
562
- fontSize: "0.9375em",
563
- lineHeight: 1.35,
564
- color: d ? b : L ? p : u,
565
- zIndex: 2,
566
- flex: 1,
567
- transition: "color 0.25s"
568
- },
569
- children: e.label
570
- }
571
- )
572
- ]
573
- }
574
- );
575
- }
576
- return /* @__PURE__ */ g(
577
- r,
578
- {
579
- onClick: () => !n && i(s, e.id),
580
- sx: {
581
- position: "relative",
582
- aspectRatio: "16/9",
583
- borderRadius: "sm",
584
- overflow: "hidden",
585
- cursor: n ? "default" : "pointer",
586
- backgroundImage: `url(${E})`,
587
- backgroundSize: "cover",
588
- backgroundPosition: "center top",
589
- backgroundClip: "padding-box",
590
- bgcolor: m.surfaceVariant,
591
- border: "1.5px solid transparent",
592
- borderColor: d ? b : L ? p : "transparent",
593
- transition: "transform 0.2s, border-color 0.25s",
594
- boxShadow: d ? `0 0 0 3px ${b}30` : L ? `0 0 0 3px ${p}30` : "none",
595
- "&:hover": n ? {} : { transform: "scale(1.01)" }
596
- },
597
- children: [
598
- /* @__PURE__ */ t(
599
- r,
600
- {
601
- sx: {
602
- position: "absolute",
603
- inset: 0,
604
- background: "linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0) 100%)"
605
- }
606
- }
607
- ),
608
- (y || l.timedOut || e.id === l.correctOptionId) && /* @__PURE__ */ t(
609
- r,
610
- {
611
- sx: {
612
- position: "absolute",
613
- inset: 0,
614
- background: d ? `linear-gradient(to top, ${b}CC, ${b}55 50%, transparent 100%)` : `linear-gradient(to top, ${p}CC, ${p}55 50%, transparent 100%)`,
615
- transition: "background 0.25s",
616
- zIndex: 1
617
- }
618
- }
619
- ),
620
- (y || l.timedOut || e.id === l.correctOptionId) && /* @__PURE__ */ t(
621
- r,
622
- {
623
- sx: {
624
- position: "absolute",
625
- top: "8px",
626
- right: "10px",
627
- zIndex: 3
628
- },
629
- children: d ? /* @__PURE__ */ t(
630
- wt,
631
- {
632
- sx: {
633
- fontSize: 28,
634
- color: "#fff",
635
- filter: "drop-shadow(0 1px 4px rgba(0,0,0,0.5))"
636
- }
637
- }
638
- ) : /* @__PURE__ */ t(
639
- Rt,
640
- {
641
- sx: {
642
- fontSize: 28,
643
- color: "#fff",
644
- filter: "drop-shadow(0 1px 4px rgba(0,0,0,0.5))"
645
- }
646
- }
647
- )
648
- }
649
- ),
650
- /* @__PURE__ */ t(
651
- r,
652
- {
653
- sx: {
654
- position: "absolute",
655
- bottom: 0,
656
- left: 0,
657
- right: 0,
658
- px: "12px",
659
- py: "8px",
660
- zIndex: 2
661
- },
662
- children: /* @__PURE__ */ t(
663
- C,
664
- {
665
- sx: {
666
- color: "#fff",
667
- fontWeight: 700,
668
- fontSize: "0.875em",
669
- textShadow: "0 1px 2px rgba(0,0,0,0.4)",
670
- textAlign: "center"
671
- },
672
- children: e.label
673
- }
674
- )
675
- }
676
- )
677
- ]
678
- }
679
- );
680
- }, Vt = ({
681
- time: e,
682
- maxTime: n,
683
- brandingPrimaryColor: l
684
- }) => {
685
- const i = K().palette.danger.softBg, s = K().palette.danger.plainColor, f = K().palette.warning.softBg, o = K().palette.warning.plainColor, m = l || K().palette.primary.plainColor, c = K().palette.primary.onPrimary, u = pe().xl, h = Te().secondary, b = Pe(), p = {
686
- "@keyframes pulse": {
687
- "0%": { transform: "scale(1)" },
688
- "50%": { transform: "scale(1.05)" },
689
- "100%": { transform: "scale(1)" }
690
- }
691
- }, x = n > 0 ? e / n * 100 : 100, E = x <= 30 ? {
692
- background: i,
693
- color: s,
694
- animation: "pulse 1s infinite"
695
- } : x <= 50 ? {
696
- background: f,
697
- color: o,
698
- animation: void 0
699
- } : {
700
- background: m,
701
- color: c,
702
- animation: void 0
703
- }, w = (I) => {
704
- const y = Math.floor(I / 60), d = I % 60;
705
- return `${y < 10 ? "0" : ""}${y}:${d < 10 ? "0" : ""}${d}${y > 0 ? "m" : "s"}`;
706
- };
707
- return /* @__PURE__ */ g(
708
- r,
709
- {
710
- sx: {
711
- py: b.xs,
712
- pl: b.sm,
713
- pr: b.md,
714
- display: "flex",
715
- gap: b["2xs"],
716
- alignItems: "center",
717
- bgcolor: E.background,
718
- borderRadius: u,
719
- maxWidth: "105px",
720
- maxHeight: "40px",
721
- transition: "all 0.3s ease",
722
- animation: E.animation,
723
- ...p,
724
- zIndex: 10
725
- },
726
- children: [
727
- /* @__PURE__ */ t(
728
- In,
729
- {
730
- sx: {
731
- width: "24px",
732
- height: "24px",
733
- color: E.color,
734
- transition: "color 0.3s ease"
735
- }
736
- }
737
- ),
738
- /* @__PURE__ */ t(
739
- C,
740
- {
741
- sx: {
742
- fontFamily: h,
743
- fontWeight: 400,
744
- fontSize: "1em",
745
- lineHeight: "150%",
746
- letterSpacing: "0.15px",
747
- color: E.color,
748
- transition: "color 0.3s ease"
749
- },
750
- children: w(e)
751
- }
752
- )
753
- ]
754
- }
755
- );
756
- }, Bn = ({
757
- currentPair: e,
758
- timer: n,
759
- selected: l,
760
- maxTime: i,
761
- feedback: s,
762
- onSelect: f,
763
- stepInfo: o,
764
- brandingPrimaryColor: m,
765
- game: c
766
- }) => {
767
- var J, X, Z, te, ae, ne, Q, de, _, fe;
768
- const [u, h] = z(0), [b, p] = z(!1), [x, A] = z(0), [E, w] = z(0), [I, y] = z(!1), d = mt(0), { t: L } = ee(), S = Se(), P = He(), B = K(), v = B.surfaceVariant, D = m || B.palette.primary.plainColor, O = ((X = (J = c == null ? void 0 : c.branding) == null ? void 0 : J.colors) == null ? void 0 : X.contentColor) || B.textColor, V = pe().md, $ = Pe(), R = le(v || ""), k = le(D || ""), G = S ? ((te = (Z = c == null ? void 0 : c.branding) == null ? void 0 : Z.images) == null ? void 0 : te.mobileLogo) || ((ne = (ae = c == null ? void 0 : c.branding) == null ? void 0 : ae.images) == null ? void 0 : ne.mainLogo) || "" : ((de = (Q = c == null ? void 0 : c.branding) == null ? void 0 : Q.images) == null ? void 0 : de.mainLogo) || "", M = L("common.labels.point", { count: u });
769
- he(() => {
770
- if (o != null && o.currentPoints && o.currentPoints > u) {
771
- A(o.currentPoints - u), p(!0), w((j) => j + 1);
772
- const U = setTimeout(() => p(!1), 1e3);
773
- return h(o.currentPoints), () => clearTimeout(U);
774
- }
775
- }, [o == null ? void 0 : o.currentPoints, u]);
776
- const H = (c == null ? void 0 : c.points) ?? [], a = H.length >= 2 ? H[1].correctSteps - H[0].correctSteps : ((_ = H[0]) == null ? void 0 : _.correctSteps) || 5;
777
- he(() => {
778
- const U = d.current, j = (o == null ? void 0 : o.currentStreak) ?? 0;
779
- if (d.current = j, j > U && j > 0 && j % a === 0) {
780
- y(!0);
781
- const ue = setTimeout(() => y(!1), 500);
782
- return () => clearTimeout(ue);
783
- }
784
- }, [o == null ? void 0 : o.currentStreak, a]);
785
- const Y = () => {
786
- const U = [], j = (o == null ? void 0 : o.currentLives) ?? 3;
787
- for (let ue = 0; ue < j; ue++)
788
- U.push(
789
- /* @__PURE__ */ t(
790
- at,
791
- {
792
- sx: { height: 20, color: D }
793
- },
794
- `life-${ue}`
795
- )
796
- );
797
- for (let ue = j; ue < 3; ue++)
798
- U.push(
799
- /* @__PURE__ */ t(
800
- Gt,
801
- {
802
- sx: {
803
- height: 20,
804
- color: k ? `rgba(${k.replace(/[^\d,]/g, "")}, 0.35)` : `${D}59`
805
- }
806
- },
807
- `empty-${ue}`
808
- )
809
- );
810
- return U;
811
- }, T = () => {
812
- const U = (o == null ? void 0 : o.currentStreak) ?? 0, j = I ? a : U % a, Ae = Math.floor(U / a) + 1;
813
- return /* @__PURE__ */ g(r, { sx: { display: "flex", alignItems: "center", gap: "4px" }, children: [
814
- Array.from({ length: a }, (we, Ce) => /* @__PURE__ */ t(
815
- r,
816
- {
817
- sx: {
818
- flex: 1,
819
- height: 4,
820
- bgcolor: Ce < j ? D : k ? `rgba(${k.replace(/[^\d,]/g, "")}, 0.2)` : `${D}33`,
821
- borderRadius: "2px",
822
- transition: "background-color 0.3s ease"
823
- }
824
- },
825
- `streak-${Ce}`
826
- )),
827
- Ae > 1 && /* @__PURE__ */ g(
828
- C,
829
- {
830
- sx: {
831
- color: D,
832
- fontWeight: 700,
833
- fontSize: "0.75em",
834
- lineHeight: 1,
835
- ml: $["2xs"],
836
- flexShrink: 0
837
- },
838
- children: [
839
- "×",
840
- Ae
841
- ]
842
- }
843
- )
844
- ] });
845
- }, N = () => /* @__PURE__ */ t(
846
- r,
847
- {
848
- sx: {
849
- display: "flex",
850
- justifyContent: "center",
851
- alignItems: "center",
852
- ...S ? { width: "100%", my: $.sm } : {}
853
- },
854
- children: /* @__PURE__ */ t(
855
- r,
856
- {
857
- sx: {
858
- borderRadius: "50%",
859
- bgcolor: B.surface,
860
- boxShadow: "sm",
861
- width: "32px",
862
- height: "32px",
863
- minWidth: "32px",
864
- border: "1px solid",
865
- borderColor: D,
866
- display: "flex",
867
- alignItems: "center",
868
- justifyContent: "center"
869
- },
870
- children: S ? /* @__PURE__ */ t(Sn, { sx: { fontSize: "1.1em", color: D } }) : /* @__PURE__ */ t(jt, { sx: { fontSize: "1.1em", color: D } })
871
- }
872
- )
873
- }
874
- );
875
- return e ? (
876
- // questionArea
877
- /* @__PURE__ */ t(r, { sx: { display: "flex", flexDirection: "column", p: $.md }, children: /* @__PURE__ */ g(
878
- r,
879
- {
880
- sx: {
881
- display: "flex",
882
- flexDirection: "column",
883
- gap: S ? $.lg : $.md
884
- },
885
- children: [
886
- /* @__PURE__ */ t(r, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ t(
887
- Vt,
888
- {
889
- time: n,
890
- maxTime: i,
891
- brandingPrimaryColor: m
892
- },
893
- `timer-${e.pairId}`
894
- ) }),
895
- /* @__PURE__ */ t(
896
- r,
897
- {
898
- sx: {
899
- borderRadius: V,
900
- overflow: "hidden",
901
- bgcolor: R ? `rgba(${R.replace(/[^\d,]/g, "")}, 0.5)` : B.surfaceVariant,
902
- display: "flex",
903
- flexDirection: "column",
904
- backdropFilter: "blur(4px)",
905
- px: $.md,
906
- pt: $.md,
907
- pb: $.lg,
908
- gap: $.md
909
- },
910
- children: /* @__PURE__ */ g(
911
- r,
912
- {
913
- sx: {
914
- display: "flex",
915
- flexDirection: S ? "column" : "row",
916
- gap: S ? 0 : $.md,
917
- alignItems: S ? "stretch" : "center"
918
- },
919
- children: [
920
- /* @__PURE__ */ t(r, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ t(
921
- nt,
922
- {
923
- option: e.optionOne,
924
- selected: l,
925
- feedback: s,
926
- onSelect: f,
927
- pairId: e.pairId,
928
- brandingPrimaryColor: m,
929
- optionIndex: 0
930
- }
931
- ) }),
932
- N(),
933
- /* @__PURE__ */ t(r, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ t(
934
- nt,
935
- {
936
- option: e.optionTwo,
937
- selected: l,
938
- feedback: s,
939
- onSelect: f,
940
- pairId: e.pairId,
941
- brandingPrimaryColor: m,
942
- optionIndex: 1
943
- }
944
- ) })
945
- ]
946
- }
947
- )
948
- }
949
- ),
950
- /* @__PURE__ */ g(r, { children: [
951
- /* @__PURE__ */ t(r, { sx: { mb: $.xs }, children: T() }),
952
- /* @__PURE__ */ g(
953
- je,
954
- {
955
- direction: "row",
956
- justifyContent: "space-between",
957
- alignItems: "center",
958
- children: [
959
- /* @__PURE__ */ t(r, { children: Y() }),
960
- /* @__PURE__ */ g(je, { direction: "row", spacing: 1, alignItems: "center", children: [
961
- /* @__PURE__ */ g(C, { sx: { color: O }, children: [
962
- M,
963
- ":"
964
- ] }),
965
- /* @__PURE__ */ g(
966
- C,
967
- {
968
- level: "h4",
969
- sx: { position: "relative", color: O },
970
- children: [
971
- u,
972
- b && /* @__PURE__ */ g(
973
- C,
974
- {
975
- sx: Nt.pointsAdded,
976
- children: [
977
- "+",
978
- x
979
- ]
980
- },
981
- E
982
- )
983
- ]
984
- }
985
- )
986
- ] })
987
- ]
988
- }
989
- ),
990
- G && /* @__PURE__ */ t(
991
- r,
992
- {
993
- sx: {
994
- mt: $.xs,
995
- display: "flex",
996
- justifyContent: P ? "center" : "flex-start"
997
- },
998
- children: /* @__PURE__ */ t(
999
- me,
1000
- {
1001
- brandingLogo: G,
1002
- textColor: O,
1003
- label: ((fe = c == null ? void 0 : c.labels) == null ? void 0 : fe.sponsor) || null
1004
- }
1005
- )
1006
- }
1007
- )
1008
- ] })
1009
- ]
1010
- }
1011
- ) })
1012
- ) : null;
1013
- }, Dn = (e, n, l, i) => {
1014
- if (n === 0)
1015
- return {
1016
- emoji: "🎮",
1017
- message: i("eitherOr.results.practice", "Keep practicing!")
1018
- };
1019
- const s = e / n * 100;
1020
- let f;
1021
- if (s === 100 ? f = {
1022
- emoji: "🏆",
1023
- message: i("eitherOr.results.perfect", "Perfect! Flawless!")
1024
- } : s >= 80 ? f = {
1025
- emoji: "🔥",
1026
- message: i("eitherOr.results.excellent", "Excellent!")
1027
- } : s >= 60 ? f = { emoji: "✨", message: i("eitherOr.results.great", "Great job!") } : s >= 40 ? f = { emoji: "💪", message: i("eitherOr.results.good", "Good try!") } : f = {
1028
- emoji: "📚",
1029
- message: i("eitherOr.results.practice", "Keep practicing!")
1030
- }, l > 0) {
1031
- const o = i("eitherOr.results.livesBonus", { count: l }) || (l === 1 ? "And with 1 life to spare!" : `And with ${l} lives to spare!`);
1032
- f = { ...f, message: `${f.message} ${o}` };
1033
- }
1034
- return f;
1035
- }, st = ({
1036
- stepInfo: e,
1037
- game: n,
1038
- sdk: l,
1039
- onPlayAgain: i,
1040
- brandingPrimaryColor: s,
1041
- additionalCTA: f
1042
- }) => {
1043
- var X, Z, te, ae, ne, Q, de, _, fe;
1044
- const { t: o } = ee(), m = K(), c = s || m.palette.primary.plainColor, u = m.palette.primary.onPrimary, h = ((Z = (X = n == null ? void 0 : n.branding) == null ? void 0 : X.colors) == null ? void 0 : Z.contentColor) || m.textColor, b = m.palette.success.plainColor, p = m.palette.danger.plainColor, x = m.palette.success.softBg, A = m.palette.danger.softBg, E = pe().md, w = pe().xl, I = Pe(), y = Te().primary, d = Se(), L = He(), S = le(c || ""), P = S ? S.replace(/[^\d,]/g, "") : null, B = d ? ((ae = (te = n == null ? void 0 : n.branding) == null ? void 0 : te.images) == null ? void 0 : ae.mobileLogo) || ((Q = (ne = n == null ? void 0 : n.branding) == null ? void 0 : ne.images) == null ? void 0 : Q.mainLogo) || "" : ((_ = (de = n == null ? void 0 : n.branding) == null ? void 0 : de.images) == null ? void 0 : _.mainLogo) || "", [v, D] = z(0), [O, V] = z(null), $ = (e == null ? void 0 : e.currentPoints) ?? 0, R = v > 0 && $ >= v;
1045
- if (he(() => {
1046
- n && (async () => {
1047
- try {
1048
- const j = await l.miniGames.getMyEitherOrStats(n.id);
1049
- D(j.personalBest ?? 0), V(j.betterThan ?? null);
1050
- } catch {
1051
- }
1052
- })();
1053
- }, [e, n, l]), !e) return null;
1054
- const k = e.steps.filter((U) => U.played), G = k.filter((U) => U.correct === !0).length, M = k.filter(
1055
- (U) => U.correct === !1 && U.userSelection !== null
1056
- ).length, H = k.filter(
1057
- (U) => U.userSelection === null
1058
- ).length, a = k.length, Y = Dn(
1059
- G,
1060
- a,
1061
- e.currentLives,
1062
- o
1063
- ), T = a > 0 ? G / a * 100 : 0, N = a > 0 ? M / a * 100 : 0, J = a > 0 ? H / a * 100 : 0;
1064
- return /* @__PURE__ */ g(
1065
- r,
1066
- {
1067
- sx: {
1068
- p: I.md,
1069
- display: "flex",
1070
- flexDirection: "column",
1071
- gap: I.md,
1072
- animation: "eoFadeUp 0.45s ease-out both",
1073
- "@keyframes eoFadeUp": {
1074
- from: { opacity: 0, transform: "translateY(14px)" },
1075
- to: { opacity: 1, transform: "translateY(0)" }
1076
- }
1077
- },
1078
- children: [
1079
- R && /* @__PURE__ */ g(
1080
- r,
1081
- {
1082
- sx: {
1083
- position: "relative",
1084
- overflow: "hidden",
1085
- borderRadius: E,
1086
- background: P ? `linear-gradient(135deg, rgba(${P},0.92) 0%, rgba(${P},0.72) 100%)` : `linear-gradient(135deg, ${c}EB 0%, ${c}B8 100%)`,
1087
- p: "20px 20px 18px",
1088
- display: "flex",
1089
- alignItems: "center",
1090
- gap: "16px",
1091
- animation: "eoPBSlideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.05s both",
1092
- "@keyframes eoPBSlideIn": {
1093
- from: { opacity: 0, transform: "scale(0.88) translateY(-8px)" },
1094
- to: { opacity: 1, transform: "scale(1) translateY(0)" }
1095
- },
1096
- "&::before": {
1097
- content: '""',
1098
- position: "absolute",
1099
- inset: 0,
1100
- background: "linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.18) 50%, transparent 65%)",
1101
- backgroundSize: "200% 100%",
1102
- animation: "eoPBShimmer 2.2s ease-in-out 0.6s infinite"
1103
- },
1104
- "@keyframes eoPBShimmer": {
1105
- "0%": { backgroundPosition: "200% 0" },
1106
- "100%": { backgroundPosition: "-200% 0" }
1107
- }
1108
- },
1109
- children: [
1110
- /* @__PURE__ */ g(
1111
- r,
1112
- {
1113
- sx: {
1114
- flexShrink: 0,
1115
- position: "relative",
1116
- width: 56,
1117
- height: 56,
1118
- display: "flex",
1119
- alignItems: "center",
1120
- justifyContent: "center"
1121
- },
1122
- children: [
1123
- /* @__PURE__ */ t(
1124
- r,
1125
- {
1126
- sx: {
1127
- position: "absolute",
1128
- inset: -6,
1129
- borderRadius: "50%",
1130
- border: "2px solid rgba(255,255,255,0.5)",
1131
- animation: "eoPBPulse 1.6s ease-in-out 0.8s infinite",
1132
- "@keyframes eoPBPulse": {
1133
- "0%, 100%": { transform: "scale(1)", opacity: 0.6 },
1134
- "50%": { transform: "scale(1.18)", opacity: 0 }
1135
- }
1136
- }
1137
- }
1138
- ),
1139
- /* @__PURE__ */ t(
1140
- r,
1141
- {
1142
- sx: {
1143
- width: 56,
1144
- height: 56,
1145
- borderRadius: "50%",
1146
- bgcolor: "rgba(255,255,255,0.22)",
1147
- display: "flex",
1148
- alignItems: "center",
1149
- justifyContent: "center"
1150
- },
1151
- children: /* @__PURE__ */ t(Ge, { sx: { fontSize: "1.9em", color: "#fff" } })
1152
- }
1153
- )
1154
- ]
1155
- }
1156
- ),
1157
- /* @__PURE__ */ g(r, { sx: { flex: 1, minWidth: 0 }, children: [
1158
- /* @__PURE__ */ g(
1159
- r,
1160
- {
1161
- sx: {
1162
- display: "inline-flex",
1163
- alignItems: "center",
1164
- gap: "5px",
1165
- bgcolor: "rgba(255,255,255,0.22)",
1166
- border: "1px solid rgba(255,255,255,0.35)",
1167
- borderRadius: "100px",
1168
- px: "8px",
1169
- py: "2px",
1170
- mb: "6px"
1171
- },
1172
- children: [
1173
- /* @__PURE__ */ t(
1174
- r,
1175
- {
1176
- sx: {
1177
- width: 6,
1178
- height: 6,
1179
- borderRadius: "50%",
1180
- bgcolor: "#fff",
1181
- animation: "eoDot 1s ease-in-out infinite",
1182
- "@keyframes eoDot": {
1183
- "0%, 100%": { opacity: 1 },
1184
- "50%": { opacity: 0.3 }
1185
- }
1186
- }
1187
- }
1188
- ),
1189
- /* @__PURE__ */ t(
1190
- C,
1191
- {
1192
- sx: {
1193
- fontSize: "0.6em",
1194
- fontWeight: 800,
1195
- letterSpacing: "0.14em",
1196
- textTransform: "uppercase",
1197
- color: "#fff",
1198
- lineHeight: 1
1199
- },
1200
- children: o("eitherOr.newRecord", "New Record")
1201
- }
1202
- )
1203
- ]
1204
- }
1205
- ),
1206
- /* @__PURE__ */ t(
1207
- C,
1208
- {
1209
- sx: {
1210
- fontSize: "1.05em",
1211
- fontWeight: 800,
1212
- color: "#fff",
1213
- lineHeight: 1.25
1214
- },
1215
- children: o("eitherOr.personalBestImprovedTitle", "Congratulations!")
1216
- }
1217
- ),
1218
- /* @__PURE__ */ t(
1219
- C,
1220
- {
1221
- sx: {
1222
- fontSize: "0.8em",
1223
- color: "rgba(255,255,255,0.82)",
1224
- mt: "2px"
1225
- },
1226
- children: o(
1227
- "eitherOr.personalBestImprovedSubtitle",
1228
- "You just broke your personal record!"
1229
- )
1230
- }
1231
- )
1232
- ] })
1233
- ]
1234
- }
1235
- ),
1236
- /* @__PURE__ */ g(
1237
- r,
1238
- {
1239
- sx: {
1240
- display: "flex",
1241
- flexDirection: "column",
1242
- alignItems: "center",
1243
- gap: "10px",
1244
- py: I.lg,
1245
- borderRadius: E,
1246
- backdropFilter: "blur(4px)",
1247
- position: "relative",
1248
- "&::before": {
1249
- content: '""',
1250
- position: "absolute",
1251
- top: 0,
1252
- left: 0,
1253
- right: 0,
1254
- bottom: 0,
1255
- backgroundColor: m.surfaceVariant,
1256
- opacity: 0.5,
1257
- borderRadius: "inherit",
1258
- zIndex: 0
1259
- },
1260
- "& > *": { position: "relative", zIndex: 1 }
1261
- },
1262
- children: [
1263
- /* @__PURE__ */ t(
1264
- r,
1265
- {
1266
- sx: {
1267
- width: 52,
1268
- height: 52,
1269
- borderRadius: "50%",
1270
- bgcolor: P ? `rgba(${P},0.14)` : `${c}24`,
1271
- display: "flex",
1272
- alignItems: "center",
1273
- justifyContent: "center"
1274
- },
1275
- children: /* @__PURE__ */ t(Ge, { sx: { fontSize: "1.75em", color: c } })
1276
- }
1277
- ),
1278
- /* @__PURE__ */ t(
1279
- C,
1280
- {
1281
- sx: {
1282
- fontSize: "0.65em",
1283
- fontWeight: 700,
1284
- letterSpacing: "0.12em",
1285
- textTransform: "uppercase",
1286
- color: m.textColor
1287
- },
1288
- children: o("eitherOr.yourScore", "Your Score")
1289
- }
1290
- ),
1291
- /* @__PURE__ */ t(
1292
- C,
1293
- {
1294
- sx: {
1295
- fontSize: "3.5em",
1296
- fontWeight: 900,
1297
- lineHeight: 1,
1298
- color: c,
1299
- textShadow: P ? `0 2px 24px rgba(${P},0.35)` : `0 2px 24px ${c}59`,
1300
- animation: "eoScorePop 0.55s cubic-bezier(0.34,1.56,0.64,1) 0.1s both",
1301
- "@keyframes eoScorePop": {
1302
- from: { opacity: 0, transform: "scale(0.5)" },
1303
- to: { opacity: 1, transform: "scale(1)" }
1304
- }
1305
- },
1306
- children: e.currentPoints
1307
- }
1308
- ),
1309
- /* @__PURE__ */ g(
1310
- C,
1311
- {
1312
- sx: { fontSize: "1em", fontWeight: 600, color: m.textColor },
1313
- children: [
1314
- Y.emoji,
1315
- " ",
1316
- Y.message
1317
- ]
1318
- }
1319
- )
1320
- ]
1321
- }
1322
- ),
1323
- /* @__PURE__ */ g(
1324
- r,
1325
- {
1326
- sx: {
1327
- height: 7,
1328
- borderRadius: "4px",
1329
- overflow: "hidden",
1330
- display: "flex",
1331
- bgcolor: m.surfaceVariant
1332
- },
1333
- children: [
1334
- T > 0 && /* @__PURE__ */ t(
1335
- r,
1336
- {
1337
- sx: {
1338
- width: `${T}%`,
1339
- bgcolor: b,
1340
- transition: "width 0.7s ease"
1341
- }
1342
- }
1343
- ),
1344
- N > 0 && /* @__PURE__ */ t(
1345
- r,
1346
- {
1347
- sx: {
1348
- width: `${N}%`,
1349
- bgcolor: p,
1350
- transition: "width 0.7s ease 0.1s"
1351
- }
1352
- }
1353
- ),
1354
- J > 0 && /* @__PURE__ */ t(
1355
- r,
1356
- {
1357
- sx: {
1358
- width: `${J}%`,
1359
- bgcolor: m.secondaryContainer,
1360
- transition: "width 0.7s ease 0.2s"
1361
- }
1362
- }
1363
- )
1364
- ]
1365
- }
1366
- ),
1367
- /* @__PURE__ */ t(je, { direction: "row", spacing: 1, children: [
1368
- {
1369
- icon: /* @__PURE__ */ t(
1370
- kn,
1371
- {
1372
- sx: { fontSize: "1.25em", color: b }
1373
- }
1374
- ),
1375
- value: G,
1376
- label: o("eitherOr.results.correct", "Correct"),
1377
- bg: x,
1378
- valueSx: { color: b },
1379
- labelSx: { color: b }
1380
- },
1381
- {
1382
- icon: /* @__PURE__ */ t(Tn, { sx: { fontSize: "1.25em", color: p } }),
1383
- value: M,
1384
- label: o("eitherOr.results.wrong", "Wrong"),
1385
- bg: A,
1386
- valueSx: { color: p },
1387
- labelSx: { color: p }
1388
- },
1389
- {
1390
- icon: /* @__PURE__ */ t(
1391
- Pn,
1392
- {
1393
- sx: { fontSize: "1.25em", color: m.textColor }
1394
- }
1395
- ),
1396
- value: H,
1397
- label: o("eitherOr.results.missed", "Missed"),
1398
- bg: m.surfaceVariant,
1399
- valueSx: { color: m.textColor },
1400
- labelSx: { color: m.textColor }
1401
- }
1402
- ].map((U) => /* @__PURE__ */ g(
1403
- r,
1404
- {
1405
- sx: {
1406
- flex: 1,
1407
- display: "flex",
1408
- flexDirection: "column",
1409
- alignItems: "center",
1410
- gap: "4px",
1411
- py: "14px",
1412
- borderRadius: E,
1413
- bgcolor: U.bg
1414
- },
1415
- children: [
1416
- U.icon,
1417
- /* @__PURE__ */ t(
1418
- C,
1419
- {
1420
- sx: {
1421
- fontSize: "1.3em",
1422
- fontWeight: 800,
1423
- lineHeight: 1,
1424
- ...U.valueSx
1425
- },
1426
- children: U.value
1427
- }
1428
- ),
1429
- /* @__PURE__ */ t(
1430
- C,
1431
- {
1432
- sx: { fontSize: "0.68em", fontWeight: 600, ...U.labelSx },
1433
- children: U.label
1434
- }
1435
- )
1436
- ]
1437
- },
1438
- U.label
1439
- )) }),
1440
- v > 0 && O !== null && O > 0 && /* @__PURE__ */ g(
1441
- r,
1442
- {
1443
- sx: {
1444
- borderRadius: E,
1445
- p: I.md,
1446
- display: "flex",
1447
- alignItems: "center",
1448
- gap: "10px",
1449
- backdropFilter: "blur(4px)",
1450
- position: "relative",
1451
- "&::before": {
1452
- content: '""',
1453
- position: "absolute",
1454
- top: 0,
1455
- left: 0,
1456
- right: 0,
1457
- bottom: 0,
1458
- backgroundColor: m.surfaceVariant,
1459
- opacity: 0.5,
1460
- borderRadius: "inherit",
1461
- zIndex: 0
1462
- },
1463
- "& > *": { position: "relative", zIndex: 1 }
1464
- },
1465
- children: [
1466
- /* @__PURE__ */ t(
1467
- vn,
1468
- {
1469
- sx: { color: c, fontSize: "1.4em", flexShrink: 0 }
1470
- }
1471
- ),
1472
- /* @__PURE__ */ t(
1473
- C,
1474
- {
1475
- sx: {
1476
- fontSize: "0.8em",
1477
- color: m.textColor,
1478
- lineHeight: 1.5
1479
- },
1480
- children: o("eitherOr.betterThanLabel", {
1481
- points: R ? $ : v,
1482
- percentile: O
1483
- })
1484
- }
1485
- )
1486
- ]
1487
- }
1488
- ),
1489
- /* @__PURE__ */ g(
1490
- r,
1491
- {
1492
- sx: {
1493
- display: "flex",
1494
- flexDirection: L ? "column-reverse" : "row",
1495
- justifyContent: B ? "space-between" : "flex-end",
1496
- alignItems: "center",
1497
- gap: I.lg
1498
- },
1499
- children: [
1500
- /* @__PURE__ */ t(
1501
- me,
1502
- {
1503
- brandingLogo: B,
1504
- textColor: h,
1505
- label: ((fe = n == null ? void 0 : n.labels) == null ? void 0 : fe.sponsor) || null
1506
- }
1507
- ),
1508
- /* @__PURE__ */ t(
1509
- ye,
1510
- {
1511
- variant: "soft",
1512
- endDecorator: /* @__PURE__ */ t(ct, { children: /* @__PURE__ */ t(gt, {}) }),
1513
- onClick: i,
1514
- sx: {
1515
- borderRadius: w,
1516
- py: "10px",
1517
- pr: "12px",
1518
- pl: "16px",
1519
- bgcolor: c,
1520
- color: u,
1521
- alignSelf: "center",
1522
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
1523
- "&:hover": { bgcolor: c, transform: "scale(1.02)" },
1524
- "&:active": { color: u, transform: "scale(0.98)" },
1525
- "--Icon-color": u
1526
- },
1527
- children: /* @__PURE__ */ t(
1528
- C,
1529
- {
1530
- sx: {
1531
- fontFamily: y,
1532
- fontWeight: 500,
1533
- fontSize: "0.9375em",
1534
- lineHeight: "24px",
1535
- letterSpacing: "0.46px",
1536
- textTransform: "uppercase",
1537
- color: u
1538
- },
1539
- children: o("eitherOr.buttons.playAgain", "Play Again")
1540
- }
1541
- )
1542
- }
1543
- )
1544
- ]
1545
- }
1546
- ),
1547
- /* @__PURE__ */ t(
1548
- Zt,
1549
- {
1550
- additionalCTA: f,
1551
- buttonStyle: {
1552
- borderRadius: w,
1553
- width: "100%",
1554
- py: "10px"
1555
- },
1556
- buttonContentStyle: { display: "flex", justifyContent: "center" },
1557
- textStyle: {
1558
- fontFamily: y,
1559
- fontWeight: 500,
1560
- fontSize: "0.9375em",
1561
- lineHeight: "24px",
1562
- letterSpacing: "0.46px",
1563
- textTransform: "uppercase"
1564
- }
1565
- }
1566
- )
1567
- ]
1568
- }
1569
- );
1570
- }, $n = 150, Fn = ({
1571
- breakdown: e,
1572
- currentPoints: n,
1573
- primaryColor: l,
1574
- textColor: i
1575
- }) => {
1576
- const { t: s } = ee(), f = Jt(), o = (R) => R.toLocaleString(f), m = K(), c = pe(), u = Pe(), h = Te().primary, b = m.outlineEnabledBorder, p = le(l), [x, A] = z(null), [E, w] = z(!1);
1577
- if (he(() => {
1578
- const R = requestAnimationFrame(() => {
1579
- setTimeout(() => w(!0), 80);
1580
- });
1581
- return () => cancelAnimationFrame(R);
1582
- }, []), !e || e.length === 0)
1583
- return /* @__PURE__ */ t(r, { sx: { py: u.lg, textAlign: "center" }, children: /* @__PURE__ */ t(
1584
- C,
1585
- {
1586
- sx: {
1587
- fontFamily: h,
1588
- color: i,
1589
- opacity: 0.4,
1590
- fontSize: "0.875em"
1591
- },
1592
- children: "No distribution data available."
1593
- }
1594
- ) });
1595
- const I = e.filter((R) => R.totalUsers > 0), y = Math.max(...I.map((R) => R.totalUsers), 1), d = Math.log(y + 1), L = e.reduce((R, k) => R + k.totalUsers, 0), S = n != null ? e.find(
1596
- (R) => n >= R.rangeStartInclusive && n <= R.rangeEndInclusive
1597
- ) ?? null : null, P = S ? I.findIndex(
1598
- (R) => R.rangeStartInclusive === S.rangeStartInclusive
1599
- ) : -1, B = x !== null ? I[x] : null, v = B ? `${o(B.rangeStartInclusive)} – ${o(B.rangeEndInclusive)} ${s("eitherOr.standings.pts", "pts")}` : S ? s("eitherOr.standings.yourRange", "Your range: {{start}} – {{end}}", {
1600
- start: o(S.rangeStartInclusive),
1601
- end: o(S.rangeEndInclusive)
1602
- }) : null, D = B ? B.totalUsers : S ? S.totalUsers : null, O = 5, V = Math.floor(
1603
- (I.length - 1) / (O - 1)
1604
- ), $ = new Set(
1605
- Array.from(
1606
- { length: O },
1607
- (R, k) => Math.min(k * V, I.length - 1)
1608
- )
1609
- );
1610
- return /* @__PURE__ */ g(
1611
- r,
1612
- {
1613
- sx: {
1614
- width: "100%",
1615
- boxSizing: "border-box",
1616
- p: u.md,
1617
- borderRadius: c.sm,
1618
- backdropFilter: "blur(4px)",
1619
- position: "relative",
1620
- "&::before": {
1621
- content: '""',
1622
- position: "absolute",
1623
- top: 0,
1624
- left: 0,
1625
- right: 0,
1626
- bottom: 0,
1627
- backgroundColor: m.surfaceVariant,
1628
- opacity: 0.5,
1629
- borderRadius: "inherit",
1630
- zIndex: 0
1631
- },
1632
- "& > *": { position: "relative", zIndex: 1 }
1633
- },
1634
- children: [
1635
- /* @__PURE__ */ g(
1636
- r,
1637
- {
1638
- sx: {
1639
- display: "flex",
1640
- justifyContent: "space-between",
1641
- alignItems: "center",
1642
- pb: u.xs,
1643
- mb: u.xs,
1644
- borderBottom: `1px solid rgba(${p}, 0.5)`
1645
- },
1646
- children: [
1647
- /* @__PURE__ */ t(
1648
- C,
1649
- {
1650
- sx: {
1651
- fontFamily: h,
1652
- fontSize: "0.7em",
1653
- fontWeight: 700,
1654
- color: i,
1655
- letterSpacing: "0.08em",
1656
- textTransform: "uppercase"
1657
- },
1658
- children: s("eitherOr.standings.scoreDistribution", "Score Distribution")
1659
- }
1660
- ),
1661
- /* @__PURE__ */ t(
1662
- C,
1663
- {
1664
- sx: {
1665
- fontFamily: h,
1666
- fontSize: "0.7em",
1667
- fontWeight: 500,
1668
- color: i,
1669
- opacity: 0.6
1670
- },
1671
- children: s("eitherOr.standings.totalUsers", "{{count}} users", {
1672
- count: L
1673
- })
1674
- }
1675
- )
1676
- ]
1677
- }
1678
- ),
1679
- /* @__PURE__ */ t(
1680
- r,
1681
- {
1682
- sx: {
1683
- display: "flex",
1684
- alignItems: "center",
1685
- justifyContent: "space-between",
1686
- px: u.sm,
1687
- py: "10px",
1688
- mb: u.md,
1689
- borderRadius: c.xs,
1690
- borderLeft: `3px solid ${v ? l : b}`,
1691
- backgroundColor: B ? `rgba(${le(b)}, 0.6)` : `rgba(${le(b)}, 0.35)`,
1692
- transition: "background-color 200ms ease, border-left-color 200ms ease"
1693
- },
1694
- children: v ? /* @__PURE__ */ g(Qe, { children: [
1695
- /* @__PURE__ */ t(
1696
- C,
1697
- {
1698
- sx: {
1699
- fontFamily: h,
1700
- fontSize: "0.8em",
1701
- color: l,
1702
- fontWeight: 700,
1703
- letterSpacing: "0.01em"
1704
- },
1705
- children: v
1706
- }
1707
- ),
1708
- /* @__PURE__ */ t(
1709
- C,
1710
- {
1711
- sx: {
1712
- fontFamily: h,
1713
- fontSize: "0.75em",
1714
- color: i,
1715
- fontWeight: 600
1716
- },
1717
- children: s("eitherOr.standings.totalUsers", "{{count}} users", {
1718
- count: D ?? 0
1719
- })
1720
- }
1721
- )
1722
- ] }) : /* @__PURE__ */ t(
1723
- C,
1724
- {
1725
- sx: {
1726
- fontFamily: h,
1727
- fontSize: "0.75em",
1728
- color: i,
1729
- opacity: 0.4,
1730
- fontStyle: "italic"
1731
- },
1732
- children: s("eitherOr.standings.noScoreHint", "Play and score points to see where you rank on this chart")
1733
- }
1734
- )
1735
- }
1736
- ),
1737
- /* @__PURE__ */ t(
1738
- r,
1739
- {
1740
- sx: {
1741
- display: "flex",
1742
- alignItems: "flex-end",
1743
- gap: "3px",
1744
- height: `${$n}px`,
1745
- width: "100%"
1746
- },
1747
- children: I.map((R, k) => {
1748
- const G = k === P, M = x === k, H = Math.log(R.totalUsers + 1) / d * 100, a = G || M ? l : `rgba(${p}, 0.5)`;
1749
- return /* @__PURE__ */ t(
1750
- r,
1751
- {
1752
- sx: {
1753
- flex: 1,
1754
- height: "100%",
1755
- display: "flex",
1756
- alignItems: "flex-end",
1757
- cursor: "pointer"
1758
- },
1759
- onMouseEnter: () => A(k),
1760
- onMouseLeave: () => A(null),
1761
- onTouchStart: (Y) => {
1762
- Y.preventDefault(), A(k);
1763
- },
1764
- onTouchEnd: () => setTimeout(() => A(null), 2e3),
1765
- children: /* @__PURE__ */ t(
1766
- r,
1767
- {
1768
- sx: {
1769
- width: "100%",
1770
- height: E ? `${H}%` : "0%",
1771
- borderRadius: "3px 3px 1px 1px",
1772
- backgroundColor: a,
1773
- boxShadow: G || M ? `0 0 10px rgba(${p}, 0.4), 0 0 3px rgba(${p}, 0.2)` : "none",
1774
- transition: [
1775
- `height 480ms cubic-bezier(0.34, 1.56, 0.64, 1) ${k * 18}ms`,
1776
- "background-color 150ms ease",
1777
- "box-shadow 150ms ease"
1778
- ].join(", "),
1779
- position: "relative",
1780
- overflow: "hidden",
1781
- "&::after": G ? {
1782
- content: '""',
1783
- position: "absolute",
1784
- top: 0,
1785
- left: 0,
1786
- right: 0,
1787
- height: "45%",
1788
- background: "linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 100%)"
1789
- } : {}
1790
- }
1791
- }
1792
- )
1793
- },
1794
- k
1795
- );
1796
- })
1797
- }
1798
- ),
1799
- /* @__PURE__ */ t(r, { sx: { height: "1px", backgroundColor: b, mt: "1px" } }),
1800
- /* @__PURE__ */ t(r, { sx: { position: "relative", height: "18px", mt: "4px" }, children: I.map((R, k) => {
1801
- if (!$.has(k)) return null;
1802
- const G = I.length > 1 ? k / (I.length - 1) * 100 : 0, M = k === 0, H = k === I.length - 1;
1803
- return /* @__PURE__ */ t(
1804
- C,
1805
- {
1806
- sx: {
1807
- position: "absolute",
1808
- left: `${G}%`,
1809
- transform: M ? "none" : H ? "translateX(-100%)" : "translateX(-50%)",
1810
- fontSize: "0.6em",
1811
- fontFamily: h,
1812
- color: i,
1813
- opacity: 0.4,
1814
- lineHeight: 1,
1815
- userSelect: "none"
1816
- },
1817
- children: o(R.rangeStartInclusive)
1818
- },
1819
- k
1820
- );
1821
- }) })
1822
- ]
1823
- }
1824
- );
1825
- }, Ze = 10, Yt = ({
1826
- game: e,
1827
- sdk: n,
1828
- stepInfo: l,
1829
- brandingPrimaryColor: i
1830
- }) => {
1831
- var Y;
1832
- const { t: s } = ee(), f = Ne(), o = K(), m = ((Y = e == null ? void 0 : e.branding) == null ? void 0 : Y.colors) || null, c = i || (m == null ? void 0 : m.primaryColor) || o.palette.primary.plainColor, u = (m == null ? void 0 : m.contentColor) || o.textColor, h = Te().primary, b = Te().secondary, p = pe(), x = Pe(), A = He(), E = o.surfaceVariant, w = f.colorSchemes.light.palette.primary.onPrimary, I = o.outlineEnabledBorder, [y, d] = z(null), [L, S] = z(!0), [P, B] = z(0), [v, D] = z(null), [O, V] = z("leaderboard"), $ = Lt(), R = (l == null ? void 0 : l.currentPoints) ?? 0;
1833
- he(() => {
1834
- (async () => {
1835
- try {
1836
- if (!e) return;
1837
- const [N, J] = await Promise.all([
1838
- n.miniGames.getEitherOrResults(e.id, $),
1839
- n.profile.getOwn().getInfo().catch(() => null)
1840
- ]), X = (J == null ? void 0 : J.id) ?? null;
1841
- if (D(X), X && N.standings.some(
1842
- (te) => te.userId === X
1843
- )) {
1844
- d(N);
1845
- return;
1846
- }
1847
- if (R > 0) {
1848
- const Z = [...N.standings], te = {
1849
- userId: "current",
1850
- userModel: {
1851
- id: "current",
1852
- name: s("common.labels.me", "Me"),
1853
- nickname: null,
1854
- avatar: null,
1855
- anonymous: !0,
1856
- gender: null,
1857
- country: null,
1858
- birthDate: null,
1859
- verified: !1,
1860
- staffMember: !1,
1861
- disabled: !1,
1862
- interests: [],
1863
- followingCount: 0,
1864
- followersCount: 0
1865
- },
1866
- personalBest: R.toString()
1867
- }, ae = Z.findIndex(
1868
- (ne) => Number.parseInt(ne.personalBest) < R
1869
- );
1870
- ae >= 0 && ae < 50 && (Z.splice(ae, 0, te), N.standings = Z);
1871
- }
1872
- d(N);
1873
- } catch {
1874
- } finally {
1875
- S(!1);
1876
- }
1877
- })();
1878
- }, [e, n, l, $]);
1879
- const k = {
1880
- tableContainer: {
1881
- overflowX: "auto",
1882
- borderRadius: p.md,
1883
- border: `1px solid ${I}`
1884
- },
1885
- table: {
1886
- backgroundColor: E,
1887
- "--TableCell-paddingX": "0.5em",
1888
- "--TableCell-paddingY": "0.375em",
1889
- cursor: "default",
1890
- "& > tbody > tr:hover": { backgroundColor: "transparent" },
1891
- "& > thead > tr > th": {
1892
- backgroundColor: `rgba(${le(E)}, 0.8)`,
1893
- color: u,
1894
- fontFamily: h,
1895
- fontWeight: 600,
1896
- fontSize: "0.875em",
1897
- textAlign: "center",
1898
- borderBottom: `1px solid ${I}`
1899
- }
1900
- },
1901
- headerCellPosition: {
1902
- backgroundColor: `rgba(${le(E)}, 0.8)`,
1903
- color: u,
1904
- fontFamily: h,
1905
- fontWeight: 600,
1906
- fontSize: "0.875em",
1907
- textAlign: "center",
1908
- padding: "0.375rem 0.5em",
1909
- width: "10%"
1910
- },
1911
- headerCellName: {
1912
- backgroundColor: `rgba(${le(E)}, 0.8)`,
1913
- color: u,
1914
- fontFamily: h,
1915
- fontWeight: 600,
1916
- fontSize: "0.875em",
1917
- textAlign: "left",
1918
- padding: "0.375rem 0.5em",
1919
- width: "80%"
1920
- },
1921
- headerCellPoints: {
1922
- backgroundColor: `rgba(${le(E)}, 0.8)`,
1923
- color: u,
1924
- fontFamily: h,
1925
- fontWeight: 600,
1926
- fontSize: "0.875em",
1927
- textAlign: "center",
1928
- padding: "0.375rem 0.5em",
1929
- width: "10%"
1930
- },
1931
- tableCellPosition: {
1932
- padding: "0.375rem 0.5em",
1933
- width: "10%",
1934
- textAlign: "center"
1935
- },
1936
- tableCellName: { padding: "0.375rem 0.5em", width: "80%" },
1937
- tableCellPoints: {
1938
- padding: "0.375rem 0.5em",
1939
- width: "10%",
1940
- textAlign: "center"
1941
- },
1942
- userRow: {
1943
- backgroundColor: `rgba(${le(c)}, 0.1)`
1944
- },
1945
- nameCell: {
1946
- display: "flex",
1947
- alignItems: "center",
1948
- gap: x.sm
1949
- },
1950
- leaderboardAvatar: {
1951
- width: "32px",
1952
- height: "32px",
1953
- fontSize: "0.875em",
1954
- fontWeight: 600,
1955
- backgroundColor: c,
1956
- color: w
1957
- },
1958
- nameText: {
1959
- fontFamily: h,
1960
- fontWeight: 500,
1961
- fontSize: "0.875em",
1962
- color: u,
1963
- overflow: "hidden",
1964
- textOverflow: "ellipsis",
1965
- whiteSpace: "nowrap"
1966
- },
1967
- positionText: {
1968
- fontFamily: h,
1969
- fontWeight: 600,
1970
- fontSize: "0.875em",
1971
- color: u
1972
- },
1973
- pointsText: {
1974
- fontFamily: h,
1975
- fontWeight: 600,
1976
- fontSize: "0.875em",
1977
- color: u
1978
- },
1979
- avatarIcon: { fontSize: "1em", color: w },
1980
- noLeaderboardText: {
1981
- fontFamily: b,
1982
- fontSize: "1.25em",
1983
- color: u,
1984
- textAlign: "center",
1985
- marginY: x.md
1986
- }
1987
- };
1988
- if (L)
1989
- return /* @__PURE__ */ t(ot, { my: 10 });
1990
- if (!(y != null && y.standings) || y.standings.length === 0)
1991
- return /* @__PURE__ */ t(
1992
- r,
1993
- {
1994
- sx: {
1995
- display: "flex",
1996
- alignItems: "center",
1997
- justifyContent: "center",
1998
- height: "100%",
1999
- flex: 1
2000
- },
2001
- children: /* @__PURE__ */ t(C, { level: "body-lg", sx: k.noLeaderboardText, children: s("common.labels.noData", "No standings available yet.") })
2002
- }
2003
- );
2004
- const G = y.standings, M = Math.ceil(G.length / Ze), H = G.slice(
2005
- P * Ze,
2006
- (P + 1) * Ze
2007
- ), a = [
2008
- {
2009
- id: "leaderboard",
2010
- label: s("eitherOr.standings.leaderboard", "Leaderboard")
2011
- },
2012
- {
2013
- id: "distribution",
2014
- label: s("eitherOr.standings.distribution", "Distribution")
2015
- }
2016
- ];
2017
- return /* @__PURE__ */ g(
2018
- r,
2019
- {
2020
- sx: {
2021
- display: "flex",
2022
- flexDirection: "column",
2023
- gap: x.sm,
2024
- p: x.md
2025
- },
2026
- children: [
2027
- /* @__PURE__ */ t(
2028
- r,
2029
- {
2030
- sx: {
2031
- display: "flex",
2032
- borderRadius: p["2xl"],
2033
- p: "3px",
2034
- gap: x.xs
2035
- },
2036
- children: a.map((T) => {
2037
- const N = O === T.id;
2038
- return /* @__PURE__ */ t(
2039
- r,
2040
- {
2041
- onClick: () => V(T.id),
2042
- sx: {
2043
- flex: 1,
2044
- display: "flex",
2045
- alignItems: "center",
2046
- justifyContent: "center",
2047
- p: x.xs,
2048
- borderRadius: `calc(${p["2xl"]} - 3px)`,
2049
- backgroundColor: N ? c : E,
2050
- cursor: "pointer",
2051
- transition: "background-color 220ms ease",
2052
- userSelect: "none",
2053
- WebkitTapHighlightColor: "transparent"
2054
- },
2055
- children: /* @__PURE__ */ t(
2056
- C,
2057
- {
2058
- sx: {
2059
- fontFamily: h,
2060
- fontWeight: N ? 700 : 500,
2061
- fontSize: "0.8em",
2062
- color: N ? w : u,
2063
- opacity: N ? 1 : 0.45,
2064
- transition: "color 220ms ease, opacity 220ms ease",
2065
- lineHeight: 1
2066
- },
2067
- children: T.label
2068
- }
2069
- )
2070
- },
2071
- T.id
2072
- );
2073
- })
2074
- }
2075
- ),
2076
- O === "leaderboard" && /* @__PURE__ */ g(Qe, { children: [
2077
- /* @__PURE__ */ t(
2078
- C,
2079
- {
2080
- sx: {
2081
- fontFamily: h,
2082
- fontWeight: 700,
2083
- fontSize: "1.5em",
2084
- color: u,
2085
- textAlign: "center"
2086
- },
2087
- children: s("eitherOr.leaderboard.top50Note", "Top 50")
2088
- }
2089
- ),
2090
- /* @__PURE__ */ t(bn, { sx: k.tableContainer, children: /* @__PURE__ */ g(
2091
- yn,
2092
- {
2093
- variant: "outlined",
2094
- hoverRow: !1,
2095
- borderAxis: "bothBetween",
2096
- size: "sm",
2097
- sx: k.table,
2098
- children: [
2099
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ g("tr", { children: [
2100
- /* @__PURE__ */ t("th", { style: k.headerCellPosition, children: A ? "" : s("eitherOr.leaderboard.position", "#") }),
2101
- /* @__PURE__ */ t("th", { style: k.headerCellName, children: s("eitherOr.leaderboard.name", "Name") }),
2102
- /* @__PURE__ */ t("th", { style: k.headerCellPoints, children: A ? "🎯" : s("eitherOr.leaderboard.points", "Pts") })
2103
- ] }) }),
2104
- /* @__PURE__ */ t("tbody", { children: H.map((T, N) => {
2105
- var ae, ne, Q;
2106
- const J = P * Ze + N, X = T.userId === "current" || v !== null && T.userId === v, Z = ((ae = T.userModel) == null ? void 0 : ae.avatar) || void 0, te = ((ne = T.userModel) == null ? void 0 : ne.nickname) || ((Q = T.userModel) == null ? void 0 : Q.name) || s("common.labels.anonymous", "Anonymous");
2107
- return /* @__PURE__ */ g(
2108
- "tr",
2109
- {
2110
- style: X ? k.userRow : void 0,
2111
- children: [
2112
- /* @__PURE__ */ t("td", { style: k.tableCellPosition, children: /* @__PURE__ */ g(C, { sx: k.positionText, children: [
2113
- "#",
2114
- J + 1
2115
- ] }) }),
2116
- /* @__PURE__ */ t("td", { style: k.tableCellName, children: /* @__PURE__ */ g(r, { sx: k.nameCell, children: [
2117
- /* @__PURE__ */ t(pn, { src: Z, sx: k.leaderboardAvatar, children: !Z && /* @__PURE__ */ t(An, { sx: k.avatarIcon }) }),
2118
- /* @__PURE__ */ t(
2119
- C,
2120
- {
2121
- sx: {
2122
- ...k.nameText,
2123
- fontWeight: X ? 700 : 500,
2124
- color: X ? c : u
2125
- },
2126
- children: X ? s("common.labels.me", "Me") : te
2127
- }
2128
- )
2129
- ] }) }),
2130
- /* @__PURE__ */ t("td", { style: k.tableCellPoints, children: /* @__PURE__ */ t(C, { sx: k.pointsText, children: T.personalBest }) })
2131
- ]
2132
- },
2133
- `${T.userId}-${J}`
2134
- );
2135
- }) })
2136
- ]
2137
- }
2138
- ) }),
2139
- M > 1 && /* @__PURE__ */ g(
2140
- r,
2141
- {
2142
- sx: {
2143
- display: "flex",
2144
- justifyContent: "center",
2145
- alignItems: "center",
2146
- gap: x.sm
2147
- },
2148
- children: [
2149
- /* @__PURE__ */ t(
2150
- r,
2151
- {
2152
- onClick: () => P > 0 && B((T) => T - 1),
2153
- sx: {
2154
- cursor: P > 0 ? "pointer" : "default",
2155
- opacity: P > 0 ? 1 : 0.3,
2156
- fontFamily: h,
2157
- fontSize: "1.25em",
2158
- fontWeight: 600,
2159
- color: c,
2160
- px: "12px",
2161
- py: "6px",
2162
- borderRadius: "4px",
2163
- userSelect: "none"
2164
- },
2165
- children: "‹"
2166
- }
2167
- ),
2168
- /* @__PURE__ */ g(
2169
- C,
2170
- {
2171
- sx: {
2172
- fontFamily: h,
2173
- fontSize: "0.75em",
2174
- color: u,
2175
- opacity: 0.7
2176
- },
2177
- children: [
2178
- P + 1,
2179
- " / ",
2180
- M
2181
- ]
2182
- }
2183
- ),
2184
- /* @__PURE__ */ t(
2185
- r,
2186
- {
2187
- onClick: () => P < M - 1 && B((T) => T + 1),
2188
- sx: {
2189
- cursor: P < M - 1 ? "pointer" : "default",
2190
- opacity: P < M - 1 ? 1 : 0.3,
2191
- fontFamily: h,
2192
- fontSize: "1.25em",
2193
- fontWeight: 600,
2194
- color: c,
2195
- px: "12px",
2196
- py: "6px",
2197
- borderRadius: "4px",
2198
- userSelect: "none"
2199
- },
2200
- children: "›"
2201
- }
2202
- )
2203
- ]
2204
- }
2205
- )
2206
- ] }),
2207
- O === "distribution" && /* @__PURE__ */ t(
2208
- Fn,
2209
- {
2210
- breakdown: y.breakdown,
2211
- currentPoints: R > 0 ? R : void 0,
2212
- primaryColor: c,
2213
- textColor: u
2214
- }
2215
- )
2216
- ]
2217
- }
2218
- );
2219
- }, ke = ({
2220
- children: e,
2221
- brandingBorderColor: n
2222
- }) => {
2223
- const l = pe().md, i = n || K().secondaryContainer, s = K().surface, f = Qt().size, o = Se(), m = f + " solid " + i;
2224
- return /* @__PURE__ */ t(
2225
- r,
2226
- {
2227
- sx: {
2228
- display: "flex",
2229
- flexDirection: o ? "column" : "row",
2230
- width: "100%",
2231
- borderRadius: l,
2232
- boxShadow: "md",
2233
- border: m,
2234
- overflow: "hidden",
2235
- background: s,
2236
- minHeight: "320px"
2237
- },
2238
- children: e
2239
- }
2240
- );
2241
- }, En = (e) => {
2242
- var Y, T;
2243
- const {
2244
- eitherOr: n,
2245
- currentPair: l,
2246
- stepInfo: i,
2247
- gameState: s,
2248
- timer: f,
2249
- selected: o,
2250
- feedback: m,
2251
- sdk: c,
2252
- defaultImagePlaceholderUrl: u,
2253
- rulesDisplay: h,
2254
- showStandings: b,
2255
- additionalCTA: p,
2256
- onGameStart: x,
2257
- onSelection: A,
2258
- onPlayAgain: E,
2259
- imagePosition: w = "left"
2260
- } = e, { t: I } = ee(), y = K(), d = ((Y = n == null ? void 0 : n.branding) == null ? void 0 : Y.colors) || null, L = (d == null ? void 0 : d.primaryColor) || y.palette.primary.plainColor, S = y.secondaryContainer, P = y.surfaceTintDim, B = ((T = le(P || "")) == null ? void 0 : T.replace(/[^\d,]/g, "")) ?? null, v = pe().md, D = Te().primary, O = Pe(), V = Se(), [$, R] = z(0), k = it(
2261
- {
2262
- images: n == null ? void 0 : n.images,
2263
- imagePlaceholder: u || ""
2264
- },
2265
- ve.STANDARD
2266
- ), G = () => {
2267
- switch (s) {
2268
- case q.LOADING:
2269
- return /* @__PURE__ */ t(ot, { my: 20 });
2270
- case q.TUTORIAL:
2271
- return /* @__PURE__ */ t(
2272
- On,
2273
- {
2274
- onStart: x,
2275
- game: n,
2276
- showSignInCTA: !1,
2277
- consents: e.consents,
2278
- isSubmitting: e.isSubmitting
2279
- }
2280
- );
2281
- case q.PLAYING:
2282
- return /* @__PURE__ */ t(
2283
- Bn,
2284
- {
2285
- currentPair: l,
2286
- timer: f,
2287
- maxTime: (n == null ? void 0 : n.time) ?? 10,
2288
- selected: o,
2289
- feedback: m,
2290
- onSelect: A,
2291
- stepInfo: i,
2292
- brandingPrimaryColor: (d == null ? void 0 : d.primaryColor) || null,
2293
- game: n
2294
- }
2295
- );
2296
- case q.RESULTS:
2297
- return /* @__PURE__ */ t(
2298
- st,
2299
- {
2300
- stepInfo: i,
2301
- game: n,
2302
- sdk: c,
2303
- onPlayAgain: E,
2304
- brandingPrimaryColor: (d == null ? void 0 : d.primaryColor) || null,
2305
- additionalCTA: p
2306
- }
2307
- );
2308
- default:
2309
- return null;
2310
- }
2311
- }, M = s === q.RESULTS, H = {
2312
- display: "flex",
2313
- flexDirection: "row",
2314
- justifyContent: "center",
2315
- alignItems: "center",
2316
- flex: V ? "0 0 auto" : 1,
2317
- width: V ? "100%" : "auto",
2318
- borderBottom: "1px solid " + S,
2319
- opacity: "60%",
2320
- py: O.sm,
2321
- px: O.md,
2322
- gap: O.xs,
2323
- "&:not(.Mui-selected):hover": {
2324
- bgcolor: B ? `rgba(${B},0.06)` : `${P}0F`
2325
- },
2326
- [`&.${Ut.selected}`]: {
2327
- bgcolor: B ? `rgba(${B},0.06)` : `${P}0F`,
2328
- borderBottom: "3px solid " + L,
2329
- opacity: "100%",
2330
- mb: "-1px"
2331
- }
2332
- }, a = {
2333
- flex: 1,
2334
- display: "flex",
2335
- flexDirection: "column",
2336
- overflow: "auto"
2337
- };
2338
- return M && b ? /* @__PURE__ */ t(ke, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ g(
2339
- Wt,
2340
- {
2341
- value: $,
2342
- onChange: (N, J) => R(J),
2343
- sx: {
2344
- borderRadius: v,
2345
- width: "100%",
2346
- backgroundColor: "transparent"
2347
- },
2348
- children: [
2349
- /* @__PURE__ */ g(
2350
- Mt,
2351
- {
2352
- sx: {
2353
- fontSize: "1em",
2354
- "--Icon-fontSize": "1.25em",
2355
- flexDirection: V ? "column" : "row"
2356
- },
2357
- children: [
2358
- /* @__PURE__ */ t(et, { sx: H, disableIndicator: !0, children: /* @__PURE__ */ g(
2359
- r,
2360
- {
2361
- sx: {
2362
- display: "flex",
2363
- alignItems: "center",
2364
- gap: O.xs
2365
- },
2366
- children: [
2367
- /* @__PURE__ */ t(Ge, { sx: { fontSize: "1.25em" } }),
2368
- /* @__PURE__ */ t(
2369
- C,
2370
- {
2371
- sx: {
2372
- fontFamily: D,
2373
- fontSize: "1em",
2374
- fontWeight: 500,
2375
- lineHeight: "24px",
2376
- letterSpacing: "0.4px",
2377
- textTransform: "uppercase"
2378
- },
2379
- children: I("eitherOr.tabs.score", "Score")
2380
- }
2381
- )
2382
- ]
2383
- }
2384
- ) }),
2385
- /* @__PURE__ */ t(et, { sx: H, disableIndicator: !0, children: /* @__PURE__ */ g(
2386
- r,
2387
- {
2388
- sx: {
2389
- display: "flex",
2390
- alignItems: "center",
2391
- gap: O.xs
2392
- },
2393
- children: [
2394
- /* @__PURE__ */ t(Ht, { sx: { fontSize: "1.25em" } }),
2395
- /* @__PURE__ */ t(
2396
- C,
2397
- {
2398
- sx: {
2399
- fontFamily: D,
2400
- fontSize: "1em",
2401
- fontWeight: 500,
2402
- lineHeight: "24px",
2403
- letterSpacing: "0.4px",
2404
- textTransform: "uppercase"
2405
- },
2406
- children: I("eitherOr.tabs.standings", "Standings")
2407
- }
2408
- )
2409
- ]
2410
- }
2411
- ) })
2412
- ]
2413
- }
2414
- ),
2415
- $ === 0 && /* @__PURE__ */ t(tt, { value: 0, sx: { p: 0, fontSize: "1em", display: "flex" }, children: /* @__PURE__ */ t(r, { sx: a, children: G() }) }),
2416
- $ === 1 && /* @__PURE__ */ t(tt, { value: 1, sx: { p: 0, fontSize: "1em", display: "flex" }, children: /* @__PURE__ */ t(r, { sx: a, children: /* @__PURE__ */ t(
2417
- Yt,
2418
- {
2419
- game: n,
2420
- sdk: c,
2421
- stepInfo: i,
2422
- brandingPrimaryColor: (d == null ? void 0 : d.primaryColor) || null
2423
- }
2424
- ) }) })
2425
- ]
2426
- }
2427
- ) }) : M ? /* @__PURE__ */ t(ke, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ t(r, { sx: a, children: G() }) }) : /* @__PURE__ */ t(ke, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ t(
2428
- en,
2429
- {
2430
- entity: n,
2431
- headline: I("eitherOr.headline", "Either/Or"),
2432
- finalImage: k,
2433
- imagePosition: w,
2434
- rulesDisplay: h,
2435
- children: G()
2436
- }
2437
- ) });
2438
- }, Un = () => {
2439
- const { t: e } = ee();
2440
- return /* @__PURE__ */ t(ke, { brandingBorderColor: null, children: /* @__PURE__ */ t(
2441
- tn,
2442
- {
2443
- notFoundTitle: e("eitherOr.eitherOrNotFound"),
2444
- notFoundMessage: e("eitherOr.eitherOrNotFoundDescription")
2445
- }
2446
- ) });
2447
- }, Wn = (e) => ({
2448
- // Pulse animation for buttons
2449
- pulseAnimation: {
2450
- "@keyframes pulse": {
2451
- "0%": { transform: "scale(1)" },
2452
- "50%": { transform: "scale(1.05)" },
2453
- "100%": { transform: "scale(1)" }
2454
- }
2455
- },
2456
- // Sign in button
2457
- signInButton: {
2458
- borderRadius: e.buttonRadius,
2459
- py: "10px",
2460
- px: "16px",
2461
- bgcolor: e.primaryColor,
2462
- color: e.onPrimaryColor,
2463
- transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
2464
- transform: "scale(1)",
2465
- alignSelf: "center",
2466
- "&:hover": {
2467
- bgcolor: e.primaryColor,
2468
- transform: "scale(1.02)"
2469
- },
2470
- "&:active": {
2471
- color: e.onPrimaryColor,
2472
- transform: "scale(0.98)"
2473
- },
2474
- "&:disabled": {
2475
- bgcolor: e.primaryColor,
2476
- color: e.onPrimaryColor,
2477
- opacity: "12%"
2478
- },
2479
- animation: "pulse 1s infinite",
2480
- fontSize: "0.9375em"
2481
- },
2482
- // Sign in button text
2483
- signInButtonText: {
2484
- fontFamily: e.fontFamilyPrimary,
2485
- fontWeight: 500,
2486
- fontSize: "0.9375em",
2487
- lineHeight: "24px",
2488
- letterSpacing: "0.46px",
2489
- textTransform: "uppercase",
2490
- color: e.onPrimaryColor,
2491
- gap: "8px",
2492
- display: "flex",
2493
- alignItems: "center"
2494
- }
2495
- }), Mn = (e) => {
2496
- var E, w, I, y, d;
2497
- const n = ((E = e.eitherOr.branding) == null ? void 0 : E.colors) || null, l = Se(), i = Ne(), s = it(
2498
- {
2499
- images: e.eitherOr.images,
2500
- imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
2501
- },
2502
- ve.STANDARD
2503
- ), f = Te().primary, o = pe().xl, m = (n == null ? void 0 : n.primaryColor) || K().palette.primary.plainColor, c = K().palette.primary.onPrimary, u = (n == null ? void 0 : n.contentColor) || K().textColor, h = l ? ((w = e.eitherOr.branding) == null ? void 0 : w.images.mobileLogo) || ((I = e.eitherOr.branding) == null ? void 0 : I.images.mainLogo) || "" : ((y = e.eitherOr.branding) == null ? void 0 : y.images.mainLogo) || "", { t: b } = ee(), p = e.imagePosition || "left", x = Wn({
2504
- fontFamilyPrimary: f,
2505
- buttonRadius: o,
2506
- primaryColor: m,
2507
- onPrimaryColor: c
2508
- }), A = () => {
2509
- var L, S, P, B;
2510
- return e.signInCTA ? (L = e.signInCTA) != null && L.component ? e.signInCTA.component : (S = e.signInCTA) != null && S.onClick ? /* @__PURE__ */ t(
2511
- ye,
2512
- {
2513
- variant: "soft",
2514
- sx: {
2515
- ...x.signInButton,
2516
- ...x.pulseAnimation
2517
- },
2518
- onClick: e.signInCTA.onClick,
2519
- children: /* @__PURE__ */ t(C, { sx: x.signInButtonText, children: e.signInCTA.defaultLabel || b("common.signIn") })
2520
- }
2521
- ) : (P = e.signInCTA) != null && P.url ? typeof window > "u" ? /* @__PURE__ */ t(
2522
- r,
2523
- {
2524
- component: "a",
2525
- href: e.signInCTA.url,
2526
- target: ((B = e.signInCTA) == null ? void 0 : B.target) || "_self",
2527
- sx: {
2528
- ...x.signInButton,
2529
- ...x.pulseAnimation,
2530
- textDecoration: "none",
2531
- display: "inline-flex",
2532
- alignItems: "center",
2533
- justifyContent: "center"
2534
- },
2535
- children: /* @__PURE__ */ t(C, { sx: x.signInButtonText, children: e.signInCTA.defaultLabel || b("common.signIn") })
2536
- }
2537
- ) : /* @__PURE__ */ t(
2538
- ye,
2539
- {
2540
- variant: "soft",
2541
- sx: {
2542
- ...x.signInButton,
2543
- ...x.pulseAnimation
2544
- },
2545
- onClick: () => {
2546
- var v, D, O;
2547
- ((v = e.signInCTA) == null ? void 0 : v.target) === "_blank" ? window.open((D = e.signInCTA) == null ? void 0 : D.url, "_blank") : window.location.href = (O = e.signInCTA) == null ? void 0 : O.url;
2548
- },
2549
- children: /* @__PURE__ */ t(C, { sx: x.signInButtonText, children: e.signInCTA.defaultLabel || b("common.signIn") })
2550
- }
2551
- ) : /* @__PURE__ */ t(
2552
- ye,
2553
- {
2554
- variant: "soft",
2555
- sx: {
2556
- ...x.signInButton
2557
- },
2558
- disabled: !0,
2559
- children: /* @__PURE__ */ t(C, { sx: x.signInButtonText, children: e.signInCTA.defaultLabel || b("common.signIn") })
2560
- }
2561
- ) : /* @__PURE__ */ t(
2562
- ye,
2563
- {
2564
- variant: "soft",
2565
- sx: {
2566
- ...x.signInButton
2567
- },
2568
- disabled: !0,
2569
- children: /* @__PURE__ */ t(C, { sx: x.signInButtonText, children: b("common.signIn") })
2570
- }
2571
- );
2572
- };
2573
- return /* @__PURE__ */ t(ke, { brandingBorderColor: (n == null ? void 0 : n.borderColor) || null, children: /* @__PURE__ */ t(
2574
- nn,
2575
- {
2576
- entity: e.eitherOr,
2577
- headline: b("eitherOr.headline"),
2578
- finalImage: s,
2579
- imagePosition: p,
2580
- signInContent: A(),
2581
- brandingContent: /* @__PURE__ */ t(
2582
- me,
2583
- {
2584
- brandingLogo: h,
2585
- textColor: l && s ? (n == null ? void 0 : n.contentColor) || i.colorSchemes.dark.textColor : u,
2586
- label: ((d = e.eitherOr.labels) == null ? void 0 : d.sponsor) || null
2587
- }
2588
- ),
2589
- rulesDisplay: e.rulesDisplay
2590
- }
2591
- ) });
2592
- }, jn = ({
2593
- eitherOr: e,
2594
- imagePosition: n,
2595
- defaultImagePlaceholderUrl: l,
2596
- rulesDisplay: i
2597
- }) => {
2598
- var u;
2599
- const { t: s } = ee(), f = ((u = e.branding) == null ? void 0 : u.colors) || null, { brandingLogo: o } = lt(
2600
- e.branding || null
2601
- ), m = (h) => {
2602
- var b;
2603
- return /* @__PURE__ */ t(
2604
- me,
2605
- {
2606
- brandingLogo: o,
2607
- textColor: h,
2608
- label: ((b = e.labels) == null ? void 0 : b.sponsor) || null
2609
- }
2610
- );
2611
- }, c = {
2612
- entity: e,
2613
- headline: s("eitherOr.headline"),
2614
- tryAgainButtonText: "",
2615
- isApiError: !1,
2616
- alertVariant: "neutral",
2617
- customAlertTitle: s("eitherOr.gameNotAvailable"),
2618
- customAlertMessage: s("eitherOr.gameNotAvailableDescription"),
2619
- renderPresentedBy: m
2620
- };
2621
- return /* @__PURE__ */ t(ke, { brandingBorderColor: (f == null ? void 0 : f.borderColor) || null, children: /* @__PURE__ */ t(
2622
- zt,
2623
- {
2624
- ...c,
2625
- imagePosition: n || "left",
2626
- defaultImagePlaceholderUrl: l,
2627
- rulesDisplay: i
2628
- }
2629
- ) });
2630
- }, Gn = (e) => {
2631
- var f, o, m, c, u, h, b;
2632
- const { t: n } = ee(), l = ((f = e.eitherOr.branding) == null ? void 0 : f.colors) || null, i = Se() ? ((m = (o = e.eitherOr.branding) == null ? void 0 : o.images) == null ? void 0 : m.mobileLogo) || ((u = (c = e.eitherOr.branding) == null ? void 0 : c.images) == null ? void 0 : u.mainLogo) || "" : ((b = (h = e.eitherOr.branding) == null ? void 0 : h.images) == null ? void 0 : b.mainLogo) || "", s = {
2633
- ...e.eitherOr,
2634
- branding: e.eitherOr.branding ? {
2635
- ...e.eitherOr.branding,
2636
- colors: e.eitherOr.branding.colors ? { ...e.eitherOr.branding.colors, secondaryColor: void 0 } : null
2637
- } : null
2638
- };
2639
- return /* @__PURE__ */ t(ke, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: /* @__PURE__ */ t(
2640
- zt,
2641
- {
2642
- entity: s,
2643
- headline: n("eitherOr.headline"),
2644
- tryAgainButtonText: n("eitherOr.buttons.tryAgain"),
2645
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2646
- imagePosition: e.imagePosition || "left",
2647
- isApiError: e.isApiError,
2648
- toggleTryAgain: e.toggleTryAgain,
2649
- apiErrorMessage: e.apiErrorMessage,
2650
- renderPresentedBy: (p) => {
2651
- var x;
2652
- return /* @__PURE__ */ t(
2653
- me,
2654
- {
2655
- brandingLogo: i,
2656
- textColor: p,
2657
- label: ((x = e.eitherOr.labels) == null ? void 0 : x.sponsor) || null
2658
- }
2659
- );
2660
- },
2661
- rulesDisplay: e.rulesDisplay
2662
- }
2663
- ) });
2664
- }, _t = ({
2665
- sdk: e,
2666
- contentId: n,
2667
- contentName: l,
2668
- brandingColors: i,
2669
- brandingUrls: s,
2670
- campaignId: f,
2671
- campaignName: o,
2672
- startGame: m,
2673
- fields: c = ["fullName", "email"],
2674
- leadTitle: u,
2675
- leadDescription: h,
2676
- leadCta: b,
2677
- leadSuccessTitle: p,
2678
- leadSuccessDescription: x,
2679
- syncWithProfile: A = !1,
2680
- consents: E,
2681
- isAfterPosition: w = !1,
2682
- isSubmittingParticipation: I = !1
2683
- }) => {
2684
- const { t: y } = ee(), d = u ?? y("leads.header.title"), L = h ?? y("leads.header.description"), S = b ?? y("leads.buttons.submit"), P = p ?? y("leads.success.title"), B = x ?? y("leads.success.description"), v = {
2685
- defaultLabel: y(w ? "eitherOr.buttons.finish" : "eitherOr.buttons.start"),
2686
- onClick: m
2687
- };
2688
- return /* @__PURE__ */ t(
2689
- rn,
2690
- {
2691
- sdk: e,
2692
- content: {
2693
- id: n,
2694
- type: "either-or",
2695
- name: l
2696
- },
2697
- onSuccessCta: v,
2698
- branding: {
2699
- colors: i,
2700
- urls: s
2701
- },
2702
- campaign: {
2703
- id: f,
2704
- name: o
2705
- },
2706
- fields: c,
2707
- labels: {
2708
- title: d,
2709
- description: L,
2710
- submitButtonLabel: S,
2711
- successTitle: P,
2712
- successDescription: B
2713
- },
2714
- syncWithProfile: A,
2715
- consents: E,
2716
- isSubmittingParticipation: I
2717
- }
2718
- );
2719
- }, Hn = (e) => {
2720
- const { t: n } = ee();
2721
- return /* @__PURE__ */ t(
2722
- Bt,
2723
- {
2724
- entity: e.eitherOr,
2725
- headline: n("eitherOr.headline"),
2726
- sdk: e.sdk,
2727
- leads: e.leads,
2728
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2729
- imagePosition: e.imagePosition,
2730
- onLeadSubmitted: e.onLeadSubmitted,
2731
- isSubmitting: e.isSubmitting,
2732
- MainCard: ke,
2733
- PresentedBy: me,
2734
- CollectLeadWrapper: _t,
2735
- consents: e.consents,
2736
- rulesDisplay: e.rulesDisplay
2737
- }
2738
- );
2739
- }, Nn = (e) => ({
2740
- // Pulse animation for buttons
2741
- pulseAnimation: {
2742
- "@keyframes pulse": {
2743
- "0%": { transform: "scale(1)" },
2744
- "50%": { transform: "scale(1.05)" },
2745
- "100%": { transform: "scale(1)" }
2746
- }
2747
- },
2748
- // Filter screen container (tutorial state)
2749
- filterScreenContainer: {
2750
- display: "flex",
2751
- alignItems: "center",
2752
- justifyContent: "space-between",
2753
- flexDirection: e.isMobile ? "column-reverse" : "row",
2754
- gap: e.spacingScale.md
2755
- },
2756
- // Start button
2757
- startButton: {
2758
- borderRadius: e.buttonRadius,
2759
- bgcolor: e.primaryColor,
2760
- color: "#FFFFFF",
2761
- py: "10px",
2762
- pr: "12px",
2763
- pl: "16px",
2764
- "&:hover": {
2765
- bgcolor: e.primaryColor
2766
- },
2767
- "&:active": {
2768
- color: e.onPrimaryColor
2769
- },
2770
- animation: "pulse 1s infinite",
2771
- fontSize: "0.9375em",
2772
- "--Icon-color": e.onPrimaryColor
2773
- },
2774
- // Start button text
2775
- startButtonText: {
2776
- fontFamily: e.fontFamilyPrimary,
2777
- fontWeight: 500,
2778
- fontSize: "0.9375em",
2779
- lineHeight: "24px",
2780
- letterSpacing: "0.46px",
2781
- textTransform: "uppercase",
2782
- color: e.onPrimaryColor,
2783
- gap: "8px",
2784
- display: "flex",
2785
- alignItems: "center"
2786
- },
2787
- // Main content section (playing state)
2788
- mainContentSection: {
2789
- display: "flex",
2790
- flexDirection: "column",
2791
- gap: e.spacingScale.lg
2792
- },
2793
- // Timer container
2794
- timerContainer: {
2795
- display: "flex",
2796
- justifyContent: "center"
2797
- },
2798
- // Content container with backdrop blur
2799
- contentContainerWithBackdrop: {
2800
- borderRadius: e.smBorderRadius,
2801
- p: e.spacingScale.md,
2802
- display: "flex",
2803
- flexDirection: "column",
2804
- gap: e.spacingScale.md,
2805
- backdropFilter: "blur(4px)",
2806
- position: "relative",
2807
- "&::before": {
2808
- content: '""',
2809
- position: "absolute",
2810
- top: 0,
2811
- left: 0,
2812
- right: 0,
2813
- bottom: 0,
2814
- backgroundColor: e.contentBgColor,
2815
- opacity: 0.5,
2816
- borderRadius: "inherit",
2817
- zIndex: 0
2818
- },
2819
- "& > *": {
2820
- position: "relative",
2821
- zIndex: 1
2822
- }
2823
- },
2824
- // Options container — row on desktop, column on mobile
2825
- optionsContainer: {
2826
- display: "flex",
2827
- flexDirection: e.isMobile ? "column" : "row",
2828
- gap: e.isMobile ? 0 : e.spacingScale.md,
2829
- alignItems: e.isMobile ? "stretch" : "center"
2830
- },
2831
- // Individual option wrapper (equal sizing in row layout)
2832
- optionWrapper: {
2833
- flex: 1,
2834
- minWidth: 0
2835
- },
2836
- // Divider container between options
2837
- dividerContainer: {
2838
- display: "flex",
2839
- justifyContent: "center",
2840
- alignItems: "center",
2841
- ...e.isMobile ? { width: "100%", my: e.spacingScale["3xs"] } : {}
2842
- },
2843
- // Bottom footer container (playing state — outside the backdrop)
2844
- bottomFooterContainer: {
2845
- display: "flex",
2846
- alignItems: "center",
2847
- justifyContent: e.isMobile ? "center" : "flex-start",
2848
- flexDirection: e.isMobile ? "column-reverse" : "row",
2849
- gap: e.spacingScale.md
2850
- }
2851
- }), Vn = (e) => {
2852
- var oe, xe, Oe, be, Fe, Ee, Ue, Xe, ft, ht, xt, bt, yt, pt, St, Ct, It, kt, Tt, Pt;
2853
- const {
2854
- eitherOr: n,
2855
- currentPair: l,
2856
- stepInfo: i,
2857
- gameState: s,
2858
- timer: f,
2859
- selected: o,
2860
- feedback: m,
2861
- sdk: c,
2862
- defaultImagePlaceholderUrl: u,
2863
- rulesDisplay: h,
2864
- showStandings: b,
2865
- additionalCTA: p,
2866
- consents: x,
2867
- isSubmitting: A,
2868
- onGameStart: E,
2869
- onSelection: w,
2870
- onPlayAgain: I
2871
- } = e, y = Ne(), d = Pe(), L = Se(), { t: S } = ee(), [P, B] = z(0), [v, D] = z(0), [O, V] = z(!1), [$, R] = z(0), [k, G] = z(0), [M, H] = z(!1), a = mt(0), { brandingImage: Y, brandingColors: T } = lt(
2872
- n.branding || null
2873
- ), N = u || (L ? dt : ut), J = it(
2874
- { images: n == null ? void 0 : n.images, imagePlaceholder: N },
2875
- ve.OVERLAY
2876
- ), X = Y || J, Z = Dt(X), te = $t(
2877
- ve.OVERLAY
2878
- ), ae = y.customRadius.dark.sm, ne = y.customRadius.dark.md, Q = (T == null ? void 0 : T.backgroundColor) || ((xe = (oe = y.colorSchemes) == null ? void 0 : oe.dark) == null ? void 0 : xe.surfaceVariant), de = (be = (Oe = y.customRadius) == null ? void 0 : Oe.light) == null ? void 0 : be.xl, _ = (T == null ? void 0 : T.primaryColor) || ((Xe = (Ue = (Ee = (Fe = y.colorSchemes) == null ? void 0 : Fe.light) == null ? void 0 : Ee.palette) == null ? void 0 : Ue.primary) == null ? void 0 : Xe.plainColor), fe = (bt = (xt = (ht = (ft = y.colorSchemes) == null ? void 0 : ft.light) == null ? void 0 : ht.palette) == null ? void 0 : xt.primary) == null ? void 0 : bt.onPrimary, U = y.customFontFamily.dark.primary, j = y.colorSchemes.dark.textColor, ue = y.colorSchemes.dark.surface, Ae = y.colorSchemes.dark.secondaryContainer, we = y.colorSchemes.dark.surfaceTintDim, Ce = ((yt = le(we || "")) == null ? void 0 : yt.replace(/[^\d,]/g, "")) ?? null, Ie = le(_ || ""), se = Nn({
2879
- spacingScale: d,
2880
- smBorderRadius: ae,
2881
- contentBgColor: Q,
2882
- buttonRadius: de,
2883
- primaryColor: _,
2884
- onPrimaryColor: fe,
2885
- fontFamilyPrimary: U,
2886
- darkTextColor: j,
2887
- isMobile: L
2888
- });
2889
- he(() => {
2890
- if (i != null && i.currentPoints && i.currentPoints > v) {
2891
- R(i.currentPoints - v), V(!0), G((ce) => ce + 1);
2892
- const ie = setTimeout(() => V(!1), 1e3);
2893
- return D(i.currentPoints), () => clearTimeout(ie);
2894
- }
2895
- }, [i == null ? void 0 : i.currentPoints, v]);
2896
- const De = (n == null ? void 0 : n.points) ?? [], Re = De.length >= 2 ? De[1].correctSteps - De[0].correctSteps : ((pt = De[0]) == null ? void 0 : pt.correctSteps) || 5;
2897
- he(() => {
2898
- const ie = a.current, ce = (i == null ? void 0 : i.currentStreak) ?? 0;
2899
- if (a.current = ce, ce > ie && ce > 0 && ce % Re === 0) {
2900
- H(!0);
2901
- const ge = setTimeout(() => H(!1), 500);
2902
- return () => clearTimeout(ge);
2903
- }
2904
- }, [i == null ? void 0 : i.currentStreak, Re]);
2905
- const Le = L ? ((Ct = (St = n.branding) == null ? void 0 : St.images) == null ? void 0 : Ct.mobileLogo) || ((kt = (It = n.branding) == null ? void 0 : It.images) == null ? void 0 : kt.mainLogo) || "" : ((Pt = (Tt = n.branding) == null ? void 0 : Tt.images) == null ? void 0 : Pt.mainLogo) || "", Ve = S("common.labels.point", { count: v }), Ye = () => {
2906
- const ie = [], ce = (i == null ? void 0 : i.currentLives) ?? 3;
2907
- for (let ge = 0; ge < ce; ge++)
2908
- ie.push(
2909
- /* @__PURE__ */ t(
2910
- at,
2911
- {
2912
- sx: { height: 20, color: _ }
2913
- },
2914
- `life-${ge}`
2915
- )
2916
- );
2917
- for (let ge = ce; ge < 3; ge++)
2918
- ie.push(
2919
- /* @__PURE__ */ t(
2920
- Gt,
2921
- {
2922
- sx: {
2923
- height: 20,
2924
- color: Ie ? `rgba(${Ie.replace(/[^\d,]/g, "")}, 0.35)` : `${_}59`
2925
- }
2926
- },
2927
- `empty-${ge}`
2928
- )
2929
- );
2930
- return ie;
2931
- }, _e = () => {
2932
- const ie = (i == null ? void 0 : i.currentStreak) ?? 0, ce = M ? Re : ie % Re, We = Math.floor(ie / Re) + 1;
2933
- return /* @__PURE__ */ g(r, { sx: { display: "flex", alignItems: "center", gap: "4px" }, children: [
2934
- Array.from({ length: Re }, (vt, ze) => /* @__PURE__ */ t(
2935
- r,
2936
- {
2937
- sx: {
2938
- flex: 1,
2939
- height: 4,
2940
- bgcolor: ze < ce ? _ : j,
2941
- borderRadius: "2px",
2942
- transition: "background-color 0.3s ease"
2943
- }
2944
- },
2945
- `streak-${ze}`
2946
- )),
2947
- We > 1 && /* @__PURE__ */ g(
2948
- C,
2949
- {
2950
- sx: {
2951
- color: _,
2952
- fontWeight: 700,
2953
- fontSize: "0.75em",
2954
- lineHeight: 1,
2955
- ml: d["2xs"],
2956
- flexShrink: 0
2957
- },
2958
- children: [
2959
- "×",
2960
- We
2961
- ]
2962
- }
2963
- )
2964
- ] });
2965
- }, qe = () => /* @__PURE__ */ t(r, { sx: se.dividerContainer, children: /* @__PURE__ */ t(
2966
- r,
2967
- {
2968
- sx: {
2969
- borderRadius: "50%",
2970
- bgcolor: ue,
2971
- boxShadow: "sm",
2972
- width: "32px",
2973
- height: "32px",
2974
- minWidth: "32px",
2975
- border: "1px solid",
2976
- borderColor: _,
2977
- display: "flex",
2978
- alignItems: "center",
2979
- justifyContent: "center"
2980
- },
2981
- children: /* @__PURE__ */ t(jt, { sx: { fontSize: "1.1em", color: _ } })
2982
- }
2983
- ) }), Ke = () => {
2984
- var ie;
2985
- return l ? /* @__PURE__ */ g(r, { sx: se.mainContentSection, children: [
2986
- /* @__PURE__ */ t(r, { sx: se.timerContainer, children: /* @__PURE__ */ t(
2987
- Vt,
2988
- {
2989
- time: f,
2990
- maxTime: (n == null ? void 0 : n.time) ?? 10,
2991
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null
2992
- },
2993
- `timer-${l.pairId}`
2994
- ) }),
2995
- /* @__PURE__ */ g(r, { sx: se.contentContainerWithBackdrop, children: [
2996
- /* @__PURE__ */ g(r, { sx: se.optionsContainer, children: [
2997
- /* @__PURE__ */ t(r, { sx: se.optionWrapper, children: /* @__PURE__ */ t(
2998
- nt,
2999
- {
3000
- option: l.optionOne,
3001
- selected: o,
3002
- feedback: m,
3003
- onSelect: w,
3004
- pairId: l.pairId,
3005
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null,
3006
- optionIndex: 0
3007
- }
3008
- ) }),
3009
- qe(),
3010
- /* @__PURE__ */ t(r, { sx: se.optionWrapper, children: /* @__PURE__ */ t(
3011
- nt,
3012
- {
3013
- option: l.optionTwo,
3014
- selected: o,
3015
- feedback: m,
3016
- onSelect: w,
3017
- pairId: l.pairId,
3018
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null,
3019
- optionIndex: 1
3020
- }
3021
- ) })
3022
- ] }),
3023
- /* @__PURE__ */ g(r, { children: [
3024
- /* @__PURE__ */ t(r, { sx: { mb: d.xs }, children: _e() }),
3025
- /* @__PURE__ */ g(
3026
- je,
3027
- {
3028
- direction: "row",
3029
- justifyContent: "space-between",
3030
- alignItems: "center",
3031
- children: [
3032
- /* @__PURE__ */ t(r, { children: Ye() }),
3033
- /* @__PURE__ */ g(je, { direction: "row", spacing: 1, alignItems: "center", children: [
3034
- /* @__PURE__ */ g(C, { sx: { color: j }, children: [
3035
- Ve,
3036
- ":"
3037
- ] }),
3038
- /* @__PURE__ */ g(
3039
- C,
3040
- {
3041
- level: "h4",
3042
- sx: { position: "relative", color: j },
3043
- children: [
3044
- v,
3045
- O && /* @__PURE__ */ g(
3046
- C,
3047
- {
3048
- sx: Nt.pointsAdded,
3049
- children: [
3050
- "+",
3051
- $
3052
- ]
3053
- },
3054
- k
3055
- )
3056
- ]
3057
- }
3058
- )
3059
- ] })
3060
- ]
3061
- }
3062
- )
3063
- ] })
3064
- ] }),
3065
- Le && /* @__PURE__ */ t(r, { sx: se.bottomFooterContainer, children: /* @__PURE__ */ t(
3066
- me,
3067
- {
3068
- brandingLogo: Le,
3069
- textColor: j,
3070
- label: ((ie = n == null ? void 0 : n.labels) == null ? void 0 : ie.sponsor) || null,
3071
- isCentered: L
3072
- }
3073
- ) })
3074
- ] }) : null;
3075
- }, $e = {
3076
- display: "flex",
3077
- flexDirection: "row",
3078
- justifyContent: "center",
3079
- alignItems: "center",
3080
- flex: L ? "0 0 auto" : 1,
3081
- width: L ? "100%" : "auto",
3082
- borderBottom: "1px solid " + Ae,
3083
- opacity: "60%",
3084
- py: d.sm,
3085
- px: d.md,
3086
- gap: d.xs,
3087
- "&:not(.Mui-selected):hover": {
3088
- bgcolor: Ce ? `rgba(${Ce},0.06)` : `${we}0F`
3089
- },
3090
- [`&.${Ut.selected}`]: {
3091
- bgcolor: Ce ? `rgba(${Ce},0.06)` : `${we}0F`,
3092
- borderBottom: "3px solid " + _,
3093
- opacity: "100%",
3094
- mb: "-1px"
3095
- }
3096
- }, W = {
3097
- flex: 1,
3098
- display: "flex",
3099
- flexDirection: "column",
3100
- overflow: "auto"
3101
- }, F = () => b ? /* @__PURE__ */ t(r, { sx: { width: "100%" }, children: /* @__PURE__ */ g(
3102
- Wt,
3103
- {
3104
- value: P,
3105
- onChange: (ie, ce) => B(ce),
3106
- sx: {
3107
- borderRadius: ne,
3108
- width: "100%",
3109
- backgroundColor: "transparent"
3110
- },
3111
- children: [
3112
- /* @__PURE__ */ g(
3113
- Mt,
3114
- {
3115
- sx: {
3116
- fontSize: "1em",
3117
- "--Icon-fontSize": "1.25em",
3118
- flexDirection: L ? "column" : "row"
3119
- },
3120
- children: [
3121
- /* @__PURE__ */ t(et, { sx: $e, disableIndicator: !0, children: /* @__PURE__ */ g(
3122
- r,
3123
- {
3124
- sx: {
3125
- display: "flex",
3126
- alignItems: "center",
3127
- gap: d.xs
3128
- },
3129
- children: [
3130
- /* @__PURE__ */ t(Ge, { sx: { fontSize: "1.25em" } }),
3131
- /* @__PURE__ */ t(
3132
- C,
3133
- {
3134
- sx: {
3135
- fontFamily: U,
3136
- fontSize: "1em",
3137
- fontWeight: 500,
3138
- lineHeight: "24px",
3139
- letterSpacing: "0.4px",
3140
- textTransform: "uppercase",
3141
- color: j
3142
- },
3143
- children: S("eitherOr.tabs.score", "Score")
3144
- }
3145
- )
3146
- ]
3147
- }
3148
- ) }),
3149
- /* @__PURE__ */ t(et, { sx: $e, disableIndicator: !0, children: /* @__PURE__ */ g(
3150
- r,
3151
- {
3152
- sx: {
3153
- display: "flex",
3154
- alignItems: "center",
3155
- gap: d.xs
3156
- },
3157
- children: [
3158
- /* @__PURE__ */ t(Ht, { sx: { fontSize: "1.25em" } }),
3159
- /* @__PURE__ */ t(
3160
- C,
3161
- {
3162
- sx: {
3163
- fontFamily: U,
3164
- fontSize: "1em",
3165
- fontWeight: 500,
3166
- lineHeight: "24px",
3167
- letterSpacing: "0.4px",
3168
- textTransform: "uppercase",
3169
- color: j
3170
- },
3171
- children: S("eitherOr.tabs.standings", "Standings")
3172
- }
3173
- )
3174
- ]
3175
- }
3176
- ) })
3177
- ]
3178
- }
3179
- ),
3180
- P === 0 && /* @__PURE__ */ t(
3181
- tt,
3182
- {
3183
- value: 0,
3184
- sx: { p: 0, fontSize: "1em", display: "flex" },
3185
- children: /* @__PURE__ */ t(r, { sx: W, children: /* @__PURE__ */ t(
3186
- st,
3187
- {
3188
- stepInfo: i,
3189
- game: n,
3190
- sdk: c,
3191
- onPlayAgain: I,
3192
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null,
3193
- additionalCTA: p
3194
- }
3195
- ) })
3196
- }
3197
- ),
3198
- P === 1 && /* @__PURE__ */ t(
3199
- tt,
3200
- {
3201
- value: 1,
3202
- sx: { p: 0, fontSize: "1em", display: "flex" },
3203
- children: /* @__PURE__ */ t(r, { sx: W, children: /* @__PURE__ */ t(
3204
- Yt,
3205
- {
3206
- game: n,
3207
- sdk: c,
3208
- stepInfo: i,
3209
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null
3210
- }
3211
- ) })
3212
- }
3213
- )
3214
- ]
3215
- }
3216
- ) }) : /* @__PURE__ */ t(
3217
- st,
3218
- {
3219
- stepInfo: i,
3220
- game: n,
3221
- sdk: c,
3222
- onPlayAgain: I,
3223
- brandingPrimaryColor: (T == null ? void 0 : T.primaryColor) || null,
3224
- additionalCTA: p
3225
- }
3226
- ), re = () => {
3227
- var ie, ce, ge;
3228
- switch (s) {
3229
- case q.LOADING:
3230
- return /* @__PURE__ */ t(ot, { my: 20 });
3231
- case q.TUTORIAL: {
3232
- const We = [
3233
- {
3234
- icon: /* @__PURE__ */ t(wn, { sx: { fontSize: "1.1em" } }),
3235
- title: S("eitherOr.tutorial.step1Title"),
3236
- description: S("eitherOr.tutorial.step1Description", {
3237
- seconds: (n == null ? void 0 : n.time) ?? 10
3238
- })
3239
- },
3240
- {
3241
- icon: /* @__PURE__ */ t(at, { sx: { fontSize: "1.1em" } }),
3242
- title: S("eitherOr.tutorial.step2Title", {
3243
- lives: (n == null ? void 0 : n.lives) ?? 3,
3244
- context: String((n == null ? void 0 : n.lives) ?? 3)
3245
- }),
3246
- description: S("eitherOr.tutorial.step2Description", {
3247
- lives: (n == null ? void 0 : n.lives) ?? 3,
3248
- context: String((n == null ? void 0 : n.lives) ?? 3)
3249
- })
3250
- },
3251
- {
3252
- icon: /* @__PURE__ */ t(Ge, { sx: { fontSize: "1.1em" } }),
3253
- title: S("eitherOr.tutorial.step3Title"),
3254
- description: S("eitherOr.tutorial.step3Description")
3255
- }
3256
- ], vt = Ie ? `rgba(${Ie.replace(/[^\d,]/g, "")}, 0.12)` : `${_}20`;
3257
- return /* @__PURE__ */ g(
3258
- r,
3259
- {
3260
- sx: {
3261
- display: "flex",
3262
- flexDirection: "column",
3263
- gap: d.md
3264
- },
3265
- children: [
3266
- /* @__PURE__ */ t(
3267
- r,
3268
- {
3269
- sx: {
3270
- borderRadius: ae,
3271
- overflow: "hidden",
3272
- display: "flex",
3273
- flexDirection: "column",
3274
- backdropFilter: "blur(4px)",
3275
- position: "relative",
3276
- "&::before": {
3277
- content: '""',
3278
- position: "absolute",
3279
- top: 0,
3280
- left: 0,
3281
- right: 0,
3282
- bottom: 0,
3283
- backgroundColor: Q,
3284
- opacity: 0.5,
3285
- borderRadius: "inherit",
3286
- zIndex: 0
3287
- },
3288
- "& > *": { position: "relative", zIndex: 1 }
3289
- },
3290
- children: We.map((ze, At) => {
3291
- const qt = At === We.length - 1;
3292
- return /* @__PURE__ */ g(r, { children: [
3293
- /* @__PURE__ */ g(
3294
- r,
3295
- {
3296
- sx: {
3297
- display: "flex",
3298
- alignItems: "flex-start",
3299
- gap: d.md,
3300
- px: d.md,
3301
- py: d.md
3302
- },
3303
- children: [
3304
- /* @__PURE__ */ t(
3305
- r,
3306
- {
3307
- sx: {
3308
- width: 36,
3309
- height: 36,
3310
- borderRadius: "50%",
3311
- bgcolor: vt,
3312
- color: _,
3313
- display: "flex",
3314
- alignItems: "center",
3315
- justifyContent: "center",
3316
- flexShrink: 0
3317
- },
3318
- children: ze.icon
3319
- }
3320
- ),
3321
- /* @__PURE__ */ g(r, { sx: { flex: 1, minWidth: 0, pt: "2px" }, children: [
3322
- /* @__PURE__ */ t(
3323
- C,
3324
- {
3325
- sx: {
3326
- fontFamily: U,
3327
- fontWeight: 700,
3328
- fontSize: "0.875em",
3329
- lineHeight: 1.3,
3330
- color: j
3331
- },
3332
- children: ze.title
3333
- }
3334
- ),
3335
- /* @__PURE__ */ t(
3336
- C,
3337
- {
3338
- sx: {
3339
- fontFamily: U,
3340
- fontWeight: 400,
3341
- fontSize: "0.75em",
3342
- lineHeight: 1.6,
3343
- color: j,
3344
- opacity: 0.65,
3345
- mt: d["2xs"]
3346
- },
3347
- children: ze.description
3348
- }
3349
- )
3350
- ] })
3351
- ]
3352
- }
3353
- ),
3354
- !qt && /* @__PURE__ */ t(
3355
- r,
3356
- {
3357
- sx: {
3358
- height: "1px",
3359
- mx: d.md,
3360
- bgcolor: Ie ? `rgba(${Ie.replace(/[^\d,]/g, "")}, 0.1)` : `${_}1A`
3361
- }
3362
- }
3363
- )
3364
- ] }, At);
3365
- })
3366
- }
3367
- ),
3368
- x != null && x.items.length ? /* @__PURE__ */ t(r, { sx: se.contentContainerWithBackdrop, children: /* @__PURE__ */ t(
3369
- rt,
3370
- {
3371
- consents: x,
3372
- primaryColor: _,
3373
- textColor: j,
3374
- brandingUrls: (ie = n == null ? void 0 : n.branding) == null ? void 0 : ie.urls
3375
- }
3376
- ) }) : null,
3377
- /* @__PURE__ */ g(
3378
- r,
3379
- {
3380
- sx: {
3381
- ...se.filterScreenContainer,
3382
- justifyContent: Le ? "space-between" : "flex-end"
3383
- },
3384
- children: [
3385
- /* @__PURE__ */ t(
3386
- me,
3387
- {
3388
- brandingLogo: Le,
3389
- textColor: j,
3390
- label: ((ce = n == null ? void 0 : n.labels) == null ? void 0 : ce.sponsor) || null,
3391
- isCentered: L
3392
- }
3393
- ),
3394
- /* @__PURE__ */ t(
3395
- ye,
3396
- {
3397
- variant: "soft",
3398
- loading: A,
3399
- sx: {
3400
- ...se.startButton,
3401
- ...se.pulseAnimation,
3402
- ...A ? Ot(
3403
- _,
3404
- fe
3405
- ) : {}
3406
- },
3407
- endDecorator: /* @__PURE__ */ t(ct, { children: /* @__PURE__ */ t(gt, {}) }),
3408
- onClick: E,
3409
- children: /* @__PURE__ */ t(
3410
- C,
3411
- {
3412
- sx: {
3413
- ...se.startButtonText,
3414
- ...A ? { color: "transparent" } : {}
3415
- },
3416
- children: ((ge = x == null ? void 0 : x.labels) == null ? void 0 : ge.ctaLabel) || S("eitherOr.buttons.start")
3417
- }
3418
- )
3419
- }
3420
- )
3421
- ]
3422
- }
3423
- )
3424
- ]
3425
- }
3426
- );
3427
- }
3428
- case q.PLAYING:
3429
- return Ke();
3430
- default:
3431
- return null;
3432
- }
3433
- };
3434
- return s === q.RESULTS ? /* @__PURE__ */ t(
3435
- on,
3436
- {
3437
- entity: n,
3438
- backgroundImage: Z,
3439
- imageBackgroundGradient: te,
3440
- isWrappedWithScoreStateWrapper: !0,
3441
- children: F()
3442
- }
3443
- ) : /* @__PURE__ */ t(
3444
- ln,
3445
- {
3446
- entity: n,
3447
- headline: S("eitherOr.headline"),
3448
- finalImage: X,
3449
- rulesDisplay: h,
3450
- children: re()
3451
- }
3452
- );
3453
- }, Yn = (e) => ({
3454
- // Pulse animation for buttons
3455
- pulseAnimation: {
3456
- "@keyframes pulse": {
3457
- "0%": { transform: "scale(1)" },
3458
- "50%": { transform: "scale(1.05)" },
3459
- "100%": { transform: "scale(1)" }
3460
- }
3461
- },
3462
- // Sign In button
3463
- signInButton: {
3464
- borderRadius: e.buttonRadius,
3465
- bgcolor: e.primaryColor,
3466
- color: "#FFFFFF",
3467
- py: "10px",
3468
- px: "16px",
3469
- "&:hover": {
3470
- bgcolor: e.primaryColor
3471
- },
3472
- "&:active": {
3473
- color: e.onPrimaryColor
3474
- },
3475
- animation: "pulse 1s infinite",
3476
- fontSize: "0.9375em"
3477
- },
3478
- // Sign in button text
3479
- signInButtonText: {
3480
- fontFamily: e.fontFamilyPrimary,
3481
- fontWeight: 500,
3482
- fontSize: "0.9375em",
3483
- lineHeight: "24px",
3484
- letterSpacing: "0.46px",
3485
- textTransform: "uppercase",
3486
- color: e.onPrimaryColor,
3487
- gap: "8px",
3488
- display: "flex",
3489
- alignItems: "center"
3490
- }
3491
- }), _n = (e) => {
3492
- var y, d, L, S, P, B, v, D, O, V, $;
3493
- const n = Ne(), { t: l } = ee(), i = Se(), s = $t(
3494
- ve.OVERLAY
3495
- ), f = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : i ? dt : ut, o = it(
3496
- { images: e.eitherOr.images, imagePlaceholder: f },
3497
- ve.OVERLAY
3498
- ), { brandingImage: m, brandingColors: c, brandingLogo: u } = lt(e.eitherOr.branding || null), b = Dt(m || o), p = (d = (y = n.customRadius) == null ? void 0 : y.light) == null ? void 0 : d.xl, x = (c == null ? void 0 : c.primaryColor) || ((B = (P = (S = (L = n.colorSchemes) == null ? void 0 : L.light) == null ? void 0 : S.palette) == null ? void 0 : P.primary) == null ? void 0 : B.plainColor), A = (V = (O = (D = (v = n.colorSchemes) == null ? void 0 : v.light) == null ? void 0 : D.palette) == null ? void 0 : O.primary) == null ? void 0 : V.onPrimary, E = n.customFontFamily.dark.primary, w = Yn({
3499
- buttonRadius: p,
3500
- primaryColor: x,
3501
- onPrimaryColor: A,
3502
- fontFamilyPrimary: E
3503
- }), I = () => {
3504
- var R, k, G, M;
3505
- return e.signInCTA ? (R = e.signInCTA) != null && R.component ? e.signInCTA.component : (k = e.signInCTA) != null && k.onClick ? /* @__PURE__ */ t(
3506
- ye,
3507
- {
3508
- variant: "soft",
3509
- sx: { ...w.signInButton, ...w.pulseAnimation },
3510
- onClick: e.signInCTA.onClick,
3511
- children: /* @__PURE__ */ t(C, { sx: w.signInButtonText, children: e.signInCTA.defaultLabel || l("common.signIn") })
3512
- }
3513
- ) : (G = e.signInCTA) != null && G.url ? typeof window > "u" ? /* @__PURE__ */ t(
3514
- r,
3515
- {
3516
- component: "a",
3517
- href: e.signInCTA.url,
3518
- target: ((M = e.signInCTA) == null ? void 0 : M.target) || "_self",
3519
- sx: {
3520
- ...w.signInButton,
3521
- ...w.pulseAnimation,
3522
- textDecoration: "none",
3523
- display: "inline-flex",
3524
- alignItems: "center",
3525
- justifyContent: "center"
3526
- },
3527
- children: /* @__PURE__ */ t(C, { sx: w.signInButtonText, children: e.signInCTA.defaultLabel || l("common.signIn") })
3528
- }
3529
- ) : /* @__PURE__ */ t(
3530
- ye,
3531
- {
3532
- variant: "soft",
3533
- sx: { ...w.signInButton, ...w.pulseAnimation },
3534
- onClick: () => {
3535
- var H, a, Y;
3536
- ((H = e.signInCTA) == null ? void 0 : H.target) === "_blank" ? window.open((a = e.signInCTA) == null ? void 0 : a.url, "_blank") : window.location.href = (Y = e.signInCTA) == null ? void 0 : Y.url;
3537
- },
3538
- children: /* @__PURE__ */ t(C, { sx: w.signInButtonText, children: e.signInCTA.defaultLabel || l("common.signIn") })
3539
- }
3540
- ) : /* @__PURE__ */ t(ye, { variant: "soft", sx: w.signInButton, disabled: !0, children: /* @__PURE__ */ t(C, { sx: w.signInButtonText, children: e.signInCTA.defaultLabel || l("common.signIn") }) }) : /* @__PURE__ */ t(ye, { variant: "soft", sx: w.signInButton, disabled: !0, children: /* @__PURE__ */ t(C, { sx: w.signInButtonText, children: l("common.signIn") }) });
3541
- };
3542
- return /* @__PURE__ */ t(
3543
- an,
3544
- {
3545
- entity: e.eitherOr,
3546
- headline: l("eitherOr.headline"),
3547
- backgroundImage: b,
3548
- imageBackgroundGradient: s,
3549
- signInContent: I(),
3550
- brandingContent: /* @__PURE__ */ t(
3551
- me,
3552
- {
3553
- brandingLogo: u,
3554
- textColor: n.colorSchemes.dark.textColor,
3555
- label: (($ = e.eitherOr.labels) == null ? void 0 : $.sponsor) || null
3556
- }
3557
- ),
3558
- rulesDisplay: e.rulesDisplay
3559
- }
3560
- );
3561
- }, qn = (e) => {
3562
- const { t: n } = ee(), l = Se(), i = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : l ? dt : ut, { brandingLogo: s } = lt(
3563
- e.eitherOr.branding || null
3564
- );
3565
- return /* @__PURE__ */ t(
3566
- sn,
3567
- {
3568
- entity: e.eitherOr,
3569
- headline: n("eitherOr.headline"),
3570
- tryAgainButtonText: n("eitherOr.buttons.tryAgain"),
3571
- defaultImagePlaceholderUrl: i,
3572
- isApiError: e.isApiError,
3573
- apiErrorMessage: e.apiErrorMessage,
3574
- toggleTryAgain: e.toggleTryAgain,
3575
- renderPresentedBy: (f) => {
3576
- var o;
3577
- return /* @__PURE__ */ t(
3578
- me,
3579
- {
3580
- brandingLogo: s,
3581
- textColor: f,
3582
- label: ((o = e.eitherOr.labels) == null ? void 0 : o.sponsor) || null,
3583
- isCentered: l
3584
- }
3585
- );
3586
- },
3587
- rulesDisplay: e.rulesDisplay
3588
- }
3589
- );
3590
- }, Kn = (e) => {
3591
- const { t: n } = ee();
3592
- return /* @__PURE__ */ t(
3593
- Ft,
3594
- {
3595
- entity: e.eitherOr,
3596
- headline: n("eitherOr.headline"),
3597
- sdk: e.sdk,
3598
- leads: e.leads,
3599
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3600
- onLeadSubmitted: e.onLeadSubmitted,
3601
- isSubmitting: e.isSubmitting,
3602
- PresentedBy: me,
3603
- CollectLeadWrapper: _t,
3604
- consents: e.consents,
3605
- rulesDisplay: e.rulesDisplay
3606
- }
3607
- );
3608
- }, Xn = (e) => {
3609
- var s, f, o;
3610
- const { t: n } = ee(), l = ((s = e.eitherOr.branding) == null ? void 0 : s.colors) || null, i = (l == null ? void 0 : l.primaryColor) || K().palette.primary.plainColor;
3611
- return /* @__PURE__ */ t(
3612
- Bt,
3613
- {
3614
- entity: e.eitherOr,
3615
- headline: n("eitherOr.headline"),
3616
- sdk: e.sdk,
3617
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3618
- imagePosition: e.imagePosition,
3619
- onLeadSubmitted: e.onSubmit,
3620
- isSubmitting: e.isSubmitting,
3621
- MainCard: ke,
3622
- PresentedBy: me,
3623
- rulesDisplay: e.rulesDisplay,
3624
- content: /* @__PURE__ */ t(
3625
- rt,
3626
- {
3627
- consents: e.consents,
3628
- primaryColor: i,
3629
- brandingUrls: (f = e.eitherOr.branding) == null ? void 0 : f.urls,
3630
- align: "center"
3631
- }
3632
- ),
3633
- footerAction: /* @__PURE__ */ t(
3634
- Et,
3635
- {
3636
- onClick: e.onSubmit,
3637
- label: ((o = e.consents.labels) == null ? void 0 : o.ctaLabel) || n("eitherOr.buttons.finish"),
3638
- isSubmitting: e.isSubmitting,
3639
- primaryColor: i
3640
- }
3641
- )
3642
- }
3643
- );
3644
- }, Zn = (e) => {
3645
- var f, o, m;
3646
- const { t: n } = ee(), l = Ne(), i = ((f = e.eitherOr.branding) == null ? void 0 : f.colors) || null, s = (i == null ? void 0 : i.primaryColor) || l.colorSchemes.dark.palette.primary.plainColor;
3647
- return /* @__PURE__ */ t(
3648
- Ft,
3649
- {
3650
- entity: e.eitherOr,
3651
- headline: n("eitherOr.headline"),
3652
- sdk: e.sdk,
3653
- defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
3654
- onLeadSubmitted: e.onSubmit,
3655
- isSubmitting: e.isSubmitting,
3656
- PresentedBy: me,
3657
- rulesDisplay: e.rulesDisplay,
3658
- content: /* @__PURE__ */ t(
3659
- rt,
3660
- {
3661
- consents: e.consents,
3662
- primaryColor: s,
3663
- textColor: (i == null ? void 0 : i.contentColor) || l.colorSchemes.dark.textColor,
3664
- brandingUrls: (o = e.eitherOr.branding) == null ? void 0 : o.urls
3665
- }
3666
- ),
3667
- footerAction: /* @__PURE__ */ t(
3668
- Et,
3669
- {
3670
- onClick: e.onSubmit,
3671
- label: ((m = e.consents.labels) == null ? void 0 : m.ctaLabel) || n("eitherOr.buttons.finish"),
3672
- isSubmitting: e.isSubmitting,
3673
- primaryColor: s
3674
- }
3675
- )
3676
- }
3677
- );
3678
- };
3679
- function Be(e) {
3680
- return e.template === ve.STANDARD;
3681
- }
3682
- function Je(e) {
3683
- return e.template === ve.OVERLAY;
3684
- }
3685
- const Jn = (e) => {
3686
- var Le, Ve, Ye, _e, qe, Ke, $e;
3687
- const [n, l] = z(
3688
- q.LOADING
3689
- ), [i, s] = z(null), [f, o] = z(null), [m, c] = z(10), [u, h] = z(null), [b, p] = z({
3690
- isCorrect: null,
3691
- selectedOption: null
3692
- }), [x, A] = z(!1), [E, w] = z(!1), [I, y] = z(!1), [d, L] = z(""), [S, P] = z(!1), [B, v] = z(!1), [D, O] = z(!1), [V, $] = z(!1), [R, k] = z(!1), [G, M] = z(!1), H = mt(null), a = Rn(e.entityId, e.sdk), {
3693
- setIsUnauthorized: Y,
3694
- setIsApiError: T
3695
- } = Ln(e.entityId, e.sdk, x), {
3696
- pending: N,
3697
- checked: J,
3698
- setChecked: X,
3699
- allRequiredChecked: Z,
3700
- submit: te
3701
- } = cn({
3702
- sdk: e.sdk,
3703
- consents: (Le = e.consents) == null ? void 0 : Le.items,
3704
- entityId: e.entityId,
3705
- entityType: "either_or"
3706
- }), ne = !!((a == null ? void 0 : a.authRequirement) === "LEAD" ? (Ve = e.leads) == null ? void 0 : Ve.position : void 0) && N.length > 0, Q = ne ? [] : N.filter((W) => W.position !== "after"), de = ne ? [] : N.filter((W) => W.position === "after"), _ = (W) => {
3707
- X(W), M(!1);
3708
- }, fe = (W) => {
3709
- var F;
3710
- return {
3711
- items: W,
3712
- checked: J,
3713
- onChange: _,
3714
- labels: (F = e.consents) == null ? void 0 : F.labels,
3715
- showError: G
3716
- };
3717
- };
3718
- he(() => {
3719
- var W, F;
3720
- n !== q.RESULTS || !f || (F = (W = e.callbacks) == null ? void 0 : W.onFinish) == null || F.call(W, f);
3721
- }, [n]), he(() => {
3722
- dn(e.language || "en");
3723
- }, [e.language]), he(() => {
3724
- a && a.id && l(q.TUTORIAL);
3725
- }, [a]);
3726
- const U = () => ({
3727
- onTimerTick: (W) => {
3728
- c(W);
3729
- },
3730
- onElapsedResponse: (W) => {
3731
- const F = W.steps.find(
3732
- (oe) => {
3733
- var xe;
3734
- return oe.pairId === ((xe = H.current) == null ? void 0 : xe.pairId);
3735
- }
3736
- ), re = ((F == null ? void 0 : F.optionOne.value) ?? 0) >= ((F == null ? void 0 : F.optionTwo.value) ?? 0) ? (F == null ? void 0 : F.optionOne.id) ?? null : (F == null ? void 0 : F.optionTwo.id) ?? null;
3737
- p({
3738
- isCorrect: !1,
3739
- selectedOption: null,
3740
- timedOut: !0,
3741
- correctOptionId: re
3742
- }), o(W), setTimeout(() => {
3743
- var Oe;
3744
- const oe = ((Oe = e.leads) == null ? void 0 : Oe.position) === "after" && (a == null ? void 0 : a.authRequirement) === "LEAD" && !S;
3745
- if (W.currentLives === 0) {
3746
- oe ? v(!0) : l(q.RESULTS);
3747
- return;
3748
- }
3749
- const xe = W.steps.find((be) => !be.played);
3750
- xe ? (s(xe), h(null), p({ isCorrect: null, selectedOption: null })) : oe ? v(!0) : l(q.RESULTS);
3751
- }, 1e3);
3752
- }
3753
- }), j = (W) => {
3754
- console.error("[either-or-play] request failed", W);
3755
- const { code: F, message: re } = un(W, e.sdk);
3756
- F === 401 || F === 403 ? w(!0) : (y(!0), L(re));
3757
- }, ue = Me(async () => {
3758
- var W;
3759
- if (Q.length > 0) {
3760
- if (D) return;
3761
- if (!Z(Q)) {
3762
- M(!0);
3763
- return;
3764
- }
3765
- O(!0), await te(Q), O(!1);
3766
- }
3767
- if ((a == null ? void 0 : a.authRequirement) === "LEAD" && ((W = e.leads) == null ? void 0 : W.position) === "before" && !S) {
3768
- v(!0);
3769
- return;
3770
- }
3771
- try {
3772
- const F = await e.sdk.miniGames.participateInEitherOr(
3773
- e.entityId,
3774
- null,
3775
- U()
3776
- );
3777
- c((a == null ? void 0 : a.time) ?? 10), o(F), s(F.steps.find((re) => !re.played) || null), l(q.PLAYING);
3778
- } catch (F) {
3779
- console.error("Failed to start game:", F), j(F);
3780
- }
3781
- }, [
3782
- e.entityId,
3783
- e.sdk,
3784
- (Ye = e.leads) == null ? void 0 : Ye.position,
3785
- a == null ? void 0 : a.authRequirement,
3786
- a == null ? void 0 : a.time,
3787
- S,
3788
- Q,
3789
- D
3790
- ]);
3791
- H.current = i;
3792
- const Ae = Me(
3793
- async (W, F) => {
3794
- if (!u) {
3795
- h(F);
3796
- try {
3797
- const re = await e.sdk.miniGames.participateInEitherOr(
3798
- e.entityId,
3799
- { pair: W, answer: F },
3800
- U()
3801
- ), oe = re.steps.find(
3802
- (be) => be.pairId === W
3803
- ), xe = (oe == null ? void 0 : oe.correct) ?? !1, Oe = xe ? null : [oe == null ? void 0 : oe.optionOne.id, oe == null ? void 0 : oe.optionTwo.id].find(
3804
- (be) => be !== F
3805
- ) ?? null;
3806
- p({ isCorrect: xe, selectedOption: F, correctOptionId: Oe }), o(re), setTimeout(() => {
3807
- var Ue;
3808
- const be = ((Ue = e.leads) == null ? void 0 : Ue.position) === "after" && (a == null ? void 0 : a.authRequirement) === "LEAD" && !S, Fe = de.length > 0 && !R;
3809
- if (re.currentLives === 0) {
3810
- Fe ? $(!0) : be ? v(!0) : l(q.RESULTS);
3811
- return;
3812
- }
3813
- const Ee = re.steps.find((Xe) => !Xe.played);
3814
- Ee ? (s(Ee), h(null), p({ isCorrect: null, selectedOption: null })) : Fe ? $(!0) : be ? v(!0) : l(q.RESULTS);
3815
- }, 1e3);
3816
- } catch (re) {
3817
- console.error("Failed to submit answer:", re), h(null), j(re);
3818
- }
3819
- }
3820
- },
3821
- [
3822
- e.entityId,
3823
- e.sdk,
3824
- u,
3825
- a == null ? void 0 : a.authRequirement,
3826
- (_e = e.leads) == null ? void 0 : _e.position,
3827
- S,
3828
- de,
3829
- R
3830
- ]
3831
- ), we = Me(async () => {
3832
- var W;
3833
- if (P(!0), ((W = e.leads) == null ? void 0 : W.position) === "before") {
3834
- O(!0);
3835
- try {
3836
- const F = await e.sdk.miniGames.participateInEitherOr(
3837
- e.entityId,
3838
- null,
3839
- U()
3840
- );
3841
- c((a == null ? void 0 : a.time) ?? 10), o(F), s(F.steps.find((re) => !re.played) || null), v(!1), O(!1), l(q.PLAYING);
3842
- } catch (F) {
3843
- O(!1), v(!1), j(F);
3844
- }
3845
- } else
3846
- v(!1), O(!1), l(q.RESULTS);
3847
- }, [(qe = e.leads) == null ? void 0 : qe.position, e.entityId, e.sdk, a == null ? void 0 : a.time]), Ce = Me(async () => {
3848
- if (!Z(de)) {
3849
- M(!0);
3850
- return;
3851
- }
3852
- O(!0), await te(de), k(!0), O(!1), $(!1), l(q.RESULTS);
3853
- }, [de, Z, te]), Ie = Me(() => {
3854
- l(q.TUTORIAL), s(null), o(null), c((a == null ? void 0 : a.time) ?? 10), h(null), p({ isCorrect: null, selectedOption: null }), P(!1), v(!1), $(!1), M(!1);
3855
- }, [a == null ? void 0 : a.time]), se = () => {
3856
- y(!1), w(!1), L(""), T(!1), Y(!1), A(!x), l(q.TUTORIAL), s(null), o(null), h(null), p({ isCorrect: null, selectedOption: null }), P(!1), v(!1), $(!1), M(!1);
3857
- };
3858
- if (!a)
3859
- return /* @__PURE__ */ t(ot, { my: 20 });
3860
- if (!a.id)
3861
- return /* @__PURE__ */ t(Un, {});
3862
- if (a.status !== "ACTIVE")
3863
- return /* @__PURE__ */ t(
3864
- jn,
3865
- {
3866
- eitherOr: a,
3867
- template: e.template,
3868
- imagePosition: Be(e) ? e.imagePosition : void 0,
3869
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3870
- rulesDisplay: e.rulesDisplay
3871
- }
3872
- );
3873
- if (a.authRequirement === "REGISTERED" && !e.userIsLoggedIn)
3874
- return Be(e) ? /* @__PURE__ */ t(
3875
- Mn,
3876
- {
3877
- eitherOr: a,
3878
- imagePosition: e.imagePosition,
3879
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3880
- signInCTA: e.signInCTA,
3881
- rulesDisplay: e.rulesDisplay
3882
- }
3883
- ) : Je(e) ? /* @__PURE__ */ t(
3884
- _n,
3885
- {
3886
- eitherOr: a,
3887
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3888
- signInCTA: e.signInCTA,
3889
- rulesDisplay: e.rulesDisplay
3890
- }
3891
- ) : /* @__PURE__ */ t(Qe, {});
3892
- if (E || I)
3893
- return Je(e) ? /* @__PURE__ */ t(
3894
- qn,
3895
- {
3896
- eitherOr: a,
3897
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3898
- isApiError: I,
3899
- apiErrorMessage: d,
3900
- toggleTryAgain: se,
3901
- rulesDisplay: e.rulesDisplay
3902
- }
3903
- ) : /* @__PURE__ */ t(
3904
- Gn,
3905
- {
3906
- eitherOr: a,
3907
- imagePosition: Be(e) ? e.imagePosition : void 0,
3908
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3909
- isApiError: I,
3910
- apiErrorMessage: d,
3911
- toggleTryAgain: se,
3912
- rulesDisplay: e.rulesDisplay
3913
- }
3914
- );
3915
- if (V && de.length > 0) {
3916
- const W = {
3917
- eitherOr: a,
3918
- sdk: e.sdk,
3919
- consents: fe(de),
3920
- onSubmit: Ce,
3921
- isSubmitting: D,
3922
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3923
- rulesDisplay: e.rulesDisplay
3924
- };
3925
- return Be(e) ? /* @__PURE__ */ t(
3926
- Xn,
3927
- {
3928
- ...W,
3929
- imagePosition: e.imagePosition
3930
- }
3931
- ) : /* @__PURE__ */ t(Zn, { ...W });
3932
- }
3933
- if (B && a.authRequirement === "LEAD" && (((Ke = e.leads) == null ? void 0 : Ke.position) === "after" || (($e = e.leads) == null ? void 0 : $e.position) === "before")) {
3934
- if (Be(e))
3935
- return /* @__PURE__ */ t(
3936
- Hn,
3937
- {
3938
- eitherOr: a,
3939
- sdk: e.sdk,
3940
- leads: e.leads,
3941
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3942
- onLeadSubmitted: we,
3943
- imagePosition: e.imagePosition,
3944
- isSubmitting: D,
3945
- rulesDisplay: e.rulesDisplay,
3946
- consents: ne ? N : void 0
3947
- }
3948
- );
3949
- if (Je(e))
3950
- return /* @__PURE__ */ t(
3951
- Kn,
3952
- {
3953
- eitherOr: a,
3954
- sdk: e.sdk,
3955
- leads: e.leads,
3956
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3957
- onLeadSubmitted: we,
3958
- isSubmitting: D,
3959
- rulesDisplay: e.rulesDisplay,
3960
- consents: ne ? N : void 0
3961
- }
3962
- );
3963
- }
3964
- return Be(e) ? /* @__PURE__ */ t(
3965
- En,
3966
- {
3967
- eitherOr: a,
3968
- currentPair: i,
3969
- stepInfo: f,
3970
- gameState: n,
3971
- timer: m,
3972
- selected: u,
3973
- feedback: b,
3974
- sdk: e.sdk,
3975
- leads: e.leads,
3976
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
3977
- rulesDisplay: e.rulesDisplay,
3978
- showStandings: e.showStandings,
3979
- additionalCTA: e.additionalCTA,
3980
- imagePosition: e.imagePosition,
3981
- consents: fe(Q),
3982
- isSubmitting: D,
3983
- onGameStart: ue,
3984
- onSelection: Ae,
3985
- onPlayAgain: Ie
3986
- }
3987
- ) : Je(e) ? /* @__PURE__ */ t(
3988
- Vn,
3989
- {
3990
- eitherOr: a,
3991
- currentPair: i,
3992
- stepInfo: f,
3993
- gameState: n,
3994
- timer: m,
3995
- selected: u,
3996
- feedback: b,
3997
- sdk: e.sdk,
3998
- leads: e.leads,
3999
- defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
4000
- rulesDisplay: e.rulesDisplay,
4001
- showStandings: e.showStandings,
4002
- additionalCTA: e.additionalCTA,
4003
- consents: fe(Q),
4004
- isSubmitting: D,
4005
- onGameStart: ue,
4006
- onSelection: Ae,
4007
- onPlayAgain: Ie
4008
- }
4009
- ) : /* @__PURE__ */ t(Qe, {});
4010
- }, Cr = (e) => /* @__PURE__ */ t(mn, { packageName: "either-or-play", ...e, children: /* @__PURE__ */ t(Jn, { ...e }) });
4011
- export {
4012
- Cr as M
4013
- };