astrogators-shared-ui 0.2.5 → 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,770 +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 r, 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: n = ""
18
+ className: o = ""
19
19
  }) => /* @__PURE__ */ r(
20
20
  "div",
21
21
  {
22
- className: `${Q.container} ${Q[`maxWidth-${e}`]} ${s ? Q.padding : ""} ${n}`,
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: n = ""
36
- }) => /* @__PURE__ */ r("header", { className: `${B.topBar} ${n}`, children: /* @__PURE__ */ h("div", { className: B.content, children: [
37
- /* @__PURE__ */ h("div", { className: B.left, children: [
38
- t && /* @__PURE__ */ r("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
41
  /* @__PURE__ */ r("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__ */ r("footer", { className: `${P.footer} ${e}`, children: /* @__PURE__ */ r("div", { className: P.content, children: t || /* @__PURE__ */ h("div", { className: P.defaultContent, children: [
49
- /* @__PURE__ */ h("p", { className: P.copyright, children: [
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
54
  /* @__PURE__ */ r("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",
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: n = !1,
76
- loading: d = !1,
77
- disabled: u = !1,
78
- className: l = "",
79
- ...i
75
+ fullWidth: o = !1,
76
+ loading: _ = !1,
77
+ disabled: h = !1,
78
+ className: c = "",
79
+ ...l
80
80
  }) => /* @__PURE__ */ r(
81
81
  "button",
82
82
  {
83
- className: `${x.button} ${x[e]} ${x[s]} ${n ? x.fullWidth : ""} ${d ? x.loading : ""} ${l}`,
84
- disabled: u || d,
85
- ...i,
86
- children: d ? /* @__PURE__ */ h("span", { className: x.loadingSpinner, children: [
87
- /* @__PURE__ */ r("span", { className: x.spinner }),
88
- /* @__PURE__ */ r("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: n = !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} ${n ? T.fullWidth : ""} ${d}`, children: [
112
- t && /* @__PURE__ */ h("label", { htmlFor: c, className: T.label, children: [
113
- t,
114
- l.required && /* @__PURE__ */ r("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
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__ */ r("span", { className: T.errorText, children: e }),
126
- s && !e && /* @__PURE__ */ r("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: n,
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__ */ r("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__ */ r("option", { value: "", disabled: !0, children: d }),
170
- n && n.map((y) => /* @__PURE__ */ r(
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
177
+ b.value
178
178
  )),
179
- !n && c.children
179
+ !o && i.children
180
180
  ]
181
181
  }
182
182
  ),
183
183
  /* @__PURE__ */ r("span", { className: w.arrow, children: "▼" })
184
184
  ] }),
185
- e && /* @__PURE__ */ r("span", { className: w.errorText, children: e }),
186
- s && !e && /* @__PURE__ */ r("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 })
187
187
  ] });
188
188
  }
189
189
  );
190
- ae.displayName = "Select";
191
- const ee = "astrogators_access_token", te = "astrogators_refresh_token", le = () => localStorage.getItem(ee), lt = (t) => {
192
- localStorage.setItem(ee, t);
193
- }, ct = () => {
194
- localStorage.removeItem(ee);
195
- }, it = () => localStorage.getItem(te), dt = (t) => {
196
- localStorage.setItem(te, t);
197
- }, _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 = () => {
198
194
  localStorage.removeItem(te);
199
- }, ce = (t, e) => {
200
- lt(t), dt(e);
201
- }, Z = () => {
202
- ct(), _t();
203
- }, ut = () => !!le();
204
- class mt {
205
- 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) {
206
206
  R(this, "baseURL");
207
207
  R(this, "onUnauthorized");
208
208
  R(this, "isRefreshing", !1);
209
209
  R(this, "refreshPromise", null);
210
- this.baseURL = e.baseURL, this.onUnauthorized = e.onUnauthorized;
210
+ this.baseURL = t.baseURL, this.onUnauthorized = t.onUnauthorized;
211
211
  }
212
212
  async refreshAccessToken() {
213
- var d;
214
- const e = it();
215
- if (!e)
213
+ var _;
214
+ const t = dt();
215
+ if (!t)
216
216
  throw new Error("No refresh token available");
217
217
  const s = await fetch(`${this.baseURL}/api/v1/auth/refresh-token`, {
218
218
  method: "POST",
219
219
  headers: {
220
220
  "Content-Type": "application/json"
221
221
  },
222
- body: JSON.stringify({ refresh_token: e })
222
+ body: JSON.stringify({ refresh_token: t })
223
223
  });
224
224
  if (!s.ok)
225
- throw Z(), (d = this.onUnauthorized) == null || d.call(this), new Error("Token refresh failed");
226
- const n = await s.json();
227
- return ce(n.access_token, e), n.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;
228
228
  }
229
- async request(e, s = {}) {
230
- const n = le(), d = {
229
+ async request(t, s = {}) {
230
+ const o = ce(), _ = {
231
231
  "Content-Type": "application/json",
232
232
  ...s.headers
233
233
  };
234
- n && (d.Authorization = `Bearer ${n}`);
235
- const u = `${this.baseURL}${e}`;
236
- let l = await fetch(u, {
234
+ o && (_.Authorization = `Bearer ${o}`);
235
+ const h = `${this.baseURL}${t}`;
236
+ let c = await fetch(h, {
237
237
  ...s,
238
- headers: d
238
+ headers: _
239
239
  });
240
- if (l.status === 401 && n) {
240
+ if (c.status === 401 && o) {
241
241
  this.isRefreshing || (this.isRefreshing = !0, this.refreshPromise = this.refreshAccessToken().finally(() => {
242
242
  this.isRefreshing = !1, this.refreshPromise = null;
243
243
  }));
244
244
  try {
245
- const i = await this.refreshPromise;
246
- d.Authorization = `Bearer ${i}`, l = await fetch(u, {
245
+ const l = await this.refreshPromise;
246
+ _.Authorization = `Bearer ${l}`, c = await fetch(h, {
247
247
  ...s,
248
- headers: d
248
+ headers: _
249
249
  });
250
250
  } catch {
251
251
  throw new Error("Authentication failed");
252
252
  }
253
253
  }
254
- if (!l.ok) {
255
- const i = {
256
- message: l.statusText,
257
- status: l.status
254
+ if (!c.ok) {
255
+ const l = {
256
+ message: c.statusText,
257
+ status: c.status
258
258
  };
259
259
  try {
260
- const c = await l.json();
261
- if (l.status === 422 && Array.isArray(c.detail)) {
262
- const p = c.detail.map((f) => f.msg || "Validation error").join(", ");
263
- i.message = p;
264
- } else typeof c.detail == "string" ? i.message = c.detail : c.message && (i.message = c.message);
265
- 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;
266
266
  } catch {
267
267
  }
268
- throw i;
268
+ throw l;
269
269
  }
270
- return l.status === 204 ? {} : l.json();
270
+ return c.status === 204 ? {} : c.json();
271
271
  }
272
- async get(e, s) {
273
- return this.request(e, { ...s, method: "GET" });
272
+ async get(t, s) {
273
+ return this.request(t, { ...s, method: "GET" });
274
274
  }
275
- async post(e, s, n) {
276
- return this.request(e, {
277
- ...n,
275
+ async post(t, s, o) {
276
+ return this.request(t, {
277
+ ...o,
278
278
  method: "POST",
279
279
  body: s ? JSON.stringify(s) : void 0
280
280
  });
281
281
  }
282
- async put(e, s, n) {
283
- return this.request(e, {
284
- ...n,
282
+ async put(t, s, o) {
283
+ return this.request(t, {
284
+ ...o,
285
285
  method: "PUT",
286
286
  body: s ? JSON.stringify(s) : void 0
287
287
  });
288
288
  }
289
- async patch(e, s, n) {
290
- return this.request(e, {
291
- ...n,
289
+ async patch(t, s, o) {
290
+ return this.request(t, {
291
+ ...o,
292
292
  method: "PATCH",
293
293
  body: s ? JSON.stringify(s) : void 0
294
294
  });
295
295
  }
296
- async delete(e, s) {
297
- return this.request(e, { ...s, method: "DELETE" });
296
+ async delete(t, s) {
297
+ return this.request(t, { ...s, method: "DELETE" });
298
298
  }
299
299
  }
300
- let g;
301
- const ys = (t) => {
302
- g = new mt(t);
303
- }, 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 = () => {
304
304
  try {
305
- const t = localStorage.getItem(U);
306
- return t ? JSON.parse(t) : [];
307
- } catch (t) {
308
- 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), [];
309
309
  }
310
- }, ht = (t) => {
310
+ }, pt = (e) => {
311
311
  try {
312
- const e = N();
313
- if (e.some((n) => n.ally_code === t.ally_code))
312
+ const t = N();
313
+ if (t.some((o) => o.ally_code === e.ally_code))
314
314
  return;
315
- e.push(t), localStorage.setItem(U, JSON.stringify(e));
316
- } catch (e) {
317
- 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);
318
318
  }
319
- }, gt = (t) => {
319
+ }, ft = (e) => {
320
320
  try {
321
- const s = N().filter((n) => n.ally_code !== t);
322
- localStorage.setItem(U, JSON.stringify(s));
323
- } catch (e) {
324
- 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);
325
325
  }
326
- }, oe = (t) => {
326
+ }, ne = (e) => {
327
327
  try {
328
328
  const s = N().map(
329
- (n) => n.ally_code === t ? { ...n, last_used_at: (/* @__PURE__ */ new Date()).toISOString() } : n
329
+ (o) => o.ally_code === e ? { ...o, last_used_at: (/* @__PURE__ */ new Date()).toISOString() } : o
330
330
  );
331
- localStorage.setItem(U, JSON.stringify(s));
332
- } catch (e) {
333
- 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);
334
334
  }
335
- }, pt = () => localStorage.getItem(H), ft = (t) => {
336
- t ? localStorage.setItem(H, t) : localStorage.removeItem(H);
337
- }, yt = () => {
338
- localStorage.removeItem(U), localStorage.removeItem(H);
339
- }, ie = he(void 0), vs = ({ children: t }) => {
340
- const [e, s] = $(null), [n, 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] = $({
341
341
  show: !1,
342
342
  localStorageCodes: []
343
- }), k = A(async () => {
344
- if (!ut()) {
345
- 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);
346
352
  return;
347
353
  }
348
354
  try {
349
- const o = await g.get("/api/v1/users/me");
350
- s(o);
351
- } catch (o) {
352
- 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();
353
359
  } finally {
354
- d(!1);
360
+ h(!1);
355
361
  }
356
362
  }, []);
357
- J(() => {
358
- k();
359
- }, [k]);
360
- const j = async (o) => {
363
+ U(() => {
364
+ W();
365
+ }, [W]);
366
+ const I = async (n) => {
361
367
  try {
362
- const a = await g.post("/api/v1/auth/login", o);
363
- ce(a.access_token, a.refresh_token);
364
- const m = await g.get("/api/v1/users/me");
365
- 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);
366
372
  } catch (a) {
367
373
  throw console.error("Login failed:", a), a;
368
374
  }
369
- }, L = async (o) => {
375
+ }, D = async (n) => {
370
376
  try {
371
- await g.post("/api/v1/auth/register", o);
377
+ await p.post("/api/v1/auth/register", n);
372
378
  } catch (a) {
373
379
  throw console.error("Registration failed:", a), a;
374
380
  }
375
- }, D = () => {
376
- Z(), s(null), l([]), c(null), y({ show: !1, localStorageCodes: [] });
377
- }, F = async () => {
378
- await k();
379
- }, 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) => {
380
386
  try {
381
- return (await g.post(
387
+ return (await p.post(
382
388
  "/api/v1/auth/forgot-password",
383
- o
389
+ n
384
390
  )).message;
385
391
  } catch (a) {
386
392
  throw console.error("Forgot password failed:", a), a;
387
393
  }
388
- }, G = async (o) => {
394
+ }, K = async (n) => {
389
395
  try {
390
- return (await g.post(
396
+ return (await p.post(
391
397
  "/api/v1/auth/reset-password",
392
- o
398
+ n
393
399
  )).message;
394
400
  } catch (a) {
395
401
  throw console.error("Reset password failed:", a), a;
396
402
  }
397
- }, K = async (o) => {
403
+ }, V = async (n) => {
398
404
  try {
399
- return (await g.post(
405
+ return (await p.post(
400
406
  "/api/v1/auth/resend-verification",
401
- o
407
+ n
402
408
  )).message;
403
409
  } catch (a) {
404
410
  throw console.error("Resend verification failed:", a), a;
405
411
  }
406
- }, E = A(async () => {
407
- f(!0);
412
+ }, d = S(async () => {
413
+ C(!0);
408
414
  try {
409
- if (e) {
410
- 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");
411
417
  l(a.ally_codes);
412
- const m = N();
413
- m.length > 0 && y({
418
+ const u = N();
419
+ u.length > 0 && k({
414
420
  show: !0,
415
- localStorageCodes: m.map((q) => q.ally_code)
421
+ localStorageCodes: u.map((q) => q.ally_code)
416
422
  });
417
423
  } else {
418
424
  const a = N();
419
425
  l(a);
420
426
  }
421
- const o = pt();
422
- c(o);
423
- } catch (o) {
424
- 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([]);
425
431
  } finally {
426
- f(!1);
432
+ C(!1);
427
433
  }
428
- }, [e]), _ = A(async (o) => {
434
+ }, [s]), y = S(async (n) => {
429
435
  var a;
430
- if (!/^\d{9}$/.test(o))
436
+ if (!/^\d{9}$/.test(n))
431
437
  throw new Error("Ally code must be exactly 9 digits");
432
- if (e) {
433
- const m = await g.post(
438
+ if (s) {
439
+ const u = await p.post(
434
440
  "/api/v1/users/me/ally-codes",
435
- { ally_code: o }
441
+ { ally_code: n }
436
442
  );
437
- l((q) => [m, ...q]), u.length === 0 && S(o);
443
+ l((q) => [u, ...q]), c.length === 0 && z(n);
438
444
  } else {
439
- const m = await g.get(`/api/v1/player-data/player/${o}`);
440
- if (!m)
445
+ const u = await p.get(`/api/v1/player-data/player/${n}`);
446
+ if (!u)
441
447
  throw new Error("Invalid ally code - player not found");
442
448
  const q = {
443
- ally_code: o,
444
- 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,
445
451
  last_used_at: (/* @__PURE__ */ new Date()).toISOString()
446
452
  };
447
- ht(q), l(N()), u.length === 0 && S(o);
453
+ pt(q), l(N()), c.length === 0 && z(n);
448
454
  }
449
- }, [e, u.length]), b = A(async (o) => {
450
- 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));
451
- }, [e, i]), S = A((o) => {
452
- if (c(o), ft(o), o && e) {
453
- const a = u.find((m) => "ally_code" in m && m.ally_code === o);
454
- a && "id" in a && se(a.id);
455
- } else o && !e && oe(o);
456
- }, [e, u]), se = A(async (o) => {
457
- 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()));
458
- }, [e, E]), V = A(() => {
459
- y({ show: !1, localStorageCodes: [] });
460
- }, []), de = A(async () => {
461
- if (!e) return;
462
- const o = N();
463
- 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)
464
470
  try {
465
- await _(a.ally_code);
466
- } catch (m) {
467
- 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);
468
474
  }
469
- yt(), V();
470
- }, [e, _, V]);
471
- J(() => {
472
- E();
473
- }, [E]);
474
- const _e = {
475
- user: e,
476
- isAuthenticated: !!e,
477
- isLoading: n,
478
- login: j,
479
- register: L,
480
- logout: D,
481
- refreshUser: F,
482
- forgotPassword: Y,
483
- resetPassword: G,
484
- 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,
485
491
  // Ally code values
486
- allyCodes: u,
492
+ allyCodes: c,
487
493
  selectedAllyCode: i,
488
- isLoadingAllyCodes: p,
489
- fetchAllyCodes: E,
490
- addAllyCode: _,
491
- removeAllyCode: b,
492
- selectAllyCode: S,
493
- updateAllyCodeLastUsed: se,
494
- migrationPrompt: I,
495
- dismissMigrationPrompt: V,
496
- 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
497
503
  };
498
- return /* @__PURE__ */ r(ie.Provider, { value: _e, children: t });
499
- }, vt = () => {
500
- const t = ge(ie);
501
- 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)
502
508
  throw new Error("useAuth must be used within an AuthProvider");
503
- return t;
504
- }, 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 = {
505
- allyCodeDropdown: $t,
506
- select: wt,
507
- manageButton: bt,
508
- managePanel: Nt,
509
- addSection: St,
510
- addInputGroup: At,
511
- error: xt,
512
- success: Tt,
513
- codesList: Ct,
514
- codeItem: kt,
515
- doneButton: Et
516
- }, ws = ({
517
- onAllyCodeSelected: t,
518
- 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 = ""
519
525
  }) => {
520
526
  const {
521
527
  allyCodes: s,
522
- selectedAllyCode: n,
523
- selectAllyCode: d,
524
- removeAllyCode: u,
525
- addAllyCode: l,
526
- isLoadingAllyCodes: i
527
- } = vt(), [c, p] = $(!1), [f, I] = $(""), [y, k] = $(""), [j, L] = $(""), [D, F] = $(!1), Y = s.map((_) => ({
528
- value: _.ally_code,
529
- label: _.player_name ? `${_.player_name} (${O(_.ally_code)})` : O(_.ally_code)
530
- })), G = (_) => {
531
- const b = _.target.value || null;
532
- d(b), t == null || t(b);
533
- }, K = async (_) => {
534
- const b = s.find((S) => S.ally_code === _);
535
- if (b) {
536
- const S = "id" in b ? b.id : b.ally_code;
537
- 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);
538
544
  }
539
- }, E = async () => {
540
- if (k(""), L(""), !/^\d{9}$/.test(f)) {
545
+ }, V = async () => {
546
+ if (k(""), I(""), !/^\d{9}$/.test(f)) {
541
547
  k("Ally code must be exactly 9 digits");
542
548
  return;
543
549
  }
544
550
  F(!0);
545
551
  try {
546
- await l(f), L("Added successfully!"), I(""), setTimeout(() => L(""), 2e3);
547
- } catch (_) {
548
- 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");
549
555
  } finally {
550
556
  F(!1);
551
557
  }
552
558
  };
553
- return s.length === 0 ? null : /* @__PURE__ */ h("div", { className: `${v.allyCodeDropdown} ${e}`, children: [
559
+ return s.length === 0 ? null : /* @__PURE__ */ m("div", { className: `${v.allyCodeDropdown} ${t}`, children: [
554
560
  /* @__PURE__ */ r(
555
- ae,
561
+ le,
556
562
  {
557
563
  options: Y,
558
- value: n || "",
564
+ value: o || "",
559
565
  onChange: G,
560
566
  placeholder: "Select ally code",
561
- disabled: i,
567
+ disabled: l,
562
568
  className: v.select
563
569
  }
564
570
  ),
565
- c && /* @__PURE__ */ h("div", { className: v.managePanel, children: [
571
+ i && /* @__PURE__ */ m("div", { className: v.managePanel, children: [
566
572
  /* @__PURE__ */ r("h4", { children: "Manage Ally Codes" }),
567
- /* @__PURE__ */ h("div", { className: v.addSection, children: [
568
- /* @__PURE__ */ h("div", { className: v.addInputGroup, children: [
573
+ /* @__PURE__ */ m("div", { className: v.addSection, children: [
574
+ /* @__PURE__ */ m("div", { className: v.addInputGroup, children: [
569
575
  /* @__PURE__ */ r(
570
- re,
576
+ ae,
571
577
  {
572
578
  type: "text",
573
579
  placeholder: "9-digit ally code",
574
580
  value: f,
575
- onChange: (_) => I(_.target.value.replace(/\D/g, "").slice(0, 9)),
581
+ onChange: (d) => C(d.target.value.replace(/\D/g, "").slice(0, 9)),
576
582
  disabled: D
577
583
  }
578
584
  ),
579
585
  /* @__PURE__ */ r(
580
- z,
586
+ O,
581
587
  {
582
588
  variant: "primary",
583
589
  size: "sm",
584
- onClick: E,
590
+ onClick: V,
585
591
  loading: D,
586
592
  disabled: f.length !== 9,
587
593
  children: "Add"
588
594
  }
589
595
  )
590
596
  ] }),
591
- y && /* @__PURE__ */ r("div", { className: v.error, children: y }),
592
- j && /* @__PURE__ */ r("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 })
593
599
  ] }),
594
- /* @__PURE__ */ r("div", { className: v.codesList, children: s.map((_) => /* @__PURE__ */ h("div", { className: v.codeItem, children: [
595
- /* @__PURE__ */ r("span", { children: _.player_name ? `${_.player_name} (${O(_.ally_code)})` : O(_.ally_code) }),
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) }),
596
602
  /* @__PURE__ */ r(
597
- z,
603
+ O,
598
604
  {
599
605
  variant: "ghost",
600
606
  size: "sm",
601
- onClick: () => K(_.ally_code),
607
+ onClick: () => K(d.ally_code),
602
608
  children: "Remove"
603
609
  }
604
610
  )
605
- ] }, _.ally_code)) }),
611
+ ] }, d.ally_code)) }),
606
612
  /* @__PURE__ */ r(
607
- z,
613
+ O,
608
614
  {
609
615
  variant: "secondary",
610
616
  size: "sm",
611
- onClick: () => p(!1),
617
+ onClick: () => g(!1),
612
618
  className: v.doneButton,
613
619
  children: "Done"
614
620
  }
615
621
  )
616
622
  ] }),
617
623
  /* @__PURE__ */ r(
618
- z,
624
+ O,
619
625
  {
620
626
  variant: "ghost",
621
627
  size: "sm",
622
- onClick: () => p(!c),
628
+ onClick: () => g(!i),
623
629
  className: v.manageButton,
624
630
  children: "Manage"
625
631
  }
626
632
  )
627
633
  ] });
628
- }, Wt = "_card_1n0ll_1", It = "_elevated_1n0ll_12", Lt = "_outline_1n0ll_17", qt = "_hoverable_1n0ll_40", M = {
629
- card: Wt,
634
+ }, Lt = "_card_1n0ll_1", qt = "_elevated_1n0ll_12", Rt = "_outline_1n0ll_17", Bt = "_hoverable_1n0ll_40", J = {
635
+ card: Lt,
630
636
  default: "_default_1n0ll_8",
631
- elevated: It,
632
- outline: Lt,
637
+ elevated: qt,
638
+ outline: Rt,
633
639
  "padding-none": "_padding-none_1n0ll_23",
634
640
  "padding-sm": "_padding-sm_1n0ll_27",
635
641
  "padding-md": "_padding-md_1n0ll_31",
636
642
  "padding-lg": "_padding-lg_1n0ll_35",
637
- hoverable: qt
638
- }, bs = ({
639
- children: t,
640
- variant: e = "default",
643
+ hoverable: Bt
644
+ }, Ns = ({
645
+ children: e,
646
+ variant: t = "default",
641
647
  chamfered: s = !1,
642
- chamferSize: n = "md",
643
- padding: d = "md",
644
- hoverable: u = !1,
645
- className: l = "",
646
- onClick: i
648
+ chamferSize: o = "md",
649
+ padding: _ = "md",
650
+ hoverable: h = !1,
651
+ className: c = "",
652
+ onClick: l
647
653
  }) => {
648
- const c = s ? n === "sm" ? "chamfered-box-sm" : n === "lg" ? "chamfered-box-lg" : "chamfered-box" : "";
654
+ const i = s ? o === "sm" ? "chamfered-box-sm" : o === "lg" ? "chamfered-box-lg" : "chamfered-box" : "";
649
655
  return /* @__PURE__ */ r(
650
656
  "div",
651
657
  {
652
- className: `${M.card} ${M[e]} ${M[`padding-${d}`]} ${c} ${u ? M.hoverable : ""} ${l}`,
653
- onClick: i,
654
- role: i ? "button" : void 0,
655
- tabIndex: i ? 0 : void 0,
656
- 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
657
663
  }
658
664
  );
659
- }, 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 = {
660
- badge: Rt,
661
- sm: Bt,
662
- md: Pt,
663
- 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,
664
670
  default: "_default_rk7t5_27",
665
- primary: jt,
666
- secondary: Dt,
667
- success: Ft,
668
- warning: zt,
669
- error: Ot,
670
- info: Mt
671
- }, Ns = ({
672
- children: t,
673
- variant: e = "default",
674
- size: s = "md",
675
- className: n = ""
676
- }) => /* @__PURE__ */ r("span", { className: `${X.badge} ${X[e]} ${X[s]} ${n}`, 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 = {
677
- overlay: Jt,
678
- fadeIn: Ht,
679
- modal: Yt,
680
- slideUp: Gt,
681
- sm: Kt,
682
- md: Vt,
683
- lg: Qt,
684
- xl: Xt,
685
- header: Zt,
686
- title: es,
687
- closeButton: ts,
688
- content: ss
671
+ primary: Ft,
672
+ secondary: zt,
673
+ success: Ot,
674
+ warning: Mt,
675
+ error: Jt,
676
+ info: Ht
689
677
  }, Ss = ({
690
- isOpen: t,
691
- 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,
692
698
  title: s,
693
- children: n,
694
- size: d = "md",
695
- closeOnOverlayClick: u = !0,
696
- className: l = ""
699
+ children: o,
700
+ size: _ = "md",
701
+ closeOnOverlayClick: h = !0,
702
+ className: c = ""
697
703
  }) => {
698
- 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", () => {
699
705
  document.body.style.overflow = "unset";
700
- }), [t]), J(() => {
701
- const c = (p) => {
702
- p.key === "Escape" && t && e();
706
+ }), [e]), U(() => {
707
+ const i = (g) => {
708
+ g.key === "Escape" && e && t();
703
709
  };
704
- return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
705
- }, [t, e]), !t) return null;
706
- const i = (c) => {
707
- 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();
708
714
  };
709
- return /* @__PURE__ */ r("div", { className: W.overlay, onClick: i, children: /* @__PURE__ */ h("div", { className: `${W.modal} ${W[d]} ${l}`, role: "dialog", "aria-modal": "true", children: [
710
- s && /* @__PURE__ */ h("div", { className: W.header, children: [
711
- /* @__PURE__ */ r("h2", { className: W.title, children: s }),
712
- /* @__PURE__ */ r("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: "✕" })
713
719
  ] }),
714
- /* @__PURE__ */ r("div", { className: W.content, children: n })
720
+ /* @__PURE__ */ r("div", { className: E.content, children: o })
715
721
  ] }) });
716
- }, 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 = {
717
- spinner: os,
718
- spin: ns,
719
- sm: rs,
720
- md: as,
721
- lg: ls,
722
- dots: cs,
723
- dot: is,
724
- bounce: ds,
725
- visuallyHidden: _s
726
- }, As = ({
727
- size: t = "md",
728
- 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",
729
735
  className: s = ""
730
- }) => e === "dots" ? /* @__PURE__ */ h("div", { className: `${C.dots} ${C[t]} ${s}`, children: [
731
- /* @__PURE__ */ r("span", { className: C.dot }),
732
- /* @__PURE__ */ r("span", { className: C.dot }),
733
- /* @__PURE__ */ r("span", { className: C.dot })
734
- ] }) : /* @__PURE__ */ r("div", { className: `${C.spinner} ${C[t]} ${s}`, role: "status", children: /* @__PURE__ */ r("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..." }) });
735
741
  export {
736
- ws as AllyCodeDropdown,
737
- mt as ApiClient,
738
- vs as AuthProvider,
739
- Ns as Badge,
740
- z as Button,
741
- bs as Card,
742
- gs as Container,
743
- fs as Footer,
744
- re as Input,
745
- As as Loader,
746
- Ss as Modal,
747
- ae as Select,
748
- ps as TopBar,
749
- g as apiClient,
750
- yt as clearAllyCodes,
751
- Z as clearTokens,
752
- O as formatAllyCode,
753
- 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,
754
760
  N as getAllyCodesFromStorage,
755
- it as getRefreshToken,
756
- pt as getSelectedAllyCode,
757
- ys as initializeApiClient,
758
- ut as isAuthenticated,
759
- ct as removeAccessToken,
760
- gt as removeAllyCodeFromStorage,
761
- _t as removeRefreshToken,
762
- ht as saveAllyCodeToStorage,
763
- lt as setAccessToken,
764
- dt as setRefreshToken,
765
- ft as setSelectedAllyCode,
766
- ce as setTokens,
767
- $s as unformatAllyCode,
768
- oe as updateAllyCodeLastUsed,
769
- 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
770
776
  };