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
@@ -0,0 +1,2992 @@
1
+ import { jsx as t, jsxs as u, Fragment as nt } from "@emotion/react/jsx-runtime";
2
+ import { useDisableCache as rn, useIsMobile as Le, useIsExtraSmall as Pt, useColors as Oe, hexToRgb as ye, DirectionalIcon as rr, useImageUrl as An, useIntlLocale as Pn, useInternalTheme as at, useIsRtl as nn, useImageVariant as Rt, WidgetTemplate as ze, useBrandingModelProperties as Dt, sanitizeBackgroundUrl as on, useImageBackgroundGradient as an, defaultBgVertical as nr, defaultBg as or, useConsents as Rn, initializeI18n as Dn, extractSdkError as zn } from "fansunited-frontend-core";
3
+ import Bn, { useState as S, useEffect as Ce, useRef as ot, useId as sn, useMemo as mr, useCallback as tt } from "react";
4
+ import { EitherOrFullModel as En } from "fansunited-sdk-esm/models";
5
+ import { PresentedBy as Mn, baseButton as it, ConsentPanel as zt, ButtonSpinner as ln, baseBody as ge, BODY_FONT as pe, space as D, AdditionalCTA as Fn, Spinner as Bt, DataTable as Un, Avatar as Wn, StandardSkeleton as Gn, NotFound as jn, StandardSignInSkeleton as Hn, SignInCta as Nn, StandardApiErrorSkeleton as cn, PlayCollectLeadWrapper as Yn, StandardLeadAfterCollection as dn, OverlayScoreStateWrapperSkeleton as Vn, OverlaySkeleton as _n, OverlaySignInSkeleton as qn, OverlayApiErrorSkeleton as Kn, OverlayLeadAfterCollection as un, ConsentCta as fn, WidgetPortal as Xn } from "fansunited-frontend-core/ui/emotion";
6
+ import { keyframes as ke, css as r } from "@emotion/react";
7
+ import { TimerIcon as gn, FavoriteIcon as Tt, EmojiEventsIcon as qe, ArrowRightAltIcon as ir, CheckCircleIcon as qt, CancelIcon as Kt, TimerOutlinedIcon as Zn, SwapVertIcon as Jn, CompareArrowsIcon as pn, FavoriteBorderIcon as mn, AccessTimeIcon as Qn, WorkspacePremiumIcon as eo, PersonIcon as to, LeaderboardIcon as hn } from "fansunited-frontend-core/ui/icons";
8
+ import { useTranslation as ie } from "react-i18next";
9
+ const ro = (e, n) => {
10
+ const [i, s] = S(null), a = rn(), d = async () => {
11
+ try {
12
+ const o = await n.miniGames.getEitherOrById(e, a);
13
+ s(o);
14
+ } catch (o) {
15
+ console.error(o), s(new En());
16
+ }
17
+ };
18
+ return Ce(() => (d(), () => s(null)), [e, n, a]), i;
19
+ }, no = (e, n, i = !1) => {
20
+ const [s, a] = S(null), [d, o] = S(!1), [b, c] = S(!1), m = async () => {
21
+ try {
22
+ const p = await n.miniGames.getMyEitherOrStats(e);
23
+ a(p);
24
+ } catch (p) {
25
+ if (a(null), n.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
26
+ const k = p;
27
+ if (k.error.code === 404)
28
+ return;
29
+ if (k.error.code === 401 || k.error.code === 403) {
30
+ o(!0);
31
+ return;
32
+ }
33
+ c(!0);
34
+ return;
35
+ }
36
+ const g = p;
37
+ if (g.data.error.code === 404)
38
+ return;
39
+ if (g.data.error.code === 401 || g.data.error.code === 403) {
40
+ o(!0);
41
+ return;
42
+ }
43
+ c(!0);
44
+ }
45
+ };
46
+ return Ce(() => (m(), () => {
47
+ a(null), o(!1), c(!1);
48
+ }), [e, n, i]), {
49
+ myStats: s,
50
+ setMyStats: a,
51
+ isUnauthorized: d,
52
+ isApiError: b,
53
+ setIsUnauthorized: o,
54
+ setIsApiError: c
55
+ };
56
+ }, J = {
57
+ LOADING: "loading",
58
+ TUTORIAL: "tutorial",
59
+ PLAYING: "playing",
60
+ RESULTS: "results"
61
+ }, me = (e) => /* @__PURE__ */ t(Mn, { centerBelow: "extraSmall", ...e }), oo = ke({
62
+ "0%": { transform: "scale(1)" },
63
+ "50%": { transform: "scale(1.05)" },
64
+ "100%": { transform: "scale(1)" }
65
+ }), Xt = "var(--fu-ucrc-font-primary)", hr = "var(--fu-ucrc-eo-text)", br = "var(--fu-ucrc-eo-glass)", rt = { display: "flex", flexDirection: "column" }, mt = { display: "flex", alignItems: "center", gap: "var(--fu-ucrc-space-lg)" }, yr = r(it, {
66
+ alignSelf: "center",
67
+ paddingBlock: "10px",
68
+ paddingRight: "12px",
69
+ paddingLeft: "16px",
70
+ borderRadius: "var(--fu-ucrc-radius-xl)",
71
+ fontSize: "0.9375em",
72
+ backgroundColor: "var(--fu-ucrc-eo-primary)",
73
+ color: "var(--fu-ucrc-primary-on-primary)",
74
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
75
+ transform: "scale(1)",
76
+ animation: `${oo} 1s infinite`,
77
+ "&:hover": { transform: "scale(1.02)" },
78
+ "&:active": { transform: "scale(0.98)" }
79
+ }), xr = {
80
+ margin: 0,
81
+ // May be a client-config label.
82
+ unicodeBidi: "plaintext",
83
+ fontFamily: Xt,
84
+ fontWeight: 500,
85
+ fontSize: "0.9375em",
86
+ lineHeight: "24px",
87
+ letterSpacing: "0.46px",
88
+ textTransform: "uppercase",
89
+ color: "var(--fu-ucrc-primary-on-primary)",
90
+ gap: "var(--fu-ucrc-space-xs)",
91
+ display: "flex",
92
+ alignItems: "center"
93
+ }, vr = { display: "flex", marginLeft: "8px", "--Icon-fontSize": "1em" }, te = {
94
+ root: r({ ...rt, padding: "var(--fu-ucrc-space-md)" }),
95
+ inner: r({ ...rt, gap: "var(--fu-ucrc-space-md)" }),
96
+ innerMobile: r({ ...rt, gap: "var(--fu-ucrc-space-lg)" }),
97
+ steps: r({
98
+ ...rt,
99
+ borderRadius: "var(--fu-ucrc-radius-md)",
100
+ overflow: "hidden",
101
+ backgroundColor: br,
102
+ backdropFilter: "blur(4px)"
103
+ }),
104
+ step: r({
105
+ display: "flex",
106
+ alignItems: "flex-start",
107
+ gap: "var(--fu-ucrc-space-md)",
108
+ padding: "var(--fu-ucrc-space-md)"
109
+ }),
110
+ // Joy's icon colour (text.icon) won over the circle's primary colour.
111
+ stepIcon: r({
112
+ width: "36px",
113
+ height: "36px",
114
+ borderRadius: "50%",
115
+ backgroundColor: "var(--fu-ucrc-eo-icon-bg)",
116
+ color: "var(--fu-ucrc-eo-primary)",
117
+ display: "flex",
118
+ alignItems: "center",
119
+ justifyContent: "center",
120
+ flexShrink: 0
121
+ }),
122
+ stepText: r({ flex: 1, minWidth: 0, paddingTop: "2px" }),
123
+ stepTitle: r({ margin: 0, fontFamily: Xt, fontWeight: 700, fontSize: "0.875em", lineHeight: 1.3, color: hr }),
124
+ stepDescription: r({
125
+ margin: 0,
126
+ fontFamily: Xt,
127
+ fontWeight: 400,
128
+ fontSize: "0.75em",
129
+ lineHeight: 1.6,
130
+ color: hr,
131
+ opacity: 0.65,
132
+ marginTop: "var(--fu-ucrc-space-2xs)"
133
+ }),
134
+ stepDivider: r({ height: "1px", marginInline: "var(--fu-ucrc-space-md)", backgroundColor: "var(--fu-ucrc-eo-divider)" }),
135
+ consents: r({
136
+ ...rt,
137
+ borderRadius: "var(--fu-ucrc-radius-md)",
138
+ backgroundColor: br,
139
+ padding: "var(--fu-ucrc-space-md)",
140
+ backdropFilter: "blur(4px)"
141
+ }),
142
+ footerRow: r({ ...mt, flexDirection: "row", justifyContent: "flex-end" }),
143
+ footerRowBranded: r({ ...mt, flexDirection: "row", justifyContent: "space-between" }),
144
+ footerColumn: r({ ...mt, flexDirection: "column", justifyContent: "flex-end" }),
145
+ footerColumnBranded: r({ ...mt, flexDirection: "column", justifyContent: "space-between" }),
146
+ start: yr,
147
+ // Busy: Joy kept the brand colour at full opacity and stopped the pulse.
148
+ startBusy: r(yr, { animation: "none" }),
149
+ startLabel: r(xr),
150
+ // Hidden rather than unmounted, so the button keeps its width.
151
+ startLabelBusy: r({ ...xr, color: "transparent" }),
152
+ decorator: r(vr),
153
+ decoratorBusy: r({ ...vr, visibility: "hidden" })
154
+ }, io = { "--Icon-margin": "0 -4px 0 0" }, Et = "1.1em", Mt = "var(--fu-ucrc-palette-text-icon)", ao = ({ onStart: e, game: n, signInCTA: i, showSignInCTA: s, consents: a, isSubmitting: d }) => {
155
+ var V, x, F, G, E, B, C, H, y, O;
156
+ const { t: o } = ie(), b = Le(), c = Pt(), m = Oe(), p = ((V = n == null ? void 0 : n.branding) == null ? void 0 : V.colors) || null, w = (p == null ? void 0 : p.primaryColor) || m.palette.primary.plainColor, g = (p == null ? void 0 : p.contentColor) || m.textColor, k = m.surfaceVariant, z = ye(w || ""), P = z ? z.replace(/[^\d,]/g, "") : null, R = ye(k || ""), M = b ? ((F = (x = n == null ? void 0 : n.branding) == null ? void 0 : x.images) == null ? void 0 : F.mobileLogo) || ((E = (G = n == null ? void 0 : n.branding) == null ? void 0 : G.images) == null ? void 0 : E.mainLogo) || "" : ((C = (B = n == null ? void 0 : n.branding) == null ? void 0 : B.images) == null ? void 0 : C.mainLogo) || "", W = [
157
+ {
158
+ icon: /* @__PURE__ */ t(gn, { size: Et, color: Mt }),
159
+ title: o("eitherOr.tutorial.step1Title"),
160
+ description: o("eitherOr.tutorial.step1Description", {
161
+ seconds: (n == null ? void 0 : n.time) ?? 10
162
+ })
163
+ },
164
+ {
165
+ icon: /* @__PURE__ */ t(Tt, { size: Et, color: Mt }),
166
+ title: o("eitherOr.tutorial.step2Title", {
167
+ lives: (n == null ? void 0 : n.lives) ?? 3,
168
+ context: String((n == null ? void 0 : n.lives) ?? 3)
169
+ }),
170
+ description: o("eitherOr.tutorial.step2Description", {
171
+ lives: (n == null ? void 0 : n.lives) ?? 3,
172
+ context: String((n == null ? void 0 : n.lives) ?? 3)
173
+ })
174
+ },
175
+ {
176
+ icon: /* @__PURE__ */ t(qe, { size: Et, color: Mt }),
177
+ title: o("eitherOr.tutorial.step3Title"),
178
+ description: o("eitherOr.tutorial.step3Description")
179
+ }
180
+ ];
181
+ if (!n) return null;
182
+ const f = /* @__PURE__ */ t(me, { brandingLogo: M, textColor: g, label: ((H = n == null ? void 0 : n.labels) == null ? void 0 : H.sponsor) || null });
183
+ return /* @__PURE__ */ t(
184
+ "div",
185
+ {
186
+ css: te.root,
187
+ style: {
188
+ "--fu-ucrc-eo-primary": w,
189
+ "--fu-ucrc-eo-text": g,
190
+ "--fu-ucrc-eo-glass": R ? `rgba(${R.replace(/[^\d,]/g, "")}, 0.5)` : k,
191
+ "--fu-ucrc-eo-icon-bg": P ? `rgba(${P}, 0.12)` : `${w}20`,
192
+ "--fu-ucrc-eo-divider": P ? `rgba(${P}, 0.1)` : `${w}1A`
193
+ },
194
+ children: /* @__PURE__ */ u("div", { css: b ? te.innerMobile : te.inner, children: [
195
+ /* @__PURE__ */ t("div", { css: te.steps, children: W.map((X, ne) => /* @__PURE__ */ u("div", { children: [
196
+ /* @__PURE__ */ u("div", { css: te.step, children: [
197
+ /* @__PURE__ */ t("div", { css: te.stepIcon, children: X.icon }),
198
+ /* @__PURE__ */ u("div", { css: te.stepText, children: [
199
+ /* @__PURE__ */ t("p", { css: te.stepTitle, children: X.title }),
200
+ /* @__PURE__ */ t("p", { css: te.stepDescription, children: X.description })
201
+ ] })
202
+ ] }),
203
+ ne < W.length - 1 && /* @__PURE__ */ t("div", { css: te.stepDivider })
204
+ ] }, ne)) }),
205
+ a != null && a.items.length ? /* @__PURE__ */ t("div", { css: te.consents, children: /* @__PURE__ */ t(
206
+ zt,
207
+ {
208
+ consents: a,
209
+ primaryColor: w,
210
+ textColor: g,
211
+ brandingUrls: (y = n == null ? void 0 : n.branding) == null ? void 0 : y.urls,
212
+ align: "center"
213
+ }
214
+ ) }) : null,
215
+ /* @__PURE__ */ u(
216
+ "div",
217
+ {
218
+ css: c ? M ? te.footerColumnBranded : te.footerColumn : M ? te.footerRowBranded : te.footerRow,
219
+ children: [
220
+ M && !c && f,
221
+ /* @__PURE__ */ u(
222
+ "button",
223
+ {
224
+ type: "button",
225
+ css: d ? te.startBusy : te.start,
226
+ disabled: d,
227
+ onClick: s && i ? i.onClick : e,
228
+ children: [
229
+ /* @__PURE__ */ t("p", { css: d ? te.startLabelBusy : te.startLabel, children: s && i ? i.defaultLabel : ((O = a == null ? void 0 : a.labels) == null ? void 0 : O.ctaLabel) || o("eitherOr.buttons.start") }),
230
+ /* @__PURE__ */ t("span", { css: d ? te.decoratorBusy : te.decorator, style: io, children: /* @__PURE__ */ t(rr, { children: /* @__PURE__ */ t(ir, {}) }) }),
231
+ d && /* @__PURE__ */ t(ln, { size: 20, thickness: 3 })
232
+ ]
233
+ }
234
+ ),
235
+ M && c && f
236
+ ]
237
+ }
238
+ )
239
+ ] })
240
+ }
241
+ );
242
+ }, Sr = {
243
+ position: "relative",
244
+ height: "100px",
245
+ overflow: "hidden",
246
+ background: "var(--fu-ucrc-eo-opt-bg)",
247
+ border: "1.5px solid var(--fu-ucrc-eo-opt-border)",
248
+ display: "flex",
249
+ alignItems: "center",
250
+ gap: "14px",
251
+ paddingInline: "var(--fu-ucrc-space-md)",
252
+ transition: "transform 0.2s, box-shadow 0.2s, border-color 0.25s",
253
+ boxShadow: "var(--fu-ucrc-eo-opt-shadow)"
254
+ }, Cr = {
255
+ position: "relative",
256
+ aspectRatio: "16/9",
257
+ overflow: "hidden",
258
+ backgroundColor: "var(--fu-ucrc-surface-variant)",
259
+ backgroundImage: "var(--fu-ucrc-eo-opt-image)",
260
+ backgroundSize: "cover",
261
+ backgroundPosition: "center top",
262
+ backgroundClip: "padding-box",
263
+ border: "1.5px solid var(--fu-ucrc-eo-opt-border)",
264
+ transition: "transform 0.2s, border-color 0.25s",
265
+ boxShadow: "var(--fu-ucrc-eo-opt-shadow)"
266
+ }, kr = { color: "#fff", filter: "drop-shadow(0 1px 4px rgba(0,0,0,0.5))" }, be = {
267
+ plainOpen: r({
268
+ ...Sr,
269
+ cursor: "pointer",
270
+ "&:hover": { transform: "scale(1.01)", boxShadow: "var(--fu-ucrc-eo-opt-hover-shadow)" }
271
+ }),
272
+ plainLocked: r({ ...Sr, cursor: "default" }),
273
+ stripes: r({ position: "absolute", inset: 0, background: "var(--fu-ucrc-eo-opt-stripes)", zIndex: 0 }),
274
+ badge: r({
275
+ width: "40px",
276
+ height: "40px",
277
+ borderRadius: "50%",
278
+ backgroundColor: "var(--fu-ucrc-eo-opt-accent)",
279
+ display: "flex",
280
+ alignItems: "center",
281
+ justifyContent: "center",
282
+ flexShrink: 0,
283
+ zIndex: 2,
284
+ transition: "background-color 0.25s",
285
+ boxShadow: "var(--fu-ucrc-eo-opt-badge-shadow)"
286
+ }),
287
+ badgeLetter: r(ge, {
288
+ fontFamily: pe,
289
+ color: "var(--fu-ucrc-primary-on-primary)",
290
+ fontWeight: 800,
291
+ fontSize: "1em",
292
+ lineHeight: 1,
293
+ userSelect: "none"
294
+ }),
295
+ plainLabel: r(ge, {
296
+ unicodeBidi: "plaintext",
297
+ fontFamily: pe,
298
+ fontWeight: 700,
299
+ fontSize: "0.9375em",
300
+ lineHeight: 1.35,
301
+ color: "var(--fu-ucrc-eo-opt-accent)",
302
+ zIndex: 2,
303
+ flex: 1,
304
+ transition: "color 0.25s"
305
+ }),
306
+ imageOpen: r({ ...Cr, cursor: "pointer", "&:hover": { transform: "scale(1.01)" } }),
307
+ imageLocked: r({ ...Cr, cursor: "default" }),
308
+ shade: r({
309
+ position: "absolute",
310
+ inset: 0,
311
+ background: "linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0) 100%)"
312
+ }),
313
+ overlay: r({
314
+ position: "absolute",
315
+ inset: 0,
316
+ background: "var(--fu-ucrc-eo-opt-overlay)",
317
+ transition: "background 0.25s",
318
+ zIndex: 1
319
+ }),
320
+ // Physical `right`: Joy's sx flipped it under RTL, and so does the plugin.
321
+ feedbackIcon: r({ position: "absolute", top: "8px", right: "10px", zIndex: 3 }),
322
+ imageLabelBox: r({
323
+ position: "absolute",
324
+ bottom: 0,
325
+ left: 0,
326
+ right: 0,
327
+ paddingInline: "12px",
328
+ paddingBlock: "8px",
329
+ zIndex: 2
330
+ }),
331
+ imageLabel: r(ge, {
332
+ unicodeBidi: "plaintext",
333
+ fontFamily: pe,
334
+ color: "#fff",
335
+ fontWeight: 700,
336
+ fontSize: "0.875em",
337
+ textShadow: "0 1px 2px rgba(0,0,0,0.4)",
338
+ textAlign: "center"
339
+ })
340
+ }, Lt = ({
341
+ option: e,
342
+ selected: n,
343
+ feedback: i,
344
+ onSelect: s,
345
+ pairId: a,
346
+ brandingPrimaryColor: d,
347
+ optionIndex: o = 0
348
+ }) => {
349
+ const b = Oe(), c = d || b.palette.primary.plainColor, m = b.palette.success.plainColor, p = b.palette.danger.plainColor, w = ye(c || ""), g = w ? w.replace(/[^\d,]/g, "") : null, k = An(e.images ?? null), z = o === 0 ? "A" : "B", P = i.selectedOption === e.id, R = P && !!i.isCorrect || e.id === i.correctOptionId, M = P && !i.isCorrect || !!i.timedOut && e.id !== i.correctOptionId, W = R ? `0 0 0 3px ${m}30` : M ? `0 0 0 3px ${p}30` : "none", f = () => !n && s(a, e.id);
350
+ if (!k) {
351
+ const F = o === 0 ? "135deg" : "225deg", G = R ? `linear-gradient(${F}, ${m}20 0%, ${m}0D 100%)` : M ? `linear-gradient(${F}, ${p}20 0%, ${p}0D 100%)` : g ? `linear-gradient(${F}, rgba(${g}, 0.22) 0%, rgba(${g}, 0.08) 60%, rgba(${g}, 0.14) 100%)` : `linear-gradient(${F}, ${c}38 0%, ${c}14 60%, ${c}24 100%)`, E = g ? `repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(${g}, 0.04) 10px, rgba(${g}, 0.04) 11px)` : "none", B = R ? m : M ? p : g ? `rgba(${g}, 0.3)` : `${c}4D`, C = R ? m : M ? p : c, H = R ? `0 2px 8px ${m}59` : M ? `0 2px 8px ${p}59` : `0 2px 8px ${g ? `rgba(${g}, 0.35)` : `${c}59`}`;
352
+ return /* @__PURE__ */ u(
353
+ "div",
354
+ {
355
+ css: n ? be.plainLocked : be.plainOpen,
356
+ style: {
357
+ "--fu-ucrc-eo-opt-bg": G,
358
+ "--fu-ucrc-eo-opt-stripes": E,
359
+ "--fu-ucrc-eo-opt-border": B,
360
+ "--fu-ucrc-eo-opt-shadow": W,
361
+ "--fu-ucrc-eo-opt-hover-shadow": `0 4px 16px ${g ? `rgba(${g}, 0.2)` : `${c}33`}`,
362
+ "--fu-ucrc-eo-opt-accent": C,
363
+ "--fu-ucrc-eo-opt-badge-shadow": H
364
+ },
365
+ onClick: f,
366
+ children: [
367
+ /* @__PURE__ */ t("div", { css: be.stripes }),
368
+ /* @__PURE__ */ t("div", { css: be.badge, children: R ? /* @__PURE__ */ t(qt, { size: "1.3em", color: "#fff" }) : M ? /* @__PURE__ */ t(Kt, { size: "1.3em", color: "#fff" }) : /* @__PURE__ */ t("p", { css: be.badgeLetter, children: z }) }),
369
+ /* @__PURE__ */ t("p", { css: be.plainLabel, children: e.label })
370
+ ]
371
+ }
372
+ );
373
+ }
374
+ const V = P || i.timedOut || e.id === i.correctOptionId, x = R ? `linear-gradient(to top, ${m}CC, ${m}55 50%, transparent 100%)` : `linear-gradient(to top, ${p}CC, ${p}55 50%, transparent 100%)`;
375
+ return /* @__PURE__ */ u(
376
+ "div",
377
+ {
378
+ css: n ? be.imageLocked : be.imageOpen,
379
+ style: {
380
+ "--fu-ucrc-eo-opt-image": `url("${k}")`,
381
+ "--fu-ucrc-eo-opt-border": R ? m : M ? p : "transparent",
382
+ "--fu-ucrc-eo-opt-shadow": W,
383
+ "--fu-ucrc-eo-opt-overlay": x
384
+ },
385
+ onClick: f,
386
+ children: [
387
+ /* @__PURE__ */ t("div", { css: be.shade }),
388
+ V && /* @__PURE__ */ t("div", { css: be.overlay }),
389
+ V && /* @__PURE__ */ t("div", { css: be.feedbackIcon, children: R ? /* @__PURE__ */ t(qt, { size: "28px", style: kr }) : /* @__PURE__ */ t(Kt, { size: "28px", style: kr }) }),
390
+ /* @__PURE__ */ t("div", { css: be.imageLabelBox, children: /* @__PURE__ */ t("p", { css: be.imageLabel, children: e.label }) })
391
+ ]
392
+ }
393
+ );
394
+ }, so = ke({ "0%": { transform: "scale(1)" }, "50%": { transform: "scale(1.05)" }, "100%": { transform: "scale(1)" } }), Ft = {
395
+ paddingBlock: "var(--fu-ucrc-space-xs)",
396
+ paddingLeft: "var(--fu-ucrc-space-sm)",
397
+ paddingRight: "var(--fu-ucrc-space-md)",
398
+ display: "flex",
399
+ gap: "var(--fu-ucrc-space-2xs)",
400
+ alignItems: "center",
401
+ borderRadius: "var(--fu-ucrc-radius-xl)",
402
+ maxWidth: "105px",
403
+ maxHeight: "40px",
404
+ transition: "all 0.3s ease",
405
+ zIndex: 10
406
+ }, Ir = {
407
+ primary: r({ ...Ft, backgroundColor: "var(--fu-ucrc-eo-timer-primary)", color: "var(--fu-ucrc-primary-on-primary)" }),
408
+ warning: r({ ...Ft, backgroundColor: "var(--fu-ucrc-warning-soft-bg)", color: "var(--fu-ucrc-warning-plain-color)" }),
409
+ danger: r({
410
+ ...Ft,
411
+ backgroundColor: "var(--fu-ucrc-danger-soft-bg)",
412
+ color: "var(--fu-ucrc-danger-plain-color)",
413
+ animation: `${so} 1s infinite`
414
+ }),
415
+ time: r({
416
+ margin: 0,
417
+ fontFamily: "var(--fu-ucrc-font-secondary)",
418
+ fontWeight: 400,
419
+ fontSize: "1em",
420
+ lineHeight: "150%",
421
+ letterSpacing: "0.15px",
422
+ transition: "color 0.3s ease"
423
+ })
424
+ }, lo = { width: "24px", height: "24px", transition: "color 0.3s ease" }, co = (e) => {
425
+ const n = Math.floor(e / 60), i = e % 60;
426
+ return `${n < 10 ? "0" : ""}${n}:${i < 10 ? "0" : ""}${i}${n > 0 ? "m" : "s"}`;
427
+ }, bn = ({ time: e, maxTime: n, brandingPrimaryColor: i }) => {
428
+ const s = Oe(), a = i || s.palette.primary.plainColor, d = n > 0 ? e / n * 100 : 100, o = d <= 30 ? "danger" : d <= 50 ? "warning" : "primary";
429
+ return /* @__PURE__ */ u("div", { css: Ir[o], style: { "--fu-ucrc-eo-timer-primary": a }, children: [
430
+ /* @__PURE__ */ t(Zn, { style: lo }),
431
+ /* @__PURE__ */ t("p", { css: Ir.time, children: co(e) })
432
+ ] });
433
+ }, uo = ke({
434
+ "0%": { opacity: 1, transform: "translateY(0)" },
435
+ "100%": { opacity: 0, transform: "translateY(-20px)" }
436
+ }), Ge = "var(--fu-ucrc-eo-primary)", wr = "var(--fu-ucrc-eo-text)", Tr = { display: "flex", flexDirection: "column" }, Lr = { display: "flex" }, Or = { flex: 1, height: "4px", borderRadius: "2px", transition: "background-color 0.3s ease" }, $r = { marginTop: "var(--fu-ucrc-space-xs)", display: "flex" }, K = {
437
+ root: r({ display: "flex", flexDirection: "column", padding: "var(--fu-ucrc-space-md)" }),
438
+ questionContainer: r({ ...Tr, gap: "var(--fu-ucrc-space-md)" }),
439
+ questionContainerMobile: r({ ...Tr, gap: "var(--fu-ucrc-space-lg)" }),
440
+ timerRow: r({ display: "flex", justifyContent: "center" }),
441
+ // Joy's frosted card around the options.
442
+ content: r({
443
+ borderRadius: "var(--fu-ucrc-radius-md)",
444
+ overflow: "hidden",
445
+ backgroundColor: "var(--fu-ucrc-eo-glass)",
446
+ display: "flex",
447
+ flexDirection: "column",
448
+ backdropFilter: "blur(4px)",
449
+ paddingInline: "var(--fu-ucrc-space-md)",
450
+ paddingTop: "var(--fu-ucrc-space-md)",
451
+ paddingBottom: "var(--fu-ucrc-space-lg)",
452
+ gap: "var(--fu-ucrc-space-md)"
453
+ }),
454
+ options: r({ ...Lr, flexDirection: "row", gap: "var(--fu-ucrc-space-md)", alignItems: "center" }),
455
+ optionsMobile: r({ ...Lr, flexDirection: "column", gap: 0, alignItems: "stretch" }),
456
+ option: r({ flex: 1, minWidth: 0 }),
457
+ divider: r({ display: "flex", justifyContent: "center", alignItems: "center" }),
458
+ dividerMobile: r({
459
+ display: "flex",
460
+ justifyContent: "center",
461
+ alignItems: "center",
462
+ width: "100%",
463
+ marginBlock: "var(--fu-ucrc-space-sm)"
464
+ }),
465
+ // Joy's `boxShadow: "sm"` never resolved in the shadow root.
466
+ dividerCircle: r({
467
+ borderRadius: "50%",
468
+ backgroundColor: "var(--fu-ucrc-surface)",
469
+ width: "32px",
470
+ height: "32px",
471
+ minWidth: "32px",
472
+ border: `1px solid ${Ge}`,
473
+ display: "flex",
474
+ alignItems: "center",
475
+ justifyContent: "center"
476
+ }),
477
+ streakBox: r({ marginBottom: "var(--fu-ucrc-space-xs)" }),
478
+ streak: r({ display: "flex", alignItems: "center", gap: "4px" }),
479
+ segmentOn: r({ ...Or, backgroundColor: Ge }),
480
+ segmentOff: r({ ...Or, backgroundColor: "var(--fu-ucrc-eo-primary-20)" }),
481
+ multiplier: r(ge, {
482
+ fontFamily: pe,
483
+ color: Ge,
484
+ fontWeight: 700,
485
+ fontSize: "0.75em",
486
+ lineHeight: 1,
487
+ marginLeft: "var(--fu-ucrc-space-2xs)",
488
+ flexShrink: 0
489
+ }),
490
+ stats: r({ display: "flex", justifyContent: "space-between", alignItems: "center" }),
491
+ points: r({ display: "flex", alignItems: "center" }),
492
+ pointsLabel: r(ge, { fontFamily: pe, fontSize: "1em", fontWeight: 400, color: wr }),
493
+ // Joy h4: xl size, lg weight, a 1.5 line height.
494
+ pointsValue: r({
495
+ margin: 0,
496
+ marginLeft: "8px",
497
+ position: "relative",
498
+ fontFamily: pe,
499
+ fontSize: "1.25em",
500
+ fontWeight: 600,
501
+ lineHeight: 1.5,
502
+ letterSpacing: "-0.025em",
503
+ color: wr
504
+ }),
505
+ pointsAdded: r({
506
+ position: "absolute",
507
+ top: "-20px",
508
+ right: 0,
509
+ color: Ge,
510
+ animation: `${uo} 1s ease-out forwards`
511
+ }),
512
+ brandingRow: r({ ...$r, justifyContent: "flex-start" }),
513
+ brandingRowCentered: r({ ...$r, justifyContent: "center" })
514
+ }, Ar = { height: "20px" }, Pr = "1.1em", fo = ({
515
+ currentPair: e,
516
+ timer: n,
517
+ selected: i,
518
+ maxTime: s,
519
+ feedback: a,
520
+ onSelect: d,
521
+ stepInfo: o,
522
+ brandingPrimaryColor: b,
523
+ game: c
524
+ }) => {
525
+ var oe, j, se, le, v, Q, $, _, xe, ve;
526
+ const [m, p] = S(0), [w, g] = S(!1), [k, z] = S(0), [P, R] = S(0), [M, W] = S(!1), f = ot(0), { t: V } = ie(), x = Le(), F = Pt(), G = Oe(), E = G.surfaceVariant, B = b || G.palette.primary.plainColor, C = ((j = (oe = c == null ? void 0 : c.branding) == null ? void 0 : oe.colors) == null ? void 0 : j.contentColor) || G.textColor, H = ye(E || ""), y = ye(B || ""), O = y ? y.replace(/[^\d,]/g, "") : null, X = x ? ((le = (se = c == null ? void 0 : c.branding) == null ? void 0 : se.images) == null ? void 0 : le.mobileLogo) || ((Q = (v = c == null ? void 0 : c.branding) == null ? void 0 : v.images) == null ? void 0 : Q.mainLogo) || "" : ((_ = ($ = c == null ? void 0 : c.branding) == null ? void 0 : $.images) == null ? void 0 : _.mainLogo) || "", ne = V("common.labels.point", { count: m });
527
+ Ce(() => {
528
+ if (o != null && o.currentPoints && o.currentPoints > m) {
529
+ z(o.currentPoints - m), g(!0), R((ce) => ce + 1);
530
+ const ue = setTimeout(() => g(!1), 1e3);
531
+ return p(o.currentPoints), () => clearTimeout(ue);
532
+ }
533
+ }, [o == null ? void 0 : o.currentPoints, m]);
534
+ const N = (c == null ? void 0 : c.points) ?? [], A = N.length >= 2 ? N[1].correctSteps - N[0].correctSteps : ((xe = N[0]) == null ? void 0 : xe.correctSteps) || 5;
535
+ Ce(() => {
536
+ const ue = f.current, ce = (o == null ? void 0 : o.currentStreak) ?? 0;
537
+ if (f.current = ce, ce > ue && ce > 0 && ce % A === 0) {
538
+ W(!0);
539
+ const ee = setTimeout(() => W(!1), 500);
540
+ return () => clearTimeout(ee);
541
+ }
542
+ }, [o == null ? void 0 : o.currentStreak, A]);
543
+ const l = () => {
544
+ const ue = [], ce = (o == null ? void 0 : o.currentLives) ?? 3;
545
+ for (let ee = 0; ee < ce; ee++)
546
+ ue.push(/* @__PURE__ */ t(Tt, { size: "1em", color: Ge, style: Ar }, `life-${ee}`));
547
+ for (let ee = ce; ee < 3; ee++)
548
+ ue.push(
549
+ /* @__PURE__ */ t(mn, { size: "1em", color: "var(--fu-ucrc-eo-primary-35)", style: Ar }, `empty-${ee}`)
550
+ );
551
+ return ue;
552
+ }, ae = () => {
553
+ const ue = (o == null ? void 0 : o.currentStreak) ?? 0, ce = M ? A : ue % A, $e = Math.floor(ue / A) + 1;
554
+ return /* @__PURE__ */ u("div", { css: K.streak, children: [
555
+ Array.from({ length: A }, (Me, Be) => /* @__PURE__ */ t("div", { css: Be < ce ? K.segmentOn : K.segmentOff }, `streak-${Be}`)),
556
+ $e > 1 && /* @__PURE__ */ u("p", { css: K.multiplier, children: [
557
+ "×",
558
+ $e
559
+ ] })
560
+ ] });
561
+ };
562
+ return e ? /* @__PURE__ */ t(
563
+ "div",
564
+ {
565
+ css: K.root,
566
+ style: {
567
+ "--fu-ucrc-eo-primary": B,
568
+ "--fu-ucrc-eo-primary-20": O ? `rgba(${O}, 0.2)` : `${B}33`,
569
+ "--fu-ucrc-eo-primary-35": O ? `rgba(${O}, 0.35)` : `${B}59`,
570
+ "--fu-ucrc-eo-glass": H ? `rgba(${H.replace(/[^\d,]/g, "")}, 0.5)` : E,
571
+ "--fu-ucrc-eo-text": C
572
+ },
573
+ children: /* @__PURE__ */ u("div", { css: x ? K.questionContainerMobile : K.questionContainer, children: [
574
+ /* @__PURE__ */ t("div", { css: K.timerRow, children: /* @__PURE__ */ t(
575
+ bn,
576
+ {
577
+ time: n,
578
+ maxTime: s,
579
+ brandingPrimaryColor: b
580
+ },
581
+ `timer-${e.pairId}`
582
+ ) }),
583
+ /* @__PURE__ */ t("div", { css: K.content, children: /* @__PURE__ */ u("div", { css: x ? K.optionsMobile : K.options, children: [
584
+ /* @__PURE__ */ t("div", { css: K.option, children: /* @__PURE__ */ t(
585
+ Lt,
586
+ {
587
+ option: e.optionOne,
588
+ selected: i,
589
+ feedback: a,
590
+ onSelect: d,
591
+ pairId: e.pairId,
592
+ brandingPrimaryColor: b,
593
+ optionIndex: 0
594
+ }
595
+ ) }),
596
+ /* @__PURE__ */ t("div", { css: x ? K.dividerMobile : K.divider, children: /* @__PURE__ */ t("div", { css: K.dividerCircle, children: x ? /* @__PURE__ */ t(Jn, { size: Pr, color: Ge }) : /* @__PURE__ */ t(pn, { size: Pr, color: Ge }) }) }),
597
+ /* @__PURE__ */ t("div", { css: K.option, children: /* @__PURE__ */ t(
598
+ Lt,
599
+ {
600
+ option: e.optionTwo,
601
+ selected: i,
602
+ feedback: a,
603
+ onSelect: d,
604
+ pairId: e.pairId,
605
+ brandingPrimaryColor: b,
606
+ optionIndex: 1
607
+ }
608
+ ) })
609
+ ] }) }),
610
+ /* @__PURE__ */ u("div", { children: [
611
+ /* @__PURE__ */ t("div", { css: K.streakBox, children: ae() }),
612
+ /* @__PURE__ */ u("div", { css: K.stats, children: [
613
+ /* @__PURE__ */ t("div", { children: l() }),
614
+ /* @__PURE__ */ u("div", { css: K.points, children: [
615
+ /* @__PURE__ */ u("p", { css: K.pointsLabel, children: [
616
+ ne,
617
+ ":"
618
+ ] }),
619
+ /* @__PURE__ */ u("h4", { css: K.pointsValue, children: [
620
+ m,
621
+ w && /* @__PURE__ */ u("span", { css: K.pointsAdded, children: [
622
+ "+",
623
+ k
624
+ ] }, P)
625
+ ] })
626
+ ] })
627
+ ] }),
628
+ X && /* @__PURE__ */ t("div", { css: F ? K.brandingRowCentered : K.brandingRow, children: /* @__PURE__ */ t(
629
+ me,
630
+ {
631
+ brandingLogo: X,
632
+ textColor: C,
633
+ label: ((ve = c == null ? void 0 : c.labels) == null ? void 0 : ve.sponsor) || null
634
+ }
635
+ ) })
636
+ ] })
637
+ ] })
638
+ }
639
+ ) : null;
640
+ }, Ot = "var(--fu-ucrc-eo-res-primary)", Rr = "var(--fu-ucrc-eo-res-on-primary)", _e = "var(--fu-ucrc-text-color)", Zt = "var(--fu-ucrc-surface-variant)", St = "var(--fu-ucrc-success-plain-color)", Ct = "var(--fu-ucrc-danger-plain-color)", go = ke({
641
+ from: { opacity: 0, transform: "translateY(14px)" },
642
+ to: { opacity: 1, transform: "translateY(0)" }
643
+ }), po = ke({
644
+ from: { opacity: 0, transform: "scale(0.88) translateY(-8px)" },
645
+ to: { opacity: 1, transform: "scale(1) translateY(0)" }
646
+ }), mo = ke({
647
+ "0%": { backgroundPosition: "200% 0" },
648
+ "100%": { backgroundPosition: "-200% 0" }
649
+ }), ho = ke({
650
+ "0%, 100%": { transform: "scale(1)", opacity: 0.6 },
651
+ "50%": { transform: "scale(1.18)", opacity: 0 }
652
+ }), bo = ke({ "0%, 100%": { opacity: 1 }, "50%": { opacity: 0.3 } }), yo = ke({
653
+ from: { opacity: 0, transform: "scale(0.5)" },
654
+ to: { opacity: 1, transform: "scale(1)" }
655
+ }), Re = { ...ge, fontFamily: pe }, Ut = { display: "flex", alignItems: "center", justifyContent: "center" }, Dr = {
656
+ backdropFilter: "blur(4px)",
657
+ position: "relative",
658
+ "&::before": {
659
+ content: '""',
660
+ position: "absolute",
661
+ top: 0,
662
+ left: 0,
663
+ right: 0,
664
+ bottom: 0,
665
+ backgroundColor: Zt,
666
+ opacity: 0.5,
667
+ borderRadius: "inherit",
668
+ zIndex: 0
669
+ },
670
+ "& > *": { position: "relative", zIndex: 1 }
671
+ }, zr = {
672
+ ...ge,
673
+ fontFamily: "var(--fu-ucrc-font-primary)",
674
+ fontWeight: 500,
675
+ fontSize: "0.9375em",
676
+ lineHeight: "24px",
677
+ letterSpacing: "0.46px",
678
+ textTransform: "uppercase"
679
+ }, ht = { display: "flex", alignItems: "center", gap: D("lg") }, Wt = {
680
+ flex: 1,
681
+ display: "flex",
682
+ flexDirection: "column",
683
+ alignItems: "center",
684
+ gap: "4px",
685
+ paddingBlock: "14px",
686
+ borderRadius: "var(--fu-ucrc-radius-md)"
687
+ }, Gt = { ...Re, fontSize: "1.3em", fontWeight: 800, lineHeight: 1 }, jt = { ...Re, fontSize: "0.68em", fontWeight: 600 }, Ht = { transition: "width 0.7s ease" }, I = {
688
+ root: r({
689
+ padding: D("md"),
690
+ display: "flex",
691
+ flexDirection: "column",
692
+ gap: D("md"),
693
+ animation: `${go} 0.45s ease-out both`
694
+ }),
695
+ pb: r({
696
+ position: "relative",
697
+ overflow: "hidden",
698
+ borderRadius: "var(--fu-ucrc-radius-md)",
699
+ background: "var(--fu-ucrc-eo-res-pb-bg)",
700
+ padding: "20px 20px 18px",
701
+ display: "flex",
702
+ alignItems: "center",
703
+ gap: "16px",
704
+ animation: `${po} 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.05s both`,
705
+ "&::before": {
706
+ content: '""',
707
+ position: "absolute",
708
+ inset: 0,
709
+ background: "linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.18) 50%, transparent 65%)",
710
+ backgroundSize: "200% 100%",
711
+ animation: `${mo} 2.2s ease-in-out 0.6s infinite`
712
+ }
713
+ }),
714
+ pbBadge: r({ ...Ut, flexShrink: 0, position: "relative", width: "56px", height: "56px" }),
715
+ pbRing: r({
716
+ position: "absolute",
717
+ inset: "-6px",
718
+ borderRadius: "50%",
719
+ border: "2px solid rgba(255,255,255,0.5)",
720
+ animation: `${ho} 1.6s ease-in-out 0.8s infinite`
721
+ }),
722
+ pbTrophy: r({
723
+ ...Ut,
724
+ width: "56px",
725
+ height: "56px",
726
+ borderRadius: "50%",
727
+ backgroundColor: "rgba(255,255,255,0.22)"
728
+ }),
729
+ pbText: r({ flex: 1, minWidth: 0 }),
730
+ pbPill: r({
731
+ display: "inline-flex",
732
+ alignItems: "center",
733
+ gap: "5px",
734
+ backgroundColor: "rgba(255,255,255,0.22)",
735
+ border: "1px solid rgba(255,255,255,0.35)",
736
+ borderRadius: "100px",
737
+ paddingInline: "8px",
738
+ paddingBlock: "2px",
739
+ marginBottom: "6px"
740
+ }),
741
+ pbDot: r({
742
+ width: "6px",
743
+ height: "6px",
744
+ borderRadius: "50%",
745
+ backgroundColor: "#fff",
746
+ animation: `${bo} 1s ease-in-out infinite`
747
+ }),
748
+ pbPillText: r({
749
+ ...Re,
750
+ fontSize: "0.6em",
751
+ fontWeight: 800,
752
+ letterSpacing: "0.14em",
753
+ textTransform: "uppercase",
754
+ color: "#fff",
755
+ lineHeight: 1
756
+ }),
757
+ pbTitle: r({ ...Re, fontSize: "1.05em", fontWeight: 800, color: "#fff", lineHeight: 1.25 }),
758
+ pbSubtitle: r({ ...Re, fontSize: "0.8em", color: "rgba(255,255,255,0.82)", marginTop: "2px" }),
759
+ hero: r({
760
+ ...Dr,
761
+ display: "flex",
762
+ flexDirection: "column",
763
+ alignItems: "center",
764
+ gap: "10px",
765
+ paddingBlock: D("lg"),
766
+ borderRadius: "var(--fu-ucrc-radius-md)"
767
+ }),
768
+ heroTrophy: r({
769
+ ...Ut,
770
+ width: "52px",
771
+ height: "52px",
772
+ borderRadius: "50%",
773
+ backgroundColor: "var(--fu-ucrc-eo-res-tint)"
774
+ }),
775
+ scoreLabel: r({
776
+ ...Re,
777
+ fontSize: "0.65em",
778
+ fontWeight: 700,
779
+ letterSpacing: "0.12em",
780
+ textTransform: "uppercase",
781
+ color: _e
782
+ }),
783
+ score: r({
784
+ ...Re,
785
+ fontSize: "3.5em",
786
+ fontWeight: 900,
787
+ lineHeight: 1,
788
+ color: Ot,
789
+ textShadow: "var(--fu-ucrc-eo-res-glow)",
790
+ animation: `${yo} 0.55s cubic-bezier(0.34,1.56,0.64,1) 0.1s both`
791
+ }),
792
+ rating: r({ ...Re, fontSize: "1em", fontWeight: 600, color: _e }),
793
+ accuracy: r({
794
+ height: "7px",
795
+ borderRadius: "4px",
796
+ overflow: "hidden",
797
+ display: "flex",
798
+ backgroundColor: Zt
799
+ }),
800
+ barCorrect: r({ ...Ht, backgroundColor: St }),
801
+ barWrong: r({ ...Ht, backgroundColor: Ct, transitionDelay: "0.1s" }),
802
+ barMissed: r({ ...Ht, backgroundColor: "var(--fu-ucrc-secondary-container)", transitionDelay: "0.2s" }),
803
+ // Joy Stack spacing={1}.
804
+ chips: r({ display: "flex", "& > :not(style) ~ :not(style)": { marginLeft: "8px" } }),
805
+ chipCorrect: r({ ...Wt, backgroundColor: "var(--fu-ucrc-success-soft-bg)" }),
806
+ chipWrong: r({ ...Wt, backgroundColor: "var(--fu-ucrc-danger-soft-bg)" }),
807
+ chipMissed: r({ ...Wt, backgroundColor: Zt }),
808
+ valueCorrect: r({ ...Gt, color: St }),
809
+ valueWrong: r({ ...Gt, color: Ct }),
810
+ valueMissed: r({ ...Gt, color: _e }),
811
+ labelCorrect: r({ ...jt, color: St }),
812
+ labelWrong: r({ ...jt, color: Ct }),
813
+ labelMissed: r({ ...jt, color: _e }),
814
+ betterThan: r({
815
+ ...Dr,
816
+ borderRadius: "var(--fu-ucrc-radius-md)",
817
+ padding: D("md"),
818
+ display: "flex",
819
+ alignItems: "center",
820
+ gap: "10px"
821
+ }),
822
+ betterThanText: r({ ...Re, fontSize: "0.8em", color: _e, lineHeight: 1.5 }),
823
+ footer: r({ ...ht, flexDirection: "row", justifyContent: "flex-end" }),
824
+ footerLogo: r({ ...ht, flexDirection: "row", justifyContent: "space-between" }),
825
+ footerStacked: r({ ...ht, flexDirection: "column-reverse", justifyContent: "flex-end" }),
826
+ footerStackedLogo: r({ ...ht, flexDirection: "column-reverse", justifyContent: "space-between" }),
827
+ playAgain: r(it, {
828
+ borderRadius: "var(--fu-ucrc-radius-xl)",
829
+ paddingBlock: "10px",
830
+ paddingRight: "12px",
831
+ paddingLeft: "16px",
832
+ backgroundColor: Ot,
833
+ color: Rr,
834
+ alignSelf: "center",
835
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
836
+ "&:hover": { transform: "scale(1.02)" },
837
+ "&:active": { transform: "scale(0.98)" }
838
+ }),
839
+ playAgainLabel: r({ ...zr, color: Rr }),
840
+ // Joy's endDecorator: an 8px gap, the icon at the button's font size.
841
+ decorator: r({ display: "flex", marginLeft: "8px", "--Icon-fontSize": "1em" }),
842
+ // Joy's default solid Button.
843
+ additionalCta: r(it, {
844
+ borderRadius: "var(--fu-ucrc-radius-xl)",
845
+ width: "100%",
846
+ paddingBlock: "10px",
847
+ paddingInline: "16px",
848
+ backgroundColor: "var(--fu-ucrc-primary-solid-bg)",
849
+ color: "#fff",
850
+ "&:hover": { backgroundColor: "var(--fu-ucrc-primary-solid-hover-bg, #185EA5)" },
851
+ "& > div": { display: "flex", justifyContent: "center" },
852
+ "& p": { ...zr, color: "var(--fu-ucrc-palette-text-secondary)" }
853
+ })
854
+ }, Nt = [
855
+ { chip: I.chipCorrect, value: I.valueCorrect, label: I.labelCorrect },
856
+ { chip: I.chipWrong, value: I.valueWrong, label: I.labelWrong },
857
+ { chip: I.chipMissed, value: I.valueMissed, label: I.labelMissed }
858
+ ], xo = { "--Icon-margin": "0 -4px 0 0" }, vo = (e, n, i, s) => {
859
+ if (n === 0)
860
+ return {
861
+ emoji: "🎮",
862
+ message: s("eitherOr.results.practice", "Keep practicing!")
863
+ };
864
+ const a = e / n * 100;
865
+ let d;
866
+ if (a === 100 ? d = {
867
+ emoji: "🏆",
868
+ message: s("eitherOr.results.perfect", "Perfect! Flawless!")
869
+ } : a >= 80 ? d = {
870
+ emoji: "🔥",
871
+ message: s("eitherOr.results.excellent", "Excellent!")
872
+ } : a >= 60 ? d = { emoji: "✨", message: s("eitherOr.results.great", "Great job!") } : a >= 40 ? d = { emoji: "💪", message: s("eitherOr.results.good", "Good try!") } : d = {
873
+ emoji: "📚",
874
+ message: s("eitherOr.results.practice", "Keep practicing!")
875
+ }, i > 0) {
876
+ const o = s("eitherOr.results.livesBonus", { count: i }) || (i === 1 ? "And with 1 life to spare!" : `And with ${i} lives to spare!`);
877
+ d = { ...d, message: `${d.message} ${o}` };
878
+ }
879
+ return d;
880
+ }, yn = ({
881
+ stepInfo: e,
882
+ game: n,
883
+ sdk: i,
884
+ onPlayAgain: s,
885
+ brandingPrimaryColor: a,
886
+ additionalCTA: d
887
+ }) => {
888
+ var A, l, ae, oe, j, se, le, v, Q;
889
+ const { t: o } = ie(), b = Oe(), c = a || b.palette.primary.plainColor, m = b.palette.primary.onPrimary, p = ((l = (A = n == null ? void 0 : n.branding) == null ? void 0 : A.colors) == null ? void 0 : l.contentColor) || b.textColor, w = Le(), g = Pt(), k = ye(c || ""), z = k ? k.replace(/[^\d,]/g, "") : null, P = w ? ((oe = (ae = n == null ? void 0 : n.branding) == null ? void 0 : ae.images) == null ? void 0 : oe.mobileLogo) || ((se = (j = n == null ? void 0 : n.branding) == null ? void 0 : j.images) == null ? void 0 : se.mainLogo) || "" : ((v = (le = n == null ? void 0 : n.branding) == null ? void 0 : le.images) == null ? void 0 : v.mainLogo) || "", [R, M] = S(0), [W, f] = S(null), V = (e == null ? void 0 : e.currentPoints) ?? 0, x = R > 0 && V >= R;
890
+ if (Ce(() => {
891
+ n && (async () => {
892
+ try {
893
+ const _ = await i.miniGames.getMyEitherOrStats(n.id);
894
+ M(_.personalBest ?? 0), f(_.betterThan ?? null);
895
+ } catch {
896
+ }
897
+ })();
898
+ }, [e, n, i]), !e) return null;
899
+ const F = e.steps.filter(($) => $.played), G = F.filter(($) => $.correct === !0).length, E = F.filter(
900
+ ($) => $.correct === !1 && $.userSelection !== null
901
+ ).length, B = F.filter(
902
+ ($) => $.userSelection === null
903
+ ).length, C = F.length, H = vo(
904
+ G,
905
+ C,
906
+ e.currentLives,
907
+ o
908
+ ), y = C > 0 ? G / C * 100 : 0, O = C > 0 ? E / C * 100 : 0, X = C > 0 ? B / C * 100 : 0, ne = {
909
+ "--fu-ucrc-eo-res-primary": c,
910
+ "--fu-ucrc-eo-res-on-primary": m,
911
+ "--fu-ucrc-eo-res-pb-bg": z ? `linear-gradient(135deg, rgba(${z},0.92) 0%, rgba(${z},0.72) 100%)` : `linear-gradient(135deg, ${c}EB 0%, ${c}B8 100%)`,
912
+ "--fu-ucrc-eo-res-tint": z ? `rgba(${z},0.14)` : `${c}24`,
913
+ "--fu-ucrc-eo-res-glow": z ? `0 2px 24px rgba(${z},0.35)` : `0 2px 24px ${c}59`
914
+ }, N = [
915
+ {
916
+ icon: /* @__PURE__ */ t(qt, { size: "1.25em", color: St }),
917
+ value: G,
918
+ label: o("eitherOr.results.correct", "Correct")
919
+ },
920
+ {
921
+ icon: /* @__PURE__ */ t(Kt, { size: "1.25em", color: Ct }),
922
+ value: E,
923
+ label: o("eitherOr.results.wrong", "Wrong")
924
+ },
925
+ {
926
+ icon: /* @__PURE__ */ t(Qn, { size: "1.25em", color: _e }),
927
+ value: B,
928
+ label: o("eitherOr.results.missed", "Missed")
929
+ }
930
+ ];
931
+ return /* @__PURE__ */ u("div", { css: I.root, style: ne, children: [
932
+ x && /* @__PURE__ */ u("div", { css: I.pb, children: [
933
+ /* @__PURE__ */ u("div", { css: I.pbBadge, children: [
934
+ /* @__PURE__ */ t("div", { css: I.pbRing }),
935
+ /* @__PURE__ */ t("div", { css: I.pbTrophy, children: /* @__PURE__ */ t(qe, { size: "1.9em", color: "#fff" }) })
936
+ ] }),
937
+ /* @__PURE__ */ u("div", { css: I.pbText, children: [
938
+ /* @__PURE__ */ u("div", { css: I.pbPill, children: [
939
+ /* @__PURE__ */ t("div", { css: I.pbDot }),
940
+ /* @__PURE__ */ t("p", { css: I.pbPillText, children: o("eitherOr.newRecord", "New Record") })
941
+ ] }),
942
+ /* @__PURE__ */ t("p", { css: I.pbTitle, children: o("eitherOr.personalBestImprovedTitle", "Congratulations!") }),
943
+ /* @__PURE__ */ t("p", { css: I.pbSubtitle, children: o(
944
+ "eitherOr.personalBestImprovedSubtitle",
945
+ "You just broke your personal record!"
946
+ ) })
947
+ ] })
948
+ ] }),
949
+ /* @__PURE__ */ u("div", { css: I.hero, children: [
950
+ /* @__PURE__ */ t("div", { css: I.heroTrophy, children: /* @__PURE__ */ t(qe, { size: "1.75em", color: Ot }) }),
951
+ /* @__PURE__ */ t("p", { css: I.scoreLabel, children: o("eitherOr.yourScore", "Your Score") }),
952
+ /* @__PURE__ */ t("p", { css: I.score, children: e.currentPoints }),
953
+ /* @__PURE__ */ u("p", { css: I.rating, children: [
954
+ H.emoji,
955
+ " ",
956
+ H.message
957
+ ] })
958
+ ] }),
959
+ /* @__PURE__ */ u("div", { css: I.accuracy, children: [
960
+ y > 0 && /* @__PURE__ */ t("div", { css: I.barCorrect, style: { width: `${y}%` } }),
961
+ O > 0 && /* @__PURE__ */ t("div", { css: I.barWrong, style: { width: `${O}%` } }),
962
+ X > 0 && /* @__PURE__ */ t("div", { css: I.barMissed, style: { width: `${X}%` } })
963
+ ] }),
964
+ /* @__PURE__ */ t("div", { css: I.chips, children: N.map(($, _) => /* @__PURE__ */ u("div", { css: Nt[_].chip, children: [
965
+ $.icon,
966
+ /* @__PURE__ */ t("p", { css: Nt[_].value, children: $.value }),
967
+ /* @__PURE__ */ t("p", { css: Nt[_].label, children: $.label })
968
+ ] }, $.label)) }),
969
+ R > 0 && W !== null && W > 0 && /* @__PURE__ */ u("div", { css: I.betterThan, children: [
970
+ /* @__PURE__ */ t(eo, { size: "1.4em", color: Ot }),
971
+ /* @__PURE__ */ t("p", { css: I.betterThanText, children: o("eitherOr.betterThanLabel", {
972
+ points: x ? V : R,
973
+ percentile: W
974
+ }) })
975
+ ] }),
976
+ /* @__PURE__ */ u(
977
+ "div",
978
+ {
979
+ css: g ? P ? I.footerStackedLogo : I.footerStacked : P ? I.footerLogo : I.footer,
980
+ children: [
981
+ /* @__PURE__ */ t(
982
+ me,
983
+ {
984
+ brandingLogo: P,
985
+ textColor: p,
986
+ label: ((Q = n == null ? void 0 : n.labels) == null ? void 0 : Q.sponsor) || null
987
+ }
988
+ ),
989
+ /* @__PURE__ */ u("button", { type: "button", css: I.playAgain, onClick: s, children: [
990
+ /* @__PURE__ */ t("p", { css: I.playAgainLabel, children: o("eitherOr.buttons.playAgain", "Play Again") }),
991
+ /* @__PURE__ */ t("span", { css: I.decorator, children: /* @__PURE__ */ t(rr, { children: /* @__PURE__ */ t(ir, { style: xo }) }) })
992
+ ] })
993
+ ]
994
+ }
995
+ ),
996
+ /* @__PURE__ */ t(Fn, { additionalCTA: d, css: I.additionalCta })
997
+ ] });
998
+ }, So = 150, xn = "var(--fu-ucrc-eo-dist-primary)", Co = "var(--fu-ucrc-eo-dist-text)", ko = "var(--fu-ucrc-eo-dist-glow)", Io = "var(--fu-ucrc-outline-enabled-border)", We = { ...ge, fontFamily: "var(--fu-ucrc-font-primary)", color: Co }, vn = {
999
+ width: "100%",
1000
+ borderRadius: "3px 3px 1px 1px",
1001
+ backgroundColor: "var(--fu-ucrc-eo-dist-dim)",
1002
+ boxShadow: "none",
1003
+ transition: [
1004
+ "height 480ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--fu-ucrc-eo-dist-delay)",
1005
+ "background-color 150ms ease",
1006
+ "box-shadow 150ms ease"
1007
+ ].join(", "),
1008
+ position: "relative",
1009
+ overflow: "hidden"
1010
+ }, Br = { ...vn, backgroundColor: xn, boxShadow: ko }, Yt = {
1011
+ ...We,
1012
+ position: "absolute",
1013
+ left: "var(--fu-ucrc-eo-dist-x)",
1014
+ fontSize: "0.6em",
1015
+ opacity: 0.4,
1016
+ lineHeight: 1,
1017
+ userSelect: "none"
1018
+ }, re = {
1019
+ empty: r({ paddingBlock: D("lg"), textAlign: "center" }),
1020
+ emptyText: r({ ...We, opacity: 0.4, fontSize: "0.875em" }),
1021
+ root: r({
1022
+ width: "100%",
1023
+ boxSizing: "border-box",
1024
+ padding: D("md"),
1025
+ borderRadius: "var(--fu-ucrc-radius-sm)",
1026
+ backdropFilter: "blur(4px)",
1027
+ position: "relative",
1028
+ "&::before": {
1029
+ content: '""',
1030
+ position: "absolute",
1031
+ top: 0,
1032
+ left: 0,
1033
+ right: 0,
1034
+ bottom: 0,
1035
+ backgroundColor: "var(--fu-ucrc-surface-variant)",
1036
+ opacity: 0.5,
1037
+ borderRadius: "inherit",
1038
+ zIndex: 0
1039
+ },
1040
+ "& > *": { position: "relative", zIndex: 1 }
1041
+ }),
1042
+ header: r({
1043
+ display: "flex",
1044
+ justifyContent: "space-between",
1045
+ alignItems: "center",
1046
+ paddingBottom: D("xs"),
1047
+ marginBottom: D("xs"),
1048
+ borderBottom: "1px solid var(--fu-ucrc-eo-dist-dim)"
1049
+ }),
1050
+ title: r({
1051
+ ...We,
1052
+ fontSize: "0.7em",
1053
+ fontWeight: 700,
1054
+ letterSpacing: "0.08em",
1055
+ textTransform: "uppercase"
1056
+ }),
1057
+ total: r({ ...We, fontSize: "0.7em", fontWeight: 500, opacity: 0.6 }),
1058
+ info: r({
1059
+ display: "flex",
1060
+ alignItems: "center",
1061
+ justifyContent: "space-between",
1062
+ paddingInline: D("sm"),
1063
+ paddingBlock: "10px",
1064
+ marginBottom: D("md"),
1065
+ borderRadius: "var(--fu-ucrc-radius-xs)",
1066
+ borderLeft: "3px solid var(--fu-ucrc-eo-dist-info-border)",
1067
+ backgroundColor: "var(--fu-ucrc-eo-dist-info-bg)",
1068
+ transition: "background-color 200ms ease, border-left-color 200ms ease"
1069
+ }),
1070
+ infoText: r({ ...We, fontSize: "0.8em", color: xn, fontWeight: 700, letterSpacing: "0.01em" }),
1071
+ infoCount: r({ ...We, fontSize: "0.75em", fontWeight: 600 }),
1072
+ hint: r({ ...We, fontSize: "0.75em", opacity: 0.4, fontStyle: "italic" }),
1073
+ chart: r({
1074
+ display: "flex",
1075
+ alignItems: "flex-end",
1076
+ gap: "3px",
1077
+ height: `${So}px`,
1078
+ width: "100%"
1079
+ }),
1080
+ column: r({
1081
+ flex: 1,
1082
+ height: "100%",
1083
+ display: "flex",
1084
+ alignItems: "flex-end",
1085
+ cursor: "pointer"
1086
+ }),
1087
+ bar: r(vn),
1088
+ barLit: r(Br),
1089
+ barMe: r({
1090
+ ...Br,
1091
+ "&::after": {
1092
+ content: '""',
1093
+ position: "absolute",
1094
+ top: 0,
1095
+ left: 0,
1096
+ right: 0,
1097
+ height: "45%",
1098
+ background: "linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 100%)"
1099
+ }
1100
+ }),
1101
+ baseline: r({ height: "1px", backgroundColor: Io, marginTop: "1px" }),
1102
+ axis: r({ position: "relative", height: "18px", marginTop: "4px" }),
1103
+ labelFirst: r({ ...Yt, transform: "none" }),
1104
+ labelLast: r({ ...Yt, transform: "translateX(-100%)" }),
1105
+ labelMiddle: r({ ...Yt, transform: "translateX(-50%)" })
1106
+ }, wo = ({
1107
+ breakdown: e,
1108
+ currentPoints: n,
1109
+ primaryColor: i,
1110
+ textColor: s
1111
+ }) => {
1112
+ const { t: a } = ie(), d = Pn(), o = (y) => y.toLocaleString(d), c = Oe().outlineEnabledBorder, m = ye(i), [p, w] = S(null), [g, k] = S(!1);
1113
+ Ce(() => {
1114
+ const y = requestAnimationFrame(() => {
1115
+ setTimeout(() => k(!0), 80);
1116
+ });
1117
+ return () => cancelAnimationFrame(y);
1118
+ }, []);
1119
+ const z = {
1120
+ "--fu-ucrc-eo-dist-primary": i,
1121
+ "--fu-ucrc-eo-dist-text": s,
1122
+ "--fu-ucrc-eo-dist-dim": `rgba(${m}, 0.5)`,
1123
+ "--fu-ucrc-eo-dist-glow": `0 0 10px rgba(${m}, 0.4), 0 0 3px rgba(${m}, 0.2)`
1124
+ };
1125
+ if (!e || e.length === 0)
1126
+ return /* @__PURE__ */ t("div", { css: re.empty, style: z, children: /* @__PURE__ */ t("p", { css: re.emptyText, children: a("eitherOr.standings.noDistribution") }) });
1127
+ const P = e.filter((y) => y.totalUsers > 0), R = Math.max(...P.map((y) => y.totalUsers), 1), M = Math.log(R + 1), W = e.reduce((y, O) => y + O.totalUsers, 0), f = n != null ? e.find(
1128
+ (y) => n >= y.rangeStartInclusive && n <= y.rangeEndInclusive
1129
+ ) ?? null : null, V = f ? P.findIndex(
1130
+ (y) => y.rangeStartInclusive === f.rangeStartInclusive
1131
+ ) : -1, x = p !== null ? P[p] : null, F = x ? `${o(x.rangeStartInclusive)} – ${o(x.rangeEndInclusive)} ${a("eitherOr.standings.pts", "pts")}` : f ? a("eitherOr.standings.yourRange", "Your range: {{start}} – {{end}}", {
1132
+ start: o(f.rangeStartInclusive),
1133
+ end: o(f.rangeEndInclusive)
1134
+ }) : null, G = x ? x.totalUsers : f ? f.totalUsers : null, E = {
1135
+ "--fu-ucrc-eo-dist-info-border": F ? i : c,
1136
+ "--fu-ucrc-eo-dist-info-bg": `rgba(${ye(c)}, ${x ? 0.6 : 0.35})`
1137
+ }, B = 5, C = Math.floor(
1138
+ (P.length - 1) / (B - 1)
1139
+ ), H = new Set(
1140
+ Array.from(
1141
+ { length: B },
1142
+ (y, O) => Math.min(O * C, P.length - 1)
1143
+ )
1144
+ );
1145
+ return /* @__PURE__ */ u("div", { css: re.root, style: z, children: [
1146
+ /* @__PURE__ */ u("div", { css: re.header, children: [
1147
+ /* @__PURE__ */ t("p", { css: re.title, children: a("eitherOr.standings.scoreDistribution", "Score Distribution") }),
1148
+ /* @__PURE__ */ t("p", { css: re.total, children: a("eitherOr.standings.totalUsers", "{{count}} users", {
1149
+ count: W
1150
+ }) })
1151
+ ] }),
1152
+ /* @__PURE__ */ t("div", { css: re.info, style: E, children: F ? /* @__PURE__ */ u(nt, { children: [
1153
+ /* @__PURE__ */ t("p", { css: re.infoText, children: F }),
1154
+ /* @__PURE__ */ t("p", { css: re.infoCount, children: a("eitherOr.standings.totalUsers", "{{count}} users", {
1155
+ count: G ?? 0
1156
+ }) })
1157
+ ] }) : /* @__PURE__ */ t("p", { css: re.hint, children: a("eitherOr.standings.noScoreHint", "Play and score points to see where you rank on this chart") }) }),
1158
+ /* @__PURE__ */ t("div", { css: re.chart, children: P.map((y, O) => {
1159
+ const X = O === V, ne = p === O, N = Math.log(y.totalUsers + 1) / M * 100;
1160
+ return /* @__PURE__ */ t(
1161
+ "div",
1162
+ {
1163
+ css: re.column,
1164
+ onMouseEnter: () => w(O),
1165
+ onMouseLeave: () => w(null),
1166
+ onTouchStart: (A) => {
1167
+ A.preventDefault(), w(O);
1168
+ },
1169
+ onTouchEnd: () => setTimeout(() => w(null), 2e3),
1170
+ children: /* @__PURE__ */ t(
1171
+ "div",
1172
+ {
1173
+ css: X ? re.barMe : ne ? re.barLit : re.bar,
1174
+ style: {
1175
+ height: g ? `${N}%` : "0%",
1176
+ "--fu-ucrc-eo-dist-delay": `${O * 18}ms`
1177
+ }
1178
+ }
1179
+ )
1180
+ },
1181
+ O
1182
+ );
1183
+ }) }),
1184
+ /* @__PURE__ */ t("div", { css: re.baseline }),
1185
+ /* @__PURE__ */ t("div", { css: re.axis, children: P.map((y, O) => {
1186
+ if (!H.has(O)) return null;
1187
+ const X = P.length > 1 ? O / (P.length - 1) * 100 : 0, ne = O === 0, N = O === P.length - 1;
1188
+ return /* @__PURE__ */ t(
1189
+ "p",
1190
+ {
1191
+ css: ne ? re.labelFirst : N ? re.labelLast : re.labelMiddle,
1192
+ style: { "--fu-ucrc-eo-dist-x": `${X}%` },
1193
+ children: o(y.rangeStartInclusive)
1194
+ },
1195
+ O
1196
+ );
1197
+ }) })
1198
+ ] });
1199
+ }, bt = 10, kt = "var(--fu-ucrc-eo-st-primary)", ar = "var(--fu-ucrc-eo-st-text)", Jt = "var(--fu-ucrc-eo-st-on-primary)", sr = "var(--fu-ucrc-font-primary)", Sn = "var(--fu-ucrc-outline-enabled-border)", Cn = "var(--fu-ucrc-surface-variant)", kn = "var(--fu-ucrc-radius-2xl)", To = "calc(6em / 10.5) 0.5em", Vt = "0.5em", $t = { ...ge, fontFamily: sr, color: ar }, Qt = { ...$t, fontSize: "0.875em" }, Er = {
1200
+ flex: 1,
1201
+ display: "flex",
1202
+ alignItems: "center",
1203
+ justifyContent: "center",
1204
+ padding: D("xs"),
1205
+ borderRadius: `calc(${kn} - 3px)`,
1206
+ backgroundColor: Cn,
1207
+ cursor: "pointer",
1208
+ transition: "background-color 220ms ease",
1209
+ userSelect: "none",
1210
+ WebkitTapHighlightColor: "transparent"
1211
+ }, Mr = {
1212
+ ...$t,
1213
+ fontWeight: 500,
1214
+ fontSize: "0.8em",
1215
+ opacity: 0.45,
1216
+ transition: "color 220ms ease, opacity 220ms ease",
1217
+ lineHeight: 1
1218
+ }, Fr = {
1219
+ cursor: "pointer",
1220
+ fontFamily: sr,
1221
+ fontSize: "1.25em",
1222
+ fontWeight: 600,
1223
+ color: kt,
1224
+ paddingInline: "12px",
1225
+ paddingBlock: "6px",
1226
+ borderRadius: "4px",
1227
+ userSelect: "none"
1228
+ }, Ur = {
1229
+ ...Qt,
1230
+ unicodeBidi: "plaintext",
1231
+ fontWeight: 500,
1232
+ overflow: "hidden",
1233
+ textOverflow: "ellipsis",
1234
+ whiteSpace: "nowrap"
1235
+ }, Z = {
1236
+ emptyWrapper: r({
1237
+ display: "flex",
1238
+ alignItems: "center",
1239
+ justifyContent: "center",
1240
+ height: "100%",
1241
+ flex: 1
1242
+ }),
1243
+ // Joy body-lg.
1244
+ empty: r({
1245
+ ...ge,
1246
+ fontFamily: "var(--fu-ucrc-font-secondary)",
1247
+ fontSize: "1.25em",
1248
+ color: ar,
1249
+ textAlign: "center",
1250
+ marginBlock: D("md")
1251
+ }),
1252
+ root: r({
1253
+ display: "flex",
1254
+ flexDirection: "column",
1255
+ gap: D("sm"),
1256
+ padding: D("md")
1257
+ }),
1258
+ tabs: r({
1259
+ display: "flex",
1260
+ borderRadius: kn,
1261
+ padding: "3px",
1262
+ gap: D("xs")
1263
+ }),
1264
+ tab: r(Er),
1265
+ tabActive: r({ ...Er, backgroundColor: kt }),
1266
+ tabLabel: r(Mr),
1267
+ tabLabelActive: r({ ...Mr, fontWeight: 700, color: Jt, opacity: 1 }),
1268
+ title: r({ ...$t, fontWeight: 700, fontSize: "1.5em", textAlign: "center" }),
1269
+ // Joy's Sheet.
1270
+ tableContainer: r({
1271
+ position: "relative",
1272
+ fontFamily: pe,
1273
+ fontSize: "1em",
1274
+ lineHeight: 1.5,
1275
+ color: "var(--fu-ucrc-neutral-plain-color)",
1276
+ backgroundColor: "var(--fu-ucrc-bg-surface)",
1277
+ overflowX: "auto",
1278
+ borderRadius: "var(--fu-ucrc-radius-md)",
1279
+ border: `1px solid ${Sn}`
1280
+ }),
1281
+ nameCell: r({ display: "flex", alignItems: "center", gap: D("sm") }),
1282
+ avatar: r({
1283
+ position: "relative",
1284
+ width: "32px",
1285
+ height: "32px",
1286
+ fontSize: "0.875em",
1287
+ fontWeight: 600,
1288
+ userSelect: "none",
1289
+ backgroundColor: kt,
1290
+ color: Jt
1291
+ }),
1292
+ position: r({ ...Qt, fontWeight: 600 }),
1293
+ name: r(Ur),
1294
+ nameMe: r({ ...Ur, fontWeight: 700, color: kt }),
1295
+ points: r({ ...Qt, fontWeight: 600 }),
1296
+ pagination: r({
1297
+ display: "flex",
1298
+ justifyContent: "center",
1299
+ alignItems: "center",
1300
+ gap: D("sm")
1301
+ }),
1302
+ pageArrow: r(Fr),
1303
+ pageArrowDisabled: r({ ...Fr, cursor: "default", opacity: 0.3 }),
1304
+ pageCount: r({ ...$t, fontSize: "0.75em", opacity: 0.7 })
1305
+ }, _t = {
1306
+ backgroundColor: "var(--fu-ucrc-eo-st-head-bg)",
1307
+ color: ar,
1308
+ fontFamily: sr,
1309
+ fontWeight: 600,
1310
+ fontSize: "0.875em",
1311
+ textAlign: "center",
1312
+ padding: To,
1313
+ borderBottomColor: Sn
1314
+ }, He = {
1315
+ headPosition: { ..._t, width: "10%" },
1316
+ headName: { ..._t, textAlign: "start", width: "80%" },
1317
+ headPoints: { ..._t, width: "10%" },
1318
+ position: { padding: Vt, width: "10%", textAlign: "center" },
1319
+ name: { padding: Vt, width: "80%" },
1320
+ points: { padding: Vt, width: "10%", textAlign: "center" }
1321
+ }, Lo = {
1322
+ backgroundColor: Cn,
1323
+ cursor: "default",
1324
+ fontWeight: 500,
1325
+ color: "var(--fu-ucrc-neutral-outlined-color)"
1326
+ }, Oo = /* @__PURE__ */ t(to, { size: "1em", color: Jt }), In = ({
1327
+ game: e,
1328
+ sdk: n,
1329
+ stepInfo: i,
1330
+ brandingPrimaryColor: s
1331
+ }) => {
1332
+ var N;
1333
+ const { t: a } = ie(), d = at(), o = Oe(), b = ((N = e == null ? void 0 : e.branding) == null ? void 0 : N.colors) || null, c = s || (b == null ? void 0 : b.primaryColor) || o.palette.primary.plainColor, m = (b == null ? void 0 : b.contentColor) || o.textColor, p = Pt(), w = d.colorSchemes.light.palette.primary.onPrimary, [g, k] = S(null), [z, P] = S(!0), [R, M] = S(0), [W, f] = S(null), [V, x] = S("leaderboard"), F = rn(), G = (i == null ? void 0 : i.currentPoints) ?? 0;
1334
+ Ce(() => {
1335
+ (async () => {
1336
+ try {
1337
+ if (!e) return;
1338
+ const [l, ae] = await Promise.all([
1339
+ n.miniGames.getEitherOrResults(e.id, F),
1340
+ n.profile.getOwn().getInfo().catch(() => null)
1341
+ ]), oe = (ae == null ? void 0 : ae.id) ?? null;
1342
+ if (f(oe), oe && l.standings.some(
1343
+ (se) => se.userId === oe
1344
+ )) {
1345
+ k(l);
1346
+ return;
1347
+ }
1348
+ if (G > 0) {
1349
+ const j = [...l.standings], se = {
1350
+ userId: "current",
1351
+ userModel: {
1352
+ id: "current",
1353
+ name: a("common.labels.me", "Me"),
1354
+ nickname: null,
1355
+ avatar: null,
1356
+ anonymous: !0,
1357
+ gender: null,
1358
+ country: null,
1359
+ birthDate: null,
1360
+ verified: !1,
1361
+ staffMember: !1,
1362
+ disabled: !1,
1363
+ interests: [],
1364
+ followingCount: 0,
1365
+ followersCount: 0
1366
+ },
1367
+ personalBest: G.toString()
1368
+ }, le = j.findIndex(
1369
+ (v) => Number.parseInt(v.personalBest) < G
1370
+ );
1371
+ le >= 0 && le < 50 && (j.splice(le, 0, se), l.standings = j);
1372
+ }
1373
+ k(l);
1374
+ } catch {
1375
+ } finally {
1376
+ P(!1);
1377
+ }
1378
+ })();
1379
+ }, [e, n, i, F, G]);
1380
+ const E = {
1381
+ "--fu-ucrc-eo-st-primary": c,
1382
+ "--fu-ucrc-eo-st-text": m,
1383
+ "--fu-ucrc-eo-st-on-primary": w,
1384
+ "--fu-ucrc-eo-st-head-bg": `rgba(${ye(o.surfaceVariant)}, 0.8)`
1385
+ }, B = { backgroundColor: `rgba(${ye(c)}, 0.1)` };
1386
+ if (z)
1387
+ return /* @__PURE__ */ t(Bt, { marginBlock: "80px" });
1388
+ if (!(g != null && g.standings) || g.standings.length === 0)
1389
+ return /* @__PURE__ */ t("div", { css: Z.emptyWrapper, style: E, children: /* @__PURE__ */ t("p", { css: Z.empty, children: a("common.labels.noData", "No standings available yet.") }) });
1390
+ const C = g.standings, H = Math.ceil(C.length / bt), y = C.slice(
1391
+ R * bt,
1392
+ (R + 1) * bt
1393
+ ), O = R > 0, X = R < H - 1, ne = [
1394
+ {
1395
+ id: "leaderboard",
1396
+ label: a("eitherOr.standings.leaderboard", "Leaderboard")
1397
+ },
1398
+ {
1399
+ id: "distribution",
1400
+ label: a("eitherOr.standings.distribution", "Distribution")
1401
+ }
1402
+ ];
1403
+ return /* @__PURE__ */ u("div", { css: Z.root, style: E, children: [
1404
+ /* @__PURE__ */ t("div", { css: Z.tabs, children: ne.map((A) => {
1405
+ const l = V === A.id;
1406
+ return /* @__PURE__ */ t(
1407
+ "div",
1408
+ {
1409
+ onClick: () => x(A.id),
1410
+ css: l ? Z.tabActive : Z.tab,
1411
+ children: /* @__PURE__ */ t("p", { css: l ? Z.tabLabelActive : Z.tabLabel, children: A.label })
1412
+ },
1413
+ A.id
1414
+ );
1415
+ }) }),
1416
+ V === "leaderboard" && /* @__PURE__ */ u(nt, { children: [
1417
+ /* @__PURE__ */ t("p", { css: Z.title, children: a("eitherOr.leaderboard.top50Note", "Top 50") }),
1418
+ /* @__PURE__ */ t("div", { css: Z.tableContainer, children: /* @__PURE__ */ u(Un, { style: Lo, children: [
1419
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ u("tr", { children: [
1420
+ /* @__PURE__ */ t("th", { style: He.headPosition, children: p ? "" : a("eitherOr.leaderboard.position", "#") }),
1421
+ /* @__PURE__ */ t("th", { style: He.headName, children: a("eitherOr.leaderboard.name", "Name") }),
1422
+ /* @__PURE__ */ t("th", { style: He.headPoints, children: p ? "🎯" : a("eitherOr.leaderboard.points", "Pts") })
1423
+ ] }) }),
1424
+ /* @__PURE__ */ t("tbody", { children: y.map((A, l) => {
1425
+ var le, v, Q;
1426
+ const ae = R * bt + l, oe = A.userId === "current" || W !== null && A.userId === W, j = ((le = A.userModel) == null ? void 0 : le.avatar) || void 0, se = ((v = A.userModel) == null ? void 0 : v.nickname) || ((Q = A.userModel) == null ? void 0 : Q.name) || a("common.labels.anonymous", "Anonymous");
1427
+ return /* @__PURE__ */ u(
1428
+ "tr",
1429
+ {
1430
+ style: oe ? B : void 0,
1431
+ children: [
1432
+ /* @__PURE__ */ t("td", { style: He.position, children: /* @__PURE__ */ u("p", { css: Z.position, children: [
1433
+ "#",
1434
+ ae + 1
1435
+ ] }) }),
1436
+ /* @__PURE__ */ t("td", { style: He.name, children: /* @__PURE__ */ u("div", { css: Z.nameCell, children: [
1437
+ /* @__PURE__ */ t(Wn, { src: j, css: Z.avatar, children: Oo }),
1438
+ /* @__PURE__ */ t("p", { css: oe ? Z.nameMe : Z.name, children: oe ? a("common.labels.me", "Me") : se })
1439
+ ] }) }),
1440
+ /* @__PURE__ */ t("td", { style: He.points, children: /* @__PURE__ */ t("p", { css: Z.points, children: A.personalBest }) })
1441
+ ]
1442
+ },
1443
+ `${A.userId}-${ae}`
1444
+ );
1445
+ }) })
1446
+ ] }) }),
1447
+ H > 1 && /* @__PURE__ */ u("div", { css: Z.pagination, children: [
1448
+ /* @__PURE__ */ t(
1449
+ "div",
1450
+ {
1451
+ onClick: () => O && M((A) => A - 1),
1452
+ css: O ? Z.pageArrow : Z.pageArrowDisabled,
1453
+ children: "‹"
1454
+ }
1455
+ ),
1456
+ /* @__PURE__ */ u("p", { css: Z.pageCount, children: [
1457
+ R + 1,
1458
+ " / ",
1459
+ H
1460
+ ] }),
1461
+ /* @__PURE__ */ t(
1462
+ "div",
1463
+ {
1464
+ onClick: () => X && M((A) => A + 1),
1465
+ css: X ? Z.pageArrow : Z.pageArrowDisabled,
1466
+ children: "›"
1467
+ }
1468
+ )
1469
+ ] })
1470
+ ] }),
1471
+ V === "distribution" && /* @__PURE__ */ t(
1472
+ wo,
1473
+ {
1474
+ breakdown: g.breakdown,
1475
+ currentPoints: G > 0 ? G : void 0,
1476
+ primaryColor: c,
1477
+ textColor: m
1478
+ }
1479
+ )
1480
+ ] });
1481
+ }, Wr = {
1482
+ display: "flex",
1483
+ width: "100%",
1484
+ borderRadius: "var(--fu-ucrc-radius-md)",
1485
+ border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-eo-card-border, var(--fu-ucrc-secondary-container))",
1486
+ overflow: "hidden",
1487
+ background: "var(--fu-ucrc-surface)",
1488
+ minHeight: "320px"
1489
+ }, Gr = {
1490
+ row: r({ ...Wr, flexDirection: "row" }),
1491
+ column: r({ ...Wr, flexDirection: "column" })
1492
+ }, De = ({ children: e, brandingBorderColor: n }) => {
1493
+ const i = Le();
1494
+ return /* @__PURE__ */ t(
1495
+ "div",
1496
+ {
1497
+ css: i ? Gr.column : Gr.row,
1498
+ style: n ? { "--fu-ucrc-eo-card-border": n } : void 0,
1499
+ children: e
1500
+ }
1501
+ );
1502
+ }, At = (e) => `var(--fu-ucrc-eo-std-${e})`, It = (e) => `var(--fu-ucrc-space-${e})`, er = "var(--fu-ucrc-neutral-plain-color)", yt = {
1503
+ WebkitTapHighlightColor: "transparent",
1504
+ boxSizing: "border-box",
1505
+ position: "relative",
1506
+ font: "inherit",
1507
+ alignSelf: "stretch",
1508
+ textAlign: "initial",
1509
+ textDecoration: "none",
1510
+ margin: 0,
1511
+ minBlockSize: "36px",
1512
+ minInlineSize: 0,
1513
+ display: "flex",
1514
+ flexDirection: "row",
1515
+ justifyContent: "center",
1516
+ alignItems: "center",
1517
+ flex: "1 1 0%",
1518
+ width: "auto",
1519
+ paddingBlock: It("sm"),
1520
+ paddingInline: It("md"),
1521
+ gap: It("xs"),
1522
+ color: er,
1523
+ backgroundColor: "transparent",
1524
+ border: "1px solid transparent",
1525
+ borderBottomColor: At("tab-line"),
1526
+ borderRadius: 0,
1527
+ opacity: 0.6,
1528
+ cursor: "pointer",
1529
+ "&:focus-visible": { outline: "2px solid var(--fu-ucrc-focus-visible)", outlineOffset: "2px", zIndex: 1 }
1530
+ }, jr = { "&:hover": { backgroundColor: At("tint"), color: "var(--fu-ucrc-neutral-plain-hover-color)" } }, Hr = { backgroundColor: At("tint"), borderBottom: `3px solid ${At("primary")}`, opacity: 1, marginBottom: "-1px" }, Nr = { flex: "0 0 auto", width: "100%" }, Yr = {
1531
+ position: "relative",
1532
+ zIndex: 1,
1533
+ boxSizing: "border-box",
1534
+ display: "flex",
1535
+ margin: 0,
1536
+ padding: "0 0 1px",
1537
+ listStyle: "none",
1538
+ fontSize: "1em",
1539
+ // Joy's divider: the neutral channel at 20% (16% in dark mode).
1540
+ boxShadow: "inset 0 -1px rgba(var(--fu-ucrc-neutral-main-channel) / 0.2)",
1541
+ ".dark &": { boxShadow: "inset 0 -1px rgba(var(--fu-ucrc-neutral-main-channel) / 0.16)" }
1542
+ }, Se = {
1543
+ // Joy's Tabs: body font, 1.5 line height and the neutral colour the panels inherit.
1544
+ tabs: r({
1545
+ position: "relative",
1546
+ display: "flex",
1547
+ flexDirection: "column",
1548
+ width: "100%",
1549
+ fontFamily: pe,
1550
+ fontSize: "1em",
1551
+ lineHeight: 1.5,
1552
+ color: er,
1553
+ borderRadius: "var(--fu-ucrc-radius-md)",
1554
+ backgroundColor: "transparent"
1555
+ }),
1556
+ list: r(Yr, { flexDirection: "row" }),
1557
+ listMobile: r(Yr, { flexDirection: "column" }),
1558
+ tabOff: r(yt, jr),
1559
+ tabOn: r(yt, Hr),
1560
+ tabOffMobile: r(yt, Nr, jr),
1561
+ tabOnMobile: r(yt, Nr, Hr),
1562
+ tabInner: r({ display: "flex", alignItems: "center", gap: It("xs") }),
1563
+ tabLabel: r({
1564
+ ...ge,
1565
+ display: "block",
1566
+ color: "var(--fu-ucrc-palette-text-secondary)",
1567
+ fontFamily: "var(--fu-ucrc-font-primary)",
1568
+ fontSize: "1em",
1569
+ fontWeight: 500,
1570
+ lineHeight: "24px",
1571
+ letterSpacing: "0.4px",
1572
+ textTransform: "uppercase"
1573
+ }),
1574
+ // Joy's TabPanel with the sx's padding, font size and display.
1575
+ panel: r({
1576
+ flexGrow: 1,
1577
+ display: "flex",
1578
+ padding: 0,
1579
+ fontFamily: pe,
1580
+ fontSize: "1em",
1581
+ lineHeight: 1.5,
1582
+ color: er
1583
+ }),
1584
+ content: r({ flex: 1, display: "flex", flexDirection: "column", overflow: "auto" })
1585
+ }, $o = (e) => {
1586
+ var l, ae;
1587
+ const {
1588
+ eitherOr: n,
1589
+ currentPair: i,
1590
+ stepInfo: s,
1591
+ gameState: a,
1592
+ timer: d,
1593
+ selected: o,
1594
+ feedback: b,
1595
+ sdk: c,
1596
+ defaultImagePlaceholderUrl: m,
1597
+ rulesDisplay: p,
1598
+ showStandings: w,
1599
+ additionalCTA: g,
1600
+ onGameStart: k,
1601
+ onSelection: z,
1602
+ onPlayAgain: P,
1603
+ imagePosition: R = "left"
1604
+ } = e, { t: M } = ie(), W = Oe(), f = ((l = n == null ? void 0 : n.branding) == null ? void 0 : l.colors) || null, V = (f == null ? void 0 : f.primaryColor) || W.palette.primary.plainColor, x = W.surfaceTintDim, F = ((ae = ye(x || "")) == null ? void 0 : ae.replace(/[^\d,]/g, "")) ?? null, G = Le(), E = nn(), B = sn(), [C, H] = S(0), [y, O] = S(0), X = ot([]), ne = Rt(
1605
+ {
1606
+ images: n == null ? void 0 : n.images,
1607
+ imagePlaceholder: m || ""
1608
+ },
1609
+ ze.STANDARD
1610
+ ), N = () => {
1611
+ switch (a) {
1612
+ case J.LOADING:
1613
+ return /* @__PURE__ */ t(Bt, { marginBlock: "160px" });
1614
+ case J.TUTORIAL:
1615
+ return /* @__PURE__ */ t(
1616
+ ao,
1617
+ {
1618
+ onStart: k,
1619
+ game: n,
1620
+ showSignInCTA: !1,
1621
+ consents: e.consents,
1622
+ isSubmitting: e.isSubmitting
1623
+ }
1624
+ );
1625
+ case J.PLAYING:
1626
+ return /* @__PURE__ */ t(
1627
+ fo,
1628
+ {
1629
+ currentPair: i,
1630
+ timer: d,
1631
+ maxTime: (n == null ? void 0 : n.time) ?? 10,
1632
+ selected: o,
1633
+ feedback: b,
1634
+ onSelect: z,
1635
+ stepInfo: s,
1636
+ brandingPrimaryColor: (f == null ? void 0 : f.primaryColor) || null,
1637
+ game: n
1638
+ }
1639
+ );
1640
+ case J.RESULTS:
1641
+ return /* @__PURE__ */ t(
1642
+ yn,
1643
+ {
1644
+ stepInfo: s,
1645
+ game: n,
1646
+ sdk: c,
1647
+ onPlayAgain: P,
1648
+ brandingPrimaryColor: (f == null ? void 0 : f.primaryColor) || null,
1649
+ additionalCTA: g
1650
+ }
1651
+ );
1652
+ default:
1653
+ return null;
1654
+ }
1655
+ }, A = a === J.RESULTS;
1656
+ if (A && w) {
1657
+ const oe = {
1658
+ "--fu-ucrc-eo-std-tint": F ? `rgba(${F},0.06)` : `${x}0F`,
1659
+ "--fu-ucrc-eo-std-tab-line": W.secondaryContainer,
1660
+ "--fu-ucrc-eo-std-primary": V
1661
+ }, j = (v) => {
1662
+ var $;
1663
+ const Q = (v + 2) % 2;
1664
+ O(Q), ($ = X.current[Q]) == null || $.focus();
1665
+ }, se = (v) => {
1666
+ const Q = E ? "ArrowLeft" : "ArrowRight", $ = E ? "ArrowRight" : "ArrowLeft", _ = { [Q]: y + 1, [$]: y - 1, Home: 0, End: 1 }[v.key];
1667
+ _ !== void 0 && (v.preventDefault(), j(_));
1668
+ }, le = [
1669
+ { Icon: qe, label: M("eitherOr.tabs.score", "Score") },
1670
+ { Icon: hn, label: M("eitherOr.tabs.standings", "Standings") }
1671
+ ];
1672
+ return /* @__PURE__ */ t(De, { brandingBorderColor: (f == null ? void 0 : f.borderColor) || null, children: /* @__PURE__ */ u("div", { css: Se.tabs, style: oe, children: [
1673
+ /* @__PURE__ */ t(
1674
+ "div",
1675
+ {
1676
+ role: "tablist",
1677
+ "aria-orientation": "horizontal",
1678
+ css: G ? Se.listMobile : Se.list,
1679
+ onKeyDown: se,
1680
+ children: le.map(({ Icon: v, label: Q }, $) => /* @__PURE__ */ t(
1681
+ "button",
1682
+ {
1683
+ ref: (_) => {
1684
+ X.current[$] = _;
1685
+ },
1686
+ type: "button",
1687
+ role: "tab",
1688
+ id: `${B}-tab-${$}`,
1689
+ "aria-selected": $ === C,
1690
+ "aria-controls": `${B}-panel-${$}`,
1691
+ tabIndex: $ === y ? 0 : -1,
1692
+ css: G ? $ === C ? Se.tabOnMobile : Se.tabOffMobile : $ === C ? Se.tabOn : Se.tabOff,
1693
+ onFocus: () => O($),
1694
+ onClick: () => {
1695
+ H($), j($);
1696
+ },
1697
+ children: /* @__PURE__ */ u("div", { css: Se.tabInner, children: [
1698
+ /* @__PURE__ */ t(v, { size: "1.25em", color: $ === C ? void 0 : "var(--fu-ucrc-palette-text-icon)" }),
1699
+ /* @__PURE__ */ t("p", { css: Se.tabLabel, children: Q })
1700
+ ] })
1701
+ },
1702
+ $
1703
+ ))
1704
+ }
1705
+ ),
1706
+ /* @__PURE__ */ t(
1707
+ "div",
1708
+ {
1709
+ role: "tabpanel",
1710
+ id: `${B}-panel-${C}`,
1711
+ "aria-labelledby": `${B}-tab-${C}`,
1712
+ css: Se.panel,
1713
+ children: /* @__PURE__ */ t("div", { css: Se.content, children: C === 0 ? N() : /* @__PURE__ */ t(
1714
+ In,
1715
+ {
1716
+ game: n,
1717
+ sdk: c,
1718
+ stepInfo: s,
1719
+ brandingPrimaryColor: (f == null ? void 0 : f.primaryColor) || null
1720
+ }
1721
+ ) })
1722
+ },
1723
+ C
1724
+ )
1725
+ ] }) });
1726
+ }
1727
+ return A ? /* @__PURE__ */ t(De, { brandingBorderColor: (f == null ? void 0 : f.borderColor) || null, children: /* @__PURE__ */ t("div", { css: Se.content, children: N() }) }) : /* @__PURE__ */ t(De, { brandingBorderColor: (f == null ? void 0 : f.borderColor) || null, children: /* @__PURE__ */ t(
1728
+ Gn,
1729
+ {
1730
+ entity: n,
1731
+ headline: M("eitherOr.headline", "Either/Or"),
1732
+ finalImage: ne,
1733
+ imagePosition: R,
1734
+ rulesDisplay: p,
1735
+ children: N()
1736
+ }
1737
+ ) });
1738
+ }, Ao = () => {
1739
+ const { t: e } = ie();
1740
+ return /* @__PURE__ */ t(De, { brandingBorderColor: null, children: /* @__PURE__ */ t(jn, { title: e("eitherOr.eitherOrNotFound"), message: e("eitherOr.eitherOrNotFoundDescription") }) });
1741
+ }, Po = (e) => {
1742
+ var w, g, k, z, P;
1743
+ const n = ((w = e.eitherOr.branding) == null ? void 0 : w.colors) || null, i = Le(), s = at(), a = Oe(), d = Rt(
1744
+ {
1745
+ images: e.eitherOr.images,
1746
+ imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
1747
+ },
1748
+ ze.STANDARD
1749
+ ), o = (n == null ? void 0 : n.primaryColor) || a.palette.primary.plainColor, b = (n == null ? void 0 : n.contentColor) || a.textColor, c = i ? ((g = e.eitherOr.branding) == null ? void 0 : g.images.mobileLogo) || ((k = e.eitherOr.branding) == null ? void 0 : k.images.mainLogo) || "" : ((z = e.eitherOr.branding) == null ? void 0 : z.images.mainLogo) || "", { t: m } = ie(), p = e.imagePosition || "left";
1750
+ return /* @__PURE__ */ t(De, { brandingBorderColor: (n == null ? void 0 : n.borderColor) || null, children: /* @__PURE__ */ t(
1751
+ Hn,
1752
+ {
1753
+ entity: e.eitherOr,
1754
+ headline: m("eitherOr.headline"),
1755
+ finalImage: d,
1756
+ imagePosition: p,
1757
+ signInContent: /* @__PURE__ */ t(Nn, { signInCTA: e.signInCTA, primaryColor: o, pulse: !0 }),
1758
+ brandingContent: /* @__PURE__ */ t(
1759
+ me,
1760
+ {
1761
+ brandingLogo: c,
1762
+ textColor: i && d ? (n == null ? void 0 : n.contentColor) || s.colorSchemes.dark.textColor : b,
1763
+ label: ((P = e.eitherOr.labels) == null ? void 0 : P.sponsor) || null
1764
+ }
1765
+ ),
1766
+ rulesDisplay: e.rulesDisplay
1767
+ }
1768
+ ) });
1769
+ }, Ro = ({
1770
+ eitherOr: e,
1771
+ imagePosition: n,
1772
+ defaultImagePlaceholderUrl: i,
1773
+ rulesDisplay: s
1774
+ }) => {
1775
+ var m;
1776
+ const { t: a } = ie(), d = ((m = e.branding) == null ? void 0 : m.colors) || null, { brandingLogo: o } = Dt(
1777
+ e.branding || null
1778
+ ), b = (p) => {
1779
+ var w;
1780
+ return /* @__PURE__ */ t(
1781
+ me,
1782
+ {
1783
+ brandingLogo: o,
1784
+ textColor: p,
1785
+ label: ((w = e.labels) == null ? void 0 : w.sponsor) || null
1786
+ }
1787
+ );
1788
+ }, c = {
1789
+ entity: e,
1790
+ headline: a("eitherOr.headline"),
1791
+ tryAgainButtonText: "",
1792
+ isApiError: !1,
1793
+ alertVariant: "neutral",
1794
+ customAlertTitle: a("eitherOr.gameNotAvailable"),
1795
+ customAlertMessage: a("eitherOr.gameNotAvailableDescription"),
1796
+ renderPresentedBy: b
1797
+ };
1798
+ return /* @__PURE__ */ t(De, { brandingBorderColor: (d == null ? void 0 : d.borderColor) || null, children: /* @__PURE__ */ t(
1799
+ cn,
1800
+ {
1801
+ ...c,
1802
+ imagePosition: n || "left",
1803
+ defaultImagePlaceholderUrl: i,
1804
+ rulesDisplay: s
1805
+ }
1806
+ ) });
1807
+ }, Do = (e) => {
1808
+ var d, o, b, c, m, p, w;
1809
+ const { t: n } = ie(), i = ((d = e.eitherOr.branding) == null ? void 0 : d.colors) || null, s = Le() ? ((b = (o = e.eitherOr.branding) == null ? void 0 : o.images) == null ? void 0 : b.mobileLogo) || ((m = (c = e.eitherOr.branding) == null ? void 0 : c.images) == null ? void 0 : m.mainLogo) || "" : ((w = (p = e.eitherOr.branding) == null ? void 0 : p.images) == null ? void 0 : w.mainLogo) || "", a = {
1810
+ ...e.eitherOr,
1811
+ branding: e.eitherOr.branding ? {
1812
+ ...e.eitherOr.branding,
1813
+ colors: e.eitherOr.branding.colors ? { ...e.eitherOr.branding.colors, secondaryColor: void 0 } : null
1814
+ } : null
1815
+ };
1816
+ return /* @__PURE__ */ t(De, { brandingBorderColor: (i == null ? void 0 : i.borderColor) || null, children: /* @__PURE__ */ t(
1817
+ cn,
1818
+ {
1819
+ entity: a,
1820
+ headline: n("eitherOr.headline"),
1821
+ tryAgainButtonText: n("eitherOr.buttons.tryAgain"),
1822
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1823
+ imagePosition: e.imagePosition || "left",
1824
+ isApiError: e.isApiError,
1825
+ toggleTryAgain: e.toggleTryAgain,
1826
+ apiErrorMessage: e.apiErrorMessage,
1827
+ renderPresentedBy: (g) => {
1828
+ var k;
1829
+ return /* @__PURE__ */ t(
1830
+ me,
1831
+ {
1832
+ brandingLogo: s,
1833
+ textColor: g,
1834
+ label: ((k = e.eitherOr.labels) == null ? void 0 : k.sponsor) || null
1835
+ }
1836
+ );
1837
+ },
1838
+ rulesDisplay: e.rulesDisplay
1839
+ }
1840
+ ) });
1841
+ }, wn = ({ isAfterPosition: e = !1, ...n }) => {
1842
+ const { t: i } = ie();
1843
+ return /* @__PURE__ */ t(
1844
+ Yn,
1845
+ {
1846
+ ...n,
1847
+ contentType: "either-or",
1848
+ successCtaLabel: i(e ? "eitherOr.buttons.finish" : "eitherOr.buttons.start")
1849
+ }
1850
+ );
1851
+ }, zo = (e) => {
1852
+ const { t: n } = ie();
1853
+ return /* @__PURE__ */ t(
1854
+ dn,
1855
+ {
1856
+ entity: e.eitherOr,
1857
+ headline: n("eitherOr.headline"),
1858
+ sdk: e.sdk,
1859
+ leads: e.leads,
1860
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1861
+ imagePosition: e.imagePosition,
1862
+ onLeadSubmitted: e.onLeadSubmitted,
1863
+ isSubmitting: e.isSubmitting,
1864
+ MainCard: De,
1865
+ PresentedBy: me,
1866
+ CollectLeadWrapper: wn,
1867
+ consents: e.consents,
1868
+ rulesDisplay: e.rulesDisplay
1869
+ }
1870
+ );
1871
+ }, wt = "var(--fu-ucrc-font-primary)", Ne = "var(--fu-ucrc-text-color)", Ee = "var(--fu-ucrc-eo-ovl-primary)", Tn = "var(--fu-ucrc-eo-ovl-on-primary)", tr = "var(--fu-ucrc-eo-ovl-tint)", Bo = ke({
1872
+ "0%": { transform: "scale(1)" },
1873
+ "50%": { transform: "scale(1.05)" },
1874
+ "100%": { transform: "scale(1)" }
1875
+ }), Eo = ke({
1876
+ "0%": { opacity: 1, transform: "translateY(0)" },
1877
+ "100%": { opacity: 0, transform: "translateY(-20px)" }
1878
+ }), Vr = {
1879
+ backdropFilter: "blur(4px)",
1880
+ position: "relative",
1881
+ "&::before": {
1882
+ content: '""',
1883
+ position: "absolute",
1884
+ top: 0,
1885
+ left: 0,
1886
+ right: 0,
1887
+ bottom: 0,
1888
+ backgroundColor: "var(--fu-ucrc-eo-ovl-content-bg)",
1889
+ opacity: 0.5,
1890
+ borderRadius: "inherit",
1891
+ zIndex: 0
1892
+ },
1893
+ "& > *": { position: "relative", zIndex: 1 }
1894
+ }, Ye = { display: "flex", alignItems: "center", gap: D("md") }, _r = {
1895
+ ...ge,
1896
+ // May be a client-config label.
1897
+ unicodeBidi: "plaintext",
1898
+ fontFamily: wt,
1899
+ fontWeight: 500,
1900
+ fontSize: "0.9375em",
1901
+ lineHeight: "24px",
1902
+ letterSpacing: "0.46px",
1903
+ textTransform: "uppercase",
1904
+ color: Tn,
1905
+ gap: "8px",
1906
+ display: "flex",
1907
+ alignItems: "center"
1908
+ }, qr = { display: "flex", marginLeft: "8px", color: Tn, "--Icon-fontSize": "1em" }, Kr = r(it, {
1909
+ paddingBlock: "10px",
1910
+ paddingRight: "12px",
1911
+ paddingLeft: "16px",
1912
+ borderRadius: "var(--fu-ucrc-eo-ovl-radius-xl)",
1913
+ fontSize: "0.9375em",
1914
+ backgroundColor: Ee,
1915
+ color: "#FFFFFF",
1916
+ animation: `${Bo} 1s infinite`
1917
+ }), xt = {
1918
+ position: "relative",
1919
+ boxSizing: "border-box",
1920
+ display: "flex",
1921
+ flexDirection: "row",
1922
+ justifyContent: "center",
1923
+ alignItems: "center",
1924
+ alignSelf: "stretch",
1925
+ flex: 1,
1926
+ gap: D("xs"),
1927
+ minWidth: 0,
1928
+ minHeight: "36px",
1929
+ margin: 0,
1930
+ paddingBlock: D("sm"),
1931
+ paddingInline: D("md"),
1932
+ border: "1px solid transparent",
1933
+ borderBottom: "1px solid var(--fu-ucrc-secondary-container)",
1934
+ borderRadius: 0,
1935
+ backgroundColor: "transparent",
1936
+ color: "inherit",
1937
+ font: "inherit",
1938
+ textAlign: "start",
1939
+ cursor: "pointer",
1940
+ opacity: "60%",
1941
+ WebkitTapHighlightColor: "transparent",
1942
+ "&:focus-visible": { outline: "2px solid var(--fu-ucrc-focus-visible)", outlineOffset: "2px", zIndex: 1 }
1943
+ }, Xr = {
1944
+ backgroundColor: tr,
1945
+ borderBottom: `3px solid ${Ee}`,
1946
+ opacity: "100%",
1947
+ marginBottom: "-1px"
1948
+ }, Zr = { flex: "0 0 auto", width: "100%" }, Jr = {
1949
+ position: "relative",
1950
+ zIndex: 1,
1951
+ boxSizing: "border-box",
1952
+ display: "flex",
1953
+ paddingBottom: "1px",
1954
+ fontSize: "1em",
1955
+ // Joy's dark divider: the neutral channel at 16%.
1956
+ boxShadow: "inset 0 -1px rgba(var(--fu-ucrc-neutral-main-channel) / 0.16)"
1957
+ }, Qr = { display: "flex" }, en = { height: "20px" }, h = {
1958
+ // No box of its own: only carries the per-instance vars.
1959
+ scope: r({ display: "contents" }),
1960
+ // Tutorial
1961
+ tutorial: r({ display: "flex", flexDirection: "column", gap: D("md") }),
1962
+ steps: r(Vr, {
1963
+ borderRadius: "var(--fu-ucrc-radius-sm)",
1964
+ overflow: "hidden",
1965
+ display: "flex",
1966
+ flexDirection: "column"
1967
+ }),
1968
+ step: r({
1969
+ display: "flex",
1970
+ alignItems: "flex-start",
1971
+ gap: D("md"),
1972
+ paddingInline: D("md"),
1973
+ paddingBlock: D("md")
1974
+ }),
1975
+ stepIcon: r({
1976
+ width: "36px",
1977
+ height: "36px",
1978
+ borderRadius: "50%",
1979
+ backgroundColor: "var(--fu-ucrc-eo-ovl-icon-bg)",
1980
+ color: Ee,
1981
+ display: "flex",
1982
+ alignItems: "center",
1983
+ justifyContent: "center",
1984
+ flexShrink: 0
1985
+ }),
1986
+ stepText: r({ flex: 1, minWidth: 0, paddingTop: "2px" }),
1987
+ stepTitle: r(ge, { fontFamily: wt, fontWeight: 700, fontSize: "0.875em", lineHeight: 1.3, color: Ne }),
1988
+ stepDescription: r(ge, {
1989
+ fontFamily: wt,
1990
+ fontWeight: 400,
1991
+ fontSize: "0.75em",
1992
+ lineHeight: 1.6,
1993
+ color: Ne,
1994
+ opacity: 0.65,
1995
+ marginTop: D("2xs")
1996
+ }),
1997
+ stepDivider: r({
1998
+ height: "1px",
1999
+ marginInline: D("md"),
2000
+ backgroundColor: "var(--fu-ucrc-eo-ovl-step-divider)"
2001
+ }),
2002
+ // Without a sponsor logo the start button sits at the end; mobile stacks the row.
2003
+ startFooter: {
2004
+ logo: r(Ye, { justifyContent: "space-between", flexDirection: "row" }),
2005
+ end: r(Ye, { justifyContent: "flex-end", flexDirection: "row" }),
2006
+ logoMobile: r(Ye, { justifyContent: "space-between", flexDirection: "column-reverse" }),
2007
+ endMobile: r(Ye, { justifyContent: "flex-end", flexDirection: "column-reverse" })
2008
+ },
2009
+ start: Kr,
2010
+ // Busy: Joy kept the brand colour at full opacity and stopped the pulse.
2011
+ startBusy: r(Kr, { animation: "none" }),
2012
+ startLabel: r(_r),
2013
+ // Hidden rather than unmounted, so the button keeps its width while busy.
2014
+ startLabelBusy: r({ ..._r, color: "transparent" }),
2015
+ decorator: r(qr),
2016
+ decoratorBusy: r({ ...qr, visibility: "hidden" }),
2017
+ // Playing
2018
+ main: r({ display: "flex", flexDirection: "column", gap: D("lg") }),
2019
+ timer: r({ display: "flex", justifyContent: "center" }),
2020
+ content: r(Vr, {
2021
+ borderRadius: "var(--fu-ucrc-radius-sm)",
2022
+ padding: D("md"),
2023
+ display: "flex",
2024
+ flexDirection: "column",
2025
+ gap: D("md")
2026
+ }),
2027
+ options: r(Qr, { flexDirection: "row", gap: D("md"), alignItems: "center" }),
2028
+ optionsMobile: r(Qr, { flexDirection: "column", gap: 0, alignItems: "stretch" }),
2029
+ option: r({ flex: 1, minWidth: 0 }),
2030
+ divider: r({ display: "flex", justifyContent: "center", alignItems: "center" }),
2031
+ dividerMobile: r({
2032
+ display: "flex",
2033
+ justifyContent: "center",
2034
+ alignItems: "center",
2035
+ width: "100%",
2036
+ marginBlock: D("3xs")
2037
+ }),
2038
+ dividerCircle: r({
2039
+ borderRadius: "50%",
2040
+ backgroundColor: "var(--fu-ucrc-surface)",
2041
+ width: "32px",
2042
+ height: "32px",
2043
+ minWidth: "32px",
2044
+ border: `1px solid ${Ee}`,
2045
+ display: "flex",
2046
+ alignItems: "center",
2047
+ justifyContent: "center"
2048
+ }),
2049
+ streakRow: r({ marginBottom: D("xs") }),
2050
+ streak: r({ display: "flex", alignItems: "center", gap: "4px" }),
2051
+ streakOn: r({
2052
+ flex: 1,
2053
+ height: "4px",
2054
+ backgroundColor: Ee,
2055
+ borderRadius: "2px",
2056
+ transition: "background-color 0.3s ease"
2057
+ }),
2058
+ streakOff: r({
2059
+ flex: 1,
2060
+ height: "4px",
2061
+ backgroundColor: Ne,
2062
+ borderRadius: "2px",
2063
+ transition: "background-color 0.3s ease"
2064
+ }),
2065
+ multiplier: r(ge, {
2066
+ fontFamily: pe,
2067
+ color: Ee,
2068
+ fontWeight: 700,
2069
+ fontSize: "0.75em",
2070
+ lineHeight: 1,
2071
+ marginLeft: D("2xs"),
2072
+ flexShrink: 0
2073
+ }),
2074
+ stats: r({ display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center" }),
2075
+ // Joy's Stack spacing={1}: 8px before every item but the first.
2076
+ points: r({
2077
+ display: "flex",
2078
+ flexDirection: "row",
2079
+ alignItems: "center",
2080
+ "& > :not(style) ~ :not(style)": { marginLeft: "8px" }
2081
+ }),
2082
+ pointsLabel: r(ge, { fontFamily: pe, fontSize: "1em", color: Ne }),
2083
+ // Joy's h4 level.
2084
+ pointsValue: r({
2085
+ margin: 0,
2086
+ fontFamily: pe,
2087
+ fontWeight: 600,
2088
+ fontSize: "1.25em",
2089
+ lineHeight: 1.5,
2090
+ letterSpacing: "-0.025em",
2091
+ color: Ne,
2092
+ position: "relative"
2093
+ }),
2094
+ pointsAdded: r({
2095
+ position: "absolute",
2096
+ top: "-20px",
2097
+ right: 0,
2098
+ color: "var(--fu-ucrc-eo-ovl-primary)",
2099
+ animation: `${Eo} 1s ease-out forwards`
2100
+ }),
2101
+ sponsor: r(Ye, { justifyContent: "flex-start", flexDirection: "row" }),
2102
+ sponsorMobile: r(Ye, { justifyContent: "center", flexDirection: "column-reverse" }),
2103
+ // Results with standings: Joy's Tabs (body font, 1.5 line height, neutral colour).
2104
+ results: r({ width: "100%" }),
2105
+ tabs: r({
2106
+ position: "relative",
2107
+ display: "flex",
2108
+ flexDirection: "column",
2109
+ width: "100%",
2110
+ borderRadius: "var(--fu-ucrc-radius-md)",
2111
+ backgroundColor: "transparent",
2112
+ fontFamily: pe,
2113
+ fontSize: "1em",
2114
+ lineHeight: 1.5,
2115
+ color: "var(--fu-ucrc-neutral-plain-color)"
2116
+ }),
2117
+ list: r(Jr, { flexDirection: "row" }),
2118
+ listMobile: r(Jr, { flexDirection: "column" }),
2119
+ tab: {
2120
+ off: r(xt, { "&:hover": { backgroundColor: tr } }),
2121
+ on: r(xt, Xr),
2122
+ offMobile: r(xt, Zr, { "&:hover": { backgroundColor: tr } }),
2123
+ onMobile: r(xt, Zr, Xr)
2124
+ },
2125
+ tabContent: r({ display: "flex", alignItems: "center", gap: D("xs") }),
2126
+ tabLabel: r({
2127
+ margin: 0,
2128
+ fontFamily: wt,
2129
+ fontSize: "1em",
2130
+ fontWeight: 500,
2131
+ lineHeight: "24px",
2132
+ letterSpacing: "0.4px",
2133
+ textTransform: "uppercase",
2134
+ color: Ne
2135
+ }),
2136
+ panel: r({ flexGrow: 1, padding: 0, fontSize: "1em", display: "flex" }),
2137
+ panelContent: r({ flex: 1, display: "flex", flexDirection: "column", overflow: "auto" })
2138
+ }, Mo = (e) => {
2139
+ var Je, Qe, pt, cr, dr, ur, fr, gr;
2140
+ const {
2141
+ eitherOr: n,
2142
+ currentPair: i,
2143
+ stepInfo: s,
2144
+ gameState: a,
2145
+ timer: d,
2146
+ selected: o,
2147
+ feedback: b,
2148
+ sdk: c,
2149
+ defaultImagePlaceholderUrl: m,
2150
+ rulesDisplay: p,
2151
+ showStandings: w,
2152
+ additionalCTA: g,
2153
+ consents: k,
2154
+ isSubmitting: z,
2155
+ onGameStart: P,
2156
+ onSelection: R,
2157
+ onPlayAgain: M
2158
+ } = e, W = at(), f = Le(), V = nn(), { t: x } = ie(), [F, G] = S(0), [E, B] = S(0), C = ot([]), H = sn(), [y, O] = S(0), [X, ne] = S(!1), [N, A] = S(0), [l, ae] = S(0), [oe, j] = S(!1), se = ot(0), { brandingImage: le, brandingColors: v } = Dt(n.branding || null), Q = m || (f ? nr : or), $ = Rt({ images: n == null ? void 0 : n.images, imagePlaceholder: Q }, ze.OVERLAY), _ = le || $, xe = on(_), ve = an(ze.OVERLAY), ue = W.colorSchemes.dark, ce = W.colorSchemes.light, ee = (v == null ? void 0 : v.primaryColor) || ce.palette.primary.plainColor, $e = ce.palette.primary.onPrimary, Me = ue.textColor, Be = ue.surfaceTintDim, Ke = ((Je = ye(Be || "")) == null ? void 0 : Je.replace(/[^\d,]/g, "")) ?? null, st = ye(ee || ""), Ae = st ? st.replace(/[^\d,]/g, "") : null, Xe = {
2159
+ "--fu-ucrc-eo-ovl-primary": ee,
2160
+ "--fu-ucrc-eo-ovl-on-primary": $e,
2161
+ "--fu-ucrc-eo-ovl-radius-xl": W.customRadius.light.xl,
2162
+ "--fu-ucrc-eo-ovl-content-bg": (v == null ? void 0 : v.backgroundColor) || ue.surfaceVariant,
2163
+ "--fu-ucrc-eo-ovl-tint": Ke ? `rgba(${Ke},0.06)` : `${Be}0F`,
2164
+ "--fu-ucrc-eo-ovl-icon-bg": Ae ? `rgba(${Ae}, 0.12)` : `${ee}20`,
2165
+ "--fu-ucrc-eo-ovl-step-divider": Ae ? `rgba(${Ae}, 0.1)` : `${ee}1A`,
2166
+ // The busy spinner strokes in on-primary.
2167
+ "--fu-ucrc-primary-on-primary": $e
2168
+ }, lr = Ae ? `rgba(${Ae}, 0.35)` : `${ee}59`;
2169
+ Ce(() => {
2170
+ if (s != null && s.currentPoints && s.currentPoints > y) {
2171
+ A(s.currentPoints - y), ne(!0), ae((q) => q + 1);
2172
+ const U = setTimeout(() => ne(!1), 1e3);
2173
+ return O(s.currentPoints), () => clearTimeout(U);
2174
+ }
2175
+ }, [s == null ? void 0 : s.currentPoints, y]);
2176
+ const Ze = (n == null ? void 0 : n.points) ?? [], Pe = Ze.length >= 2 ? Ze[1].correctSteps - Ze[0].correctSteps : ((Qe = Ze[0]) == null ? void 0 : Qe.correctSteps) || 5;
2177
+ Ce(() => {
2178
+ const U = se.current, q = (s == null ? void 0 : s.currentStreak) ?? 0;
2179
+ if (se.current = q, q > U && q > 0 && q % Pe === 0) {
2180
+ j(!0);
2181
+ const Y = setTimeout(() => j(!1), 500);
2182
+ return () => clearTimeout(Y);
2183
+ }
2184
+ }, [s == null ? void 0 : s.currentStreak, Pe]);
2185
+ const Fe = f ? ((cr = (pt = n.branding) == null ? void 0 : pt.images) == null ? void 0 : cr.mobileLogo) || ((ur = (dr = n.branding) == null ? void 0 : dr.images) == null ? void 0 : ur.mainLogo) || "" : ((gr = (fr = n.branding) == null ? void 0 : fr.images) == null ? void 0 : gr.mainLogo) || "", lt = x("common.labels.point", { count: y }), ct = () => {
2186
+ const U = [], q = (s == null ? void 0 : s.currentLives) ?? 3;
2187
+ for (let Y = 0; Y < q; Y++)
2188
+ U.push(/* @__PURE__ */ t(Tt, { size: "1em", color: Ee, style: en }, `life-${Y}`));
2189
+ for (let Y = q; Y < 3; Y++)
2190
+ U.push(/* @__PURE__ */ t(mn, { size: "1em", color: lr, style: en }, `empty-${Y}`));
2191
+ return U;
2192
+ }, dt = () => {
2193
+ const U = (s == null ? void 0 : s.currentStreak) ?? 0, q = oe ? Pe : U % Pe, he = Math.floor(U / Pe) + 1;
2194
+ return /* @__PURE__ */ u("div", { css: h.streak, children: [
2195
+ Array.from({ length: Pe }, (et, Ue) => /* @__PURE__ */ t("div", { css: Ue < q ? h.streakOn : h.streakOff }, `streak-${Ue}`)),
2196
+ he > 1 && /* @__PURE__ */ u("p", { css: h.multiplier, children: [
2197
+ "×",
2198
+ he
2199
+ ] })
2200
+ ] });
2201
+ }, ut = () => /* @__PURE__ */ t("div", { css: f ? h.dividerMobile : h.divider, children: /* @__PURE__ */ t("div", { css: h.dividerCircle, children: /* @__PURE__ */ t(pn, { size: "1.1em", color: Ee }) }) }), ft = () => {
2202
+ var U;
2203
+ return i ? /* @__PURE__ */ u("div", { css: h.main, children: [
2204
+ /* @__PURE__ */ t("div", { css: h.timer, children: /* @__PURE__ */ t(
2205
+ bn,
2206
+ {
2207
+ time: d,
2208
+ maxTime: (n == null ? void 0 : n.time) ?? 10,
2209
+ brandingPrimaryColor: (v == null ? void 0 : v.primaryColor) || null
2210
+ },
2211
+ `timer-${i.pairId}`
2212
+ ) }),
2213
+ /* @__PURE__ */ u("div", { css: h.content, children: [
2214
+ /* @__PURE__ */ u("div", { css: f ? h.optionsMobile : h.options, children: [
2215
+ /* @__PURE__ */ t("div", { css: h.option, children: /* @__PURE__ */ t(
2216
+ Lt,
2217
+ {
2218
+ option: i.optionOne,
2219
+ selected: o,
2220
+ feedback: b,
2221
+ onSelect: R,
2222
+ pairId: i.pairId,
2223
+ brandingPrimaryColor: (v == null ? void 0 : v.primaryColor) || null,
2224
+ optionIndex: 0
2225
+ }
2226
+ ) }),
2227
+ ut(),
2228
+ /* @__PURE__ */ t("div", { css: h.option, children: /* @__PURE__ */ t(
2229
+ Lt,
2230
+ {
2231
+ option: i.optionTwo,
2232
+ selected: o,
2233
+ feedback: b,
2234
+ onSelect: R,
2235
+ pairId: i.pairId,
2236
+ brandingPrimaryColor: (v == null ? void 0 : v.primaryColor) || null,
2237
+ optionIndex: 1
2238
+ }
2239
+ ) })
2240
+ ] }),
2241
+ /* @__PURE__ */ u("div", { children: [
2242
+ /* @__PURE__ */ t("div", { css: h.streakRow, children: dt() }),
2243
+ /* @__PURE__ */ u("div", { css: h.stats, children: [
2244
+ /* @__PURE__ */ t("div", { children: ct() }),
2245
+ /* @__PURE__ */ u("div", { css: h.points, children: [
2246
+ /* @__PURE__ */ u("p", { css: h.pointsLabel, children: [
2247
+ lt,
2248
+ ":"
2249
+ ] }),
2250
+ /* @__PURE__ */ u("h4", { css: h.pointsValue, children: [
2251
+ y,
2252
+ X && /* @__PURE__ */ u("span", { css: h.pointsAdded, children: [
2253
+ "+",
2254
+ N
2255
+ ] }, l)
2256
+ ] })
2257
+ ] })
2258
+ ] })
2259
+ ] })
2260
+ ] }),
2261
+ Fe && /* @__PURE__ */ t("div", { css: f ? h.sponsorMobile : h.sponsor, children: /* @__PURE__ */ t(
2262
+ me,
2263
+ {
2264
+ brandingLogo: Fe,
2265
+ textColor: Me,
2266
+ label: ((U = n == null ? void 0 : n.labels) == null ? void 0 : U.sponsor) || null,
2267
+ isCentered: f
2268
+ }
2269
+ ) })
2270
+ ] }) : null;
2271
+ }, T = [
2272
+ { Icon: qe, label: x("eitherOr.tabs.score", "Score") },
2273
+ { Icon: hn, label: x("eitherOr.tabs.standings", "Standings") }
2274
+ ], L = (U) => {
2275
+ var Y;
2276
+ const q = (U + T.length) % T.length;
2277
+ B(q), (Y = C.current[q]) == null || Y.focus();
2278
+ }, de = (U) => {
2279
+ const q = V ? "ArrowLeft" : "ArrowRight", Y = V ? "ArrowRight" : "ArrowLeft", he = { [q]: E + 1, [Y]: E - 1, Home: 0, End: T.length - 1 }[U.key];
2280
+ he !== void 0 && (U.preventDefault(), L(he));
2281
+ }, fe = (U) => {
2282
+ var q;
2283
+ G(U), B(U), (q = C.current[U]) == null || q.focus();
2284
+ }, Ie = () => /* @__PURE__ */ t(
2285
+ yn,
2286
+ {
2287
+ stepInfo: s,
2288
+ game: n,
2289
+ sdk: c,
2290
+ onPlayAgain: M,
2291
+ brandingPrimaryColor: (v == null ? void 0 : v.primaryColor) || null,
2292
+ additionalCTA: g
2293
+ }
2294
+ ), je = () => w ? /* @__PURE__ */ t("div", { css: h.results, children: /* @__PURE__ */ u("div", { css: h.tabs, children: [
2295
+ /* @__PURE__ */ t(
2296
+ "div",
2297
+ {
2298
+ role: "tablist",
2299
+ "aria-orientation": "horizontal",
2300
+ css: f ? h.listMobile : h.list,
2301
+ onKeyDown: de,
2302
+ children: T.map(({ Icon: U, label: q }, Y) => {
2303
+ const he = Y === F, et = `${he ? "on" : "off"}${f ? "Mobile" : ""}`;
2304
+ return /* @__PURE__ */ t(
2305
+ "button",
2306
+ {
2307
+ ref: (Ue) => {
2308
+ C.current[Y] = Ue;
2309
+ },
2310
+ type: "button",
2311
+ role: "tab",
2312
+ id: `${H}-tab-${Y}`,
2313
+ "aria-selected": he,
2314
+ "aria-controls": he ? `${H}-panel` : void 0,
2315
+ tabIndex: Y === E ? 0 : -1,
2316
+ css: h.tab[et],
2317
+ onClick: () => fe(Y),
2318
+ onFocus: () => B(Y),
2319
+ children: /* @__PURE__ */ u("div", { css: h.tabContent, children: [
2320
+ /* @__PURE__ */ t(U, { size: "1.25em", color: he ? void 0 : "var(--fu-ucrc-palette-text-icon)" }),
2321
+ /* @__PURE__ */ t("p", { css: h.tabLabel, children: q })
2322
+ ] })
2323
+ },
2324
+ Y
2325
+ );
2326
+ })
2327
+ }
2328
+ ),
2329
+ /* @__PURE__ */ t(
2330
+ "div",
2331
+ {
2332
+ role: "tabpanel",
2333
+ id: `${H}-panel`,
2334
+ "aria-labelledby": `${H}-tab-${F}`,
2335
+ css: h.panel,
2336
+ children: /* @__PURE__ */ t("div", { css: h.panelContent, children: F === 0 ? Ie() : /* @__PURE__ */ t(
2337
+ In,
2338
+ {
2339
+ game: n,
2340
+ sdk: c,
2341
+ stepInfo: s,
2342
+ brandingPrimaryColor: (v == null ? void 0 : v.primaryColor) || null
2343
+ }
2344
+ ) })
2345
+ }
2346
+ )
2347
+ ] }) }) : Ie(), we = () => {
2348
+ var he, et, Ue;
2349
+ const U = (n == null ? void 0 : n.lives) ?? 3, q = [
2350
+ {
2351
+ Icon: gn,
2352
+ title: x("eitherOr.tutorial.step1Title"),
2353
+ description: x("eitherOr.tutorial.step1Description", { seconds: (n == null ? void 0 : n.time) ?? 10 })
2354
+ },
2355
+ {
2356
+ Icon: Tt,
2357
+ title: x("eitherOr.tutorial.step2Title", { lives: U, context: String(U) }),
2358
+ description: x("eitherOr.tutorial.step2Description", { lives: U, context: String(U) })
2359
+ },
2360
+ {
2361
+ Icon: qe,
2362
+ title: x("eitherOr.tutorial.step3Title"),
2363
+ description: x("eitherOr.tutorial.step3Description")
2364
+ }
2365
+ ], Y = `${Fe ? "logo" : "end"}${f ? "Mobile" : ""}`;
2366
+ return /* @__PURE__ */ u("div", { css: h.tutorial, children: [
2367
+ /* @__PURE__ */ t("div", { css: h.steps, children: q.map(({ Icon: Ln, title: On, description: $n }, pr) => /* @__PURE__ */ u("div", { children: [
2368
+ /* @__PURE__ */ u("div", { css: h.step, children: [
2369
+ /* @__PURE__ */ t("div", { css: h.stepIcon, children: /* @__PURE__ */ t(Ln, { size: "1.1em", color: "var(--fu-ucrc-palette-text-icon)" }) }),
2370
+ /* @__PURE__ */ u("div", { css: h.stepText, children: [
2371
+ /* @__PURE__ */ t("p", { css: h.stepTitle, children: On }),
2372
+ /* @__PURE__ */ t("p", { css: h.stepDescription, children: $n })
2373
+ ] })
2374
+ ] }),
2375
+ pr < q.length - 1 && /* @__PURE__ */ t("div", { css: h.stepDivider })
2376
+ ] }, pr)) }),
2377
+ k != null && k.items.length ? /* @__PURE__ */ t("div", { css: h.content, children: /* @__PURE__ */ t(
2378
+ zt,
2379
+ {
2380
+ consents: k,
2381
+ primaryColor: ee,
2382
+ textColor: Me,
2383
+ brandingUrls: (he = n == null ? void 0 : n.branding) == null ? void 0 : he.urls
2384
+ }
2385
+ ) }) : null,
2386
+ /* @__PURE__ */ u("div", { css: h.startFooter[Y], children: [
2387
+ /* @__PURE__ */ t(
2388
+ me,
2389
+ {
2390
+ brandingLogo: Fe,
2391
+ textColor: Me,
2392
+ label: ((et = n == null ? void 0 : n.labels) == null ? void 0 : et.sponsor) || null,
2393
+ isCentered: f
2394
+ }
2395
+ ),
2396
+ /* @__PURE__ */ u(
2397
+ "button",
2398
+ {
2399
+ type: "button",
2400
+ css: z ? h.startBusy : h.start,
2401
+ disabled: z,
2402
+ onClick: P,
2403
+ children: [
2404
+ /* @__PURE__ */ t("p", { css: z ? h.startLabelBusy : h.startLabel, children: ((Ue = k == null ? void 0 : k.labels) == null ? void 0 : Ue.ctaLabel) || x("eitherOr.buttons.start") }),
2405
+ /* @__PURE__ */ t("span", { css: z ? h.decoratorBusy : h.decorator, style: Fo, children: /* @__PURE__ */ t(rr, { children: /* @__PURE__ */ t(ir, {}) }) }),
2406
+ z && /* @__PURE__ */ t(ln, { size: 20, thickness: 3 })
2407
+ ]
2408
+ }
2409
+ )
2410
+ ] })
2411
+ ] });
2412
+ }, gt = () => {
2413
+ switch (a) {
2414
+ case J.LOADING:
2415
+ return /* @__PURE__ */ t(Bt, { marginBlock: "160px" });
2416
+ case J.TUTORIAL:
2417
+ return we();
2418
+ case J.PLAYING:
2419
+ return ft();
2420
+ default:
2421
+ return null;
2422
+ }
2423
+ };
2424
+ return a === J.RESULTS ? /* @__PURE__ */ t(
2425
+ Vn,
2426
+ {
2427
+ entity: n,
2428
+ backgroundImage: xe,
2429
+ imageBackgroundGradient: ve,
2430
+ isWrappedWithScoreStateWrapper: !0,
2431
+ children: /* @__PURE__ */ t("div", { css: h.scope, style: Xe, children: je() })
2432
+ }
2433
+ ) : /* @__PURE__ */ t(_n, { entity: n, headline: x("eitherOr.headline"), finalImage: _, rulesDisplay: p, children: /* @__PURE__ */ t("div", { css: h.scope, style: Xe, children: gt() }) });
2434
+ }, Fo = { "--Icon-margin": "0 -4px 0 0" }, Uo = ke({ "0%": { transform: "scale(1)" }, "50%": { transform: "scale(1.05)" }, "100%": { transform: "scale(1)" } }), tn = r(it, {
2435
+ alignSelf: "center",
2436
+ paddingBlock: "10px",
2437
+ paddingInline: "16px",
2438
+ borderRadius: "var(--fu-ucrc-radius-xl)",
2439
+ backgroundColor: "var(--fu-ucrc-eo-signin-primary)",
2440
+ color: "#FFFFFF",
2441
+ fontSize: "0.9375em",
2442
+ "&:disabled": { opacity: "34%" }
2443
+ }), Te = {
2444
+ root: tn,
2445
+ pulse: r(tn, { animation: `${Uo} 1s infinite` }),
2446
+ label: r({
2447
+ margin: 0,
2448
+ unicodeBidi: "plaintext",
2449
+ fontFamily: "var(--fu-ucrc-font-primary)",
2450
+ fontWeight: 500,
2451
+ fontSize: "0.9375em",
2452
+ lineHeight: "24px",
2453
+ letterSpacing: "0.46px",
2454
+ textTransform: "uppercase",
2455
+ color: "var(--fu-ucrc-primary-on-primary)",
2456
+ gap: "8px",
2457
+ display: "flex",
2458
+ alignItems: "center"
2459
+ })
2460
+ }, Wo = ({
2461
+ signInCTA: e,
2462
+ primaryColor: n
2463
+ }) => {
2464
+ const { t: i } = ie(), s = (e == null ? void 0 : e.defaultLabel) || i("common.signIn"), a = { "--fu-ucrc-eo-signin-primary": n };
2465
+ if (!e)
2466
+ return /* @__PURE__ */ t("button", { type: "button", css: Te.root, style: a, disabled: !0, children: /* @__PURE__ */ t("p", { css: Te.label, children: i("common.signIn") }) });
2467
+ if (e.component) return /* @__PURE__ */ t(nt, { children: e.component });
2468
+ if (e.onClick)
2469
+ return /* @__PURE__ */ t("button", { type: "button", css: Te.pulse, style: a, onClick: e.onClick, children: /* @__PURE__ */ t("p", { css: Te.label, children: s }) });
2470
+ if (e.url) {
2471
+ const d = e.url, o = e.target || "_self";
2472
+ return typeof window > "u" ? /* @__PURE__ */ t("a", { css: Te.pulse, style: a, href: d, target: o, children: /* @__PURE__ */ t("p", { css: Te.label, children: s }) }) : /* @__PURE__ */ t(
2473
+ "button",
2474
+ {
2475
+ type: "button",
2476
+ css: Te.pulse,
2477
+ style: a,
2478
+ onClick: () => {
2479
+ o === "_blank" ? window.open(d, "_blank") : window.location.href = d;
2480
+ },
2481
+ children: /* @__PURE__ */ t("p", { css: Te.label, children: s })
2482
+ }
2483
+ );
2484
+ }
2485
+ return /* @__PURE__ */ t("button", { type: "button", css: Te.root, style: a, disabled: !0, children: /* @__PURE__ */ t("p", { css: Te.label, children: s }) });
2486
+ }, Go = r({ display: "contents" }), jo = (e) => {
2487
+ var z;
2488
+ const n = at(), { t: i } = ie(), s = Le(), a = an(ze.OVERLAY), d = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : s ? nr : or, o = Rt({ images: e.eitherOr.images, imagePlaceholder: d }, ze.OVERLAY), { brandingImage: b, brandingColors: c, brandingLogo: m } = Dt(
2489
+ e.eitherOr.branding || null
2490
+ ), p = b || o, w = n.colorSchemes.light, g = (c == null ? void 0 : c.primaryColor) || w.palette.primary.plainColor, k = {
2491
+ "--fu-ucrc-primary-on-primary": w.palette.primary.onPrimary,
2492
+ "--fu-ucrc-radius-xl": n.customRadius.light.xl
2493
+ };
2494
+ return /* @__PURE__ */ t(
2495
+ qn,
2496
+ {
2497
+ entity: e.eitherOr,
2498
+ headline: i("eitherOr.headline"),
2499
+ backgroundImage: on(p),
2500
+ imageBackgroundGradient: a,
2501
+ signInContent: /* @__PURE__ */ t("div", { css: Go, style: k, children: /* @__PURE__ */ t(Wo, { signInCTA: e.signInCTA, primaryColor: g }) }),
2502
+ brandingContent: /* @__PURE__ */ t(
2503
+ me,
2504
+ {
2505
+ brandingLogo: m,
2506
+ textColor: n.colorSchemes.dark.textColor,
2507
+ label: ((z = e.eitherOr.labels) == null ? void 0 : z.sponsor) || null
2508
+ }
2509
+ ),
2510
+ rulesDisplay: e.rulesDisplay
2511
+ }
2512
+ );
2513
+ }, Ho = (e) => {
2514
+ const { t: n } = ie(), i = Le(), s = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : i ? nr : or, { brandingLogo: a } = Dt(
2515
+ e.eitherOr.branding || null
2516
+ );
2517
+ return /* @__PURE__ */ t(
2518
+ Kn,
2519
+ {
2520
+ entity: e.eitherOr,
2521
+ headline: n("eitherOr.headline"),
2522
+ tryAgainButtonText: n("eitherOr.buttons.tryAgain"),
2523
+ defaultImagePlaceholderUrl: s,
2524
+ isApiError: e.isApiError,
2525
+ apiErrorMessage: e.apiErrorMessage,
2526
+ toggleTryAgain: e.toggleTryAgain,
2527
+ renderPresentedBy: (d) => {
2528
+ var o;
2529
+ return /* @__PURE__ */ t(
2530
+ me,
2531
+ {
2532
+ brandingLogo: a,
2533
+ textColor: d,
2534
+ label: ((o = e.eitherOr.labels) == null ? void 0 : o.sponsor) || null,
2535
+ isCentered: i
2536
+ }
2537
+ );
2538
+ },
2539
+ rulesDisplay: e.rulesDisplay
2540
+ }
2541
+ );
2542
+ }, No = (e) => {
2543
+ const { t: n } = ie();
2544
+ return /* @__PURE__ */ t(
2545
+ un,
2546
+ {
2547
+ entity: e.eitherOr,
2548
+ headline: n("eitherOr.headline"),
2549
+ sdk: e.sdk,
2550
+ leads: e.leads,
2551
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
2552
+ onLeadSubmitted: e.onLeadSubmitted,
2553
+ isSubmitting: e.isSubmitting,
2554
+ PresentedBy: me,
2555
+ CollectLeadWrapper: wn,
2556
+ consents: e.consents,
2557
+ rulesDisplay: e.rulesDisplay
2558
+ }
2559
+ );
2560
+ }, Yo = (e) => {
2561
+ var d, o, b;
2562
+ const { t: n } = ie(), i = ((d = e.eitherOr.branding) == null ? void 0 : d.colors) || null, s = Oe(), a = (i == null ? void 0 : i.primaryColor) || s.palette.primary.plainColor;
2563
+ return /* @__PURE__ */ t(
2564
+ dn,
2565
+ {
2566
+ entity: e.eitherOr,
2567
+ headline: n("eitherOr.headline"),
2568
+ sdk: e.sdk,
2569
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2570
+ imagePosition: e.imagePosition,
2571
+ onLeadSubmitted: e.onSubmit,
2572
+ isSubmitting: e.isSubmitting,
2573
+ MainCard: De,
2574
+ PresentedBy: me,
2575
+ rulesDisplay: e.rulesDisplay,
2576
+ content: /* @__PURE__ */ t(
2577
+ zt,
2578
+ {
2579
+ consents: e.consents,
2580
+ primaryColor: a,
2581
+ brandingUrls: (o = e.eitherOr.branding) == null ? void 0 : o.urls,
2582
+ align: "center"
2583
+ }
2584
+ ),
2585
+ footerAction: /* @__PURE__ */ t(
2586
+ fn,
2587
+ {
2588
+ onClick: e.onSubmit,
2589
+ label: ((b = e.consents.labels) == null ? void 0 : b.ctaLabel) || n("eitherOr.buttons.finish"),
2590
+ isSubmitting: e.isSubmitting,
2591
+ primaryColor: a,
2592
+ showArrow: !0
2593
+ }
2594
+ )
2595
+ }
2596
+ );
2597
+ }, Vo = (e) => {
2598
+ var d, o, b;
2599
+ const { t: n } = ie(), i = at(), s = ((d = e.eitherOr.branding) == null ? void 0 : d.colors) || null, a = (s == null ? void 0 : s.primaryColor) || i.colorSchemes.dark.palette.primary.plainColor;
2600
+ return /* @__PURE__ */ t(
2601
+ un,
2602
+ {
2603
+ entity: e.eitherOr,
2604
+ headline: n("eitherOr.headline"),
2605
+ sdk: e.sdk,
2606
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
2607
+ onLeadSubmitted: e.onSubmit,
2608
+ isSubmitting: e.isSubmitting,
2609
+ PresentedBy: me,
2610
+ rulesDisplay: e.rulesDisplay,
2611
+ content: /* @__PURE__ */ t(
2612
+ zt,
2613
+ {
2614
+ consents: e.consents,
2615
+ primaryColor: a,
2616
+ textColor: (s == null ? void 0 : s.contentColor) || i.colorSchemes.dark.textColor,
2617
+ brandingUrls: (o = e.eitherOr.branding) == null ? void 0 : o.urls
2618
+ }
2619
+ ),
2620
+ footerAction: /* @__PURE__ */ t(
2621
+ fn,
2622
+ {
2623
+ onClick: e.onSubmit,
2624
+ label: ((b = e.consents.labels) == null ? void 0 : b.ctaLabel) || n("eitherOr.buttons.finish"),
2625
+ isSubmitting: e.isSubmitting,
2626
+ primaryColor: a,
2627
+ showArrow: !0
2628
+ }
2629
+ )
2630
+ }
2631
+ );
2632
+ };
2633
+ function Ve(e) {
2634
+ return e.template === ze.STANDARD;
2635
+ }
2636
+ function vt(e) {
2637
+ return e.template === ze.OVERLAY;
2638
+ }
2639
+ const _o = (e) => {
2640
+ var Pe, Fe, lt, ct, dt, ut, ft;
2641
+ const [n, i] = S(
2642
+ J.LOADING
2643
+ ), [s, a] = S(null), [d, o] = S(null), [b, c] = S(10), [m, p] = S(null), [w, g] = S({
2644
+ isCorrect: null,
2645
+ selectedOption: null
2646
+ }), [k, z] = S(!1), [P, R] = S(!1), [M, W] = S(!1), [f, V] = S(""), [x, F] = S(!1), [G, E] = S(!1), [B, C] = S(!1), [H, y] = S(!1), [O, X] = S(!1), [ne, N] = S(!1), A = ot(null), l = ro(e.entityId, e.sdk), {
2647
+ setIsUnauthorized: ae,
2648
+ setIsApiError: oe
2649
+ } = no(e.entityId, e.sdk, k), {
2650
+ pending: j,
2651
+ checked: se,
2652
+ setChecked: le,
2653
+ allRequiredChecked: v,
2654
+ submit: Q
2655
+ } = Rn({
2656
+ sdk: e.sdk,
2657
+ consents: (Pe = e.consents) == null ? void 0 : Pe.items,
2658
+ entityId: e.entityId,
2659
+ entityType: "either_or"
2660
+ }), _ = !!((l == null ? void 0 : l.authRequirement) === "LEAD" ? (Fe = e.leads) == null ? void 0 : Fe.position : void 0) && j.length > 0, xe = mr(
2661
+ () => _ ? [] : j.filter((T) => T.position !== "after"),
2662
+ [_, j]
2663
+ ), ve = mr(
2664
+ () => _ ? [] : j.filter((T) => T.position === "after"),
2665
+ [_, j]
2666
+ ), ue = (T) => {
2667
+ le(T), N(!1);
2668
+ }, ce = (T) => {
2669
+ var L;
2670
+ return {
2671
+ items: T,
2672
+ checked: se,
2673
+ onChange: ue,
2674
+ labels: (L = e.consents) == null ? void 0 : L.labels,
2675
+ showError: ne
2676
+ };
2677
+ };
2678
+ Ce(() => {
2679
+ var T, L;
2680
+ n !== J.RESULTS || !d || (L = (T = e.callbacks) == null ? void 0 : T.onFinish) == null || L.call(T, d);
2681
+ }, [n]), Ce(() => {
2682
+ Dn(e.language || "en");
2683
+ }, [e.language]), Ce(() => {
2684
+ l && l.id && i(J.TUTORIAL);
2685
+ }, [l]);
2686
+ const ee = () => ({
2687
+ onTimerTick: (T) => {
2688
+ c(T);
2689
+ },
2690
+ onElapsedResponse: (T) => {
2691
+ const L = T.steps.find(
2692
+ (fe) => {
2693
+ var Ie;
2694
+ return fe.pairId === ((Ie = A.current) == null ? void 0 : Ie.pairId);
2695
+ }
2696
+ ), de = ((L == null ? void 0 : L.optionOne.value) ?? 0) >= ((L == null ? void 0 : L.optionTwo.value) ?? 0) ? (L == null ? void 0 : L.optionOne.id) ?? null : (L == null ? void 0 : L.optionTwo.id) ?? null;
2697
+ g({
2698
+ isCorrect: !1,
2699
+ selectedOption: null,
2700
+ timedOut: !0,
2701
+ correctOptionId: de
2702
+ }), o(T), setTimeout(() => {
2703
+ var je;
2704
+ const fe = ((je = e.leads) == null ? void 0 : je.position) === "after" && (l == null ? void 0 : l.authRequirement) === "LEAD" && !x;
2705
+ if (T.currentLives === 0) {
2706
+ fe ? E(!0) : i(J.RESULTS);
2707
+ return;
2708
+ }
2709
+ const Ie = T.steps.find((we) => !we.played);
2710
+ Ie ? (a(Ie), p(null), g({ isCorrect: null, selectedOption: null })) : fe ? E(!0) : i(J.RESULTS);
2711
+ }, 1e3);
2712
+ }
2713
+ }), $e = (T) => {
2714
+ console.error("[either-or-play] request failed", T);
2715
+ const { code: L, message: de } = zn(T, e.sdk);
2716
+ L === 401 || L === 403 ? R(!0) : (W(!0), V(de));
2717
+ }, Me = tt(async () => {
2718
+ var T;
2719
+ if (!B) {
2720
+ if (xe.length > 0 && !v(xe)) {
2721
+ N(!0);
2722
+ return;
2723
+ }
2724
+ C(!0);
2725
+ try {
2726
+ if (xe.length > 0 && await Q(xe), (l == null ? void 0 : l.authRequirement) === "LEAD" && ((T = e.leads) == null ? void 0 : T.position) === "before" && !x) {
2727
+ E(!0);
2728
+ return;
2729
+ }
2730
+ const L = await e.sdk.miniGames.participateInEitherOr(
2731
+ e.entityId,
2732
+ null,
2733
+ ee()
2734
+ );
2735
+ c((l == null ? void 0 : l.time) ?? 10), o(L), a(L.steps.find((de) => !de.played) || null), i(J.PLAYING);
2736
+ } catch (L) {
2737
+ console.error("Failed to start game:", L), $e(L);
2738
+ } finally {
2739
+ C(!1);
2740
+ }
2741
+ }
2742
+ }, [
2743
+ e.entityId,
2744
+ e.sdk,
2745
+ (lt = e.leads) == null ? void 0 : lt.position,
2746
+ l == null ? void 0 : l.authRequirement,
2747
+ l == null ? void 0 : l.time,
2748
+ x,
2749
+ xe,
2750
+ B
2751
+ ]);
2752
+ A.current = s;
2753
+ const Be = tt(
2754
+ async (T, L) => {
2755
+ if (!m) {
2756
+ p(L);
2757
+ try {
2758
+ const de = await e.sdk.miniGames.participateInEitherOr(
2759
+ e.entityId,
2760
+ { pair: T, answer: L },
2761
+ ee()
2762
+ ), fe = de.steps.find(
2763
+ (we) => we.pairId === T
2764
+ ), Ie = (fe == null ? void 0 : fe.correct) ?? !1, je = Ie ? null : [fe == null ? void 0 : fe.optionOne.id, fe == null ? void 0 : fe.optionTwo.id].find(
2765
+ (we) => we !== L
2766
+ ) ?? null;
2767
+ g({ isCorrect: Ie, selectedOption: L, correctOptionId: je }), o(de), setTimeout(() => {
2768
+ var Qe;
2769
+ const we = ((Qe = e.leads) == null ? void 0 : Qe.position) === "after" && (l == null ? void 0 : l.authRequirement) === "LEAD" && !x, gt = ve.length > 0 && !O;
2770
+ if (de.currentLives === 0) {
2771
+ gt ? y(!0) : we ? E(!0) : i(J.RESULTS);
2772
+ return;
2773
+ }
2774
+ const Je = de.steps.find((pt) => !pt.played);
2775
+ Je ? (a(Je), p(null), g({ isCorrect: null, selectedOption: null })) : gt ? y(!0) : we ? E(!0) : i(J.RESULTS);
2776
+ }, 1e3);
2777
+ } catch (de) {
2778
+ console.error("Failed to submit answer:", de), p(null), $e(de);
2779
+ }
2780
+ }
2781
+ },
2782
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- buildCallbacks/handleError are rebuilt every render
2783
+ [
2784
+ e.entityId,
2785
+ e.sdk,
2786
+ m,
2787
+ l == null ? void 0 : l.authRequirement,
2788
+ (ct = e.leads) == null ? void 0 : ct.position,
2789
+ x,
2790
+ ve,
2791
+ O
2792
+ ]
2793
+ ), Ke = tt(async () => {
2794
+ var T;
2795
+ if (F(!0), ((T = e.leads) == null ? void 0 : T.position) === "before") {
2796
+ C(!0);
2797
+ try {
2798
+ const L = await e.sdk.miniGames.participateInEitherOr(
2799
+ e.entityId,
2800
+ null,
2801
+ ee()
2802
+ );
2803
+ c((l == null ? void 0 : l.time) ?? 10), o(L), a(L.steps.find((de) => !de.played) || null), E(!1), C(!1), i(J.PLAYING);
2804
+ } catch (L) {
2805
+ C(!1), E(!1), $e(L);
2806
+ }
2807
+ } else
2808
+ E(!1), C(!1), i(J.RESULTS);
2809
+ }, [(dt = e.leads) == null ? void 0 : dt.position, e.entityId, e.sdk, l == null ? void 0 : l.time]), st = tt(async () => {
2810
+ if (!v(ve)) {
2811
+ N(!0);
2812
+ return;
2813
+ }
2814
+ C(!0), await Q(ve), X(!0), C(!1), y(!1), i(J.RESULTS);
2815
+ }, [ve, v, Q]), Ae = tt(() => {
2816
+ i(J.TUTORIAL), a(null), o(null), c((l == null ? void 0 : l.time) ?? 10), p(null), g({ isCorrect: null, selectedOption: null }), F(!1), E(!1), y(!1), N(!1);
2817
+ }, [l == null ? void 0 : l.time]), Xe = () => {
2818
+ W(!1), R(!1), V(""), oe(!1), ae(!1), z(!k), i(J.TUTORIAL), a(null), o(null), p(null), g({ isCorrect: null, selectedOption: null }), F(!1), E(!1), y(!1), N(!1);
2819
+ };
2820
+ if (!l)
2821
+ return /* @__PURE__ */ t(Bt, { marginBlock: "160px" });
2822
+ if (!l.id)
2823
+ return /* @__PURE__ */ t(Ao, {});
2824
+ if (l.status !== "ACTIVE")
2825
+ return /* @__PURE__ */ t(
2826
+ Ro,
2827
+ {
2828
+ eitherOr: l,
2829
+ template: e.template,
2830
+ imagePosition: Ve(e) ? e.imagePosition : void 0,
2831
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2832
+ rulesDisplay: e.rulesDisplay
2833
+ }
2834
+ );
2835
+ if (l.authRequirement === "REGISTERED" && !e.userIsLoggedIn)
2836
+ return Ve(e) ? /* @__PURE__ */ t(
2837
+ Po,
2838
+ {
2839
+ eitherOr: l,
2840
+ imagePosition: e.imagePosition,
2841
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2842
+ signInCTA: e.signInCTA,
2843
+ rulesDisplay: e.rulesDisplay
2844
+ }
2845
+ ) : vt(e) ? /* @__PURE__ */ t(
2846
+ jo,
2847
+ {
2848
+ eitherOr: l,
2849
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2850
+ signInCTA: e.signInCTA,
2851
+ rulesDisplay: e.rulesDisplay
2852
+ }
2853
+ ) : /* @__PURE__ */ t(nt, {});
2854
+ if (P || M)
2855
+ return vt(e) ? /* @__PURE__ */ t(
2856
+ Ho,
2857
+ {
2858
+ eitherOr: l,
2859
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2860
+ isApiError: M,
2861
+ apiErrorMessage: f,
2862
+ toggleTryAgain: Xe,
2863
+ rulesDisplay: e.rulesDisplay
2864
+ }
2865
+ ) : /* @__PURE__ */ t(
2866
+ Do,
2867
+ {
2868
+ eitherOr: l,
2869
+ imagePosition: Ve(e) ? e.imagePosition : void 0,
2870
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2871
+ isApiError: M,
2872
+ apiErrorMessage: f,
2873
+ toggleTryAgain: Xe,
2874
+ rulesDisplay: e.rulesDisplay
2875
+ }
2876
+ );
2877
+ if (H && ve.length > 0) {
2878
+ const T = {
2879
+ eitherOr: l,
2880
+ sdk: e.sdk,
2881
+ consents: ce(ve),
2882
+ onSubmit: st,
2883
+ isSubmitting: B,
2884
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2885
+ rulesDisplay: e.rulesDisplay
2886
+ };
2887
+ return Ve(e) ? /* @__PURE__ */ t(
2888
+ Yo,
2889
+ {
2890
+ ...T,
2891
+ imagePosition: e.imagePosition
2892
+ }
2893
+ ) : /* @__PURE__ */ t(Vo, { ...T });
2894
+ }
2895
+ if (G && l.authRequirement === "LEAD" && (((ut = e.leads) == null ? void 0 : ut.position) === "after" || ((ft = e.leads) == null ? void 0 : ft.position) === "before")) {
2896
+ if (Ve(e))
2897
+ return /* @__PURE__ */ t(
2898
+ zo,
2899
+ {
2900
+ eitherOr: l,
2901
+ sdk: e.sdk,
2902
+ leads: e.leads,
2903
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2904
+ onLeadSubmitted: Ke,
2905
+ imagePosition: e.imagePosition,
2906
+ isSubmitting: B,
2907
+ rulesDisplay: e.rulesDisplay,
2908
+ consents: _ ? j : void 0
2909
+ }
2910
+ );
2911
+ if (vt(e))
2912
+ return /* @__PURE__ */ t(
2913
+ No,
2914
+ {
2915
+ eitherOr: l,
2916
+ sdk: e.sdk,
2917
+ leads: e.leads,
2918
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2919
+ onLeadSubmitted: Ke,
2920
+ isSubmitting: B,
2921
+ rulesDisplay: e.rulesDisplay,
2922
+ consents: _ ? j : void 0
2923
+ }
2924
+ );
2925
+ }
2926
+ return Ve(e) ? /* @__PURE__ */ t(
2927
+ $o,
2928
+ {
2929
+ eitherOr: l,
2930
+ currentPair: s,
2931
+ stepInfo: d,
2932
+ gameState: n,
2933
+ timer: b,
2934
+ selected: m,
2935
+ feedback: w,
2936
+ sdk: e.sdk,
2937
+ leads: e.leads,
2938
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2939
+ rulesDisplay: e.rulesDisplay,
2940
+ showStandings: e.showStandings,
2941
+ additionalCTA: e.additionalCTA,
2942
+ imagePosition: e.imagePosition,
2943
+ consents: ce(xe),
2944
+ isSubmitting: B,
2945
+ onGameStart: Me,
2946
+ onSelection: Be,
2947
+ onPlayAgain: Ae
2948
+ }
2949
+ ) : vt(e) ? /* @__PURE__ */ t(
2950
+ Mo,
2951
+ {
2952
+ eitherOr: l,
2953
+ currentPair: s,
2954
+ stepInfo: d,
2955
+ gameState: n,
2956
+ timer: b,
2957
+ selected: m,
2958
+ feedback: w,
2959
+ sdk: e.sdk,
2960
+ leads: e.leads,
2961
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2962
+ rulesDisplay: e.rulesDisplay,
2963
+ showStandings: e.showStandings,
2964
+ additionalCTA: e.additionalCTA,
2965
+ consents: ce(xe),
2966
+ isSubmitting: B,
2967
+ onGameStart: Me,
2968
+ onSelection: Be,
2969
+ onPlayAgain: Ae
2970
+ }
2971
+ ) : /* @__PURE__ */ t(nt, {});
2972
+ }, qo = (e) => {
2973
+ var i;
2974
+ const n = Bn.useMemo(
2975
+ () => e.template === ze.OVERLAY ? { ...e.themeOptions, mode: "dark" } : e.themeOptions,
2976
+ [e.template, e.themeOptions]
2977
+ );
2978
+ return /* @__PURE__ */ t(
2979
+ Xn,
2980
+ {
2981
+ packageName: "either-or-play",
2982
+ language: e.language,
2983
+ themeOptions: n,
2984
+ disableCache: e.disableCache,
2985
+ leadPhoneCountryCode: (i = e.leads) == null ? void 0 : i.phoneCountryCode,
2986
+ children: e.children
2987
+ }
2988
+ );
2989
+ }, ni = (e) => /* @__PURE__ */ t(qo, { ...e, children: /* @__PURE__ */ t(_o, { ...e }) });
2990
+ export {
2991
+ ni as M
2992
+ };