fansunited-frontend-components 0.0.99 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +496 -505
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +405 -1163
  5. package/CompetitionStatistics.js +2 -2
  6. package/CompetitorCard.js +445 -425
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +648 -593
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +142 -132
  12. package/List.js +675 -713
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +1 -1
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +925 -1824
  17. package/PlayerOfTheMatch.js +2106 -2223
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +4209 -18629
  20. package/Standings.js +497 -486
  21. package/TopX.js +3223 -16958
  22. package/chunks/{ChanceGameEmbedVariant-DM9eLG5s.js → ChanceGameEmbedVariant-z8XYzgDW.js} +1 -1
  23. package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
  24. package/chunks/index-BNl8scz6.js +4 -0
  25. package/chunks/index-CSa2JU4m.js +4 -0
  26. package/chunks/index-CVRI82Gb.js +4 -0
  27. package/chunks/index-Cd1dg0KI.js +4 -0
  28. package/chunks/index-Cei2fzi7.js +4 -0
  29. package/chunks/index-Cxb4wEJU.js +4 -0
  30. package/chunks/index-w1LGN5dz.js +4 -0
  31. package/chunks/main-07vzblS8.js +2091 -0
  32. package/chunks/main-C7X4dM_P.js +4827 -0
  33. package/chunks/main-D_QDfmAw.js +6417 -0
  34. package/chunks/{main-CzfWaEQP.js → main-DdL0UekL.js} +1931 -2025
  35. package/chunks/main-DmBfwyb4.js +2992 -0
  36. package/chunks/main-LEE8n2cG.js +3117 -0
  37. package/chunks/{main-DxvBjXsd.js → main-P2WNvBZE.js} +473 -444
  38. package/chunks/{main-DiBlJBNb.js → main-gV165E-A.js} +629 -657
  39. package/chunks/predictionsHelpers-fwXaMadu.js +10063 -0
  40. package/chunks/{withVersionStamp-BsLyhvNA.js → withVersionStamp-CPDfSE5H.js} +1 -1
  41. package/package.json +2 -6
  42. package/withVersionStamp.d.ts.map +1 -1
  43. package/chunks/CheckCircle-I1FktW5Y.js +0 -13
  44. package/chunks/Person-CXRqyF4E.js +0 -11
  45. package/chunks/PickOneOfX-DET4ZhjV.js +0 -3117
  46. package/chunks/Search-CIXthh0D.js +0 -17
  47. package/chunks/TimerOutlined-D-WA_vpE.js +0 -8
  48. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +0 -136
  49. package/chunks/chevrons-right-HWKW2c4I.js +0 -45
  50. package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
  51. package/chunks/index-BENM3N_w.js +0 -4
  52. package/chunks/index-BRxAV693.js +0 -4
  53. package/chunks/index-BXYTsvIX.js +0 -4
  54. package/chunks/index-C0ilols1.js +0 -4
  55. package/chunks/index-D7VhczXH.js +0 -4
  56. package/chunks/index-DKwvdw9t.js +0 -4
  57. package/chunks/index-DZN-AITW.js +0 -4
  58. package/chunks/main-B2sDRFF4.js +0 -2184
  59. package/chunks/main-DFNl3g_U.js +0 -4910
  60. package/chunks/main-DLwnvntz.js +0 -4020
  61. package/chunks/main-S8_NDSiY.js +0 -3209
  62. package/chunks/main-lBgr8Liq.js +0 -6571
@@ -0,0 +1,2091 @@
1
+ import { jsx as t, jsxs as h, Fragment as ke } from "@emotion/react/jsx-runtime";
2
+ import { useDisableCache as jt, getTranslatedPollIds as xt, useInternalTheme as xe, useColors as be, useEmbedCode as Ne, useIsMobile as ne, useConstantContext as Le, ConstantsContext as Te, useIsLarge as Me, useBrandingModelProperties as Ye, defaultBgVertical as De, defaultBg as we, useImageVariant as Re, WidgetTemplate as G, fontFamilyOf as zt, useIsExtraSmall as nn, hexToRgb as Xe, stripHtmlTags as ln, useIntlLocale as qt, useIsDesktop as on, useImageBackgroundGradient as an, sanitizeBackgroundUrl as rn, getRelatedInfoPageId as cn, useConsents as sn, initializeI18n as dn, ChanceGameEmbed as Ct, extractSdkError as un } from "fansunited-frontend-core";
3
+ import { C as St } from "./ChanceGameEmbedVariant-z8XYzgDW.js";
4
+ import ve, { useState as V, useEffect as ye, useCallback as gn, useRef as mn, useMemo as ot } from "react";
5
+ import { PollFullModel as fn, SinglePollVoteModel as hn } from "fansunited-sdk-esm/models";
6
+ import { PresentedBy as bn, PlayCollectLeadWrapper as yn, AspectRatio as st, useBreakpointUp as Ke, baseBody as Oe, space as g, baseButton as Ae, OverlaySkeleton as vn, ConsentPanel as Ee, ConsentCta as _e, SignInCta as dt, InlineSpinner as Wt, ctaButton as xn, ctaLabel as It, StandardSkeleton as Cn, SplitSkeleton as Sn, StandardScoreStateSkeleton as In, AlertMessage as ut, AdditionalCTA as gt, ReplayButton as Pn, SplitScoreStateSkeleton as pn, OverlayScoreStateSkeleton as kn, NotFound as An, OverlayApiErrorSkeleton as Gt, SplitApiErrorSkeleton as Ht, StandardApiErrorSkeleton as $t, StandardLeadAfterCollection as Nt, SplitLeadAfterCollection as Yt, OverlayLeadAfterCollection as Xt, Spinner as Ln, WidgetPortal as Tn } from "fansunited-frontend-core/ui/emotion";
7
+ import { css as n } from "@emotion/react";
8
+ import { useTranslation as j } from "react-i18next";
9
+ import { PeopleIcon as Kt, ReplayIcon as _t } from "fansunited-frontend-core/ui/icons";
10
+ const Dn = (e, l) => {
11
+ const [o, i] = V(null), s = jt(), c = async () => {
12
+ try {
13
+ const a = await l.voting.getPollById(e, s);
14
+ i(a);
15
+ } catch (a) {
16
+ console.error(a), i(new fn());
17
+ }
18
+ };
19
+ return ye(() => (c(), () => i(null)), [e, l, s]), { poll: o, setPoll: i };
20
+ }, wn = (e, l, o, i = !1, s = !1) => {
21
+ const [c, a] = V(null), [r, m] = V(!1), [f, y] = V(!1), [b, u] = V(""), [x, C] = V(o);
22
+ o !== x && (C(o), a(null));
23
+ const D = async () => {
24
+ try {
25
+ const k = await l.voting.getMyPollVote(e);
26
+ a(k);
27
+ } catch (R) {
28
+ if (a(new hn()), l.helpers.getSDKConfiguration().errorHandlingMode === "standard") {
29
+ const P = R;
30
+ if (P.error.code === 404)
31
+ return;
32
+ if (P.error.code === 401 || P.error.code === 403) {
33
+ i || m(!0);
34
+ return;
35
+ }
36
+ y(!0), u(P.error.message);
37
+ return;
38
+ }
39
+ const S = R;
40
+ if (S.data.error.code === 404)
41
+ return;
42
+ if (S.data.error.code === 401 || S.data.error.code === 403) {
43
+ i || m(!0);
44
+ return;
45
+ }
46
+ y(!0), u(S.data.error.message);
47
+ }
48
+ };
49
+ return ye(() => (D(), () => {
50
+ a(null), m(!1), y(!1);
51
+ }), [e, l, o, i, s]), {
52
+ myVote: c,
53
+ setMyVote: a,
54
+ isUnauthorized: r,
55
+ isApiError: f,
56
+ apiErrorMessage: b,
57
+ setIsUnauthorized: m,
58
+ setIsApiError: y,
59
+ setApiErrorMessage: u
60
+ };
61
+ }, Pt = async (e, l, o) => {
62
+ if (!l.length) return [];
63
+ const i = await e.voting.getPolls(
64
+ { pollIds: l, limit: l.length },
65
+ o
66
+ );
67
+ return (i == null ? void 0 : i.data) || [];
68
+ }, Rn = async (e, l, o = !1) => {
69
+ const i = /* @__PURE__ */ new Set([e.id]), s = (f) => f.filter((y) => !i.has(y)), c = s(xt(e.related));
70
+ c.forEach((f) => i.add(f));
71
+ const a = await Pt(l, c, o), r = s(
72
+ Array.from(new Set(a.flatMap((f) => xt(f.related))))
73
+ ), m = await Pt(l, r, o);
74
+ return [...a, ...m];
75
+ }, En = (e, l) => {
76
+ const o = l.filter((i) => {
77
+ var s;
78
+ return ((s = i.options) == null ? void 0 : s.length) === e.length ? !0 : (console.warn(
79
+ `[poll-vote] translated poll ${i.id} has a different number of options, its votes are not aggregated`
80
+ ), !1);
81
+ });
82
+ return e.map((i, s) => ({
83
+ ...i,
84
+ votes: o.reduce(
85
+ (c, a) => c + (a.options[s].votes || 0),
86
+ i.votes || 0
87
+ )
88
+ }));
89
+ }, Un = (e, l) => {
90
+ const [o, i] = V([]), [s, c] = V(!1), a = jt(), r = gn(async () => {
91
+ if (e != null && e.id)
92
+ try {
93
+ i(await Rn(e, l, a));
94
+ } catch (m) {
95
+ console.error("[poll-vote] translated polls could not be loaded", m), i([]);
96
+ } finally {
97
+ c(!0);
98
+ }
99
+ }, [e, l, a]);
100
+ return { translations: o, loaded: s, loadTranslations: r };
101
+ }, W = (e) => /* @__PURE__ */ t(bn, { inheritColor: !0, ...e }), Ue = ({ isAfterPosition: e = !1, ...l }) => {
102
+ const { t: o } = j();
103
+ return /* @__PURE__ */ t(
104
+ yn,
105
+ {
106
+ ...l,
107
+ contentType: "poll",
108
+ successCtaLabel: o(e ? "poll.buttons.vote" : "poll.buttons.start")
109
+ }
110
+ );
111
+ }, je = {
112
+ borderRadius: "var(--fu-ucrc-radius-sm)",
113
+ flex: 1,
114
+ padding: "var(--fu-ucrc-space-xs)",
115
+ gap: "var(--fu-ucrc-space-xs)",
116
+ backgroundColor: "#FFFFFF",
117
+ boxShadow: "none",
118
+ cursor: "pointer",
119
+ opacity: 1,
120
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
121
+ transform: "scale(1)",
122
+ display: "flex",
123
+ flexDirection: "column",
124
+ "&:hover": { transform: "scale(1.02)" },
125
+ "&:active": { transform: "scale(0.98)" }
126
+ }, pt = {
127
+ backgroundColor: "var(--fu-ucrc-pv-primary)",
128
+ boxShadow: "inset 0 0 0 var(--fu-ucrc-border-size) var(--fu-ucrc-pv-primary)"
129
+ }, kt = {
130
+ cursor: "not-allowed",
131
+ opacity: 0.5,
132
+ "&:hover": { transform: "scale(1)" },
133
+ "&:active": { transform: "scale(1)" }
134
+ }, At = {
135
+ margin: 0,
136
+ unicodeBidi: "plaintext",
137
+ fontFamily: "var(--fu-ucrc-font-primary)",
138
+ fontWeight: 500,
139
+ fontSize: "0.935em",
140
+ letterSpacing: "0.46px",
141
+ textAlign: "center",
142
+ color: "var(--fu-ucrc-pv-option-text)",
143
+ paddingInline: "var(--fu-ucrc-space-2xs)"
144
+ }, fe = {
145
+ card: n(je),
146
+ cardSelected: n(je, pt),
147
+ cardDisabled: n(je, kt),
148
+ cardSelectedDisabled: n(je, pt, kt),
149
+ media: n({ borderRadius: "var(--fu-ucrc-radius-xs)", overflow: "hidden", flexGrow: 1 }),
150
+ img: n({ width: "100%", height: "100%", objectFit: "cover" }),
151
+ mediaTitle: n({ ...At, lineHeight: "24px" }),
152
+ title: n({ ...At, lineHeight: "16px", marginBlock: "auto" })
153
+ }, Bn = (e) => {
154
+ var b;
155
+ const l = xe(), o = be(), i = Ne(e.option.embedCode || ""), s = !!e.option.embedCode, c = e.optionsImages.get(e.option.id), a = e.selectedOptions.includes(e.option.id), r = e.isVoting || e.disabled || e.multipleChoice && !a && e.selectedOptions.length >= (e.maxChoices || 1), m = {
156
+ "--fu-ucrc-pv-primary": ((b = e.brandingColors) == null ? void 0 : b.primaryColor) || o.palette.primary.plainColor,
157
+ // The card is always white, so unselected text keeps the light scheme's colour.
158
+ "--fu-ucrc-pv-option-text": a ? o.palette.primary.onPrimary : l.colorSchemes.light.textColor
159
+ }, f = r ? void 0 : () => e.answerPoll([e.option.id]), y = s ? /* @__PURE__ */ t("div", { ref: i }) : c ? /* @__PURE__ */ t("img", { src: c, alt: "Option illustration", css: fe.img }) : null;
160
+ return /* @__PURE__ */ t(
161
+ "div",
162
+ {
163
+ css: a ? r ? fe.cardSelectedDisabled : fe.cardSelected : r ? fe.cardDisabled : fe.card,
164
+ style: m,
165
+ onClick: f,
166
+ children: y ? /* @__PURE__ */ h(ke, { children: [
167
+ /* @__PURE__ */ t("div", { css: fe.media, children: /* @__PURE__ */ t(st, { ratio: "16/9", radius: "var(--fu-ucrc-radius-xs)", children: y }) }),
168
+ /* @__PURE__ */ t("p", { css: fe.mediaTitle, children: e.option.title })
169
+ ] }) : /* @__PURE__ */ t("p", { css: fe.title, children: e.option.title })
170
+ }
171
+ );
172
+ }, Lt = { display: "flex", flexDirection: "column", gap: "16px" }, te = {
173
+ list: n({ ...Lt, paddingBlock: "16px" }),
174
+ row: n({ display: "flex", flexDirection: "row", gap: "16px" }),
175
+ column: n(Lt),
176
+ wrapRow: n({ display: "flex", flexWrap: "wrap", flexDirection: "row", gap: "16px", paddingBlock: "16px" }),
177
+ wrapColumn: n({ display: "flex", flexWrap: "wrap", flexDirection: "column", gap: "16px", paddingBlock: "16px" })
178
+ }, Qt = (e) => {
179
+ const l = [];
180
+ for (let o = 0; o < e.length; o += 2) l.push(e.slice(o, o + 2));
181
+ return l;
182
+ }, mt = (e) => {
183
+ const l = Ke("md"), o = (i) => /* @__PURE__ */ t(
184
+ Bn,
185
+ {
186
+ option: i,
187
+ optionsImages: e.optionsImages,
188
+ selectedOptions: e.selectedOptions,
189
+ answerPoll: e.answerPoll,
190
+ brandingColors: e.brandingColors,
191
+ multipleChoice: e.multipleChoice,
192
+ maxChoices: e.maxChoices,
193
+ isVoting: e.isVoting,
194
+ disabled: e.disabled
195
+ },
196
+ i.id
197
+ );
198
+ return e.optionsLayout === "twoByTwo" ? /* @__PURE__ */ t("div", { css: te.list, children: Qt(e.options).map((i, s) => /* @__PURE__ */ t("div", { css: l ? te.row : te.column, children: i.map(o) }, `row-${s}`)) }) : e.optionsLayout === "column" ? /* @__PURE__ */ t("div", { css: te.list, children: e.options.map(o) }) : /* @__PURE__ */ t("div", { css: l ? te.wrapRow : te.wrapColumn, children: e.options.map(o) });
199
+ }, Be = (e) => {
200
+ const l = /* @__PURE__ */ new Map(), o = ne();
201
+ return e.forEach((i) => {
202
+ var a, r;
203
+ const c = (o ? (a = i.images) == null ? void 0 : a.mobile : (r = i.images) == null ? void 0 : r.main) || "";
204
+ l.set(i.id, c);
205
+ }), l;
206
+ }, Vn = {
207
+ display: "flex",
208
+ flexDirection: "column",
209
+ gap: "var(--fu-ucrc-space-md)",
210
+ backdropFilter: "blur(4px)",
211
+ position: "relative",
212
+ "&::before": {
213
+ content: '""',
214
+ position: "absolute",
215
+ top: 0,
216
+ left: 0,
217
+ right: 0,
218
+ bottom: 0,
219
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
220
+ borderRadius: "inherit",
221
+ zIndex: 0
222
+ },
223
+ "& > *": { position: "relative", zIndex: 1 }
224
+ }, he = {
225
+ backdrop: Vn,
226
+ column: n({ display: "flex", flexDirection: "column", gap: "24px" }),
227
+ titleRow: n({ display: "flex", gap: "8px", alignItems: "flex-start", justifyContent: "center" }),
228
+ title: n({
229
+ ...Oe,
230
+ unicodeBidi: "plaintext",
231
+ fontFamily: "var(--fu-ucrc-pv-font-primary)",
232
+ lineHeight: "150%",
233
+ letterSpacing: "0.15px",
234
+ fontWeight: 500,
235
+ fontSize: "1.25em",
236
+ textAlign: "center",
237
+ color: "var(--fu-ucrc-text-color)"
238
+ })
239
+ }, Tt = { display: "flex", alignItems: "center", gap: g("md") }, Dt = {
240
+ ...Oe,
241
+ fontFamily: "var(--fu-ucrc-font-primary)",
242
+ fontWeight: 500,
243
+ fontSize: "0.9375em",
244
+ lineHeight: "24px",
245
+ letterSpacing: "0.46px",
246
+ textTransform: "uppercase",
247
+ color: "var(--fu-ucrc-pv-on-primary)",
248
+ gap: "8px",
249
+ display: "flex",
250
+ alignItems: "center"
251
+ }, wt = n(Ae, {
252
+ borderRadius: "var(--fu-ucrc-pv-button-radius)",
253
+ paddingBlock: "10px",
254
+ paddingInline: "16px",
255
+ backgroundColor: "var(--fu-ucrc-pv-primary)",
256
+ color: "var(--fu-ucrc-pv-on-primary)",
257
+ transition: "all 300ms cubic-bezier(0.2, 0, 0, 1)",
258
+ transform: "scale(1)",
259
+ fontSize: "0.9375em",
260
+ "&:hover": { transform: "scale(1.02)" },
261
+ "&:active": { transform: "scale(0.98)" },
262
+ "&:disabled": { opacity: "34%" }
263
+ }), ge = {
264
+ content: n(he.backdrop, {
265
+ borderRadius: "var(--fu-ucrc-radius-sm)",
266
+ padding: g("md"),
267
+ "&::before": { opacity: 0.5 }
268
+ }),
269
+ embed: n({ overflow: "hidden", borderRadius: "var(--fu-ucrc-radius-sm)" }),
270
+ footer: n(Tt, { justifyContent: "space-between" }),
271
+ footerMobile: n(Tt, { justifyContent: "center", flexDirection: "column-reverse" }),
272
+ next: wt,
273
+ // Joy's `ml: { md: "auto" }`: pushed to the end from the md viewport breakpoint.
274
+ nextEnd: n(wt, { marginLeft: "auto" }),
275
+ label: n(Dt),
276
+ labelHidden: n(Dt, { visibility: "hidden" }),
277
+ loading: n({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
278
+ }, Fn = (e) => {
279
+ var d, me, A, ue, K, _, Z, le, ie, oe, Y, ee, ce, I, E, U, O, q, T, Q, se, ae;
280
+ const [l, o] = ve.useState(
281
+ ((d = e.leads) == null ? void 0 : d.position) === "before" && e.poll.authRequirement === "LEAD"
282
+ );
283
+ ve.useEffect(() => {
284
+ var re;
285
+ o(((re = e.leads) == null ? void 0 : re.position) === "before" && e.poll.authRequirement === "LEAD" || !1);
286
+ }, [(me = e.leads) == null ? void 0 : me.position, e.poll.authRequirement]);
287
+ const { optionsLayout: i } = Le(Te), s = xe(), c = Be(e.options), { t: a } = j(), r = ne(), m = Me(), f = Ke("md"), y = Ne(e.poll.embedCode), b = !l && !!e.poll.embedCode, u = ((A = e.leads) == null ? void 0 : A.position) === "after" ? a("poll.buttons.continue") : a("poll.buttons.vote"), { brandingImage: x, brandingColors: C, brandingLogo: D } = Ye(e.poll.branding || null), R = e.defaultImagePlaceholderUrl || (r ? De : we), k = Re({ images: e.poll.images, imagePlaceholder: R }, G.OVERLAY), S = x || k, P = s.colorSchemes.dark, z = s.colorSchemes.light, H = (C == null ? void 0 : C.primaryColor) || z.palette.primary.plainColor, X = {
288
+ "--fu-ucrc-pv-content-bg": (C == null ? void 0 : C.backgroundColor) || P.surfaceVariant,
289
+ "--fu-ucrc-pv-primary": H,
290
+ "--fu-ucrc-pv-on-primary": z.palette.primary.onPrimary,
291
+ "--fu-ucrc-pv-button-radius": s.customRadius.light.xl,
292
+ "--fu-ucrc-pv-font-primary": zt(s.customFontFamily.dark.primary)
293
+ }, F = () => {
294
+ o(!1);
295
+ };
296
+ return /* @__PURE__ */ t(
297
+ vn,
298
+ {
299
+ entity: e.poll,
300
+ headline: a("poll.headline"),
301
+ finalImage: S,
302
+ rulesDisplay: e.rulesDisplay,
303
+ children: /* @__PURE__ */ h("div", { css: he.column, style: X, children: [
304
+ /* @__PURE__ */ t("div", { css: ge.content, children: e.applyConsentGate ? /* @__PURE__ */ t(
305
+ Ee,
306
+ {
307
+ consents: e.consents,
308
+ primaryColor: H,
309
+ textColor: (C == null ? void 0 : C.contentColor) || P.textColor,
310
+ brandingUrls: (ue = e.poll.branding) == null ? void 0 : ue.urls
311
+ }
312
+ ) : l ? /* @__PURE__ */ t(
313
+ Ue,
314
+ {
315
+ sdk: e.sdk,
316
+ startGame: F,
317
+ contentId: e.poll.id,
318
+ contentName: e.poll.title,
319
+ brandingColors: (K = e.poll.branding) == null ? void 0 : K.colors,
320
+ brandingUrls: (_ = e.poll.branding) == null ? void 0 : _.urls,
321
+ campaignId: (Z = e.leads) == null ? void 0 : Z.campaignId,
322
+ campaignName: (le = e.leads) == null ? void 0 : le.campaignName,
323
+ fields: (ie = e.leads) == null ? void 0 : ie.fields,
324
+ leadTitle: (oe = e.poll.labels) == null ? void 0 : oe.leadTitle,
325
+ leadDescription: (Y = e.poll.labels) == null ? void 0 : Y.leadDescription,
326
+ leadCta: (ee = e.poll.labels) == null ? void 0 : ee.leadCta,
327
+ leadSuccessTitle: (ce = e.poll.labels) == null ? void 0 : ce.leadSuccessTitle,
328
+ leadSuccessDescription: (I = e.poll.labels) == null ? void 0 : I.leadSuccessDescription,
329
+ syncWithProfile: (E = e.leads) == null ? void 0 : E.syncWithProfile,
330
+ consents: e.leadConsents
331
+ }
332
+ ) : /* @__PURE__ */ h(ke, { children: [
333
+ b && /* @__PURE__ */ t("div", { css: ge.embed, children: /* @__PURE__ */ t(st, { ratio: "16/9", children: /* @__PURE__ */ t("div", { ref: y }) }) }),
334
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: he.titleRow, children: /* @__PURE__ */ t("p", { css: he.title, children: e.poll.alternativeTitle }) }),
335
+ /* @__PURE__ */ t(
336
+ mt,
337
+ {
338
+ options: e.options || [],
339
+ answerPoll: e.answerPoll,
340
+ selectedOptions: e.selectedOptions,
341
+ optionsLayout: m ? "column" : i ?? "row",
342
+ brandingColors: C,
343
+ optionsImages: c,
344
+ multipleChoice: e.poll.multipleChoice,
345
+ maxChoices: e.optionChoices,
346
+ isVoting: e.isVoting,
347
+ disabled: e.signInRequired
348
+ }
349
+ )
350
+ ] }) }),
351
+ /* @__PURE__ */ h("div", { css: r ? ge.footerMobile : ge.footer, children: [
352
+ /* @__PURE__ */ t(
353
+ W,
354
+ {
355
+ brandingLogo: D,
356
+ textColor: P.textColor,
357
+ label: ((U = e.poll.labels) == null ? void 0 : U.sponsor) || null,
358
+ primaryUrl: (q = (O = e.poll.branding) == null ? void 0 : O.urls) == null ? void 0 : q.primaryUrl,
359
+ secondaryUrl: (Q = (T = e.poll.branding) == null ? void 0 : T.urls) == null ? void 0 : Q.secondaryUrl
360
+ }
361
+ ),
362
+ e.applyConsentGate ? /* @__PURE__ */ t(
363
+ _e,
364
+ {
365
+ onClick: e.startVoting,
366
+ label: ((ae = (se = e.consents) == null ? void 0 : se.labels) == null ? void 0 : ae.ctaLabel) || a("poll.buttons.start"),
367
+ isSubmitting: e.isSubmitting,
368
+ primaryColor: H
369
+ }
370
+ ) : !l && (e.signInRequired ? /* @__PURE__ */ t(dt, { signInCTA: e.signInCTA, primaryColor: H }) : /* @__PURE__ */ h(
371
+ "button",
372
+ {
373
+ type: "button",
374
+ css: !r && f ? ge.nextEnd : ge.next,
375
+ onClick: e.voteForPoll,
376
+ disabled: e.selectedOptions.length === 0 || e.isVoting,
377
+ children: [
378
+ /* @__PURE__ */ t("p", { css: e.isVoting ? ge.labelHidden : ge.label, children: u }),
379
+ e.isVoting && /* @__PURE__ */ t("span", { css: ge.loading, children: /* @__PURE__ */ t(Wt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
380
+ ]
381
+ }
382
+ ))
383
+ ] })
384
+ ] })
385
+ }
386
+ );
387
+ }, ze = {
388
+ root: n(xn, { paddingBlock: "10px", paddingInline: "16px" }),
389
+ label: n(It),
390
+ labelHidden: n({ ...It, visibility: "hidden" }),
391
+ loading: n({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
392
+ }, Jt = (e) => /* @__PURE__ */ h(
393
+ "button",
394
+ {
395
+ type: "button",
396
+ css: ze.root,
397
+ style: { "--fu-ucrc-cta-bg": e.buttonColor },
398
+ disabled: e.selectedOptions.length === 0 || e.isVoting,
399
+ onClick: e.onClick,
400
+ children: [
401
+ /* @__PURE__ */ t("p", { css: e.isVoting ? ze.labelHidden : ze.label, children: e.label }),
402
+ e.isVoting && /* @__PURE__ */ t("span", { css: ze.loading, children: /* @__PURE__ */ t(Wt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
403
+ ]
404
+ }
405
+ ), Rt = {
406
+ display: "flex",
407
+ width: "100%",
408
+ borderRadius: "var(--fu-ucrc-radius-md)",
409
+ border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-pv-card-border, var(--fu-ucrc-secondary-container))",
410
+ overflow: "hidden",
411
+ background: "var(--fu-ucrc-surface)",
412
+ minHeight: "250px"
413
+ }, Et = {
414
+ row: n({ ...Rt, flexDirection: "row" }),
415
+ column: n({ ...Rt, flexDirection: "column" })
416
+ }, J = ({ children: e, brandingBorderColor: l, state: o }) => {
417
+ const i = ne(), s = Me();
418
+ return /* @__PURE__ */ t(
419
+ "div",
420
+ {
421
+ css: (o === "play" ? s : i) ? Et.column : Et.row,
422
+ style: l ? { "--fu-ucrc-pv-card-border": l } : void 0,
423
+ children: e
424
+ }
425
+ );
426
+ }, qe = { display: "flex", flexDirection: "column" }, We = { display: "flex", alignItems: "center", gap: g("lg") }, L = {
427
+ area: n({ ...qe, padding: g("md") }),
428
+ // Joy's responsive gap: lg below the md breakpoint, md from it.
429
+ question: n({ ...qe, gap: g("lg") }),
430
+ questionMd: n({ ...qe, gap: g("md") }),
431
+ content: n({
432
+ ...qe,
433
+ borderRadius: "var(--fu-ucrc-radius-md)",
434
+ paddingInline: g("md"),
435
+ paddingTop: g("md"),
436
+ paddingBottom: g("lg"),
437
+ gap: g("md"),
438
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
439
+ backdropFilter: "blur(4px)"
440
+ }),
441
+ titleRow: n({ gap: "8px", display: "flex", justifyContent: "center" }),
442
+ title: n({
443
+ ...Oe,
444
+ unicodeBidi: "plaintext",
445
+ fontFamily: "var(--fu-ucrc-font-primary)",
446
+ lineHeight: "150%",
447
+ letterSpacing: "0.15px",
448
+ fontWeight: 500,
449
+ fontSize: "1.25em",
450
+ textAlign: "center",
451
+ color: "var(--fu-ucrc-pv-text)"
452
+ }),
453
+ footer: n({ ...We, justifyContent: "space-between" }),
454
+ footerEnd: n({ ...We, justifyContent: "flex-end" }),
455
+ footerColumn: n({ ...We, flexDirection: "column", justifyContent: "space-between" }),
456
+ footerColumnEnd: n({ ...We, flexDirection: "column", justifyContent: "flex-end" }),
457
+ navigation: n({ display: "flex", gap: g("md"), justifyContent: "center", alignItems: "center" })
458
+ }, On = (e) => {
459
+ var ue, K, _, Z, le, ie, oe, Y, ee, ce;
460
+ const [l, o] = ve.useState(
461
+ ((ue = e.leads) == null ? void 0 : ue.position) === "before" && e.poll.authRequirement === "LEAD"
462
+ );
463
+ ve.useEffect(() => {
464
+ var I;
465
+ o(((I = e.leads) == null ? void 0 : I.position) === "before" && e.poll.authRequirement === "LEAD" || !1);
466
+ }, [(K = e.leads) == null ? void 0 : K.position, e.poll.authRequirement]);
467
+ const { optionsLayout: i } = Le(Te), s = Ne(e.poll.embedCode), c = !l && !!e.poll.embedCode, a = Be(e.options), { t: r } = j(), m = ne(), f = nn(), y = Ke("md"), b = be(), u = ((_ = e.poll.branding) == null ? void 0 : _.colors) || null, x = m ? ((le = (Z = e.poll.branding) == null ? void 0 : Z.images) == null ? void 0 : le.mobileLogo) || ((oe = (ie = e.poll.branding) == null ? void 0 : ie.images) == null ? void 0 : oe.mainLogo) || "" : ((ee = (Y = e.poll.branding) == null ? void 0 : Y.images) == null ? void 0 : ee.mainLogo) || "", C = e.imagePosition || "left", D = Re(
468
+ {
469
+ images: e.poll.images,
470
+ imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
471
+ },
472
+ G.STANDARD
473
+ ), R = ((ce = e.leads) == null ? void 0 : ce.position) === "after" ? r("poll.buttons.continue") : r("poll.buttons.vote"), k = f || m && !!D, S = (u == null ? void 0 : u.contentColor) || b.textColor, P = (u == null ? void 0 : u.backgroundColor) || b.surfaceVariant, z = (u == null ? void 0 : u.primaryColor) || b.palette.primary.plainColor, H = {
474
+ "--fu-ucrc-pv-text": S,
475
+ "--fu-ucrc-pv-content-bg": `rgba(${P ? Xe(P).replace(/[^\d,]/g, "") : ""}, 0.5)`
476
+ }, X = () => {
477
+ o(!1);
478
+ }, F = (I) => {
479
+ var E, U, O, q, T;
480
+ return /* @__PURE__ */ t(
481
+ W,
482
+ {
483
+ brandingLogo: x,
484
+ textColor: I,
485
+ label: ((E = e.poll.labels) == null ? void 0 : E.sponsor) || null,
486
+ primaryUrl: (O = (U = e.poll.branding) == null ? void 0 : U.urls) == null ? void 0 : O.primaryUrl,
487
+ secondaryUrl: (T = (q = e.poll.branding) == null ? void 0 : q.urls) == null ? void 0 : T.secondaryUrl
488
+ }
489
+ );
490
+ }, d = () => {
491
+ var I, E, U;
492
+ return /* @__PURE__ */ t("div", { css: L.area, style: H, children: /* @__PURE__ */ h("div", { css: y ? L.questionMd : L.question, children: [
493
+ /* @__PURE__ */ t("div", { css: L.content, children: /* @__PURE__ */ t(
494
+ Ee,
495
+ {
496
+ consents: e.consents,
497
+ primaryColor: z,
498
+ textColor: S,
499
+ brandingUrls: (I = e.poll.branding) == null ? void 0 : I.urls,
500
+ align: "center"
501
+ }
502
+ ) }),
503
+ /* @__PURE__ */ h("div", { css: k ? x ? L.footerColumn : L.footerColumnEnd : x ? L.footer : L.footerEnd, children: [
504
+ x && !k && F(S),
505
+ /* @__PURE__ */ t("div", { css: L.navigation, children: /* @__PURE__ */ t(
506
+ _e,
507
+ {
508
+ onClick: e.startVoting,
509
+ label: ((U = (E = e.consents) == null ? void 0 : E.labels) == null ? void 0 : U.ctaLabel) || r("poll.buttons.start"),
510
+ isSubmitting: e.isSubmitting,
511
+ primaryColor: z
512
+ }
513
+ ) })
514
+ ] }),
515
+ x && k && F(S)
516
+ ] }) });
517
+ }, me = () => {
518
+ var I, E, U, O, q, T, Q, se, ae, re, Ce;
519
+ return /* @__PURE__ */ t("div", { css: L.area, style: H, children: /* @__PURE__ */ h("div", { css: y ? L.questionMd : L.question, children: [
520
+ /* @__PURE__ */ t("div", { css: L.content, children: /* @__PURE__ */ t(
521
+ Ue,
522
+ {
523
+ sdk: e.sdk,
524
+ startGame: X,
525
+ contentId: e.poll.id,
526
+ contentName: e.poll.title,
527
+ brandingColors: (I = e.poll.branding) == null ? void 0 : I.colors,
528
+ brandingUrls: (E = e.poll.branding) == null ? void 0 : E.urls,
529
+ campaignId: (U = e.leads) == null ? void 0 : U.campaignId,
530
+ campaignName: (O = e.leads) == null ? void 0 : O.campaignName,
531
+ fields: (q = e.leads) == null ? void 0 : q.fields,
532
+ leadTitle: (T = e.poll.labels) == null ? void 0 : T.leadTitle,
533
+ leadDescription: (Q = e.poll.labels) == null ? void 0 : Q.leadDescription,
534
+ leadCta: (se = e.poll.labels) == null ? void 0 : se.leadCta,
535
+ leadSuccessTitle: (ae = e.poll.labels) == null ? void 0 : ae.leadSuccessTitle,
536
+ leadSuccessDescription: (re = e.poll.labels) == null ? void 0 : re.leadSuccessDescription,
537
+ syncWithProfile: (Ce = e.leads) == null ? void 0 : Ce.syncWithProfile,
538
+ consents: e.leadConsents
539
+ }
540
+ ) }),
541
+ F(S)
542
+ ] }) });
543
+ }, A = () => /* @__PURE__ */ t("div", { css: L.area, style: H, children: /* @__PURE__ */ h("div", { css: y ? L.questionMd : L.question, children: [
544
+ /* @__PURE__ */ h("div", { css: L.content, children: [
545
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: L.titleRow, children: /* @__PURE__ */ t("p", { css: L.title, children: e.poll.alternativeTitle }) }),
546
+ /* @__PURE__ */ t(
547
+ mt,
548
+ {
549
+ options: e.options || [],
550
+ answerPoll: e.answerPoll,
551
+ selectedOptions: e.selectedOptions,
552
+ optionsLayout: i ?? "twoByTwo",
553
+ optionsImages: a,
554
+ brandingColors: u,
555
+ multipleChoice: e.poll.multipleChoice,
556
+ maxChoices: e.optionChoices,
557
+ isVoting: e.isVoting,
558
+ disabled: e.signInRequired
559
+ }
560
+ )
561
+ ] }),
562
+ /* @__PURE__ */ h("div", { css: k ? x ? L.footerColumn : L.footerColumnEnd : x ? L.footer : L.footerEnd, children: [
563
+ x && !k && F(S),
564
+ /* @__PURE__ */ t("div", { css: L.navigation, children: e.signInRequired ? /* @__PURE__ */ t(dt, { signInCTA: e.signInCTA, primaryColor: z }) : /* @__PURE__ */ t(
565
+ Jt,
566
+ {
567
+ selectedOptions: e.selectedOptions,
568
+ label: R,
569
+ buttonColor: z,
570
+ onClick: e.voteForPoll,
571
+ isVoting: e.isVoting
572
+ }
573
+ ) })
574
+ ] }),
575
+ x && k && F(S)
576
+ ] }) });
577
+ return /* @__PURE__ */ t(J, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, children: /* @__PURE__ */ t(
578
+ Cn,
579
+ {
580
+ entity: e.poll,
581
+ headline: r("poll.headline"),
582
+ finalImage: D,
583
+ imagePosition: C,
584
+ rulesDisplay: e.rulesDisplay,
585
+ embedCodeContainerRef: s,
586
+ hasEmbedCode: c,
587
+ children: e.applyConsentGate ? d() : l ? me() : A()
588
+ }
589
+ ) });
590
+ }, Ge = "var(--fu-ucrc-text-color)", Ut = {
591
+ display: "flex",
592
+ flexDirection: "column",
593
+ backdropFilter: "blur(4px)",
594
+ backgroundColor: "var(--fu-ucrc-pv-split-bg)",
595
+ borderRadius: "var(--fu-ucrc-radius-sm)"
596
+ }, He = { display: "flex", gap: g("lg") }, w = {
597
+ questionArea: n({ width: "100%", display: "flex", flexDirection: "column", justifyContent: "center" }),
598
+ questionAreaContent: n({
599
+ padding: g("lg"),
600
+ display: "flex",
601
+ flexDirection: "column",
602
+ justifyContent: "center",
603
+ gap: "16px"
604
+ }),
605
+ embedHeadline: n({ gap: g("xl"), display: "flex", flexDirection: "column", alignItems: "center" }),
606
+ headlineText: n({
607
+ margin: 0,
608
+ fontWeight: 500,
609
+ lineHeight: "166%",
610
+ letterSpacing: "1px",
611
+ fontSize: "0.75em",
612
+ color: Ge,
613
+ opacity: "70%",
614
+ textTransform: "uppercase",
615
+ fontFamily: "var(--fu-ucrc-font-secondary)",
616
+ textAlign: "center"
617
+ }),
618
+ texts: n({ display: "flex", flexDirection: "column", gap: g("3xs") }),
619
+ titleText: n({
620
+ margin: 0,
621
+ unicodeBidi: "plaintext",
622
+ fontWeight: 700,
623
+ lineHeight: "133%",
624
+ fontSize: "1.5em",
625
+ letterSpacing: "0.15px",
626
+ color: Ge,
627
+ fontFamily: "var(--fu-ucrc-font-primary)",
628
+ textAlign: "center"
629
+ }),
630
+ descriptionText: n({
631
+ margin: 0,
632
+ unicodeBidi: "plaintext",
633
+ fontWeight: 400,
634
+ lineHeight: "140%",
635
+ fontSize: "1.25em",
636
+ letterSpacing: "0.15px",
637
+ color: Ge,
638
+ opacity: "70%",
639
+ fontFamily: "var(--fu-ucrc-font-primary)",
640
+ textAlign: "center"
641
+ }),
642
+ leadContent: n(Ut, { padding: g("md"), gap: g("md") }),
643
+ mainContent: n(Ut, { padding: g("lg"), gap: g("md") }),
644
+ alternativeTitleSection: n({ gap: "8px", display: "flex", justifyContent: "center" }),
645
+ alternativeTitle: n({
646
+ margin: 0,
647
+ fontFamily: "var(--fu-ucrc-font-primary)",
648
+ lineHeight: "150%",
649
+ letterSpacing: "0.15px",
650
+ fontWeight: 500,
651
+ fontSize: "1.25em",
652
+ textAlign: "center",
653
+ color: Ge
654
+ }),
655
+ embedFooter: {
656
+ stackedLogo: n(He, { flexDirection: "column-reverse", justifyContent: "space-between" }),
657
+ stacked: n(He, { flexDirection: "column-reverse", justifyContent: "center" }),
658
+ sideLogo: n(He, { flexDirection: "row", justifyContent: "space-between" }),
659
+ side: n(He, { flexDirection: "row", justifyContent: "center" })
660
+ },
661
+ buttonFooter: n({ display: "flex", flexDirection: "column", gap: g("lg") }),
662
+ // The original showed it only on large screens, which its branch excludes.
663
+ presentedByMobile: n({ display: "none", justifyContent: "center" }),
664
+ block: n({ display: "block" }),
665
+ hidden: n({ display: "none" }),
666
+ presentedByBottom: n({ marginBottom: g("lg"), paddingInline: g("lg") })
667
+ }, Mn = (e) => {
668
+ var K, _, Z, le, ie, oe, Y, ee, ce;
669
+ const [l, o] = ve.useState(
670
+ ((K = e.leads) == null ? void 0 : K.position) === "before" && e.poll.authRequirement === "LEAD"
671
+ );
672
+ ve.useEffect(() => {
673
+ var I;
674
+ o(
675
+ ((I = e.leads) == null ? void 0 : I.position) === "before" && e.poll.authRequirement === "LEAD" || !1
676
+ );
677
+ }, [(_ = e.leads) == null ? void 0 : _.position, e.poll.authRequirement]);
678
+ const { optionsLayout: i } = Le(Te), s = xe(), c = be(), a = ne(), r = Me(), m = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : a ? De : we, f = Re(
679
+ {
680
+ images: e.poll.images,
681
+ imagePlaceholder: m
682
+ },
683
+ G.SPLIT
684
+ ), y = Be(e.options), { t: b } = j(), u = ((Z = e.poll.branding) == null ? void 0 : Z.colors) || null, x = a ? ((le = e.poll.branding) == null ? void 0 : le.images.mobileLogo) || ((ie = e.poll.branding) == null ? void 0 : ie.images.mainLogo) || "" : ((oe = e.poll.branding) == null ? void 0 : oe.images.mainLogo) || "", C = Ne(e.poll.embedCode), D = !l && !!e.poll.embedCode, R = ((Y = e.leads) == null ? void 0 : Y.position) === "after" ? b("poll.buttons.continue") : b("poll.buttons.vote"), k = (u == null ? void 0 : u.backgroundColor) || c.surfaceVariant, S = (u == null ? void 0 : u.primaryColor) || ((ce = (ee = c.palette) == null ? void 0 : ee.primary) == null ? void 0 : ce.plainColor), P = c.textColor, z = Xe(k || ""), H = {
685
+ "--fu-ucrc-pv-split-bg": `rgba(${z ? z.replace(/[^\d,]/g, "") : ""}, 0.5)`
686
+ }, X = () => {
687
+ o(!1);
688
+ }, F = (I, E) => {
689
+ var U, O, q, T, Q;
690
+ return /* @__PURE__ */ t(
691
+ W,
692
+ {
693
+ brandingLogo: x,
694
+ textColor: I,
695
+ label: ((U = e.poll.labels) == null ? void 0 : U.sponsor) || null,
696
+ primaryUrl: (q = (O = e.poll.branding) == null ? void 0 : O.urls) == null ? void 0 : q.primaryUrl,
697
+ secondaryUrl: (Q = (T = e.poll.branding) == null ? void 0 : T.urls) == null ? void 0 : Q.secondaryUrl,
698
+ isCentered: E || !1
699
+ }
700
+ );
701
+ }, d = e.signInRequired ? /* @__PURE__ */ t(dt, { signInCTA: e.signInCTA, primaryColor: S }) : /* @__PURE__ */ t(
702
+ Jt,
703
+ {
704
+ selectedOptions: e.selectedOptions,
705
+ label: R,
706
+ buttonColor: S,
707
+ onClick: e.voteForPoll,
708
+ isVoting: e.isVoting
709
+ }
710
+ ), me = () => {
711
+ var I;
712
+ return /* @__PURE__ */ t("div", { css: w.mainContent, children: /* @__PURE__ */ t(
713
+ Ee,
714
+ {
715
+ consents: e.consents,
716
+ primaryColor: S,
717
+ textColor: P,
718
+ brandingUrls: (I = e.poll.branding) == null ? void 0 : I.urls,
719
+ onSubmit: e.startVoting,
720
+ isSubmitting: e.isSubmitting,
721
+ ctaLabel: b("poll.buttons.start"),
722
+ align: "center"
723
+ }
724
+ ) });
725
+ }, A = () => {
726
+ var I, E, U, O, q, T, Q, se, ae, re, Ce;
727
+ return /* @__PURE__ */ h(ke, { children: [
728
+ /* @__PURE__ */ t("div", { css: w.leadContent, children: /* @__PURE__ */ t(
729
+ Ue,
730
+ {
731
+ sdk: e.sdk,
732
+ startGame: X,
733
+ contentId: e.poll.id,
734
+ contentName: e.poll.title,
735
+ brandingColors: (I = e.poll.branding) == null ? void 0 : I.colors,
736
+ brandingUrls: (E = e.poll.branding) == null ? void 0 : E.urls,
737
+ campaignId: (U = e.leads) == null ? void 0 : U.campaignId,
738
+ campaignName: (O = e.leads) == null ? void 0 : O.campaignName,
739
+ fields: (q = e.leads) == null ? void 0 : q.fields,
740
+ leadTitle: (T = e.poll.labels) == null ? void 0 : T.leadTitle,
741
+ leadDescription: (Q = e.poll.labels) == null ? void 0 : Q.leadDescription,
742
+ leadCta: (se = e.poll.labels) == null ? void 0 : se.leadCta,
743
+ leadSuccessTitle: (ae = e.poll.labels) == null ? void 0 : ae.leadSuccessTitle,
744
+ leadSuccessDescription: (re = e.poll.labels) == null ? void 0 : re.leadSuccessDescription,
745
+ syncWithProfile: (Ce = e.leads) == null ? void 0 : Ce.syncWithProfile,
746
+ consents: e.leadConsents
747
+ }
748
+ ) }),
749
+ x ? /* @__PURE__ */ t("div", { css: r ? w.block : w.hidden, children: F(P) }) : null
750
+ ] });
751
+ }, ue = () => /* @__PURE__ */ h("div", { css: w.mainContent, children: [
752
+ e.poll.alternativeTitle ? /* @__PURE__ */ t("div", { css: w.alternativeTitleSection, children: /* @__PURE__ */ t("p", { css: w.alternativeTitle, children: e.poll.alternativeTitle }) }) : null,
753
+ /* @__PURE__ */ t(
754
+ mt,
755
+ {
756
+ options: e.options || [],
757
+ answerPoll: e.answerPoll,
758
+ selectedOptions: e.selectedOptions,
759
+ optionsLayout: r ? "column" : i ?? "twoByTwo",
760
+ brandingColors: u,
761
+ optionsImages: y,
762
+ multipleChoice: e.poll.multipleChoice,
763
+ maxChoices: e.optionChoices,
764
+ isVoting: e.isVoting,
765
+ disabled: e.signInRequired
766
+ }
767
+ ),
768
+ D ? /* @__PURE__ */ h(
769
+ "div",
770
+ {
771
+ css: r ? x ? w.embedFooter.stackedLogo : w.embedFooter.stacked : x ? w.embedFooter.sideLogo : w.embedFooter.side,
772
+ children: [
773
+ F((u == null ? void 0 : u.contentColor) || P),
774
+ d
775
+ ]
776
+ }
777
+ ) : /* @__PURE__ */ h("div", { css: w.buttonFooter, children: [
778
+ d,
779
+ x && !r ? /* @__PURE__ */ t("div", { css: w.presentedByMobile, children: F((u == null ? void 0 : u.contentColor) || P) }) : null
780
+ ] })
781
+ ] });
782
+ return /* @__PURE__ */ h(J, { brandingBorderColor: (u == null ? void 0 : u.borderColor) || null, state: "play", children: [
783
+ /* @__PURE__ */ t(
784
+ Sn,
785
+ {
786
+ entity: { ...e.poll, type: "poll" },
787
+ headline: b("poll.headline"),
788
+ finalImage: f,
789
+ rulesDisplay: e.rulesDisplay,
790
+ embedCodeContainerRef: C,
791
+ hasEmbedCode: D,
792
+ brandingLogo: x,
793
+ renderPresentedBy: F,
794
+ children: /* @__PURE__ */ t("div", { css: w.questionArea, style: H, children: /* @__PURE__ */ h("div", { css: w.questionAreaContent, children: [
795
+ D && /* @__PURE__ */ t("div", { css: w.embedHeadline, children: /* @__PURE__ */ h("div", { children: [
796
+ /* @__PURE__ */ t("p", { css: w.headlineText, children: b("poll.headline") }),
797
+ /* @__PURE__ */ h("div", { css: w.texts, children: [
798
+ /* @__PURE__ */ t("p", { css: w.titleText, children: e.poll.title }),
799
+ /* @__PURE__ */ t("p", { css: w.descriptionText, children: ln(e.poll.description) })
800
+ ] })
801
+ ] }) }),
802
+ e.applyConsentGate ? me() : l ? A() : ue()
803
+ ] }) })
804
+ }
805
+ ),
806
+ x && r && /* @__PURE__ */ t("div", { css: w.presentedByBottom, children: F((u == null ? void 0 : u.contentColor) || s.colorSchemes.dark.textColor, !0) })
807
+ ] });
808
+ }, ft = "var(--fu-ucrc-pv-option-text)", Bt = {
809
+ borderRadius: "var(--fu-ucrc-radius-sm)",
810
+ flex: 1,
811
+ padding: "var(--fu-ucrc-space-xs)",
812
+ backgroundColor: "#FFFFFF",
813
+ display: "flex",
814
+ flexDirection: "column",
815
+ position: "relative",
816
+ overflow: "hidden",
817
+ justifyContent: "center"
818
+ }, Vt = {
819
+ margin: 0,
820
+ unicodeBidi: "plaintext",
821
+ fontFamily: "var(--fu-ucrc-font-primary)",
822
+ fontWeight: 500,
823
+ fontSize: "0.935em",
824
+ letterSpacing: "0.46px",
825
+ textAlign: "center",
826
+ color: ft
827
+ }, at = {
828
+ margin: 0,
829
+ fontSize: "0.7em",
830
+ fontWeight: 500,
831
+ color: ft,
832
+ fontFamily: "var(--fu-ucrc-font-secondary)",
833
+ whiteSpace: "nowrap"
834
+ }, $ = {
835
+ card: n(Bt),
836
+ cardSelected: n(Bt, { backgroundColor: "var(--fu-ucrc-pv-primary)" }),
837
+ // Starts empty and grows to the share once mounted.
838
+ bar: n({
839
+ position: "absolute",
840
+ top: 0,
841
+ left: 0,
842
+ height: "100%",
843
+ width: "var(--fu-ucrc-pv-share)",
844
+ backgroundColor: "var(--fu-ucrc-pv-bar)",
845
+ transition: "width 0.8s ease-out",
846
+ zIndex: 0
847
+ }),
848
+ media: n({
849
+ borderRadius: "var(--fu-ucrc-radius-xs)",
850
+ overflow: "hidden",
851
+ flexGrow: 1,
852
+ marginBottom: "var(--fu-ucrc-space-2xs)"
853
+ }),
854
+ img: n({ width: "100%", height: "100%", objectFit: "cover" }),
855
+ mediaVotes: n({
856
+ display: "flex",
857
+ alignItems: "center",
858
+ justifyContent: "center",
859
+ gap: "var(--fu-ucrc-space-2xs)",
860
+ marginBlock: "var(--fu-ucrc-space-2xs)"
861
+ }),
862
+ mediaCount: n({ ...at, lineHeight: 1 }),
863
+ mediaTitle: n({ ...Vt, lineHeight: "24px", paddingInline: "var(--fu-ucrc-space-2xs)" }),
864
+ row: n({ position: "relative", zIndex: 1, display: "flex", gap: "var(--fu-ucrc-space-xs)" }),
865
+ votes: n({
866
+ display: "flex",
867
+ flexDirection: "column",
868
+ justifyContent: "center",
869
+ gap: "var(--fu-ucrc-space-2xs)",
870
+ flexShrink: 0,
871
+ minWidth: "fit-content"
872
+ }),
873
+ votesTop: n({ display: "flex", alignItems: "center", gap: "var(--fu-ucrc-space-2xs)" }),
874
+ count: n({ ...at, lineHeight: 0 }),
875
+ percentage: n({ ...at, fontSize: "0.65em", fontWeight: 400, lineHeight: 1, textAlign: "center" }),
876
+ text: n({ display: "flex", alignItems: "center", flex: 1, minWidth: 0, gap: "var(--fu-ucrc-space-xs)" }),
877
+ title: n({
878
+ ...Vt,
879
+ lineHeight: "16px",
880
+ flex: 1,
881
+ minWidth: 0,
882
+ wordBreak: "break-word",
883
+ hyphens: "auto"
884
+ })
885
+ }, jn = (e) => {
886
+ var u;
887
+ const l = qt(), o = xe(), i = be(), [s, c] = V(0), a = e.optionsImages.get(e.option.id), r = e.selectedOptions.includes(e.option.id), m = e.option.votes, f = e.totalVotes > 0 ? m / e.totalVotes * 100 : 0;
888
+ ye(() => {
889
+ const x = setTimeout(() => c(f), 100);
890
+ return () => clearTimeout(x);
891
+ }, [f]);
892
+ const y = {
893
+ "--fu-ucrc-pv-primary": ((u = e.brandingColors) == null ? void 0 : u.primaryColor) || i.palette.primary.plainColor,
894
+ // The card is always white, so unselected text keeps the light scheme's colour.
895
+ "--fu-ucrc-pv-option-text": r ? i.palette.primary.onPrimary : o.colorSchemes.light.textColor,
896
+ "--fu-ucrc-pv-bar": r ? i.palette.primary.primaryContainer : o.mode === "light" ? "rgba(0, 0, 0, 0.1)" : "rgba(0, 0, 0, 0.2)",
897
+ "--fu-ucrc-pv-share": `${s}%`
898
+ }, b = /* @__PURE__ */ t(Kt, { size: "12px", color: ft });
899
+ return /* @__PURE__ */ h("div", { css: r ? $.cardSelected : $.card, style: y, children: [
900
+ /* @__PURE__ */ t("div", { css: $.bar }),
901
+ a ? /* @__PURE__ */ h(ke, { children: [
902
+ /* @__PURE__ */ t("div", { css: $.media, children: /* @__PURE__ */ t(st, { ratio: "16/9", radius: "var(--fu-ucrc-radius-xs)", children: /* @__PURE__ */ t("img", { src: a, alt: "Option illustration", css: $.img }) }) }),
903
+ /* @__PURE__ */ h("div", { css: $.mediaVotes, children: [
904
+ b,
905
+ /* @__PURE__ */ h("p", { css: $.mediaCount, children: [
906
+ m.toLocaleString(l),
907
+ " (",
908
+ f.toFixed(1),
909
+ "%)"
910
+ ] })
911
+ ] }),
912
+ /* @__PURE__ */ t("p", { css: $.mediaTitle, children: e.option.title })
913
+ ] }) : /* @__PURE__ */ h("div", { css: $.row, children: [
914
+ /* @__PURE__ */ h("div", { css: $.votes, children: [
915
+ /* @__PURE__ */ h("div", { css: $.votesTop, children: [
916
+ b,
917
+ /* @__PURE__ */ t("p", { css: $.count, children: m.toLocaleString(l) })
918
+ ] }),
919
+ /* @__PURE__ */ h("p", { css: $.percentage, children: [
920
+ "(",
921
+ f.toFixed(1),
922
+ "%)"
923
+ ] })
924
+ ] }),
925
+ /* @__PURE__ */ t("div", { css: $.text, children: /* @__PURE__ */ t("p", { css: $.title, children: e.option.title }) })
926
+ ] })
927
+ ] });
928
+ }, rt = {
929
+ root: n({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-md)" }),
930
+ footer: n({
931
+ display: "flex",
932
+ alignItems: "center",
933
+ justifyContent: "center",
934
+ gap: "var(--fu-ucrc-space-xs)",
935
+ paddingTop: "var(--fu-ucrc-space-md)",
936
+ borderTop: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-outline-enabled-border)"
937
+ }),
938
+ total: n({
939
+ margin: 0,
940
+ lineHeight: 1.5,
941
+ color: "var(--fu-ucrc-text-color)",
942
+ fontWeight: 500,
943
+ fontFamily: "var(--fu-ucrc-font-secondary)",
944
+ fontSize: "0.875em"
945
+ })
946
+ }, ht = (e) => {
947
+ const { t: l } = j(), o = qt(), i = Ke("md"), s = e.options.reduce((r, m) => r + (m.votes || 0), 0), c = (r) => /* @__PURE__ */ t(
948
+ jn,
949
+ {
950
+ option: r,
951
+ optionsImages: e.optionsImages,
952
+ selectedOptions: e.selectedOptions,
953
+ brandingColors: e.brandingColors,
954
+ totalVotes: s
955
+ },
956
+ r.id
957
+ ), a = e.optionsLayout === "twoByTwo" ? /* @__PURE__ */ t("div", { css: te.list, children: Qt(e.options).map((r, m) => /* @__PURE__ */ t("div", { css: i ? te.row : te.column, children: r.map(c) }, `row-${m}`)) }) : e.optionsLayout === "column" ? /* @__PURE__ */ t("div", { css: te.list, children: e.options.map(c) }) : /* @__PURE__ */ t("div", { css: i ? te.wrapRow : te.wrapColumn, children: e.options.map(c) });
958
+ return /* @__PURE__ */ h("div", { css: rt.root, children: [
959
+ a,
960
+ /* @__PURE__ */ h("div", { css: rt.footer, children: [
961
+ /* @__PURE__ */ t(Kt, { size: "1.2em", color: "var(--fu-ucrc-text-color)" }),
962
+ /* @__PURE__ */ h("p", { css: rt.total, children: [
963
+ s.toLocaleString(o),
964
+ " ",
965
+ l("poll.totalVotes")
966
+ ] })
967
+ ] })
968
+ ] });
969
+ }, $e = { display: "flex", alignItems: "center", gap: g("lg") }, B = {
970
+ area: n({ display: "flex", flexDirection: "column", paddingInline: g("md") }),
971
+ question: n({ display: "flex", flexDirection: "column", gap: g("md") }),
972
+ questionMobile: n({ display: "flex", flexDirection: "column", gap: g("lg") }),
973
+ content: n({
974
+ borderRadius: "var(--fu-ucrc-radius-md)",
975
+ paddingInline: g("md"),
976
+ paddingTop: g("md"),
977
+ paddingBottom: g("lg"),
978
+ gap: g("md"),
979
+ backgroundColor: "var(--fu-ucrc-pv-content-bg)",
980
+ display: "flex",
981
+ flexDirection: "column",
982
+ backdropFilter: "blur(4px)"
983
+ }),
984
+ titleRow: n({ gap: "8px", display: "flex", justifyContent: "center" }),
985
+ title: n({
986
+ ...Oe,
987
+ unicodeBidi: "plaintext",
988
+ fontFamily: "var(--fu-ucrc-font-primary)",
989
+ lineHeight: "150%",
990
+ letterSpacing: "0.15px",
991
+ fontWeight: 500,
992
+ fontSize: "1.25em",
993
+ textAlign: "center",
994
+ color: "var(--fu-ucrc-pv-text)"
995
+ }),
996
+ footer: n({ ...$e, justifyContent: "space-between" }),
997
+ footerEnd: n({ ...$e, justifyContent: "flex-end" }),
998
+ footerMobile: n({ ...$e, flexDirection: "column", justifyContent: "space-between" }),
999
+ footerMobileEnd: n({ ...$e, flexDirection: "column", justifyContent: "flex-end" }),
1000
+ block: n({ display: "block" }),
1001
+ hidden: n({ display: "none" }),
1002
+ actions: n({ display: "flex", gap: "16px" }),
1003
+ additionalCta: n(Ae, {
1004
+ display: "flex",
1005
+ paddingBlock: g("xs"),
1006
+ paddingInline: g("md"),
1007
+ flexDirection: "column",
1008
+ justifyContent: "center",
1009
+ alignItems: "center",
1010
+ gap: "8px",
1011
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1012
+ border: "var(--fu-ucrc-border-size) solid var(--fu-ucrc-secondary-container)",
1013
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1014
+ // Joy's solidColor (common.white) is not in the theme snapshot.
1015
+ color: "var(--fu-ucrc-primary-solid-color, #fff)",
1016
+ fontSize: "0.8125em",
1017
+ "&:hover": { backgroundColor: "var(--fu-ucrc-secondary-container)", opacity: 0.9 },
1018
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1019
+ "& p": {
1020
+ ...Oe,
1021
+ color: "var(--fu-ucrc-text-secondary)",
1022
+ fontFamily: "var(--fu-ucrc-font-primary)",
1023
+ fontSize: "0.8125em",
1024
+ fontStyle: "normal",
1025
+ fontWeight: 500,
1026
+ lineHeight: "22px",
1027
+ letterSpacing: "0.46px",
1028
+ textTransform: "uppercase"
1029
+ }
1030
+ })
1031
+ }, zn = (e) => {
1032
+ var C, D, R, k, S;
1033
+ const l = Re(
1034
+ {
1035
+ images: e.poll.images,
1036
+ imagePlaceholder: e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : ""
1037
+ },
1038
+ G.STANDARD
1039
+ ), { optionsLayout: o } = Le(Te), { t: i } = j(), s = be(), c = ((C = e.poll.branding) == null ? void 0 : C.colors) || null, a = ne(), r = a ? ((D = e.poll.branding) == null ? void 0 : D.images.mobileLogo) || ((R = e.poll.branding) == null ? void 0 : R.images.mainLogo) || "" : ((k = e.poll.branding) == null ? void 0 : k.images.mainLogo) || "", m = e.imagePosition || "left", f = Be(e.poll.options), y = (c == null ? void 0 : c.contentColor) || s.textColor, b = {
1040
+ "--fu-ucrc-pv-text": y,
1041
+ "--fu-ucrc-pv-content-bg": `rgba(${Xe(s.surfaceVariant)}, 0.5)`
1042
+ }, u = /* @__PURE__ */ t(W, { brandingLogo: r, textColor: y, label: ((S = e.poll.labels) == null ? void 0 : S.sponsor) || null }), x = () => {
1043
+ var P, z;
1044
+ return /* @__PURE__ */ h(ke, { children: [
1045
+ /* @__PURE__ */ t("div", { css: B.area, style: b, children: /* @__PURE__ */ t("div", { css: a ? B.questionMobile : B.question, children: /* @__PURE__ */ h("div", { css: B.content, children: [
1046
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: B.titleRow, children: /* @__PURE__ */ t("p", { css: B.title, children: e.poll.alternativeTitle }) }),
1047
+ /* @__PURE__ */ t(
1048
+ ht,
1049
+ {
1050
+ options: e.poll.options,
1051
+ selectedOptions: ((P = e.userVote) == null ? void 0 : P.optionIds) || [],
1052
+ optionsLayout: o ?? "twoByTwo",
1053
+ optionsImages: f,
1054
+ brandingColors: ((z = e.poll.branding) == null ? void 0 : z.colors) || null
1055
+ }
1056
+ )
1057
+ ] }) }) }),
1058
+ e.chanceGameContent && /* @__PURE__ */ t("div", { css: B.area, children: e.chanceGameContent }),
1059
+ /* @__PURE__ */ t("div", { css: B.area, children: /* @__PURE__ */ h("div", { css: a ? B.questionMobile : B.question, children: [
1060
+ /* @__PURE__ */ h("div", { css: a ? r ? B.footerMobile : B.footerMobileEnd : r ? B.footer : B.footerEnd, children: [
1061
+ r && /* @__PURE__ */ t("div", { css: a ? B.hidden : B.block, children: u }),
1062
+ /* @__PURE__ */ h("div", { css: B.actions, children: [
1063
+ /* @__PURE__ */ t(gt, { additionalCTA: e.additionalCTA, css: B.additionalCta }),
1064
+ !e.maxAttemptsReached && /* @__PURE__ */ t(Pn, { label: i("poll.buttons.voteAgain"), onClick: e.voteAgain })
1065
+ ] })
1066
+ ] }),
1067
+ r && /* @__PURE__ */ t("div", { css: a ? B.block : B.hidden, children: u })
1068
+ ] }) })
1069
+ ] });
1070
+ };
1071
+ return /* @__PURE__ */ t(J, { brandingBorderColor: (c == null ? void 0 : c.borderColor) || null, children: /* @__PURE__ */ t(
1072
+ In,
1073
+ {
1074
+ entity: e.poll,
1075
+ headline: i("poll.headline"),
1076
+ finalImage: l,
1077
+ imagePosition: m,
1078
+ rulesDisplay: e.rulesDisplay,
1079
+ children: e.isUnauthorized ? /* @__PURE__ */ h(ke, { children: [
1080
+ /* @__PURE__ */ t(
1081
+ ut,
1082
+ {
1083
+ variant: "error",
1084
+ title: i("common.authentication.accessRequired"),
1085
+ message: i("common.authentication.invalidOrMissingAuth")
1086
+ }
1087
+ ),
1088
+ r && u
1089
+ ] }) : x()
1090
+ }
1091
+ ) });
1092
+ }, ct = "var(--fu-ucrc-text-primary)", N = {
1093
+ questionAreaContent: n({
1094
+ padding: g("lg"),
1095
+ display: "flex",
1096
+ flexDirection: "column",
1097
+ justifyContent: "center",
1098
+ gap: g("lg"),
1099
+ flex: 1,
1100
+ height: "100%"
1101
+ }),
1102
+ // Translucent panel, from the branding background: `--fu-ucrc-pv-split-bg` on the parent.
1103
+ panel: n({
1104
+ padding: g("lg"),
1105
+ gap: g("lg"),
1106
+ display: "flex",
1107
+ flexDirection: "column",
1108
+ backdropFilter: "blur(4px)",
1109
+ backgroundColor: "var(--fu-ucrc-pv-split-bg)",
1110
+ borderRadius: "var(--fu-ucrc-radius-sm)"
1111
+ }),
1112
+ alternativeTitleSection: n({ gap: "8px", display: "flex", justifyContent: "center" }),
1113
+ alternativeTitle: n({
1114
+ margin: 0,
1115
+ fontFamily: "var(--fu-ucrc-font-primary)",
1116
+ lineHeight: "150%",
1117
+ letterSpacing: "0.15px",
1118
+ fontWeight: 500,
1119
+ fontSize: "1.25em",
1120
+ textAlign: "center",
1121
+ color: "var(--fu-ucrc-text-color)"
1122
+ }),
1123
+ ctaContainer: n({ display: "flex", flexDirection: "column", alignItems: "center" }),
1124
+ ctaContent: n({
1125
+ display: "flex",
1126
+ flexDirection: "column",
1127
+ justifyContent: "center",
1128
+ alignItems: "center",
1129
+ gap: g("lg")
1130
+ }),
1131
+ buttons: n({ display: "flex", flexDirection: "column", gap: "16px" }),
1132
+ playAgain: n(Ae, {
1133
+ display: "flex",
1134
+ paddingBlock: g("xs"),
1135
+ paddingInline: "16px",
1136
+ flexDirection: "column",
1137
+ justifyContent: "center",
1138
+ alignItems: "center",
1139
+ gap: "8px",
1140
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1141
+ color: ct,
1142
+ backgroundColor: "var(--fu-ucrc-surface)",
1143
+ fontSize: "0.9375em",
1144
+ "&:hover": { backgroundColor: "var(--fu-ucrc-on-surface)" }
1145
+ }),
1146
+ playAgainContent: n({
1147
+ display: "flex",
1148
+ justifyContent: "center",
1149
+ alignItems: "center",
1150
+ gap: "8px",
1151
+ alignSelf: "stretch"
1152
+ }),
1153
+ playAgainLabel: n({
1154
+ margin: 0,
1155
+ color: ct,
1156
+ textAlign: "center",
1157
+ fontFamily: "var(--fu-ucrc-font-primary)",
1158
+ fontSize: "0.9375em",
1159
+ fontStyle: "normal",
1160
+ fontWeight: 500,
1161
+ lineHeight: "22px",
1162
+ letterSpacing: "0.46px",
1163
+ textTransform: "uppercase"
1164
+ }),
1165
+ alertArea: {
1166
+ side: n({
1167
+ flex: "0 0 50%",
1168
+ width: "50%",
1169
+ minWidth: "50%",
1170
+ maxWidth: "50%",
1171
+ display: "flex",
1172
+ flexDirection: "column",
1173
+ justifyContent: "center"
1174
+ }),
1175
+ stacked: n({
1176
+ flex: "1",
1177
+ width: "100%",
1178
+ minWidth: "100%",
1179
+ maxWidth: "100%",
1180
+ display: "flex",
1181
+ flexDirection: "column",
1182
+ justifyContent: "center"
1183
+ })
1184
+ },
1185
+ alertWrapper: n({ padding: g("lg") }),
1186
+ // Joy's solid Button restyled by sx; the label colour is the branding secondary (`--fu-ucrc-pv-split-secondary`).
1187
+ additionalCta: n(Ae, {
1188
+ display: "flex",
1189
+ paddingBlock: g("xs"),
1190
+ paddingInline: g("md"),
1191
+ flexDirection: "column",
1192
+ justifyContent: "center",
1193
+ alignItems: "center",
1194
+ gap: "8px",
1195
+ borderRadius: "var(--fu-ucrc-radius-xl)",
1196
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1197
+ // Joy solid colour (common.white); no theme var carries it.
1198
+ color: "#fff",
1199
+ fontSize: "0.9375em",
1200
+ "&:hover": { backgroundColor: "var(--fu-ucrc-secondary-container)", opacity: 0.9 },
1201
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1202
+ "& p": {
1203
+ margin: 0,
1204
+ color: "var(--fu-ucrc-pv-split-secondary)",
1205
+ textAlign: "center",
1206
+ fontFamily: "var(--fu-ucrc-font-primary)",
1207
+ fontSize: "0.9375em",
1208
+ fontStyle: "normal",
1209
+ fontWeight: 500,
1210
+ lineHeight: "22px",
1211
+ letterSpacing: "0.46px",
1212
+ textTransform: "uppercase"
1213
+ }
1214
+ })
1215
+ }, qn = {
1216
+ display: "flex",
1217
+ width: "16px",
1218
+ height: "16px",
1219
+ justifyContent: "flex-end",
1220
+ alignItems: "center",
1221
+ color: ct
1222
+ }, Wn = (e) => {
1223
+ var k, S, P, z, H, X, F, d;
1224
+ const l = xe(), o = be(), i = ne(), s = on(), c = Me(), a = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : i ? De : we, r = Re(
1225
+ {
1226
+ images: e.poll.images,
1227
+ imagePlaceholder: a
1228
+ },
1229
+ G.SPLIT
1230
+ ), m = Be(e.poll.options), { t: f } = j(), { optionsLayout: y } = Le(Te), b = ((k = e.poll.branding) == null ? void 0 : k.colors) || null, u = (b == null ? void 0 : b.backgroundColor) || o.surfaceVariant, x = o.textColor, C = i ? ((S = e.poll.branding) == null ? void 0 : S.images.mobileLogo) || ((P = e.poll.branding) == null ? void 0 : P.images.mainLogo) || "" : ((z = e.poll.branding) == null ? void 0 : z.images.mainLogo) || "", D = {
1231
+ "--fu-ucrc-pv-split-bg": `rgba(${u ? Xe(u || "").replace(/[^\d,]/g, "") : ""}, 0.5)`,
1232
+ "--fu-ucrc-pv-split-secondary": (b == null ? void 0 : b.secondaryColor) || o.textSecondary
1233
+ }, R = s ? /* @__PURE__ */ t(
1234
+ W,
1235
+ {
1236
+ brandingLogo: C,
1237
+ textColor: (b == null ? void 0 : b.contentColor) || l.colorSchemes.dark.textColor,
1238
+ label: ((H = e.poll.labels) == null ? void 0 : H.sponsor) || null
1239
+ }
1240
+ ) : null;
1241
+ return /* @__PURE__ */ t(J, { brandingBorderColor: (b == null ? void 0 : b.borderColor) || null, children: /* @__PURE__ */ t(
1242
+ pn,
1243
+ {
1244
+ entity: e.poll,
1245
+ headline: f("poll.headline"),
1246
+ finalImage: r,
1247
+ brandingContent: R,
1248
+ rulesDisplay: e.rulesDisplay,
1249
+ children: e.isUnauthorized ? /* @__PURE__ */ t("div", { css: c ? N.alertArea.stacked : N.alertArea.side, children: /* @__PURE__ */ t("div", { css: N.alertWrapper, children: /* @__PURE__ */ t(
1250
+ ut,
1251
+ {
1252
+ variant: "error",
1253
+ title: f("common.authentication.accessRequired"),
1254
+ message: f("common.authentication.invalidOrMissingAuth")
1255
+ }
1256
+ ) }) }) : /* @__PURE__ */ h("div", { css: N.questionAreaContent, style: D, children: [
1257
+ /* @__PURE__ */ h("div", { css: N.panel, children: [
1258
+ e.poll.alternativeTitle ? /* @__PURE__ */ t("div", { css: N.alternativeTitleSection, children: /* @__PURE__ */ t("p", { css: N.alternativeTitle, children: e.poll.alternativeTitle }) }) : null,
1259
+ /* @__PURE__ */ t(
1260
+ ht,
1261
+ {
1262
+ options: e.poll.options,
1263
+ selectedOptions: ((X = e.userVote) == null ? void 0 : X.optionIds) || [],
1264
+ optionsLayout: y ?? "twoByTwo",
1265
+ optionsImages: m,
1266
+ brandingColors: ((F = e.poll.branding) == null ? void 0 : F.colors) || null
1267
+ }
1268
+ )
1269
+ ] }),
1270
+ !e.maxAttemptsReached || e.additionalCTA !== void 0 ? /* @__PURE__ */ t("div", { id: "poll-desktop-thanks", css: N.panel, children: /* @__PURE__ */ t("div", { css: N.ctaContainer, children: /* @__PURE__ */ t("div", { css: N.ctaContent, children: /* @__PURE__ */ h("div", { css: N.buttons, children: [
1271
+ !e.maxAttemptsReached && /* @__PURE__ */ t("button", { type: "button", css: N.playAgain, onClick: e.voteAgain, children: /* @__PURE__ */ h("div", { css: N.playAgainContent, children: [
1272
+ /* @__PURE__ */ t(_t, { style: qn }),
1273
+ /* @__PURE__ */ t("p", { css: N.playAgainLabel, children: f("poll.buttons.voteAgain") })
1274
+ ] }) }),
1275
+ /* @__PURE__ */ t(gt, { additionalCTA: e.additionalCTA, css: N.additionalCta })
1276
+ ] }) }) }) }) : null,
1277
+ e.chanceGameContent,
1278
+ c && C && /* @__PURE__ */ t(
1279
+ W,
1280
+ {
1281
+ brandingLogo: C,
1282
+ textColor: (b == null ? void 0 : b.contentColor) || x,
1283
+ label: ((d = e.poll.labels) == null ? void 0 : d.sponsor) || null,
1284
+ isCentered: !0
1285
+ }
1286
+ )
1287
+ ] })
1288
+ }
1289
+ ) });
1290
+ }, Ft = {
1291
+ ...he.backdrop,
1292
+ borderRadius: "var(--fu-ucrc-pv-radius-md)",
1293
+ alignItems: "center",
1294
+ alignSelf: "stretch",
1295
+ "&::before": { ...he.backdrop["&::before"], opacity: 0.25, backdropFilter: "blur(4px)" }
1296
+ }, Ot = {
1297
+ margin: 0,
1298
+ fontFamily: "var(--fu-ucrc-pv-font-primary)",
1299
+ fontSize: "0.9375em",
1300
+ fontStyle: "normal",
1301
+ fontWeight: 500,
1302
+ lineHeight: "24px",
1303
+ letterSpacing: "0.46px",
1304
+ textTransform: "uppercase"
1305
+ }, Mt = "var(--fu-ucrc-primary-solid-color, #fff)", de = {
1306
+ main: n({ display: "flex", flexDirection: "column", gap: "24px", zIndex: 10 }),
1307
+ results: n(Ft, { padding: g("md") }),
1308
+ resultsInner: n({
1309
+ display: "flex",
1310
+ flexDirection: "column",
1311
+ justifyContent: "center",
1312
+ alignItems: "center",
1313
+ alignSelf: "stretch"
1314
+ }),
1315
+ full: n({ width: "100%" }),
1316
+ cta: n(Ft, { paddingBlock: g("md") }),
1317
+ buttons: n({ display: "flex", flexDirection: "column", gap: g("md") }),
1318
+ voteAgain: n(Ae, {
1319
+ display: "flex",
1320
+ minHeight: "48px",
1321
+ paddingTop: "12px",
1322
+ paddingBottom: "12px",
1323
+ paddingRight: "24px",
1324
+ paddingLeft: "16px",
1325
+ flexDirection: "column",
1326
+ justifyContent: "center",
1327
+ alignItems: "center",
1328
+ gap: "8px",
1329
+ borderRadius: "var(--fu-ucrc-pv-radius-xl)",
1330
+ backgroundColor: "var(--fu-ucrc-on-surface)",
1331
+ color: Mt,
1332
+ fontSize: "0.9375em",
1333
+ "&:hover": { backgroundColor: "var(--fu-ucrc-surface-variant)" }
1334
+ }),
1335
+ voteAgainContent: n({ display: "flex", justifyContent: "center", alignItems: "center", gap: "8px", alignSelf: "stretch" }),
1336
+ voteAgainLabel: n(Ot, { color: "var(--fu-ucrc-text-primary)", textAlign: "center" }),
1337
+ additionalCta: n(Ae, {
1338
+ display: "flex",
1339
+ paddingBlock: g("sm"),
1340
+ paddingInline: g("md"),
1341
+ flexDirection: "column",
1342
+ justifyContent: "center",
1343
+ alignItems: "center",
1344
+ gap: "8px",
1345
+ borderRadius: "var(--fu-ucrc-pv-radius-xl)",
1346
+ backgroundColor: "var(--fu-ucrc-secondary-container)",
1347
+ color: Mt,
1348
+ fontSize: "0.9375em",
1349
+ "&:hover": { opacity: 0.9 },
1350
+ "& > div": { display: "flex", justifyContent: "center", alignItems: "center", gap: "8px" },
1351
+ "& p": { ...Ot, color: "var(--fu-ucrc-pv-secondary)" }
1352
+ })
1353
+ }, Gn = {
1354
+ display: "flex",
1355
+ width: "24px",
1356
+ height: "24px",
1357
+ justifyContent: "center",
1358
+ alignItems: "center",
1359
+ color: "var(--fu-ucrc-text-primary)"
1360
+ }, Hn = (e) => {
1361
+ var R, k, S;
1362
+ const l = xe(), { t: o } = j(), i = Me(), s = ne(), c = an(G.OVERLAY), { optionsLayout: a } = Le(Te), { brandingImage: r, brandingColors: m, brandingLogo: f } = Ye(e.poll.branding), y = e.defaultImagePlaceholderUrl || (s ? De : we), b = Re({ images: e.poll.images, imagePlaceholder: y }, G.OVERLAY), u = rn(r || b), x = Be(e.poll.options), C = l.colorSchemes.dark, D = {
1363
+ "--fu-ucrc-pv-content-bg": (m == null ? void 0 : m.backgroundColor) || C.surfaceVariant,
1364
+ "--fu-ucrc-pv-secondary": (m == null ? void 0 : m.secondaryColor) || C.textSecondary,
1365
+ "--fu-ucrc-pv-font-primary": zt(l.customFontFamily.light.primary),
1366
+ "--fu-ucrc-pv-radius-md": l.customRadius.light.md,
1367
+ "--fu-ucrc-pv-radius-xl": l.customRadius.light.xl
1368
+ };
1369
+ return /* @__PURE__ */ t(
1370
+ kn,
1371
+ {
1372
+ entity: e.poll,
1373
+ headline: o("poll.headline"),
1374
+ backgroundImage: u,
1375
+ imageBackgroundGradient: c,
1376
+ rulesDisplay: e.rulesDisplay,
1377
+ children: /* @__PURE__ */ h("div", { css: de.main, style: D, children: [
1378
+ e.isUnauthorized ? /* @__PURE__ */ t(
1379
+ ut,
1380
+ {
1381
+ variant: "error",
1382
+ title: o("common.authentication.accessRequired"),
1383
+ message: o("common.authentication.invalidOrMissingAuth")
1384
+ }
1385
+ ) : /* @__PURE__ */ t("div", { css: de.results, children: /* @__PURE__ */ h("div", { css: de.resultsInner, children: [
1386
+ e.poll.alternativeTitle && /* @__PURE__ */ t("div", { css: he.titleRow, children: /* @__PURE__ */ t("p", { css: he.title, children: e.poll.alternativeTitle }) }),
1387
+ /* @__PURE__ */ t("div", { css: de.full, children: /* @__PURE__ */ t(
1388
+ ht,
1389
+ {
1390
+ options: e.poll.options,
1391
+ selectedOptions: ((R = e.userVote) == null ? void 0 : R.optionIds) || [],
1392
+ optionsLayout: i ? "column" : a ?? "row",
1393
+ optionsImages: x,
1394
+ brandingColors: ((k = e.poll.branding) == null ? void 0 : k.colors) || null
1395
+ }
1396
+ ) })
1397
+ ] }) }),
1398
+ (!e.maxAttemptsReached || e.additionalCTA !== void 0) && /* @__PURE__ */ t("div", { css: de.cta, children: /* @__PURE__ */ h("div", { css: de.buttons, children: [
1399
+ !e.maxAttemptsReached && /* @__PURE__ */ t("button", { type: "button", css: de.voteAgain, onClick: e.voteAgain, children: /* @__PURE__ */ h("div", { css: de.voteAgainContent, children: [
1400
+ /* @__PURE__ */ t(_t, { style: Gn }),
1401
+ /* @__PURE__ */ t("p", { css: de.voteAgainLabel, children: o("poll.buttons.voteAgain") })
1402
+ ] }) }),
1403
+ /* @__PURE__ */ t(gt, { additionalCTA: e.additionalCTA, css: de.additionalCta })
1404
+ ] }) }),
1405
+ e.chanceGameContent,
1406
+ /* @__PURE__ */ t(
1407
+ W,
1408
+ {
1409
+ brandingLogo: f,
1410
+ textColor: C.textColor,
1411
+ label: ((S = e.poll.labels) == null ? void 0 : S.sponsor) || null
1412
+ }
1413
+ )
1414
+ ] })
1415
+ }
1416
+ );
1417
+ }, $n = () => {
1418
+ const { t: e } = j();
1419
+ return /* @__PURE__ */ t(J, { brandingBorderColor: null, children: /* @__PURE__ */ t(An, { title: e("poll.pollNotFound"), message: e("poll.pollNotFoundDescription") }) });
1420
+ }, Nn = ({
1421
+ poll: e,
1422
+ template: l,
1423
+ imagePosition: o,
1424
+ defaultImagePlaceholderUrl: i,
1425
+ rulesDisplay: s
1426
+ }) => {
1427
+ var b;
1428
+ const { t: c } = j(), a = ne(), r = ((b = e.branding) == null ? void 0 : b.colors) || null, { brandingLogo: m } = Ye(
1429
+ e.branding || null
1430
+ ), f = (u) => {
1431
+ var x;
1432
+ return /* @__PURE__ */ t(
1433
+ W,
1434
+ {
1435
+ brandingLogo: m,
1436
+ textColor: u,
1437
+ label: ((x = e.labels) == null ? void 0 : x.sponsor) || null
1438
+ }
1439
+ );
1440
+ }, y = {
1441
+ entity: e,
1442
+ headline: c("poll.headline"),
1443
+ tryAgainButtonText: "",
1444
+ isApiError: !1,
1445
+ alertVariant: "neutral",
1446
+ customAlertTitle: c("poll.gameNotAvailable"),
1447
+ customAlertMessage: c("poll.gameNotAvailableDescription"),
1448
+ renderPresentedBy: f,
1449
+ rulesDisplay: s
1450
+ };
1451
+ return l === G.OVERLAY ? /* @__PURE__ */ t(
1452
+ Gt,
1453
+ {
1454
+ ...y,
1455
+ defaultImagePlaceholderUrl: i || (a ? De : we)
1456
+ }
1457
+ ) : l === G.SPLIT ? /* @__PURE__ */ t(J, { brandingBorderColor: (r == null ? void 0 : r.borderColor) || null, children: /* @__PURE__ */ t(
1458
+ Ht,
1459
+ {
1460
+ ...y,
1461
+ defaultImagePlaceholderUrl: i
1462
+ }
1463
+ ) }) : /* @__PURE__ */ t(J, { brandingBorderColor: (r == null ? void 0 : r.borderColor) || null, children: /* @__PURE__ */ t(
1464
+ $t,
1465
+ {
1466
+ ...y,
1467
+ imagePosition: o || "left",
1468
+ defaultImagePlaceholderUrl: i
1469
+ }
1470
+ ) });
1471
+ }, Yn = (e) => {
1472
+ var s, c, a, r;
1473
+ const l = ((s = e.poll.branding) == null ? void 0 : s.colors) || null, o = ne() ? ((c = e.poll.branding) == null ? void 0 : c.images.mobileLogo) || ((a = e.poll.branding) == null ? void 0 : a.images.mainLogo) || "" : ((r = e.poll.branding) == null ? void 0 : r.images.mainLogo) || "", { t: i } = j();
1474
+ return /* @__PURE__ */ t(J, { brandingBorderColor: (l == null ? void 0 : l.borderColor) || null, children: /* @__PURE__ */ t(
1475
+ $t,
1476
+ {
1477
+ entity: e.poll,
1478
+ headline: i("poll.headline"),
1479
+ tryAgainButtonText: i("poll.buttons.tryAgain"),
1480
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1481
+ imagePosition: e.imagePosition || "left",
1482
+ isApiError: e.isApiError,
1483
+ apiErrorMessage: e.apiErrorMessage,
1484
+ toggleTryAgain: e.toggleTryAgain,
1485
+ rulesDisplay: e.rulesDisplay,
1486
+ renderPresentedBy: (m) => {
1487
+ var f;
1488
+ return /* @__PURE__ */ t(
1489
+ W,
1490
+ {
1491
+ brandingLogo: o,
1492
+ textColor: m,
1493
+ label: ((f = e.poll.labels) == null ? void 0 : f.sponsor) || null
1494
+ }
1495
+ );
1496
+ }
1497
+ }
1498
+ ) });
1499
+ }, Xn = (e) => {
1500
+ var c, a, r, m;
1501
+ const l = ne(), { t: o } = j(), i = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, s = l ? ((a = e.poll.branding) == null ? void 0 : a.images.mobileLogo) || ((r = e.poll.branding) == null ? void 0 : r.images.mainLogo) || "" : ((m = e.poll.branding) == null ? void 0 : m.images.mainLogo) || "";
1502
+ return /* @__PURE__ */ t(J, { brandingBorderColor: (i == null ? void 0 : i.borderColor) || null, children: /* @__PURE__ */ t(
1503
+ Ht,
1504
+ {
1505
+ entity: e.poll,
1506
+ headline: o("poll.headline"),
1507
+ tryAgainButtonText: o("poll.buttons.tryAgain"),
1508
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1509
+ isApiError: e.isApiError,
1510
+ apiErrorMessage: e.apiErrorMessage,
1511
+ toggleTryAgain: e.toggleTryAgain,
1512
+ rulesDisplay: e.rulesDisplay,
1513
+ renderPresentedBy: (f) => {
1514
+ var y;
1515
+ return /* @__PURE__ */ t(
1516
+ W,
1517
+ {
1518
+ brandingLogo: s,
1519
+ textColor: f,
1520
+ label: ((y = e.poll.labels) == null ? void 0 : y.sponsor) || null
1521
+ }
1522
+ );
1523
+ }
1524
+ }
1525
+ ) });
1526
+ }, Kn = (e) => {
1527
+ const { t: l } = j(), o = ne(), i = e.defaultImagePlaceholderUrl ? e.defaultImagePlaceholderUrl : o ? De : we, { brandingLogo: s } = Ye(
1528
+ e.poll.branding || null
1529
+ );
1530
+ return /* @__PURE__ */ t(
1531
+ Gt,
1532
+ {
1533
+ entity: e.poll,
1534
+ headline: l("poll.headline"),
1535
+ tryAgainButtonText: l("poll.buttons.tryAgain"),
1536
+ defaultImagePlaceholderUrl: i,
1537
+ isApiError: e.isApiError,
1538
+ apiErrorMessage: e.apiErrorMessage,
1539
+ toggleTryAgain: e.toggleTryAgain,
1540
+ rulesDisplay: e.rulesDisplay,
1541
+ renderPresentedBy: (c) => {
1542
+ var a;
1543
+ return /* @__PURE__ */ t(
1544
+ W,
1545
+ {
1546
+ brandingLogo: s,
1547
+ textColor: c,
1548
+ label: ((a = e.poll.labels) == null ? void 0 : a.sponsor) || null
1549
+ }
1550
+ );
1551
+ }
1552
+ }
1553
+ );
1554
+ }, _n = (e) => {
1555
+ const { t: l } = j();
1556
+ return /* @__PURE__ */ t(
1557
+ Nt,
1558
+ {
1559
+ entity: e.poll,
1560
+ headline: l("poll.headline"),
1561
+ sdk: e.sdk,
1562
+ leads: e.leads,
1563
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1564
+ imagePosition: e.imagePosition,
1565
+ onLeadSubmitted: e.onLeadSubmitted,
1566
+ isSubmitting: e.isSubmitting,
1567
+ MainCard: J,
1568
+ PresentedBy: W,
1569
+ CollectLeadWrapper: Ue,
1570
+ consents: e.consents
1571
+ }
1572
+ );
1573
+ }, Qn = (e) => {
1574
+ const { t: l } = j();
1575
+ return /* @__PURE__ */ t(
1576
+ Yt,
1577
+ {
1578
+ entity: e.poll,
1579
+ headline: l("poll.headline"),
1580
+ sdk: e.sdk,
1581
+ leads: e.leads,
1582
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1583
+ onLeadSubmitted: e.onLeadSubmitted,
1584
+ isSubmitting: e.isSubmitting,
1585
+ MainCard: J,
1586
+ PresentedBy: W,
1587
+ CollectLeadWrapper: Ue,
1588
+ consents: e.consents
1589
+ }
1590
+ );
1591
+ }, Jn = (e) => {
1592
+ const { t: l } = j();
1593
+ return /* @__PURE__ */ t(
1594
+ Xt,
1595
+ {
1596
+ entity: e.poll,
1597
+ headline: l("poll.headline"),
1598
+ sdk: e.sdk,
1599
+ leads: e.leads,
1600
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1601
+ onLeadSubmitted: e.onLeadSubmitted,
1602
+ isSubmitting: e.isSubmitting,
1603
+ PresentedBy: W,
1604
+ CollectLeadWrapper: Ue,
1605
+ consents: e.consents
1606
+ }
1607
+ );
1608
+ }, Zn = (e) => {
1609
+ var c, a, r;
1610
+ const { t: l } = j(), o = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, i = be(), s = (o == null ? void 0 : o.primaryColor) || i.palette.primary.plainColor;
1611
+ return /* @__PURE__ */ t(
1612
+ Nt,
1613
+ {
1614
+ entity: e.poll,
1615
+ headline: l("poll.headline"),
1616
+ sdk: e.sdk,
1617
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1618
+ imagePosition: e.imagePosition,
1619
+ onLeadSubmitted: e.onSubmit,
1620
+ isSubmitting: e.isSubmitting,
1621
+ MainCard: J,
1622
+ PresentedBy: W,
1623
+ rulesDisplay: e.rulesDisplay,
1624
+ content: /* @__PURE__ */ t(
1625
+ Ee,
1626
+ {
1627
+ consents: e.consents,
1628
+ primaryColor: s,
1629
+ brandingUrls: (a = e.poll.branding) == null ? void 0 : a.urls,
1630
+ align: "center"
1631
+ }
1632
+ ),
1633
+ footerAction: /* @__PURE__ */ t(
1634
+ _e,
1635
+ {
1636
+ onClick: e.onSubmit,
1637
+ label: ((r = e.consents.labels) == null ? void 0 : r.ctaLabel) || l("poll.buttons.vote"),
1638
+ isSubmitting: e.isSubmitting,
1639
+ primaryColor: s
1640
+ }
1641
+ )
1642
+ }
1643
+ );
1644
+ }, el = (e) => {
1645
+ var c, a;
1646
+ const { t: l } = j(), o = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, i = be(), s = (o == null ? void 0 : o.primaryColor) || i.palette.primary.plainColor;
1647
+ return /* @__PURE__ */ t(
1648
+ Yt,
1649
+ {
1650
+ entity: e.poll,
1651
+ headline: l("poll.headline"),
1652
+ sdk: e.sdk,
1653
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1654
+ onLeadSubmitted: e.onSubmit,
1655
+ isSubmitting: e.isSubmitting,
1656
+ MainCard: J,
1657
+ PresentedBy: W,
1658
+ rulesDisplay: e.rulesDisplay,
1659
+ content: /* @__PURE__ */ t(
1660
+ Ee,
1661
+ {
1662
+ consents: e.consents,
1663
+ primaryColor: s,
1664
+ brandingUrls: (a = e.poll.branding) == null ? void 0 : a.urls,
1665
+ onSubmit: e.onSubmit,
1666
+ isSubmitting: e.isSubmitting,
1667
+ ctaLabel: l("poll.buttons.vote"),
1668
+ align: "center"
1669
+ }
1670
+ )
1671
+ }
1672
+ );
1673
+ }, tl = (e) => {
1674
+ var c, a, r;
1675
+ const { t: l } = j(), o = xe(), i = ((c = e.poll.branding) == null ? void 0 : c.colors) || null, s = (i == null ? void 0 : i.primaryColor) || o.colorSchemes.dark.palette.primary.plainColor;
1676
+ return /* @__PURE__ */ t(
1677
+ Xt,
1678
+ {
1679
+ entity: e.poll,
1680
+ headline: l("poll.headline"),
1681
+ sdk: e.sdk,
1682
+ defaultImagePlaceholder: e.defaultImagePlaceholderUrl,
1683
+ onLeadSubmitted: e.onSubmit,
1684
+ isSubmitting: e.isSubmitting,
1685
+ PresentedBy: W,
1686
+ rulesDisplay: e.rulesDisplay,
1687
+ content: /* @__PURE__ */ t(
1688
+ Ee,
1689
+ {
1690
+ consents: e.consents,
1691
+ primaryColor: s,
1692
+ textColor: (i == null ? void 0 : i.contentColor) || o.colorSchemes.dark.textColor,
1693
+ brandingUrls: (a = e.poll.branding) == null ? void 0 : a.urls
1694
+ }
1695
+ ),
1696
+ footerAction: /* @__PURE__ */ t(
1697
+ _e,
1698
+ {
1699
+ onClick: e.onSubmit,
1700
+ label: ((r = e.consents.labels) == null ? void 0 : r.ctaLabel) || l("poll.buttons.vote"),
1701
+ isSubmitting: e.isSubmitting,
1702
+ primaryColor: s
1703
+ }
1704
+ )
1705
+ }
1706
+ );
1707
+ };
1708
+ function pe(e) {
1709
+ return e.template === G.STANDARD;
1710
+ }
1711
+ const nl = (e) => {
1712
+ var yt, vt;
1713
+ const [l, o] = V([]), [i, s] = V(!1), [c, a] = V(!1), [r, m] = V(!1), [f, y] = V(!1), [b, u] = V(!1), [x, C] = V(!1), [D, R] = V(!1), [k, S] = V(!1), [P, z] = V(!1), [H, X] = V(!1), F = mn(!1), { poll: d, setPoll: me } = Dn(e.entityId, e.sdk), {
1714
+ myVote: A,
1715
+ setMyVote: ue,
1716
+ isUnauthorized: K,
1717
+ isApiError: _,
1718
+ apiErrorMessage: Z,
1719
+ setIsApiError: le,
1720
+ setApiErrorMessage: ie,
1721
+ setIsUnauthorized: oe
1722
+ } = wn(
1723
+ e.entityId,
1724
+ e.sdk,
1725
+ r,
1726
+ // A REGISTERED poll now renders for anonymous users, so its 401 is expected.
1727
+ (d == null ? void 0 : d.authRequirement) === "REGISTERED" && !e.userIsLoggedIn,
1728
+ !!e.userIsLoggedIn
1729
+ ), Y = ot(() => !d || !A || !(A != null && A.id) || d.maxAttempts === -1 || d.maxAttempts === null || A.attempts === null ? !1 : (d == null ? void 0 : d.maxAttempts) <= (A == null ? void 0 : A.attempts), [d, A]), {
1730
+ translations: ee,
1731
+ loaded: ce,
1732
+ loadTranslations: I
1733
+ } = Un(d, e.sdk), E = !!e.aggregateTranslatedVotes && Y && !ce;
1734
+ ye(() => {
1735
+ E && I();
1736
+ }, [E, I]);
1737
+ const U = ot(() => !d || !ee.length ? null : En(d.options, ee), [d, ee]), O = ot(() => d ? cn(d.related) : null, [d]), {
1738
+ loading: q,
1739
+ pending: T,
1740
+ checked: Q,
1741
+ setChecked: se,
1742
+ allRequiredChecked: ae,
1743
+ submit: re
1744
+ } = sn({
1745
+ sdk: e.sdk,
1746
+ consents: (yt = e.consents) == null ? void 0 : yt.items,
1747
+ entityId: e.entityId,
1748
+ entityType: "poll"
1749
+ }), Se = !!((d == null ? void 0 : d.authRequirement) === "LEAD" ? (vt = e.leads) == null ? void 0 : vt.position : void 0) && T.length > 0, Ie = Se ? [] : T.filter((v) => v.position !== "after"), Pe = Se ? [] : T.filter((v) => v.position === "after"), Zt = (v) => {
1750
+ se(v), X(!1);
1751
+ };
1752
+ if (ye(() => {
1753
+ dn(e.language || "en");
1754
+ }, [e.language]), ye(() => {
1755
+ var p;
1756
+ if (!d || q || F.current) return;
1757
+ const v = d.authRequirement === "LEAD" && ((p = e.leads) == null ? void 0 : p.position) === "before";
1758
+ R(!v && Ie.length > 0);
1759
+ }, [d, q, Ie.length]), ye(() => {
1760
+ var v, p;
1761
+ !i || !(A != null && A.id) || (p = (v = e.callbacks) == null ? void 0 : v.onFinish) == null || p.call(v, A);
1762
+ }, [i]), !d || !A || q || E)
1763
+ return /* @__PURE__ */ t(Ln, { marginBlock: "160px" });
1764
+ if (!d.id)
1765
+ return /* @__PURE__ */ t($n, {});
1766
+ if (d.status !== "ACTIVE")
1767
+ return /* @__PURE__ */ t(
1768
+ Nn,
1769
+ {
1770
+ poll: d,
1771
+ template: e.template,
1772
+ imagePosition: pe(e) ? e.imagePosition : void 0,
1773
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1774
+ rulesDisplay: e.rulesDisplay
1775
+ }
1776
+ );
1777
+ const Qe = d.authRequirement === "REGISTERED" && !e.userIsLoggedIn, Je = () => {
1778
+ le(!1), ie(""), oe(!1), m(!r);
1779
+ };
1780
+ if (K || _)
1781
+ return pe(e) ? /* @__PURE__ */ t(
1782
+ Yn,
1783
+ {
1784
+ poll: d,
1785
+ imagePosition: e.imagePosition,
1786
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1787
+ isApiError: _,
1788
+ apiErrorMessage: Z,
1789
+ toggleTryAgain: Je,
1790
+ rulesDisplay: e.rulesDisplay
1791
+ }
1792
+ ) : e.template === G.OVERLAY ? /* @__PURE__ */ t(
1793
+ Kn,
1794
+ {
1795
+ poll: d,
1796
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1797
+ isApiError: _,
1798
+ apiErrorMessage: Z,
1799
+ toggleTryAgain: Je,
1800
+ rulesDisplay: e.rulesDisplay
1801
+ }
1802
+ ) : /* @__PURE__ */ t(
1803
+ Xn,
1804
+ {
1805
+ poll: d,
1806
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1807
+ isApiError: _,
1808
+ apiErrorMessage: Z,
1809
+ toggleTryAgain: Je,
1810
+ rulesDisplay: e.rulesDisplay
1811
+ }
1812
+ );
1813
+ const Ve = d.multipleChoice && d.maxMultipleChoiceOptions || 1, Ze = (v) => {
1814
+ if (Ve === 1)
1815
+ o(v);
1816
+ else {
1817
+ const p = v[0];
1818
+ o((M) => M.includes(p) ? M.filter((Fe) => Fe !== p) : M.length < Ve ? [...M, p] : M);
1819
+ }
1820
+ }, et = async () => {
1821
+ var v;
1822
+ if (Pe.length > 0 && !P) {
1823
+ S(!0);
1824
+ return;
1825
+ }
1826
+ if (((v = e.leads) == null ? void 0 : v.position) === "after" && d.authRequirement === "LEAD" && !b) {
1827
+ C(!0);
1828
+ return;
1829
+ }
1830
+ await nt();
1831
+ }, tt = async () => {
1832
+ if (Ie.length > 0) {
1833
+ if (f) return;
1834
+ if (!ae(Ie)) {
1835
+ X(!0);
1836
+ return;
1837
+ }
1838
+ y(!0), await re(Ie), y(!1);
1839
+ }
1840
+ F.current = !0, R(!1);
1841
+ }, en = async () => {
1842
+ if (!ae(Pe)) {
1843
+ X(!0);
1844
+ return;
1845
+ }
1846
+ y(!0), await re(Pe), z(!0), await nt(), y(!1), S(!1);
1847
+ }, nt = async () => {
1848
+ a(!0);
1849
+ try {
1850
+ const v = await e.sdk.voting.voteForPoll(
1851
+ e.entityId,
1852
+ l
1853
+ ), p = { ...d };
1854
+ p.options = d.options.map((M) => l.includes(M.id) ? {
1855
+ ...M,
1856
+ votes: M.votes + 1
1857
+ } : M), p.totalVotes = (d.totalVotes || 0) + l.length, e.aggregateTranslatedVotes && await I(), me(p), ue(v), s(!0);
1858
+ } catch (v) {
1859
+ console.error("[poll-vote] vote failed", v);
1860
+ const { code: p, message: M } = un(v, e.sdk);
1861
+ p === 401 || p === 403 ? oe(!0) : (le(!0), ie(M));
1862
+ } finally {
1863
+ a(!1);
1864
+ }
1865
+ }, lt = async () => {
1866
+ u(!0), y(!0), await nt(), y(!1), C(!1);
1867
+ }, it = () => {
1868
+ s(!1), o([]), y(!1), u(!1), C(!1), S(!1), X(!1);
1869
+ }, bt = (v) => {
1870
+ var p;
1871
+ return {
1872
+ items: v,
1873
+ checked: Q,
1874
+ onChange: Zt,
1875
+ labels: (p = e.consents) == null ? void 0 : p.labels,
1876
+ showError: H
1877
+ };
1878
+ }, tn = () => {
1879
+ const v = bt(Ie), p = Se ? T : void 0, M = Pe.length > 0 && !P;
1880
+ return e.template === G.OVERLAY ? /* @__PURE__ */ t(
1881
+ Fn,
1882
+ {
1883
+ sdk: e.sdk,
1884
+ leads: e.leads,
1885
+ poll: d,
1886
+ options: d.options,
1887
+ selectedOptions: l,
1888
+ answerPoll: Ze,
1889
+ voteForPoll: et,
1890
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1891
+ optionChoices: Ve,
1892
+ isVoting: c,
1893
+ rulesDisplay: e.rulesDisplay,
1894
+ consents: v,
1895
+ leadConsents: p,
1896
+ applyConsentGate: D,
1897
+ isSubmitting: f,
1898
+ hasAfterConsents: M,
1899
+ startVoting: tt,
1900
+ signInRequired: Qe,
1901
+ signInCTA: e.signInCTA
1902
+ }
1903
+ ) : pe(e) ? /* @__PURE__ */ t(
1904
+ On,
1905
+ {
1906
+ sdk: e.sdk,
1907
+ leads: e.leads,
1908
+ poll: d,
1909
+ options: d.options,
1910
+ selectedOptions: l,
1911
+ answerPoll: Ze,
1912
+ voteForPoll: et,
1913
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1914
+ imagePosition: e.imagePosition,
1915
+ optionChoices: Ve,
1916
+ isVoting: c,
1917
+ rulesDisplay: e.rulesDisplay,
1918
+ consents: v,
1919
+ leadConsents: p,
1920
+ applyConsentGate: D,
1921
+ isSubmitting: f,
1922
+ hasAfterConsents: M,
1923
+ startVoting: tt,
1924
+ signInRequired: Qe,
1925
+ signInCTA: e.signInCTA
1926
+ }
1927
+ ) : /* @__PURE__ */ t(
1928
+ Mn,
1929
+ {
1930
+ sdk: e.sdk,
1931
+ leads: e.leads,
1932
+ poll: d,
1933
+ options: d.options,
1934
+ selectedOptions: l,
1935
+ answerPoll: Ze,
1936
+ voteForPoll: et,
1937
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1938
+ optionChoices: Ve,
1939
+ isVoting: c,
1940
+ rulesDisplay: e.rulesDisplay,
1941
+ consents: v,
1942
+ leadConsents: p,
1943
+ applyConsentGate: D,
1944
+ isSubmitting: f,
1945
+ hasAfterConsents: M,
1946
+ startVoting: tt,
1947
+ signInRequired: Qe,
1948
+ signInCTA: e.signInCTA
1949
+ }
1950
+ );
1951
+ };
1952
+ if (k && Pe.length > 0) {
1953
+ const v = {
1954
+ poll: d,
1955
+ sdk: e.sdk,
1956
+ consents: bt(Pe),
1957
+ onSubmit: en,
1958
+ isSubmitting: f,
1959
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1960
+ rulesDisplay: e.rulesDisplay
1961
+ };
1962
+ return e.template === G.OVERLAY ? /* @__PURE__ */ t(tl, { ...v }) : pe(e) ? /* @__PURE__ */ t(
1963
+ Zn,
1964
+ {
1965
+ ...v,
1966
+ imagePosition: e.imagePosition
1967
+ }
1968
+ ) : /* @__PURE__ */ t(el, { ...v });
1969
+ }
1970
+ if (x)
1971
+ return e.template === G.OVERLAY ? /* @__PURE__ */ t(
1972
+ Jn,
1973
+ {
1974
+ poll: d,
1975
+ sdk: e.sdk,
1976
+ leads: e.leads,
1977
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1978
+ onLeadSubmitted: lt,
1979
+ isSubmitting: f,
1980
+ consents: Se ? T : void 0
1981
+ }
1982
+ ) : pe(e) ? /* @__PURE__ */ t(
1983
+ _n,
1984
+ {
1985
+ poll: d,
1986
+ sdk: e.sdk,
1987
+ leads: e.leads,
1988
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
1989
+ imagePosition: e.imagePosition,
1990
+ onLeadSubmitted: lt,
1991
+ isSubmitting: f,
1992
+ consents: Se ? T : void 0
1993
+ }
1994
+ ) : /* @__PURE__ */ t(
1995
+ Qn,
1996
+ {
1997
+ poll: d,
1998
+ sdk: e.sdk,
1999
+ leads: e.leads,
2000
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2001
+ onLeadSubmitted: lt,
2002
+ isSubmitting: f,
2003
+ consents: Se ? T : void 0
2004
+ }
2005
+ );
2006
+ if (i || Y) {
2007
+ const v = U ? { ...d, options: U } : d, p = O ? /* @__PURE__ */ t(Ct, { entityId: O, sdk: e.sdk, children: (Fe) => /* @__PURE__ */ t(
2008
+ St,
2009
+ {
2010
+ infoPage: Fe,
2011
+ variant: e.chanceGameVariant
2012
+ }
2013
+ ) }) : void 0, M = O ? /* @__PURE__ */ t(Ct, { entityId: O, sdk: e.sdk, children: (Fe) => /* @__PURE__ */ t(
2014
+ St,
2015
+ {
2016
+ infoPage: Fe,
2017
+ variant: e.chanceGameVariant,
2018
+ forceMobile: !0
2019
+ }
2020
+ ) }) : void 0;
2021
+ return e.template === G.OVERLAY ? /* @__PURE__ */ t(
2022
+ Hn,
2023
+ {
2024
+ userVote: A,
2025
+ poll: v,
2026
+ maxAttemptsReached: Y,
2027
+ voteAgain: it,
2028
+ sdk: e.sdk,
2029
+ leads: e.leads,
2030
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2031
+ isUnauthorized: K,
2032
+ additionalCTA: e.additionalCTA,
2033
+ rulesDisplay: e.rulesDisplay,
2034
+ chanceGameContent: p
2035
+ }
2036
+ ) : pe(e) ? /* @__PURE__ */ t(
2037
+ zn,
2038
+ {
2039
+ imagePosition: e.imagePosition || "left",
2040
+ userVote: A,
2041
+ poll: v,
2042
+ maxAttemptsReached: Y,
2043
+ voteAgain: it,
2044
+ sdk: e.sdk,
2045
+ leads: e.leads,
2046
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2047
+ isUnauthorized: K,
2048
+ additionalCTA: e.additionalCTA,
2049
+ rulesDisplay: e.rulesDisplay,
2050
+ chanceGameContent: M
2051
+ }
2052
+ ) : /* @__PURE__ */ t(
2053
+ Wn,
2054
+ {
2055
+ userVote: A,
2056
+ poll: v,
2057
+ maxAttemptsReached: Y,
2058
+ voteAgain: it,
2059
+ sdk: e.sdk,
2060
+ leads: e.leads,
2061
+ defaultImagePlaceholderUrl: e.defaultImagePlaceholderUrl,
2062
+ isUnauthorized: K,
2063
+ additionalCTA: e.additionalCTA,
2064
+ rulesDisplay: e.rulesDisplay,
2065
+ chanceGameContent: M
2066
+ }
2067
+ );
2068
+ }
2069
+ return tn();
2070
+ }, ll = (e) => {
2071
+ var o;
2072
+ const l = ve.useMemo(
2073
+ () => e.template === G.OVERLAY ? { ...e.themeOptions, mode: "dark" } : e.themeOptions,
2074
+ [e.template, e.themeOptions]
2075
+ );
2076
+ return /* @__PURE__ */ t(
2077
+ Tn,
2078
+ {
2079
+ packageName: "poll-vote",
2080
+ language: e.language,
2081
+ themeOptions: l,
2082
+ disableCache: e.disableCache,
2083
+ optionsLayout: e.optionsLayout,
2084
+ leadPhoneCountryCode: (o = e.leads) == null ? void 0 : o.phoneCountryCode,
2085
+ children: e.children
2086
+ }
2087
+ );
2088
+ }, ml = (e) => /* @__PURE__ */ t(ll, { ...e, children: /* @__PURE__ */ t(nl, { ...e }) });
2089
+ export {
2090
+ ml as M
2091
+ };