@pitvox/partner-react 0.7.22 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1467 -1071
- package/dist/styles.css +466 -0
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
import { jsx as n, jsxs as l, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { createContext as Qe, useMemo as T, useContext as Ye, useState as E, useEffect as $e, useCallback as H, useRef as Ze } from "react";
|
|
3
|
+
import { useQueryClient as V, QueryClient as Je, QueryClientProvider as Xe, useQuery as R, useMutation as G, useQueries as be } from "@tanstack/react-query";
|
|
4
|
+
import en from "react-markdown";
|
|
5
|
+
const oe = Qe(null), nn = "https://cdn.pitvox.com", tn = "https://pitvox.com";
|
|
6
|
+
let se = null;
|
|
7
|
+
function Zt({
|
|
7
8
|
partnerSlug: e = null,
|
|
8
|
-
cdnUrl: t =
|
|
9
|
-
pitvoxUrl: r =
|
|
9
|
+
cdnUrl: t = nn,
|
|
10
|
+
pitvoxUrl: r = tn,
|
|
10
11
|
getSteamId: s,
|
|
11
12
|
onRegister: a,
|
|
12
|
-
onWithdraw:
|
|
13
|
-
onFetchNotifications:
|
|
13
|
+
onWithdraw: o,
|
|
14
|
+
onFetchNotifications: i,
|
|
14
15
|
onMarkNotificationRead: d,
|
|
15
16
|
onMarkAllNotificationsRead: p,
|
|
16
17
|
onFetchServerPassword: c,
|
|
17
|
-
|
|
18
|
+
onEnterPromotion: u,
|
|
19
|
+
onWithdrawPromotionEntry: v,
|
|
20
|
+
children: f
|
|
18
21
|
}) {
|
|
19
|
-
const
|
|
22
|
+
const h = T(() => ({
|
|
20
23
|
partnerSlug: e,
|
|
21
24
|
cdnUrl: t.replace(/\/$/, ""),
|
|
22
25
|
pitvoxUrl: r.replace(/\/$/, ""),
|
|
23
26
|
getSteamId: s || (() => null),
|
|
24
27
|
onRegister: a || null,
|
|
25
|
-
onWithdraw:
|
|
26
|
-
onFetchNotifications:
|
|
28
|
+
onWithdraw: o || null,
|
|
29
|
+
onFetchNotifications: i || null,
|
|
27
30
|
onMarkNotificationRead: d || null,
|
|
28
31
|
onMarkAllNotificationsRead: p || null,
|
|
29
|
-
onFetchServerPassword: c || null
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
onFetchServerPassword: c || null,
|
|
33
|
+
onEnterPromotion: u || null,
|
|
34
|
+
onWithdrawPromotionEntry: v || null
|
|
35
|
+
}), [e, t, r, s, a, o, i, d, p, c, u, v]);
|
|
36
|
+
let y = !1;
|
|
32
37
|
try {
|
|
33
|
-
|
|
38
|
+
V(), y = !0;
|
|
34
39
|
} catch {
|
|
35
|
-
|
|
40
|
+
y = !1;
|
|
36
41
|
}
|
|
37
|
-
return
|
|
42
|
+
return y ? /* @__PURE__ */ n(oe.Provider, { value: h, children: f }) : (se || (se = new Je({
|
|
38
43
|
defaultOptions: {
|
|
39
44
|
queries: { staleTime: 6e4 }
|
|
40
45
|
}
|
|
41
|
-
})), /* @__PURE__ */ n(
|
|
46
|
+
})), /* @__PURE__ */ n(Xe, { client: se, children: /* @__PURE__ */ n(oe.Provider, { value: h, children: f }) }));
|
|
42
47
|
}
|
|
43
|
-
function
|
|
44
|
-
const e =
|
|
48
|
+
function S() {
|
|
49
|
+
const e = Ye(oe);
|
|
45
50
|
if (!e)
|
|
46
51
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
52
|
return e;
|
|
48
53
|
}
|
|
49
|
-
async function
|
|
54
|
+
async function M(e, t) {
|
|
50
55
|
const r = await fetch(`${e}/${t}`);
|
|
51
56
|
if (!r.ok) {
|
|
52
57
|
if (r.status === 404 || r.status === 403) return null;
|
|
@@ -54,18 +59,18 @@ async function D(e, t) {
|
|
|
54
59
|
}
|
|
55
60
|
return r.json();
|
|
56
61
|
}
|
|
57
|
-
function
|
|
62
|
+
function de(e, t, r, ...s) {
|
|
58
63
|
const a = ["leaderboards"];
|
|
59
64
|
return e && a.push(`partners/${e}`), t && a.push(t), r && a.push(`v/${r}`), [...a, ...s].join("/");
|
|
60
65
|
}
|
|
61
|
-
function
|
|
66
|
+
function rn(e, t, r, s) {
|
|
62
67
|
const a = s || "default";
|
|
63
68
|
return e ? `laps/partners/${e}/${t}/${r}/${a}.json` : `laps/${t}/${r}/${a}.json`;
|
|
64
69
|
}
|
|
65
|
-
function
|
|
70
|
+
function Te(e, t) {
|
|
66
71
|
return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
|
|
67
72
|
}
|
|
68
|
-
function
|
|
73
|
+
function sn(e) {
|
|
69
74
|
return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
|
|
70
75
|
}
|
|
71
76
|
function q(e) {
|
|
@@ -76,19 +81,19 @@ function q(e) {
|
|
|
76
81
|
function F(e) {
|
|
77
82
|
return !e && e !== 0 ? "-" : e >= 6e4 ? q(e) : (e / 1e3).toFixed(3);
|
|
78
83
|
}
|
|
79
|
-
function
|
|
84
|
+
function I(e) {
|
|
80
85
|
if (!e) return "";
|
|
81
86
|
let t = e;
|
|
82
87
|
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
|
|
83
88
|
}
|
|
84
|
-
function
|
|
89
|
+
function z(e, t, r) {
|
|
85
90
|
if (!e) return "";
|
|
86
|
-
const s = e.split("_").map((
|
|
91
|
+
const s = e.split("_").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" "), a = r === "acc" || !r && (t == null ? void 0 : t.toLowerCase()) === "track config";
|
|
87
92
|
if (!t || t === "default" || a) return s;
|
|
88
|
-
const
|
|
89
|
-
return `${s} ${
|
|
93
|
+
const o = t.split("_").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
|
|
94
|
+
return `${s} ${o}`;
|
|
90
95
|
}
|
|
91
|
-
function
|
|
96
|
+
function Q(e) {
|
|
92
97
|
if (!e) return "-";
|
|
93
98
|
try {
|
|
94
99
|
return new Date(e).toLocaleDateString("en-GB", {
|
|
@@ -100,7 +105,7 @@ function G(e) {
|
|
|
100
105
|
return "-";
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
function
|
|
108
|
+
function pe(e) {
|
|
104
109
|
if (!e) return "";
|
|
105
110
|
const t = Date.now() - new Date(e).getTime(), r = Math.floor(t / 1e3);
|
|
106
111
|
if (r < 60) return "Just now";
|
|
@@ -108,17 +113,17 @@ function oe(e) {
|
|
|
108
113
|
if (s < 60) return `${s}m ago`;
|
|
109
114
|
const a = Math.floor(s / 60);
|
|
110
115
|
if (a < 24) return `${a}h ago`;
|
|
111
|
-
const
|
|
112
|
-
return
|
|
116
|
+
const o = Math.floor(a / 24);
|
|
117
|
+
return o < 30 ? `${o}d ago` : Q(e);
|
|
113
118
|
}
|
|
114
|
-
function
|
|
119
|
+
function Jt(e) {
|
|
115
120
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
121
|
}
|
|
117
|
-
function
|
|
118
|
-
const { type: r, title: s, trackId: a, trackLayout:
|
|
122
|
+
function an(e, t) {
|
|
123
|
+
const { type: r, title: s, trackId: a, trackLayout: o, carId: i, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? z(a, o, d) : null, v = i ? I(i) : null, f = [u, v].filter(Boolean).join(" — ");
|
|
119
124
|
return r === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : r === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
|
|
120
125
|
}
|
|
121
|
-
function
|
|
126
|
+
function Re(e) {
|
|
122
127
|
return e ? {
|
|
123
128
|
E: "Eco",
|
|
124
129
|
RD: "Road",
|
|
@@ -132,119 +137,119 @@ function ke(e) {
|
|
|
132
137
|
S: "Soft"
|
|
133
138
|
}[e] || e : "Unknown";
|
|
134
139
|
}
|
|
135
|
-
function
|
|
140
|
+
function Me(e) {
|
|
136
141
|
if (!e) return "-";
|
|
137
142
|
const t = Number(e);
|
|
138
143
|
return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
|
|
139
144
|
}
|
|
140
|
-
function
|
|
145
|
+
function on(e = {}) {
|
|
141
146
|
var p, c, u, v, f, h;
|
|
142
|
-
const { cdnUrl: t, partnerSlug: r } =
|
|
147
|
+
const { cdnUrl: t, partnerSlug: r } = S(), { game: s, gameVersion: a } = e, o = de(r, null, null, "index.json"), i = R({
|
|
143
148
|
queryKey: ["pitvox", "leaderboards", r, "index"],
|
|
144
|
-
queryFn: () =>
|
|
149
|
+
queryFn: () => M(t, o),
|
|
145
150
|
staleTime: 3e4,
|
|
146
151
|
refetchInterval: 3e4
|
|
147
152
|
}), d = T(() => {
|
|
148
|
-
var
|
|
149
|
-
if (!((
|
|
150
|
-
let
|
|
151
|
-
return s && (
|
|
152
|
-
id:
|
|
153
|
-
layout:
|
|
154
|
-
game:
|
|
155
|
-
gameVersion:
|
|
156
|
-
displayName:
|
|
157
|
-
driverCount:
|
|
158
|
-
carCount:
|
|
159
|
-
record:
|
|
160
|
-
visibleId:
|
|
161
|
-
carId:
|
|
162
|
-
carDisplayName:
|
|
163
|
-
lapTimeMs:
|
|
164
|
-
timestamp:
|
|
153
|
+
var x;
|
|
154
|
+
if (!((x = i.data) != null && x.tracks)) return [];
|
|
155
|
+
let y = i.data.tracks;
|
|
156
|
+
return s && (y = y.filter((m) => m.game === s)), a && (y = y.filter((m) => m.gameVersion === a)), y.map((m) => ({
|
|
157
|
+
id: m.trackId,
|
|
158
|
+
layout: m.layout,
|
|
159
|
+
game: m.game,
|
|
160
|
+
gameVersion: m.gameVersion,
|
|
161
|
+
displayName: z(m.trackId, m.layout, m.game),
|
|
162
|
+
driverCount: m.driverCount || 0,
|
|
163
|
+
carCount: m.carCount || 0,
|
|
164
|
+
record: m.recordHolder ? {
|
|
165
|
+
visibleId: m.recordHolder.steamId || m.recordHolder.userId,
|
|
166
|
+
carId: m.recordHolder.carId,
|
|
167
|
+
carDisplayName: I(m.recordHolder.carId),
|
|
168
|
+
lapTimeMs: m.recordHolder.lapTimeMs,
|
|
169
|
+
timestamp: m.recordHolder.recordedAt
|
|
165
170
|
} : null,
|
|
166
|
-
recordByTag:
|
|
171
|
+
recordByTag: m.recordByTag || null
|
|
167
172
|
}));
|
|
168
|
-
}, [(p =
|
|
173
|
+
}, [(p = i.data) == null ? void 0 : p.tracks, s, a]);
|
|
169
174
|
return {
|
|
170
|
-
...
|
|
175
|
+
...i,
|
|
171
176
|
data: d,
|
|
172
|
-
partner: ((c =
|
|
173
|
-
generatedAt: (u =
|
|
174
|
-
totalLaps: ((v =
|
|
175
|
-
totalUsers: ((f =
|
|
176
|
-
versions: ((h =
|
|
177
|
+
partner: ((c = i.data) == null ? void 0 : c.partner) || null,
|
|
178
|
+
generatedAt: (u = i.data) == null ? void 0 : u.generatedAt,
|
|
179
|
+
totalLaps: ((v = i.data) == null ? void 0 : v.totalLaps) || 0,
|
|
180
|
+
totalUsers: ((f = i.data) == null ? void 0 : f.totalUsers) || 0,
|
|
181
|
+
versions: ((h = i.data) == null ? void 0 : h.versions) || {}
|
|
177
182
|
};
|
|
178
183
|
}
|
|
179
|
-
function
|
|
180
|
-
const { cdnUrl: s, partnerSlug: a } =
|
|
181
|
-
queryKey: ["pitvox", "leaderboards", a, "track", e, p,
|
|
182
|
-
queryFn: () =>
|
|
184
|
+
function ln(e, t, r = {}) {
|
|
185
|
+
const { cdnUrl: s, partnerSlug: a } = S(), { carId: o, game: i, gameVersion: d } = r, p = t || "default", c = de(a, i, d, `tracks/${e}/${p}.json`), { data: u, isLoading: v, error: f } = R({
|
|
186
|
+
queryKey: ["pitvox", "leaderboards", a, "track", e, p, i, d],
|
|
187
|
+
queryFn: () => M(s, c),
|
|
183
188
|
enabled: !!e,
|
|
184
189
|
staleTime: 3e4,
|
|
185
190
|
refetchInterval: 3e4
|
|
186
191
|
});
|
|
187
192
|
return { data: T(() => {
|
|
188
193
|
if (!(u != null && u.entries)) return [];
|
|
189
|
-
let
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
for (const b of
|
|
193
|
-
const
|
|
194
|
-
|
|
194
|
+
let y = u.entries;
|
|
195
|
+
if (i && (y = y.filter((x) => x.game === i)), !o) {
|
|
196
|
+
const x = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const b of y) {
|
|
198
|
+
const g = b.steamId || b.userId;
|
|
199
|
+
m.has(b.carId) || m.set(b.carId, /* @__PURE__ */ new Set()), m.get(b.carId).add(g), (!x.has(b.carId) || b.lapTimeMs < x.get(b.carId).lapTimeMs) && x.set(b.carId, b);
|
|
195
200
|
}
|
|
196
|
-
return Array.from(
|
|
197
|
-
var
|
|
198
|
-
return { ...b, driverCount: ((
|
|
199
|
-
}).sort((b,
|
|
201
|
+
return Array.from(x.values()).map((b) => {
|
|
202
|
+
var g;
|
|
203
|
+
return { ...b, driverCount: ((g = m.get(b.carId)) == null ? void 0 : g.size) || 0 };
|
|
204
|
+
}).sort((b, g) => b.lapTimeMs - g.lapTimeMs);
|
|
200
205
|
}
|
|
201
|
-
return
|
|
202
|
-
}, [u == null ? void 0 : u.entries,
|
|
203
|
-
}
|
|
204
|
-
function
|
|
205
|
-
var
|
|
206
|
-
const { cdnUrl:
|
|
207
|
-
queryKey: ["pitvox", "laps",
|
|
208
|
-
queryFn: () =>
|
|
206
|
+
return y.filter((x) => x.carId === o).sort((x, m) => x.lapTimeMs - m.lapTimeMs);
|
|
207
|
+
}, [u == null ? void 0 : u.entries, o, i]), isLoading: v, error: f };
|
|
208
|
+
}
|
|
209
|
+
function cn(e, t, r, s, a = {}) {
|
|
210
|
+
var x, m;
|
|
211
|
+
const { cdnUrl: o, partnerSlug: i } = S(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && t ? rn(i, e, t, r) : null, f = R({
|
|
212
|
+
queryKey: ["pitvox", "laps", i, e, t, r || "default"],
|
|
213
|
+
queryFn: () => M(o, u),
|
|
209
214
|
enabled: !!e && !!t,
|
|
210
215
|
staleTime: 3e4,
|
|
211
216
|
refetchInterval: 3e4
|
|
212
217
|
}), h = T(() => {
|
|
213
218
|
var b;
|
|
214
|
-
return (b = f.data) != null && b.laps ? f.data.laps.filter((
|
|
215
|
-
}, [(
|
|
219
|
+
return (b = f.data) != null && b.laps ? f.data.laps.filter((g) => !(g.carId !== s || p && g.game !== p || c && g.gameVersion !== c || !d && !g.isValid)).sort((g, k) => g.lapTimeMs - k.lapTimeMs) : [];
|
|
220
|
+
}, [(x = f.data) == null ? void 0 : x.laps, s, p, c, d]), y = T(() => {
|
|
216
221
|
const b = h.filter((N) => N.isValid && N.sector1Ms && N.sector2Ms && N.sector3Ms);
|
|
217
222
|
if (b.length < 2) return null;
|
|
218
|
-
const
|
|
219
|
-
return
|
|
223
|
+
const g = Math.min(...b.map((N) => N.sector1Ms)), k = Math.min(...b.map((N) => N.sector2Ms)), C = Math.min(...b.map((N) => N.sector3Ms)), P = g + k + C, A = Math.min(...b.map((N) => N.lapTimeMs));
|
|
224
|
+
return P >= A ? null : { lapTimeMs: P, sector1Ms: g, sector2Ms: k, sector3Ms: C };
|
|
220
225
|
}, [h]);
|
|
221
226
|
return {
|
|
222
227
|
...f,
|
|
223
228
|
data: h,
|
|
224
|
-
driverName: ((
|
|
225
|
-
theoreticalBest:
|
|
229
|
+
driverName: ((m = f.data) == null ? void 0 : m.driverName) || "Driver",
|
|
230
|
+
theoreticalBest: y
|
|
226
231
|
};
|
|
227
232
|
}
|
|
228
|
-
function
|
|
229
|
-
const { cdnUrl: e } =
|
|
233
|
+
function ue() {
|
|
234
|
+
const { cdnUrl: e } = S(), { data: t } = R({
|
|
230
235
|
queryKey: ["pitvox", "users", "index"],
|
|
231
|
-
queryFn: () =>
|
|
236
|
+
queryFn: () => M(e, "users/index.json"),
|
|
232
237
|
staleTime: 5 * 6e4,
|
|
233
238
|
gcTime: 30 * 6e4
|
|
234
239
|
}), r = (t == null ? void 0 : t.users) || {};
|
|
235
240
|
return (s, a) => {
|
|
236
|
-
const
|
|
241
|
+
const o = r[s];
|
|
237
242
|
return {
|
|
238
|
-
displayName: (
|
|
239
|
-
avatarUrl: (
|
|
240
|
-
affiliations: (
|
|
243
|
+
displayName: (o == null ? void 0 : o.displayName) || a || s || "Unknown",
|
|
244
|
+
avatarUrl: (o == null ? void 0 : o.avatarUrl) || null,
|
|
245
|
+
affiliations: (o == null ? void 0 : o.affiliations) || []
|
|
241
246
|
};
|
|
242
247
|
};
|
|
243
248
|
}
|
|
244
|
-
function
|
|
245
|
-
const { cdnUrl: t } =
|
|
249
|
+
function Xt(e = "evo") {
|
|
250
|
+
const { cdnUrl: t } = S(), { data: r } = R({
|
|
246
251
|
queryKey: ["pitvox", "cars", e],
|
|
247
|
-
queryFn: () =>
|
|
252
|
+
queryFn: () => M(t, `cars/${e}.json`),
|
|
248
253
|
staleTime: 5 * 6e4,
|
|
249
254
|
gcTime: 30 * 6e4
|
|
250
255
|
});
|
|
@@ -255,153 +260,153 @@ function $t(e = "evo") {
|
|
|
255
260
|
tagLabels: (r == null ? void 0 : r.tagLabels) || {}
|
|
256
261
|
};
|
|
257
262
|
}
|
|
258
|
-
function
|
|
259
|
-
var a,
|
|
260
|
-
const { cdnUrl: e, partnerSlug: t } =
|
|
263
|
+
function er() {
|
|
264
|
+
var a, o;
|
|
265
|
+
const { cdnUrl: e, partnerSlug: t } = S(), r = sn(t), s = R({
|
|
261
266
|
queryKey: ["pitvox", "recentLaps", t],
|
|
262
|
-
queryFn: () =>
|
|
267
|
+
queryFn: () => M(e, r),
|
|
263
268
|
staleTime: 3e4,
|
|
264
269
|
refetchInterval: 3e4,
|
|
265
270
|
gcTime: 10 * 6e4
|
|
266
271
|
});
|
|
267
272
|
return {
|
|
268
273
|
groups: ((a = s.data) == null ? void 0 : a.groups) || [],
|
|
269
|
-
generatedAt: ((
|
|
274
|
+
generatedAt: ((o = s.data) == null ? void 0 : o.generatedAt) || null,
|
|
270
275
|
isLoading: s.isLoading
|
|
271
276
|
};
|
|
272
277
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
278
|
+
function nr(e, t) {
|
|
279
|
+
return ln(e, null, { carId: t });
|
|
275
280
|
}
|
|
276
|
-
function
|
|
277
|
-
const { cdnUrl: e, partnerSlug: t } =
|
|
278
|
-
return
|
|
281
|
+
function tr() {
|
|
282
|
+
const { cdnUrl: e, partnerSlug: t } = S();
|
|
283
|
+
return R({
|
|
279
284
|
queryKey: ["pitvox", "competitions", t],
|
|
280
285
|
queryFn: async () => {
|
|
281
|
-
const r = await
|
|
286
|
+
const r = await M(e, "competitions/index.json");
|
|
282
287
|
return r != null && r.competitions ? t ? r.competitions.filter((s) => s.partnerSlug === t) : r.competitions : [];
|
|
283
288
|
},
|
|
284
289
|
staleTime: 6e4
|
|
285
290
|
});
|
|
286
291
|
}
|
|
287
|
-
function
|
|
288
|
-
const r =
|
|
289
|
-
return
|
|
292
|
+
function Pe(e, t = {}) {
|
|
293
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
294
|
+
return R({
|
|
290
295
|
queryKey: ["pitvox", "competition", s, e, "config"],
|
|
291
|
-
queryFn: () =>
|
|
296
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/config.json`),
|
|
292
297
|
enabled: !!s && !!e,
|
|
293
298
|
staleTime: 6e4
|
|
294
299
|
});
|
|
295
300
|
}
|
|
296
|
-
function
|
|
297
|
-
const r =
|
|
298
|
-
return
|
|
301
|
+
function De(e, t = {}) {
|
|
302
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
303
|
+
return R({
|
|
299
304
|
queryKey: ["pitvox", "competition", s, e, "standings"],
|
|
300
|
-
queryFn: () =>
|
|
305
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/standings.json`),
|
|
301
306
|
enabled: !!s && !!e,
|
|
302
307
|
staleTime: 6e4
|
|
303
308
|
});
|
|
304
309
|
}
|
|
305
|
-
function
|
|
306
|
-
const s =
|
|
307
|
-
return
|
|
310
|
+
function dn(e, t, r = {}) {
|
|
311
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
312
|
+
return R({
|
|
308
313
|
queryKey: ["pitvox", "competition", a, e, "round", t],
|
|
309
|
-
queryFn: () =>
|
|
314
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
|
|
310
315
|
enabled: !!a && !!e && t != null,
|
|
311
316
|
staleTime: 6e4
|
|
312
317
|
});
|
|
313
318
|
}
|
|
314
|
-
function
|
|
315
|
-
const s =
|
|
316
|
-
return
|
|
319
|
+
function pn(e, t = [], r = {}) {
|
|
320
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
321
|
+
return R({
|
|
317
322
|
queryKey: ["pitvox", "competition", a, e, "allRounds", t],
|
|
318
323
|
queryFn: async () => (await Promise.all(
|
|
319
324
|
t.map(
|
|
320
|
-
(
|
|
325
|
+
(i) => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${i}.json`).catch(() => null)
|
|
321
326
|
)
|
|
322
327
|
)).filter(Boolean),
|
|
323
328
|
enabled: !!a && !!e && t.length > 0,
|
|
324
329
|
staleTime: 6e4
|
|
325
330
|
});
|
|
326
331
|
}
|
|
327
|
-
function
|
|
328
|
-
const r =
|
|
329
|
-
return
|
|
332
|
+
function un(e, t = {}) {
|
|
333
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
334
|
+
return R({
|
|
330
335
|
queryKey: ["pitvox", "competition", s, e, "leaderboard"],
|
|
331
|
-
queryFn: () =>
|
|
336
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
|
|
332
337
|
enabled: !!s && !!e,
|
|
333
338
|
staleTime: 6e4
|
|
334
339
|
});
|
|
335
340
|
}
|
|
336
|
-
function
|
|
337
|
-
const s =
|
|
338
|
-
return
|
|
341
|
+
function hn(e, t, r = {}) {
|
|
342
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
343
|
+
return R({
|
|
339
344
|
queryKey: ["pitvox", "competition", a, e, "round", t, "leaderboard"],
|
|
340
|
-
queryFn: () =>
|
|
345
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/leaderboard.json`).catch(() => null),
|
|
341
346
|
enabled: !!a && !!e && t != null,
|
|
342
347
|
staleTime: 6e4
|
|
343
348
|
});
|
|
344
349
|
}
|
|
345
|
-
function
|
|
346
|
-
const s =
|
|
347
|
-
return
|
|
350
|
+
function mn(e, t, r = {}) {
|
|
351
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
352
|
+
return R({
|
|
348
353
|
queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
|
|
349
|
-
queryFn: () =>
|
|
354
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
|
|
350
355
|
enabled: !!a && !!e && t != null,
|
|
351
356
|
staleTime: 6e4
|
|
352
357
|
});
|
|
353
358
|
}
|
|
354
|
-
function
|
|
355
|
-
const s =
|
|
356
|
-
return
|
|
359
|
+
function vn(e, t, r = {}) {
|
|
360
|
+
const s = S(), a = r.partnerSlug || s.partnerSlug;
|
|
361
|
+
return R({
|
|
357
362
|
queryKey: ["pitvox", "competition", a, e, "round", t, "positions"],
|
|
358
|
-
queryFn: () =>
|
|
363
|
+
queryFn: () => M(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/positions.json`).catch(() => null),
|
|
359
364
|
enabled: (r.enabled ?? !0) && !!a && !!e && t != null,
|
|
360
365
|
staleTime: 6e4
|
|
361
366
|
});
|
|
362
367
|
}
|
|
363
|
-
function
|
|
364
|
-
const r =
|
|
365
|
-
return
|
|
368
|
+
function Ae(e, t = {}) {
|
|
369
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
370
|
+
return R({
|
|
366
371
|
queryKey: ["pitvox", "competition", s, e, "entrylist"],
|
|
367
|
-
queryFn: () =>
|
|
372
|
+
queryFn: () => M(r.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
|
|
368
373
|
enabled: !!s && !!e,
|
|
369
374
|
staleTime: 6e4
|
|
370
375
|
});
|
|
371
376
|
}
|
|
372
|
-
function
|
|
373
|
-
const { cdnUrl: t, partnerSlug: r, getSteamId: s } =
|
|
374
|
-
return
|
|
377
|
+
function he(e) {
|
|
378
|
+
const { cdnUrl: t, partnerSlug: r, getSteamId: s } = S(), a = s();
|
|
379
|
+
return R({
|
|
375
380
|
queryKey: ["pitvox", "registration", r, e, a],
|
|
376
381
|
queryFn: async () => {
|
|
377
382
|
var p;
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const
|
|
381
|
-
return { isRegistered: !!a && ((p =
|
|
383
|
+
const o = await fetch(`${t}/competitions/${r}/${e}/entrylist.json`);
|
|
384
|
+
if (!o.ok) return { isRegistered: !1, entryList: null };
|
|
385
|
+
const i = await o.json();
|
|
386
|
+
return { isRegistered: !!a && ((p = i.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: i };
|
|
382
387
|
},
|
|
383
388
|
enabled: !!e,
|
|
384
389
|
staleTime: 6e4
|
|
385
390
|
});
|
|
386
391
|
}
|
|
387
|
-
function
|
|
388
|
-
const { onRegister: t, partnerSlug: r, getSteamId: s } =
|
|
389
|
-
return
|
|
390
|
-
mutationFn: (
|
|
392
|
+
function Ee(e) {
|
|
393
|
+
const { onRegister: t, partnerSlug: r, getSteamId: s } = S(), a = V(), o = ue();
|
|
394
|
+
return G({
|
|
395
|
+
mutationFn: (i) => {
|
|
391
396
|
if (!t)
|
|
392
397
|
throw new Error(
|
|
393
398
|
"No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
|
|
394
399
|
);
|
|
395
|
-
return t(e,
|
|
400
|
+
return t(e, i);
|
|
396
401
|
},
|
|
397
402
|
onSuccess: () => {
|
|
398
|
-
const
|
|
403
|
+
const i = s();
|
|
399
404
|
if (a.setQueriesData(
|
|
400
405
|
{ queryKey: ["pitvox", "registration", r, e] },
|
|
401
406
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
402
|
-
),
|
|
403
|
-
const d = i
|
|
404
|
-
steamId:
|
|
407
|
+
), i) {
|
|
408
|
+
const d = o(i), p = {
|
|
409
|
+
steamId: i,
|
|
405
410
|
displayName: d.displayName,
|
|
406
411
|
avatarUrl: d.avatarUrl
|
|
407
412
|
};
|
|
@@ -409,89 +414,598 @@ function Te(e) {
|
|
|
409
414
|
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
410
415
|
(c) => {
|
|
411
416
|
var v;
|
|
412
|
-
return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId ===
|
|
417
|
+
return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId === i)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
|
|
413
418
|
}
|
|
414
419
|
);
|
|
415
420
|
}
|
|
416
421
|
}
|
|
417
422
|
});
|
|
418
423
|
}
|
|
419
|
-
function
|
|
420
|
-
const { onWithdraw: t, partnerSlug: r, getSteamId: s } =
|
|
421
|
-
return
|
|
422
|
-
mutationFn: (
|
|
424
|
+
function Be(e) {
|
|
425
|
+
const { onWithdraw: t, partnerSlug: r, getSteamId: s } = S(), a = V();
|
|
426
|
+
return G({
|
|
427
|
+
mutationFn: (o) => {
|
|
423
428
|
if (!t)
|
|
424
429
|
throw new Error(
|
|
425
430
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
426
431
|
);
|
|
427
|
-
const
|
|
428
|
-
if (!
|
|
429
|
-
return t(e,
|
|
432
|
+
const i = o || s();
|
|
433
|
+
if (!i) throw new Error("No Steam ID available");
|
|
434
|
+
return t(e, i);
|
|
430
435
|
},
|
|
431
436
|
onSuccess: () => {
|
|
432
|
-
const
|
|
437
|
+
const o = s();
|
|
433
438
|
a.setQueriesData(
|
|
434
439
|
{ queryKey: ["pitvox", "registration", r, e] },
|
|
435
|
-
(
|
|
436
|
-
),
|
|
440
|
+
(i) => i ? { ...i, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
441
|
+
), o && a.setQueriesData(
|
|
437
442
|
{ queryKey: ["pitvox", "competition", r, e, "entrylist"] },
|
|
438
|
-
(
|
|
443
|
+
(i) => i != null && i.drivers ? { ...i, drivers: i.drivers.filter((d) => d.steamId !== o) } : i
|
|
439
444
|
);
|
|
440
445
|
}
|
|
441
446
|
});
|
|
442
447
|
}
|
|
443
|
-
function
|
|
444
|
-
const { onRegister: e, onWithdraw: t } =
|
|
448
|
+
function me() {
|
|
449
|
+
const { onRegister: e, onWithdraw: t } = S(), r = !!(e && t);
|
|
445
450
|
return { isPowerMode: r, isBasicMode: !r };
|
|
446
451
|
}
|
|
447
|
-
function
|
|
448
|
-
const { pitvoxUrl: t, partnerSlug: r } =
|
|
452
|
+
function ve(e) {
|
|
453
|
+
const { pitvoxUrl: t, partnerSlug: r } = S();
|
|
449
454
|
return `${t}/p/${r}/competitions/${e}/register`;
|
|
450
455
|
}
|
|
451
|
-
function
|
|
456
|
+
function J(e, t = /* @__PURE__ */ new Date()) {
|
|
457
|
+
var r;
|
|
458
|
+
return e.winnersAnnouncedAt || (r = e.winners) != null && r.length ? "winners" : e.opensAt && t < new Date(e.opensAt) ? "upcoming" : e.closesAt && t >= new Date(e.closesAt) ? "closed" : "open";
|
|
459
|
+
}
|
|
460
|
+
const xn = {
|
|
461
|
+
upcoming: "Opens soon",
|
|
462
|
+
open: "Open",
|
|
463
|
+
closed: "Closed",
|
|
464
|
+
winners: "Winners announced"
|
|
465
|
+
};
|
|
466
|
+
function gn() {
|
|
467
|
+
const { cdnUrl: e, partnerSlug: t } = S();
|
|
468
|
+
return R({
|
|
469
|
+
queryKey: ["pitvox", "promotions", t],
|
|
470
|
+
queryFn: async () => {
|
|
471
|
+
const r = await M(e, "promotions/index.json");
|
|
472
|
+
return r != null && r.promotions ? t ? r.promotions.filter((s) => s.partnerSlug === t) : r.promotions : [];
|
|
473
|
+
},
|
|
474
|
+
staleTime: 6e4
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
function fn(e, t = {}) {
|
|
478
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
479
|
+
return R({
|
|
480
|
+
queryKey: ["pitvox", "promotion", s, e, "config"],
|
|
481
|
+
queryFn: () => M(r.cdnUrl, `promotions/${s}/${e}/config.json`),
|
|
482
|
+
enabled: !!s && !!e,
|
|
483
|
+
staleTime: 6e4
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function Nn(e, t = {}) {
|
|
487
|
+
const r = S(), s = t.partnerSlug || r.partnerSlug;
|
|
488
|
+
return R({
|
|
489
|
+
queryKey: ["pitvox", "promotion", s, e, "entrylist"],
|
|
490
|
+
queryFn: () => M(r.cdnUrl, `promotions/${s}/${e}/entrylist.json`),
|
|
491
|
+
enabled: !!s && !!e,
|
|
492
|
+
staleTime: 6e4
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
function yn(e) {
|
|
496
|
+
const { cdnUrl: t, partnerSlug: r, getSteamId: s } = S(), a = s();
|
|
497
|
+
return R({
|
|
498
|
+
queryKey: ["pitvox", "promotionEntry", r, e, a],
|
|
499
|
+
queryFn: async () => {
|
|
500
|
+
var d;
|
|
501
|
+
const o = await M(t, `promotions/${r}/${e}/entrylist.json`);
|
|
502
|
+
return o ? { isEntered: !!a && ((d = o.entrants) == null ? void 0 : d.some((p) => p.steamId === a)), entryList: o } : { isEntered: !1, entryList: null };
|
|
503
|
+
},
|
|
504
|
+
enabled: !!e,
|
|
505
|
+
staleTime: 6e4
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function bn(e) {
|
|
509
|
+
const { onEnterPromotion: t, partnerSlug: r, getSteamId: s } = S(), a = V(), o = ue();
|
|
510
|
+
return G({
|
|
511
|
+
mutationFn: (i) => {
|
|
512
|
+
if (!t)
|
|
513
|
+
throw new Error(
|
|
514
|
+
"No onEnterPromotion callback provided to PitVoxPartnerProvider. Provide onEnterPromotion for in-app entry, or use usePromotionUrl() to link to pitvox.com."
|
|
515
|
+
);
|
|
516
|
+
return t(e, i);
|
|
517
|
+
},
|
|
518
|
+
onSuccess: () => {
|
|
519
|
+
const i = s();
|
|
520
|
+
if (a.setQueriesData(
|
|
521
|
+
{ queryKey: ["pitvox", "promotionEntry", r, e] },
|
|
522
|
+
(d) => d ? { ...d, isEntered: !0 } : { isEntered: !0, entryList: null }
|
|
523
|
+
), i) {
|
|
524
|
+
const d = o(i), p = {
|
|
525
|
+
steamId: i,
|
|
526
|
+
displayName: d.displayName,
|
|
527
|
+
avatarUrl: d.avatarUrl
|
|
528
|
+
};
|
|
529
|
+
a.setQueriesData(
|
|
530
|
+
{ queryKey: ["pitvox", "promotion", r, e, "entrylist"] },
|
|
531
|
+
(c) => {
|
|
532
|
+
var f;
|
|
533
|
+
if (!c) return { entrants: [p], count: 1 };
|
|
534
|
+
if ((f = c.entrants) == null ? void 0 : f.some((h) => h.steamId === i)) return c;
|
|
535
|
+
const v = [...c.entrants || [], p];
|
|
536
|
+
return { ...c, entrants: v, count: v.length };
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
function wn(e) {
|
|
544
|
+
const { onWithdrawPromotionEntry: t, partnerSlug: r, getSteamId: s } = S(), a = V();
|
|
545
|
+
return G({
|
|
546
|
+
mutationFn: (o) => {
|
|
547
|
+
if (!t)
|
|
548
|
+
throw new Error(
|
|
549
|
+
"No onWithdrawPromotionEntry callback provided to PitVoxPartnerProvider. Provide onWithdrawPromotionEntry for in-app withdrawal, or use usePromotionUrl() to link to pitvox.com."
|
|
550
|
+
);
|
|
551
|
+
const i = o || s();
|
|
552
|
+
if (!i) throw new Error("No Steam ID available");
|
|
553
|
+
return t(e, i);
|
|
554
|
+
},
|
|
555
|
+
onSuccess: () => {
|
|
556
|
+
const o = s();
|
|
557
|
+
a.setQueriesData(
|
|
558
|
+
{ queryKey: ["pitvox", "promotionEntry", r, e] },
|
|
559
|
+
(i) => i ? { ...i, isEntered: !1 } : { isEntered: !1, entryList: null }
|
|
560
|
+
), o && a.setQueriesData(
|
|
561
|
+
{ queryKey: ["pitvox", "promotion", r, e, "entrylist"] },
|
|
562
|
+
(i) => {
|
|
563
|
+
if (!(i != null && i.entrants)) return i;
|
|
564
|
+
const d = i.entrants.filter((p) => p.steamId !== o);
|
|
565
|
+
return { ...i, entrants: d, count: d.length };
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function kn() {
|
|
572
|
+
const { onEnterPromotion: e, onWithdrawPromotionEntry: t } = S(), r = !!(e && t);
|
|
573
|
+
return { isPowerMode: r, isBasicMode: !r };
|
|
574
|
+
}
|
|
575
|
+
function Cn(e) {
|
|
576
|
+
const { pitvoxUrl: t, partnerSlug: r } = S();
|
|
577
|
+
return `${t}/p/${r}/promotions/${e}`;
|
|
578
|
+
}
|
|
579
|
+
const Sn = {
|
|
580
|
+
GBR: "🇬🇧",
|
|
581
|
+
DEU: "🇩🇪",
|
|
582
|
+
NLD: "🇳🇱",
|
|
583
|
+
SWE: "🇸🇪",
|
|
584
|
+
ESP: "🇪🇸",
|
|
585
|
+
ZAF: "🇿🇦",
|
|
586
|
+
FRA: "🇫🇷",
|
|
587
|
+
ITA: "🇮🇹",
|
|
588
|
+
USA: "🇺🇸",
|
|
589
|
+
AUS: "🇦🇺",
|
|
590
|
+
BRA: "🇧🇷",
|
|
591
|
+
JPN: "🇯🇵",
|
|
592
|
+
CAN: "🇨🇦",
|
|
593
|
+
POL: "🇵🇱",
|
|
594
|
+
AUT: "🇦🇹",
|
|
595
|
+
BEL: "🇧🇪",
|
|
596
|
+
PRT: "🇵🇹",
|
|
597
|
+
NOR: "🇳🇴",
|
|
598
|
+
DNK: "🇩🇰",
|
|
599
|
+
FIN: "🇫🇮",
|
|
600
|
+
IRL: "🇮🇪",
|
|
601
|
+
CHE: "🇨🇭",
|
|
602
|
+
NZL: "🇳🇿",
|
|
603
|
+
MEX: "🇲🇽",
|
|
604
|
+
ARG: "🇦🇷",
|
|
605
|
+
CZE: "🇨🇿",
|
|
606
|
+
HUN: "🇭🇺",
|
|
607
|
+
RUS: "🇷🇺",
|
|
608
|
+
TUR: "🇹🇷",
|
|
609
|
+
KOR: "🇰🇷"
|
|
610
|
+
}, xe = ["🥇", "🥈", "🥉"], Ln = {
|
|
611
|
+
championship: "Championship",
|
|
612
|
+
series: "Series",
|
|
613
|
+
event: "Event",
|
|
614
|
+
hotlap: "Hotlap"
|
|
615
|
+
}, $n = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
616
|
+
function we(e) {
|
|
617
|
+
const t = $n.indexOf(e);
|
|
618
|
+
if (t >= 0) return t;
|
|
619
|
+
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
620
|
+
return r ? 100 + parseInt(r[1]) : 999;
|
|
621
|
+
}
|
|
622
|
+
function X(e) {
|
|
623
|
+
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
624
|
+
return t ? `P${t[1]}` : e;
|
|
625
|
+
}
|
|
626
|
+
function ge({ position: e }) {
|
|
627
|
+
return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
|
|
628
|
+
}
|
|
629
|
+
function ee({ nation: e }) {
|
|
630
|
+
const t = e && Sn[e];
|
|
631
|
+
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
632
|
+
}
|
|
633
|
+
function Tn({ sessions: e, activeSession: t, onSelect: r }) {
|
|
634
|
+
if (!e || e.length <= 1) return null;
|
|
635
|
+
const s = [...e].sort(
|
|
636
|
+
(a, o) => we(a.type) - we(o.type)
|
|
637
|
+
);
|
|
638
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
639
|
+
"button",
|
|
640
|
+
{
|
|
641
|
+
onClick: () => r(a.type),
|
|
642
|
+
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
643
|
+
children: X(a.type)
|
|
644
|
+
},
|
|
645
|
+
a.type
|
|
646
|
+
)) });
|
|
647
|
+
}
|
|
648
|
+
function Rn({ type: e }) {
|
|
649
|
+
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: Ln[e] || e });
|
|
650
|
+
}
|
|
651
|
+
function ae({ children: e, variant: t = "default" }) {
|
|
652
|
+
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
653
|
+
}
|
|
654
|
+
function Mn(e) {
|
|
655
|
+
if (!e) return "TBD";
|
|
656
|
+
const t = new Date(e);
|
|
657
|
+
if (isNaN(t)) return "TBD";
|
|
658
|
+
const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
659
|
+
return `${r} • ${s}`;
|
|
660
|
+
}
|
|
661
|
+
function Pn(e) {
|
|
662
|
+
return e.reduce((t, r) => {
|
|
663
|
+
var s;
|
|
664
|
+
return (s = r.splits) != null && s.length ? t ? t.map((a, o) => {
|
|
665
|
+
const i = r.splits[o];
|
|
666
|
+
return i && i < a ? i : a;
|
|
667
|
+
}) : [...r.splits] : t;
|
|
668
|
+
}, null);
|
|
669
|
+
}
|
|
670
|
+
function W({ message: e = "Loading..." }) {
|
|
671
|
+
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
|
|
672
|
+
}
|
|
673
|
+
function _({ message: e = "No data available." }) {
|
|
674
|
+
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
675
|
+
}
|
|
676
|
+
const Ue = 3;
|
|
677
|
+
function O(e) {
|
|
678
|
+
if (!e) return !1;
|
|
679
|
+
if (e.closesAt) {
|
|
680
|
+
const t = new Date(e.closesAt).getTime();
|
|
681
|
+
if (!Number.isNaN(t)) return Date.now() >= t;
|
|
682
|
+
}
|
|
683
|
+
return !!e.isClosed;
|
|
684
|
+
}
|
|
685
|
+
function Dn(e) {
|
|
686
|
+
const t = e == null ? void 0 : e.rounds;
|
|
687
|
+
return t != null && t.length ? e.type === "hotlap" ? t.every((r) => O(r)) : t.every((r) => r.isFinalized) : !1;
|
|
688
|
+
}
|
|
689
|
+
function An(e) {
|
|
690
|
+
const t = e == null ? void 0 : e.rounds;
|
|
691
|
+
if (!(t != null && t.length)) return null;
|
|
692
|
+
let r = null;
|
|
693
|
+
for (const s of t) {
|
|
694
|
+
if (!s.startTime) continue;
|
|
695
|
+
const a = new Date(s.startTime);
|
|
696
|
+
isNaN(a) || (!r || a > r) && (r = a);
|
|
697
|
+
}
|
|
698
|
+
return r;
|
|
699
|
+
}
|
|
700
|
+
function _e(e, t = Ue) {
|
|
701
|
+
if (!Dn(e)) return "active";
|
|
702
|
+
const r = An(e);
|
|
703
|
+
if (!r) return "recently-completed";
|
|
704
|
+
const s = t * 24 * 60 * 60 * 1e3;
|
|
705
|
+
return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
|
|
706
|
+
}
|
|
707
|
+
function rr(e, t, r = Ue) {
|
|
708
|
+
if (!(e != null && e.length)) return [];
|
|
709
|
+
const s = new Set(Array.isArray(t) ? t : [t]);
|
|
710
|
+
return e.filter((a) => s.has(_e(a, r)));
|
|
711
|
+
}
|
|
712
|
+
function En(e, t = 3) {
|
|
713
|
+
const r = e == null ? void 0 : e.standings;
|
|
714
|
+
return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
715
|
+
}
|
|
716
|
+
const Bn = {
|
|
717
|
+
giveaway: "Giveaway"
|
|
718
|
+
};
|
|
719
|
+
function Ie({ promotion: e, status: t }) {
|
|
720
|
+
const r = t || J(e);
|
|
721
|
+
return /* @__PURE__ */ n("span", { className: `pvx-promo-status pvx-promo-status--${r}`, children: xn[r] || r });
|
|
722
|
+
}
|
|
723
|
+
function Fe({ type: e }) {
|
|
724
|
+
return /* @__PURE__ */ n("span", { className: `pvx-promo-type pvx-promo-type--${e || "giveaway"}`, children: Bn[e] || e });
|
|
725
|
+
}
|
|
726
|
+
function K(e) {
|
|
727
|
+
if (!e) return "";
|
|
728
|
+
const t = new Date(e);
|
|
729
|
+
if (isNaN(t)) return "";
|
|
730
|
+
const r = t.toLocaleDateString(void 0, { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
731
|
+
return `${r} ${s}`;
|
|
732
|
+
}
|
|
733
|
+
function Un(e, t) {
|
|
734
|
+
const r = t || J(e);
|
|
735
|
+
return r === "upcoming" ? `Entries open ${K(e.opensAt)}` : r === "open" && e.closesAt ? `Entries close ${K(e.closesAt)}` : r === "open" ? "Entries open now" : r === "closed" ? `Entries closed ${K(e.closesAt)}` : null;
|
|
736
|
+
}
|
|
737
|
+
function le({ className: e }) {
|
|
738
|
+
return /* @__PURE__ */ l(
|
|
739
|
+
"svg",
|
|
740
|
+
{
|
|
741
|
+
className: e,
|
|
742
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
743
|
+
viewBox: "0 0 24 24",
|
|
744
|
+
fill: "none",
|
|
745
|
+
stroke: "currentColor",
|
|
746
|
+
strokeWidth: "2",
|
|
747
|
+
strokeLinecap: "round",
|
|
748
|
+
strokeLinejoin: "round",
|
|
749
|
+
children: [
|
|
750
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "8", width: "18", height: "4", rx: "1" }),
|
|
751
|
+
/* @__PURE__ */ n("path", { d: "M12 8v13" }),
|
|
752
|
+
/* @__PURE__ */ n("path", { d: "M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7" }),
|
|
753
|
+
/* @__PURE__ */ n("path", { d: "M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5" })
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
function _n({ promotions: e, isLoading: t, onSelect: r, className: s }) {
|
|
759
|
+
if (t)
|
|
760
|
+
return /* @__PURE__ */ n(W, { message: "Loading promotions..." });
|
|
761
|
+
if (!(e != null && e.length))
|
|
762
|
+
return /* @__PURE__ */ n(_, { message: "No promotions running right now." });
|
|
763
|
+
const a = e.length === 1 ? "pvx-promo-grid--single" : e.length === 2 ? "pvx-promo-grid--pair" : "";
|
|
764
|
+
return /* @__PURE__ */ n("div", { className: `pvx-promo-grid ${a} ${s || ""}`, children: e.map((o) => /* @__PURE__ */ n(In, { promo: o, onSelect: r }, o.id)) });
|
|
765
|
+
}
|
|
766
|
+
function In({ promo: e, onSelect: t }) {
|
|
767
|
+
const { cdnUrl: r } = S(), s = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, a = J(e), o = Un(e, a);
|
|
768
|
+
return /* @__PURE__ */ l(
|
|
769
|
+
"div",
|
|
770
|
+
{
|
|
771
|
+
className: "pvx-promo-card",
|
|
772
|
+
role: "button",
|
|
773
|
+
tabIndex: 0,
|
|
774
|
+
onClick: () => t == null ? void 0 : t(e.id),
|
|
775
|
+
onKeyDown: (i) => {
|
|
776
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), t == null || t(e.id));
|
|
777
|
+
},
|
|
778
|
+
children: [
|
|
779
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-card-poster", children: s ? /* @__PURE__ */ n("img", { src: s, alt: e.title, className: "pvx-promo-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-card-poster-placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-gift-icon" }) }) }),
|
|
780
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-body", children: [
|
|
781
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-badges", children: [
|
|
782
|
+
/* @__PURE__ */ n(Ie, { promotion: e, status: a }),
|
|
783
|
+
/* @__PURE__ */ n(Fe, { type: e.type }),
|
|
784
|
+
e.game && /* @__PURE__ */ n("span", { className: "pvx-promo-game", children: e.game })
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ n("h3", { className: "pvx-promo-card-title", children: e.title }),
|
|
787
|
+
e.prizeDescription && /* @__PURE__ */ n("p", { className: "pvx-promo-card-prize", children: e.prizeDescription }),
|
|
788
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-meta", children: [
|
|
789
|
+
o && /* @__PURE__ */ n("span", { children: o }),
|
|
790
|
+
/* @__PURE__ */ l("span", { children: [
|
|
791
|
+
e.entryCount,
|
|
792
|
+
" ",
|
|
793
|
+
e.entryCount === 1 ? "entry" : "entries",
|
|
794
|
+
e.maxEntrants ? ` / ${e.maxEntrants}` : ""
|
|
795
|
+
] })
|
|
796
|
+
] })
|
|
797
|
+
] })
|
|
798
|
+
]
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
function Fn({
|
|
803
|
+
promotionId: e,
|
|
804
|
+
driverData: t,
|
|
805
|
+
className: r,
|
|
806
|
+
children: s
|
|
807
|
+
}) {
|
|
808
|
+
const { data: a, isLoading: o } = yn(e), { isPowerMode: i } = kn(), d = Cn(e), p = bn(e), c = wn(e), u = (a == null ? void 0 : a.isEntered) || !1, v = o || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
|
|
809
|
+
i && p.mutate(t || {});
|
|
810
|
+
}, y = () => {
|
|
811
|
+
i && c.mutate();
|
|
812
|
+
};
|
|
813
|
+
return typeof s == "function" ? s({ isEntered: u, isLoading: v, enter: h, withdraw: y, error: f, isPowerMode: i, promotionUrl: d }) : i ? /* @__PURE__ */ n(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
className: `pvx-promo-enter-btn ${r || ""}`,
|
|
817
|
+
onClick: u ? y : h,
|
|
818
|
+
disabled: v,
|
|
819
|
+
children: v ? "Loading..." : u ? "Withdraw Entry" : "Enter Giveaway"
|
|
820
|
+
}
|
|
821
|
+
) : /* @__PURE__ */ n(
|
|
822
|
+
"a",
|
|
823
|
+
{
|
|
824
|
+
href: d,
|
|
825
|
+
target: "_blank",
|
|
826
|
+
rel: "noopener noreferrer",
|
|
827
|
+
className: `pvx-promo-enter-link ${r || ""}`,
|
|
828
|
+
children: u ? "View Entry" : "Enter on PitVox"
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
function qn({ promotionId: e, driverData: t, onBack: r, className: s }) {
|
|
833
|
+
const { cdnUrl: a, getSteamId: o } = S(), { data: i, isLoading: d } = fn(e), { data: p } = Nn(e);
|
|
834
|
+
if (d)
|
|
835
|
+
return /* @__PURE__ */ n(W, { message: "Loading promotion..." });
|
|
836
|
+
if (!i)
|
|
837
|
+
return /* @__PURE__ */ n(_, { message: "Promotion not found." });
|
|
838
|
+
const c = J(i), u = i.winners || [], v = (p == null ? void 0 : p.entrants) || [], f = v.length || i.entryCount || 0, h = i.maxEntrants && f >= i.maxEntrants, y = i.posterCdnPath ? `${a}/${i.posterCdnPath}` : null, x = o();
|
|
839
|
+
return /* @__PURE__ */ l("div", { className: `pvx-promo-detail ${s || ""}`, children: [
|
|
840
|
+
r && /* @__PURE__ */ n("button", { type: "button", className: "pvx-promo-back", onClick: r, children: "← All promotions" }),
|
|
841
|
+
y && /* @__PURE__ */ n("div", { className: "pvx-promo-detail-poster", children: /* @__PURE__ */ n("img", { src: y, alt: i.title }) }),
|
|
842
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-detail-header", children: [
|
|
843
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-card-badges", children: [
|
|
844
|
+
/* @__PURE__ */ n(Ie, { promotion: i, status: c }),
|
|
845
|
+
/* @__PURE__ */ n(Fe, { type: i.type }),
|
|
846
|
+
i.game && /* @__PURE__ */ n("span", { className: "pvx-promo-game", children: i.game })
|
|
847
|
+
] }),
|
|
848
|
+
/* @__PURE__ */ n("h2", { className: "pvx-promo-detail-title", children: i.title }),
|
|
849
|
+
i.prizeDescription && /* @__PURE__ */ n("p", { className: "pvx-promo-detail-prize", children: i.prizeDescription }),
|
|
850
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-detail-meta", children: [
|
|
851
|
+
i.opensAt && c === "upcoming" && /* @__PURE__ */ l("span", { children: [
|
|
852
|
+
"Opens ",
|
|
853
|
+
K(i.opensAt)
|
|
854
|
+
] }),
|
|
855
|
+
i.closesAt && /* @__PURE__ */ l("span", { children: [
|
|
856
|
+
c === "open" || c === "upcoming" ? "Closes" : "Closed",
|
|
857
|
+
" ",
|
|
858
|
+
K(i.closesAt)
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ l("span", { children: [
|
|
861
|
+
f,
|
|
862
|
+
" ",
|
|
863
|
+
f === 1 ? "entry" : "entries",
|
|
864
|
+
i.maxEntrants ? ` / ${i.maxEntrants}` : ""
|
|
865
|
+
] })
|
|
866
|
+
] })
|
|
867
|
+
] }),
|
|
868
|
+
u.length > 0 && /* @__PURE__ */ l("div", { className: "pvx-promo-winners", children: [
|
|
869
|
+
/* @__PURE__ */ n("h3", { className: "pvx-promo-section-title", children: u.length === 1 ? "Winner" : "Winners" }),
|
|
870
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-winners-list", children: u.map((m) => /* @__PURE__ */ l("div", { className: "pvx-promo-winner", children: [
|
|
871
|
+
m.avatarUrl ? /* @__PURE__ */ n("img", { src: m.avatarUrl, alt: "", className: "pvx-promo-avatar pvx-promo-avatar--lg" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-avatar pvx-promo-avatar--lg pvx-promo-avatar--placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-avatar-glyph" }) }),
|
|
872
|
+
/* @__PURE__ */ n("span", { className: "pvx-promo-winner-name", children: m.displayName })
|
|
873
|
+
] }, m.steamId)) })
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-action", children: [
|
|
876
|
+
c === "upcoming" && /* @__PURE__ */ l("p", { className: "pvx-promo-action-note", children: [
|
|
877
|
+
"Entries aren't open yet — come back ",
|
|
878
|
+
i.opensAt ? K(i.opensAt) : "soon",
|
|
879
|
+
"."
|
|
880
|
+
] }),
|
|
881
|
+
(c === "closed" || c === "winners") && /* @__PURE__ */ l("p", { className: "pvx-promo-action-note", children: [
|
|
882
|
+
"Entries have closed.",
|
|
883
|
+
c === "closed" && " Winners will be announced here once the draw is done."
|
|
884
|
+
] }),
|
|
885
|
+
c === "open" && !x && /* @__PURE__ */ n("p", { className: "pvx-promo-action-note", children: "Sign in with Steam to enter this giveaway." }),
|
|
886
|
+
c === "open" && x && /* @__PURE__ */ n(Fn, { promotionId: e, driverData: t, children: ({ isEntered: m, isLoading: b, enter: g, withdraw: k, error: C, isPowerMode: P, promotionUrl: A }) => /* @__PURE__ */ l("div", { className: "pvx-promo-action-row", children: [
|
|
887
|
+
/* @__PURE__ */ l("div", { className: "pvx-promo-action-text", children: [
|
|
888
|
+
C && /* @__PURE__ */ n("p", { className: "pvx-promo-error", children: C.message }),
|
|
889
|
+
/* @__PURE__ */ n("p", { className: "pvx-promo-action-note", children: m ? "✓ You're in the draw." : h ? "This giveaway is full." : "One click and you're in the draw." }),
|
|
890
|
+
!m && !h && /* @__PURE__ */ n("p", { className: "pvx-promo-disclosure", children: "Entering displays your Steam name and avatar publicly; winners are announced by name." })
|
|
891
|
+
] }),
|
|
892
|
+
P ? /* @__PURE__ */ n(
|
|
893
|
+
"button",
|
|
894
|
+
{
|
|
895
|
+
type: "button",
|
|
896
|
+
className: m ? "pvx-promo-withdraw-btn" : "pvx-promo-enter-btn",
|
|
897
|
+
onClick: m ? k : g,
|
|
898
|
+
disabled: b || !m && h,
|
|
899
|
+
children: b ? "Loading..." : m ? "Withdraw Entry" : "Enter Giveaway"
|
|
900
|
+
}
|
|
901
|
+
) : /* @__PURE__ */ n(
|
|
902
|
+
"a",
|
|
903
|
+
{
|
|
904
|
+
href: A,
|
|
905
|
+
target: "_blank",
|
|
906
|
+
rel: "noopener noreferrer",
|
|
907
|
+
className: "pvx-promo-enter-link",
|
|
908
|
+
children: m ? "View Entry" : "Enter on PitVox"
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
] }) })
|
|
912
|
+
] }),
|
|
913
|
+
i.description && /* @__PURE__ */ n("div", { className: "pvx-promo-description", children: /* @__PURE__ */ n(en, { children: i.description }) }),
|
|
914
|
+
v.length > 0 && /* @__PURE__ */ l("div", { className: "pvx-promo-entrants", children: [
|
|
915
|
+
/* @__PURE__ */ l("h3", { className: "pvx-promo-section-title", children: [
|
|
916
|
+
"Entrants ",
|
|
917
|
+
/* @__PURE__ */ l("span", { className: "pvx-promo-section-count", children: [
|
|
918
|
+
"(",
|
|
919
|
+
v.length,
|
|
920
|
+
")"
|
|
921
|
+
] })
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ n("div", { className: "pvx-promo-entrants-grid", children: v.map((m) => /* @__PURE__ */ l("div", { className: "pvx-promo-entrant", children: [
|
|
924
|
+
m.avatarUrl ? /* @__PURE__ */ n("img", { src: m.avatarUrl, alt: "", className: "pvx-promo-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-promo-avatar pvx-promo-avatar--placeholder", children: /* @__PURE__ */ n(le, { className: "pvx-promo-avatar-glyph" }) }),
|
|
925
|
+
/* @__PURE__ */ n("span", { className: "pvx-promo-entrant-name", title: m.displayName, children: m.displayName })
|
|
926
|
+
] }, m.steamId)) })
|
|
927
|
+
] })
|
|
928
|
+
] });
|
|
929
|
+
}
|
|
930
|
+
const ce = "promotion";
|
|
931
|
+
function ke() {
|
|
932
|
+
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get(ce);
|
|
933
|
+
}
|
|
934
|
+
function sr({ title: e = "Promotions", driverData: t, className: r }) {
|
|
935
|
+
const { data: s = [], isLoading: a } = gn(), [o, i] = E(ke);
|
|
936
|
+
$e(() => {
|
|
937
|
+
const p = () => i(ke());
|
|
938
|
+
return window.addEventListener("popstate", p), () => window.removeEventListener("popstate", p);
|
|
939
|
+
}, []);
|
|
940
|
+
const d = H((p) => {
|
|
941
|
+
if (i(p), typeof window < "u") {
|
|
942
|
+
const c = new URL(window.location.href);
|
|
943
|
+
p ? c.searchParams.set(ce, p) : c.searchParams.delete(ce), window.history.pushState({}, "", c);
|
|
944
|
+
}
|
|
945
|
+
}, []);
|
|
946
|
+
return /* @__PURE__ */ l("div", { className: `pvx-promo-explorer ${r || ""}`, children: [
|
|
947
|
+
e && /* @__PURE__ */ n("h1", { className: "pvx-promo-explorer-title", children: e }),
|
|
948
|
+
o ? /* @__PURE__ */ n(
|
|
949
|
+
qn,
|
|
950
|
+
{
|
|
951
|
+
promotionId: o,
|
|
952
|
+
driverData: t,
|
|
953
|
+
onBack: () => d(null)
|
|
954
|
+
}
|
|
955
|
+
) : /* @__PURE__ */ n(
|
|
956
|
+
_n,
|
|
957
|
+
{
|
|
958
|
+
promotions: s,
|
|
959
|
+
isLoading: a,
|
|
960
|
+
onSelect: d
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
] });
|
|
964
|
+
}
|
|
965
|
+
function Wn(e, t) {
|
|
452
966
|
for (const r of t)
|
|
453
967
|
if (r.tags.includes(e)) return r.id;
|
|
454
968
|
return "other";
|
|
455
969
|
}
|
|
456
|
-
function
|
|
970
|
+
function qe(e, t, r = []) {
|
|
457
971
|
if (t.size === 0) return !0;
|
|
458
972
|
const s = {};
|
|
459
973
|
for (const a of t) {
|
|
460
|
-
const
|
|
461
|
-
s[
|
|
974
|
+
const o = Wn(a, r);
|
|
975
|
+
s[o] || (s[o] = []), s[o].push(a);
|
|
462
976
|
}
|
|
463
977
|
for (const a of Object.values(s))
|
|
464
|
-
if (!a.some((
|
|
978
|
+
if (!a.some((o) => e.includes(o))) return !1;
|
|
465
979
|
return !0;
|
|
466
980
|
}
|
|
467
|
-
function
|
|
468
|
-
const [r, s] = E(/* @__PURE__ */ new Set()), a = e !== void 0,
|
|
469
|
-
const c = new Set(
|
|
981
|
+
function We(e, t) {
|
|
982
|
+
const [r, s] = E(/* @__PURE__ */ new Set()), a = e !== void 0, o = a ? e : r, i = H((p) => {
|
|
983
|
+
const c = new Set(o);
|
|
470
984
|
c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) : s(c);
|
|
471
|
-
}, [
|
|
985
|
+
}, [o, a, t]), d = H(() => {
|
|
472
986
|
a && t ? t(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
|
|
473
987
|
}, [a, t]);
|
|
474
|
-
return { activeTags:
|
|
988
|
+
return { activeTags: o, toggle: i, clear: d };
|
|
475
989
|
}
|
|
476
|
-
function
|
|
477
|
-
const [t, r] = E(e), s =
|
|
990
|
+
function ne(e) {
|
|
991
|
+
const [t, r] = E(e), s = H((a) => {
|
|
478
992
|
r(
|
|
479
|
-
(
|
|
993
|
+
(o) => o.key === a ? { key: a, dir: o.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
480
994
|
);
|
|
481
995
|
}, []);
|
|
482
996
|
return [t, s];
|
|
483
997
|
}
|
|
484
|
-
function
|
|
998
|
+
function te(e, t, r) {
|
|
485
999
|
return [...e].sort((s, a) => {
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
488
|
-
if (
|
|
489
|
-
if (
|
|
490
|
-
const d = typeof
|
|
1000
|
+
const o = r(s, t.key), i = r(a, t.key);
|
|
1001
|
+
if (o == null && i == null) return 0;
|
|
1002
|
+
if (o == null) return 1;
|
|
1003
|
+
if (i == null) return -1;
|
|
1004
|
+
const d = typeof o == "string" ? o.localeCompare(i) : o - i;
|
|
491
1005
|
return t.dir === "desc" ? -d : d;
|
|
492
1006
|
});
|
|
493
1007
|
}
|
|
494
|
-
function
|
|
1008
|
+
function je(e, t = !1) {
|
|
495
1009
|
const r = t ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
|
|
496
1010
|
return r != null && r.length ? {
|
|
497
1011
|
s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
|
|
@@ -499,10 +1013,10 @@ function Ae(e, t = !1) {
|
|
|
499
1013
|
s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
|
|
500
1014
|
} : null;
|
|
501
1015
|
}
|
|
502
|
-
function
|
|
1016
|
+
function jn({ active: e, dir: t }) {
|
|
503
1017
|
return e ? t === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
|
|
504
1018
|
}
|
|
505
|
-
function
|
|
1019
|
+
function U({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
|
|
506
1020
|
return /* @__PURE__ */ n(
|
|
507
1021
|
"th",
|
|
508
1022
|
{
|
|
@@ -510,24 +1024,24 @@ function I({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
|
|
|
510
1024
|
onClick: () => s(t),
|
|
511
1025
|
children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
|
|
512
1026
|
e,
|
|
513
|
-
/* @__PURE__ */ n(
|
|
1027
|
+
/* @__PURE__ */ n(jn, { active: r.key === t, dir: r.dir })
|
|
514
1028
|
] })
|
|
515
1029
|
}
|
|
516
1030
|
);
|
|
517
1031
|
}
|
|
518
|
-
function
|
|
1032
|
+
function re({ userId: e, getUserDisplay: t }) {
|
|
519
1033
|
const { displayName: r, avatarUrl: s } = t(e);
|
|
520
1034
|
return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
|
|
521
1035
|
s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
522
1036
|
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children: r })
|
|
523
1037
|
] });
|
|
524
1038
|
}
|
|
525
|
-
function
|
|
1039
|
+
function fe({ rank: e, podium: t = !1 }) {
|
|
526
1040
|
return /* @__PURE__ */ n("span", { className: t ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
|
|
527
1041
|
}
|
|
528
|
-
function
|
|
1042
|
+
function Ve({ availableTags: e, activeTags: t, onToggle: r, onClear: s, categories: a = [], tagLabels: o = {} }) {
|
|
529
1043
|
if (!e || e.length < 2) return null;
|
|
530
|
-
const
|
|
1044
|
+
const i = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
|
|
531
1045
|
return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
|
|
532
1046
|
/* @__PURE__ */ n(
|
|
533
1047
|
"button",
|
|
@@ -537,21 +1051,21 @@ function Pe({ availableTags: e, activeTags: t, onToggle: r, onClear: s, categori
|
|
|
537
1051
|
children: "All"
|
|
538
1052
|
}
|
|
539
1053
|
),
|
|
540
|
-
|
|
1054
|
+
i.map((d, p) => /* @__PURE__ */ l("span", { className: "contents", children: [
|
|
541
1055
|
p > 0 && /* @__PURE__ */ n("span", { className: "pvx-tag-separator" }),
|
|
542
1056
|
d.tags.map((c) => /* @__PURE__ */ n(
|
|
543
1057
|
"button",
|
|
544
1058
|
{
|
|
545
1059
|
onClick: () => r(c),
|
|
546
1060
|
className: `pvx-tag ${t.has(c) ? "pvx-tag--active" : ""}`,
|
|
547
|
-
children:
|
|
1061
|
+
children: o[c] || c
|
|
548
1062
|
},
|
|
549
1063
|
c
|
|
550
1064
|
))
|
|
551
1065
|
] }, d.id))
|
|
552
1066
|
] });
|
|
553
1067
|
}
|
|
554
|
-
function
|
|
1068
|
+
function Ne({ segments: e }) {
|
|
555
1069
|
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, r) => {
|
|
556
1070
|
const s = r === e.length - 1;
|
|
557
1071
|
return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
|
|
@@ -560,70 +1074,70 @@ function ue({ segments: e }) {
|
|
|
560
1074
|
] }, t.key);
|
|
561
1075
|
}) }) });
|
|
562
1076
|
}
|
|
563
|
-
function
|
|
1077
|
+
function Y({ message: e }) {
|
|
564
1078
|
return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
|
|
565
1079
|
/* @__PURE__ */ n("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-4.5A3.375 3.375 0 0013.125 10.875h-2.25A3.375 3.375 0 007.5 14.25v4.5" }) }),
|
|
566
1080
|
/* @__PURE__ */ n("p", { children: e })
|
|
567
1081
|
] });
|
|
568
1082
|
}
|
|
569
|
-
function
|
|
1083
|
+
function Z() {
|
|
570
1084
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
|
|
571
1085
|
}
|
|
572
|
-
function
|
|
1086
|
+
function Vn() {
|
|
573
1087
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
574
1088
|
}
|
|
575
|
-
function
|
|
1089
|
+
function Kn() {
|
|
576
1090
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
577
1091
|
}
|
|
578
|
-
function
|
|
579
|
-
const [d, p] =
|
|
580
|
-
var
|
|
581
|
-
if (!((
|
|
582
|
-
const
|
|
1092
|
+
function ar({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrackSelect: a, tags: o, onTagChange: i }) {
|
|
1093
|
+
const [d, p] = ne({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: v } = We(o, i), f = T(() => {
|
|
1094
|
+
var m;
|
|
1095
|
+
if (!((m = r == null ? void 0 : r.tags) != null && m.length)) return [];
|
|
1096
|
+
const x = /* @__PURE__ */ new Set();
|
|
583
1097
|
for (const b of e || [])
|
|
584
|
-
b.recordByTag && Object.keys(b.recordByTag).forEach((
|
|
585
|
-
return r.tags.filter((b) =>
|
|
586
|
-
}, [e, r]), h = T(() => e ? c.size === 0 ? e : e.map((
|
|
587
|
-
var
|
|
588
|
-
if (!
|
|
589
|
-
let
|
|
1098
|
+
b.recordByTag && Object.keys(b.recordByTag).forEach((g) => x.add(g));
|
|
1099
|
+
return r.tags.filter((b) => x.has(b));
|
|
1100
|
+
}, [e, r]), h = T(() => e ? c.size === 0 ? e : e.map((x) => {
|
|
1101
|
+
var g, k;
|
|
1102
|
+
if (!x.recordByTag) return null;
|
|
1103
|
+
let m = null;
|
|
590
1104
|
const b = /* @__PURE__ */ new Set();
|
|
591
|
-
for (const C of Object.values(
|
|
1105
|
+
for (const C of Object.values(x.recordByTag)) {
|
|
592
1106
|
if (b.has(C.carId)) continue;
|
|
593
1107
|
b.add(C.carId);
|
|
594
|
-
const
|
|
595
|
-
|
|
1108
|
+
const P = ((k = (g = r == null ? void 0 : r.cars) == null ? void 0 : g[C.carId]) == null ? void 0 : k.tags) || [];
|
|
1109
|
+
qe(P, c, r == null ? void 0 : r.categories) && (!m || C.lapTimeMs < m.lapTimeMs) && (m = C);
|
|
596
1110
|
}
|
|
597
|
-
return
|
|
598
|
-
...
|
|
1111
|
+
return m ? {
|
|
1112
|
+
...x,
|
|
599
1113
|
record: {
|
|
600
|
-
visibleId:
|
|
601
|
-
carId:
|
|
602
|
-
carDisplayName:
|
|
603
|
-
lapTimeMs:
|
|
604
|
-
timestamp:
|
|
1114
|
+
visibleId: m.steamId || m.identifier,
|
|
1115
|
+
carId: m.carId,
|
|
1116
|
+
carDisplayName: I(m.carId),
|
|
1117
|
+
lapTimeMs: m.lapTimeMs,
|
|
1118
|
+
timestamp: m.recordedAt
|
|
605
1119
|
}
|
|
606
1120
|
} : null;
|
|
607
|
-
}).filter(Boolean) : [], [e, c, r]),
|
|
608
|
-
var b,
|
|
609
|
-
switch (
|
|
1121
|
+
}).filter(Boolean) : [], [e, c, r]), y = T(() => te(h, d, (x, m) => {
|
|
1122
|
+
var b, g;
|
|
1123
|
+
switch (m) {
|
|
610
1124
|
case "displayName":
|
|
611
|
-
return
|
|
1125
|
+
return x.displayName;
|
|
612
1126
|
case "record.lapTimeMs":
|
|
613
|
-
return (b =
|
|
1127
|
+
return (b = x.record) == null ? void 0 : b.lapTimeMs;
|
|
614
1128
|
case "driverCount":
|
|
615
|
-
return
|
|
1129
|
+
return x.driverCount || 0;
|
|
616
1130
|
case "carCount":
|
|
617
|
-
return
|
|
1131
|
+
return x.carCount || 0;
|
|
618
1132
|
case "record.timestamp":
|
|
619
1133
|
default:
|
|
620
|
-
return (
|
|
1134
|
+
return (g = x.record) != null && g.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
621
1135
|
}
|
|
622
1136
|
}), [h, d]);
|
|
623
|
-
return t ? /* @__PURE__ */ n(
|
|
1137
|
+
return t ? /* @__PURE__ */ n(Z, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
624
1138
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
625
1139
|
/* @__PURE__ */ n(
|
|
626
|
-
|
|
1140
|
+
Ve,
|
|
627
1141
|
{
|
|
628
1142
|
availableTags: f,
|
|
629
1143
|
activeTags: c,
|
|
@@ -635,69 +1149,69 @@ function Pt({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrac
|
|
|
635
1149
|
),
|
|
636
1150
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
637
1151
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
638
|
-
/* @__PURE__ */ n(
|
|
1152
|
+
/* @__PURE__ */ n(U, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
|
|
639
1153
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
640
1154
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
641
|
-
/* @__PURE__ */ n(
|
|
642
|
-
/* @__PURE__ */ n(
|
|
643
|
-
/* @__PURE__ */ n(
|
|
644
|
-
/* @__PURE__ */ n(
|
|
1155
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
|
|
1156
|
+
/* @__PURE__ */ n(U, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
|
|
1157
|
+
/* @__PURE__ */ n(U, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
|
|
1158
|
+
/* @__PURE__ */ n(U, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
|
|
645
1159
|
] }) }),
|
|
646
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
647
|
-
var
|
|
1160
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: y.map((x) => {
|
|
1161
|
+
var m, b, g;
|
|
648
1162
|
return /* @__PURE__ */ l(
|
|
649
1163
|
"tr",
|
|
650
1164
|
{
|
|
651
1165
|
className: "pvx-row pvx-row--clickable",
|
|
652
|
-
onClick: () => a(
|
|
1166
|
+
onClick: () => a(x.id, x.layout),
|
|
653
1167
|
children: [
|
|
654
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children:
|
|
655
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: (
|
|
656
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((b =
|
|
657
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children:
|
|
658
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
659
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
660
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (
|
|
1168
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
1169
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (m = x.record) != null && m.visibleId ? /* @__PURE__ */ n(re, { userId: x.record.visibleId, getUserDisplay: s }) : "-" }),
|
|
1170
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((b = x.record) == null ? void 0 : b.carDisplayName) || "-" }),
|
|
1171
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? q(x.record.lapTimeMs) : "-" }),
|
|
1172
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
1173
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
|
|
1174
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (g = x.record) != null && g.timestamp ? Q(x.record.timestamp) : "-" })
|
|
661
1175
|
]
|
|
662
1176
|
},
|
|
663
|
-
`${
|
|
1177
|
+
`${x.id}|${x.layout || ""}`
|
|
664
1178
|
);
|
|
665
1179
|
}) })
|
|
666
1180
|
] }) })
|
|
667
|
-
] }) : /* @__PURE__ */ n(
|
|
668
|
-
}
|
|
669
|
-
function
|
|
670
|
-
const [c, u] =
|
|
671
|
-
var
|
|
672
|
-
if (!e || !((
|
|
673
|
-
const
|
|
674
|
-
for (const
|
|
675
|
-
(((
|
|
676
|
-
return s.tags.filter((
|
|
677
|
-
}, [e, s]),
|
|
678
|
-
var C,
|
|
679
|
-
const
|
|
680
|
-
return
|
|
681
|
-
}) : [], [e, v, s]),
|
|
682
|
-
switch (
|
|
1181
|
+
] }) : /* @__PURE__ */ n(Y, { message: "No lap times recorded yet." });
|
|
1182
|
+
}
|
|
1183
|
+
function ir({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: o, onNavigate: i, tags: d, onTagChange: p }) {
|
|
1184
|
+
const [c, u] = ne({ key: "lapTimeMs", dir: "asc" }), { activeTags: v, toggle: f, clear: h } = We(d, p), y = T(() => {
|
|
1185
|
+
var k, C, P;
|
|
1186
|
+
if (!e || !((k = s == null ? void 0 : s.tags) != null && k.length)) return [];
|
|
1187
|
+
const g = /* @__PURE__ */ new Set();
|
|
1188
|
+
for (const A of e)
|
|
1189
|
+
(((P = (C = s.cars) == null ? void 0 : C[A.carId]) == null ? void 0 : P.tags) || []).forEach((L) => g.add(L));
|
|
1190
|
+
return s.tags.filter((A) => g.has(A));
|
|
1191
|
+
}, [e, s]), x = T(() => e ? v.size === 0 ? e : e.filter((g) => {
|
|
1192
|
+
var C, P;
|
|
1193
|
+
const k = ((P = (C = s == null ? void 0 : s.cars) == null ? void 0 : C[g.carId]) == null ? void 0 : P.tags) || [];
|
|
1194
|
+
return qe(k, v, s == null ? void 0 : s.categories);
|
|
1195
|
+
}) : [], [e, v, s]), m = T(() => te(x, c, (g, k) => {
|
|
1196
|
+
switch (k) {
|
|
683
1197
|
case "carId":
|
|
684
|
-
return
|
|
1198
|
+
return I(g.carId);
|
|
685
1199
|
case "driverCount":
|
|
686
|
-
return
|
|
1200
|
+
return g.driverCount || 0;
|
|
687
1201
|
case "lapTimeMs":
|
|
688
1202
|
default:
|
|
689
|
-
return
|
|
1203
|
+
return g.lapTimeMs;
|
|
690
1204
|
}
|
|
691
|
-
}), [
|
|
692
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
1205
|
+
}), [x, c]), b = [
|
|
1206
|
+
{ key: "tracks", label: "Tracks", onClick: () => i("tracks") },
|
|
693
1207
|
{ key: "track", label: r.displayName }
|
|
694
1208
|
];
|
|
695
|
-
return t ? /* @__PURE__ */ n(
|
|
696
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
1209
|
+
return t ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1210
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(Ne, { segments: b }) }),
|
|
697
1211
|
/* @__PURE__ */ n(
|
|
698
|
-
|
|
1212
|
+
Ve,
|
|
699
1213
|
{
|
|
700
|
-
availableTags:
|
|
1214
|
+
availableTags: y,
|
|
701
1215
|
activeTags: v,
|
|
702
1216
|
onToggle: f,
|
|
703
1217
|
onClear: h,
|
|
@@ -708,34 +1222,34 @@ function Bt({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay
|
|
|
708
1222
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
709
1223
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
710
1224
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
711
|
-
/* @__PURE__ */ n(
|
|
1225
|
+
/* @__PURE__ */ n(U, { label: "Car", sortKey: "carId", config: c, onSort: u }),
|
|
712
1226
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
713
|
-
/* @__PURE__ */ n(
|
|
714
|
-
/* @__PURE__ */ n(
|
|
1227
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
|
|
1228
|
+
/* @__PURE__ */ n(U, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
|
|
715
1229
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
716
1230
|
] }) }),
|
|
717
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1231
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: m.map((g, k) => /* @__PURE__ */ l(
|
|
718
1232
|
"tr",
|
|
719
1233
|
{
|
|
720
1234
|
className: "pvx-row pvx-row--clickable",
|
|
721
|
-
onClick: () =>
|
|
1235
|
+
onClick: () => o(g.carId),
|
|
722
1236
|
children: [
|
|
723
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
724
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children:
|
|
725
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
726
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(
|
|
727
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
728
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children:
|
|
1237
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: k + 1, podium: !0 }) }),
|
|
1238
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: I(g.carId) }),
|
|
1239
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(re, { userId: g.steamId || g.userId, getUserDisplay: a }) }),
|
|
1240
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(g.lapTimeMs) }),
|
|
1241
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: g.driverCount || "-" }),
|
|
1242
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: g.recordedAt ? Q(g.recordedAt) : "-" })
|
|
729
1243
|
]
|
|
730
1244
|
},
|
|
731
|
-
|
|
1245
|
+
g.carId
|
|
732
1246
|
)) })
|
|
733
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1247
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: "No lap times for this track yet." })
|
|
734
1248
|
] });
|
|
735
1249
|
}
|
|
736
|
-
function
|
|
737
|
-
const [p, c] =
|
|
738
|
-
switch (
|
|
1250
|
+
function or({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, onDriverSelect: o, onNavigate: i, highlightId: d }) {
|
|
1251
|
+
const [p, c] = ne({ key: "lapTimeMs", dir: "asc" }), u = T(() => je(e), [e]), v = T(() => te(e || [], p, (h, y) => {
|
|
1252
|
+
switch (y) {
|
|
739
1253
|
case "userId":
|
|
740
1254
|
return a(h.steamId || h.userId).displayName;
|
|
741
1255
|
case "lapCount":
|
|
@@ -745,73 +1259,73 @@ function It({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, o
|
|
|
745
1259
|
return h.lapTimeMs;
|
|
746
1260
|
}
|
|
747
1261
|
}), [e, p, a]), f = [
|
|
748
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
749
|
-
{ key: "track", label: r.displayName, onClick: () =>
|
|
750
|
-
{ key: "car", label:
|
|
1262
|
+
{ key: "tracks", label: "Tracks", onClick: () => i("tracks") },
|
|
1263
|
+
{ key: "track", label: r.displayName, onClick: () => i("track") },
|
|
1264
|
+
{ key: "car", label: I(s) }
|
|
751
1265
|
];
|
|
752
|
-
return t ? /* @__PURE__ */ n(
|
|
753
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
1266
|
+
return t ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1267
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(Ne, { segments: f }) }),
|
|
754
1268
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
755
1269
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
756
1270
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
757
|
-
/* @__PURE__ */ n(
|
|
758
|
-
/* @__PURE__ */ n(
|
|
1271
|
+
/* @__PURE__ */ n(U, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
|
|
1272
|
+
/* @__PURE__ */ n(U, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
|
|
759
1273
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
760
1274
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
761
1275
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
762
1276
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
763
1277
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
764
|
-
/* @__PURE__ */ n(
|
|
1278
|
+
/* @__PURE__ */ n(U, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
|
|
765
1279
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
766
1280
|
] }) }),
|
|
767
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h,
|
|
768
|
-
const
|
|
1281
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h, y) => {
|
|
1282
|
+
const x = y + 1, m = h.steamId || h.userId, b = u && h.sector1Ms === u.s1, g = u && h.sector2Ms === u.s2, k = u && h.sector3Ms === u.s3;
|
|
769
1283
|
return /* @__PURE__ */ l(
|
|
770
1284
|
"tr",
|
|
771
1285
|
{
|
|
772
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
773
|
-
onClick: () =>
|
|
1286
|
+
className: `pvx-row pvx-row--clickable ${d && m === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
1287
|
+
onClick: () => o(m),
|
|
774
1288
|
children: [
|
|
775
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
776
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(
|
|
1289
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: x, podium: !0 }) }),
|
|
1290
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(re, { userId: m, getUserDisplay: a }) }),
|
|
777
1291
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(h.lapTimeMs) }),
|
|
778
1292
|
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${b ? "pvx-td--best-sector" : ""}`, children: F(h.sector1Ms) }),
|
|
779
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
780
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
781
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
782
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children:
|
|
1293
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${g ? "pvx-td--best-sector" : ""}`, children: F(h.sector2Ms) }),
|
|
1294
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: F(h.sector3Ms) }),
|
|
1295
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: Re(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
1296
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: Me(h.startingFuelL) }),
|
|
783
1297
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.lapCount || "-" }),
|
|
784
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ?
|
|
1298
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ? Q(h.recordedAt) : "-" })
|
|
785
1299
|
]
|
|
786
1300
|
},
|
|
787
|
-
|
|
1301
|
+
m
|
|
788
1302
|
);
|
|
789
1303
|
}) })
|
|
790
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1304
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: "No lap times for this car yet." })
|
|
791
1305
|
] });
|
|
792
1306
|
}
|
|
793
|
-
function
|
|
794
|
-
const { data: c, driverName: u, theoreticalBest: v, isLoading: f } =
|
|
795
|
-
const
|
|
796
|
-
return
|
|
1307
|
+
function lr({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvalid: o, getUserDisplay: i, onToggleInvalid: d, onNavigate: p }) {
|
|
1308
|
+
const { data: c, driverName: u, theoreticalBest: v, isLoading: f } = cn(e, t.id, t.layout, r, { showInvalid: o, game: s, gameVersion: a }), { displayName: h, avatarUrl: y } = i(e, u), x = T(() => je(c, !0), [c]), m = T(() => {
|
|
1309
|
+
const g = (c == null ? void 0 : c.filter((k) => k.isValid)) || [];
|
|
1310
|
+
return g.length ? Math.min(...g.map((k) => k.lapTimeMs)) : null;
|
|
797
1311
|
}, [c]), b = [
|
|
798
1312
|
{ key: "tracks", label: "Tracks", onClick: () => p("tracks") },
|
|
799
1313
|
{ key: "track", label: t.displayName, onClick: () => p("track") },
|
|
800
|
-
{ key: "car", label:
|
|
1314
|
+
{ key: "car", label: I(r), onClick: () => p("car") },
|
|
801
1315
|
{ key: "driver", label: h }
|
|
802
1316
|
];
|
|
803
|
-
return f ? /* @__PURE__ */ n(
|
|
1317
|
+
return f ? /* @__PURE__ */ n(Z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
804
1318
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
805
1319
|
/* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
806
|
-
/* @__PURE__ */ n(
|
|
807
|
-
|
|
1320
|
+
/* @__PURE__ */ n(Ne, { segments: b }),
|
|
1321
|
+
y ? /* @__PURE__ */ n("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
808
1322
|
] }),
|
|
809
1323
|
/* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
|
|
810
1324
|
/* @__PURE__ */ n(
|
|
811
1325
|
"input",
|
|
812
1326
|
{
|
|
813
1327
|
type: "checkbox",
|
|
814
|
-
checked:
|
|
1328
|
+
checked: o,
|
|
815
1329
|
onChange: d,
|
|
816
1330
|
className: "pvx-checkbox"
|
|
817
1331
|
}
|
|
@@ -845,27 +1359,27 @@ function Et({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvali
|
|
|
845
1359
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
846
1360
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
847
1361
|
] }) }),
|
|
848
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((
|
|
849
|
-
const C =
|
|
850
|
-
let
|
|
851
|
-
return
|
|
852
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children:
|
|
853
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children:
|
|
854
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(
|
|
855
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
856
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
857
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: F(
|
|
858
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", title:
|
|
859
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
860
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
861
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children:
|
|
862
|
-
] },
|
|
1362
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((g, k) => {
|
|
1363
|
+
const C = g.isValid && g.lapTimeMs === m, P = x && g.isValid && g.sector1Ms === x.s1, A = x && g.isValid && g.sector2Ms === x.s2, N = x && g.isValid && g.sector3Ms === x.s3;
|
|
1364
|
+
let L = "pvx-row";
|
|
1365
|
+
return g.isValid || (L += " pvx-row--invalid"), C && (L += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: L, children: [
|
|
1366
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: k + 1 }) }),
|
|
1367
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: g.lapNumber || "-" }),
|
|
1368
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(g.lapTimeMs) }),
|
|
1369
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${P ? "pvx-td--best-sector" : ""}`, children: F(g.sector1Ms) }),
|
|
1370
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${A ? "pvx-td--best-sector" : ""}`, children: F(g.sector2Ms) }),
|
|
1371
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: F(g.sector3Ms) }),
|
|
1372
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", title: g.isValid ? void 0 : g.invalidReason || "Invalid", children: g.isValid ? /* @__PURE__ */ n(Vn, {}) : /* @__PURE__ */ n(Kn, {}) }),
|
|
1373
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: Re(g.tyreCompound), children: g.tyreCompound || "-" }),
|
|
1374
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: Me(g.startingFuelL) }),
|
|
1375
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: Q(g.timestamp) })
|
|
1376
|
+
] }, g.id);
|
|
863
1377
|
}) })
|
|
864
|
-
] }) }) : /* @__PURE__ */ n(
|
|
1378
|
+
] }) }) : /* @__PURE__ */ n(Y, { message: o ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
865
1379
|
] });
|
|
866
1380
|
}
|
|
867
|
-
function
|
|
868
|
-
const [
|
|
1381
|
+
function cr({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion: a, onComboSelect: o }) {
|
|
1382
|
+
const [i, d] = ne({ key: "rank", dir: "asc" }), [p, c] = E(null), u = T(() => e ? te(e, i, (f, h) => {
|
|
869
1383
|
switch (h) {
|
|
870
1384
|
case "rating":
|
|
871
1385
|
return f.rating;
|
|
@@ -877,10 +1391,10 @@ function _t({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion:
|
|
|
877
1391
|
default:
|
|
878
1392
|
return f.rank;
|
|
879
1393
|
}
|
|
880
|
-
}) : [], [e,
|
|
881
|
-
if (t) return /* @__PURE__ */ n(
|
|
1394
|
+
}) : [], [e, i]);
|
|
1395
|
+
if (t) return /* @__PURE__ */ n(Z, {});
|
|
882
1396
|
if (!(e != null && e.length))
|
|
883
|
-
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(
|
|
1397
|
+
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(Y, { message: "Not enough data for rankings yet." }) });
|
|
884
1398
|
const v = 5;
|
|
885
1399
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
886
1400
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
@@ -900,16 +1414,16 @@ function _t({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion:
|
|
|
900
1414
|
] }),
|
|
901
1415
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
902
1416
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
903
|
-
/* @__PURE__ */ n(
|
|
1417
|
+
/* @__PURE__ */ n(U, { label: "#", sortKey: "rank", config: i, onSort: d, className: "pvx-th--narrow" }),
|
|
904
1418
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
905
|
-
/* @__PURE__ */ n(
|
|
906
|
-
/* @__PURE__ */ n(
|
|
907
|
-
/* @__PURE__ */ n(
|
|
1419
|
+
/* @__PURE__ */ n(U, { label: "Rating", sortKey: "rating", config: i, onSort: d }),
|
|
1420
|
+
/* @__PURE__ */ n(U, { label: "Cars", sortKey: "distinctCars", config: i, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
1421
|
+
/* @__PURE__ */ n(U, { label: "Combos", sortKey: "comboCount", config: i, onSort: d, className: "pvx-hidden-below-sm" })
|
|
908
1422
|
] }) }),
|
|
909
1423
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
|
|
910
1424
|
const h = p === f.identifier;
|
|
911
1425
|
return /* @__PURE__ */ n(
|
|
912
|
-
|
|
1426
|
+
Hn,
|
|
913
1427
|
{
|
|
914
1428
|
driver: f,
|
|
915
1429
|
getUserDisplay: r,
|
|
@@ -918,7 +1432,7 @@ function _t({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion:
|
|
|
918
1432
|
colCount: v,
|
|
919
1433
|
game: s,
|
|
920
1434
|
gameVersion: a,
|
|
921
|
-
onComboSelect:
|
|
1435
|
+
onComboSelect: o
|
|
922
1436
|
},
|
|
923
1437
|
f.identifier
|
|
924
1438
|
);
|
|
@@ -926,7 +1440,7 @@ function _t({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion:
|
|
|
926
1440
|
] }) })
|
|
927
1441
|
] });
|
|
928
1442
|
}
|
|
929
|
-
function
|
|
1443
|
+
function Hn({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount: a, game: o, gameVersion: i, onComboSelect: d }) {
|
|
930
1444
|
const p = e.identifier;
|
|
931
1445
|
return /* @__PURE__ */ l(B, { children: [
|
|
932
1446
|
/* @__PURE__ */ l(
|
|
@@ -935,8 +1449,8 @@ function un({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount
|
|
|
935
1449
|
className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
936
1450
|
onClick: s,
|
|
937
1451
|
children: [
|
|
938
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
939
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(
|
|
1452
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(fe, { rank: e.rank, podium: !0 }) }),
|
|
1453
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(re, { userId: p, getUserDisplay: t }) }),
|
|
940
1454
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
|
|
941
1455
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
942
1456
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
|
|
@@ -947,7 +1461,7 @@ function un({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount
|
|
|
947
1461
|
}
|
|
948
1462
|
),
|
|
949
1463
|
r && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
|
|
950
|
-
const v = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: v, car: c.carId, highlight: p, game:
|
|
1464
|
+
const v = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: v, car: c.carId, highlight: p, game: o, gameVersion: i }) : void 0;
|
|
951
1465
|
return /* @__PURE__ */ l(
|
|
952
1466
|
"div",
|
|
953
1467
|
{
|
|
@@ -956,8 +1470,8 @@ function un({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount
|
|
|
956
1470
|
role: f ? "button" : void 0,
|
|
957
1471
|
children: [
|
|
958
1472
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
|
|
959
|
-
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children:
|
|
960
|
-
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children:
|
|
1473
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: z(c.trackId, c.layout, o) }),
|
|
1474
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
|
|
961
1475
|
] }),
|
|
962
1476
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
|
|
963
1477
|
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-time", children: q(c.lapTimeMs) }),
|
|
@@ -980,155 +1494,18 @@ function un({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount
|
|
|
980
1494
|
}) }) }) })
|
|
981
1495
|
] });
|
|
982
1496
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
DEU: "🇩🇪",
|
|
986
|
-
NLD: "🇳🇱",
|
|
987
|
-
SWE: "🇸🇪",
|
|
988
|
-
ESP: "🇪🇸",
|
|
989
|
-
ZAF: "🇿🇦",
|
|
990
|
-
FRA: "🇫🇷",
|
|
991
|
-
ITA: "🇮🇹",
|
|
992
|
-
USA: "🇺🇸",
|
|
993
|
-
AUS: "🇦🇺",
|
|
994
|
-
BRA: "🇧🇷",
|
|
995
|
-
JPN: "🇯🇵",
|
|
996
|
-
CAN: "🇨🇦",
|
|
997
|
-
POL: "🇵🇱",
|
|
998
|
-
AUT: "🇦🇹",
|
|
999
|
-
BEL: "🇧🇪",
|
|
1000
|
-
PRT: "🇵🇹",
|
|
1001
|
-
NOR: "🇳🇴",
|
|
1002
|
-
DNK: "🇩🇰",
|
|
1003
|
-
FIN: "🇫🇮",
|
|
1004
|
-
IRL: "🇮🇪",
|
|
1005
|
-
CHE: "🇨🇭",
|
|
1006
|
-
NZL: "🇳🇿",
|
|
1007
|
-
MEX: "🇲🇽",
|
|
1008
|
-
ARG: "🇦🇷",
|
|
1009
|
-
CZE: "🇨🇿",
|
|
1010
|
-
HUN: "🇭🇺",
|
|
1011
|
-
RUS: "🇷🇺",
|
|
1012
|
-
TUR: "🇹🇷",
|
|
1013
|
-
KOR: "🇰🇷"
|
|
1014
|
-
}, he = ["🥇", "🥈", "🥉"], mn = {
|
|
1015
|
-
championship: "Championship",
|
|
1016
|
-
series: "Series",
|
|
1017
|
-
event: "Event",
|
|
1018
|
-
hotlap: "Hotlap"
|
|
1019
|
-
}, vn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1020
|
-
function ge(e) {
|
|
1021
|
-
const t = vn.indexOf(e);
|
|
1022
|
-
if (t >= 0) return t;
|
|
1023
|
-
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
1024
|
-
return r ? 100 + parseInt(r[1]) : 999;
|
|
1025
|
-
}
|
|
1026
|
-
function ee(e) {
|
|
1027
|
-
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1028
|
-
return t ? `P${t[1]}` : e;
|
|
1029
|
-
}
|
|
1030
|
-
function me({ position: e }) {
|
|
1031
|
-
return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
|
|
1032
|
-
}
|
|
1033
|
-
function ne({ nation: e }) {
|
|
1034
|
-
const t = e && hn[e];
|
|
1035
|
-
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
1036
|
-
}
|
|
1037
|
-
function xn({ sessions: e, activeSession: t, onSelect: r }) {
|
|
1038
|
-
if (!e || e.length <= 1) return null;
|
|
1039
|
-
const s = [...e].sort(
|
|
1040
|
-
(a, i) => ge(a.type) - ge(i.type)
|
|
1041
|
-
);
|
|
1042
|
-
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
|
|
1043
|
-
"button",
|
|
1044
|
-
{
|
|
1045
|
-
onClick: () => r(a.type),
|
|
1046
|
-
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1047
|
-
children: ee(a.type)
|
|
1048
|
-
},
|
|
1049
|
-
a.type
|
|
1050
|
-
)) });
|
|
1051
|
-
}
|
|
1052
|
-
function gn({ type: e }) {
|
|
1053
|
-
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: mn[e] || e });
|
|
1054
|
-
}
|
|
1055
|
-
function re({ children: e, variant: t = "default" }) {
|
|
1056
|
-
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1057
|
-
}
|
|
1058
|
-
function fn(e) {
|
|
1059
|
-
if (!e) return "TBD";
|
|
1060
|
-
const t = new Date(e);
|
|
1061
|
-
if (isNaN(t)) return "TBD";
|
|
1062
|
-
const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1063
|
-
return `${r} • ${s}`;
|
|
1064
|
-
}
|
|
1065
|
-
function Nn(e) {
|
|
1066
|
-
return e.reduce((t, r) => {
|
|
1067
|
-
var s;
|
|
1068
|
-
return (s = r.splits) != null && s.length ? t ? t.map((a, i) => {
|
|
1069
|
-
const o = r.splits[i];
|
|
1070
|
-
return o && o < a ? o : a;
|
|
1071
|
-
}) : [...r.splits] : t;
|
|
1072
|
-
}, null);
|
|
1073
|
-
}
|
|
1074
|
-
function W({ message: e = "Loading..." }) {
|
|
1075
|
-
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
|
|
1076
|
-
}
|
|
1077
|
-
function U({ message: e = "No data available." }) {
|
|
1078
|
-
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1079
|
-
}
|
|
1080
|
-
const Be = 3;
|
|
1081
|
-
function j(e) {
|
|
1082
|
-
if (!e) return !1;
|
|
1083
|
-
if (e.closesAt) {
|
|
1084
|
-
const t = new Date(e.closesAt).getTime();
|
|
1085
|
-
if (!Number.isNaN(t)) return Date.now() >= t;
|
|
1086
|
-
}
|
|
1087
|
-
return !!e.isClosed;
|
|
1088
|
-
}
|
|
1089
|
-
function bn(e) {
|
|
1090
|
-
const t = e == null ? void 0 : e.rounds;
|
|
1091
|
-
return t != null && t.length ? e.type === "hotlap" ? t.every((r) => j(r)) : t.every((r) => r.isFinalized) : !1;
|
|
1092
|
-
}
|
|
1093
|
-
function yn(e) {
|
|
1094
|
-
const t = e == null ? void 0 : e.rounds;
|
|
1095
|
-
if (!(t != null && t.length)) return null;
|
|
1096
|
-
let r = null;
|
|
1097
|
-
for (const s of t) {
|
|
1098
|
-
if (!s.startTime) continue;
|
|
1099
|
-
const a = new Date(s.startTime);
|
|
1100
|
-
isNaN(a) || (!r || a > r) && (r = a);
|
|
1101
|
-
}
|
|
1102
|
-
return r;
|
|
1103
|
-
}
|
|
1104
|
-
function Ie(e, t = Be) {
|
|
1105
|
-
if (!bn(e)) return "active";
|
|
1106
|
-
const r = yn(e);
|
|
1107
|
-
if (!r) return "recently-completed";
|
|
1108
|
-
const s = t * 24 * 60 * 60 * 1e3;
|
|
1109
|
-
return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
|
|
1110
|
-
}
|
|
1111
|
-
function Ut(e, t, r = Be) {
|
|
1112
|
-
if (!(e != null && e.length)) return [];
|
|
1113
|
-
const s = new Set(Array.isArray(t) ? t : [t]);
|
|
1114
|
-
return e.filter((a) => s.has(Ie(a, r)));
|
|
1115
|
-
}
|
|
1116
|
-
function kn(e, t = 3) {
|
|
1117
|
-
const r = e == null ? void 0 : e.standings;
|
|
1118
|
-
return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1119
|
-
}
|
|
1120
|
-
function wn({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
|
|
1121
|
-
const { data: a } = Le(e), i = kn(a, t);
|
|
1497
|
+
function On({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
|
|
1498
|
+
const { data: a } = De(e), o = En(a, t);
|
|
1122
1499
|
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
|
|
1123
1500
|
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
|
|
1124
|
-
|
|
1125
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children:
|
|
1126
|
-
/* @__PURE__ */ n(
|
|
1127
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children:
|
|
1128
|
-
] },
|
|
1501
|
+
o.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: o.map((i, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1502
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: xe[d] || "" }),
|
|
1503
|
+
/* @__PURE__ */ n(ee, { nation: i.nation }),
|
|
1504
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: i.driverName })
|
|
1505
|
+
] }, i.driverId || d)) })
|
|
1129
1506
|
] });
|
|
1130
1507
|
}
|
|
1131
|
-
const
|
|
1508
|
+
const Gn = {
|
|
1132
1509
|
GameModeSelectionWeatherType_CLEAR: "Clear",
|
|
1133
1510
|
GameModeSelectionWeatherType_SCATTERED_CLOUDS: "Scattered Clouds",
|
|
1134
1511
|
GameModeSelectionWeatherType_BROKEN_CLOUDS: "Broken Clouds",
|
|
@@ -1137,7 +1514,7 @@ const Cn = {
|
|
|
1137
1514
|
GameModeSelectionWeatherType_DAMP: "Damp",
|
|
1138
1515
|
GameModeSelectionWeatherType_RAIN: "Rain",
|
|
1139
1516
|
GameModeSelectionWeatherType_HEAVY_RAIN: "Heavy Rain"
|
|
1140
|
-
},
|
|
1517
|
+
}, zn = {
|
|
1141
1518
|
viewBox: "0 0 24 24",
|
|
1142
1519
|
fill: "none",
|
|
1143
1520
|
stroke: "currentColor",
|
|
@@ -1145,7 +1522,7 @@ const Cn = {
|
|
|
1145
1522
|
strokeLinecap: "round",
|
|
1146
1523
|
strokeLinejoin: "round"
|
|
1147
1524
|
};
|
|
1148
|
-
function
|
|
1525
|
+
function Qn() {
|
|
1149
1526
|
return /* @__PURE__ */ l(B, { children: [
|
|
1150
1527
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
|
|
1151
1528
|
/* @__PURE__ */ n("path", { d: "M12 2v2" }),
|
|
@@ -1158,7 +1535,7 @@ function Ln() {
|
|
|
1158
1535
|
/* @__PURE__ */ n("path", { d: "m19.07 4.93-1.41 1.41" })
|
|
1159
1536
|
] });
|
|
1160
1537
|
}
|
|
1161
|
-
function
|
|
1538
|
+
function Yn() {
|
|
1162
1539
|
return /* @__PURE__ */ l(B, { children: [
|
|
1163
1540
|
/* @__PURE__ */ n("path", { d: "M12 2v2" }),
|
|
1164
1541
|
/* @__PURE__ */ n("path", { d: "m4.93 4.93 1.41 1.41" }),
|
|
@@ -1168,16 +1545,16 @@ function Rn() {
|
|
|
1168
1545
|
/* @__PURE__ */ n("path", { d: "M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z" })
|
|
1169
1546
|
] });
|
|
1170
1547
|
}
|
|
1171
|
-
function
|
|
1548
|
+
function Zn() {
|
|
1172
1549
|
return /* @__PURE__ */ l(B, { children: [
|
|
1173
1550
|
/* @__PURE__ */ n("path", { d: "M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" }),
|
|
1174
1551
|
/* @__PURE__ */ n("path", { d: "M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5" })
|
|
1175
1552
|
] });
|
|
1176
1553
|
}
|
|
1177
|
-
function
|
|
1554
|
+
function Jn() {
|
|
1178
1555
|
return /* @__PURE__ */ n("path", { d: "M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" });
|
|
1179
1556
|
}
|
|
1180
|
-
function
|
|
1557
|
+
function Xn() {
|
|
1181
1558
|
return /* @__PURE__ */ l(B, { children: [
|
|
1182
1559
|
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1183
1560
|
/* @__PURE__ */ n("path", { d: "M8 19v1" }),
|
|
@@ -1188,14 +1565,14 @@ function Mn() {
|
|
|
1188
1565
|
/* @__PURE__ */ n("path", { d: "M12 16v1" })
|
|
1189
1566
|
] });
|
|
1190
1567
|
}
|
|
1191
|
-
function
|
|
1568
|
+
function et() {
|
|
1192
1569
|
return /* @__PURE__ */ l(B, { children: [
|
|
1193
1570
|
/* @__PURE__ */ n("path", { d: "M16 17H7" }),
|
|
1194
1571
|
/* @__PURE__ */ n("path", { d: "M17 21H9" }),
|
|
1195
1572
|
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" })
|
|
1196
1573
|
] });
|
|
1197
1574
|
}
|
|
1198
|
-
function
|
|
1575
|
+
function nt() {
|
|
1199
1576
|
return /* @__PURE__ */ l(B, { children: [
|
|
1200
1577
|
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1201
1578
|
/* @__PURE__ */ n("path", { d: "M16 14v6" }),
|
|
@@ -1203,7 +1580,7 @@ function An() {
|
|
|
1203
1580
|
/* @__PURE__ */ n("path", { d: "M12 16v6" })
|
|
1204
1581
|
] });
|
|
1205
1582
|
}
|
|
1206
|
-
function
|
|
1583
|
+
function tt() {
|
|
1207
1584
|
return /* @__PURE__ */ l(B, { children: [
|
|
1208
1585
|
/* @__PURE__ */ n("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
1209
1586
|
/* @__PURE__ */ n("path", { d: "m9.2 22 3-7" }),
|
|
@@ -1211,29 +1588,29 @@ function Pn() {
|
|
|
1211
1588
|
/* @__PURE__ */ n("path", { d: "m17 13-3 7" })
|
|
1212
1589
|
] });
|
|
1213
1590
|
}
|
|
1214
|
-
const
|
|
1215
|
-
GameModeSelectionWeatherType_CLEAR:
|
|
1216
|
-
GameModeSelectionWeatherType_SCATTERED_CLOUDS:
|
|
1217
|
-
GameModeSelectionWeatherType_BROKEN_CLOUDS:
|
|
1218
|
-
GameModeSelectionWeatherType_OVERCAST:
|
|
1219
|
-
GameModeSelectionWeatherType_DRIZZLE:
|
|
1220
|
-
GameModeSelectionWeatherType_DAMP:
|
|
1221
|
-
GameModeSelectionWeatherType_RAIN:
|
|
1222
|
-
GameModeSelectionWeatherType_HEAVY_RAIN:
|
|
1591
|
+
const rt = {
|
|
1592
|
+
GameModeSelectionWeatherType_CLEAR: Qn,
|
|
1593
|
+
GameModeSelectionWeatherType_SCATTERED_CLOUDS: Yn,
|
|
1594
|
+
GameModeSelectionWeatherType_BROKEN_CLOUDS: Zn,
|
|
1595
|
+
GameModeSelectionWeatherType_OVERCAST: Jn,
|
|
1596
|
+
GameModeSelectionWeatherType_DRIZZLE: Xn,
|
|
1597
|
+
GameModeSelectionWeatherType_DAMP: et,
|
|
1598
|
+
GameModeSelectionWeatherType_RAIN: nt,
|
|
1599
|
+
GameModeSelectionWeatherType_HEAVY_RAIN: tt
|
|
1223
1600
|
};
|
|
1224
|
-
function
|
|
1225
|
-
const s = e ?
|
|
1601
|
+
function st({ weatherType: e, weatherBehaviour: t, className: r }) {
|
|
1602
|
+
const s = e ? rt[e] : null;
|
|
1226
1603
|
if (!s) return null;
|
|
1227
|
-
const a =
|
|
1604
|
+
const a = Gn[e] || e, o = t === "GameModeSelectionWeatherBehaviour_DYNAMIC", i = o ? `${a} · Dynamic` : a;
|
|
1228
1605
|
return /* @__PURE__ */ l(
|
|
1229
1606
|
"span",
|
|
1230
1607
|
{
|
|
1231
1608
|
className: `pvx-weather-icon ${r || ""}`.trim(),
|
|
1232
|
-
title:
|
|
1233
|
-
"aria-label":
|
|
1609
|
+
title: i,
|
|
1610
|
+
"aria-label": i,
|
|
1234
1611
|
children: [
|
|
1235
|
-
/* @__PURE__ */ n("svg", { className: "pvx-weather-icon-main", ...
|
|
1236
|
-
|
|
1612
|
+
/* @__PURE__ */ n("svg", { className: "pvx-weather-icon-main", ...zn, children: /* @__PURE__ */ n(s, {}) }),
|
|
1613
|
+
o && /* @__PURE__ */ n("span", { className: "pvx-weather-icon-dynamic", "aria-hidden": "true", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1237
1614
|
/* @__PURE__ */ n("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1238
1615
|
/* @__PURE__ */ n("path", { d: "M21 3v5h-5" }),
|
|
1239
1616
|
/* @__PURE__ */ n("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
@@ -1243,14 +1620,14 @@ function In({ weatherType: e, weatherBehaviour: t, className: r }) {
|
|
|
1243
1620
|
}
|
|
1244
1621
|
);
|
|
1245
1622
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return t ? /* @__PURE__ */ n(W, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((
|
|
1623
|
+
function dr({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
|
|
1624
|
+
return t ? /* @__PURE__ */ n(W, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((o) => /* @__PURE__ */ n(at, { comp: o, onSelect: r, onRegister: s || r }, o.id)) }) : /* @__PURE__ */ n(_, { message: "No competitions available." });
|
|
1248
1625
|
}
|
|
1249
|
-
function
|
|
1250
|
-
var
|
|
1251
|
-
const { cdnUrl: s } =
|
|
1252
|
-
(
|
|
1253
|
-
), h = f || ((N = e.rounds) == null ? void 0 : N.find((
|
|
1626
|
+
function at({ comp: e, onSelect: t, onRegister: r }) {
|
|
1627
|
+
var A, N, L, w, D;
|
|
1628
|
+
const { cdnUrl: s } = S(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, o = e.registration, i = (o == null ? void 0 : o.currentCount) || 0, d = o == null ? void 0 : o.maxParticipants, p = d && i >= d, c = (o == null ? void 0 : o.deadline) && new Date(o.deadline) < /* @__PURE__ */ new Date(), u = (o == null ? void 0 : o.isOpen) && !c && !p, v = /* @__PURE__ */ new Date(), f = (A = e.rounds) == null ? void 0 : A.find(
|
|
1629
|
+
($) => $.startTime && new Date($.startTime) <= v && !O($)
|
|
1630
|
+
), h = f || ((N = e.rounds) == null ? void 0 : N.find(($) => $.startTime && new Date($.startTime) >= v)), y = !!f, x = ((L = e.rounds) == null ? void 0 : L.length) || 0, m = e.type === "hotlap", b = m && x > 1, g = m ? ((w = e.rounds) == null ? void 0 : w.filter(O).length) || 0 : ((D = e.rounds) == null ? void 0 : D.filter(($) => $.isFinalized).length) || 0, k = _e(e), C = k === "recently-completed" || k === "archived", P = e.type === "championship";
|
|
1254
1631
|
return /* @__PURE__ */ l(
|
|
1255
1632
|
"div",
|
|
1256
1633
|
{
|
|
@@ -1258,59 +1635,59 @@ function En({ comp: e, onSelect: t, onRegister: r }) {
|
|
|
1258
1635
|
onClick: () => t(e.id),
|
|
1259
1636
|
role: "button",
|
|
1260
1637
|
tabIndex: 0,
|
|
1261
|
-
onKeyDown: (
|
|
1262
|
-
(
|
|
1638
|
+
onKeyDown: ($) => {
|
|
1639
|
+
($.key === "Enter" || $.key === " ") && ($.preventDefault(), t(e.id));
|
|
1263
1640
|
},
|
|
1264
1641
|
children: [
|
|
1265
|
-
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(
|
|
1642
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(ot, {}) }) }),
|
|
1266
1643
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
|
|
1267
1644
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1268
1645
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1269
1646
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
|
|
1270
|
-
/* @__PURE__ */ n(
|
|
1271
|
-
e.game && /* @__PURE__ */ n(
|
|
1272
|
-
e.formatDescription && e.formatDescription.split(", ").map((
|
|
1647
|
+
/* @__PURE__ */ n(Rn, { type: e.type }),
|
|
1648
|
+
e.game && /* @__PURE__ */ n(ae, { children: e.game.toUpperCase() }),
|
|
1649
|
+
e.formatDescription && e.formatDescription.split(", ").map(($, j) => /* @__PURE__ */ n(ae, { variant: "format", children: $ }, j))
|
|
1273
1650
|
] }),
|
|
1274
|
-
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((
|
|
1651
|
+
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map(($, j) => /* @__PURE__ */ n(ae, { children: $ }, j)) }),
|
|
1275
1652
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
|
|
1276
1653
|
h ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1277
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children:
|
|
1654
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: y ? "Live:" : "Next:" }),
|
|
1278
1655
|
" ",
|
|
1279
1656
|
(e.type !== "hotlap" || b) && `R${h.roundNumber} `,
|
|
1280
1657
|
h.track || "TBD",
|
|
1281
1658
|
" · ",
|
|
1282
|
-
|
|
1659
|
+
Mn(h.startTime),
|
|
1283
1660
|
(h.weatherType || e.weatherType) && /* @__PURE__ */ l(B, { children: [
|
|
1284
1661
|
" ",
|
|
1285
1662
|
/* @__PURE__ */ n(
|
|
1286
|
-
|
|
1663
|
+
st,
|
|
1287
1664
|
{
|
|
1288
1665
|
weatherType: h.weatherType || e.weatherType,
|
|
1289
1666
|
weatherBehaviour: h.weatherBehaviour || e.weatherBehaviour
|
|
1290
1667
|
}
|
|
1291
1668
|
)
|
|
1292
1669
|
] })
|
|
1293
|
-
] }) :
|
|
1294
|
-
|
|
1670
|
+
] }) : x > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1671
|
+
g,
|
|
1295
1672
|
"/",
|
|
1296
|
-
|
|
1673
|
+
x,
|
|
1297
1674
|
" rounds completed"
|
|
1298
1675
|
] }) : null,
|
|
1299
|
-
|
|
1300
|
-
|
|
1676
|
+
x > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
|
|
1677
|
+
x,
|
|
1301
1678
|
" round",
|
|
1302
|
-
|
|
1679
|
+
x !== 1 ? "s" : ""
|
|
1303
1680
|
] })
|
|
1304
1681
|
] }),
|
|
1305
|
-
C && (
|
|
1306
|
-
|
|
1307
|
-
|
|
1682
|
+
C && (P || b) && /* @__PURE__ */ n(On, { competitionId: e.id }),
|
|
1683
|
+
o && !C && /* @__PURE__ */ n(
|
|
1684
|
+
it,
|
|
1308
1685
|
{
|
|
1309
1686
|
competitionId: e.id,
|
|
1310
1687
|
regOpen: u,
|
|
1311
1688
|
isFull: p,
|
|
1312
1689
|
deadlinePassed: c,
|
|
1313
|
-
regCount:
|
|
1690
|
+
regCount: i,
|
|
1314
1691
|
regMax: d,
|
|
1315
1692
|
onRegister: r
|
|
1316
1693
|
}
|
|
@@ -1320,13 +1697,13 @@ function En({ comp: e, onSelect: t, onRegister: r }) {
|
|
|
1320
1697
|
}
|
|
1321
1698
|
);
|
|
1322
1699
|
}
|
|
1323
|
-
function
|
|
1324
|
-
const { isPowerMode: d } =
|
|
1700
|
+
function it({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: o, onRegister: i }) {
|
|
1701
|
+
const { isPowerMode: d } = me(), p = ve(e), { data: c } = he(e), u = (c == null ? void 0 : c.isRegistered) || !1, v = o ? a / o * 100 : 0, f = v >= 100 ? "full" : v >= 75 ? "warning" : "ok";
|
|
1325
1702
|
return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
|
|
1326
1703
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
|
|
1327
1704
|
a,
|
|
1328
1705
|
"/",
|
|
1329
|
-
|
|
1706
|
+
o || "∞",
|
|
1330
1707
|
" drivers"
|
|
1331
1708
|
] }) }),
|
|
1332
1709
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
|
|
@@ -1334,7 +1711,7 @@ function _n({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCou
|
|
|
1334
1711
|
{
|
|
1335
1712
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
1336
1713
|
onClick: (h) => {
|
|
1337
|
-
h.stopPropagation(),
|
|
1714
|
+
h.stopPropagation(), i(e);
|
|
1338
1715
|
},
|
|
1339
1716
|
children: "✓ Registered"
|
|
1340
1717
|
}
|
|
@@ -1343,7 +1720,7 @@ function _n({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCou
|
|
|
1343
1720
|
{
|
|
1344
1721
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1345
1722
|
onClick: (h) => {
|
|
1346
|
-
h.stopPropagation(),
|
|
1723
|
+
h.stopPropagation(), i(e);
|
|
1347
1724
|
},
|
|
1348
1725
|
children: "Register"
|
|
1349
1726
|
}
|
|
@@ -1360,7 +1737,7 @@ function _n({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCou
|
|
|
1360
1737
|
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
|
|
1361
1738
|
] });
|
|
1362
1739
|
}
|
|
1363
|
-
function
|
|
1740
|
+
function ot() {
|
|
1364
1741
|
return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1365
1742
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1366
1743
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1370,23 +1747,23 @@ function Un() {
|
|
|
1370
1747
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1371
1748
|
] });
|
|
1372
1749
|
}
|
|
1373
|
-
function
|
|
1750
|
+
function lt({ competitionId: e, className: t }) {
|
|
1374
1751
|
var c, u, v;
|
|
1375
|
-
const { data: r, isLoading: s } =
|
|
1376
|
-
if (s ||
|
|
1752
|
+
const { data: r, isLoading: s } = De(e), { data: a, isLoading: o } = Pe(e);
|
|
1753
|
+
if (s || o)
|
|
1377
1754
|
return /* @__PURE__ */ n(W, { message: "Loading standings..." });
|
|
1378
1755
|
if (!((c = r == null ? void 0 : r.standings) != null && c.length))
|
|
1379
|
-
return /* @__PURE__ */ n(
|
|
1380
|
-
const
|
|
1756
|
+
return /* @__PURE__ */ n(_, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1757
|
+
const i = (a == null ? void 0 : a.type) === "hotlap", d = i ? ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter(O)) || [] : ((v = a == null ? void 0 : a.rounds) == null ? void 0 : v.filter((f) => f.isFinalized)) || [], p = r.roundsClosed ?? r.roundsCompleted ?? 0;
|
|
1381
1758
|
return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
|
|
1382
1759
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
1383
|
-
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children:
|
|
1760
|
+
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: i ? "Overall Standings" : "Championship Standings" }),
|
|
1384
1761
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
1385
1762
|
"After ",
|
|
1386
1763
|
p,
|
|
1387
1764
|
" round",
|
|
1388
1765
|
p !== 1 ? "s" : "",
|
|
1389
|
-
|
|
1766
|
+
i ? " closed" : "",
|
|
1390
1767
|
r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
|
|
1391
1768
|
] })
|
|
1392
1769
|
] }) }),
|
|
@@ -1411,7 +1788,7 @@ function Fn({ competitionId: e, className: t }) {
|
|
|
1411
1788
|
))
|
|
1412
1789
|
] }) }),
|
|
1413
1790
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((f) => /* @__PURE__ */ n(
|
|
1414
|
-
|
|
1791
|
+
ct,
|
|
1415
1792
|
{
|
|
1416
1793
|
driver: f,
|
|
1417
1794
|
columnRounds: d
|
|
@@ -1421,19 +1798,19 @@ function Fn({ competitionId: e, className: t }) {
|
|
|
1421
1798
|
] }) })
|
|
1422
1799
|
] });
|
|
1423
1800
|
}
|
|
1424
|
-
function
|
|
1425
|
-
var
|
|
1801
|
+
function ct({ driver: e, columnRounds: t }) {
|
|
1802
|
+
var i, d, p;
|
|
1426
1803
|
const r = e.position <= 3, s = new Map(
|
|
1427
|
-
((
|
|
1428
|
-
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0,
|
|
1804
|
+
((i = e.roundResults) == null ? void 0 : i.map((c) => [c.roundNumber, c])) || []
|
|
1805
|
+
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, o = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
|
|
1429
1806
|
return /* @__PURE__ */ l("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
|
|
1430
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
1807
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: e.position }) }),
|
|
1431
1808
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1432
|
-
/* @__PURE__ */ n(
|
|
1809
|
+
/* @__PURE__ */ n(ee, { nation: e.nation }),
|
|
1433
1810
|
e.driverName
|
|
1434
1811
|
] }),
|
|
1435
1812
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1436
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children:
|
|
1813
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: o || "-" }),
|
|
1437
1814
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1438
1815
|
t.map((c) => {
|
|
1439
1816
|
const u = s.get(c.roundNumber), v = u == null ? void 0 : u.dropped;
|
|
@@ -1454,7 +1831,7 @@ function qn({ driver: e, columnRounds: t }) {
|
|
|
1454
1831
|
})
|
|
1455
1832
|
] });
|
|
1456
1833
|
}
|
|
1457
|
-
const
|
|
1834
|
+
const Ce = [
|
|
1458
1835
|
"#f59e0b",
|
|
1459
1836
|
"#3b82f6",
|
|
1460
1837
|
"#ef4444",
|
|
@@ -1480,109 +1857,109 @@ const fe = [
|
|
|
1480
1857
|
"#f87171",
|
|
1481
1858
|
"#38bdf8"
|
|
1482
1859
|
];
|
|
1483
|
-
function
|
|
1860
|
+
function dt(e, t) {
|
|
1484
1861
|
return e.map((r) => ({
|
|
1485
1862
|
driverName: r.driverName,
|
|
1486
1863
|
carClass: r.carClass,
|
|
1487
1864
|
positions: r.positions.map((s, a) => {
|
|
1488
|
-
const
|
|
1489
|
-
return
|
|
1865
|
+
const i = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName === r.driverName);
|
|
1866
|
+
return i === -1 ? null : i + 1;
|
|
1490
1867
|
})
|
|
1491
1868
|
}));
|
|
1492
1869
|
}
|
|
1493
|
-
function
|
|
1494
|
-
const [s, a] = E(() => /* @__PURE__ */ new Set()),
|
|
1495
|
-
a((
|
|
1496
|
-
const
|
|
1497
|
-
return
|
|
1870
|
+
function pt({ title: e, drivers: t, timingPoints: r }) {
|
|
1871
|
+
const [s, a] = E(() => /* @__PURE__ */ new Set()), o = H((N) => {
|
|
1872
|
+
a((L) => {
|
|
1873
|
+
const w = new Set(L);
|
|
1874
|
+
return w.has(N) ? w.delete(N) : w.add(N), w;
|
|
1498
1875
|
});
|
|
1499
|
-
}, []), { series:
|
|
1876
|
+
}, []), { series: i, maxPos: d } = T(() => {
|
|
1500
1877
|
let N = 1;
|
|
1501
|
-
return { series: t.map((
|
|
1502
|
-
for (const
|
|
1503
|
-
return { ...
|
|
1878
|
+
return { series: t.map((w, D) => {
|
|
1879
|
+
for (const $ of w.positions) $ != null && $ > N && (N = $);
|
|
1880
|
+
return { ...w, colour: Ce[D % Ce.length] };
|
|
1504
1881
|
}), maxPos: N };
|
|
1505
1882
|
}, [t]);
|
|
1506
|
-
if (!
|
|
1883
|
+
if (!i.length || r.length < 2)
|
|
1507
1884
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-empty", children: [
|
|
1508
1885
|
"No position data for ",
|
|
1509
1886
|
e || "this race",
|
|
1510
1887
|
"."
|
|
1511
1888
|
] });
|
|
1512
|
-
const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34,
|
|
1513
|
-
const
|
|
1514
|
-
let
|
|
1515
|
-
return N.forEach((
|
|
1516
|
-
|
|
1517
|
-
}),
|
|
1518
|
-
},
|
|
1889
|
+
const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34, y = p - c - u, x = Math.max(f * (d - 1), f), m = v + x + h, b = r.length, g = (N) => c + (b === 1 ? 0 : N / (b - 1) * y), k = (N) => v + (d === 1 ? 0 : (N - 1) / (d - 1) * x), C = (N) => {
|
|
1890
|
+
const L = [];
|
|
1891
|
+
let w = [];
|
|
1892
|
+
return N.forEach((D, $) => {
|
|
1893
|
+
D == null ? w.length && (L.push(w), w = []) : w.push([g($), k(D)]);
|
|
1894
|
+
}), w.length && L.push(w), L;
|
|
1895
|
+
}, P = s.size > 0, A = Math.ceil(b / 24);
|
|
1519
1896
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-chart", children: [
|
|
1520
1897
|
e && /* @__PURE__ */ n("div", { className: "pvx-positions-title", children: e }),
|
|
1521
1898
|
/* @__PURE__ */ l(
|
|
1522
1899
|
"svg",
|
|
1523
1900
|
{
|
|
1524
1901
|
className: "pvx-positions-svg",
|
|
1525
|
-
viewBox: `0 0 ${p} ${
|
|
1902
|
+
viewBox: `0 0 ${p} ${m}`,
|
|
1526
1903
|
preserveAspectRatio: "xMidYMid meet",
|
|
1527
1904
|
role: "img",
|
|
1528
1905
|
"aria-label": `Race position progression${e ? ` — ${e}` : ""}`,
|
|
1529
1906
|
children: [
|
|
1530
|
-
Array.from({ length: d }, (N,
|
|
1907
|
+
Array.from({ length: d }, (N, L) => L + 1).map((N) => /* @__PURE__ */ l("g", { children: [
|
|
1531
1908
|
/* @__PURE__ */ n(
|
|
1532
1909
|
"line",
|
|
1533
1910
|
{
|
|
1534
1911
|
className: "pvx-positions-grid",
|
|
1535
1912
|
x1: c,
|
|
1536
|
-
y1:
|
|
1913
|
+
y1: k(N),
|
|
1537
1914
|
x2: p - u,
|
|
1538
|
-
y2:
|
|
1915
|
+
y2: k(N)
|
|
1539
1916
|
}
|
|
1540
1917
|
),
|
|
1541
|
-
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y:
|
|
1918
|
+
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y: k(N) + 3, textAnchor: "end", children: [
|
|
1542
1919
|
"P",
|
|
1543
1920
|
N
|
|
1544
1921
|
] })
|
|
1545
1922
|
] }, `y${N}`)),
|
|
1546
|
-
r.map((N,
|
|
1923
|
+
r.map((N, L) => L % A === 0 && /* @__PURE__ */ n(
|
|
1547
1924
|
"text",
|
|
1548
1925
|
{
|
|
1549
1926
|
className: "pvx-positions-axis",
|
|
1550
|
-
x:
|
|
1551
|
-
y:
|
|
1927
|
+
x: g(L),
|
|
1928
|
+
y: m - h + 16,
|
|
1552
1929
|
textAnchor: "middle",
|
|
1553
1930
|
children: N.label
|
|
1554
1931
|
},
|
|
1555
|
-
`x${
|
|
1932
|
+
`x${L}`
|
|
1556
1933
|
)),
|
|
1557
|
-
|
|
1558
|
-
const
|
|
1559
|
-
return /* @__PURE__ */ l("g", { opacity:
|
|
1560
|
-
C(N.positions).map((
|
|
1934
|
+
i.map((N) => {
|
|
1935
|
+
const L = P && !s.has(N.driverName);
|
|
1936
|
+
return /* @__PURE__ */ l("g", { opacity: L ? 0.12 : 1, children: [
|
|
1937
|
+
C(N.positions).map((w, D) => /* @__PURE__ */ n(
|
|
1561
1938
|
"polyline",
|
|
1562
1939
|
{
|
|
1563
1940
|
fill: "none",
|
|
1564
1941
|
stroke: N.colour,
|
|
1565
|
-
strokeWidth:
|
|
1566
|
-
points:
|
|
1942
|
+
strokeWidth: L ? 1 : 2,
|
|
1943
|
+
points: w.map(([$, j]) => `${$},${j}`).join(" ")
|
|
1567
1944
|
},
|
|
1568
|
-
|
|
1945
|
+
D
|
|
1569
1946
|
)),
|
|
1570
|
-
!
|
|
1947
|
+
!L && N.positions.map((w, D) => w != null && /* @__PURE__ */ n("circle", { cx: g(D), cy: k(w), r: 2.4, fill: N.colour, children: /* @__PURE__ */ n("title", { children: `${N.driverName} — ${r[D].label}: P${w}` }) }, D))
|
|
1571
1948
|
] }, N.driverName);
|
|
1572
1949
|
})
|
|
1573
1950
|
]
|
|
1574
1951
|
}
|
|
1575
1952
|
),
|
|
1576
1953
|
/* @__PURE__ */ l("div", { className: "pvx-positions-legend", children: [
|
|
1577
|
-
|
|
1578
|
-
const
|
|
1954
|
+
i.map((N) => {
|
|
1955
|
+
const L = P && !s.has(N.driverName);
|
|
1579
1956
|
return /* @__PURE__ */ l(
|
|
1580
1957
|
"button",
|
|
1581
1958
|
{
|
|
1582
1959
|
type: "button",
|
|
1583
1960
|
className: "pvx-positions-legend-item",
|
|
1584
|
-
style: { opacity:
|
|
1585
|
-
onClick: () =>
|
|
1961
|
+
style: { opacity: L ? 0.4 : 1 },
|
|
1962
|
+
onClick: () => o(N.driverName),
|
|
1586
1963
|
children: [
|
|
1587
1964
|
/* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background: N.colour } }),
|
|
1588
1965
|
N.driverName
|
|
@@ -1591,7 +1968,7 @@ function jn({ title: e, drivers: t, timingPoints: r }) {
|
|
|
1591
1968
|
N.driverName
|
|
1592
1969
|
);
|
|
1593
1970
|
}),
|
|
1594
|
-
|
|
1971
|
+
P && /* @__PURE__ */ n(
|
|
1595
1972
|
"button",
|
|
1596
1973
|
{
|
|
1597
1974
|
type: "button",
|
|
@@ -1603,35 +1980,35 @@ function jn({ title: e, drivers: t, timingPoints: r }) {
|
|
|
1603
1980
|
] })
|
|
1604
1981
|
] });
|
|
1605
1982
|
}
|
|
1606
|
-
function
|
|
1983
|
+
function ut({ positions: e }) {
|
|
1607
1984
|
const t = (e == null ? void 0 : e.timingPoints) || [], r = (e == null ? void 0 : e.drivers) || [], s = T(() => {
|
|
1608
|
-
const a = [...new Set(r.map((
|
|
1609
|
-
return a.length <= 1 ? [{ title: a[0] || null, drivers: r }] : a.sort().map((
|
|
1610
|
-
title:
|
|
1611
|
-
drivers:
|
|
1612
|
-
r.filter((
|
|
1985
|
+
const a = [...new Set(r.map((o) => o.carClass).filter(Boolean))];
|
|
1986
|
+
return a.length <= 1 ? [{ title: a[0] || null, drivers: r }] : a.sort().map((o) => ({
|
|
1987
|
+
title: o,
|
|
1988
|
+
drivers: dt(
|
|
1989
|
+
r.filter((i) => i.carClass === o),
|
|
1613
1990
|
t.length
|
|
1614
1991
|
)
|
|
1615
1992
|
}));
|
|
1616
1993
|
}, [r, t.length]);
|
|
1617
|
-
return !t.length || !r.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: s.map((a,
|
|
1618
|
-
|
|
1994
|
+
return !t.length || !r.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: s.map((a, o) => /* @__PURE__ */ n(
|
|
1995
|
+
pt,
|
|
1619
1996
|
{
|
|
1620
1997
|
title: s.length > 1 ? a.title : null,
|
|
1621
1998
|
drivers: a.drivers,
|
|
1622
1999
|
timingPoints: t
|
|
1623
2000
|
},
|
|
1624
|
-
a.title ||
|
|
2001
|
+
a.title || o
|
|
1625
2002
|
)) });
|
|
1626
2003
|
}
|
|
1627
|
-
function
|
|
2004
|
+
function pr({ competitionId: e, roundNumber: t, className: r }) {
|
|
1628
2005
|
var p;
|
|
1629
|
-
const { data: s, isLoading: a } =
|
|
2006
|
+
const { data: s, isLoading: a } = dn(e, t);
|
|
1630
2007
|
if (a)
|
|
1631
2008
|
return /* @__PURE__ */ n(W, { message: "Loading results..." });
|
|
1632
2009
|
if (!s)
|
|
1633
|
-
return /* @__PURE__ */ n(
|
|
1634
|
-
const
|
|
2010
|
+
return /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
2011
|
+
const i = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = i == null ? void 0 : i.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
|
|
1635
2012
|
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${r || ""}`, children: [
|
|
1636
2013
|
/* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
|
|
1637
2014
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -1647,64 +2024,64 @@ function qt({ competitionId: e, roundNumber: t, className: r }) {
|
|
|
1647
2024
|
}) })
|
|
1648
2025
|
] }),
|
|
1649
2026
|
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1650
|
-
/* @__PURE__ */ n("span", { children:
|
|
2027
|
+
/* @__PURE__ */ n("span", { children: xe[c.position - 1] }),
|
|
1651
2028
|
/* @__PURE__ */ n("span", { children: c.driverName })
|
|
1652
2029
|
] }, c.driverId)) })
|
|
1653
2030
|
] }),
|
|
1654
|
-
/* @__PURE__ */ n(
|
|
2031
|
+
/* @__PURE__ */ n(ye, { round: s, competitionId: e })
|
|
1655
2032
|
] });
|
|
1656
2033
|
}
|
|
1657
|
-
function
|
|
1658
|
-
var h,
|
|
1659
|
-
const [s, a] = E(null),
|
|
1660
|
-
if (!
|
|
1661
|
-
return /* @__PURE__ */ n(
|
|
1662
|
-
const { data:
|
|
2034
|
+
function ye({ round: e, competitionId: t, className: r }) {
|
|
2035
|
+
var h, y, x, m, b, g;
|
|
2036
|
+
const [s, a] = E(null), o = (e == null ? void 0 : e.sessions) || [];
|
|
2037
|
+
if (!o.length)
|
|
2038
|
+
return /* @__PURE__ */ n(_, { message: "No session data for this round." });
|
|
2039
|
+
const { data: i } = mn(
|
|
1663
2040
|
t,
|
|
1664
2041
|
e == null ? void 0 : e.roundNumber,
|
|
1665
2042
|
{}
|
|
1666
|
-
), d =
|
|
2043
|
+
), d = o.some((k) => k.type === "RACE"), { data: p } = vn(
|
|
1667
2044
|
t,
|
|
1668
2045
|
e == null ? void 0 : e.roundNumber,
|
|
1669
2046
|
{ enabled: !!t && d }
|
|
1670
|
-
), c = s || ((h =
|
|
2047
|
+
), c = s || ((h = o.find((k) => k.type === "RACE")) == null ? void 0 : h.type) || ((y = o[0]) == null ? void 0 : y.type), u = o.find((k) => k.type === c) || o[0], v = ((m = (x = i == null ? void 0 : i.sessions) == null ? void 0 : x.find((k) => k.type === c)) == null ? void 0 : m.drivers) || null, f = (u == null ? void 0 : u.type) === "RACE" && ((b = p == null ? void 0 : p.timingPoints) == null ? void 0 : b.length) > 0 && ((g = p == null ? void 0 : p.drivers) == null ? void 0 : g.length) > 0;
|
|
1671
2048
|
return /* @__PURE__ */ l("div", { className: r || "", children: [
|
|
1672
2049
|
/* @__PURE__ */ n(
|
|
1673
|
-
|
|
2050
|
+
Tn,
|
|
1674
2051
|
{
|
|
1675
|
-
sessions:
|
|
2052
|
+
sessions: o,
|
|
1676
2053
|
activeSession: c,
|
|
1677
2054
|
onSelect: a
|
|
1678
2055
|
}
|
|
1679
2056
|
),
|
|
1680
|
-
/* @__PURE__ */ n(
|
|
2057
|
+
/* @__PURE__ */ n(ht, { session: u, sessionLaps: v }),
|
|
1681
2058
|
f && /* @__PURE__ */ l("div", { className: "pvx-positions-section", children: [
|
|
1682
2059
|
/* @__PURE__ */ n("div", { className: "pvx-positions-section-title", children: "Race Positions" }),
|
|
1683
|
-
/* @__PURE__ */ n(
|
|
2060
|
+
/* @__PURE__ */ n(ut, { positions: p })
|
|
1684
2061
|
] })
|
|
1685
2062
|
] });
|
|
1686
2063
|
}
|
|
1687
|
-
function
|
|
2064
|
+
function ht({ session: e, sessionLaps: t }) {
|
|
1688
2065
|
var u;
|
|
1689
2066
|
const r = e.type === "RACE", [s, a] = E(null);
|
|
1690
2067
|
if (!((u = e.results) != null && u.length))
|
|
1691
|
-
return /* @__PURE__ */ n(
|
|
1692
|
-
const
|
|
1693
|
-
var
|
|
1694
|
-
const
|
|
2068
|
+
return /* @__PURE__ */ n(_, { message: `No results for ${e.type}.` });
|
|
2069
|
+
const o = Pn(e.results), i = r ? 7 : 4, d = [...new Set(e.results.map((v) => v.carClass).filter(Boolean))], p = d.length > 1, c = (v, f, h) => {
|
|
2070
|
+
var m;
|
|
2071
|
+
const y = (m = t == null ? void 0 : t[v.driverId]) == null ? void 0 : m.laps, x = s === v.driverId && !!y;
|
|
1695
2072
|
return /* @__PURE__ */ n(
|
|
1696
|
-
|
|
2073
|
+
mt,
|
|
1697
2074
|
{
|
|
1698
2075
|
result: v,
|
|
1699
2076
|
isRace: r,
|
|
1700
|
-
fastestSplits:
|
|
2077
|
+
fastestSplits: o,
|
|
1701
2078
|
rowIndex: f,
|
|
1702
2079
|
displayPosition: h,
|
|
1703
|
-
hasLapDetail: !!
|
|
1704
|
-
isExpanded:
|
|
1705
|
-
onToggle: () => a(
|
|
1706
|
-
driverLaps:
|
|
1707
|
-
colCount:
|
|
2080
|
+
hasLapDetail: !!y,
|
|
2081
|
+
isExpanded: x,
|
|
2082
|
+
onToggle: () => a(x ? null : v.driverId),
|
|
2083
|
+
driverLaps: x ? y : null,
|
|
2084
|
+
colCount: i
|
|
1708
2085
|
},
|
|
1709
2086
|
v.driverId || f
|
|
1710
2087
|
);
|
|
@@ -1722,29 +2099,29 @@ function Wn({ session: e, sessionLaps: t }) {
|
|
|
1722
2099
|
] })
|
|
1723
2100
|
] }) }),
|
|
1724
2101
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((v) => {
|
|
1725
|
-
const f = e.results.filter((h) => h.carClass === v).sort((h,
|
|
2102
|
+
const f = e.results.filter((h) => h.carClass === v).sort((h, y) => (h.classPosition ?? h.position) - (y.classPosition ?? y.position));
|
|
1726
2103
|
return [
|
|
1727
|
-
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan:
|
|
2104
|
+
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: i, className: "pvx-td pvx-td--class-header", children: v }) }, `hdr-${v}`),
|
|
1728
2105
|
...f.map(
|
|
1729
|
-
(h,
|
|
2106
|
+
(h, y) => c(h, y, h.classPosition ?? h.position)
|
|
1730
2107
|
)
|
|
1731
2108
|
];
|
|
1732
2109
|
}) : e.results.map((v, f) => c(v, f)) })
|
|
1733
2110
|
] }) });
|
|
1734
2111
|
}
|
|
1735
|
-
function
|
|
2112
|
+
function mt({ result: e, isRace: t, fastestSplits: r, rowIndex: s, displayPosition: a, hasLapDetail: o, isExpanded: i, onToggle: d, driverLaps: p, colCount: c }) {
|
|
1736
2113
|
const u = a ?? e.position, v = u <= 3;
|
|
1737
2114
|
return /* @__PURE__ */ l(B, { children: [
|
|
1738
2115
|
/* @__PURE__ */ l(
|
|
1739
2116
|
"tr",
|
|
1740
2117
|
{
|
|
1741
|
-
className: `pvx-row ${v ? "pvx-row--podium" : ""} ${
|
|
1742
|
-
onClick:
|
|
1743
|
-
style:
|
|
2118
|
+
className: `pvx-row ${v ? "pvx-row--podium" : ""} ${o ? "pvx-row--expandable" : ""}`,
|
|
2119
|
+
onClick: o ? d : void 0,
|
|
2120
|
+
style: o ? { cursor: "pointer" } : void 0,
|
|
1744
2121
|
children: [
|
|
1745
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
2122
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: u }) }),
|
|
1746
2123
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1747
|
-
/* @__PURE__ */ n(
|
|
2124
|
+
/* @__PURE__ */ n(ee, { nation: e.nation }),
|
|
1748
2125
|
e.driverName,
|
|
1749
2126
|
e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
|
|
1750
2127
|
"#",
|
|
@@ -1752,9 +2129,9 @@ function Kn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, displayPositi
|
|
|
1752
2129
|
] }),
|
|
1753
2130
|
e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
|
|
1754
2131
|
] }),
|
|
1755
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
2132
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1756
2133
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1757
|
-
|
|
2134
|
+
xt,
|
|
1758
2135
|
{
|
|
1759
2136
|
bestLap: e.bestLapFormatted,
|
|
1760
2137
|
hasBestLap: e.hasBestLap,
|
|
@@ -1779,10 +2156,10 @@ function Kn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, displayPositi
|
|
|
1779
2156
|
]
|
|
1780
2157
|
}
|
|
1781
2158
|
),
|
|
1782
|
-
|
|
2159
|
+
i && p && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: c, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(vt, { laps: p }) }) })
|
|
1783
2160
|
] });
|
|
1784
2161
|
}
|
|
1785
|
-
function
|
|
2162
|
+
function vt({ laps: e }) {
|
|
1786
2163
|
const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
|
|
1787
2164
|
return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1788
2165
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
@@ -1798,35 +2175,35 @@ function On({ laps: e }) {
|
|
|
1798
2175
|
return /* @__PURE__ */ l("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
|
|
1799
2176
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
|
|
1800
2177
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
|
|
1801
|
-
(r.splits || []).map((
|
|
1802
|
-
Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((
|
|
2178
|
+
(r.splits || []).map((o, i) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: o }, i)),
|
|
2179
|
+
Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((o, i) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${i}`))
|
|
1803
2180
|
] }, r.lap);
|
|
1804
2181
|
}) })
|
|
1805
2182
|
] });
|
|
1806
2183
|
}
|
|
1807
|
-
function
|
|
2184
|
+
function xt({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
|
|
1808
2185
|
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1809
2186
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1810
|
-
(r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((
|
|
1811
|
-
const d = s &&
|
|
2187
|
+
(r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((o, i) => {
|
|
2188
|
+
const d = s && o === s[i];
|
|
1812
2189
|
return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1813
2190
|
/* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1814
2191
|
"S",
|
|
1815
|
-
|
|
2192
|
+
i + 1
|
|
1816
2193
|
] }),
|
|
1817
|
-
/* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children:
|
|
1818
|
-
] },
|
|
2194
|
+
/* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children: o })
|
|
2195
|
+
] }, i);
|
|
1819
2196
|
}) }) })
|
|
1820
2197
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1821
2198
|
}
|
|
1822
|
-
function
|
|
1823
|
-
const { getSteamId: r } =
|
|
2199
|
+
function ur({ competitionId: e, className: t }) {
|
|
2200
|
+
const { getSteamId: r } = S(), { data: s, isLoading: a } = Ae(e), o = r();
|
|
1824
2201
|
if (a)
|
|
1825
2202
|
return /* @__PURE__ */ n(W, { message: "Loading drivers..." });
|
|
1826
|
-
const
|
|
1827
|
-
return
|
|
2203
|
+
const i = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
|
|
2204
|
+
return i.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: i.map((d) => {
|
|
1828
2205
|
var c, u;
|
|
1829
|
-
const p =
|
|
2206
|
+
const p = o && d.steamId === o;
|
|
1830
2207
|
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
|
|
1831
2208
|
d.avatarUrl ? /* @__PURE__ */ n(
|
|
1832
2209
|
"img",
|
|
@@ -1841,24 +2218,24 @@ function Ht({ competitionId: e, className: t }) {
|
|
|
1841
2218
|
p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1842
2219
|
] })
|
|
1843
2220
|
] }, d.steamId || d.driverId);
|
|
1844
|
-
}) }) : /* @__PURE__ */ n(
|
|
2221
|
+
}) }) : /* @__PURE__ */ n(_, { message: "No drivers registered yet." });
|
|
1845
2222
|
}
|
|
1846
|
-
function
|
|
2223
|
+
function hr({
|
|
1847
2224
|
competitionId: e,
|
|
1848
2225
|
driverData: t,
|
|
1849
2226
|
className: r,
|
|
1850
2227
|
children: s
|
|
1851
2228
|
}) {
|
|
1852
|
-
const { data: a, isLoading:
|
|
1853
|
-
|
|
1854
|
-
},
|
|
1855
|
-
|
|
2229
|
+
const { data: a, isLoading: o } = he(e), { isPowerMode: i } = me(), d = ve(e), p = Ee(e), c = Be(e), u = (a == null ? void 0 : a.isRegistered) || !1, v = o || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
|
|
2230
|
+
i && p.mutate(t || {});
|
|
2231
|
+
}, y = () => {
|
|
2232
|
+
i && c.mutate();
|
|
1856
2233
|
};
|
|
1857
|
-
return typeof s == "function" ? s({ isRegistered: u, isLoading: v, register: h, withdraw:
|
|
2234
|
+
return typeof s == "function" ? s({ isRegistered: u, isLoading: v, register: h, withdraw: y, error: f, isPowerMode: i, registrationUrl: d }) : i ? /* @__PURE__ */ n(
|
|
1858
2235
|
"button",
|
|
1859
2236
|
{
|
|
1860
2237
|
className: `pvx-comp-register-btn ${r || ""}`,
|
|
1861
|
-
onClick: u ?
|
|
2238
|
+
onClick: u ? y : h,
|
|
1862
2239
|
disabled: v,
|
|
1863
2240
|
children: v ? "Loading..." : u ? "Withdraw" : "Register"
|
|
1864
2241
|
}
|
|
@@ -1873,44 +2250,44 @@ function jt({
|
|
|
1873
2250
|
}
|
|
1874
2251
|
);
|
|
1875
2252
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const { getSteamId: a } =
|
|
1878
|
-
return p || u ? /* @__PURE__ */ n(W, { message: "Loading registration..." }) :
|
|
1879
|
-
|
|
2253
|
+
function mr({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
|
|
2254
|
+
const { getSteamId: a } = S(), { isPowerMode: o } = me(), i = ve(e), { data: d, isLoading: p } = he(e), { data: c, isLoading: u } = Ae(e), v = Ee(e), f = Be(e), h = a(), y = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], m = t || {}, b = x.length || m.currentCount || 0, g = m.maxParticipants && b >= m.maxParticipants, k = m.deadline && new Date(m.deadline) < /* @__PURE__ */ new Date(), C = m.isOpen && !k && !g;
|
|
2255
|
+
return p || u ? /* @__PURE__ */ n(W, { message: "Loading registration..." }) : y ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
2256
|
+
ft,
|
|
1880
2257
|
{
|
|
1881
2258
|
competitionId: e,
|
|
1882
|
-
drivers:
|
|
2259
|
+
drivers: x,
|
|
1883
2260
|
steamId: h,
|
|
1884
|
-
isPowerMode:
|
|
1885
|
-
registrationUrl:
|
|
2261
|
+
isPowerMode: o,
|
|
2262
|
+
registrationUrl: i,
|
|
1886
2263
|
withdrawMutation: f,
|
|
1887
2264
|
onWithdrawSuccess: r,
|
|
1888
|
-
registration:
|
|
2265
|
+
registration: m
|
|
1889
2266
|
}
|
|
1890
|
-
) }) : C ? h ?
|
|
1891
|
-
|
|
2267
|
+
) }) : C ? h ? o ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
|
|
2268
|
+
gt,
|
|
1892
2269
|
{
|
|
1893
2270
|
competitionId: e,
|
|
1894
2271
|
registerMutation: v,
|
|
1895
|
-
registration:
|
|
2272
|
+
registration: m
|
|
1896
2273
|
}
|
|
1897
|
-
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href:
|
|
1898
|
-
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children:
|
|
1899
|
-
|
|
2274
|
+
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href: i, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: o ? /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ n("a", { href: i, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${s || ""}`, children: [
|
|
2275
|
+
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: g ? "Registration is full." : k ? "Registration deadline has passed." : "Registration is closed." }),
|
|
2276
|
+
x.length > 0 && /* @__PURE__ */ n(Ke, { drivers: x, steamId: h })
|
|
1900
2277
|
] });
|
|
1901
2278
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const [s, a] = E(""), [
|
|
2279
|
+
function gt({ competitionId: e, registerMutation: t, registration: r }) {
|
|
2280
|
+
const [s, a] = E(""), [o, i] = E("intermediate"), [d, p] = E(""), c = (h) => {
|
|
1904
2281
|
h.preventDefault(), t.mutate({
|
|
1905
2282
|
discordUsername: s || void 0,
|
|
1906
|
-
experience:
|
|
2283
|
+
experience: o,
|
|
1907
2284
|
comments: d || void 0
|
|
1908
2285
|
});
|
|
1909
2286
|
}, u = r || {}, v = u.currentCount || 0, f = u.maxParticipants;
|
|
1910
2287
|
return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
|
|
1911
2288
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1912
2289
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1913
|
-
f && /* @__PURE__ */ n(
|
|
2290
|
+
f && /* @__PURE__ */ n(He, { count: v, max: f })
|
|
1914
2291
|
] }),
|
|
1915
2292
|
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1916
2293
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
@@ -1937,8 +2314,8 @@ function zn({ competitionId: e, registerMutation: t, registration: r }) {
|
|
|
1937
2314
|
{
|
|
1938
2315
|
id: `pvx-exp-${e}`,
|
|
1939
2316
|
className: "pvx-reg-select",
|
|
1940
|
-
value:
|
|
1941
|
-
onChange: (h) =>
|
|
2317
|
+
value: o,
|
|
2318
|
+
onChange: (h) => i(h.target.value),
|
|
1942
2319
|
children: [
|
|
1943
2320
|
/* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
|
|
1944
2321
|
/* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
|
|
@@ -1975,21 +2352,21 @@ function zn({ competitionId: e, registerMutation: t, registration: r }) {
|
|
|
1975
2352
|
) })
|
|
1976
2353
|
] });
|
|
1977
2354
|
}
|
|
1978
|
-
function
|
|
2355
|
+
function ft({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: o, onWithdrawSuccess: i, registration: d }) {
|
|
1979
2356
|
const [p, c] = E(!1), u = () => {
|
|
1980
|
-
|
|
2357
|
+
o.mutate(void 0, {
|
|
1981
2358
|
onSuccess: () => {
|
|
1982
|
-
c(!1),
|
|
2359
|
+
c(!1), i && i();
|
|
1983
2360
|
}
|
|
1984
2361
|
});
|
|
1985
2362
|
}, v = d || {}, f = t.length || v.currentCount || 0, h = v.maxParticipants;
|
|
1986
2363
|
return /* @__PURE__ */ l(B, { children: [
|
|
1987
2364
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1988
2365
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1989
|
-
h && /* @__PURE__ */ n(
|
|
2366
|
+
h && /* @__PURE__ */ n(He, { count: f, max: h })
|
|
1990
2367
|
] }),
|
|
1991
|
-
/* @__PURE__ */ n(
|
|
1992
|
-
|
|
2368
|
+
/* @__PURE__ */ n(Ke, { drivers: t, steamId: r }),
|
|
2369
|
+
o.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: o.error.message || "Withdrawal failed" }),
|
|
1993
2370
|
s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
|
|
1994
2371
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1995
2372
|
/* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
|
|
@@ -2008,8 +2385,8 @@ function Qn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registra
|
|
|
2008
2385
|
type: "button",
|
|
2009
2386
|
className: "pvx-reg-danger-btn",
|
|
2010
2387
|
onClick: u,
|
|
2011
|
-
disabled:
|
|
2012
|
-
children:
|
|
2388
|
+
disabled: o.isPending,
|
|
2389
|
+
children: o.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
2013
2390
|
}
|
|
2014
2391
|
)
|
|
2015
2392
|
] })
|
|
@@ -2024,22 +2401,22 @@ function Qn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registra
|
|
|
2024
2401
|
) }) : /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
|
|
2025
2402
|
] });
|
|
2026
2403
|
}
|
|
2027
|
-
function
|
|
2404
|
+
function Ke({ drivers: e, steamId: t }) {
|
|
2028
2405
|
if (!e.length)
|
|
2029
2406
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
2030
2407
|
const r = [...e].sort((s, a) => {
|
|
2031
|
-
const
|
|
2032
|
-
return
|
|
2408
|
+
const o = t && s.steamId === t ? -1 : 0, i = t && a.steamId === t ? -1 : 0;
|
|
2409
|
+
return o - i;
|
|
2033
2410
|
});
|
|
2034
2411
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
|
|
2035
|
-
var
|
|
2412
|
+
var o, i;
|
|
2036
2413
|
const a = t && s.steamId === t;
|
|
2037
2414
|
return /* @__PURE__ */ l(
|
|
2038
2415
|
"div",
|
|
2039
2416
|
{
|
|
2040
2417
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
2041
2418
|
children: [
|
|
2042
|
-
s.avatarUrl ? /* @__PURE__ */ n("img", { src: s.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((
|
|
2419
|
+
s.avatarUrl ? /* @__PURE__ */ n("img", { src: s.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((i = (o = s.displayName) == null ? void 0 : o.charAt(0)) == null ? void 0 : i.toUpperCase()) || "?" }),
|
|
2043
2420
|
/* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
|
|
2044
2421
|
s.displayName,
|
|
2045
2422
|
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
@@ -2050,7 +2427,7 @@ function Ee({ drivers: e, steamId: t }) {
|
|
|
2050
2427
|
);
|
|
2051
2428
|
}) });
|
|
2052
2429
|
}
|
|
2053
|
-
function
|
|
2430
|
+
function He({ count: e, max: t }) {
|
|
2054
2431
|
const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
|
|
2055
2432
|
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
|
|
2056
2433
|
e,
|
|
@@ -2059,82 +2436,82 @@ function _e({ count: e, max: t }) {
|
|
|
2059
2436
|
" drivers"
|
|
2060
2437
|
] });
|
|
2061
2438
|
}
|
|
2062
|
-
function
|
|
2063
|
-
const { data: r, isLoading: s } =
|
|
2064
|
-
() =>
|
|
2065
|
-
[
|
|
2439
|
+
function vr({ competitionId: e, className: t }) {
|
|
2440
|
+
const { data: r, isLoading: s } = Pe(e), a = (r == null ? void 0 : r.type) === "championship", o = (r == null ? void 0 : r.type) === "hotlap", i = T(() => (r == null ? void 0 : r.rounds) || [], [r]), d = o && i.length > 1, p = o && !d, { data: c } = un(p ? e : null), u = T(
|
|
2441
|
+
() => i.filter((w) => w.isFinalized),
|
|
2442
|
+
[i]
|
|
2066
2443
|
), v = T(
|
|
2067
|
-
() => u.map((
|
|
2444
|
+
() => u.map((w) => w.roundNumber),
|
|
2068
2445
|
[u]
|
|
2069
|
-
), { data: f = [], isLoading: h } =
|
|
2446
|
+
), { data: f = [], isLoading: h } = pn(
|
|
2070
2447
|
e,
|
|
2071
2448
|
v
|
|
2072
|
-
),
|
|
2073
|
-
(
|
|
2074
|
-
) : null, b = d ?
|
|
2449
|
+
), y = p && f.length > 0 ? f[0] : null, x = (y == null ? void 0 : y.sessions) || [], m = d ? i.find(
|
|
2450
|
+
(w) => w.startTime && new Date(w.startTime) <= /* @__PURE__ */ new Date() && !O(w)
|
|
2451
|
+
) : null, b = d ? m ? `hlround-${m.roundNumber}` : "standings" : p ? "leaderboard" : a ? "standings" : v.length > 0 ? `round-${v[v.length - 1]}` : null, [g, k] = E(null), C = g || b;
|
|
2075
2452
|
if (s || h)
|
|
2076
2453
|
return /* @__PURE__ */ n(W, { message: "Loading results..." });
|
|
2077
2454
|
if (!r)
|
|
2078
|
-
return /* @__PURE__ */ n(
|
|
2455
|
+
return /* @__PURE__ */ n(_, { message: "Competition not found." });
|
|
2079
2456
|
if (!u.length)
|
|
2080
|
-
return /* @__PURE__ */ n(
|
|
2081
|
-
const
|
|
2457
|
+
return /* @__PURE__ */ n(_, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
2458
|
+
const P = new Map(f.map((w) => [`round-${w.roundNumber}`, w])), A = new Map(f.map((w) => [w.roundNumber, w])), N = [];
|
|
2082
2459
|
if (d) {
|
|
2083
2460
|
N.push({ id: "standings", label: "Standings" });
|
|
2084
|
-
for (const
|
|
2085
|
-
N.push({ id: `hlround-${
|
|
2461
|
+
for (const w of [...i].sort((D, $) => D.roundNumber - $.roundNumber))
|
|
2462
|
+
N.push({ id: `hlround-${w.roundNumber}`, label: `R${w.roundNumber}`, track: w.track || null });
|
|
2086
2463
|
} else if (p) {
|
|
2087
2464
|
N.push({ id: "leaderboard", label: "Leaderboard" });
|
|
2088
|
-
for (const
|
|
2089
|
-
N.push({ id: `session-${
|
|
2465
|
+
for (const w of x)
|
|
2466
|
+
N.push({ id: `session-${w.type}`, label: X(w.type) });
|
|
2090
2467
|
} else if (a) {
|
|
2091
2468
|
N.push({ id: "standings", label: "Standings" });
|
|
2092
|
-
for (const
|
|
2093
|
-
N.push({ id: `round-${
|
|
2469
|
+
for (const w of u)
|
|
2470
|
+
N.push({ id: `round-${w.roundNumber}`, label: `R${w.roundNumber}`, track: null });
|
|
2094
2471
|
} else
|
|
2095
|
-
for (const
|
|
2096
|
-
N.push({ id: `round-${
|
|
2097
|
-
let
|
|
2472
|
+
for (const w of u)
|
|
2473
|
+
N.push({ id: `round-${w.roundNumber}`, label: `R${w.roundNumber}`, track: null });
|
|
2474
|
+
let L;
|
|
2098
2475
|
if (C === "standings")
|
|
2099
|
-
|
|
2476
|
+
L = /* @__PURE__ */ n(lt, { competitionId: e });
|
|
2100
2477
|
else if (C === "leaderboard")
|
|
2101
|
-
|
|
2478
|
+
L = /* @__PURE__ */ n(Oe, { leaderboard: c, config: r });
|
|
2102
2479
|
else if (C != null && C.startsWith("hlround-")) {
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2480
|
+
const w = parseInt(C.slice(8), 10), D = i.find(($) => $.roundNumber === w);
|
|
2481
|
+
L = D ? /* @__PURE__ */ n(yt, { competitionId: e, roundMeta: D, roundData: A.get(w) }) : /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
2105
2482
|
} else if (C != null && C.startsWith("session-"))
|
|
2106
|
-
|
|
2107
|
-
|
|
2483
|
+
L = /* @__PURE__ */ n(
|
|
2484
|
+
Ge,
|
|
2108
2485
|
{
|
|
2109
|
-
session:
|
|
2110
|
-
round:
|
|
2486
|
+
session: x.find((w) => `session-${w.type}` === C),
|
|
2487
|
+
round: y,
|
|
2111
2488
|
competitionId: e
|
|
2112
2489
|
}
|
|
2113
2490
|
);
|
|
2114
2491
|
else {
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2492
|
+
const w = P.get(C);
|
|
2493
|
+
L = w ? /* @__PURE__ */ n(Nt, { round: w, competitionId: e }) : /* @__PURE__ */ n(_, { message: "No results for this round." });
|
|
2117
2494
|
}
|
|
2118
2495
|
return /* @__PURE__ */ l("div", { className: t || "", children: [
|
|
2119
|
-
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: N.map((
|
|
2496
|
+
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: N.map((w) => /* @__PURE__ */ l(
|
|
2120
2497
|
"button",
|
|
2121
2498
|
{
|
|
2122
|
-
className: `pvx-results-tab ${C ===
|
|
2123
|
-
onClick: () => w
|
|
2124
|
-
title:
|
|
2499
|
+
className: `pvx-results-tab ${C === w.id ? "pvx-results-tab--active" : ""}`,
|
|
2500
|
+
onClick: () => k(w.id),
|
|
2501
|
+
title: w.track || void 0,
|
|
2125
2502
|
children: [
|
|
2126
|
-
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children:
|
|
2127
|
-
|
|
2503
|
+
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: w.label }),
|
|
2504
|
+
w.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: w.track })
|
|
2128
2505
|
]
|
|
2129
2506
|
},
|
|
2130
|
-
|
|
2507
|
+
w.id
|
|
2131
2508
|
)) }),
|
|
2132
|
-
|
|
2509
|
+
L
|
|
2133
2510
|
] });
|
|
2134
2511
|
}
|
|
2135
|
-
function
|
|
2136
|
-
var
|
|
2137
|
-
const s = (e.sessions || []).find((
|
|
2512
|
+
function Nt({ round: e, competitionId: t }) {
|
|
2513
|
+
var o;
|
|
2514
|
+
const s = (e.sessions || []).find((i) => i.type === "RACE"), a = (o = s == null ? void 0 : s.results) == null ? void 0 : o.filter((i) => i.position <= 3).sort((i, d) => i.position - d.position);
|
|
2138
2515
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2139
2516
|
/* @__PURE__ */ l("div", { className: "pvx-card-header--split", children: [
|
|
2140
2517
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -2149,15 +2526,15 @@ function Yn({ round: e, competitionId: t }) {
|
|
|
2149
2526
|
year: "numeric"
|
|
2150
2527
|
}) })
|
|
2151
2528
|
] }),
|
|
2152
|
-
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((
|
|
2153
|
-
/* @__PURE__ */ n("span", { children:
|
|
2154
|
-
/* @__PURE__ */ n("span", { children:
|
|
2155
|
-
] },
|
|
2529
|
+
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((i) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
2530
|
+
/* @__PURE__ */ n("span", { children: xe[i.position - 1] }),
|
|
2531
|
+
/* @__PURE__ */ n("span", { children: i.driverName })
|
|
2532
|
+
] }, i.driverId)) })
|
|
2156
2533
|
] }),
|
|
2157
|
-
/* @__PURE__ */ n(
|
|
2534
|
+
/* @__PURE__ */ n(ye, { round: e, competitionId: t })
|
|
2158
2535
|
] });
|
|
2159
2536
|
}
|
|
2160
|
-
function
|
|
2537
|
+
function Oe({ leaderboard: e, config: t, heading: r }) {
|
|
2161
2538
|
var s;
|
|
2162
2539
|
return (s = e == null ? void 0 : e.drivers) != null && s.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2163
2540
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
|
|
@@ -2180,52 +2557,52 @@ function Ue({ leaderboard: e, config: t, heading: r }) {
|
|
|
2180
2557
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
|
|
2181
2558
|
] }) }),
|
|
2182
2559
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((a) => {
|
|
2183
|
-
const
|
|
2560
|
+
const o = a.position === 1 ? "" : `+${((a.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
|
|
2184
2561
|
return /* @__PURE__ */ l("tr", { className: `pvx-row ${a.position <= 3 ? "pvx-row--podium" : ""}`, children: [
|
|
2185
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
2562
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ge, { position: a.position }) }),
|
|
2186
2563
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
2187
|
-
/* @__PURE__ */ n(
|
|
2564
|
+
/* @__PURE__ */ n(ee, { nation: a.nation }),
|
|
2188
2565
|
a.driverName
|
|
2189
2566
|
] }),
|
|
2190
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
2567
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(a.carId) }),
|
|
2191
2568
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: a.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: a.bestLapFormatted }) }),
|
|
2192
2569
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.totalLaps }),
|
|
2193
2570
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.sessionsParticipated }),
|
|
2194
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children:
|
|
2571
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: o })
|
|
2195
2572
|
] }, a.driverId);
|
|
2196
2573
|
}) })
|
|
2197
2574
|
] }) })
|
|
2198
|
-
] }) : /* @__PURE__ */ n(
|
|
2575
|
+
] }) : /* @__PURE__ */ n(_, { message: "No lap times recorded yet." });
|
|
2199
2576
|
}
|
|
2200
|
-
function
|
|
2577
|
+
function Ge({ session: e, round: t, competitionId: r }) {
|
|
2201
2578
|
return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2202
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children:
|
|
2579
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: X(e.type) }) }),
|
|
2203
2580
|
/* @__PURE__ */ n(
|
|
2204
|
-
|
|
2581
|
+
ye,
|
|
2205
2582
|
{
|
|
2206
2583
|
round: { ...t, sessions: [e] },
|
|
2207
2584
|
competitionId: r
|
|
2208
2585
|
}
|
|
2209
2586
|
)
|
|
2210
|
-
] }) : /* @__PURE__ */ n(
|
|
2587
|
+
] }) : /* @__PURE__ */ n(_, { message: "Session data not available." });
|
|
2211
2588
|
}
|
|
2212
|
-
function
|
|
2213
|
-
const { data: s } =
|
|
2589
|
+
function yt({ competitionId: e, roundMeta: t, roundData: r }) {
|
|
2590
|
+
const { data: s } = hn(e, t.roundNumber), a = (r == null ? void 0 : r.sessions) || [], [o, i] = E("leaderboard"), d = [
|
|
2214
2591
|
{ id: "leaderboard", label: "Leaderboard" },
|
|
2215
|
-
...a.map((u) => ({ id: `session-${u.type}`, label:
|
|
2216
|
-
], p = d.some((u) => u.id ===
|
|
2592
|
+
...a.map((u) => ({ id: `session-${u.type}`, label: X(u.type) }))
|
|
2593
|
+
], p = d.some((u) => u.id === o) ? o : "leaderboard", c = `Round ${t.roundNumber}${t.track ? ` — ${t.track}` : ""}`;
|
|
2217
2594
|
return /* @__PURE__ */ l("div", { children: [
|
|
2218
2595
|
/* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: d.map((u) => /* @__PURE__ */ n(
|
|
2219
2596
|
"button",
|
|
2220
2597
|
{
|
|
2221
|
-
onClick: () =>
|
|
2598
|
+
onClick: () => i(u.id),
|
|
2222
2599
|
className: `pvx-session-tab ${p === u.id ? "pvx-session-tab--active" : ""}`,
|
|
2223
2600
|
children: u.label
|
|
2224
2601
|
},
|
|
2225
2602
|
u.id
|
|
2226
2603
|
)) }),
|
|
2227
|
-
p === "leaderboard" ? /* @__PURE__ */ n(
|
|
2228
|
-
|
|
2604
|
+
p === "leaderboard" ? /* @__PURE__ */ n(Oe, { leaderboard: s, heading: c }) : /* @__PURE__ */ n(
|
|
2605
|
+
Ge,
|
|
2229
2606
|
{
|
|
2230
2607
|
session: a.find((u) => `session-${u.type}` === p),
|
|
2231
2608
|
round: r,
|
|
@@ -2234,10 +2611,10 @@ function Zn({ competitionId: e, roundMeta: t, roundData: r }) {
|
|
|
2234
2611
|
)
|
|
2235
2612
|
] });
|
|
2236
2613
|
}
|
|
2237
|
-
function
|
|
2238
|
-
const { cdnUrl: t } =
|
|
2614
|
+
function bt(e) {
|
|
2615
|
+
const { cdnUrl: t } = S(), r = R({
|
|
2239
2616
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
2240
|
-
queryFn: () =>
|
|
2617
|
+
queryFn: () => M(t, Te(null, e)),
|
|
2241
2618
|
enabled: !!e,
|
|
2242
2619
|
staleTime: 3e4,
|
|
2243
2620
|
refetchInterval: 3e4
|
|
@@ -2260,16 +2637,16 @@ function Jn(e) {
|
|
|
2260
2637
|
} : null
|
|
2261
2638
|
};
|
|
2262
2639
|
}
|
|
2263
|
-
function
|
|
2264
|
-
const { cdnUrl: t, partnerSlug: r } =
|
|
2640
|
+
function wt(e) {
|
|
2641
|
+
const { cdnUrl: t, partnerSlug: r } = S(), s = R({
|
|
2265
2642
|
queryKey: ["pitvox", "laps", r || "global", e, "index"],
|
|
2266
|
-
queryFn: () =>
|
|
2643
|
+
queryFn: () => M(t, Te(r, e)),
|
|
2267
2644
|
enabled: !!e,
|
|
2268
2645
|
staleTime: 3e4,
|
|
2269
2646
|
refetchInterval: 3e4
|
|
2270
2647
|
}), a = T(() => {
|
|
2271
|
-
var
|
|
2272
|
-
return ((
|
|
2648
|
+
var o;
|
|
2649
|
+
return ((o = s.data) == null ? void 0 : o.combos) || [];
|
|
2273
2650
|
}, [s.data]);
|
|
2274
2651
|
return {
|
|
2275
2652
|
isLoading: s.isLoading,
|
|
@@ -2277,22 +2654,22 @@ function Xn(e) {
|
|
|
2277
2654
|
data: a
|
|
2278
2655
|
};
|
|
2279
2656
|
}
|
|
2280
|
-
function
|
|
2281
|
-
const { cdnUrl: t, partnerSlug: r } =
|
|
2282
|
-
return
|
|
2657
|
+
function ze(e = {}) {
|
|
2658
|
+
const { cdnUrl: t, partnerSlug: r } = S(), { game: s, gameVersion: a, enabled: o = !0 } = e, i = de(r, s, a, "ratings.json");
|
|
2659
|
+
return R({
|
|
2283
2660
|
queryKey: ["pitvox", "ratings", r, s || null, a || null],
|
|
2284
|
-
queryFn: () =>
|
|
2661
|
+
queryFn: () => M(t, i),
|
|
2285
2662
|
staleTime: 3e4,
|
|
2286
2663
|
refetchInterval: 3e4,
|
|
2287
|
-
enabled:
|
|
2664
|
+
enabled: o
|
|
2288
2665
|
});
|
|
2289
2666
|
}
|
|
2290
|
-
function
|
|
2667
|
+
function xr(e) {
|
|
2291
2668
|
var s;
|
|
2292
|
-
const t =
|
|
2669
|
+
const t = ze(), r = T(() => {
|
|
2293
2670
|
var a;
|
|
2294
2671
|
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
2295
|
-
(
|
|
2672
|
+
(o) => o.identifier === e
|
|
2296
2673
|
) || null;
|
|
2297
2674
|
}, [(s = t.data) == null ? void 0 : s.drivers, e]);
|
|
2298
2675
|
return {
|
|
@@ -2308,66 +2685,66 @@ function Kt(e) {
|
|
|
2308
2685
|
} : null
|
|
2309
2686
|
};
|
|
2310
2687
|
}
|
|
2311
|
-
function
|
|
2312
|
-
const t =
|
|
2688
|
+
function ie(e = {}) {
|
|
2689
|
+
const t = ze(e);
|
|
2313
2690
|
return {
|
|
2314
2691
|
data: t.data || null,
|
|
2315
2692
|
isLoading: t.isLoading,
|
|
2316
2693
|
error: t.error
|
|
2317
2694
|
};
|
|
2318
2695
|
}
|
|
2319
|
-
function
|
|
2696
|
+
function kt(e) {
|
|
2320
2697
|
var p, c;
|
|
2321
|
-
const { versions: t } =
|
|
2698
|
+
const { versions: t } = on(), r = (p = t == null ? void 0 : t.evo) == null ? void 0 : p.default, s = (c = t == null ? void 0 : t.lmu) == null ? void 0 : c.default, a = ie({ game: "evo", gameVersion: r, enabled: !!r }), o = ie({ game: "acc" }), i = ie({ game: "lmu", gameVersion: s, enabled: !!s });
|
|
2322
2699
|
return {
|
|
2323
2700
|
data: T(() => e ? [
|
|
2324
2701
|
{ data: a.data, game: "evo", label: "EVO" },
|
|
2325
|
-
{ data:
|
|
2326
|
-
{ data:
|
|
2702
|
+
{ data: o.data, game: "acc", label: "ACC" },
|
|
2703
|
+
{ data: i.data, game: "lmu", label: "LMU" }
|
|
2327
2704
|
].map(({ data: u, game: v, label: f }) => {
|
|
2328
|
-
var
|
|
2329
|
-
if (!((
|
|
2330
|
-
const h = [...u.drivers].sort((
|
|
2331
|
-
return
|
|
2705
|
+
var x;
|
|
2706
|
+
if (!((x = u == null ? void 0 : u.drivers) != null && x.length)) return null;
|
|
2707
|
+
const h = [...u.drivers].sort((m, b) => b.rating - m.rating), y = h.findIndex((m) => m.identifier === e);
|
|
2708
|
+
return y === -1 ? null : {
|
|
2332
2709
|
game: v,
|
|
2333
2710
|
label: f,
|
|
2334
|
-
rating: h[
|
|
2335
|
-
rank:
|
|
2711
|
+
rating: h[y].rating,
|
|
2712
|
+
rank: y + 1,
|
|
2336
2713
|
totalDrivers: h.length
|
|
2337
2714
|
};
|
|
2338
|
-
}).filter(Boolean) : [], [e, a.data,
|
|
2339
|
-
isLoading: a.isLoading ||
|
|
2715
|
+
}).filter(Boolean) : [], [e, a.data, o.data, i.data]),
|
|
2716
|
+
isLoading: a.isLoading || o.isLoading || i.isLoading
|
|
2340
2717
|
};
|
|
2341
2718
|
}
|
|
2342
|
-
function
|
|
2343
|
-
const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } =
|
|
2719
|
+
function Ct() {
|
|
2720
|
+
const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = S(), a = r(), { data: o, isLoading: i } = R({
|
|
2344
2721
|
queryKey: ["pitvox", "competitions", t],
|
|
2345
2722
|
queryFn: async () => {
|
|
2346
|
-
const h = await
|
|
2347
|
-
return h != null && h.competitions ? h.competitions.filter((
|
|
2723
|
+
const h = await M(e, "competitions/index.json");
|
|
2724
|
+
return h != null && h.competitions ? h.competitions.filter((y) => y.partnerSlug === t) : [];
|
|
2348
2725
|
},
|
|
2349
2726
|
staleTime: 6e4
|
|
2350
|
-
}), d = (
|
|
2727
|
+
}), d = (o == null ? void 0 : o.map((h) => h.id)) || [], p = be({
|
|
2351
2728
|
queries: d.map((h) => ({
|
|
2352
2729
|
queryKey: ["pitvox", "competition", t, h, "entrylist"],
|
|
2353
|
-
queryFn: () =>
|
|
2730
|
+
queryFn: () => M(e, `competitions/${t}/${h}/entrylist.json`),
|
|
2354
2731
|
enabled: !!a && d.length > 0,
|
|
2355
2732
|
staleTime: 6e4
|
|
2356
2733
|
}))
|
|
2357
2734
|
}), c = p.some((h) => h.isLoading), u = T(() => {
|
|
2358
|
-
var
|
|
2359
|
-
if (!
|
|
2360
|
-
const h = /* @__PURE__ */ new Date(),
|
|
2361
|
-
for (let b = 0; b <
|
|
2362
|
-
const
|
|
2363
|
-
if (!((
|
|
2364
|
-
const
|
|
2365
|
-
for (const N of
|
|
2366
|
-
if (
|
|
2367
|
-
const
|
|
2368
|
-
!
|
|
2369
|
-
competitionId:
|
|
2370
|
-
competitionName:
|
|
2735
|
+
var x, m;
|
|
2736
|
+
if (!o || !a || c) return [];
|
|
2737
|
+
const h = /* @__PURE__ */ new Date(), y = [];
|
|
2738
|
+
for (let b = 0; b < o.length; b++) {
|
|
2739
|
+
const g = o[b], k = (x = p[b]) == null ? void 0 : x.data;
|
|
2740
|
+
if (!((m = k == null ? void 0 : k.drivers) == null ? void 0 : m.some((N) => N.steamId === a))) continue;
|
|
2741
|
+
const P = g.type === "hotlap", A = g.rounds || [];
|
|
2742
|
+
for (const N of A) {
|
|
2743
|
+
if (P ? O(N) : N.isFinalized) continue;
|
|
2744
|
+
const w = N.dediStatus === "running" || N.dediStatus === "provisioning", D = N.dediStatus === "scheduled", $ = N.startTime && new Date(N.startTime) > h, j = w || D || N.dediServerAddress;
|
|
2745
|
+
!w && !$ && !j || y.push({
|
|
2746
|
+
competitionId: g.id,
|
|
2747
|
+
competitionName: g.name,
|
|
2371
2748
|
roundNumber: N.roundNumber,
|
|
2372
2749
|
track: N.track || "TBD",
|
|
2373
2750
|
startTime: N.startTime,
|
|
@@ -2376,11 +2753,11 @@ function nt() {
|
|
|
2376
2753
|
});
|
|
2377
2754
|
}
|
|
2378
2755
|
}
|
|
2379
|
-
return
|
|
2380
|
-
const
|
|
2381
|
-
return
|
|
2382
|
-
}),
|
|
2383
|
-
}, [
|
|
2756
|
+
return y.sort((b, g) => {
|
|
2757
|
+
const k = b.dediStatus === "running" || b.dediStatus === "provisioning", C = g.dediStatus === "running" || g.dediStatus === "provisioning";
|
|
2758
|
+
return k && !C ? -1 : !k && C ? 1 : new Date(b.startTime) - new Date(g.startTime);
|
|
2759
|
+
}), y.length > 0 && (y[0].isNext = !0), y;
|
|
2760
|
+
}, [o, a, c, p]), v = be({
|
|
2384
2761
|
queries: u.map((h) => ({
|
|
2385
2762
|
queryKey: ["pitvox", "serverInfo", h.competitionId, h.roundNumber],
|
|
2386
2763
|
queryFn: () => s(h.competitionId, h.roundNumber),
|
|
@@ -2391,25 +2768,25 @@ function nt() {
|
|
|
2391
2768
|
}))
|
|
2392
2769
|
});
|
|
2393
2770
|
return {
|
|
2394
|
-
data: T(() => u.length ? s ? u.map((h,
|
|
2395
|
-
var
|
|
2396
|
-
const
|
|
2397
|
-
return
|
|
2771
|
+
data: T(() => u.length ? s ? u.map((h, y) => {
|
|
2772
|
+
var m;
|
|
2773
|
+
const x = (m = v[y]) == null ? void 0 : m.data;
|
|
2774
|
+
return x != null && x.success ? {
|
|
2398
2775
|
...h,
|
|
2399
|
-
serverAddress:
|
|
2400
|
-
serverPassword:
|
|
2776
|
+
serverAddress: x.serverAddress || null,
|
|
2777
|
+
serverPassword: x.serverPassword || null
|
|
2401
2778
|
} : h;
|
|
2402
2779
|
}) : u : [], [u, s, v]),
|
|
2403
|
-
isLoading:
|
|
2780
|
+
isLoading: i || !!a && c
|
|
2404
2781
|
};
|
|
2405
2782
|
}
|
|
2406
|
-
function
|
|
2407
|
-
const { onFetchNotifications: e } =
|
|
2783
|
+
function St() {
|
|
2784
|
+
const { onFetchNotifications: e } = S();
|
|
2408
2785
|
return !!e;
|
|
2409
2786
|
}
|
|
2410
|
-
function
|
|
2411
|
-
const { onFetchNotifications: t, partnerSlug: r } =
|
|
2412
|
-
return
|
|
2787
|
+
function Lt(e = {}) {
|
|
2788
|
+
const { onFetchNotifications: t, partnerSlug: r } = S(), { limit: s = 20, unreadOnly: a = !1 } = e;
|
|
2789
|
+
return R({
|
|
2413
2790
|
queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
|
|
2414
2791
|
queryFn: () => t({ limit: s, unreadOnly: a }),
|
|
2415
2792
|
enabled: !!t,
|
|
@@ -2417,8 +2794,8 @@ function rt(e = {}) {
|
|
|
2417
2794
|
refetchInterval: 3e4
|
|
2418
2795
|
});
|
|
2419
2796
|
}
|
|
2420
|
-
function
|
|
2421
|
-
const { onFetchNotifications: e, partnerSlug: t } =
|
|
2797
|
+
function gr() {
|
|
2798
|
+
const { onFetchNotifications: e, partnerSlug: t } = S(), { data: r, isLoading: s } = R({
|
|
2422
2799
|
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
2423
2800
|
queryFn: () => e({ limit: 1 }),
|
|
2424
2801
|
enabled: !!e,
|
|
@@ -2428,9 +2805,9 @@ function Ot() {
|
|
|
2428
2805
|
});
|
|
2429
2806
|
return { count: r ?? 0, isLoading: s };
|
|
2430
2807
|
}
|
|
2431
|
-
function
|
|
2432
|
-
const { onMarkNotificationRead: e, partnerSlug: t } =
|
|
2433
|
-
return
|
|
2808
|
+
function $t() {
|
|
2809
|
+
const { onMarkNotificationRead: e, partnerSlug: t } = S(), r = V();
|
|
2810
|
+
return G({
|
|
2434
2811
|
mutationFn: (s) => {
|
|
2435
2812
|
if (!e)
|
|
2436
2813
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
@@ -2439,20 +2816,20 @@ function st() {
|
|
|
2439
2816
|
onSuccess: (s, a) => {
|
|
2440
2817
|
r.setQueriesData(
|
|
2441
2818
|
{ queryKey: ["pitvox", "notifications", t] },
|
|
2442
|
-
(
|
|
2443
|
-
...
|
|
2444
|
-
unreadCount: Math.max(0, (
|
|
2445
|
-
notifications:
|
|
2446
|
-
(
|
|
2819
|
+
(o) => o != null && o.notifications ? {
|
|
2820
|
+
...o,
|
|
2821
|
+
unreadCount: Math.max(0, (o.unreadCount || 0) - 1),
|
|
2822
|
+
notifications: o.notifications.map(
|
|
2823
|
+
(i) => i.id === a ? { ...i, isRead: !0, readAt: (/* @__PURE__ */ new Date()).toISOString() } : i
|
|
2447
2824
|
)
|
|
2448
|
-
} :
|
|
2825
|
+
} : o
|
|
2449
2826
|
);
|
|
2450
2827
|
}
|
|
2451
2828
|
});
|
|
2452
2829
|
}
|
|
2453
|
-
function
|
|
2454
|
-
const { onMarkAllNotificationsRead: e, partnerSlug: t } =
|
|
2455
|
-
return
|
|
2830
|
+
function Tt() {
|
|
2831
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: t } = S(), r = V();
|
|
2832
|
+
return G({
|
|
2456
2833
|
mutationFn: () => {
|
|
2457
2834
|
if (!e)
|
|
2458
2835
|
throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
|
|
@@ -2474,7 +2851,7 @@ function at() {
|
|
|
2474
2851
|
}
|
|
2475
2852
|
});
|
|
2476
2853
|
}
|
|
2477
|
-
function
|
|
2854
|
+
function Rt({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
|
|
2478
2855
|
const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
2479
2856
|
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
|
|
2480
2857
|
t ? /* @__PURE__ */ n("img", { src: t, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
|
|
@@ -2487,7 +2864,7 @@ function it({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" })
|
|
|
2487
2864
|
] })
|
|
2488
2865
|
] });
|
|
2489
2866
|
}
|
|
2490
|
-
function
|
|
2867
|
+
function Mt() {
|
|
2491
2868
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2492
2869
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2493
2870
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -2495,7 +2872,7 @@ function ot() {
|
|
|
2495
2872
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2496
2873
|
] });
|
|
2497
2874
|
}
|
|
2498
|
-
function
|
|
2875
|
+
function Pt() {
|
|
2499
2876
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2500
2877
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2501
2878
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -2504,19 +2881,19 @@ function lt() {
|
|
|
2504
2881
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
2505
2882
|
] });
|
|
2506
2883
|
}
|
|
2507
|
-
function
|
|
2884
|
+
function Se() {
|
|
2508
2885
|
return /* @__PURE__ */ n("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
|
|
2509
2886
|
}
|
|
2510
|
-
function
|
|
2511
|
-
const [
|
|
2512
|
-
|
|
2513
|
-
if (!
|
|
2887
|
+
function Le({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: o }) {
|
|
2888
|
+
const [i, d] = E(!1), p = Ze(null);
|
|
2889
|
+
$e(() => {
|
|
2890
|
+
if (!i) return;
|
|
2514
2891
|
function u(v) {
|
|
2515
2892
|
p.current && !p.current.contains(v.target) && d(!1);
|
|
2516
2893
|
}
|
|
2517
2894
|
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
2518
|
-
}, [
|
|
2519
|
-
const c = s != null && s.length ? s.slice().sort((u, v) => v[
|
|
2895
|
+
}, [i]);
|
|
2896
|
+
const c = s != null && s.length ? s.slice().sort((u, v) => v[o] - u[o]) : null;
|
|
2520
2897
|
return /* @__PURE__ */ l(
|
|
2521
2898
|
"div",
|
|
2522
2899
|
{
|
|
@@ -2529,48 +2906,48 @@ function be({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: i })
|
|
|
2529
2906
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
2530
2907
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
|
|
2531
2908
|
] }),
|
|
2532
|
-
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${
|
|
2909
|
+
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${i ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, v) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2533
2910
|
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
|
|
2534
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[
|
|
2911
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[o] })
|
|
2535
2912
|
] }, v)) })
|
|
2536
2913
|
]
|
|
2537
2914
|
}
|
|
2538
2915
|
);
|
|
2539
2916
|
}
|
|
2540
|
-
function
|
|
2917
|
+
function Dt({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, className: a = "" }) {
|
|
2541
2918
|
if (!e) return null;
|
|
2542
|
-
const
|
|
2543
|
-
name:
|
|
2919
|
+
const o = e.trackBreakdown.map((p) => ({
|
|
2920
|
+
name: z(p.trackId, p.layout),
|
|
2544
2921
|
lapCount: p.lapCount
|
|
2545
|
-
})),
|
|
2546
|
-
name:
|
|
2922
|
+
})), i = e.carBreakdown.map((p) => ({
|
|
2923
|
+
name: I(p.carId),
|
|
2547
2924
|
lapCount: p.lapCount
|
|
2548
2925
|
})), d = Array.isArray(t) && t.length > 0;
|
|
2549
2926
|
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${a}`, children: [
|
|
2550
2927
|
/* @__PURE__ */ n(
|
|
2551
|
-
|
|
2928
|
+
Le,
|
|
2552
2929
|
{
|
|
2553
|
-
icon: /* @__PURE__ */ n(
|
|
2930
|
+
icon: /* @__PURE__ */ n(Mt, {}),
|
|
2554
2931
|
value: e.lapCount.toLocaleString(),
|
|
2555
2932
|
label: "Total Laps",
|
|
2556
|
-
items:
|
|
2933
|
+
items: o,
|
|
2557
2934
|
labelKey: "name",
|
|
2558
2935
|
countKey: "lapCount"
|
|
2559
2936
|
}
|
|
2560
2937
|
),
|
|
2561
2938
|
/* @__PURE__ */ n(
|
|
2562
|
-
|
|
2939
|
+
Le,
|
|
2563
2940
|
{
|
|
2564
|
-
icon: /* @__PURE__ */ n(
|
|
2941
|
+
icon: /* @__PURE__ */ n(Pt, {}),
|
|
2565
2942
|
value: e.carBreakdown.length,
|
|
2566
2943
|
label: "Cars Used",
|
|
2567
|
-
items:
|
|
2944
|
+
items: i,
|
|
2568
2945
|
labelKey: "name",
|
|
2569
2946
|
countKey: "lapCount"
|
|
2570
2947
|
}
|
|
2571
2948
|
),
|
|
2572
2949
|
d ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating-chips", children: [
|
|
2573
|
-
/* @__PURE__ */ n(
|
|
2950
|
+
/* @__PURE__ */ n(Se, {}),
|
|
2574
2951
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2575
2952
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2576
2953
|
/* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: t.map((p) => {
|
|
@@ -2602,7 +2979,7 @@ function ct({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, classN
|
|
|
2602
2979
|
}) })
|
|
2603
2980
|
] })
|
|
2604
2981
|
] }) : s ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2605
|
-
/* @__PURE__ */ n(
|
|
2982
|
+
/* @__PURE__ */ n(Se, {}),
|
|
2606
2983
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2607
2984
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: s.rating.toFixed(1) }),
|
|
2608
2985
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
@@ -2616,7 +2993,7 @@ function ct({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, classN
|
|
|
2616
2993
|
] }) : null
|
|
2617
2994
|
] });
|
|
2618
2995
|
}
|
|
2619
|
-
function
|
|
2996
|
+
function At({ combos: e, onComboSelect: t, className: r = "" }) {
|
|
2620
2997
|
return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
|
|
2621
2998
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2622
2999
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combos-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
@@ -2631,7 +3008,7 @@ function dt({ combos: e, onComboSelect: t, className: r = "" }) {
|
|
|
2631
3008
|
] })
|
|
2632
3009
|
] }) }),
|
|
2633
3010
|
/* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((s) => /* @__PURE__ */ n(
|
|
2634
|
-
|
|
3011
|
+
Et,
|
|
2635
3012
|
{
|
|
2636
3013
|
combo: s,
|
|
2637
3014
|
onClick: t ? () => t(s) : null
|
|
@@ -2640,7 +3017,7 @@ function dt({ combos: e, onComboSelect: t, className: r = "" }) {
|
|
|
2640
3017
|
)) })
|
|
2641
3018
|
] }) : null;
|
|
2642
3019
|
}
|
|
2643
|
-
function
|
|
3020
|
+
function Et({ combo: e, onClick: t }) {
|
|
2644
3021
|
const r = e.game || "evo", s = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
|
|
2645
3022
|
return /* @__PURE__ */ l(
|
|
2646
3023
|
"div",
|
|
@@ -2656,10 +3033,10 @@ function pt({ combo: e, onClick: t }) {
|
|
|
2656
3033
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-info", children: [
|
|
2657
3034
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-title", children: [
|
|
2658
3035
|
e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r}`, children: r.toUpperCase() }),
|
|
2659
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children:
|
|
3036
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: z(e.trackId, e.trackLayout, e.game) })
|
|
2660
3037
|
] }),
|
|
2661
3038
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-meta", children: [
|
|
2662
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children:
|
|
3039
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: I(e.carId) }),
|
|
2663
3040
|
e.lapCount > 0 && /* @__PURE__ */ l(B, { children: [
|
|
2664
3041
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2665
3042
|
/* @__PURE__ */ l("span", { children: [
|
|
@@ -2670,7 +3047,7 @@ function pt({ combo: e, onClick: t }) {
|
|
|
2670
3047
|
] }),
|
|
2671
3048
|
e.lastDrivenAt && /* @__PURE__ */ l(B, { children: [
|
|
2672
3049
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2673
|
-
/* @__PURE__ */ n("span", { children:
|
|
3050
|
+
/* @__PURE__ */ n("span", { children: pe(e.lastDrivenAt) })
|
|
2674
3051
|
] })
|
|
2675
3052
|
] })
|
|
2676
3053
|
] }),
|
|
@@ -2706,15 +3083,15 @@ function pt({ combo: e, onClick: t }) {
|
|
|
2706
3083
|
}
|
|
2707
3084
|
);
|
|
2708
3085
|
}
|
|
2709
|
-
function
|
|
3086
|
+
function Bt({ events: e, isLoading: t, className: r, limit: s = 3 }) {
|
|
2710
3087
|
if (t)
|
|
2711
3088
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2712
3089
|
if (!(e != null && e.length))
|
|
2713
3090
|
return null;
|
|
2714
|
-
const a = s ? e.slice(0, s) : e,
|
|
3091
|
+
const a = s ? e.slice(0, s) : e, o = e.length - a.length;
|
|
2715
3092
|
return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
|
|
2716
3093
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2717
|
-
/* @__PURE__ */ n(
|
|
3094
|
+
/* @__PURE__ */ n(It, {}),
|
|
2718
3095
|
"Upcoming Events",
|
|
2719
3096
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2720
3097
|
"(",
|
|
@@ -2723,67 +3100,67 @@ function ut({ events: e, isLoading: t, className: r, limit: s = 3 }) {
|
|
|
2723
3100
|
] })
|
|
2724
3101
|
] }) }),
|
|
2725
3102
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-list", children: [
|
|
2726
|
-
a.map((
|
|
3103
|
+
a.map((i) => /* @__PURE__ */ l(
|
|
2727
3104
|
"div",
|
|
2728
3105
|
{
|
|
2729
|
-
className: `pvx-upcoming-item ${
|
|
3106
|
+
className: `pvx-upcoming-item ${i.isNext ? "pvx-upcoming-item--next" : ""}`,
|
|
2730
3107
|
children: [
|
|
2731
3108
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-info", children: [
|
|
2732
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children:
|
|
3109
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children: i.competitionName }),
|
|
2733
3110
|
/* @__PURE__ */ l("span", { className: "pvx-upcoming-round", children: [
|
|
2734
3111
|
"Round ",
|
|
2735
|
-
|
|
3112
|
+
i.roundNumber,
|
|
2736
3113
|
": ",
|
|
2737
|
-
|
|
3114
|
+
i.track
|
|
2738
3115
|
] }),
|
|
2739
|
-
|
|
2740
|
-
|
|
3116
|
+
i.serverPassword && /* @__PURE__ */ n(
|
|
3117
|
+
Ut,
|
|
2741
3118
|
{
|
|
2742
|
-
password:
|
|
2743
|
-
address:
|
|
3119
|
+
password: i.serverPassword,
|
|
3120
|
+
address: i.serverAddress
|
|
2744
3121
|
}
|
|
2745
3122
|
)
|
|
2746
3123
|
] }),
|
|
2747
3124
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-time", children: [
|
|
2748
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(
|
|
3125
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(i.startTime).toLocaleDateString("en-GB", {
|
|
2749
3126
|
day: "numeric",
|
|
2750
3127
|
month: "short",
|
|
2751
3128
|
year: "numeric"
|
|
2752
3129
|
}) }),
|
|
2753
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children:
|
|
2754
|
-
|
|
2755
|
-
!
|
|
3130
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: i.dediStatus === "running" ? "Live now" : i.dediStatus === "provisioning" ? "Starting..." : _t(i.startTime) }),
|
|
3131
|
+
i.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
3132
|
+
!i.dediStatus && i.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2756
3133
|
] })
|
|
2757
3134
|
]
|
|
2758
3135
|
},
|
|
2759
|
-
`${
|
|
3136
|
+
`${i.competitionId}-${i.roundNumber}`
|
|
2760
3137
|
)),
|
|
2761
|
-
|
|
3138
|
+
o > 0 && /* @__PURE__ */ l("div", { className: "pvx-upcoming-remaining", children: [
|
|
2762
3139
|
"+",
|
|
2763
|
-
|
|
3140
|
+
o,
|
|
2764
3141
|
" more event",
|
|
2765
|
-
|
|
3142
|
+
o !== 1 ? "s" : ""
|
|
2766
3143
|
] })
|
|
2767
3144
|
] })
|
|
2768
3145
|
] });
|
|
2769
3146
|
}
|
|
2770
|
-
function
|
|
2771
|
-
const [r, s] = E(!1), [a,
|
|
2772
|
-
if (
|
|
3147
|
+
function Ut({ password: e, address: t }) {
|
|
3148
|
+
const [r, s] = E(!1), [a, o] = E(!1), i = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
|
|
3149
|
+
if (i)
|
|
2773
3150
|
try {
|
|
2774
|
-
await navigator.clipboard.writeText(
|
|
3151
|
+
await navigator.clipboard.writeText(i), s(!0), setTimeout(() => s(!1), 2e3);
|
|
2775
3152
|
} catch {
|
|
2776
3153
|
}
|
|
2777
|
-
}, [
|
|
3154
|
+
}, [i]);
|
|
2778
3155
|
return /* @__PURE__ */ l("div", { className: "pvx-server-info", children: [
|
|
2779
|
-
|
|
3156
|
+
i && /* @__PURE__ */ l(
|
|
2780
3157
|
"span",
|
|
2781
3158
|
{
|
|
2782
3159
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2783
3160
|
onClick: d,
|
|
2784
3161
|
title: "Copy join string to clipboard",
|
|
2785
3162
|
children: [
|
|
2786
|
-
/* @__PURE__ */ n(
|
|
3163
|
+
/* @__PURE__ */ n(qt, {}),
|
|
2787
3164
|
" ",
|
|
2788
3165
|
r ? "Copied!" : "Join"
|
|
2789
3166
|
]
|
|
@@ -2794,20 +3171,20 @@ function ht({ password: e, address: t }) {
|
|
|
2794
3171
|
"span",
|
|
2795
3172
|
{
|
|
2796
3173
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2797
|
-
onClick: () =>
|
|
3174
|
+
onClick: () => o((p) => !p),
|
|
2798
3175
|
title: a ? "Hide password" : "Reveal password",
|
|
2799
|
-
children: a ? /* @__PURE__ */ n(
|
|
3176
|
+
children: a ? /* @__PURE__ */ n(jt, {}) : /* @__PURE__ */ n(Wt, {})
|
|
2800
3177
|
}
|
|
2801
3178
|
),
|
|
2802
3179
|
a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
|
|
2803
|
-
/* @__PURE__ */ n(
|
|
3180
|
+
/* @__PURE__ */ n(Ft, {}),
|
|
2804
3181
|
" ",
|
|
2805
3182
|
e
|
|
2806
3183
|
] })
|
|
2807
3184
|
] })
|
|
2808
3185
|
] });
|
|
2809
3186
|
}
|
|
2810
|
-
function
|
|
3187
|
+
function _t(e) {
|
|
2811
3188
|
const t = new Date(e).getTime() - Date.now();
|
|
2812
3189
|
if (t <= 0) return "Now";
|
|
2813
3190
|
const r = Math.floor(t / (1e3 * 60 * 60));
|
|
@@ -2820,61 +3197,61 @@ function mt(e) {
|
|
|
2820
3197
|
const a = Math.floor(s / 7);
|
|
2821
3198
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2822
3199
|
}
|
|
2823
|
-
return
|
|
3200
|
+
return pe(e);
|
|
2824
3201
|
}
|
|
2825
|
-
function
|
|
3202
|
+
function It() {
|
|
2826
3203
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2827
3204
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2828
3205
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2829
3206
|
] });
|
|
2830
3207
|
}
|
|
2831
|
-
function
|
|
3208
|
+
function Ft() {
|
|
2832
3209
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2833
3210
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2834
3211
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2835
3212
|
] });
|
|
2836
3213
|
}
|
|
2837
|
-
function
|
|
3214
|
+
function qt() {
|
|
2838
3215
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2839
3216
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2840
3217
|
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2841
3218
|
] });
|
|
2842
3219
|
}
|
|
2843
|
-
function
|
|
3220
|
+
function Wt() {
|
|
2844
3221
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2845
3222
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2846
3223
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2847
3224
|
] });
|
|
2848
3225
|
}
|
|
2849
|
-
function
|
|
3226
|
+
function jt() {
|
|
2850
3227
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2851
3228
|
/* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
2852
3229
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2853
3230
|
] });
|
|
2854
3231
|
}
|
|
2855
|
-
function
|
|
2856
|
-
const
|
|
2857
|
-
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
3232
|
+
function Vt({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: o }) {
|
|
3233
|
+
const i = ue();
|
|
3234
|
+
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${o || ""}`, children: [
|
|
2858
3235
|
/* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
|
|
2859
3236
|
/* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2860
|
-
/* @__PURE__ */ n(
|
|
3237
|
+
/* @__PURE__ */ n(Ot, {}),
|
|
2861
3238
|
"Notifications",
|
|
2862
3239
|
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2863
3240
|
] }),
|
|
2864
3241
|
t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
|
|
2865
3242
|
] }),
|
|
2866
3243
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2867
|
-
|
|
3244
|
+
Kt,
|
|
2868
3245
|
{
|
|
2869
3246
|
notification: d,
|
|
2870
|
-
getUserDisplay:
|
|
3247
|
+
getUserDisplay: i,
|
|
2871
3248
|
onMarkRead: r
|
|
2872
3249
|
},
|
|
2873
3250
|
d.id
|
|
2874
3251
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2875
3252
|
] });
|
|
2876
3253
|
}
|
|
2877
|
-
function
|
|
3254
|
+
function Kt({ notification: e, getUserDisplay: t, onMarkRead: r }) {
|
|
2878
3255
|
const s = () => {
|
|
2879
3256
|
!e.isRead && r && r(e.id);
|
|
2880
3257
|
};
|
|
@@ -2884,17 +3261,17 @@ function yt({ notification: e, getUserDisplay: t, onMarkRead: r }) {
|
|
|
2884
3261
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2885
3262
|
onClick: s,
|
|
2886
3263
|
children: [
|
|
2887
|
-
/* @__PURE__ */ n(
|
|
3264
|
+
/* @__PURE__ */ n(Ht, { type: e.type }),
|
|
2888
3265
|
/* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
|
|
2889
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children:
|
|
2890
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children:
|
|
3266
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: an(e, t) }),
|
|
3267
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: pe(e.createdAt) })
|
|
2891
3268
|
] }),
|
|
2892
3269
|
!e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
|
|
2893
3270
|
]
|
|
2894
3271
|
}
|
|
2895
3272
|
);
|
|
2896
3273
|
}
|
|
2897
|
-
function
|
|
3274
|
+
function Ht({ type: e }) {
|
|
2898
3275
|
return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2899
3276
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2900
3277
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2907,25 +3284,25 @@ function kt({ type: e }) {
|
|
|
2907
3284
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2908
3285
|
] }) });
|
|
2909
3286
|
}
|
|
2910
|
-
function
|
|
3287
|
+
function Ot() {
|
|
2911
3288
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2912
3289
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2913
3290
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2914
3291
|
] });
|
|
2915
3292
|
}
|
|
2916
|
-
function
|
|
3293
|
+
function fr({
|
|
2917
3294
|
steamId: e,
|
|
2918
3295
|
avatarUrl: t,
|
|
2919
3296
|
memberSince: r,
|
|
2920
3297
|
hideProfile: s = !1,
|
|
2921
3298
|
onComboSelect: a,
|
|
2922
|
-
onGameRatingSelect:
|
|
2923
|
-
className:
|
|
3299
|
+
onGameRatingSelect: o,
|
|
3300
|
+
className: i = ""
|
|
2924
3301
|
}) {
|
|
2925
|
-
const { data: d, isLoading: p, error: c } =
|
|
2926
|
-
return p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : d ? /* @__PURE__ */ l("div", { className: `pvx-dash ${
|
|
3302
|
+
const { data: d, isLoading: p, error: c } = bt(e), { data: u } = kt(e), { data: v } = wt(e), { data: f, isLoading: h } = Ct(), y = St(), { data: x, isLoading: m } = Lt({ limit: 10 }), b = $t(), g = Tt();
|
|
3303
|
+
return p ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : c ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : d ? /* @__PURE__ */ l("div", { className: `pvx-dash ${i}`, children: [
|
|
2927
3304
|
!s && /* @__PURE__ */ n(
|
|
2928
|
-
|
|
3305
|
+
Rt,
|
|
2929
3306
|
{
|
|
2930
3307
|
driverName: d.driverName,
|
|
2931
3308
|
avatarUrl: t,
|
|
@@ -2933,33 +3310,33 @@ function Gt({
|
|
|
2933
3310
|
}
|
|
2934
3311
|
),
|
|
2935
3312
|
/* @__PURE__ */ n(
|
|
2936
|
-
|
|
3313
|
+
Dt,
|
|
2937
3314
|
{
|
|
2938
3315
|
stats: d,
|
|
2939
3316
|
gameRatings: u,
|
|
2940
|
-
onGameRatingSelect:
|
|
3317
|
+
onGameRatingSelect: o
|
|
2941
3318
|
}
|
|
2942
3319
|
),
|
|
2943
|
-
e && /* @__PURE__ */ n(
|
|
2944
|
-
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${
|
|
2945
|
-
/* @__PURE__ */ n(
|
|
2946
|
-
|
|
2947
|
-
|
|
3320
|
+
e && /* @__PURE__ */ n(Bt, { events: f, isLoading: h }),
|
|
3321
|
+
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${y ? "pvx-dash-row--2col" : ""}`, children: [
|
|
3322
|
+
/* @__PURE__ */ n(At, { combos: v, onComboSelect: a }),
|
|
3323
|
+
y && /* @__PURE__ */ n(
|
|
3324
|
+
Vt,
|
|
2948
3325
|
{
|
|
2949
|
-
notifications:
|
|
2950
|
-
unreadCount: (
|
|
2951
|
-
onMarkRead: (
|
|
2952
|
-
onMarkAllRead: () =>
|
|
2953
|
-
isLoading:
|
|
3326
|
+
notifications: x == null ? void 0 : x.notifications,
|
|
3327
|
+
unreadCount: (x == null ? void 0 : x.unreadCount) || 0,
|
|
3328
|
+
onMarkRead: (k) => b.mutate(k),
|
|
3329
|
+
onMarkAllRead: () => g.mutate(),
|
|
3330
|
+
isLoading: m
|
|
2954
3331
|
}
|
|
2955
3332
|
)
|
|
2956
3333
|
] })
|
|
2957
3334
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2958
3335
|
}
|
|
2959
|
-
function
|
|
3336
|
+
function Nr({ records: e, className: t = "" }) {
|
|
2960
3337
|
const r = T(() => e != null && e.length ? e.slice().sort((s, a) => {
|
|
2961
|
-
const
|
|
2962
|
-
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) -
|
|
3338
|
+
const o = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
|
|
3339
|
+
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - o;
|
|
2963
3340
|
}) : [], [e]);
|
|
2964
3341
|
return r.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
|
|
2965
3342
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
@@ -2980,8 +3357,8 @@ function zt({ records: e, className: t = "" }) {
|
|
|
2980
3357
|
] }) }),
|
|
2981
3358
|
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
|
|
2982
3359
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
|
|
2983
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children:
|
|
2984
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children:
|
|
3360
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: z(s.trackId, s.layout, s.game) }),
|
|
3361
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(s.carId) })
|
|
2985
3362
|
] }),
|
|
2986
3363
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
|
|
2987
3364
|
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(s.lapTimeMs) }),
|
|
@@ -2994,91 +3371,110 @@ function zt({ records: e, className: t = "" }) {
|
|
|
2994
3371
|
] }) : null;
|
|
2995
3372
|
}
|
|
2996
3373
|
export {
|
|
2997
|
-
|
|
2998
|
-
|
|
3374
|
+
ir as CarsTable,
|
|
3375
|
+
_ as CompEmptyState,
|
|
2999
3376
|
W as CompLoadingState,
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3377
|
+
at as CompetitionCard,
|
|
3378
|
+
dr as CompetitionCards,
|
|
3379
|
+
vr as CompetitionResultsTabs,
|
|
3380
|
+
On as CompletedBadge,
|
|
3381
|
+
Ue as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
3382
|
+
fr as DriverDashboard,
|
|
3383
|
+
Rt as DriverProfile,
|
|
3384
|
+
or as DriversTable,
|
|
3385
|
+
Fn as EnterButton,
|
|
3386
|
+
ur as EntryList,
|
|
3387
|
+
ae as InfoPill,
|
|
3388
|
+
lr as LapHistoryTable,
|
|
3389
|
+
Vt as NotificationsCard,
|
|
3390
|
+
xe as PODIUM_MEDALS,
|
|
3391
|
+
xn as PROMOTION_STATUS_LABELS,
|
|
3392
|
+
Zt as PitVoxPartnerProvider,
|
|
3393
|
+
In as PromotionCard,
|
|
3394
|
+
_n as PromotionCards,
|
|
3395
|
+
qn as PromotionDetail,
|
|
3396
|
+
sr as PromotionExplorer,
|
|
3397
|
+
Ie as PromotionStatusBadge,
|
|
3398
|
+
Fe as PromotionTypeBadge,
|
|
3399
|
+
ut as RacePositionsChart,
|
|
3400
|
+
cr as RankingsTable,
|
|
3401
|
+
At as RecentCombosCard,
|
|
3402
|
+
Nr as RecordsTable,
|
|
3403
|
+
hr as RegisterButton,
|
|
3404
|
+
mr as RegistrationPanel,
|
|
3405
|
+
pr as RoundResults,
|
|
3406
|
+
ye as RoundSessionResults,
|
|
3407
|
+
lt as StandingsTable,
|
|
3408
|
+
Dt as StatsCards,
|
|
3409
|
+
ar as TracksTable,
|
|
3410
|
+
Rn as TypeBadge,
|
|
3411
|
+
Bt as UpcomingEvents,
|
|
3412
|
+
st as WeatherIcon,
|
|
3413
|
+
Te as buildDriverIndexPath,
|
|
3414
|
+
rn as buildLapsPath,
|
|
3415
|
+
de as buildLeaderboardPath,
|
|
3416
|
+
sn as buildRecentLapsPath,
|
|
3417
|
+
M as fetchCdnJson,
|
|
3418
|
+
rr as filterCompetitionsByStatus,
|
|
3419
|
+
I as formatCarName,
|
|
3420
|
+
Q as formatDate,
|
|
3421
|
+
Jt as formatDelta,
|
|
3422
|
+
Me as formatFuel,
|
|
3038
3423
|
q as formatLapTime,
|
|
3039
|
-
|
|
3040
|
-
|
|
3424
|
+
an as formatNotificationMessage,
|
|
3425
|
+
K as formatPromotionDate,
|
|
3426
|
+
pe as formatRelativeTime,
|
|
3041
3427
|
F as formatSectorTime,
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3428
|
+
X as formatSessionLabel,
|
|
3429
|
+
z as formatTrackName,
|
|
3430
|
+
Re as formatTyreCompound,
|
|
3431
|
+
En as getCompetitionPodium,
|
|
3432
|
+
_e as getCompetitionStatus,
|
|
3433
|
+
An as getCompletionDate,
|
|
3434
|
+
J as getPromotionStatus,
|
|
3435
|
+
Dn as isCompetitionComplete,
|
|
3436
|
+
O as isRoundClosed,
|
|
3437
|
+
Un as promotionWindowSummary,
|
|
3438
|
+
nr as useCarLeaderboard,
|
|
3439
|
+
Xt as useCarMetadata,
|
|
3440
|
+
pn as useCompetitionAllRounds,
|
|
3441
|
+
Pe as useCompetitionConfig,
|
|
3442
|
+
Ae as useCompetitionEntryList,
|
|
3443
|
+
un as useCompetitionLeaderboard,
|
|
3444
|
+
dn as useCompetitionRound,
|
|
3445
|
+
mn as useCompetitionRoundLaps,
|
|
3446
|
+
hn as useCompetitionRoundLeaderboard,
|
|
3447
|
+
vn as useCompetitionRoundPositions,
|
|
3448
|
+
De as useCompetitionStandings,
|
|
3449
|
+
tr as useCompetitions,
|
|
3450
|
+
wt as useDriverCombos,
|
|
3451
|
+
cn as useDriverLaps,
|
|
3452
|
+
xr as useDriverRating,
|
|
3453
|
+
ie as useDriverRatings,
|
|
3454
|
+
kt as useDriverRatingsByGame,
|
|
3455
|
+
bt as useDriverStats,
|
|
3456
|
+
bn as useEnterPromotion,
|
|
3457
|
+
on as useLeaderboardIndex,
|
|
3458
|
+
Tt as useMarkAllNotificationsRead,
|
|
3459
|
+
$t as useMarkNotificationRead,
|
|
3460
|
+
Lt as useNotifications,
|
|
3461
|
+
St as useNotificationsEnabled,
|
|
3462
|
+
S as usePitVox,
|
|
3463
|
+
fn as usePromotionConfig,
|
|
3464
|
+
Nn as usePromotionEntryList,
|
|
3465
|
+
yn as usePromotionEntryStatus,
|
|
3466
|
+
kn as usePromotionMode,
|
|
3467
|
+
Cn as usePromotionUrl,
|
|
3468
|
+
gn as usePromotions,
|
|
3469
|
+
er as useRecentLaps,
|
|
3470
|
+
Ee as useRegister,
|
|
3471
|
+
me as useRegistrationMode,
|
|
3472
|
+
he as useRegistrationStatus,
|
|
3473
|
+
ve as useRegistrationUrl,
|
|
3474
|
+
ln as useTrackLeaderboard,
|
|
3475
|
+
gr as useUnreadCount,
|
|
3476
|
+
Ct as useUpcomingEvents,
|
|
3477
|
+
ue as useUserLookup,
|
|
3478
|
+
Be as useWithdraw,
|
|
3479
|
+
wn as useWithdrawPromotionEntry
|
|
3084
3480
|
};
|