@pitvox/partner-react 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1318 -1040
- package/dist/styles.css +281 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,74 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
function
|
|
7
|
-
partnerSlug:
|
|
8
|
-
cdnUrl:
|
|
9
|
-
pitvoxUrl:
|
|
10
|
-
getSteamId:
|
|
11
|
-
onRegister:
|
|
1
|
+
import { jsx as r, jsxs as c, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as be, useMemo as C, useContext as ye, useState as M, useCallback as O } from "react";
|
|
3
|
+
import { useQueryClient as P, QueryClient as we, QueryClientProvider as Ce, useQuery as k, useMutation as _, useQueries as ke } from "@tanstack/react-query";
|
|
4
|
+
const W = be(null), Le = "https://cdn.pitvox.com", Re = "https://pitvox.com";
|
|
5
|
+
let K = null;
|
|
6
|
+
function kr({
|
|
7
|
+
partnerSlug: e,
|
|
8
|
+
cdnUrl: n = Le,
|
|
9
|
+
pitvoxUrl: s = Re,
|
|
10
|
+
getSteamId: t,
|
|
11
|
+
onRegister: a,
|
|
12
12
|
onWithdraw: i,
|
|
13
|
-
|
|
13
|
+
onFetchNotifications: o,
|
|
14
|
+
onMarkNotificationRead: d,
|
|
15
|
+
onMarkAllNotificationsRead: u,
|
|
16
|
+
children: l
|
|
14
17
|
}) {
|
|
15
|
-
const
|
|
16
|
-
partnerSlug:
|
|
17
|
-
cdnUrl:
|
|
18
|
-
pitvoxUrl:
|
|
19
|
-
getSteamId:
|
|
20
|
-
onRegister:
|
|
21
|
-
onWithdraw: i || null
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const m = C(() => ({
|
|
19
|
+
partnerSlug: e,
|
|
20
|
+
cdnUrl: n.replace(/\/$/, ""),
|
|
21
|
+
pitvoxUrl: s.replace(/\/$/, ""),
|
|
22
|
+
getSteamId: t || (() => null),
|
|
23
|
+
onRegister: a || null,
|
|
24
|
+
onWithdraw: i || null,
|
|
25
|
+
onFetchNotifications: o || null,
|
|
26
|
+
onMarkNotificationRead: d || null,
|
|
27
|
+
onMarkAllNotificationsRead: u || null
|
|
28
|
+
}), [e, n, s, t, a, i, o, d, u]);
|
|
29
|
+
let g = !1;
|
|
24
30
|
try {
|
|
25
|
-
|
|
31
|
+
P(), g = !0;
|
|
26
32
|
} catch {
|
|
27
|
-
|
|
33
|
+
g = !1;
|
|
28
34
|
}
|
|
29
|
-
return
|
|
35
|
+
return g ? /* @__PURE__ */ r(W.Provider, { value: m, children: l }) : (K || (K = new we({
|
|
30
36
|
defaultOptions: {
|
|
31
37
|
queries: { staleTime: 6e4 }
|
|
32
38
|
}
|
|
33
|
-
})), /* @__PURE__ */
|
|
39
|
+
})), /* @__PURE__ */ r(Ce, { client: K, children: /* @__PURE__ */ r(W.Provider, { value: m, children: l }) }));
|
|
34
40
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
41
|
+
function w() {
|
|
42
|
+
const e = ye(W);
|
|
43
|
+
if (!e)
|
|
38
44
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
39
|
-
return
|
|
45
|
+
return e;
|
|
40
46
|
}
|
|
41
|
-
async function
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
44
|
-
if (
|
|
45
|
-
throw new Error(`CDN fetch failed: ${
|
|
47
|
+
async function R(e, n) {
|
|
48
|
+
const s = await fetch(`${e}/${n}`);
|
|
49
|
+
if (!s.ok) {
|
|
50
|
+
if (s.status === 404 || s.status === 403) return null;
|
|
51
|
+
throw new Error(`CDN fetch failed: ${s.status}`);
|
|
46
52
|
}
|
|
47
|
-
return
|
|
53
|
+
return s.json();
|
|
48
54
|
}
|
|
49
|
-
function
|
|
50
|
-
if (!
|
|
51
|
-
const
|
|
52
|
-
return `${
|
|
55
|
+
function U(e) {
|
|
56
|
+
if (!e && e !== 0) return "-";
|
|
57
|
+
const n = Math.floor(e / 1e3), s = Math.floor(n / 60), t = n % 60, a = e % 1e3;
|
|
58
|
+
return `${s}:${String(t).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
|
|
53
59
|
}
|
|
54
|
-
function
|
|
55
|
-
return !
|
|
60
|
+
function D(e) {
|
|
61
|
+
return !e && e !== 0 ? "-" : (e / 1e3).toFixed(3);
|
|
56
62
|
}
|
|
57
|
-
function
|
|
58
|
-
if (!
|
|
59
|
-
let
|
|
60
|
-
return
|
|
63
|
+
function S(e) {
|
|
64
|
+
if (!e) return "";
|
|
65
|
+
let n = e;
|
|
66
|
+
return n.startsWith("ks_") && (n = n.slice(3)), n.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
|
|
61
67
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const i =
|
|
66
|
-
return `${
|
|
68
|
+
function q(e, n, s) {
|
|
69
|
+
const t = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (n == null ? void 0 : n.toLowerCase()) === "track config";
|
|
70
|
+
if (!n || n === "default" || a) return t;
|
|
71
|
+
const i = n.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
|
|
72
|
+
return `${t} ${i}`;
|
|
67
73
|
}
|
|
68
|
-
function
|
|
69
|
-
if (!
|
|
74
|
+
function A(e) {
|
|
75
|
+
if (!e) return "-";
|
|
70
76
|
try {
|
|
71
|
-
return new Date(
|
|
77
|
+
return new Date(e).toLocaleDateString("en-GB", {
|
|
72
78
|
day: "numeric",
|
|
73
79
|
month: "short",
|
|
74
80
|
year: "numeric"
|
|
@@ -77,22 +83,26 @@ function D(r) {
|
|
|
77
83
|
return "-";
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
function
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const i = Math.floor(
|
|
89
|
-
return i < 30 ? `${i}d ago` :
|
|
90
|
-
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
function
|
|
95
|
-
|
|
86
|
+
function ne(e) {
|
|
87
|
+
if (!e) return "";
|
|
88
|
+
const n = Date.now() - new Date(e).getTime(), s = Math.floor(n / 1e3);
|
|
89
|
+
if (s < 60) return "Just now";
|
|
90
|
+
const t = Math.floor(s / 60);
|
|
91
|
+
if (t < 60) return `${t}m ago`;
|
|
92
|
+
const a = Math.floor(t / 60);
|
|
93
|
+
if (a < 24) return `${a}h ago`;
|
|
94
|
+
const i = Math.floor(a / 24);
|
|
95
|
+
return i < 30 ? `${i}d ago` : A(e);
|
|
96
|
+
}
|
|
97
|
+
function Lr(e) {
|
|
98
|
+
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
99
|
+
}
|
|
100
|
+
function Te(e, n) {
|
|
101
|
+
const { type: s, title: t, trackId: a, trackLayout: i, carId: o, game: d, data: u } = e, l = a ? q(a, i, d) : null, m = o ? S(o) : null, g = [l, m].filter(Boolean).join(" — ");
|
|
102
|
+
return s === "RECORD_BEATEN" && g ? `${u != null && u.beatenBySteamId && n ? n(u.beatenBySteamId).displayName : "Someone"} beat your record on ${g}` : s === "RECORD_SET" && g ? `You set a new record on ${g}` : t || "New notification";
|
|
103
|
+
}
|
|
104
|
+
function se(e) {
|
|
105
|
+
return e ? {
|
|
96
106
|
E: "Eco",
|
|
97
107
|
RD: "Road",
|
|
98
108
|
SC: "SuperCar",
|
|
@@ -103,251 +113,267 @@ function se(r) {
|
|
|
103
113
|
MR: "Medium Race",
|
|
104
114
|
SR: "Soft Race",
|
|
105
115
|
S: "Soft"
|
|
106
|
-
}[
|
|
116
|
+
}[e] || e : "Unknown";
|
|
107
117
|
}
|
|
108
|
-
function
|
|
109
|
-
var
|
|
110
|
-
const { cdnUrl:
|
|
111
|
-
queryKey: ["pitvox", "leaderboards",
|
|
112
|
-
queryFn: () =>
|
|
118
|
+
function Rr(e = {}) {
|
|
119
|
+
var d, u, l, m, g, h;
|
|
120
|
+
const { cdnUrl: n, partnerSlug: s } = w(), { game: t, gameVersion: a } = e, i = k({
|
|
121
|
+
queryKey: ["pitvox", "leaderboards", s, "index"],
|
|
122
|
+
queryFn: () => R(n, `leaderboards/partners/${s}/index.json`),
|
|
113
123
|
staleTime: 3e4,
|
|
114
124
|
refetchInterval: 3e4
|
|
115
125
|
}), o = C(() => {
|
|
116
|
-
var
|
|
117
|
-
if (!((
|
|
118
|
-
let
|
|
119
|
-
return
|
|
126
|
+
var b;
|
|
127
|
+
if (!((b = i.data) != null && b.tracks)) return [];
|
|
128
|
+
let f = i.data.tracks;
|
|
129
|
+
return t && (f = f.filter((p) => p.game === t)), a && (f = f.filter((p) => p.gameVersion === a)), f.map((p) => ({
|
|
120
130
|
id: p.trackId,
|
|
121
131
|
layout: p.layout,
|
|
122
132
|
game: p.game,
|
|
123
133
|
gameVersion: p.gameVersion,
|
|
124
|
-
displayName:
|
|
134
|
+
displayName: q(p.trackId, p.layout, p.game),
|
|
125
135
|
driverCount: p.driverCount || 0,
|
|
126
136
|
carCount: p.carCount || 0,
|
|
127
137
|
record: p.recordHolder ? {
|
|
128
138
|
visibleId: p.recordHolder.steamId || p.recordHolder.userId,
|
|
129
139
|
carId: p.recordHolder.carId,
|
|
130
|
-
carDisplayName:
|
|
140
|
+
carDisplayName: S(p.recordHolder.carId),
|
|
131
141
|
lapTimeMs: p.recordHolder.lapTimeMs,
|
|
132
142
|
timestamp: p.recordHolder.recordedAt
|
|
133
143
|
} : null,
|
|
134
144
|
recordByTag: p.recordByTag || null
|
|
135
145
|
}));
|
|
136
|
-
}, [(
|
|
146
|
+
}, [(d = i.data) == null ? void 0 : d.tracks, t, a]);
|
|
137
147
|
return {
|
|
138
148
|
...i,
|
|
139
149
|
data: o,
|
|
140
|
-
partner: ((
|
|
141
|
-
generatedAt: (
|
|
142
|
-
totalLaps: ((
|
|
143
|
-
totalUsers: ((
|
|
144
|
-
versions: ((
|
|
150
|
+
partner: ((u = i.data) == null ? void 0 : u.partner) || null,
|
|
151
|
+
generatedAt: (l = i.data) == null ? void 0 : l.generatedAt,
|
|
152
|
+
totalLaps: ((m = i.data) == null ? void 0 : m.totalLaps) || 0,
|
|
153
|
+
totalUsers: ((g = i.data) == null ? void 0 : g.totalUsers) || 0,
|
|
154
|
+
versions: ((h = i.data) == null ? void 0 : h.versions) || {}
|
|
145
155
|
};
|
|
146
156
|
}
|
|
147
|
-
function
|
|
148
|
-
const { cdnUrl:
|
|
149
|
-
queryKey: ["pitvox", "leaderboards",
|
|
150
|
-
queryFn: () =>
|
|
151
|
-
enabled: !!
|
|
157
|
+
function Se(e, n, s = {}) {
|
|
158
|
+
const { cdnUrl: t, partnerSlug: a } = w(), { carId: i, game: o, gameVersion: d } = s, u = n || "default", l = d ? `leaderboards/partners/${a}/v/${d}/tracks/${e}/${u}.json` : `leaderboards/partners/${a}/tracks/${e}/${u}.json`, { data: m, isLoading: g, error: h } = k({
|
|
159
|
+
queryKey: ["pitvox", "leaderboards", a, "track", e, u, d],
|
|
160
|
+
queryFn: () => R(t, l),
|
|
161
|
+
enabled: !!e,
|
|
152
162
|
staleTime: 3e4,
|
|
153
163
|
refetchInterval: 3e4
|
|
154
164
|
});
|
|
155
165
|
return { data: C(() => {
|
|
156
|
-
if (!(
|
|
157
|
-
let
|
|
158
|
-
if (o && (
|
|
159
|
-
const p = /* @__PURE__ */ new Map(),
|
|
160
|
-
for (const
|
|
161
|
-
const
|
|
162
|
-
|
|
166
|
+
if (!(m != null && m.entries)) return [];
|
|
167
|
+
let b = m.entries;
|
|
168
|
+
if (o && (b = b.filter((p) => p.game === o)), !i) {
|
|
169
|
+
const p = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const v of b) {
|
|
171
|
+
const x = v.steamId || v.userId;
|
|
172
|
+
N.has(v.carId) || N.set(v.carId, /* @__PURE__ */ new Set()), N.get(v.carId).add(x), (!p.has(v.carId) || v.lapTimeMs < p.get(v.carId).lapTimeMs) && p.set(v.carId, v);
|
|
163
173
|
}
|
|
164
|
-
return Array.from(p.values()).map((
|
|
165
|
-
var
|
|
166
|
-
return { ...
|
|
167
|
-
}).sort((
|
|
174
|
+
return Array.from(p.values()).map((v) => {
|
|
175
|
+
var x;
|
|
176
|
+
return { ...v, driverCount: ((x = N.get(v.carId)) == null ? void 0 : x.size) || 0 };
|
|
177
|
+
}).sort((v, x) => v.lapTimeMs - x.lapTimeMs);
|
|
168
178
|
}
|
|
169
|
-
return
|
|
170
|
-
}, [
|
|
171
|
-
}
|
|
172
|
-
function
|
|
173
|
-
var
|
|
174
|
-
const { cdnUrl: i, partnerSlug: o } =
|
|
175
|
-
queryKey: ["pitvox", "laps", o,
|
|
176
|
-
queryFn: () =>
|
|
177
|
-
enabled: !!
|
|
179
|
+
return b.filter((p) => p.carId === i).sort((p, N) => p.lapTimeMs - N.lapTimeMs);
|
|
180
|
+
}, [m == null ? void 0 : m.entries, i, o]), isLoading: g, error: h };
|
|
181
|
+
}
|
|
182
|
+
function $e(e, n, s, t, a = {}) {
|
|
183
|
+
var h, f;
|
|
184
|
+
const { cdnUrl: i, partnerSlug: o } = w(), { showInvalid: d = !1, game: u, gameVersion: l } = a, m = k({
|
|
185
|
+
queryKey: ["pitvox", "laps", o, e],
|
|
186
|
+
queryFn: () => R(i, `laps/partners/${o}/${e}.json`),
|
|
187
|
+
enabled: !!e,
|
|
178
188
|
staleTime: 3e4,
|
|
179
189
|
refetchInterval: 3e4
|
|
180
|
-
}),
|
|
181
|
-
var
|
|
182
|
-
return (
|
|
183
|
-
if (p.trackId !==
|
|
184
|
-
if (
|
|
185
|
-
if (p.trackLayout !==
|
|
190
|
+
}), g = C(() => {
|
|
191
|
+
var b;
|
|
192
|
+
return (b = m.data) != null && b.laps ? m.data.laps.filter((p) => {
|
|
193
|
+
if (p.trackId !== n) return !1;
|
|
194
|
+
if (s) {
|
|
195
|
+
if (p.trackLayout !== s) return !1;
|
|
186
196
|
} else if (p.trackLayout && p.trackLayout !== "default") return !1;
|
|
187
|
-
return !(p.carId !==
|
|
188
|
-
}).sort((p,
|
|
189
|
-
}, [(
|
|
197
|
+
return !(p.carId !== t || u && p.game !== u || l && p.gameVersion !== l || !d && !p.isValid);
|
|
198
|
+
}).sort((p, N) => p.lapTimeMs - N.lapTimeMs) : [];
|
|
199
|
+
}, [(h = m.data) == null ? void 0 : h.laps, n, s, t, u, l, d]);
|
|
190
200
|
return {
|
|
191
|
-
...
|
|
192
|
-
data:
|
|
193
|
-
driverName: ((
|
|
201
|
+
...m,
|
|
202
|
+
data: g,
|
|
203
|
+
driverName: ((f = m.data) == null ? void 0 : f.driverName) || "Driver"
|
|
194
204
|
};
|
|
195
205
|
}
|
|
196
|
-
function
|
|
197
|
-
const { cdnUrl:
|
|
206
|
+
function ae() {
|
|
207
|
+
const { cdnUrl: e } = w(), { data: n } = k({
|
|
198
208
|
queryKey: ["pitvox", "users", "index"],
|
|
199
|
-
queryFn: () =>
|
|
209
|
+
queryFn: () => R(e, "users/index.json"),
|
|
200
210
|
staleTime: 5 * 6e4,
|
|
201
211
|
gcTime: 30 * 6e4
|
|
202
|
-
}),
|
|
203
|
-
return (
|
|
204
|
-
const i =
|
|
212
|
+
}), s = (n == null ? void 0 : n.users) || {};
|
|
213
|
+
return (t, a) => {
|
|
214
|
+
const i = s[t];
|
|
205
215
|
return {
|
|
206
|
-
displayName: (i == null ? void 0 : i.displayName) ||
|
|
216
|
+
displayName: (i == null ? void 0 : i.displayName) || a || t || "Unknown",
|
|
207
217
|
avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
|
|
208
218
|
affiliations: (i == null ? void 0 : i.affiliations) || []
|
|
209
219
|
};
|
|
210
220
|
};
|
|
211
221
|
}
|
|
212
|
-
function
|
|
213
|
-
const { cdnUrl:
|
|
222
|
+
function Tr() {
|
|
223
|
+
const { cdnUrl: e } = w(), { data: n } = k({
|
|
214
224
|
queryKey: ["pitvox", "cars", "index"],
|
|
215
|
-
queryFn: () =>
|
|
225
|
+
queryFn: () => R(e, "cars/index.json"),
|
|
216
226
|
staleTime: 5 * 6e4,
|
|
217
227
|
gcTime: 30 * 6e4
|
|
218
228
|
});
|
|
219
229
|
return {
|
|
220
|
-
tags: (
|
|
221
|
-
cars: (
|
|
230
|
+
tags: (n == null ? void 0 : n.tags) || [],
|
|
231
|
+
cars: (n == null ? void 0 : n.cars) || {}
|
|
222
232
|
};
|
|
223
233
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
234
|
+
function Sr(e, n) {
|
|
235
|
+
return Se(e, null, { carId: n });
|
|
226
236
|
}
|
|
227
|
-
function
|
|
228
|
-
const { cdnUrl:
|
|
237
|
+
function $r() {
|
|
238
|
+
const { cdnUrl: e, partnerSlug: n } = w();
|
|
229
239
|
return k({
|
|
230
|
-
queryKey: ["pitvox", "competitions",
|
|
240
|
+
queryKey: ["pitvox", "competitions", n],
|
|
231
241
|
queryFn: async () => {
|
|
232
|
-
const
|
|
233
|
-
return
|
|
242
|
+
const s = await R(e, "competitions/index.json");
|
|
243
|
+
return s != null && s.competitions ? s.competitions.filter((t) => t.partnerSlug === n) : [];
|
|
234
244
|
},
|
|
235
245
|
staleTime: 6e4
|
|
236
246
|
});
|
|
237
247
|
}
|
|
238
|
-
function
|
|
239
|
-
const { cdnUrl:
|
|
248
|
+
function Me(e) {
|
|
249
|
+
const { cdnUrl: n, partnerSlug: s } = w();
|
|
240
250
|
return k({
|
|
241
|
-
queryKey: ["pitvox", "competition",
|
|
242
|
-
queryFn: () =>
|
|
243
|
-
enabled: !!
|
|
251
|
+
queryKey: ["pitvox", "competition", s, e, "config"],
|
|
252
|
+
queryFn: () => R(n, `competitions/${s}/${e}/config.json`),
|
|
253
|
+
enabled: !!e,
|
|
244
254
|
staleTime: 6e4
|
|
245
255
|
});
|
|
246
256
|
}
|
|
247
|
-
function
|
|
248
|
-
const { cdnUrl:
|
|
257
|
+
function De(e) {
|
|
258
|
+
const { cdnUrl: n, partnerSlug: s } = w();
|
|
249
259
|
return k({
|
|
250
|
-
queryKey: ["pitvox", "competition",
|
|
251
|
-
queryFn: () =>
|
|
252
|
-
enabled: !!
|
|
260
|
+
queryKey: ["pitvox", "competition", s, e, "standings"],
|
|
261
|
+
queryFn: () => R(n, `competitions/${s}/${e}/standings.json`),
|
|
262
|
+
enabled: !!e,
|
|
253
263
|
staleTime: 6e4
|
|
254
264
|
});
|
|
255
265
|
}
|
|
256
|
-
function
|
|
257
|
-
const { cdnUrl:
|
|
266
|
+
function Ie(e, n) {
|
|
267
|
+
const { cdnUrl: s, partnerSlug: t } = w();
|
|
258
268
|
return k({
|
|
259
|
-
queryKey: ["pitvox", "competition",
|
|
260
|
-
queryFn: () =>
|
|
261
|
-
enabled: !!
|
|
269
|
+
queryKey: ["pitvox", "competition", t, e, "round", n],
|
|
270
|
+
queryFn: () => R(s, `competitions/${t}/${e}/rounds/${n}.json`),
|
|
271
|
+
enabled: !!e && n != null,
|
|
262
272
|
staleTime: 6e4
|
|
263
273
|
});
|
|
264
274
|
}
|
|
265
|
-
function
|
|
266
|
-
const { cdnUrl:
|
|
275
|
+
function Mr(e, n = []) {
|
|
276
|
+
const { cdnUrl: s, partnerSlug: t } = w();
|
|
267
277
|
return k({
|
|
268
|
-
queryKey: ["pitvox", "competition",
|
|
278
|
+
queryKey: ["pitvox", "competition", t, e, "allRounds", n],
|
|
269
279
|
queryFn: async () => (await Promise.all(
|
|
270
|
-
|
|
271
|
-
(i) =>
|
|
280
|
+
n.map(
|
|
281
|
+
(i) => R(s, `competitions/${t}/${e}/rounds/${i}.json`).catch(() => null)
|
|
272
282
|
)
|
|
273
283
|
)).filter(Boolean),
|
|
274
|
-
enabled: !!
|
|
284
|
+
enabled: !!e && n.length > 0,
|
|
275
285
|
staleTime: 6e4
|
|
276
286
|
});
|
|
277
287
|
}
|
|
278
|
-
function
|
|
279
|
-
const { cdnUrl:
|
|
288
|
+
function ie(e) {
|
|
289
|
+
const { cdnUrl: n, partnerSlug: s } = w();
|
|
280
290
|
return k({
|
|
281
|
-
queryKey: ["pitvox", "competition",
|
|
282
|
-
queryFn: () =>
|
|
283
|
-
enabled: !!
|
|
291
|
+
queryKey: ["pitvox", "competition", s, e, "entrylist"],
|
|
292
|
+
queryFn: () => R(n, `competitions/${s}/${e}/entrylist.json`),
|
|
293
|
+
enabled: !!e,
|
|
284
294
|
staleTime: 6e4
|
|
285
295
|
});
|
|
286
296
|
}
|
|
287
|
-
function
|
|
288
|
-
const { cdnUrl:
|
|
297
|
+
function z(e) {
|
|
298
|
+
const { cdnUrl: n, partnerSlug: s, getSteamId: t } = w(), a = t();
|
|
289
299
|
return k({
|
|
290
|
-
queryKey: ["pitvox", "registration",
|
|
300
|
+
queryKey: ["pitvox", "registration", s, e, a],
|
|
291
301
|
queryFn: async () => {
|
|
292
|
-
var
|
|
293
|
-
const i = await fetch(`${
|
|
302
|
+
var u;
|
|
303
|
+
const i = await fetch(`${n}/competitions/${s}/${e}/entrylist.json`);
|
|
294
304
|
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
295
305
|
const o = await i.json();
|
|
296
|
-
return { isRegistered: !!
|
|
306
|
+
return { isRegistered: !!a && ((u = o.drivers) == null ? void 0 : u.some((l) => l.steamId === a)), entryList: o };
|
|
297
307
|
},
|
|
298
|
-
enabled: !!
|
|
308
|
+
enabled: !!e,
|
|
299
309
|
staleTime: 6e4
|
|
300
310
|
});
|
|
301
311
|
}
|
|
302
|
-
function
|
|
303
|
-
const { onRegister:
|
|
304
|
-
return
|
|
305
|
-
mutationFn: (
|
|
306
|
-
if (!
|
|
312
|
+
function oe(e) {
|
|
313
|
+
const { onRegister: n, partnerSlug: s, getSteamId: t } = w(), a = P(), i = ae();
|
|
314
|
+
return _({
|
|
315
|
+
mutationFn: (o) => {
|
|
316
|
+
if (!n)
|
|
307
317
|
throw new Error(
|
|
308
318
|
"No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
|
|
309
319
|
);
|
|
310
|
-
return
|
|
320
|
+
return n(e, o);
|
|
311
321
|
},
|
|
312
322
|
onSuccess: () => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
323
|
+
const o = t();
|
|
324
|
+
if (a.setQueriesData(
|
|
325
|
+
{ queryKey: ["pitvox", "registration", s, e] },
|
|
326
|
+
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
327
|
+
), o) {
|
|
328
|
+
const d = i(o), u = {
|
|
329
|
+
steamId: o,
|
|
330
|
+
displayName: d.displayName,
|
|
331
|
+
avatarUrl: d.avatarUrl
|
|
332
|
+
};
|
|
333
|
+
a.setQueriesData(
|
|
334
|
+
{ queryKey: ["pitvox", "competition", s, e, "entrylist"] },
|
|
335
|
+
(l) => {
|
|
336
|
+
var g;
|
|
337
|
+
return l ? ((g = l.drivers) == null ? void 0 : g.some((h) => h.steamId === o)) ? l : { ...l, drivers: [...l.drivers || [], u] } : { drivers: [u] };
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
}
|
|
318
341
|
}
|
|
319
342
|
});
|
|
320
343
|
}
|
|
321
|
-
function
|
|
322
|
-
const { onWithdraw:
|
|
323
|
-
return
|
|
344
|
+
function ce(e) {
|
|
345
|
+
const { onWithdraw: n, partnerSlug: s, getSteamId: t } = w(), a = P();
|
|
346
|
+
return _({
|
|
324
347
|
mutationFn: (i) => {
|
|
325
|
-
if (!
|
|
348
|
+
if (!n)
|
|
326
349
|
throw new Error(
|
|
327
350
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
328
351
|
);
|
|
329
|
-
const o = i ||
|
|
352
|
+
const o = i || t();
|
|
330
353
|
if (!o) throw new Error("No Steam ID available");
|
|
331
|
-
return
|
|
354
|
+
return n(e, o);
|
|
332
355
|
},
|
|
333
356
|
onSuccess: () => {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
357
|
+
const i = t();
|
|
358
|
+
a.setQueriesData(
|
|
359
|
+
{ queryKey: ["pitvox", "registration", s, e] },
|
|
360
|
+
(o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
361
|
+
), i && a.setQueriesData(
|
|
362
|
+
{ queryKey: ["pitvox", "competition", s, e, "entrylist"] },
|
|
363
|
+
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
|
|
364
|
+
);
|
|
339
365
|
}
|
|
340
366
|
});
|
|
341
367
|
}
|
|
342
|
-
function
|
|
343
|
-
const { onRegister:
|
|
344
|
-
return { isPowerMode:
|
|
368
|
+
function Q() {
|
|
369
|
+
const { onRegister: e, onWithdraw: n } = w(), s = !!(e && n);
|
|
370
|
+
return { isPowerMode: s, isBasicMode: !s };
|
|
345
371
|
}
|
|
346
|
-
function
|
|
347
|
-
const { pitvoxUrl:
|
|
348
|
-
return `${
|
|
372
|
+
function Y(e) {
|
|
373
|
+
const { pitvoxUrl: n, partnerSlug: s } = w();
|
|
374
|
+
return `${n}/p/${s}/competitions/${e}/register`;
|
|
349
375
|
}
|
|
350
|
-
const
|
|
376
|
+
const Be = {
|
|
351
377
|
formula: "Formula",
|
|
352
378
|
gt3: "GT3",
|
|
353
379
|
gt2: "GT2",
|
|
@@ -367,395 +393,395 @@ const $e = {
|
|
|
367
393
|
"2000s": "2000s",
|
|
368
394
|
"2010s": "2010s",
|
|
369
395
|
"2020s": "2020s"
|
|
370
|
-
},
|
|
396
|
+
}, le = [
|
|
371
397
|
{ id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
|
|
372
398
|
{ id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
|
|
373
399
|
{ id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
|
|
374
400
|
];
|
|
375
|
-
function
|
|
376
|
-
for (const
|
|
377
|
-
if (
|
|
401
|
+
function Pe(e) {
|
|
402
|
+
for (const n of le)
|
|
403
|
+
if (n.tags.includes(e)) return n.id;
|
|
378
404
|
return "other";
|
|
379
405
|
}
|
|
380
|
-
function
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
for (const
|
|
384
|
-
const
|
|
385
|
-
|
|
406
|
+
function de(e, n) {
|
|
407
|
+
if (n.size === 0) return !0;
|
|
408
|
+
const s = {};
|
|
409
|
+
for (const t of n) {
|
|
410
|
+
const a = Pe(t);
|
|
411
|
+
s[a] || (s[a] = []), s[a].push(t);
|
|
386
412
|
}
|
|
387
|
-
for (const
|
|
388
|
-
if (!
|
|
413
|
+
for (const t of Object.values(s))
|
|
414
|
+
if (!t.some((a) => e.includes(a))) return !1;
|
|
389
415
|
return !0;
|
|
390
416
|
}
|
|
391
|
-
function
|
|
392
|
-
const [
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}, [
|
|
398
|
-
return { activeTags:
|
|
399
|
-
}
|
|
400
|
-
function
|
|
401
|
-
const [
|
|
402
|
-
|
|
403
|
-
(i) => i.key ===
|
|
417
|
+
function pe(e, n) {
|
|
418
|
+
const [s, t] = M(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : s, o = O((u) => {
|
|
419
|
+
const l = new Set(i);
|
|
420
|
+
l.has(u) ? l.delete(u) : l.add(u), a && n ? n(l) : t(l);
|
|
421
|
+
}, [i, a, n]), d = O(() => {
|
|
422
|
+
a && n ? n(/* @__PURE__ */ new Set()) : t(/* @__PURE__ */ new Set());
|
|
423
|
+
}, [a, n]);
|
|
424
|
+
return { activeTags: i, toggle: o, clear: d };
|
|
425
|
+
}
|
|
426
|
+
function Z(e) {
|
|
427
|
+
const [n, s] = M(e), t = O((a) => {
|
|
428
|
+
s(
|
|
429
|
+
(i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
404
430
|
);
|
|
405
431
|
}, []);
|
|
406
|
-
return [
|
|
432
|
+
return [n, t];
|
|
407
433
|
}
|
|
408
|
-
function
|
|
409
|
-
return [...
|
|
410
|
-
const i =
|
|
434
|
+
function J(e, n, s) {
|
|
435
|
+
return [...e].sort((t, a) => {
|
|
436
|
+
const i = s(t, n.key), o = s(a, n.key);
|
|
411
437
|
if (i == null && o == null) return 0;
|
|
412
438
|
if (i == null) return 1;
|
|
413
439
|
if (o == null) return -1;
|
|
414
|
-
const
|
|
415
|
-
return
|
|
440
|
+
const d = typeof i == "string" ? i.localeCompare(o) : i - o;
|
|
441
|
+
return n.dir === "desc" ? -d : d;
|
|
416
442
|
});
|
|
417
443
|
}
|
|
418
|
-
function
|
|
419
|
-
const
|
|
420
|
-
return
|
|
421
|
-
s1: Math.min(...
|
|
422
|
-
s2: Math.min(...
|
|
423
|
-
s3: Math.min(...
|
|
444
|
+
function ue(e, n = !1) {
|
|
445
|
+
const s = n ? e == null ? void 0 : e.filter((t) => t.isValid) : e;
|
|
446
|
+
return s != null && s.length ? {
|
|
447
|
+
s1: Math.min(...s.map((t) => t.sector1Ms).filter(Boolean)),
|
|
448
|
+
s2: Math.min(...s.map((t) => t.sector2Ms).filter(Boolean)),
|
|
449
|
+
s3: Math.min(...s.map((t) => t.sector3Ms).filter(Boolean))
|
|
424
450
|
} : null;
|
|
425
451
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
452
|
+
function Ue({ active: e, dir: n }) {
|
|
453
|
+
return e ? n === "asc" ? /* @__PURE__ */ r("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ r("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ r("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
|
|
428
454
|
}
|
|
429
|
-
function
|
|
430
|
-
return /* @__PURE__ */
|
|
455
|
+
function T({ label: e, sortKey: n, config: s, onSort: t, className: a = "" }) {
|
|
456
|
+
return /* @__PURE__ */ r(
|
|
431
457
|
"th",
|
|
432
458
|
{
|
|
433
|
-
className: `pvx-th pvx-th--sortable ${
|
|
434
|
-
onClick: () =>
|
|
435
|
-
children: /* @__PURE__ */
|
|
436
|
-
|
|
437
|
-
/* @__PURE__ */
|
|
459
|
+
className: `pvx-th pvx-th--sortable ${a}`,
|
|
460
|
+
onClick: () => t(n),
|
|
461
|
+
children: /* @__PURE__ */ c("span", { className: "pvx-th-inner", children: [
|
|
462
|
+
e,
|
|
463
|
+
/* @__PURE__ */ r(Ue, { active: s.key === n, dir: s.dir })
|
|
438
464
|
] })
|
|
439
465
|
}
|
|
440
466
|
);
|
|
441
467
|
}
|
|
442
|
-
function
|
|
443
|
-
const { displayName:
|
|
444
|
-
return /* @__PURE__ */
|
|
445
|
-
|
|
446
|
-
/* @__PURE__ */
|
|
468
|
+
function X({ userId: e, getUserDisplay: n }) {
|
|
469
|
+
const { displayName: s, avatarUrl: t } = n(e);
|
|
470
|
+
return /* @__PURE__ */ c("span", { className: "pvx-driver", children: [
|
|
471
|
+
t ? /* @__PURE__ */ r("img", { src: t, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ r("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
|
|
472
|
+
/* @__PURE__ */ r("span", { className: "pvx-driver-name", children: s })
|
|
447
473
|
] });
|
|
448
474
|
}
|
|
449
|
-
function
|
|
450
|
-
return /* @__PURE__ */
|
|
475
|
+
function me({ rank: e, podium: n = !1 }) {
|
|
476
|
+
return /* @__PURE__ */ r("span", { className: n ? 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 });
|
|
451
477
|
}
|
|
452
|
-
function
|
|
453
|
-
if (!
|
|
454
|
-
const
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
478
|
+
function ve({ availableTags: e, activeTags: n, onToggle: s, onClear: t }) {
|
|
479
|
+
if (!e || e.length < 2) return null;
|
|
480
|
+
const a = le.map((i) => ({ id: i.id, tags: i.tags.filter((o) => e.includes(o)) })).filter((i) => i.tags.length > 0);
|
|
481
|
+
return /* @__PURE__ */ c("div", { className: "pvx-tag-bar", children: [
|
|
482
|
+
/* @__PURE__ */ r(
|
|
457
483
|
"button",
|
|
458
484
|
{
|
|
459
|
-
onClick:
|
|
460
|
-
className: `pvx-tag ${
|
|
485
|
+
onClick: t,
|
|
486
|
+
className: `pvx-tag ${n.size === 0 ? "pvx-tag--active" : ""}`,
|
|
461
487
|
children: "All"
|
|
462
488
|
}
|
|
463
489
|
),
|
|
464
|
-
|
|
465
|
-
o > 0 && /* @__PURE__ */
|
|
466
|
-
i.tags.map((
|
|
490
|
+
a.map((i, o) => /* @__PURE__ */ c("span", { className: "contents", children: [
|
|
491
|
+
o > 0 && /* @__PURE__ */ r("span", { className: "pvx-tag-separator" }),
|
|
492
|
+
i.tags.map((d) => /* @__PURE__ */ r(
|
|
467
493
|
"button",
|
|
468
494
|
{
|
|
469
|
-
onClick: () =>
|
|
470
|
-
className: `pvx-tag ${
|
|
471
|
-
children:
|
|
495
|
+
onClick: () => s(d),
|
|
496
|
+
className: `pvx-tag ${n.has(d) ? "pvx-tag--active" : ""}`,
|
|
497
|
+
children: Be[d] || d
|
|
472
498
|
},
|
|
473
|
-
|
|
499
|
+
d
|
|
474
500
|
))
|
|
475
501
|
] }, i.id))
|
|
476
502
|
] });
|
|
477
503
|
}
|
|
478
|
-
function
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
const
|
|
481
|
-
return /* @__PURE__ */
|
|
482
|
-
|
|
483
|
-
!
|
|
484
|
-
] },
|
|
504
|
+
function ee({ segments: e }) {
|
|
505
|
+
return /* @__PURE__ */ r("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ r("ol", { className: "pvx-breadcrumb-list", children: e.map((n, s) => {
|
|
506
|
+
const t = s === e.length - 1;
|
|
507
|
+
return /* @__PURE__ */ c("li", { className: "pvx-breadcrumb-item", children: [
|
|
508
|
+
s > 0 && /* @__PURE__ */ r("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
|
|
509
|
+
!t && n.onClick ? /* @__PURE__ */ r("button", { onClick: n.onClick, className: "pvx-breadcrumb-link", children: n.label }) : /* @__PURE__ */ r("span", { className: "pvx-breadcrumb-current", children: n.label })
|
|
510
|
+
] }, n.key);
|
|
485
511
|
}) }) });
|
|
486
512
|
}
|
|
487
|
-
function
|
|
488
|
-
return /* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
513
|
+
function V({ message: e }) {
|
|
514
|
+
return /* @__PURE__ */ c("div", { className: "pvx-empty", children: [
|
|
515
|
+
/* @__PURE__ */ r("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-4.5A3.375 3.375 0 0013.125 10.875h-2.25A3.375 3.375 0 007.5 14.25v4.5" }) }),
|
|
516
|
+
/* @__PURE__ */ r("p", { children: e })
|
|
491
517
|
] });
|
|
492
518
|
}
|
|
493
|
-
function
|
|
494
|
-
return /* @__PURE__ */
|
|
495
|
-
}
|
|
496
|
-
function
|
|
497
|
-
return /* @__PURE__ */
|
|
498
|
-
}
|
|
499
|
-
function
|
|
500
|
-
return /* @__PURE__ */
|
|
501
|
-
}
|
|
502
|
-
function
|
|
503
|
-
const [
|
|
504
|
-
var
|
|
505
|
-
if (!((
|
|
506
|
-
const m = /* @__PURE__ */ new Set();
|
|
507
|
-
for (const p of r || [])
|
|
508
|
-
p.recordByTag && Object.keys(p.recordByTag).forEach((f) => m.add(f));
|
|
509
|
-
return n.tags.filter((p) => m.has(p));
|
|
510
|
-
}, [r, n]), b = C(() => r ? c.size === 0 ? r : r.map((m) => {
|
|
511
|
-
var f, h;
|
|
512
|
-
if (!m.recordByTag) return null;
|
|
513
|
-
let g = null;
|
|
519
|
+
function j() {
|
|
520
|
+
return /* @__PURE__ */ r("div", { className: "pvx-loading", children: "Loading..." });
|
|
521
|
+
}
|
|
522
|
+
function Ae() {
|
|
523
|
+
return /* @__PURE__ */ r("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
524
|
+
}
|
|
525
|
+
function Fe() {
|
|
526
|
+
return /* @__PURE__ */ r("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
527
|
+
}
|
|
528
|
+
function Dr({ tracks: e, isLoading: n, carMetadata: s, getUserDisplay: t, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
529
|
+
const [d, u] = Z({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle: m, clear: g } = pe(i, o), h = C(() => {
|
|
530
|
+
var N;
|
|
531
|
+
if (!((N = s == null ? void 0 : s.tags) != null && N.length)) return [];
|
|
514
532
|
const p = /* @__PURE__ */ new Set();
|
|
515
|
-
for (const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
533
|
+
for (const v of e || [])
|
|
534
|
+
v.recordByTag && Object.keys(v.recordByTag).forEach((x) => p.add(x));
|
|
535
|
+
return s.tags.filter((v) => p.has(v));
|
|
536
|
+
}, [e, s]), f = C(() => e ? l.size === 0 ? e : e.map((p) => {
|
|
537
|
+
var x, y;
|
|
538
|
+
if (!p.recordByTag) return null;
|
|
539
|
+
let N = null;
|
|
540
|
+
const v = /* @__PURE__ */ new Set();
|
|
541
|
+
for (const L of Object.values(p.recordByTag)) {
|
|
542
|
+
if (v.has(L.carId)) continue;
|
|
543
|
+
v.add(L.carId);
|
|
544
|
+
const $ = ((y = (x = s == null ? void 0 : s.cars) == null ? void 0 : x[L.carId]) == null ? void 0 : y.tags) || ["sports_car"];
|
|
545
|
+
de($, l) && (!N || L.lapTimeMs < N.lapTimeMs) && (N = L);
|
|
520
546
|
}
|
|
521
|
-
return
|
|
522
|
-
...
|
|
547
|
+
return N ? {
|
|
548
|
+
...p,
|
|
523
549
|
record: {
|
|
524
|
-
visibleId:
|
|
525
|
-
carId:
|
|
526
|
-
carDisplayName:
|
|
527
|
-
lapTimeMs:
|
|
528
|
-
timestamp:
|
|
550
|
+
visibleId: N.steamId || N.identifier,
|
|
551
|
+
carId: N.carId,
|
|
552
|
+
carDisplayName: S(N.carId),
|
|
553
|
+
lapTimeMs: N.lapTimeMs,
|
|
554
|
+
timestamp: N.recordedAt
|
|
529
555
|
}
|
|
530
556
|
} : null;
|
|
531
|
-
}).filter(Boolean) : [], [
|
|
532
|
-
var
|
|
533
|
-
switch (
|
|
557
|
+
}).filter(Boolean) : [], [e, l, s]), b = C(() => J(f, d, (p, N) => {
|
|
558
|
+
var v, x;
|
|
559
|
+
switch (N) {
|
|
534
560
|
case "displayName":
|
|
535
|
-
return
|
|
561
|
+
return p.displayName;
|
|
536
562
|
case "record.lapTimeMs":
|
|
537
|
-
return (
|
|
563
|
+
return (v = p.record) == null ? void 0 : v.lapTimeMs;
|
|
538
564
|
case "driverCount":
|
|
539
|
-
return
|
|
565
|
+
return p.driverCount || 0;
|
|
540
566
|
case "carCount":
|
|
541
|
-
return
|
|
567
|
+
return p.carCount || 0;
|
|
542
568
|
case "record.timestamp":
|
|
543
569
|
default:
|
|
544
|
-
return (
|
|
570
|
+
return (x = p.record) != null && x.timestamp ? new Date(p.record.timestamp).getTime() : 0;
|
|
545
571
|
}
|
|
546
|
-
}), [
|
|
547
|
-
return
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
572
|
+
}), [f, d]);
|
|
573
|
+
return n ? /* @__PURE__ */ r(j, {}) : e != null && e.length ? /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
574
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header", children: /* @__PURE__ */ r("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
575
|
+
/* @__PURE__ */ r(ve, { availableTags: h, activeTags: l, onToggle: m, onClear: g }),
|
|
576
|
+
/* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
577
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
578
|
+
/* @__PURE__ */ r(T, { label: "Track", sortKey: "displayName", config: d, onSort: u }),
|
|
579
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Record Holder" }),
|
|
580
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
581
|
+
/* @__PURE__ */ r(T, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: u }),
|
|
582
|
+
/* @__PURE__ */ r(T, { label: "Drivers", sortKey: "driverCount", config: d, onSort: u, className: "pvx-hidden-below-md" }),
|
|
583
|
+
/* @__PURE__ */ r(T, { label: "Cars", sortKey: "carCount", config: d, onSort: u, className: "pvx-hidden-below-lg" }),
|
|
584
|
+
/* @__PURE__ */ r(T, { label: "Date", sortKey: "record.timestamp", config: d, onSort: u, className: "pvx-hidden-below-xl" })
|
|
559
585
|
] }) }),
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
var
|
|
562
|
-
return /* @__PURE__ */
|
|
586
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: b.map((p) => {
|
|
587
|
+
var N, v, x;
|
|
588
|
+
return /* @__PURE__ */ c(
|
|
563
589
|
"tr",
|
|
564
590
|
{
|
|
565
591
|
className: "pvx-row pvx-row--clickable",
|
|
566
|
-
onClick: () =>
|
|
592
|
+
onClick: () => a(p.id, p.layout),
|
|
567
593
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary", children: p.displayName }),
|
|
595
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: (N = p.record) != null && N.visibleId ? /* @__PURE__ */ r(X, { userId: p.record.visibleId, getUserDisplay: t }) : "-" }),
|
|
596
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-hidden-below-lg", children: ((v = p.record) == null ? void 0 : v.carDisplayName) || "-" }),
|
|
597
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: p.record ? U(p.record.lapTimeMs) : "-" }),
|
|
598
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: p.driverCount || "-" }),
|
|
599
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: p.carCount || "-" }),
|
|
600
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (x = p.record) != null && x.timestamp ? A(p.record.timestamp) : "-" })
|
|
575
601
|
]
|
|
576
602
|
},
|
|
577
|
-
`${
|
|
603
|
+
`${p.id}|${p.layout || ""}`
|
|
578
604
|
);
|
|
579
605
|
}) })
|
|
580
606
|
] }) })
|
|
581
|
-
] }) : /* @__PURE__ */
|
|
582
|
-
}
|
|
583
|
-
function
|
|
584
|
-
const [
|
|
585
|
-
var
|
|
586
|
-
if (!
|
|
587
|
-
const
|
|
588
|
-
for (const
|
|
589
|
-
(((
|
|
590
|
-
return
|
|
591
|
-
}, [
|
|
592
|
-
var
|
|
593
|
-
const
|
|
594
|
-
return
|
|
595
|
-
}) : [], [
|
|
596
|
-
switch (
|
|
607
|
+
] }) : /* @__PURE__ */ r(V, { message: "No lap times recorded yet." });
|
|
608
|
+
}
|
|
609
|
+
function Ir({ entries: e, isLoading: n, track: s, carMetadata: t, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: u }) {
|
|
610
|
+
const [l, m] = Z({ key: "lapTimeMs", dir: "asc" }), { activeTags: g, toggle: h, clear: f } = pe(d, u), b = C(() => {
|
|
611
|
+
var y, L, $;
|
|
612
|
+
if (!e || !((y = t == null ? void 0 : t.tags) != null && y.length)) return [];
|
|
613
|
+
const x = /* @__PURE__ */ new Set();
|
|
614
|
+
for (const B of e)
|
|
615
|
+
((($ = (L = t.cars) == null ? void 0 : L[B.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((Ne) => x.add(Ne));
|
|
616
|
+
return t.tags.filter((B) => x.has(B));
|
|
617
|
+
}, [e, t]), p = C(() => e ? g.size === 0 ? e : e.filter((x) => {
|
|
618
|
+
var L, $;
|
|
619
|
+
const y = (($ = (L = t == null ? void 0 : t.cars) == null ? void 0 : L[x.carId]) == null ? void 0 : $.tags) || ["sports_car"];
|
|
620
|
+
return de(y, g);
|
|
621
|
+
}) : [], [e, g, t]), N = C(() => J(p, l, (x, y) => {
|
|
622
|
+
switch (y) {
|
|
597
623
|
case "carId":
|
|
598
|
-
return
|
|
624
|
+
return S(x.carId);
|
|
599
625
|
case "driverCount":
|
|
600
|
-
return
|
|
626
|
+
return x.driverCount || 0;
|
|
601
627
|
case "lapTimeMs":
|
|
602
628
|
default:
|
|
603
|
-
return
|
|
629
|
+
return x.lapTimeMs;
|
|
604
630
|
}
|
|
605
|
-
}), [
|
|
631
|
+
}), [p, l]), v = [
|
|
606
632
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
607
|
-
{ key: "track", label:
|
|
633
|
+
{ key: "track", label: s.displayName }
|
|
608
634
|
];
|
|
609
|
-
return
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
635
|
+
return n ? /* @__PURE__ */ r(j, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
636
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header", children: /* @__PURE__ */ r(ee, { segments: v }) }),
|
|
637
|
+
/* @__PURE__ */ r(ve, { availableTags: b, activeTags: g, onToggle: h, onClear: f }),
|
|
638
|
+
e != null && e.length ? /* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
639
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
640
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
641
|
+
/* @__PURE__ */ r(T, { label: "Car", sortKey: "carId", config: l, onSort: m }),
|
|
642
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Record Holder" }),
|
|
643
|
+
/* @__PURE__ */ r(T, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort: m }),
|
|
644
|
+
/* @__PURE__ */ r(T, { label: "Drivers", sortKey: "driverCount", config: l, onSort: m, className: "pvx-hidden-below-md" }),
|
|
645
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
620
646
|
] }) }),
|
|
621
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: N.map((x, y) => /* @__PURE__ */ c(
|
|
622
648
|
"tr",
|
|
623
649
|
{
|
|
624
650
|
className: "pvx-row pvx-row--clickable",
|
|
625
|
-
onClick: () => i(
|
|
651
|
+
onClick: () => i(x.carId),
|
|
626
652
|
children: [
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r(me, { rank: y + 1, podium: !0 }) }),
|
|
654
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary", children: S(x.carId) }),
|
|
655
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r(X, { userId: x.steamId || x.userId, getUserDisplay: a }) }),
|
|
656
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(x.lapTimeMs) }),
|
|
657
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
658
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: x.recordedAt ? A(x.recordedAt) : "-" })
|
|
633
659
|
]
|
|
634
660
|
},
|
|
635
|
-
|
|
661
|
+
x.carId
|
|
636
662
|
)) })
|
|
637
|
-
] }) }) : /* @__PURE__ */
|
|
663
|
+
] }) }) : /* @__PURE__ */ r(V, { message: "No lap times for this track yet." })
|
|
638
664
|
] });
|
|
639
665
|
}
|
|
640
|
-
function
|
|
641
|
-
const [
|
|
642
|
-
switch (
|
|
666
|
+
function Br({ entries: e, isLoading: n, track: s, carId: t, getUserDisplay: a, onDriverSelect: i, onNavigate: o }) {
|
|
667
|
+
const [d, u] = Z({ key: "lapTimeMs", dir: "asc" }), l = C(() => ue(e), [e]), m = C(() => J(e || [], d, (h, f) => {
|
|
668
|
+
switch (f) {
|
|
643
669
|
case "userId":
|
|
644
|
-
return
|
|
670
|
+
return a(h.steamId || h.userId).displayName;
|
|
645
671
|
case "lapCount":
|
|
646
|
-
return
|
|
672
|
+
return h.lapCount || 0;
|
|
647
673
|
case "lapTimeMs":
|
|
648
674
|
default:
|
|
649
|
-
return
|
|
675
|
+
return h.lapTimeMs;
|
|
650
676
|
}
|
|
651
|
-
}), [
|
|
677
|
+
}), [e, d, a]), g = [
|
|
652
678
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
653
|
-
{ key: "track", label:
|
|
654
|
-
{ key: "car", label:
|
|
679
|
+
{ key: "track", label: s.displayName, onClick: () => o("track") },
|
|
680
|
+
{ key: "car", label: S(t) }
|
|
655
681
|
];
|
|
656
|
-
return
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
/* @__PURE__ */
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
682
|
+
return n ? /* @__PURE__ */ r(j, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
683
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header", children: /* @__PURE__ */ r(ee, { segments: g }) }),
|
|
684
|
+
e != null && e.length ? /* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
685
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
686
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
687
|
+
/* @__PURE__ */ r(T, { label: "Driver", sortKey: "userId", config: d, onSort: u }),
|
|
688
|
+
/* @__PURE__ */ r(T, { label: "Lap Time", sortKey: "lapTimeMs", config: d, onSort: u }),
|
|
689
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
690
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
691
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
692
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
693
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
694
|
+
/* @__PURE__ */ r(T, { label: "Laps", sortKey: "lapCount", config: d, onSort: u, className: "pvx-hidden-below-lg" }),
|
|
695
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
670
696
|
] }) }),
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
const
|
|
673
|
-
return /* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: m.map((h, f) => {
|
|
698
|
+
const b = f + 1, p = h.steamId || h.userId, N = l && h.sector1Ms === l.s1, v = l && h.sector2Ms === l.s2, x = l && h.sector3Ms === l.s3;
|
|
699
|
+
return /* @__PURE__ */ c(
|
|
674
700
|
"tr",
|
|
675
701
|
{
|
|
676
|
-
className: `pvx-row pvx-row--clickable ${
|
|
702
|
+
className: `pvx-row pvx-row--clickable ${b <= 3 ? "pvx-row--podium" : ""}`,
|
|
677
703
|
onClick: () => i(p),
|
|
678
704
|
children: [
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r(me, { rank: b, podium: !0 }) }),
|
|
706
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ r(X, { userId: p, getUserDisplay: a }) }),
|
|
707
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(h.lapTimeMs) }),
|
|
708
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: D(h.sector1Ms) }),
|
|
709
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${v ? "pvx-td--best-sector" : ""}`, children: D(h.sector2Ms) }),
|
|
710
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${x ? "pvx-td--best-sector" : ""}`, children: D(h.sector3Ms) }),
|
|
711
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: se(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
712
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: h.startingFuelL ? `${h.startingFuelL}L` : "-" }),
|
|
713
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.lapCount || "-" }),
|
|
714
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ? A(h.recordedAt) : "-" })
|
|
689
715
|
]
|
|
690
716
|
},
|
|
691
717
|
p
|
|
692
718
|
);
|
|
693
719
|
}) })
|
|
694
|
-
] }) }) : /* @__PURE__ */
|
|
720
|
+
] }) }) : /* @__PURE__ */ r(V, { message: "No lap times for this car yet." })
|
|
695
721
|
] });
|
|
696
722
|
}
|
|
697
|
-
function
|
|
698
|
-
const { data:
|
|
699
|
-
const
|
|
700
|
-
return
|
|
701
|
-
}, [
|
|
702
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
703
|
-
{ key: "track", label:
|
|
704
|
-
{ key: "car", label:
|
|
705
|
-
{ key: "driver", label:
|
|
723
|
+
function Pr({ userId: e, track: n, carId: s, game: t, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: u }) {
|
|
724
|
+
const { data: l, driverName: m, isLoading: g } = $e(e, n.id, n.layout, s, { showInvalid: i, game: t, gameVersion: a }), { displayName: h, avatarUrl: f } = o(e, m), b = C(() => ue(l, !0), [l]), p = C(() => {
|
|
725
|
+
const v = (l == null ? void 0 : l.filter((x) => x.isValid)) || [];
|
|
726
|
+
return v.length ? Math.min(...v.map((x) => x.lapTimeMs)) : null;
|
|
727
|
+
}, [l]), N = [
|
|
728
|
+
{ key: "tracks", label: "Tracks", onClick: () => u("tracks") },
|
|
729
|
+
{ key: "track", label: n.displayName, onClick: () => u("track") },
|
|
730
|
+
{ key: "car", label: S(s), onClick: () => u("car") },
|
|
731
|
+
{ key: "driver", label: h }
|
|
706
732
|
];
|
|
707
|
-
return
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
|
|
733
|
+
return g ? /* @__PURE__ */ r(j, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
734
|
+
/* @__PURE__ */ c("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
735
|
+
/* @__PURE__ */ c("div", { className: "pvx-card-header-left", children: [
|
|
736
|
+
/* @__PURE__ */ r(ee, { segments: N }),
|
|
737
|
+
f ? /* @__PURE__ */ r("img", { src: f, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ r("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
712
738
|
] }),
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ c("label", { className: "pvx-checkbox-label", children: [
|
|
740
|
+
/* @__PURE__ */ r(
|
|
715
741
|
"input",
|
|
716
742
|
{
|
|
717
743
|
type: "checkbox",
|
|
718
744
|
checked: i,
|
|
719
|
-
onChange:
|
|
745
|
+
onChange: d,
|
|
720
746
|
className: "pvx-checkbox"
|
|
721
747
|
}
|
|
722
748
|
),
|
|
723
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ r("span", { children: "Show invalid laps" })
|
|
724
750
|
] })
|
|
725
751
|
] }),
|
|
726
|
-
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
752
|
+
l != null && l.length ? /* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
753
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
754
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
755
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
|
|
756
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Lap Time" }),
|
|
757
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
758
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
759
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
760
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
|
|
761
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
762
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
763
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
738
764
|
] }) }),
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
const
|
|
741
|
-
let
|
|
742
|
-
return
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
] },
|
|
765
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: l.map((v, x) => {
|
|
766
|
+
const y = v.isValid && v.lapTimeMs === p, L = b && v.isValid && v.sector1Ms === b.s1, $ = b && v.isValid && v.sector2Ms === b.s2, B = b && v.isValid && v.sector3Ms === b.s3;
|
|
767
|
+
let E = "pvx-row";
|
|
768
|
+
return v.isValid || (E += " pvx-row--invalid"), y && (E += " pvx-row--personal-best"), /* @__PURE__ */ c("tr", { className: E, children: [
|
|
769
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r("span", { className: `pvx-rank ${y ? "pvx-rank--gold" : ""}`, children: x + 1 }) }),
|
|
770
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: v.lapNumber || "-" }),
|
|
771
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(v.lapTimeMs) }),
|
|
772
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: D(v.sector1Ms) }),
|
|
773
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(v.sector2Ms) }),
|
|
774
|
+
/* @__PURE__ */ r("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${B ? "pvx-td--best-sector" : ""}`, children: D(v.sector3Ms) }),
|
|
775
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", title: v.isValid ? void 0 : v.invalidReason || "Invalid", children: v.isValid ? /* @__PURE__ */ r(Ae, {}) : /* @__PURE__ */ r(Fe, {}) }),
|
|
776
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: se(v.tyreCompound), children: v.tyreCompound || "-" }),
|
|
777
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: v.startingFuelL ? `${v.startingFuelL}L` : "-" }),
|
|
778
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: A(v.timestamp) })
|
|
779
|
+
] }, v.id);
|
|
754
780
|
}) })
|
|
755
|
-
] }) }) : /* @__PURE__ */
|
|
781
|
+
] }) }) : /* @__PURE__ */ r(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
756
782
|
] });
|
|
757
783
|
}
|
|
758
|
-
const
|
|
784
|
+
const Ee = {
|
|
759
785
|
GBR: "🇬🇧",
|
|
760
786
|
DEU: "🇩🇪",
|
|
761
787
|
NLD: "🇳🇱",
|
|
@@ -786,120 +812,120 @@ const Ue = {
|
|
|
786
812
|
RUS: "🇷🇺",
|
|
787
813
|
TUR: "🇹🇷",
|
|
788
814
|
KOR: "🇰🇷"
|
|
789
|
-
},
|
|
815
|
+
}, _e = ["🥇", "🥈", "🥉"], qe = {
|
|
790
816
|
championship: "Championship",
|
|
791
817
|
series: "Series",
|
|
792
818
|
event: "Event"
|
|
793
|
-
},
|
|
794
|
-
function he({ position:
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
}
|
|
797
|
-
function
|
|
798
|
-
const
|
|
799
|
-
return
|
|
800
|
-
}
|
|
801
|
-
function
|
|
802
|
-
if (!
|
|
803
|
-
const
|
|
804
|
-
(
|
|
819
|
+
}, re = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
820
|
+
function he({ position: e }) {
|
|
821
|
+
return /* @__PURE__ */ r("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 });
|
|
822
|
+
}
|
|
823
|
+
function xe({ nation: e }) {
|
|
824
|
+
const n = e && Ee[e];
|
|
825
|
+
return n ? /* @__PURE__ */ r("span", { className: "pvx-nation-flag", title: e, children: n }) : null;
|
|
826
|
+
}
|
|
827
|
+
function Ve({ sessions: e, activeSession: n, onSelect: s }) {
|
|
828
|
+
if (!e || e.length <= 1) return null;
|
|
829
|
+
const t = [...e].sort(
|
|
830
|
+
(a, i) => re.indexOf(a.type) - re.indexOf(i.type)
|
|
805
831
|
);
|
|
806
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ r("div", { className: "pvx-session-tabs", children: t.map((a) => /* @__PURE__ */ r(
|
|
807
833
|
"button",
|
|
808
834
|
{
|
|
809
|
-
onClick: () =>
|
|
810
|
-
className: `pvx-session-tab ${
|
|
811
|
-
children:
|
|
835
|
+
onClick: () => s(a.type),
|
|
836
|
+
className: `pvx-session-tab ${n === a.type ? "pvx-session-tab--active" : ""}`,
|
|
837
|
+
children: a.type
|
|
812
838
|
},
|
|
813
|
-
|
|
839
|
+
a.type
|
|
814
840
|
)) });
|
|
815
841
|
}
|
|
816
|
-
function
|
|
817
|
-
return /* @__PURE__ */
|
|
818
|
-
}
|
|
819
|
-
function
|
|
820
|
-
return /* @__PURE__ */
|
|
821
|
-
}
|
|
822
|
-
function
|
|
823
|
-
if (!
|
|
824
|
-
const
|
|
825
|
-
if (isNaN(
|
|
826
|
-
const
|
|
827
|
-
return `${
|
|
828
|
-
}
|
|
829
|
-
function
|
|
830
|
-
return
|
|
831
|
-
var
|
|
832
|
-
return (
|
|
833
|
-
const o =
|
|
834
|
-
return o && o <
|
|
835
|
-
}) : [...
|
|
842
|
+
function je({ type: e }) {
|
|
843
|
+
return /* @__PURE__ */ r("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: qe[e] || e });
|
|
844
|
+
}
|
|
845
|
+
function H({ children: e, variant: n = "default" }) {
|
|
846
|
+
return /* @__PURE__ */ r("span", { className: `pvx-info-pill ${n !== "default" ? `pvx-info-pill--${n}` : ""}`, children: e });
|
|
847
|
+
}
|
|
848
|
+
function Ke(e) {
|
|
849
|
+
if (!e) return "TBD";
|
|
850
|
+
const n = new Date(e);
|
|
851
|
+
if (isNaN(n)) return "TBD";
|
|
852
|
+
const s = n.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), t = n.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
853
|
+
return `${s} • ${t}`;
|
|
854
|
+
}
|
|
855
|
+
function He(e) {
|
|
856
|
+
return e.reduce((n, s) => {
|
|
857
|
+
var t;
|
|
858
|
+
return (t = s.splits) != null && t.length ? n ? n.map((a, i) => {
|
|
859
|
+
const o = s.splits[i];
|
|
860
|
+
return o && o < a ? o : a;
|
|
861
|
+
}) : [...s.splits] : n;
|
|
836
862
|
}, null);
|
|
837
863
|
}
|
|
838
|
-
function
|
|
839
|
-
return /* @__PURE__ */
|
|
864
|
+
function F({ message: e = "Loading..." }) {
|
|
865
|
+
return /* @__PURE__ */ r("div", { className: "pvx-loading", children: e });
|
|
840
866
|
}
|
|
841
|
-
function
|
|
842
|
-
return /* @__PURE__ */
|
|
867
|
+
function I({ message: e = "No data available." }) {
|
|
868
|
+
return /* @__PURE__ */ r("div", { className: "pvx-empty", children: /* @__PURE__ */ r("p", { children: e }) });
|
|
843
869
|
}
|
|
844
|
-
function
|
|
845
|
-
return
|
|
870
|
+
function Ur({ competitions: e, isLoading: n, onSelect: s, onRegister: t, className: a }) {
|
|
871
|
+
return n ? /* @__PURE__ */ r(F, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ r("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ r(Oe, { comp: i, onSelect: s, onRegister: t || s }, i.id)) }) : /* @__PURE__ */ r(I, { message: "No competitions available." });
|
|
846
872
|
}
|
|
847
|
-
function
|
|
848
|
-
var p,
|
|
849
|
-
const { cdnUrl:
|
|
850
|
-
return /* @__PURE__ */
|
|
873
|
+
function Oe({ comp: e, onSelect: n, onRegister: s }) {
|
|
874
|
+
var p, N, v;
|
|
875
|
+
const { cdnUrl: t } = w(), a = e.posterCdnPath ? `${t}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, u = d && o >= d, l = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), m = (i == null ? void 0 : i.isOpen) && !l && !u, g = /* @__PURE__ */ new Date(), h = (p = e.rounds) == null ? void 0 : p.find((x) => x.startTime && new Date(x.startTime) >= g), f = ((N = e.rounds) == null ? void 0 : N.length) || 0, b = ((v = e.rounds) == null ? void 0 : v.filter((x) => x.isFinalized).length) || 0;
|
|
876
|
+
return /* @__PURE__ */ c(
|
|
851
877
|
"div",
|
|
852
878
|
{
|
|
853
879
|
className: "pvx-comp-card",
|
|
854
|
-
onClick: () =>
|
|
880
|
+
onClick: () => n(e.id),
|
|
855
881
|
role: "button",
|
|
856
882
|
tabIndex: 0,
|
|
857
|
-
onKeyDown: (
|
|
858
|
-
(
|
|
883
|
+
onKeyDown: (x) => {
|
|
884
|
+
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), n(e.id));
|
|
859
885
|
},
|
|
860
886
|
children: [
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
/* @__PURE__ */
|
|
867
|
-
|
|
868
|
-
|
|
887
|
+
/* @__PURE__ */ r("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ r("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ r("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ r(Ge, {}) }) }),
|
|
888
|
+
/* @__PURE__ */ c("div", { className: "pvx-comp-card-body", children: [
|
|
889
|
+
/* @__PURE__ */ r("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
890
|
+
e.description && /* @__PURE__ */ r("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
891
|
+
/* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
|
|
892
|
+
/* @__PURE__ */ r(je, { type: e.type }),
|
|
893
|
+
e.game && /* @__PURE__ */ r(H, { children: e.game.toUpperCase() }),
|
|
894
|
+
e.formatDescription && e.formatDescription.split(", ").map((x, y) => /* @__PURE__ */ r(H, { variant: "format", children: x }, y))
|
|
869
895
|
] }),
|
|
870
|
-
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
|
|
873
|
-
/* @__PURE__ */
|
|
896
|
+
e.carsDescription && /* @__PURE__ */ r("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((x, y) => /* @__PURE__ */ r(H, { children: x }, y)) }),
|
|
897
|
+
/* @__PURE__ */ c("div", { className: "pvx-comp-card-schedule", children: [
|
|
898
|
+
h ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
899
|
+
/* @__PURE__ */ r("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
874
900
|
" ",
|
|
875
901
|
"R",
|
|
876
|
-
|
|
902
|
+
h.roundNumber,
|
|
877
903
|
" ",
|
|
878
|
-
|
|
904
|
+
h.track || "TBD",
|
|
879
905
|
" — ",
|
|
880
|
-
|
|
881
|
-
] }) :
|
|
882
|
-
|
|
906
|
+
Ke(h.startTime)
|
|
907
|
+
] }) : f > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
908
|
+
b,
|
|
883
909
|
"/",
|
|
884
|
-
|
|
910
|
+
f,
|
|
885
911
|
" rounds completed"
|
|
886
912
|
] }) : null,
|
|
887
|
-
|
|
888
|
-
|
|
913
|
+
f > 0 && /* @__PURE__ */ c("span", { className: "pvx-comp-card-round-count", children: [
|
|
914
|
+
f,
|
|
889
915
|
" round",
|
|
890
|
-
|
|
916
|
+
f !== 1 ? "s" : ""
|
|
891
917
|
] })
|
|
892
918
|
] }),
|
|
893
|
-
i && /* @__PURE__ */
|
|
894
|
-
|
|
919
|
+
i && /* @__PURE__ */ r(
|
|
920
|
+
We,
|
|
895
921
|
{
|
|
896
|
-
competitionId:
|
|
897
|
-
regOpen:
|
|
898
|
-
isFull:
|
|
899
|
-
deadlinePassed:
|
|
922
|
+
competitionId: e.id,
|
|
923
|
+
regOpen: m,
|
|
924
|
+
isFull: u,
|
|
925
|
+
deadlinePassed: l,
|
|
900
926
|
regCount: o,
|
|
901
|
-
regMax:
|
|
902
|
-
onRegister:
|
|
927
|
+
regMax: d,
|
|
928
|
+
onRegister: s
|
|
903
929
|
}
|
|
904
930
|
)
|
|
905
931
|
] })
|
|
@@ -907,754 +933,1006 @@ function qe({ comp: r, onSelect: t, onRegister: n }) {
|
|
|
907
933
|
}
|
|
908
934
|
);
|
|
909
935
|
}
|
|
910
|
-
function
|
|
911
|
-
const { isPowerMode:
|
|
912
|
-
return /* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
|
|
936
|
+
function We({ competitionId: e, regOpen: n, isFull: s, deadlinePassed: t, regCount: a, regMax: i, onRegister: o }) {
|
|
937
|
+
const { isPowerMode: d } = Q(), u = Y(e), { data: l } = z(e), m = (l == null ? void 0 : l.isRegistered) || !1, g = i ? a / i * 100 : 0, h = g >= 100 ? "full" : g >= 75 ? "warning" : "ok";
|
|
938
|
+
return /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
|
|
939
|
+
/* @__PURE__ */ r("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${h}`, children: [
|
|
940
|
+
a,
|
|
915
941
|
"/",
|
|
916
942
|
i || "∞",
|
|
917
943
|
" drivers"
|
|
918
944
|
] }) }),
|
|
919
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ r("div", { className: "pvx-comp-card-reg-action", children: m ? /* @__PURE__ */ r(
|
|
920
946
|
"button",
|
|
921
947
|
{
|
|
922
948
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
923
|
-
onClick: (
|
|
924
|
-
|
|
949
|
+
onClick: (f) => {
|
|
950
|
+
f.stopPropagation(), o(e);
|
|
925
951
|
},
|
|
926
952
|
children: "✓ Registered"
|
|
927
953
|
}
|
|
928
|
-
) :
|
|
954
|
+
) : n ? d ? /* @__PURE__ */ r(
|
|
929
955
|
"button",
|
|
930
956
|
{
|
|
931
957
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
932
|
-
onClick: (
|
|
933
|
-
|
|
958
|
+
onClick: (f) => {
|
|
959
|
+
f.stopPropagation(), o(e);
|
|
934
960
|
},
|
|
935
961
|
children: "Register"
|
|
936
962
|
}
|
|
937
|
-
) : /* @__PURE__ */
|
|
963
|
+
) : /* @__PURE__ */ r(
|
|
938
964
|
"a",
|
|
939
965
|
{
|
|
940
|
-
href:
|
|
966
|
+
href: u,
|
|
941
967
|
target: "_blank",
|
|
942
968
|
rel: "noopener noreferrer",
|
|
943
969
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
944
|
-
onClick: (
|
|
970
|
+
onClick: (f) => f.stopPropagation(),
|
|
945
971
|
children: "Register"
|
|
946
972
|
}
|
|
947
|
-
) : /* @__PURE__ */
|
|
973
|
+
) : /* @__PURE__ */ r("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
|
|
948
974
|
] });
|
|
949
975
|
}
|
|
950
|
-
function
|
|
951
|
-
return /* @__PURE__ */
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
/* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
976
|
+
function Ge() {
|
|
977
|
+
return /* @__PURE__ */ c("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
978
|
+
/* @__PURE__ */ r("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
979
|
+
/* @__PURE__ */ r("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
980
|
+
/* @__PURE__ */ r("path", { d: "M4 22h16" }),
|
|
981
|
+
/* @__PURE__ */ r("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
|
|
982
|
+
/* @__PURE__ */ r("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
|
|
983
|
+
/* @__PURE__ */ r("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
958
984
|
] });
|
|
959
985
|
}
|
|
960
|
-
function
|
|
961
|
-
var
|
|
962
|
-
const { data:
|
|
963
|
-
if (
|
|
964
|
-
return /* @__PURE__ */
|
|
965
|
-
if (!((
|
|
966
|
-
return /* @__PURE__ */
|
|
967
|
-
const o = ((
|
|
968
|
-
return /* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
986
|
+
function Ar({ competitionId: e, className: n }) {
|
|
987
|
+
var d, u;
|
|
988
|
+
const { data: s, isLoading: t } = De(e), { data: a, isLoading: i } = Me(e);
|
|
989
|
+
if (t || i)
|
|
990
|
+
return /* @__PURE__ */ r(F, { message: "Loading standings..." });
|
|
991
|
+
if (!((d = s == null ? void 0 : s.standings) != null && d.length))
|
|
992
|
+
return /* @__PURE__ */ r(I, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
993
|
+
const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((l) => l.isFinalized)) || [];
|
|
994
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card ${n || ""}`, children: [
|
|
995
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ c("div", { className: "pvx-card-header-left", children: [
|
|
996
|
+
/* @__PURE__ */ r("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
997
|
+
/* @__PURE__ */ c("span", { className: "pvx-standings-subtitle", children: [
|
|
972
998
|
"After ",
|
|
973
|
-
|
|
999
|
+
s.roundsCompleted,
|
|
974
1000
|
" round",
|
|
975
|
-
|
|
976
|
-
|
|
1001
|
+
s.roundsCompleted !== 1 ? "s" : "",
|
|
1002
|
+
s.countingRounds > 0 && ` (best ${s.countingRounds} count)`
|
|
977
1003
|
] })
|
|
978
1004
|
] }) }),
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
o.map((
|
|
1005
|
+
/* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
1006
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1007
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1008
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Driver" }),
|
|
1009
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
|
|
1010
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
|
|
1011
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--center", children: "Points" }),
|
|
1012
|
+
o.map((l) => /* @__PURE__ */ c(
|
|
987
1013
|
"th",
|
|
988
1014
|
{
|
|
989
1015
|
className: "pvx-th pvx-th--center pvx-hidden-below-md",
|
|
990
|
-
title:
|
|
1016
|
+
title: l.track || `Round ${l.roundNumber}`,
|
|
991
1017
|
children: [
|
|
992
1018
|
"R",
|
|
993
|
-
|
|
1019
|
+
l.roundNumber
|
|
994
1020
|
]
|
|
995
1021
|
},
|
|
996
|
-
|
|
1022
|
+
l.roundNumber
|
|
997
1023
|
))
|
|
998
1024
|
] }) }),
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
|
|
1025
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: s.standings.map((l) => /* @__PURE__ */ r(
|
|
1026
|
+
ze,
|
|
1001
1027
|
{
|
|
1002
|
-
driver:
|
|
1028
|
+
driver: l,
|
|
1003
1029
|
finalizedRounds: o
|
|
1004
1030
|
},
|
|
1005
|
-
|
|
1031
|
+
l.driverId || l.driverName
|
|
1006
1032
|
)) })
|
|
1007
1033
|
] }) })
|
|
1008
1034
|
] });
|
|
1009
1035
|
}
|
|
1010
|
-
function
|
|
1011
|
-
var o,
|
|
1012
|
-
const
|
|
1013
|
-
((o =
|
|
1014
|
-
),
|
|
1015
|
-
return /* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
|
|
1036
|
+
function ze({ driver: e, finalizedRounds: n }) {
|
|
1037
|
+
var o, d, u;
|
|
1038
|
+
const s = e.position <= 3, t = new Map(
|
|
1039
|
+
((o = e.roundResults) == null ? void 0 : o.map((l) => [l.roundNumber, l])) || []
|
|
1040
|
+
), a = ((d = e.roundResults) == null ? void 0 : d.filter((l) => l.position === 1).length) || 0, i = ((u = e.roundResults) == null ? void 0 : u.filter((l) => l.position <= 3).length) || 0;
|
|
1041
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
|
|
1042
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r(he, { position: e.position }) }),
|
|
1043
|
+
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1044
|
+
/* @__PURE__ */ r(xe, { nation: e.nation }),
|
|
1045
|
+
e.driverName
|
|
1020
1046
|
] }),
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
return /* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1048
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1049
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1050
|
+
n.map((l) => {
|
|
1051
|
+
const m = t.get(l.roundNumber), g = m == null ? void 0 : m.dropped;
|
|
1052
|
+
return /* @__PURE__ */ r(
|
|
1027
1053
|
"td",
|
|
1028
1054
|
{
|
|
1029
|
-
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!
|
|
1030
|
-
children:
|
|
1031
|
-
/* @__PURE__ */
|
|
1055
|
+
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!g && (m == null ? void 0 : m.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
|
|
1056
|
+
children: m ? /* @__PURE__ */ c("div", { className: `pvx-standings-round-cell ${g ? "pvx-standings-round-cell--dropped" : ""}`, children: [
|
|
1057
|
+
/* @__PURE__ */ c("span", { className: "pvx-standings-round-pos", children: [
|
|
1032
1058
|
"P",
|
|
1033
|
-
|
|
1059
|
+
m.position
|
|
1034
1060
|
] }),
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
] }) : /* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ r("span", { className: "pvx-standings-round-pts", children: m.points })
|
|
1062
|
+
] }) : /* @__PURE__ */ r("span", { className: "pvx-td--muted", children: "-" })
|
|
1037
1063
|
},
|
|
1038
|
-
|
|
1064
|
+
l.roundNumber
|
|
1039
1065
|
);
|
|
1040
1066
|
})
|
|
1041
1067
|
] });
|
|
1042
1068
|
}
|
|
1043
|
-
function
|
|
1044
|
-
var
|
|
1045
|
-
const { data:
|
|
1046
|
-
if (
|
|
1047
|
-
return /* @__PURE__ */
|
|
1048
|
-
if (!
|
|
1049
|
-
return /* @__PURE__ */
|
|
1050
|
-
const o = (
|
|
1051
|
-
return /* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1069
|
+
function Fr({ competitionId: e, roundNumber: n, className: s }) {
|
|
1070
|
+
var u;
|
|
1071
|
+
const { data: t, isLoading: a } = Ie(e, n);
|
|
1072
|
+
if (a)
|
|
1073
|
+
return /* @__PURE__ */ r(F, { message: "Loading results..." });
|
|
1074
|
+
if (!t)
|
|
1075
|
+
return /* @__PURE__ */ r(I, { message: "No results for this round." });
|
|
1076
|
+
const o = (t.sessions || []).find((l) => l.type === "RACE"), d = (u = o == null ? void 0 : o.results) == null ? void 0 : u.filter((l) => l.position <= 3).sort((l, m) => l.position - m.position);
|
|
1077
|
+
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${s || ""}`, children: [
|
|
1078
|
+
/* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
|
|
1079
|
+
/* @__PURE__ */ c("div", { children: [
|
|
1080
|
+
/* @__PURE__ */ c("h4", { className: "pvx-round-results-title", children: [
|
|
1055
1081
|
"Round ",
|
|
1056
|
-
|
|
1057
|
-
|
|
1082
|
+
t.roundNumber,
|
|
1083
|
+
t.track ? `: ${t.track}` : ""
|
|
1058
1084
|
] }),
|
|
1059
|
-
|
|
1085
|
+
t.startTime && /* @__PURE__ */ r("p", { className: "pvx-round-results-date", children: new Date(t.startTime).toLocaleDateString("en-GB", {
|
|
1060
1086
|
day: "numeric",
|
|
1061
1087
|
month: "long",
|
|
1062
1088
|
year: "numeric"
|
|
1063
1089
|
}) })
|
|
1064
1090
|
] }),
|
|
1065
|
-
(
|
|
1066
|
-
/* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
] },
|
|
1091
|
+
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ r("div", { className: "pvx-round-podium-summary", children: d.map((l) => /* @__PURE__ */ c("span", { className: "pvx-round-podium-item", children: [
|
|
1092
|
+
/* @__PURE__ */ r("span", { children: _e[l.position - 1] }),
|
|
1093
|
+
/* @__PURE__ */ r("span", { children: l.driverName })
|
|
1094
|
+
] }, l.driverId)) })
|
|
1069
1095
|
] }),
|
|
1070
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ r(Qe, { round: t })
|
|
1071
1097
|
] });
|
|
1072
1098
|
}
|
|
1073
|
-
function
|
|
1074
|
-
var
|
|
1075
|
-
const [
|
|
1076
|
-
if (!
|
|
1077
|
-
return /* @__PURE__ */
|
|
1078
|
-
const i =
|
|
1079
|
-
return /* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
|
|
1099
|
+
function Qe({ round: e, className: n }) {
|
|
1100
|
+
var d, u;
|
|
1101
|
+
const [s, t] = M(null), a = (e == null ? void 0 : e.sessions) || [];
|
|
1102
|
+
if (!a.length)
|
|
1103
|
+
return /* @__PURE__ */ r(I, { message: "No session data for this round." });
|
|
1104
|
+
const i = s || ((d = a.find((l) => l.type === "RACE")) == null ? void 0 : d.type) || ((u = a[0]) == null ? void 0 : u.type), o = a.find((l) => l.type === i) || a[0];
|
|
1105
|
+
return /* @__PURE__ */ c("div", { className: n || "", children: [
|
|
1106
|
+
/* @__PURE__ */ r(
|
|
1107
|
+
Ve,
|
|
1082
1108
|
{
|
|
1083
|
-
sessions:
|
|
1109
|
+
sessions: a,
|
|
1084
1110
|
activeSession: i,
|
|
1085
|
-
onSelect:
|
|
1111
|
+
onSelect: t
|
|
1086
1112
|
}
|
|
1087
1113
|
),
|
|
1088
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ r(Ye, { session: o })
|
|
1089
1115
|
] });
|
|
1090
1116
|
}
|
|
1091
|
-
function
|
|
1092
|
-
var
|
|
1093
|
-
const
|
|
1094
|
-
if (!((
|
|
1095
|
-
return /* @__PURE__ */
|
|
1096
|
-
const
|
|
1097
|
-
return /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1117
|
+
function Ye({ session: e }) {
|
|
1118
|
+
var t;
|
|
1119
|
+
const n = e.type === "RACE";
|
|
1120
|
+
if (!((t = e.results) != null && t.length))
|
|
1121
|
+
return /* @__PURE__ */ r(I, { message: `No results for ${e.type}.` });
|
|
1122
|
+
const s = He(e.results);
|
|
1123
|
+
return /* @__PURE__ */ r("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
1124
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1125
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1126
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Driver" }),
|
|
1127
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1128
|
+
/* @__PURE__ */ r("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1129
|
+
n && /* @__PURE__ */ c(G, { children: [
|
|
1130
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1131
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1132
|
+
/* @__PURE__ */ r("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1107
1133
|
] })
|
|
1108
1134
|
] }) }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
|
|
1135
|
+
/* @__PURE__ */ r("tbody", { className: "pvx-tbody", children: e.results.map((a, i) => /* @__PURE__ */ r(
|
|
1136
|
+
Ze,
|
|
1111
1137
|
{
|
|
1112
|
-
result:
|
|
1113
|
-
isRace:
|
|
1114
|
-
fastestSplits:
|
|
1138
|
+
result: a,
|
|
1139
|
+
isRace: n,
|
|
1140
|
+
fastestSplits: s,
|
|
1115
1141
|
rowIndex: i
|
|
1116
1142
|
},
|
|
1117
|
-
|
|
1143
|
+
a.driverId || i
|
|
1118
1144
|
)) })
|
|
1119
1145
|
] }) });
|
|
1120
1146
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const
|
|
1123
|
-
return /* @__PURE__ */
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
|
|
1128
|
-
|
|
1147
|
+
function Ze({ result: e, isRace: n, fastestSplits: s, rowIndex: t }) {
|
|
1148
|
+
const a = e.position <= 3;
|
|
1149
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${a ? "pvx-row--podium" : ""}`, children: [
|
|
1150
|
+
/* @__PURE__ */ r("td", { className: "pvx-td", children: /* @__PURE__ */ r(he, { position: e.position }) }),
|
|
1151
|
+
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1152
|
+
/* @__PURE__ */ r(xe, { nation: e.nation }),
|
|
1153
|
+
e.driverName,
|
|
1154
|
+
e.carNumber != null && /* @__PURE__ */ c("span", { className: "pvx-car-number", children: [
|
|
1129
1155
|
"#",
|
|
1130
|
-
|
|
1156
|
+
e.carNumber
|
|
1131
1157
|
] }),
|
|
1132
|
-
|
|
1158
|
+
e.penalty && /* @__PURE__ */ r("span", { className: "pvx-penalty", children: e.penalty })
|
|
1133
1159
|
] }),
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
|
|
1160
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-hidden-below-sm", children: S(e.carId) }),
|
|
1161
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ r(
|
|
1162
|
+
Je,
|
|
1137
1163
|
{
|
|
1138
|
-
bestLap:
|
|
1139
|
-
hasBestLap:
|
|
1140
|
-
splits:
|
|
1141
|
-
fastestSplits:
|
|
1142
|
-
showAbove:
|
|
1164
|
+
bestLap: e.bestLapFormatted,
|
|
1165
|
+
hasBestLap: e.hasBestLap,
|
|
1166
|
+
splits: e.splits,
|
|
1167
|
+
fastestSplits: s,
|
|
1168
|
+
showAbove: t <= 1
|
|
1143
1169
|
}
|
|
1144
1170
|
) }),
|
|
1145
|
-
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
|
|
1171
|
+
n && /* @__PURE__ */ c(G, { children: [
|
|
1172
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
|
|
1173
|
+
/* @__PURE__ */ r("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
|
|
1174
|
+
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--center", children: [
|
|
1175
|
+
/* @__PURE__ */ r("span", { className: "pvx-session-points", children: e.points }),
|
|
1176
|
+
e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ c("span", { className: "pvx-points-override", children: [
|
|
1151
1177
|
"(",
|
|
1152
|
-
|
|
1153
|
-
|
|
1178
|
+
e.pointsOverride > 0 ? "+" : "",
|
|
1179
|
+
e.pointsOverride,
|
|
1154
1180
|
")"
|
|
1155
1181
|
] })
|
|
1156
1182
|
] })
|
|
1157
1183
|
] })
|
|
1158
1184
|
] });
|
|
1159
1185
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
(
|
|
1164
|
-
const
|
|
1165
|
-
return /* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1186
|
+
function Je({ bestLap: e, hasBestLap: n, splits: s, fastestSplits: t, showAbove: a }) {
|
|
1187
|
+
return e ? /* @__PURE__ */ c("span", { className: `pvx-best-lap-cell ${n ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1188
|
+
/* @__PURE__ */ r("span", { className: "pvx-best-lap-time", children: e }),
|
|
1189
|
+
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ r("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ r("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
|
|
1190
|
+
const d = t && i === t[o];
|
|
1191
|
+
return /* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1192
|
+
/* @__PURE__ */ c("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1167
1193
|
"S",
|
|
1168
1194
|
o + 1
|
|
1169
1195
|
] }),
|
|
1170
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ r("span", { className: d ? "pvx-splits-tooltip-best" : "", children: i })
|
|
1171
1197
|
] }, o);
|
|
1172
1198
|
}) }) })
|
|
1173
|
-
] }) : /* @__PURE__ */
|
|
1174
|
-
}
|
|
1175
|
-
function
|
|
1176
|
-
const { getSteamId:
|
|
1177
|
-
if (
|
|
1178
|
-
return /* @__PURE__ */
|
|
1179
|
-
const o = (
|
|
1180
|
-
return o.length ? /* @__PURE__ */
|
|
1181
|
-
var
|
|
1182
|
-
const
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
|
|
1199
|
+
] }) : /* @__PURE__ */ r("span", { className: "pvx-td--muted", children: "-" });
|
|
1200
|
+
}
|
|
1201
|
+
function Er({ competitionId: e, className: n }) {
|
|
1202
|
+
const { getSteamId: s } = w(), { data: t, isLoading: a } = ie(e), i = s();
|
|
1203
|
+
if (a)
|
|
1204
|
+
return /* @__PURE__ */ r(F, { message: "Loading drivers..." });
|
|
1205
|
+
const o = (t == null ? void 0 : t.drivers) || (t == null ? void 0 : t.entries) || [];
|
|
1206
|
+
return o.length ? /* @__PURE__ */ r("div", { className: `pvx-entry-grid ${n || ""}`, children: o.map((d) => {
|
|
1207
|
+
var l, m;
|
|
1208
|
+
const u = i && d.steamId === i;
|
|
1209
|
+
return /* @__PURE__ */ c("div", { className: `pvx-entry-card ${u ? "pvx-entry-card--you" : ""}`, children: [
|
|
1210
|
+
d.avatarUrl ? /* @__PURE__ */ r(
|
|
1185
1211
|
"img",
|
|
1186
1212
|
{
|
|
1187
|
-
src:
|
|
1213
|
+
src: d.avatarUrl,
|
|
1188
1214
|
alt: "",
|
|
1189
1215
|
className: "pvx-entry-avatar"
|
|
1190
1216
|
}
|
|
1191
|
-
) : /* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
|
|
1194
|
-
|
|
1217
|
+
) : /* @__PURE__ */ r("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((m = (l = d.displayName) == null ? void 0 : l.charAt(0)) == null ? void 0 : m.toUpperCase()) || "?" }),
|
|
1218
|
+
/* @__PURE__ */ c("span", { className: "pvx-entry-name", children: [
|
|
1219
|
+
d.displayName,
|
|
1220
|
+
u && /* @__PURE__ */ r("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1195
1221
|
] })
|
|
1196
|
-
] },
|
|
1197
|
-
}) }) : /* @__PURE__ */
|
|
1198
|
-
}
|
|
1199
|
-
function
|
|
1200
|
-
competitionId:
|
|
1201
|
-
driverData:
|
|
1202
|
-
className:
|
|
1203
|
-
children:
|
|
1222
|
+
] }, d.steamId || d.driverId);
|
|
1223
|
+
}) }) : /* @__PURE__ */ r(I, { message: "No drivers registered yet." });
|
|
1224
|
+
}
|
|
1225
|
+
function _r({
|
|
1226
|
+
competitionId: e,
|
|
1227
|
+
driverData: n,
|
|
1228
|
+
className: s,
|
|
1229
|
+
children: t
|
|
1204
1230
|
}) {
|
|
1205
|
-
const { data:
|
|
1206
|
-
o &&
|
|
1207
|
-
},
|
|
1208
|
-
o &&
|
|
1231
|
+
const { data: a, isLoading: i } = z(e), { isPowerMode: o } = Q(), d = Y(e), u = oe(e), l = ce(e), m = (a == null ? void 0 : a.isRegistered) || !1, g = i || u.isPending || l.isPending, h = u.error || l.error || null, f = () => {
|
|
1232
|
+
o && u.mutate(n || {});
|
|
1233
|
+
}, b = () => {
|
|
1234
|
+
o && l.mutate();
|
|
1209
1235
|
};
|
|
1210
|
-
return typeof
|
|
1236
|
+
return typeof t == "function" ? t({ isRegistered: m, isLoading: g, register: f, withdraw: b, error: h, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ r(
|
|
1211
1237
|
"button",
|
|
1212
1238
|
{
|
|
1213
|
-
className: `pvx-comp-register-btn ${
|
|
1214
|
-
onClick:
|
|
1215
|
-
disabled:
|
|
1216
|
-
children:
|
|
1239
|
+
className: `pvx-comp-register-btn ${s || ""}`,
|
|
1240
|
+
onClick: m ? b : f,
|
|
1241
|
+
disabled: g,
|
|
1242
|
+
children: g ? "Loading..." : m ? "Withdraw" : "Register"
|
|
1217
1243
|
}
|
|
1218
|
-
) : /* @__PURE__ */
|
|
1244
|
+
) : /* @__PURE__ */ r(
|
|
1219
1245
|
"a",
|
|
1220
1246
|
{
|
|
1221
|
-
href:
|
|
1247
|
+
href: d,
|
|
1222
1248
|
target: "_blank",
|
|
1223
1249
|
rel: "noopener noreferrer",
|
|
1224
|
-
className: `pvx-comp-register-link ${
|
|
1225
|
-
children:
|
|
1250
|
+
className: `pvx-comp-register-link ${s || ""}`,
|
|
1251
|
+
children: m ? "View Registration" : "Register on PitVox"
|
|
1226
1252
|
}
|
|
1227
1253
|
);
|
|
1228
1254
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const { getSteamId: a } =
|
|
1231
|
-
return
|
|
1232
|
-
|
|
1255
|
+
function qr({ competitionId: e, registration: n, onWithdrawSuccess: s, className: t }) {
|
|
1256
|
+
const { getSteamId: a } = w(), { isPowerMode: i } = Q(), o = Y(e), { data: d, isLoading: u } = z(e), { data: l, isLoading: m } = ie(e), g = oe(e), h = ce(e), f = a(), b = (d == null ? void 0 : d.isRegistered) || !1, p = (l == null ? void 0 : l.drivers) || (l == null ? void 0 : l.entries) || [], N = n || {}, v = p.length || N.currentCount || 0, x = N.maxParticipants && v >= N.maxParticipants, y = N.deadline && new Date(N.deadline) < /* @__PURE__ */ new Date(), L = N.isOpen && !y && !x;
|
|
1257
|
+
return u || m ? /* @__PURE__ */ r(F, { message: "Loading registration..." }) : b ? /* @__PURE__ */ r("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ r(
|
|
1258
|
+
er,
|
|
1233
1259
|
{
|
|
1234
|
-
competitionId:
|
|
1235
|
-
drivers:
|
|
1236
|
-
steamId:
|
|
1237
|
-
isPowerMode:
|
|
1238
|
-
registrationUrl:
|
|
1239
|
-
withdrawMutation:
|
|
1240
|
-
|
|
1260
|
+
competitionId: e,
|
|
1261
|
+
drivers: p,
|
|
1262
|
+
steamId: f,
|
|
1263
|
+
isPowerMode: i,
|
|
1264
|
+
registrationUrl: o,
|
|
1265
|
+
withdrawMutation: h,
|
|
1266
|
+
onWithdrawSuccess: s,
|
|
1267
|
+
registration: N
|
|
1241
1268
|
}
|
|
1242
|
-
) }) :
|
|
1243
|
-
|
|
1269
|
+
) }) : L ? f ? i ? /* @__PURE__ */ r("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ r(
|
|
1270
|
+
Xe,
|
|
1244
1271
|
{
|
|
1245
|
-
competitionId:
|
|
1246
|
-
registerMutation:
|
|
1247
|
-
registration:
|
|
1272
|
+
competitionId: e,
|
|
1273
|
+
registerMutation: g,
|
|
1274
|
+
registration: N
|
|
1248
1275
|
}
|
|
1249
|
-
) }) : /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
|
|
1276
|
+
) }) : /* @__PURE__ */ r("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ r("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ r("div", { className: `pvx-reg-panel ${t || ""}`, children: i ? /* @__PURE__ */ r("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ r("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ r("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ c("div", { className: `pvx-reg-panel ${t || ""}`, children: [
|
|
1277
|
+
/* @__PURE__ */ r("div", { className: "pvx-reg-status-msg", children: x ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1278
|
+
p.length > 0 && /* @__PURE__ */ r(ge, { drivers: p, steamId: f })
|
|
1252
1279
|
] });
|
|
1253
1280
|
}
|
|
1254
|
-
function
|
|
1255
|
-
const [
|
|
1256
|
-
|
|
1257
|
-
discordUsername:
|
|
1281
|
+
function Xe({ competitionId: e, registerMutation: n, registration: s }) {
|
|
1282
|
+
const [t, a] = M(""), [i, o] = M("intermediate"), [d, u] = M(""), l = (f) => {
|
|
1283
|
+
f.preventDefault(), n.mutate({
|
|
1284
|
+
discordUsername: t || void 0,
|
|
1258
1285
|
experience: i,
|
|
1259
|
-
comments:
|
|
1286
|
+
comments: d || void 0
|
|
1260
1287
|
});
|
|
1261
|
-
},
|
|
1262
|
-
return /* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
|
|
1288
|
+
}, m = s || {}, g = m.currentCount || 0, h = m.maxParticipants;
|
|
1289
|
+
return /* @__PURE__ */ c("form", { className: "pvx-reg-form", onSubmit: l, children: [
|
|
1290
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1291
|
+
/* @__PURE__ */ r("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1292
|
+
h && /* @__PURE__ */ r(fe, { count: g, max: h })
|
|
1266
1293
|
] }),
|
|
1267
|
-
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1294
|
+
n.error && /* @__PURE__ */ r("div", { className: "pvx-reg-error", children: n.error.message || "Registration failed" }),
|
|
1295
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
1296
|
+
/* @__PURE__ */ c("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${e}`, children: [
|
|
1270
1297
|
"Discord Username ",
|
|
1271
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ r("span", { className: "pvx-reg-optional", children: "(optional)" })
|
|
1272
1299
|
] }),
|
|
1273
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ r(
|
|
1274
1301
|
"input",
|
|
1275
1302
|
{
|
|
1276
|
-
id: `pvx-discord-${
|
|
1303
|
+
id: `pvx-discord-${e}`,
|
|
1277
1304
|
type: "text",
|
|
1278
1305
|
className: "pvx-reg-input",
|
|
1279
1306
|
placeholder: "e.g. username",
|
|
1280
|
-
value:
|
|
1281
|
-
onChange: (
|
|
1307
|
+
value: t,
|
|
1308
|
+
onChange: (f) => a(f.target.value)
|
|
1282
1309
|
}
|
|
1283
1310
|
)
|
|
1284
1311
|
] }),
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
1313
|
+
/* @__PURE__ */ r("label", { className: "pvx-reg-label", htmlFor: `pvx-exp-${e}`, children: "Experience Level" }),
|
|
1314
|
+
/* @__PURE__ */ c(
|
|
1288
1315
|
"select",
|
|
1289
1316
|
{
|
|
1290
|
-
id: `pvx-exp-${
|
|
1317
|
+
id: `pvx-exp-${e}`,
|
|
1291
1318
|
className: "pvx-reg-select",
|
|
1292
1319
|
value: i,
|
|
1293
|
-
onChange: (
|
|
1320
|
+
onChange: (f) => o(f.target.value),
|
|
1294
1321
|
children: [
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1322
|
+
/* @__PURE__ */ r("option", { value: "beginner", children: "Beginner" }),
|
|
1323
|
+
/* @__PURE__ */ r("option", { value: "intermediate", children: "Intermediate" }),
|
|
1324
|
+
/* @__PURE__ */ r("option", { value: "advanced", children: "Advanced" })
|
|
1298
1325
|
]
|
|
1299
1326
|
}
|
|
1300
1327
|
)
|
|
1301
1328
|
] }),
|
|
1302
|
-
/* @__PURE__ */
|
|
1303
|
-
/* @__PURE__ */
|
|
1329
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
1330
|
+
/* @__PURE__ */ c("label", { className: "pvx-reg-label", htmlFor: `pvx-comments-${e}`, children: [
|
|
1304
1331
|
"Comments ",
|
|
1305
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ r("span", { className: "pvx-reg-optional", children: "(optional)" })
|
|
1306
1333
|
] }),
|
|
1307
|
-
/* @__PURE__ */
|
|
1334
|
+
/* @__PURE__ */ r(
|
|
1308
1335
|
"textarea",
|
|
1309
1336
|
{
|
|
1310
|
-
id: `pvx-comments-${
|
|
1337
|
+
id: `pvx-comments-${e}`,
|
|
1311
1338
|
className: "pvx-reg-textarea",
|
|
1312
1339
|
rows: 3,
|
|
1313
1340
|
placeholder: "Anything the organisers should know?",
|
|
1314
|
-
value:
|
|
1315
|
-
onChange: (
|
|
1341
|
+
value: d,
|
|
1342
|
+
onChange: (f) => u(f.target.value)
|
|
1316
1343
|
}
|
|
1317
1344
|
)
|
|
1318
1345
|
] }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ r("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ r(
|
|
1320
1347
|
"button",
|
|
1321
1348
|
{
|
|
1322
1349
|
type: "submit",
|
|
1323
1350
|
className: "pvx-comp-register-btn",
|
|
1324
|
-
disabled:
|
|
1325
|
-
children:
|
|
1351
|
+
disabled: n.isPending,
|
|
1352
|
+
children: n.isPending ? "Registering..." : "Register"
|
|
1326
1353
|
}
|
|
1327
1354
|
) })
|
|
1328
1355
|
] });
|
|
1329
1356
|
}
|
|
1330
|
-
function
|
|
1331
|
-
const [
|
|
1357
|
+
function er({ competitionId: e, drivers: n, steamId: s, isPowerMode: t, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1358
|
+
const [u, l] = M(!1), m = () => {
|
|
1332
1359
|
i.mutate(void 0, {
|
|
1333
|
-
onSuccess: () =>
|
|
1360
|
+
onSuccess: () => {
|
|
1361
|
+
l(!1), o && o();
|
|
1362
|
+
}
|
|
1334
1363
|
});
|
|
1335
|
-
},
|
|
1336
|
-
return /* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
|
|
1364
|
+
}, g = d || {}, h = n.length || g.currentCount || 0, f = g.maxParticipants;
|
|
1365
|
+
return /* @__PURE__ */ c(G, { children: [
|
|
1366
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1367
|
+
/* @__PURE__ */ r("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1368
|
+
f && /* @__PURE__ */ r(fe, { count: h, max: f })
|
|
1340
1369
|
] }),
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
i.error && /* @__PURE__ */
|
|
1343
|
-
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ r(ge, { drivers: n, steamId: s }),
|
|
1371
|
+
i.error && /* @__PURE__ */ r("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1372
|
+
t ? /* @__PURE__ */ r("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ c("div", { className: "pvx-reg-confirm", children: [
|
|
1373
|
+
/* @__PURE__ */ r("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1374
|
+
/* @__PURE__ */ c("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1375
|
+
/* @__PURE__ */ r(
|
|
1347
1376
|
"button",
|
|
1348
1377
|
{
|
|
1349
1378
|
type: "button",
|
|
1350
1379
|
className: "pvx-reg-cancel-btn",
|
|
1351
|
-
onClick: () =>
|
|
1380
|
+
onClick: () => l(!1),
|
|
1352
1381
|
children: "Cancel"
|
|
1353
1382
|
}
|
|
1354
1383
|
),
|
|
1355
|
-
/* @__PURE__ */
|
|
1384
|
+
/* @__PURE__ */ r(
|
|
1356
1385
|
"button",
|
|
1357
1386
|
{
|
|
1358
1387
|
type: "button",
|
|
1359
1388
|
className: "pvx-reg-danger-btn",
|
|
1360
|
-
onClick:
|
|
1389
|
+
onClick: m,
|
|
1361
1390
|
disabled: i.isPending,
|
|
1362
1391
|
children: i.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1363
1392
|
}
|
|
1364
1393
|
)
|
|
1365
1394
|
] })
|
|
1366
|
-
] }) : /* @__PURE__ */
|
|
1395
|
+
] }) : /* @__PURE__ */ r(
|
|
1367
1396
|
"button",
|
|
1368
1397
|
{
|
|
1369
1398
|
type: "button",
|
|
1370
1399
|
className: "pvx-reg-unregister-btn",
|
|
1371
|
-
onClick: () =>
|
|
1400
|
+
onClick: () => l(!0),
|
|
1372
1401
|
children: "Unregister"
|
|
1373
1402
|
}
|
|
1374
|
-
) }) : /* @__PURE__ */
|
|
1403
|
+
) }) : /* @__PURE__ */ r("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ r("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
|
|
1375
1404
|
] });
|
|
1376
1405
|
}
|
|
1377
|
-
function
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1406
|
+
function ge({ drivers: e, steamId: n }) {
|
|
1407
|
+
if (!e.length)
|
|
1408
|
+
return /* @__PURE__ */ r("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1409
|
+
const s = [...e].sort((t, a) => {
|
|
1410
|
+
const i = n && t.steamId === n ? -1 : 0, o = n && a.steamId === n ? -1 : 0;
|
|
1411
|
+
return i - o;
|
|
1412
|
+
});
|
|
1413
|
+
return /* @__PURE__ */ r("div", { className: "pvx-reg-driver-list", children: s.map((t) => {
|
|
1414
|
+
var i, o;
|
|
1415
|
+
const a = n && t.steamId === n;
|
|
1416
|
+
return /* @__PURE__ */ c(
|
|
1382
1417
|
"div",
|
|
1383
1418
|
{
|
|
1384
|
-
className: `pvx-
|
|
1419
|
+
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1385
1420
|
children: [
|
|
1386
|
-
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
|
|
1389
|
-
a && /* @__PURE__ */
|
|
1421
|
+
t.avatarUrl ? /* @__PURE__ */ r("img", { src: t.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ r("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = t.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
|
|
1422
|
+
/* @__PURE__ */ c("span", { className: "pvx-reg-driver-name", children: [
|
|
1423
|
+
t.displayName,
|
|
1424
|
+
a && /* @__PURE__ */ r("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1390
1425
|
] })
|
|
1391
1426
|
]
|
|
1392
1427
|
},
|
|
1393
|
-
|
|
1428
|
+
t.steamId || t.driverId
|
|
1394
1429
|
);
|
|
1395
|
-
}) })
|
|
1430
|
+
}) });
|
|
1396
1431
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const
|
|
1399
|
-
return /* @__PURE__ */
|
|
1400
|
-
|
|
1432
|
+
function fe({ count: e, max: n }) {
|
|
1433
|
+
const s = n ? e / n * 100 : 0, t = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
|
|
1434
|
+
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${t}`, children: [
|
|
1435
|
+
e,
|
|
1401
1436
|
"/",
|
|
1402
|
-
|
|
1437
|
+
n,
|
|
1403
1438
|
" drivers"
|
|
1404
1439
|
] });
|
|
1405
1440
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const { cdnUrl:
|
|
1408
|
-
queryKey: ["pitvox", "laps",
|
|
1409
|
-
queryFn: () =>
|
|
1410
|
-
enabled: !!
|
|
1441
|
+
function rr(e) {
|
|
1442
|
+
const { cdnUrl: n } = w(), s = k({
|
|
1443
|
+
queryKey: ["pitvox", "laps", "global", e],
|
|
1444
|
+
queryFn: () => R(n, `laps/${e}.json`),
|
|
1445
|
+
enabled: !!e,
|
|
1411
1446
|
staleTime: 3e4,
|
|
1412
1447
|
refetchInterval: 3e4
|
|
1413
|
-
}),
|
|
1448
|
+
}), t = s.data;
|
|
1414
1449
|
return {
|
|
1415
|
-
isLoading:
|
|
1416
|
-
error:
|
|
1417
|
-
data:
|
|
1418
|
-
driverName:
|
|
1419
|
-
lapCount:
|
|
1420
|
-
trackBreakdown:
|
|
1421
|
-
carBreakdown:
|
|
1422
|
-
recordsHeld:
|
|
1423
|
-
currentRecords:
|
|
1424
|
-
bestRanking:
|
|
1425
|
-
bestRankingTrackId:
|
|
1426
|
-
bestRankingLayout:
|
|
1427
|
-
bestRankingCarId:
|
|
1428
|
-
generatedAt:
|
|
1450
|
+
isLoading: s.isLoading,
|
|
1451
|
+
error: s.error,
|
|
1452
|
+
data: t ? {
|
|
1453
|
+
driverName: t.driverName || "Driver",
|
|
1454
|
+
lapCount: t.lapCount || 0,
|
|
1455
|
+
trackBreakdown: t.trackBreakdown || [],
|
|
1456
|
+
carBreakdown: t.carBreakdown || [],
|
|
1457
|
+
recordsHeld: t.recordsHeld || 0,
|
|
1458
|
+
currentRecords: t.currentRecords || [],
|
|
1459
|
+
bestRanking: t.bestRanking ?? null,
|
|
1460
|
+
bestRankingTrackId: t.bestRankingTrackId ?? null,
|
|
1461
|
+
bestRankingLayout: t.bestRankingLayout ?? null,
|
|
1462
|
+
bestRankingCarId: t.bestRankingCarId ?? null,
|
|
1463
|
+
generatedAt: t.generatedAt
|
|
1429
1464
|
} : null
|
|
1430
1465
|
};
|
|
1431
1466
|
}
|
|
1432
|
-
function
|
|
1467
|
+
function tr(e) {
|
|
1433
1468
|
var i;
|
|
1434
|
-
const { cdnUrl:
|
|
1435
|
-
queryKey: ["pitvox", "ratings",
|
|
1436
|
-
queryFn: () =>
|
|
1469
|
+
const { cdnUrl: n, partnerSlug: s } = w(), t = k({
|
|
1470
|
+
queryKey: ["pitvox", "ratings", s],
|
|
1471
|
+
queryFn: () => R(n, `leaderboards/partners/${s}/ratings.json`),
|
|
1437
1472
|
staleTime: 6e4,
|
|
1438
1473
|
refetchInterval: 6e4
|
|
1439
|
-
}),
|
|
1474
|
+
}), a = C(() => {
|
|
1440
1475
|
var o;
|
|
1441
|
-
return !((o =
|
|
1442
|
-
(
|
|
1476
|
+
return !((o = t.data) != null && o.drivers) || !e ? null : t.data.drivers.find(
|
|
1477
|
+
(d) => d.identifier === e
|
|
1443
1478
|
) || null;
|
|
1444
|
-
}, [(i =
|
|
1479
|
+
}, [(i = t.data) == null ? void 0 : i.drivers, e]);
|
|
1445
1480
|
return {
|
|
1446
|
-
isLoading:
|
|
1447
|
-
error:
|
|
1448
|
-
data:
|
|
1449
|
-
rating:
|
|
1450
|
-
rank:
|
|
1451
|
-
totalDrivers:
|
|
1452
|
-
comboCount:
|
|
1453
|
-
distinctCars:
|
|
1454
|
-
combos:
|
|
1481
|
+
isLoading: t.isLoading,
|
|
1482
|
+
error: t.error,
|
|
1483
|
+
data: a ? {
|
|
1484
|
+
rating: a.rating,
|
|
1485
|
+
rank: a.rank,
|
|
1486
|
+
totalDrivers: t.data.driverCount || t.data.drivers.length,
|
|
1487
|
+
comboCount: a.comboCount || 0,
|
|
1488
|
+
distinctCars: a.distinctCars || 0,
|
|
1489
|
+
combos: a.combos || []
|
|
1455
1490
|
} : null
|
|
1456
1491
|
};
|
|
1457
1492
|
}
|
|
1458
|
-
function
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1493
|
+
function nr() {
|
|
1494
|
+
const { cdnUrl: e, partnerSlug: n, getSteamId: s } = w(), t = s(), { data: a, isLoading: i } = k({
|
|
1495
|
+
queryKey: ["pitvox", "competitions", n],
|
|
1496
|
+
queryFn: async () => {
|
|
1497
|
+
const m = await R(e, "competitions/index.json");
|
|
1498
|
+
return m != null && m.competitions ? m.competitions.filter((g) => g.partnerSlug === n) : [];
|
|
1499
|
+
},
|
|
1500
|
+
staleTime: 6e4
|
|
1501
|
+
}), o = (a == null ? void 0 : a.map((m) => m.id)) || [], d = ke({
|
|
1502
|
+
queries: o.map((m) => ({
|
|
1503
|
+
queryKey: ["pitvox", "competition", n, m, "entrylist"],
|
|
1504
|
+
queryFn: () => R(e, `competitions/${n}/${m}/entrylist.json`),
|
|
1505
|
+
enabled: !!t && o.length > 0,
|
|
1506
|
+
staleTime: 6e4
|
|
1507
|
+
}))
|
|
1508
|
+
}), u = d.some((m) => m.isLoading);
|
|
1509
|
+
return {
|
|
1510
|
+
data: C(() => {
|
|
1511
|
+
var h, f;
|
|
1512
|
+
if (!a || !t || u) return [];
|
|
1513
|
+
const m = /* @__PURE__ */ new Date(), g = [];
|
|
1514
|
+
for (let b = 0; b < a.length; b++) {
|
|
1515
|
+
const p = a[b], N = (h = d[b]) == null ? void 0 : h.data;
|
|
1516
|
+
if (!((f = N == null ? void 0 : N.drivers) == null ? void 0 : f.some((y) => y.steamId === t))) continue;
|
|
1517
|
+
const x = p.rounds || [];
|
|
1518
|
+
for (const y of x)
|
|
1519
|
+
y.isFinalized || !y.startTime || new Date(y.startTime) <= m || g.push({
|
|
1520
|
+
competitionId: p.id,
|
|
1521
|
+
competitionName: p.name,
|
|
1522
|
+
roundNumber: y.roundNumber,
|
|
1523
|
+
track: y.track || "TBD",
|
|
1524
|
+
startTime: y.startTime
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
return g.sort((b, p) => new Date(b.startTime) - new Date(p.startTime)), g.length > 0 && (g[0].isNext = !0), g;
|
|
1528
|
+
}, [a, t, u, d]),
|
|
1529
|
+
isLoading: i || !!t && u
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
function sr() {
|
|
1533
|
+
const { onFetchNotifications: e } = w();
|
|
1534
|
+
return !!e;
|
|
1535
|
+
}
|
|
1536
|
+
function ar(e = {}) {
|
|
1537
|
+
const { onFetchNotifications: n, partnerSlug: s } = w(), { limit: t = 20, unreadOnly: a = !1 } = e;
|
|
1538
|
+
return k({
|
|
1539
|
+
queryKey: ["pitvox", "notifications", s, { limit: t, unreadOnly: a }],
|
|
1540
|
+
queryFn: () => n({ limit: t, unreadOnly: a }),
|
|
1541
|
+
enabled: !!n,
|
|
1542
|
+
staleTime: 3e4,
|
|
1543
|
+
refetchInterval: 3e4
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
function Vr() {
|
|
1547
|
+
const { onFetchNotifications: e, partnerSlug: n } = w(), { data: s, isLoading: t } = k({
|
|
1548
|
+
queryKey: ["pitvox", "notifications", n, { limit: 1, unreadOnly: !1 }],
|
|
1549
|
+
queryFn: () => e({ limit: 1 }),
|
|
1550
|
+
enabled: !!e,
|
|
1551
|
+
staleTime: 3e4,
|
|
1552
|
+
refetchInterval: 3e4,
|
|
1553
|
+
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
1554
|
+
});
|
|
1555
|
+
return { count: s ?? 0, isLoading: t };
|
|
1556
|
+
}
|
|
1557
|
+
function ir() {
|
|
1558
|
+
const { onMarkNotificationRead: e, partnerSlug: n } = w(), s = P();
|
|
1559
|
+
return _({
|
|
1560
|
+
mutationFn: (t) => {
|
|
1561
|
+
if (!e)
|
|
1562
|
+
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
1563
|
+
return e(t);
|
|
1564
|
+
},
|
|
1565
|
+
onSuccess: (t, a) => {
|
|
1566
|
+
s.setQueriesData(
|
|
1567
|
+
{ queryKey: ["pitvox", "notifications", n] },
|
|
1568
|
+
(i) => i != null && i.notifications ? {
|
|
1569
|
+
...i,
|
|
1570
|
+
unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
|
|
1571
|
+
notifications: i.notifications.map(
|
|
1572
|
+
(o) => o.id === a ? { ...o, isRead: !0, readAt: (/* @__PURE__ */ new Date()).toISOString() } : o
|
|
1573
|
+
)
|
|
1574
|
+
} : i
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function or() {
|
|
1580
|
+
const { onMarkAllNotificationsRead: e, partnerSlug: n } = w(), s = P();
|
|
1581
|
+
return _({
|
|
1582
|
+
mutationFn: () => {
|
|
1583
|
+
if (!e)
|
|
1584
|
+
throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
|
|
1585
|
+
return e();
|
|
1586
|
+
},
|
|
1587
|
+
onSuccess: () => {
|
|
1588
|
+
s.setQueriesData(
|
|
1589
|
+
{ queryKey: ["pitvox", "notifications", n] },
|
|
1590
|
+
(t) => t != null && t.notifications ? {
|
|
1591
|
+
...t,
|
|
1592
|
+
unreadCount: 0,
|
|
1593
|
+
notifications: t.notifications.map((a) => ({
|
|
1594
|
+
...a,
|
|
1595
|
+
isRead: !0,
|
|
1596
|
+
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1597
|
+
}))
|
|
1598
|
+
} : t
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
function cr({ driverName: e, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
1604
|
+
const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
1605
|
+
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${t}`, children: [
|
|
1606
|
+
n ? /* @__PURE__ */ r("img", { src: n, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ r("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
|
|
1607
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-profile-info", children: [
|
|
1608
|
+
/* @__PURE__ */ r("h2", { className: "pvx-dash-profile-name", children: e }),
|
|
1609
|
+
a && /* @__PURE__ */ c("p", { className: "pvx-dash-profile-since", children: [
|
|
1465
1610
|
"Racing since ",
|
|
1466
|
-
|
|
1611
|
+
a
|
|
1467
1612
|
] })
|
|
1468
1613
|
] })
|
|
1469
1614
|
] });
|
|
1470
1615
|
}
|
|
1471
|
-
function
|
|
1472
|
-
return /* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1616
|
+
function lr() {
|
|
1617
|
+
return /* @__PURE__ */ c("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1618
|
+
/* @__PURE__ */ r("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
1619
|
+
/* @__PURE__ */ r("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
1620
|
+
/* @__PURE__ */ r("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
1621
|
+
/* @__PURE__ */ r("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
1477
1622
|
] });
|
|
1478
1623
|
}
|
|
1479
|
-
function
|
|
1480
|
-
return /* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1624
|
+
function dr() {
|
|
1625
|
+
return /* @__PURE__ */ c("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1626
|
+
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1627
|
+
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "2" }),
|
|
1628
|
+
/* @__PURE__ */ r("path", { d: "M12 14v4" }),
|
|
1629
|
+
/* @__PURE__ */ r("path", { d: "M10.5 12.5l-4 2.5" }),
|
|
1630
|
+
/* @__PURE__ */ r("path", { d: "M13.5 12.5l4 2.5" })
|
|
1486
1631
|
] });
|
|
1487
1632
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return /* @__PURE__ */
|
|
1633
|
+
function pr() {
|
|
1634
|
+
return /* @__PURE__ */ r("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r("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" }) });
|
|
1490
1635
|
}
|
|
1491
|
-
function
|
|
1492
|
-
if (!(
|
|
1493
|
-
const
|
|
1494
|
-
return /* @__PURE__ */
|
|
1495
|
-
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1636
|
+
function te({ items: e, labelKey: n, countKey: s }) {
|
|
1637
|
+
if (!(e != null && e.length)) return null;
|
|
1638
|
+
const t = e.slice().sort((a, i) => i[s] - a[s]).slice(0, 10);
|
|
1639
|
+
return /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip", children: [
|
|
1640
|
+
t.map((a, i) => /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip-row", children: [
|
|
1641
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-tooltip-label", children: a[n] }),
|
|
1642
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-tooltip-value", children: a[s] })
|
|
1498
1643
|
] }, i)),
|
|
1499
|
-
|
|
1644
|
+
e.length > 10 && /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip-row pvx-dash-tooltip-more", children: [
|
|
1500
1645
|
"+",
|
|
1501
|
-
|
|
1646
|
+
e.length - 10,
|
|
1502
1647
|
" more"
|
|
1503
1648
|
] })
|
|
1504
1649
|
] });
|
|
1505
1650
|
}
|
|
1506
|
-
function
|
|
1507
|
-
if (!
|
|
1508
|
-
const
|
|
1509
|
-
name:
|
|
1651
|
+
function ur({ stats: e, rating: n, className: s = "" }) {
|
|
1652
|
+
if (!e) return null;
|
|
1653
|
+
const t = e.trackBreakdown.map((i) => ({
|
|
1654
|
+
name: q(i.trackId, i.layout),
|
|
1510
1655
|
lapCount: i.lapCount
|
|
1511
|
-
})),
|
|
1512
|
-
name:
|
|
1656
|
+
})), a = e.carBreakdown.map((i) => ({
|
|
1657
|
+
name: S(i.carId),
|
|
1513
1658
|
lapCount: i.lapCount
|
|
1514
1659
|
}));
|
|
1515
|
-
return /* @__PURE__ */
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ c("div", { className: `pvx-dash-stats ${s}`, children: [
|
|
1661
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--has-tooltip", children: [
|
|
1662
|
+
/* @__PURE__ */ r(lr, {}),
|
|
1663
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
1664
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-value", children: e.lapCount.toLocaleString() }),
|
|
1665
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-label", children: "Total Laps" })
|
|
1521
1666
|
] }),
|
|
1522
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ r(te, { items: t, labelKey: "name", countKey: "lapCount" })
|
|
1523
1668
|
] }),
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--has-tooltip", children: [
|
|
1670
|
+
/* @__PURE__ */ r(dr, {}),
|
|
1671
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
1672
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-value", children: e.carBreakdown.length }),
|
|
1673
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-label", children: "Cars Used" })
|
|
1529
1674
|
] }),
|
|
1530
|
-
/* @__PURE__ */
|
|
1675
|
+
/* @__PURE__ */ r(te, { items: a, labelKey: "name", countKey: "lapCount" })
|
|
1531
1676
|
] }),
|
|
1532
|
-
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1677
|
+
n && /* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
1678
|
+
/* @__PURE__ */ r(pr, {}),
|
|
1679
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
1680
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-value", children: n.rating.toFixed(1) }),
|
|
1681
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
1682
|
+
/* @__PURE__ */ c("span", { className: "pvx-dash-stat-sub", children: [
|
|
1538
1683
|
"#",
|
|
1539
|
-
|
|
1684
|
+
n.rank,
|
|
1540
1685
|
" of ",
|
|
1541
|
-
|
|
1686
|
+
n.totalDrivers
|
|
1542
1687
|
] })
|
|
1543
1688
|
] })
|
|
1544
1689
|
] })
|
|
1545
1690
|
] });
|
|
1546
1691
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */ e("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
|
|
1562
|
-
/* @__PURE__ */ e("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
|
|
1563
|
-
/* @__PURE__ */ e("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
|
|
1692
|
+
function mr({ records: e, className: n = "" }) {
|
|
1693
|
+
const s = C(() => e != null && e.length ? e.slice().sort((t, a) => {
|
|
1694
|
+
const i = t.recordedAt ? new Date(t.recordedAt).getTime() : 0;
|
|
1695
|
+
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
1696
|
+
}) : [], [e]);
|
|
1697
|
+
return s.length ? /* @__PURE__ */ c("div", { className: `pvx-card ${n}`, children: [
|
|
1698
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
1699
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1700
|
+
/* @__PURE__ */ r("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
|
|
1701
|
+
/* @__PURE__ */ r("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
|
|
1702
|
+
/* @__PURE__ */ r("path", { d: "M4 22h16" }),
|
|
1703
|
+
/* @__PURE__ */ r("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
|
|
1704
|
+
/* @__PURE__ */ r("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
|
|
1705
|
+
/* @__PURE__ */ r("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
|
|
1564
1706
|
] }) }),
|
|
1565
1707
|
"Current Records",
|
|
1566
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
1567
1709
|
"(",
|
|
1568
1710
|
s.length,
|
|
1569
1711
|
")"
|
|
1570
1712
|
] })
|
|
1571
1713
|
] }) }),
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ r("div", { className: "pvx-dash-records-list", children: s.map((t, a) => /* @__PURE__ */ c("div", { className: "pvx-dash-record-row", children: [
|
|
1715
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-record-info", children: [
|
|
1716
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-record-track", children: q(t.trackId, t.layout, t.game) }),
|
|
1717
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-record-car", children: S(t.carId) })
|
|
1576
1718
|
] }),
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
(
|
|
1581
|
-
|
|
1719
|
+
/* @__PURE__ */ c("div", { className: "pvx-dash-record-time", children: [
|
|
1720
|
+
/* @__PURE__ */ r("span", { className: "pvx-dash-record-lap", children: U(t.lapTimeMs) }),
|
|
1721
|
+
/* @__PURE__ */ c("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${t.game || "evo"}`, children: [
|
|
1722
|
+
(t.game || "evo").toUpperCase(),
|
|
1723
|
+
t.gameVersion ? ` ${t.gameVersion}` : ""
|
|
1582
1724
|
] })
|
|
1583
1725
|
] })
|
|
1584
|
-
] },
|
|
1585
|
-
|
|
1586
|
-
|
|
1726
|
+
] }, a)) })
|
|
1727
|
+
] }) : null;
|
|
1728
|
+
}
|
|
1729
|
+
function vr({ events: e, isLoading: n, className: s }) {
|
|
1730
|
+
return n ? /* @__PURE__ */ r("div", { className: "pvx-loading", children: "Loading upcoming events..." }) : e != null && e.length ? /* @__PURE__ */ c("div", { className: `pvx-card ${s || ""}`, children: [
|
|
1731
|
+
/* @__PURE__ */ r("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
1732
|
+
/* @__PURE__ */ r(xr, {}),
|
|
1733
|
+
"Upcoming Events",
|
|
1734
|
+
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
1735
|
+
"(",
|
|
1736
|
+
e.length,
|
|
1737
|
+
")"
|
|
1738
|
+
] })
|
|
1739
|
+
] }) }),
|
|
1740
|
+
/* @__PURE__ */ r("div", { className: "pvx-upcoming-list", children: e.map((t) => /* @__PURE__ */ c(
|
|
1741
|
+
"div",
|
|
1587
1742
|
{
|
|
1588
|
-
className: "pvx-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1743
|
+
className: `pvx-upcoming-item ${t.isNext ? "pvx-upcoming-item--next" : ""}`,
|
|
1744
|
+
children: [
|
|
1745
|
+
/* @__PURE__ */ c("div", { className: "pvx-upcoming-info", children: [
|
|
1746
|
+
/* @__PURE__ */ r("span", { className: "pvx-upcoming-comp", children: t.competitionName }),
|
|
1747
|
+
/* @__PURE__ */ c("span", { className: "pvx-upcoming-round", children: [
|
|
1748
|
+
"Round ",
|
|
1749
|
+
t.roundNumber,
|
|
1750
|
+
": ",
|
|
1751
|
+
t.track
|
|
1752
|
+
] })
|
|
1753
|
+
] }),
|
|
1754
|
+
/* @__PURE__ */ c("div", { className: "pvx-upcoming-time", children: [
|
|
1755
|
+
/* @__PURE__ */ r("span", { className: "pvx-upcoming-date", children: new Date(t.startTime).toLocaleDateString("en-GB", {
|
|
1756
|
+
day: "numeric",
|
|
1757
|
+
month: "short",
|
|
1758
|
+
year: "numeric"
|
|
1759
|
+
}) }),
|
|
1760
|
+
/* @__PURE__ */ r("span", { className: "pvx-upcoming-relative", children: hr(t.startTime) }),
|
|
1761
|
+
t.isNext && /* @__PURE__ */ r("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
1762
|
+
] })
|
|
1763
|
+
]
|
|
1764
|
+
},
|
|
1765
|
+
`${t.competitionId}-${t.roundNumber}`
|
|
1766
|
+
)) })
|
|
1767
|
+
] }) : null;
|
|
1768
|
+
}
|
|
1769
|
+
function hr(e) {
|
|
1770
|
+
const n = new Date(e).getTime() - Date.now();
|
|
1771
|
+
if (n <= 0) return "Now";
|
|
1772
|
+
const s = Math.floor(n / (1e3 * 60 * 60));
|
|
1773
|
+
if (s < 1) return "Less than 1 hour";
|
|
1774
|
+
if (s < 24) return `in ${s}h`;
|
|
1775
|
+
const t = Math.floor(s / 24);
|
|
1776
|
+
if (t === 1) return "Tomorrow";
|
|
1777
|
+
if (t < 7) return `in ${t} days`;
|
|
1778
|
+
if (t < 30) {
|
|
1779
|
+
const a = Math.floor(t / 7);
|
|
1780
|
+
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
1781
|
+
}
|
|
1782
|
+
return ne(e);
|
|
1783
|
+
}
|
|
1784
|
+
function xr() {
|
|
1785
|
+
return /* @__PURE__ */ c("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: [
|
|
1786
|
+
/* @__PURE__ */ r("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
1787
|
+
/* @__PURE__ */ r("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
1593
1788
|
] });
|
|
1594
1789
|
}
|
|
1595
|
-
function
|
|
1596
|
-
const
|
|
1597
|
-
return
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
|
|
1790
|
+
function gr({ notifications: e, unreadCount: n = 0, onMarkRead: s, onMarkAllRead: t, isLoading: a, className: i }) {
|
|
1791
|
+
const o = ae();
|
|
1792
|
+
return a ? /* @__PURE__ */ r("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ c("div", { className: `pvx-card ${i || ""}`, children: [
|
|
1793
|
+
/* @__PURE__ */ c("div", { className: "pvx-card-header", children: [
|
|
1794
|
+
/* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
1795
|
+
/* @__PURE__ */ r(br, {}),
|
|
1796
|
+
"Notifications",
|
|
1797
|
+
n > 0 && /* @__PURE__ */ r("span", { className: "pvx-notif-badge", children: n > 99 ? "99+" : n })
|
|
1798
|
+
] }),
|
|
1799
|
+
n > 0 && t && /* @__PURE__ */ r("button", { className: "pvx-notif-mark-all", onClick: t, children: "Mark all read" })
|
|
1800
|
+
] }),
|
|
1801
|
+
e != null && e.length ? /* @__PURE__ */ r("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ r(
|
|
1802
|
+
fr,
|
|
1600
1803
|
{
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1804
|
+
notification: d,
|
|
1805
|
+
getUserDisplay: o,
|
|
1806
|
+
onMarkRead: s
|
|
1807
|
+
},
|
|
1808
|
+
d.id
|
|
1809
|
+
)) }) : /* @__PURE__ */ r("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
1810
|
+
] });
|
|
1811
|
+
}
|
|
1812
|
+
function fr({ notification: e, getUserDisplay: n, onMarkRead: s }) {
|
|
1813
|
+
const t = () => {
|
|
1814
|
+
!e.isRead && s && s(e.id);
|
|
1815
|
+
};
|
|
1816
|
+
return /* @__PURE__ */ c(
|
|
1817
|
+
"button",
|
|
1818
|
+
{
|
|
1819
|
+
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
1820
|
+
onClick: t,
|
|
1821
|
+
children: [
|
|
1822
|
+
/* @__PURE__ */ r(Nr, { type: e.type }),
|
|
1823
|
+
/* @__PURE__ */ c("div", { className: "pvx-notif-content", children: [
|
|
1824
|
+
/* @__PURE__ */ r("span", { className: "pvx-notif-message", children: Te(e, n) }),
|
|
1825
|
+
/* @__PURE__ */ r("span", { className: "pvx-notif-time", children: ne(e.createdAt) })
|
|
1826
|
+
] }),
|
|
1827
|
+
!e.isRead && /* @__PURE__ */ r("span", { className: "pvx-notif-dot" })
|
|
1828
|
+
]
|
|
1829
|
+
}
|
|
1830
|
+
);
|
|
1831
|
+
}
|
|
1832
|
+
function Nr({ type: e }) {
|
|
1833
|
+
return e === "RECORD_BEATEN" ? /* @__PURE__ */ r("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ r("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1834
|
+
/* @__PURE__ */ r("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
1835
|
+
/* @__PURE__ */ r("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
1836
|
+
] }) }) : /* @__PURE__ */ r("span", { className: "pvx-notif-icon pvx-notif-icon--record", children: /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1837
|
+
/* @__PURE__ */ r("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1838
|
+
/* @__PURE__ */ r("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
1839
|
+
/* @__PURE__ */ r("path", { d: "M4 22h16" }),
|
|
1840
|
+
/* @__PURE__ */ r("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
|
|
1841
|
+
/* @__PURE__ */ r("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
|
|
1842
|
+
/* @__PURE__ */ r("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1843
|
+
] }) });
|
|
1844
|
+
}
|
|
1845
|
+
function br() {
|
|
1846
|
+
return /* @__PURE__ */ c("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: [
|
|
1847
|
+
/* @__PURE__ */ r("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
1848
|
+
/* @__PURE__ */ r("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
1849
|
+
] });
|
|
1850
|
+
}
|
|
1851
|
+
function jr({ steamId: e, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
1852
|
+
const { data: a, isLoading: i, error: o } = rr(e), { data: d, isLoading: u } = tr(e), { data: l, isLoading: m } = nr(), g = sr(), { data: h, isLoading: f } = ar({ limit: 10 }), b = ir(), p = or();
|
|
1853
|
+
return i || u ? /* @__PURE__ */ r("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ r("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ c("div", { className: `pvx-dash ${t}`, children: [
|
|
1854
|
+
/* @__PURE__ */ r(
|
|
1855
|
+
cr,
|
|
1856
|
+
{
|
|
1857
|
+
driverName: a.driverName,
|
|
1858
|
+
avatarUrl: n,
|
|
1859
|
+
memberSince: s
|
|
1604
1860
|
}
|
|
1605
1861
|
),
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
|
|
1862
|
+
/* @__PURE__ */ r(ur, { stats: a, rating: d }),
|
|
1863
|
+
e && /* @__PURE__ */ r(vr, { events: l, isLoading: m }),
|
|
1864
|
+
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${g ? "pvx-dash-row--2col" : ""}`, children: [
|
|
1865
|
+
/* @__PURE__ */ r(mr, { records: a.currentRecords }),
|
|
1866
|
+
g && /* @__PURE__ */ r(
|
|
1867
|
+
gr,
|
|
1868
|
+
{
|
|
1869
|
+
notifications: h == null ? void 0 : h.notifications,
|
|
1870
|
+
unreadCount: (h == null ? void 0 : h.unreadCount) || 0,
|
|
1871
|
+
onMarkRead: (N) => b.mutate(N),
|
|
1872
|
+
onMarkAllRead: () => p.mutate(),
|
|
1873
|
+
isLoading: f
|
|
1874
|
+
}
|
|
1875
|
+
)
|
|
1876
|
+
] })
|
|
1877
|
+
] }) : /* @__PURE__ */ r("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
1609
1878
|
}
|
|
1610
1879
|
export {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1880
|
+
Ir as CarsTable,
|
|
1881
|
+
I as CompEmptyState,
|
|
1882
|
+
F as CompLoadingState,
|
|
1883
|
+
Ur as CompetitionCards,
|
|
1884
|
+
jr as DriverDashboard,
|
|
1885
|
+
cr as DriverProfile,
|
|
1886
|
+
Br as DriversTable,
|
|
1887
|
+
Er as EntryList,
|
|
1888
|
+
H as InfoPill,
|
|
1889
|
+
Pr as LapHistoryTable,
|
|
1890
|
+
gr as NotificationsCard,
|
|
1891
|
+
_e as PODIUM_MEDALS,
|
|
1892
|
+
kr as PitVoxPartnerProvider,
|
|
1893
|
+
mr as RecordsTable,
|
|
1894
|
+
_r as RegisterButton,
|
|
1895
|
+
qr as RegistrationPanel,
|
|
1896
|
+
Fr as RoundResults,
|
|
1897
|
+
Qe as RoundSessionResults,
|
|
1898
|
+
Ar as StandingsTable,
|
|
1899
|
+
ur as StatsCards,
|
|
1900
|
+
Dr as TracksTable,
|
|
1901
|
+
je as TypeBadge,
|
|
1902
|
+
vr as UpcomingEvents,
|
|
1903
|
+
S as formatCarName,
|
|
1904
|
+
A as formatDate,
|
|
1905
|
+
Lr as formatDelta,
|
|
1906
|
+
U as formatLapTime,
|
|
1907
|
+
Te as formatNotificationMessage,
|
|
1908
|
+
ne as formatRelativeTime,
|
|
1909
|
+
D as formatSectorTime,
|
|
1910
|
+
q as formatTrackName,
|
|
1639
1911
|
se as formatTyreCompound,
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1912
|
+
Sr as useCarLeaderboard,
|
|
1913
|
+
Tr as useCarMetadata,
|
|
1914
|
+
Mr as useCompetitionAllRounds,
|
|
1915
|
+
Me as useCompetitionConfig,
|
|
1916
|
+
ie as useCompetitionEntryList,
|
|
1917
|
+
Ie as useCompetitionRound,
|
|
1918
|
+
De as useCompetitionStandings,
|
|
1919
|
+
$r as useCompetitions,
|
|
1920
|
+
$e as useDriverLaps,
|
|
1921
|
+
tr as useDriverRating,
|
|
1922
|
+
rr as useDriverStats,
|
|
1923
|
+
Rr as useLeaderboardIndex,
|
|
1924
|
+
or as useMarkAllNotificationsRead,
|
|
1925
|
+
ir as useMarkNotificationRead,
|
|
1926
|
+
ar as useNotifications,
|
|
1927
|
+
sr as useNotificationsEnabled,
|
|
1928
|
+
w as usePitVox,
|
|
1929
|
+
oe as useRegister,
|
|
1930
|
+
Q as useRegistrationMode,
|
|
1931
|
+
z as useRegistrationStatus,
|
|
1932
|
+
Y as useRegistrationUrl,
|
|
1933
|
+
Se as useTrackLeaderboard,
|
|
1934
|
+
Vr as useUnreadCount,
|
|
1935
|
+
nr as useUpcomingEvents,
|
|
1936
|
+
ae as useUserLookup,
|
|
1937
|
+
ce as useWithdraw
|
|
1660
1938
|
};
|