@pitvox/partner-react 0.6.1 → 0.6.2

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