fansunited-frontend-components 1.0.1 → 1.1.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.
- package/BattleOfFans.d.ts +4 -0
- package/BattleOfFans.d.ts.map +1 -0
- package/BattleOfFans.js +1867 -0
- package/Betslip.js +1 -1
- package/ChanceGame.js +1 -1
- package/ClassicQuizPlay.js +1 -1
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +1 -1
- package/CompetitorCard.js +1105 -1154
- package/Discussion.js +1 -1
- package/EitherOrPlay.js +1 -1
- package/EventCard.js +1 -1
- package/EventGamePlay.js +1 -1
- package/Leaderboard.js +1 -1
- package/List.js +1 -1
- package/MatchQuizPlay.js +1 -1
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +1 -1
- package/PickThePair.js +1 -1
- package/PlayerOfTheMatch.js +1 -1
- package/PollVote.js +1 -1
- package/Predictor.js +1 -1
- package/README.md +93 -0
- package/Standings.js +1 -1
- package/TopX.js +1 -1
- package/chunks/{withVersionStamp-BPvy9XSs.js → withVersionStamp-Cck3fT4t.js} +1 -1
- package/components.d.ts +2 -1
- package/components.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +29 -27
- package/package.json +10 -2
package/BattleOfFans.js
ADDED
|
@@ -0,0 +1,1867 @@
|
|
|
1
|
+
import { jsx as l, Fragment as Wt, jsxs as b } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { space as at, radius as lt, LeadForm as Pn, Notification as Ln, WidgetPortal as Tn } from "fansunited-frontend-core/ui/emotion";
|
|
3
|
+
import en, { useState as T, useRef as on, useEffect as Ft, useMemo as j, useCallback as At } from "react";
|
|
4
|
+
import { useTranslation as mt } from "react-i18next";
|
|
5
|
+
import { useDisableCache as Nn, extractSdkError as xt, getSportsApiCredentials as Dn, hexColor as rn, fetchSearchEntitiesByIds as Bn, contrastRatio as pt, standsOut as Ct, cdnAssets as zn, initialsOf as Mn, useIsRtl as Rt, useIntlLocale as sn, useIsMobile as Vn, useColors as Hn, stripHtmlTags as An } from "fansunited-frontend-core";
|
|
6
|
+
import { a as an, u as jn, O as _n } from "./chunks/OddsSkeleton-DP5Yfqpr.js";
|
|
7
|
+
import { keyframes as ot, css as d } from "@emotion/react";
|
|
8
|
+
import { EmojiEventsIcon as Gn, CheckIcon as qn, LockOutlinedIcon as Un } from "fansunited-frontend-core/ui/icons";
|
|
9
|
+
import "fansunited-sdk-esm/enums";
|
|
10
|
+
import { w as Yn } from "./chunks/withVersionStamp-Cck3fT4t.js";
|
|
11
|
+
const s = (t, n = 16) => `${Math.round(t / n * 1e4) / 1e4}em`, i = {
|
|
12
|
+
fontPrimary: "var(--fu-ucrc-font-primary)",
|
|
13
|
+
fontSecondary: "var(--fu-ucrc-font-secondary)",
|
|
14
|
+
surface: "var(--fu-ucrc-surface)",
|
|
15
|
+
/** The neutral inner surface: countdown boxes, the ended pill, the losing side. */
|
|
16
|
+
inner: "var(--fu-ucrc-on-surface)",
|
|
17
|
+
track: "var(--fu-ucrc-surface-variant)",
|
|
18
|
+
text: "var(--fu-ucrc-text-primary)",
|
|
19
|
+
dim: "color-mix(in srgb, var(--fu-ucrc-text-primary) 62%, transparent)",
|
|
20
|
+
border: "var(--fu-ucrc-outline-enabled-border)",
|
|
21
|
+
borderSize: "var(--fu-ucrc-border-size)",
|
|
22
|
+
focus: "var(--fu-ucrc-primary-plain-color)",
|
|
23
|
+
/** The theme's shadow colour (Joy shadow-sm). */
|
|
24
|
+
shadow: "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))",
|
|
25
|
+
trophy: "var(--fu-ucrc-warning-plain-color)",
|
|
26
|
+
trophyOn: "var(--bof-trophy-on)",
|
|
27
|
+
spaceXs: at("xs"),
|
|
28
|
+
spaceSm: at("sm"),
|
|
29
|
+
spaceMd: at("md"),
|
|
30
|
+
spaceLg: at("lg"),
|
|
31
|
+
radiusSm: lt("sm"),
|
|
32
|
+
radiusMd: lt("md"),
|
|
33
|
+
radiusLg: lt("lg"),
|
|
34
|
+
radiusFull: lt("full"),
|
|
35
|
+
fill: "var(--bof-fill)",
|
|
36
|
+
on: "var(--bof-on)",
|
|
37
|
+
ink: "var(--bof-ink)",
|
|
38
|
+
/** The side colour mixed into the card, at `--bof-tint`. */
|
|
39
|
+
tint: "color-mix(in srgb, var(--bof-fill) var(--bof-tint), var(--fu-ucrc-surface))"
|
|
40
|
+
}, et = {
|
|
41
|
+
logo: "drop-shadow(0 3px 6px rgba(0,0,0,0.18))",
|
|
42
|
+
winnerLogo: "drop-shadow(0 8px 14px rgba(0,0,0,0.35))",
|
|
43
|
+
winnerHeadshot: "0 10px 22px -10px rgba(0,0,0,0.5)",
|
|
44
|
+
trophy: "0 4px 10px -3px rgba(0,0,0,0.45)"
|
|
45
|
+
}, Xn = "@media (prefers-reduced-motion: reduce)", Z = {
|
|
46
|
+
pad: 24,
|
|
47
|
+
arenaBar: 238,
|
|
48
|
+
arenaFill: 324,
|
|
49
|
+
colPad: [24, 24],
|
|
50
|
+
colGap: 12,
|
|
51
|
+
imgSlot: 88,
|
|
52
|
+
img: 80,
|
|
53
|
+
name: [20, 26],
|
|
54
|
+
btnH: 48,
|
|
55
|
+
btnFont: 16,
|
|
56
|
+
pctBar: [34, 40],
|
|
57
|
+
pctFill: [36, 42],
|
|
58
|
+
bar: 12,
|
|
59
|
+
barGap: 4,
|
|
60
|
+
labelsGap: 16,
|
|
61
|
+
caption: [12, 16],
|
|
62
|
+
winWrap: 112,
|
|
63
|
+
winImg: 108,
|
|
64
|
+
rays: 440,
|
|
65
|
+
eyebrow: [13, 18],
|
|
66
|
+
winName: [30, 36],
|
|
67
|
+
winPct: [56, 60],
|
|
68
|
+
loserSlot: 60,
|
|
69
|
+
loserImg: 52,
|
|
70
|
+
loserName: [16, 22],
|
|
71
|
+
loserPct: [28, 34],
|
|
72
|
+
trophy: 40,
|
|
73
|
+
trophyRing: 3,
|
|
74
|
+
slant: 4
|
|
75
|
+
}, tt = {
|
|
76
|
+
pad: 16,
|
|
77
|
+
arenaBar: 196,
|
|
78
|
+
arenaFill: 264,
|
|
79
|
+
colPad: [16, 12],
|
|
80
|
+
colGap: 10,
|
|
81
|
+
imgSlot: 60,
|
|
82
|
+
img: 56,
|
|
83
|
+
name: [15, 20],
|
|
84
|
+
btnH: 44,
|
|
85
|
+
btnFont: 15,
|
|
86
|
+
pctBar: [28, 34],
|
|
87
|
+
pctFill: [28, 34],
|
|
88
|
+
bar: 10,
|
|
89
|
+
barGap: 3,
|
|
90
|
+
labelsGap: 8,
|
|
91
|
+
caption: [11, 14],
|
|
92
|
+
winWrap: 72,
|
|
93
|
+
winImg: 70,
|
|
94
|
+
rays: 250,
|
|
95
|
+
eyebrow: [11, 14],
|
|
96
|
+
winName: [18, 24],
|
|
97
|
+
winPct: [40, 44],
|
|
98
|
+
loserSlot: 44,
|
|
99
|
+
loserImg: 38,
|
|
100
|
+
loserName: [13, 18],
|
|
101
|
+
loserPct: [22, 28],
|
|
102
|
+
trophy: 28,
|
|
103
|
+
trophyRing: 2,
|
|
104
|
+
slant: 3
|
|
105
|
+
}, kt = 76, I = ([t, n]) => ({
|
|
106
|
+
fontSize: s(t),
|
|
107
|
+
lineHeight: n / t
|
|
108
|
+
}), St = ot({
|
|
109
|
+
"0%, 100%": { opacity: 1 },
|
|
110
|
+
"50%": { opacity: 0.45 }
|
|
111
|
+
}), jt = {
|
|
112
|
+
margin: 0,
|
|
113
|
+
fontFamily: i.fontPrimary,
|
|
114
|
+
fontWeight: 700,
|
|
115
|
+
letterSpacing: "-0.01em"
|
|
116
|
+
}, _t = (t, n) => ({
|
|
117
|
+
root: d({
|
|
118
|
+
fontSize: "1em",
|
|
119
|
+
boxSizing: "border-box",
|
|
120
|
+
width: "100%",
|
|
121
|
+
display: "flex",
|
|
122
|
+
flexDirection: "column",
|
|
123
|
+
overflow: "hidden",
|
|
124
|
+
color: i.text,
|
|
125
|
+
fontFamily: i.fontSecondary,
|
|
126
|
+
backgroundColor: i.surface,
|
|
127
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
128
|
+
borderRadius: i.radiusLg,
|
|
129
|
+
boxShadow: `0 1px 2px 0 ${i.shadow}, 0 2px 4px 0 ${i.shadow}`,
|
|
130
|
+
"--bof-tint": "10%",
|
|
131
|
+
".dark &": { "--bof-tint": "26%" },
|
|
132
|
+
[Xn]: {
|
|
133
|
+
"& *, & *::before, & *::after": {
|
|
134
|
+
animation: "none !important",
|
|
135
|
+
transition: "none !important"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
body: d({
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
gap: n ? i.spaceMd : i.spaceLg,
|
|
143
|
+
padding: n ? i.spaceMd : i.spaceLg
|
|
144
|
+
}),
|
|
145
|
+
header: d(
|
|
146
|
+
n ? { display: "flex", flexDirection: "column", gap: s(12) } : {
|
|
147
|
+
display: "flex",
|
|
148
|
+
alignItems: "flex-start",
|
|
149
|
+
justifyContent: "space-between",
|
|
150
|
+
gap: i.spaceLg,
|
|
151
|
+
minHeight: s(90)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
titles: d({
|
|
155
|
+
display: "flex",
|
|
156
|
+
flexDirection: "column",
|
|
157
|
+
gap: s(n ? 2 : 4),
|
|
158
|
+
minWidth: 0
|
|
159
|
+
}),
|
|
160
|
+
// Title and open subtitle can be poll (CMS) text, in any language.
|
|
161
|
+
title: d({
|
|
162
|
+
...jt,
|
|
163
|
+
unicodeBidi: "plaintext",
|
|
164
|
+
...I(n ? [22, 28] : [28, 34])
|
|
165
|
+
}),
|
|
166
|
+
// Every subtitle sits in one grid cell, so the header is as tall as the longest in every state.
|
|
167
|
+
subtitles: d({ display: "grid" }),
|
|
168
|
+
subtitle: d({
|
|
169
|
+
gridArea: "1 / 1",
|
|
170
|
+
margin: 0,
|
|
171
|
+
color: i.dim,
|
|
172
|
+
unicodeBidi: "plaintext",
|
|
173
|
+
...I(n ? [14, 20] : [15, 22])
|
|
174
|
+
}),
|
|
175
|
+
subtitleHidden: d({
|
|
176
|
+
gridArea: "1 / 1",
|
|
177
|
+
margin: 0,
|
|
178
|
+
visibility: "hidden",
|
|
179
|
+
...I(n ? [14, 20] : [15, 22])
|
|
180
|
+
}),
|
|
181
|
+
// Mobile: the countdown (or the ended note) sits in a bordered box under the title.
|
|
182
|
+
status: d({
|
|
183
|
+
minHeight: s(58),
|
|
184
|
+
boxSizing: "border-box",
|
|
185
|
+
padding: `${s(10)} ${s(14)}`,
|
|
186
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
187
|
+
borderRadius: i.radiusSm,
|
|
188
|
+
display: "flex",
|
|
189
|
+
alignItems: "center",
|
|
190
|
+
justifyContent: "center"
|
|
191
|
+
}),
|
|
192
|
+
pill: d({
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
whiteSpace: "nowrap",
|
|
196
|
+
fontWeight: 500,
|
|
197
|
+
...I([14, 20]),
|
|
198
|
+
...n ? {} : {
|
|
199
|
+
height: s(36, 14),
|
|
200
|
+
padding: `0 ${s(14, 14)}`,
|
|
201
|
+
borderRadius: i.radiusFull,
|
|
202
|
+
backgroundColor: i.inner
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
arenaSkeleton: d({
|
|
206
|
+
borderRadius: i.radiusMd,
|
|
207
|
+
backgroundColor: i.inner,
|
|
208
|
+
animation: `${St} 1.5s ease-in-out infinite`
|
|
209
|
+
}),
|
|
210
|
+
resultsSkeleton: d({
|
|
211
|
+
height: s(t.pctBar[1] + (n ? 8 : 10) + t.bar),
|
|
212
|
+
display: "flex",
|
|
213
|
+
flexDirection: "column",
|
|
214
|
+
justifyContent: "flex-end"
|
|
215
|
+
}),
|
|
216
|
+
// Where the odds strip goes while it loads: the strip's own framed padding and top border.
|
|
217
|
+
oddsSlot: d({
|
|
218
|
+
paddingInline: n ? "0.625em" : "0.75em",
|
|
219
|
+
paddingBlock: "0.625em",
|
|
220
|
+
borderBlockStart: `1px solid ${i.border}`
|
|
221
|
+
}),
|
|
222
|
+
barSkeleton: d({
|
|
223
|
+
height: s(t.bar),
|
|
224
|
+
borderRadius: i.radiusFull,
|
|
225
|
+
backgroundColor: i.track,
|
|
226
|
+
animation: `${St} 1.5s ease-in-out infinite`
|
|
227
|
+
}),
|
|
228
|
+
titleSkeleton: d({
|
|
229
|
+
width: s(n ? 170 : 220),
|
|
230
|
+
height: s(n ? 28 : 34),
|
|
231
|
+
borderRadius: i.radiusSm,
|
|
232
|
+
backgroundColor: i.inner,
|
|
233
|
+
animation: `${St} 1.5s ease-in-out infinite`
|
|
234
|
+
}),
|
|
235
|
+
message: d({
|
|
236
|
+
display: "flex",
|
|
237
|
+
flexDirection: "column",
|
|
238
|
+
alignItems: "center",
|
|
239
|
+
justifyContent: "center",
|
|
240
|
+
gap: s(8),
|
|
241
|
+
textAlign: "center",
|
|
242
|
+
borderRadius: i.radiusMd,
|
|
243
|
+
backgroundColor: i.inner,
|
|
244
|
+
padding: i.spaceLg,
|
|
245
|
+
boxSizing: "border-box"
|
|
246
|
+
}),
|
|
247
|
+
messageTitle: d({ ...jt, ...I([18, 24]) }),
|
|
248
|
+
messageText: d({ margin: 0, color: i.dim, ...I([14, 20]) }),
|
|
249
|
+
retry: d({
|
|
250
|
+
marginTop: s(8, 15),
|
|
251
|
+
height: s(40, 15),
|
|
252
|
+
padding: `0 ${s(20, 15)}`,
|
|
253
|
+
border: `${i.borderSize} solid ${i.border}`,
|
|
254
|
+
borderRadius: i.radiusSm,
|
|
255
|
+
background: i.surface,
|
|
256
|
+
color: i.text,
|
|
257
|
+
font: "inherit",
|
|
258
|
+
fontWeight: 700,
|
|
259
|
+
fontSize: s(15),
|
|
260
|
+
cursor: "pointer",
|
|
261
|
+
"&:focus-visible": {
|
|
262
|
+
outline: `2px solid ${i.focus}`,
|
|
263
|
+
outlineOffset: "2px"
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
}), Gt = (t) => ({
|
|
267
|
+
root: d(
|
|
268
|
+
t ? {
|
|
269
|
+
width: "100%",
|
|
270
|
+
display: "flex",
|
|
271
|
+
alignItems: "center",
|
|
272
|
+
justifyContent: "space-between",
|
|
273
|
+
gap: s(12)
|
|
274
|
+
} : {
|
|
275
|
+
display: "flex",
|
|
276
|
+
flexDirection: "column",
|
|
277
|
+
alignItems: "flex-end",
|
|
278
|
+
gap: s(8)
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
label: d({
|
|
282
|
+
fontWeight: 500,
|
|
283
|
+
...I(t ? [12, 16] : [13, 18]),
|
|
284
|
+
...t ? { maxWidth: s(96, 12) } : {}
|
|
285
|
+
}),
|
|
286
|
+
units: d({
|
|
287
|
+
display: "flex",
|
|
288
|
+
alignItems: "flex-start",
|
|
289
|
+
gap: s(t ? 14 : 8)
|
|
290
|
+
}),
|
|
291
|
+
unit: d({
|
|
292
|
+
display: "flex",
|
|
293
|
+
flexDirection: "column",
|
|
294
|
+
alignItems: "center",
|
|
295
|
+
gap: s(t ? 1 : 6)
|
|
296
|
+
}),
|
|
297
|
+
value: d({
|
|
298
|
+
fontFamily: i.fontPrimary,
|
|
299
|
+
fontWeight: 700,
|
|
300
|
+
fontVariantNumeric: "tabular-nums",
|
|
301
|
+
...t ? I([18, 22]) : {
|
|
302
|
+
fontSize: s(20),
|
|
303
|
+
lineHeight: 1,
|
|
304
|
+
width: s(44, 20),
|
|
305
|
+
height: s(44, 20),
|
|
306
|
+
display: "flex",
|
|
307
|
+
alignItems: "center",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
borderRadius: i.radiusSm,
|
|
310
|
+
backgroundColor: i.inner
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
caption: d({
|
|
314
|
+
textTransform: "uppercase",
|
|
315
|
+
letterSpacing: "0.05em",
|
|
316
|
+
color: i.dim,
|
|
317
|
+
...I(t ? [10, 14] : [11, 14])
|
|
318
|
+
}),
|
|
319
|
+
colon: d({
|
|
320
|
+
height: s(44, 20),
|
|
321
|
+
display: "flex",
|
|
322
|
+
alignItems: "center",
|
|
323
|
+
fontFamily: i.fontPrimary,
|
|
324
|
+
fontWeight: 700,
|
|
325
|
+
fontSize: s(20),
|
|
326
|
+
color: i.dim
|
|
327
|
+
})
|
|
328
|
+
}), y = { d: _t(Z, !1), m: _t(tt, !0) }, q = { d: Gt(!1), m: Gt(!0) }, Kn = "battle-of-fans", Jn = "voting_ends_at", qt = { team: "team", player: "player" }, Qn = (t) => {
|
|
329
|
+
var r;
|
|
330
|
+
const n = (((r = t.context) == null ? void 0 : r.tags) ?? []).filter(
|
|
331
|
+
(o) => !!(o != null && o.id) && !!qt[(o.type ?? "").toLowerCase()]
|
|
332
|
+
), e = t.options ?? [];
|
|
333
|
+
return n.length !== e.length && console.warn(
|
|
334
|
+
`BattleOfFans: poll ${t.id} has ${e.length} options and ${n.length} team/player tags; using the first ${Math.min(n.length, e.length)}.`
|
|
335
|
+
), e.slice(0, n.length).map((o, a) => ({
|
|
336
|
+
optionId: o.id,
|
|
337
|
+
entityId: n[a].id,
|
|
338
|
+
kind: qt[n[a].type.toLowerCase()],
|
|
339
|
+
title: o.title ?? ""
|
|
340
|
+
}));
|
|
341
|
+
}, Zn = (t) => t.split("-")[0].toUpperCase(), te = (t, n) => {
|
|
342
|
+
var o, a;
|
|
343
|
+
if (!t) return null;
|
|
344
|
+
const e = Zn(n);
|
|
345
|
+
return (((a = (o = t.translations) == null ? void 0 : o.find(
|
|
346
|
+
(u) => {
|
|
347
|
+
var m;
|
|
348
|
+
return ((m = u.language) == null ? void 0 : m.toUpperCase()) === e;
|
|
349
|
+
}
|
|
350
|
+
)) == null ? void 0 : a.name) ?? t.name ?? "").trim() || null;
|
|
351
|
+
}, ne = (t, n) => {
|
|
352
|
+
var e, r;
|
|
353
|
+
return ((r = (e = t == null ? void 0 : t.assets) == null ? void 0 : e.find((o) => o.key === (n === "team" ? "LOGO" : "HEADSHOT"))) == null ? void 0 : r.value) ?? null;
|
|
354
|
+
}, ln = (t) => {
|
|
355
|
+
var n, e;
|
|
356
|
+
return ((e = (n = t == null ? void 0 : t.related) == null ? void 0 : n.find((r) => {
|
|
357
|
+
var o;
|
|
358
|
+
return ((o = r.relationship) == null ? void 0 : o.toUpperCase()) === "TEAM";
|
|
359
|
+
})) == null ? void 0 : e.related_id) ?? null;
|
|
360
|
+
}, ee = (t, n) => {
|
|
361
|
+
var r;
|
|
362
|
+
const e = (r = t == null ? void 0 : t.metadata) == null ? void 0 : r.branding;
|
|
363
|
+
return [
|
|
364
|
+
e == null ? void 0 : e.primary_color,
|
|
365
|
+
e == null ? void 0 : e.secondary_color,
|
|
366
|
+
e == null ? void 0 : e.tertiary_color
|
|
367
|
+
].map((o) => n(o)).filter((o) => !!o);
|
|
368
|
+
}, oe = (t, n, e, r) => t.map((o) => {
|
|
369
|
+
const a = n.get(o.entityId), u = o.kind === "player" ? n.get(ln(a) ?? "") : a;
|
|
370
|
+
return {
|
|
371
|
+
...o,
|
|
372
|
+
name: te(a, e) ?? o.title,
|
|
373
|
+
image: ne(a, o.kind),
|
|
374
|
+
brand: ee(u, r)
|
|
375
|
+
};
|
|
376
|
+
}), re = (t) => {
|
|
377
|
+
const n = t.reduce((u, m) => u + Math.max(0, m), 0);
|
|
378
|
+
if (n === 0) return t.map(() => 0);
|
|
379
|
+
const e = t.map((u) => Math.max(0, u) / n * 100), r = e.map(Math.floor);
|
|
380
|
+
let o = 100 - r.reduce((u, m) => u + m, 0);
|
|
381
|
+
const a = e.map((u, m) => ({ i: m, rest: u - Math.floor(u) })).sort((u, m) => m.rest - u.rest || u.i - m.i);
|
|
382
|
+
for (const { i: u } of a) {
|
|
383
|
+
if (o <= 0) break;
|
|
384
|
+
r[u] += 1, o -= 1;
|
|
385
|
+
}
|
|
386
|
+
return r;
|
|
387
|
+
}, ie = (t) => {
|
|
388
|
+
const n = Math.max(...t);
|
|
389
|
+
return n > 0 && t.filter((r) => r === n).length === 1 ? t.indexOf(n) : null;
|
|
390
|
+
}, se = (t) => {
|
|
391
|
+
if (!t) return null;
|
|
392
|
+
const n = Date.parse(t);
|
|
393
|
+
return Number.isNaN(n) ? null : n;
|
|
394
|
+
}, ae = (t, n) => {
|
|
395
|
+
const e = Math.max(0, Math.floor((t - n) / 1e3));
|
|
396
|
+
return {
|
|
397
|
+
days: Math.floor(e / 86400),
|
|
398
|
+
hours: Math.floor(e % 86400 / 3600),
|
|
399
|
+
minutes: Math.floor(e % 3600 / 60),
|
|
400
|
+
seconds: e % 60
|
|
401
|
+
};
|
|
402
|
+
}, le = [401, 403, 404], ce = async (t, n, e, r) => {
|
|
403
|
+
const o = /* @__PURE__ */ new Map(), a = Dn(t);
|
|
404
|
+
if (!a) return o;
|
|
405
|
+
const u = async (c) => {
|
|
406
|
+
if (!c.length) return;
|
|
407
|
+
(await Bn(
|
|
408
|
+
a,
|
|
409
|
+
c,
|
|
410
|
+
{
|
|
411
|
+
signal: e,
|
|
412
|
+
disableCache: r,
|
|
413
|
+
partial: !0
|
|
414
|
+
}
|
|
415
|
+
).catch(() => [])).forEach((p) => p.id && o.set(p.id, p));
|
|
416
|
+
};
|
|
417
|
+
await u(n.map((c) => c.entityId));
|
|
418
|
+
const m = n.filter((c) => c.kind === "player").map((c) => ln(o.get(c.entityId))).filter((c) => !!c && !o.has(c));
|
|
419
|
+
return await u(m), o;
|
|
420
|
+
}, de = (t) => {
|
|
421
|
+
var n;
|
|
422
|
+
return t != null && t.id ? ((n = t.optionIds) == null ? void 0 : n[0]) ?? t.optionId ?? null : null;
|
|
423
|
+
}, ue = (t) => {
|
|
424
|
+
var z;
|
|
425
|
+
const { entityId: n, sdk: e, language: r, userIsLoggedIn: o } = t, a = Nn(), [u, m] = T("loading"), [c, f] = T(null), [p, h] = T(0), [R, P] = T(!1), [U, E] = T(!1), [_, $] = T(null), k = on(t.callbacks);
|
|
426
|
+
k.current = t.callbacks, Ft(() => {
|
|
427
|
+
const C = new AbortController();
|
|
428
|
+
let S = !1;
|
|
429
|
+
return m("loading"), E(!1), (async () => {
|
|
430
|
+
let x;
|
|
431
|
+
try {
|
|
432
|
+
x = await e.voting.getPollById(n, a);
|
|
433
|
+
} catch (V) {
|
|
434
|
+
if (S) return;
|
|
435
|
+
m(
|
|
436
|
+
xt(V, e).code === 404 ? "notFound" : "error"
|
|
437
|
+
);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const w = x != null && x.id && (x.type ?? "").toLowerCase() === Kn ? Qn(x) : [];
|
|
441
|
+
if (w.length < 2) {
|
|
442
|
+
S || m("notFound");
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const Y = x.authRequirement === "REGISTERED" && !o ? Promise.resolve(null) : e.voting.getMyPollVote(n).catch((V) => {
|
|
446
|
+
if (le.includes(xt(V, e).code))
|
|
447
|
+
return null;
|
|
448
|
+
throw V;
|
|
449
|
+
});
|
|
450
|
+
try {
|
|
451
|
+
const [V, nt] = await Promise.all([
|
|
452
|
+
Y,
|
|
453
|
+
ce(e, w, C.signal, a)
|
|
454
|
+
]);
|
|
455
|
+
if (S) return;
|
|
456
|
+
f({
|
|
457
|
+
poll: x,
|
|
458
|
+
refs: w,
|
|
459
|
+
entities: nt,
|
|
460
|
+
votedOptionId: de(V)
|
|
461
|
+
}), m("ready");
|
|
462
|
+
} catch {
|
|
463
|
+
S || m("error");
|
|
464
|
+
}
|
|
465
|
+
})(), () => {
|
|
466
|
+
S = !0, C.abort();
|
|
467
|
+
};
|
|
468
|
+
}, [n, e, a, o, p]);
|
|
469
|
+
const rt = j(
|
|
470
|
+
() => c ? oe(c.refs, c.entities, r, rn) : [],
|
|
471
|
+
[c, r]
|
|
472
|
+
), O = j(
|
|
473
|
+
() => c ? c.refs.map(
|
|
474
|
+
(C) => {
|
|
475
|
+
var S;
|
|
476
|
+
return ((S = c.poll.options.find((M) => M.id === C.optionId)) == null ? void 0 : S.votes) ?? 0;
|
|
477
|
+
}
|
|
478
|
+
) : [],
|
|
479
|
+
[c]
|
|
480
|
+
), G = At(
|
|
481
|
+
async (C) => {
|
|
482
|
+
var S, M;
|
|
483
|
+
if (!(!c || R || c.votedOptionId)) {
|
|
484
|
+
P(!0);
|
|
485
|
+
try {
|
|
486
|
+
const x = await e.voting.voteForPoll(n, C);
|
|
487
|
+
f(
|
|
488
|
+
(w) => w && {
|
|
489
|
+
...w,
|
|
490
|
+
votedOptionId: C,
|
|
491
|
+
poll: {
|
|
492
|
+
...w.poll,
|
|
493
|
+
totalVotes: (w.poll.totalVotes ?? 0) + 1,
|
|
494
|
+
options: w.poll.options.map(
|
|
495
|
+
(L) => L.id === C ? { ...L, votes: (L.votes ?? 0) + 1 } : L
|
|
496
|
+
)
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
), (M = (S = k.current) == null ? void 0 : S.onFinish) == null || M.call(S, x);
|
|
500
|
+
} catch (x) {
|
|
501
|
+
const { code: w, message: L } = xt(x, e);
|
|
502
|
+
w === 401 || w === 403 ? E(!0) : $(L);
|
|
503
|
+
} finally {
|
|
504
|
+
P(!1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
[n, e, c, R]
|
|
509
|
+
), ft = At(() => {
|
|
510
|
+
e.voting.getPollById(n, a).then(
|
|
511
|
+
(C) => f(
|
|
512
|
+
(S) => S && (C != null && C.id) ? { ...S, poll: C } : S
|
|
513
|
+
)
|
|
514
|
+
).catch(() => {
|
|
515
|
+
});
|
|
516
|
+
}, [n, e, a]), B = (c == null ? void 0 : c.poll) ?? null;
|
|
517
|
+
return {
|
|
518
|
+
status: u,
|
|
519
|
+
poll: B,
|
|
520
|
+
sides: rt,
|
|
521
|
+
votes: O,
|
|
522
|
+
votedOptionId: (c == null ? void 0 : c.votedOptionId) ?? null,
|
|
523
|
+
endMs: se((z = B == null ? void 0 : B.customFields) == null ? void 0 : z[Jn]),
|
|
524
|
+
signInRequired: U || (B == null ? void 0 : B.authRequirement) === "REGISTERED" && !o,
|
|
525
|
+
submitting: R,
|
|
526
|
+
voteError: _,
|
|
527
|
+
clearVoteError: () => $(null),
|
|
528
|
+
vote: G,
|
|
529
|
+
retry: () => h((C) => C + 1),
|
|
530
|
+
refresh: ft
|
|
531
|
+
};
|
|
532
|
+
}, pe = (t) => {
|
|
533
|
+
const { t: n } = mt("common");
|
|
534
|
+
return j(
|
|
535
|
+
() => (e, r) => {
|
|
536
|
+
const o = t == null ? void 0 : t[e];
|
|
537
|
+
return typeof o == "string" && o.trim() ? o : n(`battleOfFans.${e}`, r ?? {});
|
|
538
|
+
},
|
|
539
|
+
[t, n]
|
|
540
|
+
);
|
|
541
|
+
}, me = (t) => {
|
|
542
|
+
const [n, e] = T(() => Date.now()), r = t !== null && n >= t;
|
|
543
|
+
return Ft(() => {
|
|
544
|
+
if (t === null || r) return;
|
|
545
|
+
const o = setInterval(() => e(Date.now()), 1e3);
|
|
546
|
+
return () => clearInterval(o);
|
|
547
|
+
}, [t, r]), n;
|
|
548
|
+
}, Ut = (t) => {
|
|
549
|
+
const n = rn(t);
|
|
550
|
+
if (!n) return null;
|
|
551
|
+
const [e, r, o] = [1, 3, 5].map(
|
|
552
|
+
(c) => parseInt(n.slice(c, c + 2), 16) / 255
|
|
553
|
+
), a = Math.max(e, r, o), u = a - Math.min(e, r, o);
|
|
554
|
+
return u < 0.12 ? null : ((a === e ? (r - o) / u % 6 : a === r ? (o - e) / u + 2 : (e - r) / u + 4) * 60 + 360) % 360;
|
|
555
|
+
}, J = (t, n) => {
|
|
556
|
+
if (!Ct(t, n)) return !0;
|
|
557
|
+
const e = Ut(t), r = Ut(n);
|
|
558
|
+
if (e === null || r === null) return (pt(t, n) ?? 1) < 2;
|
|
559
|
+
const o = Math.abs(e - r);
|
|
560
|
+
return Math.min(o, 360 - o) < 35;
|
|
561
|
+
}, fe = (t, n) => {
|
|
562
|
+
const e = [n.primary, n.text, ...n.extras], r = t.map(
|
|
563
|
+
(a) => a.filter((u) => Ct(u, n.surface))
|
|
564
|
+
), o = r.map(
|
|
565
|
+
(a, u) => a[0] ?? e[u % e.length]
|
|
566
|
+
);
|
|
567
|
+
for (let a = 1; a < o.length; a += 1) {
|
|
568
|
+
const u = o.slice(0, a);
|
|
569
|
+
if (!u.some((p) => J(p, o[a]))) continue;
|
|
570
|
+
const m = r[a].slice(1).find((p) => !u.some((h) => J(h, p)));
|
|
571
|
+
if (m) {
|
|
572
|
+
o[a] = m;
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
let c = !1;
|
|
576
|
+
for (let p = 0; p < a && !c; p += 1) {
|
|
577
|
+
if (!J(o[p], o[a])) continue;
|
|
578
|
+
const h = r[p].slice(1).find(
|
|
579
|
+
(R) => o.slice(0, a + 1).every((P, U) => U === p || !J(P, R))
|
|
580
|
+
);
|
|
581
|
+
h && (o[p] = h), c = !o.slice(0, a).some((R) => J(R, o[a]));
|
|
582
|
+
}
|
|
583
|
+
if (c) continue;
|
|
584
|
+
const f = e.find((p) => !u.some((h) => J(h, p)));
|
|
585
|
+
f && u.some((p) => !Ct(p, o[a])) && (o[a] = f);
|
|
586
|
+
}
|
|
587
|
+
return o;
|
|
588
|
+
}, cn = (t, n) => {
|
|
589
|
+
if ((pt(n.onPrimary, t) ?? 21) >= 4.5)
|
|
590
|
+
return n.onPrimary;
|
|
591
|
+
const e = [n.onPrimary, n.text, n.surface];
|
|
592
|
+
let r = e[0], o = -1;
|
|
593
|
+
for (const a of e) {
|
|
594
|
+
const u = pt(a, t) ?? -1;
|
|
595
|
+
u > o && (r = a, o = u);
|
|
596
|
+
}
|
|
597
|
+
return r;
|
|
598
|
+
}, he = (t, n, e = 3) => (pt(t, n.surface) ?? 21) >= e ? t : n.text, ge = (t, n) => fe(t, n).map((e) => ({
|
|
599
|
+
fill: e,
|
|
600
|
+
on: cn(e, n),
|
|
601
|
+
ink: he(e, n)
|
|
602
|
+
})), be = (t, n, e) => Math.max(n, Math.min(e, t)), ye = (t, n) => {
|
|
603
|
+
const e = t.length, r = 100 / e;
|
|
604
|
+
if (t.every((c) => c === 0)) return t.map(() => r);
|
|
605
|
+
const o = r * (n || e > 2 ? 0.8 : 0.6), a = t.map((c) => Math.max(c, o)), u = a.reduce((c, f) => c + f, 0) - 100, m = a.reduce((c, f) => c + (f - o), 0);
|
|
606
|
+
return a.map((c) => m > 0 ? c - (c - o) / m * u : r);
|
|
607
|
+
}, xe = (t, n, e, r) => {
|
|
608
|
+
const o = t.length, a = e ? be(t[n], r ? 60 : 56, r ? 68 : 74) : 64, u = 100 - a, c = t.filter((f, p) => p !== n).reduce((f, p) => f + p, 0);
|
|
609
|
+
return t.map((f, p) => p === n ? a : !e || c === 0 ? u / (o - 1) : f / c * u);
|
|
610
|
+
}, ke = (t) => {
|
|
611
|
+
const n = [];
|
|
612
|
+
let e = 0;
|
|
613
|
+
for (let r = 0; r < t.length - 1; r += 1)
|
|
614
|
+
e += t[r], n.push(e);
|
|
615
|
+
return n;
|
|
616
|
+
}, Se = (t) => `${Math.round(t * 100) / 100}%`, Ie = (t, n, e, r) => {
|
|
617
|
+
const o = (h) => Se(r ? 100 - h : h), a = n === 0 ? null : t[n - 1], u = n === t.length ? null : t[n], m = o(a === null ? 0 : a + e), c = o(a === null ? 0 : a - e), f = o(u === null ? 100 : u + e), p = o(u === null ? 100 : u - e);
|
|
618
|
+
return `polygon(${m} 0, ${f} 0, ${p} 100%, ${c} 100%)`;
|
|
619
|
+
}, ct = "cubic-bezier(.2,.8,.2,1)", ve = ot({ from: { clipPath: "var(--bof-from)" } }), wt = ot({ from: { opacity: 0, transform: "translateY(10px)" } }), $e = ot({ to: { transform: "rotate(360deg)" } }), dn = ot({
|
|
620
|
+
"0%": { transform: "scale(.92)", opacity: 0 },
|
|
621
|
+
"60%": { transform: "scale(1.03)" },
|
|
622
|
+
"100%": { transform: "scale(1)", opacity: 1 }
|
|
623
|
+
}), N = { fontFamily: i.fontPrimary, fontWeight: 700 }, It = ([t, n]) => ({
|
|
624
|
+
fontSize: `min(${s(t)}, 30cqi)`,
|
|
625
|
+
lineHeight: n / t
|
|
626
|
+
}), Yt = (t) => ({
|
|
627
|
+
paddingInlineStart: `calc(${s(t)} + var(--bof-pad-start, 0%))`,
|
|
628
|
+
paddingInlineEnd: `calc(${s(t)} + var(--bof-pad-end, 0%))`
|
|
629
|
+
}), vt = { overflowWrap: "anywhere", maxWidth: "100%" }, $t = ([t, n]) => ({
|
|
630
|
+
fontSize: `min(${s(t)}, 18cqi)`,
|
|
631
|
+
lineHeight: n / t
|
|
632
|
+
}), dt = { unicodeBidi: "plaintext" }, ut = {
|
|
633
|
+
display: "-webkit-box",
|
|
634
|
+
WebkitLineClamp: 2,
|
|
635
|
+
WebkitBoxOrient: "vertical",
|
|
636
|
+
overflow: "hidden"
|
|
637
|
+
}, Xt = (t, n) => ({
|
|
638
|
+
boxSizing: "border-box",
|
|
639
|
+
height: s(t, n),
|
|
640
|
+
padding: `0 min(${s(20, n)}, 6cqi)`,
|
|
641
|
+
border: 0,
|
|
642
|
+
borderRadius: i.radiusSm,
|
|
643
|
+
display: "inline-flex",
|
|
644
|
+
alignItems: "center",
|
|
645
|
+
justifyContent: "center",
|
|
646
|
+
gap: s(8, n),
|
|
647
|
+
fontFamily: i.fontSecondary,
|
|
648
|
+
fontWeight: 700,
|
|
649
|
+
fontSize: s(n),
|
|
650
|
+
lineHeight: 1.2,
|
|
651
|
+
whiteSpace: "nowrap",
|
|
652
|
+
overflow: "hidden",
|
|
653
|
+
textOverflow: "ellipsis",
|
|
654
|
+
"& > span": { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" },
|
|
655
|
+
"&:focus-visible": {
|
|
656
|
+
outline: `2px solid ${i.focus}`,
|
|
657
|
+
outlineOffset: "2px"
|
|
658
|
+
}
|
|
659
|
+
}), un = (t, n, e) => ({
|
|
660
|
+
vote: d(Xt(t, n), e, {
|
|
661
|
+
backgroundColor: i.fill,
|
|
662
|
+
color: i.on,
|
|
663
|
+
cursor: "pointer",
|
|
664
|
+
boxShadow: `0 ${s(8, n)} ${s(16, n)} -${s(8, n)} var(--bof-fill)`,
|
|
665
|
+
transition: "transform .15s ease, filter .15s ease",
|
|
666
|
+
"&:hover:not(:disabled)": {
|
|
667
|
+
transform: "translateY(-1px)",
|
|
668
|
+
filter: "brightness(1.08)"
|
|
669
|
+
},
|
|
670
|
+
"&:active:not(:disabled)": { transform: "translateY(0)" },
|
|
671
|
+
"&:disabled": { cursor: "default", opacity: 0.7 }
|
|
672
|
+
}),
|
|
673
|
+
thanks: d(Xt(t, n), e, {
|
|
674
|
+
padding: `0 ${s(12, n)}`,
|
|
675
|
+
border: `2px solid ${i.ink}`,
|
|
676
|
+
backgroundColor: i.surface,
|
|
677
|
+
color: i.ink,
|
|
678
|
+
animation: `${dn} .35s ease-out`
|
|
679
|
+
}),
|
|
680
|
+
icon: d({ fontSize: "1.25em", flexShrink: 0 })
|
|
681
|
+
}), Ce = (t) => {
|
|
682
|
+
const n = (a) => ({
|
|
683
|
+
display: "block",
|
|
684
|
+
width: `min(${s(a)}, 100%)`,
|
|
685
|
+
height: "auto",
|
|
686
|
+
aspectRatio: "1",
|
|
687
|
+
flexShrink: 0
|
|
688
|
+
}), e = (a, u) => d(n(a), {
|
|
689
|
+
boxSizing: "border-box",
|
|
690
|
+
borderRadius: "50%",
|
|
691
|
+
overflow: "hidden",
|
|
692
|
+
backgroundColor: i.surface,
|
|
693
|
+
border: u,
|
|
694
|
+
"& img": {
|
|
695
|
+
display: "block",
|
|
696
|
+
width: "100%",
|
|
697
|
+
height: "100%",
|
|
698
|
+
objectFit: "cover",
|
|
699
|
+
objectPosition: "top"
|
|
700
|
+
}
|
|
701
|
+
}), r = (a) => d({
|
|
702
|
+
flexShrink: 0,
|
|
703
|
+
width: `min(${s(a, a * 0.36)}, 100%)`,
|
|
704
|
+
aspectRatio: "1",
|
|
705
|
+
boxSizing: "border-box",
|
|
706
|
+
borderRadius: "50%",
|
|
707
|
+
display: "flex",
|
|
708
|
+
alignItems: "center",
|
|
709
|
+
justifyContent: "center",
|
|
710
|
+
fontSize: s(a * 0.36),
|
|
711
|
+
...N,
|
|
712
|
+
color: i.text,
|
|
713
|
+
backgroundColor: i.surface,
|
|
714
|
+
border: `${i.borderSize} solid ${i.border}`
|
|
715
|
+
}), o = (a, u) => d(n(a), { objectFit: "contain", filter: u });
|
|
716
|
+
return {
|
|
717
|
+
side: {
|
|
718
|
+
logo: o(t.img, et.logo),
|
|
719
|
+
headshot: e(t.img, `${s(t.trophyRing)} solid ${i.fill}`),
|
|
720
|
+
initials: r(t.img)
|
|
721
|
+
},
|
|
722
|
+
winner: {
|
|
723
|
+
logo: o(t.winImg, et.winnerLogo),
|
|
724
|
+
headshot: d(
|
|
725
|
+
e(t.winImg, `${s(t.trophyRing + 1)} solid ${i.on}`),
|
|
726
|
+
{ boxShadow: et.winnerHeadshot }
|
|
727
|
+
),
|
|
728
|
+
initials: r(t.winImg)
|
|
729
|
+
},
|
|
730
|
+
loser: {
|
|
731
|
+
logo: o(t.loserImg),
|
|
732
|
+
headshot: e(t.loserImg, `2px solid ${i.fill}`),
|
|
733
|
+
initials: r(t.loserImg)
|
|
734
|
+
},
|
|
735
|
+
row: {
|
|
736
|
+
logo: o(44, et.logo),
|
|
737
|
+
headshot: e(44, `2px solid ${i.fill}`),
|
|
738
|
+
initials: r(44)
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
}, we = [
|
|
742
|
+
"top-left",
|
|
743
|
+
"top-right",
|
|
744
|
+
"bottom-left",
|
|
745
|
+
"bottom-right"
|
|
746
|
+
], pn = (t) => {
|
|
747
|
+
const n = {
|
|
748
|
+
position: "absolute",
|
|
749
|
+
width: s(t.trophy),
|
|
750
|
+
height: s(t.trophy),
|
|
751
|
+
boxSizing: "border-box",
|
|
752
|
+
borderRadius: "50%",
|
|
753
|
+
border: `${s(t.trophyRing)} solid ${i.on}`,
|
|
754
|
+
backgroundColor: i.trophy,
|
|
755
|
+
color: i.trophyOn,
|
|
756
|
+
boxShadow: et.trophy,
|
|
757
|
+
display: "flex",
|
|
758
|
+
alignItems: "center",
|
|
759
|
+
justifyContent: "center",
|
|
760
|
+
fontSize: "1em",
|
|
761
|
+
animation: `${dn} .5s .55s ease-out both`
|
|
762
|
+
}, e = (o, a) => {
|
|
763
|
+
const [u, m] = o.split("-"), c = a ? m === "left" ? "right" : "left" : m;
|
|
764
|
+
return d(n, { [u]: s(-4), [c]: s(-4) });
|
|
765
|
+
}, r = {};
|
|
766
|
+
for (const o of we)
|
|
767
|
+
r[`${o}|ltr`] = e(o, !1), r[`${o}|rtl`] = e(o, !0);
|
|
768
|
+
return { at: r, icon: d({ fontSize: s(t.trophy * 0.5) }) };
|
|
769
|
+
}, Kt = (t, n) => {
|
|
770
|
+
const e = (a) => d({
|
|
771
|
+
position: "relative",
|
|
772
|
+
height: s(a),
|
|
773
|
+
display: "flex",
|
|
774
|
+
overflow: "hidden",
|
|
775
|
+
borderRadius: i.radiusMd,
|
|
776
|
+
backgroundColor: i.inner
|
|
777
|
+
}), r = (a) => d({
|
|
778
|
+
position: "relative",
|
|
779
|
+
zIndex: 1,
|
|
780
|
+
minWidth: 0,
|
|
781
|
+
boxSizing: "border-box",
|
|
782
|
+
containerType: "inline-size",
|
|
783
|
+
paddingBlock: s(t.colPad[0]),
|
|
784
|
+
...Yt(t.colPad[1]),
|
|
785
|
+
display: "flex",
|
|
786
|
+
flexDirection: "column",
|
|
787
|
+
alignItems: "center",
|
|
788
|
+
justifyContent: "center",
|
|
789
|
+
gap: s(a),
|
|
790
|
+
transition: `flex-basis .6s ${ct}`
|
|
791
|
+
}), o = n ? { width: "100%" } : { minWidth: `min(${s(180, t.btnFont)}, 100%)`, maxWidth: "100%" };
|
|
792
|
+
return {
|
|
793
|
+
bar: e(t.arenaBar),
|
|
794
|
+
fill: d(e(t.arenaFill), {
|
|
795
|
+
"--bof-tint": "14%",
|
|
796
|
+
".dark &": { "--bof-tint": "30%" }
|
|
797
|
+
}),
|
|
798
|
+
layer: d({
|
|
799
|
+
position: "absolute",
|
|
800
|
+
inset: 0,
|
|
801
|
+
backgroundColor: i.tint,
|
|
802
|
+
transition: `clip-path .6s ${ct}, background-color .3s`
|
|
803
|
+
}),
|
|
804
|
+
layerNeutral: d({
|
|
805
|
+
position: "absolute",
|
|
806
|
+
inset: 0,
|
|
807
|
+
backgroundColor: i.inner
|
|
808
|
+
}),
|
|
809
|
+
layerWinner: d({
|
|
810
|
+
position: "absolute",
|
|
811
|
+
inset: 0,
|
|
812
|
+
backgroundColor: i.fill,
|
|
813
|
+
animation: `${ve} .9s ${ct} both`
|
|
814
|
+
}),
|
|
815
|
+
column: r(t.colGap),
|
|
816
|
+
columnFill: r(10),
|
|
817
|
+
imgSlot: d({
|
|
818
|
+
width: "100%",
|
|
819
|
+
height: s(t.imgSlot),
|
|
820
|
+
display: "flex",
|
|
821
|
+
alignItems: "center",
|
|
822
|
+
justifyContent: "center"
|
|
823
|
+
}),
|
|
824
|
+
nameBox: d(
|
|
825
|
+
n ? {
|
|
826
|
+
minHeight: s(40),
|
|
827
|
+
display: "flex",
|
|
828
|
+
alignItems: "center",
|
|
829
|
+
justifyContent: "center"
|
|
830
|
+
} : {}
|
|
831
|
+
),
|
|
832
|
+
name: d({
|
|
833
|
+
...N,
|
|
834
|
+
...$t(t.name),
|
|
835
|
+
...dt,
|
|
836
|
+
...ut,
|
|
837
|
+
...vt,
|
|
838
|
+
textAlign: "center",
|
|
839
|
+
textWrap: "balance"
|
|
840
|
+
}),
|
|
841
|
+
pct: d({
|
|
842
|
+
...N,
|
|
843
|
+
...It(t.pctFill),
|
|
844
|
+
color: i.ink,
|
|
845
|
+
fontVariantNumeric: "tabular-nums"
|
|
846
|
+
}),
|
|
847
|
+
action: d({
|
|
848
|
+
width: "100%",
|
|
849
|
+
minHeight: s(t.btnH),
|
|
850
|
+
paddingTop: s(n ? 0 : 4),
|
|
851
|
+
display: "flex",
|
|
852
|
+
justifyContent: "center"
|
|
853
|
+
}),
|
|
854
|
+
actionFill: d({
|
|
855
|
+
width: "100%",
|
|
856
|
+
minHeight: s(t.btnH),
|
|
857
|
+
paddingTop: s(n ? 0 : 6),
|
|
858
|
+
display: "flex",
|
|
859
|
+
justifyContent: "center"
|
|
860
|
+
}),
|
|
861
|
+
...un(t.btnH, t.btnFont, o),
|
|
862
|
+
// Winner panel
|
|
863
|
+
winColumn: d({
|
|
864
|
+
position: "relative",
|
|
865
|
+
zIndex: 1,
|
|
866
|
+
minWidth: 0,
|
|
867
|
+
boxSizing: "border-box",
|
|
868
|
+
containerType: "inline-size",
|
|
869
|
+
paddingBlock: s(n ? 12 : 24),
|
|
870
|
+
...Yt(n ? 12 : 24),
|
|
871
|
+
transition: `flex-basis .6s ${ct}`,
|
|
872
|
+
display: "flex",
|
|
873
|
+
alignItems: "center",
|
|
874
|
+
justifyContent: "center"
|
|
875
|
+
}),
|
|
876
|
+
winContent: d({
|
|
877
|
+
maxWidth: "100%",
|
|
878
|
+
display: "flex",
|
|
879
|
+
flexDirection: n ? "column" : "row",
|
|
880
|
+
alignItems: "center",
|
|
881
|
+
gap: s(n ? 8 : 24),
|
|
882
|
+
textAlign: n ? "center" : "start",
|
|
883
|
+
color: i.on,
|
|
884
|
+
minWidth: 0,
|
|
885
|
+
animation: `${wt} .6s .25s ease-out both`
|
|
886
|
+
}),
|
|
887
|
+
winWrap: d({
|
|
888
|
+
position: "relative",
|
|
889
|
+
isolation: "isolate",
|
|
890
|
+
flexShrink: 0,
|
|
891
|
+
width: s(t.winWrap),
|
|
892
|
+
height: s(t.winWrap),
|
|
893
|
+
display: "flex",
|
|
894
|
+
alignItems: "center",
|
|
895
|
+
justifyContent: "center"
|
|
896
|
+
}),
|
|
897
|
+
rays: d({
|
|
898
|
+
position: "absolute",
|
|
899
|
+
inset: s(-(t.rays - t.winWrap) / 2),
|
|
900
|
+
zIndex: -1,
|
|
901
|
+
borderRadius: "50%",
|
|
902
|
+
pointerEvents: "none",
|
|
903
|
+
background: `repeating-conic-gradient(from 0deg, color-mix(in srgb, ${i.on} 12%, transparent) 0deg 9deg, transparent 9deg 18deg), radial-gradient(circle closest-side, color-mix(in srgb, ${i.on} 24%, transparent) 0%, transparent 72%)`,
|
|
904
|
+
maskImage: "radial-gradient(circle closest-side, #000 28%, transparent 100%)",
|
|
905
|
+
animation: `${$e} 80s linear infinite`
|
|
906
|
+
}),
|
|
907
|
+
winText: d({
|
|
908
|
+
minWidth: 0,
|
|
909
|
+
display: "flex",
|
|
910
|
+
flexDirection: "column",
|
|
911
|
+
gap: s(2)
|
|
912
|
+
}),
|
|
913
|
+
eyebrow: d({
|
|
914
|
+
fontWeight: 700,
|
|
915
|
+
textTransform: "uppercase",
|
|
916
|
+
letterSpacing: "0.14em",
|
|
917
|
+
...I(t.eyebrow)
|
|
918
|
+
}),
|
|
919
|
+
winName: d({
|
|
920
|
+
...N,
|
|
921
|
+
...$t(t.winName),
|
|
922
|
+
...dt,
|
|
923
|
+
...ut,
|
|
924
|
+
...vt,
|
|
925
|
+
letterSpacing: "-0.01em",
|
|
926
|
+
textWrap: "balance"
|
|
927
|
+
}),
|
|
928
|
+
winPctRow: d(
|
|
929
|
+
n ? {
|
|
930
|
+
display: "flex",
|
|
931
|
+
flexDirection: "column",
|
|
932
|
+
alignItems: "center",
|
|
933
|
+
paddingTop: s(4)
|
|
934
|
+
} : {
|
|
935
|
+
display: "flex",
|
|
936
|
+
flexWrap: "wrap",
|
|
937
|
+
alignItems: "baseline",
|
|
938
|
+
columnGap: s(10),
|
|
939
|
+
paddingTop: s(4)
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
winPct: d({
|
|
943
|
+
...N,
|
|
944
|
+
...It(t.winPct),
|
|
945
|
+
fontVariantNumeric: "tabular-nums"
|
|
946
|
+
}),
|
|
947
|
+
ofVotes: d({ fontWeight: 500, ...I([14, 20]) }),
|
|
948
|
+
loserContent: d({
|
|
949
|
+
maxWidth: "100%",
|
|
950
|
+
display: "flex",
|
|
951
|
+
flexDirection: "column",
|
|
952
|
+
alignItems: "center",
|
|
953
|
+
gap: s(6),
|
|
954
|
+
textAlign: "center",
|
|
955
|
+
minWidth: 0,
|
|
956
|
+
animation: `${wt} .6s .4s ease-out both`
|
|
957
|
+
}),
|
|
958
|
+
loserSlot: d({
|
|
959
|
+
width: "100%",
|
|
960
|
+
height: s(t.loserSlot),
|
|
961
|
+
display: "flex",
|
|
962
|
+
alignItems: "center",
|
|
963
|
+
justifyContent: "center",
|
|
964
|
+
filter: "grayscale(1) opacity(0.7)"
|
|
965
|
+
}),
|
|
966
|
+
loserName: d({
|
|
967
|
+
...N,
|
|
968
|
+
...$t(t.loserName),
|
|
969
|
+
...dt,
|
|
970
|
+
...ut,
|
|
971
|
+
...vt,
|
|
972
|
+
paddingTop: s(2),
|
|
973
|
+
textWrap: "balance"
|
|
974
|
+
}),
|
|
975
|
+
loserPct: d({
|
|
976
|
+
...N,
|
|
977
|
+
...It(t.loserPct),
|
|
978
|
+
fontVariantNumeric: "tabular-nums"
|
|
979
|
+
}),
|
|
980
|
+
img: Ce(t),
|
|
981
|
+
trophy: pn(t)
|
|
982
|
+
};
|
|
983
|
+
}, We = () => ({
|
|
984
|
+
shell: d({
|
|
985
|
+
display: "flex",
|
|
986
|
+
flexDirection: "column",
|
|
987
|
+
overflow: "hidden",
|
|
988
|
+
borderRadius: i.radiusMd,
|
|
989
|
+
backgroundColor: i.inner,
|
|
990
|
+
"--bof-tint": "10%",
|
|
991
|
+
".dark &": { "--bof-tint": "26%" }
|
|
992
|
+
}),
|
|
993
|
+
row: d({
|
|
994
|
+
position: "relative",
|
|
995
|
+
height: s(kt),
|
|
996
|
+
boxSizing: "border-box",
|
|
997
|
+
padding: `0 ${s(12)}`,
|
|
998
|
+
display: "flex",
|
|
999
|
+
alignItems: "center",
|
|
1000
|
+
gap: s(12),
|
|
1001
|
+
backgroundColor: i.tint
|
|
1002
|
+
}),
|
|
1003
|
+
rowNeutral: d({
|
|
1004
|
+
position: "relative",
|
|
1005
|
+
height: s(kt),
|
|
1006
|
+
boxSizing: "border-box",
|
|
1007
|
+
padding: `0 ${s(12)}`,
|
|
1008
|
+
display: "flex",
|
|
1009
|
+
alignItems: "center",
|
|
1010
|
+
gap: s(12)
|
|
1011
|
+
}),
|
|
1012
|
+
rowWinner: d({
|
|
1013
|
+
position: "relative",
|
|
1014
|
+
height: s(kt),
|
|
1015
|
+
boxSizing: "border-box",
|
|
1016
|
+
padding: `0 ${s(12)}`,
|
|
1017
|
+
display: "flex",
|
|
1018
|
+
alignItems: "center",
|
|
1019
|
+
gap: s(12),
|
|
1020
|
+
backgroundColor: i.fill,
|
|
1021
|
+
color: i.on,
|
|
1022
|
+
animation: `${wt} .6s ease-out both`
|
|
1023
|
+
}),
|
|
1024
|
+
greyed: d({ filter: "grayscale(1) opacity(0.7)", display: "flex" }),
|
|
1025
|
+
imgWrap: d({ position: "relative", display: "flex", flexShrink: 0 }),
|
|
1026
|
+
name: d({
|
|
1027
|
+
...N,
|
|
1028
|
+
...I([15, 20]),
|
|
1029
|
+
...dt,
|
|
1030
|
+
...ut,
|
|
1031
|
+
flex: 1,
|
|
1032
|
+
minWidth: 0
|
|
1033
|
+
}),
|
|
1034
|
+
pct: d({
|
|
1035
|
+
...N,
|
|
1036
|
+
...I([20, 24]),
|
|
1037
|
+
color: i.ink,
|
|
1038
|
+
fontVariantNumeric: "tabular-nums",
|
|
1039
|
+
flexShrink: 0
|
|
1040
|
+
}),
|
|
1041
|
+
pctOn: d({
|
|
1042
|
+
...N,
|
|
1043
|
+
...I([20, 24]),
|
|
1044
|
+
fontVariantNumeric: "tabular-nums",
|
|
1045
|
+
flexShrink: 0
|
|
1046
|
+
}),
|
|
1047
|
+
action: d({ width: s(104), flexShrink: 0, display: "flex" }),
|
|
1048
|
+
...un(40, 14, { width: "100%" }),
|
|
1049
|
+
trophy: pn({ trophy: 22, trophyRing: 2 })
|
|
1050
|
+
}), g = { d: Kt(Z, !1), m: Kt(tt, !0) }, F = We(), Q = ({ side: t, layout: n, variant: e, language: r }) => {
|
|
1051
|
+
const [o, a] = T(null), u = t.image && o !== t.image ? t.image : null;
|
|
1052
|
+
return t.kind === "player" ? /* @__PURE__ */ l("div", { css: g[n].img[e].headshot, "aria-hidden": "true", children: /* @__PURE__ */ l(
|
|
1053
|
+
"img",
|
|
1054
|
+
{
|
|
1055
|
+
src: u ?? zn.playerPlaceholder,
|
|
1056
|
+
alt: "",
|
|
1057
|
+
loading: "lazy",
|
|
1058
|
+
decoding: "async",
|
|
1059
|
+
onError: () => u && a(u)
|
|
1060
|
+
}
|
|
1061
|
+
) }) : u ? /* @__PURE__ */ l(
|
|
1062
|
+
"img",
|
|
1063
|
+
{
|
|
1064
|
+
css: g[n].img[e].logo,
|
|
1065
|
+
src: u,
|
|
1066
|
+
alt: "",
|
|
1067
|
+
loading: "lazy",
|
|
1068
|
+
decoding: "async",
|
|
1069
|
+
onError: () => a(u)
|
|
1070
|
+
}
|
|
1071
|
+
) : /* @__PURE__ */ l("div", { css: g[n].img[e].initials, "aria-hidden": "true", children: Mn(t.name, r) });
|
|
1072
|
+
}, mn = ({ position: t, layout: n, row: e }) => {
|
|
1073
|
+
const r = `${t}|${Rt() ? "rtl" : "ltr"}`;
|
|
1074
|
+
return /* @__PURE__ */ l(
|
|
1075
|
+
"div",
|
|
1076
|
+
{
|
|
1077
|
+
css: e ? F.trophy.at[r] : g[n].trophy.at[r],
|
|
1078
|
+
"aria-hidden": "true",
|
|
1079
|
+
children: /* @__PURE__ */ l(
|
|
1080
|
+
Gn,
|
|
1081
|
+
{
|
|
1082
|
+
css: e ? F.trophy.icon : g[n].trophy.icon
|
|
1083
|
+
}
|
|
1084
|
+
)
|
|
1085
|
+
}
|
|
1086
|
+
);
|
|
1087
|
+
}, Fe = (t) => {
|
|
1088
|
+
if (t != null && t.onClick) return t.onClick;
|
|
1089
|
+
const n = t == null ? void 0 : t.url;
|
|
1090
|
+
if (n)
|
|
1091
|
+
return () => {
|
|
1092
|
+
((t == null ? void 0 : t.target) ?? "_self") === "_blank" ? window.open(n, "_blank") : window.location.href = n;
|
|
1093
|
+
};
|
|
1094
|
+
}, fn = ({
|
|
1095
|
+
state: t,
|
|
1096
|
+
layout: n,
|
|
1097
|
+
row: e,
|
|
1098
|
+
labels: r,
|
|
1099
|
+
signInCTA: o,
|
|
1100
|
+
onVote: a
|
|
1101
|
+
}) => {
|
|
1102
|
+
if (t === "signIn") {
|
|
1103
|
+
if (o != null && o.component) return /* @__PURE__ */ l(Wt, { children: o.component });
|
|
1104
|
+
const u = Fe(o);
|
|
1105
|
+
return /* @__PURE__ */ l(
|
|
1106
|
+
"button",
|
|
1107
|
+
{
|
|
1108
|
+
type: "button",
|
|
1109
|
+
css: e ? F.vote : g[n].vote,
|
|
1110
|
+
disabled: !u,
|
|
1111
|
+
onClick: u,
|
|
1112
|
+
children: /* @__PURE__ */ l("span", { children: (o == null ? void 0 : o.defaultLabel) || r.signIn })
|
|
1113
|
+
}
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
return t === "chosen" ? /* @__PURE__ */ b("div", { css: e ? F.thanks : g[n].thanks, role: "status", children: [
|
|
1117
|
+
/* @__PURE__ */ l(qn, { css: g.d.icon }),
|
|
1118
|
+
/* @__PURE__ */ l("span", { children: r.thankYou })
|
|
1119
|
+
] }) : t === "locked" ? null : /* @__PURE__ */ l(
|
|
1120
|
+
"button",
|
|
1121
|
+
{
|
|
1122
|
+
type: "button",
|
|
1123
|
+
css: e ? F.vote : g[n].vote,
|
|
1124
|
+
"aria-label": r.voteFor,
|
|
1125
|
+
disabled: t === "submitting",
|
|
1126
|
+
onClick: a,
|
|
1127
|
+
children: /* @__PURE__ */ l("span", { children: r.vote })
|
|
1128
|
+
}
|
|
1129
|
+
);
|
|
1130
|
+
}, D = (t, n) => ({
|
|
1131
|
+
"--bof-fill": t.fill,
|
|
1132
|
+
"--bof-on": t.on,
|
|
1133
|
+
"--bof-ink": t.ink,
|
|
1134
|
+
...n ? { "--bof-from": n } : {}
|
|
1135
|
+
}), Et = (t, n) => ({
|
|
1136
|
+
...D(t.colours[n]),
|
|
1137
|
+
flex: `0 0 ${t.widths[n]}%`,
|
|
1138
|
+
"--bof-pad-start": n > 0 ? `${t.slant}%` : "0%",
|
|
1139
|
+
"--bof-pad-end": n < t.sides.length - 1 ? `${t.slant}%` : "0%"
|
|
1140
|
+
}), hn = (t, n) => ({
|
|
1141
|
+
vote: t.label("vote"),
|
|
1142
|
+
voteFor: t.label("voteFor", { name: n.name }),
|
|
1143
|
+
thankYou: t.label("thankYou"),
|
|
1144
|
+
signIn: t.label("signIn")
|
|
1145
|
+
}), Re = ({ view: t }) => /* @__PURE__ */ l("div", { css: F.shell, role: "group", "aria-label": t.splitLabel ?? void 0, children: t.sides.map((n, e) => {
|
|
1146
|
+
const r = t.winner === e, o = t.winner !== null && !r, a = /* @__PURE__ */ l(
|
|
1147
|
+
Q,
|
|
1148
|
+
{
|
|
1149
|
+
side: n,
|
|
1150
|
+
layout: "m",
|
|
1151
|
+
variant: "row",
|
|
1152
|
+
language: t.language
|
|
1153
|
+
}
|
|
1154
|
+
);
|
|
1155
|
+
return /* @__PURE__ */ b(
|
|
1156
|
+
"div",
|
|
1157
|
+
{
|
|
1158
|
+
css: r ? F.rowWinner : t.lit[e] && !o ? F.row : F.rowNeutral,
|
|
1159
|
+
style: D(t.colours[e]),
|
|
1160
|
+
children: [
|
|
1161
|
+
/* @__PURE__ */ b("div", { css: F.imgWrap, children: [
|
|
1162
|
+
o ? /* @__PURE__ */ l("div", { css: F.greyed, children: a }) : a,
|
|
1163
|
+
r && t.showTrophy && /* @__PURE__ */ l(mn, { position: t.trophyPosition, layout: "m", row: !0 })
|
|
1164
|
+
] }),
|
|
1165
|
+
/* @__PURE__ */ l("div", { css: F.name, children: n.name }),
|
|
1166
|
+
t.fill && t.percents[e] !== null && /* @__PURE__ */ l("div", { css: r ? F.pctOn : F.pct, children: t.percents[e] }),
|
|
1167
|
+
!t.ended && /* @__PURE__ */ l("div", { css: F.action, children: /* @__PURE__ */ l(
|
|
1168
|
+
fn,
|
|
1169
|
+
{
|
|
1170
|
+
state: t.actions[e],
|
|
1171
|
+
layout: "m",
|
|
1172
|
+
row: !0,
|
|
1173
|
+
labels: hn(t, n),
|
|
1174
|
+
signInCTA: t.signInCTA,
|
|
1175
|
+
onVote: () => t.onVote(e)
|
|
1176
|
+
}
|
|
1177
|
+
) })
|
|
1178
|
+
]
|
|
1179
|
+
},
|
|
1180
|
+
n.optionId
|
|
1181
|
+
);
|
|
1182
|
+
}) }), Ee = ({
|
|
1183
|
+
view: t,
|
|
1184
|
+
index: n
|
|
1185
|
+
}) => {
|
|
1186
|
+
const e = t.sides[n];
|
|
1187
|
+
return /* @__PURE__ */ l("div", { css: g[t.layout].winColumn, style: Et(t, n), children: /* @__PURE__ */ b("div", { css: g[t.layout].winContent, children: [
|
|
1188
|
+
/* @__PURE__ */ b("div", { css: g[t.layout].winWrap, children: [
|
|
1189
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].rays, "aria-hidden": "true" }),
|
|
1190
|
+
/* @__PURE__ */ l(
|
|
1191
|
+
Q,
|
|
1192
|
+
{
|
|
1193
|
+
side: e,
|
|
1194
|
+
layout: t.layout,
|
|
1195
|
+
variant: "winner",
|
|
1196
|
+
language: t.language
|
|
1197
|
+
}
|
|
1198
|
+
),
|
|
1199
|
+
t.showTrophy && /* @__PURE__ */ l(
|
|
1200
|
+
mn,
|
|
1201
|
+
{
|
|
1202
|
+
position: t.trophyPosition,
|
|
1203
|
+
layout: t.layout,
|
|
1204
|
+
row: !1
|
|
1205
|
+
}
|
|
1206
|
+
)
|
|
1207
|
+
] }),
|
|
1208
|
+
/* @__PURE__ */ b("div", { css: g[t.layout].winText, children: [
|
|
1209
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].eyebrow, children: t.label("winner") }),
|
|
1210
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].winName, children: e.name }),
|
|
1211
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ b("div", { css: g[t.layout].winPctRow, children: [
|
|
1212
|
+
/* @__PURE__ */ l("span", { css: g[t.layout].winPct, children: t.percents[n] }),
|
|
1213
|
+
/* @__PURE__ */ l("span", { css: g[t.layout].ofVotes, children: t.label("ofTheVotes") })
|
|
1214
|
+
] })
|
|
1215
|
+
] })
|
|
1216
|
+
] }) });
|
|
1217
|
+
}, Oe = ({
|
|
1218
|
+
view: t,
|
|
1219
|
+
index: n
|
|
1220
|
+
}) => {
|
|
1221
|
+
const e = t.sides[n];
|
|
1222
|
+
return /* @__PURE__ */ l("div", { css: g[t.layout].winColumn, style: Et(t, n), children: /* @__PURE__ */ b("div", { css: g[t.layout].loserContent, children: [
|
|
1223
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].loserSlot, children: /* @__PURE__ */ l(
|
|
1224
|
+
Q,
|
|
1225
|
+
{
|
|
1226
|
+
side: e,
|
|
1227
|
+
layout: t.layout,
|
|
1228
|
+
variant: "loser",
|
|
1229
|
+
language: t.language
|
|
1230
|
+
}
|
|
1231
|
+
) }),
|
|
1232
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].loserName, children: e.name }),
|
|
1233
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ l("div", { css: g[t.layout].loserPct, children: t.percents[n] })
|
|
1234
|
+
] }) });
|
|
1235
|
+
}, Pe = ({
|
|
1236
|
+
view: t,
|
|
1237
|
+
index: n
|
|
1238
|
+
}) => {
|
|
1239
|
+
const e = t.sides[n];
|
|
1240
|
+
return /* @__PURE__ */ b(
|
|
1241
|
+
"div",
|
|
1242
|
+
{
|
|
1243
|
+
css: t.fill ? g[t.layout].columnFill : g[t.layout].column,
|
|
1244
|
+
style: Et(t, n),
|
|
1245
|
+
children: [
|
|
1246
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].imgSlot, children: /* @__PURE__ */ l(
|
|
1247
|
+
Q,
|
|
1248
|
+
{
|
|
1249
|
+
side: e,
|
|
1250
|
+
layout: t.layout,
|
|
1251
|
+
variant: "side",
|
|
1252
|
+
language: t.language
|
|
1253
|
+
}
|
|
1254
|
+
) }),
|
|
1255
|
+
/* @__PURE__ */ l("div", { css: g[t.layout].nameBox, children: /* @__PURE__ */ l("div", { css: g[t.layout].name, children: e.name }) }),
|
|
1256
|
+
t.fill && t.percents[n] !== null && /* @__PURE__ */ l("div", { css: g[t.layout].pct, children: t.percents[n] }),
|
|
1257
|
+
!t.ended && /* @__PURE__ */ l(
|
|
1258
|
+
"div",
|
|
1259
|
+
{
|
|
1260
|
+
css: t.fill ? g[t.layout].actionFill : g[t.layout].action,
|
|
1261
|
+
children: /* @__PURE__ */ l(
|
|
1262
|
+
fn,
|
|
1263
|
+
{
|
|
1264
|
+
state: t.actions[n],
|
|
1265
|
+
layout: t.layout,
|
|
1266
|
+
row: !1,
|
|
1267
|
+
labels: hn(t, e),
|
|
1268
|
+
signInCTA: t.signInCTA,
|
|
1269
|
+
onVote: () => t.onVote(n)
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1277
|
+
}, Le = ({ view: t }) => {
|
|
1278
|
+
if (t.rows) return /* @__PURE__ */ l(Re, { view: t });
|
|
1279
|
+
const n = t.winner;
|
|
1280
|
+
return /* @__PURE__ */ b(
|
|
1281
|
+
"div",
|
|
1282
|
+
{
|
|
1283
|
+
css: t.fill ? g[t.layout].fill : g[t.layout].bar,
|
|
1284
|
+
role: "group",
|
|
1285
|
+
"aria-label": t.splitLabel ?? void 0,
|
|
1286
|
+
children: [
|
|
1287
|
+
n !== null ? /* @__PURE__ */ l(
|
|
1288
|
+
"div",
|
|
1289
|
+
{
|
|
1290
|
+
css: g[t.layout].layerWinner,
|
|
1291
|
+
"aria-hidden": "true",
|
|
1292
|
+
style: {
|
|
1293
|
+
...D(t.colours[n], t.evenClips[n]),
|
|
1294
|
+
clipPath: t.clips[n]
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
"winner"
|
|
1298
|
+
) : t.sides.map((e, r) => /* @__PURE__ */ l(
|
|
1299
|
+
"div",
|
|
1300
|
+
{
|
|
1301
|
+
css: t.lit[r] ? g[t.layout].layer : g[t.layout].layerNeutral,
|
|
1302
|
+
"aria-hidden": "true",
|
|
1303
|
+
style: { ...D(t.colours[r]), clipPath: t.clips[r] }
|
|
1304
|
+
},
|
|
1305
|
+
e.optionId
|
|
1306
|
+
)),
|
|
1307
|
+
t.sides.map(
|
|
1308
|
+
(e, r) => n === null ? /* @__PURE__ */ l(Pe, { view: t, index: r }, e.optionId) : r === n ? /* @__PURE__ */ l(Ee, { view: t, index: r }, e.optionId) : /* @__PURE__ */ l(Oe, { view: t, index: r }, e.optionId)
|
|
1309
|
+
)
|
|
1310
|
+
]
|
|
1311
|
+
}
|
|
1312
|
+
);
|
|
1313
|
+
}, Te = ({ layout: t, label: n, left: e }) => {
|
|
1314
|
+
const r = sn(), o = j(
|
|
1315
|
+
() => new Intl.NumberFormat(r, {
|
|
1316
|
+
minimumIntegerDigits: 2,
|
|
1317
|
+
useGrouping: !1
|
|
1318
|
+
}),
|
|
1319
|
+
[r]
|
|
1320
|
+
), a = [
|
|
1321
|
+
{ value: e.days, caption: n("days") },
|
|
1322
|
+
{ value: e.hours, caption: n("hours") },
|
|
1323
|
+
{ value: e.minutes, caption: n("minutes") },
|
|
1324
|
+
{ value: e.seconds, caption: n("seconds") }
|
|
1325
|
+
];
|
|
1326
|
+
return /* @__PURE__ */ b("div", { css: q[t].root, children: [
|
|
1327
|
+
/* @__PURE__ */ l("div", { css: q[t].label, children: n("votingEndsIn") }),
|
|
1328
|
+
/* @__PURE__ */ l("div", { css: q[t].units, children: a.map((u, m) => /* @__PURE__ */ b(en.Fragment, { children: [
|
|
1329
|
+
t === "d" && m > 0 && /* @__PURE__ */ l("div", { css: q.d.colon, "aria-hidden": "true", children: ":" }),
|
|
1330
|
+
/* @__PURE__ */ b("div", { css: q[t].unit, children: [
|
|
1331
|
+
/* @__PURE__ */ l("div", { css: q[t].value, children: o.format(u.value) }),
|
|
1332
|
+
/* @__PURE__ */ l("div", { css: q[t].caption, children: u.caption })
|
|
1333
|
+
] })
|
|
1334
|
+
] }, m)) })
|
|
1335
|
+
] });
|
|
1336
|
+
}, Ne = ({
|
|
1337
|
+
layout: t,
|
|
1338
|
+
label: n,
|
|
1339
|
+
title: e,
|
|
1340
|
+
openSubtitle: r,
|
|
1341
|
+
ended: o,
|
|
1342
|
+
draw: a,
|
|
1343
|
+
left: u
|
|
1344
|
+
}) => {
|
|
1345
|
+
const m = [
|
|
1346
|
+
{ key: "open", text: r, on: !o },
|
|
1347
|
+
{ key: "ended", text: n("endedSubtitle"), on: o && !a },
|
|
1348
|
+
{ key: "draw", text: n("drawSubtitle"), on: o && a }
|
|
1349
|
+
], c = o ? /* @__PURE__ */ l("div", { css: y[t].pill, children: n("votingEnded") }) : u ? /* @__PURE__ */ l(Te, { layout: t, label: n, left: u }) : null;
|
|
1350
|
+
return /* @__PURE__ */ b("div", { css: y[t].header, children: [
|
|
1351
|
+
/* @__PURE__ */ b("div", { css: y[t].titles, children: [
|
|
1352
|
+
/* @__PURE__ */ l("h2", { css: y[t].title, children: e }),
|
|
1353
|
+
/* @__PURE__ */ l("div", { css: y[t].subtitles, children: m.map((f) => /* @__PURE__ */ l(
|
|
1354
|
+
"p",
|
|
1355
|
+
{
|
|
1356
|
+
css: f.on ? y[t].subtitle : y[t].subtitleHidden,
|
|
1357
|
+
"aria-hidden": !f.on,
|
|
1358
|
+
children: f.text
|
|
1359
|
+
},
|
|
1360
|
+
f.key
|
|
1361
|
+
)) })
|
|
1362
|
+
] }),
|
|
1363
|
+
t === "m" ? c && /* @__PURE__ */ l("div", { css: y.m.status, children: c }) : c
|
|
1364
|
+
] });
|
|
1365
|
+
}, Jt = (t) => ({
|
|
1366
|
+
fontSize: "1em",
|
|
1367
|
+
display: "flex",
|
|
1368
|
+
flexDirection: "column",
|
|
1369
|
+
alignItems: "center",
|
|
1370
|
+
gap: t ? i.spaceMd : i.spaceLg,
|
|
1371
|
+
padding: t ? i.spaceMd : `${s(32)} ${i.spaceLg}`,
|
|
1372
|
+
borderRadius: i.radiusMd
|
|
1373
|
+
}), Qt = (t) => d({
|
|
1374
|
+
flexShrink: 0,
|
|
1375
|
+
width: "2px",
|
|
1376
|
+
height: s(32),
|
|
1377
|
+
backgroundColor: i.border,
|
|
1378
|
+
transform: `skewX(${t ? 14 : -14}deg)`
|
|
1379
|
+
}), Zt = (t) => ({
|
|
1380
|
+
panel: d(Jt(t), { backgroundColor: i.inner }),
|
|
1381
|
+
// "after": the panel takes the picked side's tint.
|
|
1382
|
+
panelPicked: d(Jt(t), { backgroundColor: i.tint }),
|
|
1383
|
+
intro: d({
|
|
1384
|
+
display: "flex",
|
|
1385
|
+
flexDirection: "column",
|
|
1386
|
+
alignItems: "center",
|
|
1387
|
+
gap: s(t ? 10 : 12),
|
|
1388
|
+
width: "100%",
|
|
1389
|
+
maxWidth: s(560),
|
|
1390
|
+
minWidth: 0,
|
|
1391
|
+
textAlign: "center"
|
|
1392
|
+
}),
|
|
1393
|
+
sides: d({
|
|
1394
|
+
display: "flex",
|
|
1395
|
+
justifyContent: "center",
|
|
1396
|
+
alignItems: "center",
|
|
1397
|
+
flexWrap: "wrap",
|
|
1398
|
+
gap: s(12)
|
|
1399
|
+
}),
|
|
1400
|
+
pick: d({
|
|
1401
|
+
display: "flex",
|
|
1402
|
+
justifyContent: "center",
|
|
1403
|
+
alignItems: "center",
|
|
1404
|
+
gap: s(12),
|
|
1405
|
+
minWidth: 0
|
|
1406
|
+
}),
|
|
1407
|
+
pickName: d({
|
|
1408
|
+
margin: 0,
|
|
1409
|
+
minWidth: 0,
|
|
1410
|
+
overflowWrap: "anywhere",
|
|
1411
|
+
fontFamily: i.fontPrimary,
|
|
1412
|
+
fontWeight: 700,
|
|
1413
|
+
color: i.ink,
|
|
1414
|
+
unicodeBidi: "plaintext",
|
|
1415
|
+
...I(t ? [18, 24] : [20, 26])
|
|
1416
|
+
}),
|
|
1417
|
+
// Lead title and description come from the poll's CMS labels.
|
|
1418
|
+
title: d({
|
|
1419
|
+
margin: 0,
|
|
1420
|
+
fontFamily: i.fontPrimary,
|
|
1421
|
+
fontWeight: 700,
|
|
1422
|
+
letterSpacing: "-0.01em",
|
|
1423
|
+
color: i.text,
|
|
1424
|
+
unicodeBidi: "plaintext",
|
|
1425
|
+
...I(t ? [18, 24] : [22, 28])
|
|
1426
|
+
}),
|
|
1427
|
+
description: d({
|
|
1428
|
+
margin: 0,
|
|
1429
|
+
color: i.dim,
|
|
1430
|
+
unicodeBidi: "plaintext",
|
|
1431
|
+
...I([14, 20])
|
|
1432
|
+
}),
|
|
1433
|
+
form: d({
|
|
1434
|
+
fontSize: "1em",
|
|
1435
|
+
width: "100%",
|
|
1436
|
+
maxWidth: s(480),
|
|
1437
|
+
minWidth: 0,
|
|
1438
|
+
boxSizing: "border-box",
|
|
1439
|
+
padding: t ? i.spaceMd : i.spaceLg,
|
|
1440
|
+
borderRadius: i.radiusSm,
|
|
1441
|
+
backgroundColor: i.surface,
|
|
1442
|
+
border: `${i.borderSize} solid ${i.border}`
|
|
1443
|
+
})
|
|
1444
|
+
}), H = { d: Zt(!1), m: Zt(!0) }, De = { ltr: Qt(!1), rtl: Qt(!0) }, Be = (t) => {
|
|
1445
|
+
var h;
|
|
1446
|
+
const { layout: n, poll: e, sides: r, colours: o, picked: a } = t, { t: u } = mt("common"), m = Rt(), c = a !== null ? r[a] : null, f = e.labels, p = c ? /* @__PURE__ */ b("div", { css: H[n].pick, children: [
|
|
1447
|
+
/* @__PURE__ */ l(
|
|
1448
|
+
Q,
|
|
1449
|
+
{
|
|
1450
|
+
side: c,
|
|
1451
|
+
layout: n,
|
|
1452
|
+
variant: "row",
|
|
1453
|
+
language: t.language
|
|
1454
|
+
}
|
|
1455
|
+
),
|
|
1456
|
+
/* @__PURE__ */ l("p", { css: H[n].pickName, children: c.name })
|
|
1457
|
+
] }) : /* @__PURE__ */ l("div", { css: H[n].sides, "aria-hidden": "true", children: r.map((R, P) => /* @__PURE__ */ b(en.Fragment, { children: [
|
|
1458
|
+
P > 0 && /* @__PURE__ */ l("span", { css: De[m ? "rtl" : "ltr"] }),
|
|
1459
|
+
/* @__PURE__ */ l("span", { style: D(o[P]), children: /* @__PURE__ */ l(
|
|
1460
|
+
Q,
|
|
1461
|
+
{
|
|
1462
|
+
side: R,
|
|
1463
|
+
layout: n,
|
|
1464
|
+
variant: "row",
|
|
1465
|
+
language: t.language
|
|
1466
|
+
}
|
|
1467
|
+
) })
|
|
1468
|
+
] }, R.optionId)) });
|
|
1469
|
+
return /* @__PURE__ */ b(
|
|
1470
|
+
"div",
|
|
1471
|
+
{
|
|
1472
|
+
css: c ? H[n].panelPicked : H[n].panel,
|
|
1473
|
+
style: a !== null ? {
|
|
1474
|
+
...D(o[a]),
|
|
1475
|
+
"--fu-ucrc-primary-on-primary": o[a].on
|
|
1476
|
+
} : void 0,
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ b("div", { css: H[n].intro, children: [
|
|
1479
|
+
p,
|
|
1480
|
+
/* @__PURE__ */ l("h3", { css: H[n].title, children: (f == null ? void 0 : f.leadTitle) || u("leads.header.title") }),
|
|
1481
|
+
/* @__PURE__ */ l("p", { css: H[n].description, children: (f == null ? void 0 : f.leadDescription) || u("leads.header.description") })
|
|
1482
|
+
] }),
|
|
1483
|
+
/* @__PURE__ */ l("div", { css: H[n].form, children: /* @__PURE__ */ l(
|
|
1484
|
+
Pn,
|
|
1485
|
+
{
|
|
1486
|
+
sdk: t.sdk,
|
|
1487
|
+
brandingColors: c ? { primaryColor: o[a].fill } : void 0,
|
|
1488
|
+
brandingUrls: (h = e.branding) == null ? void 0 : h.urls,
|
|
1489
|
+
fields: t.leads.fields,
|
|
1490
|
+
campaignId: t.leads.campaignId,
|
|
1491
|
+
campaignName: t.leads.campaignName,
|
|
1492
|
+
contentType: "poll",
|
|
1493
|
+
contentId: e.id,
|
|
1494
|
+
contentName: e.title,
|
|
1495
|
+
syncWithProfile: t.leads.syncWithProfile,
|
|
1496
|
+
labels: {
|
|
1497
|
+
submitButtonLabel: (f == null ? void 0 : f.leadCta) || u("leads.buttons.submit"),
|
|
1498
|
+
successTitle: (f == null ? void 0 : f.leadSuccessTitle) || u("leads.success.title"),
|
|
1499
|
+
successDescription: (f == null ? void 0 : f.leadSuccessDescription) || u("leads.success.description")
|
|
1500
|
+
},
|
|
1501
|
+
onSuccessCta: {
|
|
1502
|
+
defaultLabel: t.continueLabel,
|
|
1503
|
+
onClick: t.onContinue
|
|
1504
|
+
},
|
|
1505
|
+
isSubmittingParticipation: t.submitting
|
|
1506
|
+
}
|
|
1507
|
+
) })
|
|
1508
|
+
]
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
}, tn = (t) => {
|
|
1512
|
+
const n = {
|
|
1513
|
+
flex: 1,
|
|
1514
|
+
fontFamily: i.fontPrimary,
|
|
1515
|
+
fontWeight: 700,
|
|
1516
|
+
fontVariantNumeric: "tabular-nums",
|
|
1517
|
+
...I(t.pctBar)
|
|
1518
|
+
}, e = (a) => d({
|
|
1519
|
+
minWidth: s(t.bar),
|
|
1520
|
+
backgroundColor: i.fill,
|
|
1521
|
+
borderRadius: a,
|
|
1522
|
+
transition: "flex-grow .6s cubic-bezier(.2,.8,.2,1)"
|
|
1523
|
+
}), r = i.radiusFull, o = s(3);
|
|
1524
|
+
return {
|
|
1525
|
+
root: d({
|
|
1526
|
+
display: "flex",
|
|
1527
|
+
flexDirection: "column",
|
|
1528
|
+
gap: s(t.barGap === 4 ? 10 : 8)
|
|
1529
|
+
}),
|
|
1530
|
+
labels: d({
|
|
1531
|
+
display: "flex",
|
|
1532
|
+
alignItems: "center",
|
|
1533
|
+
gap: s(t.labelsGap),
|
|
1534
|
+
minHeight: s(t.pctBar[1])
|
|
1535
|
+
}),
|
|
1536
|
+
pct: d(n, { color: i.ink }),
|
|
1537
|
+
pctEnd: d(n, { color: i.ink, textAlign: "end" }),
|
|
1538
|
+
// 3+ sides: one label per segment, sized like it.
|
|
1539
|
+
cell: d(n, {
|
|
1540
|
+
minWidth: s(t.bar),
|
|
1541
|
+
color: i.ink,
|
|
1542
|
+
overflow: "hidden",
|
|
1543
|
+
whiteSpace: "nowrap"
|
|
1544
|
+
}),
|
|
1545
|
+
caption: d({
|
|
1546
|
+
fontWeight: 500,
|
|
1547
|
+
textTransform: "uppercase",
|
|
1548
|
+
letterSpacing: "0.05em",
|
|
1549
|
+
whiteSpace: "nowrap",
|
|
1550
|
+
color: i.dim,
|
|
1551
|
+
...I(t.caption)
|
|
1552
|
+
}),
|
|
1553
|
+
bar: d({ display: "flex", gap: s(t.barGap), height: s(t.bar) }),
|
|
1554
|
+
segFirst: e(`${r} ${o} ${o} ${r}`),
|
|
1555
|
+
segLast: e(`${o} ${r} ${r} ${o}`),
|
|
1556
|
+
segMid: e(o),
|
|
1557
|
+
lock: d({
|
|
1558
|
+
display: "flex",
|
|
1559
|
+
alignItems: "center",
|
|
1560
|
+
justifyContent: "center",
|
|
1561
|
+
gap: s(8, 14),
|
|
1562
|
+
minHeight: s(t.pctBar[1], 14),
|
|
1563
|
+
fontWeight: 500,
|
|
1564
|
+
color: i.dim,
|
|
1565
|
+
...I([14, 20])
|
|
1566
|
+
}),
|
|
1567
|
+
lockIcon: d({ fontSize: s(18, 14), flexShrink: 0 }),
|
|
1568
|
+
track: d({
|
|
1569
|
+
height: s(t.bar),
|
|
1570
|
+
borderRadius: i.radiusFull,
|
|
1571
|
+
backgroundColor: i.track
|
|
1572
|
+
})
|
|
1573
|
+
};
|
|
1574
|
+
}, W = { d: tn(Z), m: tn(tt) }, ze = ({
|
|
1575
|
+
layout: t,
|
|
1576
|
+
label: n,
|
|
1577
|
+
colours: e,
|
|
1578
|
+
shares: r,
|
|
1579
|
+
percents: o,
|
|
1580
|
+
ended: a,
|
|
1581
|
+
splitLabel: u
|
|
1582
|
+
}) => {
|
|
1583
|
+
if (o.some((p) => p === null))
|
|
1584
|
+
return /* @__PURE__ */ b("div", { css: W[t].root, children: [
|
|
1585
|
+
/* @__PURE__ */ b("div", { css: W[t].lock, children: [
|
|
1586
|
+
/* @__PURE__ */ l(Un, { css: W[t].lockIcon }),
|
|
1587
|
+
/* @__PURE__ */ l("span", { children: n("voteToSeeResults") })
|
|
1588
|
+
] }),
|
|
1589
|
+
/* @__PURE__ */ l("div", { css: W[t].track, "aria-hidden": "true" })
|
|
1590
|
+
] });
|
|
1591
|
+
const m = r.length, c = r.every((p) => p === 0) ? r.map(() => 1) : r, f = m - 1;
|
|
1592
|
+
return /* @__PURE__ */ b("div", { css: W[t].root, children: [
|
|
1593
|
+
m === 2 ? /* @__PURE__ */ b("div", { css: W[t].labels, children: [
|
|
1594
|
+
/* @__PURE__ */ l("div", { css: W[t].pct, style: D(e[0]), children: o[0] }),
|
|
1595
|
+
a && /* @__PURE__ */ l("div", { css: W[t].caption, children: n("finalResult") }),
|
|
1596
|
+
/* @__PURE__ */ l("div", { css: W[t].pctEnd, style: D(e[1]), children: o[1] })
|
|
1597
|
+
] }) : /* @__PURE__ */ l("div", { css: W[t].labels, children: o.map((p, h) => /* @__PURE__ */ l(
|
|
1598
|
+
"div",
|
|
1599
|
+
{
|
|
1600
|
+
css: W[t].cell,
|
|
1601
|
+
style: { ...D(e[h]), flex: `${c[h]} 1 0%` },
|
|
1602
|
+
children: p
|
|
1603
|
+
},
|
|
1604
|
+
h
|
|
1605
|
+
)) }),
|
|
1606
|
+
/* @__PURE__ */ l(
|
|
1607
|
+
"div",
|
|
1608
|
+
{
|
|
1609
|
+
css: W[t].bar,
|
|
1610
|
+
role: "img",
|
|
1611
|
+
"aria-label": u ?? void 0,
|
|
1612
|
+
children: e.map((p, h) => /* @__PURE__ */ l(
|
|
1613
|
+
"div",
|
|
1614
|
+
{
|
|
1615
|
+
css: h === 0 ? W[t].segFirst : h === f ? W[t].segLast : W[t].segMid,
|
|
1616
|
+
style: { ...D(p), flex: `${c[h]} 1 0%` }
|
|
1617
|
+
},
|
|
1618
|
+
h
|
|
1619
|
+
))
|
|
1620
|
+
}
|
|
1621
|
+
)
|
|
1622
|
+
] });
|
|
1623
|
+
}, Me = { d: s(90), m: s(120) }, gn = { d: s(Z.arenaFill), m: s(tt.arenaFill) }, Ve = { d: s(Z.arenaBar), m: s(tt.arenaBar) }, He = ({ layout: t, fill: n, odds: e }) => /* @__PURE__ */ b("div", { css: y[t].root, "aria-busy": "true", children: [
|
|
1624
|
+
/* @__PURE__ */ b("div", { css: y[t].body, children: [
|
|
1625
|
+
/* @__PURE__ */ l("div", { css: y[t].header, style: { minHeight: Me[t] }, children: /* @__PURE__ */ l("div", { css: y[t].titleSkeleton }) }),
|
|
1626
|
+
n ? /* @__PURE__ */ l(
|
|
1627
|
+
"div",
|
|
1628
|
+
{
|
|
1629
|
+
css: y[t].arenaSkeleton,
|
|
1630
|
+
style: { height: gn[t] }
|
|
1631
|
+
}
|
|
1632
|
+
) : /* @__PURE__ */ b(Wt, { children: [
|
|
1633
|
+
/* @__PURE__ */ l(
|
|
1634
|
+
"div",
|
|
1635
|
+
{
|
|
1636
|
+
css: y[t].arenaSkeleton,
|
|
1637
|
+
style: { height: Ve[t] }
|
|
1638
|
+
}
|
|
1639
|
+
),
|
|
1640
|
+
/* @__PURE__ */ l("div", { css: y[t].resultsSkeleton, children: /* @__PURE__ */ l("div", { css: y[t].barSkeleton }) })
|
|
1641
|
+
] })
|
|
1642
|
+
] }),
|
|
1643
|
+
e && /* @__PURE__ */ l("div", { css: y[t].oddsSlot, children: /* @__PURE__ */ l(an, { size: t === "m" ? "dense" : "default" }) })
|
|
1644
|
+
] }), Ae = ({
|
|
1645
|
+
layout: t,
|
|
1646
|
+
label: n,
|
|
1647
|
+
kind: e,
|
|
1648
|
+
onRetry: r
|
|
1649
|
+
}) => {
|
|
1650
|
+
const { t: o } = mt("common"), a = e === "notFound" ? n("notAvailableTitle") : o("common.error.title"), u = e === "notFound" ? n("notAvailableMessage") : o("common.error.message");
|
|
1651
|
+
return /* @__PURE__ */ l("div", { css: y[t].root, children: /* @__PURE__ */ b("div", { css: y[t].body, children: [
|
|
1652
|
+
/* @__PURE__ */ l("div", { css: y[t].header, children: /* @__PURE__ */ l("h2", { css: y[t].title, children: n("title") }) }),
|
|
1653
|
+
/* @__PURE__ */ b(
|
|
1654
|
+
"div",
|
|
1655
|
+
{
|
|
1656
|
+
css: y[t].message,
|
|
1657
|
+
style: { minHeight: gn[t] },
|
|
1658
|
+
role: "alert",
|
|
1659
|
+
children: [
|
|
1660
|
+
/* @__PURE__ */ l("h3", { css: y[t].messageTitle, children: a }),
|
|
1661
|
+
/* @__PURE__ */ l("p", { css: y[t].messageText, children: u }),
|
|
1662
|
+
e === "error" && /* @__PURE__ */ l("button", { type: "button", css: y[t].retry, onClick: r, children: o("common.retry") })
|
|
1663
|
+
]
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1666
|
+
] }) });
|
|
1667
|
+
}, nn = (t, n, e) => {
|
|
1668
|
+
const r = ke(t);
|
|
1669
|
+
return t.map((o, a) => Ie(r, a, n, e));
|
|
1670
|
+
}, je = (t) => {
|
|
1671
|
+
var Nt, Dt, Bt, zt, Mt, Vt, Ht;
|
|
1672
|
+
const {
|
|
1673
|
+
sdk: n,
|
|
1674
|
+
language: e,
|
|
1675
|
+
progressDisplay: r = "bar",
|
|
1676
|
+
showResultsBeforeVote: o = !0,
|
|
1677
|
+
showTrophy: a = !0,
|
|
1678
|
+
trophyPosition: u = "bottom-right",
|
|
1679
|
+
showOdds: m = !1,
|
|
1680
|
+
odds: c
|
|
1681
|
+
} = t, { t: f } = mt("common"), p = pe(t.labels), h = Vn() ? "m" : "d", R = h === "m" ? tt : Z, P = Rt(), U = sn(), E = Hn(), _ = r === "background", $ = ue({
|
|
1682
|
+
entityId: t.entityId,
|
|
1683
|
+
sdk: n,
|
|
1684
|
+
language: e,
|
|
1685
|
+
userIsLoggedIn: t.userIsLoggedIn,
|
|
1686
|
+
callbacks: t.callbacks
|
|
1687
|
+
}), { sides: k, votes: rt, poll: O, endMs: G } = $, [ft, B] = T(!1), [z, C] = T(null), S = me(G), M = G !== null && S >= G, x = !!O && (O.status !== "ACTIVE" || M), w = on(!1), { refresh: L } = $;
|
|
1688
|
+
Ft(() => {
|
|
1689
|
+
O && (M ? w.current && (w.current = !1, L()) : w.current = !0);
|
|
1690
|
+
}, [O, M, L]);
|
|
1691
|
+
const Y = j(
|
|
1692
|
+
() => {
|
|
1693
|
+
var v, A;
|
|
1694
|
+
return {
|
|
1695
|
+
surface: E.surface,
|
|
1696
|
+
text: E.textPrimary,
|
|
1697
|
+
primary: E.palette.primary.plainColor,
|
|
1698
|
+
onPrimary: E.palette.primary.onPrimary,
|
|
1699
|
+
extras: [
|
|
1700
|
+
(v = E.palette.success) == null ? void 0 : v.plainColor,
|
|
1701
|
+
(A = E.palette.warning) == null ? void 0 : A.plainColor
|
|
1702
|
+
].filter((On) => !!On)
|
|
1703
|
+
};
|
|
1704
|
+
},
|
|
1705
|
+
[E]
|
|
1706
|
+
), V = j(() => k.map((v) => v.brand), [k]), nt = j(() => ge(V, Y), [V, Y]), bn = cn(
|
|
1707
|
+
((Nt = E.palette.warning) == null ? void 0 : Nt.plainColor) ?? Y.primary,
|
|
1708
|
+
Y
|
|
1709
|
+
), X = c == null ? void 0 : c.eventId, ht = m && !!X && k.length === 2 && k.every((v) => v.kind === "team"), yn = m && !!X, { odds: xn, loading: kn } = jn(
|
|
1710
|
+
n,
|
|
1711
|
+
ht && X ? [X] : [],
|
|
1712
|
+
{
|
|
1713
|
+
enabled: ht,
|
|
1714
|
+
markets: [(c == null ? void 0 : c.market) ?? "FT_1X2"],
|
|
1715
|
+
sport: "FOOTBALL",
|
|
1716
|
+
pollingIntervalMs: c == null ? void 0 : c.pollingInterval,
|
|
1717
|
+
operators: c == null ? void 0 : c.operators,
|
|
1718
|
+
affiliateId: c == null ? void 0 : c.affiliateId,
|
|
1719
|
+
affiliateIds: c == null ? void 0 : c.affiliateIds
|
|
1720
|
+
}
|
|
1721
|
+
), Ot = X ? xn.get(X) : void 0, Sn = j(
|
|
1722
|
+
() => new Intl.NumberFormat(U, {
|
|
1723
|
+
style: "percent",
|
|
1724
|
+
maximumFractionDigits: 0
|
|
1725
|
+
}),
|
|
1726
|
+
[U]
|
|
1727
|
+
);
|
|
1728
|
+
if ($.status === "loading")
|
|
1729
|
+
return /* @__PURE__ */ l(He, { layout: h, fill: _, odds: yn });
|
|
1730
|
+
if ($.status !== "ready" || !O)
|
|
1731
|
+
return /* @__PURE__ */ l(
|
|
1732
|
+
Ae,
|
|
1733
|
+
{
|
|
1734
|
+
layout: h,
|
|
1735
|
+
label: p,
|
|
1736
|
+
kind: $.status === "notFound" ? "notFound" : "error",
|
|
1737
|
+
onRetry: $.retry
|
|
1738
|
+
}
|
|
1739
|
+
);
|
|
1740
|
+
const it = re(rt), st = x ? ie(rt) : null, In = x && st === null, K = k.findIndex(
|
|
1741
|
+
(v) => v.optionId === $.votedOptionId
|
|
1742
|
+
), gt = x || o || K >= 0, bt = it.map(
|
|
1743
|
+
(v) => gt ? Sn.format(v / 100) : null
|
|
1744
|
+
), vn = h === "m" && k.length > 2, Pt = k.map(() => 100 / k.length), Lt = st !== null ? xe(it, st, _, h === "m") : _ && gt ? ye(it, h === "m") : Pt, $n = k.map((v, A) => x || K < 0 || K === A), Cn = k.map((v, A) => K === A ? "chosen" : K >= 0 ? "locked" : $.signInRequired ? "signIn" : $.submitting ? "submitting" : "open"), yt = O.authRequirement === "LEAD" && !ft && !x && K < 0 ? (Dt = t.leads) == null ? void 0 : Dt.position : void 0, wn = yt === "before" || yt === "after" && z !== null, Wn = (v) => {
|
|
1745
|
+
yt === "after" ? C(v) : $.vote(k[v].optionId);
|
|
1746
|
+
}, Fn = async () => {
|
|
1747
|
+
B(!0), z !== null && (await $.vote(k[z].optionId), C(null));
|
|
1748
|
+
}, Tt = gt ? `${p("voteSplit")}: ${k.map((v, A) => `${v.name} ${bt[A]}`).join(", ")}` : null, Rn = k.every((v) => v.kind === "player"), En = G !== null && !x ? ae(G, S) : null;
|
|
1749
|
+
return /* @__PURE__ */ b(
|
|
1750
|
+
"div",
|
|
1751
|
+
{
|
|
1752
|
+
css: y[h].root,
|
|
1753
|
+
style: { "--bof-trophy-on": bn },
|
|
1754
|
+
children: [
|
|
1755
|
+
/* @__PURE__ */ b("div", { css: y[h].body, children: [
|
|
1756
|
+
/* @__PURE__ */ l(
|
|
1757
|
+
Ne,
|
|
1758
|
+
{
|
|
1759
|
+
layout: h,
|
|
1760
|
+
label: p,
|
|
1761
|
+
title: ((zt = (Bt = t.labels) == null ? void 0 : Bt.title) == null ? void 0 : zt.trim()) || ((Mt = O.title) == null ? void 0 : Mt.trim()) || p("title"),
|
|
1762
|
+
openSubtitle: ((Ht = (Vt = t.labels) == null ? void 0 : Vt.subtitle) == null ? void 0 : Ht.trim()) || An(O.description ?? null).trim() || p(Rn ? "subtitlePlayers" : "subtitleTeams"),
|
|
1763
|
+
ended: x,
|
|
1764
|
+
draw: In,
|
|
1765
|
+
left: En
|
|
1766
|
+
}
|
|
1767
|
+
),
|
|
1768
|
+
wn && t.leads ? /* @__PURE__ */ l(
|
|
1769
|
+
Be,
|
|
1770
|
+
{
|
|
1771
|
+
layout: h,
|
|
1772
|
+
sdk: n,
|
|
1773
|
+
poll: O,
|
|
1774
|
+
leads: t.leads,
|
|
1775
|
+
sides: k,
|
|
1776
|
+
colours: nt,
|
|
1777
|
+
picked: z,
|
|
1778
|
+
language: e,
|
|
1779
|
+
continueLabel: z !== null ? p("voteFor", { name: k[z].name }) : f("poll.buttons.continue"),
|
|
1780
|
+
onContinue: Fn,
|
|
1781
|
+
submitting: $.submitting
|
|
1782
|
+
}
|
|
1783
|
+
) : /* @__PURE__ */ b(Wt, { children: [
|
|
1784
|
+
/* @__PURE__ */ l(
|
|
1785
|
+
Le,
|
|
1786
|
+
{
|
|
1787
|
+
view: {
|
|
1788
|
+
layout: h,
|
|
1789
|
+
fill: _,
|
|
1790
|
+
rows: vn,
|
|
1791
|
+
sides: k,
|
|
1792
|
+
colours: nt,
|
|
1793
|
+
percents: bt,
|
|
1794
|
+
ended: x,
|
|
1795
|
+
winner: st,
|
|
1796
|
+
lit: $n,
|
|
1797
|
+
widths: Lt,
|
|
1798
|
+
clips: nn(Lt, R.slant, P),
|
|
1799
|
+
slant: R.slant,
|
|
1800
|
+
evenClips: nn(Pt, R.slant, P),
|
|
1801
|
+
actions: Cn,
|
|
1802
|
+
showTrophy: a,
|
|
1803
|
+
trophyPosition: u,
|
|
1804
|
+
language: e,
|
|
1805
|
+
label: p,
|
|
1806
|
+
splitLabel: Tt,
|
|
1807
|
+
signInCTA: t.signInCTA,
|
|
1808
|
+
onVote: Wn
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
),
|
|
1812
|
+
!_ && /* @__PURE__ */ l(
|
|
1813
|
+
ze,
|
|
1814
|
+
{
|
|
1815
|
+
layout: h,
|
|
1816
|
+
label: p,
|
|
1817
|
+
colours: nt,
|
|
1818
|
+
shares: it,
|
|
1819
|
+
percents: bt,
|
|
1820
|
+
ended: x,
|
|
1821
|
+
splitLabel: Tt
|
|
1822
|
+
}
|
|
1823
|
+
)
|
|
1824
|
+
] })
|
|
1825
|
+
] }),
|
|
1826
|
+
Ot ? /* @__PURE__ */ l(
|
|
1827
|
+
_n,
|
|
1828
|
+
{
|
|
1829
|
+
odds: Ot,
|
|
1830
|
+
market: (c == null ? void 0 : c.market) ?? "FT_1X2",
|
|
1831
|
+
size: h === "m" ? "dense" : "default",
|
|
1832
|
+
mode: c == null ? void 0 : c.mode,
|
|
1833
|
+
flashInterval: c == null ? void 0 : c.flashInterval
|
|
1834
|
+
}
|
|
1835
|
+
) : ht && kn && /* @__PURE__ */ l("div", { css: y[h].oddsSlot, children: /* @__PURE__ */ l(an, { size: h === "m" ? "dense" : "default" }) }),
|
|
1836
|
+
/* @__PURE__ */ l(
|
|
1837
|
+
Ln,
|
|
1838
|
+
{
|
|
1839
|
+
notification: {
|
|
1840
|
+
open: !!$.voteError,
|
|
1841
|
+
variant: "error",
|
|
1842
|
+
title: f("common.error.title"),
|
|
1843
|
+
message: $.voteError ?? ""
|
|
1844
|
+
},
|
|
1845
|
+
onClose: $.clearVoteError
|
|
1846
|
+
}
|
|
1847
|
+
)
|
|
1848
|
+
]
|
|
1849
|
+
}
|
|
1850
|
+
);
|
|
1851
|
+
}, _e = (t) => {
|
|
1852
|
+
var n;
|
|
1853
|
+
return /* @__PURE__ */ l(
|
|
1854
|
+
Tn,
|
|
1855
|
+
{
|
|
1856
|
+
packageName: "battle-of-fans",
|
|
1857
|
+
language: t.language,
|
|
1858
|
+
themeOptions: t.themeOptions,
|
|
1859
|
+
disableCache: t.disableCache,
|
|
1860
|
+
leadPhoneCountryCode: (n = t.leads) == null ? void 0 : n.phoneCountryCode,
|
|
1861
|
+
children: /* @__PURE__ */ l(je, { ...t })
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
}, no = Yn(_e);
|
|
1865
|
+
export {
|
|
1866
|
+
no as BattleOfFans
|
|
1867
|
+
};
|