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