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