astrogators-shared-ui 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.js +258 -240
- package/dist/src/services/allyCodeStorage.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,9 +140,9 @@ var _ = [
|
|
|
140
140
|
x(e), w(t);
|
|
141
141
|
}, D = () => {
|
|
142
142
|
S(), T();
|
|
143
|
-
}, O = () => !!b(), ee = "", te, k = null,
|
|
143
|
+
}, O = () => !!b(), ee = "", te, k = null, ne = (e) => {
|
|
144
144
|
ee = e.baseURL, te = e.onUnauthorized;
|
|
145
|
-
},
|
|
145
|
+
}, A = () => k || (k = (async () => {
|
|
146
146
|
let e = C();
|
|
147
147
|
if (!e) throw Error("No refresh token available");
|
|
148
148
|
let t = await fetch(`${ee}/api/v1/auth/refresh`, {
|
|
@@ -155,21 +155,21 @@ var _ = [
|
|
|
155
155
|
return E(n.access_token, n.refresh_token), n.access_token;
|
|
156
156
|
})().finally(() => {
|
|
157
157
|
k = null;
|
|
158
|
-
}), k),
|
|
158
|
+
}), k), re = 30, j = [700, 1500], ie = /* @__PURE__ */ new Set([
|
|
159
159
|
502,
|
|
160
160
|
503,
|
|
161
161
|
504
|
|
162
|
-
]),
|
|
162
|
+
]), M = (e) => {
|
|
163
163
|
let t = (e ?? "GET").toUpperCase();
|
|
164
164
|
return t === "GET" || t === "HEAD" || t === "OPTIONS";
|
|
165
|
-
},
|
|
166
|
-
let n =
|
|
167
|
-
for (let a = 0; a <=
|
|
168
|
-
a > 0 && await
|
|
169
|
-
let o = a <
|
|
165
|
+
}, N = (e) => e == null || typeof e == "string", ae = (e) => new Promise((t) => setTimeout(t, e)), P = async (e, t) => {
|
|
166
|
+
let n = M(t.method) && N(t.body), r = N(t.body), i;
|
|
167
|
+
for (let a = 0; a <= j.length; a++) {
|
|
168
|
+
a > 0 && await ae(j[a - 1]);
|
|
169
|
+
let o = a < j.length;
|
|
170
170
|
try {
|
|
171
171
|
let r = await fetch(e, t);
|
|
172
|
-
if (o && n &&
|
|
172
|
+
if (o && n && ie.has(r.status)) continue;
|
|
173
173
|
return r;
|
|
174
174
|
} catch (e) {
|
|
175
175
|
if (i = e, o && r) continue;
|
|
@@ -177,39 +177,39 @@ var _ = [
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
throw i ?? /* @__PURE__ */ Error("fetchWithRetry: retries exhausted");
|
|
180
|
-
},
|
|
180
|
+
}, oe = (e) => {
|
|
181
181
|
try {
|
|
182
182
|
let t = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), { exp: n } = JSON.parse(atob(t));
|
|
183
|
-
return typeof n == "number" && Date.now() / 1e3 >= n -
|
|
183
|
+
return typeof n == "number" && Date.now() / 1e3 >= n - re;
|
|
184
184
|
} catch {
|
|
185
185
|
return !1;
|
|
186
186
|
}
|
|
187
|
-
},
|
|
187
|
+
}, se = async (e, t = {}) => {
|
|
188
188
|
let n = b();
|
|
189
|
-
if (n &&
|
|
190
|
-
n = await
|
|
189
|
+
if (n && oe(n)) try {
|
|
190
|
+
n = await A();
|
|
191
191
|
} catch {
|
|
192
192
|
n = b();
|
|
193
193
|
}
|
|
194
194
|
let r = { ...t.headers };
|
|
195
195
|
n && (r.Authorization = `Bearer ${n}`);
|
|
196
|
-
let i = await
|
|
196
|
+
let i = await P(e, {
|
|
197
197
|
...t,
|
|
198
198
|
headers: r
|
|
199
199
|
});
|
|
200
200
|
if (i.status !== 401 || !n) return i;
|
|
201
201
|
try {
|
|
202
|
-
return r.Authorization = `Bearer ${await
|
|
202
|
+
return r.Authorization = `Bearer ${await A()}`, await P(e, {
|
|
203
203
|
...t,
|
|
204
204
|
headers: r
|
|
205
205
|
});
|
|
206
206
|
} catch {
|
|
207
207
|
return i;
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, ce = class {
|
|
210
210
|
baseURL;
|
|
211
211
|
constructor(e) {
|
|
212
|
-
this.baseURL = e.baseURL,
|
|
212
|
+
this.baseURL = e.baseURL, ne({
|
|
213
213
|
baseURL: e.baseURL,
|
|
214
214
|
onUnauthorized: e.onUnauthorized
|
|
215
215
|
});
|
|
@@ -218,7 +218,7 @@ var _ = [
|
|
|
218
218
|
let n = {
|
|
219
219
|
"Content-Type": "application/json",
|
|
220
220
|
...t.headers
|
|
221
|
-
}, r = await
|
|
221
|
+
}, r = await se(`${this.baseURL}${e}`, {
|
|
222
222
|
...t,
|
|
223
223
|
headers: n
|
|
224
224
|
});
|
|
@@ -268,56 +268,74 @@ var _ = [
|
|
|
268
268
|
method: "DELETE"
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
let t = await
|
|
271
|
+
}, F, le = (e) => {
|
|
272
|
+
F = new ce(e);
|
|
273
|
+
}, ue = async (e) => {
|
|
274
|
+
let t = await F.patch("/api/v1/users/me", e);
|
|
275
275
|
return t.tokens && E(t.tokens.access_token, t.tokens.refresh_token), t;
|
|
276
|
-
},
|
|
276
|
+
}, de = async () => (await F.post("/api/v1/auth/logout-all")).message, I = "astrogators_ally_codes", L = "astrogators_selected_ally_code", fe = "astrogators_migration_prompt_dismissed", R = () => {
|
|
277
277
|
try {
|
|
278
|
-
let e = localStorage.getItem(
|
|
278
|
+
let e = localStorage.getItem(I);
|
|
279
279
|
return e ? JSON.parse(e) : [];
|
|
280
280
|
} catch (e) {
|
|
281
281
|
return console.error("Failed to read ally codes from localStorage:", e), [];
|
|
282
282
|
}
|
|
283
|
-
},
|
|
283
|
+
}, pe = (e) => {
|
|
284
284
|
try {
|
|
285
|
-
let t =
|
|
285
|
+
let t = R();
|
|
286
286
|
if (t.some((t) => t.ally_code === e.ally_code)) return;
|
|
287
|
-
t.push(e), localStorage.setItem(
|
|
287
|
+
t.push(e), localStorage.setItem(I, JSON.stringify(t));
|
|
288
288
|
} catch (e) {
|
|
289
289
|
console.error("Failed to save ally code to localStorage:", e);
|
|
290
290
|
}
|
|
291
|
-
},
|
|
291
|
+
}, me = (e) => {
|
|
292
292
|
try {
|
|
293
|
-
let t =
|
|
294
|
-
localStorage.setItem(
|
|
293
|
+
let t = R().filter((t) => t.ally_code !== e);
|
|
294
|
+
localStorage.setItem(I, JSON.stringify(t));
|
|
295
295
|
} catch (e) {
|
|
296
296
|
console.error("Failed to remove ally code from localStorage:", e);
|
|
297
297
|
}
|
|
298
|
-
},
|
|
298
|
+
}, he = (e) => {
|
|
299
299
|
try {
|
|
300
|
-
let t =
|
|
300
|
+
let t = R().map((t) => t.ally_code === e ? {
|
|
301
301
|
...t,
|
|
302
302
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
303
303
|
} : t);
|
|
304
|
-
localStorage.setItem(
|
|
304
|
+
localStorage.setItem(I, JSON.stringify(t));
|
|
305
305
|
} catch (e) {
|
|
306
306
|
console.error("Failed to update ally code last used:", e);
|
|
307
307
|
}
|
|
308
|
-
},
|
|
309
|
-
e ? localStorage.setItem(
|
|
310
|
-
},
|
|
311
|
-
localStorage.removeItem(
|
|
312
|
-
},
|
|
308
|
+
}, ge = () => localStorage.getItem(L), z = (e) => {
|
|
309
|
+
e ? localStorage.setItem(L, e) : localStorage.removeItem(L);
|
|
310
|
+
}, _e = () => {
|
|
311
|
+
localStorage.removeItem(I), localStorage.removeItem(L);
|
|
312
|
+
}, ve = () => {
|
|
313
|
+
try {
|
|
314
|
+
return sessionStorage.getItem(fe) === "1";
|
|
315
|
+
} catch (e) {
|
|
316
|
+
return console.error("Failed to read migration prompt dismissal from sessionStorage:", e), !1;
|
|
317
|
+
}
|
|
318
|
+
}, ye = () => {
|
|
319
|
+
try {
|
|
320
|
+
sessionStorage.setItem(fe, "1");
|
|
321
|
+
} catch (e) {
|
|
322
|
+
console.error("Failed to persist migration prompt dismissal to sessionStorage:", e);
|
|
323
|
+
}
|
|
324
|
+
}, be = () => {
|
|
325
|
+
try {
|
|
326
|
+
sessionStorage.removeItem(fe);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
console.error("Failed to clear migration prompt dismissal from sessionStorage:", e);
|
|
329
|
+
}
|
|
330
|
+
}, xe = t(void 0), Se = ({ children: e, apiBaseUrl: t }) => {
|
|
313
331
|
let [n, i] = s(null), [o, c] = s(!0), [u, d] = s(!0), [f, p] = s(!0), [m, h] = s([]), [g, _] = s(null), [v, y] = s(!1), [b, x] = s({
|
|
314
332
|
show: !1,
|
|
315
333
|
localStorageCodes: []
|
|
316
334
|
});
|
|
317
|
-
|
|
335
|
+
le({ baseURL: t }), a(() => {
|
|
318
336
|
(async () => {
|
|
319
337
|
try {
|
|
320
|
-
let e = await
|
|
338
|
+
let e = await F.get("/api/v1/config/features");
|
|
321
339
|
d(e.auth_enabled);
|
|
322
340
|
} catch (e) {
|
|
323
341
|
console.error("Failed to fetch features:", e), d(!0);
|
|
@@ -332,7 +350,7 @@ var _ = [
|
|
|
332
350
|
return;
|
|
333
351
|
}
|
|
334
352
|
try {
|
|
335
|
-
let e = await
|
|
353
|
+
let e = await F.get("/api/v1/users/me");
|
|
336
354
|
i(e);
|
|
337
355
|
} catch (e) {
|
|
338
356
|
console.error("Failed to fetch user:", e), i(null), D();
|
|
@@ -345,134 +363,134 @@ var _ = [
|
|
|
345
363
|
}, [S]);
|
|
346
364
|
let C = async (e) => {
|
|
347
365
|
try {
|
|
348
|
-
let t = await
|
|
366
|
+
let t = await F.post("/api/v1/auth/login", e);
|
|
349
367
|
E(t.access_token, t.refresh_token);
|
|
350
|
-
let n = await
|
|
368
|
+
let n = await F.get("/api/v1/users/me");
|
|
351
369
|
i(n);
|
|
352
370
|
} catch (e) {
|
|
353
371
|
throw console.error("Login failed:", e), e;
|
|
354
372
|
}
|
|
355
373
|
}, w = async (e) => {
|
|
356
374
|
try {
|
|
357
|
-
await
|
|
375
|
+
await F.post("/api/v1/auth/register", e);
|
|
358
376
|
} catch (e) {
|
|
359
377
|
throw console.error("Registration failed:", e), e;
|
|
360
378
|
}
|
|
361
379
|
}, T = () => {
|
|
362
|
-
D(), i(null), h([]), _(null),
|
|
380
|
+
D(), i(null), h([]), _(null), z(null), x({
|
|
363
381
|
show: !1,
|
|
364
382
|
localStorageCodes: []
|
|
365
|
-
});
|
|
383
|
+
}), be();
|
|
366
384
|
}, ee = async () => {
|
|
367
385
|
await S();
|
|
368
386
|
}, te = async () => {
|
|
369
387
|
try {
|
|
370
|
-
await
|
|
388
|
+
await de();
|
|
371
389
|
} finally {
|
|
372
390
|
T();
|
|
373
391
|
}
|
|
374
392
|
}, k = async (e) => {
|
|
375
|
-
let t = await
|
|
393
|
+
let t = await ue(e);
|
|
376
394
|
return i(t), t;
|
|
377
|
-
},
|
|
395
|
+
}, ne = async (e) => {
|
|
378
396
|
try {
|
|
379
|
-
return (await
|
|
397
|
+
return (await F.post("/api/v1/auth/forgot-password", e)).message;
|
|
380
398
|
} catch (e) {
|
|
381
399
|
throw console.error("Forgot password failed:", e), e;
|
|
382
400
|
}
|
|
383
|
-
},
|
|
401
|
+
}, A = async (e) => {
|
|
384
402
|
try {
|
|
385
|
-
return (await
|
|
403
|
+
return (await F.post("/api/v1/auth/reset-password", e)).message;
|
|
386
404
|
} catch (e) {
|
|
387
405
|
throw console.error("Reset password failed:", e), e;
|
|
388
406
|
}
|
|
389
|
-
},
|
|
407
|
+
}, re = async (e) => {
|
|
390
408
|
try {
|
|
391
|
-
return (await
|
|
409
|
+
return (await F.post("/api/v1/auth/resend-verification", e)).message;
|
|
392
410
|
} catch (e) {
|
|
393
411
|
throw console.error("Resend verification failed:", e), e;
|
|
394
412
|
}
|
|
395
|
-
},
|
|
413
|
+
}, j = r(async () => {
|
|
396
414
|
y(!0);
|
|
397
415
|
try {
|
|
398
416
|
let e = [];
|
|
399
417
|
if (n) {
|
|
400
|
-
let t = await
|
|
418
|
+
let t = await F.get("/api/v1/users/me/ally-codes");
|
|
401
419
|
h(t.ally_codes), e = t.ally_codes.map((e) => e.ally_code);
|
|
402
|
-
let n =
|
|
403
|
-
n.length > 0 && x({
|
|
420
|
+
let n = R();
|
|
421
|
+
n.length > 0 && !ve() && x({
|
|
404
422
|
show: !0,
|
|
405
423
|
localStorageCodes: n.map((e) => e.ally_code)
|
|
406
424
|
});
|
|
407
425
|
} else {
|
|
408
|
-
let t =
|
|
426
|
+
let t = R();
|
|
409
427
|
h(t), e = t.map((e) => e.ally_code);
|
|
410
428
|
}
|
|
411
|
-
let t =
|
|
412
|
-
_(r), r !== t &&
|
|
429
|
+
let t = ge(), r = t && e.includes(t) ? t : null;
|
|
430
|
+
_(r), r !== t && z(r);
|
|
413
431
|
} catch (e) {
|
|
414
432
|
console.error("Failed to fetch ally codes:", e), h([]);
|
|
415
433
|
} finally {
|
|
416
434
|
y(!1);
|
|
417
435
|
}
|
|
418
|
-
}, [n]),
|
|
419
|
-
n && typeof e == "number" ? (await
|
|
420
|
-
}, [n,
|
|
421
|
-
if (_(e),
|
|
436
|
+
}, [n]), ie = r(async (e) => {
|
|
437
|
+
n && typeof e == "number" ? (await F.put(`/api/v1/users/me/ally-codes/${e}/use`, {}), await j()) : !n && typeof e == "string" && (he(e), h(R()));
|
|
438
|
+
}, [n, j]), M = r((e) => {
|
|
439
|
+
if (_(e), z(e), e && n) {
|
|
422
440
|
let t = m.find((t) => "ally_code" in t && t.ally_code === e);
|
|
423
|
-
t && "id" in t &&
|
|
424
|
-
} else e && !n &&
|
|
441
|
+
t && "id" in t && ie(t.id);
|
|
442
|
+
} else e && !n && he(e);
|
|
425
443
|
}, [
|
|
426
444
|
n,
|
|
427
445
|
m,
|
|
428
|
-
|
|
429
|
-
]),
|
|
446
|
+
ie
|
|
447
|
+
]), N = r(async (e) => {
|
|
430
448
|
if (!/^\d{9}$/.test(e)) throw Error("Ally code must be exactly 9 digits");
|
|
431
449
|
if (n) {
|
|
432
|
-
let t = await
|
|
433
|
-
h((e) => [t, ...e]), m.length === 0 &&
|
|
450
|
+
let t = await F.post("/api/v1/users/me/ally-codes", { ally_code: e });
|
|
451
|
+
h((e) => [t, ...e]), m.length === 0 && M(e);
|
|
434
452
|
} else {
|
|
435
|
-
let t = await
|
|
453
|
+
let t = await F.get(`/api/v1/player-data/player/${e}`);
|
|
436
454
|
if (!t) throw Error("Invalid ally code - player not found");
|
|
437
|
-
|
|
455
|
+
pe({
|
|
438
456
|
ally_code: e,
|
|
439
457
|
player_name: t.data?.name ?? null,
|
|
440
458
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
441
|
-
}), h(
|
|
459
|
+
}), h(R()), m.length === 0 && M(e);
|
|
442
460
|
}
|
|
443
461
|
}, [
|
|
444
462
|
n,
|
|
445
463
|
m.length,
|
|
446
|
-
|
|
447
|
-
]),
|
|
448
|
-
n && typeof e == "number" ? (await
|
|
464
|
+
M
|
|
465
|
+
]), ae = r(async (e) => {
|
|
466
|
+
n && typeof e == "number" ? (await F.delete(`/api/v1/users/me/ally-codes/${e}`), h((t) => t.filter((t) => "id" in t && t.id !== e))) : !n && typeof e == "string" && (me(e), h(R()), g === e && M(null));
|
|
449
467
|
}, [
|
|
450
468
|
n,
|
|
451
469
|
g,
|
|
452
|
-
|
|
453
|
-
]),
|
|
470
|
+
M
|
|
471
|
+
]), P = r(() => {
|
|
454
472
|
x({
|
|
455
473
|
show: !1,
|
|
456
474
|
localStorageCodes: []
|
|
457
|
-
});
|
|
458
|
-
}, []),
|
|
475
|
+
}), ye();
|
|
476
|
+
}, []), oe = r(async () => {
|
|
459
477
|
if (!n) return;
|
|
460
|
-
let e =
|
|
478
|
+
let e = R();
|
|
461
479
|
for (let t of e) try {
|
|
462
|
-
await
|
|
480
|
+
await N(t.ally_code);
|
|
463
481
|
} catch (e) {
|
|
464
482
|
console.error(`Failed to migrate ally code ${t.ally_code}:`, e);
|
|
465
483
|
}
|
|
466
|
-
|
|
484
|
+
_e(), P();
|
|
467
485
|
}, [
|
|
468
486
|
n,
|
|
469
|
-
|
|
470
|
-
|
|
487
|
+
N,
|
|
488
|
+
P
|
|
471
489
|
]);
|
|
472
490
|
a(() => {
|
|
473
|
-
|
|
474
|
-
}, [
|
|
475
|
-
let
|
|
491
|
+
j();
|
|
492
|
+
}, [j]);
|
|
493
|
+
let se = {
|
|
476
494
|
user: n,
|
|
477
495
|
isAuthenticated: !!n,
|
|
478
496
|
isLoading: o,
|
|
@@ -481,36 +499,36 @@ var _ = [
|
|
|
481
499
|
logout: T,
|
|
482
500
|
logoutAll: te,
|
|
483
501
|
refreshUser: ee,
|
|
484
|
-
forgotPassword:
|
|
485
|
-
resetPassword:
|
|
486
|
-
resendVerification:
|
|
502
|
+
forgotPassword: ne,
|
|
503
|
+
resetPassword: A,
|
|
504
|
+
resendVerification: re,
|
|
487
505
|
updateAccount: k,
|
|
488
506
|
authEnabled: u,
|
|
489
507
|
isLoadingFeatures: f,
|
|
490
508
|
allyCodes: m,
|
|
491
509
|
selectedAllyCode: g,
|
|
492
510
|
isLoadingAllyCodes: v,
|
|
493
|
-
fetchAllyCodes:
|
|
494
|
-
addAllyCode:
|
|
495
|
-
removeAllyCode:
|
|
496
|
-
selectAllyCode:
|
|
497
|
-
updateAllyCodeLastUsed:
|
|
511
|
+
fetchAllyCodes: j,
|
|
512
|
+
addAllyCode: N,
|
|
513
|
+
removeAllyCode: ae,
|
|
514
|
+
selectAllyCode: M,
|
|
515
|
+
updateAllyCodeLastUsed: ie,
|
|
498
516
|
migrationPrompt: b,
|
|
499
|
-
dismissMigrationPrompt:
|
|
500
|
-
migrateLocalStorageCodes:
|
|
517
|
+
dismissMigrationPrompt: P,
|
|
518
|
+
migrateLocalStorageCodes: oe
|
|
501
519
|
};
|
|
502
|
-
return /* @__PURE__ */ l(
|
|
503
|
-
value:
|
|
520
|
+
return /* @__PURE__ */ l(xe.Provider, {
|
|
521
|
+
value: se,
|
|
504
522
|
children: e
|
|
505
523
|
});
|
|
506
|
-
},
|
|
507
|
-
let e = i(
|
|
524
|
+
}, B = () => {
|
|
525
|
+
let e = i(xe);
|
|
508
526
|
if (e === void 0) throw Error("useAuth must be used within an AuthProvider");
|
|
509
527
|
return e;
|
|
510
528
|
};
|
|
511
529
|
//#endregion
|
|
512
530
|
//#region src/hooks/useDismissableMenu.ts
|
|
513
|
-
function
|
|
531
|
+
function Ce({ isOpen: e, onClose: t, triggerRef: n, panelRef: r }) {
|
|
514
532
|
a(() => {
|
|
515
533
|
if (!e) return;
|
|
516
534
|
let i = (e) => {
|
|
@@ -529,7 +547,7 @@ function ve({ isOpen: e, onClose: t, triggerRef: n, panelRef: r }) {
|
|
|
529
547
|
r
|
|
530
548
|
]);
|
|
531
549
|
}
|
|
532
|
-
var
|
|
550
|
+
var V = {
|
|
533
551
|
navMenu: "_navMenu_vspnm_1",
|
|
534
552
|
trigger: "_trigger_vspnm_8",
|
|
535
553
|
tabActive: "_tabActive_vspnm_29",
|
|
@@ -542,9 +560,9 @@ var H = {
|
|
|
542
560
|
groupLabel: "_groupLabel_vspnm_92",
|
|
543
561
|
groupItems: "_groupItems_vspnm_97",
|
|
544
562
|
groupItem: "_groupItem_vspnm_97"
|
|
545
|
-
},
|
|
546
|
-
let { isAuthenticated: s, user: c } =
|
|
547
|
-
|
|
563
|
+
}, we = ({ app: e, isCurrentApp: t, activeSectionId: n, isOpen: r, onOpenChange: i, onSectionClick: a }) => {
|
|
564
|
+
let { isAuthenticated: s, user: c } = B(), d = o(null), f = o(null), p = `navmenu-panel-${e.id}`;
|
|
565
|
+
Ce({
|
|
548
566
|
isOpen: r,
|
|
549
567
|
onClose: () => i(!1),
|
|
550
568
|
triggerRef: d,
|
|
@@ -560,24 +578,24 @@ var H = {
|
|
|
560
578
|
let i = t && n === e.id;
|
|
561
579
|
return /* @__PURE__ */ l("a", {
|
|
562
580
|
href: e.href,
|
|
563
|
-
className: `${
|
|
581
|
+
className: `${V.sectionLink} ${r ?? ""} ${i ? V.sectionActive : ""}`,
|
|
564
582
|
"aria-current": i ? "page" : void 0,
|
|
565
583
|
onClick: h(e),
|
|
566
584
|
children: e.label
|
|
567
585
|
}, e.id);
|
|
568
586
|
};
|
|
569
587
|
return /* @__PURE__ */ u("div", {
|
|
570
|
-
className:
|
|
588
|
+
className: V.navMenu,
|
|
571
589
|
children: [/* @__PURE__ */ u("button", {
|
|
572
590
|
type: "button",
|
|
573
591
|
ref: d,
|
|
574
|
-
className: `${
|
|
592
|
+
className: `${V.trigger} ${t ? V.tabActive : ""}`,
|
|
575
593
|
"aria-expanded": r,
|
|
576
594
|
"aria-controls": p,
|
|
577
595
|
"aria-haspopup": "true",
|
|
578
596
|
onClick: () => i(!r),
|
|
579
597
|
children: [e.label, /* @__PURE__ */ l("svg", {
|
|
580
|
-
className:
|
|
598
|
+
className: V.chevron,
|
|
581
599
|
width: "10",
|
|
582
600
|
height: "6",
|
|
583
601
|
viewBox: "0 0 10 6",
|
|
@@ -594,9 +612,9 @@ var H = {
|
|
|
594
612
|
}), r && /* @__PURE__ */ l("div", {
|
|
595
613
|
id: p,
|
|
596
614
|
ref: f,
|
|
597
|
-
className:
|
|
615
|
+
className: V.panel,
|
|
598
616
|
children: e.status === "coming-soon" ? /* @__PURE__ */ l("div", {
|
|
599
|
-
className:
|
|
617
|
+
className: V.comingSoon,
|
|
600
618
|
children: "Coming soon"
|
|
601
619
|
}) : /* @__PURE__ */ l("nav", {
|
|
602
620
|
"aria-label": `${e.label} sections`,
|
|
@@ -605,20 +623,20 @@ var H = {
|
|
|
605
623
|
if (!g(e)) return m(e) ? v(e) : null;
|
|
606
624
|
let t = e.items.filter(m);
|
|
607
625
|
return /* @__PURE__ */ u("div", {
|
|
608
|
-
className:
|
|
609
|
-
children: [v(e,
|
|
610
|
-
className:
|
|
611
|
-
children: t.map((e) => v(e,
|
|
626
|
+
className: V.group,
|
|
627
|
+
children: [v(e, V.groupLabel), /* @__PURE__ */ l("div", {
|
|
628
|
+
className: V.groupItems,
|
|
629
|
+
children: t.map((e) => v(e, V.groupItem))
|
|
612
630
|
})]
|
|
613
631
|
}, e.id);
|
|
614
632
|
})
|
|
615
633
|
})
|
|
616
634
|
})]
|
|
617
635
|
});
|
|
618
|
-
},
|
|
636
|
+
}, Te = { burger: "_burger_javjr_1" }, Ee = n(({ isOpen: e, onClick: t, controlsId: n }, r) => /* @__PURE__ */ l("button", {
|
|
619
637
|
ref: r,
|
|
620
638
|
type: "button",
|
|
621
|
-
className:
|
|
639
|
+
className: Te.burger,
|
|
622
640
|
onClick: t,
|
|
623
641
|
"aria-expanded": e,
|
|
624
642
|
"aria-controls": n,
|
|
@@ -647,8 +665,8 @@ var H = {
|
|
|
647
665
|
})
|
|
648
666
|
})
|
|
649
667
|
}));
|
|
650
|
-
|
|
651
|
-
var
|
|
668
|
+
Ee.displayName = "NavBurger";
|
|
669
|
+
var H = {
|
|
652
670
|
selectWrapper: "_selectWrapper_ir4bq_1",
|
|
653
671
|
fullWidth: "_fullWidth_ir4bq_7",
|
|
654
672
|
label: "_label_ir4bq_11",
|
|
@@ -659,25 +677,25 @@ var U = {
|
|
|
659
677
|
arrow: "_arrow_ir4bq_71",
|
|
660
678
|
errorText: "_errorText_ir4bq_81",
|
|
661
679
|
helperText: "_helperText_ir4bq_86"
|
|
662
|
-
},
|
|
680
|
+
}, De = e.forwardRef(({ label: e, error: t, helperText: n, options: r, placeholder: i, fullWidth: a = !1, className: o = "", id: s, ...c }, d) => {
|
|
663
681
|
let f = s || `select-${Math.random().toString(36).substr(2, 9)}`, p = !!t;
|
|
664
682
|
return /* @__PURE__ */ u("div", {
|
|
665
|
-
className: `${
|
|
683
|
+
className: `${H.selectWrapper} ${a ? H.fullWidth : ""} ${o}`,
|
|
666
684
|
children: [
|
|
667
685
|
e && /* @__PURE__ */ u("label", {
|
|
668
686
|
htmlFor: f,
|
|
669
|
-
className:
|
|
687
|
+
className: H.label,
|
|
670
688
|
children: [e, c.required && /* @__PURE__ */ l("span", {
|
|
671
|
-
className:
|
|
689
|
+
className: H.required,
|
|
672
690
|
children: "*"
|
|
673
691
|
})]
|
|
674
692
|
}),
|
|
675
693
|
/* @__PURE__ */ u("div", {
|
|
676
|
-
className:
|
|
694
|
+
className: H.selectContainer,
|
|
677
695
|
children: [/* @__PURE__ */ u("select", {
|
|
678
696
|
ref: d,
|
|
679
697
|
id: f,
|
|
680
|
-
className: `${
|
|
698
|
+
className: `${H.select} ${p ? H.error : ""}`,
|
|
681
699
|
...c,
|
|
682
700
|
children: [
|
|
683
701
|
i && /* @__PURE__ */ l("option", {
|
|
@@ -693,23 +711,23 @@ var U = {
|
|
|
693
711
|
!r && c.children
|
|
694
712
|
]
|
|
695
713
|
}), /* @__PURE__ */ l("span", {
|
|
696
|
-
className:
|
|
714
|
+
className: H.arrow,
|
|
697
715
|
children: "▼"
|
|
698
716
|
})]
|
|
699
717
|
}),
|
|
700
718
|
t && /* @__PURE__ */ l("span", {
|
|
701
|
-
className:
|
|
719
|
+
className: H.errorText,
|
|
702
720
|
children: t
|
|
703
721
|
}),
|
|
704
722
|
n && !t && /* @__PURE__ */ l("span", {
|
|
705
|
-
className:
|
|
723
|
+
className: H.helperText,
|
|
706
724
|
children: n
|
|
707
725
|
})
|
|
708
726
|
]
|
|
709
727
|
});
|
|
710
728
|
});
|
|
711
|
-
|
|
712
|
-
var
|
|
729
|
+
De.displayName = "Select";
|
|
730
|
+
var U = {
|
|
713
731
|
button: "_button_159ms_1",
|
|
714
732
|
sm: "_sm_159ms_22",
|
|
715
733
|
md: "_md_159ms_28",
|
|
@@ -725,18 +743,18 @@ var W = {
|
|
|
725
743
|
spinner: "_spinner_159ms_116",
|
|
726
744
|
spin: "_spin_159ms_116",
|
|
727
745
|
loadingText: "_loadingText_159ms_131"
|
|
728
|
-
},
|
|
729
|
-
className: `${
|
|
746
|
+
}, W = ({ children: e, variant: t = "primary", size: n = "md", fullWidth: r = !1, loading: i = !1, disabled: a = !1, className: o = "", ...s }) => /* @__PURE__ */ l("button", {
|
|
747
|
+
className: `${U.button} ${U[t]} ${U[n]} ${r ? U.fullWidth : ""} ${i ? U.loading : ""} ${o}`,
|
|
730
748
|
disabled: a || i,
|
|
731
749
|
...s,
|
|
732
750
|
children: i ? /* @__PURE__ */ u("span", {
|
|
733
|
-
className:
|
|
734
|
-
children: [/* @__PURE__ */ l("span", { className:
|
|
735
|
-
className:
|
|
751
|
+
className: U.loadingSpinner,
|
|
752
|
+
children: [/* @__PURE__ */ l("span", { className: U.spinner }), /* @__PURE__ */ l("span", {
|
|
753
|
+
className: U.loadingText,
|
|
736
754
|
children: e
|
|
737
755
|
})]
|
|
738
756
|
}) : e
|
|
739
|
-
}),
|
|
757
|
+
}), G = {
|
|
740
758
|
inputWrapper: "_inputWrapper_15t4g_1",
|
|
741
759
|
fullWidth: "_fullWidth_15t4g_7",
|
|
742
760
|
label: "_label_15t4g_11",
|
|
@@ -745,40 +763,40 @@ var W = {
|
|
|
745
763
|
error: "_error_15t4g_55",
|
|
746
764
|
errorText: "_errorText_15t4g_63",
|
|
747
765
|
helperText: "_helperText_15t4g_68"
|
|
748
|
-
},
|
|
766
|
+
}, Oe = e.forwardRef(({ label: e, error: t, helperText: n, fullWidth: r = !1, className: i = "", id: a, ...o }, s) => {
|
|
749
767
|
let c = a || `input-${Math.random().toString(36).substr(2, 9)}`, d = !!t;
|
|
750
768
|
return /* @__PURE__ */ u("div", {
|
|
751
|
-
className: `${
|
|
769
|
+
className: `${G.inputWrapper} ${r ? G.fullWidth : ""} ${i}`,
|
|
752
770
|
children: [
|
|
753
771
|
e && /* @__PURE__ */ u("label", {
|
|
754
772
|
htmlFor: c,
|
|
755
|
-
className:
|
|
773
|
+
className: G.label,
|
|
756
774
|
children: [e, o.required && /* @__PURE__ */ l("span", {
|
|
757
|
-
className:
|
|
775
|
+
className: G.required,
|
|
758
776
|
children: "*"
|
|
759
777
|
})]
|
|
760
778
|
}),
|
|
761
779
|
/* @__PURE__ */ l("input", {
|
|
762
780
|
ref: s,
|
|
763
781
|
id: c,
|
|
764
|
-
className: `${
|
|
782
|
+
className: `${G.input} ${d ? G.error : ""}`,
|
|
765
783
|
...o
|
|
766
784
|
}),
|
|
767
785
|
t && /* @__PURE__ */ l("span", {
|
|
768
|
-
className:
|
|
786
|
+
className: G.errorText,
|
|
769
787
|
children: t
|
|
770
788
|
}),
|
|
771
789
|
n && !t && /* @__PURE__ */ l("span", {
|
|
772
|
-
className:
|
|
790
|
+
className: G.helperText,
|
|
773
791
|
children: n
|
|
774
792
|
})
|
|
775
793
|
]
|
|
776
794
|
});
|
|
777
795
|
});
|
|
778
|
-
|
|
796
|
+
Oe.displayName = "Input";
|
|
779
797
|
//#endregion
|
|
780
798
|
//#region src/utils/formatAllyCode.ts
|
|
781
|
-
var
|
|
799
|
+
var K = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, ke = (e) => e.replace(/-/g, ""), q = {
|
|
782
800
|
allyCodeDropdown: "_allyCodeDropdown_1pawi_1",
|
|
783
801
|
select: "_select_1pawi_8",
|
|
784
802
|
manageButton: "_manageButton_1pawi_12",
|
|
@@ -791,11 +809,11 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
791
809
|
codeItem: "_codeItem_1pawi_71",
|
|
792
810
|
doneButton: "_doneButton_1pawi_88",
|
|
793
811
|
inline: "_inline_1pawi_107"
|
|
794
|
-
},
|
|
795
|
-
let { allyCodes: a, selectedAllyCode: c, selectAllyCode: d, removeAllyCode: f, addAllyCode: p, isLoadingAllyCodes: m } =
|
|
812
|
+
}, Ae = ({ onAllyCodeSelected: e, className: t = "", isOpen: n, onOpenChange: r, variant: i = "floating" }) => {
|
|
813
|
+
let { allyCodes: a, selectedAllyCode: c, selectAllyCode: d, removeAllyCode: f, addAllyCode: p, isLoadingAllyCodes: m } = B(), [h, g] = s(!1), _ = n ?? h, v = (e) => {
|
|
796
814
|
g(e), r?.(e);
|
|
797
815
|
}, [y, b] = s(""), [x, S] = s(""), [C, w] = s(""), [T, E] = s(!1), D = o(null), O = o(null);
|
|
798
|
-
|
|
816
|
+
Ce({
|
|
799
817
|
isOpen: _ && i === "floating",
|
|
800
818
|
onClose: () => v(!1),
|
|
801
819
|
triggerRef: D,
|
|
@@ -803,7 +821,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
803
821
|
});
|
|
804
822
|
let ee = a.map((e) => ({
|
|
805
823
|
value: e.ally_code,
|
|
806
|
-
label: e.player_name ? `${e.player_name} (${
|
|
824
|
+
label: e.player_name ? `${e.player_name} (${K(e.ally_code)})` : K(e.ally_code)
|
|
807
825
|
})), te = (t) => {
|
|
808
826
|
let n = t.target.value || null;
|
|
809
827
|
d(n), e?.(n);
|
|
@@ -813,7 +831,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
813
831
|
let e = "id" in t ? t.id : t.ally_code;
|
|
814
832
|
await f(e);
|
|
815
833
|
}
|
|
816
|
-
},
|
|
834
|
+
}, ne = async () => {
|
|
817
835
|
if (S(""), w(""), !/^\d{9}$/.test(y)) {
|
|
818
836
|
S("Ally code must be exactly 9 digits");
|
|
819
837
|
return;
|
|
@@ -826,59 +844,59 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
826
844
|
} finally {
|
|
827
845
|
E(!1);
|
|
828
846
|
}
|
|
829
|
-
},
|
|
847
|
+
}, A = a.length > 0;
|
|
830
848
|
return /* @__PURE__ */ u("div", {
|
|
831
|
-
className: `${
|
|
849
|
+
className: `${q.allyCodeDropdown} ${i === "inline" ? q.inline : ""} ${t}`,
|
|
832
850
|
children: [
|
|
833
|
-
|
|
851
|
+
A && /* @__PURE__ */ l(De, {
|
|
834
852
|
options: ee,
|
|
835
853
|
value: c || "",
|
|
836
854
|
onChange: te,
|
|
837
855
|
placeholder: "Select ally code",
|
|
838
856
|
disabled: m,
|
|
839
|
-
className:
|
|
857
|
+
className: q.select
|
|
840
858
|
}),
|
|
841
859
|
_ && /* @__PURE__ */ u("div", {
|
|
842
|
-
className:
|
|
860
|
+
className: q.managePanel,
|
|
843
861
|
ref: O,
|
|
844
862
|
id: "ally-code-manage-panel",
|
|
845
863
|
children: [
|
|
846
864
|
/* @__PURE__ */ l("h4", { children: "Manage Ally Codes" }),
|
|
847
865
|
/* @__PURE__ */ u("div", {
|
|
848
|
-
className:
|
|
866
|
+
className: q.addSection,
|
|
849
867
|
children: [
|
|
850
868
|
/* @__PURE__ */ u("div", {
|
|
851
|
-
className:
|
|
852
|
-
children: [/* @__PURE__ */ l(
|
|
869
|
+
className: q.addInputGroup,
|
|
870
|
+
children: [/* @__PURE__ */ l(Oe, {
|
|
853
871
|
type: "text",
|
|
854
872
|
placeholder: "9-digit ally code",
|
|
855
873
|
value: y,
|
|
856
874
|
onChange: (e) => b(e.target.value.replace(/\D/g, "").slice(0, 9)),
|
|
857
875
|
disabled: T
|
|
858
|
-
}), /* @__PURE__ */ l(
|
|
876
|
+
}), /* @__PURE__ */ l(W, {
|
|
859
877
|
variant: "primary",
|
|
860
878
|
size: "sm",
|
|
861
|
-
onClick:
|
|
879
|
+
onClick: ne,
|
|
862
880
|
loading: T,
|
|
863
881
|
disabled: y.length !== 9,
|
|
864
882
|
children: "Add"
|
|
865
883
|
})]
|
|
866
884
|
}),
|
|
867
885
|
x && /* @__PURE__ */ l("div", {
|
|
868
|
-
className:
|
|
886
|
+
className: q.error,
|
|
869
887
|
children: x
|
|
870
888
|
}),
|
|
871
889
|
C && /* @__PURE__ */ l("div", {
|
|
872
|
-
className:
|
|
890
|
+
className: q.success,
|
|
873
891
|
children: C
|
|
874
892
|
})
|
|
875
893
|
]
|
|
876
894
|
}),
|
|
877
895
|
/* @__PURE__ */ l("div", {
|
|
878
|
-
className:
|
|
896
|
+
className: q.codesList,
|
|
879
897
|
children: a.map((e) => /* @__PURE__ */ u("div", {
|
|
880
|
-
className:
|
|
881
|
-
children: [/* @__PURE__ */ l("span", { children: e.player_name ? `${e.player_name} (${
|
|
898
|
+
className: q.codeItem,
|
|
899
|
+
children: [/* @__PURE__ */ l("span", { children: e.player_name ? `${e.player_name} (${K(e.ally_code)})` : K(e.ally_code) }), /* @__PURE__ */ l(W, {
|
|
882
900
|
variant: "ghost",
|
|
883
901
|
size: "sm",
|
|
884
902
|
onClick: () => k(e.ally_code),
|
|
@@ -886,50 +904,50 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
886
904
|
})]
|
|
887
905
|
}, e.ally_code))
|
|
888
906
|
}),
|
|
889
|
-
/* @__PURE__ */ l(
|
|
907
|
+
/* @__PURE__ */ l(W, {
|
|
890
908
|
variant: "secondary",
|
|
891
909
|
size: "sm",
|
|
892
910
|
onClick: () => v(!1),
|
|
893
|
-
className:
|
|
911
|
+
className: q.doneButton,
|
|
894
912
|
children: "Done"
|
|
895
913
|
})
|
|
896
914
|
]
|
|
897
915
|
}),
|
|
898
916
|
/* @__PURE__ */ l("span", {
|
|
899
917
|
ref: D,
|
|
900
|
-
children: /* @__PURE__ */ l(
|
|
918
|
+
children: /* @__PURE__ */ l(W, {
|
|
901
919
|
variant: "ghost",
|
|
902
920
|
size: "sm",
|
|
903
921
|
onClick: () => v(!_),
|
|
904
|
-
className:
|
|
922
|
+
className: q.manageButton,
|
|
905
923
|
"aria-expanded": _,
|
|
906
924
|
"aria-controls": "ally-code-manage-panel",
|
|
907
925
|
"aria-haspopup": "true",
|
|
908
|
-
children:
|
|
926
|
+
children: A ? "Manage" : "+ Add ally code"
|
|
909
927
|
})
|
|
910
928
|
})
|
|
911
929
|
]
|
|
912
930
|
});
|
|
913
|
-
},
|
|
931
|
+
}, je = {
|
|
914
932
|
authCluster: "_authCluster_17o10_1",
|
|
915
933
|
userLink: "_userLink_17o10_7",
|
|
916
934
|
adminLink: "_adminLink_17o10_16"
|
|
917
|
-
},
|
|
918
|
-
let { user: t, isAuthenticated: n, logout: r, authEnabled: i } =
|
|
935
|
+
}, Me = ({ showAuth: e = !0 }) => {
|
|
936
|
+
let { user: t, isAuthenticated: n, logout: r, authEnabled: i } = B();
|
|
919
937
|
return e ? n ? /* @__PURE__ */ u("div", {
|
|
920
|
-
className:
|
|
938
|
+
className: je.authCluster,
|
|
921
939
|
children: [
|
|
922
940
|
t?.role === "admin" && /* @__PURE__ */ l("a", {
|
|
923
941
|
href: "/admin/users",
|
|
924
|
-
className:
|
|
942
|
+
className: je.adminLink,
|
|
925
943
|
children: "Admin"
|
|
926
944
|
}),
|
|
927
945
|
/* @__PURE__ */ l("a", {
|
|
928
946
|
href: "/profile",
|
|
929
|
-
className:
|
|
947
|
+
className: je.userLink,
|
|
930
948
|
children: t?.username
|
|
931
949
|
}),
|
|
932
|
-
/* @__PURE__ */ l(
|
|
950
|
+
/* @__PURE__ */ l(W, {
|
|
933
951
|
variant: "ghost",
|
|
934
952
|
size: "sm",
|
|
935
953
|
onClick: () => {
|
|
@@ -939,24 +957,24 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
939
957
|
})
|
|
940
958
|
]
|
|
941
959
|
}) : i ? /* @__PURE__ */ u("div", {
|
|
942
|
-
className:
|
|
960
|
+
className: je.authCluster,
|
|
943
961
|
children: [/* @__PURE__ */ l("a", {
|
|
944
962
|
href: "/login",
|
|
945
|
-
children: /* @__PURE__ */ l(
|
|
963
|
+
children: /* @__PURE__ */ l(W, {
|
|
946
964
|
variant: "ghost",
|
|
947
965
|
size: "sm",
|
|
948
966
|
children: "Login"
|
|
949
967
|
})
|
|
950
968
|
}), /* @__PURE__ */ l("a", {
|
|
951
969
|
href: "/register",
|
|
952
|
-
children: /* @__PURE__ */ l(
|
|
970
|
+
children: /* @__PURE__ */ l(W, {
|
|
953
971
|
variant: "primary",
|
|
954
972
|
size: "sm",
|
|
955
973
|
children: "Sign Up"
|
|
956
974
|
})
|
|
957
975
|
})]
|
|
958
976
|
}) : null : null;
|
|
959
|
-
},
|
|
977
|
+
}, J = {
|
|
960
978
|
backdrop: "_backdrop_3ax21_1",
|
|
961
979
|
panel: "_panel_3ax21_11",
|
|
962
980
|
accordion: "_accordion_3ax21_24",
|
|
@@ -976,8 +994,8 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
976
994
|
allySection: "_allySection_3ax21_112",
|
|
977
995
|
extrasSection: "_extrasSection_3ax21_113",
|
|
978
996
|
accountSection: "_accountSection_3ax21_114"
|
|
979
|
-
},
|
|
980
|
-
let { isAuthenticated: h, user: v } =
|
|
997
|
+
}, Ne = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Pe = ({ isOpen: e, onClose: t, currentApp: n, activeSectionId: r, onSectionClick: i, rightExtras: c, showAuth: f, panelId: p, returnFocusRef: m }) => {
|
|
998
|
+
let { isAuthenticated: h, user: v } = B(), [y, b] = s(n === "hub" ? null : n), x = o(null);
|
|
981
999
|
if (a(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
982
1000
|
document.body.style.overflow = "unset";
|
|
983
1001
|
}), [e]), a(() => {
|
|
@@ -988,7 +1006,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
988
1006
|
return;
|
|
989
1007
|
}
|
|
990
1008
|
if (e.key === "Tab") {
|
|
991
|
-
let t = x.current?.querySelectorAll(
|
|
1009
|
+
let t = x.current?.querySelectorAll(Ne);
|
|
992
1010
|
if (!t || t.length === 0) return;
|
|
993
1011
|
let n = t[0], r = t[t.length - 1], i = document.activeElement, a = i === x.current || !x.current?.contains(i);
|
|
994
1012
|
e.shiftKey && (i === n || a) ? (e.preventDefault(), r.focus()) : !e.shiftKey && (i === r || a) && (e.preventDefault(), n.focus());
|
|
@@ -1000,7 +1018,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1000
1018
|
e === n && i?.(r, a), t();
|
|
1001
1019
|
};
|
|
1002
1020
|
return d(/* @__PURE__ */ l("div", {
|
|
1003
|
-
className:
|
|
1021
|
+
className: J.backdrop,
|
|
1004
1022
|
onClick: t,
|
|
1005
1023
|
children: /* @__PURE__ */ u("div", {
|
|
1006
1024
|
ref: x,
|
|
@@ -1009,32 +1027,32 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1009
1027
|
"aria-modal": "true",
|
|
1010
1028
|
"aria-label": "Navigation menu",
|
|
1011
1029
|
tabIndex: -1,
|
|
1012
|
-
className:
|
|
1030
|
+
className: J.panel,
|
|
1013
1031
|
onClick: (e) => e.stopPropagation(),
|
|
1014
1032
|
children: [
|
|
1015
1033
|
/* @__PURE__ */ l("div", {
|
|
1016
|
-
className:
|
|
1034
|
+
className: J.accordion,
|
|
1017
1035
|
children: _.map((e) => {
|
|
1018
1036
|
let t = y === e.id, i = n === e.id, a = (e) => !(e.requiresAuth && !h || e.roles && (!v || !e.roles.includes(v.role))), o = `mobile-accordion-${e.id}`, s = (t, n) => {
|
|
1019
1037
|
let a = i && r === t.id;
|
|
1020
1038
|
return /* @__PURE__ */ l("a", {
|
|
1021
1039
|
href: t.href,
|
|
1022
|
-
className: `${
|
|
1040
|
+
className: `${J.sectionLink} ${n ?? ""} ${a ? J.sectionActive : ""}`,
|
|
1023
1041
|
"aria-current": a ? "page" : void 0,
|
|
1024
1042
|
onClick: S(e.id, t),
|
|
1025
1043
|
children: t.label
|
|
1026
1044
|
}, t.id);
|
|
1027
1045
|
};
|
|
1028
1046
|
return /* @__PURE__ */ u("div", {
|
|
1029
|
-
className:
|
|
1047
|
+
className: J.accordionItem,
|
|
1030
1048
|
children: [/* @__PURE__ */ u("button", {
|
|
1031
1049
|
type: "button",
|
|
1032
|
-
className: `${
|
|
1050
|
+
className: `${J.accordionHeader} ${i ? J.currentApp : ""}`,
|
|
1033
1051
|
"aria-expanded": t,
|
|
1034
1052
|
"aria-controls": o,
|
|
1035
1053
|
onClick: () => b(t ? null : e.id),
|
|
1036
1054
|
children: [e.label, /* @__PURE__ */ l("svg", {
|
|
1037
|
-
className: `${
|
|
1055
|
+
className: `${J.chevron} ${t ? J.chevronOpen : ""}`,
|
|
1038
1056
|
width: "10",
|
|
1039
1057
|
height: "6",
|
|
1040
1058
|
viewBox: "0 0 10 6",
|
|
@@ -1050,18 +1068,18 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1050
1068
|
})]
|
|
1051
1069
|
}), t && /* @__PURE__ */ l("div", {
|
|
1052
1070
|
id: o,
|
|
1053
|
-
className:
|
|
1071
|
+
className: J.accordionPanel,
|
|
1054
1072
|
children: e.status === "coming-soon" ? /* @__PURE__ */ l("div", {
|
|
1055
|
-
className:
|
|
1073
|
+
className: J.comingSoon,
|
|
1056
1074
|
children: "Coming soon"
|
|
1057
1075
|
}) : e.sections.map((e) => {
|
|
1058
1076
|
if (!g(e)) return a(e) ? s(e) : null;
|
|
1059
1077
|
let t = e.items.filter(a);
|
|
1060
1078
|
return /* @__PURE__ */ u("div", {
|
|
1061
|
-
className:
|
|
1062
|
-
children: [s(e,
|
|
1063
|
-
className:
|
|
1064
|
-
children: t.map((e) => s(e,
|
|
1079
|
+
className: J.group,
|
|
1080
|
+
children: [s(e, J.groupLabel), /* @__PURE__ */ l("div", {
|
|
1081
|
+
className: J.groupItems,
|
|
1082
|
+
children: t.map((e) => s(e, J.groupItem))
|
|
1065
1083
|
})]
|
|
1066
1084
|
}, e.id);
|
|
1067
1085
|
})
|
|
@@ -1070,26 +1088,26 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1070
1088
|
})
|
|
1071
1089
|
}),
|
|
1072
1090
|
/* @__PURE__ */ l("div", {
|
|
1073
|
-
className:
|
|
1074
|
-
children: /* @__PURE__ */ l(
|
|
1091
|
+
className: J.allySection,
|
|
1092
|
+
children: /* @__PURE__ */ l(Ae, { variant: "inline" })
|
|
1075
1093
|
}),
|
|
1076
1094
|
c && /* @__PURE__ */ l("div", {
|
|
1077
|
-
className:
|
|
1095
|
+
className: J.extrasSection,
|
|
1078
1096
|
children: c
|
|
1079
1097
|
}),
|
|
1080
1098
|
/* @__PURE__ */ l("div", {
|
|
1081
|
-
className:
|
|
1082
|
-
children: /* @__PURE__ */ l(
|
|
1099
|
+
className: J.accountSection,
|
|
1100
|
+
children: /* @__PURE__ */ l(Me, { showAuth: f })
|
|
1083
1101
|
})
|
|
1084
1102
|
]
|
|
1085
1103
|
})
|
|
1086
1104
|
}), document.body);
|
|
1087
|
-
},
|
|
1105
|
+
}, Y = {
|
|
1088
1106
|
logoLink: "_logoLink_12f5f_3",
|
|
1089
1107
|
appMenus: "_appMenus_12f5f_10",
|
|
1090
1108
|
desktopRight: "_desktopRight_12f5f_19",
|
|
1091
1109
|
extrasGroup: "_extrasGroup_12f5f_25"
|
|
1092
|
-
},
|
|
1110
|
+
}, Fe = ({ currentApp: e, activeSectionId: t, onNavigate: n, rightExtras: r, showAuth: i = !0, className: d }) => {
|
|
1093
1111
|
let [f, p] = s(null), [m, g] = s(!1), v = o(null), y = "suite-mobile-nav-panel";
|
|
1094
1112
|
return a(() => {
|
|
1095
1113
|
let e = window.matchMedia("(max-width: 768px)"), t = () => {
|
|
@@ -1100,12 +1118,12 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1100
1118
|
className: d,
|
|
1101
1119
|
logo: /* @__PURE__ */ l("a", {
|
|
1102
1120
|
href: "/",
|
|
1103
|
-
className:
|
|
1121
|
+
className: Y.logoLink,
|
|
1104
1122
|
children: "The Astrogator's Table"
|
|
1105
1123
|
}),
|
|
1106
1124
|
leftContent: /* @__PURE__ */ l("nav", {
|
|
1107
|
-
className:
|
|
1108
|
-
children: _.map((r) => /* @__PURE__ */ l(
|
|
1125
|
+
className: Y.appMenus,
|
|
1126
|
+
children: _.map((r) => /* @__PURE__ */ l(we, {
|
|
1109
1127
|
app: r,
|
|
1110
1128
|
isCurrentApp: e === r.id,
|
|
1111
1129
|
activeSectionId: t,
|
|
@@ -1115,19 +1133,19 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1115
1133
|
}, r.id))
|
|
1116
1134
|
}),
|
|
1117
1135
|
rightContent: /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
|
|
1118
|
-
className:
|
|
1136
|
+
className: Y.desktopRight,
|
|
1119
1137
|
children: [
|
|
1120
1138
|
r && /* @__PURE__ */ l("div", {
|
|
1121
|
-
className:
|
|
1139
|
+
className: Y.extrasGroup,
|
|
1122
1140
|
children: r
|
|
1123
1141
|
}),
|
|
1124
|
-
/* @__PURE__ */ l(
|
|
1142
|
+
/* @__PURE__ */ l(Ae, {
|
|
1125
1143
|
isOpen: f === "ally",
|
|
1126
1144
|
onOpenChange: (e) => p(e ? "ally" : null)
|
|
1127
1145
|
}),
|
|
1128
|
-
/* @__PURE__ */ l(
|
|
1146
|
+
/* @__PURE__ */ l(Me, { showAuth: i })
|
|
1129
1147
|
]
|
|
1130
|
-
}), /* @__PURE__ */ l(
|
|
1148
|
+
}), /* @__PURE__ */ l(Ee, {
|
|
1131
1149
|
ref: v,
|
|
1132
1150
|
isOpen: m,
|
|
1133
1151
|
onClick: () => {
|
|
@@ -1135,7 +1153,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1135
1153
|
},
|
|
1136
1154
|
controlsId: y
|
|
1137
1155
|
})] })
|
|
1138
|
-
}), /* @__PURE__ */ l(
|
|
1156
|
+
}), /* @__PURE__ */ l(Pe, {
|
|
1139
1157
|
isOpen: m,
|
|
1140
1158
|
onClose: () => g(!1),
|
|
1141
1159
|
currentApp: e,
|
|
@@ -1152,7 +1170,7 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1152
1170
|
defaultContent: "_defaultContent_zjuj8_13",
|
|
1153
1171
|
copyright: "_copyright_zjuj8_21",
|
|
1154
1172
|
disclaimer: "_disclaimer_zjuj8_26"
|
|
1155
|
-
},
|
|
1173
|
+
}, Ie = ({ children: e, className: t = "" }) => /* @__PURE__ */ l("footer", {
|
|
1156
1174
|
className: `${X.footer} ${t}`,
|
|
1157
1175
|
children: /* @__PURE__ */ l("div", {
|
|
1158
1176
|
className: X.content,
|
|
@@ -1174,11 +1192,11 @@ var q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e
|
|
|
1174
1192
|
});
|
|
1175
1193
|
//#endregion
|
|
1176
1194
|
//#region src/utils/formatTime.ts
|
|
1177
|
-
function
|
|
1195
|
+
function Le(e) {
|
|
1178
1196
|
let t = /([zZ]|[+-]\d{2}:?\d{2})$/.test(e);
|
|
1179
1197
|
return new Date(t ? e : `${e}Z`);
|
|
1180
1198
|
}
|
|
1181
|
-
function
|
|
1199
|
+
function Re(e, t) {
|
|
1182
1200
|
let n = Math.max(0, Math.floor((t - e.getTime()) / 1e3));
|
|
1183
1201
|
if (n < 60) return `${n}s ago`;
|
|
1184
1202
|
let r = Math.floor(n / 60);
|
|
@@ -1186,38 +1204,38 @@ function Pe(e, t) {
|
|
|
1186
1204
|
let i = Math.floor(r / 60);
|
|
1187
1205
|
return i < 24 ? `${i}h ago` : `${Math.floor(i / 24)}d ago`;
|
|
1188
1206
|
}
|
|
1189
|
-
function
|
|
1207
|
+
function ze(e) {
|
|
1190
1208
|
return `${Math.floor(e / 60)}:${(e % 60).toString().padStart(2, "0")}`;
|
|
1191
1209
|
}
|
|
1192
|
-
var
|
|
1210
|
+
var Be = {
|
|
1193
1211
|
rosterRefresh: "_rosterRefresh_1rbul_3",
|
|
1194
1212
|
updatedLabel: "_updatedLabel_1rbul_11",
|
|
1195
1213
|
refreshButton: "_refreshButton_1rbul_19",
|
|
1196
1214
|
spin: "_spin_1rbul_31"
|
|
1197
|
-
},
|
|
1215
|
+
}, Ve = ({ onRefresh: e, isRefreshing: t, cachedAt: n = null, refreshAvailableAt: r = null, labelPrefix: i = "Updated", className: o = "" }) => {
|
|
1198
1216
|
let [c, d] = s(() => Date.now()), f = !!n || r != null && r > c;
|
|
1199
1217
|
a(() => {
|
|
1200
1218
|
if (!f) return;
|
|
1201
1219
|
let e = setInterval(() => d(Date.now()), 1e3);
|
|
1202
1220
|
return () => clearInterval(e);
|
|
1203
1221
|
}, [f]);
|
|
1204
|
-
let p = r ? Math.max(0, Math.ceil((r - c) / 1e3)) : 0, m = n ?
|
|
1222
|
+
let p = r ? Math.max(0, Math.ceil((r - c) / 1e3)) : 0, m = n ? Re(Le(n), c) : null, h = t || p > 0, g = p > 0 ? `Fresh data available in ${ze(p)}` : "Refresh roster";
|
|
1205
1223
|
return /* @__PURE__ */ u("div", {
|
|
1206
|
-
className: `${
|
|
1224
|
+
className: `${Be.rosterRefresh} ${o}`,
|
|
1207
1225
|
children: [m && /* @__PURE__ */ l("span", {
|
|
1208
|
-
className:
|
|
1226
|
+
className: Be.updatedLabel,
|
|
1209
1227
|
title: g,
|
|
1210
|
-
children: p > 0 ? `${i} ${m} · fresh in ${
|
|
1211
|
-
}), /* @__PURE__ */ l(
|
|
1228
|
+
children: p > 0 ? `${i} ${m} · fresh in ${ze(p)}` : `${i} ${m}`
|
|
1229
|
+
}), /* @__PURE__ */ l(W, {
|
|
1212
1230
|
variant: "outline",
|
|
1213
1231
|
size: "sm",
|
|
1214
1232
|
onClick: e,
|
|
1215
1233
|
disabled: h,
|
|
1216
1234
|
title: g,
|
|
1217
1235
|
"aria-label": "Refresh roster",
|
|
1218
|
-
className:
|
|
1236
|
+
className: Be.refreshButton,
|
|
1219
1237
|
children: /* @__PURE__ */ l("span", {
|
|
1220
|
-
className: t ?
|
|
1238
|
+
className: t ? Be.spin : void 0,
|
|
1221
1239
|
children: "⟳"
|
|
1222
1240
|
})
|
|
1223
1241
|
})]
|
|
@@ -1233,7 +1251,7 @@ var Ie = {
|
|
|
1233
1251
|
"padding-md": "_padding-md_1vw8g_43",
|
|
1234
1252
|
"padding-lg": "_padding-lg_1vw8g_47",
|
|
1235
1253
|
hoverable: "_hoverable_1vw8g_52"
|
|
1236
|
-
},
|
|
1254
|
+
}, He = ({ children: e, variant: t = "default", chamfered: n = !1, chamferSize: r = "md", padding: i = "md", hoverable: a = !1, showDiagonalBorders: o = !0, edgeColor: s, className: d = "", onClick: f, style: p }) => {
|
|
1237
1255
|
let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h = s ?? (n ? "var(--color-border)" : void 0), g = h ? { color: h } : void 0, _ = h ? {
|
|
1238
1256
|
...p,
|
|
1239
1257
|
"--card-edge-color": h
|
|
@@ -1263,7 +1281,7 @@ var Ie = {
|
|
|
1263
1281
|
})
|
|
1264
1282
|
] }), e]
|
|
1265
1283
|
});
|
|
1266
|
-
},
|
|
1284
|
+
}, Ue = {
|
|
1267
1285
|
badge: "_badge_rk7t5_1",
|
|
1268
1286
|
sm: "_sm_rk7t5_11",
|
|
1269
1287
|
md: "_md_rk7t5_16",
|
|
@@ -1275,8 +1293,8 @@ var Ie = {
|
|
|
1275
1293
|
warning: "_warning_rk7t5_47",
|
|
1276
1294
|
error: "_error_rk7t5_52",
|
|
1277
1295
|
info: "_info_rk7t5_57"
|
|
1278
|
-
},
|
|
1279
|
-
className: `${
|
|
1296
|
+
}, We = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ l("span", {
|
|
1297
|
+
className: `${Ue.badge} ${Ue[t]} ${Ue[n]} ${r}`,
|
|
1280
1298
|
children: e
|
|
1281
1299
|
}), Q = {
|
|
1282
1300
|
overlay: "_overlay_1b3yt_1",
|
|
@@ -1291,7 +1309,7 @@ var Ie = {
|
|
|
1291
1309
|
title: "_title_1b3yt_53",
|
|
1292
1310
|
closeButton: "_closeButton_1b3yt_60",
|
|
1293
1311
|
content: "_content_1b3yt_78"
|
|
1294
|
-
},
|
|
1312
|
+
}, Ge = ({ isOpen: e, onClose: t, title: n, children: r, size: i = "md", closeOnOverlayClick: o = !0, className: s = "" }) => (a(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
1295
1313
|
document.body.style.overflow = "unset";
|
|
1296
1314
|
}), [e]), a(() => {
|
|
1297
1315
|
let n = (n) => {
|
|
@@ -1333,7 +1351,7 @@ var Ie = {
|
|
|
1333
1351
|
dot: "_dot_1uhnh_34",
|
|
1334
1352
|
bounce: "_bounce_1uhnh_1",
|
|
1335
1353
|
visuallyHidden: "_visuallyHidden_1uhnh_91"
|
|
1336
|
-
},
|
|
1354
|
+
}, Ke = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ u("div", {
|
|
1337
1355
|
className: `${$.dots} ${$[e]} ${n}`,
|
|
1338
1356
|
children: [
|
|
1339
1357
|
/* @__PURE__ */ l("span", { className: $.dot }),
|
|
@@ -1347,10 +1365,10 @@ var Ie = {
|
|
|
1347
1365
|
className: $.visuallyHidden,
|
|
1348
1366
|
children: "Loading..."
|
|
1349
1367
|
})
|
|
1350
|
-
}),
|
|
1368
|
+
}), qe = async (e) => {
|
|
1351
1369
|
if (e.length === 0) return {};
|
|
1352
|
-
let t = [...new Set(e)], n = await
|
|
1370
|
+
let t = [...new Set(e)], n = await F.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
|
|
1353
1371
|
return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
|
|
1354
1372
|
};
|
|
1355
1373
|
//#endregion
|
|
1356
|
-
export {
|
|
1374
|
+
export { Ae as AllyCodeDropdown, ce as ApiClient, Se as AuthProvider, We as Badge, W as Button, He as Card, p as Container, Ie as Footer, Oe as Input, Ke as Loader, Ge as Modal, Fe as NavBar, Ve as RosterRefresh, _ as SUITE_NAV, De as Select, h as TopBar, F as apiClient, se as authedFetch, _e as clearAllyCodes, D as clearTokens, ne as configureAuthRefresh, qe as fetchUsernames, K as formatAllyCode, ze as formatCountdown, Re as formatRelativeTime, b as getAccessToken, R as getAllyCodesFromStorage, C as getRefreshToken, ge as getSelectedAllyCode, le as initializeApiClient, O as isAuthenticated, g as isSuiteNavGroup, Le as parseBackendTimestamp, A as refreshAccessToken, S as removeAccessToken, me as removeAllyCodeFromStorage, T as removeRefreshToken, pe as saveAllyCodeToStorage, x as setAccessToken, w as setRefreshToken, z as setSelectedAllyCode, E as setTokens, ke as unformatAllyCode, he as updateAllyCodeLastUsed, B as useAuth };
|