@pitvox/partner-react 0.7.2 → 0.7.4
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 +19 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +587 -524
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as n, jsxs as c, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as _, QueryClient as
|
|
4
|
-
const J =
|
|
1
|
+
import { jsx as n, jsxs as c, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Me, useMemo as L, useContext as De, useState as D, useCallback as H, useRef as Ie, useEffect as Be } from "react";
|
|
3
|
+
import { useQueryClient as _, QueryClient as Pe, QueryClientProvider as Ae, useQuery as R, useMutation as O, useQueries as ie } from "@tanstack/react-query";
|
|
4
|
+
const J = Me(null), Ue = "https://cdn.pitvox.com", Fe = "https://pitvox.com";
|
|
5
5
|
let Q = null;
|
|
6
|
-
function
|
|
6
|
+
function Yn({
|
|
7
7
|
partnerSlug: e = null,
|
|
8
|
-
cdnUrl: t =
|
|
9
|
-
pitvoxUrl: s =
|
|
8
|
+
cdnUrl: t = Ue,
|
|
9
|
+
pitvoxUrl: s = Fe,
|
|
10
10
|
getSteamId: r,
|
|
11
11
|
onRegister: a,
|
|
12
12
|
onWithdraw: i,
|
|
13
13
|
onFetchNotifications: o,
|
|
14
14
|
onMarkNotificationRead: d,
|
|
15
|
-
onMarkAllNotificationsRead:
|
|
15
|
+
onMarkAllNotificationsRead: u,
|
|
16
16
|
onFetchServerPassword: l,
|
|
17
|
-
children:
|
|
17
|
+
children: p
|
|
18
18
|
}) {
|
|
19
19
|
const f = L(() => ({
|
|
20
20
|
partnerSlug: e,
|
|
@@ -25,23 +25,23 @@ function zn({
|
|
|
25
25
|
onWithdraw: i || null,
|
|
26
26
|
onFetchNotifications: o || null,
|
|
27
27
|
onMarkNotificationRead: d || null,
|
|
28
|
-
onMarkAllNotificationsRead:
|
|
28
|
+
onMarkAllNotificationsRead: u || null,
|
|
29
29
|
onFetchServerPassword: l || null
|
|
30
|
-
}), [e, t, s, r, a, i, o, d,
|
|
30
|
+
}), [e, t, s, r, a, i, o, d, u, l]);
|
|
31
31
|
let g = !1;
|
|
32
32
|
try {
|
|
33
33
|
_(), g = !0;
|
|
34
34
|
} catch {
|
|
35
35
|
g = !1;
|
|
36
36
|
}
|
|
37
|
-
return g ? /* @__PURE__ */ n(J.Provider, { value: f, children:
|
|
37
|
+
return g ? /* @__PURE__ */ n(J.Provider, { value: f, children: p }) : (Q || (Q = new Pe({
|
|
38
38
|
defaultOptions: {
|
|
39
39
|
queries: { staleTime: 6e4 }
|
|
40
40
|
}
|
|
41
|
-
})), /* @__PURE__ */ n(
|
|
41
|
+
})), /* @__PURE__ */ n(Ae, { client: Q, children: /* @__PURE__ */ n(J.Provider, { value: f, children: p }) }));
|
|
42
42
|
}
|
|
43
43
|
function k() {
|
|
44
|
-
const e =
|
|
44
|
+
const e = De(J);
|
|
45
45
|
if (!e)
|
|
46
46
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
47
|
return e;
|
|
@@ -62,10 +62,10 @@ function Ee(e, t, s, r) {
|
|
|
62
62
|
const a = r || "default";
|
|
63
63
|
return e ? `laps/partners/${e}/${t}/${s}/${a}.json` : `laps/${t}/${s}/${a}.json`;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function _e(e, t) {
|
|
66
66
|
return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function qe(e) {
|
|
69
69
|
return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
|
|
70
70
|
}
|
|
71
71
|
function A(e) {
|
|
@@ -111,11 +111,11 @@ function le(e) {
|
|
|
111
111
|
const i = Math.floor(a / 24);
|
|
112
112
|
return i < 30 ? `${i}d ago` : j(e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Jn(e) {
|
|
115
115
|
return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const { type: s, title: r, trackId: a, trackLayout: i, carId: o, game: d, data:
|
|
117
|
+
function je(e, t) {
|
|
118
|
+
const { type: s, title: r, trackId: a, trackLayout: i, carId: o, game: d, data: u } = e, l = typeof u == "string" ? JSON.parse(u) : u, p = a ? q(a, i, d) : null, f = o ? I(o) : null, g = [p, f].filter(Boolean).join(" — ");
|
|
119
119
|
return s === "RECORD_BEATEN" && g ? `${l != null && l.beatenBySteamId && t ? t(l.beatenBySteamId).displayName : "Someone"} beat your record on ${g}` : s === "RECORD_SET" && g ? `You set a new record on ${g}` : r || "New notification";
|
|
120
120
|
}
|
|
121
121
|
function de(e) {
|
|
@@ -132,8 +132,13 @@ function de(e) {
|
|
|
132
132
|
S: "Soft"
|
|
133
133
|
}[e] || e : "Unknown";
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
135
|
+
function pe(e) {
|
|
136
|
+
if (!e) return "-";
|
|
137
|
+
const t = Number(e);
|
|
138
|
+
return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
|
|
139
|
+
}
|
|
140
|
+
function Zn(e = {}) {
|
|
141
|
+
var u, l, p, f, g, m;
|
|
137
142
|
const { cdnUrl: t, partnerSlug: s } = k(), { game: r, gameVersion: a } = e, i = Z(s, null, null, "index.json"), o = R({
|
|
138
143
|
queryKey: ["pitvox", "leaderboards", s, "index"],
|
|
139
144
|
queryFn: () => S(t, i),
|
|
@@ -143,84 +148,84 @@ function Qn(e = {}) {
|
|
|
143
148
|
var x;
|
|
144
149
|
if (!((x = o.data) != null && x.tracks)) return [];
|
|
145
150
|
let b = o.data.tracks;
|
|
146
|
-
return r && (b = b.filter((
|
|
147
|
-
id:
|
|
148
|
-
layout:
|
|
149
|
-
game:
|
|
150
|
-
gameVersion:
|
|
151
|
-
displayName: q(
|
|
152
|
-
driverCount:
|
|
153
|
-
carCount:
|
|
154
|
-
record:
|
|
155
|
-
visibleId:
|
|
156
|
-
carId:
|
|
157
|
-
carDisplayName: I(
|
|
158
|
-
lapTimeMs:
|
|
159
|
-
timestamp:
|
|
151
|
+
return r && (b = b.filter((v) => v.game === r)), a && (b = b.filter((v) => v.gameVersion === a)), b.map((v) => ({
|
|
152
|
+
id: v.trackId,
|
|
153
|
+
layout: v.layout,
|
|
154
|
+
game: v.game,
|
|
155
|
+
gameVersion: v.gameVersion,
|
|
156
|
+
displayName: q(v.trackId, v.layout, v.game),
|
|
157
|
+
driverCount: v.driverCount || 0,
|
|
158
|
+
carCount: v.carCount || 0,
|
|
159
|
+
record: v.recordHolder ? {
|
|
160
|
+
visibleId: v.recordHolder.steamId || v.recordHolder.userId,
|
|
161
|
+
carId: v.recordHolder.carId,
|
|
162
|
+
carDisplayName: I(v.recordHolder.carId),
|
|
163
|
+
lapTimeMs: v.recordHolder.lapTimeMs,
|
|
164
|
+
timestamp: v.recordHolder.recordedAt
|
|
160
165
|
} : null,
|
|
161
|
-
recordByTag:
|
|
166
|
+
recordByTag: v.recordByTag || null
|
|
162
167
|
}));
|
|
163
|
-
}, [(
|
|
168
|
+
}, [(u = o.data) == null ? void 0 : u.tracks, r, a]);
|
|
164
169
|
return {
|
|
165
170
|
...o,
|
|
166
171
|
data: d,
|
|
167
172
|
partner: ((l = o.data) == null ? void 0 : l.partner) || null,
|
|
168
|
-
generatedAt: (
|
|
173
|
+
generatedAt: (p = o.data) == null ? void 0 : p.generatedAt,
|
|
169
174
|
totalLaps: ((f = o.data) == null ? void 0 : f.totalLaps) || 0,
|
|
170
175
|
totalUsers: ((g = o.data) == null ? void 0 : g.totalUsers) || 0,
|
|
171
|
-
versions: ((
|
|
176
|
+
versions: ((m = o.data) == null ? void 0 : m.versions) || {}
|
|
172
177
|
};
|
|
173
178
|
}
|
|
174
|
-
function
|
|
175
|
-
const { cdnUrl: r, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s,
|
|
176
|
-
queryKey: ["pitvox", "leaderboards", a, "track", e,
|
|
179
|
+
function Ve(e, t, s = {}) {
|
|
180
|
+
const { cdnUrl: r, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, u = t || "default", l = Z(a, o, d, `tracks/${e}/${u}.json`), { data: p, isLoading: f, error: g } = R({
|
|
181
|
+
queryKey: ["pitvox", "leaderboards", a, "track", e, u, o, d],
|
|
177
182
|
queryFn: () => S(r, l),
|
|
178
183
|
enabled: !!e,
|
|
179
184
|
staleTime: 3e4,
|
|
180
185
|
refetchInterval: 3e4
|
|
181
186
|
});
|
|
182
187
|
return { data: L(() => {
|
|
183
|
-
if (!(
|
|
184
|
-
let b =
|
|
188
|
+
if (!(p != null && p.entries)) return [];
|
|
189
|
+
let b = p.entries;
|
|
185
190
|
if (o && (b = b.filter((x) => x.game === o)), !i) {
|
|
186
|
-
const x = /* @__PURE__ */ new Map(),
|
|
191
|
+
const x = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
187
192
|
for (const N of b) {
|
|
188
193
|
const h = N.steamId || N.userId;
|
|
189
|
-
|
|
194
|
+
v.has(N.carId) || v.set(N.carId, /* @__PURE__ */ new Set()), v.get(N.carId).add(h), (!x.has(N.carId) || N.lapTimeMs < x.get(N.carId).lapTimeMs) && x.set(N.carId, N);
|
|
190
195
|
}
|
|
191
196
|
return Array.from(x.values()).map((N) => {
|
|
192
197
|
var h;
|
|
193
|
-
return { ...N, driverCount: ((h =
|
|
198
|
+
return { ...N, driverCount: ((h = v.get(N.carId)) == null ? void 0 : h.size) || 0 };
|
|
194
199
|
}).sort((N, h) => N.lapTimeMs - h.lapTimeMs);
|
|
195
200
|
}
|
|
196
|
-
return b.filter((x) => x.carId === i).sort((x,
|
|
197
|
-
}, [
|
|
201
|
+
return b.filter((x) => x.carId === i).sort((x, v) => x.lapTimeMs - v.lapTimeMs);
|
|
202
|
+
}, [p == null ? void 0 : p.entries, i, o]), isLoading: f, error: g };
|
|
198
203
|
}
|
|
199
|
-
function
|
|
200
|
-
var x,
|
|
201
|
-
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game:
|
|
204
|
+
function Ke(e, t, s, r, a = {}) {
|
|
205
|
+
var x, v;
|
|
206
|
+
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: u, gameVersion: l } = a, p = e && t ? Ee(o, e, t, s) : null, g = R({
|
|
202
207
|
queryKey: ["pitvox", "laps", o, e, t, s || "default"],
|
|
203
|
-
queryFn: () => S(i,
|
|
208
|
+
queryFn: () => S(i, p),
|
|
204
209
|
enabled: !!e && !!t,
|
|
205
210
|
staleTime: 3e4,
|
|
206
211
|
refetchInterval: 3e4
|
|
207
|
-
}),
|
|
212
|
+
}), m = L(() => {
|
|
208
213
|
var N;
|
|
209
|
-
return (N = g.data) != null && N.laps ? g.data.laps.filter((h) => !(h.carId !== r ||
|
|
210
|
-
}, [(x = g.data) == null ? void 0 : x.laps, r,
|
|
211
|
-
const N =
|
|
214
|
+
return (N = g.data) != null && N.laps ? g.data.laps.filter((h) => !(h.carId !== r || u && h.game !== u || l && h.gameVersion !== l || !d && !h.isValid)).sort((h, y) => h.lapTimeMs - y.lapTimeMs) : [];
|
|
215
|
+
}, [(x = g.data) == null ? void 0 : x.laps, r, u, l, d]), b = L(() => {
|
|
216
|
+
const N = m.filter(($) => $.isValid && $.sector1Ms && $.sector2Ms && $.sector3Ms);
|
|
212
217
|
if (N.length < 2) return null;
|
|
213
218
|
const h = Math.min(...N.map(($) => $.sector1Ms)), y = Math.min(...N.map(($) => $.sector2Ms)), C = Math.min(...N.map(($) => $.sector3Ms)), w = h + y + C, T = Math.min(...N.map(($) => $.lapTimeMs));
|
|
214
219
|
return w >= T ? null : { lapTimeMs: w, sector1Ms: h, sector2Ms: y, sector3Ms: C };
|
|
215
|
-
}, [
|
|
220
|
+
}, [m]);
|
|
216
221
|
return {
|
|
217
222
|
...g,
|
|
218
|
-
data:
|
|
219
|
-
driverName: ((
|
|
223
|
+
data: m,
|
|
224
|
+
driverName: ((v = g.data) == null ? void 0 : v.driverName) || "Driver",
|
|
220
225
|
theoreticalBest: b
|
|
221
226
|
};
|
|
222
227
|
}
|
|
223
|
-
function
|
|
228
|
+
function ue() {
|
|
224
229
|
const { cdnUrl: e } = k(), { data: t } = R({
|
|
225
230
|
queryKey: ["pitvox", "users", "index"],
|
|
226
231
|
queryFn: () => S(e, "users/index.json"),
|
|
@@ -236,7 +241,7 @@ function pe() {
|
|
|
236
241
|
};
|
|
237
242
|
};
|
|
238
243
|
}
|
|
239
|
-
function
|
|
244
|
+
function Xn() {
|
|
240
245
|
const { cdnUrl: e } = k(), { data: t } = R({
|
|
241
246
|
queryKey: ["pitvox", "cars", "evo"],
|
|
242
247
|
queryFn: () => S(e, "cars/evo.json"),
|
|
@@ -248,9 +253,9 @@ function Yn() {
|
|
|
248
253
|
cars: (t == null ? void 0 : t.cars) || {}
|
|
249
254
|
};
|
|
250
255
|
}
|
|
251
|
-
function
|
|
256
|
+
function et() {
|
|
252
257
|
var a, i;
|
|
253
|
-
const { cdnUrl: e, partnerSlug: t } = k(), s =
|
|
258
|
+
const { cdnUrl: e, partnerSlug: t } = k(), s = qe(t), r = R({
|
|
254
259
|
queryKey: ["pitvox", "recentLaps", t],
|
|
255
260
|
queryFn: () => S(e, s),
|
|
256
261
|
staleTime: 3e4,
|
|
@@ -263,10 +268,10 @@ function Jn() {
|
|
|
263
268
|
isLoading: r.isLoading
|
|
264
269
|
};
|
|
265
270
|
}
|
|
266
|
-
function
|
|
267
|
-
return
|
|
271
|
+
function nt(e, t) {
|
|
272
|
+
return Ve(e, null, { carId: t });
|
|
268
273
|
}
|
|
269
|
-
function
|
|
274
|
+
function tt() {
|
|
270
275
|
const { cdnUrl: e, partnerSlug: t } = k();
|
|
271
276
|
return R({
|
|
272
277
|
queryKey: ["pitvox", "competitions", t],
|
|
@@ -277,7 +282,7 @@ function Xn() {
|
|
|
277
282
|
staleTime: 6e4
|
|
278
283
|
});
|
|
279
284
|
}
|
|
280
|
-
function
|
|
285
|
+
function me(e, t = {}) {
|
|
281
286
|
const s = k(), r = t.partnerSlug || s.partnerSlug;
|
|
282
287
|
return R({
|
|
283
288
|
queryKey: ["pitvox", "competition", r, e, "config"],
|
|
@@ -286,7 +291,7 @@ function ue(e, t = {}) {
|
|
|
286
291
|
staleTime: 6e4
|
|
287
292
|
});
|
|
288
293
|
}
|
|
289
|
-
function
|
|
294
|
+
function ve(e, t = {}) {
|
|
290
295
|
const s = k(), r = t.partnerSlug || s.partnerSlug;
|
|
291
296
|
return R({
|
|
292
297
|
queryKey: ["pitvox", "competition", r, e, "standings"],
|
|
@@ -295,7 +300,7 @@ function me(e, t = {}) {
|
|
|
295
300
|
staleTime: 6e4
|
|
296
301
|
});
|
|
297
302
|
}
|
|
298
|
-
function
|
|
303
|
+
function He(e, t, s = {}) {
|
|
299
304
|
const r = k(), a = s.partnerSlug || r.partnerSlug;
|
|
300
305
|
return R({
|
|
301
306
|
queryKey: ["pitvox", "competition", a, e, "round", t],
|
|
@@ -304,7 +309,7 @@ function Ke(e, t, s = {}) {
|
|
|
304
309
|
staleTime: 6e4
|
|
305
310
|
});
|
|
306
311
|
}
|
|
307
|
-
function
|
|
312
|
+
function Oe(e, t = [], s = {}) {
|
|
308
313
|
const r = k(), a = s.partnerSlug || r.partnerSlug;
|
|
309
314
|
return R({
|
|
310
315
|
queryKey: ["pitvox", "competition", a, e, "allRounds", t],
|
|
@@ -317,7 +322,16 @@ function He(e, t = [], s = {}) {
|
|
|
317
322
|
staleTime: 6e4
|
|
318
323
|
});
|
|
319
324
|
}
|
|
320
|
-
function
|
|
325
|
+
function We(e, t, s = {}) {
|
|
326
|
+
const r = k(), a = s.partnerSlug || r.partnerSlug;
|
|
327
|
+
return R({
|
|
328
|
+
queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
|
|
329
|
+
queryFn: () => S(r.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
|
|
330
|
+
enabled: !!a && !!e && t != null,
|
|
331
|
+
staleTime: 6e4
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function he(e, t = {}) {
|
|
321
335
|
const s = k(), r = t.partnerSlug || s.partnerSlug;
|
|
322
336
|
return R({
|
|
323
337
|
queryKey: ["pitvox", "competition", r, e, "entrylist"],
|
|
@@ -331,18 +345,18 @@ function X(e) {
|
|
|
331
345
|
return R({
|
|
332
346
|
queryKey: ["pitvox", "registration", s, e, a],
|
|
333
347
|
queryFn: async () => {
|
|
334
|
-
var
|
|
348
|
+
var u;
|
|
335
349
|
const i = await fetch(`${t}/competitions/${s}/${e}/entrylist.json`);
|
|
336
350
|
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
337
351
|
const o = await i.json();
|
|
338
|
-
return { isRegistered: !!a && ((
|
|
352
|
+
return { isRegistered: !!a && ((u = o.drivers) == null ? void 0 : u.some((l) => l.steamId === a)), entryList: o };
|
|
339
353
|
},
|
|
340
354
|
enabled: !!e,
|
|
341
355
|
staleTime: 6e4
|
|
342
356
|
});
|
|
343
357
|
}
|
|
344
|
-
function
|
|
345
|
-
const { onRegister: t, partnerSlug: s, getSteamId: r } = k(), a = _(), i =
|
|
358
|
+
function xe(e) {
|
|
359
|
+
const { onRegister: t, partnerSlug: s, getSteamId: r } = k(), a = _(), i = ue();
|
|
346
360
|
return O({
|
|
347
361
|
mutationFn: (o) => {
|
|
348
362
|
if (!t)
|
|
@@ -357,7 +371,7 @@ function he(e) {
|
|
|
357
371
|
{ queryKey: ["pitvox", "registration", s, e] },
|
|
358
372
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
359
373
|
), o) {
|
|
360
|
-
const d = i(o),
|
|
374
|
+
const d = i(o), u = {
|
|
361
375
|
steamId: o,
|
|
362
376
|
displayName: d.displayName,
|
|
363
377
|
avatarUrl: d.avatarUrl
|
|
@@ -366,14 +380,14 @@ function he(e) {
|
|
|
366
380
|
{ queryKey: ["pitvox", "competition", s, e, "entrylist"] },
|
|
367
381
|
(l) => {
|
|
368
382
|
var f;
|
|
369
|
-
return l ? ((f = l.drivers) == null ? void 0 : f.some((g) => g.steamId === o)) ? l : { ...l, drivers: [...l.drivers || [],
|
|
383
|
+
return l ? ((f = l.drivers) == null ? void 0 : f.some((g) => g.steamId === o)) ? l : { ...l, drivers: [...l.drivers || [], u] } : { drivers: [u] };
|
|
370
384
|
}
|
|
371
385
|
);
|
|
372
386
|
}
|
|
373
387
|
}
|
|
374
388
|
});
|
|
375
389
|
}
|
|
376
|
-
function
|
|
390
|
+
function ge(e) {
|
|
377
391
|
const { onWithdraw: t, partnerSlug: s, getSteamId: r } = k(), a = _();
|
|
378
392
|
return O({
|
|
379
393
|
mutationFn: (i) => {
|
|
@@ -405,7 +419,7 @@ function ne(e) {
|
|
|
405
419
|
const { pitvoxUrl: t, partnerSlug: s } = k();
|
|
406
420
|
return `${t}/p/${s}/competitions/${e}/register`;
|
|
407
421
|
}
|
|
408
|
-
const
|
|
422
|
+
const ze = {
|
|
409
423
|
formula: "Formula",
|
|
410
424
|
gt3: "GT3",
|
|
411
425
|
gt2: "GT2",
|
|
@@ -425,31 +439,31 @@ const Oe = {
|
|
|
425
439
|
"2000s": "2000s",
|
|
426
440
|
"2010s": "2010s",
|
|
427
441
|
"2020s": "2020s"
|
|
428
|
-
},
|
|
442
|
+
}, fe = [
|
|
429
443
|
{ id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
|
|
430
444
|
{ id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
|
|
431
445
|
{ id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
|
|
432
446
|
];
|
|
433
|
-
function
|
|
434
|
-
for (const t of
|
|
447
|
+
function Ge(e) {
|
|
448
|
+
for (const t of fe)
|
|
435
449
|
if (t.tags.includes(e)) return t.id;
|
|
436
450
|
return "other";
|
|
437
451
|
}
|
|
438
|
-
function
|
|
452
|
+
function Ne(e, t) {
|
|
439
453
|
if (t.size === 0) return !0;
|
|
440
454
|
const s = {};
|
|
441
455
|
for (const r of t) {
|
|
442
|
-
const a =
|
|
456
|
+
const a = Ge(r);
|
|
443
457
|
s[a] || (s[a] = []), s[a].push(r);
|
|
444
458
|
}
|
|
445
459
|
for (const r of Object.values(s))
|
|
446
460
|
if (!r.some((a) => e.includes(a))) return !1;
|
|
447
461
|
return !0;
|
|
448
462
|
}
|
|
449
|
-
function
|
|
450
|
-
const [s, r] = D(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : s, o = H((
|
|
463
|
+
function be(e, t) {
|
|
464
|
+
const [s, r] = D(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : s, o = H((u) => {
|
|
451
465
|
const l = new Set(i);
|
|
452
|
-
l.has(
|
|
466
|
+
l.has(u) ? l.delete(u) : l.add(u), a && t ? t(l) : r(l);
|
|
453
467
|
}, [i, a, t]), d = H(() => {
|
|
454
468
|
a && t ? t(/* @__PURE__ */ new Set()) : r(/* @__PURE__ */ new Set());
|
|
455
469
|
}, [a, t]);
|
|
@@ -473,7 +487,7 @@ function z(e, t, s) {
|
|
|
473
487
|
return t.dir === "desc" ? -d : d;
|
|
474
488
|
});
|
|
475
489
|
}
|
|
476
|
-
function
|
|
490
|
+
function ye(e, t = !1) {
|
|
477
491
|
const s = t ? e == null ? void 0 : e.filter((r) => r.isValid) : e;
|
|
478
492
|
return s != null && s.length ? {
|
|
479
493
|
s1: Math.min(...s.map((r) => r.sector1Ms).filter(Boolean)),
|
|
@@ -481,7 +495,7 @@ function be(e, t = !1) {
|
|
|
481
495
|
s3: Math.min(...s.map((r) => r.sector3Ms).filter(Boolean))
|
|
482
496
|
} : null;
|
|
483
497
|
}
|
|
484
|
-
function
|
|
498
|
+
function Qe({ active: e, dir: t }) {
|
|
485
499
|
return e ? t === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
|
|
486
500
|
}
|
|
487
501
|
function M({ label: e, sortKey: t, config: s, onSort: r, className: a = "" }) {
|
|
@@ -492,7 +506,7 @@ function M({ label: e, sortKey: t, config: s, onSort: r, className: a = "" }) {
|
|
|
492
506
|
onClick: () => r(t),
|
|
493
507
|
children: /* @__PURE__ */ c("span", { className: "pvx-th-inner", children: [
|
|
494
508
|
e,
|
|
495
|
-
/* @__PURE__ */ n(
|
|
509
|
+
/* @__PURE__ */ n(Qe, { active: s.key === t, dir: s.dir })
|
|
496
510
|
] })
|
|
497
511
|
}
|
|
498
512
|
);
|
|
@@ -507,9 +521,9 @@ function G({ userId: e, getUserDisplay: t }) {
|
|
|
507
521
|
function te({ rank: e, podium: t = !1 }) {
|
|
508
522
|
return /* @__PURE__ */ n("span", { className: t ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
|
|
509
523
|
}
|
|
510
|
-
function
|
|
524
|
+
function ke({ availableTags: e, activeTags: t, onToggle: s, onClear: r }) {
|
|
511
525
|
if (!e || e.length < 2) return null;
|
|
512
|
-
const a =
|
|
526
|
+
const a = fe.map((i) => ({ id: i.id, tags: i.tags.filter((o) => e.includes(o)) })).filter((i) => i.tags.length > 0);
|
|
513
527
|
return /* @__PURE__ */ c("div", { className: "pvx-tag-bar", children: [
|
|
514
528
|
/* @__PURE__ */ n(
|
|
515
529
|
"button",
|
|
@@ -526,7 +540,7 @@ function ye({ availableTags: e, activeTags: t, onToggle: s, onClear: r }) {
|
|
|
526
540
|
{
|
|
527
541
|
onClick: () => s(d),
|
|
528
542
|
className: `pvx-tag ${t.has(d) ? "pvx-tag--active" : ""}`,
|
|
529
|
-
children:
|
|
543
|
+
children: ze[d] || d
|
|
530
544
|
},
|
|
531
545
|
d
|
|
532
546
|
))
|
|
@@ -551,44 +565,44 @@ function V({ message: e }) {
|
|
|
551
565
|
function K() {
|
|
552
566
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
|
|
553
567
|
}
|
|
554
|
-
function
|
|
568
|
+
function Ye() {
|
|
555
569
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
556
570
|
}
|
|
557
|
-
function
|
|
571
|
+
function Je() {
|
|
558
572
|
return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
559
573
|
}
|
|
560
|
-
function
|
|
561
|
-
const [d,
|
|
562
|
-
var
|
|
563
|
-
if (!((
|
|
574
|
+
function rt({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
575
|
+
const [d, u] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle: p, clear: f } = be(i, o), g = L(() => {
|
|
576
|
+
var v;
|
|
577
|
+
if (!((v = s == null ? void 0 : s.tags) != null && v.length)) return [];
|
|
564
578
|
const x = /* @__PURE__ */ new Set();
|
|
565
579
|
for (const N of e || [])
|
|
566
580
|
N.recordByTag && Object.keys(N.recordByTag).forEach((h) => x.add(h));
|
|
567
581
|
return s.tags.filter((N) => x.has(N));
|
|
568
|
-
}, [e, s]),
|
|
582
|
+
}, [e, s]), m = L(() => e ? l.size === 0 ? e : e.map((x) => {
|
|
569
583
|
var h, y;
|
|
570
584
|
if (!x.recordByTag) return null;
|
|
571
|
-
let
|
|
585
|
+
let v = null;
|
|
572
586
|
const N = /* @__PURE__ */ new Set();
|
|
573
587
|
for (const C of Object.values(x.recordByTag)) {
|
|
574
588
|
if (N.has(C.carId)) continue;
|
|
575
589
|
N.add(C.carId);
|
|
576
590
|
const w = ((y = (h = s == null ? void 0 : s.cars) == null ? void 0 : h[C.carId]) == null ? void 0 : y.tags) || ["sports_car"];
|
|
577
|
-
|
|
591
|
+
Ne(w, l) && (!v || C.lapTimeMs < v.lapTimeMs) && (v = C);
|
|
578
592
|
}
|
|
579
|
-
return
|
|
593
|
+
return v ? {
|
|
580
594
|
...x,
|
|
581
595
|
record: {
|
|
582
|
-
visibleId:
|
|
583
|
-
carId:
|
|
584
|
-
carDisplayName: I(
|
|
585
|
-
lapTimeMs:
|
|
586
|
-
timestamp:
|
|
596
|
+
visibleId: v.steamId || v.identifier,
|
|
597
|
+
carId: v.carId,
|
|
598
|
+
carDisplayName: I(v.carId),
|
|
599
|
+
lapTimeMs: v.lapTimeMs,
|
|
600
|
+
timestamp: v.recordedAt
|
|
587
601
|
}
|
|
588
602
|
} : null;
|
|
589
|
-
}).filter(Boolean) : [], [e, l, s]), b = L(() => z(
|
|
603
|
+
}).filter(Boolean) : [], [e, l, s]), b = L(() => z(m, d, (x, v) => {
|
|
590
604
|
var N, h;
|
|
591
|
-
switch (
|
|
605
|
+
switch (v) {
|
|
592
606
|
case "displayName":
|
|
593
607
|
return x.displayName;
|
|
594
608
|
case "record.lapTimeMs":
|
|
@@ -601,22 +615,22 @@ function et({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
601
615
|
default:
|
|
602
616
|
return (h = x.record) != null && h.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
603
617
|
}
|
|
604
|
-
}), [
|
|
618
|
+
}), [m, d]);
|
|
605
619
|
return t ? /* @__PURE__ */ n(K, {}) : e != null && e.length ? /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
606
620
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
607
|
-
/* @__PURE__ */ n(
|
|
621
|
+
/* @__PURE__ */ n(ke, { availableTags: g, activeTags: l, onToggle: p, onClear: f }),
|
|
608
622
|
/* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
609
623
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
610
|
-
/* @__PURE__ */ n(M, { label: "Track", sortKey: "displayName", config: d, onSort:
|
|
624
|
+
/* @__PURE__ */ n(M, { label: "Track", sortKey: "displayName", config: d, onSort: u }),
|
|
611
625
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
612
626
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
613
|
-
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort:
|
|
614
|
-
/* @__PURE__ */ n(M, { label: "Drivers", sortKey: "driverCount", config: d, onSort:
|
|
615
|
-
/* @__PURE__ */ n(M, { label: "Cars", sortKey: "carCount", config: d, onSort:
|
|
616
|
-
/* @__PURE__ */ n(M, { label: "Date", sortKey: "record.timestamp", config: d, onSort:
|
|
627
|
+
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: u }),
|
|
628
|
+
/* @__PURE__ */ n(M, { label: "Drivers", sortKey: "driverCount", config: d, onSort: u, className: "pvx-hidden-below-md" }),
|
|
629
|
+
/* @__PURE__ */ n(M, { label: "Cars", sortKey: "carCount", config: d, onSort: u, className: "pvx-hidden-below-lg" }),
|
|
630
|
+
/* @__PURE__ */ n(M, { label: "Date", sortKey: "record.timestamp", config: d, onSort: u, className: "pvx-hidden-below-xl" })
|
|
617
631
|
] }) }),
|
|
618
632
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: b.map((x) => {
|
|
619
|
-
var
|
|
633
|
+
var v, N, h;
|
|
620
634
|
return /* @__PURE__ */ c(
|
|
621
635
|
"tr",
|
|
622
636
|
{
|
|
@@ -624,7 +638,7 @@ function et({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
624
638
|
onClick: () => a(x.id, x.layout),
|
|
625
639
|
children: [
|
|
626
640
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
627
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: (
|
|
641
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: (v = x.record) != null && v.visibleId ? /* @__PURE__ */ n(G, { userId: x.record.visibleId, getUserDisplay: r }) : "-" }),
|
|
628
642
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
|
|
629
643
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? A(x.record.lapTimeMs) : "-" }),
|
|
630
644
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
@@ -638,8 +652,8 @@ function et({ tracks: e, isLoading: t, carMetadata: s, getUserDisplay: r, onTrac
|
|
|
638
652
|
] }) })
|
|
639
653
|
] }) : /* @__PURE__ */ n(V, { message: "No lap times recorded yet." });
|
|
640
654
|
}
|
|
641
|
-
function
|
|
642
|
-
const [l,
|
|
655
|
+
function st({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: u }) {
|
|
656
|
+
const [l, p] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: f, toggle: g, clear: m } = be(d, u), b = L(() => {
|
|
643
657
|
var y, C, w;
|
|
644
658
|
if (!e || !((y = r == null ? void 0 : r.tags) != null && y.length)) return [];
|
|
645
659
|
const h = /* @__PURE__ */ new Set();
|
|
@@ -649,8 +663,8 @@ function nt({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay
|
|
|
649
663
|
}, [e, r]), x = L(() => e ? f.size === 0 ? e : e.filter((h) => {
|
|
650
664
|
var C, w;
|
|
651
665
|
const y = ((w = (C = r == null ? void 0 : r.cars) == null ? void 0 : C[h.carId]) == null ? void 0 : w.tags) || ["sports_car"];
|
|
652
|
-
return
|
|
653
|
-
}) : [], [e, f, r]),
|
|
666
|
+
return Ne(y, f);
|
|
667
|
+
}) : [], [e, f, r]), v = L(() => z(x, l, (h, y) => {
|
|
654
668
|
switch (y) {
|
|
655
669
|
case "carId":
|
|
656
670
|
return I(h.carId);
|
|
@@ -666,17 +680,17 @@ function nt({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay
|
|
|
666
680
|
];
|
|
667
681
|
return t ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
668
682
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(re, { segments: N }) }),
|
|
669
|
-
/* @__PURE__ */ n(
|
|
683
|
+
/* @__PURE__ */ n(ke, { availableTags: b, activeTags: f, onToggle: g, onClear: m }),
|
|
670
684
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
671
685
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
672
686
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
673
|
-
/* @__PURE__ */ n(M, { label: "Car", sortKey: "carId", config: l, onSort:
|
|
687
|
+
/* @__PURE__ */ n(M, { label: "Car", sortKey: "carId", config: l, onSort: p }),
|
|
674
688
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
|
|
675
|
-
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort:
|
|
676
|
-
/* @__PURE__ */ n(M, { label: "Drivers", sortKey: "driverCount", config: l, onSort:
|
|
689
|
+
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort: p }),
|
|
690
|
+
/* @__PURE__ */ n(M, { label: "Drivers", sortKey: "driverCount", config: l, onSort: p, className: "pvx-hidden-below-md" }),
|
|
677
691
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
678
692
|
] }) }),
|
|
679
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
693
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: v.map((h, y) => /* @__PURE__ */ c(
|
|
680
694
|
"tr",
|
|
681
695
|
{
|
|
682
696
|
className: "pvx-row pvx-row--clickable",
|
|
@@ -695,18 +709,18 @@ function nt({ entries: e, isLoading: t, track: s, carMetadata: r, getUserDisplay
|
|
|
695
709
|
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this track yet." })
|
|
696
710
|
] });
|
|
697
711
|
}
|
|
698
|
-
function
|
|
699
|
-
const [
|
|
712
|
+
function at({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
713
|
+
const [u, l] = W({ key: "lapTimeMs", dir: "asc" }), p = L(() => ye(e), [e]), f = L(() => z(e || [], u, (m, b) => {
|
|
700
714
|
switch (b) {
|
|
701
715
|
case "userId":
|
|
702
|
-
return a(
|
|
716
|
+
return a(m.steamId || m.userId).displayName;
|
|
703
717
|
case "lapCount":
|
|
704
|
-
return
|
|
718
|
+
return m.lapCount || 0;
|
|
705
719
|
case "lapTimeMs":
|
|
706
720
|
default:
|
|
707
|
-
return
|
|
721
|
+
return m.lapTimeMs;
|
|
708
722
|
}
|
|
709
|
-
}), [e,
|
|
723
|
+
}), [e, u, a]), g = [
|
|
710
724
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
711
725
|
{ key: "track", label: s.displayName, onClick: () => o("track") },
|
|
712
726
|
{ key: "car", label: I(r) }
|
|
@@ -716,51 +730,51 @@ function tt({ entries: e, isLoading: t, track: s, carId: r, getUserDisplay: a, o
|
|
|
716
730
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
717
731
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
718
732
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
719
|
-
/* @__PURE__ */ n(M, { label: "Driver", sortKey: "userId", config:
|
|
720
|
-
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "lapTimeMs", config:
|
|
733
|
+
/* @__PURE__ */ n(M, { label: "Driver", sortKey: "userId", config: u, onSort: l }),
|
|
734
|
+
/* @__PURE__ */ n(M, { label: "Lap Time", sortKey: "lapTimeMs", config: u, onSort: l }),
|
|
721
735
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
722
736
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
723
737
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
724
738
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
725
739
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
726
|
-
/* @__PURE__ */ n(M, { label: "Laps", sortKey: "lapCount", config:
|
|
740
|
+
/* @__PURE__ */ n(M, { label: "Laps", sortKey: "lapCount", config: u, onSort: l, className: "pvx-hidden-below-lg" }),
|
|
727
741
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
728
742
|
] }) }),
|
|
729
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: f.map((
|
|
730
|
-
const x = b + 1,
|
|
743
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: f.map((m, b) => {
|
|
744
|
+
const x = b + 1, v = m.steamId || m.userId, N = p && m.sector1Ms === p.s1, h = p && m.sector2Ms === p.s2, y = p && m.sector3Ms === p.s3;
|
|
731
745
|
return /* @__PURE__ */ c(
|
|
732
746
|
"tr",
|
|
733
747
|
{
|
|
734
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
735
|
-
onClick: () => i(
|
|
748
|
+
className: `pvx-row pvx-row--clickable ${d && v === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
749
|
+
onClick: () => i(v),
|
|
736
750
|
children: [
|
|
737
751
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(te, { rank: x, podium: !0 }) }),
|
|
738
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(G, { userId:
|
|
739
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: A(
|
|
740
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: B(
|
|
741
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: B(
|
|
742
|
-
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: B(
|
|
743
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: de(
|
|
744
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children:
|
|
745
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
746
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children:
|
|
752
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(G, { userId: v, getUserDisplay: a }) }),
|
|
753
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: A(m.lapTimeMs) }),
|
|
754
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: B(m.sector1Ms) }),
|
|
755
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: B(m.sector2Ms) }),
|
|
756
|
+
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: B(m.sector3Ms) }),
|
|
757
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: de(m.tyreCompound), children: m.tyreCompound || "-" }),
|
|
758
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: pe(m.startingFuelL) }),
|
|
759
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.lapCount || "-" }),
|
|
760
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: m.recordedAt ? j(m.recordedAt) : "-" })
|
|
747
761
|
]
|
|
748
762
|
},
|
|
749
|
-
|
|
763
|
+
v
|
|
750
764
|
);
|
|
751
765
|
}) })
|
|
752
766
|
] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this car yet." })
|
|
753
767
|
] });
|
|
754
768
|
}
|
|
755
|
-
function
|
|
756
|
-
const { data: l, driverName:
|
|
769
|
+
function it({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: u }) {
|
|
770
|
+
const { data: l, driverName: p, theoreticalBest: f, isLoading: g } = Ke(e, t.id, t.layout, s, { showInvalid: i, game: r, gameVersion: a }), { displayName: m, avatarUrl: b } = o(e, p), x = L(() => ye(l, !0), [l]), v = L(() => {
|
|
757
771
|
const h = (l == null ? void 0 : l.filter((y) => y.isValid)) || [];
|
|
758
772
|
return h.length ? Math.min(...h.map((y) => y.lapTimeMs)) : null;
|
|
759
773
|
}, [l]), N = [
|
|
760
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
761
|
-
{ key: "track", label: t.displayName, onClick: () =>
|
|
762
|
-
{ key: "car", label: I(s), onClick: () =>
|
|
763
|
-
{ key: "driver", label:
|
|
774
|
+
{ key: "tracks", label: "Tracks", onClick: () => u("tracks") },
|
|
775
|
+
{ key: "track", label: t.displayName, onClick: () => u("track") },
|
|
776
|
+
{ key: "car", label: I(s), onClick: () => u("car") },
|
|
777
|
+
{ key: "driver", label: m }
|
|
764
778
|
];
|
|
765
779
|
return g ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
766
780
|
/* @__PURE__ */ c("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
@@ -808,7 +822,7 @@ function rt({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvali
|
|
|
808
822
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
809
823
|
] }) }),
|
|
810
824
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: l.map((h, y) => {
|
|
811
|
-
const C = h.isValid && h.lapTimeMs ===
|
|
825
|
+
const C = h.isValid && h.lapTimeMs === v, w = x && h.isValid && h.sector1Ms === x.s1, T = x && h.isValid && h.sector2Ms === x.s2, $ = x && h.isValid && h.sector3Ms === x.s3;
|
|
812
826
|
let E = "pvx-row";
|
|
813
827
|
return h.isValid || (E += " pvx-row--invalid"), C && (E += " pvx-row--personal-best"), /* @__PURE__ */ c("tr", { className: E, children: [
|
|
814
828
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${C ? "pvx-rank--gold" : ""}`, children: y + 1 }) }),
|
|
@@ -817,18 +831,18 @@ function rt({ userId: e, track: t, carId: s, game: r, gameVersion: a, showInvali
|
|
|
817
831
|
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: B(h.sector1Ms) }),
|
|
818
832
|
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${T ? "pvx-td--best-sector" : ""}`, children: B(h.sector2Ms) }),
|
|
819
833
|
/* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: B(h.sector3Ms) }),
|
|
820
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", title: h.isValid ? void 0 : h.invalidReason || "Invalid", children: h.isValid ? /* @__PURE__ */ n(
|
|
834
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", title: h.isValid ? void 0 : h.invalidReason || "Invalid", children: h.isValid ? /* @__PURE__ */ n(Ye, {}) : /* @__PURE__ */ n(Je, {}) }),
|
|
821
835
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: de(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
822
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.startingFuelL
|
|
836
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: pe(h.startingFuelL) }),
|
|
823
837
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: j(h.timestamp) })
|
|
824
838
|
] }, h.id);
|
|
825
839
|
}) })
|
|
826
840
|
] }) }) : /* @__PURE__ */ n(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
827
841
|
] });
|
|
828
842
|
}
|
|
829
|
-
function
|
|
830
|
-
const [o, d] = W({ key: "rank", dir: "asc" }), [
|
|
831
|
-
switch (
|
|
843
|
+
function ot({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion: a, onComboSelect: i }) {
|
|
844
|
+
const [o, d] = W({ key: "rank", dir: "asc" }), [u, l] = D(null), p = L(() => e ? z(e, o, (g, m) => {
|
|
845
|
+
switch (m) {
|
|
832
846
|
case "rating":
|
|
833
847
|
return g.rating;
|
|
834
848
|
case "comboCount":
|
|
@@ -868,15 +882,15 @@ function st({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
868
882
|
/* @__PURE__ */ n(M, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
869
883
|
/* @__PURE__ */ n(M, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
|
|
870
884
|
] }) }),
|
|
871
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children:
|
|
872
|
-
const
|
|
885
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: p.map((g) => {
|
|
886
|
+
const m = u === g.identifier;
|
|
873
887
|
return /* @__PURE__ */ n(
|
|
874
|
-
|
|
888
|
+
Ze,
|
|
875
889
|
{
|
|
876
890
|
driver: g,
|
|
877
891
|
getUserDisplay: s,
|
|
878
|
-
isExpanded:
|
|
879
|
-
onToggle: () => l(
|
|
892
|
+
isExpanded: m,
|
|
893
|
+
onToggle: () => l(m ? null : g.identifier),
|
|
880
894
|
colCount: f,
|
|
881
895
|
game: r,
|
|
882
896
|
gameVersion: a,
|
|
@@ -888,9 +902,9 @@ function st({ drivers: e, isLoading: t, getUserDisplay: s, game: r, gameVersion:
|
|
|
888
902
|
] }) })
|
|
889
903
|
] });
|
|
890
904
|
}
|
|
891
|
-
function
|
|
892
|
-
const
|
|
893
|
-
return /* @__PURE__ */ c(
|
|
905
|
+
function Ze({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
|
|
906
|
+
const u = e.identifier;
|
|
907
|
+
return /* @__PURE__ */ c(U, { children: [
|
|
894
908
|
/* @__PURE__ */ c(
|
|
895
909
|
"tr",
|
|
896
910
|
{
|
|
@@ -898,7 +912,7 @@ function Ye({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
898
912
|
onClick: r,
|
|
899
913
|
children: [
|
|
900
914
|
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(te, { rank: e.rank, podium: !0 }) }),
|
|
901
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(G, { userId:
|
|
915
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(G, { userId: u, getUserDisplay: t }) }),
|
|
902
916
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
|
|
903
917
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
|
|
904
918
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ c("span", { className: "pvx-rankings-combo-count", children: [
|
|
@@ -908,8 +922,8 @@ function Ye({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
908
922
|
]
|
|
909
923
|
}
|
|
910
924
|
),
|
|
911
|
-
s && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((l,
|
|
912
|
-
const f = l.layout ? `${l.trackId}|${l.layout}` : l.trackId, g = d ? () => d({ track: f, car: l.carId, highlight:
|
|
925
|
+
s && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((l, p) => {
|
|
926
|
+
const f = l.layout ? `${l.trackId}|${l.layout}` : l.trackId, g = d ? () => d({ track: f, car: l.carId, highlight: u, game: i, gameVersion: o }) : void 0;
|
|
913
927
|
return /* @__PURE__ */ c(
|
|
914
928
|
"div",
|
|
915
929
|
{
|
|
@@ -937,12 +951,12 @@ function Ye({ driver: e, getUserDisplay: t, isExpanded: s, onToggle: r, colCount
|
|
|
937
951
|
] })
|
|
938
952
|
]
|
|
939
953
|
},
|
|
940
|
-
|
|
954
|
+
p
|
|
941
955
|
);
|
|
942
956
|
}) }) }) })
|
|
943
957
|
] });
|
|
944
958
|
}
|
|
945
|
-
const
|
|
959
|
+
const Xe = {
|
|
946
960
|
GBR: "🇬🇧",
|
|
947
961
|
DEU: "🇩🇪",
|
|
948
962
|
NLD: "🇳🇱",
|
|
@@ -973,19 +987,19 @@ const Je = {
|
|
|
973
987
|
RUS: "🇷🇺",
|
|
974
988
|
TUR: "🇹🇷",
|
|
975
989
|
KOR: "🇰🇷"
|
|
976
|
-
}, se = ["🥇", "🥈", "🥉"],
|
|
990
|
+
}, se = ["🥇", "🥈", "🥉"], en = {
|
|
977
991
|
championship: "Championship",
|
|
978
992
|
series: "Series",
|
|
979
993
|
event: "Event"
|
|
980
994
|
}, oe = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
981
|
-
function
|
|
995
|
+
function we({ position: e }) {
|
|
982
996
|
return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
|
|
983
997
|
}
|
|
984
998
|
function ae({ nation: e }) {
|
|
985
|
-
const t = e &&
|
|
999
|
+
const t = e && Xe[e];
|
|
986
1000
|
return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
|
|
987
1001
|
}
|
|
988
|
-
function
|
|
1002
|
+
function nn({ sessions: e, activeSession: t, onSelect: s }) {
|
|
989
1003
|
if (!e || e.length <= 1) return null;
|
|
990
1004
|
const r = [...e].sort(
|
|
991
1005
|
(a, i) => oe.indexOf(a.type) - oe.indexOf(i.type)
|
|
@@ -1000,20 +1014,20 @@ function Xe({ sessions: e, activeSession: t, onSelect: s }) {
|
|
|
1000
1014
|
a.type
|
|
1001
1015
|
)) });
|
|
1002
1016
|
}
|
|
1003
|
-
function
|
|
1004
|
-
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children:
|
|
1017
|
+
function tn({ type: e }) {
|
|
1018
|
+
return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: en[e] || e });
|
|
1005
1019
|
}
|
|
1006
1020
|
function Y({ children: e, variant: t = "default" }) {
|
|
1007
1021
|
return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
|
|
1008
1022
|
}
|
|
1009
|
-
function
|
|
1023
|
+
function rn(e) {
|
|
1010
1024
|
if (!e) return "TBD";
|
|
1011
1025
|
const t = new Date(e);
|
|
1012
1026
|
if (isNaN(t)) return "TBD";
|
|
1013
1027
|
const s = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), r = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
1014
1028
|
return `${s} • ${r}`;
|
|
1015
1029
|
}
|
|
1016
|
-
function
|
|
1030
|
+
function sn(e) {
|
|
1017
1031
|
return e.reduce((t, s) => {
|
|
1018
1032
|
var r;
|
|
1019
1033
|
return (r = s.splits) != null && r.length ? t ? t.map((a, i) => {
|
|
@@ -1022,18 +1036,18 @@ function tn(e) {
|
|
|
1022
1036
|
}) : [...s.splits] : t;
|
|
1023
1037
|
}, null);
|
|
1024
1038
|
}
|
|
1025
|
-
function
|
|
1039
|
+
function F({ message: e = "Loading..." }) {
|
|
1026
1040
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
|
|
1027
1041
|
}
|
|
1028
1042
|
function P({ message: e = "No data available." }) {
|
|
1029
1043
|
return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
|
|
1030
1044
|
}
|
|
1031
|
-
const
|
|
1032
|
-
function
|
|
1045
|
+
const Ce = 3;
|
|
1046
|
+
function an(e) {
|
|
1033
1047
|
const t = e == null ? void 0 : e.rounds;
|
|
1034
1048
|
return t != null && t.length ? t.every((s) => s.isFinalized) : !1;
|
|
1035
1049
|
}
|
|
1036
|
-
function
|
|
1050
|
+
function on(e) {
|
|
1037
1051
|
const t = e == null ? void 0 : e.rounds;
|
|
1038
1052
|
if (!(t != null && t.length)) return null;
|
|
1039
1053
|
let s = null;
|
|
@@ -1044,24 +1058,24 @@ function sn(e) {
|
|
|
1044
1058
|
}
|
|
1045
1059
|
return s;
|
|
1046
1060
|
}
|
|
1047
|
-
function
|
|
1048
|
-
if (!
|
|
1049
|
-
const s =
|
|
1061
|
+
function Le(e, t = Ce) {
|
|
1062
|
+
if (!an(e)) return "active";
|
|
1063
|
+
const s = on(e);
|
|
1050
1064
|
if (!s) return "recently-completed";
|
|
1051
1065
|
const r = t * 24 * 60 * 60 * 1e3;
|
|
1052
1066
|
return Date.now() - s.getTime() <= r ? "recently-completed" : "archived";
|
|
1053
1067
|
}
|
|
1054
|
-
function
|
|
1068
|
+
function ct(e, t, s = Ce) {
|
|
1055
1069
|
if (!(e != null && e.length)) return [];
|
|
1056
1070
|
const r = new Set(Array.isArray(t) ? t : [t]);
|
|
1057
|
-
return e.filter((a) => r.has(
|
|
1071
|
+
return e.filter((a) => r.has(Le(a, s)));
|
|
1058
1072
|
}
|
|
1059
|
-
function
|
|
1073
|
+
function cn(e, t = 3) {
|
|
1060
1074
|
const s = e == null ? void 0 : e.standings;
|
|
1061
1075
|
return Array.isArray(s) ? [...s].sort((r, a) => (r.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
|
|
1062
1076
|
}
|
|
1063
|
-
function
|
|
1064
|
-
const { data: a } =
|
|
1077
|
+
function ln({ competitionId: e, topN: t = 3, label: s = "Completed", className: r }) {
|
|
1078
|
+
const { data: a } = ve(e), i = cn(a, t);
|
|
1065
1079
|
return /* @__PURE__ */ c("div", { className: `pvx-comp-completed-badge ${r || ""}`, children: [
|
|
1066
1080
|
/* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: s }),
|
|
1067
1081
|
i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ c("li", { className: "pvx-comp-completed-badge-driver", children: [
|
|
@@ -1071,12 +1085,12 @@ function on({ competitionId: e, topN: t = 3, label: s = "Completed", className:
|
|
|
1071
1085
|
] }, o.driverId || d)) })
|
|
1072
1086
|
] });
|
|
1073
1087
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return t ? /* @__PURE__ */ n(
|
|
1088
|
+
function lt({ competitions: e, isLoading: t, onSelect: s, onRegister: r, className: a }) {
|
|
1089
|
+
return t ? /* @__PURE__ */ n(F, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(dn, { comp: i, onSelect: s, onRegister: r || s }, i.id)) }) : /* @__PURE__ */ n(P, { message: "No competitions available." });
|
|
1076
1090
|
}
|
|
1077
|
-
function
|
|
1091
|
+
function dn({ comp: e, onSelect: t, onRegister: s }) {
|
|
1078
1092
|
var h, y, C;
|
|
1079
|
-
const { cdnUrl: r } = k(), a = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants,
|
|
1093
|
+
const { cdnUrl: r } = k(), a = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, u = d && o >= d, l = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), p = (i == null ? void 0 : i.isOpen) && !l && !u, f = /* @__PURE__ */ new Date(), g = (h = e.rounds) == null ? void 0 : h.find((w) => w.startTime && new Date(w.startTime) >= f), m = ((y = e.rounds) == null ? void 0 : y.length) || 0, b = ((C = e.rounds) == null ? void 0 : C.filter((w) => w.isFinalized).length) || 0, x = Le(e), v = x === "recently-completed" || x === "archived", N = e.type === "championship";
|
|
1080
1094
|
return /* @__PURE__ */ c(
|
|
1081
1095
|
"div",
|
|
1082
1096
|
{
|
|
@@ -1088,12 +1102,12 @@ function cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1088
1102
|
(w.key === "Enter" || w.key === " ") && (w.preventDefault(), t(e.id));
|
|
1089
1103
|
},
|
|
1090
1104
|
children: [
|
|
1091
|
-
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(
|
|
1105
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(un, {}) }) }),
|
|
1092
1106
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-body", children: [
|
|
1093
1107
|
/* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
|
|
1094
1108
|
e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
|
|
1095
1109
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
|
|
1096
|
-
/* @__PURE__ */ n(
|
|
1110
|
+
/* @__PURE__ */ n(tn, { type: e.type }),
|
|
1097
1111
|
e.game && /* @__PURE__ */ n(Y, { children: e.game.toUpperCase() }),
|
|
1098
1112
|
e.formatDescription && e.formatDescription.split(", ").map((w, T) => /* @__PURE__ */ n(Y, { variant: "format", children: w }, T))
|
|
1099
1113
|
] }),
|
|
@@ -1107,26 +1121,26 @@ function cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1107
1121
|
" ",
|
|
1108
1122
|
g.track || "TBD",
|
|
1109
1123
|
" — ",
|
|
1110
|
-
|
|
1111
|
-
] }) :
|
|
1124
|
+
rn(g.startTime)
|
|
1125
|
+
] }) : m > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1112
1126
|
b,
|
|
1113
1127
|
"/",
|
|
1114
|
-
|
|
1128
|
+
m,
|
|
1115
1129
|
" rounds completed"
|
|
1116
1130
|
] }) : null,
|
|
1117
|
-
|
|
1118
|
-
|
|
1131
|
+
m > 0 && /* @__PURE__ */ c("span", { className: "pvx-comp-card-round-count", children: [
|
|
1132
|
+
m,
|
|
1119
1133
|
" round",
|
|
1120
|
-
|
|
1134
|
+
m !== 1 ? "s" : ""
|
|
1121
1135
|
] })
|
|
1122
1136
|
] }),
|
|
1123
|
-
|
|
1124
|
-
i && !
|
|
1125
|
-
|
|
1137
|
+
v && N && /* @__PURE__ */ n(ln, { competitionId: e.id }),
|
|
1138
|
+
i && !v && /* @__PURE__ */ n(
|
|
1139
|
+
pn,
|
|
1126
1140
|
{
|
|
1127
1141
|
competitionId: e.id,
|
|
1128
|
-
regOpen:
|
|
1129
|
-
isFull:
|
|
1142
|
+
regOpen: p,
|
|
1143
|
+
isFull: u,
|
|
1130
1144
|
deadlinePassed: l,
|
|
1131
1145
|
regCount: o,
|
|
1132
1146
|
regMax: d,
|
|
@@ -1138,8 +1152,8 @@ function cn({ comp: e, onSelect: t, onRegister: s }) {
|
|
|
1138
1152
|
}
|
|
1139
1153
|
);
|
|
1140
1154
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const { isPowerMode: d } = ee(),
|
|
1155
|
+
function pn({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCount: a, regMax: i, onRegister: o }) {
|
|
1156
|
+
const { isPowerMode: d } = ee(), u = ne(e), { data: l } = X(e), p = (l == null ? void 0 : l.isRegistered) || !1, f = i ? a / i * 100 : 0, g = f >= 100 ? "full" : f >= 75 ? "warning" : "ok";
|
|
1143
1157
|
return /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
|
|
1144
1158
|
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${g}`, children: [
|
|
1145
1159
|
a,
|
|
@@ -1147,12 +1161,12 @@ function ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1147
1161
|
i || "∞",
|
|
1148
1162
|
" drivers"
|
|
1149
1163
|
] }) }),
|
|
1150
|
-
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children:
|
|
1164
|
+
/* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: p ? /* @__PURE__ */ n(
|
|
1151
1165
|
"button",
|
|
1152
1166
|
{
|
|
1153
1167
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
1154
|
-
onClick: (
|
|
1155
|
-
|
|
1168
|
+
onClick: (m) => {
|
|
1169
|
+
m.stopPropagation(), o(e);
|
|
1156
1170
|
},
|
|
1157
1171
|
children: "✓ Registered"
|
|
1158
1172
|
}
|
|
@@ -1160,25 +1174,25 @@ function ln({ competitionId: e, regOpen: t, isFull: s, deadlinePassed: r, regCou
|
|
|
1160
1174
|
"button",
|
|
1161
1175
|
{
|
|
1162
1176
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1163
|
-
onClick: (
|
|
1164
|
-
|
|
1177
|
+
onClick: (m) => {
|
|
1178
|
+
m.stopPropagation(), o(e);
|
|
1165
1179
|
},
|
|
1166
1180
|
children: "Register"
|
|
1167
1181
|
}
|
|
1168
1182
|
) : /* @__PURE__ */ n(
|
|
1169
1183
|
"a",
|
|
1170
1184
|
{
|
|
1171
|
-
href:
|
|
1185
|
+
href: u,
|
|
1172
1186
|
target: "_blank",
|
|
1173
1187
|
rel: "noopener noreferrer",
|
|
1174
1188
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1175
|
-
onClick: (
|
|
1189
|
+
onClick: (m) => m.stopPropagation(),
|
|
1176
1190
|
children: "Register"
|
|
1177
1191
|
}
|
|
1178
1192
|
) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
|
|
1179
1193
|
] });
|
|
1180
1194
|
}
|
|
1181
|
-
function
|
|
1195
|
+
function un() {
|
|
1182
1196
|
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: [
|
|
1183
1197
|
/* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1184
1198
|
/* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1188,14 +1202,14 @@ function dn() {
|
|
|
1188
1202
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1189
1203
|
] });
|
|
1190
1204
|
}
|
|
1191
|
-
function
|
|
1192
|
-
var d,
|
|
1193
|
-
const { data: s, isLoading: r } =
|
|
1205
|
+
function mn({ competitionId: e, className: t }) {
|
|
1206
|
+
var d, u;
|
|
1207
|
+
const { data: s, isLoading: r } = ve(e), { data: a, isLoading: i } = me(e);
|
|
1194
1208
|
if (r || i)
|
|
1195
|
-
return /* @__PURE__ */ n(
|
|
1209
|
+
return /* @__PURE__ */ n(F, { message: "Loading standings..." });
|
|
1196
1210
|
if (!((d = s == null ? void 0 : s.standings) != null && d.length))
|
|
1197
1211
|
return /* @__PURE__ */ n(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1198
|
-
const o = ((
|
|
1212
|
+
const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((l) => l.isFinalized)) || [];
|
|
1199
1213
|
return /* @__PURE__ */ c("div", { className: `pvx-card ${t || ""}`, children: [
|
|
1200
1214
|
/* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ c("div", { className: "pvx-card-header-left", children: [
|
|
1201
1215
|
/* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
@@ -1228,7 +1242,7 @@ function pn({ competitionId: e, className: t }) {
|
|
|
1228
1242
|
))
|
|
1229
1243
|
] }) }),
|
|
1230
1244
|
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: s.standings.map((l) => /* @__PURE__ */ n(
|
|
1231
|
-
|
|
1245
|
+
vn,
|
|
1232
1246
|
{
|
|
1233
1247
|
driver: l,
|
|
1234
1248
|
finalizedRounds: o
|
|
@@ -1238,13 +1252,13 @@ function pn({ competitionId: e, className: t }) {
|
|
|
1238
1252
|
] }) })
|
|
1239
1253
|
] });
|
|
1240
1254
|
}
|
|
1241
|
-
function
|
|
1242
|
-
var o, d,
|
|
1255
|
+
function vn({ driver: e, finalizedRounds: t }) {
|
|
1256
|
+
var o, d, u;
|
|
1243
1257
|
const s = e.position <= 3, r = new Map(
|
|
1244
1258
|
((o = e.roundResults) == null ? void 0 : o.map((l) => [l.roundNumber, l])) || []
|
|
1245
|
-
), a = ((d = e.roundResults) == null ? void 0 : d.filter((l) => l.position === 1).length) || 0, i = ((
|
|
1259
|
+
), 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;
|
|
1246
1260
|
return /* @__PURE__ */ c("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
|
|
1247
|
-
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(
|
|
1261
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(we, { position: e.position }) }),
|
|
1248
1262
|
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1249
1263
|
/* @__PURE__ */ n(ae, { nation: e.nation }),
|
|
1250
1264
|
e.driverName
|
|
@@ -1253,17 +1267,17 @@ function un({ driver: e, finalizedRounds: t }) {
|
|
|
1253
1267
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1254
1268
|
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
|
|
1255
1269
|
t.map((l) => {
|
|
1256
|
-
const
|
|
1270
|
+
const p = r.get(l.roundNumber), f = p == null ? void 0 : p.dropped;
|
|
1257
1271
|
return /* @__PURE__ */ n(
|
|
1258
1272
|
"td",
|
|
1259
1273
|
{
|
|
1260
|
-
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!f && (
|
|
1261
|
-
children:
|
|
1274
|
+
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!f && (p == null ? void 0 : p.position) === 1 ? "pvx-standings-cell--p1" : !f && (p == null ? void 0 : p.position) === 2 ? "pvx-standings-cell--p2" : !f && (p == null ? void 0 : p.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
|
|
1275
|
+
children: p ? /* @__PURE__ */ c("div", { className: `pvx-standings-round-cell ${f ? "pvx-standings-round-cell--dropped" : ""}`, children: [
|
|
1262
1276
|
/* @__PURE__ */ c("span", { className: "pvx-standings-round-pos", children: [
|
|
1263
1277
|
"P",
|
|
1264
|
-
|
|
1278
|
+
p.position
|
|
1265
1279
|
] }),
|
|
1266
|
-
/* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children:
|
|
1280
|
+
/* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: p.points })
|
|
1267
1281
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" })
|
|
1268
1282
|
},
|
|
1269
1283
|
l.roundNumber
|
|
@@ -1271,14 +1285,14 @@ function un({ driver: e, finalizedRounds: t }) {
|
|
|
1271
1285
|
})
|
|
1272
1286
|
] });
|
|
1273
1287
|
}
|
|
1274
|
-
function
|
|
1275
|
-
var
|
|
1276
|
-
const { data: r, isLoading: a } =
|
|
1288
|
+
function dt({ competitionId: e, roundNumber: t, className: s }) {
|
|
1289
|
+
var u;
|
|
1290
|
+
const { data: r, isLoading: a } = He(e, t);
|
|
1277
1291
|
if (a)
|
|
1278
|
-
return /* @__PURE__ */ n(
|
|
1292
|
+
return /* @__PURE__ */ n(F, { message: "Loading results..." });
|
|
1279
1293
|
if (!r)
|
|
1280
1294
|
return /* @__PURE__ */ n(P, { message: "No results for this round." });
|
|
1281
|
-
const o = (r.sessions || []).find((l) => l.type === "RACE"), d = (
|
|
1295
|
+
const o = (r.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, p) => l.position - p.position);
|
|
1282
1296
|
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${s || ""}`, children: [
|
|
1283
1297
|
/* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
|
|
1284
1298
|
/* @__PURE__ */ c("div", { children: [
|
|
@@ -1298,97 +1312,144 @@ function ot({ competitionId: e, roundNumber: t, className: s }) {
|
|
|
1298
1312
|
/* @__PURE__ */ n("span", { children: l.driverName })
|
|
1299
1313
|
] }, l.driverId)) })
|
|
1300
1314
|
] }),
|
|
1301
|
-
/* @__PURE__ */ n(
|
|
1315
|
+
/* @__PURE__ */ n(Te, { round: r, competitionId: e })
|
|
1302
1316
|
] });
|
|
1303
1317
|
}
|
|
1304
|
-
function
|
|
1305
|
-
var
|
|
1306
|
-
const [
|
|
1307
|
-
if (!
|
|
1318
|
+
function Te({ round: e, competitionId: t, className: s }) {
|
|
1319
|
+
var p, f, g, m;
|
|
1320
|
+
const [r, a] = D(null), i = (e == null ? void 0 : e.sessions) || [];
|
|
1321
|
+
if (!i.length)
|
|
1308
1322
|
return /* @__PURE__ */ n(P, { message: "No session data for this round." });
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1323
|
+
const { data: o } = We(
|
|
1324
|
+
t,
|
|
1325
|
+
e == null ? void 0 : e.roundNumber,
|
|
1326
|
+
{}
|
|
1327
|
+
), d = r || ((p = i.find((b) => b.type === "RACE")) == null ? void 0 : p.type) || ((f = i[0]) == null ? void 0 : f.type), u = i.find((b) => b.type === d) || i[0], l = ((m = (g = o == null ? void 0 : o.sessions) == null ? void 0 : g.find((b) => b.type === d)) == null ? void 0 : m.drivers) || null;
|
|
1328
|
+
return /* @__PURE__ */ c("div", { className: s || "", children: [
|
|
1311
1329
|
/* @__PURE__ */ n(
|
|
1312
|
-
|
|
1330
|
+
nn,
|
|
1313
1331
|
{
|
|
1314
|
-
sessions:
|
|
1315
|
-
activeSession:
|
|
1316
|
-
onSelect:
|
|
1332
|
+
sessions: i,
|
|
1333
|
+
activeSession: d,
|
|
1334
|
+
onSelect: a
|
|
1317
1335
|
}
|
|
1318
1336
|
),
|
|
1319
|
-
/* @__PURE__ */ n(
|
|
1337
|
+
/* @__PURE__ */ n(hn, { session: u, sessionLaps: l })
|
|
1320
1338
|
] });
|
|
1321
1339
|
}
|
|
1322
|
-
function
|
|
1323
|
-
var
|
|
1324
|
-
const
|
|
1325
|
-
if (!((
|
|
1340
|
+
function hn({ session: e, sessionLaps: t }) {
|
|
1341
|
+
var d;
|
|
1342
|
+
const s = e.type === "RACE", [r, a] = D(null);
|
|
1343
|
+
if (!((d = e.results) != null && d.length))
|
|
1326
1344
|
return /* @__PURE__ */ n(P, { message: `No results for ${e.type}.` });
|
|
1327
|
-
const
|
|
1345
|
+
const i = sn(e.results), o = s ? 7 : 4;
|
|
1328
1346
|
return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
1329
1347
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1330
1348
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
1331
1349
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
|
|
1332
1350
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
|
|
1333
1351
|
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
|
|
1334
|
-
|
|
1352
|
+
s && /* @__PURE__ */ c(U, { children: [
|
|
1335
1353
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
|
|
1336
1354
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
|
|
1337
1355
|
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1338
1356
|
] })
|
|
1339
1357
|
] }) }),
|
|
1340
|
-
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1358
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((u, l) => {
|
|
1359
|
+
var g;
|
|
1360
|
+
const p = (g = t == null ? void 0 : t[u.driverId]) == null ? void 0 : g.laps, f = r === u.driverId && !!p;
|
|
1361
|
+
return /* @__PURE__ */ n(
|
|
1362
|
+
xn,
|
|
1363
|
+
{
|
|
1364
|
+
result: u,
|
|
1365
|
+
isRace: s,
|
|
1366
|
+
fastestSplits: i,
|
|
1367
|
+
rowIndex: l,
|
|
1368
|
+
hasLapDetail: !!p,
|
|
1369
|
+
isExpanded: f,
|
|
1370
|
+
onToggle: () => a(f ? null : u.driverId),
|
|
1371
|
+
driverLaps: f ? p : null,
|
|
1372
|
+
colCount: o
|
|
1373
|
+
},
|
|
1374
|
+
u.driverId || l
|
|
1375
|
+
);
|
|
1376
|
+
}) })
|
|
1350
1377
|
] }) });
|
|
1351
1378
|
}
|
|
1352
|
-
function
|
|
1353
|
-
const
|
|
1354
|
-
return /* @__PURE__ */ c(
|
|
1355
|
-
/* @__PURE__ */
|
|
1356
|
-
|
|
1357
|
-
/* @__PURE__ */ n(ae, { nation: e.nation }),
|
|
1358
|
-
e.driverName,
|
|
1359
|
-
e.carNumber != null && /* @__PURE__ */ c("span", { className: "pvx-car-number", children: [
|
|
1360
|
-
"#",
|
|
1361
|
-
e.carNumber
|
|
1362
|
-
] }),
|
|
1363
|
-
e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
|
|
1364
|
-
] }),
|
|
1365
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1366
|
-
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1367
|
-
hn,
|
|
1379
|
+
function xn({ result: e, isRace: t, fastestSplits: s, rowIndex: r, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: u }) {
|
|
1380
|
+
const l = e.position <= 3;
|
|
1381
|
+
return /* @__PURE__ */ c(U, { children: [
|
|
1382
|
+
/* @__PURE__ */ c(
|
|
1383
|
+
"tr",
|
|
1368
1384
|
{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1385
|
+
className: `pvx-row ${l ? "pvx-row--podium" : ""} ${a ? "pvx-row--expandable" : ""}`,
|
|
1386
|
+
onClick: a ? o : void 0,
|
|
1387
|
+
style: a ? { cursor: "pointer" } : void 0,
|
|
1388
|
+
children: [
|
|
1389
|
+
/* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(we, { position: e.position }) }),
|
|
1390
|
+
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1391
|
+
/* @__PURE__ */ n(ae, { nation: e.nation }),
|
|
1392
|
+
e.driverName,
|
|
1393
|
+
e.carNumber != null && /* @__PURE__ */ c("span", { className: "pvx-car-number", children: [
|
|
1394
|
+
"#",
|
|
1395
|
+
e.carNumber
|
|
1396
|
+
] }),
|
|
1397
|
+
e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty }),
|
|
1398
|
+
a && /* @__PURE__ */ n("span", { className: `pvx-expand-indicator ${i ? "pvx-expand-indicator--open" : ""}`, children: /* @__PURE__ */ n("svg", { width: "10", height: "6", viewBox: "0 0 10 6", fill: "currentColor", style: { transition: "transform 0.15s", transform: i ? "rotate(180deg)" : "none" }, children: /* @__PURE__ */ n("path", { d: "M1 1l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", fill: "none", strokeLinecap: "round" }) }) })
|
|
1399
|
+
] }),
|
|
1400
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
|
|
1401
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
|
|
1402
|
+
fn,
|
|
1403
|
+
{
|
|
1404
|
+
bestLap: e.bestLapFormatted,
|
|
1405
|
+
hasBestLap: e.hasBestLap,
|
|
1406
|
+
splits: e.splits,
|
|
1407
|
+
fastestSplits: s,
|
|
1408
|
+
showAbove: r <= 1
|
|
1409
|
+
}
|
|
1410
|
+
) }),
|
|
1411
|
+
t && /* @__PURE__ */ c(U, { children: [
|
|
1412
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
|
|
1413
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
|
|
1414
|
+
/* @__PURE__ */ c("td", { className: "pvx-td pvx-td--center", children: [
|
|
1415
|
+
/* @__PURE__ */ n("span", { className: "pvx-session-points", children: e.points }),
|
|
1416
|
+
e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ c("span", { className: "pvx-points-override", children: [
|
|
1417
|
+
"(",
|
|
1418
|
+
e.pointsOverride > 0 ? "+" : "",
|
|
1419
|
+
e.pointsOverride,
|
|
1420
|
+
")"
|
|
1421
|
+
] })
|
|
1422
|
+
] })
|
|
1423
|
+
] })
|
|
1424
|
+
]
|
|
1374
1425
|
}
|
|
1375
|
-
)
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
] })
|
|
1426
|
+
),
|
|
1427
|
+
i && d && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: u, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(gn, { laps: d }) }) })
|
|
1428
|
+
] });
|
|
1429
|
+
}
|
|
1430
|
+
function gn({ laps: e }) {
|
|
1431
|
+
const t = Math.min(...e.filter((s) => s.valid && s.timeMs > 0).map((s) => s.timeMs));
|
|
1432
|
+
return /* @__PURE__ */ c("table", { className: "pvx-table pvx-table--laps", children: [
|
|
1433
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
1434
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
|
|
1435
|
+
/* @__PURE__ */ n("th", { className: "pvx-th", children: "Time" }),
|
|
1436
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
1437
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
1438
|
+
/* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
|
|
1439
|
+
] }) }),
|
|
1440
|
+
/* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((s) => {
|
|
1441
|
+
var a;
|
|
1442
|
+
const r = s.valid && s.timeMs === t;
|
|
1443
|
+
return /* @__PURE__ */ c("tr", { className: `pvx-row ${s.valid ? "" : "pvx-row--invalid"} ${r ? "pvx-row--fastest" : ""}`, children: [
|
|
1444
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: s.lap }),
|
|
1445
|
+
/* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: s.time }),
|
|
1446
|
+
(s.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
|
|
1447
|
+
Array.from({ length: Math.max(0, 3 - (((a = s.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
|
|
1448
|
+
] }, s.lap);
|
|
1449
|
+
}) })
|
|
1389
1450
|
] });
|
|
1390
1451
|
}
|
|
1391
|
-
function
|
|
1452
|
+
function fn({ bestLap: e, hasBestLap: t, splits: s, fastestSplits: r, showAbove: a }) {
|
|
1392
1453
|
return e ? /* @__PURE__ */ c("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1393
1454
|
/* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
|
|
1394
1455
|
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
|
|
@@ -1403,15 +1464,15 @@ function hn({ bestLap: e, hasBestLap: t, splits: s, fastestSplits: r, showAbove:
|
|
|
1403
1464
|
}) }) })
|
|
1404
1465
|
] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
|
|
1405
1466
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const { getSteamId: s } = k(), { data: r, isLoading: a } =
|
|
1467
|
+
function pt({ competitionId: e, className: t }) {
|
|
1468
|
+
const { getSteamId: s } = k(), { data: r, isLoading: a } = he(e), i = s();
|
|
1408
1469
|
if (a)
|
|
1409
|
-
return /* @__PURE__ */ n(
|
|
1470
|
+
return /* @__PURE__ */ n(F, { message: "Loading drivers..." });
|
|
1410
1471
|
const o = (r == null ? void 0 : r.drivers) || (r == null ? void 0 : r.entries) || [];
|
|
1411
1472
|
return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
|
|
1412
|
-
var l,
|
|
1413
|
-
const
|
|
1414
|
-
return /* @__PURE__ */ c("div", { className: `pvx-entry-card ${
|
|
1473
|
+
var l, p;
|
|
1474
|
+
const u = i && d.steamId === i;
|
|
1475
|
+
return /* @__PURE__ */ c("div", { className: `pvx-entry-card ${u ? "pvx-entry-card--you" : ""}`, children: [
|
|
1415
1476
|
d.avatarUrl ? /* @__PURE__ */ n(
|
|
1416
1477
|
"img",
|
|
1417
1478
|
{
|
|
@@ -1419,32 +1480,32 @@ function ct({ competitionId: e, className: t }) {
|
|
|
1419
1480
|
alt: "",
|
|
1420
1481
|
className: "pvx-entry-avatar"
|
|
1421
1482
|
}
|
|
1422
|
-
) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((
|
|
1483
|
+
) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((p = (l = d.displayName) == null ? void 0 : l.charAt(0)) == null ? void 0 : p.toUpperCase()) || "?" }),
|
|
1423
1484
|
/* @__PURE__ */ c("span", { className: "pvx-entry-name", children: [
|
|
1424
1485
|
d.displayName,
|
|
1425
|
-
|
|
1486
|
+
u && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1426
1487
|
] })
|
|
1427
1488
|
] }, d.steamId || d.driverId);
|
|
1428
1489
|
}) }) : /* @__PURE__ */ n(P, { message: "No drivers registered yet." });
|
|
1429
1490
|
}
|
|
1430
|
-
function
|
|
1491
|
+
function ut({
|
|
1431
1492
|
competitionId: e,
|
|
1432
1493
|
driverData: t,
|
|
1433
1494
|
className: s,
|
|
1434
1495
|
children: r
|
|
1435
1496
|
}) {
|
|
1436
|
-
const { data: a, isLoading: i } = X(e), { isPowerMode: o } = ee(), d = ne(e),
|
|
1437
|
-
o &&
|
|
1497
|
+
const { data: a, isLoading: i } = X(e), { isPowerMode: o } = ee(), d = ne(e), u = xe(e), l = ge(e), p = (a == null ? void 0 : a.isRegistered) || !1, f = i || u.isPending || l.isPending, g = u.error || l.error || null, m = () => {
|
|
1498
|
+
o && u.mutate(t || {});
|
|
1438
1499
|
}, b = () => {
|
|
1439
1500
|
o && l.mutate();
|
|
1440
1501
|
};
|
|
1441
|
-
return typeof r == "function" ? r({ isRegistered:
|
|
1502
|
+
return typeof r == "function" ? r({ isRegistered: p, isLoading: f, register: m, withdraw: b, error: g, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
|
|
1442
1503
|
"button",
|
|
1443
1504
|
{
|
|
1444
1505
|
className: `pvx-comp-register-btn ${s || ""}`,
|
|
1445
|
-
onClick:
|
|
1506
|
+
onClick: p ? b : m,
|
|
1446
1507
|
disabled: f,
|
|
1447
|
-
children: f ? "Loading..." :
|
|
1508
|
+
children: f ? "Loading..." : p ? "Withdraw" : "Register"
|
|
1448
1509
|
}
|
|
1449
1510
|
) : /* @__PURE__ */ n(
|
|
1450
1511
|
"a",
|
|
@@ -1453,48 +1514,48 @@ function lt({
|
|
|
1453
1514
|
target: "_blank",
|
|
1454
1515
|
rel: "noopener noreferrer",
|
|
1455
1516
|
className: `pvx-comp-register-link ${s || ""}`,
|
|
1456
|
-
children:
|
|
1517
|
+
children: p ? "View Registration" : "Register on PitVox"
|
|
1457
1518
|
}
|
|
1458
1519
|
);
|
|
1459
1520
|
}
|
|
1460
|
-
function
|
|
1461
|
-
const { getSteamId: a } = k(), { isPowerMode: i } = ee(), o = ne(e), { data: d, isLoading:
|
|
1462
|
-
return
|
|
1463
|
-
|
|
1521
|
+
function mt({ competitionId: e, registration: t, onWithdrawSuccess: s, className: r }) {
|
|
1522
|
+
const { getSteamId: a } = k(), { isPowerMode: i } = ee(), o = ne(e), { data: d, isLoading: u } = X(e), { data: l, isLoading: p } = he(e), f = xe(e), g = ge(e), m = a(), b = (d == null ? void 0 : d.isRegistered) || !1, x = (l == null ? void 0 : l.drivers) || (l == null ? void 0 : l.entries) || [], v = t || {}, N = x.length || v.currentCount || 0, h = v.maxParticipants && N >= v.maxParticipants, y = v.deadline && new Date(v.deadline) < /* @__PURE__ */ new Date(), C = v.isOpen && !y && !h;
|
|
1523
|
+
return u || p ? /* @__PURE__ */ n(F, { message: "Loading registration..." }) : b ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n(
|
|
1524
|
+
bn,
|
|
1464
1525
|
{
|
|
1465
1526
|
competitionId: e,
|
|
1466
1527
|
drivers: x,
|
|
1467
|
-
steamId:
|
|
1528
|
+
steamId: m,
|
|
1468
1529
|
isPowerMode: i,
|
|
1469
1530
|
registrationUrl: o,
|
|
1470
1531
|
withdrawMutation: g,
|
|
1471
1532
|
onWithdrawSuccess: s,
|
|
1472
|
-
registration:
|
|
1533
|
+
registration: v
|
|
1473
1534
|
}
|
|
1474
|
-
) }) : C ?
|
|
1475
|
-
|
|
1535
|
+
) }) : C ? m ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n(
|
|
1536
|
+
Nn,
|
|
1476
1537
|
{
|
|
1477
1538
|
competitionId: e,
|
|
1478
1539
|
registerMutation: f,
|
|
1479
|
-
registration:
|
|
1540
|
+
registration: v
|
|
1480
1541
|
}
|
|
1481
1542
|
) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${r || ""}`, children: i ? /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ c("div", { className: `pvx-reg-panel ${r || ""}`, children: [
|
|
1482
1543
|
/* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1483
|
-
x.length > 0 && /* @__PURE__ */ n(
|
|
1544
|
+
x.length > 0 && /* @__PURE__ */ n(Re, { drivers: x, steamId: m })
|
|
1484
1545
|
] });
|
|
1485
1546
|
}
|
|
1486
|
-
function
|
|
1487
|
-
const [r, a] = D(""), [i, o] = D("intermediate"), [d,
|
|
1488
|
-
|
|
1547
|
+
function Nn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
1548
|
+
const [r, a] = D(""), [i, o] = D("intermediate"), [d, u] = D(""), l = (m) => {
|
|
1549
|
+
m.preventDefault(), t.mutate({
|
|
1489
1550
|
discordUsername: r || void 0,
|
|
1490
1551
|
experience: i,
|
|
1491
1552
|
comments: d || void 0
|
|
1492
1553
|
});
|
|
1493
|
-
},
|
|
1554
|
+
}, p = s || {}, f = p.currentCount || 0, g = p.maxParticipants;
|
|
1494
1555
|
return /* @__PURE__ */ c("form", { className: "pvx-reg-form", onSubmit: l, children: [
|
|
1495
1556
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1496
1557
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1497
|
-
g && /* @__PURE__ */ n(
|
|
1558
|
+
g && /* @__PURE__ */ n(Se, { count: f, max: g })
|
|
1498
1559
|
] }),
|
|
1499
1560
|
t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
|
|
1500
1561
|
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
@@ -1510,7 +1571,7 @@ function xn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1510
1571
|
className: "pvx-reg-input",
|
|
1511
1572
|
placeholder: "e.g. username",
|
|
1512
1573
|
value: r,
|
|
1513
|
-
onChange: (
|
|
1574
|
+
onChange: (m) => a(m.target.value)
|
|
1514
1575
|
}
|
|
1515
1576
|
)
|
|
1516
1577
|
] }),
|
|
@@ -1522,7 +1583,7 @@ function xn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1522
1583
|
id: `pvx-exp-${e}`,
|
|
1523
1584
|
className: "pvx-reg-select",
|
|
1524
1585
|
value: i,
|
|
1525
|
-
onChange: (
|
|
1586
|
+
onChange: (m) => o(m.target.value),
|
|
1526
1587
|
children: [
|
|
1527
1588
|
/* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
|
|
1528
1589
|
/* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
|
|
@@ -1544,7 +1605,7 @@ function xn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1544
1605
|
rows: 3,
|
|
1545
1606
|
placeholder: "Anything the organisers should know?",
|
|
1546
1607
|
value: d,
|
|
1547
|
-
onChange: (
|
|
1608
|
+
onChange: (m) => u(m.target.value)
|
|
1548
1609
|
}
|
|
1549
1610
|
)
|
|
1550
1611
|
] }),
|
|
@@ -1559,22 +1620,22 @@ function xn({ competitionId: e, registerMutation: t, registration: s }) {
|
|
|
1559
1620
|
) })
|
|
1560
1621
|
] });
|
|
1561
1622
|
}
|
|
1562
|
-
function
|
|
1563
|
-
const [
|
|
1623
|
+
function bn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1624
|
+
const [u, l] = D(!1), p = () => {
|
|
1564
1625
|
i.mutate(void 0, {
|
|
1565
1626
|
onSuccess: () => {
|
|
1566
1627
|
l(!1), o && o();
|
|
1567
1628
|
}
|
|
1568
1629
|
});
|
|
1569
|
-
}, f = d || {}, g = t.length || f.currentCount || 0,
|
|
1570
|
-
return /* @__PURE__ */ c(
|
|
1630
|
+
}, f = d || {}, g = t.length || f.currentCount || 0, m = f.maxParticipants;
|
|
1631
|
+
return /* @__PURE__ */ c(U, { children: [
|
|
1571
1632
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1572
1633
|
/* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1573
|
-
|
|
1634
|
+
m && /* @__PURE__ */ n(Se, { count: g, max: m })
|
|
1574
1635
|
] }),
|
|
1575
|
-
/* @__PURE__ */ n(
|
|
1636
|
+
/* @__PURE__ */ n(Re, { drivers: t, steamId: s }),
|
|
1576
1637
|
i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1577
|
-
r ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children:
|
|
1638
|
+
r ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ c("div", { className: "pvx-reg-confirm", children: [
|
|
1578
1639
|
/* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1579
1640
|
/* @__PURE__ */ c("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1580
1641
|
/* @__PURE__ */ n(
|
|
@@ -1591,7 +1652,7 @@ function gn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1591
1652
|
{
|
|
1592
1653
|
type: "button",
|
|
1593
1654
|
className: "pvx-reg-danger-btn",
|
|
1594
|
-
onClick:
|
|
1655
|
+
onClick: p,
|
|
1595
1656
|
disabled: i.isPending,
|
|
1596
1657
|
children: i.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1597
1658
|
}
|
|
@@ -1608,7 +1669,7 @@ function gn({ competitionId: e, drivers: t, steamId: s, isPowerMode: r, registra
|
|
|
1608
1669
|
) }) : /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
|
|
1609
1670
|
] });
|
|
1610
1671
|
}
|
|
1611
|
-
function
|
|
1672
|
+
function Re({ drivers: e, steamId: t }) {
|
|
1612
1673
|
if (!e.length)
|
|
1613
1674
|
return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1614
1675
|
const s = [...e].sort((r, a) => {
|
|
@@ -1634,7 +1695,7 @@ function Te({ drivers: e, steamId: t }) {
|
|
|
1634
1695
|
);
|
|
1635
1696
|
}) });
|
|
1636
1697
|
}
|
|
1637
|
-
function
|
|
1698
|
+
function Se({ count: e, max: t }) {
|
|
1638
1699
|
const s = t ? e / t * 100 : 0, r = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
|
|
1639
1700
|
return /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${r}`, children: [
|
|
1640
1701
|
e,
|
|
@@ -1643,53 +1704,53 @@ function Re({ count: e, max: t }) {
|
|
|
1643
1704
|
" drivers"
|
|
1644
1705
|
] });
|
|
1645
1706
|
}
|
|
1646
|
-
function
|
|
1647
|
-
const { data: s, isLoading: r } =
|
|
1707
|
+
function vt({ competitionId: e, className: t }) {
|
|
1708
|
+
const { data: s, isLoading: r } = me(e), a = (s == null ? void 0 : s.type) === "championship", i = L(
|
|
1648
1709
|
() => {
|
|
1649
|
-
var
|
|
1650
|
-
return ((
|
|
1710
|
+
var v;
|
|
1711
|
+
return ((v = s == null ? void 0 : s.rounds) == null ? void 0 : v.filter((N) => N.isFinalized)) || [];
|
|
1651
1712
|
},
|
|
1652
1713
|
[s]
|
|
1653
1714
|
), o = L(
|
|
1654
|
-
() => i.map((
|
|
1715
|
+
() => i.map((v) => v.roundNumber),
|
|
1655
1716
|
[i]
|
|
1656
|
-
), { data: d = [], isLoading:
|
|
1717
|
+
), { data: d = [], isLoading: u } = Oe(
|
|
1657
1718
|
e,
|
|
1658
1719
|
o
|
|
1659
|
-
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [
|
|
1660
|
-
if (r ||
|
|
1661
|
-
return /* @__PURE__ */ n(
|
|
1720
|
+
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [p, f] = D(null), g = p || l;
|
|
1721
|
+
if (r || u)
|
|
1722
|
+
return /* @__PURE__ */ n(F, { message: "Loading results..." });
|
|
1662
1723
|
if (!s)
|
|
1663
1724
|
return /* @__PURE__ */ n(P, { message: "Competition not found." });
|
|
1664
1725
|
if (!i.length)
|
|
1665
1726
|
return /* @__PURE__ */ n(P, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
1666
|
-
const
|
|
1727
|
+
const m = new Map(d.map((v) => [`round-${v.roundNumber}`, v])), b = [];
|
|
1667
1728
|
a && b.push({ id: "standings", label: "Standings" });
|
|
1668
|
-
for (const
|
|
1729
|
+
for (const v of i)
|
|
1669
1730
|
b.push({
|
|
1670
|
-
id: `round-${
|
|
1671
|
-
label: `R${
|
|
1731
|
+
id: `round-${v.roundNumber}`,
|
|
1732
|
+
label: `R${v.roundNumber}`,
|
|
1672
1733
|
track: null
|
|
1673
1734
|
});
|
|
1674
|
-
const x =
|
|
1735
|
+
const x = m.get(g);
|
|
1675
1736
|
return /* @__PURE__ */ c("div", { className: t || "", children: [
|
|
1676
|
-
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: b.map((
|
|
1737
|
+
/* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: b.map((v) => /* @__PURE__ */ c(
|
|
1677
1738
|
"button",
|
|
1678
1739
|
{
|
|
1679
|
-
className: `pvx-results-tab ${g ===
|
|
1680
|
-
onClick: () => f(
|
|
1681
|
-
title:
|
|
1740
|
+
className: `pvx-results-tab ${g === v.id ? "pvx-results-tab--active" : ""}`,
|
|
1741
|
+
onClick: () => f(v.id),
|
|
1742
|
+
title: v.track || void 0,
|
|
1682
1743
|
children: [
|
|
1683
|
-
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children:
|
|
1684
|
-
|
|
1744
|
+
/* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: v.label }),
|
|
1745
|
+
v.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: v.track })
|
|
1685
1746
|
]
|
|
1686
1747
|
},
|
|
1687
|
-
|
|
1748
|
+
v.id
|
|
1688
1749
|
)) }),
|
|
1689
|
-
g === "standings" ? /* @__PURE__ */ n(
|
|
1750
|
+
g === "standings" ? /* @__PURE__ */ n(mn, { competitionId: e }) : x ? /* @__PURE__ */ n(yn, { round: x }) : /* @__PURE__ */ n(P, { message: "No results for this round." })
|
|
1690
1751
|
] });
|
|
1691
1752
|
}
|
|
1692
|
-
function
|
|
1753
|
+
function yn({ round: e }) {
|
|
1693
1754
|
var a;
|
|
1694
1755
|
const s = (e.sessions || []).find((i) => i.type === "RACE"), r = (a = s == null ? void 0 : s.results) == null ? void 0 : a.filter((i) => i.position <= 3).sort((i, o) => i.position - o.position);
|
|
1695
1756
|
return /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
@@ -1711,13 +1772,13 @@ function fn({ round: e }) {
|
|
|
1711
1772
|
/* @__PURE__ */ n("span", { children: i.driverName })
|
|
1712
1773
|
] }, i.driverId)) })
|
|
1713
1774
|
] }),
|
|
1714
|
-
/* @__PURE__ */ n(
|
|
1775
|
+
/* @__PURE__ */ n(Te, { round: e })
|
|
1715
1776
|
] });
|
|
1716
1777
|
}
|
|
1717
|
-
function
|
|
1778
|
+
function kn(e) {
|
|
1718
1779
|
const { cdnUrl: t } = k(), s = R({
|
|
1719
1780
|
queryKey: ["pitvox", "laps", "global", e, "index"],
|
|
1720
|
-
queryFn: () => S(t,
|
|
1781
|
+
queryFn: () => S(t, _e(null, e)),
|
|
1721
1782
|
enabled: !!e,
|
|
1722
1783
|
staleTime: 3e4,
|
|
1723
1784
|
refetchInterval: 3e4
|
|
@@ -1740,7 +1801,7 @@ function Nn(e) {
|
|
|
1740
1801
|
} : null
|
|
1741
1802
|
};
|
|
1742
1803
|
}
|
|
1743
|
-
function
|
|
1804
|
+
function $e(e = {}) {
|
|
1744
1805
|
const { cdnUrl: t, partnerSlug: s } = k(), { game: r, gameVersion: a, enabled: i = !0 } = e, o = Z(s, r, a, "ratings.json");
|
|
1745
1806
|
return R({
|
|
1746
1807
|
queryKey: ["pitvox", "ratings", s, r || null, a || null],
|
|
@@ -1750,9 +1811,9 @@ function Se(e = {}) {
|
|
|
1750
1811
|
enabled: i
|
|
1751
1812
|
});
|
|
1752
1813
|
}
|
|
1753
|
-
function
|
|
1814
|
+
function wn(e) {
|
|
1754
1815
|
var r;
|
|
1755
|
-
const t =
|
|
1816
|
+
const t = $e(), s = L(() => {
|
|
1756
1817
|
var a;
|
|
1757
1818
|
return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
|
|
1758
1819
|
(i) => i.identifier === e
|
|
@@ -1771,39 +1832,39 @@ function bn(e) {
|
|
|
1771
1832
|
} : null
|
|
1772
1833
|
};
|
|
1773
1834
|
}
|
|
1774
|
-
function
|
|
1775
|
-
const t =
|
|
1835
|
+
function ht(e = {}) {
|
|
1836
|
+
const t = $e(e);
|
|
1776
1837
|
return {
|
|
1777
1838
|
data: t.data || null,
|
|
1778
1839
|
isLoading: t.isLoading,
|
|
1779
1840
|
error: t.error
|
|
1780
1841
|
};
|
|
1781
1842
|
}
|
|
1782
|
-
function
|
|
1843
|
+
function Cn() {
|
|
1783
1844
|
const { cdnUrl: e, partnerSlug: t, getSteamId: s, onFetchServerPassword: r } = k(), a = s(), { data: i, isLoading: o } = R({
|
|
1784
1845
|
queryKey: ["pitvox", "competitions", t],
|
|
1785
1846
|
queryFn: async () => {
|
|
1786
|
-
const
|
|
1787
|
-
return
|
|
1847
|
+
const m = await S(e, "competitions/index.json");
|
|
1848
|
+
return m != null && m.competitions ? m.competitions.filter((b) => b.partnerSlug === t) : [];
|
|
1788
1849
|
},
|
|
1789
1850
|
staleTime: 6e4
|
|
1790
|
-
}), d = (i == null ? void 0 : i.map((
|
|
1791
|
-
queries: d.map((
|
|
1792
|
-
queryKey: ["pitvox", "competition", t,
|
|
1793
|
-
queryFn: () => S(e, `competitions/${t}/${
|
|
1851
|
+
}), d = (i == null ? void 0 : i.map((m) => m.id)) || [], u = ie({
|
|
1852
|
+
queries: d.map((m) => ({
|
|
1853
|
+
queryKey: ["pitvox", "competition", t, m, "entrylist"],
|
|
1854
|
+
queryFn: () => S(e, `competitions/${t}/${m}/entrylist.json`),
|
|
1794
1855
|
enabled: !!a && d.length > 0,
|
|
1795
1856
|
staleTime: 6e4
|
|
1796
1857
|
}))
|
|
1797
|
-
}), l =
|
|
1798
|
-
var x,
|
|
1858
|
+
}), l = u.some((m) => m.isLoading), p = L(() => {
|
|
1859
|
+
var x, v;
|
|
1799
1860
|
if (!i || !a || l) return [];
|
|
1800
|
-
const
|
|
1861
|
+
const m = /* @__PURE__ */ new Date(), b = [];
|
|
1801
1862
|
for (let N = 0; N < i.length; N++) {
|
|
1802
|
-
const h = i[N], y = (x =
|
|
1803
|
-
if (!((
|
|
1863
|
+
const h = i[N], y = (x = u[N]) == null ? void 0 : x.data;
|
|
1864
|
+
if (!((v = y == null ? void 0 : y.drivers) == null ? void 0 : v.some((T) => T.steamId === a))) continue;
|
|
1804
1865
|
const w = h.rounds || [];
|
|
1805
1866
|
for (const T of w)
|
|
1806
|
-
T.isFinalized || !T.startTime || new Date(T.startTime) <=
|
|
1867
|
+
T.isFinalized || !T.startTime || new Date(T.startTime) <= m || b.push({
|
|
1807
1868
|
competitionId: h.id,
|
|
1808
1869
|
competitionName: h.name,
|
|
1809
1870
|
roundNumber: T.roundNumber,
|
|
@@ -1812,34 +1873,34 @@ function yn() {
|
|
|
1812
1873
|
});
|
|
1813
1874
|
}
|
|
1814
1875
|
return b.sort((N, h) => new Date(N.startTime) - new Date(h.startTime)), b.length > 0 && (b[0].isNext = !0), b;
|
|
1815
|
-
}, [i, a, l,
|
|
1816
|
-
queries:
|
|
1817
|
-
queryKey: ["pitvox", "serverInfo",
|
|
1818
|
-
queryFn: () => r(
|
|
1819
|
-
enabled: !!r &&
|
|
1876
|
+
}, [i, a, l, u]), f = ie({
|
|
1877
|
+
queries: p.map((m) => ({
|
|
1878
|
+
queryKey: ["pitvox", "serverInfo", m.competitionId, m.roundNumber],
|
|
1879
|
+
queryFn: () => r(m.competitionId, m.roundNumber),
|
|
1880
|
+
enabled: !!r && p.length > 0,
|
|
1820
1881
|
staleTime: 5 * 6e4,
|
|
1821
1882
|
// 5 minutes
|
|
1822
1883
|
retry: !1
|
|
1823
1884
|
}))
|
|
1824
1885
|
});
|
|
1825
1886
|
return {
|
|
1826
|
-
data: L(() =>
|
|
1827
|
-
var
|
|
1828
|
-
const x = (
|
|
1887
|
+
data: L(() => p.length ? r ? p.map((m, b) => {
|
|
1888
|
+
var v;
|
|
1889
|
+
const x = (v = f[b]) == null ? void 0 : v.data;
|
|
1829
1890
|
return x != null && x.success ? {
|
|
1830
|
-
...
|
|
1891
|
+
...m,
|
|
1831
1892
|
serverAddress: x.serverAddress || null,
|
|
1832
1893
|
serverPassword: x.serverPassword || null
|
|
1833
|
-
} :
|
|
1834
|
-
}) :
|
|
1894
|
+
} : m;
|
|
1895
|
+
}) : p : [], [p, r, f]),
|
|
1835
1896
|
isLoading: o || !!a && l
|
|
1836
1897
|
};
|
|
1837
1898
|
}
|
|
1838
|
-
function
|
|
1899
|
+
function Ln() {
|
|
1839
1900
|
const { onFetchNotifications: e } = k();
|
|
1840
1901
|
return !!e;
|
|
1841
1902
|
}
|
|
1842
|
-
function
|
|
1903
|
+
function Tn(e = {}) {
|
|
1843
1904
|
const { onFetchNotifications: t, partnerSlug: s } = k(), { limit: r = 20, unreadOnly: a = !1 } = e;
|
|
1844
1905
|
return R({
|
|
1845
1906
|
queryKey: ["pitvox", "notifications", s, { limit: r, unreadOnly: a }],
|
|
@@ -1849,7 +1910,7 @@ function wn(e = {}) {
|
|
|
1849
1910
|
refetchInterval: 3e4
|
|
1850
1911
|
});
|
|
1851
1912
|
}
|
|
1852
|
-
function
|
|
1913
|
+
function xt() {
|
|
1853
1914
|
const { onFetchNotifications: e, partnerSlug: t } = k(), { data: s, isLoading: r } = R({
|
|
1854
1915
|
queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
|
|
1855
1916
|
queryFn: () => e({ limit: 1 }),
|
|
@@ -1860,7 +1921,7 @@ function mt() {
|
|
|
1860
1921
|
});
|
|
1861
1922
|
return { count: s ?? 0, isLoading: r };
|
|
1862
1923
|
}
|
|
1863
|
-
function
|
|
1924
|
+
function Rn() {
|
|
1864
1925
|
const { onMarkNotificationRead: e, partnerSlug: t } = k(), s = _();
|
|
1865
1926
|
return O({
|
|
1866
1927
|
mutationFn: (r) => {
|
|
@@ -1882,7 +1943,7 @@ function Cn() {
|
|
|
1882
1943
|
}
|
|
1883
1944
|
});
|
|
1884
1945
|
}
|
|
1885
|
-
function
|
|
1946
|
+
function Sn() {
|
|
1886
1947
|
const { onMarkAllNotificationsRead: e, partnerSlug: t } = k(), s = _();
|
|
1887
1948
|
return O({
|
|
1888
1949
|
mutationFn: () => {
|
|
@@ -1906,7 +1967,7 @@ function Ln() {
|
|
|
1906
1967
|
}
|
|
1907
1968
|
});
|
|
1908
1969
|
}
|
|
1909
|
-
function
|
|
1970
|
+
function $n({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" }) {
|
|
1910
1971
|
const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
1911
1972
|
return /* @__PURE__ */ c("div", { className: `pvx-card pvx-dash-profile ${r}`, children: [
|
|
1912
1973
|
t ? /* @__PURE__ */ n("img", { src: t, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
|
|
@@ -1919,7 +1980,7 @@ function Tn({ driverName: e, avatarUrl: t, memberSince: s, className: r = "" })
|
|
|
1919
1980
|
] })
|
|
1920
1981
|
] });
|
|
1921
1982
|
}
|
|
1922
|
-
function
|
|
1983
|
+
function Mn() {
|
|
1923
1984
|
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: [
|
|
1924
1985
|
/* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
1925
1986
|
/* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -1927,7 +1988,7 @@ function Rn() {
|
|
|
1927
1988
|
/* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
1928
1989
|
] });
|
|
1929
1990
|
}
|
|
1930
|
-
function
|
|
1991
|
+
function Dn() {
|
|
1931
1992
|
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: [
|
|
1932
1993
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1933
1994
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -1936,40 +1997,40 @@ function Sn() {
|
|
|
1936
1997
|
/* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
|
|
1937
1998
|
] });
|
|
1938
1999
|
}
|
|
1939
|
-
function
|
|
2000
|
+
function In() {
|
|
1940
2001
|
return /* @__PURE__ */ n("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
|
|
1941
2002
|
}
|
|
1942
2003
|
function ce({ icon: e, value: t, label: s, items: r, labelKey: a, countKey: i }) {
|
|
1943
|
-
const [o, d] = D(!1),
|
|
1944
|
-
|
|
2004
|
+
const [o, d] = D(!1), u = Ie(null);
|
|
2005
|
+
Be(() => {
|
|
1945
2006
|
if (!o) return;
|
|
1946
|
-
function
|
|
1947
|
-
|
|
2007
|
+
function p(f) {
|
|
2008
|
+
u.current && !u.current.contains(f.target) && d(!1);
|
|
1948
2009
|
}
|
|
1949
|
-
return document.addEventListener("mousedown",
|
|
2010
|
+
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
1950
2011
|
}, [o]);
|
|
1951
|
-
const l = r != null && r.length ? r.slice().sort((
|
|
2012
|
+
const l = r != null && r.length ? r.slice().sort((p, f) => f[i] - p[i]) : null;
|
|
1952
2013
|
return /* @__PURE__ */ c(
|
|
1953
2014
|
"div",
|
|
1954
2015
|
{
|
|
1955
|
-
ref:
|
|
2016
|
+
ref: u,
|
|
1956
2017
|
className: `pvx-dash-stat-card ${l ? "pvx-dash-stat-card--clickable" : ""}`,
|
|
1957
|
-
onClick: l ? () => d((
|
|
2018
|
+
onClick: l ? () => d((p) => !p) : void 0,
|
|
1958
2019
|
children: [
|
|
1959
2020
|
e,
|
|
1960
2021
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
1961
2022
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
|
|
1962
2023
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: s })
|
|
1963
2024
|
] }),
|
|
1964
|
-
l && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: l.map((
|
|
1965
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children:
|
|
1966
|
-
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children:
|
|
2025
|
+
l && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: l.map((p, f) => /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip-row", children: [
|
|
2026
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: p[a] }),
|
|
2027
|
+
/* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: p[i] })
|
|
1967
2028
|
] }, f)) })
|
|
1968
2029
|
]
|
|
1969
2030
|
}
|
|
1970
2031
|
);
|
|
1971
2032
|
}
|
|
1972
|
-
function
|
|
2033
|
+
function Bn({ stats: e, rating: t, className: s = "" }) {
|
|
1973
2034
|
if (!e) return null;
|
|
1974
2035
|
const r = e.trackBreakdown.map((i) => ({
|
|
1975
2036
|
name: q(i.trackId, i.layout),
|
|
@@ -1982,7 +2043,7 @@ function Mn({ stats: e, rating: t, className: s = "" }) {
|
|
|
1982
2043
|
/* @__PURE__ */ n(
|
|
1983
2044
|
ce,
|
|
1984
2045
|
{
|
|
1985
|
-
icon: /* @__PURE__ */ n(
|
|
2046
|
+
icon: /* @__PURE__ */ n(Mn, {}),
|
|
1986
2047
|
value: e.lapCount.toLocaleString(),
|
|
1987
2048
|
label: "Total Laps",
|
|
1988
2049
|
items: r,
|
|
@@ -1993,7 +2054,7 @@ function Mn({ stats: e, rating: t, className: s = "" }) {
|
|
|
1993
2054
|
/* @__PURE__ */ n(
|
|
1994
2055
|
ce,
|
|
1995
2056
|
{
|
|
1996
|
-
icon: /* @__PURE__ */ n(
|
|
2057
|
+
icon: /* @__PURE__ */ n(Dn, {}),
|
|
1997
2058
|
value: e.carBreakdown.length,
|
|
1998
2059
|
label: "Cars Used",
|
|
1999
2060
|
items: a,
|
|
@@ -2002,7 +2063,7 @@ function Mn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2002
2063
|
}
|
|
2003
2064
|
),
|
|
2004
2065
|
t && /* @__PURE__ */ c("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
2005
|
-
/* @__PURE__ */ n(
|
|
2066
|
+
/* @__PURE__ */ n(In, {}),
|
|
2006
2067
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
2007
2068
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t.rating.toFixed(1) }),
|
|
2008
2069
|
/* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
@@ -2016,7 +2077,7 @@ function Mn({ stats: e, rating: t, className: s = "" }) {
|
|
|
2016
2077
|
] })
|
|
2017
2078
|
] });
|
|
2018
2079
|
}
|
|
2019
|
-
function
|
|
2080
|
+
function Pn({ records: e, className: t = "" }) {
|
|
2020
2081
|
const s = L(() => e != null && e.length ? e.slice().sort((r, a) => {
|
|
2021
2082
|
const i = r.recordedAt ? new Date(r.recordedAt).getTime() : 0;
|
|
2022
2083
|
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
@@ -2053,7 +2114,7 @@ function Dn({ records: e, className: t = "" }) {
|
|
|
2053
2114
|
] }, a)) })
|
|
2054
2115
|
] }) : null;
|
|
2055
2116
|
}
|
|
2056
|
-
function
|
|
2117
|
+
function An({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
2057
2118
|
if (t)
|
|
2058
2119
|
return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
2059
2120
|
if (!(e != null && e.length))
|
|
@@ -2061,7 +2122,7 @@ function In({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2061
2122
|
const a = r ? e.slice(0, r) : e, i = e.length - a.length;
|
|
2062
2123
|
return /* @__PURE__ */ c("div", { className: `pvx-card ${s || ""}`, children: [
|
|
2063
2124
|
/* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2064
|
-
/* @__PURE__ */ n(
|
|
2125
|
+
/* @__PURE__ */ n(En, {}),
|
|
2065
2126
|
"Upcoming Events",
|
|
2066
2127
|
/* @__PURE__ */ c("span", { className: "pvx-dash-records-count", children: [
|
|
2067
2128
|
"(",
|
|
@@ -2084,7 +2145,7 @@ function In({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2084
2145
|
o.track
|
|
2085
2146
|
] }),
|
|
2086
2147
|
o.serverPassword && /* @__PURE__ */ n(
|
|
2087
|
-
|
|
2148
|
+
Un,
|
|
2088
2149
|
{
|
|
2089
2150
|
password: o.serverPassword,
|
|
2090
2151
|
address: o.serverAddress
|
|
@@ -2097,7 +2158,7 @@ function In({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2097
2158
|
month: "short",
|
|
2098
2159
|
year: "numeric"
|
|
2099
2160
|
}) }),
|
|
2100
|
-
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children:
|
|
2161
|
+
/* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: Fn(o.startTime) }),
|
|
2101
2162
|
o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
2102
2163
|
] })
|
|
2103
2164
|
]
|
|
@@ -2113,7 +2174,7 @@ function In({ events: e, isLoading: t, className: s, limit: r = 3 }) {
|
|
|
2113
2174
|
] })
|
|
2114
2175
|
] });
|
|
2115
2176
|
}
|
|
2116
|
-
function
|
|
2177
|
+
function Un({ password: e, address: t }) {
|
|
2117
2178
|
const [s, r] = D(!1), [a, i] = D(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
|
|
2118
2179
|
if (o)
|
|
2119
2180
|
try {
|
|
@@ -2129,31 +2190,31 @@ function Bn({ password: e, address: t }) {
|
|
|
2129
2190
|
onClick: d,
|
|
2130
2191
|
title: "Copy join string to clipboard",
|
|
2131
2192
|
children: [
|
|
2132
|
-
/* @__PURE__ */ n(
|
|
2193
|
+
/* @__PURE__ */ n(qn, {}),
|
|
2133
2194
|
" ",
|
|
2134
2195
|
s ? "Copied!" : "Join"
|
|
2135
2196
|
]
|
|
2136
2197
|
}
|
|
2137
2198
|
),
|
|
2138
|
-
e && /* @__PURE__ */ c(
|
|
2199
|
+
e && /* @__PURE__ */ c(U, { children: [
|
|
2139
2200
|
/* @__PURE__ */ n(
|
|
2140
2201
|
"span",
|
|
2141
2202
|
{
|
|
2142
2203
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
2143
|
-
onClick: () => i((
|
|
2204
|
+
onClick: () => i((u) => !u),
|
|
2144
2205
|
title: a ? "Hide password" : "Reveal password",
|
|
2145
|
-
children: a ? /* @__PURE__ */ n(
|
|
2206
|
+
children: a ? /* @__PURE__ */ n(Vn, {}) : /* @__PURE__ */ n(jn, {})
|
|
2146
2207
|
}
|
|
2147
2208
|
),
|
|
2148
2209
|
a && /* @__PURE__ */ c("span", { className: "pvx-server-detail", children: [
|
|
2149
|
-
/* @__PURE__ */ n(
|
|
2210
|
+
/* @__PURE__ */ n(_n, {}),
|
|
2150
2211
|
" ",
|
|
2151
2212
|
e
|
|
2152
2213
|
] })
|
|
2153
2214
|
] })
|
|
2154
2215
|
] });
|
|
2155
2216
|
}
|
|
2156
|
-
function
|
|
2217
|
+
function Fn(e) {
|
|
2157
2218
|
const t = new Date(e).getTime() - Date.now();
|
|
2158
2219
|
if (t <= 0) return "Now";
|
|
2159
2220
|
const s = Math.floor(t / (1e3 * 60 * 60));
|
|
@@ -2168,49 +2229,49 @@ function Pn(e) {
|
|
|
2168
2229
|
}
|
|
2169
2230
|
return le(e);
|
|
2170
2231
|
}
|
|
2171
|
-
function
|
|
2232
|
+
function En() {
|
|
2172
2233
|
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: [
|
|
2173
2234
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2174
2235
|
/* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2175
2236
|
] });
|
|
2176
2237
|
}
|
|
2177
|
-
function
|
|
2238
|
+
function _n() {
|
|
2178
2239
|
return /* @__PURE__ */ c("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2179
2240
|
/* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2180
2241
|
/* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2181
2242
|
] });
|
|
2182
2243
|
}
|
|
2183
|
-
function
|
|
2244
|
+
function qn() {
|
|
2184
2245
|
return /* @__PURE__ */ c("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2185
2246
|
/* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2186
2247
|
/* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2187
2248
|
] });
|
|
2188
2249
|
}
|
|
2189
|
-
function
|
|
2250
|
+
function jn() {
|
|
2190
2251
|
return /* @__PURE__ */ c("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2191
2252
|
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2192
2253
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
2193
2254
|
] });
|
|
2194
2255
|
}
|
|
2195
|
-
function
|
|
2256
|
+
function Vn() {
|
|
2196
2257
|
return /* @__PURE__ */ c("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2197
2258
|
/* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
2198
2259
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2199
2260
|
] });
|
|
2200
2261
|
}
|
|
2201
|
-
function
|
|
2202
|
-
const o =
|
|
2262
|
+
function Kn({ notifications: e, unreadCount: t = 0, onMarkRead: s, onMarkAllRead: r, isLoading: a, className: i }) {
|
|
2263
|
+
const o = ue();
|
|
2203
2264
|
return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ c("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2204
2265
|
/* @__PURE__ */ c("div", { className: "pvx-card-header", children: [
|
|
2205
2266
|
/* @__PURE__ */ c("h3", { className: "pvx-card-title", children: [
|
|
2206
|
-
/* @__PURE__ */ n(
|
|
2267
|
+
/* @__PURE__ */ n(Wn, {}),
|
|
2207
2268
|
"Notifications",
|
|
2208
2269
|
t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
|
|
2209
2270
|
] }),
|
|
2210
2271
|
t > 0 && r && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: r, children: "Mark all read" })
|
|
2211
2272
|
] }),
|
|
2212
2273
|
e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
|
|
2213
|
-
|
|
2274
|
+
Hn,
|
|
2214
2275
|
{
|
|
2215
2276
|
notification: d,
|
|
2216
2277
|
getUserDisplay: o,
|
|
@@ -2220,7 +2281,7 @@ function qn({ notifications: e, unreadCount: t = 0, onMarkRead: s, onMarkAllRead
|
|
|
2220
2281
|
)) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2221
2282
|
] });
|
|
2222
2283
|
}
|
|
2223
|
-
function
|
|
2284
|
+
function Hn({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
2224
2285
|
const r = () => {
|
|
2225
2286
|
!e.isRead && s && s(e.id);
|
|
2226
2287
|
};
|
|
@@ -2230,9 +2291,9 @@ function jn({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
|
2230
2291
|
className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2231
2292
|
onClick: r,
|
|
2232
2293
|
children: [
|
|
2233
|
-
/* @__PURE__ */ n(
|
|
2294
|
+
/* @__PURE__ */ n(On, { type: e.type }),
|
|
2234
2295
|
/* @__PURE__ */ c("div", { className: "pvx-notif-content", children: [
|
|
2235
|
-
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children:
|
|
2296
|
+
/* @__PURE__ */ n("span", { className: "pvx-notif-message", children: je(e, t) }),
|
|
2236
2297
|
/* @__PURE__ */ n("span", { className: "pvx-notif-time", children: le(e.createdAt) })
|
|
2237
2298
|
] }),
|
|
2238
2299
|
!e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
|
|
@@ -2240,7 +2301,7 @@ function jn({ notification: e, getUserDisplay: t, onMarkRead: s }) {
|
|
|
2240
2301
|
}
|
|
2241
2302
|
);
|
|
2242
2303
|
}
|
|
2243
|
-
function
|
|
2304
|
+
function On({ type: e }) {
|
|
2244
2305
|
return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2245
2306
|
/* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2246
2307
|
/* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2253,114 +2314,116 @@ function Vn({ type: e }) {
|
|
|
2253
2314
|
/* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2254
2315
|
] }) });
|
|
2255
2316
|
}
|
|
2256
|
-
function
|
|
2317
|
+
function Wn() {
|
|
2257
2318
|
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: [
|
|
2258
2319
|
/* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2259
2320
|
/* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2260
2321
|
] });
|
|
2261
2322
|
}
|
|
2262
|
-
function
|
|
2263
|
-
const { data: a, isLoading: i, error: o } =
|
|
2264
|
-
return i ||
|
|
2323
|
+
function gt({ steamId: e, avatarUrl: t, memberSince: s, className: r = "" }) {
|
|
2324
|
+
const { data: a, isLoading: i, error: o } = kn(e), { data: d, isLoading: u } = wn(e), { data: l, isLoading: p } = Cn(), f = Ln(), { data: g, isLoading: m } = Tn({ limit: 10 }), b = Rn(), x = Sn();
|
|
2325
|
+
return i || u ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ c("div", { className: `pvx-dash ${r}`, children: [
|
|
2265
2326
|
/* @__PURE__ */ n(
|
|
2266
|
-
|
|
2327
|
+
$n,
|
|
2267
2328
|
{
|
|
2268
2329
|
driverName: a.driverName,
|
|
2269
2330
|
avatarUrl: t,
|
|
2270
2331
|
memberSince: s
|
|
2271
2332
|
}
|
|
2272
2333
|
),
|
|
2273
|
-
/* @__PURE__ */ n(
|
|
2274
|
-
e && /* @__PURE__ */ n(
|
|
2334
|
+
/* @__PURE__ */ n(Bn, { stats: a, rating: d }),
|
|
2335
|
+
e && /* @__PURE__ */ n(An, { events: l, isLoading: p }),
|
|
2275
2336
|
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${f ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2276
|
-
/* @__PURE__ */ n(
|
|
2337
|
+
/* @__PURE__ */ n(Pn, { records: a.currentRecords }),
|
|
2277
2338
|
f && /* @__PURE__ */ n(
|
|
2278
|
-
|
|
2339
|
+
Kn,
|
|
2279
2340
|
{
|
|
2280
2341
|
notifications: g == null ? void 0 : g.notifications,
|
|
2281
2342
|
unreadCount: (g == null ? void 0 : g.unreadCount) || 0,
|
|
2282
|
-
onMarkRead: (
|
|
2343
|
+
onMarkRead: (v) => b.mutate(v),
|
|
2283
2344
|
onMarkAllRead: () => x.mutate(),
|
|
2284
|
-
isLoading:
|
|
2345
|
+
isLoading: m
|
|
2285
2346
|
}
|
|
2286
2347
|
)
|
|
2287
2348
|
] })
|
|
2288
2349
|
] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2289
2350
|
}
|
|
2290
2351
|
export {
|
|
2291
|
-
|
|
2352
|
+
st as CarsTable,
|
|
2292
2353
|
P as CompEmptyState,
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2354
|
+
F as CompLoadingState,
|
|
2355
|
+
dn as CompetitionCard,
|
|
2356
|
+
lt as CompetitionCards,
|
|
2357
|
+
vt as CompetitionResultsTabs,
|
|
2358
|
+
ln as CompletedBadge,
|
|
2359
|
+
Ce as DEFAULT_COMPLETION_GRACE_DAYS,
|
|
2360
|
+
gt as DriverDashboard,
|
|
2361
|
+
$n as DriverProfile,
|
|
2362
|
+
at as DriversTable,
|
|
2363
|
+
pt as EntryList,
|
|
2303
2364
|
Y as InfoPill,
|
|
2304
|
-
|
|
2305
|
-
|
|
2365
|
+
it as LapHistoryTable,
|
|
2366
|
+
Kn as NotificationsCard,
|
|
2306
2367
|
se as PODIUM_MEDALS,
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2368
|
+
Yn as PitVoxPartnerProvider,
|
|
2369
|
+
ot as RankingsTable,
|
|
2370
|
+
Pn as RecordsTable,
|
|
2371
|
+
ut as RegisterButton,
|
|
2372
|
+
mt as RegistrationPanel,
|
|
2373
|
+
dt as RoundResults,
|
|
2374
|
+
Te as RoundSessionResults,
|
|
2375
|
+
mn as StandingsTable,
|
|
2376
|
+
Bn as StatsCards,
|
|
2377
|
+
rt as TracksTable,
|
|
2378
|
+
tn as TypeBadge,
|
|
2379
|
+
An as UpcomingEvents,
|
|
2380
|
+
_e as buildDriverIndexPath,
|
|
2320
2381
|
Ee as buildLapsPath,
|
|
2321
2382
|
Z as buildLeaderboardPath,
|
|
2322
|
-
|
|
2383
|
+
qe as buildRecentLapsPath,
|
|
2323
2384
|
S as fetchCdnJson,
|
|
2324
|
-
|
|
2385
|
+
ct as filterCompetitionsByStatus,
|
|
2325
2386
|
I as formatCarName,
|
|
2326
2387
|
j as formatDate,
|
|
2327
|
-
|
|
2388
|
+
Jn as formatDelta,
|
|
2389
|
+
pe as formatFuel,
|
|
2328
2390
|
A as formatLapTime,
|
|
2329
|
-
|
|
2391
|
+
je as formatNotificationMessage,
|
|
2330
2392
|
le as formatRelativeTime,
|
|
2331
2393
|
B as formatSectorTime,
|
|
2332
2394
|
q as formatTrackName,
|
|
2333
2395
|
de as formatTyreCompound,
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2396
|
+
cn as getCompetitionPodium,
|
|
2397
|
+
Le as getCompetitionStatus,
|
|
2398
|
+
on as getCompletionDate,
|
|
2399
|
+
an as isCompetitionComplete,
|
|
2400
|
+
nt as useCarLeaderboard,
|
|
2401
|
+
Xn as useCarMetadata,
|
|
2402
|
+
Oe as useCompetitionAllRounds,
|
|
2403
|
+
me as useCompetitionConfig,
|
|
2404
|
+
he as useCompetitionEntryList,
|
|
2405
|
+
He as useCompetitionRound,
|
|
2406
|
+
We as useCompetitionRoundLaps,
|
|
2407
|
+
ve as useCompetitionStandings,
|
|
2408
|
+
tt as useCompetitions,
|
|
2409
|
+
Ke as useDriverLaps,
|
|
2410
|
+
wn as useDriverRating,
|
|
2411
|
+
ht as useDriverRatings,
|
|
2412
|
+
kn as useDriverStats,
|
|
2413
|
+
Zn as useLeaderboardIndex,
|
|
2414
|
+
Sn as useMarkAllNotificationsRead,
|
|
2415
|
+
Rn as useMarkNotificationRead,
|
|
2416
|
+
Tn as useNotifications,
|
|
2417
|
+
Ln as useNotificationsEnabled,
|
|
2355
2418
|
k as usePitVox,
|
|
2356
|
-
|
|
2357
|
-
|
|
2419
|
+
et as useRecentLaps,
|
|
2420
|
+
xe as useRegister,
|
|
2358
2421
|
ee as useRegistrationMode,
|
|
2359
2422
|
X as useRegistrationStatus,
|
|
2360
2423
|
ne as useRegistrationUrl,
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2424
|
+
Ve as useTrackLeaderboard,
|
|
2425
|
+
xt as useUnreadCount,
|
|
2426
|
+
Cn as useUpcomingEvents,
|
|
2427
|
+
ue as useUserLookup,
|
|
2428
|
+
ge as useWithdraw
|
|
2366
2429
|
};
|