fansunited-frontend-components 0.0.98 → 0.0.99

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 (69) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +958 -1464
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +1 -1
  5. package/CompetitionStatistics.js +2042 -2215
  6. package/CompetitorCard.js +4225 -5079
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +6010 -7547
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +546 -849
  12. package/List.js +227 -218
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +50 -42
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +2 -2
  17. package/PlayerOfTheMatch.js +285 -269
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +80 -127
  20. package/README.md +1 -1
  21. package/Standings.js +991 -1324
  22. package/TopX.js +1120 -1167
  23. package/chunks/{ChanceGameEmbedVariant-CVys-3Zh.js → ChanceGameEmbedVariant-DM9eLG5s.js} +2 -2
  24. package/chunks/CheckCircle-I1FktW5Y.js +13 -0
  25. package/chunks/OddsSkeleton-DP5Yfqpr.js +522 -0
  26. package/chunks/Person-CXRqyF4E.js +11 -0
  27. package/chunks/PickOneOfX-DET4ZhjV.js +3117 -0
  28. package/chunks/Search-CIXthh0D.js +17 -0
  29. package/chunks/TimerOutlined-D-WA_vpE.js +8 -0
  30. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +136 -0
  31. package/chunks/{chevrons-right-CXSpQt9w.js → chevrons-right-HWKW2c4I.js} +24 -4
  32. package/chunks/index-BENM3N_w.js +4 -0
  33. package/chunks/index-BRxAV693.js +4 -0
  34. package/chunks/index-BXYTsvIX.js +4 -0
  35. package/chunks/index-C0ilols1.js +4 -0
  36. package/chunks/index-D7VhczXH.js +4 -0
  37. package/chunks/index-DKwvdw9t.js +4 -0
  38. package/chunks/index-DZN-AITW.js +4 -0
  39. package/chunks/main-B2sDRFF4.js +2184 -0
  40. package/chunks/main-CzfWaEQP.js +4869 -0
  41. package/chunks/main-DFNl3g_U.js +4910 -0
  42. package/chunks/{main-65WcUqAl.js → main-DLwnvntz.js} +600 -593
  43. package/chunks/main-DiBlJBNb.js +1956 -0
  44. package/chunks/main-DxvBjXsd.js +1775 -0
  45. package/chunks/main-S8_NDSiY.js +3209 -0
  46. package/chunks/main-lBgr8Liq.js +6571 -0
  47. package/chunks/{withVersionStamp-T8seRk9h.js → withVersionStamp-BsLyhvNA.js} +1 -1
  48. package/package.json +2 -2
  49. package/chunks/OddsSkeleton-ClJE2xhR.js +0 -26
  50. package/chunks/OddsStrip-BnSp5TXa.js +0 -383
  51. package/chunks/PickOneOfX-DaJtkbCw.js +0 -4206
  52. package/chunks/chevron-left-CxfCSZcr.js +0 -13
  53. package/chunks/chevron-right-BEQMacFn.js +0 -13
  54. package/chunks/index-Aq5MbUB9.js +0 -4
  55. package/chunks/index-BBQm_8LD.js +0 -4
  56. package/chunks/index-BC_sWWgc.js +0 -4
  57. package/chunks/index-DXKDJ1Vp.js +0 -4
  58. package/chunks/index-DjT5NrbA.js +0 -4
  59. package/chunks/index-DvLRehH6.js +0 -4
  60. package/chunks/index-aIMaxR-p.js +0 -4
  61. package/chunks/main-52Wff7qC.js +0 -11441
  62. package/chunks/main-B58mi9jx.js +0 -5622
  63. package/chunks/main-BIdXUTZS.js +0 -7308
  64. package/chunks/main-DD-NEzC7.js +0 -8241
  65. package/chunks/main-DUnfJPzY.js +0 -3608
  66. package/chunks/main-DpCBqqg_.js +0 -1950
  67. package/chunks/main-Drznt1ak.js +0 -1790
  68. package/chunks/users-wbJRbqW8.js +0 -16
  69. package/chunks/x-CK4GYo7T.js +0 -14
package/Leaderboard.js CHANGED
@@ -1,1010 +1,707 @@
1
- import { jsxs as S, jsx as n, Fragment as de } from "react/jsx-runtime";
2
- import z, { useState as F, useEffect as Q, useCallback as he, useMemo as W } from "react";
3
- import { useTheme as me, Box as I, FormLabel as fe, Typography as L, Select as ge, Option as be, Sheet as ye, Table as xe, Avatar as ee, IconButton as H, Button as te } from "@mui/joy";
4
- import { useTranslation as G } from "react-i18next";
5
- import { useConstantContext as Ce, ConstantsContext as ve, useColors as j, useCornerRadius as ue, useFontFamily as _, useSpacingScale as Z, useInternalTheme as pe, isExtraSmall as Te, hexToRgb as U, Spinner as Pe, stripHtmlTags as we, DirectionalIcon as k, useDisableCache as Se, AlertMessage as re, getLanguageDirection as Re, initializeI18n as Ee, applyDirectionToMount as Ae, widgetCacheKey as Le, createWidgetCache as Ie, ContainerProvider as Me, ThemeProvider as ze, ConstantsProvider as Be } from "fansunited-frontend-core";
6
- import oe from "@mui/icons-material/Person";
7
- import { C as Fe, a as Ue } from "./chunks/chevrons-right-CXSpQt9w.js";
8
- import { C as $e } from "./chunks/chevron-left-CxfCSZcr.js";
9
- import { C as Qe } from "./chunks/chevron-right-BEQMacFn.js";
10
- import { CacheProvider as He } from "@emotion/react";
11
- import { createPortal as ke } from "react-dom";
12
- import { w as De } from "./chunks/withVersionStamp-T8seRk9h.js";
13
- const Oe = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()).join(" "), We = ({
14
- options: e,
15
- selectedId: t,
16
- onChange: o
17
- }) => {
18
- const { t: c } = G(), { shadowRootElement: r } = Ce(ve), s = me(), b = j(), g = ue(), m = _().primary, u = Z(), C = b.textColor, f = {
19
- background: {
20
- surface: s.colorSchemes.light.palette.background.surface,
21
- popup: s.colorSchemes.light.palette.background.popup
22
- },
23
- neutral: {
24
- outlinedBorder: s.colorSchemes.light.palette.neutral.outlinedBorder,
25
- outlinedColor: s.colorSchemes.light.palette.neutral.outlinedColor,
26
- outlinedHoverBg: s.colorSchemes.light.palette.neutral.outlinedHoverBg,
27
- plainActiveBg: s.colorSchemes.light.palette.neutral.plainActiveBg,
28
- plainHoverBg: s.colorSchemes.light.palette.neutral.plainHoverBg,
29
- plainHoverColor: s.colorSchemes.light.palette.neutral.plainHoverColor
30
- }
31
- }, x = {
1
+ import { jsxs as T, jsx as i } from "@emotion/react/jsx-runtime";
2
+ import { useMemo as Q, useState as z, useEffect as F, useCallback as me } from "react";
3
+ import { css as v } from "@emotion/react";
4
+ import { useTranslation as Y } from "react-i18next";
5
+ import { Select as ge, Spinner as ye, DataTable as be, Avatar as J, Button as S, AlertMessage as K, WidgetPortal as ve } from "fansunited-frontend-core/ui/emotion";
6
+ import { useInternalTheme as ce, useColors as xe, isExtraSmall as Ce, hexToRgb as ee, stripHtmlTags as Te, DirectionalIcon as B, useDisableCache as Pe } from "fansunited-frontend-core";
7
+ import { PersonIcon as Ae } from "fansunited-frontend-core/ui/icons";
8
+ import { ChevronsLeft as Le, ChevronLeft as Ee, ChevronRight as we, ChevronsRight as Ie } from "fansunited-frontend-core/ui/icons/lucide";
9
+ import { w as Me } from "./chunks/withVersionStamp-BsLyhvNA.js";
10
+ const Oe = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()).join(" "), R = {
11
+ root: v({
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ gap: "var(--fu-ucrc-space-2xs)",
15
+ fontFamily: "var(--fu-ucrc-font-primary)"
16
+ }),
17
+ label: v({ display: "flex", color: "var(--fu-ucrc-text-color)", fontSize: "0.875em" }),
18
+ labelText: v({ margin: 0, lineHeight: 1.5, fontSize: "0.875em", color: "var(--fu-ucrc-text-color)" }),
19
+ option: v({
20
+ display: "flex",
21
+ alignItems: "center",
22
+ justifyContent: "space-between",
23
+ width: "100%",
24
+ gap: "var(--fu-ucrc-space-sm)"
25
+ }),
26
+ chip: v({
32
27
  flexShrink: 0,
33
- fontFamily: m,
34
28
  fontSize: "0.65em",
35
29
  fontWeight: 600,
36
30
  letterSpacing: "0.05em",
37
31
  textTransform: "uppercase",
38
- color: f.neutral.outlinedColor,
39
- bgcolor: f.neutral.plainHoverBg,
40
- border: `1px solid ${f.neutral.outlinedBorder}`,
41
- borderRadius: g.sm,
42
- px: u["2xs"],
43
- py: u["3xs"]
44
- }, R = (d) => /* @__PURE__ */ S(
45
- I,
46
- {
47
- sx: {
48
- display: "flex",
49
- alignItems: "center",
50
- justifyContent: "space-between",
51
- width: "100%",
52
- gap: u.sm
53
- },
54
- children: [
55
- /* @__PURE__ */ n("span", { children: d.label }),
56
- d.type && /* @__PURE__ */ n(I, { sx: x, children: Oe(d.type) })
57
- ]
58
- }
59
- ), T = {
60
- root: {
61
- sx: {
62
- fontFamily: m,
63
- borderRadius: g.sm,
64
- bgcolor: f.background.surface,
65
- borderColor: f.neutral.outlinedBorder,
66
- color: f.neutral.outlinedColor,
67
- fontSize: "1em",
68
- "&:hover": { bgcolor: f.neutral.outlinedHoverBg }
69
- }
70
- },
71
- listbox: {
72
- container: r,
73
- sx: {
74
- zIndex: 10,
75
- bgcolor: f.background.popup,
76
- border: `1px solid ${f.neutral.outlinedBorder}`,
77
- borderRadius: g.sm,
78
- boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
79
- }
80
- }
81
- }, h = {
82
- fontFamily: m,
83
- color: `${f.neutral.outlinedColor} !important`,
84
- bgcolor: "transparent",
85
- "&:hover": {
86
- bgcolor: `${f.neutral.plainHoverBg} !important`,
87
- color: `${f.neutral.plainHoverColor} !important`
88
- },
89
- "&.Mui-selected": {
90
- bgcolor: `${f.neutral.plainActiveBg} !important`,
91
- color: `${f.neutral.outlinedColor} !important`
92
- },
93
- "&.Mui-selected:hover": {
94
- bgcolor: `${f.neutral.plainActiveBg} !important`,
95
- color: `${f.neutral.outlinedColor} !important`
96
- }
97
- };
98
- return /* @__PURE__ */ S(I, { sx: { display: "flex", flexDirection: "column", gap: u["2xs"] }, children: [
99
- /* @__PURE__ */ n(
100
- fe,
101
- {
102
- sx: {
103
- color: `${C} !important`,
104
- fontFamily: m,
105
- fontSize: "0.875em"
106
- },
107
- children: /* @__PURE__ */ n(
108
- L,
109
- {
110
- sx: {
111
- fontFamily: m,
112
- fontSize: "0.875em",
113
- color: C
114
- },
115
- children: c("leaderboard.selectLabel")
116
- }
117
- )
118
- }
119
- ),
120
- /* @__PURE__ */ n(
32
+ color: "var(--fu-ucrc-neutral-outlined-color)",
33
+ backgroundColor: "var(--fu-ucrc-neutral-plain-hover-bg)",
34
+ border: "1px solid var(--fu-ucrc-neutral-outlined-border)",
35
+ borderRadius: "var(--fu-ucrc-radius-sm)",
36
+ paddingInline: "var(--fu-ucrc-space-2xs)",
37
+ paddingBlock: "var(--fu-ucrc-space-3xs)"
38
+ })
39
+ }, Ue = {
40
+ "--fu-ucrc-bg-surface": ["background", "surface"],
41
+ "--fu-ucrc-bg-popup": ["background", "popup"],
42
+ "--fu-ucrc-neutral-outlined-border": ["neutral", "outlinedBorder"],
43
+ "--fu-ucrc-neutral-outlined-color": ["neutral", "outlinedColor"],
44
+ "--fu-ucrc-neutral-outlined-hover-bg": ["neutral", "outlinedHoverBg"],
45
+ "--fu-ucrc-neutral-plain-active-bg": ["neutral", "plainActiveBg"],
46
+ "--fu-ucrc-neutral-plain-hover-bg": ["neutral", "plainHoverBg"],
47
+ "--fu-ucrc-neutral-plain-hover-color": ["neutral", "plainHoverColor"]
48
+ }, _e = ({ options: e, selectedId: t, onChange: n }) => {
49
+ const { t: o } = Y(), r = ce(), l = Q(() => {
50
+ const c = r.colorSchemes.light.palette || {};
51
+ return Object.fromEntries(
52
+ Object.entries(Ue).map(([p, [y, E]]) => {
53
+ var P;
54
+ return [p, (P = c[y]) == null ? void 0 : P[E]];
55
+ })
56
+ );
57
+ }, [r]), u = Q(
58
+ () => e.map((c) => ({
59
+ value: c.id,
60
+ label: /* @__PURE__ */ T("span", { css: R.option, children: [
61
+ /* @__PURE__ */ i("span", { children: c.label }),
62
+ c.type && /* @__PURE__ */ i("span", { css: R.chip, children: Oe(c.type) })
63
+ ] })
64
+ })),
65
+ [e]
66
+ );
67
+ return /* @__PURE__ */ T("div", { css: R.root, style: l, children: [
68
+ /* @__PURE__ */ i("label", { css: R.label, children: /* @__PURE__ */ i("p", { css: R.labelText, children: o("leaderboard.selectLabel") }) }),
69
+ /* @__PURE__ */ i(
121
70
  ge,
122
71
  {
72
+ "aria-label": o("leaderboard.selectLabel"),
73
+ options: u,
123
74
  value: t,
124
- onChange: (d, w) => w && o(w),
125
- slotProps: T,
126
- renderValue: (d) => {
127
- if (!d) return null;
128
- const w = e.find((A) => A.id === d.value);
129
- return w ? R(w) : d.label;
130
- },
131
- children: e.map((d) => /* @__PURE__ */ n(be, { value: d.id, sx: h, children: R(d) }, d.id))
75
+ onChange: n
132
76
  }
133
77
  )
134
78
  ] });
135
- }, _e = ({
79
+ }, ze = "calc(6em / 10.5) calc(8em / 10.5)", X = "0.5em calc(8em / 12)", Qe = "var(--fu-ucrc-lb-primary)", G = "var(--fu-ucrc-lb-text)", de = "var(--fu-ucrc-lb-on-primary)", Se = "var(--fu-ucrc-lb-head-bg)", j = "var(--fu-ucrc-font-primary)", te = "var(--fu-ucrc-font-secondary)", ue = "var(--fu-ucrc-outline-enabled-border)", $ = { margin: 0, lineHeight: 1.5 }, Z = { ...$, fontFamily: j, fontSize: "0.875em", color: G }, x = {
80
+ container: v({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-md)" }),
81
+ heading: v({ display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center" }),
82
+ overline: v({
83
+ ...$,
84
+ fontWeight: 500,
85
+ lineHeight: "166%",
86
+ letterSpacing: "1px",
87
+ textTransform: "uppercase",
88
+ fontSize: "0.75em",
89
+ color: "var(--fu-ucrc-text-color)",
90
+ opacity: "60%",
91
+ fontFamily: te
92
+ }),
93
+ titles: v({ display: "flex", flexDirection: "column", gap: "var(--fu-ucrc-space-3xs)" }),
94
+ title: v({
95
+ ...$,
96
+ fontFamily: j,
97
+ fontWeight: 700,
98
+ lineHeight: "133%",
99
+ letterSpacing: "0px",
100
+ fontSize: "1.5em",
101
+ color: G,
102
+ textAlign: "center"
103
+ }),
104
+ description: v({
105
+ ...$,
106
+ fontWeight: 400,
107
+ lineHeight: "140%",
108
+ letterSpacing: "0.15px",
109
+ fontSize: "1.25em",
110
+ color: "var(--fu-ucrc-text-color)",
111
+ opacity: "60%",
112
+ fontFamily: j
113
+ }),
114
+ tableContainer: v({
115
+ backgroundColor: "var(--fu-ucrc-bg-surface)",
116
+ overflowX: "auto",
117
+ borderRadius: "var(--fu-ucrc-radius-md)",
118
+ border: `1px solid ${ue}`
119
+ }),
120
+ nameCell: v({ display: "flex", alignItems: "center", gap: "var(--fu-ucrc-space-sm)" }),
121
+ avatar: v({
122
+ width: "32px",
123
+ height: "32px",
124
+ fontSize: "0.875em",
125
+ fontWeight: 600,
126
+ backgroundColor: Qe,
127
+ color: de
128
+ }),
129
+ position: v({ ...Z, fontWeight: 600 }),
130
+ name: v({ ...Z, fontWeight: 500, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }),
131
+ points: v({ ...Z, fontWeight: 600 }),
132
+ empty: v({
133
+ ...$,
134
+ fontFamily: te,
135
+ fontSize: "1.25em",
136
+ color: G,
137
+ textAlign: "center",
138
+ marginBlock: "var(--fu-ucrc-space-md)"
139
+ })
140
+ }, N = {
141
+ backgroundColor: Se,
142
+ color: G,
143
+ fontFamily: j,
144
+ fontWeight: 600,
145
+ fontSize: "0.875em",
146
+ textAlign: "center",
147
+ padding: ze,
148
+ borderBottomColor: ue
149
+ }, U = {
150
+ headPosition: { ...N, width: "10%" },
151
+ headName: { ...N, textAlign: "start", width: "80%" },
152
+ headPoints: { ...N, width: "10%" },
153
+ position: { padding: X, width: "10%", textAlign: "center" },
154
+ name: { padding: X, width: "80%" },
155
+ points: { padding: X, width: "10%", textAlign: "center" }
156
+ }, De = { backgroundColor: "var(--fu-ucrc-surface-variant)", cursor: "default" }, re = /* @__PURE__ */ i(Ae, { size: "1em", color: de }), Re = ({
136
157
  leaderboard: e,
137
158
  userRank: t,
138
- showHeading: o,
139
- title: c,
159
+ showHeading: n,
160
+ title: o,
140
161
  description: r,
141
- isSplitVariant: s,
142
- brandingColors: b,
143
- rankStyles: g
162
+ isSplitVariant: l,
163
+ brandingColors: u,
164
+ rankStyles: c
144
165
  }) => {
145
- const { t: m } = G(), u = pe(), C = j(), f = (b == null ? void 0 : b.primaryColor) || C.palette.primary.plainColor, x = (b == null ? void 0 : b.contentColor) || C.textColor, R = C.textColor, T = _().primary, h = _().secondary, d = ue(), w = Z(), A = Te(), l = C.surfaceVariant, p = u.colorSchemes.light.palette.primary.onPrimary, i = C.outlineEnabledBorder, a = {
146
- leaderboardContainer: {
147
- display: "flex",
148
- flexDirection: "column",
149
- gap: w.md
150
- },
151
- leaderboardTitle: {
152
- fontFamily: T,
153
- fontWeight: 700,
154
- lineHeight: "133%",
155
- letterSpacing: "0px",
156
- fontSize: "1.5em",
157
- color: x,
158
- textAlign: "center"
159
- },
160
- tableContainer: {
161
- overflowX: "auto",
162
- borderRadius: d.md,
163
- border: `1px solid ${i}`
164
- },
165
- table: {
166
- backgroundColor: l,
167
- "--TableCell-paddingX": "0.5rem",
168
- "--TableCell-paddingY": "0.375rem",
169
- cursor: "default",
170
- "& > tbody > tr:hover": {
171
- backgroundColor: "transparent"
172
- },
173
- "& > thead > tr > th": {
174
- backgroundColor: `rgba(${U(l)}, 0.8)`,
175
- color: x,
176
- fontFamily: T,
177
- fontWeight: 600,
178
- fontSize: "0.875em",
179
- textAlign: "center",
180
- borderBottom: `1px solid ${i}`
181
- }
182
- },
183
- headerCellPosition: {
184
- backgroundColor: `rgba(${U(l)}, 0.8)`,
185
- color: x,
186
- fontFamily: T,
187
- fontWeight: 600,
188
- fontSize: "0.875em",
189
- textAlign: "center",
190
- padding: "0.375rem 0.5rem",
191
- width: "10%"
192
- },
193
- headerCellName: {
194
- backgroundColor: `rgba(${U(l)}, 0.8)`,
195
- color: x,
196
- fontFamily: T,
197
- fontWeight: 600,
198
- fontSize: "0.875em",
199
- textAlign: "left",
200
- padding: "0.375rem 0.5rem",
201
- width: "80%"
202
- },
203
- headerCellPoints: {
204
- backgroundColor: `rgba(${U(l)}, 0.8)`,
205
- color: x,
206
- fontFamily: T,
207
- fontWeight: 600,
208
- fontSize: "0.875em",
209
- textAlign: "center",
210
- padding: "0.375rem 0.5rem",
211
- width: "10%"
212
- },
213
- tableCellPosition: {
214
- padding: "0.375rem 0.5rem",
215
- width: "10%",
216
- textAlign: "center"
217
- },
218
- tableCellName: {
219
- padding: "0.375rem 0.5rem",
220
- width: "80%"
221
- },
222
- tableCellPoints: {
223
- padding: "0.375rem 0.5rem",
224
- width: "10%",
225
- textAlign: "center"
226
- },
227
- userRow: {
228
- backgroundColor: `rgba(${U(f)}, 0.1)`
229
- },
230
- nameCell: {
231
- display: "flex",
232
- alignItems: "center",
233
- gap: w.sm
234
- },
235
- leaderboardAvatar: {
236
- width: "32px",
237
- height: "32px",
238
- fontSize: "0.875em",
239
- fontWeight: 600,
240
- backgroundColor: f,
241
- color: p
242
- },
243
- nameText: {
244
- fontFamily: T,
245
- fontWeight: 500,
246
- fontSize: "0.875em",
247
- color: x,
248
- overflow: "hidden",
249
- textOverflow: "ellipsis",
250
- whiteSpace: "nowrap"
251
- },
252
- positionText: {
253
- fontFamily: T,
254
- fontWeight: 600,
255
- fontSize: "0.875em",
256
- color: x
257
- },
258
- pointsText: {
259
- fontFamily: T,
260
- fontWeight: 600,
261
- fontSize: "0.875em",
262
- color: x
263
- },
264
- avatarIcon: {
265
- fontSize: "1em",
266
- color: p
267
- },
268
- noLeaderboardText: {
269
- fontFamily: h,
270
- fontSize: "1.25em",
271
- color: x,
272
- textAlign: "center",
273
- marginY: w.md
274
- }
275
- };
166
+ const { t: p } = Y(), y = ce(), E = xe(), P = Ce(), A = (u == null ? void 0 : u.primaryColor) || E.palette.primary.plainColor, f = Q(
167
+ () => ({
168
+ "--fu-ucrc-lb-primary": A,
169
+ "--fu-ucrc-lb-text": (u == null ? void 0 : u.contentColor) || E.textColor,
170
+ "--fu-ucrc-lb-on-primary": y.colorSchemes.light.palette.primary.onPrimary,
171
+ "--fu-ucrc-lb-head-bg": `rgba(${ee(E.surfaceVariant)}, 0.8)`
172
+ }),
173
+ [A, u == null ? void 0 : u.contentColor, E, y]
174
+ ), h = Q(() => ({ backgroundColor: `rgba(${ee(A)}, 0.1)` }), [A]);
276
175
  if (!e)
277
- return /* @__PURE__ */ n(Pe, { my: 10 });
176
+ return /* @__PURE__ */ i(ye, { marginBlock: "5em" });
278
177
  if (e.length === 0)
279
- return /* @__PURE__ */ n(L, { level: "body-lg", sx: a.noLeaderboardText, children: m("leaderboard.noLeaderboardAvailable") });
280
- const v = t, P = v == null ? void 0 : v.profileId, B = P && e.some((E) => E.profileId === P);
281
- return /* @__PURE__ */ S(I, { sx: a.leaderboardContainer, children: [
282
- o && /* @__PURE__ */ S(
283
- I,
284
- {
285
- sx: {
286
- display: "flex",
287
- flexDirection: "column",
288
- alignItems: "center",
289
- textAlign: "center"
290
- },
291
- children: [
292
- /* @__PURE__ */ n(
293
- L,
294
- {
295
- level: "body-sm",
296
- sx: {
297
- fontWeight: 500,
298
- lineHeight: "166%",
299
- letterSpacing: "1px",
300
- textTransform: "uppercase",
301
- fontSize: "0.75em",
302
- color: R,
303
- opacity: "60%",
304
- fontFamily: h
305
- },
306
- children: m("leaderboard.heading")
307
- }
308
- ),
309
- /* @__PURE__ */ S(
310
- I,
311
- {
312
- sx: {
313
- display: "flex",
314
- flexDirection: "column",
315
- gap: w["3xs"]
316
- },
317
- children: [
318
- c && /* @__PURE__ */ n(L, { level: "h4", sx: a.leaderboardTitle, children: c }),
319
- r && /* @__PURE__ */ n(
320
- L,
321
- {
322
- sx: {
323
- fontWeight: 400,
324
- lineHeight: "140%",
325
- letterSpacing: "0.15px",
326
- fontSize: "1.25em",
327
- color: R,
328
- opacity: "60%",
329
- fontFamily: T
330
- },
331
- children: we(r)
332
- }
333
- )
334
- ]
335
- }
336
- )
337
- ]
338
- }
339
- ),
340
- /* @__PURE__ */ n(ye, { sx: a.tableContainer, children: /* @__PURE__ */ S(
341
- xe,
342
- {
343
- variant: "outlined",
344
- hoverRow: !1,
345
- borderAxis: "bothBetween",
346
- size: "sm",
347
- sx: a.table,
348
- children: [
349
- /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ S("tr", { children: [
350
- /* @__PURE__ */ n("th", { style: a.headerCellPosition, children: A || s ? "" : m("leaderboard.position") }),
351
- /* @__PURE__ */ n("th", { style: a.headerCellName, children: m("leaderboard.name") }),
352
- /* @__PURE__ */ n("th", { style: a.headerCellPoints, children: A || s ? "🎯" : m("leaderboard.points") })
178
+ return /* @__PURE__ */ i("p", { css: x.empty, style: f, children: p("leaderboard.noLeaderboardAvailable") });
179
+ const C = t == null ? void 0 : t.profileId, s = C && e.some((g) => g.profileId === C);
180
+ return /* @__PURE__ */ T("div", { css: x.container, style: f, children: [
181
+ n && /* @__PURE__ */ T("div", { css: x.heading, children: [
182
+ /* @__PURE__ */ i("p", { css: x.overline, children: p("leaderboard.heading") }),
183
+ /* @__PURE__ */ T("div", { css: x.titles, children: [
184
+ o && /* @__PURE__ */ i("h4", { css: x.title, children: o }),
185
+ r && /* @__PURE__ */ i("p", { css: x.description, children: Te(r) })
186
+ ] })
187
+ ] }),
188
+ /* @__PURE__ */ i("div", { css: x.tableContainer, children: /* @__PURE__ */ T(be, { style: De, children: [
189
+ /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ T("tr", { children: [
190
+ /* @__PURE__ */ i("th", { style: U.headPosition, children: P || l ? "" : p("leaderboard.position") }),
191
+ /* @__PURE__ */ i("th", { style: U.headName, children: p("leaderboard.name") }),
192
+ /* @__PURE__ */ i("th", { style: U.headPoints, children: P || l ? "🎯" : p("leaderboard.points") })
193
+ ] }) }),
194
+ /* @__PURE__ */ T("tbody", { children: [
195
+ t && !s && /* @__PURE__ */ T("tr", { style: h, children: [
196
+ /* @__PURE__ */ i("td", { style: U.position, children: /* @__PURE__ */ T("p", { css: x.position, children: [
197
+ "#",
198
+ t.position
353
199
  ] }) }),
354
- /* @__PURE__ */ S("tbody", { children: [
355
- v && !B && /* @__PURE__ */ S("tr", { style: a.userRow, children: [
356
- /* @__PURE__ */ n("td", { style: a.tableCellPosition, children: /* @__PURE__ */ S(L, { sx: a.positionText, children: [
357
- "#",
358
- v.position
359
- ] }) }),
360
- /* @__PURE__ */ n("td", { style: a.tableCellName, children: /* @__PURE__ */ S(I, { sx: a.nameCell, children: [
361
- /* @__PURE__ */ n(ee, { sx: a.leaderboardAvatar, children: /* @__PURE__ */ n(oe, { sx: a.avatarIcon }) }),
362
- /* @__PURE__ */ n(L, { sx: a.nameText, children: m("leaderboard.you") })
363
- ] }) }),
364
- /* @__PURE__ */ n("td", { style: a.tableCellPoints, children: /* @__PURE__ */ n(L, { sx: a.pointsText, children: v.points }) })
365
- ] }),
366
- e.map((E, y) => {
367
- var Y, K, q, J;
368
- const M = P === E.profileId, O = M ? a.userRow : g == null ? void 0 : g[y + 1];
369
- return /* @__PURE__ */ S("tr", { style: O, children: [
370
- /* @__PURE__ */ n("td", { style: a.tableCellPosition, children: /* @__PURE__ */ S(L, { sx: a.positionText, children: [
371
- "#",
372
- E.position
373
- ] }) }),
374
- /* @__PURE__ */ n("td", { style: a.tableCellName, children: /* @__PURE__ */ S(I, { sx: a.nameCell, children: [
375
- /* @__PURE__ */ n(
376
- ee,
377
- {
378
- src: ((Y = E.profileModel) == null ? void 0 : Y.avatar) || void 0,
379
- sx: a.leaderboardAvatar,
380
- children: (K = E.profileModel) != null && K.avatar ? /* @__PURE__ */ n(de, {}) : /* @__PURE__ */ n(oe, { sx: a.avatarIcon })
381
- }
382
- ),
383
- /* @__PURE__ */ n(L, { sx: a.nameText, children: M ? m("leaderboard.you") : ((q = E.profileModel) == null ? void 0 : q.nickname) || ((J = E.profileModel) == null ? void 0 : J.name) || m("leaderboard.anonymous") })
384
- ] }) }),
385
- /* @__PURE__ */ n("td", { style: a.tableCellPoints, children: /* @__PURE__ */ n(L, { sx: a.pointsText, children: E.points }) })
386
- ] }, E.profileId);
387
- })
388
- ] })
389
- ]
390
- }
391
- ) })
200
+ /* @__PURE__ */ i("td", { style: U.name, children: /* @__PURE__ */ T("div", { css: x.nameCell, children: [
201
+ /* @__PURE__ */ i(J, { css: x.avatar, children: re }),
202
+ /* @__PURE__ */ i("p", { css: x.name, children: p("leaderboard.you") })
203
+ ] }) }),
204
+ /* @__PURE__ */ i("td", { style: U.points, children: /* @__PURE__ */ i("p", { css: x.points, children: t.points }) })
205
+ ] }),
206
+ e.map((g, w) => {
207
+ var a, m, I, O;
208
+ const d = C === g.profileId, b = d ? h : c == null ? void 0 : c[w + 1];
209
+ return /* @__PURE__ */ T("tr", { style: b, children: [
210
+ /* @__PURE__ */ i("td", { style: U.position, children: /* @__PURE__ */ T("p", { css: x.position, children: [
211
+ "#",
212
+ g.position
213
+ ] }) }),
214
+ /* @__PURE__ */ i("td", { style: U.name, children: /* @__PURE__ */ T("div", { css: x.nameCell, children: [
215
+ /* @__PURE__ */ i(J, { src: ((a = g.profileModel) == null ? void 0 : a.avatar) || void 0, css: x.avatar, children: (m = g.profileModel) != null && m.avatar ? null : re }),
216
+ /* @__PURE__ */ i("p", { css: x.name, children: d ? p("leaderboard.you") : ((I = g.profileModel) == null ? void 0 : I.nickname) || ((O = g.profileModel) == null ? void 0 : O.name) || p("leaderboard.anonymous") })
217
+ ] }) }),
218
+ /* @__PURE__ */ i("td", { style: U.points, children: /* @__PURE__ */ i("p", { css: x.points, children: g.points }) })
219
+ ] }, g.profileId);
220
+ })
221
+ ] })
222
+ ] }) })
392
223
  ] });
393
- }, Xe = ({
224
+ }, He = v({
225
+ display: "flex",
226
+ gap: "4px",
227
+ alignItems: "center",
228
+ flexWrap: "wrap",
229
+ fontFamily: "var(--fu-ucrc-font-primary)"
230
+ }), D = { borderRadius: "8px", minWidth: "32px", minHeight: "32px" }, pe = { ...D, fontWeight: 400 }, Fe = { ...D, fontWeight: 600 }, $e = { ...pe, cursor: "default", color: "var(--fu-ucrc-joy-text-secondary)" }, Be = ({
394
231
  count: e = 10,
395
232
  page: t = 1,
396
- onChange: o,
397
- siblingCount: c = 1,
233
+ onChange: n,
234
+ siblingCount: o = 1,
398
235
  boundaryCount: r = 1,
399
- showFirstButton: s = !0,
400
- showLastButton: b = !0,
401
- size: g = "md",
402
- disabled: m = !1,
403
- isOverlayVariant: u = !1
236
+ showFirstButton: l = !0,
237
+ showLastButton: u = !0,
238
+ size: c = "md",
239
+ disabled: p = !1
404
240
  }) => {
405
- const C = pe(), f = (l) => {
406
- o && l >= 1 && l <= e && o(l);
407
- }, x = (l, p) => {
408
- const i = [];
409
- for (let a = l; a <= p; a++) i.push(a);
410
- return i;
411
- }, T = (() => {
241
+ const y = (h) => {
242
+ n && h >= 1 && h <= e && n(h);
243
+ }, E = (h, C) => {
244
+ const s = [];
245
+ for (let g = h; g <= C; g++) s.push(g);
246
+ return s;
247
+ }, A = (() => {
412
248
  if (e <= 0) return [];
413
- const l = x(1, Math.min(r, e)), p = x(
249
+ const h = E(1, Math.min(r, e)), C = E(
414
250
  Math.max(e - r + 1, r + 1),
415
251
  e
416
- ), i = Math.max(r + 1, t - c), a = Math.min(e - r, t + c), v = [...l];
417
- if (i > r + 1 && v.push("ellipsis-start"), i <= a)
418
- for (let P = i; P <= a; P++)
419
- v.push(P);
420
- a < e - r && v.push("ellipsis-end");
421
- for (const P of p)
422
- v.includes(P) || v.push(P);
423
- return v;
424
- })(), h = g === "sm" ? "sm" : g === "lg" ? "lg" : "md", d = g === "sm" ? 16 : g === "lg" ? 24 : 20, w = (l = !1) => {
425
- if (!u)
426
- return {
427
- borderRadius: "8px",
428
- minWidth: "32px",
429
- minHeight: "32px",
430
- fontWeight: l ? 600 : 400
431
- };
432
- const p = C.colorSchemes.dark;
433
- return {
434
- borderRadius: "8px",
435
- minWidth: "32px",
436
- minHeight: "32px",
437
- fontWeight: l ? 600 : 400,
438
- backgroundColor: l ? p.palette.neutral.solidBg : "transparent",
439
- color: l ? p.palette.neutral.solidColor : p.textColor,
440
- border: "none",
441
- "&:hover": {
442
- backgroundColor: p.palette.neutral.solidBg,
443
- color: l ? p.palette.neutral.solidColor : p.textColor
444
- },
445
- "&:active": {
446
- backgroundColor: p.palette.neutral.plainActiveBg
447
- },
448
- "&.Mui-disabled": {
449
- backgroundColor: "transparent",
450
- color: p.textDisabled,
451
- opacity: 0.5
252
+ ), s = Math.max(r + 1, t - o), g = Math.min(e - r, t + o), w = [...h];
253
+ if (s > r + 1 && w.push("ellipsis-start"), s <= g)
254
+ for (let d = s; d <= g; d++)
255
+ w.push(d);
256
+ g < e - r && w.push("ellipsis-end");
257
+ for (const d of C)
258
+ w.includes(d) || w.push(d);
259
+ return w;
260
+ })(), f = c === "sm" ? 16 : c === "lg" ? 24 : 20;
261
+ return /* @__PURE__ */ T("div", { css: He, children: [
262
+ l && /* @__PURE__ */ i(
263
+ S,
264
+ {
265
+ icon: !0,
266
+ variant: "plain",
267
+ onClick: () => y(1),
268
+ disabled: p || t === 1,
269
+ style: D,
270
+ children: /* @__PURE__ */ i(B, { children: /* @__PURE__ */ i(Le, { size: f }) })
452
271
  }
453
- };
454
- }, A = () => {
455
- if (!u)
456
- return {
457
- borderRadius: "8px",
458
- minWidth: "32px",
459
- minHeight: "32px"
460
- };
461
- const l = C.colorSchemes.dark;
462
- return {
463
- borderRadius: "8px",
464
- minWidth: "32px",
465
- minHeight: "32px",
466
- backgroundColor: "transparent",
467
- color: l.textColor,
468
- border: "none",
469
- "&:hover": {
470
- backgroundColor: l.palette.neutral.solidBg,
471
- color: l.textColor
472
- },
473
- "&:active": {
474
- backgroundColor: l.palette.neutral.plainActiveBg
475
- },
476
- "&.Mui-disabled": {
477
- backgroundColor: "transparent",
478
- color: l.textDisabled,
479
- opacity: 0.5
272
+ ),
273
+ /* @__PURE__ */ i(
274
+ S,
275
+ {
276
+ icon: !0,
277
+ variant: "plain",
278
+ onClick: () => y(t - 1),
279
+ disabled: p || t === 1,
280
+ style: D,
281
+ children: /* @__PURE__ */ i(B, { children: /* @__PURE__ */ i(Ee, { size: f }) })
480
282
  }
481
- };
482
- };
483
- return /* @__PURE__ */ S(
484
- I,
485
- {
486
- sx: {
487
- display: "flex",
488
- gap: 0.5,
489
- alignItems: "center",
490
- flexWrap: "wrap"
491
- },
492
- children: [
493
- s && /* @__PURE__ */ n(
494
- H,
495
- {
496
- size: h,
497
- variant: "plain",
498
- color: "neutral",
499
- onClick: () => f(1),
500
- disabled: m || t === 1,
501
- sx: A(),
502
- children: /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(Fe, { size: d }) })
503
- }
504
- ),
505
- /* @__PURE__ */ n(
506
- H,
507
- {
508
- size: h,
509
- variant: "plain",
510
- color: "neutral",
511
- onClick: () => f(t - 1),
512
- disabled: m || t === 1,
513
- sx: A(),
514
- children: /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n($e, { size: d }) })
515
- }
516
- ),
517
- T.map((l, p) => {
518
- if (typeof l == "string" && l.startsWith("ellipsis"))
519
- return /* @__PURE__ */ n(
520
- te,
521
- {
522
- size: h,
523
- variant: "plain",
524
- color: "neutral",
525
- disabled: !0,
526
- sx: {
527
- ...w(!1),
528
- cursor: "default",
529
- "&.Mui-disabled": u ? {
530
- backgroundColor: "transparent",
531
- color: C.colorSchemes.dark.textDisabled,
532
- opacity: 0.5
533
- } : {
534
- opacity: 1,
535
- color: "text.secondary"
536
- }
537
- },
538
- children: "..."
539
- },
540
- `${l}-${p}`
541
- );
542
- const i = l === t;
543
- return /* @__PURE__ */ n(
544
- te,
545
- {
546
- size: h,
547
- variant: i ? "solid" : "plain",
548
- color: "neutral",
549
- onClick: () => f(l),
550
- disabled: m,
551
- sx: w(i),
552
- children: l
553
- },
554
- l
555
- );
556
- }),
557
- /* @__PURE__ */ n(
558
- H,
559
- {
560
- size: h,
561
- variant: "plain",
562
- color: "neutral",
563
- onClick: () => f(t + 1),
564
- disabled: m || t === e,
565
- sx: A(),
566
- children: /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(Qe, { size: d }) })
567
- }
568
- ),
569
- b && /* @__PURE__ */ n(
570
- H,
283
+ ),
284
+ A.map((h, C) => {
285
+ if (typeof h == "string" && h.startsWith("ellipsis"))
286
+ return /* @__PURE__ */ i(
287
+ S,
571
288
  {
572
- size: h,
573
289
  variant: "plain",
574
- color: "neutral",
575
- onClick: () => f(e),
576
- disabled: m || t === e,
577
- sx: A(),
578
- children: /* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(Ue, { size: d }) })
579
- }
580
- )
581
- ]
582
- }
583
- );
584
- }, $ = "ALL", V = (e) => ({
290
+ disabled: !0,
291
+ style: $e,
292
+ children: "..."
293
+ },
294
+ `${h}-${C}`
295
+ );
296
+ const s = h === t;
297
+ return /* @__PURE__ */ i(
298
+ S,
299
+ {
300
+ variant: s ? "solid" : "plain",
301
+ onClick: () => y(h),
302
+ disabled: p,
303
+ style: s ? Fe : pe,
304
+ children: h
305
+ },
306
+ h
307
+ );
308
+ }),
309
+ /* @__PURE__ */ i(
310
+ S,
311
+ {
312
+ icon: !0,
313
+ variant: "plain",
314
+ onClick: () => y(t + 1),
315
+ disabled: p || t === e,
316
+ style: D,
317
+ children: /* @__PURE__ */ i(B, { children: /* @__PURE__ */ i(we, { size: f }) })
318
+ }
319
+ ),
320
+ u && /* @__PURE__ */ i(
321
+ S,
322
+ {
323
+ icon: !0,
324
+ variant: "plain",
325
+ onClick: () => y(e),
326
+ disabled: p || t === e,
327
+ style: D,
328
+ children: /* @__PURE__ */ i(B, { children: /* @__PURE__ */ i(Ie, { size: f }) })
329
+ }
330
+ )
331
+ ] });
332
+ }, H = "ALL", k = (e) => ({
585
333
  currentPage: e.currentPage,
586
334
  totalPages: e.numberOfPages,
587
335
  totalItems: e.totalItems,
588
336
  itemsPerPage: e.itemsPerPage
589
- }), N = (e) => e.map((t) => ({
337
+ }), q = (e) => e.map((t) => ({
590
338
  position: t.position,
591
339
  profileId: t.profileId,
592
340
  profileModel: t.profileModel,
593
341
  points: t.points
594
- })), Ge = async (e) => {
342
+ })), We = async (e) => {
595
343
  try {
596
344
  return await e.profile.getOwn().getInfo();
597
345
  } catch {
598
346
  return null;
599
347
  }
600
- }, ne = async (e, t, o) => e.length === 0 ? [] : (await t.topX.getGames({ gameIds: e }, o)).data.map((r) => {
601
- var s;
348
+ }, ne = async (e, t, n) => e.length === 0 ? [] : (await t.topX.getGames({ gameIds: e }, n)).data.map((r) => {
349
+ var l;
602
350
  return {
603
351
  id: r.id,
604
352
  title: r.title,
605
353
  description: r.description || null,
606
- branding: ((s = r.branding) == null ? void 0 : s.colors) || null
354
+ branding: ((l = r.branding) == null ? void 0 : l.colors) || null
607
355
  };
608
- }), le = async (e, t, o) => e.length === 0 ? [] : (await t.matchQuiz.getGames({ gameIds: e }, o)).data.map((r) => {
609
- var s;
356
+ }), ie = async (e, t, n) => e.length === 0 ? [] : (await t.matchQuiz.getGames({ gameIds: e }, n)).data.map((r) => {
357
+ var l;
610
358
  return {
611
359
  id: r.id,
612
360
  title: r.title,
613
361
  description: r.description || null,
614
- branding: ((s = r.branding) == null ? void 0 : s.colors) || null
362
+ branding: ((l = r.branding) == null ? void 0 : l.colors) || null
615
363
  };
616
- }), ae = async (e, t, o) => e.length === 0 ? [] : (await t.loyalty.getTemplates(void 0, o)).data.filter((r) => e.includes(r.id)).map((r) => {
617
- var s;
364
+ }), oe = async (e, t, n) => e.length === 0 ? [] : (await t.loyalty.getTemplates(void 0, n)).data.filter((r) => e.includes(r.id)).map((r) => {
365
+ var l;
618
366
  return {
619
367
  id: r.id,
620
368
  title: r.title || r.name,
621
369
  description: r.description || null,
622
- branding: ((s = r.branding) == null ? void 0 : s.colors) || null
370
+ branding: ((l = r.branding) == null ? void 0 : l.colors) || null
623
371
  };
624
- }), ie = async (e, t, o) => e.length === 0 ? [] : (await t.miniGames.getClassicQuizzes(
372
+ }), ae = async (e, t, n) => e.length === 0 ? [] : (await t.miniGames.getClassicQuizzes(
625
373
  { classicQuizIds: e, limit: e.length },
626
374
  void 0,
627
- o
375
+ n
628
376
  )).data.map((r) => {
629
- var s;
377
+ var l;
630
378
  return {
631
379
  id: r.id,
632
380
  title: r.title || r.name,
633
381
  description: r.description || null,
634
- branding: ((s = r.branding) == null ? void 0 : s.colors) || null
382
+ branding: ((l = r.branding) == null ? void 0 : l.colors) || null
635
383
  };
636
- }), je = async (e, t, o, c, r) => {
637
- const s = await t.loyalty.getLeaderboardForGame(e, { page: o, limit: c }, r);
384
+ }), Ge = async (e, t, n, o, r) => {
385
+ const l = await t.loyalty.getLeaderboardForGame(e, { page: n, limit: o }, r);
638
386
  return {
639
- leaderboard: N(s.data),
640
- pagination: V(s.meta.pagination)
387
+ leaderboard: q(l.data),
388
+ pagination: k(l.meta.pagination)
641
389
  };
642
- }, Ze = async (e, t, o, c, r) => {
643
- const s = await t.loyalty.getLeaderboard(
390
+ }, je = async (e, t, n, o, r) => {
391
+ const l = await t.loyalty.getLeaderboard(
644
392
  e,
645
- { page: o, limit: c },
393
+ { page: n, limit: o },
646
394
  r
647
395
  );
648
396
  return {
649
- leaderboard: N(s.data),
650
- pagination: V(s.meta.pagination)
397
+ leaderboard: q(l.data),
398
+ pagination: k(l.meta.pagination)
651
399
  };
652
- }, X = async (e, t, o, c, r) => {
653
- const s = await t.miniGames.getLeaderboardForClassicQuizzes(
654
- { classicQuizIds: e, page: o, limit: c },
400
+ }, V = async (e, t, n, o, r) => {
401
+ const l = await t.miniGames.getLeaderboardForClassicQuizzes(
402
+ { classicQuizIds: e, page: n, limit: o },
655
403
  r
656
404
  );
657
405
  return {
658
- leaderboard: N(s.data),
659
- pagination: V(s.meta.pagination)
406
+ leaderboard: q(l.data),
407
+ pagination: k(l.meta.pagination)
660
408
  };
661
- }, se = (e, t, o, c, r) => {
662
- const s = e.type.toUpperCase();
663
- return s === "TOP_X" || s === "MATCH_QUIZ" ? je(e.id, t, o, c, r) : s === "TEMPLATE" ? Ze(e.id, t, o, c, r) : X(
409
+ }, le = (e, t, n, o, r) => {
410
+ const l = e.type.toUpperCase();
411
+ return l === "TOP_X" || l === "MATCH_QUIZ" ? Ge(e.id, t, n, o, r) : l === "TEMPLATE" ? je(e.id, t, n, o, r) : V(
664
412
  [e.id],
665
413
  t,
414
+ n,
666
415
  o,
667
- c,
668
416
  r
669
417
  );
670
- }, Ve = async (e, t, o, c, r) => {
671
- const b = o.toUpperCase() === "TEMPLATE" ? { rankType: "TEMPLATE", leaderboardIds: [e] } : { rankType: "GAME", gameType: o.toUpperCase(), leaderboardIds: [e] }, u = (await t.loyalty.getOwnRankings(b, r)).data[0] ?? null;
672
- return u ? {
673
- position: u.position,
674
- profileId: c,
418
+ }, Xe = async (e, t, n, o, r) => {
419
+ const u = n.toUpperCase() === "TEMPLATE" ? { rankType: "TEMPLATE", leaderboardIds: [e] } : { rankType: "GAME", gameType: n.toUpperCase(), leaderboardIds: [e] }, y = (await t.loyalty.getOwnRankings(u, r)).data[0] ?? null;
420
+ return y ? {
421
+ position: y.position,
422
+ profileId: o,
675
423
  profileModel: null,
676
- points: u.points
424
+ points: y.points
677
425
  } : null;
678
- }, Ne = async (e, t, o, c) => {
679
- const b = (await t.miniGames.getClassicQuizzesUserRanking(
680
- o,
426
+ }, Ze = async (e, t, n, o) => {
427
+ const u = (await t.miniGames.getClassicQuizzesUserRanking(
428
+ n,
681
429
  void 0,
682
- c
683
- )).data.find((g) => g.classicQuizId === e) ?? null;
684
- return b ? {
685
- position: b.position,
686
- profileId: o,
430
+ o
431
+ )).data.find((c) => c.classicQuizId === e) ?? null;
432
+ return u ? {
433
+ position: u.position,
434
+ profileId: n,
687
435
  profileModel: null,
688
- points: b.points
436
+ points: u.points
689
437
  } : null;
690
- }, Ye = (e, t, o, c) => {
438
+ }, Ne = (e, t, n, o) => {
691
439
  const r = e.type.toUpperCase();
692
- return r === "TOP_X" || r === "MATCH_QUIZ" || r === "TEMPLATE" ? Ve(
440
+ return r === "TOP_X" || r === "MATCH_QUIZ" || r === "TEMPLATE" ? Xe(
693
441
  e.id,
694
442
  t,
695
443
  e.type,
696
- o,
697
- c
698
- ) : Ne(e.id, t, o, c);
699
- }, Ke = (e, t, o, c = 10) => {
700
- const [r, s] = F({}), [b, g] = F(null), [m, u] = F(!1), [C, f] = F(!1), [x, R] = F(
444
+ n,
445
+ o
446
+ ) : Ze(e.id, t, n, o);
447
+ }, Ve = (e, t, n, o = 10) => {
448
+ const [r, l] = z({}), [u, c] = z(null), [p, y] = z(!1), [E, P] = z(!1), [A, f] = z(
701
449
  null
702
- ), [T, h] = F(null), d = Se();
703
- Q(() => {
704
- const l = {
705
- topX: e.filter((i) => i.type.toUpperCase() === "TOP_X").map((i) => i.id),
706
- matchQuiz: e.filter((i) => i.type.toUpperCase() === "MATCH_QUIZ").map((i) => i.id),
707
- template: e.filter((i) => i.type.toUpperCase() === "TEMPLATE").map((i) => i.id),
708
- classicQuiz: e.filter((i) => i.type.toUpperCase() === "CLASSIC_QUIZ").map((i) => i.id)
709
- }, p = (i) => i.catch(() => []);
450
+ ), [h, C] = z(null), s = Pe();
451
+ F(() => {
452
+ const d = {
453
+ topX: e.filter((a) => a.type.toUpperCase() === "TOP_X").map((a) => a.id),
454
+ matchQuiz: e.filter((a) => a.type.toUpperCase() === "MATCH_QUIZ").map((a) => a.id),
455
+ template: e.filter((a) => a.type.toUpperCase() === "TEMPLATE").map((a) => a.id),
456
+ classicQuiz: e.filter((a) => a.type.toUpperCase() === "CLASSIC_QUIZ").map((a) => a.id)
457
+ }, b = (a) => a.catch(() => []);
710
458
  Promise.all([
711
- p(ne(l.topX, t, d)),
712
- p(le(l.matchQuiz, t, d)),
713
- p(ae(l.template, t, d)),
714
- p(ie(l.classicQuiz, t, d))
715
- ]).then((i) => {
716
- const a = {};
717
- i.flat().forEach((v) => {
718
- a[v.id] = v;
719
- }), s(a);
459
+ b(ne(d.topX, t, s)),
460
+ b(ie(d.matchQuiz, t, s)),
461
+ b(oe(d.template, t, s)),
462
+ b(ae(d.classicQuiz, t, s))
463
+ ]).then((a) => {
464
+ const m = {};
465
+ a.flat().forEach((I) => {
466
+ m[I.id] = I;
467
+ }), l(m);
720
468
  });
721
- }, [e, t, d]), Q(() => {
722
- Ge(t).then(R);
723
- }, [t]), Q(() => {
724
- if (!o || !x) {
725
- h(null);
469
+ }, [e, t, s]), F(() => {
470
+ We(t).then(f);
471
+ }, [t]), F(() => {
472
+ if (!n || !A) {
473
+ C(null);
726
474
  return;
727
475
  }
728
- let l = !1, p;
729
- if (o === $) {
730
- const i = e.map((a) => a.id);
731
- p = t.miniGames.getClassicQuizzesUserRanking(x.id, void 0, d).then((a) => {
732
- const P = a.data.find((B) => i.includes(B.classicQuizId)) ?? null;
733
- return P ? {
734
- position: P.position,
735
- profileId: x.id,
476
+ let d = !1, b;
477
+ if (n === H) {
478
+ const a = e.map((m) => m.id);
479
+ b = t.miniGames.getClassicQuizzesUserRanking(A.id, void 0, s).then((m) => {
480
+ const O = m.data.find((M) => a.includes(M.classicQuizId)) ?? null;
481
+ return O ? {
482
+ position: O.position,
483
+ profileId: A.id,
736
484
  profileModel: null,
737
- points: P.points
485
+ points: O.points
738
486
  } : null;
739
487
  });
740
488
  } else {
741
- const i = e.find((a) => a.id === o);
742
- if (!i) return;
743
- p = Ye(
744
- i,
489
+ const a = e.find((m) => m.id === n);
490
+ if (!a) return;
491
+ b = Ne(
492
+ a,
745
493
  t,
746
- x.id,
747
- d
494
+ A.id,
495
+ s
748
496
  );
749
497
  }
750
- return p.then((i) => {
751
- l || h(i);
498
+ return b.then((a) => {
499
+ d || C(a);
752
500
  }).catch(() => {
753
- l || h(null);
501
+ d || C(null);
754
502
  }), () => {
755
- l = !0;
503
+ d = !0;
756
504
  };
757
- }, [o, e, t, x, d]), Q(() => {
758
- if (!o) return;
759
- let l = !1;
760
- return u(!0), f(!1), g(null), (async () => {
505
+ }, [n, e, t, A, s]), F(() => {
506
+ if (!n) return;
507
+ let d = !1;
508
+ return y(!0), P(!1), c(null), (async () => {
761
509
  try {
762
- const i = e.length > 1 && e.every((y) => y.type.toUpperCase() === "CLASSIC_QUIZ");
763
- if (o === $ && i) {
764
- const y = e.map((O) => O.id), M = await X(
765
- y,
510
+ const a = e.length > 1 && e.every((L) => L.type.toUpperCase() === "CLASSIC_QUIZ");
511
+ if (n === H && a) {
512
+ const L = e.map((he) => he.id), fe = await V(
513
+ L,
766
514
  t,
767
515
  1,
768
- c,
769
- d
516
+ o,
517
+ s
770
518
  );
771
- l || g({
772
- id: $,
773
- title: $,
519
+ d || c({
520
+ id: H,
521
+ title: H,
774
522
  description: null,
775
523
  branding: null,
776
- ...M
524
+ ...fe
777
525
  });
778
526
  return;
779
527
  }
780
- const a = e.find((y) => y.id === o);
781
- if (!a) return;
782
- const v = a.type.toUpperCase(), P = v === "TOP_X" ? ne([o], t, d) : v === "MATCH_QUIZ" ? le([o], t, d) : v === "TEMPLATE" ? ae([o], t, d) : ie([o], t, d), [B, E] = await Promise.all([
783
- se(a, t, 1, c, d),
784
- P.catch(() => [])
528
+ const m = e.find((L) => L.id === n);
529
+ if (!m) return;
530
+ const I = m.type.toUpperCase(), O = I === "TOP_X" ? ne([n], t, s) : I === "MATCH_QUIZ" ? ie([n], t, s) : I === "TEMPLATE" ? oe([n], t, s) : ae([n], t, s), [M, _] = await Promise.all([
531
+ le(m, t, 1, o, s),
532
+ O.catch(() => [])
785
533
  ]);
786
- if (!l) {
787
- const y = E[0];
788
- g({
789
- id: o,
790
- title: (y == null ? void 0 : y.title) || o,
791
- description: (y == null ? void 0 : y.description) || null,
792
- branding: (y == null ? void 0 : y.branding) || null,
793
- ...B
534
+ if (!d) {
535
+ const L = _[0];
536
+ c({
537
+ id: n,
538
+ title: (L == null ? void 0 : L.title) || n,
539
+ description: (L == null ? void 0 : L.description) || null,
540
+ branding: (L == null ? void 0 : L.branding) || null,
541
+ ...M
794
542
  });
795
543
  }
796
- } catch (i) {
797
- console.error("Failed to fetch leaderboard:", i), l || f(!0);
544
+ } catch (a) {
545
+ console.error("Failed to fetch leaderboard:", a), d || P(!0);
798
546
  } finally {
799
- l || u(!1);
547
+ d || y(!1);
800
548
  }
801
549
  })(), () => {
802
- l = !0;
550
+ d = !0;
803
551
  };
804
- }, [o, e, t, c, d]);
805
- const w = he(
806
- async (l) => {
807
- if (o) {
808
- u(!0);
552
+ }, [n, e, t, o, s]);
553
+ const g = me(
554
+ async (d) => {
555
+ if (n) {
556
+ y(!0);
809
557
  try {
810
- let p;
811
- if (o === $) {
812
- const i = e.map((a) => a.id);
813
- p = await X(
814
- i,
558
+ let b;
559
+ if (n === H) {
560
+ const a = e.map((m) => m.id);
561
+ b = await V(
562
+ a,
815
563
  t,
816
- l,
817
- c,
818
- d
564
+ d,
565
+ o,
566
+ s
819
567
  );
820
568
  } else {
821
- const i = e.find((a) => a.id === o);
822
- if (!i) return;
823
- p = await se(
824
- i,
569
+ const a = e.find((m) => m.id === n);
570
+ if (!a) return;
571
+ b = await le(
572
+ a,
825
573
  t,
826
- l,
827
- c,
828
- d
574
+ d,
575
+ o,
576
+ s
829
577
  );
830
578
  }
831
- g((i) => i ? { ...i, ...p } : null);
832
- } catch (p) {
833
- console.error("Failed to fetch page:", p);
579
+ c((a) => a ? { ...a, ...b } : null);
580
+ } catch (b) {
581
+ console.error("Failed to fetch page:", b);
834
582
  } finally {
835
- u(!1);
583
+ y(!1);
836
584
  }
837
585
  }
838
586
  },
839
- [o, e, t, c, d]
840
- ), A = Object.fromEntries(
841
- Object.entries(r).map(([l, p]) => [l, p.title])
587
+ [n, e, t, o, s]
588
+ ), w = Object.fromEntries(
589
+ Object.entries(r).map(([d, b]) => [d, b.title])
842
590
  );
843
- return { data: b, entityTitles: A, loading: m, error: C, setPage: w, userRank: T };
844
- }, D = "ALL", ce = ["TOP_X", "MATCH_QUIZ", "TEMPLATE", "CLASSIC_QUIZ"], qe = (e, t) => {
591
+ return { data: u, entityTitles: w, loading: p, error: E, setPage: g, userRank: h };
592
+ }, W = "ALL", Ye = v({
593
+ display: "flex",
594
+ flexDirection: "column",
595
+ gap: "var(--fu-ucrc-space-md)",
596
+ backgroundColor: "var(--fu-ucrc-surface)",
597
+ padding: "var(--fu-ucrc-space-md)"
598
+ }), se = ["TOP_X", "MATCH_QUIZ", "TEMPLATE", "CLASSIC_QUIZ"], ke = (e, t) => {
845
599
  if (!Array.isArray(e) || e.length === 0)
846
600
  return "The 'entities' setting is required and must be a non-empty array.";
847
- const o = /* @__PURE__ */ new Set();
848
- for (let c = 0; c < e.length; c++) {
849
- const r = e[c];
601
+ const n = /* @__PURE__ */ new Set();
602
+ for (let o = 0; o < e.length; o++) {
603
+ const r = e[o];
850
604
  if (!r || typeof r != "object")
851
- return `Entity at index ${c} must be an object with 'id' and 'type' fields.`;
605
+ return `Entity at index ${o} must be an object with 'id' and 'type' fields.`;
852
606
  if (!r.id || typeof r.id != "string")
853
- return `Entity at index ${c} is missing a required 'id' string field.`;
854
- if (o.has(r.id))
855
- return `Duplicate entity id '${r.id}' found at index ${c}. Each entity must have a unique id.`;
856
- if (o.add(r.id), !r.type || typeof r.type != "string")
857
- return `Entity at index ${c} is missing a required 'type' string field.`;
858
- if (!ce.includes(r.type.toUpperCase()))
859
- return `Entity at index ${c} has an invalid type '${r.type}'. Valid values are: ${ce.join(", ")} (case-insensitive).`;
607
+ return `Entity at index ${o} is missing a required 'id' string field.`;
608
+ if (n.has(r.id))
609
+ return `Duplicate entity id '${r.id}' found at index ${o}. Each entity must have a unique id.`;
610
+ if (n.add(r.id), !r.type || typeof r.type != "string")
611
+ return `Entity at index ${o} is missing a required 'type' string field.`;
612
+ if (!se.includes(r.type.toUpperCase()))
613
+ return `Entity at index ${o} has an invalid type '${r.type}'. Valid values are: ${se.join(", ")} (case-insensitive).`;
860
614
  }
861
615
  return t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t < 1 || t > 50) ? "The 'pageSize' setting must be an integer between 1 and 50." : null;
862
- }, Je = ({
616
+ }, qe = ({
863
617
  entities: e,
864
618
  sdk: t,
865
- pageSize: o,
866
- rankStyles: c,
619
+ pageSize: n,
620
+ rankStyles: o,
867
621
  showOverallOnly: r = !1,
868
- showHeading: s = !0
622
+ showHeading: l = !0
869
623
  }) => {
870
- var E;
871
- const { t: b } = G(), g = Z(), m = j().surface, u = W(
872
- () => qe(e, o),
873
- [e, o]
874
- ), C = W(
875
- () => !u && e.length > 1 && e.every((y) => y.type.toUpperCase() === "CLASSIC_QUIZ"),
876
- [e, u]
877
- ), f = r && C, x = C ? D : ((E = e[0]) == null ? void 0 : E.id) || "", [R, T] = F(x);
878
- Q(() => {
879
- R === D || e.some((M) => M.id === R) || T(x);
624
+ var O;
625
+ const { t: u } = Y(), c = Q(
626
+ () => ke(e, n),
627
+ [e, n]
628
+ ), p = Q(
629
+ () => !c && e.length > 1 && e.every((M) => M.type.toUpperCase() === "CLASSIC_QUIZ"),
630
+ [e, c]
631
+ ), y = r && p, E = p ? W : ((O = e[0]) == null ? void 0 : O.id) || "", [P, A] = z(E);
632
+ F(() => {
633
+ P === W || e.some((_) => _.id === P) || A(E);
880
634
  }, [e]);
881
- const { data: h, entityTitles: d, loading: w, error: A, setPage: l, userRank: p } = Ke(
882
- u ? [] : e,
635
+ const { data: f, entityTitles: h, loading: C, error: s, setPage: g, userRank: w } = Ve(
636
+ c ? [] : e,
883
637
  t,
884
- u ? "" : R,
885
- o
886
- ), i = W(() => {
887
- if (u) return [];
888
- const y = [];
889
- return C && y.push({ id: D, label: b("leaderboard.overall") }), e.forEach((M) => {
890
- y.push({
891
- id: M.id,
892
- label: d[M.id] ?? "",
893
- type: M.type.toUpperCase()
638
+ c ? "" : P,
639
+ n
640
+ ), d = Q(() => {
641
+ if (c) return [];
642
+ const M = [];
643
+ return p && M.push({ id: W, label: u("leaderboard.overall") }), e.forEach((_) => {
644
+ M.push({
645
+ id: _.id,
646
+ label: h[_.id] ?? "",
647
+ type: _.type.toUpperCase()
894
648
  });
895
- }), y;
896
- }, [e, C, b, d, u]), a = e.every((y) => d[y.id] !== void 0), v = !u && !f && (e.length > 1 || C) && a, P = (h == null ? void 0 : h.pagination) || null, B = R === D ? b("leaderboard.overall") : (h == null ? void 0 : h.title) || null;
897
- return u ? /* @__PURE__ */ n(
898
- re,
649
+ }), M;
650
+ }, [e, p, u, h, c]), b = e.every((M) => h[M.id] !== void 0), a = !c && !y && (e.length > 1 || p) && b, m = (f == null ? void 0 : f.pagination) || null, I = P === W ? u("leaderboard.overall") : (f == null ? void 0 : f.title) || null;
651
+ return c ? /* @__PURE__ */ i(
652
+ K,
899
653
  {
900
654
  variant: "error",
901
655
  title: "Configuration Error",
902
- message: u
656
+ message: c
903
657
  }
904
- ) : A ? /* @__PURE__ */ n(
905
- re,
658
+ ) : s ? /* @__PURE__ */ i(
659
+ K,
906
660
  {
907
661
  variant: "error",
908
662
  title: "Failed to Load Leaderboard",
909
663
  message: "One or more entity IDs could not be found. Please verify the provided IDs and try again."
910
664
  }
911
- ) : /* @__PURE__ */ S(
912
- I,
913
- {
914
- sx: {
915
- display: "flex",
916
- flexDirection: "column",
917
- gap: g.md,
918
- backgroundColor: m,
919
- padding: g.md
920
- },
921
- children: [
922
- v && /* @__PURE__ */ n(
923
- We,
924
- {
925
- options: i,
926
- selectedId: R,
927
- onChange: T
928
- }
929
- ),
930
- /* @__PURE__ */ n(
931
- _e,
932
- {
933
- leaderboard: w ? null : (h == null ? void 0 : h.leaderboard) || null,
934
- userRank: w ? null : p,
935
- showHeading: s && !v,
936
- title: B,
937
- description: (h == null ? void 0 : h.description) || null,
938
- brandingColors: (h == null ? void 0 : h.branding) || null,
939
- rankStyles: c
940
- }
941
- ),
942
- !w && P && P.totalPages > 1 && /* @__PURE__ */ n(
943
- Xe,
944
- {
945
- count: P.totalPages,
946
- page: P.currentPage,
947
- onChange: l
948
- }
949
- )
950
- ]
951
- }
952
- );
953
- }, et = (e) => {
954
- var T;
955
- const [t, o] = z.useState(!1), [c, r] = z.useState(!1), s = Re(e.language), b = z.useRef(
956
- `leaderboard-shadow-root-${Math.random().toString(36).substring(2, 11)}`
957
- ), g = z.useRef(null), m = z.useRef(null), u = z.useRef(null), [C, f] = z.useState(null);
958
- z.useEffect(() => {
959
- Ee(e.language || "en").finally(() => r(!0));
960
- }, [e.language]), z.useEffect(() => {
961
- if (!g.current) return;
962
- g.current.shadowRoot ? (m.current = g.current.shadowRoot, u.current = m.current.getElementById(
963
- b.current
964
- ), u.current || (u.current = document.createElement("div"), u.current.id = b.current, m.current.appendChild(u.current))) : (m.current = g.current.attachShadow({ mode: "open" }), u.current = document.createElement("div"), u.current.id = b.current, m.current.appendChild(u.current)), Ae(u.current, s);
965
- const h = Le("leaderboard", s);
966
- return f(
967
- (d) => (d == null ? void 0 : d.key) === h ? d : Ie(
968
- "leaderboard",
969
- m.current,
970
- s
971
- )
972
- ), o(!0), () => {
973
- o(!1);
974
- };
975
- }, [s]);
976
- const x = /* @__PURE__ */ n(I, { ref: g, lang: e.language || "en" }), R = t && c && u.current && C ? ke(
977
- // Keyed on the cache, not on `direction`: it must change in the same
978
- // render that adopts the new cache, or CssVarsProvider writes its CSS
979
- // variables into the outgoing cache and never repeats.
980
- /* @__PURE__ */ n(He, { value: C, children: /* @__PURE__ */ n(Me, { containerRef: g, children: /* @__PURE__ */ n(
981
- ze,
665
+ ) : /* @__PURE__ */ T("div", { css: Ye, children: [
666
+ a && /* @__PURE__ */ i(
667
+ _e,
982
668
  {
983
- customTheme: e.themeOptions,
984
- mode: (T = e.themeOptions) == null ? void 0 : T.mode,
985
- shadowRootElement: u.current,
986
- direction: s,
987
- children: /* @__PURE__ */ n(
988
- Be,
989
- {
990
- shadowRootElement: u.current,
991
- leadPhoneCountryCode: null,
992
- language: e.language,
993
- optionsLayout: null,
994
- direction: s,
995
- disableCache: e.disableCache ?? !1,
996
- children: e.children
997
- }
998
- )
669
+ options: d,
670
+ selectedId: P,
671
+ onChange: A
999
672
  }
1000
- ) }) }, C.key),
1001
- u.current
1002
- ) : null;
1003
- return /* @__PURE__ */ S(de, { children: [
1004
- x,
1005
- R
673
+ ),
674
+ /* @__PURE__ */ i(
675
+ Re,
676
+ {
677
+ leaderboard: C ? null : (f == null ? void 0 : f.leaderboard) || null,
678
+ userRank: C ? null : w,
679
+ showHeading: l && !a,
680
+ title: I,
681
+ description: (f == null ? void 0 : f.description) || null,
682
+ brandingColors: (f == null ? void 0 : f.branding) || null,
683
+ rankStyles: o
684
+ }
685
+ ),
686
+ !C && m && m.totalPages > 1 && /* @__PURE__ */ i(
687
+ Be,
688
+ {
689
+ count: m.totalPages,
690
+ page: m.currentPage,
691
+ onChange: g
692
+ }
693
+ )
1006
694
  ] });
1007
- }, tt = (e) => /* @__PURE__ */ n(et, { ...e, children: /* @__PURE__ */ n(Je, { ...e }) }), mt = De(tt);
695
+ }, Je = (e) => /* @__PURE__ */ i(
696
+ ve,
697
+ {
698
+ packageName: "leaderboard",
699
+ language: e.language,
700
+ themeOptions: e.themeOptions,
701
+ disableCache: e.disableCache,
702
+ children: /* @__PURE__ */ i(qe, { ...e })
703
+ }
704
+ ), st = Me(Je);
1008
705
  export {
1009
- mt as Leaderboard
706
+ st as Leaderboard
1010
707
  };