astrogators-shared-ui 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,769 +1,776 @@
1
- var ue = Object.defineProperty;
2
- var me = (t, e, s) => e in t ? ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var R = (t, e, s) => me(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { jsx as n, jsxs as h } from "react/jsx-runtime";
5
- import ne, { createContext as he, useState as $, useCallback as A, useEffect as J, useContext as ge } from "react";
6
- const pe = "_container_u3o0e_1", fe = "_padding_u3o0e_7", Q = {
7
- container: pe,
8
- padding: fe,
1
+ var me = Object.defineProperty;
2
+ var he = (e, t, s) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var R = (e, t, s) => he(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
5
+ import re, { createContext as ge, useState as $, useEffect as U, useCallback as S, useContext as pe } from "react";
6
+ const fe = "_container_u3o0e_1", ye = "_padding_u3o0e_7", X = {
7
+ container: fe,
8
+ padding: ye,
9
9
  "maxWidth-sm": "_maxWidth-sm_u3o0e_12",
10
10
  "maxWidth-md": "_maxWidth-md_u3o0e_16",
11
11
  "maxWidth-lg": "_maxWidth-lg_u3o0e_20",
12
12
  "maxWidth-xl": "_maxWidth-xl_u3o0e_24",
13
13
  "maxWidth-full": "_maxWidth-full_u3o0e_28"
14
- }, gs = ({
15
- children: t,
16
- maxWidth: e = "xl",
14
+ }, fs = ({
15
+ children: e,
16
+ maxWidth: t = "xl",
17
17
  padding: s = !0,
18
- className: r = ""
19
- }) => /* @__PURE__ */ n(
18
+ className: o = ""
19
+ }) => /* @__PURE__ */ r(
20
20
  "div",
21
21
  {
22
- className: `${Q.container} ${Q[`maxWidth-${e}`]} ${s ? Q.padding : ""} ${r}`,
23
- children: t
22
+ className: `${X.container} ${X[`maxWidth-${t}`]} ${s ? X.padding : ""} ${o}`,
23
+ children: e
24
24
  }
25
- ), ye = "_topBar_10g3c_1", ve = "_content_10g3c_13", $e = "_left_10g3c_23", we = "_right_10g3c_30", be = "_logo_10g3c_36", B = {
26
- topBar: ye,
27
- content: ve,
28
- left: $e,
29
- right: we,
30
- logo: be
31
- }, ps = ({
32
- logo: t,
33
- leftContent: e,
25
+ ), ve = "_topBar_10g3c_1", $e = "_content_10g3c_13", we = "_left_10g3c_23", be = "_right_10g3c_30", Ne = "_logo_10g3c_36", B = {
26
+ topBar: ve,
27
+ content: $e,
28
+ left: we,
29
+ right: be,
30
+ logo: Ne
31
+ }, ys = ({
32
+ logo: e,
33
+ leftContent: t,
34
34
  rightContent: s,
35
- className: r = ""
36
- }) => /* @__PURE__ */ n("header", { className: `${B.topBar} ${r}`, children: /* @__PURE__ */ h("div", { className: B.content, children: [
37
- /* @__PURE__ */ h("div", { className: B.left, children: [
38
- t && /* @__PURE__ */ n("div", { className: B.logo, children: t }),
39
- e
35
+ className: o = ""
36
+ }) => /* @__PURE__ */ r("header", { className: `${B.topBar} ${o}`, children: /* @__PURE__ */ m("div", { className: B.content, children: [
37
+ /* @__PURE__ */ m("div", { className: B.left, children: [
38
+ e && /* @__PURE__ */ r("div", { className: B.logo, children: e }),
39
+ t
40
40
  ] }),
41
- /* @__PURE__ */ n("div", { className: B.right, children: s })
42
- ] }) }), Ne = "_footer_zjuj8_1", Se = "_content_zjuj8_7", Ae = "_defaultContent_zjuj8_13", xe = "_copyright_zjuj8_21", Te = "_disclaimer_zjuj8_26", P = {
43
- footer: Ne,
44
- content: Se,
45
- defaultContent: Ae,
46
- copyright: xe,
47
- disclaimer: Te
48
- }, fs = ({ children: t, className: e = "" }) => /* @__PURE__ */ n("footer", { className: `${P.footer} ${e}`, children: /* @__PURE__ */ n("div", { className: P.content, children: t || /* @__PURE__ */ h("div", { className: P.defaultContent, children: [
49
- /* @__PURE__ */ h("p", { className: P.copyright, children: [
41
+ /* @__PURE__ */ r("div", { className: B.right, children: s })
42
+ ] }) }), Se = "_footer_zjuj8_1", Ae = "_content_zjuj8_7", xe = "_defaultContent_zjuj8_13", Te = "_copyright_zjuj8_21", Ce = "_disclaimer_zjuj8_26", P = {
43
+ footer: Se,
44
+ content: Ae,
45
+ defaultContent: xe,
46
+ copyright: Te,
47
+ disclaimer: Ce
48
+ }, vs = ({ children: e, className: t = "" }) => /* @__PURE__ */ r("footer", { className: `${P.footer} ${t}`, children: /* @__PURE__ */ r("div", { className: P.content, children: e || /* @__PURE__ */ m("div", { className: P.defaultContent, children: [
49
+ /* @__PURE__ */ m("p", { className: P.copyright, children: [
50
50
  "© ",
51
51
  (/* @__PURE__ */ new Date()).getFullYear(),
52
52
  " The Astrogator's Table. All rights reserved."
53
53
  ] }),
54
- /* @__PURE__ */ n("p", { className: P.disclaimer, children: "Star Wars: Galaxy of Heroes is a trademark of Electronic Arts Inc." })
55
- ] }) }) }), Ce = "_button_159ms_1", ke = "_sm_159ms_22", Ee = "_md_159ms_28", We = "_lg_159ms_34", Ie = "_primary_159ms_41", Le = "_secondary_159ms_55", qe = "_outline_159ms_69", Re = "_ghost_159ms_80", Be = "_danger_159ms_89", Pe = "_fullWidth_159ms_100", Ue = "_loading_159ms_105", je = "_loadingSpinner_159ms_110", De = "_spinner_159ms_116", Fe = "_spin_159ms_116", ze = "_loadingText_159ms_131", x = {
56
- button: Ce,
57
- sm: ke,
58
- md: Ee,
59
- lg: We,
60
- primary: Ie,
61
- secondary: Le,
62
- outline: qe,
63
- ghost: Re,
64
- danger: Be,
65
- fullWidth: Pe,
66
- loading: Ue,
67
- loadingSpinner: je,
68
- spinner: De,
69
- spin: Fe,
70
- loadingText: ze
71
- }, z = ({
72
- children: t,
73
- variant: e = "primary",
54
+ /* @__PURE__ */ r("p", { className: P.disclaimer, children: "Star Wars: Galaxy of Heroes is a trademark of Electronic Arts Inc." })
55
+ ] }) }) }), ke = "_button_159ms_1", Ee = "_sm_159ms_22", We = "_md_159ms_28", Ie = "_lg_159ms_34", Le = "_primary_159ms_41", qe = "_secondary_159ms_55", Re = "_outline_159ms_69", Be = "_ghost_159ms_80", Pe = "_danger_159ms_89", Ue = "_fullWidth_159ms_100", je = "_loading_159ms_105", De = "_loadingSpinner_159ms_110", Fe = "_spinner_159ms_116", ze = "_spin_159ms_116", Oe = "_loadingText_159ms_131", A = {
56
+ button: ke,
57
+ sm: Ee,
58
+ md: We,
59
+ lg: Ie,
60
+ primary: Le,
61
+ secondary: qe,
62
+ outline: Re,
63
+ ghost: Be,
64
+ danger: Pe,
65
+ fullWidth: Ue,
66
+ loading: je,
67
+ loadingSpinner: De,
68
+ spinner: Fe,
69
+ spin: ze,
70
+ loadingText: Oe
71
+ }, O = ({
72
+ children: e,
73
+ variant: t = "primary",
74
74
  size: s = "md",
75
- fullWidth: r = !1,
76
- loading: d = !1,
77
- disabled: u = !1,
78
- className: l = "",
79
- ...i
80
- }) => /* @__PURE__ */ n(
75
+ fullWidth: o = !1,
76
+ loading: _ = !1,
77
+ disabled: h = !1,
78
+ className: c = "",
79
+ ...l
80
+ }) => /* @__PURE__ */ r(
81
81
  "button",
82
82
  {
83
- className: `${x.button} ${x[e]} ${x[s]} ${r ? x.fullWidth : ""} ${d ? x.loading : ""} ${l}`,
84
- disabled: u || d,
85
- ...i,
86
- children: d ? /* @__PURE__ */ h("span", { className: x.loadingSpinner, children: [
87
- /* @__PURE__ */ n("span", { className: x.spinner }),
88
- /* @__PURE__ */ n("span", { className: x.loadingText, children: t })
89
- ] }) : t
83
+ className: `${A.button} ${A[t]} ${A[s]} ${o ? A.fullWidth : ""} ${_ ? A.loading : ""} ${c}`,
84
+ disabled: h || _,
85
+ ...l,
86
+ children: _ ? /* @__PURE__ */ m("span", { className: A.loadingSpinner, children: [
87
+ /* @__PURE__ */ r("span", { className: A.spinner }),
88
+ /* @__PURE__ */ r("span", { className: A.loadingText, children: e })
89
+ ] }) : e
90
90
  }
91
- ), Oe = "_inputWrapper_15t4g_1", Me = "_fullWidth_15t4g_7", Je = "_label_15t4g_11", He = "_required_15t4g_20", Ye = "_input_15t4g_1", Ge = "_error_15t4g_55", Ke = "_errorText_15t4g_63", Ve = "_helperText_15t4g_68", T = {
92
- inputWrapper: Oe,
93
- fullWidth: Me,
94
- label: Je,
95
- required: He,
96
- input: Ye,
97
- error: Ge,
98
- errorText: Ke,
99
- helperText: Ve
100
- }, re = ne.forwardRef(
91
+ ), Me = "_inputWrapper_15t4g_1", Je = "_fullWidth_15t4g_7", He = "_label_15t4g_11", Ye = "_required_15t4g_20", Ge = "_input_15t4g_1", Ke = "_error_15t4g_55", Ve = "_errorText_15t4g_63", Qe = "_helperText_15t4g_68", x = {
92
+ inputWrapper: Me,
93
+ fullWidth: Je,
94
+ label: He,
95
+ required: Ye,
96
+ input: Ge,
97
+ error: Ke,
98
+ errorText: Ve,
99
+ helperText: Qe
100
+ }, ae = re.forwardRef(
101
101
  ({
102
- label: t,
103
- error: e,
102
+ label: e,
103
+ error: t,
104
104
  helperText: s,
105
- fullWidth: r = !1,
106
- className: d = "",
107
- id: u,
108
- ...l
109
- }, i) => {
110
- const c = u || `input-${Math.random().toString(36).substr(2, 9)}`, p = !!e;
111
- return /* @__PURE__ */ h("div", { className: `${T.inputWrapper} ${r ? T.fullWidth : ""} ${d}`, children: [
112
- t && /* @__PURE__ */ h("label", { htmlFor: c, className: T.label, children: [
113
- t,
114
- l.required && /* @__PURE__ */ n("span", { className: T.required, children: "*" })
105
+ fullWidth: o = !1,
106
+ className: _ = "",
107
+ id: h,
108
+ ...c
109
+ }, l) => {
110
+ const i = h || `input-${Math.random().toString(36).substr(2, 9)}`, g = !!t;
111
+ return /* @__PURE__ */ m("div", { className: `${x.inputWrapper} ${o ? x.fullWidth : ""} ${_}`, children: [
112
+ e && /* @__PURE__ */ m("label", { htmlFor: i, className: x.label, children: [
113
+ e,
114
+ c.required && /* @__PURE__ */ r("span", { className: x.required, children: "*" })
115
115
  ] }),
116
- /* @__PURE__ */ n(
116
+ /* @__PURE__ */ r(
117
117
  "input",
118
118
  {
119
- ref: i,
120
- id: c,
121
- className: `${T.input} ${p ? T.error : ""}`,
122
- ...l
119
+ ref: l,
120
+ id: i,
121
+ className: `${x.input} ${g ? x.error : ""}`,
122
+ ...c
123
123
  }
124
124
  ),
125
- e && /* @__PURE__ */ n("span", { className: T.errorText, children: e }),
126
- s && !e && /* @__PURE__ */ n("span", { className: T.helperText, children: s })
125
+ t && /* @__PURE__ */ r("span", { className: x.errorText, children: t }),
126
+ s && !t && /* @__PURE__ */ r("span", { className: x.helperText, children: s })
127
127
  ] });
128
128
  }
129
129
  );
130
- re.displayName = "Input";
131
- const Qe = "_selectWrapper_ir4bq_1", Xe = "_fullWidth_ir4bq_7", Ze = "_label_ir4bq_11", et = "_required_ir4bq_20", tt = "_selectContainer_ir4bq_24", st = "_select_ir4bq_1", ot = "_error_ir4bq_63", nt = "_arrow_ir4bq_71", rt = "_errorText_ir4bq_81", at = "_helperText_ir4bq_86", w = {
132
- selectWrapper: Qe,
133
- fullWidth: Xe,
134
- label: Ze,
135
- required: et,
136
- selectContainer: tt,
137
- select: st,
138
- error: ot,
139
- arrow: nt,
140
- errorText: rt,
141
- helperText: at
142
- }, ae = ne.forwardRef(
130
+ ae.displayName = "Input";
131
+ const Xe = "_selectWrapper_ir4bq_1", Ze = "_fullWidth_ir4bq_7", et = "_label_ir4bq_11", tt = "_required_ir4bq_20", st = "_selectContainer_ir4bq_24", ot = "_select_ir4bq_1", nt = "_error_ir4bq_63", rt = "_arrow_ir4bq_71", at = "_errorText_ir4bq_81", lt = "_helperText_ir4bq_86", w = {
132
+ selectWrapper: Xe,
133
+ fullWidth: Ze,
134
+ label: et,
135
+ required: tt,
136
+ selectContainer: st,
137
+ select: ot,
138
+ error: nt,
139
+ arrow: rt,
140
+ errorText: at,
141
+ helperText: lt
142
+ }, le = re.forwardRef(
143
143
  ({
144
- label: t,
145
- error: e,
144
+ label: e,
145
+ error: t,
146
146
  helperText: s,
147
- options: r,
148
- placeholder: d,
149
- fullWidth: u = !1,
150
- className: l = "",
151
- id: i,
152
- ...c
153
- }, p) => {
154
- const f = i || `select-${Math.random().toString(36).substr(2, 9)}`, I = !!e;
155
- return /* @__PURE__ */ h("div", { className: `${w.selectWrapper} ${u ? w.fullWidth : ""} ${l}`, children: [
156
- t && /* @__PURE__ */ h("label", { htmlFor: f, className: w.label, children: [
157
- t,
158
- c.required && /* @__PURE__ */ n("span", { className: w.required, children: "*" })
147
+ options: o,
148
+ placeholder: _,
149
+ fullWidth: h = !1,
150
+ className: c = "",
151
+ id: l,
152
+ ...i
153
+ }, g) => {
154
+ const f = l || `select-${Math.random().toString(36).substr(2, 9)}`, C = !!t;
155
+ return /* @__PURE__ */ m("div", { className: `${w.selectWrapper} ${h ? w.fullWidth : ""} ${c}`, children: [
156
+ e && /* @__PURE__ */ m("label", { htmlFor: f, className: w.label, children: [
157
+ e,
158
+ i.required && /* @__PURE__ */ r("span", { className: w.required, children: "*" })
159
159
  ] }),
160
- /* @__PURE__ */ h("div", { className: w.selectContainer, children: [
161
- /* @__PURE__ */ h(
160
+ /* @__PURE__ */ m("div", { className: w.selectContainer, children: [
161
+ /* @__PURE__ */ m(
162
162
  "select",
163
163
  {
164
- ref: p,
164
+ ref: g,
165
165
  id: f,
166
- className: `${w.select} ${I ? w.error : ""}`,
167
- ...c,
166
+ className: `${w.select} ${C ? w.error : ""}`,
167
+ ...i,
168
168
  children: [
169
- d && /* @__PURE__ */ n("option", { value: "", disabled: !0, children: d }),
170
- r.map((y) => /* @__PURE__ */ n(
169
+ _ && /* @__PURE__ */ r("option", { value: "", disabled: !0, children: _ }),
170
+ o && o.map((b) => /* @__PURE__ */ r(
171
171
  "option",
172
172
  {
173
- value: y.value,
174
- disabled: y.disabled,
175
- children: y.label
173
+ value: b.value,
174
+ disabled: b.disabled,
175
+ children: b.label
176
176
  },
177
- y.value
178
- ))
177
+ b.value
178
+ )),
179
+ !o && i.children
179
180
  ]
180
181
  }
181
182
  ),
182
- /* @__PURE__ */ n("span", { className: w.arrow, children: "▼" })
183
+ /* @__PURE__ */ r("span", { className: w.arrow, children: "▼" })
183
184
  ] }),
184
- e && /* @__PURE__ */ n("span", { className: w.errorText, children: e }),
185
- s && !e && /* @__PURE__ */ n("span", { className: w.helperText, children: s })
185
+ t && /* @__PURE__ */ r("span", { className: w.errorText, children: t }),
186
+ s && !t && /* @__PURE__ */ r("span", { className: w.helperText, children: s })
186
187
  ] });
187
188
  }
188
189
  );
189
- ae.displayName = "Select";
190
- const ee = "astrogators_access_token", te = "astrogators_refresh_token", le = () => localStorage.getItem(ee), lt = (t) => {
191
- localStorage.setItem(ee, t);
192
- }, ct = () => {
193
- localStorage.removeItem(ee);
194
- }, it = () => localStorage.getItem(te), dt = (t) => {
195
- localStorage.setItem(te, t);
196
- }, _t = () => {
190
+ le.displayName = "Select";
191
+ const te = "astrogators_access_token", se = "astrogators_refresh_token", ce = () => localStorage.getItem(te), ct = (e) => {
192
+ localStorage.setItem(te, e);
193
+ }, it = () => {
197
194
  localStorage.removeItem(te);
198
- }, ce = (t, e) => {
199
- lt(t), dt(e);
200
- }, Z = () => {
201
- ct(), _t();
202
- }, ut = () => !!le();
203
- class mt {
204
- constructor(e) {
195
+ }, dt = () => localStorage.getItem(se), _t = (e) => {
196
+ localStorage.setItem(se, e);
197
+ }, ut = () => {
198
+ localStorage.removeItem(se);
199
+ }, ie = (e, t) => {
200
+ ct(e), _t(t);
201
+ }, ee = () => {
202
+ it(), ut();
203
+ }, mt = () => !!ce();
204
+ class ht {
205
+ constructor(t) {
205
206
  R(this, "baseURL");
206
207
  R(this, "onUnauthorized");
207
208
  R(this, "isRefreshing", !1);
208
209
  R(this, "refreshPromise", null);
209
- this.baseURL = e.baseURL, this.onUnauthorized = e.onUnauthorized;
210
+ this.baseURL = t.baseURL, this.onUnauthorized = t.onUnauthorized;
210
211
  }
211
212
  async refreshAccessToken() {
212
- var d;
213
- const e = it();
214
- if (!e)
213
+ var _;
214
+ const t = dt();
215
+ if (!t)
215
216
  throw new Error("No refresh token available");
216
217
  const s = await fetch(`${this.baseURL}/api/v1/auth/refresh-token`, {
217
218
  method: "POST",
218
219
  headers: {
219
220
  "Content-Type": "application/json"
220
221
  },
221
- body: JSON.stringify({ refresh_token: e })
222
+ body: JSON.stringify({ refresh_token: t })
222
223
  });
223
224
  if (!s.ok)
224
- throw Z(), (d = this.onUnauthorized) == null || d.call(this), new Error("Token refresh failed");
225
- const r = await s.json();
226
- return ce(r.access_token, e), r.access_token;
225
+ throw ee(), (_ = this.onUnauthorized) == null || _.call(this), new Error("Token refresh failed");
226
+ const o = await s.json();
227
+ return ie(o.access_token, t), o.access_token;
227
228
  }
228
- async request(e, s = {}) {
229
- const r = le(), d = {
229
+ async request(t, s = {}) {
230
+ const o = ce(), _ = {
230
231
  "Content-Type": "application/json",
231
232
  ...s.headers
232
233
  };
233
- r && (d.Authorization = `Bearer ${r}`);
234
- const u = `${this.baseURL}${e}`;
235
- let l = await fetch(u, {
234
+ o && (_.Authorization = `Bearer ${o}`);
235
+ const h = `${this.baseURL}${t}`;
236
+ let c = await fetch(h, {
236
237
  ...s,
237
- headers: d
238
+ headers: _
238
239
  });
239
- if (l.status === 401 && r) {
240
+ if (c.status === 401 && o) {
240
241
  this.isRefreshing || (this.isRefreshing = !0, this.refreshPromise = this.refreshAccessToken().finally(() => {
241
242
  this.isRefreshing = !1, this.refreshPromise = null;
242
243
  }));
243
244
  try {
244
- const i = await this.refreshPromise;
245
- d.Authorization = `Bearer ${i}`, l = await fetch(u, {
245
+ const l = await this.refreshPromise;
246
+ _.Authorization = `Bearer ${l}`, c = await fetch(h, {
246
247
  ...s,
247
- headers: d
248
+ headers: _
248
249
  });
249
250
  } catch {
250
251
  throw new Error("Authentication failed");
251
252
  }
252
253
  }
253
- if (!l.ok) {
254
- const i = {
255
- message: l.statusText,
256
- status: l.status
254
+ if (!c.ok) {
255
+ const l = {
256
+ message: c.statusText,
257
+ status: c.status
257
258
  };
258
259
  try {
259
- const c = await l.json();
260
- if (l.status === 422 && Array.isArray(c.detail)) {
261
- const p = c.detail.map((f) => f.msg || "Validation error").join(", ");
262
- i.message = p;
263
- } else typeof c.detail == "string" ? i.message = c.detail : c.message && (i.message = c.message);
264
- i.detail = c.detail;
260
+ const i = await c.json();
261
+ if (c.status === 422 && Array.isArray(i.detail)) {
262
+ const g = i.detail.map((f) => f.msg || "Validation error").join(", ");
263
+ l.message = g;
264
+ } else typeof i.detail == "string" ? l.message = i.detail : i.message && (l.message = i.message);
265
+ l.detail = i.detail;
265
266
  } catch {
266
267
  }
267
- throw i;
268
+ throw l;
268
269
  }
269
- return l.status === 204 ? {} : l.json();
270
+ return c.status === 204 ? {} : c.json();
270
271
  }
271
- async get(e, s) {
272
- return this.request(e, { ...s, method: "GET" });
272
+ async get(t, s) {
273
+ return this.request(t, { ...s, method: "GET" });
273
274
  }
274
- async post(e, s, r) {
275
- return this.request(e, {
276
- ...r,
275
+ async post(t, s, o) {
276
+ return this.request(t, {
277
+ ...o,
277
278
  method: "POST",
278
279
  body: s ? JSON.stringify(s) : void 0
279
280
  });
280
281
  }
281
- async put(e, s, r) {
282
- return this.request(e, {
283
- ...r,
282
+ async put(t, s, o) {
283
+ return this.request(t, {
284
+ ...o,
284
285
  method: "PUT",
285
286
  body: s ? JSON.stringify(s) : void 0
286
287
  });
287
288
  }
288
- async patch(e, s, r) {
289
- return this.request(e, {
290
- ...r,
289
+ async patch(t, s, o) {
290
+ return this.request(t, {
291
+ ...o,
291
292
  method: "PATCH",
292
293
  body: s ? JSON.stringify(s) : void 0
293
294
  });
294
295
  }
295
- async delete(e, s) {
296
- return this.request(e, { ...s, method: "DELETE" });
296
+ async delete(t, s) {
297
+ return this.request(t, { ...s, method: "DELETE" });
297
298
  }
298
299
  }
299
- let g;
300
- const ys = (t) => {
301
- g = new mt(t);
302
- }, U = "astrogators_ally_codes", H = "astrogators_selected_ally_code", N = () => {
300
+ let p;
301
+ const gt = (e) => {
302
+ p = new ht(e);
303
+ }, j = "astrogators_ally_codes", H = "astrogators_selected_ally_code", N = () => {
303
304
  try {
304
- const t = localStorage.getItem(U);
305
- return t ? JSON.parse(t) : [];
306
- } catch (t) {
307
- return console.error("Failed to read ally codes from localStorage:", t), [];
305
+ const e = localStorage.getItem(j);
306
+ return e ? JSON.parse(e) : [];
307
+ } catch (e) {
308
+ return console.error("Failed to read ally codes from localStorage:", e), [];
308
309
  }
309
- }, ht = (t) => {
310
+ }, pt = (e) => {
310
311
  try {
311
- const e = N();
312
- if (e.some((r) => r.ally_code === t.ally_code))
312
+ const t = N();
313
+ if (t.some((o) => o.ally_code === e.ally_code))
313
314
  return;
314
- e.push(t), localStorage.setItem(U, JSON.stringify(e));
315
- } catch (e) {
316
- console.error("Failed to save ally code to localStorage:", e);
315
+ t.push(e), localStorage.setItem(j, JSON.stringify(t));
316
+ } catch (t) {
317
+ console.error("Failed to save ally code to localStorage:", t);
317
318
  }
318
- }, gt = (t) => {
319
+ }, ft = (e) => {
319
320
  try {
320
- const s = N().filter((r) => r.ally_code !== t);
321
- localStorage.setItem(U, JSON.stringify(s));
322
- } catch (e) {
323
- console.error("Failed to remove ally code from localStorage:", e);
321
+ const s = N().filter((o) => o.ally_code !== e);
322
+ localStorage.setItem(j, JSON.stringify(s));
323
+ } catch (t) {
324
+ console.error("Failed to remove ally code from localStorage:", t);
324
325
  }
325
- }, oe = (t) => {
326
+ }, ne = (e) => {
326
327
  try {
327
328
  const s = N().map(
328
- (r) => r.ally_code === t ? { ...r, last_used_at: (/* @__PURE__ */ new Date()).toISOString() } : r
329
+ (o) => o.ally_code === e ? { ...o, last_used_at: (/* @__PURE__ */ new Date()).toISOString() } : o
329
330
  );
330
- localStorage.setItem(U, JSON.stringify(s));
331
- } catch (e) {
332
- console.error("Failed to update ally code last used:", e);
331
+ localStorage.setItem(j, JSON.stringify(s));
332
+ } catch (t) {
333
+ console.error("Failed to update ally code last used:", t);
333
334
  }
334
- }, pt = () => localStorage.getItem(H), ft = (t) => {
335
- t ? localStorage.setItem(H, t) : localStorage.removeItem(H);
336
- }, yt = () => {
337
- localStorage.removeItem(U), localStorage.removeItem(H);
338
- }, ie = he(void 0), vs = ({ children: t }) => {
339
- const [e, s] = $(null), [r, d] = $(!0), [u, l] = $([]), [i, c] = $(null), [p, f] = $(!1), [I, y] = $({
335
+ }, yt = () => localStorage.getItem(H), vt = (e) => {
336
+ e ? localStorage.setItem(H, e) : localStorage.removeItem(H);
337
+ }, $t = () => {
338
+ localStorage.removeItem(j), localStorage.removeItem(H);
339
+ }, de = ge(void 0), $s = ({ children: e, apiBaseUrl: t }) => {
340
+ const [s, o] = $(null), [_, h] = $(!0), [c, l] = $([]), [i, g] = $(null), [f, C] = $(!1), [b, k] = $({
340
341
  show: !1,
341
342
  localStorageCodes: []
342
- }), k = A(async () => {
343
- if (!ut()) {
344
- s(null), d(!1);
343
+ });
344
+ U(() => {
345
+ gt({
346
+ baseURL: t
347
+ });
348
+ }, [t]);
349
+ const W = S(async () => {
350
+ if (!mt()) {
351
+ o(null), h(!1);
345
352
  return;
346
353
  }
347
354
  try {
348
- const o = await g.get("/api/v1/users/me");
349
- s(o);
350
- } catch (o) {
351
- console.error("Failed to fetch user:", o), s(null), Z();
355
+ const n = await p.get("/api/v1/users/me");
356
+ o(n);
357
+ } catch (n) {
358
+ console.error("Failed to fetch user:", n), o(null), ee();
352
359
  } finally {
353
- d(!1);
360
+ h(!1);
354
361
  }
355
362
  }, []);
356
- J(() => {
357
- k();
358
- }, [k]);
359
- const j = async (o) => {
363
+ U(() => {
364
+ W();
365
+ }, [W]);
366
+ const I = async (n) => {
360
367
  try {
361
- const a = await g.post("/api/v1/auth/login", o);
362
- ce(a.access_token, a.refresh_token);
363
- const m = await g.get("/api/v1/users/me");
364
- s(m);
368
+ const a = await p.post("/api/v1/auth/login", n);
369
+ ie(a.access_token, a.refresh_token);
370
+ const u = await p.get("/api/v1/users/me");
371
+ o(u);
365
372
  } catch (a) {
366
373
  throw console.error("Login failed:", a), a;
367
374
  }
368
- }, L = async (o) => {
375
+ }, D = async (n) => {
369
376
  try {
370
- await g.post("/api/v1/auth/register", o);
377
+ await p.post("/api/v1/auth/register", n);
371
378
  } catch (a) {
372
379
  throw console.error("Registration failed:", a), a;
373
380
  }
374
- }, D = () => {
375
- Z(), s(null), l([]), c(null), y({ show: !1, localStorageCodes: [] });
376
- }, F = async () => {
377
- await k();
378
- }, Y = async (o) => {
381
+ }, F = () => {
382
+ ee(), o(null), l([]), g(null), k({ show: !1, localStorageCodes: [] });
383
+ }, Y = async () => {
384
+ await W();
385
+ }, G = async (n) => {
379
386
  try {
380
- return (await g.post(
387
+ return (await p.post(
381
388
  "/api/v1/auth/forgot-password",
382
- o
389
+ n
383
390
  )).message;
384
391
  } catch (a) {
385
392
  throw console.error("Forgot password failed:", a), a;
386
393
  }
387
- }, G = async (o) => {
394
+ }, K = async (n) => {
388
395
  try {
389
- return (await g.post(
396
+ return (await p.post(
390
397
  "/api/v1/auth/reset-password",
391
- o
398
+ n
392
399
  )).message;
393
400
  } catch (a) {
394
401
  throw console.error("Reset password failed:", a), a;
395
402
  }
396
- }, K = async (o) => {
403
+ }, V = async (n) => {
397
404
  try {
398
- return (await g.post(
405
+ return (await p.post(
399
406
  "/api/v1/auth/resend-verification",
400
- o
407
+ n
401
408
  )).message;
402
409
  } catch (a) {
403
410
  throw console.error("Resend verification failed:", a), a;
404
411
  }
405
- }, E = A(async () => {
406
- f(!0);
412
+ }, d = S(async () => {
413
+ C(!0);
407
414
  try {
408
- if (e) {
409
- const a = await g.get("/api/v1/users/me/ally-codes");
415
+ if (s) {
416
+ const a = await p.get("/api/v1/users/me/ally-codes");
410
417
  l(a.ally_codes);
411
- const m = N();
412
- m.length > 0 && y({
418
+ const u = N();
419
+ u.length > 0 && k({
413
420
  show: !0,
414
- localStorageCodes: m.map((q) => q.ally_code)
421
+ localStorageCodes: u.map((q) => q.ally_code)
415
422
  });
416
423
  } else {
417
424
  const a = N();
418
425
  l(a);
419
426
  }
420
- const o = pt();
421
- c(o);
422
- } catch (o) {
423
- console.error("Failed to fetch ally codes:", o), l([]);
427
+ const n = yt();
428
+ g(n);
429
+ } catch (n) {
430
+ console.error("Failed to fetch ally codes:", n), l([]);
424
431
  } finally {
425
- f(!1);
432
+ C(!1);
426
433
  }
427
- }, [e]), _ = A(async (o) => {
434
+ }, [s]), y = S(async (n) => {
428
435
  var a;
429
- if (!/^\d{9}$/.test(o))
436
+ if (!/^\d{9}$/.test(n))
430
437
  throw new Error("Ally code must be exactly 9 digits");
431
- if (e) {
432
- const m = await g.post(
438
+ if (s) {
439
+ const u = await p.post(
433
440
  "/api/v1/users/me/ally-codes",
434
- { ally_code: o }
441
+ { ally_code: n }
435
442
  );
436
- l((q) => [m, ...q]), u.length === 0 && S(o);
443
+ l((q) => [u, ...q]), c.length === 0 && z(n);
437
444
  } else {
438
- const m = await g.get(`/api/v1/player-data/player/${o}`);
439
- if (!m)
445
+ const u = await p.get(`/api/v1/player-data/player/${n}`);
446
+ if (!u)
440
447
  throw new Error("Invalid ally code - player not found");
441
448
  const q = {
442
- ally_code: o,
443
- player_name: ((a = m == null ? void 0 : m.data) == null ? void 0 : a.name) || null,
449
+ ally_code: n,
450
+ player_name: ((a = u == null ? void 0 : u.data) == null ? void 0 : a.name) || null,
444
451
  last_used_at: (/* @__PURE__ */ new Date()).toISOString()
445
452
  };
446
- ht(q), l(N()), u.length === 0 && S(o);
453
+ pt(q), l(N()), c.length === 0 && z(n);
447
454
  }
448
- }, [e, u.length]), b = A(async (o) => {
449
- e && typeof o == "number" ? (await g.delete(`/api/v1/users/me/ally-codes/${o}`), l((a) => a.filter((m) => "id" in m && m.id !== o))) : !e && typeof o == "string" && (gt(o), l(N()), i === o && S(null));
450
- }, [e, i]), S = A((o) => {
451
- if (c(o), ft(o), o && e) {
452
- const a = u.find((m) => "ally_code" in m && m.ally_code === o);
453
- a && "id" in a && se(a.id);
454
- } else o && !e && oe(o);
455
- }, [e, u]), se = A(async (o) => {
456
- e && typeof o == "number" ? (await g.put(`/api/v1/users/me/ally-codes/${o}/use`, {}), await E()) : !e && typeof o == "string" && (oe(o), l(N()));
457
- }, [e, E]), V = A(() => {
458
- y({ show: !1, localStorageCodes: [] });
459
- }, []), de = A(async () => {
460
- if (!e) return;
461
- const o = N();
462
- for (const a of o)
455
+ }, [s, c.length]), L = S(async (n) => {
456
+ s && typeof n == "number" ? (await p.delete(`/api/v1/users/me/ally-codes/${n}`), l((a) => a.filter((u) => "id" in u && u.id !== n))) : !s && typeof n == "string" && (ft(n), l(N()), i === n && z(null));
457
+ }, [s, i]), z = S((n) => {
458
+ if (g(n), vt(n), n && s) {
459
+ const a = c.find((u) => "ally_code" in u && u.ally_code === n);
460
+ a && "id" in a && oe(a.id);
461
+ } else n && !s && ne(n);
462
+ }, [s, c]), oe = S(async (n) => {
463
+ s && typeof n == "number" ? (await p.put(`/api/v1/users/me/ally-codes/${n}/use`, {}), await d()) : !s && typeof n == "string" && (ne(n), l(N()));
464
+ }, [s, d]), Q = S(() => {
465
+ k({ show: !1, localStorageCodes: [] });
466
+ }, []), _e = S(async () => {
467
+ if (!s) return;
468
+ const n = N();
469
+ for (const a of n)
463
470
  try {
464
- await _(a.ally_code);
465
- } catch (m) {
466
- console.error(`Failed to migrate ally code ${a.ally_code}:`, m);
471
+ await y(a.ally_code);
472
+ } catch (u) {
473
+ console.error(`Failed to migrate ally code ${a.ally_code}:`, u);
467
474
  }
468
- yt(), V();
469
- }, [e, _, V]);
470
- J(() => {
471
- E();
472
- }, [E]);
473
- const _e = {
474
- user: e,
475
- isAuthenticated: !!e,
476
- isLoading: r,
477
- login: j,
478
- register: L,
479
- logout: D,
480
- refreshUser: F,
481
- forgotPassword: Y,
482
- resetPassword: G,
483
- resendVerification: K,
475
+ $t(), Q();
476
+ }, [s, y, Q]);
477
+ U(() => {
478
+ d();
479
+ }, [d]);
480
+ const ue = {
481
+ user: s,
482
+ isAuthenticated: !!s,
483
+ isLoading: _,
484
+ login: I,
485
+ register: D,
486
+ logout: F,
487
+ refreshUser: Y,
488
+ forgotPassword: G,
489
+ resetPassword: K,
490
+ resendVerification: V,
484
491
  // Ally code values
485
- allyCodes: u,
492
+ allyCodes: c,
486
493
  selectedAllyCode: i,
487
- isLoadingAllyCodes: p,
488
- fetchAllyCodes: E,
489
- addAllyCode: _,
490
- removeAllyCode: b,
491
- selectAllyCode: S,
492
- updateAllyCodeLastUsed: se,
493
- migrationPrompt: I,
494
- dismissMigrationPrompt: V,
495
- migrateLocalStorageCodes: de
494
+ isLoadingAllyCodes: f,
495
+ fetchAllyCodes: d,
496
+ addAllyCode: y,
497
+ removeAllyCode: L,
498
+ selectAllyCode: z,
499
+ updateAllyCodeLastUsed: oe,
500
+ migrationPrompt: b,
501
+ dismissMigrationPrompt: Q,
502
+ migrateLocalStorageCodes: _e
496
503
  };
497
- return /* @__PURE__ */ n(ie.Provider, { value: _e, children: t });
498
- }, vt = () => {
499
- const t = ge(ie);
500
- if (t === void 0)
504
+ return /* @__PURE__ */ r(de.Provider, { value: ue, children: e });
505
+ }, wt = () => {
506
+ const e = pe(de);
507
+ if (e === void 0)
501
508
  throw new Error("useAuth must be used within an AuthProvider");
502
- return t;
503
- }, O = (t) => !t || t.length !== 9 ? t : `${t.slice(0, 3)}-${t.slice(3, 6)}-${t.slice(6, 9)}`, $s = (t) => t.replace(/-/g, ""), $t = "_allyCodeDropdown_1m0tw_1", wt = "_select_1m0tw_8", bt = "_manageButton_1m0tw_12", Nt = "_managePanel_1m0tw_16", St = "_addSection_1m0tw_37", At = "_addInputGroup_1m0tw_43", xt = "_error_1m0tw_55", Tt = "_success_1m0tw_61", Ct = "_codesList_1m0tw_67", kt = "_codeItem_1m0tw_71", Et = "_doneButton_1m0tw_88", v = {
504
- allyCodeDropdown: $t,
505
- select: wt,
506
- manageButton: bt,
507
- managePanel: Nt,
508
- addSection: St,
509
- addInputGroup: At,
510
- error: xt,
511
- success: Tt,
512
- codesList: Ct,
513
- codeItem: kt,
514
- doneButton: Et
515
- }, ws = ({
516
- onAllyCodeSelected: t,
517
- className: e = ""
509
+ return e;
510
+ }, M = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, ws = (e) => e.replace(/-/g, ""), bt = "_allyCodeDropdown_1m0tw_1", Nt = "_select_1m0tw_8", St = "_manageButton_1m0tw_12", At = "_managePanel_1m0tw_16", xt = "_addSection_1m0tw_37", Tt = "_addInputGroup_1m0tw_43", Ct = "_error_1m0tw_55", kt = "_success_1m0tw_61", Et = "_codesList_1m0tw_67", Wt = "_codeItem_1m0tw_71", It = "_doneButton_1m0tw_88", v = {
511
+ allyCodeDropdown: bt,
512
+ select: Nt,
513
+ manageButton: St,
514
+ managePanel: At,
515
+ addSection: xt,
516
+ addInputGroup: Tt,
517
+ error: Ct,
518
+ success: kt,
519
+ codesList: Et,
520
+ codeItem: Wt,
521
+ doneButton: It
522
+ }, bs = ({
523
+ onAllyCodeSelected: e,
524
+ className: t = ""
518
525
  }) => {
519
526
  const {
520
527
  allyCodes: s,
521
- selectedAllyCode: r,
522
- selectAllyCode: d,
523
- removeAllyCode: u,
524
- addAllyCode: l,
525
- isLoadingAllyCodes: i
526
- } = vt(), [c, p] = $(!1), [f, I] = $(""), [y, k] = $(""), [j, L] = $(""), [D, F] = $(!1), Y = s.map((_) => ({
527
- value: _.ally_code,
528
- label: _.player_name ? `${_.player_name} (${O(_.ally_code)})` : O(_.ally_code)
529
- })), G = (_) => {
530
- const b = _.target.value || null;
531
- d(b), t == null || t(b);
532
- }, K = async (_) => {
533
- const b = s.find((S) => S.ally_code === _);
534
- if (b) {
535
- const S = "id" in b ? b.id : b.ally_code;
536
- await u(S);
528
+ selectedAllyCode: o,
529
+ selectAllyCode: _,
530
+ removeAllyCode: h,
531
+ addAllyCode: c,
532
+ isLoadingAllyCodes: l
533
+ } = wt(), [i, g] = $(!1), [f, C] = $(""), [b, k] = $(""), [W, I] = $(""), [D, F] = $(!1), Y = s.map((d) => ({
534
+ value: d.ally_code,
535
+ label: d.player_name ? `${d.player_name} (${M(d.ally_code)})` : M(d.ally_code)
536
+ })), G = (d) => {
537
+ const y = d.target.value || null;
538
+ _(y), e == null || e(y);
539
+ }, K = async (d) => {
540
+ const y = s.find((L) => L.ally_code === d);
541
+ if (y) {
542
+ const L = "id" in y ? y.id : y.ally_code;
543
+ await h(L);
537
544
  }
538
- }, E = async () => {
539
- if (k(""), L(""), !/^\d{9}$/.test(f)) {
545
+ }, V = async () => {
546
+ if (k(""), I(""), !/^\d{9}$/.test(f)) {
540
547
  k("Ally code must be exactly 9 digits");
541
548
  return;
542
549
  }
543
550
  F(!0);
544
551
  try {
545
- await l(f), L("Added successfully!"), I(""), setTimeout(() => L(""), 2e3);
546
- } catch (_) {
547
- k(_.message || "Failed to add ally code");
552
+ await c(f), I("Added successfully!"), C(""), setTimeout(() => I(""), 2e3);
553
+ } catch (d) {
554
+ k(d.message || "Failed to add ally code");
548
555
  } finally {
549
556
  F(!1);
550
557
  }
551
558
  };
552
- return s.length === 0 ? null : /* @__PURE__ */ h("div", { className: `${v.allyCodeDropdown} ${e}`, children: [
553
- /* @__PURE__ */ n(
554
- ae,
559
+ return s.length === 0 ? null : /* @__PURE__ */ m("div", { className: `${v.allyCodeDropdown} ${t}`, children: [
560
+ /* @__PURE__ */ r(
561
+ le,
555
562
  {
556
563
  options: Y,
557
- value: r || "",
564
+ value: o || "",
558
565
  onChange: G,
559
566
  placeholder: "Select ally code",
560
- disabled: i,
567
+ disabled: l,
561
568
  className: v.select
562
569
  }
563
570
  ),
564
- c && /* @__PURE__ */ h("div", { className: v.managePanel, children: [
565
- /* @__PURE__ */ n("h4", { children: "Manage Ally Codes" }),
566
- /* @__PURE__ */ h("div", { className: v.addSection, children: [
567
- /* @__PURE__ */ h("div", { className: v.addInputGroup, children: [
568
- /* @__PURE__ */ n(
569
- re,
571
+ i && /* @__PURE__ */ m("div", { className: v.managePanel, children: [
572
+ /* @__PURE__ */ r("h4", { children: "Manage Ally Codes" }),
573
+ /* @__PURE__ */ m("div", { className: v.addSection, children: [
574
+ /* @__PURE__ */ m("div", { className: v.addInputGroup, children: [
575
+ /* @__PURE__ */ r(
576
+ ae,
570
577
  {
571
578
  type: "text",
572
579
  placeholder: "9-digit ally code",
573
580
  value: f,
574
- onChange: (_) => I(_.target.value.replace(/\D/g, "").slice(0, 9)),
581
+ onChange: (d) => C(d.target.value.replace(/\D/g, "").slice(0, 9)),
575
582
  disabled: D
576
583
  }
577
584
  ),
578
- /* @__PURE__ */ n(
579
- z,
585
+ /* @__PURE__ */ r(
586
+ O,
580
587
  {
581
588
  variant: "primary",
582
589
  size: "sm",
583
- onClick: E,
590
+ onClick: V,
584
591
  loading: D,
585
592
  disabled: f.length !== 9,
586
593
  children: "Add"
587
594
  }
588
595
  )
589
596
  ] }),
590
- y && /* @__PURE__ */ n("div", { className: v.error, children: y }),
591
- j && /* @__PURE__ */ n("div", { className: v.success, children: j })
597
+ b && /* @__PURE__ */ r("div", { className: v.error, children: b }),
598
+ W && /* @__PURE__ */ r("div", { className: v.success, children: W })
592
599
  ] }),
593
- /* @__PURE__ */ n("div", { className: v.codesList, children: s.map((_) => /* @__PURE__ */ h("div", { className: v.codeItem, children: [
594
- /* @__PURE__ */ n("span", { children: _.player_name ? `${_.player_name} (${O(_.ally_code)})` : O(_.ally_code) }),
595
- /* @__PURE__ */ n(
596
- z,
600
+ /* @__PURE__ */ r("div", { className: v.codesList, children: s.map((d) => /* @__PURE__ */ m("div", { className: v.codeItem, children: [
601
+ /* @__PURE__ */ r("span", { children: d.player_name ? `${d.player_name} (${M(d.ally_code)})` : M(d.ally_code) }),
602
+ /* @__PURE__ */ r(
603
+ O,
597
604
  {
598
605
  variant: "ghost",
599
606
  size: "sm",
600
- onClick: () => K(_.ally_code),
607
+ onClick: () => K(d.ally_code),
601
608
  children: "Remove"
602
609
  }
603
610
  )
604
- ] }, _.ally_code)) }),
605
- /* @__PURE__ */ n(
606
- z,
611
+ ] }, d.ally_code)) }),
612
+ /* @__PURE__ */ r(
613
+ O,
607
614
  {
608
615
  variant: "secondary",
609
616
  size: "sm",
610
- onClick: () => p(!1),
617
+ onClick: () => g(!1),
611
618
  className: v.doneButton,
612
619
  children: "Done"
613
620
  }
614
621
  )
615
622
  ] }),
616
- /* @__PURE__ */ n(
617
- z,
623
+ /* @__PURE__ */ r(
624
+ O,
618
625
  {
619
626
  variant: "ghost",
620
627
  size: "sm",
621
- onClick: () => p(!c),
628
+ onClick: () => g(!i),
622
629
  className: v.manageButton,
623
630
  children: "Manage"
624
631
  }
625
632
  )
626
633
  ] });
627
- }, Wt = "_card_1n0ll_1", It = "_elevated_1n0ll_12", Lt = "_outline_1n0ll_17", qt = "_hoverable_1n0ll_40", M = {
628
- card: Wt,
634
+ }, Lt = "_card_1n0ll_1", qt = "_elevated_1n0ll_12", Rt = "_outline_1n0ll_17", Bt = "_hoverable_1n0ll_40", J = {
635
+ card: Lt,
629
636
  default: "_default_1n0ll_8",
630
- elevated: It,
631
- outline: Lt,
637
+ elevated: qt,
638
+ outline: Rt,
632
639
  "padding-none": "_padding-none_1n0ll_23",
633
640
  "padding-sm": "_padding-sm_1n0ll_27",
634
641
  "padding-md": "_padding-md_1n0ll_31",
635
642
  "padding-lg": "_padding-lg_1n0ll_35",
636
- hoverable: qt
637
- }, bs = ({
638
- children: t,
639
- variant: e = "default",
643
+ hoverable: Bt
644
+ }, Ns = ({
645
+ children: e,
646
+ variant: t = "default",
640
647
  chamfered: s = !1,
641
- chamferSize: r = "md",
642
- padding: d = "md",
643
- hoverable: u = !1,
644
- className: l = "",
645
- onClick: i
648
+ chamferSize: o = "md",
649
+ padding: _ = "md",
650
+ hoverable: h = !1,
651
+ className: c = "",
652
+ onClick: l
646
653
  }) => {
647
- const c = s ? r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "";
648
- return /* @__PURE__ */ n(
654
+ const i = s ? o === "sm" ? "chamfered-box-sm" : o === "lg" ? "chamfered-box-lg" : "chamfered-box" : "";
655
+ return /* @__PURE__ */ r(
649
656
  "div",
650
657
  {
651
- className: `${M.card} ${M[e]} ${M[`padding-${d}`]} ${c} ${u ? M.hoverable : ""} ${l}`,
652
- onClick: i,
653
- role: i ? "button" : void 0,
654
- tabIndex: i ? 0 : void 0,
655
- children: t
658
+ className: `${J.card} ${J[t]} ${J[`padding-${_}`]} ${i} ${h ? J.hoverable : ""} ${c}`,
659
+ onClick: l,
660
+ role: l ? "button" : void 0,
661
+ tabIndex: l ? 0 : void 0,
662
+ children: e
656
663
  }
657
664
  );
658
- }, Rt = "_badge_rk7t5_1", Bt = "_sm_rk7t5_11", Pt = "_md_rk7t5_16", Ut = "_lg_rk7t5_21", jt = "_primary_rk7t5_32", Dt = "_secondary_rk7t5_37", Ft = "_success_rk7t5_42", zt = "_warning_rk7t5_47", Ot = "_error_rk7t5_52", Mt = "_info_rk7t5_57", X = {
659
- badge: Rt,
660
- sm: Bt,
661
- md: Pt,
662
- lg: Ut,
665
+ }, Pt = "_badge_rk7t5_1", Ut = "_sm_rk7t5_11", jt = "_md_rk7t5_16", Dt = "_lg_rk7t5_21", Ft = "_primary_rk7t5_32", zt = "_secondary_rk7t5_37", Ot = "_success_rk7t5_42", Mt = "_warning_rk7t5_47", Jt = "_error_rk7t5_52", Ht = "_info_rk7t5_57", Z = {
666
+ badge: Pt,
667
+ sm: Ut,
668
+ md: jt,
669
+ lg: Dt,
663
670
  default: "_default_rk7t5_27",
664
- primary: jt,
665
- secondary: Dt,
666
- success: Ft,
667
- warning: zt,
668
- error: Ot,
669
- info: Mt
670
- }, Ns = ({
671
- children: t,
672
- variant: e = "default",
673
- size: s = "md",
674
- className: r = ""
675
- }) => /* @__PURE__ */ n("span", { className: `${X.badge} ${X[e]} ${X[s]} ${r}`, children: t }), Jt = "_overlay_1b3yt_1", Ht = "_fadeIn_1b3yt_1", Yt = "_modal_1b3yt_13", Gt = "_slideUp_1b3yt_1", Kt = "_sm_1b3yt_25", Vt = "_md_1b3yt_30", Qt = "_lg_1b3yt_35", Xt = "_xl_1b3yt_40", Zt = "_header_1b3yt_45", es = "_title_1b3yt_53", ts = "_closeButton_1b3yt_60", ss = "_content_1b3yt_78", W = {
676
- overlay: Jt,
677
- fadeIn: Ht,
678
- modal: Yt,
679
- slideUp: Gt,
680
- sm: Kt,
681
- md: Vt,
682
- lg: Qt,
683
- xl: Xt,
684
- header: Zt,
685
- title: es,
686
- closeButton: ts,
687
- content: ss
671
+ primary: Ft,
672
+ secondary: zt,
673
+ success: Ot,
674
+ warning: Mt,
675
+ error: Jt,
676
+ info: Ht
688
677
  }, Ss = ({
689
- isOpen: t,
690
- onClose: e,
678
+ children: e,
679
+ variant: t = "default",
680
+ size: s = "md",
681
+ className: o = ""
682
+ }) => /* @__PURE__ */ r("span", { className: `${Z.badge} ${Z[t]} ${Z[s]} ${o}`, children: e }), Yt = "_overlay_1b3yt_1", Gt = "_fadeIn_1b3yt_1", Kt = "_modal_1b3yt_13", Vt = "_slideUp_1b3yt_1", Qt = "_sm_1b3yt_25", Xt = "_md_1b3yt_30", Zt = "_lg_1b3yt_35", es = "_xl_1b3yt_40", ts = "_header_1b3yt_45", ss = "_title_1b3yt_53", os = "_closeButton_1b3yt_60", ns = "_content_1b3yt_78", E = {
683
+ overlay: Yt,
684
+ fadeIn: Gt,
685
+ modal: Kt,
686
+ slideUp: Vt,
687
+ sm: Qt,
688
+ md: Xt,
689
+ lg: Zt,
690
+ xl: es,
691
+ header: ts,
692
+ title: ss,
693
+ closeButton: os,
694
+ content: ns
695
+ }, As = ({
696
+ isOpen: e,
697
+ onClose: t,
691
698
  title: s,
692
- children: r,
693
- size: d = "md",
694
- closeOnOverlayClick: u = !0,
695
- className: l = ""
699
+ children: o,
700
+ size: _ = "md",
701
+ closeOnOverlayClick: h = !0,
702
+ className: c = ""
696
703
  }) => {
697
- if (J(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
704
+ if (U(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
698
705
  document.body.style.overflow = "unset";
699
- }), [t]), J(() => {
700
- const c = (p) => {
701
- p.key === "Escape" && t && e();
706
+ }), [e]), U(() => {
707
+ const i = (g) => {
708
+ g.key === "Escape" && e && t();
702
709
  };
703
- return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
704
- }, [t, e]), !t) return null;
705
- const i = (c) => {
706
- u && c.target === c.currentTarget && e();
710
+ return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
711
+ }, [e, t]), !e) return null;
712
+ const l = (i) => {
713
+ h && i.target === i.currentTarget && t();
707
714
  };
708
- return /* @__PURE__ */ n("div", { className: W.overlay, onClick: i, children: /* @__PURE__ */ h("div", { className: `${W.modal} ${W[d]} ${l}`, role: "dialog", "aria-modal": "true", children: [
709
- s && /* @__PURE__ */ h("div", { className: W.header, children: [
710
- /* @__PURE__ */ n("h2", { className: W.title, children: s }),
711
- /* @__PURE__ */ n("button", { className: W.closeButton, onClick: e, "aria-label": "Close modal", children: "✕" })
715
+ return /* @__PURE__ */ r("div", { className: E.overlay, onClick: l, children: /* @__PURE__ */ m("div", { className: `${E.modal} ${E[_]} ${c}`, role: "dialog", "aria-modal": "true", children: [
716
+ s && /* @__PURE__ */ m("div", { className: E.header, children: [
717
+ /* @__PURE__ */ r("h2", { className: E.title, children: s }),
718
+ /* @__PURE__ */ r("button", { className: E.closeButton, onClick: t, "aria-label": "Close modal", children: "✕" })
712
719
  ] }),
713
- /* @__PURE__ */ n("div", { className: W.content, children: r })
720
+ /* @__PURE__ */ r("div", { className: E.content, children: o })
714
721
  ] }) });
715
- }, os = "_spinner_1uhnh_2", ns = "_spin_1uhnh_2", rs = "_sm_1uhnh_9", as = "_md_1uhnh_15", ls = "_lg_1uhnh_21", cs = "_dots_1uhnh_34", is = "_dot_1uhnh_34", ds = "_bounce_1uhnh_1", _s = "_visuallyHidden_1uhnh_91", C = {
716
- spinner: os,
717
- spin: ns,
718
- sm: rs,
719
- md: as,
720
- lg: ls,
721
- dots: cs,
722
- dot: is,
723
- bounce: ds,
724
- visuallyHidden: _s
725
- }, As = ({
726
- size: t = "md",
727
- variant: e = "spinner",
722
+ }, rs = "_spinner_1uhnh_2", as = "_spin_1uhnh_2", ls = "_sm_1uhnh_9", cs = "_md_1uhnh_15", is = "_lg_1uhnh_21", ds = "_dots_1uhnh_34", _s = "_dot_1uhnh_34", us = "_bounce_1uhnh_1", ms = "_visuallyHidden_1uhnh_91", T = {
723
+ spinner: rs,
724
+ spin: as,
725
+ sm: ls,
726
+ md: cs,
727
+ lg: is,
728
+ dots: ds,
729
+ dot: _s,
730
+ bounce: us,
731
+ visuallyHidden: ms
732
+ }, xs = ({
733
+ size: e = "md",
734
+ variant: t = "spinner",
728
735
  className: s = ""
729
- }) => e === "dots" ? /* @__PURE__ */ h("div", { className: `${C.dots} ${C[t]} ${s}`, children: [
730
- /* @__PURE__ */ n("span", { className: C.dot }),
731
- /* @__PURE__ */ n("span", { className: C.dot }),
732
- /* @__PURE__ */ n("span", { className: C.dot })
733
- ] }) : /* @__PURE__ */ n("div", { className: `${C.spinner} ${C[t]} ${s}`, role: "status", children: /* @__PURE__ */ n("span", { className: C.visuallyHidden, children: "Loading..." }) });
736
+ }) => t === "dots" ? /* @__PURE__ */ m("div", { className: `${T.dots} ${T[e]} ${s}`, children: [
737
+ /* @__PURE__ */ r("span", { className: T.dot }),
738
+ /* @__PURE__ */ r("span", { className: T.dot }),
739
+ /* @__PURE__ */ r("span", { className: T.dot })
740
+ ] }) : /* @__PURE__ */ r("div", { className: `${T.spinner} ${T[e]} ${s}`, role: "status", children: /* @__PURE__ */ r("span", { className: T.visuallyHidden, children: "Loading..." }) });
734
741
  export {
735
- ws as AllyCodeDropdown,
736
- mt as ApiClient,
737
- vs as AuthProvider,
738
- Ns as Badge,
739
- z as Button,
740
- bs as Card,
741
- gs as Container,
742
- fs as Footer,
743
- re as Input,
744
- As as Loader,
745
- Ss as Modal,
746
- ae as Select,
747
- ps as TopBar,
748
- g as apiClient,
749
- yt as clearAllyCodes,
750
- Z as clearTokens,
751
- O as formatAllyCode,
752
- le as getAccessToken,
742
+ bs as AllyCodeDropdown,
743
+ ht as ApiClient,
744
+ $s as AuthProvider,
745
+ Ss as Badge,
746
+ O as Button,
747
+ Ns as Card,
748
+ fs as Container,
749
+ vs as Footer,
750
+ ae as Input,
751
+ xs as Loader,
752
+ As as Modal,
753
+ le as Select,
754
+ ys as TopBar,
755
+ p as apiClient,
756
+ $t as clearAllyCodes,
757
+ ee as clearTokens,
758
+ M as formatAllyCode,
759
+ ce as getAccessToken,
753
760
  N as getAllyCodesFromStorage,
754
- it as getRefreshToken,
755
- pt as getSelectedAllyCode,
756
- ys as initializeApiClient,
757
- ut as isAuthenticated,
758
- ct as removeAccessToken,
759
- gt as removeAllyCodeFromStorage,
760
- _t as removeRefreshToken,
761
- ht as saveAllyCodeToStorage,
762
- lt as setAccessToken,
763
- dt as setRefreshToken,
764
- ft as setSelectedAllyCode,
765
- ce as setTokens,
766
- $s as unformatAllyCode,
767
- oe as updateAllyCodeLastUsed,
768
- vt as useAuth
761
+ dt as getRefreshToken,
762
+ yt as getSelectedAllyCode,
763
+ gt as initializeApiClient,
764
+ mt as isAuthenticated,
765
+ it as removeAccessToken,
766
+ ft as removeAllyCodeFromStorage,
767
+ ut as removeRefreshToken,
768
+ pt as saveAllyCodeToStorage,
769
+ ct as setAccessToken,
770
+ _t as setRefreshToken,
771
+ vt as setSelectedAllyCode,
772
+ ie as setTokens,
773
+ ws as unformatAllyCode,
774
+ ne as updateAllyCodeLastUsed,
775
+ wt as useAuth
769
776
  };