@pitvox/partner-react 0.7.20 → 0.7.21
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/dist/index.cjs +1 -1
- package/dist/index.js +1238 -1179
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
import { jsx as n, jsxs as l, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as H, QueryClient as
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
function
|
|
2
|
+
import { createContext as je, useMemo as $, useContext as Ve, useState as B, useCallback as K, useRef as Ke, useEffect as He } from "react";
|
|
3
|
+
import { useQueryClient as H, QueryClient as We, QueryClientProvider as Oe, useQuery as M, useMutation as Q, useQueries as xe } from "@tanstack/react-query";
|
|
4
|
+
const ae = je(null), ze = "https://cdn.pitvox.com", Qe = "https://pitvox.com";
|
|
5
|
+
let te = null;
|
|
6
|
+
function vt({
|
|
7
7
|
partnerSlug: e = null,
|
|
8
|
-
cdnUrl:
|
|
9
|
-
pitvoxUrl:
|
|
10
|
-
getSteamId:
|
|
8
|
+
cdnUrl: t = ze,
|
|
9
|
+
pitvoxUrl: s = Qe,
|
|
10
|
+
getSteamId: r,
|
|
11
11
|
onRegister: a,
|
|
12
12
|
onWithdraw: i,
|
|
13
13
|
onFetchNotifications: o,
|
|
14
14
|
onMarkNotificationRead: d,
|
|
15
15
|
onMarkAllNotificationsRead: p,
|
|
16
16
|
onFetchServerPassword: c,
|
|
17
|
-
children:
|
|
17
|
+
children: u
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const v = $(() => ({
|
|
20
20
|
partnerSlug: e,
|
|
21
|
-
cdnUrl:
|
|
22
|
-
pitvoxUrl:
|
|
23
|
-
getSteamId:
|
|
21
|
+
cdnUrl: t.replace(/\/$/, ""),
|
|
22
|
+
pitvoxUrl: s.replace(/\/$/, ""),
|
|
23
|
+
getSteamId: r || (() => null),
|
|
24
24
|
onRegister: a || null,
|
|
25
25
|
onWithdraw: i || null,
|
|
26
26
|
onFetchNotifications: o || null,
|
|
27
27
|
onMarkNotificationRead: d || null,
|
|
28
28
|
onMarkAllNotificationsRead: p || null,
|
|
29
29
|
onFetchServerPassword: c || null
|
|
30
|
-
}), [e,
|
|
30
|
+
}), [e, t, s, r, a, i, o, d, p, c]);
|
|
31
31
|
let f = !1;
|
|
32
32
|
try {
|
|
33
33
|
H(), f = !0;
|
|
34
34
|
} catch {
|
|
35
35
|
f = !1;
|
|
36
36
|
}
|
|
37
|
-
return f ? /* @__PURE__ */ n(
|
|
37
|
+
return f ? /* @__PURE__ */ n(ae.Provider, { value: v, children: u }) : (te || (te = new We({
|
|
38
38
|
defaultOptions: {
|
|
39
39
|
queries: { staleTime: 6e4 }
|
|
40
40
|
}
|
|
41
|
-
})), /* @__PURE__ */ n(
|
|
41
|
+
})), /* @__PURE__ */ n(Oe, { client: te, children: /* @__PURE__ */ n(ae.Provider, { value: v, children: u }) }));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const e =
|
|
43
|
+
function C() {
|
|
44
|
+
const e = Ve(ae);
|
|
45
45
|
if (!e)
|
|
46
46
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
47
|
return e;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
throw new Error(`CDN fetch failed: ${
|
|
49
|
+
async function D(e, t) {
|
|
50
|
+
const s = await fetch(`${e}/${t}`);
|
|
51
|
+
if (!s.ok) {
|
|
52
|
+
if (s.status === 404 || s.status === 403) return null;
|
|
53
|
+
throw new Error(`CDN fetch failed: ${s.status}`);
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return s.json();
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function ie(e, t, s, ...r) {
|
|
58
58
|
const a = ["leaderboards"];
|
|
59
|
-
return e && a.push(`partners/${e}`),
|
|
59
|
+
return e && a.push(`partners/${e}`), t && a.push(t), s && a.push(`v/${s}`), [...a, ...r].join("/");
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const a =
|
|
63
|
-
return e ? `laps/partners/${e}/${
|
|
61
|
+
function Ge(e, t, s, r) {
|
|
62
|
+
const a = r || "default";
|
|
63
|
+
return e ? `laps/partners/${e}/${t}/${s}/${a}.json` : `laps/${t}/${s}/${a}.json`;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return e ? `laps/partners/${e}/${
|
|
65
|
+
function ye(e, t) {
|
|
66
|
+
return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Ye(e) {
|
|
69
69
|
return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
|
|
70
70
|
}
|
|
71
71
|
function q(e) {
|
|
72
72
|
if (!e && e !== 0) return "-";
|
|
73
|
-
const
|
|
74
|
-
return `${
|
|
73
|
+
const t = Math.floor(e / 1e3), s = Math.floor(t / 60), r = t % 60, a = e % 1e3;
|
|
74
|
+
return `${s}:${String(r).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
|
|
75
75
|
}
|
|
76
76
|
function E(e) {
|
|
77
77
|
return !e && e !== 0 ? "-" : e >= 6e4 ? q(e) : (e / 1e3).toFixed(3);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function I(e) {
|
|
80
80
|
if (!e) return "";
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let t = e;
|
|
82
|
+
return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
|
|
83
83
|
}
|
|
84
|
-
function j(e,
|
|
84
|
+
function j(e, t, s) {
|
|
85
85
|
if (!e) return "";
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
const i =
|
|
89
|
-
return `${
|
|
86
|
+
const r = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (t == null ? void 0 : t.toLowerCase()) === "track config";
|
|
87
|
+
if (!t || t === "default" || a) return r;
|
|
88
|
+
const i = t.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
|
|
89
|
+
return `${r} ${i}`;
|
|
90
90
|
}
|
|
91
91
|
function W(e) {
|
|
92
92
|
if (!e) return "-";
|
|
@@ -100,25 +100,25 @@ function W(e) {
|
|
|
100
100
|
return "-";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function oe(e) {
|
|
104
104
|
if (!e) return "";
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const a = Math.floor(
|
|
105
|
+
const t = Date.now() - new Date(e).getTime(), s = Math.floor(t / 1e3);
|
|
106
|
+
if (s < 60) return "Just now";
|
|
107
|
+
const r = Math.floor(s / 60);
|
|
108
|
+
if (r < 60) return `${r}m ago`;
|
|
109
|
+
const a = Math.floor(r / 60);
|
|
110
110
|
if (a < 24) return `${a}h ago`;
|
|
111
111
|
const i = Math.floor(a / 24);
|
|
112
112
|
return i < 30 ? `${i}d ago` : W(e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function xt(e) {
|
|
115
115
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const { type:
|
|
119
|
-
return
|
|
117
|
+
function Je(e, t) {
|
|
118
|
+
const { type: s, title: r, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? j(a, i, d) : null, v = o ? I(o) : null, f = [u, v].filter(Boolean).join(" — ");
|
|
119
|
+
return s === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : s === "RECORD_SET" && f ? `You set a new record on ${f}` : r || "New notification";
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ke(e) {
|
|
122
122
|
return e ? {
|
|
123
123
|
E: "Eco",
|
|
124
124
|
RD: "Road",
|
|
@@ -132,241 +132,250 @@ function be(e) {
|
|
|
132
132
|
S: "Soft"
|
|
133
133
|
}[e] || e : "Unknown";
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function we(e) {
|
|
136
136
|
if (!e) return "-";
|
|
137
|
-
const
|
|
138
|
-
return isNaN(
|
|
139
|
-
}
|
|
140
|
-
function
|
|
141
|
-
var p, c,
|
|
142
|
-
const { cdnUrl:
|
|
143
|
-
queryKey: ["pitvox", "leaderboards",
|
|
144
|
-
queryFn: () =>
|
|
137
|
+
const t = Number(e);
|
|
138
|
+
return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
|
|
139
|
+
}
|
|
140
|
+
function Ze(e = {}) {
|
|
141
|
+
var p, c, u, v, f, h;
|
|
142
|
+
const { cdnUrl: t, partnerSlug: s } = C(), { game: r, gameVersion: a } = e, i = ie(s, null, null, "index.json"), o = M({
|
|
143
|
+
queryKey: ["pitvox", "leaderboards", s, "index"],
|
|
144
|
+
queryFn: () => D(t, i),
|
|
145
145
|
staleTime: 3e4,
|
|
146
146
|
refetchInterval: 3e4
|
|
147
147
|
}), d = $(() => {
|
|
148
148
|
var x;
|
|
149
149
|
if (!((x = o.data) != null && x.tracks)) return [];
|
|
150
|
-
let
|
|
151
|
-
return
|
|
152
|
-
id:
|
|
153
|
-
layout:
|
|
154
|
-
game:
|
|
155
|
-
gameVersion:
|
|
156
|
-
displayName: j(
|
|
157
|
-
driverCount:
|
|
158
|
-
carCount:
|
|
159
|
-
record:
|
|
160
|
-
visibleId:
|
|
161
|
-
carId:
|
|
162
|
-
carDisplayName:
|
|
163
|
-
lapTimeMs:
|
|
164
|
-
timestamp:
|
|
150
|
+
let k = o.data.tracks;
|
|
151
|
+
return r && (k = k.filter((g) => g.game === r)), a && (k = k.filter((g) => g.gameVersion === a)), k.map((g) => ({
|
|
152
|
+
id: g.trackId,
|
|
153
|
+
layout: g.layout,
|
|
154
|
+
game: g.game,
|
|
155
|
+
gameVersion: g.gameVersion,
|
|
156
|
+
displayName: j(g.trackId, g.layout, g.game),
|
|
157
|
+
driverCount: g.driverCount || 0,
|
|
158
|
+
carCount: g.carCount || 0,
|
|
159
|
+
record: g.recordHolder ? {
|
|
160
|
+
visibleId: g.recordHolder.steamId || g.recordHolder.userId,
|
|
161
|
+
carId: g.recordHolder.carId,
|
|
162
|
+
carDisplayName: I(g.recordHolder.carId),
|
|
163
|
+
lapTimeMs: g.recordHolder.lapTimeMs,
|
|
164
|
+
timestamp: g.recordHolder.recordedAt
|
|
165
165
|
} : null,
|
|
166
|
-
recordByTag:
|
|
166
|
+
recordByTag: g.recordByTag || null
|
|
167
167
|
}));
|
|
168
|
-
}, [(p = o.data) == null ? void 0 : p.tracks,
|
|
168
|
+
}, [(p = o.data) == null ? void 0 : p.tracks, r, a]);
|
|
169
169
|
return {
|
|
170
170
|
...o,
|
|
171
171
|
data: d,
|
|
172
172
|
partner: ((c = o.data) == null ? void 0 : c.partner) || null,
|
|
173
|
-
generatedAt: (
|
|
174
|
-
totalLaps: ((
|
|
173
|
+
generatedAt: (u = o.data) == null ? void 0 : u.generatedAt,
|
|
174
|
+
totalLaps: ((v = o.data) == null ? void 0 : v.totalLaps) || 0,
|
|
175
175
|
totalUsers: ((f = o.data) == null ? void 0 : f.totalUsers) || 0,
|
|
176
|
-
versions: ((
|
|
176
|
+
versions: ((h = o.data) == null ? void 0 : h.versions) || {}
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
const { cdnUrl:
|
|
179
|
+
function Xe(e, t, s = {}) {
|
|
180
|
+
const { cdnUrl: r, partnerSlug: a } = C(), { carId: i, game: o, gameVersion: d } = s, p = t || "default", c = ie(a, o, d, `tracks/${e}/${p}.json`), { data: u, isLoading: v, error: f } = M({
|
|
181
181
|
queryKey: ["pitvox", "leaderboards", a, "track", e, p, o, d],
|
|
182
|
-
queryFn: () =>
|
|
182
|
+
queryFn: () => D(r, c),
|
|
183
183
|
enabled: !!e,
|
|
184
184
|
staleTime: 3e4,
|
|
185
185
|
refetchInterval: 3e4
|
|
186
186
|
});
|
|
187
187
|
return { data: $(() => {
|
|
188
|
-
if (!(
|
|
189
|
-
let
|
|
190
|
-
if (o && (
|
|
191
|
-
const x = /* @__PURE__ */ new Map(),
|
|
192
|
-
for (const
|
|
193
|
-
const m =
|
|
194
|
-
|
|
188
|
+
if (!(u != null && u.entries)) return [];
|
|
189
|
+
let k = u.entries;
|
|
190
|
+
if (o && (k = k.filter((x) => x.game === o)), !i) {
|
|
191
|
+
const x = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const y of k) {
|
|
193
|
+
const m = y.steamId || y.userId;
|
|
194
|
+
g.has(y.carId) || g.set(y.carId, /* @__PURE__ */ new Set()), g.get(y.carId).add(m), (!x.has(y.carId) || y.lapTimeMs < x.get(y.carId).lapTimeMs) && x.set(y.carId, y);
|
|
195
195
|
}
|
|
196
|
-
return Array.from(x.values()).map((
|
|
196
|
+
return Array.from(x.values()).map((y) => {
|
|
197
197
|
var m;
|
|
198
|
-
return { ...
|
|
199
|
-
}).sort((
|
|
198
|
+
return { ...y, driverCount: ((m = g.get(y.carId)) == null ? void 0 : m.size) || 0 };
|
|
199
|
+
}).sort((y, m) => y.lapTimeMs - m.lapTimeMs);
|
|
200
200
|
}
|
|
201
|
-
return
|
|
202
|
-
}, [
|
|
203
|
-
}
|
|
204
|
-
function
|
|
205
|
-
var x,
|
|
206
|
-
const { cdnUrl: i, partnerSlug: o } =
|
|
207
|
-
queryKey: ["pitvox", "laps", o, e,
|
|
208
|
-
queryFn: () =>
|
|
209
|
-
enabled: !!e && !!
|
|
201
|
+
return k.filter((x) => x.carId === i).sort((x, g) => x.lapTimeMs - g.lapTimeMs);
|
|
202
|
+
}, [u == null ? void 0 : u.entries, i, o]), isLoading: v, error: f };
|
|
203
|
+
}
|
|
204
|
+
function en(e, t, s, r, a = {}) {
|
|
205
|
+
var x, g;
|
|
206
|
+
const { cdnUrl: i, partnerSlug: o } = C(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && t ? Ge(o, e, t, s) : null, f = M({
|
|
207
|
+
queryKey: ["pitvox", "laps", o, e, t, s || "default"],
|
|
208
|
+
queryFn: () => D(i, u),
|
|
209
|
+
enabled: !!e && !!t,
|
|
210
210
|
staleTime: 3e4,
|
|
211
211
|
refetchInterval: 3e4
|
|
212
|
-
}),
|
|
213
|
-
var
|
|
214
|
-
return (
|
|
215
|
-
}, [(x = f.data) == null ? void 0 : x.laps,
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const m = Math.min(...
|
|
219
|
-
return
|
|
220
|
-
}, [
|
|
212
|
+
}), h = $(() => {
|
|
213
|
+
var y;
|
|
214
|
+
return (y = f.data) != null && y.laps ? f.data.laps.filter((m) => !(m.carId !== r || p && m.game !== p || c && m.gameVersion !== c || !d && !m.isValid)).sort((m, w) => m.lapTimeMs - w.lapTimeMs) : [];
|
|
215
|
+
}, [(x = f.data) == null ? void 0 : x.laps, r, p, c, d]), k = $(() => {
|
|
216
|
+
const y = h.filter((N) => N.isValid && N.sector1Ms && N.sector2Ms && N.sector3Ms);
|
|
217
|
+
if (y.length < 2) return null;
|
|
218
|
+
const m = Math.min(...y.map((N) => N.sector1Ms)), w = Math.min(...y.map((N) => N.sector2Ms)), S = Math.min(...y.map((N) => N.sector3Ms)), R = m + w + S, T = Math.min(...y.map((N) => N.lapTimeMs));
|
|
219
|
+
return R >= T ? null : { lapTimeMs: R, sector1Ms: m, sector2Ms: w, sector3Ms: S };
|
|
220
|
+
}, [h]);
|
|
221
221
|
return {
|
|
222
222
|
...f,
|
|
223
|
-
data:
|
|
224
|
-
driverName: ((
|
|
225
|
-
theoreticalBest:
|
|
223
|
+
data: h,
|
|
224
|
+
driverName: ((g = f.data) == null ? void 0 : g.driverName) || "Driver",
|
|
225
|
+
theoreticalBest: k
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const { cdnUrl: e } =
|
|
228
|
+
function Ce() {
|
|
229
|
+
const { cdnUrl: e } = C(), { data: t } = M({
|
|
230
230
|
queryKey: ["pitvox", "users", "index"],
|
|
231
|
-
queryFn: () =>
|
|
231
|
+
queryFn: () => D(e, "users/index.json"),
|
|
232
232
|
staleTime: 5 * 6e4,
|
|
233
233
|
gcTime: 30 * 6e4
|
|
234
|
-
}),
|
|
235
|
-
return (
|
|
236
|
-
const i =
|
|
234
|
+
}), s = (t == null ? void 0 : t.users) || {};
|
|
235
|
+
return (r, a) => {
|
|
236
|
+
const i = s[r];
|
|
237
237
|
return {
|
|
238
|
-
displayName: (i == null ? void 0 : i.displayName) || a ||
|
|
238
|
+
displayName: (i == null ? void 0 : i.displayName) || a || r || "Unknown",
|
|
239
239
|
avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
|
|
240
240
|
affiliations: (i == null ? void 0 : i.affiliations) || []
|
|
241
241
|
};
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
const { cdnUrl:
|
|
244
|
+
function gt(e = "evo") {
|
|
245
|
+
const { cdnUrl: t } = C(), { data: s } = M({
|
|
246
246
|
queryKey: ["pitvox", "cars", e],
|
|
247
|
-
queryFn: () =>
|
|
247
|
+
queryFn: () => D(t, `cars/${e}.json`),
|
|
248
248
|
staleTime: 5 * 6e4,
|
|
249
249
|
gcTime: 30 * 6e4
|
|
250
250
|
});
|
|
251
251
|
return {
|
|
252
|
-
tags: (
|
|
253
|
-
cars: (
|
|
254
|
-
categories: (
|
|
255
|
-
tagLabels: (
|
|
252
|
+
tags: (s == null ? void 0 : s.tags) || [],
|
|
253
|
+
cars: (s == null ? void 0 : s.cars) || {},
|
|
254
|
+
categories: (s == null ? void 0 : s.categories) || [],
|
|
255
|
+
tagLabels: (s == null ? void 0 : s.tagLabels) || {}
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function ft() {
|
|
259
259
|
var a, i;
|
|
260
|
-
const { cdnUrl: e, partnerSlug:
|
|
261
|
-
queryKey: ["pitvox", "recentLaps",
|
|
262
|
-
queryFn: () =>
|
|
260
|
+
const { cdnUrl: e, partnerSlug: t } = C(), s = Ye(t), r = M({
|
|
261
|
+
queryKey: ["pitvox", "recentLaps", t],
|
|
262
|
+
queryFn: () => D(e, s),
|
|
263
263
|
staleTime: 3e4,
|
|
264
264
|
refetchInterval: 3e4,
|
|
265
265
|
gcTime: 10 * 6e4
|
|
266
266
|
});
|
|
267
267
|
return {
|
|
268
|
-
groups: ((a =
|
|
269
|
-
generatedAt: ((i =
|
|
270
|
-
isLoading:
|
|
268
|
+
groups: ((a = r.data) == null ? void 0 : a.groups) || [],
|
|
269
|
+
generatedAt: ((i = r.data) == null ? void 0 : i.generatedAt) || null,
|
|
270
|
+
isLoading: r.isLoading
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
273
|
+
function Nt(e, t) {
|
|
274
|
+
return Xe(e, null, { carId: t });
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const { cdnUrl: e, partnerSlug:
|
|
278
|
-
return
|
|
279
|
-
queryKey: ["pitvox", "competitions",
|
|
276
|
+
function bt() {
|
|
277
|
+
const { cdnUrl: e, partnerSlug: t } = C();
|
|
278
|
+
return M({
|
|
279
|
+
queryKey: ["pitvox", "competitions", t],
|
|
280
280
|
queryFn: async () => {
|
|
281
|
-
const
|
|
282
|
-
return
|
|
281
|
+
const s = await D(e, "competitions/index.json");
|
|
282
|
+
return s != null && s.competitions ? t ? s.competitions.filter((r) => r.partnerSlug === t) : s.competitions : [];
|
|
283
283
|
},
|
|
284
284
|
staleTime: 6e4
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
queryKey: ["pitvox", "competition",
|
|
291
|
-
queryFn: () =>
|
|
292
|
-
enabled: !!
|
|
287
|
+
function Le(e, t = {}) {
|
|
288
|
+
const s = C(), r = t.partnerSlug || s.partnerSlug;
|
|
289
|
+
return M({
|
|
290
|
+
queryKey: ["pitvox", "competition", r, e, "config"],
|
|
291
|
+
queryFn: () => D(s.cdnUrl, `competitions/${r}/${e}/config.json`),
|
|
292
|
+
enabled: !!r && !!e,
|
|
293
293
|
staleTime: 6e4
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
return
|
|
299
|
-
queryKey: ["pitvox", "competition",
|
|
300
|
-
queryFn: () =>
|
|
301
|
-
enabled: !!
|
|
296
|
+
function Se(e, t = {}) {
|
|
297
|
+
const s = C(), r = t.partnerSlug || s.partnerSlug;
|
|
298
|
+
return M({
|
|
299
|
+
queryKey: ["pitvox", "competition", r, e, "standings"],
|
|
300
|
+
queryFn: () => D(s.cdnUrl, `competitions/${r}/${e}/standings.json`),
|
|
301
|
+
enabled: !!r && !!e,
|
|
302
302
|
staleTime: 6e4
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
const
|
|
307
|
-
return
|
|
308
|
-
queryKey: ["pitvox", "competition", a, e, "round",
|
|
309
|
-
queryFn: () =>
|
|
310
|
-
enabled: !!a && !!e &&
|
|
305
|
+
function nn(e, t, s = {}) {
|
|
306
|
+
const r = C(), a = s.partnerSlug || r.partnerSlug;
|
|
307
|
+
return M({
|
|
308
|
+
queryKey: ["pitvox", "competition", a, e, "round", t],
|
|
309
|
+
queryFn: () => D(r.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
|
|
310
|
+
enabled: !!a && !!e && t != null,
|
|
311
311
|
staleTime: 6e4
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
return
|
|
317
|
-
queryKey: ["pitvox", "competition", a, e, "allRounds",
|
|
314
|
+
function tn(e, t = [], s = {}) {
|
|
315
|
+
const r = C(), a = s.partnerSlug || r.partnerSlug;
|
|
316
|
+
return M({
|
|
317
|
+
queryKey: ["pitvox", "competition", a, e, "allRounds", t],
|
|
318
318
|
queryFn: async () => (await Promise.all(
|
|
319
|
-
|
|
320
|
-
(o) =>
|
|
319
|
+
t.map(
|
|
320
|
+
(o) => D(r.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
|
|
321
321
|
)
|
|
322
322
|
)).filter(Boolean),
|
|
323
|
-
enabled: !!a && !!e &&
|
|
323
|
+
enabled: !!a && !!e && t.length > 0,
|
|
324
324
|
staleTime: 6e4
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
const
|
|
329
|
-
return
|
|
330
|
-
queryKey: ["pitvox", "competition",
|
|
331
|
-
queryFn: () =>
|
|
332
|
-
enabled: !!
|
|
327
|
+
function sn(e, t = {}) {
|
|
328
|
+
const s = C(), r = t.partnerSlug || s.partnerSlug;
|
|
329
|
+
return M({
|
|
330
|
+
queryKey: ["pitvox", "competition", r, e, "leaderboard"],
|
|
331
|
+
queryFn: () => D(s.cdnUrl, `competitions/${r}/${e}/leaderboard.json`).catch(() => null),
|
|
332
|
+
enabled: !!r && !!e,
|
|
333
333
|
staleTime: 6e4
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
-
queryKey: ["pitvox", "competition", a, e, "round",
|
|
340
|
-
queryFn: () =>
|
|
341
|
-
enabled: !!a && !!e &&
|
|
336
|
+
function rn(e, t, s = {}) {
|
|
337
|
+
const r = C(), a = s.partnerSlug || r.partnerSlug;
|
|
338
|
+
return M({
|
|
339
|
+
queryKey: ["pitvox", "competition", a, e, "round", t, "leaderboard"],
|
|
340
|
+
queryFn: () => D(r.cdnUrl, `competitions/${a}/${e}/rounds/${t}/leaderboard.json`).catch(() => null),
|
|
341
|
+
enabled: !!a && !!e && t != null,
|
|
342
342
|
staleTime: 6e4
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
return
|
|
348
|
-
queryKey: ["pitvox", "competition", a, e, "round",
|
|
349
|
-
queryFn: () =>
|
|
350
|
-
enabled:
|
|
345
|
+
function an(e, t, s = {}) {
|
|
346
|
+
const r = C(), a = s.partnerSlug || r.partnerSlug;
|
|
347
|
+
return M({
|
|
348
|
+
queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
|
|
349
|
+
queryFn: () => D(r.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
|
|
350
|
+
enabled: !!a && !!e && t != null,
|
|
351
351
|
staleTime: 6e4
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
return
|
|
357
|
-
queryKey: ["pitvox", "competition",
|
|
358
|
-
queryFn: () =>
|
|
359
|
-
enabled:
|
|
354
|
+
function on(e, t, s = {}) {
|
|
355
|
+
const r = C(), a = s.partnerSlug || r.partnerSlug;
|
|
356
|
+
return M({
|
|
357
|
+
queryKey: ["pitvox", "competition", a, e, "round", t, "positions"],
|
|
358
|
+
queryFn: () => D(r.cdnUrl, `competitions/${a}/${e}/rounds/${t}/positions.json`).catch(() => null),
|
|
359
|
+
enabled: (s.enabled ?? !0) && !!a && !!e && t != null,
|
|
360
360
|
staleTime: 6e4
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
queryKey: ["pitvox", "
|
|
363
|
+
function $e(e, t = {}) {
|
|
364
|
+
const s = C(), r = t.partnerSlug || s.partnerSlug;
|
|
365
|
+
return M({
|
|
366
|
+
queryKey: ["pitvox", "competition", r, e, "entrylist"],
|
|
367
|
+
queryFn: () => D(s.cdnUrl, `competitions/${r}/${e}/entrylist.json`),
|
|
368
|
+
enabled: !!r && !!e,
|
|
369
|
+
staleTime: 6e4
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
function le(e) {
|
|
373
|
+
const { cdnUrl: t, partnerSlug: s, getSteamId: r } = C(), a = r();
|
|
374
|
+
return M({
|
|
375
|
+
queryKey: ["pitvox", "registration", s, e, a],
|
|
367
376
|
queryFn: async () => {
|
|
368
377
|
var p;
|
|
369
|
-
const i = await fetch(`${
|
|
378
|
+
const i = await fetch(`${t}/competitions/${s}/${e}/entrylist.json`);
|
|
370
379
|
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
371
380
|
const o = await i.json();
|
|
372
381
|
return { isRegistered: !!a && ((p = o.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: o };
|
|
@@ -375,20 +384,20 @@ function ae(e) {
|
|
|
375
384
|
staleTime: 6e4
|
|
376
385
|
});
|
|
377
386
|
}
|
|
378
|
-
function
|
|
379
|
-
const { onRegister:
|
|
387
|
+
function Re(e) {
|
|
388
|
+
const { onRegister: t, partnerSlug: s, getSteamId: r } = C(), a = H(), i = Ce();
|
|
380
389
|
return Q({
|
|
381
390
|
mutationFn: (o) => {
|
|
382
|
-
if (!
|
|
391
|
+
if (!t)
|
|
383
392
|
throw new Error(
|
|
384
393
|
"No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
|
|
385
394
|
);
|
|
386
|
-
return
|
|
395
|
+
return t(e, o);
|
|
387
396
|
},
|
|
388
397
|
onSuccess: () => {
|
|
389
|
-
const o =
|
|
398
|
+
const o = r();
|
|
390
399
|
if (a.setQueriesData(
|
|
391
|
-
{ queryKey: ["pitvox", "registration",
|
|
400
|
+
{ queryKey: ["pitvox", "registration", s, e] },
|
|
392
401
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
393
402
|
), o) {
|
|
394
403
|
const d = i(o), p = {
|
|
@@ -397,134 +406,134 @@ function Se(e) {
|
|
|
397
406
|
avatarUrl: d.avatarUrl
|
|
398
407
|
};
|
|
399
408
|
a.setQueriesData(
|
|
400
|
-
{ queryKey: ["pitvox", "competition",
|
|
409
|
+
{ queryKey: ["pitvox", "competition", s, e, "entrylist"] },
|
|
401
410
|
(c) => {
|
|
402
|
-
var
|
|
403
|
-
return c ? ((
|
|
411
|
+
var v;
|
|
412
|
+
return c ? ((v = c.drivers) == null ? void 0 : v.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
|
|
404
413
|
}
|
|
405
414
|
);
|
|
406
415
|
}
|
|
407
416
|
}
|
|
408
417
|
});
|
|
409
418
|
}
|
|
410
|
-
function
|
|
411
|
-
const { onWithdraw:
|
|
419
|
+
function Te(e) {
|
|
420
|
+
const { onWithdraw: t, partnerSlug: s, getSteamId: r } = C(), a = H();
|
|
412
421
|
return Q({
|
|
413
422
|
mutationFn: (i) => {
|
|
414
|
-
if (!
|
|
423
|
+
if (!t)
|
|
415
424
|
throw new Error(
|
|
416
425
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
417
426
|
);
|
|
418
|
-
const o = i ||
|
|
427
|
+
const o = i || r();
|
|
419
428
|
if (!o) throw new Error("No Steam ID available");
|
|
420
|
-
return
|
|
429
|
+
return t(e, o);
|
|
421
430
|
},
|
|
422
431
|
onSuccess: () => {
|
|
423
|
-
const i =
|
|
432
|
+
const i = r();
|
|
424
433
|
a.setQueriesData(
|
|
425
|
-
{ queryKey: ["pitvox", "registration",
|
|
434
|
+
{ queryKey: ["pitvox", "registration", s, e] },
|
|
426
435
|
(o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
427
436
|
), i && a.setQueriesData(
|
|
428
|
-
{ queryKey: ["pitvox", "competition",
|
|
437
|
+
{ queryKey: ["pitvox", "competition", s, e, "entrylist"] },
|
|
429
438
|
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
|
|
430
439
|
);
|
|
431
440
|
}
|
|
432
441
|
});
|
|
433
442
|
}
|
|
434
|
-
function
|
|
435
|
-
const { onRegister: e, onWithdraw:
|
|
436
|
-
return { isPowerMode:
|
|
443
|
+
function ce() {
|
|
444
|
+
const { onRegister: e, onWithdraw: t } = C(), s = !!(e && t);
|
|
445
|
+
return { isPowerMode: s, isBasicMode: !s };
|
|
437
446
|
}
|
|
438
|
-
function
|
|
439
|
-
const { pitvoxUrl:
|
|
440
|
-
return `${
|
|
447
|
+
function de(e) {
|
|
448
|
+
const { pitvoxUrl: t, partnerSlug: s } = C();
|
|
449
|
+
return `${t}/p/${s}/competitions/${e}/register`;
|
|
441
450
|
}
|
|
442
|
-
function
|
|
443
|
-
for (const
|
|
444
|
-
if (
|
|
451
|
+
function ln(e, t) {
|
|
452
|
+
for (const s of t)
|
|
453
|
+
if (s.tags.includes(e)) return s.id;
|
|
445
454
|
return "other";
|
|
446
455
|
}
|
|
447
|
-
function
|
|
448
|
-
if (
|
|
449
|
-
const
|
|
450
|
-
for (const a of
|
|
451
|
-
const i =
|
|
452
|
-
|
|
456
|
+
function Me(e, t, s = []) {
|
|
457
|
+
if (t.size === 0) return !0;
|
|
458
|
+
const r = {};
|
|
459
|
+
for (const a of t) {
|
|
460
|
+
const i = ln(a, s);
|
|
461
|
+
r[i] || (r[i] = []), r[i].push(a);
|
|
453
462
|
}
|
|
454
|
-
for (const a of Object.values(
|
|
463
|
+
for (const a of Object.values(r))
|
|
455
464
|
if (!a.some((i) => e.includes(i))) return !1;
|
|
456
465
|
return !0;
|
|
457
466
|
}
|
|
458
|
-
function
|
|
459
|
-
const [
|
|
467
|
+
function De(e, t) {
|
|
468
|
+
const [s, r] = B(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : s, o = K((p) => {
|
|
460
469
|
const c = new Set(i);
|
|
461
|
-
c.has(p) ? c.delete(p) : c.add(p), a &&
|
|
462
|
-
}, [i, a,
|
|
463
|
-
a &&
|
|
464
|
-
}, [a,
|
|
470
|
+
c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) : r(c);
|
|
471
|
+
}, [i, a, t]), d = K(() => {
|
|
472
|
+
a && t ? t(/* @__PURE__ */ new Set()) : r(/* @__PURE__ */ new Set());
|
|
473
|
+
}, [a, t]);
|
|
465
474
|
return { activeTags: i, toggle: o, clear: d };
|
|
466
475
|
}
|
|
467
476
|
function G(e) {
|
|
468
|
-
const [
|
|
469
|
-
|
|
477
|
+
const [t, s] = B(e), r = K((a) => {
|
|
478
|
+
s(
|
|
470
479
|
(i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
471
480
|
);
|
|
472
481
|
}, []);
|
|
473
|
-
return [
|
|
482
|
+
return [t, r];
|
|
474
483
|
}
|
|
475
|
-
function Y(e,
|
|
476
|
-
return [...e].sort((
|
|
477
|
-
const i =
|
|
484
|
+
function Y(e, t, s) {
|
|
485
|
+
return [...e].sort((r, a) => {
|
|
486
|
+
const i = s(r, t.key), o = s(a, t.key);
|
|
478
487
|
if (i == null && o == null) return 0;
|
|
479
488
|
if (i == null) return 1;
|
|
480
489
|
if (o == null) return -1;
|
|
481
490
|
const d = typeof i == "string" ? i.localeCompare(o) : i - o;
|
|
482
|
-
return
|
|
491
|
+
return t.dir === "desc" ? -d : d;
|
|
483
492
|
});
|
|
484
493
|
}
|
|
485
|
-
function
|
|
486
|
-
const
|
|
487
|
-
return
|
|
488
|
-
s1: Math.min(...
|
|
489
|
-
s2: Math.min(...
|
|
490
|
-
s3: Math.min(...
|
|
494
|
+
function Pe(e, t = !1) {
|
|
495
|
+
const s = t ? e == null ? void 0 : e.filter((r) => r.isValid) : e;
|
|
496
|
+
return s != null && s.length ? {
|
|
497
|
+
s1: Math.min(...s.map((r) => r.sector1Ms).filter(Boolean)),
|
|
498
|
+
s2: Math.min(...s.map((r) => r.sector2Ms).filter(Boolean)),
|
|
499
|
+
s3: Math.min(...s.map((r) => r.sector3Ms).filter(Boolean))
|
|
491
500
|
} : null;
|
|
492
501
|
}
|
|
493
|
-
function
|
|
494
|
-
return e ?
|
|
502
|
+
function cn({ active: e, dir: t }) {
|
|
503
|
+
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" }) });
|
|
495
504
|
}
|
|
496
|
-
function
|
|
505
|
+
function A({ label: e, sortKey: t, config: s, onSort: r, className: a = "" }) {
|
|
497
506
|
return /* @__PURE__ */ n(
|
|
498
507
|
"th",
|
|
499
508
|
{
|
|
500
509
|
className: `pvx-th pvx-th--sortable ${a}`,
|
|
501
|
-
onClick: () =>
|
|
510
|
+
onClick: () => r(t),
|
|
502
511
|
children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
|
|
503
512
|
e,
|
|
504
|
-
/* @__PURE__ */ n(
|
|
513
|
+
/* @__PURE__ */ n(cn, { active: s.key === t, dir: s.dir })
|
|
505
514
|
] })
|
|
506
515
|
}
|
|
507
516
|
);
|
|
508
517
|
}
|
|
509
|
-
function J({ userId: e, getUserDisplay:
|
|
510
|
-
const { displayName:
|
|
518
|
+
function J({ userId: e, getUserDisplay: t }) {
|
|
519
|
+
const { displayName: s, avatarUrl: r } = t(e);
|
|
511
520
|
return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
|
|
512
|
-
|
|
513
|
-
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children:
|
|
521
|
+
r ? /* @__PURE__ */ n("img", { src: r, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
522
|
+
/* @__PURE__ */ n("span", { className: "pvx-driver-name", children: s })
|
|
514
523
|
] });
|
|
515
524
|
}
|
|
516
|
-
function
|
|
517
|
-
return /* @__PURE__ */ n("span", { className:
|
|
525
|
+
function pe({ rank: e, podium: t = !1 }) {
|
|
526
|
+
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 });
|
|
518
527
|
}
|
|
519
|
-
function
|
|
528
|
+
function Ae({ availableTags: e, activeTags: t, onToggle: s, onClear: r, categories: a = [], tagLabels: i = {} }) {
|
|
520
529
|
if (!e || e.length < 2) return null;
|
|
521
530
|
const o = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
|
|
522
531
|
return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
|
|
523
532
|
/* @__PURE__ */ n(
|
|
524
533
|
"button",
|
|
525
534
|
{
|
|
526
|
-
onClick:
|
|
527
|
-
className: `pvx-tag ${
|
|
535
|
+
onClick: r,
|
|
536
|
+
className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
|
|
528
537
|
children: "All"
|
|
529
538
|
}
|
|
530
539
|
),
|
|
@@ -533,8 +542,8 @@ function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categori
|
|
|
533
542
|
d.tags.map((c) => /* @__PURE__ */ n(
|
|
534
543
|
"button",
|
|
535
544
|
{
|
|
536
|
-
onClick: () =>
|
|
537
|
-
className: `pvx-tag ${
|
|
545
|
+
onClick: () => s(c),
|
|
546
|
+
className: `pvx-tag ${t.has(c) ? "pvx-tag--active" : ""}`,
|
|
538
547
|
children: i[c] || c
|
|
539
548
|
},
|
|
540
549
|
c
|
|
@@ -542,13 +551,13 @@ function De({ availableTags: e, activeTags: r, onToggle: t, onClear: s, categori
|
|
|
542
551
|
] }, d.id))
|
|
543
552
|
] });
|
|
544
553
|
}
|
|
545
|
-
function
|
|
546
|
-
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((
|
|
547
|
-
const
|
|
554
|
+
function ue({ segments: e }) {
|
|
555
|
+
return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, s) => {
|
|
556
|
+
const r = s === e.length - 1;
|
|
548
557
|
return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
|
|
549
|
-
|
|
550
|
-
!
|
|
551
|
-
] },
|
|
558
|
+
s > 0 && /* @__PURE__ */ n("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
|
|
559
|
+
!r && t.onClick ? /* @__PURE__ */ n("button", { onClick: t.onClick, className: "pvx-breadcrumb-link", children: t.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: t.label })
|
|
560
|
+
] }, t.key);
|
|
552
561
|
}) }) });
|
|
553
562
|
}
|
|
554
563
|
function O({ message: e }) {
|
|
@@ -560,48 +569,48 @@ function O({ message: e }) {
|
|
|
560
569
|
function z() {
|
|
561
570
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
|
|
562
571
|
}
|
|
563
|
-
function
|
|
572
|
+
function dn() {
|
|
564
573
|
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" }) });
|
|
565
574
|
}
|
|
566
|
-
function
|
|
575
|
+
function pn() {
|
|
567
576
|
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" }) });
|
|
568
577
|
}
|
|
569
|
-
function
|
|
570
|
-
const [d, p] = G({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle:
|
|
571
|
-
var
|
|
572
|
-
if (!((
|
|
578
|
+
function yt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
579
|
+
const [d, p] = G({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: v } = De(i, o), f = $(() => {
|
|
580
|
+
var g;
|
|
581
|
+
if (!((g = s == null ? void 0 : s.tags) != null && g.length)) return [];
|
|
573
582
|
const x = /* @__PURE__ */ new Set();
|
|
574
|
-
for (const
|
|
575
|
-
|
|
576
|
-
return
|
|
577
|
-
}, [e,
|
|
578
|
-
var m,
|
|
583
|
+
for (const y of e || [])
|
|
584
|
+
y.recordByTag && Object.keys(y.recordByTag).forEach((m) => x.add(m));
|
|
585
|
+
return s.tags.filter((y) => x.has(y));
|
|
586
|
+
}, [e, s]), h = $(() => e ? c.size === 0 ? e : e.map((x) => {
|
|
587
|
+
var m, w;
|
|
579
588
|
if (!x.recordByTag) return null;
|
|
580
|
-
let
|
|
581
|
-
const
|
|
582
|
-
for (const
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
589
|
+
let g = null;
|
|
590
|
+
const y = /* @__PURE__ */ new Set();
|
|
591
|
+
for (const S of Object.values(x.recordByTag)) {
|
|
592
|
+
if (y.has(S.carId)) continue;
|
|
593
|
+
y.add(S.carId);
|
|
594
|
+
const R = ((w = (m = s == null ? void 0 : s.cars) == null ? void 0 : m[S.carId]) == null ? void 0 : w.tags) || [];
|
|
595
|
+
Me(R, c, s == null ? void 0 : s.categories) && (!g || S.lapTimeMs < g.lapTimeMs) && (g = S);
|
|
587
596
|
}
|
|
588
|
-
return
|
|
597
|
+
return g ? {
|
|
589
598
|
...x,
|
|
590
599
|
record: {
|
|
591
|
-
visibleId:
|
|
592
|
-
carId:
|
|
593
|
-
carDisplayName:
|
|
594
|
-
lapTimeMs:
|
|
595
|
-
timestamp:
|
|
600
|
+
visibleId: g.steamId || g.identifier,
|
|
601
|
+
carId: g.carId,
|
|
602
|
+
carDisplayName: I(g.carId),
|
|
603
|
+
lapTimeMs: g.lapTimeMs,
|
|
604
|
+
timestamp: g.recordedAt
|
|
596
605
|
}
|
|
597
606
|
} : null;
|
|
598
|
-
}).filter(Boolean) : [], [e, c,
|
|
599
|
-
var
|
|
600
|
-
switch (
|
|
607
|
+
}).filter(Boolean) : [], [e, c, s]), k = $(() => Y(h, d, (x, g) => {
|
|
608
|
+
var y, m;
|
|
609
|
+
switch (g) {
|
|
601
610
|
case "displayName":
|
|
602
611
|
return x.displayName;
|
|
603
612
|
case "record.lapTimeMs":
|
|
604
|
-
return (
|
|
613
|
+
return (y = x.record) == null ? void 0 : y.lapTimeMs;
|
|
605
614
|
case "driverCount":
|
|
606
615
|
return x.driverCount || 0;
|
|
607
616
|
case "carCount":
|
|
@@ -610,32 +619,32 @@ function ft({ tracks: e, isLoading: r, carMetadata: t, getUserDisplay: s, onTrac
|
|
|
610
619
|
default:
|
|
611
620
|
return (m = x.record) != null && m.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
612
621
|
}
|
|
613
|
-
}), [
|
|
614
|
-
return
|
|
622
|
+
}), [h, d]);
|
|
623
|
+
return t ? /* @__PURE__ */ n(z, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
615
624
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
616
625
|
/* @__PURE__ */ n(
|
|
617
|
-
|
|
626
|
+
Ae,
|
|
618
627
|
{
|
|
619
628
|
availableTags: f,
|
|
620
629
|
activeTags: c,
|
|
621
|
-
onToggle:
|
|
622
|
-
onClear:
|
|
623
|
-
categories:
|
|
624
|
-
tagLabels:
|
|
630
|
+
onToggle: u,
|
|
631
|
+
onClear: v,
|
|
632
|
+
categories: s == null ? void 0 : s.categories,
|
|
633
|
+
tagLabels: s == null ? void 0 : s.tagLabels
|
|
625
634
|
}
|
|
626
635
|
),
|
|
627
636
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
628
637
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
629
|
-
/* @__PURE__ */ n(
|
|
638
|
+
/* @__PURE__ */ n(A, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
|
|
630
639
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
631
640
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
632
|
-
/* @__PURE__ */ n(
|
|
633
|
-
/* @__PURE__ */ n(
|
|
634
|
-
/* @__PURE__ */ n(
|
|
635
|
-
/* @__PURE__ */ n(
|
|
641
|
+
/* @__PURE__ */ n(A, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
|
|
642
|
+
/* @__PURE__ */ n(A, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
|
|
643
|
+
/* @__PURE__ */ n(A, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
|
|
644
|
+
/* @__PURE__ */ n(A, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
|
|
636
645
|
] }) }),
|
|
637
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
638
|
-
var
|
|
646
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: k.map((x) => {
|
|
647
|
+
var g, y, m;
|
|
639
648
|
return /* @__PURE__ */ l(
|
|
640
649
|
"tr",
|
|
641
650
|
{
|
|
@@ -643,8 +652,8 @@ function ft({ tracks: e, isLoading: r, carMetadata: t, getUserDisplay: s, onTrac
|
|
|
643
652
|
onClick: () => a(x.id, x.layout),
|
|
644
653
|
children: [
|
|
645
654
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
646
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: (
|
|
647
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((
|
|
655
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (g = x.record) != null && g.visibleId ? /* @__PURE__ */ n(J, { userId: x.record.visibleId, getUserDisplay: r }) : "-" }),
|
|
656
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((y = x.record) == null ? void 0 : y.carDisplayName) || "-" }),
|
|
648
657
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? q(x.record.lapTimeMs) : "-" }),
|
|
649
658
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
650
659
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
|
|
@@ -657,62 +666,62 @@ function ft({ tracks: e, isLoading: r, carMetadata: t, getUserDisplay: s, onTrac
|
|
|
657
666
|
] }) })
|
|
658
667
|
] }) : /* @__PURE__ */ n(O, { message: "No lap times recorded yet." });
|
|
659
668
|
}
|
|
660
|
-
function
|
|
661
|
-
const [c,
|
|
662
|
-
var
|
|
663
|
-
if (!e || !((
|
|
669
|
+
function kt({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
|
|
670
|
+
const [c, u] = G({ key: "lapTimeMs", dir: "asc" }), { activeTags: v, toggle: f, clear: h } = De(d, p), k = $(() => {
|
|
671
|
+
var w, S, R;
|
|
672
|
+
if (!e || !((w = r == null ? void 0 : r.tags) != null && w.length)) return [];
|
|
664
673
|
const m = /* @__PURE__ */ new Set();
|
|
665
|
-
for (const
|
|
666
|
-
(((
|
|
667
|
-
return
|
|
668
|
-
}, [e,
|
|
669
|
-
var
|
|
670
|
-
const
|
|
671
|
-
return
|
|
672
|
-
}) : [], [e,
|
|
673
|
-
switch (
|
|
674
|
+
for (const T of e)
|
|
675
|
+
(((R = (S = r.cars) == null ? void 0 : S[T.carId]) == null ? void 0 : R.tags) || []).forEach((b) => m.add(b));
|
|
676
|
+
return r.tags.filter((T) => m.has(T));
|
|
677
|
+
}, [e, r]), x = $(() => e ? v.size === 0 ? e : e.filter((m) => {
|
|
678
|
+
var S, R;
|
|
679
|
+
const w = ((R = (S = r == null ? void 0 : r.cars) == null ? void 0 : S[m.carId]) == null ? void 0 : R.tags) || [];
|
|
680
|
+
return Me(w, v, r == null ? void 0 : r.categories);
|
|
681
|
+
}) : [], [e, v, r]), g = $(() => Y(x, c, (m, w) => {
|
|
682
|
+
switch (w) {
|
|
674
683
|
case "carId":
|
|
675
|
-
return
|
|
684
|
+
return I(m.carId);
|
|
676
685
|
case "driverCount":
|
|
677
686
|
return m.driverCount || 0;
|
|
678
687
|
case "lapTimeMs":
|
|
679
688
|
default:
|
|
680
689
|
return m.lapTimeMs;
|
|
681
690
|
}
|
|
682
|
-
}), [x, c]),
|
|
691
|
+
}), [x, c]), y = [
|
|
683
692
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
684
|
-
{ key: "track", label:
|
|
693
|
+
{ key: "track", label: s.displayName }
|
|
685
694
|
];
|
|
686
|
-
return
|
|
687
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
695
|
+
return t ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
696
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ue, { segments: y }) }),
|
|
688
697
|
/* @__PURE__ */ n(
|
|
689
|
-
|
|
698
|
+
Ae,
|
|
690
699
|
{
|
|
691
|
-
availableTags:
|
|
692
|
-
activeTags:
|
|
700
|
+
availableTags: k,
|
|
701
|
+
activeTags: v,
|
|
693
702
|
onToggle: f,
|
|
694
|
-
onClear:
|
|
695
|
-
categories:
|
|
696
|
-
tagLabels:
|
|
703
|
+
onClear: h,
|
|
704
|
+
categories: r == null ? void 0 : r.categories,
|
|
705
|
+
tagLabels: r == null ? void 0 : r.tagLabels
|
|
697
706
|
}
|
|
698
707
|
),
|
|
699
708
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
700
709
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
701
710
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
702
|
-
/* @__PURE__ */ n(
|
|
711
|
+
/* @__PURE__ */ n(A, { label: "Car", sortKey: "carId", config: c, onSort: u }),
|
|
703
712
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
704
|
-
/* @__PURE__ */ n(
|
|
705
|
-
/* @__PURE__ */ n(
|
|
713
|
+
/* @__PURE__ */ n(A, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
|
|
714
|
+
/* @__PURE__ */ n(A, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
|
|
706
715
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
707
716
|
] }) }),
|
|
708
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
717
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: g.map((m, w) => /* @__PURE__ */ l(
|
|
709
718
|
"tr",
|
|
710
719
|
{
|
|
711
720
|
className: "pvx-row pvx-row--clickable",
|
|
712
721
|
onClick: () => i(m.carId),
|
|
713
722
|
children: [
|
|
714
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
715
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children:
|
|
723
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: w + 1, podium: !0 }) }),
|
|
724
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: I(m.carId) }),
|
|
716
725
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(J, { userId: m.steamId || m.userId, getUserDisplay: a }) }),
|
|
717
726
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(m.lapTimeMs) }),
|
|
718
727
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: m.driverCount || "-" }),
|
|
@@ -724,78 +733,78 @@ function Nt({ entries: e, isLoading: r, track: t, carMetadata: s, getUserDisplay
|
|
|
724
733
|
] }) }) : /* @__PURE__ */ n(O, { message: "No lap times for this track yet." })
|
|
725
734
|
] });
|
|
726
735
|
}
|
|
727
|
-
function
|
|
728
|
-
const [p, c] = G({ key: "lapTimeMs", dir: "asc" }),
|
|
729
|
-
switch (
|
|
736
|
+
function wt({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
737
|
+
const [p, c] = G({ key: "lapTimeMs", dir: "asc" }), u = $(() => Pe(e), [e]), v = $(() => Y(e || [], p, (h, k) => {
|
|
738
|
+
switch (k) {
|
|
730
739
|
case "userId":
|
|
731
|
-
return a(
|
|
740
|
+
return a(h.steamId || h.userId).displayName;
|
|
732
741
|
case "lapCount":
|
|
733
|
-
return
|
|
742
|
+
return h.lapCount || 0;
|
|
734
743
|
case "lapTimeMs":
|
|
735
744
|
default:
|
|
736
|
-
return
|
|
745
|
+
return h.lapTimeMs;
|
|
737
746
|
}
|
|
738
747
|
}), [e, p, a]), f = [
|
|
739
748
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
740
|
-
{ key: "track", label:
|
|
741
|
-
{ key: "car", label:
|
|
749
|
+
{ key: "track", label: s.displayName, onClick: () => o("track") },
|
|
750
|
+
{ key: "car", label: I(r) }
|
|
742
751
|
];
|
|
743
|
-
return
|
|
744
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(
|
|
752
|
+
return t ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
753
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ue, { segments: f }) }),
|
|
745
754
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
746
755
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
747
756
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
748
|
-
/* @__PURE__ */ n(
|
|
749
|
-
/* @__PURE__ */ n(
|
|
757
|
+
/* @__PURE__ */ n(A, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
|
|
758
|
+
/* @__PURE__ */ n(A, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
|
|
750
759
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
751
760
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
752
761
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
753
762
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
754
763
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
755
|
-
/* @__PURE__ */ n(
|
|
764
|
+
/* @__PURE__ */ n(A, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
|
|
756
765
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
757
766
|
] }) }),
|
|
758
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
759
|
-
const x =
|
|
767
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h, k) => {
|
|
768
|
+
const x = k + 1, g = h.steamId || h.userId, y = u && h.sector1Ms === u.s1, m = u && h.sector2Ms === u.s2, w = u && h.sector3Ms === u.s3;
|
|
760
769
|
return /* @__PURE__ */ l(
|
|
761
770
|
"tr",
|
|
762
771
|
{
|
|
763
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
764
|
-
onClick: () => i(
|
|
772
|
+
className: `pvx-row pvx-row--clickable ${d && g === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
773
|
+
onClick: () => i(g),
|
|
765
774
|
children: [
|
|
766
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
767
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId:
|
|
768
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(
|
|
769
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
770
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${m ? "pvx-td--best-sector" : ""}`, children: E(
|
|
771
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
772
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
773
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children:
|
|
774
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
775
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children:
|
|
775
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: x, podium: !0 }) }),
|
|
776
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId: g, getUserDisplay: a }) }),
|
|
777
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(h.lapTimeMs) }),
|
|
778
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: E(h.sector1Ms) }),
|
|
779
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${m ? "pvx-td--best-sector" : ""}`, children: E(h.sector2Ms) }),
|
|
780
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: E(h.sector3Ms) }),
|
|
781
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ke(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
782
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: we(h.startingFuelL) }),
|
|
783
|
+
/* @__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 ? W(h.recordedAt) : "-" })
|
|
776
785
|
]
|
|
777
786
|
},
|
|
778
|
-
|
|
787
|
+
g
|
|
779
788
|
);
|
|
780
789
|
}) })
|
|
781
790
|
] }) }) : /* @__PURE__ */ n(O, { message: "No lap times for this car yet." })
|
|
782
791
|
] });
|
|
783
792
|
}
|
|
784
|
-
function
|
|
785
|
-
const { data: c, driverName:
|
|
786
|
-
const m = (c == null ? void 0 : c.filter((
|
|
787
|
-
return m.length ? Math.min(...m.map((
|
|
788
|
-
}, [c]),
|
|
793
|
+
function Ct({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
|
|
794
|
+
const { data: c, driverName: u, theoreticalBest: v, isLoading: f } = en(e, t.id, t.layout, s, { showInvalid: i, game: r, gameVersion: a }), { displayName: h, avatarUrl: k } = o(e, u), x = $(() => Pe(c, !0), [c]), g = $(() => {
|
|
795
|
+
const m = (c == null ? void 0 : c.filter((w) => w.isValid)) || [];
|
|
796
|
+
return m.length ? Math.min(...m.map((w) => w.lapTimeMs)) : null;
|
|
797
|
+
}, [c]), y = [
|
|
789
798
|
{ key: "tracks", label: "Tracks", onClick: () => p("tracks") },
|
|
790
|
-
{ key: "track", label:
|
|
791
|
-
{ key: "car", label:
|
|
792
|
-
{ key: "driver", label:
|
|
799
|
+
{ key: "track", label: t.displayName, onClick: () => p("track") },
|
|
800
|
+
{ key: "car", label: I(s), onClick: () => p("car") },
|
|
801
|
+
{ key: "driver", label: h }
|
|
793
802
|
];
|
|
794
803
|
return f ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
795
804
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
796
805
|
/* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
797
|
-
/* @__PURE__ */ n(
|
|
798
|
-
|
|
806
|
+
/* @__PURE__ */ n(ue, { segments: y }),
|
|
807
|
+
k ? /* @__PURE__ */ n("img", { src: k, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
799
808
|
] }),
|
|
800
809
|
/* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
|
|
801
810
|
/* @__PURE__ */ n(
|
|
@@ -810,16 +819,16 @@ function yt({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvali
|
|
|
810
819
|
/* @__PURE__ */ n("span", { children: "Show invalid laps" })
|
|
811
820
|
] })
|
|
812
821
|
] }),
|
|
813
|
-
|
|
822
|
+
v && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
|
|
814
823
|
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
|
|
815
|
-
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: q(
|
|
824
|
+
/* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: q(v.lapTimeMs) }),
|
|
816
825
|
/* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
|
|
817
826
|
"(",
|
|
818
|
-
E(
|
|
827
|
+
E(v.sector1Ms),
|
|
819
828
|
" + ",
|
|
820
|
-
E(
|
|
829
|
+
E(v.sector2Ms),
|
|
821
830
|
" + ",
|
|
822
|
-
E(
|
|
831
|
+
E(v.sector3Ms),
|
|
823
832
|
")"
|
|
824
833
|
] })
|
|
825
834
|
] }),
|
|
@@ -836,28 +845,28 @@ function yt({ userId: e, track: r, carId: t, game: s, gameVersion: a, showInvali
|
|
|
836
845
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
837
846
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
838
847
|
] }) }),
|
|
839
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((m,
|
|
840
|
-
const
|
|
841
|
-
let
|
|
842
|
-
return m.isValid || (
|
|
843
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${
|
|
848
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((m, w) => {
|
|
849
|
+
const S = m.isValid && m.lapTimeMs === g, R = x && m.isValid && m.sector1Ms === x.s1, T = x && m.isValid && m.sector2Ms === x.s2, N = x && m.isValid && m.sector3Ms === x.s3;
|
|
850
|
+
let b = "pvx-row";
|
|
851
|
+
return m.isValid || (b += " pvx-row--invalid"), S && (b += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: b, children: [
|
|
852
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${S ? "pvx-rank--gold" : ""}`, children: w + 1 }) }),
|
|
844
853
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: m.lapNumber || "-" }),
|
|
845
854
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: q(m.lapTimeMs) }),
|
|
846
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
847
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
848
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
849
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", title: m.isValid ? void 0 : m.invalidReason || "Invalid", children: m.isValid ? /* @__PURE__ */ n(
|
|
850
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
851
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
855
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${R ? "pvx-td--best-sector" : ""}`, children: E(m.sector1Ms) }),
|
|
856
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${T ? "pvx-td--best-sector" : ""}`, children: E(m.sector2Ms) }),
|
|
857
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: E(m.sector3Ms) }),
|
|
858
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", title: m.isValid ? void 0 : m.invalidReason || "Invalid", children: m.isValid ? /* @__PURE__ */ n(dn, {}) : /* @__PURE__ */ n(pn, {}) }),
|
|
859
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ke(m.tyreCompound), children: m.tyreCompound || "-" }),
|
|
860
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: we(m.startingFuelL) }),
|
|
852
861
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: W(m.timestamp) })
|
|
853
862
|
] }, m.id);
|
|
854
863
|
}) })
|
|
855
864
|
] }) }) : /* @__PURE__ */ n(O, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
856
865
|
] });
|
|
857
866
|
}
|
|
858
|
-
function
|
|
859
|
-
const [o, d] = G({ key: "rank", dir: "asc" }), [p, c] = B(null),
|
|
860
|
-
switch (
|
|
867
|
+
function Lt({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion: a, onComboSelect: i }) {
|
|
868
|
+
const [o, d] = G({ key: "rank", dir: "asc" }), [p, c] = B(null), u = $(() => e ? Y(e, o, (f, h) => {
|
|
869
|
+
switch (h) {
|
|
861
870
|
case "rating":
|
|
862
871
|
return f.rating;
|
|
863
872
|
case "comboCount":
|
|
@@ -869,10 +878,10 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
|
|
|
869
878
|
return f.rank;
|
|
870
879
|
}
|
|
871
880
|
}) : [], [e, o]);
|
|
872
|
-
if (
|
|
881
|
+
if (t) return /* @__PURE__ */ n(z, {});
|
|
873
882
|
if (!(e != null && e.length))
|
|
874
883
|
return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(O, { message: "Not enough data for rankings yet." }) });
|
|
875
|
-
const
|
|
884
|
+
const v = 5;
|
|
876
885
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
877
886
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
878
887
|
/* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
|
|
@@ -891,23 +900,23 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
|
|
|
891
900
|
] }),
|
|
892
901
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
893
902
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
894
|
-
/* @__PURE__ */ n(
|
|
903
|
+
/* @__PURE__ */ n(A, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
|
|
895
904
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
896
|
-
/* @__PURE__ */ n(
|
|
897
|
-
/* @__PURE__ */ n(
|
|
898
|
-
/* @__PURE__ */ n(
|
|
905
|
+
/* @__PURE__ */ n(A, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
|
|
906
|
+
/* @__PURE__ */ n(A, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
907
|
+
/* @__PURE__ */ n(A, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
|
|
899
908
|
] }) }),
|
|
900
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
901
|
-
const
|
|
909
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
|
|
910
|
+
const h = p === f.identifier;
|
|
902
911
|
return /* @__PURE__ */ n(
|
|
903
|
-
|
|
912
|
+
un,
|
|
904
913
|
{
|
|
905
914
|
driver: f,
|
|
906
|
-
getUserDisplay:
|
|
907
|
-
isExpanded:
|
|
908
|
-
onToggle: () => c(
|
|
909
|
-
colCount:
|
|
910
|
-
game:
|
|
915
|
+
getUserDisplay: s,
|
|
916
|
+
isExpanded: h,
|
|
917
|
+
onToggle: () => c(h ? null : f.identifier),
|
|
918
|
+
colCount: v,
|
|
919
|
+
game: r,
|
|
911
920
|
gameVersion: a,
|
|
912
921
|
onComboSelect: i
|
|
913
922
|
},
|
|
@@ -917,28 +926,28 @@ function kt({ drivers: e, isLoading: r, getUserDisplay: t, game: s, gameVersion:
|
|
|
917
926
|
] }) })
|
|
918
927
|
] });
|
|
919
928
|
}
|
|
920
|
-
function
|
|
929
|
+
function un({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
|
|
921
930
|
const p = e.identifier;
|
|
922
931
|
return /* @__PURE__ */ l(_, { children: [
|
|
923
932
|
/* @__PURE__ */ l(
|
|
924
933
|
"tr",
|
|
925
934
|
{
|
|
926
935
|
className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
927
|
-
onClick:
|
|
936
|
+
onClick: r,
|
|
928
937
|
children: [
|
|
929
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
930
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId: p, getUserDisplay:
|
|
938
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(pe, { rank: e.rank, podium: !0 }) }),
|
|
939
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(J, { userId: p, getUserDisplay: t }) }),
|
|
931
940
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
|
|
932
941
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
933
942
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
|
|
934
943
|
e.comboCount,
|
|
935
|
-
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${
|
|
944
|
+
/* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${s ? "pvx-rankings-chevron--open" : ""}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) })
|
|
936
945
|
] }) })
|
|
937
946
|
]
|
|
938
947
|
}
|
|
939
948
|
),
|
|
940
|
-
|
|
941
|
-
const
|
|
949
|
+
s && 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: i, gameVersion: o }) : void 0;
|
|
942
951
|
return /* @__PURE__ */ l(
|
|
943
952
|
"div",
|
|
944
953
|
{
|
|
@@ -948,7 +957,7 @@ function ln({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount
|
|
|
948
957
|
children: [
|
|
949
958
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
|
|
950
959
|
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: j(c.trackId, c.layout, i) }),
|
|
951
|
-
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children:
|
|
960
|
+
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
|
|
952
961
|
] }),
|
|
953
962
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
|
|
954
963
|
/* @__PURE__ */ n("p", { className: "pvx-rankings-combo-time", children: q(c.lapTimeMs) }),
|
|
@@ -966,12 +975,12 @@ function ln({ driver: e, getUserDisplay: r, isExpanded: t, onToggle: s, colCount
|
|
|
966
975
|
] })
|
|
967
976
|
]
|
|
968
977
|
},
|
|
969
|
-
|
|
978
|
+
u
|
|
970
979
|
);
|
|
971
980
|
}) }) }) })
|
|
972
981
|
] });
|
|
973
982
|
}
|
|
974
|
-
const
|
|
983
|
+
const hn = {
|
|
975
984
|
GBR: "🇬🇧",
|
|
976
985
|
DEU: "🇩🇪",
|
|
977
986
|
NLD: "🇳🇱",
|
|
@@ -1002,64 +1011,64 @@ const cn = {
|
|
|
1002
1011
|
RUS: "🇷🇺",
|
|
1003
1012
|
TUR: "🇹🇷",
|
|
1004
1013
|
KOR: "🇰🇷"
|
|
1005
|
-
},
|
|
1014
|
+
}, he = ["🥇", "🥈", "🥉"], mn = {
|
|
1006
1015
|
championship: "Championship",
|
|
1007
1016
|
series: "Series",
|
|
1008
1017
|
event: "Event",
|
|
1009
1018
|
hotlap: "Hotlap"
|
|
1010
|
-
},
|
|
1011
|
-
function
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1019
|
+
}, vn = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
1020
|
+
function ge(e) {
|
|
1021
|
+
const t = vn.indexOf(e);
|
|
1022
|
+
if (t >= 0) return t;
|
|
1023
|
+
const s = e.match(/^PRACTICE_(\d+)$/);
|
|
1024
|
+
return s ? 100 + parseInt(s[1]) : 999;
|
|
1025
|
+
}
|
|
1026
|
+
function Z(e) {
|
|
1014
1027
|
const t = e.match(/^PRACTICE_(\d+)$/);
|
|
1015
|
-
return t ?
|
|
1028
|
+
return t ? `P${t[1]}` : e;
|
|
1016
1029
|
}
|
|
1017
|
-
function
|
|
1018
|
-
const r = e.match(/^PRACTICE_(\d+)$/);
|
|
1019
|
-
return r ? `P${r[1]}` : e;
|
|
1020
|
-
}
|
|
1021
|
-
function ue({ position: e }) {
|
|
1030
|
+
function me({ position: e }) {
|
|
1022
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 });
|
|
1023
1032
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const
|
|
1026
|
-
return
|
|
1033
|
+
function X({ nation: e }) {
|
|
1034
|
+
const t = e && hn[e];
|
|
1035
|
+
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
1027
1036
|
}
|
|
1028
|
-
function
|
|
1037
|
+
function xn({ sessions: e, activeSession: t, onSelect: s }) {
|
|
1029
1038
|
if (!e || e.length <= 1) return null;
|
|
1030
|
-
const
|
|
1031
|
-
(a, i) =>
|
|
1039
|
+
const r = [...e].sort(
|
|
1040
|
+
(a, i) => ge(a.type) - ge(i.type)
|
|
1032
1041
|
);
|
|
1033
|
-
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children:
|
|
1042
|
+
return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: r.map((a) => /* @__PURE__ */ n(
|
|
1034
1043
|
"button",
|
|
1035
1044
|
{
|
|
1036
|
-
onClick: () =>
|
|
1037
|
-
className: `pvx-session-tab ${
|
|
1038
|
-
children:
|
|
1045
|
+
onClick: () => s(a.type),
|
|
1046
|
+
className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
|
|
1047
|
+
children: Z(a.type)
|
|
1039
1048
|
},
|
|
1040
1049
|
a.type
|
|
1041
1050
|
)) });
|
|
1042
1051
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children:
|
|
1052
|
+
function gn({ type: e }) {
|
|
1053
|
+
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: mn[e] || e });
|
|
1045
1054
|
}
|
|
1046
|
-
function
|
|
1047
|
-
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${
|
|
1055
|
+
function se({ children: e, variant: t = "default" }) {
|
|
1056
|
+
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1048
1057
|
}
|
|
1049
|
-
function
|
|
1058
|
+
function fn(e) {
|
|
1050
1059
|
if (!e) return "TBD";
|
|
1051
|
-
const
|
|
1052
|
-
if (isNaN(
|
|
1053
|
-
const
|
|
1054
|
-
return `${
|
|
1055
|
-
}
|
|
1056
|
-
function
|
|
1057
|
-
return e.reduce((
|
|
1058
|
-
var
|
|
1059
|
-
return (
|
|
1060
|
-
const o =
|
|
1060
|
+
const t = new Date(e);
|
|
1061
|
+
if (isNaN(t)) return "TBD";
|
|
1062
|
+
const s = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), r = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1063
|
+
return `${s} • ${r}`;
|
|
1064
|
+
}
|
|
1065
|
+
function Nn(e) {
|
|
1066
|
+
return e.reduce((t, s) => {
|
|
1067
|
+
var r;
|
|
1068
|
+
return (r = s.splits) != null && r.length ? t ? t.map((a, i) => {
|
|
1069
|
+
const o = s.splits[i];
|
|
1061
1070
|
return o && o < a ? o : a;
|
|
1062
|
-
}) : [...
|
|
1071
|
+
}) : [...s.splits] : t;
|
|
1063
1072
|
}, null);
|
|
1064
1073
|
}
|
|
1065
1074
|
function V({ message: e = "Loading..." }) {
|
|
@@ -1068,107 +1077,115 @@ function V({ message: e = "Loading..." }) {
|
|
|
1068
1077
|
function U({ message: e = "No data available." }) {
|
|
1069
1078
|
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1070
1079
|
}
|
|
1071
|
-
const
|
|
1072
|
-
function
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1080
|
+
const Be = 3;
|
|
1081
|
+
function ee(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((s) => ee(s)) : t.every((s) => s.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 s = null;
|
|
1097
|
+
for (const r of t) {
|
|
1098
|
+
if (!r.startTime) continue;
|
|
1099
|
+
const a = new Date(r.startTime);
|
|
1100
|
+
isNaN(a) || (!s || a > s) && (s = a);
|
|
1084
1101
|
}
|
|
1085
|
-
return
|
|
1102
|
+
return s;
|
|
1086
1103
|
}
|
|
1087
|
-
function
|
|
1088
|
-
if (!
|
|
1089
|
-
const
|
|
1090
|
-
if (!
|
|
1091
|
-
const
|
|
1092
|
-
return Date.now() -
|
|
1104
|
+
function Ie(e, t = Be) {
|
|
1105
|
+
if (!bn(e)) return "active";
|
|
1106
|
+
const s = yn(e);
|
|
1107
|
+
if (!s) return "recently-completed";
|
|
1108
|
+
const r = t * 24 * 60 * 60 * 1e3;
|
|
1109
|
+
return Date.now() - s.getTime() <= r ? "recently-completed" : "archived";
|
|
1093
1110
|
}
|
|
1094
|
-
function
|
|
1111
|
+
function St(e, t, s = Be) {
|
|
1095
1112
|
if (!(e != null && e.length)) return [];
|
|
1096
|
-
const
|
|
1097
|
-
return e.filter((a) =>
|
|
1113
|
+
const r = new Set(Array.isArray(t) ? t : [t]);
|
|
1114
|
+
return e.filter((a) => r.has(Ie(a, s)));
|
|
1098
1115
|
}
|
|
1099
|
-
function
|
|
1100
|
-
const
|
|
1101
|
-
return Array.isArray(
|
|
1116
|
+
function kn(e, t = 3) {
|
|
1117
|
+
const s = e == null ? void 0 : e.standings;
|
|
1118
|
+
return Array.isArray(s) ? [...s].sort((r, a) => (r.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1102
1119
|
}
|
|
1103
|
-
function
|
|
1104
|
-
const { data: a } =
|
|
1105
|
-
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${
|
|
1106
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children:
|
|
1120
|
+
function wn({ competitionId: e, topN: t = 3, label: s = "Completed", className: r }) {
|
|
1121
|
+
const { data: a } = Se(e), i = kn(a, t);
|
|
1122
|
+
return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${r || ""}`, children: [
|
|
1123
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: s }),
|
|
1107
1124
|
i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
1108
|
-
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children:
|
|
1109
|
-
/* @__PURE__ */ n(
|
|
1125
|
+
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: he[d] || "" }),
|
|
1126
|
+
/* @__PURE__ */ n(X, { nation: o.nation }),
|
|
1110
1127
|
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
|
|
1111
1128
|
] }, o.driverId || d)) })
|
|
1112
1129
|
] });
|
|
1113
1130
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1131
|
+
function $t({ competitions: e, isLoading: t, onSelect: s, onRegister: r, className: a }) {
|
|
1132
|
+
return t ? /* @__PURE__ */ n(V, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(Cn, { comp: i, onSelect: s, onRegister: r || s }, i.id)) }) : /* @__PURE__ */ n(U, { message: "No competitions available." });
|
|
1116
1133
|
}
|
|
1117
|
-
function
|
|
1118
|
-
var
|
|
1119
|
-
const { cdnUrl:
|
|
1134
|
+
function Cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
1135
|
+
var S, R, T, N;
|
|
1136
|
+
const { cdnUrl: r } = C(), a = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), u = (i == null ? void 0 : i.isOpen) && !c && !p, v = /* @__PURE__ */ new Date(), f = (S = e.rounds) == null ? void 0 : S.find((b) => b.startTime && new Date(b.startTime) >= v), h = ((R = e.rounds) == null ? void 0 : R.length) || 0, k = e.type === "hotlap", x = k && h > 1, g = k ? ((T = e.rounds) == null ? void 0 : T.filter(ee).length) || 0 : ((N = e.rounds) == null ? void 0 : N.filter((b) => b.isFinalized).length) || 0, y = Ie(e), m = y === "recently-completed" || y === "archived", w = e.type === "championship";
|
|
1120
1137
|
return /* @__PURE__ */ l(
|
|
1121
1138
|
"div",
|
|
1122
1139
|
{
|
|
1123
1140
|
className: "pvx-comp-card",
|
|
1124
|
-
onClick: () =>
|
|
1141
|
+
onClick: () => t(e.id),
|
|
1125
1142
|
role: "button",
|
|
1126
1143
|
tabIndex: 0,
|
|
1127
|
-
onKeyDown: (
|
|
1128
|
-
(
|
|
1144
|
+
onKeyDown: (b) => {
|
|
1145
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), t(e.id));
|
|
1129
1146
|
},
|
|
1130
1147
|
children: [
|
|
1131
|
-
/* @__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(
|
|
1148
|
+
/* @__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(Sn, {}) }) }),
|
|
1132
1149
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
|
|
1133
1150
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1134
1151
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1135
1152
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
|
|
1136
|
-
/* @__PURE__ */ n(
|
|
1137
|
-
e.game && /* @__PURE__ */ n(
|
|
1138
|
-
e.formatDescription && e.formatDescription.split(", ").map((
|
|
1153
|
+
/* @__PURE__ */ n(gn, { type: e.type }),
|
|
1154
|
+
e.game && /* @__PURE__ */ n(se, { children: e.game.toUpperCase() }),
|
|
1155
|
+
e.formatDescription && e.formatDescription.split(", ").map((b, L) => /* @__PURE__ */ n(se, { variant: "format", children: b }, L))
|
|
1139
1156
|
] }),
|
|
1140
|
-
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((
|
|
1157
|
+
e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((b, L) => /* @__PURE__ */ n(se, { children: b }, L)) }),
|
|
1141
1158
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
|
|
1142
1159
|
f ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1143
1160
|
/* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
1144
1161
|
" ",
|
|
1145
|
-
e.type !== "hotlap" && `R${f.roundNumber} `,
|
|
1162
|
+
(e.type !== "hotlap" || x) && `R${f.roundNumber} `,
|
|
1146
1163
|
f.track || "TBD",
|
|
1147
1164
|
" · ",
|
|
1148
|
-
|
|
1149
|
-
] }) :
|
|
1150
|
-
|
|
1165
|
+
fn(f.startTime)
|
|
1166
|
+
] }) : h > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1167
|
+
g,
|
|
1151
1168
|
"/",
|
|
1152
|
-
|
|
1169
|
+
h,
|
|
1153
1170
|
" rounds completed"
|
|
1154
1171
|
] }) : null,
|
|
1155
|
-
|
|
1156
|
-
|
|
1172
|
+
h > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
|
|
1173
|
+
h,
|
|
1157
1174
|
" round",
|
|
1158
|
-
|
|
1175
|
+
h !== 1 ? "s" : ""
|
|
1159
1176
|
] })
|
|
1160
1177
|
] }),
|
|
1161
|
-
|
|
1162
|
-
i && !
|
|
1163
|
-
|
|
1178
|
+
m && (w || x) && /* @__PURE__ */ n(wn, { competitionId: e.id }),
|
|
1179
|
+
i && !m && /* @__PURE__ */ n(
|
|
1180
|
+
Ln,
|
|
1164
1181
|
{
|
|
1165
1182
|
competitionId: e.id,
|
|
1166
|
-
regOpen:
|
|
1183
|
+
regOpen: u,
|
|
1167
1184
|
isFull: p,
|
|
1168
1185
|
deadlinePassed: c,
|
|
1169
1186
|
regCount: o,
|
|
1170
1187
|
regMax: d,
|
|
1171
|
-
onRegister:
|
|
1188
|
+
onRegister: s
|
|
1172
1189
|
}
|
|
1173
1190
|
)
|
|
1174
1191
|
] })
|
|
@@ -1176,8 +1193,8 @@ function bn({ comp: e, onSelect: r, onRegister: t }) {
|
|
|
1176
1193
|
}
|
|
1177
1194
|
);
|
|
1178
1195
|
}
|
|
1179
|
-
function
|
|
1180
|
-
const { isPowerMode: d } =
|
|
1196
|
+
function Ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCount: a, regMax: i, onRegister: o }) {
|
|
1197
|
+
const { isPowerMode: d } = ce(), p = de(e), { data: c } = le(e), u = (c == null ? void 0 : c.isRegistered) || !1, v = i ? a / i * 100 : 0, f = v >= 100 ? "full" : v >= 75 ? "warning" : "ok";
|
|
1181
1198
|
return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
|
|
1182
1199
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
|
|
1183
1200
|
a,
|
|
@@ -1185,21 +1202,21 @@ function yn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCou
|
|
|
1185
1202
|
i || "∞",
|
|
1186
1203
|
" drivers"
|
|
1187
1204
|
] }) }),
|
|
1188
|
-
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children:
|
|
1205
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
|
|
1189
1206
|
"button",
|
|
1190
1207
|
{
|
|
1191
1208
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
1192
|
-
onClick: (
|
|
1193
|
-
|
|
1209
|
+
onClick: (h) => {
|
|
1210
|
+
h.stopPropagation(), o(e);
|
|
1194
1211
|
},
|
|
1195
1212
|
children: "✓ Registered"
|
|
1196
1213
|
}
|
|
1197
|
-
) :
|
|
1214
|
+
) : t ? d ? /* @__PURE__ */ n(
|
|
1198
1215
|
"button",
|
|
1199
1216
|
{
|
|
1200
1217
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1201
|
-
onClick: (
|
|
1202
|
-
|
|
1218
|
+
onClick: (h) => {
|
|
1219
|
+
h.stopPropagation(), o(e);
|
|
1203
1220
|
},
|
|
1204
1221
|
children: "Register"
|
|
1205
1222
|
}
|
|
@@ -1210,13 +1227,13 @@ function yn({ competitionId: e, regOpen: r, isFull: t, deadlinePassed: s, regCou
|
|
|
1210
1227
|
target: "_blank",
|
|
1211
1228
|
rel: "noopener noreferrer",
|
|
1212
1229
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1213
|
-
onClick: (
|
|
1230
|
+
onClick: (h) => h.stopPropagation(),
|
|
1214
1231
|
children: "Register"
|
|
1215
1232
|
}
|
|
1216
|
-
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children:
|
|
1233
|
+
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
|
|
1217
1234
|
] });
|
|
1218
1235
|
}
|
|
1219
|
-
function
|
|
1236
|
+
function Sn() {
|
|
1220
1237
|
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: [
|
|
1221
1238
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1222
1239
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1226,23 +1243,24 @@ function kn() {
|
|
|
1226
1243
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1227
1244
|
] });
|
|
1228
1245
|
}
|
|
1229
|
-
function
|
|
1230
|
-
var
|
|
1231
|
-
const { data:
|
|
1232
|
-
if (
|
|
1246
|
+
function $n({ competitionId: e, className: t }) {
|
|
1247
|
+
var c, u, v;
|
|
1248
|
+
const { data: s, isLoading: r } = Se(e), { data: a, isLoading: i } = Le(e);
|
|
1249
|
+
if (r || i)
|
|
1233
1250
|
return /* @__PURE__ */ n(V, { message: "Loading standings..." });
|
|
1234
|
-
if (!((
|
|
1251
|
+
if (!((c = s == null ? void 0 : s.standings) != null && c.length))
|
|
1235
1252
|
return /* @__PURE__ */ n(U, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1236
|
-
const o = ((
|
|
1237
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
1253
|
+
const o = (a == null ? void 0 : a.type) === "hotlap", d = o ? ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter(ee)) || [] : ((v = a == null ? void 0 : a.rounds) == null ? void 0 : v.filter((f) => f.isFinalized)) || [], p = s.roundsClosed ?? s.roundsCompleted ?? 0;
|
|
1254
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
|
|
1238
1255
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
1239
|
-
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
1256
|
+
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: o ? "Overall Standings" : "Championship Standings" }),
|
|
1240
1257
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
1241
1258
|
"After ",
|
|
1242
|
-
|
|
1259
|
+
p,
|
|
1243
1260
|
" round",
|
|
1244
|
-
|
|
1245
|
-
|
|
1261
|
+
p !== 1 ? "s" : "",
|
|
1262
|
+
o ? " closed" : "",
|
|
1263
|
+
s.countingRounds > 0 && ` (best ${s.countingRounds} count)`
|
|
1246
1264
|
] })
|
|
1247
1265
|
] }) }),
|
|
1248
1266
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
@@ -1252,56 +1270,56 @@ function wn({ competitionId: e, className: r }) {
|
|
|
1252
1270
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
|
|
1253
1271
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
|
|
1254
1272
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" }),
|
|
1255
|
-
|
|
1273
|
+
d.map((f) => /* @__PURE__ */ l(
|
|
1256
1274
|
"th",
|
|
1257
1275
|
{
|
|
1258
1276
|
className: "pvx-th pvx-th--center pvx-hidden-below-md",
|
|
1259
|
-
title:
|
|
1277
|
+
title: f.track || `Round ${f.roundNumber}`,
|
|
1260
1278
|
children: [
|
|
1261
1279
|
"R",
|
|
1262
|
-
|
|
1280
|
+
f.roundNumber
|
|
1263
1281
|
]
|
|
1264
1282
|
},
|
|
1265
|
-
|
|
1283
|
+
f.roundNumber
|
|
1266
1284
|
))
|
|
1267
1285
|
] }) }),
|
|
1268
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
1269
|
-
|
|
1286
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: s.standings.map((f) => /* @__PURE__ */ n(
|
|
1287
|
+
Rn,
|
|
1270
1288
|
{
|
|
1271
|
-
driver:
|
|
1272
|
-
|
|
1289
|
+
driver: f,
|
|
1290
|
+
columnRounds: d
|
|
1273
1291
|
},
|
|
1274
|
-
|
|
1292
|
+
f.driverId || f.driverName
|
|
1275
1293
|
)) })
|
|
1276
1294
|
] }) })
|
|
1277
1295
|
] });
|
|
1278
1296
|
}
|
|
1279
|
-
function
|
|
1297
|
+
function Rn({ driver: e, columnRounds: t }) {
|
|
1280
1298
|
var o, d, p;
|
|
1281
|
-
const
|
|
1299
|
+
const s = e.position <= 3, r = new Map(
|
|
1282
1300
|
((o = e.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
|
|
1283
1301
|
), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
|
|
1284
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1285
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
1302
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
|
|
1303
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: e.position }) }),
|
|
1286
1304
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1287
|
-
/* @__PURE__ */ n(
|
|
1305
|
+
/* @__PURE__ */ n(X, { nation: e.nation }),
|
|
1288
1306
|
e.driverName
|
|
1289
1307
|
] }),
|
|
1290
1308
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1291
1309
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1292
1310
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1311
|
+
t.map((c) => {
|
|
1312
|
+
const u = r.get(c.roundNumber), v = u == null ? void 0 : u.dropped;
|
|
1295
1313
|
return /* @__PURE__ */ n(
|
|
1296
1314
|
"td",
|
|
1297
1315
|
{
|
|
1298
|
-
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!
|
|
1299
|
-
children:
|
|
1316
|
+
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!v && (u == null ? void 0 : u.position) === 1 ? "pvx-standings-cell--p1" : !v && (u == null ? void 0 : u.position) === 2 ? "pvx-standings-cell--p2" : !v && (u == null ? void 0 : u.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
|
|
1317
|
+
children: u ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${v ? "pvx-standings-round-cell--dropped" : ""}`, children: [
|
|
1300
1318
|
/* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
|
|
1301
1319
|
"P",
|
|
1302
|
-
|
|
1320
|
+
u.position
|
|
1303
1321
|
] }),
|
|
1304
|
-
/* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children:
|
|
1322
|
+
/* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: u.points })
|
|
1305
1323
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" })
|
|
1306
1324
|
},
|
|
1307
1325
|
c.roundNumber
|
|
@@ -1309,7 +1327,7 @@ function Cn({ driver: e, finalizedRounds: r }) {
|
|
|
1309
1327
|
})
|
|
1310
1328
|
] });
|
|
1311
1329
|
}
|
|
1312
|
-
const
|
|
1330
|
+
const fe = [
|
|
1313
1331
|
"#f59e0b",
|
|
1314
1332
|
"#3b82f6",
|
|
1315
1333
|
"#ef4444",
|
|
@@ -1335,118 +1353,118 @@ const xe = [
|
|
|
1335
1353
|
"#f87171",
|
|
1336
1354
|
"#38bdf8"
|
|
1337
1355
|
];
|
|
1338
|
-
function
|
|
1339
|
-
return e.map((
|
|
1340
|
-
driverName:
|
|
1341
|
-
carClass:
|
|
1342
|
-
positions:
|
|
1343
|
-
const o = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName ===
|
|
1356
|
+
function Tn(e, t) {
|
|
1357
|
+
return e.map((s) => ({
|
|
1358
|
+
driverName: s.driverName,
|
|
1359
|
+
carClass: s.carClass,
|
|
1360
|
+
positions: s.positions.map((r, a) => {
|
|
1361
|
+
const o = e.filter((d) => d.positions[a] != null).sort((d, p) => d.positions[a] - p.positions[a]).findIndex((d) => d.driverName === s.driverName);
|
|
1344
1362
|
return o === -1 ? null : o + 1;
|
|
1345
1363
|
})
|
|
1346
1364
|
}));
|
|
1347
1365
|
}
|
|
1348
|
-
function
|
|
1349
|
-
const [
|
|
1350
|
-
a((
|
|
1351
|
-
const
|
|
1352
|
-
return
|
|
1366
|
+
function Mn({ title: e, drivers: t, timingPoints: s }) {
|
|
1367
|
+
const [r, a] = B(() => /* @__PURE__ */ new Set()), i = K((N) => {
|
|
1368
|
+
a((b) => {
|
|
1369
|
+
const L = new Set(b);
|
|
1370
|
+
return L.has(N) ? L.delete(N) : L.add(N), L;
|
|
1353
1371
|
});
|
|
1354
1372
|
}, []), { series: o, maxPos: d } = $(() => {
|
|
1355
|
-
let
|
|
1356
|
-
return { series:
|
|
1357
|
-
for (const F of
|
|
1358
|
-
return { ...
|
|
1359
|
-
}), maxPos:
|
|
1360
|
-
}, [
|
|
1361
|
-
if (!o.length ||
|
|
1373
|
+
let N = 1;
|
|
1374
|
+
return { series: t.map((L, P) => {
|
|
1375
|
+
for (const F of L.positions) F != null && F > N && (N = F);
|
|
1376
|
+
return { ...L, colour: fe[P % fe.length] };
|
|
1377
|
+
}), maxPos: N };
|
|
1378
|
+
}, [t]);
|
|
1379
|
+
if (!o.length || s.length < 2)
|
|
1362
1380
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-empty", children: [
|
|
1363
1381
|
"No position data for ",
|
|
1364
1382
|
e || "this race",
|
|
1365
1383
|
"."
|
|
1366
1384
|
] });
|
|
1367
|
-
const p = 800, c = 34,
|
|
1368
|
-
const
|
|
1369
|
-
let
|
|
1370
|
-
return
|
|
1371
|
-
|
|
1372
|
-
}),
|
|
1373
|
-
},
|
|
1385
|
+
const p = 800, c = 34, u = 12, v = 12, f = 22, h = 34, k = p - c - u, x = Math.max(f * (d - 1), f), g = v + x + h, y = s.length, m = (N) => c + (y === 1 ? 0 : N / (y - 1) * k), w = (N) => v + (d === 1 ? 0 : (N - 1) / (d - 1) * x), S = (N) => {
|
|
1386
|
+
const b = [];
|
|
1387
|
+
let L = [];
|
|
1388
|
+
return N.forEach((P, F) => {
|
|
1389
|
+
P == null ? L.length && (b.push(L), L = []) : L.push([m(F), w(P)]);
|
|
1390
|
+
}), L.length && b.push(L), b;
|
|
1391
|
+
}, R = r.size > 0, T = Math.ceil(y / 24);
|
|
1374
1392
|
return /* @__PURE__ */ l("div", { className: "pvx-positions-chart", children: [
|
|
1375
1393
|
e && /* @__PURE__ */ n("div", { className: "pvx-positions-title", children: e }),
|
|
1376
1394
|
/* @__PURE__ */ l(
|
|
1377
1395
|
"svg",
|
|
1378
1396
|
{
|
|
1379
1397
|
className: "pvx-positions-svg",
|
|
1380
|
-
viewBox: `0 0 ${p} ${
|
|
1398
|
+
viewBox: `0 0 ${p} ${g}`,
|
|
1381
1399
|
preserveAspectRatio: "xMidYMid meet",
|
|
1382
1400
|
role: "img",
|
|
1383
1401
|
"aria-label": `Race position progression${e ? ` — ${e}` : ""}`,
|
|
1384
1402
|
children: [
|
|
1385
|
-
Array.from({ length: d }, (
|
|
1403
|
+
Array.from({ length: d }, (N, b) => b + 1).map((N) => /* @__PURE__ */ l("g", { children: [
|
|
1386
1404
|
/* @__PURE__ */ n(
|
|
1387
1405
|
"line",
|
|
1388
1406
|
{
|
|
1389
1407
|
className: "pvx-positions-grid",
|
|
1390
1408
|
x1: c,
|
|
1391
|
-
y1:
|
|
1392
|
-
x2: p -
|
|
1393
|
-
y2:
|
|
1409
|
+
y1: w(N),
|
|
1410
|
+
x2: p - u,
|
|
1411
|
+
y2: w(N)
|
|
1394
1412
|
}
|
|
1395
1413
|
),
|
|
1396
|
-
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y:
|
|
1414
|
+
/* @__PURE__ */ l("text", { className: "pvx-positions-axis", x: c - 6, y: w(N) + 3, textAnchor: "end", children: [
|
|
1397
1415
|
"P",
|
|
1398
|
-
|
|
1416
|
+
N
|
|
1399
1417
|
] })
|
|
1400
|
-
] }, `y${
|
|
1401
|
-
|
|
1418
|
+
] }, `y${N}`)),
|
|
1419
|
+
s.map((N, b) => b % T === 0 && /* @__PURE__ */ n(
|
|
1402
1420
|
"text",
|
|
1403
1421
|
{
|
|
1404
1422
|
className: "pvx-positions-axis",
|
|
1405
|
-
x: m(
|
|
1406
|
-
y:
|
|
1423
|
+
x: m(b),
|
|
1424
|
+
y: g - h + 16,
|
|
1407
1425
|
textAnchor: "middle",
|
|
1408
|
-
children:
|
|
1426
|
+
children: N.label
|
|
1409
1427
|
},
|
|
1410
|
-
`x${
|
|
1428
|
+
`x${b}`
|
|
1411
1429
|
)),
|
|
1412
|
-
o.map((
|
|
1413
|
-
const
|
|
1414
|
-
return /* @__PURE__ */ l("g", { opacity:
|
|
1415
|
-
|
|
1430
|
+
o.map((N) => {
|
|
1431
|
+
const b = R && !r.has(N.driverName);
|
|
1432
|
+
return /* @__PURE__ */ l("g", { opacity: b ? 0.12 : 1, children: [
|
|
1433
|
+
S(N.positions).map((L, P) => /* @__PURE__ */ n(
|
|
1416
1434
|
"polyline",
|
|
1417
1435
|
{
|
|
1418
1436
|
fill: "none",
|
|
1419
|
-
stroke:
|
|
1420
|
-
strokeWidth:
|
|
1421
|
-
points:
|
|
1437
|
+
stroke: N.colour,
|
|
1438
|
+
strokeWidth: b ? 1 : 2,
|
|
1439
|
+
points: L.map(([F, ne]) => `${F},${ne}`).join(" ")
|
|
1422
1440
|
},
|
|
1423
|
-
|
|
1441
|
+
P
|
|
1424
1442
|
)),
|
|
1425
|
-
!
|
|
1426
|
-
] },
|
|
1443
|
+
!b && N.positions.map((L, P) => L != null && /* @__PURE__ */ n("circle", { cx: m(P), cy: w(L), r: 2.4, fill: N.colour, children: /* @__PURE__ */ n("title", { children: `${N.driverName} — ${s[P].label}: P${L}` }) }, P))
|
|
1444
|
+
] }, N.driverName);
|
|
1427
1445
|
})
|
|
1428
1446
|
]
|
|
1429
1447
|
}
|
|
1430
1448
|
),
|
|
1431
1449
|
/* @__PURE__ */ l("div", { className: "pvx-positions-legend", children: [
|
|
1432
|
-
o.map((
|
|
1433
|
-
const
|
|
1450
|
+
o.map((N) => {
|
|
1451
|
+
const b = R && !r.has(N.driverName);
|
|
1434
1452
|
return /* @__PURE__ */ l(
|
|
1435
1453
|
"button",
|
|
1436
1454
|
{
|
|
1437
1455
|
type: "button",
|
|
1438
1456
|
className: "pvx-positions-legend-item",
|
|
1439
|
-
style: { opacity:
|
|
1440
|
-
onClick: () => i(
|
|
1457
|
+
style: { opacity: b ? 0.4 : 1 },
|
|
1458
|
+
onClick: () => i(N.driverName),
|
|
1441
1459
|
children: [
|
|
1442
|
-
/* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background:
|
|
1443
|
-
|
|
1460
|
+
/* @__PURE__ */ n("span", { className: "pvx-positions-swatch", style: { background: N.colour } }),
|
|
1461
|
+
N.driverName
|
|
1444
1462
|
]
|
|
1445
1463
|
},
|
|
1446
|
-
|
|
1464
|
+
N.driverName
|
|
1447
1465
|
);
|
|
1448
1466
|
}),
|
|
1449
|
-
|
|
1467
|
+
R && /* @__PURE__ */ n(
|
|
1450
1468
|
"button",
|
|
1451
1469
|
{
|
|
1452
1470
|
type: "button",
|
|
@@ -1458,110 +1476,110 @@ function Sn({ title: e, drivers: r, timingPoints: t }) {
|
|
|
1458
1476
|
] })
|
|
1459
1477
|
] });
|
|
1460
1478
|
}
|
|
1461
|
-
function
|
|
1462
|
-
const
|
|
1463
|
-
const a = [...new Set(
|
|
1464
|
-
return a.length <= 1 ? [{ title: a[0] || null, drivers:
|
|
1479
|
+
function Dn({ positions: e }) {
|
|
1480
|
+
const t = (e == null ? void 0 : e.timingPoints) || [], s = (e == null ? void 0 : e.drivers) || [], r = $(() => {
|
|
1481
|
+
const a = [...new Set(s.map((i) => i.carClass).filter(Boolean))];
|
|
1482
|
+
return a.length <= 1 ? [{ title: a[0] || null, drivers: s }] : a.sort().map((i) => ({
|
|
1465
1483
|
title: i,
|
|
1466
|
-
drivers:
|
|
1467
|
-
|
|
1468
|
-
|
|
1484
|
+
drivers: Tn(
|
|
1485
|
+
s.filter((o) => o.carClass === i),
|
|
1486
|
+
t.length
|
|
1469
1487
|
)
|
|
1470
1488
|
}));
|
|
1471
|
-
}, [
|
|
1472
|
-
return !
|
|
1473
|
-
|
|
1489
|
+
}, [s, t.length]);
|
|
1490
|
+
return !t.length || !s.length ? /* @__PURE__ */ n("div", { className: "pvx-positions-empty", children: "No position data available for this race." }) : /* @__PURE__ */ n("div", { className: "pvx-positions", children: r.map((a, i) => /* @__PURE__ */ n(
|
|
1491
|
+
Mn,
|
|
1474
1492
|
{
|
|
1475
|
-
title:
|
|
1493
|
+
title: r.length > 1 ? a.title : null,
|
|
1476
1494
|
drivers: a.drivers,
|
|
1477
|
-
timingPoints:
|
|
1495
|
+
timingPoints: t
|
|
1478
1496
|
},
|
|
1479
1497
|
a.title || i
|
|
1480
1498
|
)) });
|
|
1481
1499
|
}
|
|
1482
|
-
function
|
|
1500
|
+
function Rt({ competitionId: e, roundNumber: t, className: s }) {
|
|
1483
1501
|
var p;
|
|
1484
|
-
const { data:
|
|
1502
|
+
const { data: r, isLoading: a } = nn(e, t);
|
|
1485
1503
|
if (a)
|
|
1486
1504
|
return /* @__PURE__ */ n(V, { message: "Loading results..." });
|
|
1487
|
-
if (!
|
|
1505
|
+
if (!r)
|
|
1488
1506
|
return /* @__PURE__ */ n(U, { message: "No results for this round." });
|
|
1489
|
-
const o = (
|
|
1490
|
-
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${
|
|
1507
|
+
const o = (r.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
|
|
1508
|
+
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${s || ""}`, children: [
|
|
1491
1509
|
/* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
|
|
1492
1510
|
/* @__PURE__ */ l("div", { children: [
|
|
1493
1511
|
/* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
|
|
1494
1512
|
"Round ",
|
|
1495
|
-
|
|
1496
|
-
|
|
1513
|
+
r.roundNumber,
|
|
1514
|
+
r.track ? `: ${r.track}` : ""
|
|
1497
1515
|
] }),
|
|
1498
|
-
|
|
1516
|
+
r.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(r.startTime).toLocaleDateString("en-GB", {
|
|
1499
1517
|
day: "numeric",
|
|
1500
1518
|
month: "long",
|
|
1501
1519
|
year: "numeric"
|
|
1502
1520
|
}) })
|
|
1503
1521
|
] }),
|
|
1504
1522
|
(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: [
|
|
1505
|
-
/* @__PURE__ */ n("span", { children:
|
|
1523
|
+
/* @__PURE__ */ n("span", { children: he[c.position - 1] }),
|
|
1506
1524
|
/* @__PURE__ */ n("span", { children: c.driverName })
|
|
1507
1525
|
] }, c.driverId)) })
|
|
1508
1526
|
] }),
|
|
1509
|
-
/* @__PURE__ */ n(
|
|
1527
|
+
/* @__PURE__ */ n(ve, { round: r, competitionId: e })
|
|
1510
1528
|
] });
|
|
1511
1529
|
}
|
|
1512
|
-
function
|
|
1513
|
-
var
|
|
1514
|
-
const [
|
|
1530
|
+
function ve({ round: e, competitionId: t, className: s }) {
|
|
1531
|
+
var h, k, x, g, y, m;
|
|
1532
|
+
const [r, a] = B(null), i = (e == null ? void 0 : e.sessions) || [];
|
|
1515
1533
|
if (!i.length)
|
|
1516
1534
|
return /* @__PURE__ */ n(U, { message: "No session data for this round." });
|
|
1517
|
-
const { data: o } =
|
|
1518
|
-
|
|
1535
|
+
const { data: o } = an(
|
|
1536
|
+
t,
|
|
1519
1537
|
e == null ? void 0 : e.roundNumber,
|
|
1520
1538
|
{}
|
|
1521
|
-
), d = i.some((
|
|
1522
|
-
|
|
1539
|
+
), d = i.some((w) => w.type === "RACE"), { data: p } = on(
|
|
1540
|
+
t,
|
|
1523
1541
|
e == null ? void 0 : e.roundNumber,
|
|
1524
|
-
{ enabled: !!
|
|
1525
|
-
), c =
|
|
1526
|
-
return /* @__PURE__ */ l("div", { className:
|
|
1542
|
+
{ enabled: !!t && d }
|
|
1543
|
+
), c = r || ((h = i.find((w) => w.type === "RACE")) == null ? void 0 : h.type) || ((k = i[0]) == null ? void 0 : k.type), u = i.find((w) => w.type === c) || i[0], v = ((g = (x = o == null ? void 0 : o.sessions) == null ? void 0 : x.find((w) => w.type === c)) == null ? void 0 : g.drivers) || null, f = (u == null ? void 0 : u.type) === "RACE" && ((y = p == null ? void 0 : p.timingPoints) == null ? void 0 : y.length) > 0 && ((m = p == null ? void 0 : p.drivers) == null ? void 0 : m.length) > 0;
|
|
1544
|
+
return /* @__PURE__ */ l("div", { className: s || "", children: [
|
|
1527
1545
|
/* @__PURE__ */ n(
|
|
1528
|
-
|
|
1546
|
+
xn,
|
|
1529
1547
|
{
|
|
1530
1548
|
sessions: i,
|
|
1531
1549
|
activeSession: c,
|
|
1532
1550
|
onSelect: a
|
|
1533
1551
|
}
|
|
1534
1552
|
),
|
|
1535
|
-
/* @__PURE__ */ n(
|
|
1553
|
+
/* @__PURE__ */ n(Pn, { session: u, sessionLaps: v }),
|
|
1536
1554
|
f && /* @__PURE__ */ l("div", { className: "pvx-positions-section", children: [
|
|
1537
1555
|
/* @__PURE__ */ n("div", { className: "pvx-positions-section-title", children: "Race Positions" }),
|
|
1538
|
-
/* @__PURE__ */ n(
|
|
1556
|
+
/* @__PURE__ */ n(Dn, { positions: p })
|
|
1539
1557
|
] })
|
|
1540
1558
|
] });
|
|
1541
1559
|
}
|
|
1542
|
-
function
|
|
1543
|
-
var
|
|
1544
|
-
const
|
|
1545
|
-
if (!((
|
|
1560
|
+
function Pn({ session: e, sessionLaps: t }) {
|
|
1561
|
+
var u;
|
|
1562
|
+
const s = e.type === "RACE", [r, a] = B(null);
|
|
1563
|
+
if (!((u = e.results) != null && u.length))
|
|
1546
1564
|
return /* @__PURE__ */ n(U, { message: `No results for ${e.type}.` });
|
|
1547
|
-
const i =
|
|
1548
|
-
var
|
|
1549
|
-
const
|
|
1565
|
+
const i = Nn(e.results), o = s ? 7 : 4, d = [...new Set(e.results.map((v) => v.carClass).filter(Boolean))], p = d.length > 1, c = (v, f, h) => {
|
|
1566
|
+
var g;
|
|
1567
|
+
const k = (g = t == null ? void 0 : t[v.driverId]) == null ? void 0 : g.laps, x = r === v.driverId && !!k;
|
|
1550
1568
|
return /* @__PURE__ */ n(
|
|
1551
|
-
|
|
1569
|
+
An,
|
|
1552
1570
|
{
|
|
1553
|
-
result:
|
|
1554
|
-
isRace:
|
|
1571
|
+
result: v,
|
|
1572
|
+
isRace: s,
|
|
1555
1573
|
fastestSplits: i,
|
|
1556
1574
|
rowIndex: f,
|
|
1557
|
-
displayPosition:
|
|
1558
|
-
hasLapDetail: !!
|
|
1575
|
+
displayPosition: h,
|
|
1576
|
+
hasLapDetail: !!k,
|
|
1559
1577
|
isExpanded: x,
|
|
1560
|
-
onToggle: () => a(x ? null :
|
|
1561
|
-
driverLaps: x ?
|
|
1578
|
+
onToggle: () => a(x ? null : v.driverId),
|
|
1579
|
+
driverLaps: x ? k : null,
|
|
1562
1580
|
colCount: o
|
|
1563
1581
|
},
|
|
1564
|
-
|
|
1582
|
+
v.driverId || f
|
|
1565
1583
|
);
|
|
1566
1584
|
};
|
|
1567
1585
|
return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
@@ -1570,36 +1588,36 @@ function Rn({ session: e, sessionLaps: r }) {
|
|
|
1570
1588
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1571
1589
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1572
1590
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1573
|
-
|
|
1591
|
+
s && /* @__PURE__ */ l(_, { children: [
|
|
1574
1592
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1575
1593
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1576
1594
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1577
1595
|
] })
|
|
1578
1596
|
] }) }),
|
|
1579
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((
|
|
1580
|
-
const f = e.results.filter((
|
|
1597
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p ? d.sort().map((v) => {
|
|
1598
|
+
const f = e.results.filter((h) => h.carClass === v).sort((h, k) => (h.classPosition ?? h.position) - (k.classPosition ?? k.position));
|
|
1581
1599
|
return [
|
|
1582
|
-
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: o, className: "pvx-td pvx-td--class-header", children:
|
|
1600
|
+
/* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--class-header", children: /* @__PURE__ */ n("td", { colSpan: o, className: "pvx-td pvx-td--class-header", children: v }) }, `hdr-${v}`),
|
|
1583
1601
|
...f.map(
|
|
1584
|
-
(
|
|
1602
|
+
(h, k) => c(h, k, h.classPosition ?? h.position)
|
|
1585
1603
|
)
|
|
1586
1604
|
];
|
|
1587
|
-
}) : e.results.map((
|
|
1605
|
+
}) : e.results.map((v, f) => c(v, f)) })
|
|
1588
1606
|
] }) });
|
|
1589
1607
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const
|
|
1608
|
+
function An({ result: e, isRace: t, fastestSplits: s, rowIndex: r, displayPosition: a, hasLapDetail: i, isExpanded: o, onToggle: d, driverLaps: p, colCount: c }) {
|
|
1609
|
+
const u = a ?? e.position, v = u <= 3;
|
|
1592
1610
|
return /* @__PURE__ */ l(_, { children: [
|
|
1593
1611
|
/* @__PURE__ */ l(
|
|
1594
1612
|
"tr",
|
|
1595
1613
|
{
|
|
1596
|
-
className: `pvx-row ${
|
|
1614
|
+
className: `pvx-row ${v ? "pvx-row--podium" : ""} ${i ? "pvx-row--expandable" : ""}`,
|
|
1597
1615
|
onClick: i ? d : void 0,
|
|
1598
1616
|
style: i ? { cursor: "pointer" } : void 0,
|
|
1599
1617
|
children: [
|
|
1600
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
1618
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: u }) }),
|
|
1601
1619
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1602
|
-
/* @__PURE__ */ n(
|
|
1620
|
+
/* @__PURE__ */ n(X, { nation: e.nation }),
|
|
1603
1621
|
e.driverName,
|
|
1604
1622
|
e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
|
|
1605
1623
|
"#",
|
|
@@ -1607,18 +1625,18 @@ function Tn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, displayPositi
|
|
|
1607
1625
|
] }),
|
|
1608
1626
|
e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
|
|
1609
1627
|
] }),
|
|
1610
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
1628
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1611
1629
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1612
|
-
|
|
1630
|
+
In,
|
|
1613
1631
|
{
|
|
1614
1632
|
bestLap: e.bestLapFormatted,
|
|
1615
1633
|
hasBestLap: e.hasBestLap,
|
|
1616
1634
|
splits: e.splits,
|
|
1617
|
-
fastestSplits:
|
|
1618
|
-
showAbove:
|
|
1635
|
+
fastestSplits: s,
|
|
1636
|
+
showAbove: r <= 1
|
|
1619
1637
|
}
|
|
1620
1638
|
) }),
|
|
1621
|
-
|
|
1639
|
+
t && /* @__PURE__ */ l(_, { children: [
|
|
1622
1640
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
|
|
1623
1641
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
|
|
1624
1642
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
|
|
@@ -1634,11 +1652,11 @@ function Tn({ result: e, isRace: r, fastestSplits: t, rowIndex: s, displayPositi
|
|
|
1634
1652
|
]
|
|
1635
1653
|
}
|
|
1636
1654
|
),
|
|
1637
|
-
o && 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(
|
|
1655
|
+
o && 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(Bn, { laps: p }) }) })
|
|
1638
1656
|
] });
|
|
1639
1657
|
}
|
|
1640
|
-
function
|
|
1641
|
-
const
|
|
1658
|
+
function Bn({ laps: e }) {
|
|
1659
|
+
const t = Math.min(...e.filter((s) => s.valid && s.timeMs > 0).map((s) => s.timeMs));
|
|
1642
1660
|
return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1643
1661
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1644
1662
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
@@ -1647,23 +1665,23 @@ function Mn({ laps: e }) {
|
|
|
1647
1665
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1648
1666
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1649
1667
|
] }) }),
|
|
1650
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((
|
|
1668
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((s) => {
|
|
1651
1669
|
var a;
|
|
1652
|
-
const
|
|
1653
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1654
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children:
|
|
1655
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children:
|
|
1656
|
-
(
|
|
1657
|
-
Array.from({ length: Math.max(0, 3 - (((a =
|
|
1658
|
-
] },
|
|
1670
|
+
const r = s.valid && s.timeMs === t;
|
|
1671
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${s.valid ? "" : "pvx-row--invalid"} ${r ? "pvx-row--fastest" : ""}`, children: [
|
|
1672
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: s.lap }),
|
|
1673
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: s.time }),
|
|
1674
|
+
(s.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
|
|
1675
|
+
Array.from({ length: Math.max(0, 3 - (((a = s.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
|
|
1676
|
+
] }, s.lap);
|
|
1659
1677
|
}) })
|
|
1660
1678
|
] });
|
|
1661
1679
|
}
|
|
1662
|
-
function
|
|
1663
|
-
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${
|
|
1680
|
+
function In({ bestLap: e, hasBestLap: t, splits: s, fastestSplits: r, showAbove: a }) {
|
|
1681
|
+
return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1664
1682
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1665
|
-
(
|
|
1666
|
-
const d =
|
|
1683
|
+
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
|
|
1684
|
+
const d = r && i === r[o];
|
|
1667
1685
|
return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1668
1686
|
/* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1669
1687
|
"S",
|
|
@@ -1674,13 +1692,13 @@ function Dn({ bestLap: e, hasBestLap: r, splits: t, fastestSplits: s, showAbove:
|
|
|
1674
1692
|
}) }) })
|
|
1675
1693
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1676
1694
|
}
|
|
1677
|
-
function
|
|
1678
|
-
const { getSteamId:
|
|
1695
|
+
function Tt({ competitionId: e, className: t }) {
|
|
1696
|
+
const { getSteamId: s } = C(), { data: r, isLoading: a } = $e(e), i = s();
|
|
1679
1697
|
if (a)
|
|
1680
1698
|
return /* @__PURE__ */ n(V, { message: "Loading drivers..." });
|
|
1681
|
-
const o = (
|
|
1682
|
-
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${
|
|
1683
|
-
var c,
|
|
1699
|
+
const o = (r == null ? void 0 : r.drivers) || (r == null ? void 0 : r.entries) || [];
|
|
1700
|
+
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
|
|
1701
|
+
var c, u;
|
|
1684
1702
|
const p = i && d.steamId === i;
|
|
1685
1703
|
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
|
|
1686
1704
|
d.avatarUrl ? /* @__PURE__ */ n(
|
|
@@ -1690,7 +1708,7 @@ function St({ competitionId: e, className: r }) {
|
|
|
1690
1708
|
alt: "",
|
|
1691
1709
|
className: "pvx-entry-avatar"
|
|
1692
1710
|
}
|
|
1693
|
-
) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((
|
|
1711
|
+
) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((u = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : u.toUpperCase()) || "?" }),
|
|
1694
1712
|
/* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
|
|
1695
1713
|
d.displayName,
|
|
1696
1714
|
p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
@@ -1698,24 +1716,24 @@ function St({ competitionId: e, className: r }) {
|
|
|
1698
1716
|
] }, d.steamId || d.driverId);
|
|
1699
1717
|
}) }) : /* @__PURE__ */ n(U, { message: "No drivers registered yet." });
|
|
1700
1718
|
}
|
|
1701
|
-
function
|
|
1719
|
+
function Mt({
|
|
1702
1720
|
competitionId: e,
|
|
1703
|
-
driverData:
|
|
1704
|
-
className:
|
|
1705
|
-
children:
|
|
1721
|
+
driverData: t,
|
|
1722
|
+
className: s,
|
|
1723
|
+
children: r
|
|
1706
1724
|
}) {
|
|
1707
|
-
const { data: a, isLoading: i } =
|
|
1708
|
-
o && p.mutate(
|
|
1709
|
-
},
|
|
1725
|
+
const { data: a, isLoading: i } = le(e), { isPowerMode: o } = ce(), d = de(e), p = Re(e), c = Te(e), u = (a == null ? void 0 : a.isRegistered) || !1, v = i || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
|
|
1726
|
+
o && p.mutate(t || {});
|
|
1727
|
+
}, k = () => {
|
|
1710
1728
|
o && c.mutate();
|
|
1711
1729
|
};
|
|
1712
|
-
return typeof
|
|
1730
|
+
return typeof r == "function" ? r({ isRegistered: u, isLoading: v, register: h, withdraw: k, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
|
|
1713
1731
|
"button",
|
|
1714
1732
|
{
|
|
1715
|
-
className: `pvx-comp-register-btn ${
|
|
1716
|
-
onClick:
|
|
1717
|
-
disabled:
|
|
1718
|
-
children:
|
|
1733
|
+
className: `pvx-comp-register-btn ${s || ""}`,
|
|
1734
|
+
onClick: u ? k : h,
|
|
1735
|
+
disabled: v,
|
|
1736
|
+
children: v ? "Loading..." : u ? "Withdraw" : "Register"
|
|
1719
1737
|
}
|
|
1720
1738
|
) : /* @__PURE__ */ n(
|
|
1721
1739
|
"a",
|
|
@@ -1723,51 +1741,51 @@ function $t({
|
|
|
1723
1741
|
href: d,
|
|
1724
1742
|
target: "_blank",
|
|
1725
1743
|
rel: "noopener noreferrer",
|
|
1726
|
-
className: `pvx-comp-register-link ${
|
|
1727
|
-
children:
|
|
1744
|
+
className: `pvx-comp-register-link ${s || ""}`,
|
|
1745
|
+
children: u ? "View Registration" : "Register on PitVox"
|
|
1728
1746
|
}
|
|
1729
1747
|
);
|
|
1730
1748
|
}
|
|
1731
|
-
function
|
|
1732
|
-
const { getSteamId: a } =
|
|
1733
|
-
return p ||
|
|
1734
|
-
|
|
1749
|
+
function Dt({ competitionId: e, registration: t, onWithdrawSuccess: s, className: r }) {
|
|
1750
|
+
const { getSteamId: a } = C(), { isPowerMode: i } = ce(), o = de(e), { data: d, isLoading: p } = le(e), { data: c, isLoading: u } = $e(e), v = Re(e), f = Te(e), h = a(), k = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], g = t || {}, y = x.length || g.currentCount || 0, m = g.maxParticipants && y >= g.maxParticipants, w = g.deadline && new Date(g.deadline) < /* @__PURE__ */ new Date(), S = g.isOpen && !w && !m;
|
|
1751
|
+
return p || u ? /* @__PURE__ */ n(V, { message: "Loading registration..." }) : k ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n(
|
|
1752
|
+
Fn,
|
|
1735
1753
|
{
|
|
1736
1754
|
competitionId: e,
|
|
1737
1755
|
drivers: x,
|
|
1738
|
-
steamId:
|
|
1756
|
+
steamId: h,
|
|
1739
1757
|
isPowerMode: i,
|
|
1740
1758
|
registrationUrl: o,
|
|
1741
1759
|
withdrawMutation: f,
|
|
1742
|
-
onWithdrawSuccess:
|
|
1743
|
-
registration:
|
|
1760
|
+
onWithdrawSuccess: s,
|
|
1761
|
+
registration: g
|
|
1744
1762
|
}
|
|
1745
|
-
) }) :
|
|
1746
|
-
|
|
1763
|
+
) }) : S ? h ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n(
|
|
1764
|
+
Un,
|
|
1747
1765
|
{
|
|
1748
1766
|
competitionId: e,
|
|
1749
|
-
registerMutation:
|
|
1750
|
-
registration:
|
|
1767
|
+
registerMutation: v,
|
|
1768
|
+
registration: g
|
|
1751
1769
|
}
|
|
1752
|
-
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${
|
|
1753
|
-
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: m ? "Registration is full." :
|
|
1754
|
-
x.length > 0 && /* @__PURE__ */ n(
|
|
1770
|
+
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: i ? /* @__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: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${r || ""}`, children: [
|
|
1771
|
+
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: m ? "Registration is full." : w ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1772
|
+
x.length > 0 && /* @__PURE__ */ n(Ue, { drivers: x, steamId: h })
|
|
1755
1773
|
] });
|
|
1756
1774
|
}
|
|
1757
|
-
function
|
|
1758
|
-
const [
|
|
1759
|
-
|
|
1760
|
-
discordUsername:
|
|
1775
|
+
function Un({ competitionId: e, registerMutation: t, registration: s }) {
|
|
1776
|
+
const [r, a] = B(""), [i, o] = B("intermediate"), [d, p] = B(""), c = (h) => {
|
|
1777
|
+
h.preventDefault(), t.mutate({
|
|
1778
|
+
discordUsername: r || void 0,
|
|
1761
1779
|
experience: i,
|
|
1762
1780
|
comments: d || void 0
|
|
1763
1781
|
});
|
|
1764
|
-
},
|
|
1782
|
+
}, u = s || {}, v = u.currentCount || 0, f = u.maxParticipants;
|
|
1765
1783
|
return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
|
|
1766
1784
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1767
1785
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1768
|
-
f && /* @__PURE__ */ n(
|
|
1786
|
+
f && /* @__PURE__ */ n(Fe, { count: v, max: f })
|
|
1769
1787
|
] }),
|
|
1770
|
-
|
|
1788
|
+
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1771
1789
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
1772
1790
|
/* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${e}`, children: [
|
|
1773
1791
|
"Discord Username ",
|
|
@@ -1780,8 +1798,8 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
|
|
|
1780
1798
|
type: "text",
|
|
1781
1799
|
className: "pvx-reg-input",
|
|
1782
1800
|
placeholder: "e.g. username",
|
|
1783
|
-
value:
|
|
1784
|
-
onChange: (
|
|
1801
|
+
value: r,
|
|
1802
|
+
onChange: (h) => a(h.target.value)
|
|
1785
1803
|
}
|
|
1786
1804
|
)
|
|
1787
1805
|
] }),
|
|
@@ -1793,7 +1811,7 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
|
|
|
1793
1811
|
id: `pvx-exp-${e}`,
|
|
1794
1812
|
className: "pvx-reg-select",
|
|
1795
1813
|
value: i,
|
|
1796
|
-
onChange: (
|
|
1814
|
+
onChange: (h) => o(h.target.value),
|
|
1797
1815
|
children: [
|
|
1798
1816
|
/* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
|
|
1799
1817
|
/* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
|
|
@@ -1815,7 +1833,7 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
|
|
|
1815
1833
|
rows: 3,
|
|
1816
1834
|
placeholder: "Anything the organisers should know?",
|
|
1817
1835
|
value: d,
|
|
1818
|
-
onChange: (
|
|
1836
|
+
onChange: (h) => p(h.target.value)
|
|
1819
1837
|
}
|
|
1820
1838
|
)
|
|
1821
1839
|
] }),
|
|
@@ -1824,28 +1842,28 @@ function Pn({ competitionId: e, registerMutation: r, registration: t }) {
|
|
|
1824
1842
|
{
|
|
1825
1843
|
type: "submit",
|
|
1826
1844
|
className: "pvx-comp-register-btn",
|
|
1827
|
-
disabled:
|
|
1828
|
-
children:
|
|
1845
|
+
disabled: t.isPending,
|
|
1846
|
+
children: t.isPending ? "Registering..." : "Register"
|
|
1829
1847
|
}
|
|
1830
1848
|
) })
|
|
1831
1849
|
] });
|
|
1832
1850
|
}
|
|
1833
|
-
function
|
|
1834
|
-
const [p, c] = B(!1),
|
|
1851
|
+
function Fn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1852
|
+
const [p, c] = B(!1), u = () => {
|
|
1835
1853
|
i.mutate(void 0, {
|
|
1836
1854
|
onSuccess: () => {
|
|
1837
1855
|
c(!1), o && o();
|
|
1838
1856
|
}
|
|
1839
1857
|
});
|
|
1840
|
-
},
|
|
1858
|
+
}, v = d || {}, f = t.length || v.currentCount || 0, h = v.maxParticipants;
|
|
1841
1859
|
return /* @__PURE__ */ l(_, { children: [
|
|
1842
1860
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1843
1861
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1844
|
-
|
|
1862
|
+
h && /* @__PURE__ */ n(Fe, { count: f, max: h })
|
|
1845
1863
|
] }),
|
|
1846
|
-
/* @__PURE__ */ n(
|
|
1864
|
+
/* @__PURE__ */ n(Ue, { drivers: t, steamId: s }),
|
|
1847
1865
|
i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1848
|
-
|
|
1866
|
+
r ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
|
|
1849
1867
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1850
1868
|
/* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1851
1869
|
/* @__PURE__ */ n(
|
|
@@ -1862,7 +1880,7 @@ function Bn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registra
|
|
|
1862
1880
|
{
|
|
1863
1881
|
type: "button",
|
|
1864
1882
|
className: "pvx-reg-danger-btn",
|
|
1865
|
-
onClick:
|
|
1883
|
+
onClick: u,
|
|
1866
1884
|
disabled: i.isPending,
|
|
1867
1885
|
children: i.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1868
1886
|
}
|
|
@@ -1879,101 +1897,115 @@ function Bn({ competitionId: e, drivers: r, steamId: t, isPowerMode: s, registra
|
|
|
1879
1897
|
) }) : /* @__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" }) })
|
|
1880
1898
|
] });
|
|
1881
1899
|
}
|
|
1882
|
-
function
|
|
1900
|
+
function Ue({ drivers: e, steamId: t }) {
|
|
1883
1901
|
if (!e.length)
|
|
1884
1902
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1885
|
-
const
|
|
1886
|
-
const i =
|
|
1903
|
+
const s = [...e].sort((r, a) => {
|
|
1904
|
+
const i = t && r.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
|
|
1887
1905
|
return i - o;
|
|
1888
1906
|
});
|
|
1889
|
-
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children:
|
|
1907
|
+
return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: s.map((r) => {
|
|
1890
1908
|
var i, o;
|
|
1891
|
-
const a =
|
|
1909
|
+
const a = t && r.steamId === t;
|
|
1892
1910
|
return /* @__PURE__ */ l(
|
|
1893
1911
|
"div",
|
|
1894
1912
|
{
|
|
1895
1913
|
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1896
1914
|
children: [
|
|
1897
|
-
|
|
1915
|
+
r.avatarUrl ? /* @__PURE__ */ n("img", { src: r.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = r.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
|
|
1898
1916
|
/* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
|
|
1899
|
-
|
|
1917
|
+
r.displayName,
|
|
1900
1918
|
a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1901
1919
|
] })
|
|
1902
1920
|
]
|
|
1903
1921
|
},
|
|
1904
|
-
|
|
1922
|
+
r.steamId || r.driverId
|
|
1905
1923
|
);
|
|
1906
1924
|
}) });
|
|
1907
1925
|
}
|
|
1908
|
-
function
|
|
1909
|
-
const
|
|
1910
|
-
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
1926
|
+
function Fe({ count: e, max: t }) {
|
|
1927
|
+
const s = t ? e / t * 100 : 0, r = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
|
|
1928
|
+
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${r}`, children: [
|
|
1911
1929
|
e,
|
|
1912
1930
|
"/",
|
|
1913
|
-
|
|
1931
|
+
t,
|
|
1914
1932
|
" drivers"
|
|
1915
1933
|
] });
|
|
1916
1934
|
}
|
|
1917
|
-
function
|
|
1918
|
-
const { data:
|
|
1919
|
-
() =>
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
[
|
|
1924
|
-
),
|
|
1925
|
-
() => d.map((w) => w.roundNumber),
|
|
1926
|
-
[d]
|
|
1927
|
-
), { data: c = [], isLoading: h } = Xe(
|
|
1935
|
+
function Pt({ competitionId: e, className: t }) {
|
|
1936
|
+
const { data: s, isLoading: r } = Le(e), a = (s == null ? void 0 : s.type) === "championship", i = (s == null ? void 0 : s.type) === "hotlap", o = $(() => (s == null ? void 0 : s.rounds) || [], [s]), d = i && o.length > 1, p = i && !d, { data: c } = sn(p ? e : null), u = $(
|
|
1937
|
+
() => o.filter((b) => b.isFinalized),
|
|
1938
|
+
[o]
|
|
1939
|
+
), v = $(
|
|
1940
|
+
() => u.map((b) => b.roundNumber),
|
|
1941
|
+
[u]
|
|
1942
|
+
), { data: f = [], isLoading: h } = tn(
|
|
1928
1943
|
e,
|
|
1929
|
-
|
|
1930
|
-
),
|
|
1931
|
-
if (
|
|
1944
|
+
v
|
|
1945
|
+
), k = p && f.length > 0 ? f[0] : null, x = (k == null ? void 0 : k.sessions) || [], g = d ? "standings" : p ? "leaderboard" : a ? "standings" : v.length > 0 ? `round-${v[v.length - 1]}` : null, [y, m] = B(null), w = y || g;
|
|
1946
|
+
if (r || h)
|
|
1932
1947
|
return /* @__PURE__ */ n(V, { message: "Loading results..." });
|
|
1933
|
-
if (!
|
|
1948
|
+
if (!s)
|
|
1934
1949
|
return /* @__PURE__ */ n(U, { message: "Competition not found." });
|
|
1935
|
-
if (!
|
|
1950
|
+
if (!u.length)
|
|
1936
1951
|
return /* @__PURE__ */ n(U, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1939
|
-
|
|
1940
|
-
for (const
|
|
1941
|
-
|
|
1952
|
+
const S = new Map(f.map((b) => [`round-${b.roundNumber}`, b])), R = new Map(f.map((b) => [b.roundNumber, b])), T = [];
|
|
1953
|
+
if (d) {
|
|
1954
|
+
T.push({ id: "standings", label: "Standings" });
|
|
1955
|
+
for (const b of [...o].sort((L, P) => L.roundNumber - P.roundNumber))
|
|
1956
|
+
T.push({ id: `hlround-${b.roundNumber}`, label: `R${b.roundNumber}`, track: b.track || null });
|
|
1957
|
+
} else if (p) {
|
|
1958
|
+
T.push({ id: "leaderboard", label: "Leaderboard" });
|
|
1959
|
+
for (const b of x)
|
|
1960
|
+
T.push({ id: `session-${b.type}`, label: Z(b.type) });
|
|
1961
|
+
} else if (a) {
|
|
1962
|
+
T.push({ id: "standings", label: "Standings" });
|
|
1963
|
+
for (const b of u)
|
|
1964
|
+
T.push({ id: `round-${b.roundNumber}`, label: `R${b.roundNumber}`, track: null });
|
|
1942
1965
|
} else
|
|
1943
|
-
for (const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1966
|
+
for (const b of u)
|
|
1967
|
+
T.push({ id: `round-${b.roundNumber}`, label: `R${b.roundNumber}`, track: null });
|
|
1968
|
+
let N;
|
|
1969
|
+
if (w === "standings")
|
|
1970
|
+
N = /* @__PURE__ */ n($n, { competitionId: e });
|
|
1971
|
+
else if (w === "leaderboard")
|
|
1972
|
+
N = /* @__PURE__ */ n(Ee, { leaderboard: c, config: s });
|
|
1973
|
+
else if (w != null && w.startsWith("hlround-")) {
|
|
1974
|
+
const b = parseInt(w.slice(8), 10), L = o.find((P) => P.roundNumber === b);
|
|
1975
|
+
N = L ? /* @__PURE__ */ n(qn, { competitionId: e, roundMeta: L, roundData: R.get(b) }) : /* @__PURE__ */ n(U, { message: "No results for this round." });
|
|
1976
|
+
} else if (w != null && w.startsWith("session-"))
|
|
1977
|
+
N = /* @__PURE__ */ n(
|
|
1978
|
+
qe,
|
|
1979
|
+
{
|
|
1980
|
+
session: x.find((b) => `session-${b.type}` === w),
|
|
1981
|
+
round: k,
|
|
1982
|
+
competitionId: e
|
|
1983
|
+
}
|
|
1984
|
+
);
|
|
1985
|
+
else {
|
|
1986
|
+
const b = S.get(w);
|
|
1987
|
+
N = b ? /* @__PURE__ */ n(En, { round: b, competitionId: e }) : /* @__PURE__ */ n(U, { message: "No results for this round." });
|
|
1988
|
+
}
|
|
1989
|
+
return /* @__PURE__ */ l("div", { className: t || "", children: [
|
|
1990
|
+
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: T.map((b) => /* @__PURE__ */ l(
|
|
1952
1991
|
"button",
|
|
1953
1992
|
{
|
|
1954
|
-
className: `pvx-results-tab ${
|
|
1955
|
-
onClick: () =>
|
|
1956
|
-
title:
|
|
1993
|
+
className: `pvx-results-tab ${w === b.id ? "pvx-results-tab--active" : ""}`,
|
|
1994
|
+
onClick: () => m(b.id),
|
|
1995
|
+
title: b.track || void 0,
|
|
1957
1996
|
children: [
|
|
1958
|
-
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children:
|
|
1959
|
-
|
|
1997
|
+
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: b.label }),
|
|
1998
|
+
b.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: b.track })
|
|
1960
1999
|
]
|
|
1961
2000
|
},
|
|
1962
|
-
|
|
2001
|
+
b.id
|
|
1963
2002
|
)) }),
|
|
1964
|
-
|
|
1965
|
-
Un,
|
|
1966
|
-
{
|
|
1967
|
-
session: f.find((w) => `session-${w.type}` === v),
|
|
1968
|
-
round: g,
|
|
1969
|
-
competitionId: e
|
|
1970
|
-
}
|
|
1971
|
-
) : k ? /* @__PURE__ */ n(An, { round: k, competitionId: e }) : /* @__PURE__ */ n(U, { message: "No results for this round." })
|
|
2003
|
+
N
|
|
1972
2004
|
] });
|
|
1973
2005
|
}
|
|
1974
|
-
function
|
|
2006
|
+
function En({ round: e, competitionId: t }) {
|
|
1975
2007
|
var i;
|
|
1976
|
-
const
|
|
2008
|
+
const r = (e.sessions || []).find((o) => o.type === "RACE"), a = (i = r == null ? void 0 : r.results) == null ? void 0 : i.filter((o) => o.position <= 3).sort((o, d) => o.position - d.position);
|
|
1977
2009
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
1978
2010
|
/* @__PURE__ */ l("div", { className: "pvx-card-header--split", children: [
|
|
1979
2011
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -1989,18 +2021,18 @@ function An({ round: e, competitionId: r }) {
|
|
|
1989
2021
|
}) })
|
|
1990
2022
|
] }),
|
|
1991
2023
|
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((o) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1992
|
-
/* @__PURE__ */ n("span", { children:
|
|
2024
|
+
/* @__PURE__ */ n("span", { children: he[o.position - 1] }),
|
|
1993
2025
|
/* @__PURE__ */ n("span", { children: o.driverName })
|
|
1994
2026
|
] }, o.driverId)) })
|
|
1995
2027
|
] }),
|
|
1996
|
-
/* @__PURE__ */ n(
|
|
2028
|
+
/* @__PURE__ */ n(ve, { round: e, competitionId: t })
|
|
1997
2029
|
] });
|
|
1998
2030
|
}
|
|
1999
|
-
function
|
|
2000
|
-
var
|
|
2001
|
-
return (
|
|
2031
|
+
function Ee({ leaderboard: e, config: t, heading: s }) {
|
|
2032
|
+
var r;
|
|
2033
|
+
return (r = e == null ? void 0 : e.drivers) != null && r.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2002
2034
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
|
|
2003
|
-
/* @__PURE__ */ n("h4", { className: "pvx-card-title", children: e.track || (
|
|
2035
|
+
/* @__PURE__ */ n("h4", { className: "pvx-card-title", children: s || e.track || (t == null ? void 0 : t.name) || "Hotlap Leaderboard" }),
|
|
2004
2036
|
/* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
|
|
2005
2037
|
e.sessionsCompleted,
|
|
2006
2038
|
" session",
|
|
@@ -2018,241 +2050,266 @@ function In({ leaderboard: e, config: r }) {
|
|
|
2018
2050
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Sessions" }),
|
|
2019
2051
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
|
|
2020
2052
|
] }) }),
|
|
2021
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((
|
|
2022
|
-
const
|
|
2023
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
2024
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
2053
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((a) => {
|
|
2054
|
+
const i = a.position === 1 ? "" : `+${((a.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
|
|
2055
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${a.position <= 3 ? "pvx-row--podium" : ""}`, children: [
|
|
2056
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(me, { position: a.position }) }),
|
|
2025
2057
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
2026
|
-
/* @__PURE__ */ n(
|
|
2027
|
-
|
|
2058
|
+
/* @__PURE__ */ n(X, { nation: a.nation }),
|
|
2059
|
+
a.driverName
|
|
2028
2060
|
] }),
|
|
2029
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
2030
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className:
|
|
2031
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
2032
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children:
|
|
2033
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children:
|
|
2034
|
-
] },
|
|
2061
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(a.carId) }),
|
|
2062
|
+
/* @__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 }) }),
|
|
2063
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.totalLaps }),
|
|
2064
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: a.sessionsParticipated }),
|
|
2065
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i })
|
|
2066
|
+
] }, a.driverId);
|
|
2035
2067
|
}) })
|
|
2036
2068
|
] }) })
|
|
2037
2069
|
] }) : /* @__PURE__ */ n(U, { message: "No lap times recorded yet." });
|
|
2038
2070
|
}
|
|
2039
|
-
function
|
|
2071
|
+
function qe({ session: e, round: t, competitionId: s }) {
|
|
2040
2072
|
return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
2041
|
-
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children:
|
|
2073
|
+
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: Z(e.type) }) }),
|
|
2042
2074
|
/* @__PURE__ */ n(
|
|
2043
|
-
|
|
2075
|
+
ve,
|
|
2044
2076
|
{
|
|
2045
|
-
round: { ...
|
|
2046
|
-
competitionId:
|
|
2077
|
+
round: { ...t, sessions: [e] },
|
|
2078
|
+
competitionId: s
|
|
2047
2079
|
}
|
|
2048
2080
|
)
|
|
2049
2081
|
] }) : /* @__PURE__ */ n(U, { message: "Session data not available." });
|
|
2050
2082
|
}
|
|
2051
|
-
function
|
|
2052
|
-
const {
|
|
2083
|
+
function qn({ competitionId: e, roundMeta: t, roundData: s }) {
|
|
2084
|
+
const { data: r } = rn(e, t.roundNumber), a = (s == null ? void 0 : s.sessions) || [], [i, o] = B("leaderboard"), d = [
|
|
2085
|
+
{ id: "leaderboard", label: "Leaderboard" },
|
|
2086
|
+
...a.map((u) => ({ id: `session-${u.type}`, label: Z(u.type) }))
|
|
2087
|
+
], p = d.some((u) => u.id === i) ? i : "leaderboard", c = `Round ${t.roundNumber}${t.track ? ` — ${t.track}` : ""}`;
|
|
2088
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
2089
|
+
/* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: d.map((u) => /* @__PURE__ */ n(
|
|
2090
|
+
"button",
|
|
2091
|
+
{
|
|
2092
|
+
onClick: () => o(u.id),
|
|
2093
|
+
className: `pvx-session-tab ${p === u.id ? "pvx-session-tab--active" : ""}`,
|
|
2094
|
+
children: u.label
|
|
2095
|
+
},
|
|
2096
|
+
u.id
|
|
2097
|
+
)) }),
|
|
2098
|
+
p === "leaderboard" ? /* @__PURE__ */ n(Ee, { leaderboard: r, heading: c }) : /* @__PURE__ */ n(
|
|
2099
|
+
qe,
|
|
2100
|
+
{
|
|
2101
|
+
session: a.find((u) => `session-${u.type}` === p),
|
|
2102
|
+
round: s,
|
|
2103
|
+
competitionId: e
|
|
2104
|
+
}
|
|
2105
|
+
)
|
|
2106
|
+
] });
|
|
2107
|
+
}
|
|
2108
|
+
function _n(e) {
|
|
2109
|
+
const { cdnUrl: t } = C(), s = M({
|
|
2053
2110
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
2054
|
-
queryFn: () =>
|
|
2111
|
+
queryFn: () => D(t, ye(null, e)),
|
|
2055
2112
|
enabled: !!e,
|
|
2056
2113
|
staleTime: 3e4,
|
|
2057
2114
|
refetchInterval: 3e4
|
|
2058
|
-
}),
|
|
2115
|
+
}), r = s.data;
|
|
2059
2116
|
return {
|
|
2060
|
-
isLoading:
|
|
2061
|
-
error:
|
|
2062
|
-
data:
|
|
2063
|
-
driverName:
|
|
2064
|
-
lapCount:
|
|
2065
|
-
trackBreakdown:
|
|
2066
|
-
carBreakdown:
|
|
2067
|
-
recordsHeld:
|
|
2068
|
-
currentRecords:
|
|
2069
|
-
bestRanking:
|
|
2070
|
-
bestRankingTrackId:
|
|
2071
|
-
bestRankingLayout:
|
|
2072
|
-
bestRankingCarId:
|
|
2073
|
-
generatedAt:
|
|
2117
|
+
isLoading: s.isLoading,
|
|
2118
|
+
error: s.error,
|
|
2119
|
+
data: r ? {
|
|
2120
|
+
driverName: r.driverName || "Driver",
|
|
2121
|
+
lapCount: r.lapCount || 0,
|
|
2122
|
+
trackBreakdown: r.trackBreakdown || [],
|
|
2123
|
+
carBreakdown: r.carBreakdown || [],
|
|
2124
|
+
recordsHeld: r.recordsHeld || 0,
|
|
2125
|
+
currentRecords: r.currentRecords || [],
|
|
2126
|
+
bestRanking: r.bestRanking ?? null,
|
|
2127
|
+
bestRankingTrackId: r.bestRankingTrackId ?? null,
|
|
2128
|
+
bestRankingLayout: r.bestRankingLayout ?? null,
|
|
2129
|
+
bestRankingCarId: r.bestRankingCarId ?? null,
|
|
2130
|
+
generatedAt: r.generatedAt
|
|
2074
2131
|
} : null
|
|
2075
2132
|
};
|
|
2076
2133
|
}
|
|
2077
|
-
function
|
|
2078
|
-
const { cdnUrl:
|
|
2079
|
-
queryKey: ["pitvox", "laps",
|
|
2080
|
-
queryFn: () =>
|
|
2134
|
+
function jn(e) {
|
|
2135
|
+
const { cdnUrl: t, partnerSlug: s } = C(), r = M({
|
|
2136
|
+
queryKey: ["pitvox", "laps", s || "global", e, "index"],
|
|
2137
|
+
queryFn: () => D(t, ye(s, e)),
|
|
2081
2138
|
enabled: !!e,
|
|
2082
2139
|
staleTime: 3e4,
|
|
2083
2140
|
refetchInterval: 3e4
|
|
2084
2141
|
}), a = $(() => {
|
|
2085
2142
|
var i;
|
|
2086
|
-
return ((i =
|
|
2087
|
-
}, [
|
|
2143
|
+
return ((i = r.data) == null ? void 0 : i.combos) || [];
|
|
2144
|
+
}, [r.data]);
|
|
2088
2145
|
return {
|
|
2089
|
-
isLoading:
|
|
2090
|
-
error:
|
|
2146
|
+
isLoading: r.isLoading,
|
|
2147
|
+
error: r.error,
|
|
2091
2148
|
data: a
|
|
2092
2149
|
};
|
|
2093
2150
|
}
|
|
2094
|
-
function
|
|
2095
|
-
const { cdnUrl:
|
|
2096
|
-
return
|
|
2097
|
-
queryKey: ["pitvox", "ratings",
|
|
2098
|
-
queryFn: () =>
|
|
2151
|
+
function _e(e = {}) {
|
|
2152
|
+
const { cdnUrl: t, partnerSlug: s } = C(), { game: r, gameVersion: a, enabled: i = !0 } = e, o = ie(s, r, a, "ratings.json");
|
|
2153
|
+
return M({
|
|
2154
|
+
queryKey: ["pitvox", "ratings", s, r || null, a || null],
|
|
2155
|
+
queryFn: () => D(t, o),
|
|
2099
2156
|
staleTime: 3e4,
|
|
2100
2157
|
refetchInterval: 3e4,
|
|
2101
2158
|
enabled: i
|
|
2102
2159
|
});
|
|
2103
2160
|
}
|
|
2104
|
-
function
|
|
2105
|
-
var
|
|
2106
|
-
const
|
|
2161
|
+
function At(e) {
|
|
2162
|
+
var r;
|
|
2163
|
+
const t = _e(), s = $(() => {
|
|
2107
2164
|
var a;
|
|
2108
|
-
return !((a =
|
|
2165
|
+
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
2109
2166
|
(i) => i.identifier === e
|
|
2110
2167
|
) || null;
|
|
2111
|
-
}, [(
|
|
2168
|
+
}, [(r = t.data) == null ? void 0 : r.drivers, e]);
|
|
2112
2169
|
return {
|
|
2113
|
-
isLoading:
|
|
2114
|
-
error:
|
|
2115
|
-
data:
|
|
2116
|
-
rating:
|
|
2117
|
-
rank:
|
|
2118
|
-
totalDrivers:
|
|
2119
|
-
comboCount:
|
|
2120
|
-
distinctCars:
|
|
2121
|
-
combos:
|
|
2170
|
+
isLoading: t.isLoading,
|
|
2171
|
+
error: t.error,
|
|
2172
|
+
data: s ? {
|
|
2173
|
+
rating: s.rating,
|
|
2174
|
+
rank: s.rank,
|
|
2175
|
+
totalDrivers: t.data.driverCount || t.data.drivers.length,
|
|
2176
|
+
comboCount: s.comboCount || 0,
|
|
2177
|
+
distinctCars: s.distinctCars || 0,
|
|
2178
|
+
combos: s.combos || []
|
|
2122
2179
|
} : null
|
|
2123
2180
|
};
|
|
2124
2181
|
}
|
|
2125
|
-
function
|
|
2126
|
-
const
|
|
2182
|
+
function re(e = {}) {
|
|
2183
|
+
const t = _e(e);
|
|
2127
2184
|
return {
|
|
2128
|
-
data:
|
|
2129
|
-
isLoading:
|
|
2130
|
-
error:
|
|
2185
|
+
data: t.data || null,
|
|
2186
|
+
isLoading: t.isLoading,
|
|
2187
|
+
error: t.error
|
|
2131
2188
|
};
|
|
2132
2189
|
}
|
|
2133
|
-
function
|
|
2190
|
+
function Vn(e) {
|
|
2134
2191
|
var p, c;
|
|
2135
|
-
const { versions:
|
|
2192
|
+
const { versions: t } = Ze(), s = (p = t == null ? void 0 : t.evo) == null ? void 0 : p.default, r = (c = t == null ? void 0 : t.lmu) == null ? void 0 : c.default, a = re({ game: "evo", gameVersion: s, enabled: !!s }), i = re({ game: "acc" }), o = re({ game: "lmu", gameVersion: r, enabled: !!r });
|
|
2136
2193
|
return {
|
|
2137
2194
|
data: $(() => e ? [
|
|
2138
2195
|
{ data: a.data, game: "evo", label: "EVO" },
|
|
2139
2196
|
{ data: i.data, game: "acc", label: "ACC" },
|
|
2140
2197
|
{ data: o.data, game: "lmu", label: "LMU" }
|
|
2141
|
-
].map(({ data:
|
|
2198
|
+
].map(({ data: u, game: v, label: f }) => {
|
|
2142
2199
|
var x;
|
|
2143
|
-
if (!((x =
|
|
2144
|
-
const
|
|
2145
|
-
return
|
|
2146
|
-
game:
|
|
2200
|
+
if (!((x = u == null ? void 0 : u.drivers) != null && x.length)) return null;
|
|
2201
|
+
const h = [...u.drivers].sort((g, y) => y.rating - g.rating), k = h.findIndex((g) => g.identifier === e);
|
|
2202
|
+
return k === -1 ? null : {
|
|
2203
|
+
game: v,
|
|
2147
2204
|
label: f,
|
|
2148
|
-
rating:
|
|
2149
|
-
rank:
|
|
2150
|
-
totalDrivers:
|
|
2205
|
+
rating: h[k].rating,
|
|
2206
|
+
rank: k + 1,
|
|
2207
|
+
totalDrivers: h.length
|
|
2151
2208
|
};
|
|
2152
2209
|
}).filter(Boolean) : [], [e, a.data, i.data, o.data]),
|
|
2153
2210
|
isLoading: a.isLoading || i.isLoading || o.isLoading
|
|
2154
2211
|
};
|
|
2155
2212
|
}
|
|
2156
|
-
function
|
|
2157
|
-
const { cdnUrl: e, partnerSlug:
|
|
2158
|
-
queryKey: ["pitvox", "competitions",
|
|
2213
|
+
function Kn() {
|
|
2214
|
+
const { cdnUrl: e, partnerSlug: t, getSteamId: s, onFetchServerPassword: r } = C(), a = s(), { data: i, isLoading: o } = M({
|
|
2215
|
+
queryKey: ["pitvox", "competitions", t],
|
|
2159
2216
|
queryFn: async () => {
|
|
2160
|
-
const
|
|
2161
|
-
return
|
|
2217
|
+
const h = await D(e, "competitions/index.json");
|
|
2218
|
+
return h != null && h.competitions ? h.competitions.filter((k) => k.partnerSlug === t) : [];
|
|
2162
2219
|
},
|
|
2163
2220
|
staleTime: 6e4
|
|
2164
|
-
}), d = (i == null ? void 0 : i.map((
|
|
2165
|
-
queries: d.map((
|
|
2166
|
-
queryKey: ["pitvox", "competition",
|
|
2167
|
-
queryFn: () =>
|
|
2221
|
+
}), d = (i == null ? void 0 : i.map((h) => h.id)) || [], p = xe({
|
|
2222
|
+
queries: d.map((h) => ({
|
|
2223
|
+
queryKey: ["pitvox", "competition", t, h, "entrylist"],
|
|
2224
|
+
queryFn: () => D(e, `competitions/${t}/${h}/entrylist.json`),
|
|
2168
2225
|
enabled: !!a && d.length > 0,
|
|
2169
2226
|
staleTime: 6e4
|
|
2170
2227
|
}))
|
|
2171
|
-
}), c = p.some((
|
|
2172
|
-
var x,
|
|
2228
|
+
}), c = p.some((h) => h.isLoading), u = $(() => {
|
|
2229
|
+
var x, g;
|
|
2173
2230
|
if (!i || !a || c) return [];
|
|
2174
|
-
const
|
|
2175
|
-
for (let
|
|
2176
|
-
const m = i[
|
|
2177
|
-
if (!((
|
|
2178
|
-
const
|
|
2179
|
-
for (const
|
|
2180
|
-
if (
|
|
2181
|
-
const
|
|
2182
|
-
!
|
|
2231
|
+
const h = /* @__PURE__ */ new Date(), k = [];
|
|
2232
|
+
for (let y = 0; y < i.length; y++) {
|
|
2233
|
+
const m = i[y], w = (x = p[y]) == null ? void 0 : x.data;
|
|
2234
|
+
if (!((g = w == null ? void 0 : w.drivers) == null ? void 0 : g.some((N) => N.steamId === a))) continue;
|
|
2235
|
+
const R = m.type === "hotlap", T = m.rounds || [];
|
|
2236
|
+
for (const N of T) {
|
|
2237
|
+
if (R ? ee(N) : N.isFinalized) continue;
|
|
2238
|
+
const L = N.dediStatus === "running" || N.dediStatus === "provisioning", P = N.dediStatus === "scheduled", F = N.startTime && new Date(N.startTime) > h, ne = L || P || N.dediServerAddress;
|
|
2239
|
+
!L && !F && !ne || k.push({
|
|
2183
2240
|
competitionId: m.id,
|
|
2184
2241
|
competitionName: m.name,
|
|
2185
|
-
roundNumber:
|
|
2186
|
-
track:
|
|
2187
|
-
startTime:
|
|
2188
|
-
dediStatus:
|
|
2189
|
-
dediServerAddress:
|
|
2242
|
+
roundNumber: N.roundNumber,
|
|
2243
|
+
track: N.track || "TBD",
|
|
2244
|
+
startTime: N.startTime,
|
|
2245
|
+
dediStatus: N.dediStatus || null,
|
|
2246
|
+
dediServerAddress: N.dediServerAddress || null
|
|
2190
2247
|
});
|
|
2191
2248
|
}
|
|
2192
2249
|
}
|
|
2193
|
-
return
|
|
2194
|
-
const
|
|
2195
|
-
return
|
|
2196
|
-
}),
|
|
2197
|
-
}, [i, a, c, p]),
|
|
2198
|
-
queries:
|
|
2199
|
-
queryKey: ["pitvox", "serverInfo",
|
|
2200
|
-
queryFn: () =>
|
|
2201
|
-
enabled: !!
|
|
2250
|
+
return k.sort((y, m) => {
|
|
2251
|
+
const w = y.dediStatus === "running" || y.dediStatus === "provisioning", S = m.dediStatus === "running" || m.dediStatus === "provisioning";
|
|
2252
|
+
return w && !S ? -1 : !w && S ? 1 : new Date(y.startTime) - new Date(m.startTime);
|
|
2253
|
+
}), k.length > 0 && (k[0].isNext = !0), k;
|
|
2254
|
+
}, [i, a, c, p]), v = xe({
|
|
2255
|
+
queries: u.map((h) => ({
|
|
2256
|
+
queryKey: ["pitvox", "serverInfo", h.competitionId, h.roundNumber],
|
|
2257
|
+
queryFn: () => r(h.competitionId, h.roundNumber),
|
|
2258
|
+
enabled: !!r && u.length > 0,
|
|
2202
2259
|
staleTime: 5 * 6e4,
|
|
2203
2260
|
// 5 minutes
|
|
2204
2261
|
retry: !1
|
|
2205
2262
|
}))
|
|
2206
2263
|
});
|
|
2207
2264
|
return {
|
|
2208
|
-
data: $(() =>
|
|
2209
|
-
var
|
|
2210
|
-
const x = (
|
|
2265
|
+
data: $(() => u.length ? r ? u.map((h, k) => {
|
|
2266
|
+
var g;
|
|
2267
|
+
const x = (g = v[k]) == null ? void 0 : g.data;
|
|
2211
2268
|
return x != null && x.success ? {
|
|
2212
|
-
...
|
|
2269
|
+
...h,
|
|
2213
2270
|
serverAddress: x.serverAddress || null,
|
|
2214
2271
|
serverPassword: x.serverPassword || null
|
|
2215
|
-
} :
|
|
2216
|
-
}) :
|
|
2272
|
+
} : h;
|
|
2273
|
+
}) : u : [], [u, r, v]),
|
|
2217
2274
|
isLoading: o || !!a && c
|
|
2218
2275
|
};
|
|
2219
2276
|
}
|
|
2220
|
-
function
|
|
2221
|
-
const { onFetchNotifications: e } =
|
|
2277
|
+
function Hn() {
|
|
2278
|
+
const { onFetchNotifications: e } = C();
|
|
2222
2279
|
return !!e;
|
|
2223
2280
|
}
|
|
2224
|
-
function
|
|
2225
|
-
const { onFetchNotifications:
|
|
2226
|
-
return
|
|
2227
|
-
queryKey: ["pitvox", "notifications",
|
|
2228
|
-
queryFn: () =>
|
|
2229
|
-
enabled: !!
|
|
2281
|
+
function Wn(e = {}) {
|
|
2282
|
+
const { onFetchNotifications: t, partnerSlug: s } = C(), { limit: r = 20, unreadOnly: a = !1 } = e;
|
|
2283
|
+
return M({
|
|
2284
|
+
queryKey: ["pitvox", "notifications", s, { limit: r, unreadOnly: a }],
|
|
2285
|
+
queryFn: () => t({ limit: r, unreadOnly: a }),
|
|
2286
|
+
enabled: !!t,
|
|
2230
2287
|
staleTime: 3e4,
|
|
2231
2288
|
refetchInterval: 3e4
|
|
2232
2289
|
});
|
|
2233
2290
|
}
|
|
2234
|
-
function
|
|
2235
|
-
const { onFetchNotifications: e, partnerSlug:
|
|
2236
|
-
queryKey: ["pitvox", "notifications",
|
|
2291
|
+
function Bt() {
|
|
2292
|
+
const { onFetchNotifications: e, partnerSlug: t } = C(), { data: s, isLoading: r } = M({
|
|
2293
|
+
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
2237
2294
|
queryFn: () => e({ limit: 1 }),
|
|
2238
2295
|
enabled: !!e,
|
|
2239
2296
|
staleTime: 3e4,
|
|
2240
2297
|
refetchInterval: 3e4,
|
|
2241
2298
|
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
2242
2299
|
});
|
|
2243
|
-
return { count:
|
|
2300
|
+
return { count: s ?? 0, isLoading: r };
|
|
2244
2301
|
}
|
|
2245
|
-
function
|
|
2246
|
-
const { onMarkNotificationRead: e, partnerSlug:
|
|
2302
|
+
function On() {
|
|
2303
|
+
const { onMarkNotificationRead: e, partnerSlug: t } = C(), s = H();
|
|
2247
2304
|
return Q({
|
|
2248
|
-
mutationFn: (
|
|
2305
|
+
mutationFn: (r) => {
|
|
2249
2306
|
if (!e)
|
|
2250
2307
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
2251
|
-
return e(
|
|
2308
|
+
return e(r);
|
|
2252
2309
|
},
|
|
2253
|
-
onSuccess: (
|
|
2254
|
-
|
|
2255
|
-
{ queryKey: ["pitvox", "notifications",
|
|
2310
|
+
onSuccess: (r, a) => {
|
|
2311
|
+
s.setQueriesData(
|
|
2312
|
+
{ queryKey: ["pitvox", "notifications", t] },
|
|
2256
2313
|
(i) => i != null && i.notifications ? {
|
|
2257
2314
|
...i,
|
|
2258
2315
|
unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
|
|
@@ -2264,8 +2321,8 @@ function Kn() {
|
|
|
2264
2321
|
}
|
|
2265
2322
|
});
|
|
2266
2323
|
}
|
|
2267
|
-
function
|
|
2268
|
-
const { onMarkAllNotificationsRead: e, partnerSlug:
|
|
2324
|
+
function zn() {
|
|
2325
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: t } = C(), s = H();
|
|
2269
2326
|
return Q({
|
|
2270
2327
|
mutationFn: () => {
|
|
2271
2328
|
if (!e)
|
|
@@ -2273,25 +2330,25 @@ function Hn() {
|
|
|
2273
2330
|
return e();
|
|
2274
2331
|
},
|
|
2275
2332
|
onSuccess: () => {
|
|
2276
|
-
|
|
2277
|
-
{ queryKey: ["pitvox", "notifications",
|
|
2278
|
-
(
|
|
2279
|
-
...
|
|
2333
|
+
s.setQueriesData(
|
|
2334
|
+
{ queryKey: ["pitvox", "notifications", t] },
|
|
2335
|
+
(r) => r != null && r.notifications ? {
|
|
2336
|
+
...r,
|
|
2280
2337
|
unreadCount: 0,
|
|
2281
|
-
notifications:
|
|
2338
|
+
notifications: r.notifications.map((a) => ({
|
|
2282
2339
|
...a,
|
|
2283
2340
|
isRead: !0,
|
|
2284
2341
|
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
2285
2342
|
}))
|
|
2286
|
-
} :
|
|
2343
|
+
} : r
|
|
2287
2344
|
);
|
|
2288
2345
|
}
|
|
2289
2346
|
});
|
|
2290
2347
|
}
|
|
2291
|
-
function
|
|
2292
|
-
const a =
|
|
2293
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${
|
|
2294
|
-
|
|
2348
|
+
function Qn({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" }) {
|
|
2349
|
+
const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
2350
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${r}`, children: [
|
|
2351
|
+
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() }),
|
|
2295
2352
|
/* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
|
|
2296
2353
|
/* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
2297
2354
|
a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
|
|
@@ -2301,7 +2358,7 @@ function Wn({ driverName: e, avatarUrl: r, memberSince: t, className: s = "" })
|
|
|
2301
2358
|
] })
|
|
2302
2359
|
] });
|
|
2303
2360
|
}
|
|
2304
|
-
function
|
|
2361
|
+
function Gn() {
|
|
2305
2362
|
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: [
|
|
2306
2363
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2307
2364
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -2309,7 +2366,7 @@ function On() {
|
|
|
2309
2366
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2310
2367
|
] });
|
|
2311
2368
|
}
|
|
2312
|
-
function
|
|
2369
|
+
function Yn() {
|
|
2313
2370
|
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: [
|
|
2314
2371
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2315
2372
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -2318,53 +2375,53 @@ function zn() {
|
|
|
2318
2375
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
2319
2376
|
] });
|
|
2320
2377
|
}
|
|
2321
|
-
function
|
|
2378
|
+
function Ne() {
|
|
2322
2379
|
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" }) });
|
|
2323
2380
|
}
|
|
2324
|
-
function
|
|
2325
|
-
const [o, d] = B(!1), p =
|
|
2326
|
-
|
|
2381
|
+
function be({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i }) {
|
|
2382
|
+
const [o, d] = B(!1), p = Ke(null);
|
|
2383
|
+
He(() => {
|
|
2327
2384
|
if (!o) return;
|
|
2328
|
-
function
|
|
2329
|
-
p.current && !p.current.contains(
|
|
2385
|
+
function u(v) {
|
|
2386
|
+
p.current && !p.current.contains(v.target) && d(!1);
|
|
2330
2387
|
}
|
|
2331
|
-
return document.addEventListener("mousedown",
|
|
2388
|
+
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
2332
2389
|
}, [o]);
|
|
2333
|
-
const c =
|
|
2390
|
+
const c = r != null && r.length ? r.slice().sort((u, v) => v[i] - u[i]) : null;
|
|
2334
2391
|
return /* @__PURE__ */ l(
|
|
2335
2392
|
"div",
|
|
2336
2393
|
{
|
|
2337
2394
|
ref: p,
|
|
2338
2395
|
className: `pvx-dash-stat-card ${c ? "pvx-dash-stat-card--clickable" : ""}`,
|
|
2339
|
-
onClick: c ? () => d((
|
|
2396
|
+
onClick: c ? () => d((u) => !u) : void 0,
|
|
2340
2397
|
children: [
|
|
2341
2398
|
e,
|
|
2342
2399
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2343
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children:
|
|
2344
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children:
|
|
2400
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
2401
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: s })
|
|
2345
2402
|
] }),
|
|
2346
|
-
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((
|
|
2347
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children:
|
|
2348
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children:
|
|
2349
|
-
] },
|
|
2403
|
+
c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, v) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2404
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
|
|
2405
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[i] })
|
|
2406
|
+
] }, v)) })
|
|
2350
2407
|
]
|
|
2351
2408
|
}
|
|
2352
2409
|
);
|
|
2353
2410
|
}
|
|
2354
|
-
function
|
|
2411
|
+
function Jn({ stats: e, gameRatings: t, onGameRatingSelect: s, rating: r, className: a = "" }) {
|
|
2355
2412
|
if (!e) return null;
|
|
2356
2413
|
const i = e.trackBreakdown.map((p) => ({
|
|
2357
2414
|
name: j(p.trackId, p.layout),
|
|
2358
2415
|
lapCount: p.lapCount
|
|
2359
2416
|
})), o = e.carBreakdown.map((p) => ({
|
|
2360
|
-
name:
|
|
2417
|
+
name: I(p.carId),
|
|
2361
2418
|
lapCount: p.lapCount
|
|
2362
|
-
})), d = Array.isArray(
|
|
2419
|
+
})), d = Array.isArray(t) && t.length > 0;
|
|
2363
2420
|
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${a}`, children: [
|
|
2364
2421
|
/* @__PURE__ */ n(
|
|
2365
|
-
|
|
2422
|
+
be,
|
|
2366
2423
|
{
|
|
2367
|
-
icon: /* @__PURE__ */ n(
|
|
2424
|
+
icon: /* @__PURE__ */ n(Gn, {}),
|
|
2368
2425
|
value: e.lapCount.toLocaleString(),
|
|
2369
2426
|
label: "Total Laps",
|
|
2370
2427
|
items: i,
|
|
@@ -2373,9 +2430,9 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
|
|
|
2373
2430
|
}
|
|
2374
2431
|
),
|
|
2375
2432
|
/* @__PURE__ */ n(
|
|
2376
|
-
|
|
2433
|
+
be,
|
|
2377
2434
|
{
|
|
2378
|
-
icon: /* @__PURE__ */ n(
|
|
2435
|
+
icon: /* @__PURE__ */ n(Yn, {}),
|
|
2379
2436
|
value: e.carBreakdown.length,
|
|
2380
2437
|
label: "Cars Used",
|
|
2381
2438
|
items: o,
|
|
@@ -2384,18 +2441,18 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
|
|
|
2384
2441
|
}
|
|
2385
2442
|
),
|
|
2386
2443
|
d ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating-chips", children: [
|
|
2387
|
-
/* @__PURE__ */ n(
|
|
2444
|
+
/* @__PURE__ */ n(Ne, {}),
|
|
2388
2445
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2389
2446
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2390
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children:
|
|
2391
|
-
const c = !!
|
|
2447
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: t.map((p) => {
|
|
2448
|
+
const c = !!s;
|
|
2392
2449
|
return /* @__PURE__ */ l(
|
|
2393
2450
|
"span",
|
|
2394
2451
|
{
|
|
2395
2452
|
className: `pvx-dash-rating-chip${c ? " pvx-dash-rating-chip--clickable" : ""}`,
|
|
2396
|
-
onClick: c ? () =>
|
|
2397
|
-
onKeyDown: c ? (
|
|
2398
|
-
c && (
|
|
2453
|
+
onClick: c ? () => s(p) : void 0,
|
|
2454
|
+
onKeyDown: c ? (v) => {
|
|
2455
|
+
c && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), s(p));
|
|
2399
2456
|
} : void 0,
|
|
2400
2457
|
role: c ? "button" : void 0,
|
|
2401
2458
|
tabIndex: c ? 0 : void 0,
|
|
@@ -2415,23 +2472,23 @@ function Qn({ stats: e, gameRatings: r, onGameRatingSelect: t, rating: s, classN
|
|
|
2415
2472
|
);
|
|
2416
2473
|
}) })
|
|
2417
2474
|
] })
|
|
2418
|
-
] }) :
|
|
2419
|
-
/* @__PURE__ */ n(
|
|
2475
|
+
] }) : r ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2476
|
+
/* @__PURE__ */ n(Ne, {}),
|
|
2420
2477
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
2421
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children:
|
|
2478
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: r.rating.toFixed(1) }),
|
|
2422
2479
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
2423
2480
|
/* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
|
|
2424
2481
|
"#",
|
|
2425
|
-
|
|
2482
|
+
r.rank,
|
|
2426
2483
|
" of ",
|
|
2427
|
-
|
|
2484
|
+
r.totalDrivers
|
|
2428
2485
|
] })
|
|
2429
2486
|
] })
|
|
2430
2487
|
] }) : null
|
|
2431
2488
|
] });
|
|
2432
2489
|
}
|
|
2433
|
-
function
|
|
2434
|
-
return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
2490
|
+
function Zn({ combos: e, onComboSelect: t, className: s = "" }) {
|
|
2491
|
+
return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${s}`, children: [
|
|
2435
2492
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2436
2493
|
/* @__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: [
|
|
2437
2494
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
@@ -2444,36 +2501,36 @@ function Gn({ combos: e, onComboSelect: r, className: t = "" }) {
|
|
|
2444
2501
|
")"
|
|
2445
2502
|
] })
|
|
2446
2503
|
] }) }),
|
|
2447
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((
|
|
2448
|
-
|
|
2504
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((r) => /* @__PURE__ */ n(
|
|
2505
|
+
Xn,
|
|
2449
2506
|
{
|
|
2450
|
-
combo:
|
|
2451
|
-
onClick:
|
|
2507
|
+
combo: r,
|
|
2508
|
+
onClick: t ? () => t(r) : null
|
|
2452
2509
|
},
|
|
2453
|
-
`${
|
|
2510
|
+
`${r.trackId}|${r.trackLayout || ""}|${r.carId}|${r.game || ""}|${r.gameVersion || ""}`
|
|
2454
2511
|
)) })
|
|
2455
2512
|
] }) : null;
|
|
2456
2513
|
}
|
|
2457
|
-
function
|
|
2458
|
-
const
|
|
2514
|
+
function Xn({ combo: e, onClick: t }) {
|
|
2515
|
+
const s = e.game || "evo", r = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
|
|
2459
2516
|
return /* @__PURE__ */ l(
|
|
2460
2517
|
"div",
|
|
2461
2518
|
{
|
|
2462
|
-
className: `pvx-dash-combo-row${
|
|
2463
|
-
onClick:
|
|
2464
|
-
onKeyDown:
|
|
2465
|
-
|
|
2519
|
+
className: `pvx-dash-combo-row${t ? " pvx-dash-combo-row--clickable" : ""}`,
|
|
2520
|
+
onClick: t || void 0,
|
|
2521
|
+
onKeyDown: t ? (d) => {
|
|
2522
|
+
t && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), t());
|
|
2466
2523
|
} : void 0,
|
|
2467
|
-
role:
|
|
2468
|
-
tabIndex:
|
|
2524
|
+
role: t ? "button" : void 0,
|
|
2525
|
+
tabIndex: t ? 0 : void 0,
|
|
2469
2526
|
children: [
|
|
2470
2527
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-info", children: [
|
|
2471
2528
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-title", children: [
|
|
2472
|
-
e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2529
|
+
e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s}`, children: s.toUpperCase() }),
|
|
2473
2530
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: j(e.trackId, e.trackLayout, e.game) })
|
|
2474
2531
|
] }),
|
|
2475
2532
|
/* @__PURE__ */ l("div", { className: "pvx-dash-combo-meta", children: [
|
|
2476
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children:
|
|
2533
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: I(e.carId) }),
|
|
2477
2534
|
e.lapCount > 0 && /* @__PURE__ */ l(_, { children: [
|
|
2478
2535
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2479
2536
|
/* @__PURE__ */ l("span", { children: [
|
|
@@ -2484,7 +2541,7 @@ function Yn({ combo: e, onClick: r }) {
|
|
|
2484
2541
|
] }),
|
|
2485
2542
|
e.lastDrivenAt && /* @__PURE__ */ l(_, { children: [
|
|
2486
2543
|
/* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
|
|
2487
|
-
/* @__PURE__ */ n("span", { children:
|
|
2544
|
+
/* @__PURE__ */ n("span", { children: oe(e.lastDrivenAt) })
|
|
2488
2545
|
] })
|
|
2489
2546
|
] })
|
|
2490
2547
|
] }),
|
|
@@ -2510,9 +2567,9 @@ function Yn({ combo: e, onClick: r }) {
|
|
|
2510
2567
|
e.totalDrivers,
|
|
2511
2568
|
" on leaderboard"
|
|
2512
2569
|
] }) : null,
|
|
2513
|
-
|
|
2570
|
+
r && /* @__PURE__ */ l("span", { className: "pvx-dash-combo-gap", children: [
|
|
2514
2571
|
"+",
|
|
2515
|
-
|
|
2572
|
+
r
|
|
2516
2573
|
] }),
|
|
2517
2574
|
e.personalBestMs && /* @__PURE__ */ n("span", { className: "pvx-dash-combo-pb", children: q(e.personalBestMs) })
|
|
2518
2575
|
] })
|
|
@@ -2520,15 +2577,15 @@ function Yn({ combo: e, onClick: r }) {
|
|
|
2520
2577
|
}
|
|
2521
2578
|
);
|
|
2522
2579
|
}
|
|
2523
|
-
function
|
|
2524
|
-
if (
|
|
2580
|
+
function et({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
2581
|
+
if (t)
|
|
2525
2582
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2526
2583
|
if (!(e != null && e.length))
|
|
2527
2584
|
return null;
|
|
2528
|
-
const a =
|
|
2529
|
-
return /* @__PURE__ */ l("div", { className: `pvx-card ${
|
|
2585
|
+
const a = r ? e.slice(0, r) : e, i = e.length - a.length;
|
|
2586
|
+
return /* @__PURE__ */ l("div", { className: `pvx-card ${s || ""}`, children: [
|
|
2530
2587
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2531
|
-
/* @__PURE__ */ n(
|
|
2588
|
+
/* @__PURE__ */ n(st, {}),
|
|
2532
2589
|
"Upcoming Events",
|
|
2533
2590
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2534
2591
|
"(",
|
|
@@ -2551,7 +2608,7 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
|
|
|
2551
2608
|
o.track
|
|
2552
2609
|
] }),
|
|
2553
2610
|
o.serverPassword && /* @__PURE__ */ n(
|
|
2554
|
-
|
|
2611
|
+
nt,
|
|
2555
2612
|
{
|
|
2556
2613
|
password: o.serverPassword,
|
|
2557
2614
|
address: o.serverAddress
|
|
@@ -2564,7 +2621,7 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
|
|
|
2564
2621
|
month: "short",
|
|
2565
2622
|
year: "numeric"
|
|
2566
2623
|
}) }),
|
|
2567
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." :
|
|
2624
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : tt(o.startTime) }),
|
|
2568
2625
|
o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
|
|
2569
2626
|
!o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2570
2627
|
] })
|
|
@@ -2581,11 +2638,11 @@ function Jn({ events: e, isLoading: r, className: t, limit: s = 3 }) {
|
|
|
2581
2638
|
] })
|
|
2582
2639
|
] });
|
|
2583
2640
|
}
|
|
2584
|
-
function
|
|
2585
|
-
const [
|
|
2641
|
+
function nt({ password: e, address: t }) {
|
|
2642
|
+
const [s, r] = B(!1), [a, i] = B(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = K(async () => {
|
|
2586
2643
|
if (o)
|
|
2587
2644
|
try {
|
|
2588
|
-
await navigator.clipboard.writeText(o),
|
|
2645
|
+
await navigator.clipboard.writeText(o), r(!0), setTimeout(() => r(!1), 2e3);
|
|
2589
2646
|
} catch {
|
|
2590
2647
|
}
|
|
2591
2648
|
}, [o]);
|
|
@@ -2597,9 +2654,9 @@ function Zn({ password: e, address: r }) {
|
|
|
2597
2654
|
onClick: d,
|
|
2598
2655
|
title: "Copy join string to clipboard",
|
|
2599
2656
|
children: [
|
|
2600
|
-
/* @__PURE__ */ n(
|
|
2657
|
+
/* @__PURE__ */ n(at, {}),
|
|
2601
2658
|
" ",
|
|
2602
|
-
|
|
2659
|
+
s ? "Copied!" : "Join"
|
|
2603
2660
|
]
|
|
2604
2661
|
}
|
|
2605
2662
|
),
|
|
@@ -2610,105 +2667,105 @@ function Zn({ password: e, address: r }) {
|
|
|
2610
2667
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2611
2668
|
onClick: () => i((p) => !p),
|
|
2612
2669
|
title: a ? "Hide password" : "Reveal password",
|
|
2613
|
-
children: a ? /* @__PURE__ */ n(
|
|
2670
|
+
children: a ? /* @__PURE__ */ n(ot, {}) : /* @__PURE__ */ n(it, {})
|
|
2614
2671
|
}
|
|
2615
2672
|
),
|
|
2616
2673
|
a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
|
|
2617
|
-
/* @__PURE__ */ n(
|
|
2674
|
+
/* @__PURE__ */ n(rt, {}),
|
|
2618
2675
|
" ",
|
|
2619
2676
|
e
|
|
2620
2677
|
] })
|
|
2621
2678
|
] })
|
|
2622
2679
|
] });
|
|
2623
2680
|
}
|
|
2624
|
-
function
|
|
2625
|
-
const
|
|
2626
|
-
if (
|
|
2627
|
-
const
|
|
2628
|
-
if (
|
|
2629
|
-
if (
|
|
2630
|
-
const
|
|
2631
|
-
if (
|
|
2632
|
-
if (
|
|
2633
|
-
if (
|
|
2634
|
-
const a = Math.floor(
|
|
2681
|
+
function tt(e) {
|
|
2682
|
+
const t = new Date(e).getTime() - Date.now();
|
|
2683
|
+
if (t <= 0) return "Now";
|
|
2684
|
+
const s = Math.floor(t / (1e3 * 60 * 60));
|
|
2685
|
+
if (s < 1) return "Less than 1 hour";
|
|
2686
|
+
if (s < 24) return `in ${s}h`;
|
|
2687
|
+
const r = Math.floor(s / 24);
|
|
2688
|
+
if (r === 1) return "Tomorrow";
|
|
2689
|
+
if (r < 7) return `in ${r} days`;
|
|
2690
|
+
if (r < 30) {
|
|
2691
|
+
const a = Math.floor(r / 7);
|
|
2635
2692
|
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2636
2693
|
}
|
|
2637
|
-
return
|
|
2694
|
+
return oe(e);
|
|
2638
2695
|
}
|
|
2639
|
-
function
|
|
2696
|
+
function st() {
|
|
2640
2697
|
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: [
|
|
2641
2698
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2642
2699
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2643
2700
|
] });
|
|
2644
2701
|
}
|
|
2645
|
-
function
|
|
2702
|
+
function rt() {
|
|
2646
2703
|
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: [
|
|
2647
2704
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2648
2705
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2649
2706
|
] });
|
|
2650
2707
|
}
|
|
2651
|
-
function
|
|
2708
|
+
function at() {
|
|
2652
2709
|
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: [
|
|
2653
2710
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2654
2711
|
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2655
2712
|
] });
|
|
2656
2713
|
}
|
|
2657
|
-
function
|
|
2714
|
+
function it() {
|
|
2658
2715
|
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: [
|
|
2659
2716
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2660
2717
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2661
2718
|
] });
|
|
2662
2719
|
}
|
|
2663
|
-
function
|
|
2720
|
+
function ot() {
|
|
2664
2721
|
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: [
|
|
2665
2722
|
/* @__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" }),
|
|
2666
2723
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2667
2724
|
] });
|
|
2668
2725
|
}
|
|
2669
|
-
function
|
|
2670
|
-
const o =
|
|
2726
|
+
function lt({ notifications: e, unreadCount: t = 0, onMarkRead: s, onMarkAllRead: r, isLoading: a, className: i }) {
|
|
2727
|
+
const o = Ce();
|
|
2671
2728
|
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2672
2729
|
/* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
|
|
2673
2730
|
/* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2674
|
-
/* @__PURE__ */ n(
|
|
2731
|
+
/* @__PURE__ */ n(pt, {}),
|
|
2675
2732
|
"Notifications",
|
|
2676
|
-
|
|
2733
|
+
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2677
2734
|
] }),
|
|
2678
|
-
|
|
2735
|
+
t > 0 && r && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: r, children: "Mark all read" })
|
|
2679
2736
|
] }),
|
|
2680
2737
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2681
|
-
|
|
2738
|
+
ct,
|
|
2682
2739
|
{
|
|
2683
2740
|
notification: d,
|
|
2684
2741
|
getUserDisplay: o,
|
|
2685
|
-
onMarkRead:
|
|
2742
|
+
onMarkRead: s
|
|
2686
2743
|
},
|
|
2687
2744
|
d.id
|
|
2688
2745
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2689
2746
|
] });
|
|
2690
2747
|
}
|
|
2691
|
-
function
|
|
2692
|
-
const
|
|
2693
|
-
!e.isRead &&
|
|
2748
|
+
function ct({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
2749
|
+
const r = () => {
|
|
2750
|
+
!e.isRead && s && s(e.id);
|
|
2694
2751
|
};
|
|
2695
2752
|
return /* @__PURE__ */ l(
|
|
2696
2753
|
"button",
|
|
2697
2754
|
{
|
|
2698
2755
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2699
|
-
onClick:
|
|
2756
|
+
onClick: r,
|
|
2700
2757
|
children: [
|
|
2701
|
-
/* @__PURE__ */ n(
|
|
2758
|
+
/* @__PURE__ */ n(dt, { type: e.type }),
|
|
2702
2759
|
/* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
|
|
2703
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children:
|
|
2704
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children:
|
|
2760
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: Je(e, t) }),
|
|
2761
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: oe(e.createdAt) })
|
|
2705
2762
|
] }),
|
|
2706
2763
|
!e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
|
|
2707
2764
|
]
|
|
2708
2765
|
}
|
|
2709
2766
|
);
|
|
2710
2767
|
}
|
|
2711
|
-
function
|
|
2768
|
+
function dt({ type: e }) {
|
|
2712
2769
|
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: [
|
|
2713
2770
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2714
2771
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2721,61 +2778,61 @@ function ot({ type: e }) {
|
|
|
2721
2778
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2722
2779
|
] }) });
|
|
2723
2780
|
}
|
|
2724
|
-
function
|
|
2781
|
+
function pt() {
|
|
2725
2782
|
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: [
|
|
2726
2783
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2727
2784
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2728
2785
|
] });
|
|
2729
2786
|
}
|
|
2730
|
-
function
|
|
2787
|
+
function It({
|
|
2731
2788
|
steamId: e,
|
|
2732
|
-
avatarUrl:
|
|
2733
|
-
memberSince:
|
|
2734
|
-
hideProfile:
|
|
2789
|
+
avatarUrl: t,
|
|
2790
|
+
memberSince: s,
|
|
2791
|
+
hideProfile: r = !1,
|
|
2735
2792
|
onComboSelect: a,
|
|
2736
2793
|
onGameRatingSelect: i,
|
|
2737
2794
|
className: o = ""
|
|
2738
2795
|
}) {
|
|
2739
|
-
const { data: d, isLoading: p, error: c } =
|
|
2796
|
+
const { data: d, isLoading: p, error: c } = _n(e), { data: u } = Vn(e), { data: v } = jn(e), { data: f, isLoading: h } = Kn(), k = Hn(), { data: x, isLoading: g } = Wn({ limit: 10 }), y = On(), m = zn();
|
|
2740
2797
|
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 ${o}`, children: [
|
|
2741
|
-
!
|
|
2742
|
-
|
|
2798
|
+
!r && /* @__PURE__ */ n(
|
|
2799
|
+
Qn,
|
|
2743
2800
|
{
|
|
2744
2801
|
driverName: d.driverName,
|
|
2745
|
-
avatarUrl:
|
|
2746
|
-
memberSince:
|
|
2802
|
+
avatarUrl: t,
|
|
2803
|
+
memberSince: s
|
|
2747
2804
|
}
|
|
2748
2805
|
),
|
|
2749
2806
|
/* @__PURE__ */ n(
|
|
2750
|
-
|
|
2807
|
+
Jn,
|
|
2751
2808
|
{
|
|
2752
2809
|
stats: d,
|
|
2753
|
-
gameRatings:
|
|
2810
|
+
gameRatings: u,
|
|
2754
2811
|
onGameRatingSelect: i
|
|
2755
2812
|
}
|
|
2756
2813
|
),
|
|
2757
|
-
e && /* @__PURE__ */ n(
|
|
2758
|
-
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${
|
|
2759
|
-
/* @__PURE__ */ n(
|
|
2760
|
-
|
|
2761
|
-
|
|
2814
|
+
e && /* @__PURE__ */ n(et, { events: f, isLoading: h }),
|
|
2815
|
+
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${k ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2816
|
+
/* @__PURE__ */ n(Zn, { combos: v, onComboSelect: a }),
|
|
2817
|
+
k && /* @__PURE__ */ n(
|
|
2818
|
+
lt,
|
|
2762
2819
|
{
|
|
2763
2820
|
notifications: x == null ? void 0 : x.notifications,
|
|
2764
2821
|
unreadCount: (x == null ? void 0 : x.unreadCount) || 0,
|
|
2765
|
-
onMarkRead: (
|
|
2822
|
+
onMarkRead: (w) => y.mutate(w),
|
|
2766
2823
|
onMarkAllRead: () => m.mutate(),
|
|
2767
|
-
isLoading:
|
|
2824
|
+
isLoading: g
|
|
2768
2825
|
}
|
|
2769
2826
|
)
|
|
2770
2827
|
] })
|
|
2771
2828
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2772
2829
|
}
|
|
2773
|
-
function
|
|
2774
|
-
const
|
|
2775
|
-
const i =
|
|
2830
|
+
function Ut({ records: e, className: t = "" }) {
|
|
2831
|
+
const s = $(() => e != null && e.length ? e.slice().sort((r, a) => {
|
|
2832
|
+
const i = r.recordedAt ? new Date(r.recordedAt).getTime() : 0;
|
|
2776
2833
|
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
2777
2834
|
}) : [], [e]);
|
|
2778
|
-
return
|
|
2835
|
+
return s.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
|
|
2779
2836
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2780
2837
|
/* @__PURE__ */ n("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2781
2838
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
@@ -2788,108 +2845,110 @@ function Bt({ records: e, className: r = "" }) {
|
|
|
2788
2845
|
"Current Records",
|
|
2789
2846
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
2790
2847
|
"(",
|
|
2791
|
-
|
|
2848
|
+
s.length,
|
|
2792
2849
|
")"
|
|
2793
2850
|
] })
|
|
2794
2851
|
] }) }),
|
|
2795
|
-
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children:
|
|
2852
|
+
/* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: s.map((r, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
|
|
2796
2853
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
|
|
2797
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: j(
|
|
2798
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children:
|
|
2854
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: j(r.trackId, r.layout, r.game) }),
|
|
2855
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: I(r.carId) })
|
|
2799
2856
|
] }),
|
|
2800
2857
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
|
|
2801
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(
|
|
2802
|
-
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${
|
|
2803
|
-
(
|
|
2804
|
-
|
|
2858
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: q(r.lapTimeMs) }),
|
|
2859
|
+
/* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r.game || "evo"}`, children: [
|
|
2860
|
+
(r.game || "evo").toUpperCase(),
|
|
2861
|
+
r.gameVersion ? ` ${r.gameVersion}` : ""
|
|
2805
2862
|
] })
|
|
2806
2863
|
] })
|
|
2807
2864
|
] }, a)) })
|
|
2808
2865
|
] }) : null;
|
|
2809
2866
|
}
|
|
2810
2867
|
export {
|
|
2811
|
-
|
|
2868
|
+
kt as CarsTable,
|
|
2812
2869
|
U as CompEmptyState,
|
|
2813
2870
|
V as CompLoadingState,
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2871
|
+
Cn as CompetitionCard,
|
|
2872
|
+
$t as CompetitionCards,
|
|
2873
|
+
Pt as CompetitionResultsTabs,
|
|
2874
|
+
wn as CompletedBadge,
|
|
2875
|
+
Be as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
2876
|
+
It as DriverDashboard,
|
|
2877
|
+
Qn as DriverProfile,
|
|
2878
|
+
wt as DriversTable,
|
|
2879
|
+
Tt as EntryList,
|
|
2880
|
+
se as InfoPill,
|
|
2881
|
+
Ct as LapHistoryTable,
|
|
2882
|
+
lt as NotificationsCard,
|
|
2883
|
+
he as PODIUM_MEDALS,
|
|
2884
|
+
vt as PitVoxPartnerProvider,
|
|
2885
|
+
Dn as RacePositionsChart,
|
|
2886
|
+
Lt as RankingsTable,
|
|
2887
|
+
Zn as RecentCombosCard,
|
|
2888
|
+
Ut as RecordsTable,
|
|
2889
|
+
Mt as RegisterButton,
|
|
2890
|
+
Dt as RegistrationPanel,
|
|
2891
|
+
Rt as RoundResults,
|
|
2892
|
+
ve as RoundSessionResults,
|
|
2893
|
+
$n as StandingsTable,
|
|
2894
|
+
Jn as StatsCards,
|
|
2895
|
+
yt as TracksTable,
|
|
2896
|
+
gn as TypeBadge,
|
|
2897
|
+
et as UpcomingEvents,
|
|
2898
|
+
ye as buildDriverIndexPath,
|
|
2899
|
+
Ge as buildLapsPath,
|
|
2900
|
+
ie as buildLeaderboardPath,
|
|
2901
|
+
Ye as buildRecentLapsPath,
|
|
2902
|
+
D as fetchCdnJson,
|
|
2903
|
+
St as filterCompetitionsByStatus,
|
|
2904
|
+
I as formatCarName,
|
|
2848
2905
|
W as formatDate,
|
|
2849
|
-
|
|
2850
|
-
|
|
2906
|
+
xt as formatDelta,
|
|
2907
|
+
we as formatFuel,
|
|
2851
2908
|
q as formatLapTime,
|
|
2852
|
-
|
|
2853
|
-
|
|
2909
|
+
Je as formatNotificationMessage,
|
|
2910
|
+
oe as formatRelativeTime,
|
|
2854
2911
|
E as formatSectorTime,
|
|
2855
|
-
|
|
2912
|
+
Z as formatSessionLabel,
|
|
2856
2913
|
j as formatTrackName,
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
Le as
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
nn as
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2914
|
+
ke as formatTyreCompound,
|
|
2915
|
+
kn as getCompetitionPodium,
|
|
2916
|
+
Ie as getCompetitionStatus,
|
|
2917
|
+
yn as getCompletionDate,
|
|
2918
|
+
bn as isCompetitionComplete,
|
|
2919
|
+
ee as isRoundClosed,
|
|
2920
|
+
Nt as useCarLeaderboard,
|
|
2921
|
+
gt as useCarMetadata,
|
|
2922
|
+
tn as useCompetitionAllRounds,
|
|
2923
|
+
Le as useCompetitionConfig,
|
|
2924
|
+
$e as useCompetitionEntryList,
|
|
2925
|
+
sn as useCompetitionLeaderboard,
|
|
2926
|
+
nn as useCompetitionRound,
|
|
2927
|
+
an as useCompetitionRoundLaps,
|
|
2928
|
+
rn as useCompetitionRoundLeaderboard,
|
|
2929
|
+
on as useCompetitionRoundPositions,
|
|
2930
|
+
Se as useCompetitionStandings,
|
|
2931
|
+
bt as useCompetitions,
|
|
2932
|
+
jn as useDriverCombos,
|
|
2933
|
+
en as useDriverLaps,
|
|
2934
|
+
At as useDriverRating,
|
|
2935
|
+
re as useDriverRatings,
|
|
2936
|
+
Vn as useDriverRatingsByGame,
|
|
2937
|
+
_n as useDriverStats,
|
|
2938
|
+
Ze as useLeaderboardIndex,
|
|
2939
|
+
zn as useMarkAllNotificationsRead,
|
|
2940
|
+
On as useMarkNotificationRead,
|
|
2941
|
+
Wn as useNotifications,
|
|
2942
|
+
Hn as useNotificationsEnabled,
|
|
2943
|
+
C as usePitVox,
|
|
2944
|
+
ft as useRecentLaps,
|
|
2945
|
+
Re as useRegister,
|
|
2946
|
+
ce as useRegistrationMode,
|
|
2947
|
+
le as useRegistrationStatus,
|
|
2948
|
+
de as useRegistrationUrl,
|
|
2949
|
+
Xe as useTrackLeaderboard,
|
|
2950
|
+
Bt as useUnreadCount,
|
|
2951
|
+
Kn as useUpcomingEvents,
|
|
2952
|
+
Ce as useUserLookup,
|
|
2953
|
+
Te as useWithdraw
|
|
2895
2954
|
};
|