alex-evo-sh-auth 0.0.11 → 0.0.12
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.
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Outlet as
|
|
3
|
-
async function
|
|
4
|
-
const
|
|
1
|
+
import De, { createContext as Rr, useState as Q, useMemo as Sr, useCallback as Z, useEffect as re, useContext as $e } from "react";
|
|
2
|
+
import { Outlet as Ue } from "react-router-dom";
|
|
3
|
+
async function wr(n) {
|
|
4
|
+
const a = await fetch(`${n.authServer}/refresh`, {
|
|
5
5
|
method: "POST",
|
|
6
6
|
headers: {
|
|
7
7
|
"Content-Type": "application/json"
|
|
8
8
|
},
|
|
9
9
|
body: JSON.stringify({
|
|
10
10
|
grant_type: "refresh_token",
|
|
11
|
-
client_id:
|
|
11
|
+
client_id: n.clientId
|
|
12
12
|
})
|
|
13
13
|
});
|
|
14
|
-
if (
|
|
15
|
-
return localStorage.removeItem(
|
|
16
|
-
const
|
|
17
|
-
return localStorage.setItem(
|
|
14
|
+
if (a.status === 401)
|
|
15
|
+
return localStorage.removeItem(n.baseKey + "_access"), null;
|
|
16
|
+
const c = await a.json();
|
|
17
|
+
return localStorage.setItem(n.baseKey + "_access", c.access), c.access;
|
|
18
18
|
}
|
|
19
|
-
class
|
|
20
|
-
constructor(
|
|
21
|
-
this.onAuthFail =
|
|
19
|
+
class Tr {
|
|
20
|
+
constructor(a, c) {
|
|
21
|
+
this.onAuthFail = c, this.config = a;
|
|
22
22
|
}
|
|
23
23
|
refreshPromise = null;
|
|
24
24
|
config;
|
|
25
25
|
getToken() {
|
|
26
26
|
return localStorage.getItem(this.config.baseKey + "_access");
|
|
27
27
|
}
|
|
28
|
-
setToken(
|
|
29
|
-
|
|
28
|
+
setToken(a) {
|
|
29
|
+
a ? localStorage.setItem(this.config.baseKey + "_access", a) : localStorage.removeItem(this.config.baseKey + "_access");
|
|
30
30
|
}
|
|
31
31
|
async getValidToken() {
|
|
32
|
-
let
|
|
33
|
-
return
|
|
32
|
+
let a = this.getToken();
|
|
33
|
+
return a || (this.refreshPromise || (this.refreshPromise = wr(this.config).then((c) => (this.setToken(c), c)).finally(() => {
|
|
34
34
|
this.refreshPromise = null;
|
|
35
|
-
})),
|
|
35
|
+
})), a = await this.refreshPromise, !a && this.onAuthFail && this.onAuthFail(), a);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class Dr {
|
|
39
39
|
authServer;
|
|
40
40
|
clientId;
|
|
41
41
|
redirectUri;
|
|
42
42
|
homePage;
|
|
43
43
|
baseKey;
|
|
44
|
-
constructor(
|
|
45
|
-
this.authServer =
|
|
44
|
+
constructor(a, c, u, d, p) {
|
|
45
|
+
this.authServer = a, this.clientId = c, this.redirectUri = u, this.homePage = d, this.baseKey = p;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
...
|
|
48
|
+
async function We(n, a, c = {}) {
|
|
49
|
+
let u = n.getToken();
|
|
50
|
+
const d = (h) => fetch(a, {
|
|
51
|
+
...c,
|
|
52
52
|
headers: {
|
|
53
|
-
...
|
|
54
|
-
Authorization:
|
|
53
|
+
...c.headers,
|
|
54
|
+
Authorization: h ? `Bearer ${h}` : ""
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
let
|
|
58
|
-
return
|
|
57
|
+
let p = await d(u);
|
|
58
|
+
return p.status !== 401 || (n.setToken(null), u = await n.getValidToken(), !u) ? p : d(u);
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
if (!
|
|
60
|
+
async function je(n) {
|
|
61
|
+
const a = new URLSearchParams(window.location.search), c = a.get("code"), u = sessionStorage.getItem("oauth_state"), d = a.get("state");
|
|
62
|
+
if (!c) return;
|
|
63
|
+
if (!d || d !== u)
|
|
64
64
|
throw new Error("Invalid OAuth state");
|
|
65
|
-
const
|
|
65
|
+
const p = sessionStorage.getItem("pkce_verifier"), R = await (await fetch(`${n.config.authServer}/token`, {
|
|
66
66
|
method: "POST",
|
|
67
67
|
headers: {
|
|
68
68
|
"Content-Type": "application/json"
|
|
69
69
|
},
|
|
70
70
|
body: JSON.stringify({
|
|
71
|
-
client_id:
|
|
72
|
-
code:
|
|
73
|
-
code_verifier:
|
|
71
|
+
client_id: n.config.clientId,
|
|
72
|
+
code: c,
|
|
73
|
+
code_verifier: p
|
|
74
74
|
})
|
|
75
75
|
})).json();
|
|
76
|
-
localStorage.setItem(
|
|
76
|
+
localStorage.setItem(n.config.baseKey + "_access", R.access), window.history.replaceState({}, document.title, n.config.homePage), window.location.href = n.config.homePage;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
const
|
|
82
|
-
crypto.getRandomValues(
|
|
83
|
-
for (let
|
|
84
|
-
|
|
85
|
-
return
|
|
78
|
+
function Pr(n = 64) {
|
|
79
|
+
const a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
80
|
+
let c = "";
|
|
81
|
+
const u = new Uint8Array(n);
|
|
82
|
+
crypto.getRandomValues(u);
|
|
83
|
+
for (let d = 0; d < u.length; d++)
|
|
84
|
+
c += a[u[d] % a.length];
|
|
85
|
+
return c;
|
|
86
86
|
}
|
|
87
|
-
async function
|
|
88
|
-
const
|
|
89
|
-
return new Uint8Array(
|
|
87
|
+
async function Or(n) {
|
|
88
|
+
const c = new TextEncoder().encode(n), u = await crypto.subtle.digest("SHA-256", c);
|
|
89
|
+
return new Uint8Array(u);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return btoa(String.fromCharCode(...Array.from(
|
|
91
|
+
function Cr(n) {
|
|
92
|
+
return btoa(String.fromCharCode(...Array.from(n))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
95
|
-
const
|
|
96
|
-
sessionStorage.setItem("pkce_verifier",
|
|
97
|
-
const
|
|
98
|
-
sessionStorage.setItem("oauth_state",
|
|
99
|
-
const
|
|
94
|
+
async function ee(n) {
|
|
95
|
+
const a = Pr(64), c = Cr(await Or(a));
|
|
96
|
+
sessionStorage.setItem("pkce_verifier", a);
|
|
97
|
+
const u = crypto.randomUUID();
|
|
98
|
+
sessionStorage.setItem("oauth_state", u);
|
|
99
|
+
const d = new URLSearchParams({
|
|
100
100
|
response_type: "code",
|
|
101
|
-
client_id:
|
|
102
|
-
redirect_uri:
|
|
103
|
-
code_challenge:
|
|
101
|
+
client_id: n.config.clientId,
|
|
102
|
+
redirect_uri: n.config.redirectUri,
|
|
103
|
+
code_challenge: c,
|
|
104
104
|
code_challenge_method: "S256",
|
|
105
|
-
state:
|
|
105
|
+
state: u
|
|
106
106
|
});
|
|
107
|
-
window.location.href = `${
|
|
107
|
+
window.location.href = `${n.config.authServer}/authorize?${d}`;
|
|
108
108
|
}
|
|
109
|
-
async function
|
|
109
|
+
async function xe(n) {
|
|
110
110
|
try {
|
|
111
|
-
await
|
|
111
|
+
await We(n, `${n.config.authServer}/logout`, {
|
|
112
112
|
method: "POST",
|
|
113
113
|
headers: {
|
|
114
114
|
"Content-Type": "application/json"
|
|
115
115
|
},
|
|
116
116
|
body: JSON.stringify({
|
|
117
|
-
client_id:
|
|
117
|
+
client_id: n.config.clientId
|
|
118
118
|
})
|
|
119
|
-
}), localStorage.removeItem(
|
|
120
|
-
} catch (
|
|
121
|
-
console.error(
|
|
119
|
+
}), localStorage.removeItem(n.config.baseKey + "_access"), await ee(n);
|
|
120
|
+
} catch (a) {
|
|
121
|
+
console.error(a);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const te = Rr({
|
|
125
125
|
login: () => {
|
|
126
126
|
},
|
|
127
127
|
logout: () => {
|
|
@@ -132,339 +132,690 @@ const $ = de({
|
|
|
132
132
|
user: null,
|
|
133
133
|
loading: !1
|
|
134
134
|
});
|
|
135
|
-
var
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} else c = s;
|
|
148
|
-
return s = c.ref, {
|
|
149
|
-
$$typeof: r,
|
|
150
|
-
type: a,
|
|
151
|
-
key: l,
|
|
152
|
-
ref: s !== void 0 ? s : null,
|
|
153
|
-
props: c
|
|
154
|
-
};
|
|
135
|
+
var N = { exports: {} }, U = {};
|
|
136
|
+
var Ae;
|
|
137
|
+
function kr() {
|
|
138
|
+
if (Ae) return U;
|
|
139
|
+
Ae = 1;
|
|
140
|
+
var n = De, a = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, d = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
141
|
+
function h(R, y, P) {
|
|
142
|
+
var m, S = {}, w = null, j = null;
|
|
143
|
+
P !== void 0 && (w = "" + P), y.key !== void 0 && (w = "" + y.key), y.ref !== void 0 && (j = y.ref);
|
|
144
|
+
for (m in y) u.call(y, m) && !p.hasOwnProperty(m) && (S[m] = y[m]);
|
|
145
|
+
if (R && R.defaultProps) for (m in y = R.defaultProps, y) S[m] === void 0 && (S[m] = y[m]);
|
|
146
|
+
return { $$typeof: a, type: R, key: w, ref: j, props: S, _owner: d.current };
|
|
155
147
|
}
|
|
156
|
-
return
|
|
148
|
+
return U.Fragment = c, U.jsx = h, U.jsxs = h, U;
|
|
157
149
|
}
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
function
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (typeof e
|
|
165
|
-
return
|
|
166
|
-
|
|
150
|
+
var W = {};
|
|
151
|
+
var Ie;
|
|
152
|
+
function jr() {
|
|
153
|
+
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
154
|
+
var n = De, a = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), d = /* @__PURE__ */ Symbol.for("react.strict_mode"), p = /* @__PURE__ */ Symbol.for("react.profiler"), h = /* @__PURE__ */ Symbol.for("react.provider"), R = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), P = /* @__PURE__ */ Symbol.for("react.suspense"), m = /* @__PURE__ */ Symbol.for("react.suspense_list"), S = /* @__PURE__ */ Symbol.for("react.memo"), w = /* @__PURE__ */ Symbol.for("react.lazy"), j = /* @__PURE__ */ Symbol.for("react.offscreen"), ae = Symbol.iterator, Ye = "@@iterator";
|
|
155
|
+
function Le(e) {
|
|
156
|
+
if (e === null || typeof e != "object")
|
|
157
|
+
return null;
|
|
158
|
+
var r = ae && e[ae] || e[Ye];
|
|
159
|
+
return typeof r == "function" ? r : null;
|
|
160
|
+
}
|
|
161
|
+
var x = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
162
|
+
function _(e) {
|
|
163
|
+
{
|
|
164
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
|
|
165
|
+
t[o - 1] = arguments[o];
|
|
166
|
+
Ve("error", e, t);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function Ve(e, r, t) {
|
|
170
|
+
{
|
|
171
|
+
var o = x.ReactDebugCurrentFrame, l = o.getStackAddendum();
|
|
172
|
+
l !== "" && (r += "%s", t = t.concat([l]));
|
|
173
|
+
var f = t.map(function(s) {
|
|
174
|
+
return String(s);
|
|
175
|
+
});
|
|
176
|
+
f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
var Ke = !1, Ne = !1, Je = !1, Me = !1, Be = !1, oe;
|
|
180
|
+
oe = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
181
|
+
function qe(e) {
|
|
182
|
+
return !!(typeof e == "string" || typeof e == "function" || e === u || e === p || Be || e === d || e === P || e === m || Me || e === j || Ke || Ne || Je || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === S || e.$$typeof === h || e.$$typeof === R || e.$$typeof === y || // This needs to include all possible module reference object
|
|
183
|
+
// types supported by any Flight configuration anywhere since
|
|
184
|
+
// we don't know which Flight build this will end up being used
|
|
185
|
+
// with.
|
|
186
|
+
e.$$typeof === oe || e.getModuleId !== void 0));
|
|
187
|
+
}
|
|
188
|
+
function ze(e, r, t) {
|
|
189
|
+
var o = e.displayName;
|
|
190
|
+
if (o)
|
|
191
|
+
return o;
|
|
192
|
+
var l = r.displayName || r.name || "";
|
|
193
|
+
return l !== "" ? t + "(" + l + ")" : t;
|
|
194
|
+
}
|
|
195
|
+
function ie(e) {
|
|
196
|
+
return e.displayName || "Context";
|
|
197
|
+
}
|
|
198
|
+
function O(e) {
|
|
199
|
+
if (e == null)
|
|
200
|
+
return null;
|
|
201
|
+
if (typeof e.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
202
|
+
return e.displayName || e.name || null;
|
|
203
|
+
if (typeof e == "string")
|
|
204
|
+
return e;
|
|
167
205
|
switch (e) {
|
|
168
|
-
case
|
|
206
|
+
case u:
|
|
169
207
|
return "Fragment";
|
|
170
|
-
case
|
|
208
|
+
case c:
|
|
209
|
+
return "Portal";
|
|
210
|
+
case p:
|
|
171
211
|
return "Profiler";
|
|
172
|
-
case
|
|
212
|
+
case d:
|
|
173
213
|
return "StrictMode";
|
|
174
|
-
case
|
|
214
|
+
case P:
|
|
175
215
|
return "Suspense";
|
|
176
|
-
case
|
|
216
|
+
case m:
|
|
177
217
|
return "SuspenseList";
|
|
178
|
-
case ce:
|
|
179
|
-
return "Activity";
|
|
180
218
|
}
|
|
181
219
|
if (typeof e == "object")
|
|
182
|
-
switch (typeof
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
189
|
-
case
|
|
190
|
-
return (e.
|
|
191
|
-
case
|
|
192
|
-
var
|
|
193
|
-
return
|
|
194
|
-
case
|
|
195
|
-
|
|
196
|
-
case k:
|
|
197
|
-
n = e._payload, e = e._init;
|
|
220
|
+
switch (e.$$typeof) {
|
|
221
|
+
case R:
|
|
222
|
+
var r = e;
|
|
223
|
+
return ie(r) + ".Consumer";
|
|
224
|
+
case h:
|
|
225
|
+
var t = e;
|
|
226
|
+
return ie(t._context) + ".Provider";
|
|
227
|
+
case y:
|
|
228
|
+
return ze(e, e.render, "ForwardRef");
|
|
229
|
+
case S:
|
|
230
|
+
var o = e.displayName || null;
|
|
231
|
+
return o !== null ? o : O(e.type) || "Memo";
|
|
232
|
+
case w: {
|
|
233
|
+
var l = e, f = l._payload, s = l._init;
|
|
198
234
|
try {
|
|
199
|
-
return
|
|
235
|
+
return O(s(f));
|
|
200
236
|
} catch {
|
|
237
|
+
return null;
|
|
201
238
|
}
|
|
239
|
+
}
|
|
202
240
|
}
|
|
203
241
|
return null;
|
|
204
242
|
}
|
|
205
|
-
|
|
206
|
-
|
|
243
|
+
var C = Object.assign, D = 0, se, ue, ce, le, fe, de, ve;
|
|
244
|
+
function ge() {
|
|
207
245
|
}
|
|
208
|
-
|
|
246
|
+
ge.__reactDisabledLog = !0;
|
|
247
|
+
function Ge() {
|
|
248
|
+
{
|
|
249
|
+
if (D === 0) {
|
|
250
|
+
se = console.log, ue = console.info, ce = console.warn, le = console.error, fe = console.group, de = console.groupCollapsed, ve = console.groupEnd;
|
|
251
|
+
var e = {
|
|
252
|
+
configurable: !0,
|
|
253
|
+
enumerable: !0,
|
|
254
|
+
value: ge,
|
|
255
|
+
writable: !0
|
|
256
|
+
};
|
|
257
|
+
Object.defineProperties(console, {
|
|
258
|
+
info: e,
|
|
259
|
+
log: e,
|
|
260
|
+
warn: e,
|
|
261
|
+
error: e,
|
|
262
|
+
group: e,
|
|
263
|
+
groupCollapsed: e,
|
|
264
|
+
groupEnd: e
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
D++;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function He() {
|
|
271
|
+
{
|
|
272
|
+
if (D--, D === 0) {
|
|
273
|
+
var e = {
|
|
274
|
+
configurable: !0,
|
|
275
|
+
enumerable: !0,
|
|
276
|
+
writable: !0
|
|
277
|
+
};
|
|
278
|
+
Object.defineProperties(console, {
|
|
279
|
+
log: C({}, e, {
|
|
280
|
+
value: se
|
|
281
|
+
}),
|
|
282
|
+
info: C({}, e, {
|
|
283
|
+
value: ue
|
|
284
|
+
}),
|
|
285
|
+
warn: C({}, e, {
|
|
286
|
+
value: ce
|
|
287
|
+
}),
|
|
288
|
+
error: C({}, e, {
|
|
289
|
+
value: le
|
|
290
|
+
}),
|
|
291
|
+
group: C({}, e, {
|
|
292
|
+
value: fe
|
|
293
|
+
}),
|
|
294
|
+
groupCollapsed: C({}, e, {
|
|
295
|
+
value: de
|
|
296
|
+
}),
|
|
297
|
+
groupEnd: C({}, e, {
|
|
298
|
+
value: ve
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
D < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
var J = x.ReactCurrentDispatcher, M;
|
|
306
|
+
function Y(e, r, t) {
|
|
307
|
+
{
|
|
308
|
+
if (M === void 0)
|
|
309
|
+
try {
|
|
310
|
+
throw Error();
|
|
311
|
+
} catch (l) {
|
|
312
|
+
var o = l.stack.trim().match(/\n( *(at )?)/);
|
|
313
|
+
M = o && o[1] || "";
|
|
314
|
+
}
|
|
315
|
+
return `
|
|
316
|
+
` + M + e;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
var B = !1, L;
|
|
320
|
+
{
|
|
321
|
+
var Xe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
322
|
+
L = new Xe();
|
|
323
|
+
}
|
|
324
|
+
function he(e, r) {
|
|
325
|
+
if (!e || B)
|
|
326
|
+
return "";
|
|
327
|
+
{
|
|
328
|
+
var t = L.get(e);
|
|
329
|
+
if (t !== void 0)
|
|
330
|
+
return t;
|
|
331
|
+
}
|
|
332
|
+
var o;
|
|
333
|
+
B = !0;
|
|
334
|
+
var l = Error.prepareStackTrace;
|
|
335
|
+
Error.prepareStackTrace = void 0;
|
|
336
|
+
var f;
|
|
337
|
+
f = J.current, J.current = null, Ge();
|
|
209
338
|
try {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
339
|
+
if (r) {
|
|
340
|
+
var s = function() {
|
|
341
|
+
throw Error();
|
|
342
|
+
};
|
|
343
|
+
if (Object.defineProperty(s.prototype, "props", {
|
|
344
|
+
set: function() {
|
|
345
|
+
throw Error();
|
|
346
|
+
}
|
|
347
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
348
|
+
try {
|
|
349
|
+
Reflect.construct(s, []);
|
|
350
|
+
} catch (E) {
|
|
351
|
+
o = E;
|
|
352
|
+
}
|
|
353
|
+
Reflect.construct(e, [], s);
|
|
354
|
+
} else {
|
|
355
|
+
try {
|
|
356
|
+
s.call();
|
|
357
|
+
} catch (E) {
|
|
358
|
+
o = E;
|
|
359
|
+
}
|
|
360
|
+
e.call(s.prototype);
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
try {
|
|
364
|
+
throw Error();
|
|
365
|
+
} catch (E) {
|
|
366
|
+
o = E;
|
|
367
|
+
}
|
|
368
|
+
e();
|
|
369
|
+
}
|
|
370
|
+
} catch (E) {
|
|
371
|
+
if (E && o && typeof E.stack == "string") {
|
|
372
|
+
for (var i = E.stack.split(`
|
|
373
|
+
`), b = o.stack.split(`
|
|
374
|
+
`), v = i.length - 1, g = b.length - 1; v >= 1 && g >= 0 && i[v] !== b[g]; )
|
|
375
|
+
g--;
|
|
376
|
+
for (; v >= 1 && g >= 0; v--, g--)
|
|
377
|
+
if (i[v] !== b[g]) {
|
|
378
|
+
if (v !== 1 || g !== 1)
|
|
379
|
+
do
|
|
380
|
+
if (v--, g--, g < 0 || i[v] !== b[g]) {
|
|
381
|
+
var T = `
|
|
382
|
+
` + i[v].replace(" at new ", " at ");
|
|
383
|
+
return e.displayName && T.includes("<anonymous>") && (T = T.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, T), T;
|
|
384
|
+
}
|
|
385
|
+
while (v >= 1 && g >= 0);
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
} finally {
|
|
390
|
+
B = !1, J.current = f, He(), Error.prepareStackTrace = l;
|
|
214
391
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
392
|
+
var I = e ? e.displayName || e.name : "", k = I ? Y(I) : "";
|
|
393
|
+
return typeof e == "function" && L.set(e, k), k;
|
|
394
|
+
}
|
|
395
|
+
function Ze(e, r, t) {
|
|
396
|
+
return he(e, !1);
|
|
397
|
+
}
|
|
398
|
+
function Qe(e) {
|
|
399
|
+
var r = e.prototype;
|
|
400
|
+
return !!(r && r.isReactComponent);
|
|
401
|
+
}
|
|
402
|
+
function V(e, r, t) {
|
|
403
|
+
if (e == null)
|
|
404
|
+
return "";
|
|
405
|
+
if (typeof e == "function")
|
|
406
|
+
return he(e, Qe(e));
|
|
407
|
+
if (typeof e == "string")
|
|
408
|
+
return Y(e);
|
|
409
|
+
switch (e) {
|
|
410
|
+
case P:
|
|
411
|
+
return Y("Suspense");
|
|
412
|
+
case m:
|
|
413
|
+
return Y("SuspenseList");
|
|
223
414
|
}
|
|
415
|
+
if (typeof e == "object")
|
|
416
|
+
switch (e.$$typeof) {
|
|
417
|
+
case y:
|
|
418
|
+
return Ze(e.render);
|
|
419
|
+
case S:
|
|
420
|
+
return V(e.type, r, t);
|
|
421
|
+
case w: {
|
|
422
|
+
var o = e, l = o._payload, f = o._init;
|
|
423
|
+
try {
|
|
424
|
+
return V(f(l), r, t);
|
|
425
|
+
} catch {
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return "";
|
|
430
|
+
}
|
|
431
|
+
var $ = Object.prototype.hasOwnProperty, pe = {}, ye = x.ReactDebugCurrentFrame;
|
|
432
|
+
function K(e) {
|
|
433
|
+
if (e) {
|
|
434
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
435
|
+
ye.setExtraStackFrame(t);
|
|
436
|
+
} else
|
|
437
|
+
ye.setExtraStackFrame(null);
|
|
438
|
+
}
|
|
439
|
+
function er(e, r, t, o, l) {
|
|
440
|
+
{
|
|
441
|
+
var f = Function.call.bind($);
|
|
442
|
+
for (var s in e)
|
|
443
|
+
if (f(e, s)) {
|
|
444
|
+
var i = void 0;
|
|
445
|
+
try {
|
|
446
|
+
if (typeof e[s] != "function") {
|
|
447
|
+
var b = Error((o || "React class") + ": " + t + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
448
|
+
throw b.name = "Invariant Violation", b;
|
|
449
|
+
}
|
|
450
|
+
i = e[s](r, s, o, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
451
|
+
} catch (v) {
|
|
452
|
+
i = v;
|
|
453
|
+
}
|
|
454
|
+
i && !(i instanceof Error) && (K(l), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", t, s, typeof i), K(null)), i instanceof Error && !(i.message in pe) && (pe[i.message] = !0, K(l), _("Failed %s type: %s", t, i.message), K(null));
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
var rr = Array.isArray;
|
|
459
|
+
function q(e) {
|
|
460
|
+
return rr(e);
|
|
224
461
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
462
|
+
function tr(e) {
|
|
463
|
+
{
|
|
464
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
465
|
+
return t;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function nr(e) {
|
|
229
469
|
try {
|
|
230
|
-
|
|
231
|
-
return n ? "<" + n + ">" : "<...>";
|
|
470
|
+
return me(e), !1;
|
|
232
471
|
} catch {
|
|
233
|
-
return
|
|
472
|
+
return !0;
|
|
234
473
|
}
|
|
235
474
|
}
|
|
236
|
-
function
|
|
237
|
-
|
|
238
|
-
|
|
475
|
+
function me(e) {
|
|
476
|
+
return "" + e;
|
|
477
|
+
}
|
|
478
|
+
function _e(e) {
|
|
479
|
+
if (nr(e))
|
|
480
|
+
return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tr(e)), me(e);
|
|
239
481
|
}
|
|
240
|
-
|
|
241
|
-
|
|
482
|
+
var be = x.ReactCurrentOwner, ar = {
|
|
483
|
+
key: !0,
|
|
484
|
+
ref: !0,
|
|
485
|
+
__self: !0,
|
|
486
|
+
__source: !0
|
|
487
|
+
}, Ee, Re;
|
|
488
|
+
function or(e) {
|
|
489
|
+
if ($.call(e, "ref")) {
|
|
490
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
491
|
+
if (r && r.isReactWarning)
|
|
492
|
+
return !1;
|
|
493
|
+
}
|
|
494
|
+
return e.ref !== void 0;
|
|
242
495
|
}
|
|
243
|
-
function
|
|
244
|
-
if (
|
|
245
|
-
var
|
|
246
|
-
if (
|
|
496
|
+
function ir(e) {
|
|
497
|
+
if ($.call(e, "key")) {
|
|
498
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
499
|
+
if (r && r.isReactWarning)
|
|
500
|
+
return !1;
|
|
247
501
|
}
|
|
248
502
|
return e.key !== void 0;
|
|
249
503
|
}
|
|
250
|
-
function
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
504
|
+
function sr(e, r) {
|
|
505
|
+
typeof e.ref == "string" && be.current;
|
|
506
|
+
}
|
|
507
|
+
function ur(e, r) {
|
|
508
|
+
{
|
|
509
|
+
var t = function() {
|
|
510
|
+
Ee || (Ee = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
511
|
+
};
|
|
512
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
513
|
+
get: t,
|
|
514
|
+
configurable: !0
|
|
515
|
+
});
|
|
256
516
|
}
|
|
257
|
-
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
258
|
-
get: i,
|
|
259
|
-
configurable: !0
|
|
260
|
-
});
|
|
261
517
|
}
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
518
|
+
function cr(e, r) {
|
|
519
|
+
{
|
|
520
|
+
var t = function() {
|
|
521
|
+
Re || (Re = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
522
|
+
};
|
|
523
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
524
|
+
get: t,
|
|
525
|
+
configurable: !0
|
|
526
|
+
});
|
|
527
|
+
}
|
|
267
528
|
}
|
|
268
|
-
function
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
$$typeof:
|
|
529
|
+
var lr = function(e, r, t, o, l, f, s) {
|
|
530
|
+
var i = {
|
|
531
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
532
|
+
$$typeof: a,
|
|
533
|
+
// Built-in properties that belong on the element
|
|
272
534
|
type: e,
|
|
273
|
-
key:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
configurable: !1,
|
|
281
|
-
enumerable: !1,
|
|
282
|
-
writable: !0,
|
|
283
|
-
value: 0
|
|
284
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
535
|
+
key: r,
|
|
536
|
+
ref: t,
|
|
537
|
+
props: s,
|
|
538
|
+
// Record the component responsible for creating this element.
|
|
539
|
+
_owner: f
|
|
540
|
+
};
|
|
541
|
+
return i._store = {}, Object.defineProperty(i._store, "validated", {
|
|
285
542
|
configurable: !1,
|
|
286
543
|
enumerable: !1,
|
|
287
544
|
writable: !0,
|
|
288
|
-
value:
|
|
289
|
-
}), Object.defineProperty(
|
|
545
|
+
value: !1
|
|
546
|
+
}), Object.defineProperty(i, "_self", {
|
|
290
547
|
configurable: !1,
|
|
291
548
|
enumerable: !1,
|
|
292
|
-
writable: !
|
|
293
|
-
value:
|
|
294
|
-
}), Object.defineProperty(
|
|
549
|
+
writable: !1,
|
|
550
|
+
value: o
|
|
551
|
+
}), Object.defineProperty(i, "_source", {
|
|
295
552
|
configurable: !1,
|
|
296
553
|
enumerable: !1,
|
|
297
|
-
writable: !
|
|
298
|
-
value:
|
|
299
|
-
}), Object.freeze && (Object.freeze(
|
|
300
|
-
}
|
|
301
|
-
function
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
554
|
+
writable: !1,
|
|
555
|
+
value: l
|
|
556
|
+
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
557
|
+
};
|
|
558
|
+
function fr(e, r, t, o, l) {
|
|
559
|
+
{
|
|
560
|
+
var f, s = {}, i = null, b = null;
|
|
561
|
+
t !== void 0 && (_e(t), i = "" + t), ir(r) && (_e(r.key), i = "" + r.key), or(r) && (b = r.ref, sr(r, l));
|
|
562
|
+
for (f in r)
|
|
563
|
+
$.call(r, f) && !ar.hasOwnProperty(f) && (s[f] = r[f]);
|
|
564
|
+
if (e && e.defaultProps) {
|
|
565
|
+
var v = e.defaultProps;
|
|
566
|
+
for (f in v)
|
|
567
|
+
s[f] === void 0 && (s[f] = v[f]);
|
|
568
|
+
}
|
|
569
|
+
if (i || b) {
|
|
570
|
+
var g = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
571
|
+
i && ur(s, g), b && cr(s, g);
|
|
572
|
+
}
|
|
573
|
+
return lr(e, i, b, l, o, be.current, s);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
var z = x.ReactCurrentOwner, Se = x.ReactDebugCurrentFrame;
|
|
577
|
+
function A(e) {
|
|
578
|
+
if (e) {
|
|
579
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
580
|
+
Se.setExtraStackFrame(t);
|
|
581
|
+
} else
|
|
582
|
+
Se.setExtraStackFrame(null);
|
|
583
|
+
}
|
|
584
|
+
var G;
|
|
585
|
+
G = !1;
|
|
586
|
+
function H(e) {
|
|
587
|
+
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
588
|
+
}
|
|
589
|
+
function we() {
|
|
590
|
+
{
|
|
591
|
+
if (z.current) {
|
|
592
|
+
var e = O(z.current.type);
|
|
593
|
+
if (e)
|
|
594
|
+
return `
|
|
595
|
+
|
|
596
|
+
Check the render method of \`` + e + "`.";
|
|
597
|
+
}
|
|
598
|
+
return "";
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function dr(e) {
|
|
602
|
+
return "";
|
|
603
|
+
}
|
|
604
|
+
var Te = {};
|
|
605
|
+
function vr(e) {
|
|
606
|
+
{
|
|
607
|
+
var r = we();
|
|
608
|
+
if (!r) {
|
|
609
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
610
|
+
t && (r = `
|
|
611
|
+
|
|
612
|
+
Check the top-level render call using <` + t + ">.");
|
|
613
|
+
}
|
|
614
|
+
return r;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function Pe(e, r) {
|
|
618
|
+
{
|
|
619
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
620
|
+
return;
|
|
621
|
+
e._store.validated = !0;
|
|
622
|
+
var t = vr(r);
|
|
623
|
+
if (Te[t])
|
|
624
|
+
return;
|
|
625
|
+
Te[t] = !0;
|
|
626
|
+
var o = "";
|
|
627
|
+
e && e._owner && e._owner !== z.current && (o = " It was passed a child from " + O(e._owner.type) + "."), A(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, o), A(null);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
function Oe(e, r) {
|
|
631
|
+
{
|
|
632
|
+
if (typeof e != "object")
|
|
633
|
+
return;
|
|
634
|
+
if (q(e))
|
|
635
|
+
for (var t = 0; t < e.length; t++) {
|
|
636
|
+
var o = e[t];
|
|
637
|
+
H(o) && Pe(o, r);
|
|
638
|
+
}
|
|
639
|
+
else if (H(e))
|
|
640
|
+
e._store && (e._store.validated = !0);
|
|
641
|
+
else if (e) {
|
|
642
|
+
var l = Le(e);
|
|
643
|
+
if (typeof l == "function" && l !== e.entries)
|
|
644
|
+
for (var f = l.call(e), s; !(s = f.next()).done; )
|
|
645
|
+
H(s.value) && Pe(s.value, r);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
function gr(e) {
|
|
650
|
+
{
|
|
651
|
+
var r = e.type;
|
|
652
|
+
if (r == null || typeof r == "string")
|
|
653
|
+
return;
|
|
654
|
+
var t;
|
|
655
|
+
if (typeof r == "function")
|
|
656
|
+
t = r.propTypes;
|
|
657
|
+
else if (typeof r == "object" && (r.$$typeof === y || // Note: Memo only checks outer props here.
|
|
658
|
+
// Inner props are checked in the reconciler.
|
|
659
|
+
r.$$typeof === S))
|
|
660
|
+
t = r.propTypes;
|
|
661
|
+
else
|
|
662
|
+
return;
|
|
663
|
+
if (t) {
|
|
664
|
+
var o = O(r);
|
|
665
|
+
er(t, e.props, "prop", o, e);
|
|
666
|
+
} else if (r.PropTypes !== void 0 && !G) {
|
|
667
|
+
G = !0;
|
|
668
|
+
var l = O(r);
|
|
669
|
+
_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", l || "Unknown");
|
|
670
|
+
}
|
|
671
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
function hr(e) {
|
|
675
|
+
{
|
|
676
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
677
|
+
var o = r[t];
|
|
678
|
+
if (o !== "children" && o !== "key") {
|
|
679
|
+
A(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), A(null);
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
e.ref !== null && (A(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
var Ce = {};
|
|
687
|
+
function ke(e, r, t, o, l, f) {
|
|
688
|
+
{
|
|
689
|
+
var s = qe(e);
|
|
690
|
+
if (!s) {
|
|
691
|
+
var i = "";
|
|
692
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
693
|
+
var b = dr();
|
|
694
|
+
b ? i += b : i += we();
|
|
695
|
+
var v;
|
|
696
|
+
e === null ? v = "null" : q(e) ? v = "array" : e !== void 0 && e.$$typeof === a ? (v = "<" + (O(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, i);
|
|
697
|
+
}
|
|
698
|
+
var g = fr(e, r, t, l, f);
|
|
699
|
+
if (g == null)
|
|
700
|
+
return g;
|
|
701
|
+
if (s) {
|
|
702
|
+
var T = r.children;
|
|
703
|
+
if (T !== void 0)
|
|
704
|
+
if (o)
|
|
705
|
+
if (q(T)) {
|
|
706
|
+
for (var I = 0; I < T.length; I++)
|
|
707
|
+
Oe(T[I], e);
|
|
708
|
+
Object.freeze && Object.freeze(T);
|
|
709
|
+
} else
|
|
710
|
+
_("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
711
|
+
else
|
|
712
|
+
Oe(T, e);
|
|
713
|
+
}
|
|
714
|
+
if ($.call(r, "key")) {
|
|
715
|
+
var k = O(e), E = Object.keys(r).filter(function(Er) {
|
|
716
|
+
return Er !== "key";
|
|
717
|
+
}), X = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
718
|
+
if (!Ce[k + X]) {
|
|
719
|
+
var br = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
|
|
720
|
+
_(`A props object containing a "key" prop is being spread into JSX:
|
|
321
721
|
let props = %s;
|
|
322
722
|
<%s {...props} />
|
|
323
723
|
React keys must be passed directly to JSX without using spread:
|
|
324
724
|
let props = %s;
|
|
325
|
-
<%s key={someKey} {...props} />`,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
f
|
|
330
|
-
), W[f + u] = !0);
|
|
331
|
-
}
|
|
332
|
-
if (f = null, i !== void 0 && (o(i), f = "" + i), l(n) && (o(n.key), f = "" + n.key), "key" in n) {
|
|
333
|
-
i = {};
|
|
334
|
-
for (var x in n)
|
|
335
|
-
x !== "key" && (i[x] = n[x]);
|
|
336
|
-
} else i = n;
|
|
337
|
-
return f && d(
|
|
338
|
-
i,
|
|
339
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
340
|
-
), R(
|
|
341
|
-
e,
|
|
342
|
-
f,
|
|
343
|
-
i,
|
|
344
|
-
s(),
|
|
345
|
-
y,
|
|
346
|
-
O
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
function v(e) {
|
|
350
|
-
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
351
|
-
}
|
|
352
|
-
function m(e) {
|
|
353
|
-
return typeof e == "object" && e !== null && e.$$typeof === Y;
|
|
354
|
-
}
|
|
355
|
-
var h = fe, Y = /* @__PURE__ */ Symbol.for("react.transitional.element"), Z = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), Q = /* @__PURE__ */ Symbol.for("react.strict_mode"), ee = /* @__PURE__ */ Symbol.for("react.profiler"), re = /* @__PURE__ */ Symbol.for("react.consumer"), te = /* @__PURE__ */ Symbol.for("react.context"), ne = /* @__PURE__ */ Symbol.for("react.forward_ref"), oe = /* @__PURE__ */ Symbol.for("react.suspense"), ae = /* @__PURE__ */ Symbol.for("react.suspense_list"), se = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), ie = /* @__PURE__ */ Symbol.for("react.client.reference"), P = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, le = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
356
|
-
return null;
|
|
357
|
-
};
|
|
358
|
-
h = {
|
|
359
|
-
react_stack_bottom_frame: function(e) {
|
|
360
|
-
return e();
|
|
725
|
+
<%s key={someKey} {...props} />`, X, k, br, k), Ce[k + X] = !0;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return e === u ? hr(g) : gr(g), g;
|
|
361
729
|
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
i,
|
|
373
|
-
!1,
|
|
374
|
-
u ? Error("react-stack-top-frame") : J,
|
|
375
|
-
u ? A(a(e)) : V
|
|
376
|
-
);
|
|
377
|
-
}, E.jsxs = function(e, n, i) {
|
|
378
|
-
var u = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
379
|
-
return p(
|
|
380
|
-
e,
|
|
381
|
-
n,
|
|
382
|
-
i,
|
|
383
|
-
!0,
|
|
384
|
-
u ? Error("react-stack-top-frame") : J,
|
|
385
|
-
u ? A(a(e)) : V
|
|
386
|
-
);
|
|
387
|
-
};
|
|
388
|
-
})()), E;
|
|
730
|
+
}
|
|
731
|
+
function pr(e, r, t) {
|
|
732
|
+
return ke(e, r, t, !0);
|
|
733
|
+
}
|
|
734
|
+
function yr(e, r, t) {
|
|
735
|
+
return ke(e, r, t, !1);
|
|
736
|
+
}
|
|
737
|
+
var mr = yr, _r = pr;
|
|
738
|
+
W.Fragment = u, W.jsx = mr, W.jsxs = _r;
|
|
739
|
+
})()), W;
|
|
389
740
|
}
|
|
390
|
-
var
|
|
391
|
-
function
|
|
392
|
-
return
|
|
741
|
+
var Fe;
|
|
742
|
+
function xr() {
|
|
743
|
+
return Fe || (Fe = 1, process.env.NODE_ENV === "production" ? N.exports = kr() : N.exports = jr()), N.exports;
|
|
393
744
|
}
|
|
394
|
-
var
|
|
395
|
-
const
|
|
396
|
-
const [
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
if (!
|
|
400
|
-
|
|
745
|
+
var F = xr();
|
|
746
|
+
const $r = ({ children: n, authConfig: a }) => {
|
|
747
|
+
const [c, u] = Q(null), [d, p] = Q(!0), h = Sr(() => new Tr(a), [a]), R = Z(async () => {
|
|
748
|
+
p(!0);
|
|
749
|
+
const m = localStorage.getItem(h.config.baseKey + "_access");
|
|
750
|
+
if (!m) {
|
|
751
|
+
u(null), p(!1);
|
|
401
752
|
return;
|
|
402
753
|
}
|
|
403
754
|
try {
|
|
404
|
-
const
|
|
755
|
+
const S = await We(h, `${h.config.authServer}/me`, {
|
|
405
756
|
headers: {
|
|
406
|
-
Authorization: `Bearer ${
|
|
757
|
+
Authorization: `Bearer ${m}`
|
|
407
758
|
}
|
|
408
759
|
});
|
|
409
|
-
if (!
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
role:
|
|
413
|
-
userId:
|
|
414
|
-
userName:
|
|
415
|
-
privileges:
|
|
760
|
+
if (!S.ok) throw new Error("not found");
|
|
761
|
+
const w = await S.json();
|
|
762
|
+
u({
|
|
763
|
+
role: w.role.role_name,
|
|
764
|
+
userId: w.user_id,
|
|
765
|
+
userName: w.user_name,
|
|
766
|
+
privileges: w.role.privileges.map((j) => j.privilege.trim())
|
|
416
767
|
});
|
|
417
768
|
} catch {
|
|
418
|
-
|
|
769
|
+
u(null);
|
|
419
770
|
}
|
|
420
|
-
|
|
771
|
+
p(!1);
|
|
421
772
|
}, []);
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}, [
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
}, [
|
|
428
|
-
|
|
429
|
-
}, [
|
|
430
|
-
return /* @__PURE__ */
|
|
431
|
-
},
|
|
432
|
-
const { authManager:
|
|
433
|
-
return
|
|
434
|
-
|
|
435
|
-
}, [
|
|
436
|
-
},
|
|
437
|
-
const
|
|
438
|
-
if (!
|
|
439
|
-
return
|
|
440
|
-
},
|
|
441
|
-
const { user:
|
|
442
|
-
return !!
|
|
773
|
+
re(() => {
|
|
774
|
+
R();
|
|
775
|
+
}, [R]);
|
|
776
|
+
const y = Z(() => {
|
|
777
|
+
ee(h);
|
|
778
|
+
}, [ee, h]), P = Z(() => {
|
|
779
|
+
xe(h), u(null);
|
|
780
|
+
}, [xe, h]);
|
|
781
|
+
return /* @__PURE__ */ F.jsx(te.Provider, { value: { loadMe: R, loading: d, user: c, login: y, authManager: h, logout: P }, children: n });
|
|
782
|
+
}, Ur = () => {
|
|
783
|
+
const { authManager: n, loadMe: a } = $e(te);
|
|
784
|
+
return re(() => {
|
|
785
|
+
n && (je(n), a());
|
|
786
|
+
}, [je, n, a]), /* @__PURE__ */ F.jsx("div", {});
|
|
787
|
+
}, ne = () => {
|
|
788
|
+
const n = $e(te);
|
|
789
|
+
if (!n || !n.authManager) throw new Error("AuthContext not found");
|
|
790
|
+
return n;
|
|
791
|
+
}, Ar = (n) => {
|
|
792
|
+
const { user: a } = ne();
|
|
793
|
+
return !!a?.privileges?.includes(n);
|
|
443
794
|
};
|
|
444
|
-
function
|
|
445
|
-
const { loading:
|
|
446
|
-
return
|
|
795
|
+
function Wr({ privilege: n, invalidPage: a, loadingPage: c }) {
|
|
796
|
+
const { loading: u } = ne(), d = Ar(n);
|
|
797
|
+
return u ? c : d ? /* @__PURE__ */ F.jsx(Ue, {}) : a;
|
|
447
798
|
}
|
|
448
|
-
function
|
|
449
|
-
const { authManager:
|
|
450
|
-
return
|
|
451
|
-
if (!
|
|
452
|
-
|
|
453
|
-
}, [
|
|
799
|
+
function Yr({ loadingPage: n }) {
|
|
800
|
+
const { authManager: a, login: c, user: u } = ne(), [d, p] = Q(!0);
|
|
801
|
+
return re(() => {
|
|
802
|
+
if (!a) return;
|
|
803
|
+
a.getToken() ? p(!1) : c();
|
|
804
|
+
}, [a, u]), a ? d ? n ?? /* @__PURE__ */ F.jsx("div", { children: "Loading..." }) : /* @__PURE__ */ F.jsx(Ue, {}) : /* @__PURE__ */ F.jsx("p", { children: "invalud config" });
|
|
454
805
|
}
|
|
455
806
|
export {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
807
|
+
te as AuthContext,
|
|
808
|
+
Tr as AuthManager,
|
|
809
|
+
$r as AuthProvider,
|
|
810
|
+
Ur as CallbackPage,
|
|
811
|
+
Dr as Config,
|
|
812
|
+
Wr as PrivilegeGate,
|
|
813
|
+
Yr as ProtectGate,
|
|
814
|
+
We as apiFetch,
|
|
815
|
+
je as handleCallback,
|
|
816
|
+
ee as login,
|
|
817
|
+
xe as logout,
|
|
818
|
+
wr as refreshToken,
|
|
819
|
+
ne as useAuth,
|
|
820
|
+
Ar as usePrivilege
|
|
470
821
|
};
|