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