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