@pitvox/partner-react 0.7.13 → 0.7.15

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,13 +1,13 @@
1
- import { jsx as t, jsxs as l, Fragment as F } from "react/jsx-runtime";
2
- import { createContext as Be, useMemo as S, useContext as Ae, useState as D, useCallback as H, useRef as Ue, useEffect as Fe } from "react";
3
- import { useQueryClient as _, QueryClient as Ee, QueryClientProvider as _e, useQuery as T, useMutation as O, useQueries as ce } from "@tanstack/react-query";
4
- const Z = Be(null), qe = "https://cdn.pitvox.com", je = "https://pitvox.com";
1
+ import { jsx as n, jsxs as l, Fragment as F } from "react/jsx-runtime";
2
+ import { createContext as Ue, useMemo as S, useContext as Fe, useState as M, useCallback as H, useRef as Ee, useEffect as qe } from "react";
3
+ import { useQueryClient as j, QueryClient as je, QueryClientProvider as _e, useQuery as T, useMutation as W, useQueries as pe } from "@tanstack/react-query";
4
+ const X = Ue(null), Ve = "https://cdn.pitvox.com", Ke = "https://pitvox.com";
5
5
  let Y = null;
6
- function rn({
6
+ function it({
7
7
  partnerSlug: e = null,
8
- cdnUrl: n = qe,
9
- pitvoxUrl: s = je,
10
- getSteamId: r,
8
+ cdnUrl: t = Ve,
9
+ pitvoxUrl: r = Ke,
10
+ getSteamId: s,
11
11
  onRegister: a,
12
12
  onWithdraw: i,
13
13
  onFetchNotifications: o,
@@ -16,79 +16,79 @@ function rn({
16
16
  onFetchServerPassword: c,
17
17
  children: u
18
18
  }) {
19
- const g = S(() => ({
19
+ const x = S(() => ({
20
20
  partnerSlug: e,
21
- cdnUrl: n.replace(/\/$/, ""),
22
- pitvoxUrl: s.replace(/\/$/, ""),
23
- getSteamId: r || (() => null),
21
+ cdnUrl: t.replace(/\/$/, ""),
22
+ pitvoxUrl: r.replace(/\/$/, ""),
23
+ getSteamId: s || (() => null),
24
24
  onRegister: a || null,
25
25
  onWithdraw: i || null,
26
26
  onFetchNotifications: o || null,
27
27
  onMarkNotificationRead: d || null,
28
28
  onMarkAllNotificationsRead: p || null,
29
29
  onFetchServerPassword: c || null
30
- }), [e, n, s, r, a, i, o, d, p, c]);
30
+ }), [e, t, r, s, a, i, o, d, p, c]);
31
31
  let f = !1;
32
32
  try {
33
- _(), f = !0;
33
+ j(), f = !0;
34
34
  } catch {
35
35
  f = !1;
36
36
  }
37
- return f ? /* @__PURE__ */ t(Z.Provider, { value: g, children: u }) : (Y || (Y = new Ee({
37
+ return f ? /* @__PURE__ */ n(X.Provider, { value: x, children: u }) : (Y || (Y = new je({
38
38
  defaultOptions: {
39
39
  queries: { staleTime: 6e4 }
40
40
  }
41
- })), /* @__PURE__ */ t(_e, { client: Y, children: /* @__PURE__ */ t(Z.Provider, { value: g, children: u }) }));
41
+ })), /* @__PURE__ */ n(_e, { client: Y, children: /* @__PURE__ */ n(X.Provider, { value: x, children: u }) }));
42
42
  }
43
43
  function C() {
44
- const e = Ae(Z);
44
+ const e = Fe(X);
45
45
  if (!e)
46
46
  throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
47
47
  return e;
48
48
  }
49
- async function R(e, n) {
50
- const s = await fetch(`${e}/${n}`);
51
- if (!s.ok) {
52
- if (s.status === 404 || s.status === 403) return null;
53
- throw new Error(`CDN fetch failed: ${s.status}`);
49
+ async function $(e, t) {
50
+ const r = await fetch(`${e}/${t}`);
51
+ if (!r.ok) {
52
+ if (r.status === 404 || r.status === 403) return null;
53
+ throw new Error(`CDN fetch failed: ${r.status}`);
54
54
  }
55
- return s.json();
55
+ return r.json();
56
56
  }
57
- function X(e, n, s, ...r) {
57
+ function ee(e, t, r, ...s) {
58
58
  const a = ["leaderboards"];
59
- return e && a.push(`partners/${e}`), n && a.push(n), s && a.push(`v/${s}`), [...a, ...r].join("/");
59
+ return e && a.push(`partners/${e}`), t && a.push(t), r && a.push(`v/${r}`), [...a, ...s].join("/");
60
60
  }
61
- function Ve(e, n, s, r) {
62
- const a = r || "default";
63
- return e ? `laps/partners/${e}/${n}/${s}/${a}.json` : `laps/${n}/${s}/${a}.json`;
61
+ function He(e, t, r, s) {
62
+ const a = s || "default";
63
+ return e ? `laps/partners/${e}/${t}/${r}/${a}.json` : `laps/${t}/${r}/${a}.json`;
64
64
  }
65
- function Ke(e, n) {
66
- return e ? `laps/partners/${e}/${n}/index.json` : `laps/${n}/index.json`;
65
+ function me(e, t) {
66
+ return e ? `laps/partners/${e}/${t}/index.json` : `laps/${t}/index.json`;
67
67
  }
68
- function He(e) {
68
+ function We(e) {
69
69
  return e ? `recent-laps/partners/${e}.json` : "recent-laps.json";
70
70
  }
71
- function U(e) {
71
+ function A(e) {
72
72
  if (!e && e !== 0) return "-";
73
- const n = Math.floor(e / 1e3), s = Math.floor(n / 60), r = n % 60, a = e % 1e3;
74
- return `${s}:${String(r).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
73
+ const t = Math.floor(e / 1e3), r = Math.floor(t / 60), s = t % 60, a = e % 1e3;
74
+ return `${r}:${String(s).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
75
75
  }
76
- function B(e) {
77
- return !e && e !== 0 ? "-" : e >= 6e4 ? U(e) : (e / 1e3).toFixed(3);
76
+ function P(e) {
77
+ return !e && e !== 0 ? "-" : e >= 6e4 ? A(e) : (e / 1e3).toFixed(3);
78
78
  }
79
- function I(e) {
79
+ function B(e) {
80
80
  if (!e) return "";
81
- let n = e;
82
- return n.startsWith("ks_") && (n = n.slice(3)), n.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
81
+ let t = e;
82
+ return t.startsWith("ks_") && (t = t.slice(3)), t.split("_").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
83
83
  }
84
- function q(e, n, s) {
84
+ function E(e, t, r) {
85
85
  if (!e) return "";
86
- const r = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (n == null ? void 0 : n.toLowerCase()) === "track config";
87
- if (!n || n === "default" || a) return r;
88
- const i = n.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
89
- return `${r} ${i}`;
86
+ const s = e.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = r === "acc" || !r && (t == null ? void 0 : t.toLowerCase()) === "track config";
87
+ if (!t || t === "default" || a) return s;
88
+ const i = t.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
89
+ return `${s} ${i}`;
90
90
  }
91
- function j(e) {
91
+ function _(e) {
92
92
  if (!e) return "-";
93
93
  try {
94
94
  return new Date(e).toLocaleDateString("en-GB", {
@@ -100,25 +100,25 @@ function j(e) {
100
100
  return "-";
101
101
  }
102
102
  }
103
- function ue(e) {
103
+ function ne(e) {
104
104
  if (!e) return "";
105
- const n = Date.now() - new Date(e).getTime(), s = Math.floor(n / 1e3);
106
- if (s < 60) return "Just now";
107
- const r = Math.floor(s / 60);
108
- if (r < 60) return `${r}m ago`;
109
- const a = Math.floor(r / 60);
105
+ const t = Date.now() - new Date(e).getTime(), r = Math.floor(t / 1e3);
106
+ if (r < 60) return "Just now";
107
+ const s = Math.floor(r / 60);
108
+ if (s < 60) return `${s}m ago`;
109
+ const a = Math.floor(s / 60);
110
110
  if (a < 24) return `${a}h ago`;
111
111
  const i = Math.floor(a / 24);
112
- return i < 30 ? `${i}d ago` : j(e);
112
+ return i < 30 ? `${i}d ago` : _(e);
113
113
  }
114
- function sn(e) {
114
+ function ot(e) {
115
115
  return e == null ? "" : `${e >= 0 ? "+" : "-"}${(Math.abs(e) / 1e3).toFixed(3)}`;
116
116
  }
117
- function Oe(e, n) {
118
- const { type: s, title: r, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? q(a, i, d) : null, g = o ? I(o) : null, f = [u, g].filter(Boolean).join(" — ");
119
- return s === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && n ? n(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : s === "RECORD_SET" && f ? `You set a new record on ${f}` : r || "New notification";
117
+ function Oe(e, t) {
118
+ const { type: r, title: s, trackId: a, trackLayout: i, carId: o, game: d, data: p } = e, c = typeof p == "string" ? JSON.parse(p) : p, u = a ? E(a, i, d) : null, x = o ? B(o) : null, f = [u, x].filter(Boolean).join(" — ");
119
+ return r === "RECORD_BEATEN" && f ? `${c != null && c.beatenBySteamId && t ? t(c.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : r === "RECORD_SET" && f ? `You set a new record on ${f}` : s || "New notification";
120
120
  }
121
- function me(e) {
121
+ function xe(e) {
122
122
  return e ? {
123
123
  E: "Eco",
124
124
  RD: "Road",
@@ -132,230 +132,232 @@ function me(e) {
132
132
  S: "Soft"
133
133
  }[e] || e : "Unknown";
134
134
  }
135
- function he(e) {
135
+ function ge(e) {
136
136
  if (!e) return "-";
137
- const n = Number(e);
138
- return isNaN(n) ? "-" : n % 1 ? `${n.toFixed(1)}L` : `${n}L`;
139
- }
140
- function an(e = {}) {
141
- var p, c, u, g, f, m;
142
- const { cdnUrl: n, partnerSlug: s } = C(), { game: r, gameVersion: a } = e, i = X(s, null, null, "index.json"), o = T({
143
- queryKey: ["pitvox", "leaderboards", s, "index"],
144
- queryFn: () => R(n, i),
137
+ const t = Number(e);
138
+ return isNaN(t) ? "-" : t % 1 ? `${t.toFixed(1)}L` : `${t}L`;
139
+ }
140
+ function ze(e = {}) {
141
+ var p, c, u, x, f, h;
142
+ const { cdnUrl: t, partnerSlug: r } = C(), { game: s, gameVersion: a } = e, i = ee(r, null, null, "index.json"), o = T({
143
+ queryKey: ["pitvox", "leaderboards", r, "index"],
144
+ queryFn: () => $(t, i),
145
145
  staleTime: 3e4,
146
146
  refetchInterval: 3e4
147
147
  }), d = S(() => {
148
- var x;
149
- if (!((x = o.data) != null && x.tracks)) return [];
150
- let y = o.data.tracks;
151
- return r && (y = y.filter((v) => v.game === r)), a && (y = y.filter((v) => v.gameVersion === a)), y.map((v) => ({
152
- id: v.trackId,
153
- layout: v.layout,
154
- game: v.game,
155
- gameVersion: v.gameVersion,
156
- displayName: q(v.trackId, v.layout, v.game),
157
- driverCount: v.driverCount || 0,
158
- carCount: v.carCount || 0,
159
- record: v.recordHolder ? {
160
- visibleId: v.recordHolder.steamId || v.recordHolder.userId,
161
- carId: v.recordHolder.carId,
162
- carDisplayName: I(v.recordHolder.carId),
163
- lapTimeMs: v.recordHolder.lapTimeMs,
164
- timestamp: v.recordHolder.recordedAt
148
+ var g;
149
+ if (!((g = o.data) != null && g.tracks)) return [];
150
+ let b = o.data.tracks;
151
+ return s && (b = b.filter((m) => m.game === s)), a && (b = b.filter((m) => m.gameVersion === a)), b.map((m) => ({
152
+ id: m.trackId,
153
+ layout: m.layout,
154
+ game: m.game,
155
+ gameVersion: m.gameVersion,
156
+ displayName: E(m.trackId, m.layout, m.game),
157
+ driverCount: m.driverCount || 0,
158
+ carCount: m.carCount || 0,
159
+ record: m.recordHolder ? {
160
+ visibleId: m.recordHolder.steamId || m.recordHolder.userId,
161
+ carId: m.recordHolder.carId,
162
+ carDisplayName: B(m.recordHolder.carId),
163
+ lapTimeMs: m.recordHolder.lapTimeMs,
164
+ timestamp: m.recordHolder.recordedAt
165
165
  } : null,
166
- recordByTag: v.recordByTag || null
166
+ recordByTag: m.recordByTag || null
167
167
  }));
168
- }, [(p = o.data) == null ? void 0 : p.tracks, r, a]);
168
+ }, [(p = o.data) == null ? void 0 : p.tracks, s, a]);
169
169
  return {
170
170
  ...o,
171
171
  data: d,
172
172
  partner: ((c = o.data) == null ? void 0 : c.partner) || null,
173
173
  generatedAt: (u = o.data) == null ? void 0 : u.generatedAt,
174
- totalLaps: ((g = o.data) == null ? void 0 : g.totalLaps) || 0,
174
+ totalLaps: ((x = o.data) == null ? void 0 : x.totalLaps) || 0,
175
175
  totalUsers: ((f = o.data) == null ? void 0 : f.totalUsers) || 0,
176
- versions: ((m = o.data) == null ? void 0 : m.versions) || {}
176
+ versions: ((h = o.data) == null ? void 0 : h.versions) || {}
177
177
  };
178
178
  }
179
- function We(e, n, s = {}) {
180
- const { cdnUrl: r, partnerSlug: a } = C(), { carId: i, game: o, gameVersion: d } = s, p = n || "default", c = X(a, o, d, `tracks/${e}/${p}.json`), { data: u, isLoading: g, error: f } = T({
179
+ function Qe(e, t, r = {}) {
180
+ const { cdnUrl: s, partnerSlug: a } = C(), { carId: i, game: o, gameVersion: d } = r, p = t || "default", c = ee(a, o, d, `tracks/${e}/${p}.json`), { data: u, isLoading: x, error: f } = T({
181
181
  queryKey: ["pitvox", "leaderboards", a, "track", e, p, o, d],
182
- queryFn: () => R(r, c),
182
+ queryFn: () => $(s, c),
183
183
  enabled: !!e,
184
184
  staleTime: 3e4,
185
185
  refetchInterval: 3e4
186
186
  });
187
187
  return { data: S(() => {
188
188
  if (!(u != null && u.entries)) return [];
189
- let y = u.entries;
190
- if (o && (y = y.filter((x) => x.game === o)), !i) {
191
- const x = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
192
- for (const N of y) {
193
- const h = N.steamId || N.userId;
194
- v.has(N.carId) || v.set(N.carId, /* @__PURE__ */ new Set()), v.get(N.carId).add(h), (!x.has(N.carId) || N.lapTimeMs < x.get(N.carId).lapTimeMs) && x.set(N.carId, N);
189
+ let b = u.entries;
190
+ if (o && (b = b.filter((g) => g.game === o)), !i) {
191
+ const g = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
192
+ for (const N of b) {
193
+ const v = N.steamId || N.userId;
194
+ m.has(N.carId) || m.set(N.carId, /* @__PURE__ */ new Set()), m.get(N.carId).add(v), (!g.has(N.carId) || N.lapTimeMs < g.get(N.carId).lapTimeMs) && g.set(N.carId, N);
195
195
  }
196
- return Array.from(x.values()).map((N) => {
197
- var h;
198
- return { ...N, driverCount: ((h = v.get(N.carId)) == null ? void 0 : h.size) || 0 };
199
- }).sort((N, h) => N.lapTimeMs - h.lapTimeMs);
196
+ return Array.from(g.values()).map((N) => {
197
+ var v;
198
+ return { ...N, driverCount: ((v = m.get(N.carId)) == null ? void 0 : v.size) || 0 };
199
+ }).sort((N, v) => N.lapTimeMs - v.lapTimeMs);
200
200
  }
201
- return y.filter((x) => x.carId === i).sort((x, v) => x.lapTimeMs - v.lapTimeMs);
202
- }, [u == null ? void 0 : u.entries, i, o]), isLoading: g, error: f };
203
- }
204
- function ze(e, n, s, r, a = {}) {
205
- var x, v;
206
- const { cdnUrl: i, partnerSlug: o } = C(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && n ? Ve(o, e, n, s) : null, f = T({
207
- queryKey: ["pitvox", "laps", o, e, n, s || "default"],
208
- queryFn: () => R(i, u),
209
- enabled: !!e && !!n,
201
+ return b.filter((g) => g.carId === i).sort((g, m) => g.lapTimeMs - m.lapTimeMs);
202
+ }, [u == null ? void 0 : u.entries, i, o]), isLoading: x, error: f };
203
+ }
204
+ function Ge(e, t, r, s, a = {}) {
205
+ var g, m;
206
+ const { cdnUrl: i, partnerSlug: o } = C(), { showInvalid: d = !1, game: p, gameVersion: c } = a, u = e && t ? He(o, e, t, r) : null, f = T({
207
+ queryKey: ["pitvox", "laps", o, e, t, r || "default"],
208
+ queryFn: () => $(i, u),
209
+ enabled: !!e && !!t,
210
210
  staleTime: 3e4,
211
211
  refetchInterval: 3e4
212
- }), m = S(() => {
212
+ }), h = S(() => {
213
213
  var N;
214
- return (N = f.data) != null && N.laps ? f.data.laps.filter((h) => !(h.carId !== r || p && h.game !== p || c && h.gameVersion !== c || !d && !h.isValid)).sort((h, w) => h.lapTimeMs - w.lapTimeMs) : [];
215
- }, [(x = f.data) == null ? void 0 : x.laps, r, p, c, d]), y = S(() => {
216
- const N = m.filter((k) => k.isValid && k.sector1Ms && k.sector2Ms && k.sector3Ms);
214
+ return (N = f.data) != null && N.laps ? f.data.laps.filter((v) => !(v.carId !== s || p && v.game !== p || c && v.gameVersion !== c || !d && !v.isValid)).sort((v, k) => v.lapTimeMs - k.lapTimeMs) : [];
215
+ }, [(g = f.data) == null ? void 0 : g.laps, s, p, c, d]), b = S(() => {
216
+ const N = h.filter((w) => w.isValid && w.sector1Ms && w.sector2Ms && w.sector3Ms);
217
217
  if (N.length < 2) return null;
218
- const h = Math.min(...N.map((k) => k.sector1Ms)), w = Math.min(...N.map((k) => k.sector2Ms)), b = Math.min(...N.map((k) => k.sector3Ms)), L = h + w + b, M = Math.min(...N.map((k) => k.lapTimeMs));
219
- return L >= M ? null : { lapTimeMs: L, sector1Ms: h, sector2Ms: w, sector3Ms: b };
220
- }, [m]);
218
+ const v = Math.min(...N.map((w) => w.sector1Ms)), k = Math.min(...N.map((w) => w.sector2Ms)), y = Math.min(...N.map((w) => w.sector3Ms)), L = v + k + y, D = Math.min(...N.map((w) => w.lapTimeMs));
219
+ return L >= D ? null : { lapTimeMs: L, sector1Ms: v, sector2Ms: k, sector3Ms: y };
220
+ }, [h]);
221
221
  return {
222
222
  ...f,
223
- data: m,
224
- driverName: ((v = f.data) == null ? void 0 : v.driverName) || "Driver",
225
- theoreticalBest: y
223
+ data: h,
224
+ driverName: ((m = f.data) == null ? void 0 : m.driverName) || "Driver",
225
+ theoreticalBest: b
226
226
  };
227
227
  }
228
- function ve() {
229
- const { cdnUrl: e } = C(), { data: n } = T({
228
+ function fe() {
229
+ const { cdnUrl: e } = C(), { data: t } = T({
230
230
  queryKey: ["pitvox", "users", "index"],
231
- queryFn: () => R(e, "users/index.json"),
231
+ queryFn: () => $(e, "users/index.json"),
232
232
  staleTime: 5 * 6e4,
233
233
  gcTime: 30 * 6e4
234
- }), s = (n == null ? void 0 : n.users) || {};
235
- return (r, a) => {
236
- const i = s[r];
234
+ }), r = (t == null ? void 0 : t.users) || {};
235
+ return (s, a) => {
236
+ const i = r[s];
237
237
  return {
238
- displayName: (i == null ? void 0 : i.displayName) || a || r || "Unknown",
238
+ displayName: (i == null ? void 0 : i.displayName) || a || s || "Unknown",
239
239
  avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
240
240
  affiliations: (i == null ? void 0 : i.affiliations) || []
241
241
  };
242
242
  };
243
243
  }
244
- function on() {
245
- const { cdnUrl: e } = C(), { data: n } = T({
246
- queryKey: ["pitvox", "cars", "evo"],
247
- queryFn: () => R(e, "cars/evo.json"),
244
+ function lt(e = "evo") {
245
+ const { cdnUrl: t } = C(), { data: r } = T({
246
+ queryKey: ["pitvox", "cars", e],
247
+ queryFn: () => $(t, `cars/${e}.json`),
248
248
  staleTime: 5 * 6e4,
249
249
  gcTime: 30 * 6e4
250
250
  });
251
251
  return {
252
- tags: (n == null ? void 0 : n.tags) || [],
253
- cars: (n == null ? void 0 : n.cars) || {}
252
+ tags: (r == null ? void 0 : r.tags) || [],
253
+ cars: (r == null ? void 0 : r.cars) || {},
254
+ categories: (r == null ? void 0 : r.categories) || [],
255
+ tagLabels: (r == null ? void 0 : r.tagLabels) || {}
254
256
  };
255
257
  }
256
- function ln() {
258
+ function ct() {
257
259
  var a, i;
258
- const { cdnUrl: e, partnerSlug: n } = C(), s = He(n), r = T({
259
- queryKey: ["pitvox", "recentLaps", n],
260
- queryFn: () => R(e, s),
260
+ const { cdnUrl: e, partnerSlug: t } = C(), r = We(t), s = T({
261
+ queryKey: ["pitvox", "recentLaps", t],
262
+ queryFn: () => $(e, r),
261
263
  staleTime: 3e4,
262
264
  refetchInterval: 3e4,
263
265
  gcTime: 10 * 6e4
264
266
  });
265
267
  return {
266
- groups: ((a = r.data) == null ? void 0 : a.groups) || [],
267
- generatedAt: ((i = r.data) == null ? void 0 : i.generatedAt) || null,
268
- isLoading: r.isLoading
268
+ groups: ((a = s.data) == null ? void 0 : a.groups) || [],
269
+ generatedAt: ((i = s.data) == null ? void 0 : i.generatedAt) || null,
270
+ isLoading: s.isLoading
269
271
  };
270
272
  }
271
- function cn(e, n) {
272
- return We(e, null, { carId: n });
273
+ function dt(e, t) {
274
+ return Qe(e, null, { carId: t });
273
275
  }
274
- function dn() {
275
- const { cdnUrl: e, partnerSlug: n } = C();
276
+ function pt() {
277
+ const { cdnUrl: e, partnerSlug: t } = C();
276
278
  return T({
277
- queryKey: ["pitvox", "competitions", n],
279
+ queryKey: ["pitvox", "competitions", t],
278
280
  queryFn: async () => {
279
- const s = await R(e, "competitions/index.json");
280
- return s != null && s.competitions ? n ? s.competitions.filter((r) => r.partnerSlug === n) : s.competitions : [];
281
+ const r = await $(e, "competitions/index.json");
282
+ return r != null && r.competitions ? t ? r.competitions.filter((s) => s.partnerSlug === t) : r.competitions : [];
281
283
  },
282
284
  staleTime: 6e4
283
285
  });
284
286
  }
285
- function xe(e, n = {}) {
286
- const s = C(), r = n.partnerSlug || s.partnerSlug;
287
+ function Ne(e, t = {}) {
288
+ const r = C(), s = t.partnerSlug || r.partnerSlug;
287
289
  return T({
288
- queryKey: ["pitvox", "competition", r, e, "config"],
289
- queryFn: () => R(s.cdnUrl, `competitions/${r}/${e}/config.json`),
290
- enabled: !!r && !!e,
290
+ queryKey: ["pitvox", "competition", s, e, "config"],
291
+ queryFn: () => $(r.cdnUrl, `competitions/${s}/${e}/config.json`),
292
+ enabled: !!s && !!e,
291
293
  staleTime: 6e4
292
294
  });
293
295
  }
294
- function ge(e, n = {}) {
295
- const s = C(), r = n.partnerSlug || s.partnerSlug;
296
+ function be(e, t = {}) {
297
+ const r = C(), s = t.partnerSlug || r.partnerSlug;
296
298
  return T({
297
- queryKey: ["pitvox", "competition", r, e, "standings"],
298
- queryFn: () => R(s.cdnUrl, `competitions/${r}/${e}/standings.json`),
299
- enabled: !!r && !!e,
299
+ queryKey: ["pitvox", "competition", s, e, "standings"],
300
+ queryFn: () => $(r.cdnUrl, `competitions/${s}/${e}/standings.json`),
301
+ enabled: !!s && !!e,
300
302
  staleTime: 6e4
301
303
  });
302
304
  }
303
- function Ge(e, n, s = {}) {
304
- const r = C(), a = s.partnerSlug || r.partnerSlug;
305
+ function Ye(e, t, r = {}) {
306
+ const s = C(), a = r.partnerSlug || s.partnerSlug;
305
307
  return T({
306
- queryKey: ["pitvox", "competition", a, e, "round", n],
307
- queryFn: () => R(r.cdnUrl, `competitions/${a}/${e}/rounds/${n}.json`),
308
- enabled: !!a && !!e && n != null,
308
+ queryKey: ["pitvox", "competition", a, e, "round", t],
309
+ queryFn: () => $(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}.json`),
310
+ enabled: !!a && !!e && t != null,
309
311
  staleTime: 6e4
310
312
  });
311
313
  }
312
- function Qe(e, n = [], s = {}) {
313
- const r = C(), a = s.partnerSlug || r.partnerSlug;
314
+ function Je(e, t = [], r = {}) {
315
+ const s = C(), a = r.partnerSlug || s.partnerSlug;
314
316
  return T({
315
- queryKey: ["pitvox", "competition", a, e, "allRounds", n],
317
+ queryKey: ["pitvox", "competition", a, e, "allRounds", t],
316
318
  queryFn: async () => (await Promise.all(
317
- n.map(
318
- (o) => R(r.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
319
+ t.map(
320
+ (o) => $(s.cdnUrl, `competitions/${a}/${e}/rounds/${o}.json`).catch(() => null)
319
321
  )
320
322
  )).filter(Boolean),
321
- enabled: !!a && !!e && n.length > 0,
323
+ enabled: !!a && !!e && t.length > 0,
322
324
  staleTime: 6e4
323
325
  });
324
326
  }
325
- function Ye(e, n = {}) {
326
- const s = C(), r = n.partnerSlug || s.partnerSlug;
327
+ function Ze(e, t = {}) {
328
+ const r = C(), s = t.partnerSlug || r.partnerSlug;
327
329
  return T({
328
- queryKey: ["pitvox", "competition", r, e, "leaderboard"],
329
- queryFn: () => R(s.cdnUrl, `competitions/${r}/${e}/leaderboard.json`).catch(() => null),
330
- enabled: !!r && !!e,
330
+ queryKey: ["pitvox", "competition", s, e, "leaderboard"],
331
+ queryFn: () => $(r.cdnUrl, `competitions/${s}/${e}/leaderboard.json`).catch(() => null),
332
+ enabled: !!s && !!e,
331
333
  staleTime: 6e4
332
334
  });
333
335
  }
334
- function Je(e, n, s = {}) {
335
- const r = C(), a = s.partnerSlug || r.partnerSlug;
336
+ function Xe(e, t, r = {}) {
337
+ const s = C(), a = r.partnerSlug || s.partnerSlug;
336
338
  return T({
337
- queryKey: ["pitvox", "competition", a, e, "round", n, "laps"],
338
- queryFn: () => R(r.cdnUrl, `competitions/${a}/${e}/rounds/${n}/laps.json`).catch(() => null),
339
- enabled: !!a && !!e && n != null,
339
+ queryKey: ["pitvox", "competition", a, e, "round", t, "laps"],
340
+ queryFn: () => $(s.cdnUrl, `competitions/${a}/${e}/rounds/${t}/laps.json`).catch(() => null),
341
+ enabled: !!a && !!e && t != null,
340
342
  staleTime: 6e4
341
343
  });
342
344
  }
343
- function fe(e, n = {}) {
344
- const s = C(), r = n.partnerSlug || s.partnerSlug;
345
+ function ye(e, t = {}) {
346
+ const r = C(), s = t.partnerSlug || r.partnerSlug;
345
347
  return T({
346
- queryKey: ["pitvox", "competition", r, e, "entrylist"],
347
- queryFn: () => R(s.cdnUrl, `competitions/${r}/${e}/entrylist.json`),
348
- enabled: !!r && !!e,
348
+ queryKey: ["pitvox", "competition", s, e, "entrylist"],
349
+ queryFn: () => $(r.cdnUrl, `competitions/${s}/${e}/entrylist.json`),
350
+ enabled: !!s && !!e,
349
351
  staleTime: 6e4
350
352
  });
351
353
  }
352
- function ee(e) {
353
- const { cdnUrl: n, partnerSlug: s, getSteamId: r } = C(), a = r();
354
+ function te(e) {
355
+ const { cdnUrl: t, partnerSlug: r, getSteamId: s } = C(), a = s();
354
356
  return T({
355
- queryKey: ["pitvox", "registration", s, e, a],
357
+ queryKey: ["pitvox", "registration", r, e, a],
356
358
  queryFn: async () => {
357
359
  var p;
358
- const i = await fetch(`${n}/competitions/${s}/${e}/entrylist.json`);
360
+ const i = await fetch(`${t}/competitions/${r}/${e}/entrylist.json`);
359
361
  if (!i.ok) return { isRegistered: !1, entryList: null };
360
362
  const o = await i.json();
361
363
  return { isRegistered: !!a && ((p = o.drivers) == null ? void 0 : p.some((c) => c.steamId === a)), entryList: o };
@@ -364,20 +366,20 @@ function ee(e) {
364
366
  staleTime: 6e4
365
367
  });
366
368
  }
367
- function Ne(e) {
368
- const { onRegister: n, partnerSlug: s, getSteamId: r } = C(), a = _(), i = ve();
369
- return O({
369
+ function ke(e) {
370
+ const { onRegister: t, partnerSlug: r, getSteamId: s } = C(), a = j(), i = fe();
371
+ return W({
370
372
  mutationFn: (o) => {
371
- if (!n)
373
+ if (!t)
372
374
  throw new Error(
373
375
  "No onRegister callback provided to PitVoxPartnerProvider. Provide onRegister for in-app registration, or use useRegistrationUrl() to link to pitvox.com."
374
376
  );
375
- return n(e, o);
377
+ return t(e, o);
376
378
  },
377
379
  onSuccess: () => {
378
- const o = r();
380
+ const o = s();
379
381
  if (a.setQueriesData(
380
- { queryKey: ["pitvox", "registration", s, e] },
382
+ { queryKey: ["pitvox", "registration", r, e] },
381
383
  (d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
382
384
  ), o) {
383
385
  const d = i(o), p = {
@@ -386,413 +388,408 @@ function Ne(e) {
386
388
  avatarUrl: d.avatarUrl
387
389
  };
388
390
  a.setQueriesData(
389
- { queryKey: ["pitvox", "competition", s, e, "entrylist"] },
391
+ { queryKey: ["pitvox", "competition", r, e, "entrylist"] },
390
392
  (c) => {
391
- var g;
392
- return c ? ((g = c.drivers) == null ? void 0 : g.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
393
+ var x;
394
+ return c ? ((x = c.drivers) == null ? void 0 : x.some((f) => f.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], p] } : { drivers: [p] };
393
395
  }
394
396
  );
395
397
  }
396
398
  }
397
399
  });
398
400
  }
399
- function be(e) {
400
- const { onWithdraw: n, partnerSlug: s, getSteamId: r } = C(), a = _();
401
- return O({
401
+ function we(e) {
402
+ const { onWithdraw: t, partnerSlug: r, getSteamId: s } = C(), a = j();
403
+ return W({
402
404
  mutationFn: (i) => {
403
- if (!n)
405
+ if (!t)
404
406
  throw new Error(
405
407
  "No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
406
408
  );
407
- const o = i || r();
409
+ const o = i || s();
408
410
  if (!o) throw new Error("No Steam ID available");
409
- return n(e, o);
411
+ return t(e, o);
410
412
  },
411
413
  onSuccess: () => {
412
- const i = r();
414
+ const i = s();
413
415
  a.setQueriesData(
414
- { queryKey: ["pitvox", "registration", s, e] },
416
+ { queryKey: ["pitvox", "registration", r, e] },
415
417
  (o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
416
418
  ), i && a.setQueriesData(
417
- { queryKey: ["pitvox", "competition", s, e, "entrylist"] },
419
+ { queryKey: ["pitvox", "competition", r, e, "entrylist"] },
418
420
  (o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
419
421
  );
420
422
  }
421
423
  });
422
424
  }
423
- function te() {
424
- const { onRegister: e, onWithdraw: n } = C(), s = !!(e && n);
425
- return { isPowerMode: s, isBasicMode: !s };
425
+ function re() {
426
+ const { onRegister: e, onWithdraw: t } = C(), r = !!(e && t);
427
+ return { isPowerMode: r, isBasicMode: !r };
426
428
  }
427
- function ne(e) {
428
- const { pitvoxUrl: n, partnerSlug: s } = C();
429
- return `${n}/p/${s}/competitions/${e}/register`;
430
- }
431
- const Ze = {
432
- formula: "Formula",
433
- gt3: "GT3",
434
- gt2: "GT2",
435
- gt4: "GT4",
436
- cup: "Cup",
437
- prototype: "Prototype",
438
- rally: "Rally",
439
- hypercar: "Hypercar",
440
- supercar: "Supercar",
441
- sports_car: "Sports Car",
442
- hot_hatch: "Hot Hatch",
443
- lightweight: "Lightweight",
444
- "1960s": "1960s",
445
- "1970s": "1970s",
446
- "1980s": "1980s",
447
- "1990s": "1990s",
448
- "2000s": "2000s",
449
- "2010s": "2010s",
450
- "2020s": "2020s"
451
- }, ye = [
452
- { id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
453
- { id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
454
- { id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
455
- ];
456
- function Xe(e) {
457
- for (const n of ye)
458
- if (n.tags.includes(e)) return n.id;
429
+ function se(e) {
430
+ const { pitvoxUrl: t, partnerSlug: r } = C();
431
+ return `${t}/p/${r}/competitions/${e}/register`;
432
+ }
433
+ function en(e, t) {
434
+ for (const r of t)
435
+ if (r.tags.includes(e)) return r.id;
459
436
  return "other";
460
437
  }
461
- function we(e, n) {
462
- if (n.size === 0) return !0;
438
+ function Ce(e, t, r = []) {
439
+ if (t.size === 0) return !0;
463
440
  const s = {};
464
- for (const r of n) {
465
- const a = Xe(r);
466
- s[a] || (s[a] = []), s[a].push(r);
441
+ for (const a of t) {
442
+ const i = en(a, r);
443
+ s[i] || (s[i] = []), s[i].push(a);
467
444
  }
468
- for (const r of Object.values(s))
469
- if (!r.some((a) => e.includes(a))) return !1;
445
+ for (const a of Object.values(s))
446
+ if (!a.some((i) => e.includes(i))) return !1;
470
447
  return !0;
471
448
  }
472
- function ke(e, n) {
473
- const [s, r] = D(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : s, o = H((p) => {
449
+ function Le(e, t) {
450
+ const [r, s] = M(/* @__PURE__ */ new Set()), a = e !== void 0, i = a ? e : r, o = H((p) => {
474
451
  const c = new Set(i);
475
- c.has(p) ? c.delete(p) : c.add(p), a && n ? n(c) : r(c);
476
- }, [i, a, n]), d = H(() => {
477
- a && n ? n(/* @__PURE__ */ new Set()) : r(/* @__PURE__ */ new Set());
478
- }, [a, n]);
452
+ c.has(p) ? c.delete(p) : c.add(p), a && t ? t(c) : s(c);
453
+ }, [i, a, t]), d = H(() => {
454
+ a && t ? t(/* @__PURE__ */ new Set()) : s(/* @__PURE__ */ new Set());
455
+ }, [a, t]);
479
456
  return { activeTags: i, toggle: o, clear: d };
480
457
  }
481
- function W(e) {
482
- const [n, s] = D(e), r = H((a) => {
483
- s(
458
+ function O(e) {
459
+ const [t, r] = M(e), s = H((a) => {
460
+ r(
484
461
  (i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
485
462
  );
486
463
  }, []);
487
- return [n, r];
464
+ return [t, s];
488
465
  }
489
- function z(e, n, s) {
490
- return [...e].sort((r, a) => {
491
- const i = s(r, n.key), o = s(a, n.key);
466
+ function z(e, t, r) {
467
+ return [...e].sort((s, a) => {
468
+ const i = r(s, t.key), o = r(a, t.key);
492
469
  if (i == null && o == null) return 0;
493
470
  if (i == null) return 1;
494
471
  if (o == null) return -1;
495
472
  const d = typeof i == "string" ? i.localeCompare(o) : i - o;
496
- return n.dir === "desc" ? -d : d;
473
+ return t.dir === "desc" ? -d : d;
497
474
  });
498
475
  }
499
- function Ce(e, n = !1) {
500
- const s = n ? e == null ? void 0 : e.filter((r) => r.isValid) : e;
501
- return s != null && s.length ? {
502
- s1: Math.min(...s.map((r) => r.sector1Ms).filter(Boolean)),
503
- s2: Math.min(...s.map((r) => r.sector2Ms).filter(Boolean)),
504
- s3: Math.min(...s.map((r) => r.sector3Ms).filter(Boolean))
476
+ function Se(e, t = !1) {
477
+ const r = t ? e == null ? void 0 : e.filter((s) => s.isValid) : e;
478
+ return r != null && r.length ? {
479
+ s1: Math.min(...r.map((s) => s.sector1Ms).filter(Boolean)),
480
+ s2: Math.min(...r.map((s) => s.sector2Ms).filter(Boolean)),
481
+ s3: Math.min(...r.map((s) => s.sector3Ms).filter(Boolean))
505
482
  } : null;
506
483
  }
507
- function et({ active: e, dir: n }) {
508
- return e ? n === "asc" ? /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ t("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
484
+ function nn({ active: e, dir: t }) {
485
+ return e ? t === "asc" ? /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ n("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
509
486
  }
510
- function $({ label: e, sortKey: n, config: s, onSort: r, className: a = "" }) {
511
- return /* @__PURE__ */ t(
487
+ function R({ label: e, sortKey: t, config: r, onSort: s, className: a = "" }) {
488
+ return /* @__PURE__ */ n(
512
489
  "th",
513
490
  {
514
491
  className: `pvx-th pvx-th--sortable ${a}`,
515
- onClick: () => r(n),
492
+ onClick: () => s(t),
516
493
  children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
517
494
  e,
518
- /* @__PURE__ */ t(et, { active: s.key === n, dir: s.dir })
495
+ /* @__PURE__ */ n(nn, { active: r.key === t, dir: r.dir })
519
496
  ] })
520
497
  }
521
498
  );
522
499
  }
523
- function G({ userId: e, getUserDisplay: n }) {
524
- const { displayName: s, avatarUrl: r } = n(e);
500
+ function Q({ userId: e, getUserDisplay: t }) {
501
+ const { displayName: r, avatarUrl: s } = t(e);
525
502
  return /* @__PURE__ */ l("span", { className: "pvx-driver", children: [
526
- r ? /* @__PURE__ */ t("img", { src: r, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
527
- /* @__PURE__ */ t("span", { className: "pvx-driver-name", children: s })
503
+ s ? /* @__PURE__ */ n("img", { src: s, alt: "", className: "pvx-driver-avatar" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--placeholder" }),
504
+ /* @__PURE__ */ n("span", { className: "pvx-driver-name", children: r })
528
505
  ] });
529
506
  }
530
- function re({ rank: e, podium: n = !1 }) {
531
- return /* @__PURE__ */ t("span", { className: n ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
507
+ function ae({ rank: e, podium: t = !1 }) {
508
+ return /* @__PURE__ */ n("span", { className: t ? e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: e });
532
509
  }
533
- function Le({ availableTags: e, activeTags: n, onToggle: s, onClear: r }) {
510
+ function Te({ availableTags: e, activeTags: t, onToggle: r, onClear: s, categories: a = [], tagLabels: i = {} }) {
534
511
  if (!e || e.length < 2) return null;
535
- const a = ye.map((i) => ({ id: i.id, tags: i.tags.filter((o) => e.includes(o)) })).filter((i) => i.tags.length > 0);
512
+ const o = a.map((d) => ({ id: d.id, tags: d.tags.filter((p) => e.includes(p)) })).filter((d) => d.tags.length > 0);
536
513
  return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
537
- /* @__PURE__ */ t(
514
+ /* @__PURE__ */ n(
538
515
  "button",
539
516
  {
540
- onClick: r,
541
- className: `pvx-tag ${n.size === 0 ? "pvx-tag--active" : ""}`,
517
+ onClick: s,
518
+ className: `pvx-tag ${t.size === 0 ? "pvx-tag--active" : ""}`,
542
519
  children: "All"
543
520
  }
544
521
  ),
545
- a.map((i, o) => /* @__PURE__ */ l("span", { className: "contents", children: [
546
- o > 0 && /* @__PURE__ */ t("span", { className: "pvx-tag-separator" }),
547
- i.tags.map((d) => /* @__PURE__ */ t(
522
+ o.map((d, p) => /* @__PURE__ */ l("span", { className: "contents", children: [
523
+ p > 0 && /* @__PURE__ */ n("span", { className: "pvx-tag-separator" }),
524
+ d.tags.map((c) => /* @__PURE__ */ n(
548
525
  "button",
549
526
  {
550
- onClick: () => s(d),
551
- className: `pvx-tag ${n.has(d) ? "pvx-tag--active" : ""}`,
552
- children: Ze[d] || d
527
+ onClick: () => r(c),
528
+ className: `pvx-tag ${t.has(c) ? "pvx-tag--active" : ""}`,
529
+ children: i[c] || c
553
530
  },
554
- d
531
+ c
555
532
  ))
556
- ] }, i.id))
533
+ ] }, d.id))
557
534
  ] });
558
535
  }
559
- function se({ segments: e }) {
560
- return /* @__PURE__ */ t("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ t("ol", { className: "pvx-breadcrumb-list", children: e.map((n, s) => {
561
- const r = s === e.length - 1;
536
+ function ie({ segments: e }) {
537
+ return /* @__PURE__ */ n("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "pvx-breadcrumb-list", children: e.map((t, r) => {
538
+ const s = r === e.length - 1;
562
539
  return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
563
- s > 0 && /* @__PURE__ */ t("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
564
- !r && n.onClick ? /* @__PURE__ */ t("button", { onClick: n.onClick, className: "pvx-breadcrumb-link", children: n.label }) : /* @__PURE__ */ t("span", { className: "pvx-breadcrumb-current", children: n.label })
565
- ] }, n.key);
540
+ r > 0 && /* @__PURE__ */ n("svg", { className: "pvx-breadcrumb-chevron", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }),
541
+ !s && t.onClick ? /* @__PURE__ */ n("button", { onClick: t.onClick, className: "pvx-breadcrumb-link", children: t.label }) : /* @__PURE__ */ n("span", { className: "pvx-breadcrumb-current", children: t.label })
542
+ ] }, t.key);
566
543
  }) }) });
567
544
  }
568
545
  function V({ message: e }) {
569
546
  return /* @__PURE__ */ l("div", { className: "pvx-empty", children: [
570
- /* @__PURE__ */ t("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ t("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" }) }),
571
- /* @__PURE__ */ t("p", { children: e })
547
+ /* @__PURE__ */ n("svg", { className: "pvx-empty-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("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" }) }),
548
+ /* @__PURE__ */ n("p", { children: e })
572
549
  ] });
573
550
  }
574
551
  function K() {
575
- return /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading..." });
552
+ return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading..." });
576
553
  }
577
- function tt() {
578
- return /* @__PURE__ */ t("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
554
+ function tn() {
555
+ return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
579
556
  }
580
- function nt() {
581
- return /* @__PURE__ */ t("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
557
+ function rn() {
558
+ return /* @__PURE__ */ n("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
582
559
  }
583
- function pn({ tracks: e, isLoading: n, carMetadata: s, getUserDisplay: r, onTrackSelect: a, tags: i, onTagChange: o }) {
584
- const [d, p] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: g } = ke(i, o), f = S(() => {
585
- var v;
586
- if (!((v = s == null ? void 0 : s.tags) != null && v.length)) return [];
587
- const x = /* @__PURE__ */ new Set();
560
+ function ut({ tracks: e, isLoading: t, carMetadata: r, getUserDisplay: s, onTrackSelect: a, tags: i, onTagChange: o }) {
561
+ const [d, p] = O({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: u, clear: x } = Le(i, o), f = S(() => {
562
+ var m;
563
+ if (!((m = r == null ? void 0 : r.tags) != null && m.length)) return [];
564
+ const g = /* @__PURE__ */ new Set();
588
565
  for (const N of e || [])
589
- N.recordByTag && Object.keys(N.recordByTag).forEach((h) => x.add(h));
590
- return s.tags.filter((N) => x.has(N));
591
- }, [e, s]), m = S(() => e ? c.size === 0 ? e : e.map((x) => {
592
- var h, w;
593
- if (!x.recordByTag) return null;
594
- let v = null;
566
+ N.recordByTag && Object.keys(N.recordByTag).forEach((v) => g.add(v));
567
+ return r.tags.filter((N) => g.has(N));
568
+ }, [e, r]), h = S(() => e ? c.size === 0 ? e : e.map((g) => {
569
+ var v, k;
570
+ if (!g.recordByTag) return null;
571
+ let m = null;
595
572
  const N = /* @__PURE__ */ new Set();
596
- for (const b of Object.values(x.recordByTag)) {
597
- if (N.has(b.carId)) continue;
598
- N.add(b.carId);
599
- const L = ((w = (h = s == null ? void 0 : s.cars) == null ? void 0 : h[b.carId]) == null ? void 0 : w.tags) || ["sports_car"];
600
- we(L, c) && (!v || b.lapTimeMs < v.lapTimeMs) && (v = b);
573
+ for (const y of Object.values(g.recordByTag)) {
574
+ if (N.has(y.carId)) continue;
575
+ N.add(y.carId);
576
+ const L = ((k = (v = r == null ? void 0 : r.cars) == null ? void 0 : v[y.carId]) == null ? void 0 : k.tags) || [];
577
+ Ce(L, c, r == null ? void 0 : r.categories) && (!m || y.lapTimeMs < m.lapTimeMs) && (m = y);
601
578
  }
602
- return v ? {
603
- ...x,
579
+ return m ? {
580
+ ...g,
604
581
  record: {
605
- visibleId: v.steamId || v.identifier,
606
- carId: v.carId,
607
- carDisplayName: I(v.carId),
608
- lapTimeMs: v.lapTimeMs,
609
- timestamp: v.recordedAt
582
+ visibleId: m.steamId || m.identifier,
583
+ carId: m.carId,
584
+ carDisplayName: B(m.carId),
585
+ lapTimeMs: m.lapTimeMs,
586
+ timestamp: m.recordedAt
610
587
  }
611
588
  } : null;
612
- }).filter(Boolean) : [], [e, c, s]), y = S(() => z(m, d, (x, v) => {
613
- var N, h;
614
- switch (v) {
589
+ }).filter(Boolean) : [], [e, c, r]), b = S(() => z(h, d, (g, m) => {
590
+ var N, v;
591
+ switch (m) {
615
592
  case "displayName":
616
- return x.displayName;
593
+ return g.displayName;
617
594
  case "record.lapTimeMs":
618
- return (N = x.record) == null ? void 0 : N.lapTimeMs;
595
+ return (N = g.record) == null ? void 0 : N.lapTimeMs;
619
596
  case "driverCount":
620
- return x.driverCount || 0;
597
+ return g.driverCount || 0;
621
598
  case "carCount":
622
- return x.carCount || 0;
599
+ return g.carCount || 0;
623
600
  case "record.timestamp":
624
601
  default:
625
- return (h = x.record) != null && h.timestamp ? new Date(x.record.timestamp).getTime() : 0;
602
+ return (v = g.record) != null && v.timestamp ? new Date(g.record.timestamp).getTime() : 0;
626
603
  }
627
- }), [m, d]);
628
- return n ? /* @__PURE__ */ t(K, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
629
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t("h2", { className: "pvx-card-title", children: "Track Records" }) }),
630
- /* @__PURE__ */ t(Le, { availableTags: f, activeTags: c, onToggle: u, onClear: g }),
631
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
632
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
633
- /* @__PURE__ */ t($, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
634
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Record Holder" }),
635
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
636
- /* @__PURE__ */ t($, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
637
- /* @__PURE__ */ t($, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
638
- /* @__PURE__ */ t($, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
639
- /* @__PURE__ */ t($, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
604
+ }), [h, d]);
605
+ return t ? /* @__PURE__ */ n(K, {}) : e != null && e.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
606
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Track Records" }) }),
607
+ /* @__PURE__ */ n(
608
+ Te,
609
+ {
610
+ availableTags: f,
611
+ activeTags: c,
612
+ onToggle: u,
613
+ onClear: x,
614
+ categories: r == null ? void 0 : r.categories,
615
+ tagLabels: r == null ? void 0 : r.tagLabels
616
+ }
617
+ ),
618
+ /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
619
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
620
+ /* @__PURE__ */ n(R, { label: "Track", sortKey: "displayName", config: d, onSort: p }),
621
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
622
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
623
+ /* @__PURE__ */ n(R, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: p }),
624
+ /* @__PURE__ */ n(R, { label: "Drivers", sortKey: "driverCount", config: d, onSort: p, className: "pvx-hidden-below-md" }),
625
+ /* @__PURE__ */ n(R, { label: "Cars", sortKey: "carCount", config: d, onSort: p, className: "pvx-hidden-below-lg" }),
626
+ /* @__PURE__ */ n(R, { label: "Date", sortKey: "record.timestamp", config: d, onSort: p, className: "pvx-hidden-below-xl" })
640
627
  ] }) }),
641
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: y.map((x) => {
642
- var v, N, h;
628
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: b.map((g) => {
629
+ var m, N, v;
643
630
  return /* @__PURE__ */ l(
644
631
  "tr",
645
632
  {
646
633
  className: "pvx-row pvx-row--clickable",
647
- onClick: () => a(x.id, x.layout),
634
+ onClick: () => a(g.id, g.layout),
648
635
  children: [
649
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
650
- /* @__PURE__ */ t("td", { className: "pvx-td", children: (v = x.record) != null && v.visibleId ? /* @__PURE__ */ t(G, { userId: x.record.visibleId, getUserDisplay: r }) : "-" }),
651
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
652
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? U(x.record.lapTimeMs) : "-" }),
653
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
654
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
655
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (h = x.record) != null && h.timestamp ? j(x.record.timestamp) : "-" })
636
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: g.displayName }),
637
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: (m = g.record) != null && m.visibleId ? /* @__PURE__ */ n(Q, { userId: g.record.visibleId, getUserDisplay: s }) : "-" }),
638
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = g.record) == null ? void 0 : N.carDisplayName) || "-" }),
639
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: g.record ? A(g.record.lapTimeMs) : "-" }),
640
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: g.driverCount || "-" }),
641
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: g.carCount || "-" }),
642
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (v = g.record) != null && v.timestamp ? _(g.record.timestamp) : "-" })
656
643
  ]
657
644
  },
658
- `${x.id}|${x.layout || ""}`
645
+ `${g.id}|${g.layout || ""}`
659
646
  );
660
647
  }) })
661
648
  ] }) })
662
- ] }) : /* @__PURE__ */ t(V, { message: "No lap times recorded yet." });
663
- }
664
- function un({ entries: e, isLoading: n, track: s, carMetadata: r, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
665
- const [c, u] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: g, toggle: f, clear: m } = ke(d, p), y = S(() => {
666
- var w, b, L;
667
- if (!e || !((w = r == null ? void 0 : r.tags) != null && w.length)) return [];
668
- const h = /* @__PURE__ */ new Set();
669
- for (const M of e)
670
- (((L = (b = r.cars) == null ? void 0 : b[M.carId]) == null ? void 0 : L.tags) || ["sports_car"]).forEach((A) => h.add(A));
671
- return r.tags.filter((M) => h.has(M));
672
- }, [e, r]), x = S(() => e ? g.size === 0 ? e : e.filter((h) => {
673
- var b, L;
674
- const w = ((L = (b = r == null ? void 0 : r.cars) == null ? void 0 : b[h.carId]) == null ? void 0 : L.tags) || ["sports_car"];
675
- return we(w, g);
676
- }) : [], [e, g, r]), v = S(() => z(x, c, (h, w) => {
677
- switch (w) {
649
+ ] }) : /* @__PURE__ */ n(V, { message: "No lap times recorded yet." });
650
+ }
651
+ function ht({ entries: e, isLoading: t, track: r, carMetadata: s, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: p }) {
652
+ const [c, u] = O({ key: "lapTimeMs", dir: "asc" }), { activeTags: x, toggle: f, clear: h } = Le(d, p), b = S(() => {
653
+ var k, y, L;
654
+ if (!e || !((k = s == null ? void 0 : s.tags) != null && k.length)) return [];
655
+ const v = /* @__PURE__ */ new Set();
656
+ for (const D of e)
657
+ (((L = (y = s.cars) == null ? void 0 : y[D.carId]) == null ? void 0 : L.tags) || []).forEach((U) => v.add(U));
658
+ return s.tags.filter((D) => v.has(D));
659
+ }, [e, s]), g = S(() => e ? x.size === 0 ? e : e.filter((v) => {
660
+ var y, L;
661
+ const k = ((L = (y = s == null ? void 0 : s.cars) == null ? void 0 : y[v.carId]) == null ? void 0 : L.tags) || [];
662
+ return Ce(k, x, s == null ? void 0 : s.categories);
663
+ }) : [], [e, x, s]), m = S(() => z(g, c, (v, k) => {
664
+ switch (k) {
678
665
  case "carId":
679
- return I(h.carId);
666
+ return B(v.carId);
680
667
  case "driverCount":
681
- return h.driverCount || 0;
668
+ return v.driverCount || 0;
682
669
  case "lapTimeMs":
683
670
  default:
684
- return h.lapTimeMs;
671
+ return v.lapTimeMs;
685
672
  }
686
- }), [x, c]), N = [
673
+ }), [g, c]), N = [
687
674
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
688
- { key: "track", label: s.displayName }
675
+ { key: "track", label: r.displayName }
689
676
  ];
690
- return n ? /* @__PURE__ */ t(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
691
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(se, { segments: N }) }),
692
- /* @__PURE__ */ t(Le, { availableTags: y, activeTags: g, onToggle: f, onClear: m }),
693
- e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
694
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
695
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
696
- /* @__PURE__ */ t($, { label: "Car", sortKey: "carId", config: c, onSort: u }),
697
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Record Holder" }),
698
- /* @__PURE__ */ t($, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
699
- /* @__PURE__ */ t($, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
700
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
677
+ return t ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
678
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ie, { segments: N }) }),
679
+ /* @__PURE__ */ n(
680
+ Te,
681
+ {
682
+ availableTags: b,
683
+ activeTags: x,
684
+ onToggle: f,
685
+ onClear: h,
686
+ categories: s == null ? void 0 : s.categories,
687
+ tagLabels: s == null ? void 0 : s.tagLabels
688
+ }
689
+ ),
690
+ e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
691
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
692
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
693
+ /* @__PURE__ */ n(R, { label: "Car", sortKey: "carId", config: c, onSort: u }),
694
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Record Holder" }),
695
+ /* @__PURE__ */ n(R, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: u }),
696
+ /* @__PURE__ */ n(R, { label: "Drivers", sortKey: "driverCount", config: c, onSort: u, className: "pvx-hidden-below-md" }),
697
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
701
698
  ] }) }),
702
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: v.map((h, w) => /* @__PURE__ */ l(
699
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: m.map((v, k) => /* @__PURE__ */ l(
703
700
  "tr",
704
701
  {
705
702
  className: "pvx-row pvx-row--clickable",
706
- onClick: () => i(h.carId),
703
+ onClick: () => i(v.carId),
707
704
  children: [
708
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(re, { rank: w + 1, podium: !0 }) }),
709
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: I(h.carId) }),
710
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(G, { userId: h.steamId || h.userId, getUserDisplay: a }) }),
711
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(h.lapTimeMs) }),
712
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
713
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: h.recordedAt ? j(h.recordedAt) : "-" })
705
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ae, { rank: k + 1, podium: !0 }) }),
706
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: B(v.carId) }),
707
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(Q, { userId: v.steamId || v.userId, getUserDisplay: a }) }),
708
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: A(v.lapTimeMs) }),
709
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: v.driverCount || "-" }),
710
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: v.recordedAt ? _(v.recordedAt) : "-" })
714
711
  ]
715
712
  },
716
- h.carId
713
+ v.carId
717
714
  )) })
718
- ] }) }) : /* @__PURE__ */ t(V, { message: "No lap times for this track yet." })
715
+ ] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this track yet." })
719
716
  ] });
720
717
  }
721
- function mn({ entries: e, isLoading: n, track: s, carId: r, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
722
- const [p, c] = W({ key: "lapTimeMs", dir: "asc" }), u = S(() => Ce(e), [e]), g = S(() => z(e || [], p, (m, y) => {
723
- switch (y) {
718
+ function vt({ entries: e, isLoading: t, track: r, carId: s, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
719
+ const [p, c] = O({ key: "lapTimeMs", dir: "asc" }), u = S(() => Se(e), [e]), x = S(() => z(e || [], p, (h, b) => {
720
+ switch (b) {
724
721
  case "userId":
725
- return a(m.steamId || m.userId).displayName;
722
+ return a(h.steamId || h.userId).displayName;
726
723
  case "lapCount":
727
- return m.lapCount || 0;
724
+ return h.lapCount || 0;
728
725
  case "lapTimeMs":
729
726
  default:
730
- return m.lapTimeMs;
727
+ return h.lapTimeMs;
731
728
  }
732
729
  }), [e, p, a]), f = [
733
730
  { key: "tracks", label: "Tracks", onClick: () => o("tracks") },
734
- { key: "track", label: s.displayName, onClick: () => o("track") },
735
- { key: "car", label: I(r) }
731
+ { key: "track", label: r.displayName, onClick: () => o("track") },
732
+ { key: "car", label: B(s) }
736
733
  ];
737
- return n ? /* @__PURE__ */ t(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
738
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t(se, { segments: f }) }),
739
- e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
740
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
741
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
742
- /* @__PURE__ */ t($, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
743
- /* @__PURE__ */ t($, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
744
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
745
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
746
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
747
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
748
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
749
- /* @__PURE__ */ t($, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
750
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
734
+ return t ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
735
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n(ie, { segments: f }) }),
736
+ e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
737
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
738
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
739
+ /* @__PURE__ */ n(R, { label: "Driver", sortKey: "userId", config: p, onSort: c }),
740
+ /* @__PURE__ */ n(R, { label: "Lap Time", sortKey: "lapTimeMs", config: p, onSort: c }),
741
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
742
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
743
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
744
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
745
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
746
+ /* @__PURE__ */ n(R, { label: "Laps", sortKey: "lapCount", config: p, onSort: c, className: "pvx-hidden-below-lg" }),
747
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
751
748
  ] }) }),
752
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: g.map((m, y) => {
753
- const x = y + 1, v = m.steamId || m.userId, N = u && m.sector1Ms === u.s1, h = u && m.sector2Ms === u.s2, w = u && m.sector3Ms === u.s3;
749
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: x.map((h, b) => {
750
+ const g = b + 1, m = h.steamId || h.userId, N = u && h.sector1Ms === u.s1, v = u && h.sector2Ms === u.s2, k = u && h.sector3Ms === u.s3;
754
751
  return /* @__PURE__ */ l(
755
752
  "tr",
756
753
  {
757
- className: `pvx-row pvx-row--clickable ${d && v === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
758
- onClick: () => i(v),
754
+ className: `pvx-row pvx-row--clickable ${d && m === d ? "pvx-row--highlight" : g <= 3 ? "pvx-row--podium" : ""}`,
755
+ onClick: () => i(m),
759
756
  children: [
760
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(re, { rank: x, podium: !0 }) }),
761
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ t(G, { userId: v, getUserDisplay: a }) }),
762
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(m.lapTimeMs) }),
763
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: B(m.sector1Ms) }),
764
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: B(m.sector2Ms) }),
765
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: B(m.sector3Ms) }),
766
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: me(m.tyreCompound), children: m.tyreCompound || "-" }),
767
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: he(m.startingFuelL) }),
768
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: m.lapCount || "-" }),
769
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: m.recordedAt ? j(m.recordedAt) : "-" })
757
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ae, { rank: g, podium: !0 }) }),
758
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(Q, { userId: m, getUserDisplay: a }) }),
759
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: A(h.lapTimeMs) }),
760
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: P(h.sector1Ms) }),
761
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${v ? "pvx-td--best-sector" : ""}`, children: P(h.sector2Ms) }),
762
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: P(h.sector3Ms) }),
763
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: xe(h.tyreCompound), children: h.tyreCompound || "-" }),
764
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: ge(h.startingFuelL) }),
765
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.lapCount || "-" }),
766
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: h.recordedAt ? _(h.recordedAt) : "-" })
770
767
  ]
771
768
  },
772
- v
769
+ m
773
770
  );
774
771
  }) })
775
- ] }) }) : /* @__PURE__ */ t(V, { message: "No lap times for this car yet." })
772
+ ] }) }) : /* @__PURE__ */ n(V, { message: "No lap times for this car yet." })
776
773
  ] });
777
774
  }
778
- function hn({ userId: e, track: n, carId: s, game: r, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
779
- const { data: c, driverName: u, theoreticalBest: g, isLoading: f } = ze(e, n.id, n.layout, s, { showInvalid: i, game: r, gameVersion: a }), { displayName: m, avatarUrl: y } = o(e, u), x = S(() => Ce(c, !0), [c]), v = S(() => {
780
- const h = (c == null ? void 0 : c.filter((w) => w.isValid)) || [];
781
- return h.length ? Math.min(...h.map((w) => w.lapTimeMs)) : null;
775
+ function mt({ userId: e, track: t, carId: r, game: s, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: p }) {
776
+ const { data: c, driverName: u, theoreticalBest: x, isLoading: f } = Ge(e, t.id, t.layout, r, { showInvalid: i, game: s, gameVersion: a }), { displayName: h, avatarUrl: b } = o(e, u), g = S(() => Se(c, !0), [c]), m = S(() => {
777
+ const v = (c == null ? void 0 : c.filter((k) => k.isValid)) || [];
778
+ return v.length ? Math.min(...v.map((k) => k.lapTimeMs)) : null;
782
779
  }, [c]), N = [
783
780
  { key: "tracks", label: "Tracks", onClick: () => p("tracks") },
784
- { key: "track", label: n.displayName, onClick: () => p("track") },
785
- { key: "car", label: I(s), onClick: () => p("car") },
786
- { key: "driver", label: m }
781
+ { key: "track", label: t.displayName, onClick: () => p("track") },
782
+ { key: "car", label: B(r), onClick: () => p("car") },
783
+ { key: "driver", label: h }
787
784
  ];
788
- return f ? /* @__PURE__ */ t(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
785
+ return f ? /* @__PURE__ */ n(K, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
789
786
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
790
787
  /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
791
- /* @__PURE__ */ t(se, { segments: N }),
792
- y ? /* @__PURE__ */ t("img", { src: y, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ t("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
788
+ /* @__PURE__ */ n(ie, { segments: N }),
789
+ b ? /* @__PURE__ */ n("img", { src: b, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ n("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
793
790
  ] }),
794
791
  /* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
795
- /* @__PURE__ */ t(
792
+ /* @__PURE__ */ n(
796
793
  "input",
797
794
  {
798
795
  type: "checkbox",
@@ -801,57 +798,57 @@ function hn({ userId: e, track: n, carId: s, game: r, gameVersion: a, showInvali
801
798
  className: "pvx-checkbox"
802
799
  }
803
800
  ),
804
- /* @__PURE__ */ t("span", { children: "Show invalid laps" })
801
+ /* @__PURE__ */ n("span", { children: "Show invalid laps" })
805
802
  ] })
806
803
  ] }),
807
- g && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
808
- /* @__PURE__ */ t("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
809
- /* @__PURE__ */ t("span", { className: "pvx-theoretical-best-time", children: U(g.lapTimeMs) }),
804
+ x && /* @__PURE__ */ l("div", { className: "pvx-theoretical-best", children: [
805
+ /* @__PURE__ */ n("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
806
+ /* @__PURE__ */ n("span", { className: "pvx-theoretical-best-time", children: A(x.lapTimeMs) }),
810
807
  /* @__PURE__ */ l("span", { className: "pvx-theoretical-best-sectors", children: [
811
808
  "(",
812
- B(g.sector1Ms),
809
+ P(x.sector1Ms),
813
810
  " + ",
814
- B(g.sector2Ms),
811
+ P(x.sector2Ms),
815
812
  " + ",
816
- B(g.sector3Ms),
813
+ P(x.sector3Ms),
817
814
  ")"
818
815
  ] })
819
816
  ] }),
820
- c != null && c.length ? /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
821
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
822
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
823
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
824
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Lap Time" }),
825
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
826
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
827
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
828
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
829
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
830
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
831
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
817
+ c != null && c.length ? /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
818
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
819
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
820
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-md", children: "Lap" }),
821
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Lap Time" }),
822
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
823
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
824
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
825
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Valid" }),
826
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
827
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
828
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
832
829
  ] }) }),
833
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: c.map((h, w) => {
834
- const b = h.isValid && h.lapTimeMs === v, L = x && h.isValid && h.sector1Ms === x.s1, M = x && h.isValid && h.sector2Ms === x.s2, k = x && h.isValid && h.sector3Ms === x.s3;
835
- let A = "pvx-row";
836
- return h.isValid || (A += " pvx-row--invalid"), b && (A += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: A, children: [
837
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t("span", { className: `pvx-rank ${b ? "pvx-rank--gold" : ""}`, children: w + 1 }) }),
838
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: h.lapNumber || "-" }),
839
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: U(h.lapTimeMs) }),
840
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: B(h.sector1Ms) }),
841
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${M ? "pvx-td--best-sector" : ""}`, children: B(h.sector2Ms) }),
842
- /* @__PURE__ */ t("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${k ? "pvx-td--best-sector" : ""}`, children: B(h.sector3Ms) }),
843
- /* @__PURE__ */ t("td", { className: "pvx-td", title: h.isValid ? void 0 : h.invalidReason || "Invalid", children: h.isValid ? /* @__PURE__ */ t(tt, {}) : /* @__PURE__ */ t(nt, {}) }),
844
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: me(h.tyreCompound), children: h.tyreCompound || "-" }),
845
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: he(h.startingFuelL) }),
846
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: j(h.timestamp) })
847
- ] }, h.id);
830
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: c.map((v, k) => {
831
+ const y = v.isValid && v.lapTimeMs === m, L = g && v.isValid && v.sector1Ms === g.s1, D = g && v.isValid && v.sector2Ms === g.s2, w = g && v.isValid && v.sector3Ms === g.s3;
832
+ let U = "pvx-row";
833
+ return v.isValid || (U += " pvx-row--invalid"), y && (U += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: U, children: [
834
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n("span", { className: `pvx-rank ${y ? "pvx-rank--gold" : ""}`, children: k + 1 }) }),
835
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: v.lapNumber || "-" }),
836
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: A(v.lapTimeMs) }),
837
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: P(v.sector1Ms) }),
838
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${D ? "pvx-td--best-sector" : ""}`, children: P(v.sector2Ms) }),
839
+ /* @__PURE__ */ n("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: P(v.sector3Ms) }),
840
+ /* @__PURE__ */ n("td", { className: "pvx-td", title: v.isValid ? void 0 : v.invalidReason || "Invalid", children: v.isValid ? /* @__PURE__ */ n(tn, {}) : /* @__PURE__ */ n(rn, {}) }),
841
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: xe(v.tyreCompound), children: v.tyreCompound || "-" }),
842
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: ge(v.startingFuelL) }),
843
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: _(v.timestamp) })
844
+ ] }, v.id);
848
845
  }) })
849
- ] }) }) : /* @__PURE__ */ t(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
846
+ ] }) }) : /* @__PURE__ */ n(V, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
850
847
  ] });
851
848
  }
852
- function vn({ drivers: e, isLoading: n, getUserDisplay: s, game: r, gameVersion: a, onComboSelect: i }) {
853
- const [o, d] = W({ key: "rank", dir: "asc" }), [p, c] = D(null), u = S(() => e ? z(e, o, (f, m) => {
854
- switch (m) {
849
+ function xt({ drivers: e, isLoading: t, getUserDisplay: r, game: s, gameVersion: a, onComboSelect: i }) {
850
+ const [o, d] = O({ key: "rank", dir: "asc" }), [p, c] = M(null), u = S(() => e ? z(e, o, (f, h) => {
851
+ switch (h) {
855
852
  case "rating":
856
853
  return f.rating;
857
854
  case "comboCount":
@@ -863,45 +860,45 @@ function vn({ drivers: e, isLoading: n, getUserDisplay: s, game: r, gameVersion:
863
860
  return f.rank;
864
861
  }
865
862
  }) : [], [e, o]);
866
- if (n) return /* @__PURE__ */ t(K, {});
863
+ if (t) return /* @__PURE__ */ n(K, {});
867
864
  if (!(e != null && e.length))
868
- return /* @__PURE__ */ t("div", { className: "pvx-card", children: /* @__PURE__ */ t(V, { message: "Not enough data for rankings yet." }) });
869
- const g = 5;
865
+ return /* @__PURE__ */ n("div", { className: "pvx-card", children: /* @__PURE__ */ n(V, { message: "Not enough data for rankings yet." }) });
866
+ const x = 5;
870
867
  return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
871
868
  /* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
872
- /* @__PURE__ */ t("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
869
+ /* @__PURE__ */ n("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
873
870
  /* @__PURE__ */ l("div", { className: "pvx-rankings-info-trigger", children: [
874
- /* @__PURE__ */ t("svg", { className: "pvx-rankings-info-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) }),
871
+ /* @__PURE__ */ n("svg", { className: "pvx-rankings-info-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) }),
875
872
  /* @__PURE__ */ l("div", { className: "pvx-rankings-info-tooltip", children: [
876
- /* @__PURE__ */ t("p", { className: "pvx-rankings-info-title", children: "How ratings work" }),
873
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-info-title", children: "How ratings work" }),
877
874
  /* @__PURE__ */ l("ul", { className: "pvx-rankings-info-list", children: [
878
- /* @__PURE__ */ t("li", { children: "For each car/track combo with 3+ drivers, you're ranked by lap time and given a percentile (100 = fastest, 0 = slowest)" }),
879
- /* @__PURE__ */ t("li", { children: "Your rating is a weighted average across all your combos — bigger fields count more" }),
880
- /* @__PURE__ */ t("li", { children: "A confidence adjustment rewards car diversity: the more different cars you drive competitively, the closer your rating reflects your true score" }),
881
- /* @__PURE__ */ t("li", { children: "Minimum 2 qualifying combos required" })
875
+ /* @__PURE__ */ n("li", { children: "For each car/track combo with 3+ drivers, you're ranked by lap time and given a percentile (100 = fastest, 0 = slowest)" }),
876
+ /* @__PURE__ */ n("li", { children: "Your rating is a weighted average across all your combos — bigger fields count more" }),
877
+ /* @__PURE__ */ n("li", { children: "A confidence adjustment rewards car diversity: the more different cars you drive competitively, the closer your rating reflects your true score" }),
878
+ /* @__PURE__ */ n("li", { children: "Minimum 2 qualifying combos required" })
882
879
  ] })
883
880
  ] })
884
881
  ] })
885
882
  ] }),
886
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
887
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
888
- /* @__PURE__ */ t($, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
889
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
890
- /* @__PURE__ */ t($, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
891
- /* @__PURE__ */ t($, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
892
- /* @__PURE__ */ t($, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
883
+ /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
884
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
885
+ /* @__PURE__ */ n(R, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
886
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
887
+ /* @__PURE__ */ n(R, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
888
+ /* @__PURE__ */ n(R, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
889
+ /* @__PURE__ */ n(R, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
893
890
  ] }) }),
894
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: u.map((f) => {
895
- const m = p === f.identifier;
896
- return /* @__PURE__ */ t(
897
- rt,
891
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: u.map((f) => {
892
+ const h = p === f.identifier;
893
+ return /* @__PURE__ */ n(
894
+ sn,
898
895
  {
899
896
  driver: f,
900
- getUserDisplay: s,
901
- isExpanded: m,
902
- onToggle: () => c(m ? null : f.identifier),
903
- colCount: g,
904
- game: r,
897
+ getUserDisplay: r,
898
+ isExpanded: h,
899
+ onToggle: () => c(h ? null : f.identifier),
900
+ colCount: x,
901
+ game: s,
905
902
  gameVersion: a,
906
903
  onComboSelect: i
907
904
  },
@@ -911,28 +908,28 @@ function vn({ drivers: e, isLoading: n, getUserDisplay: s, game: r, gameVersion:
911
908
  ] }) })
912
909
  ] });
913
910
  }
914
- function rt({ driver: e, getUserDisplay: n, isExpanded: s, onToggle: r, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
911
+ function sn({ driver: e, getUserDisplay: t, isExpanded: r, onToggle: s, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
915
912
  const p = e.identifier;
916
913
  return /* @__PURE__ */ l(F, { children: [
917
914
  /* @__PURE__ */ l(
918
915
  "tr",
919
916
  {
920
917
  className: `pvx-row pvx-row--clickable ${e.rank <= 3 ? "pvx-row--podium" : ""}`,
921
- onClick: r,
918
+ onClick: s,
922
919
  children: [
923
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(re, { rank: e.rank, podium: !0 }) }),
924
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ t(G, { userId: p, getUserDisplay: n }) }),
925
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
926
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
927
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
920
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ae, { rank: e.rank, podium: !0 }) }),
921
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ n(Q, { userId: p, getUserDisplay: t }) }),
922
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: e.rating.toFixed(1) }),
923
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: e.distinctCars || "-" }),
924
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
928
925
  e.comboCount,
929
- /* @__PURE__ */ t("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__ */ t("path", { d: "m6 9 6 6 6-6" }) })
926
+ /* @__PURE__ */ n("svg", { className: `pvx-rankings-chevron ${r ? "pvx-rankings-chevron--open" : ""}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) })
930
927
  ] }) })
931
928
  ]
932
929
  }
933
930
  ),
934
- s && e.combos && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ t("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
935
- const g = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: g, car: c.carId, highlight: p, game: i, gameVersion: o }) : void 0;
931
+ r && e.combos && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ n("div", { className: "pvx-rankings-combos", children: e.combos.map((c, u) => {
932
+ const x = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, f = d ? () => d({ track: x, car: c.carId, highlight: p, game: i, gameVersion: o }) : void 0;
936
933
  return /* @__PURE__ */ l(
937
934
  "div",
938
935
  {
@@ -941,11 +938,11 @@ function rt({ driver: e, getUserDisplay: n, isExpanded: s, onToggle: r, colCount
941
938
  role: f ? "button" : void 0,
942
939
  children: [
943
940
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
944
- /* @__PURE__ */ t("p", { className: "pvx-rankings-combo-track", children: q(c.trackId, c.layout, i) }),
945
- /* @__PURE__ */ t("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
941
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-track", children: E(c.trackId, c.layout, i) }),
942
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-car", children: B(c.carId) })
946
943
  ] }),
947
944
  /* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
948
- /* @__PURE__ */ t("p", { className: "pvx-rankings-combo-time", children: U(c.lapTimeMs) }),
945
+ /* @__PURE__ */ n("p", { className: "pvx-rankings-combo-time", children: A(c.lapTimeMs) }),
949
946
  /* @__PURE__ */ l("p", { className: `pvx-rankings-combo-pct ${c.percentile >= 75 ? "pvx-rankings-combo-pct--high" : c.percentile >= 50 ? "pvx-rankings-combo-pct--mid" : c.percentile >= 25 ? "pvx-rankings-combo-pct--low" : "pvx-rankings-combo-pct--bottom"}`, children: [
950
947
  c.percentile.toFixed(0),
951
948
  "%",
@@ -965,7 +962,7 @@ function rt({ driver: e, getUserDisplay: n, isExpanded: s, onToggle: r, colCount
965
962
  }) }) }) })
966
963
  ] });
967
964
  }
968
- const st = {
965
+ const an = {
969
966
  GBR: "🇬🇧",
970
967
  DEU: "🇩🇪",
971
968
  NLD: "🇳🇱",
@@ -996,165 +993,165 @@ const st = {
996
993
  RUS: "🇷🇺",
997
994
  TUR: "🇹🇷",
998
995
  KOR: "🇰🇷"
999
- }, ae = ["🥇", "🥈", "🥉"], at = {
996
+ }, oe = ["🥇", "🥈", "🥉"], on = {
1000
997
  championship: "Championship",
1001
998
  series: "Series",
1002
999
  event: "Event",
1003
1000
  hotlap: "Hotlap"
1004
- }, it = ["PRACTICE", "QUALIFYING", "RACE"];
1005
- function de(e) {
1006
- const n = it.indexOf(e);
1007
- if (n >= 0) return n;
1008
- const s = e.match(/^PRACTICE_(\d+)$/);
1009
- return s ? 100 + parseInt(s[1]) : 999;
1001
+ }, ln = ["PRACTICE", "QUALIFYING", "RACE"];
1002
+ function ue(e) {
1003
+ const t = ln.indexOf(e);
1004
+ if (t >= 0) return t;
1005
+ const r = e.match(/^PRACTICE_(\d+)$/);
1006
+ return r ? 100 + parseInt(r[1]) : 999;
1010
1007
  }
1011
- function ie(e) {
1012
- const n = e.match(/^PRACTICE_(\d+)$/);
1013
- return n ? `P${n[1]}` : e;
1008
+ function le(e) {
1009
+ const t = e.match(/^PRACTICE_(\d+)$/);
1010
+ return t ? `P${t[1]}` : e;
1014
1011
  }
1015
- function oe({ position: e }) {
1016
- return /* @__PURE__ */ t("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
1012
+ function ce({ position: e }) {
1013
+ return /* @__PURE__ */ n("span", { className: e === 1 ? "pvx-rank pvx-rank--gold" : e === 2 ? "pvx-rank pvx-rank--silver" : e === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: e });
1017
1014
  }
1018
- function Q({ nation: e }) {
1019
- const n = e && st[e];
1020
- return n ? /* @__PURE__ */ t("span", { className: "pvx-nation-flag", title: e, children: n }) : null;
1015
+ function G({ nation: e }) {
1016
+ const t = e && an[e];
1017
+ return t ? /* @__PURE__ */ n("span", { className: "pvx-nation-flag", title: e, children: t }) : null;
1021
1018
  }
1022
- function ot({ sessions: e, activeSession: n, onSelect: s }) {
1019
+ function cn({ sessions: e, activeSession: t, onSelect: r }) {
1023
1020
  if (!e || e.length <= 1) return null;
1024
- const r = [...e].sort(
1025
- (a, i) => de(a.type) - de(i.type)
1021
+ const s = [...e].sort(
1022
+ (a, i) => ue(a.type) - ue(i.type)
1026
1023
  );
1027
- return /* @__PURE__ */ t("div", { className: "pvx-session-tabs", children: r.map((a) => /* @__PURE__ */ t(
1024
+ return /* @__PURE__ */ n("div", { className: "pvx-session-tabs", children: s.map((a) => /* @__PURE__ */ n(
1028
1025
  "button",
1029
1026
  {
1030
- onClick: () => s(a.type),
1031
- className: `pvx-session-tab ${n === a.type ? "pvx-session-tab--active" : ""}`,
1032
- children: ie(a.type)
1027
+ onClick: () => r(a.type),
1028
+ className: `pvx-session-tab ${t === a.type ? "pvx-session-tab--active" : ""}`,
1029
+ children: le(a.type)
1033
1030
  },
1034
1031
  a.type
1035
1032
  )) });
1036
1033
  }
1037
- function lt({ type: e }) {
1038
- return /* @__PURE__ */ t("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: at[e] || e });
1034
+ function dn({ type: e }) {
1035
+ return /* @__PURE__ */ n("span", { className: `pvx-comp-badge pvx-comp-badge--${e}`, children: on[e] || e });
1039
1036
  }
1040
- function J({ children: e, variant: n = "default" }) {
1041
- return /* @__PURE__ */ t("span", { className: `pvx-info-pill ${n !== "default" ? `pvx-info-pill--${n}` : ""}`, children: e });
1037
+ function J({ children: e, variant: t = "default" }) {
1038
+ return /* @__PURE__ */ n("span", { className: `pvx-info-pill ${t !== "default" ? `pvx-info-pill--${t}` : ""}`, children: e });
1042
1039
  }
1043
- function ct(e) {
1040
+ function pn(e) {
1044
1041
  if (!e) return "TBD";
1045
- const n = new Date(e);
1046
- if (isNaN(n)) return "TBD";
1047
- const s = n.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), r = n.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1048
- return `${s} • ${r}`;
1049
- }
1050
- function dt(e) {
1051
- return e.reduce((n, s) => {
1052
- var r;
1053
- return (r = s.splits) != null && r.length ? n ? n.map((a, i) => {
1054
- const o = s.splits[i];
1042
+ const t = new Date(e);
1043
+ if (isNaN(t)) return "TBD";
1044
+ const r = t.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), s = t.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1045
+ return `${r} • ${s}`;
1046
+ }
1047
+ function un(e) {
1048
+ return e.reduce((t, r) => {
1049
+ var s;
1050
+ return (s = r.splits) != null && s.length ? t ? t.map((a, i) => {
1051
+ const o = r.splits[i];
1055
1052
  return o && o < a ? o : a;
1056
- }) : [...s.splits] : n;
1053
+ }) : [...r.splits] : t;
1057
1054
  }, null);
1058
1055
  }
1059
- function E({ message: e = "Loading..." }) {
1060
- return /* @__PURE__ */ t("div", { className: "pvx-loading", children: e });
1061
- }
1062
- function P({ message: e = "No data available." }) {
1063
- return /* @__PURE__ */ t("div", { className: "pvx-empty", children: /* @__PURE__ */ t("p", { children: e }) });
1064
- }
1065
- const Se = 3;
1066
- function pt(e) {
1067
- const n = e == null ? void 0 : e.rounds;
1068
- return n != null && n.length ? e.type === "hotlap" ? n.every((s) => s.isFinalized && s.dediStatus === "completed") : n.every((s) => s.isFinalized) : !1;
1069
- }
1070
- function ut(e) {
1071
- const n = e == null ? void 0 : e.rounds;
1072
- if (!(n != null && n.length)) return null;
1073
- let s = null;
1074
- for (const r of n) {
1075
- if (!r.startTime) continue;
1076
- const a = new Date(r.startTime);
1077
- isNaN(a) || (!s || a > s) && (s = a);
1056
+ function q({ message: e = "Loading..." }) {
1057
+ return /* @__PURE__ */ n("div", { className: "pvx-loading", children: e });
1058
+ }
1059
+ function I({ message: e = "No data available." }) {
1060
+ return /* @__PURE__ */ n("div", { className: "pvx-empty", children: /* @__PURE__ */ n("p", { children: e }) });
1061
+ }
1062
+ const $e = 3;
1063
+ function hn(e) {
1064
+ const t = e == null ? void 0 : e.rounds;
1065
+ return t != null && t.length ? e.type === "hotlap" ? t.every((r) => r.isFinalized && r.dediStatus === "completed") : t.every((r) => r.isFinalized) : !1;
1066
+ }
1067
+ function vn(e) {
1068
+ const t = e == null ? void 0 : e.rounds;
1069
+ if (!(t != null && t.length)) return null;
1070
+ let r = null;
1071
+ for (const s of t) {
1072
+ if (!s.startTime) continue;
1073
+ const a = new Date(s.startTime);
1074
+ isNaN(a) || (!r || a > r) && (r = a);
1078
1075
  }
1079
- return s;
1076
+ return r;
1080
1077
  }
1081
- function Te(e, n = Se) {
1082
- if (!pt(e)) return "active";
1083
- const s = ut(e);
1084
- if (!s) return "recently-completed";
1085
- const r = n * 24 * 60 * 60 * 1e3;
1086
- return Date.now() - s.getTime() <= r ? "recently-completed" : "archived";
1078
+ function Re(e, t = $e) {
1079
+ if (!hn(e)) return "active";
1080
+ const r = vn(e);
1081
+ if (!r) return "recently-completed";
1082
+ const s = t * 24 * 60 * 60 * 1e3;
1083
+ return Date.now() - r.getTime() <= s ? "recently-completed" : "archived";
1087
1084
  }
1088
- function xn(e, n, s = Se) {
1085
+ function gt(e, t, r = $e) {
1089
1086
  if (!(e != null && e.length)) return [];
1090
- const r = new Set(Array.isArray(n) ? n : [n]);
1091
- return e.filter((a) => r.has(Te(a, s)));
1092
- }
1093
- function mt(e, n = 3) {
1094
- const s = e == null ? void 0 : e.standings;
1095
- return Array.isArray(s) ? [...s].sort((r, a) => (r.position ?? 999) - (a.position ?? 999)).slice(0, n) : [];
1096
- }
1097
- function ht({ competitionId: e, topN: n = 3, label: s = "Completed", className: r }) {
1098
- const { data: a } = ge(e), i = mt(a, n);
1099
- return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${r || ""}`, children: [
1100
- /* @__PURE__ */ t("span", { className: "pvx-comp-completed-badge-label", children: s }),
1101
- i.length > 0 && /* @__PURE__ */ t("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
1102
- /* @__PURE__ */ t("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: ae[d] || "" }),
1103
- /* @__PURE__ */ t(Q, { nation: o.nation }),
1104
- /* @__PURE__ */ t("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
1087
+ const s = new Set(Array.isArray(t) ? t : [t]);
1088
+ return e.filter((a) => s.has(Re(a, r)));
1089
+ }
1090
+ function mn(e, t = 3) {
1091
+ const r = e == null ? void 0 : e.standings;
1092
+ return Array.isArray(r) ? [...r].sort((s, a) => (s.position ?? 999) - (a.position ?? 999)).slice(0, t) : [];
1093
+ }
1094
+ function xn({ competitionId: e, topN: t = 3, label: r = "Completed", className: s }) {
1095
+ const { data: a } = be(e), i = mn(a, t);
1096
+ return /* @__PURE__ */ l("div", { className: `pvx-comp-completed-badge ${s || ""}`, children: [
1097
+ /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-label", children: r }),
1098
+ i.length > 0 && /* @__PURE__ */ n("ol", { className: "pvx-comp-completed-badge-podium", children: i.map((o, d) => /* @__PURE__ */ l("li", { className: "pvx-comp-completed-badge-driver", children: [
1099
+ /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-medal", "aria-hidden": "true", children: oe[d] || "" }),
1100
+ /* @__PURE__ */ n(G, { nation: o.nation }),
1101
+ /* @__PURE__ */ n("span", { className: "pvx-comp-completed-badge-name", children: o.driverName })
1105
1102
  ] }, o.driverId || d)) })
1106
1103
  ] });
1107
1104
  }
1108
- function gn({ competitions: e, isLoading: n, onSelect: s, onRegister: r, className: a }) {
1109
- return n ? /* @__PURE__ */ t(E, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ t("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ t(vt, { comp: i, onSelect: s, onRegister: r || s }, i.id)) }) : /* @__PURE__ */ t(P, { message: "No competitions available." });
1105
+ function ft({ competitions: e, isLoading: t, onSelect: r, onRegister: s, className: a }) {
1106
+ return t ? /* @__PURE__ */ n(q, { message: "Loading competitions..." }) : e != null && e.length ? /* @__PURE__ */ n("div", { className: `pvx-comp-grid ${a || ""}`, children: e.map((i) => /* @__PURE__ */ n(gn, { comp: i, onSelect: r, onRegister: s || r }, i.id)) }) : /* @__PURE__ */ n(I, { message: "No competitions available." });
1110
1107
  }
1111
- function vt({ comp: e, onSelect: n, onRegister: s }) {
1112
- var h, w, b;
1113
- const { cdnUrl: r } = C(), a = e.posterCdnPath ? `${r}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), u = (i == null ? void 0 : i.isOpen) && !c && !p, g = /* @__PURE__ */ new Date(), f = (h = e.rounds) == null ? void 0 : h.find((L) => L.startTime && new Date(L.startTime) >= g), m = ((w = e.rounds) == null ? void 0 : w.length) || 0, y = ((b = e.rounds) == null ? void 0 : b.filter((L) => L.isFinalized).length) || 0, x = Te(e), v = x === "recently-completed" || x === "archived", N = e.type === "championship";
1108
+ function gn({ comp: e, onSelect: t, onRegister: r }) {
1109
+ var v, k, y;
1110
+ const { cdnUrl: s } = C(), a = e.posterCdnPath ? `${s}/${e.posterCdnPath}` : null, i = e.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, p = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), u = (i == null ? void 0 : i.isOpen) && !c && !p, x = /* @__PURE__ */ new Date(), f = (v = e.rounds) == null ? void 0 : v.find((L) => L.startTime && new Date(L.startTime) >= x), h = ((k = e.rounds) == null ? void 0 : k.length) || 0, b = ((y = e.rounds) == null ? void 0 : y.filter((L) => L.isFinalized).length) || 0, g = Re(e), m = g === "recently-completed" || g === "archived", N = e.type === "championship";
1114
1111
  return /* @__PURE__ */ l(
1115
1112
  "div",
1116
1113
  {
1117
1114
  className: "pvx-comp-card",
1118
- onClick: () => n(e.id),
1115
+ onClick: () => t(e.id),
1119
1116
  role: "button",
1120
1117
  tabIndex: 0,
1121
1118
  onKeyDown: (L) => {
1122
- (L.key === "Enter" || L.key === " ") && (L.preventDefault(), n(e.id));
1119
+ (L.key === "Enter" || L.key === " ") && (L.preventDefault(), t(e.id));
1123
1120
  },
1124
1121
  children: [
1125
- /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ t("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ t("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ t(gt, {}) }) }),
1122
+ /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ n("img", { src: a, alt: e.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ n("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ n(Nn, {}) }) }),
1126
1123
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
1127
- /* @__PURE__ */ t("h3", { className: "pvx-comp-card-title", children: e.name }),
1128
- e.description && /* @__PURE__ */ t("p", { className: "pvx-comp-card-desc", children: e.description }),
1124
+ /* @__PURE__ */ n("h3", { className: "pvx-comp-card-title", children: e.name }),
1125
+ e.description && /* @__PURE__ */ n("p", { className: "pvx-comp-card-desc", children: e.description }),
1129
1126
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
1130
- /* @__PURE__ */ t(lt, { type: e.type }),
1131
- e.game && /* @__PURE__ */ t(J, { children: e.game.toUpperCase() }),
1132
- e.formatDescription && e.formatDescription.split(", ").map((L, M) => /* @__PURE__ */ t(J, { variant: "format", children: L }, M))
1127
+ /* @__PURE__ */ n(dn, { type: e.type }),
1128
+ e.game && /* @__PURE__ */ n(J, { children: e.game.toUpperCase() }),
1129
+ e.formatDescription && e.formatDescription.split(", ").map((L, D) => /* @__PURE__ */ n(J, { variant: "format", children: L }, D))
1133
1130
  ] }),
1134
- e.carsDescription && /* @__PURE__ */ t("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((L, M) => /* @__PURE__ */ t(J, { children: L }, M)) }),
1131
+ e.carsDescription && /* @__PURE__ */ n("div", { className: "pvx-comp-card-pills", children: e.carsDescription.split(", ").map((L, D) => /* @__PURE__ */ n(J, { children: L }, D)) }),
1135
1132
  /* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
1136
1133
  f ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1137
- /* @__PURE__ */ t("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1134
+ /* @__PURE__ */ n("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
1138
1135
  " ",
1139
1136
  e.type !== "hotlap" && `R${f.roundNumber} `,
1140
1137
  f.track || "TBD",
1141
1138
  " · ",
1142
- ct(f.startTime)
1143
- ] }) : m > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1144
- y,
1139
+ pn(f.startTime)
1140
+ ] }) : h > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
1141
+ b,
1145
1142
  "/",
1146
- m,
1143
+ h,
1147
1144
  " rounds completed"
1148
1145
  ] }) : null,
1149
- m > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1150
- m,
1146
+ h > 0 && /* @__PURE__ */ l("span", { className: "pvx-comp-card-round-count", children: [
1147
+ h,
1151
1148
  " round",
1152
- m !== 1 ? "s" : ""
1149
+ h !== 1 ? "s" : ""
1153
1150
  ] })
1154
1151
  ] }),
1155
- v && N && /* @__PURE__ */ t(ht, { competitionId: e.id }),
1156
- i && !v && /* @__PURE__ */ t(
1157
- xt,
1152
+ m && N && /* @__PURE__ */ n(xn, { competitionId: e.id }),
1153
+ i && !m && /* @__PURE__ */ n(
1154
+ fn,
1158
1155
  {
1159
1156
  competitionId: e.id,
1160
1157
  regOpen: u,
@@ -1162,7 +1159,7 @@ function vt({ comp: e, onSelect: n, onRegister: s }) {
1162
1159
  deadlinePassed: c,
1163
1160
  regCount: o,
1164
1161
  regMax: d,
1165
- onRegister: s
1162
+ onRegister: r
1166
1163
  }
1167
1164
  )
1168
1165
  ] })
@@ -1170,82 +1167,82 @@ function vt({ comp: e, onSelect: n, onRegister: s }) {
1170
1167
  }
1171
1168
  );
1172
1169
  }
1173
- function xt({ competitionId: e, regOpen: n, isFull: s, deadlinePassed: r, regCount: a, regMax: i, onRegister: o }) {
1174
- const { isPowerMode: d } = te(), p = ne(e), { data: c } = ee(e), u = (c == null ? void 0 : c.isRegistered) || !1, g = i ? a / i * 100 : 0, f = g >= 100 ? "full" : g >= 75 ? "warning" : "ok";
1170
+ function fn({ competitionId: e, regOpen: t, isFull: r, deadlinePassed: s, regCount: a, regMax: i, onRegister: o }) {
1171
+ const { isPowerMode: d } = re(), p = se(e), { data: c } = te(e), u = (c == null ? void 0 : c.isRegistered) || !1, x = i ? a / i * 100 : 0, f = x >= 100 ? "full" : x >= 75 ? "warning" : "ok";
1175
1172
  return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
1176
- /* @__PURE__ */ t("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
1173
+ /* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
1177
1174
  a,
1178
1175
  "/",
1179
1176
  i || "∞",
1180
1177
  " drivers"
1181
1178
  ] }) }),
1182
- /* @__PURE__ */ t("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ t(
1179
+ /* @__PURE__ */ n("div", { className: "pvx-comp-card-reg-action", children: u ? /* @__PURE__ */ n(
1183
1180
  "button",
1184
1181
  {
1185
1182
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
1186
- onClick: (m) => {
1187
- m.stopPropagation(), o(e);
1183
+ onClick: (h) => {
1184
+ h.stopPropagation(), o(e);
1188
1185
  },
1189
1186
  children: "✓ Registered"
1190
1187
  }
1191
- ) : n ? d ? /* @__PURE__ */ t(
1188
+ ) : t ? d ? /* @__PURE__ */ n(
1192
1189
  "button",
1193
1190
  {
1194
1191
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1195
- onClick: (m) => {
1196
- m.stopPropagation(), o(e);
1192
+ onClick: (h) => {
1193
+ h.stopPropagation(), o(e);
1197
1194
  },
1198
1195
  children: "Register"
1199
1196
  }
1200
- ) : /* @__PURE__ */ t(
1197
+ ) : /* @__PURE__ */ n(
1201
1198
  "a",
1202
1199
  {
1203
1200
  href: p,
1204
1201
  target: "_blank",
1205
1202
  rel: "noopener noreferrer",
1206
1203
  className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
1207
- onClick: (m) => m.stopPropagation(),
1204
+ onClick: (h) => h.stopPropagation(),
1208
1205
  children: "Register"
1209
1206
  }
1210
- ) : /* @__PURE__ */ t("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
1207
+ ) : /* @__PURE__ */ n("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: r ? "Full" : "Closed" }) })
1211
1208
  ] });
1212
1209
  }
1213
- function gt() {
1210
+ function Nn() {
1214
1211
  return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1215
- /* @__PURE__ */ t("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1216
- /* @__PURE__ */ t("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
1217
- /* @__PURE__ */ t("path", { d: "M4 22h16" }),
1218
- /* @__PURE__ */ t("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
1219
- /* @__PURE__ */ t("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
1220
- /* @__PURE__ */ t("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1212
+ /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
1213
+ /* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
1214
+ /* @__PURE__ */ n("path", { d: "M4 22h16" }),
1215
+ /* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
1216
+ /* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
1217
+ /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
1221
1218
  ] });
1222
1219
  }
1223
- function ft({ competitionId: e, className: n }) {
1220
+ function bn({ competitionId: e, className: t }) {
1224
1221
  var d, p;
1225
- const { data: s, isLoading: r } = ge(e), { data: a, isLoading: i } = xe(e);
1226
- if (r || i)
1227
- return /* @__PURE__ */ t(E, { message: "Loading standings..." });
1228
- if (!((d = s == null ? void 0 : s.standings) != null && d.length))
1229
- return /* @__PURE__ */ t(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
1222
+ const { data: r, isLoading: s } = be(e), { data: a, isLoading: i } = Ne(e);
1223
+ if (s || i)
1224
+ return /* @__PURE__ */ n(q, { message: "Loading standings..." });
1225
+ if (!((d = r == null ? void 0 : r.standings) != null && d.length))
1226
+ return /* @__PURE__ */ n(I, { message: "No standings data yet. Results will appear once rounds are finalised." });
1230
1227
  const o = ((p = a == null ? void 0 : a.rounds) == null ? void 0 : p.filter((c) => c.isFinalized)) || [];
1231
- return /* @__PURE__ */ l("div", { className: `pvx-card ${n || ""}`, children: [
1232
- /* @__PURE__ */ t("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
1233
- /* @__PURE__ */ t("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1228
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${t || ""}`, children: [
1229
+ /* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
1230
+ /* @__PURE__ */ n("h3", { className: "pvx-card-title", children: "Championship Standings" }),
1234
1231
  /* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
1235
1232
  "After ",
1236
- s.roundsCompleted,
1233
+ r.roundsCompleted,
1237
1234
  " round",
1238
- s.roundsCompleted !== 1 ? "s" : "",
1239
- s.countingRounds > 0 && ` (best ${s.countingRounds} count)`
1235
+ r.roundsCompleted !== 1 ? "s" : "",
1236
+ r.countingRounds > 0 && ` (best ${r.countingRounds} count)`
1240
1237
  ] })
1241
1238
  ] }) }),
1242
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1243
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1244
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1245
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1246
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1247
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1248
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1239
+ /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1240
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1241
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1242
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
1243
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "W" }),
1244
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center pvx-hidden-below-sm", children: "Pod" }),
1245
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" }),
1249
1246
  o.map((c) => /* @__PURE__ */ l(
1250
1247
  "th",
1251
1248
  {
@@ -1259,8 +1256,8 @@ function ft({ competitionId: e, className: n }) {
1259
1256
  c.roundNumber
1260
1257
  ))
1261
1258
  ] }) }),
1262
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: s.standings.map((c) => /* @__PURE__ */ t(
1263
- Nt,
1259
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: r.standings.map((c) => /* @__PURE__ */ n(
1260
+ yn,
1264
1261
  {
1265
1262
  driver: c,
1266
1263
  finalizedRounds: o
@@ -1270,123 +1267,123 @@ function ft({ competitionId: e, className: n }) {
1270
1267
  ] }) })
1271
1268
  ] });
1272
1269
  }
1273
- function Nt({ driver: e, finalizedRounds: n }) {
1270
+ function yn({ driver: e, finalizedRounds: t }) {
1274
1271
  var o, d, p;
1275
- const s = e.position <= 3, r = new Map(
1272
+ const r = e.position <= 3, s = new Map(
1276
1273
  ((o = e.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
1277
1274
  ), a = ((d = e.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((p = e.roundResults) == null ? void 0 : p.filter((c) => c.position <= 3).length) || 0;
1278
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
1279
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(oe, { position: e.position }) }),
1275
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${r ? "pvx-row--podium" : ""}`, children: [
1276
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ce, { position: e.position }) }),
1280
1277
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1281
- /* @__PURE__ */ t(Q, { nation: e.nation }),
1278
+ /* @__PURE__ */ n(G, { nation: e.nation }),
1282
1279
  e.driverName
1283
1280
  ] }),
1284
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1285
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1286
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
1287
- n.map((c) => {
1288
- const u = r.get(c.roundNumber), g = u == null ? void 0 : u.dropped;
1289
- return /* @__PURE__ */ t(
1281
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
1282
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
1283
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: e.totalPoints }),
1284
+ t.map((c) => {
1285
+ const u = s.get(c.roundNumber), x = u == null ? void 0 : u.dropped;
1286
+ return /* @__PURE__ */ n(
1290
1287
  "td",
1291
1288
  {
1292
- className: `pvx-td pvx-td--center pvx-hidden-below-md ${!g && (u == null ? void 0 : u.position) === 1 ? "pvx-standings-cell--p1" : !g && (u == null ? void 0 : u.position) === 2 ? "pvx-standings-cell--p2" : !g && (u == null ? void 0 : u.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
1293
- children: u ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${g ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1289
+ className: `pvx-td pvx-td--center pvx-hidden-below-md ${!x && (u == null ? void 0 : u.position) === 1 ? "pvx-standings-cell--p1" : !x && (u == null ? void 0 : u.position) === 2 ? "pvx-standings-cell--p2" : !x && (u == null ? void 0 : u.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
1290
+ children: u ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${x ? "pvx-standings-round-cell--dropped" : ""}`, children: [
1294
1291
  /* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
1295
1292
  "P",
1296
1293
  u.position
1297
1294
  ] }),
1298
- /* @__PURE__ */ t("span", { className: "pvx-standings-round-pts", children: u.points })
1299
- ] }) : /* @__PURE__ */ t("span", { className: "pvx-td--muted", children: "-" })
1295
+ /* @__PURE__ */ n("span", { className: "pvx-standings-round-pts", children: u.points })
1296
+ ] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" })
1300
1297
  },
1301
1298
  c.roundNumber
1302
1299
  );
1303
1300
  })
1304
1301
  ] });
1305
1302
  }
1306
- function fn({ competitionId: e, roundNumber: n, className: s }) {
1303
+ function Nt({ competitionId: e, roundNumber: t, className: r }) {
1307
1304
  var p;
1308
- const { data: r, isLoading: a } = Ge(e, n);
1305
+ const { data: s, isLoading: a } = Ye(e, t);
1309
1306
  if (a)
1310
- return /* @__PURE__ */ t(E, { message: "Loading results..." });
1311
- if (!r)
1312
- return /* @__PURE__ */ t(P, { message: "No results for this round." });
1313
- const o = (r.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
1314
- return /* @__PURE__ */ l("div", { className: `pvx-round-results ${s || ""}`, children: [
1307
+ return /* @__PURE__ */ n(q, { message: "Loading results..." });
1308
+ if (!s)
1309
+ return /* @__PURE__ */ n(I, { message: "No results for this round." });
1310
+ const o = (s.sessions || []).find((c) => c.type === "RACE"), d = (p = o == null ? void 0 : o.results) == null ? void 0 : p.filter((c) => c.position <= 3).sort((c, u) => c.position - u.position);
1311
+ return /* @__PURE__ */ l("div", { className: `pvx-round-results ${r || ""}`, children: [
1315
1312
  /* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
1316
1313
  /* @__PURE__ */ l("div", { children: [
1317
1314
  /* @__PURE__ */ l("h4", { className: "pvx-round-results-title", children: [
1318
1315
  "Round ",
1319
- r.roundNumber,
1320
- r.track ? `: ${r.track}` : ""
1316
+ s.roundNumber,
1317
+ s.track ? `: ${s.track}` : ""
1321
1318
  ] }),
1322
- r.startTime && /* @__PURE__ */ t("p", { className: "pvx-round-results-date", children: new Date(r.startTime).toLocaleDateString("en-GB", {
1319
+ s.startTime && /* @__PURE__ */ n("p", { className: "pvx-round-results-date", children: new Date(s.startTime).toLocaleDateString("en-GB", {
1323
1320
  day: "numeric",
1324
1321
  month: "long",
1325
1322
  year: "numeric"
1326
1323
  }) })
1327
1324
  ] }),
1328
- (d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ t("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1329
- /* @__PURE__ */ t("span", { children: ae[c.position - 1] }),
1330
- /* @__PURE__ */ t("span", { children: c.driverName })
1325
+ (d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1326
+ /* @__PURE__ */ n("span", { children: oe[c.position - 1] }),
1327
+ /* @__PURE__ */ n("span", { children: c.driverName })
1331
1328
  ] }, c.driverId)) })
1332
1329
  ] }),
1333
- /* @__PURE__ */ t(le, { round: r, competitionId: e })
1330
+ /* @__PURE__ */ n(de, { round: s, competitionId: e })
1334
1331
  ] });
1335
1332
  }
1336
- function le({ round: e, competitionId: n, className: s }) {
1337
- var u, g, f, m;
1338
- const [r, a] = D(null), i = (e == null ? void 0 : e.sessions) || [];
1333
+ function de({ round: e, competitionId: t, className: r }) {
1334
+ var u, x, f, h;
1335
+ const [s, a] = M(null), i = (e == null ? void 0 : e.sessions) || [];
1339
1336
  if (!i.length)
1340
- return /* @__PURE__ */ t(P, { message: "No session data for this round." });
1341
- const { data: o } = Je(
1342
- n,
1337
+ return /* @__PURE__ */ n(I, { message: "No session data for this round." });
1338
+ const { data: o } = Xe(
1339
+ t,
1343
1340
  e == null ? void 0 : e.roundNumber,
1344
1341
  {}
1345
- ), d = r || ((u = i.find((y) => y.type === "RACE")) == null ? void 0 : u.type) || ((g = i[0]) == null ? void 0 : g.type), p = i.find((y) => y.type === d) || i[0], c = ((m = (f = o == null ? void 0 : o.sessions) == null ? void 0 : f.find((y) => y.type === d)) == null ? void 0 : m.drivers) || null;
1346
- return /* @__PURE__ */ l("div", { className: s || "", children: [
1347
- /* @__PURE__ */ t(
1348
- ot,
1342
+ ), d = s || ((u = i.find((b) => b.type === "RACE")) == null ? void 0 : u.type) || ((x = i[0]) == null ? void 0 : x.type), p = i.find((b) => b.type === d) || i[0], c = ((h = (f = o == null ? void 0 : o.sessions) == null ? void 0 : f.find((b) => b.type === d)) == null ? void 0 : h.drivers) || null;
1343
+ return /* @__PURE__ */ l("div", { className: r || "", children: [
1344
+ /* @__PURE__ */ n(
1345
+ cn,
1349
1346
  {
1350
1347
  sessions: i,
1351
1348
  activeSession: d,
1352
1349
  onSelect: a
1353
1350
  }
1354
1351
  ),
1355
- /* @__PURE__ */ t(bt, { session: p, sessionLaps: c })
1352
+ /* @__PURE__ */ n(kn, { session: p, sessionLaps: c })
1356
1353
  ] });
1357
1354
  }
1358
- function bt({ session: e, sessionLaps: n }) {
1355
+ function kn({ session: e, sessionLaps: t }) {
1359
1356
  var d;
1360
- const s = e.type === "RACE", [r, a] = D(null);
1357
+ const r = e.type === "RACE", [s, a] = M(null);
1361
1358
  if (!((d = e.results) != null && d.length))
1362
- return /* @__PURE__ */ t(P, { message: `No results for ${e.type}.` });
1363
- const i = dt(e.results), o = s ? 7 : 4;
1364
- return /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1365
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1366
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1367
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1368
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1369
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Best Lap" }),
1370
- s && /* @__PURE__ */ l(F, { children: [
1371
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1372
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1373
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--center", children: "Points" })
1359
+ return /* @__PURE__ */ n(I, { message: `No results for ${e.type}.` });
1360
+ const i = un(e.results), o = r ? 7 : 4;
1361
+ return /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1362
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1363
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1364
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
1365
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1366
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
1367
+ r && /* @__PURE__ */ l(F, { children: [
1368
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1369
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Time / Gap" }),
1370
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--center", children: "Points" })
1374
1371
  ] })
1375
1372
  ] }) }),
1376
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.results.map((p, c) => {
1373
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.results.map((p, c) => {
1377
1374
  var f;
1378
- const u = (f = n == null ? void 0 : n[p.driverId]) == null ? void 0 : f.laps, g = r === p.driverId && !!u;
1379
- return /* @__PURE__ */ t(
1380
- yt,
1375
+ const u = (f = t == null ? void 0 : t[p.driverId]) == null ? void 0 : f.laps, x = s === p.driverId && !!u;
1376
+ return /* @__PURE__ */ n(
1377
+ wn,
1381
1378
  {
1382
1379
  result: p,
1383
- isRace: s,
1380
+ isRace: r,
1384
1381
  fastestSplits: i,
1385
1382
  rowIndex: c,
1386
1383
  hasLapDetail: !!u,
1387
- isExpanded: g,
1388
- onToggle: () => a(g ? null : p.driverId),
1389
- driverLaps: g ? u : null,
1384
+ isExpanded: x,
1385
+ onToggle: () => a(x ? null : p.driverId),
1386
+ driverLaps: x ? u : null,
1390
1387
  colCount: o
1391
1388
  },
1392
1389
  p.driverId || c
@@ -1394,7 +1391,7 @@ function bt({ session: e, sessionLaps: n }) {
1394
1391
  }) })
1395
1392
  ] }) });
1396
1393
  }
1397
- function yt({ result: e, isRace: n, fastestSplits: s, rowIndex: r, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: p }) {
1394
+ function wn({ result: e, isRace: t, fastestSplits: r, rowIndex: s, hasLapDetail: a, isExpanded: i, onToggle: o, driverLaps: d, colCount: p }) {
1398
1395
  const c = e.position <= 3;
1399
1396
  return /* @__PURE__ */ l(F, { children: [
1400
1397
  /* @__PURE__ */ l(
@@ -1404,32 +1401,32 @@ function yt({ result: e, isRace: n, fastestSplits: s, rowIndex: r, hasLapDetail:
1404
1401
  onClick: a ? o : void 0,
1405
1402
  style: a ? { cursor: "pointer" } : void 0,
1406
1403
  children: [
1407
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(oe, { position: e.position }) }),
1404
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ce, { position: e.position }) }),
1408
1405
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1409
- /* @__PURE__ */ t(Q, { nation: e.nation }),
1406
+ /* @__PURE__ */ n(G, { nation: e.nation }),
1410
1407
  e.driverName,
1411
1408
  e.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
1412
1409
  "#",
1413
1410
  e.carNumber
1414
1411
  ] }),
1415
- e.penalty && /* @__PURE__ */ t("span", { className: "pvx-penalty", children: e.penalty })
1412
+ e.penalty && /* @__PURE__ */ n("span", { className: "pvx-penalty", children: e.penalty })
1416
1413
  ] }),
1417
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: I(e.carId) }),
1418
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ t(
1419
- kt,
1414
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: B(e.carId) }),
1415
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n(
1416
+ Ln,
1420
1417
  {
1421
1418
  bestLap: e.bestLapFormatted,
1422
1419
  hasBestLap: e.hasBestLap,
1423
1420
  splits: e.splits,
1424
- fastestSplits: s,
1425
- showAbove: r <= 1
1421
+ fastestSplits: r,
1422
+ showAbove: s <= 1
1426
1423
  }
1427
1424
  ) }),
1428
- n && /* @__PURE__ */ l(F, { children: [
1429
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
1430
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
1425
+ t && /* @__PURE__ */ l(F, { children: [
1426
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: e.lapsCompleted }),
1427
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: e.position === 1 ? e.totalTime || "-" : e.gap || "-" }),
1431
1428
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--center", children: [
1432
- /* @__PURE__ */ t("span", { className: "pvx-session-points", children: e.points }),
1429
+ /* @__PURE__ */ n("span", { className: "pvx-session-points", children: e.points }),
1433
1430
  e.pointsOverride !== 0 && e.pointsOverride && /* @__PURE__ */ l("span", { className: "pvx-points-override", children: [
1434
1431
  "(",
1435
1432
  e.pointsOverride > 0 ? "+" : "",
@@ -1441,170 +1438,170 @@ function yt({ result: e, isRace: n, fastestSplits: s, rowIndex: r, hasLapDetail:
1441
1438
  ]
1442
1439
  }
1443
1440
  ),
1444
- i && d && /* @__PURE__ */ t("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ t("td", { colSpan: p, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ t(wt, { laps: d }) }) })
1441
+ i && d && /* @__PURE__ */ n("tr", { className: "pvx-row pvx-row--lap-detail", children: /* @__PURE__ */ n("td", { colSpan: p, className: "pvx-td pvx-td--lap-detail", children: /* @__PURE__ */ n(Cn, { laps: d }) }) })
1445
1442
  ] });
1446
1443
  }
1447
- function wt({ laps: e }) {
1448
- const n = Math.min(...e.filter((s) => s.valid && s.timeMs > 0).map((s) => s.timeMs));
1444
+ function Cn({ laps: e }) {
1445
+ const t = Math.min(...e.filter((r) => r.valid && r.timeMs > 0).map((r) => r.timeMs));
1449
1446
  return /* @__PURE__ */ l("table", { className: "pvx-table pvx-table--laps", children: [
1450
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1451
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
1452
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Time" }),
1453
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
1454
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
1455
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
1447
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1448
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Lap" }),
1449
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Time" }),
1450
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
1451
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
1452
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" })
1456
1453
  ] }) }),
1457
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.map((s) => {
1454
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.map((r) => {
1458
1455
  var a;
1459
- const r = s.valid && s.timeMs === n;
1460
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${s.valid ? "" : "pvx-row--invalid"} ${r ? "pvx-row--fastest" : ""}`, children: [
1461
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--muted", children: s.lap }),
1462
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono", children: s.time }),
1463
- (s.splits || []).map((i, o) => /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
1464
- Array.from({ length: Math.max(0, 3 - (((a = s.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
1465
- ] }, s.lap);
1456
+ const s = r.valid && r.timeMs === t;
1457
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${r.valid ? "" : "pvx-row--invalid"} ${s ? "pvx-row--fastest" : ""}`, children: [
1458
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--muted", children: r.lap }),
1459
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: r.time }),
1460
+ (r.splits || []).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: i }, o)),
1461
+ Array.from({ length: Math.max(0, 3 - (((a = r.splits) == null ? void 0 : a.length) || 0)) }).map((i, o) => /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm" }, `pad-${o}`))
1462
+ ] }, r.lap);
1466
1463
  }) })
1467
1464
  ] });
1468
1465
  }
1469
- function kt({ bestLap: e, hasBestLap: n, splits: s, fastestSplits: r, showAbove: a }) {
1470
- return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${n ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1471
- /* @__PURE__ */ t("span", { className: "pvx-best-lap-time", children: e }),
1472
- (s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ t("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ t("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
1473
- const d = r && i === r[o];
1466
+ function Ln({ bestLap: e, hasBestLap: t, splits: r, fastestSplits: s, showAbove: a }) {
1467
+ return e ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${t ? "pvx-best-lap-cell--fastest" : ""}`, children: [
1468
+ /* @__PURE__ */ n("span", { className: "pvx-best-lap-time", children: e }),
1469
+ (r == null ? void 0 : r.length) > 0 && /* @__PURE__ */ n("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ n("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: r.map((i, o) => {
1470
+ const d = s && i === s[o];
1474
1471
  return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
1475
1472
  /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
1476
1473
  "S",
1477
1474
  o + 1
1478
1475
  ] }),
1479
- /* @__PURE__ */ t("span", { className: d ? "pvx-splits-tooltip-best" : "", children: i })
1476
+ /* @__PURE__ */ n("span", { className: d ? "pvx-splits-tooltip-best" : "", children: i })
1480
1477
  ] }, o);
1481
1478
  }) }) })
1482
- ] }) : /* @__PURE__ */ t("span", { className: "pvx-td--muted", children: "-" });
1479
+ ] }) : /* @__PURE__ */ n("span", { className: "pvx-td--muted", children: "-" });
1483
1480
  }
1484
- function Nn({ competitionId: e, className: n }) {
1485
- const { getSteamId: s } = C(), { data: r, isLoading: a } = fe(e), i = s();
1481
+ function bt({ competitionId: e, className: t }) {
1482
+ const { getSteamId: r } = C(), { data: s, isLoading: a } = ye(e), i = r();
1486
1483
  if (a)
1487
- return /* @__PURE__ */ t(E, { message: "Loading drivers..." });
1488
- const o = (r == null ? void 0 : r.drivers) || (r == null ? void 0 : r.entries) || [];
1489
- return o.length ? /* @__PURE__ */ t("div", { className: `pvx-entry-grid ${n || ""}`, children: o.map((d) => {
1484
+ return /* @__PURE__ */ n(q, { message: "Loading drivers..." });
1485
+ const o = (s == null ? void 0 : s.drivers) || (s == null ? void 0 : s.entries) || [];
1486
+ return o.length ? /* @__PURE__ */ n("div", { className: `pvx-entry-grid ${t || ""}`, children: o.map((d) => {
1490
1487
  var c, u;
1491
1488
  const p = i && d.steamId === i;
1492
1489
  return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${p ? "pvx-entry-card--you" : ""}`, children: [
1493
- d.avatarUrl ? /* @__PURE__ */ t(
1490
+ d.avatarUrl ? /* @__PURE__ */ n(
1494
1491
  "img",
1495
1492
  {
1496
1493
  src: d.avatarUrl,
1497
1494
  alt: "",
1498
1495
  className: "pvx-entry-avatar"
1499
1496
  }
1500
- ) : /* @__PURE__ */ t("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((u = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : u.toUpperCase()) || "?" }),
1497
+ ) : /* @__PURE__ */ n("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((u = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : u.toUpperCase()) || "?" }),
1501
1498
  /* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
1502
1499
  d.displayName,
1503
- p && /* @__PURE__ */ t("span", { className: "pvx-entry-you", children: " (you)" })
1500
+ p && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
1504
1501
  ] })
1505
1502
  ] }, d.steamId || d.driverId);
1506
- }) }) : /* @__PURE__ */ t(P, { message: "No drivers registered yet." });
1503
+ }) }) : /* @__PURE__ */ n(I, { message: "No drivers registered yet." });
1507
1504
  }
1508
- function bn({
1505
+ function yt({
1509
1506
  competitionId: e,
1510
- driverData: n,
1511
- className: s,
1512
- children: r
1507
+ driverData: t,
1508
+ className: r,
1509
+ children: s
1513
1510
  }) {
1514
- const { data: a, isLoading: i } = ee(e), { isPowerMode: o } = te(), d = ne(e), p = Ne(e), c = be(e), u = (a == null ? void 0 : a.isRegistered) || !1, g = i || p.isPending || c.isPending, f = p.error || c.error || null, m = () => {
1515
- o && p.mutate(n || {});
1516
- }, y = () => {
1511
+ const { data: a, isLoading: i } = te(e), { isPowerMode: o } = re(), d = se(e), p = ke(e), c = we(e), u = (a == null ? void 0 : a.isRegistered) || !1, x = i || p.isPending || c.isPending, f = p.error || c.error || null, h = () => {
1512
+ o && p.mutate(t || {});
1513
+ }, b = () => {
1517
1514
  o && c.mutate();
1518
1515
  };
1519
- return typeof r == "function" ? r({ isRegistered: u, isLoading: g, register: m, withdraw: y, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ t(
1516
+ return typeof s == "function" ? s({ isRegistered: u, isLoading: x, register: h, withdraw: b, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ n(
1520
1517
  "button",
1521
1518
  {
1522
- className: `pvx-comp-register-btn ${s || ""}`,
1523
- onClick: u ? y : m,
1524
- disabled: g,
1525
- children: g ? "Loading..." : u ? "Withdraw" : "Register"
1519
+ className: `pvx-comp-register-btn ${r || ""}`,
1520
+ onClick: u ? b : h,
1521
+ disabled: x,
1522
+ children: x ? "Loading..." : u ? "Withdraw" : "Register"
1526
1523
  }
1527
- ) : /* @__PURE__ */ t(
1524
+ ) : /* @__PURE__ */ n(
1528
1525
  "a",
1529
1526
  {
1530
1527
  href: d,
1531
1528
  target: "_blank",
1532
1529
  rel: "noopener noreferrer",
1533
- className: `pvx-comp-register-link ${s || ""}`,
1530
+ className: `pvx-comp-register-link ${r || ""}`,
1534
1531
  children: u ? "View Registration" : "Register on PitVox"
1535
1532
  }
1536
1533
  );
1537
1534
  }
1538
- function yn({ competitionId: e, registration: n, onWithdrawSuccess: s, className: r }) {
1539
- const { getSteamId: a } = C(), { isPowerMode: i } = te(), o = ne(e), { data: d, isLoading: p } = ee(e), { data: c, isLoading: u } = fe(e), g = Ne(e), f = be(e), m = a(), y = (d == null ? void 0 : d.isRegistered) || !1, x = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], v = n || {}, N = x.length || v.currentCount || 0, h = v.maxParticipants && N >= v.maxParticipants, w = v.deadline && new Date(v.deadline) < /* @__PURE__ */ new Date(), b = v.isOpen && !w && !h;
1540
- return p || u ? /* @__PURE__ */ t(E, { message: "Loading registration..." }) : y ? /* @__PURE__ */ t("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ t(
1541
- Lt,
1535
+ function kt({ competitionId: e, registration: t, onWithdrawSuccess: r, className: s }) {
1536
+ const { getSteamId: a } = C(), { isPowerMode: i } = re(), o = se(e), { data: d, isLoading: p } = te(e), { data: c, isLoading: u } = ye(e), x = ke(e), f = we(e), h = a(), b = (d == null ? void 0 : d.isRegistered) || !1, g = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], m = t || {}, N = g.length || m.currentCount || 0, v = m.maxParticipants && N >= m.maxParticipants, k = m.deadline && new Date(m.deadline) < /* @__PURE__ */ new Date(), y = m.isOpen && !k && !v;
1537
+ return p || u ? /* @__PURE__ */ n(q, { message: "Loading registration..." }) : b ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1538
+ Tn,
1542
1539
  {
1543
1540
  competitionId: e,
1544
- drivers: x,
1545
- steamId: m,
1541
+ drivers: g,
1542
+ steamId: h,
1546
1543
  isPowerMode: i,
1547
1544
  registrationUrl: o,
1548
1545
  withdrawMutation: f,
1549
- onWithdrawSuccess: s,
1550
- registration: v
1546
+ onWithdrawSuccess: r,
1547
+ registration: m
1551
1548
  }
1552
- ) }) : b ? m ? i ? /* @__PURE__ */ t("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ t(
1553
- Ct,
1549
+ ) }) : y ? h ? i ? /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n(
1550
+ Sn,
1554
1551
  {
1555
1552
  competitionId: e,
1556
- registerMutation: g,
1557
- registration: v
1553
+ registerMutation: x,
1554
+ registration: m
1558
1555
  }
1559
- ) }) : /* @__PURE__ */ t("div", { className: `pvx-reg-panel ${r || ""}`, children: /* @__PURE__ */ t("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ t("div", { className: `pvx-reg-panel ${r || ""}`, children: i ? /* @__PURE__ */ t("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ t("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ t("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${r || ""}`, children: [
1560
- /* @__PURE__ */ t("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : w ? "Registration deadline has passed." : "Registration is closed." }),
1561
- x.length > 0 && /* @__PURE__ */ t(Re, { drivers: x, steamId: m })
1556
+ ) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ n("div", { className: `pvx-reg-panel ${s || ""}`, children: i ? /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ n("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${s || ""}`, children: [
1557
+ /* @__PURE__ */ n("div", { className: "pvx-reg-status-msg", children: v ? "Registration is full." : k ? "Registration deadline has passed." : "Registration is closed." }),
1558
+ g.length > 0 && /* @__PURE__ */ n(De, { drivers: g, steamId: h })
1562
1559
  ] });
1563
1560
  }
1564
- function Ct({ competitionId: e, registerMutation: n, registration: s }) {
1565
- const [r, a] = D(""), [i, o] = D("intermediate"), [d, p] = D(""), c = (m) => {
1566
- m.preventDefault(), n.mutate({
1567
- discordUsername: r || void 0,
1561
+ function Sn({ competitionId: e, registerMutation: t, registration: r }) {
1562
+ const [s, a] = M(""), [i, o] = M("intermediate"), [d, p] = M(""), c = (h) => {
1563
+ h.preventDefault(), t.mutate({
1564
+ discordUsername: s || void 0,
1568
1565
  experience: i,
1569
1566
  comments: d || void 0
1570
1567
  });
1571
- }, u = s || {}, g = u.currentCount || 0, f = u.maxParticipants;
1568
+ }, u = r || {}, x = u.currentCount || 0, f = u.maxParticipants;
1572
1569
  return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
1573
1570
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1574
- /* @__PURE__ */ t("h3", { className: "pvx-reg-form-title", children: "Register" }),
1575
- f && /* @__PURE__ */ t($e, { count: g, max: f })
1571
+ /* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Register" }),
1572
+ f && /* @__PURE__ */ n(Me, { count: x, max: f })
1576
1573
  ] }),
1577
- n.error && /* @__PURE__ */ t("div", { className: "pvx-reg-error", children: n.error.message || "Registration failed" }),
1574
+ t.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: t.error.message || "Registration failed" }),
1578
1575
  /* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
1579
1576
  /* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-discord-${e}`, children: [
1580
1577
  "Discord Username ",
1581
- /* @__PURE__ */ t("span", { className: "pvx-reg-optional", children: "(optional)" })
1578
+ /* @__PURE__ */ n("span", { className: "pvx-reg-optional", children: "(optional)" })
1582
1579
  ] }),
1583
- /* @__PURE__ */ t(
1580
+ /* @__PURE__ */ n(
1584
1581
  "input",
1585
1582
  {
1586
1583
  id: `pvx-discord-${e}`,
1587
1584
  type: "text",
1588
1585
  className: "pvx-reg-input",
1589
1586
  placeholder: "e.g. username",
1590
- value: r,
1591
- onChange: (m) => a(m.target.value)
1587
+ value: s,
1588
+ onChange: (h) => a(h.target.value)
1592
1589
  }
1593
1590
  )
1594
1591
  ] }),
1595
1592
  /* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
1596
- /* @__PURE__ */ t("label", { className: "pvx-reg-label", htmlFor: `pvx-exp-${e}`, children: "Experience Level" }),
1593
+ /* @__PURE__ */ n("label", { className: "pvx-reg-label", htmlFor: `pvx-exp-${e}`, children: "Experience Level" }),
1597
1594
  /* @__PURE__ */ l(
1598
1595
  "select",
1599
1596
  {
1600
1597
  id: `pvx-exp-${e}`,
1601
1598
  className: "pvx-reg-select",
1602
1599
  value: i,
1603
- onChange: (m) => o(m.target.value),
1600
+ onChange: (h) => o(h.target.value),
1604
1601
  children: [
1605
- /* @__PURE__ */ t("option", { value: "beginner", children: "Beginner" }),
1606
- /* @__PURE__ */ t("option", { value: "intermediate", children: "Intermediate" }),
1607
- /* @__PURE__ */ t("option", { value: "advanced", children: "Advanced" })
1602
+ /* @__PURE__ */ n("option", { value: "beginner", children: "Beginner" }),
1603
+ /* @__PURE__ */ n("option", { value: "intermediate", children: "Intermediate" }),
1604
+ /* @__PURE__ */ n("option", { value: "advanced", children: "Advanced" })
1608
1605
  ]
1609
1606
  }
1610
1607
  )
@@ -1612,9 +1609,9 @@ function Ct({ competitionId: e, registerMutation: n, registration: s }) {
1612
1609
  /* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
1613
1610
  /* @__PURE__ */ l("label", { className: "pvx-reg-label", htmlFor: `pvx-comments-${e}`, children: [
1614
1611
  "Comments ",
1615
- /* @__PURE__ */ t("span", { className: "pvx-reg-optional", children: "(optional)" })
1612
+ /* @__PURE__ */ n("span", { className: "pvx-reg-optional", children: "(optional)" })
1616
1613
  ] }),
1617
- /* @__PURE__ */ t(
1614
+ /* @__PURE__ */ n(
1618
1615
  "textarea",
1619
1616
  {
1620
1617
  id: `pvx-comments-${e}`,
@@ -1622,40 +1619,40 @@ function Ct({ competitionId: e, registerMutation: n, registration: s }) {
1622
1619
  rows: 3,
1623
1620
  placeholder: "Anything the organisers should know?",
1624
1621
  value: d,
1625
- onChange: (m) => p(m.target.value)
1622
+ onChange: (h) => p(h.target.value)
1626
1623
  }
1627
1624
  )
1628
1625
  ] }),
1629
- /* @__PURE__ */ t("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ t(
1626
+ /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n(
1630
1627
  "button",
1631
1628
  {
1632
1629
  type: "submit",
1633
1630
  className: "pvx-comp-register-btn",
1634
- disabled: n.isPending,
1635
- children: n.isPending ? "Registering..." : "Register"
1631
+ disabled: t.isPending,
1632
+ children: t.isPending ? "Registering..." : "Register"
1636
1633
  }
1637
1634
  ) })
1638
1635
  ] });
1639
1636
  }
1640
- function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1641
- const [p, c] = D(!1), u = () => {
1637
+ function Tn({ competitionId: e, drivers: t, steamId: r, isPowerMode: s, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
1638
+ const [p, c] = M(!1), u = () => {
1642
1639
  i.mutate(void 0, {
1643
1640
  onSuccess: () => {
1644
1641
  c(!1), o && o();
1645
1642
  }
1646
1643
  });
1647
- }, g = d || {}, f = n.length || g.currentCount || 0, m = g.maxParticipants;
1644
+ }, x = d || {}, f = t.length || x.currentCount || 0, h = x.maxParticipants;
1648
1645
  return /* @__PURE__ */ l(F, { children: [
1649
1646
  /* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
1650
- /* @__PURE__ */ t("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
1651
- m && /* @__PURE__ */ t($e, { count: f, max: m })
1647
+ /* @__PURE__ */ n("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
1648
+ h && /* @__PURE__ */ n(Me, { count: f, max: h })
1652
1649
  ] }),
1653
- /* @__PURE__ */ t(Re, { drivers: n, steamId: s }),
1654
- i.error && /* @__PURE__ */ t("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
1655
- r ? /* @__PURE__ */ t("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
1656
- /* @__PURE__ */ t("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
1650
+ /* @__PURE__ */ n(De, { drivers: t, steamId: r }),
1651
+ i.error && /* @__PURE__ */ n("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
1652
+ s ? /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: p ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
1653
+ /* @__PURE__ */ n("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
1657
1654
  /* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
1658
- /* @__PURE__ */ t(
1655
+ /* @__PURE__ */ n(
1659
1656
  "button",
1660
1657
  {
1661
1658
  type: "button",
@@ -1664,7 +1661,7 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
1664
1661
  children: "Cancel"
1665
1662
  }
1666
1663
  ),
1667
- /* @__PURE__ */ t(
1664
+ /* @__PURE__ */ n(
1668
1665
  "button",
1669
1666
  {
1670
1667
  type: "button",
@@ -1675,7 +1672,7 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
1675
1672
  }
1676
1673
  )
1677
1674
  ] })
1678
- ] }) : /* @__PURE__ */ t(
1675
+ ] }) : /* @__PURE__ */ n(
1679
1676
  "button",
1680
1677
  {
1681
1678
  type: "button",
@@ -1683,104 +1680,104 @@ function Lt({ competitionId: e, drivers: n, steamId: s, isPowerMode: r, registra
1683
1680
  onClick: () => c(!0),
1684
1681
  children: "Unregister"
1685
1682
  }
1686
- ) }) : /* @__PURE__ */ t("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ t("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
1683
+ ) }) : /* @__PURE__ */ n("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ n("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
1687
1684
  ] });
1688
1685
  }
1689
- function Re({ drivers: e, steamId: n }) {
1686
+ function De({ drivers: e, steamId: t }) {
1690
1687
  if (!e.length)
1691
- return /* @__PURE__ */ t("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
1692
- const s = [...e].sort((r, a) => {
1693
- const i = n && r.steamId === n ? -1 : 0, o = n && a.steamId === n ? -1 : 0;
1688
+ return /* @__PURE__ */ n("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
1689
+ const r = [...e].sort((s, a) => {
1690
+ const i = t && s.steamId === t ? -1 : 0, o = t && a.steamId === t ? -1 : 0;
1694
1691
  return i - o;
1695
1692
  });
1696
- return /* @__PURE__ */ t("div", { className: "pvx-reg-driver-list", children: s.map((r) => {
1693
+ return /* @__PURE__ */ n("div", { className: "pvx-reg-driver-list", children: r.map((s) => {
1697
1694
  var i, o;
1698
- const a = n && r.steamId === n;
1695
+ const a = t && s.steamId === t;
1699
1696
  return /* @__PURE__ */ l(
1700
1697
  "div",
1701
1698
  {
1702
1699
  className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
1703
1700
  children: [
1704
- r.avatarUrl ? /* @__PURE__ */ t("img", { src: r.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ t("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = r.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1701
+ s.avatarUrl ? /* @__PURE__ */ n("img", { src: s.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = s.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
1705
1702
  /* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
1706
- r.displayName,
1707
- a && /* @__PURE__ */ t("span", { className: "pvx-entry-you", children: " (you)" })
1703
+ s.displayName,
1704
+ a && /* @__PURE__ */ n("span", { className: "pvx-entry-you", children: " (you)" })
1708
1705
  ] })
1709
1706
  ]
1710
1707
  },
1711
- r.steamId || r.driverId
1708
+ s.steamId || s.driverId
1712
1709
  );
1713
1710
  }) });
1714
1711
  }
1715
- function $e({ count: e, max: n }) {
1716
- const s = n ? e / n * 100 : 0, r = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
1717
- return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${r}`, children: [
1712
+ function Me({ count: e, max: t }) {
1713
+ const r = t ? e / t * 100 : 0, s = r >= 100 ? "full" : r >= 75 ? "warning" : "ok";
1714
+ return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${s}`, children: [
1718
1715
  e,
1719
1716
  "/",
1720
- n,
1717
+ t,
1721
1718
  " drivers"
1722
1719
  ] });
1723
1720
  }
1724
- function wn({ competitionId: e, className: n }) {
1725
- const { data: s, isLoading: r } = xe(e), a = (s == null ? void 0 : s.type) === "championship", i = (s == null ? void 0 : s.type) === "hotlap", { data: o } = Ye(i ? e : null), d = S(
1721
+ function wt({ competitionId: e, className: t }) {
1722
+ const { data: r, isLoading: s } = Ne(e), a = (r == null ? void 0 : r.type) === "championship", i = (r == null ? void 0 : r.type) === "hotlap", { data: o } = Ze(i ? e : null), d = S(
1726
1723
  () => {
1727
- var b;
1728
- return ((b = s == null ? void 0 : s.rounds) == null ? void 0 : b.filter((L) => L.isFinalized)) || [];
1724
+ var y;
1725
+ return ((y = r == null ? void 0 : r.rounds) == null ? void 0 : y.filter((L) => L.isFinalized)) || [];
1729
1726
  },
1730
- [s]
1727
+ [r]
1731
1728
  ), p = S(
1732
- () => d.map((b) => b.roundNumber),
1729
+ () => d.map((y) => y.roundNumber),
1733
1730
  [d]
1734
- ), { data: c = [], isLoading: u } = Qe(
1731
+ ), { data: c = [], isLoading: u } = Je(
1735
1732
  e,
1736
1733
  p
1737
- ), g = i && c.length > 0 ? c[0] : null, f = (g == null ? void 0 : g.sessions) || [], m = i ? "leaderboard" : a ? "standings" : p.length > 0 ? `round-${p[p.length - 1]}` : null, [y, x] = D(null), v = y || m;
1738
- if (r || u)
1739
- return /* @__PURE__ */ t(E, { message: "Loading results..." });
1740
- if (!s)
1741
- return /* @__PURE__ */ t(P, { message: "Competition not found." });
1734
+ ), x = i && c.length > 0 ? c[0] : null, f = (x == null ? void 0 : x.sessions) || [], h = i ? "leaderboard" : a ? "standings" : p.length > 0 ? `round-${p[p.length - 1]}` : null, [b, g] = M(null), m = b || h;
1735
+ if (s || u)
1736
+ return /* @__PURE__ */ n(q, { message: "Loading results..." });
1737
+ if (!r)
1738
+ return /* @__PURE__ */ n(I, { message: "Competition not found." });
1742
1739
  if (!d.length)
1743
- return /* @__PURE__ */ t(P, { message: "No results available yet. Results will appear here once rounds are finalised." });
1744
- const N = new Map(c.map((b) => [`round-${b.roundNumber}`, b])), h = [];
1745
- if (a && h.push({ id: "standings", label: "Standings" }), i) {
1746
- h.push({ id: "leaderboard", label: "Leaderboard" });
1747
- for (const b of f)
1748
- h.push({ id: `session-${b.type}`, label: ie(b.type) });
1740
+ return /* @__PURE__ */ n(I, { message: "No results available yet. Results will appear here once rounds are finalised." });
1741
+ const N = new Map(c.map((y) => [`round-${y.roundNumber}`, y])), v = [];
1742
+ if (a && v.push({ id: "standings", label: "Standings" }), i) {
1743
+ v.push({ id: "leaderboard", label: "Leaderboard" });
1744
+ for (const y of f)
1745
+ v.push({ id: `session-${y.type}`, label: le(y.type) });
1749
1746
  } else
1750
- for (const b of d)
1751
- h.push({
1752
- id: `round-${b.roundNumber}`,
1753
- label: `R${b.roundNumber}`,
1747
+ for (const y of d)
1748
+ v.push({
1749
+ id: `round-${y.roundNumber}`,
1750
+ label: `R${y.roundNumber}`,
1754
1751
  track: null
1755
1752
  });
1756
- const w = N.get(v);
1757
- return /* @__PURE__ */ l("div", { className: n || "", children: [
1758
- /* @__PURE__ */ t("div", { className: "pvx-results-tabs", children: h.map((b) => /* @__PURE__ */ l(
1753
+ const k = N.get(m);
1754
+ return /* @__PURE__ */ l("div", { className: t || "", children: [
1755
+ /* @__PURE__ */ n("div", { className: "pvx-results-tabs", children: v.map((y) => /* @__PURE__ */ l(
1759
1756
  "button",
1760
1757
  {
1761
- className: `pvx-results-tab ${v === b.id ? "pvx-results-tab--active" : ""}`,
1762
- onClick: () => x(b.id),
1763
- title: b.track || void 0,
1758
+ className: `pvx-results-tab ${m === y.id ? "pvx-results-tab--active" : ""}`,
1759
+ onClick: () => g(y.id),
1760
+ title: y.track || void 0,
1764
1761
  children: [
1765
- /* @__PURE__ */ t("span", { className: "pvx-results-tab-label", children: b.label }),
1766
- b.track && /* @__PURE__ */ t("span", { className: "pvx-results-tab-track", children: b.track })
1762
+ /* @__PURE__ */ n("span", { className: "pvx-results-tab-label", children: y.label }),
1763
+ y.track && /* @__PURE__ */ n("span", { className: "pvx-results-tab-track", children: y.track })
1767
1764
  ]
1768
1765
  },
1769
- b.id
1766
+ y.id
1770
1767
  )) }),
1771
- v === "standings" ? /* @__PURE__ */ t(ft, { competitionId: e }) : v === "leaderboard" ? /* @__PURE__ */ t(Tt, { leaderboard: o, config: s }) : v != null && v.startsWith("session-") ? /* @__PURE__ */ t(
1772
- Rt,
1768
+ m === "standings" ? /* @__PURE__ */ n(bn, { competitionId: e }) : m === "leaderboard" ? /* @__PURE__ */ n(Rn, { leaderboard: o, config: r }) : m != null && m.startsWith("session-") ? /* @__PURE__ */ n(
1769
+ Dn,
1773
1770
  {
1774
- session: f.find((b) => `session-${b.type}` === v),
1775
- round: g,
1771
+ session: f.find((y) => `session-${y.type}` === m),
1772
+ round: x,
1776
1773
  competitionId: e
1777
1774
  }
1778
- ) : w ? /* @__PURE__ */ t(St, { round: w, competitionId: e }) : /* @__PURE__ */ t(P, { message: "No results for this round." })
1775
+ ) : k ? /* @__PURE__ */ n($n, { round: k, competitionId: e }) : /* @__PURE__ */ n(I, { message: "No results for this round." })
1779
1776
  ] });
1780
1777
  }
1781
- function St({ round: e, competitionId: n }) {
1778
+ function $n({ round: e, competitionId: t }) {
1782
1779
  var i;
1783
- const r = (e.sessions || []).find((o) => o.type === "RACE"), a = (i = r == null ? void 0 : r.results) == null ? void 0 : i.filter((o) => o.position <= 3).sort((o, d) => o.position - d.position);
1780
+ const s = (e.sessions || []).find((o) => o.type === "RACE"), a = (i = s == null ? void 0 : s.results) == null ? void 0 : i.filter((o) => o.position <= 3).sort((o, d) => o.position - d.position);
1784
1781
  return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
1785
1782
  /* @__PURE__ */ l("div", { className: "pvx-card-header--split", children: [
1786
1783
  /* @__PURE__ */ l("div", { children: [
@@ -1789,25 +1786,25 @@ function St({ round: e, competitionId: n }) {
1789
1786
  e.roundNumber,
1790
1787
  e.track ? `: ${e.track}` : ""
1791
1788
  ] }),
1792
- e.startTime && /* @__PURE__ */ t("span", { className: "pvx-standings-subtitle", children: new Date(e.startTime).toLocaleDateString("en-GB", {
1789
+ e.startTime && /* @__PURE__ */ n("span", { className: "pvx-standings-subtitle", children: new Date(e.startTime).toLocaleDateString("en-GB", {
1793
1790
  day: "numeric",
1794
1791
  month: "long",
1795
1792
  year: "numeric"
1796
1793
  }) })
1797
1794
  ] }),
1798
- (a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ t("div", { className: "pvx-round-podium-summary", children: a.map((o) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1799
- /* @__PURE__ */ t("span", { children: ae[o.position - 1] }),
1800
- /* @__PURE__ */ t("span", { children: o.driverName })
1795
+ (a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ n("div", { className: "pvx-round-podium-summary", children: a.map((o) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
1796
+ /* @__PURE__ */ n("span", { children: oe[o.position - 1] }),
1797
+ /* @__PURE__ */ n("span", { children: o.driverName })
1801
1798
  ] }, o.driverId)) })
1802
1799
  ] }),
1803
- /* @__PURE__ */ t(le, { round: e, competitionId: n })
1800
+ /* @__PURE__ */ n(de, { round: e, competitionId: t })
1804
1801
  ] });
1805
1802
  }
1806
- function Tt({ leaderboard: e, config: n }) {
1807
- var s;
1808
- return (s = e == null ? void 0 : e.drivers) != null && s.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
1809
- /* @__PURE__ */ t("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
1810
- /* @__PURE__ */ t("h4", { className: "pvx-card-title", children: e.track || (n == null ? void 0 : n.name) || "Hotlap Leaderboard" }),
1803
+ function Rn({ leaderboard: e, config: t }) {
1804
+ var r;
1805
+ return (r = e == null ? void 0 : e.drivers) != null && r.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
1806
+ /* @__PURE__ */ n("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { children: [
1807
+ /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: e.track || (t == null ? void 0 : t.name) || "Hotlap Leaderboard" }),
1811
1808
  /* @__PURE__ */ l("span", { className: "pvx-standings-subtitle", children: [
1812
1809
  e.sessionsCompleted,
1813
1810
  " session",
@@ -1815,211 +1812,251 @@ function Tt({ leaderboard: e, config: n }) {
1815
1812
  " completed"
1816
1813
  ] })
1817
1814
  ] }) }),
1818
- /* @__PURE__ */ t("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1819
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1820
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1821
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Driver" }),
1822
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1823
- /* @__PURE__ */ t("th", { className: "pvx-th", children: "Best Lap" }),
1824
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1825
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Sessions" }),
1826
- /* @__PURE__ */ t("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
1815
+ /* @__PURE__ */ n("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
1816
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
1817
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
1818
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Driver" }),
1819
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Car" }),
1820
+ /* @__PURE__ */ n("th", { className: "pvx-th", children: "Best Lap" }),
1821
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Laps" }),
1822
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Sessions" }),
1823
+ /* @__PURE__ */ n("th", { className: "pvx-th pvx-hidden-below-sm", children: "Gap" })
1827
1824
  ] }) }),
1828
- /* @__PURE__ */ t("tbody", { className: "pvx-tbody", children: e.drivers.map((r) => {
1829
- const a = r.position === 1 ? "" : `+${((r.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
1830
- return /* @__PURE__ */ l("tr", { className: `pvx-row ${r.position <= 3 ? "pvx-row--podium" : ""}`, children: [
1831
- /* @__PURE__ */ t("td", { className: "pvx-td", children: /* @__PURE__ */ t(oe, { position: r.position }) }),
1825
+ /* @__PURE__ */ n("tbody", { className: "pvx-tbody", children: e.drivers.map((s) => {
1826
+ const a = s.position === 1 ? "" : `+${((s.bestLapMs - e.drivers[0].bestLapMs) / 1e3).toFixed(3)}`;
1827
+ return /* @__PURE__ */ l("tr", { className: `pvx-row ${s.position <= 3 ? "pvx-row--podium" : ""}`, children: [
1828
+ /* @__PURE__ */ n("td", { className: "pvx-td", children: /* @__PURE__ */ n(ce, { position: s.position }) }),
1832
1829
  /* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
1833
- /* @__PURE__ */ t(Q, { nation: r.nation }),
1834
- r.driverName
1830
+ /* @__PURE__ */ n(G, { nation: s.nation }),
1831
+ s.driverName
1835
1832
  ] }),
1836
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: I(r.carId) }),
1837
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ t("span", { className: r.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: r.bestLapFormatted }) }),
1838
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: r.totalLaps }),
1839
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-hidden-below-sm", children: r.sessionsParticipated }),
1840
- /* @__PURE__ */ t("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: a })
1841
- ] }, r.driverId);
1833
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: B(s.carId) }),
1834
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ n("span", { className: s.position === 1 ? "pvx-best-lap-cell--fastest" : "", children: s.bestLapFormatted }) }),
1835
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.totalLaps }),
1836
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-hidden-below-sm", children: s.sessionsParticipated }),
1837
+ /* @__PURE__ */ n("td", { className: "pvx-td pvx-td--mono pvx-td--muted pvx-hidden-below-sm", children: a })
1838
+ ] }, s.driverId);
1842
1839
  }) })
1843
1840
  ] }) })
1844
- ] }) : /* @__PURE__ */ t(P, { message: "No lap times recorded yet." });
1841
+ ] }) : /* @__PURE__ */ n(I, { message: "No lap times recorded yet." });
1845
1842
  }
1846
- function Rt({ session: e, round: n, competitionId: s }) {
1843
+ function Dn({ session: e, round: t, competitionId: r }) {
1847
1844
  return e ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
1848
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ t("h4", { className: "pvx-card-title", children: ie(e.type) }) }),
1849
- /* @__PURE__ */ t(
1850
- le,
1845
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ n("h4", { className: "pvx-card-title", children: le(e.type) }) }),
1846
+ /* @__PURE__ */ n(
1847
+ de,
1851
1848
  {
1852
- round: { ...n, sessions: [e] },
1853
- competitionId: s
1849
+ round: { ...t, sessions: [e] },
1850
+ competitionId: r
1854
1851
  }
1855
1852
  )
1856
- ] }) : /* @__PURE__ */ t(P, { message: "Session data not available." });
1853
+ ] }) : /* @__PURE__ */ n(I, { message: "Session data not available." });
1857
1854
  }
1858
- function $t(e) {
1859
- const { cdnUrl: n } = C(), s = T({
1855
+ function Mn(e) {
1856
+ const { cdnUrl: t } = C(), r = T({
1860
1857
  queryKey: ["pitvox", "laps", "global", e, "index"],
1861
- queryFn: () => R(n, Ke(null, e)),
1858
+ queryFn: () => $(t, me(null, e)),
1862
1859
  enabled: !!e,
1863
1860
  staleTime: 3e4,
1864
1861
  refetchInterval: 3e4
1865
- }), r = s.data;
1862
+ }), s = r.data;
1863
+ return {
1864
+ isLoading: r.isLoading,
1865
+ error: r.error,
1866
+ data: s ? {
1867
+ driverName: s.driverName || "Driver",
1868
+ lapCount: s.lapCount || 0,
1869
+ trackBreakdown: s.trackBreakdown || [],
1870
+ carBreakdown: s.carBreakdown || [],
1871
+ recordsHeld: s.recordsHeld || 0,
1872
+ currentRecords: s.currentRecords || [],
1873
+ bestRanking: s.bestRanking ?? null,
1874
+ bestRankingTrackId: s.bestRankingTrackId ?? null,
1875
+ bestRankingLayout: s.bestRankingLayout ?? null,
1876
+ bestRankingCarId: s.bestRankingCarId ?? null,
1877
+ generatedAt: s.generatedAt
1878
+ } : null
1879
+ };
1880
+ }
1881
+ function Bn(e) {
1882
+ const { cdnUrl: t, partnerSlug: r } = C(), s = T({
1883
+ queryKey: ["pitvox", "laps", r || "global", e, "index"],
1884
+ queryFn: () => $(t, me(r, e)),
1885
+ enabled: !!e,
1886
+ staleTime: 3e4,
1887
+ refetchInterval: 3e4
1888
+ }), a = S(() => {
1889
+ var i;
1890
+ return ((i = s.data) == null ? void 0 : i.combos) || [];
1891
+ }, [s.data]);
1866
1892
  return {
1867
1893
  isLoading: s.isLoading,
1868
1894
  error: s.error,
1869
- data: r ? {
1870
- driverName: r.driverName || "Driver",
1871
- lapCount: r.lapCount || 0,
1872
- trackBreakdown: r.trackBreakdown || [],
1873
- carBreakdown: r.carBreakdown || [],
1874
- recordsHeld: r.recordsHeld || 0,
1875
- currentRecords: r.currentRecords || [],
1876
- bestRanking: r.bestRanking ?? null,
1877
- bestRankingTrackId: r.bestRankingTrackId ?? null,
1878
- bestRankingLayout: r.bestRankingLayout ?? null,
1879
- bestRankingCarId: r.bestRankingCarId ?? null,
1880
- generatedAt: r.generatedAt
1881
- } : null
1895
+ data: a
1882
1896
  };
1883
1897
  }
1884
- function Me(e = {}) {
1885
- const { cdnUrl: n, partnerSlug: s } = C(), { game: r, gameVersion: a, enabled: i = !0 } = e, o = X(s, r, a, "ratings.json");
1898
+ function Be(e = {}) {
1899
+ const { cdnUrl: t, partnerSlug: r } = C(), { game: s, gameVersion: a, enabled: i = !0 } = e, o = ee(r, s, a, "ratings.json");
1886
1900
  return T({
1887
- queryKey: ["pitvox", "ratings", s, r || null, a || null],
1888
- queryFn: () => R(n, o),
1901
+ queryKey: ["pitvox", "ratings", r, s || null, a || null],
1902
+ queryFn: () => $(t, o),
1889
1903
  staleTime: 3e4,
1890
1904
  refetchInterval: 3e4,
1891
1905
  enabled: i
1892
1906
  });
1893
1907
  }
1894
- function Mt(e) {
1895
- var r;
1896
- const n = Me(), s = S(() => {
1908
+ function Ct(e) {
1909
+ var s;
1910
+ const t = Be(), r = S(() => {
1897
1911
  var a;
1898
- return !((a = n.data) != null && a.drivers) || !e ? null : n.data.drivers.find(
1912
+ return !((a = t.data) != null && a.drivers) || !e ? null : t.data.drivers.find(
1899
1913
  (i) => i.identifier === e
1900
1914
  ) || null;
1901
- }, [(r = n.data) == null ? void 0 : r.drivers, e]);
1915
+ }, [(s = t.data) == null ? void 0 : s.drivers, e]);
1902
1916
  return {
1903
- isLoading: n.isLoading,
1904
- error: n.error,
1905
- data: s ? {
1906
- rating: s.rating,
1907
- rank: s.rank,
1908
- totalDrivers: n.data.driverCount || n.data.drivers.length,
1909
- comboCount: s.comboCount || 0,
1910
- distinctCars: s.distinctCars || 0,
1911
- combos: s.combos || []
1917
+ isLoading: t.isLoading,
1918
+ error: t.error,
1919
+ data: r ? {
1920
+ rating: r.rating,
1921
+ rank: r.rank,
1922
+ totalDrivers: t.data.driverCount || t.data.drivers.length,
1923
+ comboCount: r.comboCount || 0,
1924
+ distinctCars: r.distinctCars || 0,
1925
+ combos: r.combos || []
1912
1926
  } : null
1913
1927
  };
1914
1928
  }
1915
- function kn(e = {}) {
1916
- const n = Me(e);
1929
+ function Z(e = {}) {
1930
+ const t = Be(e);
1917
1931
  return {
1918
- data: n.data || null,
1919
- isLoading: n.isLoading,
1920
- error: n.error
1932
+ data: t.data || null,
1933
+ isLoading: t.isLoading,
1934
+ error: t.error
1921
1935
  };
1922
1936
  }
1923
- function Dt() {
1924
- const { cdnUrl: e, partnerSlug: n, getSteamId: s, onFetchServerPassword: r } = C(), a = s(), { data: i, isLoading: o } = T({
1925
- queryKey: ["pitvox", "competitions", n],
1937
+ function In(e) {
1938
+ var p, c;
1939
+ const { versions: t } = ze(), r = (p = t == null ? void 0 : t.evo) == null ? void 0 : p.default, s = (c = t == null ? void 0 : t.lmu) == null ? void 0 : c.default, a = Z({ game: "evo", gameVersion: r, enabled: !!r }), i = Z({ game: "acc" }), o = Z({ game: "lmu", gameVersion: s, enabled: !!s });
1940
+ return {
1941
+ data: S(() => e ? [
1942
+ { data: a.data, game: "evo", label: "EVO" },
1943
+ { data: i.data, game: "acc", label: "ACC" },
1944
+ { data: o.data, game: "lmu", label: "LMU" }
1945
+ ].map(({ data: u, game: x, label: f }) => {
1946
+ var g;
1947
+ if (!((g = u == null ? void 0 : u.drivers) != null && g.length)) return null;
1948
+ const h = [...u.drivers].sort((m, N) => N.rating - m.rating), b = h.findIndex((m) => m.identifier === e);
1949
+ return b === -1 ? null : {
1950
+ game: x,
1951
+ label: f,
1952
+ rating: h[b].rating,
1953
+ rank: b + 1,
1954
+ totalDrivers: h.length
1955
+ };
1956
+ }).filter(Boolean) : [], [e, a.data, i.data, o.data]),
1957
+ isLoading: a.isLoading || i.isLoading || o.isLoading
1958
+ };
1959
+ }
1960
+ function Pn() {
1961
+ const { cdnUrl: e, partnerSlug: t, getSteamId: r, onFetchServerPassword: s } = C(), a = r(), { data: i, isLoading: o } = T({
1962
+ queryKey: ["pitvox", "competitions", t],
1926
1963
  queryFn: async () => {
1927
- const m = await R(e, "competitions/index.json");
1928
- return m != null && m.competitions ? m.competitions.filter((y) => y.partnerSlug === n) : [];
1964
+ const h = await $(e, "competitions/index.json");
1965
+ return h != null && h.competitions ? h.competitions.filter((b) => b.partnerSlug === t) : [];
1929
1966
  },
1930
1967
  staleTime: 6e4
1931
- }), d = (i == null ? void 0 : i.map((m) => m.id)) || [], p = ce({
1932
- queries: d.map((m) => ({
1933
- queryKey: ["pitvox", "competition", n, m, "entrylist"],
1934
- queryFn: () => R(e, `competitions/${n}/${m}/entrylist.json`),
1968
+ }), d = (i == null ? void 0 : i.map((h) => h.id)) || [], p = pe({
1969
+ queries: d.map((h) => ({
1970
+ queryKey: ["pitvox", "competition", t, h, "entrylist"],
1971
+ queryFn: () => $(e, `competitions/${t}/${h}/entrylist.json`),
1935
1972
  enabled: !!a && d.length > 0,
1936
1973
  staleTime: 6e4
1937
1974
  }))
1938
- }), c = p.some((m) => m.isLoading), u = S(() => {
1939
- var x, v;
1975
+ }), c = p.some((h) => h.isLoading), u = S(() => {
1976
+ var g, m;
1940
1977
  if (!i || !a || c) return [];
1941
- const m = /* @__PURE__ */ new Date(), y = [];
1978
+ const h = /* @__PURE__ */ new Date(), b = [];
1942
1979
  for (let N = 0; N < i.length; N++) {
1943
- const h = i[N], w = (x = p[N]) == null ? void 0 : x.data;
1944
- if (!((v = w == null ? void 0 : w.drivers) == null ? void 0 : v.some((k) => k.steamId === a))) continue;
1945
- const L = h.type === "hotlap", M = h.rounds || [];
1946
- for (const k of M) {
1947
- if (k.isFinalized && (!L || k.dediStatus === "completed")) continue;
1948
- const A = k.dediStatus === "running" || k.dediStatus === "provisioning", De = k.dediStatus === "scheduled", Ie = k.startTime && new Date(k.startTime) > m, Pe = A || De || k.dediServerAddress;
1949
- !A && !Ie && !Pe || y.push({
1950
- competitionId: h.id,
1951
- competitionName: h.name,
1952
- roundNumber: k.roundNumber,
1953
- track: k.track || "TBD",
1954
- startTime: k.startTime,
1955
- dediStatus: k.dediStatus || null,
1956
- dediServerAddress: k.dediServerAddress || null
1980
+ const v = i[N], k = (g = p[N]) == null ? void 0 : g.data;
1981
+ if (!((m = k == null ? void 0 : k.drivers) == null ? void 0 : m.some((w) => w.steamId === a))) continue;
1982
+ const L = v.type === "hotlap", D = v.rounds || [];
1983
+ for (const w of D) {
1984
+ if (w.isFinalized && (!L || w.dediStatus === "completed")) continue;
1985
+ const U = w.dediStatus === "running" || w.dediStatus === "provisioning", Ie = w.dediStatus === "scheduled", Pe = w.startTime && new Date(w.startTime) > h, Ae = U || Ie || w.dediServerAddress;
1986
+ !U && !Pe && !Ae || b.push({
1987
+ competitionId: v.id,
1988
+ competitionName: v.name,
1989
+ roundNumber: w.roundNumber,
1990
+ track: w.track || "TBD",
1991
+ startTime: w.startTime,
1992
+ dediStatus: w.dediStatus || null,
1993
+ dediServerAddress: w.dediServerAddress || null
1957
1994
  });
1958
1995
  }
1959
1996
  }
1960
- return y.sort((N, h) => {
1961
- const w = N.dediStatus === "running" || N.dediStatus === "provisioning", b = h.dediStatus === "running" || h.dediStatus === "provisioning";
1962
- return w && !b ? -1 : !w && b ? 1 : new Date(N.startTime) - new Date(h.startTime);
1963
- }), y.length > 0 && (y[0].isNext = !0), y;
1964
- }, [i, a, c, p]), g = ce({
1965
- queries: u.map((m) => ({
1966
- queryKey: ["pitvox", "serverInfo", m.competitionId, m.roundNumber],
1967
- queryFn: () => r(m.competitionId, m.roundNumber),
1968
- enabled: !!r && u.length > 0,
1997
+ return b.sort((N, v) => {
1998
+ const k = N.dediStatus === "running" || N.dediStatus === "provisioning", y = v.dediStatus === "running" || v.dediStatus === "provisioning";
1999
+ return k && !y ? -1 : !k && y ? 1 : new Date(N.startTime) - new Date(v.startTime);
2000
+ }), b.length > 0 && (b[0].isNext = !0), b;
2001
+ }, [i, a, c, p]), x = pe({
2002
+ queries: u.map((h) => ({
2003
+ queryKey: ["pitvox", "serverInfo", h.competitionId, h.roundNumber],
2004
+ queryFn: () => s(h.competitionId, h.roundNumber),
2005
+ enabled: !!s && u.length > 0,
1969
2006
  staleTime: 5 * 6e4,
1970
2007
  // 5 minutes
1971
2008
  retry: !1
1972
2009
  }))
1973
2010
  });
1974
2011
  return {
1975
- data: S(() => u.length ? r ? u.map((m, y) => {
1976
- var v;
1977
- const x = (v = g[y]) == null ? void 0 : v.data;
1978
- return x != null && x.success ? {
1979
- ...m,
1980
- serverAddress: x.serverAddress || null,
1981
- serverPassword: x.serverPassword || null
1982
- } : m;
1983
- }) : u : [], [u, r, g]),
2012
+ data: S(() => u.length ? s ? u.map((h, b) => {
2013
+ var m;
2014
+ const g = (m = x[b]) == null ? void 0 : m.data;
2015
+ return g != null && g.success ? {
2016
+ ...h,
2017
+ serverAddress: g.serverAddress || null,
2018
+ serverPassword: g.serverPassword || null
2019
+ } : h;
2020
+ }) : u : [], [u, s, x]),
1984
2021
  isLoading: o || !!a && c
1985
2022
  };
1986
2023
  }
1987
- function It() {
2024
+ function An() {
1988
2025
  const { onFetchNotifications: e } = C();
1989
2026
  return !!e;
1990
2027
  }
1991
- function Pt(e = {}) {
1992
- const { onFetchNotifications: n, partnerSlug: s } = C(), { limit: r = 20, unreadOnly: a = !1 } = e;
2028
+ function Un(e = {}) {
2029
+ const { onFetchNotifications: t, partnerSlug: r } = C(), { limit: s = 20, unreadOnly: a = !1 } = e;
1993
2030
  return T({
1994
- queryKey: ["pitvox", "notifications", s, { limit: r, unreadOnly: a }],
1995
- queryFn: () => n({ limit: r, unreadOnly: a }),
1996
- enabled: !!n,
2031
+ queryKey: ["pitvox", "notifications", r, { limit: s, unreadOnly: a }],
2032
+ queryFn: () => t({ limit: s, unreadOnly: a }),
2033
+ enabled: !!t,
1997
2034
  staleTime: 3e4,
1998
2035
  refetchInterval: 3e4
1999
2036
  });
2000
2037
  }
2001
- function Cn() {
2002
- const { onFetchNotifications: e, partnerSlug: n } = C(), { data: s, isLoading: r } = T({
2003
- queryKey: ["pitvox", "notifications", n, { limit: 1, unreadOnly: !1 }],
2038
+ function Lt() {
2039
+ const { onFetchNotifications: e, partnerSlug: t } = C(), { data: r, isLoading: s } = T({
2040
+ queryKey: ["pitvox", "notifications", t, { limit: 1, unreadOnly: !1 }],
2004
2041
  queryFn: () => e({ limit: 1 }),
2005
2042
  enabled: !!e,
2006
2043
  staleTime: 3e4,
2007
2044
  refetchInterval: 3e4,
2008
2045
  select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
2009
2046
  });
2010
- return { count: s ?? 0, isLoading: r };
2047
+ return { count: r ?? 0, isLoading: s };
2011
2048
  }
2012
- function Bt() {
2013
- const { onMarkNotificationRead: e, partnerSlug: n } = C(), s = _();
2014
- return O({
2015
- mutationFn: (r) => {
2049
+ function Fn() {
2050
+ const { onMarkNotificationRead: e, partnerSlug: t } = C(), r = j();
2051
+ return W({
2052
+ mutationFn: (s) => {
2016
2053
  if (!e)
2017
2054
  throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
2018
- return e(r);
2055
+ return e(s);
2019
2056
  },
2020
- onSuccess: (r, a) => {
2021
- s.setQueriesData(
2022
- { queryKey: ["pitvox", "notifications", n] },
2057
+ onSuccess: (s, a) => {
2058
+ r.setQueriesData(
2059
+ { queryKey: ["pitvox", "notifications", t] },
2023
2060
  (i) => i != null && i.notifications ? {
2024
2061
  ...i,
2025
2062
  unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
@@ -2031,36 +2068,36 @@ function Bt() {
2031
2068
  }
2032
2069
  });
2033
2070
  }
2034
- function At() {
2035
- const { onMarkAllNotificationsRead: e, partnerSlug: n } = C(), s = _();
2036
- return O({
2071
+ function En() {
2072
+ const { onMarkAllNotificationsRead: e, partnerSlug: t } = C(), r = j();
2073
+ return W({
2037
2074
  mutationFn: () => {
2038
2075
  if (!e)
2039
2076
  throw new Error("No onMarkAllNotificationsRead callback provided to PitVoxPartnerProvider.");
2040
2077
  return e();
2041
2078
  },
2042
2079
  onSuccess: () => {
2043
- s.setQueriesData(
2044
- { queryKey: ["pitvox", "notifications", n] },
2045
- (r) => r != null && r.notifications ? {
2046
- ...r,
2080
+ r.setQueriesData(
2081
+ { queryKey: ["pitvox", "notifications", t] },
2082
+ (s) => s != null && s.notifications ? {
2083
+ ...s,
2047
2084
  unreadCount: 0,
2048
- notifications: r.notifications.map((a) => ({
2085
+ notifications: s.notifications.map((a) => ({
2049
2086
  ...a,
2050
2087
  isRead: !0,
2051
2088
  readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
2052
2089
  }))
2053
- } : r
2090
+ } : s
2054
2091
  );
2055
2092
  }
2056
2093
  });
2057
2094
  }
2058
- function Ut({ driverName: e, avatarUrl: n, memberSince: s, className: r = "" }) {
2059
- const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
2060
- return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${r}`, children: [
2061
- n ? /* @__PURE__ */ t("img", { src: n, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ t("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
2095
+ function qn({ driverName: e, avatarUrl: t, memberSince: r, className: s = "" }) {
2096
+ const a = r ? new Date(r).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
2097
+ return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${s}`, children: [
2098
+ t ? /* @__PURE__ */ n("img", { src: t, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ n("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (e || "?")[0].toUpperCase() }),
2062
2099
  /* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
2063
- /* @__PURE__ */ t("h2", { className: "pvx-dash-profile-name", children: e }),
2100
+ /* @__PURE__ */ n("h2", { className: "pvx-dash-profile-name", children: e }),
2064
2101
  a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
2065
2102
  "Racing since ",
2066
2103
  a
@@ -2068,36 +2105,36 @@ function Ut({ driverName: e, avatarUrl: n, memberSince: s, className: r = "" })
2068
2105
  ] })
2069
2106
  ] });
2070
2107
  }
2071
- function Ft() {
2108
+ function jn() {
2072
2109
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2073
- /* @__PURE__ */ t("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
2074
- /* @__PURE__ */ t("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
2075
- /* @__PURE__ */ t("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
2076
- /* @__PURE__ */ t("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
2110
+ /* @__PURE__ */ n("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
2111
+ /* @__PURE__ */ n("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
2112
+ /* @__PURE__ */ n("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
2113
+ /* @__PURE__ */ n("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
2077
2114
  ] });
2078
2115
  }
2079
- function Et() {
2116
+ function _n() {
2080
2117
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2081
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
2082
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "2" }),
2083
- /* @__PURE__ */ t("path", { d: "M12 14v4" }),
2084
- /* @__PURE__ */ t("path", { d: "M10.5 12.5l-4 2.5" }),
2085
- /* @__PURE__ */ t("path", { d: "M13.5 12.5l4 2.5" })
2118
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
2119
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
2120
+ /* @__PURE__ */ n("path", { d: "M12 14v4" }),
2121
+ /* @__PURE__ */ n("path", { d: "M10.5 12.5l-4 2.5" }),
2122
+ /* @__PURE__ */ n("path", { d: "M13.5 12.5l4 2.5" })
2086
2123
  ] });
2087
2124
  }
2088
- function _t() {
2089
- return /* @__PURE__ */ t("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ t("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" }) });
2125
+ function he() {
2126
+ return /* @__PURE__ */ n("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
2090
2127
  }
2091
- function pe({ icon: e, value: n, label: s, items: r, labelKey: a, countKey: i }) {
2092
- const [o, d] = D(!1), p = Ue(null);
2093
- Fe(() => {
2128
+ function ve({ icon: e, value: t, label: r, items: s, labelKey: a, countKey: i }) {
2129
+ const [o, d] = M(!1), p = Ee(null);
2130
+ qe(() => {
2094
2131
  if (!o) return;
2095
- function u(g) {
2096
- p.current && !p.current.contains(g.target) && d(!1);
2132
+ function u(x) {
2133
+ p.current && !p.current.contains(x.target) && d(!1);
2097
2134
  }
2098
2135
  return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
2099
2136
  }, [o]);
2100
- const c = r != null && r.length ? r.slice().sort((u, g) => g[i] - u[i]) : null;
2137
+ const c = s != null && s.length ? s.slice().sort((u, x) => x[i] - u[i]) : null;
2101
2138
  return /* @__PURE__ */ l(
2102
2139
  "div",
2103
2140
  {
@@ -2107,110 +2144,195 @@ function pe({ icon: e, value: n, label: s, items: r, labelKey: a, countKey: i })
2107
2144
  children: [
2108
2145
  e,
2109
2146
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2110
- /* @__PURE__ */ t("span", { className: "pvx-dash-stat-value", children: n }),
2111
- /* @__PURE__ */ t("span", { className: "pvx-dash-stat-label", children: s })
2147
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: t }),
2148
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: r })
2112
2149
  ] }),
2113
- c && /* @__PURE__ */ t("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, g) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
2114
- /* @__PURE__ */ t("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
2115
- /* @__PURE__ */ t("span", { className: "pvx-dash-tooltip-value", children: u[i] })
2116
- ] }, g)) })
2150
+ c && /* @__PURE__ */ n("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((u, x) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
2151
+ /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-label", children: u[a] }),
2152
+ /* @__PURE__ */ n("span", { className: "pvx-dash-tooltip-value", children: u[i] })
2153
+ ] }, x)) })
2117
2154
  ]
2118
2155
  }
2119
2156
  );
2120
2157
  }
2121
- function qt({ stats: e, rating: n, className: s = "" }) {
2158
+ function Vn({ stats: e, gameRatings: t, onGameRatingSelect: r, rating: s, className: a = "" }) {
2122
2159
  if (!e) return null;
2123
- const r = e.trackBreakdown.map((i) => ({
2124
- name: q(i.trackId, i.layout),
2125
- lapCount: i.lapCount
2126
- })), a = e.carBreakdown.map((i) => ({
2127
- name: I(i.carId),
2128
- lapCount: i.lapCount
2129
- }));
2130
- return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${s}`, children: [
2131
- /* @__PURE__ */ t(
2132
- pe,
2160
+ const i = e.trackBreakdown.map((p) => ({
2161
+ name: E(p.trackId, p.layout),
2162
+ lapCount: p.lapCount
2163
+ })), o = e.carBreakdown.map((p) => ({
2164
+ name: B(p.carId),
2165
+ lapCount: p.lapCount
2166
+ })), d = Array.isArray(t) && t.length > 0;
2167
+ return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${a}`, children: [
2168
+ /* @__PURE__ */ n(
2169
+ ve,
2133
2170
  {
2134
- icon: /* @__PURE__ */ t(Ft, {}),
2171
+ icon: /* @__PURE__ */ n(jn, {}),
2135
2172
  value: e.lapCount.toLocaleString(),
2136
2173
  label: "Total Laps",
2137
- items: r,
2174
+ items: i,
2138
2175
  labelKey: "name",
2139
2176
  countKey: "lapCount"
2140
2177
  }
2141
2178
  ),
2142
- /* @__PURE__ */ t(
2143
- pe,
2179
+ /* @__PURE__ */ n(
2180
+ ve,
2144
2181
  {
2145
- icon: /* @__PURE__ */ t(Et, {}),
2182
+ icon: /* @__PURE__ */ n(_n, {}),
2146
2183
  value: e.carBreakdown.length,
2147
2184
  label: "Cars Used",
2148
- items: a,
2185
+ items: o,
2149
2186
  labelKey: "name",
2150
2187
  countKey: "lapCount"
2151
2188
  }
2152
2189
  ),
2153
- n && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
2154
- /* @__PURE__ */ t(_t, {}),
2190
+ d ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating-chips", children: [
2191
+ /* @__PURE__ */ n(he, {}),
2192
+ /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2193
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
2194
+ /* @__PURE__ */ n("div", { className: "pvx-dash-rating-chips", children: t.map((p) => {
2195
+ const c = !!r;
2196
+ return /* @__PURE__ */ l(
2197
+ "span",
2198
+ {
2199
+ className: `pvx-dash-rating-chip${c ? " pvx-dash-rating-chip--clickable" : ""}`,
2200
+ onClick: c ? () => r(p) : void 0,
2201
+ onKeyDown: c ? (x) => {
2202
+ c && (x.key === "Enter" || x.key === " ") && (x.preventDefault(), r(p));
2203
+ } : void 0,
2204
+ role: c ? "button" : void 0,
2205
+ tabIndex: c ? 0 : void 0,
2206
+ title: `${p.label} rating: ${p.rating.toFixed(1)} (#${p.rank} of ${p.totalDrivers})`,
2207
+ children: [
2208
+ /* @__PURE__ */ n("span", { className: "pvx-dash-rating-chip-label", children: p.label }),
2209
+ /* @__PURE__ */ n("span", { className: "pvx-dash-rating-chip-value", children: p.rating.toFixed(1) }),
2210
+ /* @__PURE__ */ l("span", { className: "pvx-dash-rating-chip-rank", children: [
2211
+ "#",
2212
+ p.rank,
2213
+ "/",
2214
+ p.totalDrivers
2215
+ ] })
2216
+ ]
2217
+ },
2218
+ p.game
2219
+ );
2220
+ }) })
2221
+ ] })
2222
+ ] }) : s ? /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
2223
+ /* @__PURE__ */ n(he, {}),
2155
2224
  /* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
2156
- /* @__PURE__ */ t("span", { className: "pvx-dash-stat-value", children: n.rating.toFixed(1) }),
2157
- /* @__PURE__ */ t("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
2225
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-value", children: s.rating.toFixed(1) }),
2226
+ /* @__PURE__ */ n("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
2158
2227
  /* @__PURE__ */ l("span", { className: "pvx-dash-stat-sub", children: [
2159
2228
  "#",
2160
- n.rank,
2229
+ s.rank,
2161
2230
  " of ",
2162
- n.totalDrivers
2231
+ s.totalDrivers
2163
2232
  ] })
2164
2233
  ] })
2165
- ] })
2234
+ ] }) : null
2166
2235
  ] });
2167
2236
  }
2168
- function jt({ records: e, className: n = "" }) {
2169
- const s = S(() => e != null && e.length ? e.slice().sort((r, a) => {
2170
- const i = r.recordedAt ? new Date(r.recordedAt).getTime() : 0;
2171
- return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
2172
- }) : [], [e]);
2173
- return s.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${n}`, children: [
2174
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2175
- /* @__PURE__ */ t("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2176
- /* @__PURE__ */ t("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
2177
- /* @__PURE__ */ t("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
2178
- /* @__PURE__ */ t("path", { d: "M4 22h16" }),
2179
- /* @__PURE__ */ t("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
2180
- /* @__PURE__ */ t("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
2181
- /* @__PURE__ */ t("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
2237
+ function Kn({ combos: e, onComboSelect: t, className: r = "" }) {
2238
+ return e != null && e.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${r}`, children: [
2239
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2240
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combos-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2241
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
2242
+ /* @__PURE__ */ n("polyline", { points: "12 6 12 12 16 14" })
2182
2243
  ] }) }),
2183
- "Current Records",
2184
- /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
2244
+ "Recent Combos",
2245
+ /* @__PURE__ */ l("span", { className: "pvx-dash-combos-count", children: [
2185
2246
  "(",
2186
- s.length,
2247
+ e.length,
2187
2248
  ")"
2188
2249
  ] })
2189
2250
  ] }) }),
2190
- /* @__PURE__ */ t("div", { className: "pvx-dash-records-list", children: s.map((r, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
2191
- /* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
2192
- /* @__PURE__ */ t("span", { className: "pvx-dash-record-track", children: q(r.trackId, r.layout, r.game) }),
2193
- /* @__PURE__ */ t("span", { className: "pvx-dash-record-car", children: I(r.carId) })
2194
- ] }),
2195
- /* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
2196
- /* @__PURE__ */ t("span", { className: "pvx-dash-record-lap", children: U(r.lapTimeMs) }),
2197
- /* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r.game || "evo"}`, children: [
2198
- (r.game || "evo").toUpperCase(),
2199
- r.gameVersion ? ` ${r.gameVersion}` : ""
2200
- ] })
2201
- ] })
2202
- ] }, a)) })
2251
+ /* @__PURE__ */ n("div", { className: "pvx-dash-combos-list", children: e.map((s) => /* @__PURE__ */ n(
2252
+ Hn,
2253
+ {
2254
+ combo: s,
2255
+ onClick: t ? () => t(s) : null
2256
+ },
2257
+ `${s.trackId}|${s.trackLayout || ""}|${s.carId}|${s.game || ""}|${s.gameVersion || ""}`
2258
+ )) })
2203
2259
  ] }) : null;
2204
2260
  }
2205
- function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
2206
- if (n)
2207
- return /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading upcoming events..." });
2261
+ function Hn({ combo: e, onClick: t }) {
2262
+ const r = e.game || "evo", s = e.gapToLeaderMs && e.gapToLeaderMs > 0 ? (e.gapToLeaderMs / 1e3).toFixed(3) : null, a = e.rank === 1 && e.totalDrivers > 1;
2263
+ return /* @__PURE__ */ l(
2264
+ "div",
2265
+ {
2266
+ className: `pvx-dash-combo-row${t ? " pvx-dash-combo-row--clickable" : ""}`,
2267
+ onClick: t || void 0,
2268
+ onKeyDown: t ? (d) => {
2269
+ t && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), t());
2270
+ } : void 0,
2271
+ role: t ? "button" : void 0,
2272
+ tabIndex: t ? 0 : void 0,
2273
+ children: [
2274
+ /* @__PURE__ */ l("div", { className: "pvx-dash-combo-info", children: [
2275
+ /* @__PURE__ */ l("div", { className: "pvx-dash-combo-title", children: [
2276
+ e.game && /* @__PURE__ */ n("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${r}`, children: r.toUpperCase() }),
2277
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-track", children: E(e.trackId, e.trackLayout, e.game) })
2278
+ ] }),
2279
+ /* @__PURE__ */ l("div", { className: "pvx-dash-combo-meta", children: [
2280
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-car", children: B(e.carId) }),
2281
+ e.lapCount > 0 && /* @__PURE__ */ l(F, { children: [
2282
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
2283
+ /* @__PURE__ */ l("span", { children: [
2284
+ e.lapCount,
2285
+ " ",
2286
+ e.lapCount === 1 ? "lap" : "laps"
2287
+ ] })
2288
+ ] }),
2289
+ e.lastDrivenAt && /* @__PURE__ */ l(F, { children: [
2290
+ /* @__PURE__ */ n("span", { className: "pvx-dash-combo-meta-sep", children: "·" }),
2291
+ /* @__PURE__ */ n("span", { children: ne(e.lastDrivenAt) })
2292
+ ] })
2293
+ ] })
2294
+ ] }),
2295
+ /* @__PURE__ */ l("div", { className: "pvx-dash-combo-stats", children: [
2296
+ e.rank ? /* @__PURE__ */ l("span", { className: "pvx-dash-combo-rank", children: [
2297
+ a && /* @__PURE__ */ n("span", { className: "pvx-dash-combo-trophy", "aria-label": "Leader", title: "Leader", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2298
+ /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
2299
+ /* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
2300
+ /* @__PURE__ */ n("path", { d: "M4 22h16" }),
2301
+ /* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
2302
+ /* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
2303
+ /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
2304
+ ] }) }),
2305
+ /* @__PURE__ */ l("span", { className: "pvx-dash-combo-rank-text", children: [
2306
+ "P",
2307
+ e.rank,
2308
+ e.totalDrivers ? /* @__PURE__ */ l("span", { className: "pvx-dash-combo-rank-total", children: [
2309
+ "/",
2310
+ e.totalDrivers
2311
+ ] }) : null
2312
+ ] })
2313
+ ] }) : e.totalDrivers ? /* @__PURE__ */ l("span", { className: "pvx-dash-combo-rank-text pvx-dash-combo-rank-text--muted", children: [
2314
+ e.totalDrivers,
2315
+ " on leaderboard"
2316
+ ] }) : null,
2317
+ s && /* @__PURE__ */ l("span", { className: "pvx-dash-combo-gap", children: [
2318
+ "+",
2319
+ s
2320
+ ] }),
2321
+ e.personalBestMs && /* @__PURE__ */ n("span", { className: "pvx-dash-combo-pb", children: A(e.personalBestMs) })
2322
+ ] })
2323
+ ]
2324
+ }
2325
+ );
2326
+ }
2327
+ function Wn({ events: e, isLoading: t, className: r, limit: s = 3 }) {
2328
+ if (t)
2329
+ return /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading upcoming events..." });
2208
2330
  if (!(e != null && e.length))
2209
2331
  return null;
2210
- const a = r ? e.slice(0, r) : e, i = e.length - a.length;
2211
- return /* @__PURE__ */ l("div", { className: `pvx-card ${s || ""}`, children: [
2212
- /* @__PURE__ */ t("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2213
- /* @__PURE__ */ t(Ot, {}),
2332
+ const a = s ? e.slice(0, s) : e, i = e.length - a.length;
2333
+ return /* @__PURE__ */ l("div", { className: `pvx-card ${r || ""}`, children: [
2334
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2335
+ /* @__PURE__ */ n(Qn, {}),
2214
2336
  "Upcoming Events",
2215
2337
  /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
2216
2338
  "(",
@@ -2225,15 +2347,15 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
2225
2347
  className: `pvx-upcoming-item ${o.isNext ? "pvx-upcoming-item--next" : ""}`,
2226
2348
  children: [
2227
2349
  /* @__PURE__ */ l("div", { className: "pvx-upcoming-info", children: [
2228
- /* @__PURE__ */ t("span", { className: "pvx-upcoming-comp", children: o.competitionName }),
2350
+ /* @__PURE__ */ n("span", { className: "pvx-upcoming-comp", children: o.competitionName }),
2229
2351
  /* @__PURE__ */ l("span", { className: "pvx-upcoming-round", children: [
2230
2352
  "Round ",
2231
2353
  o.roundNumber,
2232
2354
  ": ",
2233
2355
  o.track
2234
2356
  ] }),
2235
- o.serverPassword && /* @__PURE__ */ t(
2236
- Kt,
2357
+ o.serverPassword && /* @__PURE__ */ n(
2358
+ On,
2237
2359
  {
2238
2360
  password: o.serverPassword,
2239
2361
  address: o.serverAddress
@@ -2241,14 +2363,14 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
2241
2363
  )
2242
2364
  ] }),
2243
2365
  /* @__PURE__ */ l("div", { className: "pvx-upcoming-time", children: [
2244
- /* @__PURE__ */ t("span", { className: "pvx-upcoming-date", children: new Date(o.startTime).toLocaleDateString("en-GB", {
2366
+ /* @__PURE__ */ n("span", { className: "pvx-upcoming-date", children: new Date(o.startTime).toLocaleDateString("en-GB", {
2245
2367
  day: "numeric",
2246
2368
  month: "short",
2247
2369
  year: "numeric"
2248
2370
  }) }),
2249
- /* @__PURE__ */ t("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : Ht(o.startTime) }),
2250
- o.dediStatus === "running" && /* @__PURE__ */ t("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
2251
- !o.dediStatus && o.isNext && /* @__PURE__ */ t("span", { className: "pvx-upcoming-badge", children: "Next" })
2371
+ /* @__PURE__ */ n("span", { className: "pvx-upcoming-relative", children: o.dediStatus === "running" ? "Live now" : o.dediStatus === "provisioning" ? "Starting..." : zn(o.startTime) }),
2372
+ o.dediStatus === "running" && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge pvx-upcoming-badge--live", children: "Live" }),
2373
+ !o.dediStatus && o.isNext && /* @__PURE__ */ n("span", { className: "pvx-upcoming-badge", children: "Next" })
2252
2374
  ] })
2253
2375
  ]
2254
2376
  },
@@ -2263,11 +2385,11 @@ function Vt({ events: e, isLoading: n, className: s, limit: r = 3 }) {
2263
2385
  ] })
2264
2386
  ] });
2265
2387
  }
2266
- function Kt({ password: e, address: n }) {
2267
- const [s, r] = D(!1), [a, i] = D(!1), o = n ? e ? `join:${n}|${e}` : `join:${n}` : null, d = H(async () => {
2388
+ function On({ password: e, address: t }) {
2389
+ const [r, s] = M(!1), [a, i] = M(!1), o = t ? e ? `join:${t}|${e}` : `join:${t}` : null, d = H(async () => {
2268
2390
  if (o)
2269
2391
  try {
2270
- await navigator.clipboard.writeText(o), r(!0), setTimeout(() => r(!1), 2e3);
2392
+ await navigator.clipboard.writeText(o), s(!0), setTimeout(() => s(!1), 2e3);
2271
2393
  } catch {
2272
2394
  }
2273
2395
  }, [o]);
@@ -2279,242 +2401,296 @@ function Kt({ password: e, address: n }) {
2279
2401
  onClick: d,
2280
2402
  title: "Copy join string to clipboard",
2281
2403
  children: [
2282
- /* @__PURE__ */ t(zt, {}),
2404
+ /* @__PURE__ */ n(Yn, {}),
2283
2405
  " ",
2284
- s ? "Copied!" : "Join"
2406
+ r ? "Copied!" : "Join"
2285
2407
  ]
2286
2408
  }
2287
2409
  ),
2288
2410
  e && /* @__PURE__ */ l(F, { children: [
2289
- /* @__PURE__ */ t(
2411
+ /* @__PURE__ */ n(
2290
2412
  "span",
2291
2413
  {
2292
2414
  className: "pvx-server-detail pvx-server-detail--clickable",
2293
2415
  onClick: () => i((p) => !p),
2294
2416
  title: a ? "Hide password" : "Reveal password",
2295
- children: a ? /* @__PURE__ */ t(Qt, {}) : /* @__PURE__ */ t(Gt, {})
2417
+ children: a ? /* @__PURE__ */ n(Zn, {}) : /* @__PURE__ */ n(Jn, {})
2296
2418
  }
2297
2419
  ),
2298
2420
  a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
2299
- /* @__PURE__ */ t(Wt, {}),
2421
+ /* @__PURE__ */ n(Gn, {}),
2300
2422
  " ",
2301
2423
  e
2302
2424
  ] })
2303
2425
  ] })
2304
2426
  ] });
2305
2427
  }
2306
- function Ht(e) {
2307
- const n = new Date(e).getTime() - Date.now();
2308
- if (n <= 0) return "Now";
2309
- const s = Math.floor(n / (1e3 * 60 * 60));
2310
- if (s < 1) return "Less than 1 hour";
2311
- if (s < 24) return `in ${s}h`;
2312
- const r = Math.floor(s / 24);
2313
- if (r === 1) return "Tomorrow";
2314
- if (r < 7) return `in ${r} days`;
2315
- if (r < 30) {
2316
- const a = Math.floor(r / 7);
2428
+ function zn(e) {
2429
+ const t = new Date(e).getTime() - Date.now();
2430
+ if (t <= 0) return "Now";
2431
+ const r = Math.floor(t / (1e3 * 60 * 60));
2432
+ if (r < 1) return "Less than 1 hour";
2433
+ if (r < 24) return `in ${r}h`;
2434
+ const s = Math.floor(r / 24);
2435
+ if (s === 1) return "Tomorrow";
2436
+ if (s < 7) return `in ${s} days`;
2437
+ if (s < 30) {
2438
+ const a = Math.floor(s / 7);
2317
2439
  return `in ${a} week${a !== 1 ? "s" : ""}`;
2318
2440
  }
2319
- return ue(e);
2441
+ return ne(e);
2320
2442
  }
2321
- function Ot() {
2443
+ function Qn() {
2322
2444
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2323
- /* @__PURE__ */ t("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2324
- /* @__PURE__ */ t("path", { d: "M16 2v4M8 2v4M3 10h18" })
2445
+ /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2446
+ /* @__PURE__ */ n("path", { d: "M16 2v4M8 2v4M3 10h18" })
2325
2447
  ] });
2326
2448
  }
2327
- function Wt() {
2449
+ function Gn() {
2328
2450
  return /* @__PURE__ */ l("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: [
2329
- /* @__PURE__ */ t("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
2330
- /* @__PURE__ */ t("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2451
+ /* @__PURE__ */ n("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
2452
+ /* @__PURE__ */ n("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2331
2453
  ] });
2332
2454
  }
2333
- function zt() {
2455
+ function Yn() {
2334
2456
  return /* @__PURE__ */ l("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: [
2335
- /* @__PURE__ */ t("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
2336
- /* @__PURE__ */ t("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
2457
+ /* @__PURE__ */ n("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
2458
+ /* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
2337
2459
  ] });
2338
2460
  }
2339
- function Gt() {
2461
+ function Jn() {
2340
2462
  return /* @__PURE__ */ l("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: [
2341
- /* @__PURE__ */ t("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
2342
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "3" })
2463
+ /* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
2464
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
2343
2465
  ] });
2344
2466
  }
2345
- function Qt() {
2467
+ function Zn() {
2346
2468
  return /* @__PURE__ */ l("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: [
2347
- /* @__PURE__ */ t("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" }),
2348
- /* @__PURE__ */ t("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2469
+ /* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
2470
+ /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2349
2471
  ] });
2350
2472
  }
2351
- function Yt({ notifications: e, unreadCount: n = 0, onMarkRead: s, onMarkAllRead: r, isLoading: a, className: i }) {
2352
- const o = ve();
2353
- return a ? /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
2473
+ function Xn({ notifications: e, unreadCount: t = 0, onMarkRead: r, onMarkAllRead: s, isLoading: a, className: i }) {
2474
+ const o = fe();
2475
+ return a ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
2354
2476
  /* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
2355
2477
  /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2356
- /* @__PURE__ */ t(Xt, {}),
2478
+ /* @__PURE__ */ n(tt, {}),
2357
2479
  "Notifications",
2358
- n > 0 && /* @__PURE__ */ t("span", { className: "pvx-notif-badge", children: n > 99 ? "99+" : n })
2480
+ t > 0 && /* @__PURE__ */ n("span", { className: "pvx-notif-badge", children: t > 99 ? "99+" : t })
2359
2481
  ] }),
2360
- n > 0 && r && /* @__PURE__ */ t("button", { className: "pvx-notif-mark-all", onClick: r, children: "Mark all read" })
2482
+ t > 0 && s && /* @__PURE__ */ n("button", { className: "pvx-notif-mark-all", onClick: s, children: "Mark all read" })
2361
2483
  ] }),
2362
- e != null && e.length ? /* @__PURE__ */ t("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ t(
2363
- Jt,
2484
+ e != null && e.length ? /* @__PURE__ */ n("div", { className: "pvx-notif-list", children: e.map((d) => /* @__PURE__ */ n(
2485
+ et,
2364
2486
  {
2365
2487
  notification: d,
2366
2488
  getUserDisplay: o,
2367
- onMarkRead: s
2489
+ onMarkRead: r
2368
2490
  },
2369
2491
  d.id
2370
- )) }) : /* @__PURE__ */ t("div", { className: "pvx-notif-empty", children: "No notifications" })
2492
+ )) }) : /* @__PURE__ */ n("div", { className: "pvx-notif-empty", children: "No notifications" })
2371
2493
  ] });
2372
2494
  }
2373
- function Jt({ notification: e, getUserDisplay: n, onMarkRead: s }) {
2374
- const r = () => {
2375
- !e.isRead && s && s(e.id);
2495
+ function et({ notification: e, getUserDisplay: t, onMarkRead: r }) {
2496
+ const s = () => {
2497
+ !e.isRead && r && r(e.id);
2376
2498
  };
2377
2499
  return /* @__PURE__ */ l(
2378
2500
  "button",
2379
2501
  {
2380
2502
  className: `pvx-notif-item ${e.isRead ? "" : "pvx-notif-item--unread"}`,
2381
- onClick: r,
2503
+ onClick: s,
2382
2504
  children: [
2383
- /* @__PURE__ */ t(Zt, { type: e.type }),
2505
+ /* @__PURE__ */ n(nt, { type: e.type }),
2384
2506
  /* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
2385
- /* @__PURE__ */ t("span", { className: "pvx-notif-message", children: Oe(e, n) }),
2386
- /* @__PURE__ */ t("span", { className: "pvx-notif-time", children: ue(e.createdAt) })
2507
+ /* @__PURE__ */ n("span", { className: "pvx-notif-message", children: Oe(e, t) }),
2508
+ /* @__PURE__ */ n("span", { className: "pvx-notif-time", children: ne(e.createdAt) })
2387
2509
  ] }),
2388
- !e.isRead && /* @__PURE__ */ t("span", { className: "pvx-notif-dot" })
2510
+ !e.isRead && /* @__PURE__ */ n("span", { className: "pvx-notif-dot" })
2389
2511
  ]
2390
2512
  }
2391
2513
  );
2392
2514
  }
2393
- function Zt({ type: e }) {
2394
- return e === "RECORD_BEATEN" ? /* @__PURE__ */ t("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ t("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ t("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2395
- /* @__PURE__ */ t("path", { d: "m3 11 18-5v12L3 13v-2z" }),
2396
- /* @__PURE__ */ t("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
2397
- ] }) }) : /* @__PURE__ */ t("span", { className: "pvx-notif-icon pvx-notif-icon--record", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2398
- /* @__PURE__ */ t("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
2399
- /* @__PURE__ */ t("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
2400
- /* @__PURE__ */ t("path", { d: "M4 22h16" }),
2401
- /* @__PURE__ */ t("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
2402
- /* @__PURE__ */ t("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
2403
- /* @__PURE__ */ t("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
2515
+ function nt({ type: e }) {
2516
+ return e === "RECORD_BEATEN" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ n("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : e === "ADMIN_MESSAGE" ? /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2517
+ /* @__PURE__ */ n("path", { d: "m3 11 18-5v12L3 13v-2z" }),
2518
+ /* @__PURE__ */ n("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
2519
+ ] }) }) : /* @__PURE__ */ n("span", { className: "pvx-notif-icon pvx-notif-icon--record", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2520
+ /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
2521
+ /* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
2522
+ /* @__PURE__ */ n("path", { d: "M4 22h16" }),
2523
+ /* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
2524
+ /* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
2525
+ /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
2404
2526
  ] }) });
2405
2527
  }
2406
- function Xt() {
2528
+ function tt() {
2407
2529
  return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2408
- /* @__PURE__ */ t("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
2409
- /* @__PURE__ */ t("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
2530
+ /* @__PURE__ */ n("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
2531
+ /* @__PURE__ */ n("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
2410
2532
  ] });
2411
2533
  }
2412
- function Ln({ steamId: e, avatarUrl: n, memberSince: s, className: r = "" }) {
2413
- const { data: a, isLoading: i, error: o } = $t(e), { data: d, isLoading: p } = Mt(e), { data: c, isLoading: u } = Dt(), g = It(), { data: f, isLoading: m } = Pt({ limit: 10 }), y = Bt(), x = At();
2414
- return i || p ? /* @__PURE__ */ t("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ t("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ l("div", { className: `pvx-dash ${r}`, children: [
2415
- /* @__PURE__ */ t(
2416
- Ut,
2534
+ function St({
2535
+ steamId: e,
2536
+ avatarUrl: t,
2537
+ memberSince: r,
2538
+ onComboSelect: s,
2539
+ onGameRatingSelect: a,
2540
+ className: i = ""
2541
+ }) {
2542
+ const { data: o, isLoading: d, error: p } = Mn(e), { data: c } = In(e), { data: u } = Bn(e), { data: x, isLoading: f } = Pn(), h = An(), { data: b, isLoading: g } = Un({ limit: 10 }), m = Fn(), N = En();
2543
+ return d ? /* @__PURE__ */ n("div", { className: "pvx-loading", children: "Loading dashboard..." }) : p ? /* @__PURE__ */ n("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : o ? /* @__PURE__ */ l("div", { className: `pvx-dash ${i}`, children: [
2544
+ /* @__PURE__ */ n(
2545
+ qn,
2417
2546
  {
2418
- driverName: a.driverName,
2419
- avatarUrl: n,
2420
- memberSince: s
2547
+ driverName: o.driverName,
2548
+ avatarUrl: t,
2549
+ memberSince: r
2421
2550
  }
2422
2551
  ),
2423
- /* @__PURE__ */ t(qt, { stats: a, rating: d }),
2424
- e && /* @__PURE__ */ t(Vt, { events: c, isLoading: u }),
2425
- /* @__PURE__ */ l("div", { className: `pvx-dash-row ${g ? "pvx-dash-row--2col" : ""}`, children: [
2426
- /* @__PURE__ */ t(jt, { records: a.currentRecords }),
2427
- g && /* @__PURE__ */ t(
2428
- Yt,
2552
+ /* @__PURE__ */ n(
2553
+ Vn,
2554
+ {
2555
+ stats: o,
2556
+ gameRatings: c,
2557
+ onGameRatingSelect: a
2558
+ }
2559
+ ),
2560
+ e && /* @__PURE__ */ n(Wn, { events: x, isLoading: f }),
2561
+ /* @__PURE__ */ l("div", { className: `pvx-dash-row ${h ? "pvx-dash-row--2col" : ""}`, children: [
2562
+ /* @__PURE__ */ n(Kn, { combos: u, onComboSelect: s }),
2563
+ h && /* @__PURE__ */ n(
2564
+ Xn,
2429
2565
  {
2430
- notifications: f == null ? void 0 : f.notifications,
2431
- unreadCount: (f == null ? void 0 : f.unreadCount) || 0,
2432
- onMarkRead: (v) => y.mutate(v),
2433
- onMarkAllRead: () => x.mutate(),
2434
- isLoading: m
2566
+ notifications: b == null ? void 0 : b.notifications,
2567
+ unreadCount: (b == null ? void 0 : b.unreadCount) || 0,
2568
+ onMarkRead: (v) => m.mutate(v),
2569
+ onMarkAllRead: () => N.mutate(),
2570
+ isLoading: g
2435
2571
  }
2436
2572
  )
2437
2573
  ] })
2438
- ] }) : /* @__PURE__ */ t("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
2574
+ ] }) : /* @__PURE__ */ n("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
2575
+ }
2576
+ function Tt({ records: e, className: t = "" }) {
2577
+ const r = S(() => e != null && e.length ? e.slice().sort((s, a) => {
2578
+ const i = s.recordedAt ? new Date(s.recordedAt).getTime() : 0;
2579
+ return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
2580
+ }) : [], [e]);
2581
+ return r.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${t}`, children: [
2582
+ /* @__PURE__ */ n("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
2583
+ /* @__PURE__ */ n("span", { className: "pvx-dash-records-icon", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2584
+ /* @__PURE__ */ n("path", { d: "M6 9H4.5a2.5 2.5 0 010-5H6" }),
2585
+ /* @__PURE__ */ n("path", { d: "M18 9h1.5a2.5 2.5 0 000-5H18" }),
2586
+ /* @__PURE__ */ n("path", { d: "M4 22h16" }),
2587
+ /* @__PURE__ */ n("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20 7 22" }),
2588
+ /* @__PURE__ */ n("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20 17 22" }),
2589
+ /* @__PURE__ */ n("path", { d: "M18 2H6v7a6 6 0 0012 0V2z" })
2590
+ ] }) }),
2591
+ "Current Records",
2592
+ /* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
2593
+ "(",
2594
+ r.length,
2595
+ ")"
2596
+ ] })
2597
+ ] }) }),
2598
+ /* @__PURE__ */ n("div", { className: "pvx-dash-records-list", children: r.map((s, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
2599
+ /* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
2600
+ /* @__PURE__ */ n("span", { className: "pvx-dash-record-track", children: E(s.trackId, s.layout, s.game) }),
2601
+ /* @__PURE__ */ n("span", { className: "pvx-dash-record-car", children: B(s.carId) })
2602
+ ] }),
2603
+ /* @__PURE__ */ l("div", { className: "pvx-dash-record-time", children: [
2604
+ /* @__PURE__ */ n("span", { className: "pvx-dash-record-lap", children: A(s.lapTimeMs) }),
2605
+ /* @__PURE__ */ l("span", { className: `pvx-dash-game-badge pvx-dash-game-badge--${s.game || "evo"}`, children: [
2606
+ (s.game || "evo").toUpperCase(),
2607
+ s.gameVersion ? ` ${s.gameVersion}` : ""
2608
+ ] })
2609
+ ] })
2610
+ ] }, a)) })
2611
+ ] }) : null;
2439
2612
  }
2440
2613
  export {
2441
- un as CarsTable,
2442
- P as CompEmptyState,
2443
- E as CompLoadingState,
2444
- vt as CompetitionCard,
2445
- gn as CompetitionCards,
2446
- wn as CompetitionResultsTabs,
2447
- ht as CompletedBadge,
2448
- Se as DEFAULT_COMPLETION_GRACE_DAYS,
2449
- Ln as DriverDashboard,
2450
- Ut as DriverProfile,
2451
- mn as DriversTable,
2452
- Nn as EntryList,
2614
+ ht as CarsTable,
2615
+ I as CompEmptyState,
2616
+ q as CompLoadingState,
2617
+ gn as CompetitionCard,
2618
+ ft as CompetitionCards,
2619
+ wt as CompetitionResultsTabs,
2620
+ xn as CompletedBadge,
2621
+ $e as DEFAULT_COMPLETION_GRACE_DAYS,
2622
+ St as DriverDashboard,
2623
+ qn as DriverProfile,
2624
+ vt as DriversTable,
2625
+ bt as EntryList,
2453
2626
  J as InfoPill,
2454
- hn as LapHistoryTable,
2455
- Yt as NotificationsCard,
2456
- ae as PODIUM_MEDALS,
2457
- rn as PitVoxPartnerProvider,
2458
- vn as RankingsTable,
2459
- jt as RecordsTable,
2460
- bn as RegisterButton,
2461
- yn as RegistrationPanel,
2462
- fn as RoundResults,
2463
- le as RoundSessionResults,
2464
- ft as StandingsTable,
2465
- qt as StatsCards,
2466
- pn as TracksTable,
2467
- lt as TypeBadge,
2468
- Vt as UpcomingEvents,
2469
- Ke as buildDriverIndexPath,
2470
- Ve as buildLapsPath,
2471
- X as buildLeaderboardPath,
2472
- He as buildRecentLapsPath,
2473
- R as fetchCdnJson,
2474
- xn as filterCompetitionsByStatus,
2475
- I as formatCarName,
2476
- j as formatDate,
2477
- sn as formatDelta,
2478
- he as formatFuel,
2479
- U as formatLapTime,
2627
+ mt as LapHistoryTable,
2628
+ Xn as NotificationsCard,
2629
+ oe as PODIUM_MEDALS,
2630
+ it as PitVoxPartnerProvider,
2631
+ xt as RankingsTable,
2632
+ Kn as RecentCombosCard,
2633
+ Tt as RecordsTable,
2634
+ yt as RegisterButton,
2635
+ kt as RegistrationPanel,
2636
+ Nt as RoundResults,
2637
+ de as RoundSessionResults,
2638
+ bn as StandingsTable,
2639
+ Vn as StatsCards,
2640
+ ut as TracksTable,
2641
+ dn as TypeBadge,
2642
+ Wn as UpcomingEvents,
2643
+ me as buildDriverIndexPath,
2644
+ He as buildLapsPath,
2645
+ ee as buildLeaderboardPath,
2646
+ We as buildRecentLapsPath,
2647
+ $ as fetchCdnJson,
2648
+ gt as filterCompetitionsByStatus,
2649
+ B as formatCarName,
2650
+ _ as formatDate,
2651
+ ot as formatDelta,
2652
+ ge as formatFuel,
2653
+ A as formatLapTime,
2480
2654
  Oe as formatNotificationMessage,
2481
- ue as formatRelativeTime,
2482
- B as formatSectorTime,
2483
- ie as formatSessionLabel,
2484
- q as formatTrackName,
2485
- me as formatTyreCompound,
2486
- mt as getCompetitionPodium,
2487
- Te as getCompetitionStatus,
2488
- ut as getCompletionDate,
2489
- pt as isCompetitionComplete,
2490
- cn as useCarLeaderboard,
2491
- on as useCarMetadata,
2492
- Qe as useCompetitionAllRounds,
2493
- xe as useCompetitionConfig,
2494
- fe as useCompetitionEntryList,
2495
- Ye as useCompetitionLeaderboard,
2496
- Ge as useCompetitionRound,
2497
- Je as useCompetitionRoundLaps,
2498
- ge as useCompetitionStandings,
2499
- dn as useCompetitions,
2500
- ze as useDriverLaps,
2501
- Mt as useDriverRating,
2502
- kn as useDriverRatings,
2503
- $t as useDriverStats,
2504
- an as useLeaderboardIndex,
2505
- At as useMarkAllNotificationsRead,
2506
- Bt as useMarkNotificationRead,
2507
- Pt as useNotifications,
2508
- It as useNotificationsEnabled,
2655
+ ne as formatRelativeTime,
2656
+ P as formatSectorTime,
2657
+ le as formatSessionLabel,
2658
+ E as formatTrackName,
2659
+ xe as formatTyreCompound,
2660
+ mn as getCompetitionPodium,
2661
+ Re as getCompetitionStatus,
2662
+ vn as getCompletionDate,
2663
+ hn as isCompetitionComplete,
2664
+ dt as useCarLeaderboard,
2665
+ lt as useCarMetadata,
2666
+ Je as useCompetitionAllRounds,
2667
+ Ne as useCompetitionConfig,
2668
+ ye as useCompetitionEntryList,
2669
+ Ze as useCompetitionLeaderboard,
2670
+ Ye as useCompetitionRound,
2671
+ Xe as useCompetitionRoundLaps,
2672
+ be as useCompetitionStandings,
2673
+ pt as useCompetitions,
2674
+ Bn as useDriverCombos,
2675
+ Ge as useDriverLaps,
2676
+ Ct as useDriverRating,
2677
+ Z as useDriverRatings,
2678
+ In as useDriverRatingsByGame,
2679
+ Mn as useDriverStats,
2680
+ ze as useLeaderboardIndex,
2681
+ En as useMarkAllNotificationsRead,
2682
+ Fn as useMarkNotificationRead,
2683
+ Un as useNotifications,
2684
+ An as useNotificationsEnabled,
2509
2685
  C as usePitVox,
2510
- ln as useRecentLaps,
2511
- Ne as useRegister,
2512
- te as useRegistrationMode,
2513
- ee as useRegistrationStatus,
2514
- ne as useRegistrationUrl,
2515
- We as useTrackLeaderboard,
2516
- Cn as useUnreadCount,
2517
- Dt as useUpcomingEvents,
2518
- ve as useUserLookup,
2519
- be as useWithdraw
2686
+ ct as useRecentLaps,
2687
+ ke as useRegister,
2688
+ re as useRegistrationMode,
2689
+ te as useRegistrationStatus,
2690
+ se as useRegistrationUrl,
2691
+ Qe as useTrackLeaderboard,
2692
+ Lt as useUnreadCount,
2693
+ Pn as useUpcomingEvents,
2694
+ fe as useUserLookup,
2695
+ we as useWithdraw
2520
2696
  };