@pitvox/partner-react 0.6.7 → 0.7.1

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