@service_laboratory/auth 0.0.9 → 1.0.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 +321 -323
- package/dist/index.umd.cjs +7 -7
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,228 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
current: []
|
|
3
|
-
};
|
|
4
|
-
let Ae = !1;
|
|
5
|
-
const ge = /* @__PURE__ */ new Set(), qe = /* @__PURE__ */ new Map();
|
|
6
|
-
function Xe(b) {
|
|
7
|
-
const o = Array.from(b).sort((a, f) => a instanceof ne && a.options.deps.includes(f) ? 1 : f instanceof ne && f.options.deps.includes(a) ? -1 : 0);
|
|
8
|
-
for (const a of o) {
|
|
9
|
-
if (Te.current.includes(a))
|
|
10
|
-
continue;
|
|
11
|
-
Te.current.push(a), a.recompute();
|
|
12
|
-
const f = be.get(a);
|
|
13
|
-
if (f)
|
|
14
|
-
for (const p of f) {
|
|
15
|
-
const v = ie.get(p);
|
|
16
|
-
v && Xe(v);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function nt(b) {
|
|
21
|
-
b.listeners.forEach(
|
|
22
|
-
(o) => o({
|
|
23
|
-
prevVal: b.prevState,
|
|
24
|
-
currentVal: b.state
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
function ot(b) {
|
|
29
|
-
b.listeners.forEach(
|
|
30
|
-
(o) => o({
|
|
31
|
-
prevVal: b.prevState,
|
|
32
|
-
currentVal: b.state
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
function st(b) {
|
|
37
|
-
if (ge.add(b), !Ae)
|
|
38
|
-
try {
|
|
39
|
-
for (Ae = !0; ge.size > 0; ) {
|
|
40
|
-
const o = Array.from(ge);
|
|
41
|
-
ge.clear();
|
|
42
|
-
for (const a of o) {
|
|
43
|
-
const f = qe.get(a) ?? a.prevState;
|
|
44
|
-
a.prevState = f, nt(a);
|
|
45
|
-
}
|
|
46
|
-
for (const a of o) {
|
|
47
|
-
const f = ie.get(a);
|
|
48
|
-
f && (Te.current.push(a), Xe(f));
|
|
49
|
-
}
|
|
50
|
-
for (const a of o) {
|
|
51
|
-
const f = ie.get(a);
|
|
52
|
-
if (f)
|
|
53
|
-
for (const p of f)
|
|
54
|
-
ot(p);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} finally {
|
|
58
|
-
Ae = !1, Te.current = [], qe.clear();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function ut(b) {
|
|
62
|
-
return typeof b == "function";
|
|
63
|
-
}
|
|
64
|
-
class Ce {
|
|
65
|
-
constructor(o, a) {
|
|
66
|
-
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = (f) => {
|
|
67
|
-
var p, v;
|
|
68
|
-
this.listeners.add(f);
|
|
69
|
-
const A = (v = (p = this.options) == null ? void 0 : p.onSubscribe) == null ? void 0 : v.call(p, f, this);
|
|
70
|
-
return () => {
|
|
71
|
-
this.listeners.delete(f), A?.();
|
|
72
|
-
};
|
|
73
|
-
}, this.prevState = o, this.state = o, this.options = a;
|
|
74
|
-
}
|
|
75
|
-
setState(o) {
|
|
76
|
-
var a, f, p;
|
|
77
|
-
this.prevState = this.state, (a = this.options) != null && a.updateFn ? this.state = this.options.updateFn(this.prevState)(o) : ut(o) ? this.state = o(this.prevState) : this.state = o, (p = (f = this.options) == null ? void 0 : f.onUpdate) == null || p.call(f), st(this);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
class ne {
|
|
81
|
-
constructor(o) {
|
|
82
|
-
this.listeners = /* @__PURE__ */ new Set(), this._subscriptions = [], this.lastSeenDepValues = [], this.getDepVals = () => {
|
|
83
|
-
const a = [], f = [];
|
|
84
|
-
for (const p of this.options.deps)
|
|
85
|
-
a.push(p.prevState), f.push(p.state);
|
|
86
|
-
return this.lastSeenDepValues = f, {
|
|
87
|
-
prevDepVals: a,
|
|
88
|
-
currDepVals: f,
|
|
89
|
-
prevVal: this.prevState ?? void 0
|
|
90
|
-
};
|
|
91
|
-
}, this.recompute = () => {
|
|
92
|
-
var a, f;
|
|
93
|
-
this.prevState = this.state;
|
|
94
|
-
const { prevDepVals: p, currDepVals: v, prevVal: A } = this.getDepVals();
|
|
95
|
-
this.state = this.options.fn({
|
|
96
|
-
prevDepVals: p,
|
|
97
|
-
currDepVals: v,
|
|
98
|
-
prevVal: A
|
|
99
|
-
}), (f = (a = this.options).onUpdate) == null || f.call(a);
|
|
100
|
-
}, this.checkIfRecalculationNeededDeeply = () => {
|
|
101
|
-
for (const v of this.options.deps)
|
|
102
|
-
v instanceof ne && v.checkIfRecalculationNeededDeeply();
|
|
103
|
-
let a = !1;
|
|
104
|
-
const f = this.lastSeenDepValues, { currDepVals: p } = this.getDepVals();
|
|
105
|
-
for (let v = 0; v < p.length; v++)
|
|
106
|
-
if (p[v] !== f[v]) {
|
|
107
|
-
a = !0;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
a && this.recompute();
|
|
111
|
-
}, this.mount = () => (this.registerOnGraph(), this.checkIfRecalculationNeededDeeply(), () => {
|
|
112
|
-
this.unregisterFromGraph();
|
|
113
|
-
for (const a of this._subscriptions)
|
|
114
|
-
a();
|
|
115
|
-
}), this.subscribe = (a) => {
|
|
116
|
-
var f, p;
|
|
117
|
-
this.listeners.add(a);
|
|
118
|
-
const v = (p = (f = this.options).onSubscribe) == null ? void 0 : p.call(f, a, this);
|
|
119
|
-
return () => {
|
|
120
|
-
this.listeners.delete(a), v?.();
|
|
121
|
-
};
|
|
122
|
-
}, this.options = o, this.state = o.fn({
|
|
123
|
-
prevDepVals: void 0,
|
|
124
|
-
prevVal: void 0,
|
|
125
|
-
currDepVals: this.getDepVals().currDepVals
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
registerOnGraph(o = this.options.deps) {
|
|
129
|
-
for (const a of o)
|
|
130
|
-
if (a instanceof ne)
|
|
131
|
-
a.registerOnGraph(), this.registerOnGraph(a.options.deps);
|
|
132
|
-
else if (a instanceof Ce) {
|
|
133
|
-
let f = ie.get(a);
|
|
134
|
-
f || (f = /* @__PURE__ */ new Set(), ie.set(a, f)), f.add(this);
|
|
135
|
-
let p = be.get(this);
|
|
136
|
-
p || (p = /* @__PURE__ */ new Set(), be.set(this, p)), p.add(a);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
unregisterFromGraph(o = this.options.deps) {
|
|
140
|
-
for (const a of o)
|
|
141
|
-
if (a instanceof ne)
|
|
142
|
-
this.unregisterFromGraph(a.options.deps);
|
|
143
|
-
else if (a instanceof Ce) {
|
|
144
|
-
const f = ie.get(a);
|
|
145
|
-
f && f.delete(this);
|
|
146
|
-
const p = be.get(this);
|
|
147
|
-
p && p.delete(a);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const ke = "Authorization", Ke = () => ({
|
|
152
|
-
user: {
|
|
153
|
-
id: null,
|
|
154
|
-
email: null,
|
|
155
|
-
roles: [],
|
|
156
|
-
is_enabled: !1,
|
|
157
|
-
is_active: !1
|
|
158
|
-
},
|
|
159
|
-
isAuthenticated: !1,
|
|
160
|
-
isLoaded: !1
|
|
161
|
-
}), re = new Ce(Ke()), dt = new ne({
|
|
162
|
-
fn: () => !!re.state.user?.roles.find((b) => b.name === "admin"),
|
|
163
|
-
deps: [re]
|
|
164
|
-
});
|
|
165
|
-
class ht {
|
|
166
|
-
accountStore;
|
|
167
|
-
httpClient;
|
|
168
|
-
constructor(o) {
|
|
169
|
-
this.httpClient = o, this.accountStore = re;
|
|
170
|
-
}
|
|
171
|
-
initAuthData() {
|
|
172
|
-
const o = localStorage.getItem("token");
|
|
173
|
-
o && (this.httpClient.defaults.headers.common[ke] = o);
|
|
174
|
-
}
|
|
175
|
-
async load() {
|
|
176
|
-
try {
|
|
177
|
-
const { data: o } = await this.httpClient.get("/api/auth/account/me");
|
|
178
|
-
re.setState(() => ({
|
|
179
|
-
user: o,
|
|
180
|
-
isAuthenticated: !0,
|
|
181
|
-
isLoaded: !0
|
|
182
|
-
}));
|
|
183
|
-
} catch {
|
|
184
|
-
re.setState((o) => ({
|
|
185
|
-
...o,
|
|
186
|
-
isLoaded: !0
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
async login(o) {
|
|
191
|
-
const a = await this.httpClient.post("/api/auth/account/login", o), { user: f, access_token: p } = a.data;
|
|
192
|
-
return f.is_active && this._initUserData({ user: f, access_token: p }), f;
|
|
193
|
-
}
|
|
194
|
-
register(o) {
|
|
195
|
-
return this.httpClient.post("/api/auth/account/register", o);
|
|
196
|
-
}
|
|
197
|
-
async activate(o) {
|
|
198
|
-
const a = await this.httpClient.post("/api/auth/account/activate", o);
|
|
199
|
-
this._initUserData(a.data);
|
|
200
|
-
}
|
|
201
|
-
logout() {
|
|
202
|
-
re.setState(() => ({ ...Ke(), isLoaded: !0 })), this._clearAuthData();
|
|
203
|
-
}
|
|
204
|
-
startResetPassword(o) {
|
|
205
|
-
return this.httpClient.post("/api/auth/account/start-reset-password", o);
|
|
206
|
-
}
|
|
207
|
-
async resetPassword(o) {
|
|
208
|
-
const a = await this.httpClient.post("/api/auth/account/reset-password", o);
|
|
209
|
-
this._initUserData(a.data);
|
|
210
|
-
}
|
|
211
|
-
_initUserData({ user: o, access_token: a }) {
|
|
212
|
-
this._setAuthData(a), re.setState(() => ({
|
|
213
|
-
user: o,
|
|
214
|
-
isAuthenticated: !0,
|
|
215
|
-
isLoaded: !0
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
_setAuthData(o) {
|
|
219
|
-
localStorage.setItem("token", o), this.httpClient.defaults.headers.common[ke] = o;
|
|
220
|
-
}
|
|
221
|
-
_clearAuthData() {
|
|
222
|
-
localStorage.removeItem("token"), delete this.httpClient.defaults.headers.common[ke];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
var Re = { exports: {} }, le = {};
|
|
1
|
+
var ge = { exports: {} }, le = {};
|
|
226
2
|
/**
|
|
227
3
|
* @license React
|
|
228
4
|
* react-jsx-runtime.production.js
|
|
@@ -233,28 +9,28 @@ var Re = { exports: {} }, le = {};
|
|
|
233
9
|
* LICENSE file in the root directory of this source tree.
|
|
234
10
|
*/
|
|
235
11
|
var We;
|
|
236
|
-
function
|
|
12
|
+
function nt() {
|
|
237
13
|
if (We) return le;
|
|
238
14
|
We = 1;
|
|
239
15
|
var b = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
|
|
240
|
-
function a(f, p,
|
|
16
|
+
function a(f, p, m) {
|
|
241
17
|
var A = null;
|
|
242
|
-
if (
|
|
243
|
-
|
|
18
|
+
if (m !== void 0 && (A = "" + m), p.key !== void 0 && (A = "" + p.key), "key" in p) {
|
|
19
|
+
m = {};
|
|
244
20
|
for (var D in p)
|
|
245
|
-
D !== "key" && (
|
|
246
|
-
} else
|
|
247
|
-
return p =
|
|
21
|
+
D !== "key" && (m[D] = p[D]);
|
|
22
|
+
} else m = p;
|
|
23
|
+
return p = m.ref, {
|
|
248
24
|
$$typeof: b,
|
|
249
25
|
type: f,
|
|
250
26
|
key: A,
|
|
251
27
|
ref: p !== void 0 ? p : null,
|
|
252
|
-
props:
|
|
28
|
+
props: m
|
|
253
29
|
};
|
|
254
30
|
}
|
|
255
31
|
return le.Fragment = o, le.jsx = a, le.jsxs = a, le;
|
|
256
32
|
}
|
|
257
|
-
var pe = {},
|
|
33
|
+
var pe = {}, Re = { exports: {} }, _ = {};
|
|
258
34
|
/**
|
|
259
35
|
* @license React
|
|
260
36
|
* react.production.js
|
|
@@ -264,13 +40,13 @@ var pe = {}, we = { exports: {} }, _ = {};
|
|
|
264
40
|
* This source code is licensed under the MIT license found in the
|
|
265
41
|
* LICENSE file in the root directory of this source tree.
|
|
266
42
|
*/
|
|
267
|
-
var
|
|
268
|
-
function
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
var b = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"),
|
|
43
|
+
var qe;
|
|
44
|
+
function ot() {
|
|
45
|
+
if (qe) return _;
|
|
46
|
+
qe = 1;
|
|
47
|
+
var b = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), A = Symbol.for("react.context"), D = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), W = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), q = Symbol.iterator;
|
|
272
48
|
function H(t) {
|
|
273
|
-
return t === null || typeof t != "object" ? null : (t =
|
|
49
|
+
return t === null || typeof t != "object" ? null : (t = q && t[q] || t["@@iterator"], typeof t == "function" ? t : null);
|
|
274
50
|
}
|
|
275
51
|
var z = {
|
|
276
52
|
isMounted: function() {
|
|
@@ -402,17 +178,17 @@ function it() {
|
|
|
402
178
|
h = 0;
|
|
403
179
|
var C = c === "" ? "." : c + ":";
|
|
404
180
|
if (se(t))
|
|
405
|
-
for (var
|
|
406
|
-
c = t[
|
|
181
|
+
for (var v = 0; v < t.length; v++)
|
|
182
|
+
c = t[v], w = C + B(c, v), h += k(
|
|
407
183
|
c,
|
|
408
184
|
n,
|
|
409
185
|
i,
|
|
410
186
|
w,
|
|
411
187
|
d
|
|
412
188
|
);
|
|
413
|
-
else if (
|
|
414
|
-
for (t =
|
|
415
|
-
c = c.value, w = C + B(c,
|
|
189
|
+
else if (v = H(t), typeof v == "function")
|
|
190
|
+
for (t = v.call(t), v = 0; !(c = t.next()).done; )
|
|
191
|
+
c = c.value, w = C + B(c, v++), h += k(
|
|
416
192
|
c,
|
|
417
193
|
n,
|
|
418
194
|
i,
|
|
@@ -523,8 +299,8 @@ function it() {
|
|
|
523
299
|
var h = arguments.length - 2;
|
|
524
300
|
if (h === 1) c.children = i;
|
|
525
301
|
else if (1 < h) {
|
|
526
|
-
for (var C = Array(h),
|
|
527
|
-
C[
|
|
302
|
+
for (var C = Array(h), v = 0; v < h; v++)
|
|
303
|
+
C[v] = arguments[v + 2];
|
|
528
304
|
c.children = C;
|
|
529
305
|
}
|
|
530
306
|
return ee(t.type, d, void 0, void 0, w, c);
|
|
@@ -537,7 +313,7 @@ function it() {
|
|
|
537
313
|
Provider: null,
|
|
538
314
|
Consumer: null
|
|
539
315
|
}, t.Provider = t, t.Consumer = {
|
|
540
|
-
$$typeof:
|
|
316
|
+
$$typeof: m,
|
|
541
317
|
_context: t
|
|
542
318
|
}, t;
|
|
543
319
|
}, _.createElement = function(t, n, i) {
|
|
@@ -548,8 +324,8 @@ function it() {
|
|
|
548
324
|
var h = arguments.length - 2;
|
|
549
325
|
if (h === 1) d.children = i;
|
|
550
326
|
else if (1 < h) {
|
|
551
|
-
for (var C = Array(h),
|
|
552
|
-
C[
|
|
327
|
+
for (var C = Array(h), v = 0; v < h; v++)
|
|
328
|
+
C[v] = arguments[v + 2];
|
|
553
329
|
d.children = C;
|
|
554
330
|
}
|
|
555
331
|
if (t && t.defaultProps)
|
|
@@ -568,7 +344,7 @@ function it() {
|
|
|
568
344
|
};
|
|
569
345
|
}, _.memo = function(t, n) {
|
|
570
346
|
return {
|
|
571
|
-
$$typeof:
|
|
347
|
+
$$typeof: W,
|
|
572
348
|
type: t,
|
|
573
349
|
compare: n === void 0 ? null : n
|
|
574
350
|
};
|
|
@@ -642,12 +418,12 @@ var de = { exports: {} };
|
|
|
642
418
|
* LICENSE file in the root directory of this source tree.
|
|
643
419
|
*/
|
|
644
420
|
de.exports;
|
|
645
|
-
var
|
|
646
|
-
function
|
|
647
|
-
return
|
|
421
|
+
var ze;
|
|
422
|
+
function st() {
|
|
423
|
+
return ze || (ze = 1, (function(b, o) {
|
|
648
424
|
process.env.NODE_ENV !== "production" && (function() {
|
|
649
425
|
function a(e, r) {
|
|
650
|
-
Object.defineProperty(
|
|
426
|
+
Object.defineProperty(m.prototype, e, {
|
|
651
427
|
get: function() {
|
|
652
428
|
console.warn(
|
|
653
429
|
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
@@ -669,7 +445,7 @@ function ct() {
|
|
|
669
445
|
e
|
|
670
446
|
), je[s] = !0);
|
|
671
447
|
}
|
|
672
|
-
function
|
|
448
|
+
function m(e, r, s) {
|
|
673
449
|
this.props = e, this.context = r, this.refs = Se, this.updater = s || Pe;
|
|
674
450
|
}
|
|
675
451
|
function A() {
|
|
@@ -680,7 +456,7 @@ function ct() {
|
|
|
680
456
|
function oe(e) {
|
|
681
457
|
return "" + e;
|
|
682
458
|
}
|
|
683
|
-
function
|
|
459
|
+
function W(e) {
|
|
684
460
|
try {
|
|
685
461
|
oe(e);
|
|
686
462
|
var r = !1;
|
|
@@ -729,7 +505,7 @@ function ct() {
|
|
|
729
505
|
case w:
|
|
730
506
|
var r = e.render;
|
|
731
507
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
732
|
-
case
|
|
508
|
+
case v:
|
|
733
509
|
return r = e.displayName || null, r !== null ? r : $(e.type) || "Memo";
|
|
734
510
|
case j:
|
|
735
511
|
r = e._payload, e = e._init;
|
|
@@ -740,7 +516,7 @@ function ct() {
|
|
|
740
516
|
}
|
|
741
517
|
return null;
|
|
742
518
|
}
|
|
743
|
-
function
|
|
519
|
+
function q(e) {
|
|
744
520
|
if (e === t) return "<>";
|
|
745
521
|
if (typeof e == "object" && e !== null && e.$$typeof === j)
|
|
746
522
|
return "<...>";
|
|
@@ -759,7 +535,7 @@ function ct() {
|
|
|
759
535
|
return Error("react-stack-top-frame");
|
|
760
536
|
}
|
|
761
537
|
function K(e) {
|
|
762
|
-
if (
|
|
538
|
+
if (ve.call(e, "key")) {
|
|
763
539
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
764
540
|
if (r && r.isReactWarning) return !1;
|
|
765
541
|
}
|
|
@@ -837,7 +613,7 @@ function ct() {
|
|
|
837
613
|
});
|
|
838
614
|
}
|
|
839
615
|
function T(e, r) {
|
|
840
|
-
return typeof e == "object" && e !== null && e.key != null ? (
|
|
616
|
+
return typeof e == "object" && e !== null && e.key != null ? (W(e.key), se("" + e.key)) : r.toString(36);
|
|
841
617
|
}
|
|
842
618
|
function J() {
|
|
843
619
|
}
|
|
@@ -897,7 +673,7 @@ function ct() {
|
|
|
897
673
|
var S = u === "" ? "." + T(E, 0) : u;
|
|
898
674
|
return De(l) ? (s = "", S != null && (s = S.replace(Ue, "$&/") + "/"), L(l, r, s, "", function(X) {
|
|
899
675
|
return X;
|
|
900
|
-
})) : l != null && (P(l) && (l.key != null && (E && E.key === l.key ||
|
|
676
|
+
})) : l != null && (P(l) && (l.key != null && (E && E.key === l.key || W(l.key)), s = Z(
|
|
901
677
|
l,
|
|
902
678
|
s + (l.key == null || E && E.key === l.key ? "" : ("" + l.key).replace(
|
|
903
679
|
Ue,
|
|
@@ -990,15 +766,15 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
990
766
|
function B() {
|
|
991
767
|
}
|
|
992
768
|
function x(e) {
|
|
993
|
-
if (
|
|
769
|
+
if (me === null)
|
|
994
770
|
try {
|
|
995
771
|
var r = ("require" + Math.random()).slice(0, 7);
|
|
996
|
-
|
|
772
|
+
me = (b && b[r]).call(
|
|
997
773
|
b,
|
|
998
774
|
"timers"
|
|
999
775
|
).setImmediate;
|
|
1000
776
|
} catch {
|
|
1001
|
-
|
|
777
|
+
me = function(u) {
|
|
1002
778
|
xe === !1 && (xe = !0, typeof MessageChannel > "u" && console.error(
|
|
1003
779
|
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
1004
780
|
));
|
|
@@ -1006,7 +782,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1006
782
|
l.port1.onmessage = u, l.port2.postMessage(void 0);
|
|
1007
783
|
};
|
|
1008
784
|
}
|
|
1009
|
-
return
|
|
785
|
+
return me(e);
|
|
1010
786
|
}
|
|
1011
787
|
function M(e) {
|
|
1012
788
|
return 1 < e.length && typeof AggregateError == "function" ? new AggregateError(e) : e[0];
|
|
@@ -1059,7 +835,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1059
835
|
}
|
|
1060
836
|
}
|
|
1061
837
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1062
|
-
var V = Symbol.for("react.transitional.element"), te = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), c = Symbol.for("react.consumer"), d = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), C = Symbol.for("react.suspense_list"),
|
|
838
|
+
var V = Symbol.for("react.transitional.element"), te = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), c = Symbol.for("react.consumer"), d = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), C = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), fe = Symbol.for("react.activity"), he = Symbol.iterator, je = {}, Pe = {
|
|
1063
839
|
isMounted: function() {
|
|
1064
840
|
return !1;
|
|
1065
841
|
},
|
|
@@ -1073,13 +849,13 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1073
849
|
p(e, "setState");
|
|
1074
850
|
}
|
|
1075
851
|
}, Ne = Object.assign, Se = {};
|
|
1076
|
-
Object.freeze(Se),
|
|
852
|
+
Object.freeze(Se), m.prototype.isReactComponent = {}, m.prototype.setState = function(e, r) {
|
|
1077
853
|
if (typeof e != "object" && typeof e != "function" && e != null)
|
|
1078
854
|
throw Error(
|
|
1079
855
|
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
1080
856
|
);
|
|
1081
857
|
this.updater.enqueueSetState(this, e, r, "setState");
|
|
1082
|
-
},
|
|
858
|
+
}, m.prototype.forceUpdate = function(e) {
|
|
1083
859
|
this.updater.enqueueForceUpdate(this, e, "forceUpdate");
|
|
1084
860
|
};
|
|
1085
861
|
var N = {
|
|
@@ -1094,7 +870,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1094
870
|
}, _e;
|
|
1095
871
|
for (_e in N)
|
|
1096
872
|
N.hasOwnProperty(_e) && a(_e, N[_e]);
|
|
1097
|
-
A.prototype =
|
|
873
|
+
A.prototype = m.prototype, N = D.prototype = new A(), N.constructor = D, Ne(N, m.prototype), N.isPureReactComponent = !0;
|
|
1098
874
|
var De = Array.isArray, Ze = Symbol.for("react.client.reference"), g = {
|
|
1099
875
|
H: null,
|
|
1100
876
|
A: null,
|
|
@@ -1108,7 +884,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1108
884
|
thrownErrors: [],
|
|
1109
885
|
getCurrentStack: null,
|
|
1110
886
|
recentlyCreatedOwnerStacks: 0
|
|
1111
|
-
},
|
|
887
|
+
}, ve = Object.prototype.hasOwnProperty, Le = console.createTask ? console.createTask : function() {
|
|
1112
888
|
return null;
|
|
1113
889
|
};
|
|
1114
890
|
N = {
|
|
@@ -1119,7 +895,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1119
895
|
var Me, Ie, $e = {}, Je = N.react_stack_bottom_frame.bind(
|
|
1120
896
|
N,
|
|
1121
897
|
z
|
|
1122
|
-
)(), et = Le(
|
|
898
|
+
)(), et = Le(q(z)), Ye = !1, Ue = /\/+/g, He = typeof reportError == "function" ? reportError : function(e) {
|
|
1123
899
|
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
1124
900
|
var r = new window.ErrorEvent("error", {
|
|
1125
901
|
bubbles: !0,
|
|
@@ -1133,7 +909,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1133
909
|
return;
|
|
1134
910
|
}
|
|
1135
911
|
console.error(e);
|
|
1136
|
-
}, xe = !1,
|
|
912
|
+
}, xe = !1, me = null, Ee = 0, ye = !1, Oe = !1, Ve = typeof queueMicrotask == "function" ? function(e) {
|
|
1137
913
|
queueMicrotask(function() {
|
|
1138
914
|
return queueMicrotask(e);
|
|
1139
915
|
});
|
|
@@ -1172,7 +948,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1172
948
|
);
|
|
1173
949
|
return e;
|
|
1174
950
|
}
|
|
1175
|
-
}, o.Component =
|
|
951
|
+
}, o.Component = m, o.Fragment = t, o.Profiler = i, o.PureComponent = D, o.StrictMode = n, o.Suspense = h, o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = g, o.__COMPILER_RUNTIME = N, o.act = function(e) {
|
|
1176
952
|
var r = g.actQueue, s = Ee;
|
|
1177
953
|
Ee++;
|
|
1178
954
|
var u = g.actQueue = r !== null ? r : [], l = !1;
|
|
@@ -1256,7 +1032,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1256
1032
|
if (r != null) {
|
|
1257
1033
|
var E;
|
|
1258
1034
|
e: {
|
|
1259
|
-
if (
|
|
1035
|
+
if (ve.call(r, "ref") && (E = Object.getOwnPropertyDescriptor(
|
|
1260
1036
|
r,
|
|
1261
1037
|
"ref"
|
|
1262
1038
|
).get) && E.isReactWarning) {
|
|
@@ -1265,9 +1041,9 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1265
1041
|
}
|
|
1266
1042
|
E = r.ref !== void 0;
|
|
1267
1043
|
}
|
|
1268
|
-
E && (R = H()), K(r) && (
|
|
1044
|
+
E && (R = H()), K(r) && (W(r.key), l = "" + r.key);
|
|
1269
1045
|
for (S in r)
|
|
1270
|
-
!
|
|
1046
|
+
!ve.call(r, S) || S === "key" || S === "__self" || S === "__source" || S === "ref" && r.ref === void 0 || (u[S] = r[S]);
|
|
1271
1047
|
}
|
|
1272
1048
|
var S = arguments.length - 2;
|
|
1273
1049
|
if (S === 1) u.children = s;
|
|
@@ -1309,8 +1085,8 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1309
1085
|
if (u = {}, l = null, r != null)
|
|
1310
1086
|
for (y in Ie || !("__self" in r) || "key" in r || (Ie = !0, console.warn(
|
|
1311
1087
|
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1312
|
-
)), K(r) && (
|
|
1313
|
-
|
|
1088
|
+
)), K(r) && (W(r.key), l = "" + r.key), r)
|
|
1089
|
+
ve.call(r, y) && y !== "key" && y !== "__self" && y !== "__source" && (u[y] = r[y]);
|
|
1314
1090
|
var R = arguments.length - 2;
|
|
1315
1091
|
if (R === 1) u.children = s;
|
|
1316
1092
|
else if (1 < R) {
|
|
@@ -1334,13 +1110,13 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1334
1110
|
H(),
|
|
1335
1111
|
u,
|
|
1336
1112
|
y ? Error("react-stack-top-frame") : Je,
|
|
1337
|
-
y ? Le(
|
|
1113
|
+
y ? Le(q(e)) : et
|
|
1338
1114
|
);
|
|
1339
1115
|
}, o.createRef = function() {
|
|
1340
1116
|
var e = { current: null };
|
|
1341
1117
|
return Object.seal(e), e;
|
|
1342
1118
|
}, o.forwardRef = function(e) {
|
|
1343
|
-
e != null && e.$$typeof ===
|
|
1119
|
+
e != null && e.$$typeof === v ? console.error(
|
|
1344
1120
|
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
1345
1121
|
) : typeof e != "function" ? console.error(
|
|
1346
1122
|
"forwardRef requires a render function but was given %s.",
|
|
@@ -1373,7 +1149,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1373
1149
|
"memo: The first argument must be a component. Instead received: %s",
|
|
1374
1150
|
e === null ? "null" : typeof e
|
|
1375
1151
|
), r = {
|
|
1376
|
-
$$typeof:
|
|
1152
|
+
$$typeof: v,
|
|
1377
1153
|
type: e,
|
|
1378
1154
|
compare: r === void 0 ? null : r
|
|
1379
1155
|
};
|
|
@@ -1466,9 +1242,9 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1466
1242
|
})();
|
|
1467
1243
|
})(de, de.exports)), de.exports;
|
|
1468
1244
|
}
|
|
1469
|
-
var
|
|
1470
|
-
function
|
|
1471
|
-
return
|
|
1245
|
+
var Ge;
|
|
1246
|
+
function ut() {
|
|
1247
|
+
return Ge || (Ge = 1, process.env.NODE_ENV === "production" ? Re.exports = ot() : Re.exports = st()), Re.exports;
|
|
1472
1248
|
}
|
|
1473
1249
|
/**
|
|
1474
1250
|
* @license React
|
|
@@ -1479,9 +1255,9 @@ function ft() {
|
|
|
1479
1255
|
* This source code is licensed under the MIT license found in the
|
|
1480
1256
|
* LICENSE file in the root directory of this source tree.
|
|
1481
1257
|
*/
|
|
1482
|
-
var
|
|
1483
|
-
function
|
|
1484
|
-
return
|
|
1258
|
+
var Fe;
|
|
1259
|
+
function at() {
|
|
1260
|
+
return Fe || (Fe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
1485
1261
|
function b(t) {
|
|
1486
1262
|
if (t == null) return null;
|
|
1487
1263
|
if (typeof t == "function")
|
|
@@ -1560,7 +1336,7 @@ function lt() {
|
|
|
1560
1336
|
var t = O.A;
|
|
1561
1337
|
return t === null ? null : t.getOwner();
|
|
1562
1338
|
}
|
|
1563
|
-
function
|
|
1339
|
+
function m() {
|
|
1564
1340
|
return Error("react-stack-top-frame");
|
|
1565
1341
|
}
|
|
1566
1342
|
function A(t) {
|
|
@@ -1588,7 +1364,7 @@ function lt() {
|
|
|
1588
1364
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
1589
1365
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
1590
1366
|
}
|
|
1591
|
-
function
|
|
1367
|
+
function W(t, n, i, c, d, w, h, C) {
|
|
1592
1368
|
return i = w.ref, t = {
|
|
1593
1369
|
$$typeof: z,
|
|
1594
1370
|
type: t,
|
|
@@ -1621,24 +1397,24 @@ function lt() {
|
|
|
1621
1397
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
1622
1398
|
}
|
|
1623
1399
|
function $(t, n, i, c, d, w, h, C) {
|
|
1624
|
-
var
|
|
1625
|
-
if (
|
|
1400
|
+
var v = n.children;
|
|
1401
|
+
if (v !== void 0)
|
|
1626
1402
|
if (c)
|
|
1627
|
-
if (x(
|
|
1628
|
-
for (c = 0; c <
|
|
1629
|
-
|
|
1630
|
-
Object.freeze && Object.freeze(
|
|
1403
|
+
if (x(v)) {
|
|
1404
|
+
for (c = 0; c < v.length; c++)
|
|
1405
|
+
q(v[c]);
|
|
1406
|
+
Object.freeze && Object.freeze(v);
|
|
1631
1407
|
} else
|
|
1632
1408
|
console.error(
|
|
1633
1409
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
1634
1410
|
);
|
|
1635
|
-
else
|
|
1411
|
+
else q(v);
|
|
1636
1412
|
if (B.call(n, "key")) {
|
|
1637
|
-
|
|
1413
|
+
v = b(t);
|
|
1638
1414
|
var j = Object.keys(n).filter(function(he) {
|
|
1639
1415
|
return he !== "key";
|
|
1640
1416
|
});
|
|
1641
|
-
c = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", te[
|
|
1417
|
+
c = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", te[v + c] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
1642
1418
|
`A props object containing a "key" prop is being spread into JSX:
|
|
1643
1419
|
let props = %s;
|
|
1644
1420
|
<%s {...props} />
|
|
@@ -1646,22 +1422,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1646
1422
|
let props = %s;
|
|
1647
1423
|
<%s key={someKey} {...props} />`,
|
|
1648
1424
|
c,
|
|
1649
|
-
|
|
1425
|
+
v,
|
|
1650
1426
|
j,
|
|
1651
|
-
|
|
1652
|
-
), te[
|
|
1427
|
+
v
|
|
1428
|
+
), te[v + c] = !0);
|
|
1653
1429
|
}
|
|
1654
|
-
if (
|
|
1430
|
+
if (v = null, i !== void 0 && (a(i), v = "" + i), A(n) && (a(n.key), v = "" + n.key), "key" in n) {
|
|
1655
1431
|
i = {};
|
|
1656
1432
|
for (var fe in n)
|
|
1657
1433
|
fe !== "key" && (i[fe] = n[fe]);
|
|
1658
1434
|
} else i = n;
|
|
1659
|
-
return
|
|
1435
|
+
return v && D(
|
|
1660
1436
|
i,
|
|
1661
1437
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
1662
|
-
),
|
|
1438
|
+
), W(
|
|
1663
1439
|
t,
|
|
1664
|
-
|
|
1440
|
+
v,
|
|
1665
1441
|
w,
|
|
1666
1442
|
d,
|
|
1667
1443
|
p(),
|
|
@@ -1670,10 +1446,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1670
1446
|
C
|
|
1671
1447
|
);
|
|
1672
1448
|
}
|
|
1673
|
-
function
|
|
1449
|
+
function q(t) {
|
|
1674
1450
|
typeof t == "object" && t !== null && t.$$typeof === z && t._store && (t._store.validated = 1);
|
|
1675
1451
|
}
|
|
1676
|
-
var H =
|
|
1452
|
+
var H = ut(), z = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), G = Symbol.for("react.fragment"), Y = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), P = Symbol.for("react.context"), se = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), ee = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), O = H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, x = Array.isArray, M = console.createTask ? console.createTask : function() {
|
|
1677
1453
|
return null;
|
|
1678
1454
|
};
|
|
1679
1455
|
H = {
|
|
@@ -1683,8 +1459,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1683
1459
|
};
|
|
1684
1460
|
var k, I = {}, Q = H.react_stack_bottom_frame.bind(
|
|
1685
1461
|
H,
|
|
1686
|
-
|
|
1687
|
-
)(), V = M(f(
|
|
1462
|
+
m
|
|
1463
|
+
)(), V = M(f(m)), te = {};
|
|
1688
1464
|
pe.Fragment = G, pe.jsx = function(t, n, i, c, d) {
|
|
1689
1465
|
var w = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
1690
1466
|
return $(
|
|
@@ -1712,22 +1488,244 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1712
1488
|
};
|
|
1713
1489
|
})()), pe;
|
|
1714
1490
|
}
|
|
1715
|
-
var
|
|
1716
|
-
function
|
|
1717
|
-
return
|
|
1491
|
+
var Be;
|
|
1492
|
+
function it() {
|
|
1493
|
+
return Be || (Be = 1, process.env.NODE_ENV === "production" ? ge.exports = nt() : ge.exports = at()), ge.exports;
|
|
1718
1494
|
}
|
|
1719
|
-
var ae =
|
|
1720
|
-
function
|
|
1495
|
+
var ae = it();
|
|
1496
|
+
function dt() {
|
|
1721
1497
|
return /* @__PURE__ */ ae.jsxs("form", { children: [
|
|
1722
|
-
/* @__PURE__ */ ae.jsx("
|
|
1723
|
-
/* @__PURE__ */ ae.jsx("
|
|
1724
|
-
/* @__PURE__ */ ae.jsx("
|
|
1725
|
-
/* @__PURE__ */ ae.jsx("input", { type: "password", id: "password", name: "password", required: !0 }),
|
|
1726
|
-
/* @__PURE__ */ ae.jsx("button", { type: "submit", children: "Login" })
|
|
1498
|
+
/* @__PURE__ */ ae.jsx("div", { children: /* @__PURE__ */ ae.jsx("input", { type: "email" }) }),
|
|
1499
|
+
/* @__PURE__ */ ae.jsx("div", { children: /* @__PURE__ */ ae.jsx("input", { type: "password" }) }),
|
|
1500
|
+
/* @__PURE__ */ ae.jsx("button", { type: "submit" })
|
|
1727
1501
|
] });
|
|
1728
1502
|
}
|
|
1503
|
+
const ie = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap(), Te = {
|
|
1504
|
+
current: []
|
|
1505
|
+
};
|
|
1506
|
+
let Ae = !1;
|
|
1507
|
+
const we = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
|
|
1508
|
+
function Xe(b) {
|
|
1509
|
+
const o = Array.from(b).sort((a, f) => a instanceof ne && a.options.deps.includes(f) ? 1 : f instanceof ne && f.options.deps.includes(a) ? -1 : 0);
|
|
1510
|
+
for (const a of o) {
|
|
1511
|
+
if (Te.current.includes(a))
|
|
1512
|
+
continue;
|
|
1513
|
+
Te.current.push(a), a.recompute();
|
|
1514
|
+
const f = be.get(a);
|
|
1515
|
+
if (f)
|
|
1516
|
+
for (const p of f) {
|
|
1517
|
+
const m = ie.get(p);
|
|
1518
|
+
m && Xe(m);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
function ct(b) {
|
|
1523
|
+
b.listeners.forEach(
|
|
1524
|
+
(o) => o({
|
|
1525
|
+
prevVal: b.prevState,
|
|
1526
|
+
currentVal: b.state
|
|
1527
|
+
})
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
function ft(b) {
|
|
1531
|
+
b.listeners.forEach(
|
|
1532
|
+
(o) => o({
|
|
1533
|
+
prevVal: b.prevState,
|
|
1534
|
+
currentVal: b.state
|
|
1535
|
+
})
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
function lt(b) {
|
|
1539
|
+
if (we.add(b), !Ae)
|
|
1540
|
+
try {
|
|
1541
|
+
for (Ae = !0; we.size > 0; ) {
|
|
1542
|
+
const o = Array.from(we);
|
|
1543
|
+
we.clear();
|
|
1544
|
+
for (const a of o) {
|
|
1545
|
+
const f = Qe.get(a) ?? a.prevState;
|
|
1546
|
+
a.prevState = f, ct(a);
|
|
1547
|
+
}
|
|
1548
|
+
for (const a of o) {
|
|
1549
|
+
const f = ie.get(a);
|
|
1550
|
+
f && (Te.current.push(a), Xe(f));
|
|
1551
|
+
}
|
|
1552
|
+
for (const a of o) {
|
|
1553
|
+
const f = ie.get(a);
|
|
1554
|
+
if (f)
|
|
1555
|
+
for (const p of f)
|
|
1556
|
+
ft(p);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
} finally {
|
|
1560
|
+
Ae = !1, Te.current = [], Qe.clear();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function pt(b) {
|
|
1564
|
+
return typeof b == "function";
|
|
1565
|
+
}
|
|
1566
|
+
class Ce {
|
|
1567
|
+
constructor(o, a) {
|
|
1568
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = (f) => {
|
|
1569
|
+
var p, m;
|
|
1570
|
+
this.listeners.add(f);
|
|
1571
|
+
const A = (m = (p = this.options) == null ? void 0 : p.onSubscribe) == null ? void 0 : m.call(p, f, this);
|
|
1572
|
+
return () => {
|
|
1573
|
+
this.listeners.delete(f), A?.();
|
|
1574
|
+
};
|
|
1575
|
+
}, this.prevState = o, this.state = o, this.options = a;
|
|
1576
|
+
}
|
|
1577
|
+
setState(o) {
|
|
1578
|
+
var a, f, p;
|
|
1579
|
+
this.prevState = this.state, (a = this.options) != null && a.updateFn ? this.state = this.options.updateFn(this.prevState)(o) : pt(o) ? this.state = o(this.prevState) : this.state = o, (p = (f = this.options) == null ? void 0 : f.onUpdate) == null || p.call(f), lt(this);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
class ne {
|
|
1583
|
+
constructor(o) {
|
|
1584
|
+
this.listeners = /* @__PURE__ */ new Set(), this._subscriptions = [], this.lastSeenDepValues = [], this.getDepVals = () => {
|
|
1585
|
+
const a = [], f = [];
|
|
1586
|
+
for (const p of this.options.deps)
|
|
1587
|
+
a.push(p.prevState), f.push(p.state);
|
|
1588
|
+
return this.lastSeenDepValues = f, {
|
|
1589
|
+
prevDepVals: a,
|
|
1590
|
+
currDepVals: f,
|
|
1591
|
+
prevVal: this.prevState ?? void 0
|
|
1592
|
+
};
|
|
1593
|
+
}, this.recompute = () => {
|
|
1594
|
+
var a, f;
|
|
1595
|
+
this.prevState = this.state;
|
|
1596
|
+
const { prevDepVals: p, currDepVals: m, prevVal: A } = this.getDepVals();
|
|
1597
|
+
this.state = this.options.fn({
|
|
1598
|
+
prevDepVals: p,
|
|
1599
|
+
currDepVals: m,
|
|
1600
|
+
prevVal: A
|
|
1601
|
+
}), (f = (a = this.options).onUpdate) == null || f.call(a);
|
|
1602
|
+
}, this.checkIfRecalculationNeededDeeply = () => {
|
|
1603
|
+
for (const m of this.options.deps)
|
|
1604
|
+
m instanceof ne && m.checkIfRecalculationNeededDeeply();
|
|
1605
|
+
let a = !1;
|
|
1606
|
+
const f = this.lastSeenDepValues, { currDepVals: p } = this.getDepVals();
|
|
1607
|
+
for (let m = 0; m < p.length; m++)
|
|
1608
|
+
if (p[m] !== f[m]) {
|
|
1609
|
+
a = !0;
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
a && this.recompute();
|
|
1613
|
+
}, this.mount = () => (this.registerOnGraph(), this.checkIfRecalculationNeededDeeply(), () => {
|
|
1614
|
+
this.unregisterFromGraph();
|
|
1615
|
+
for (const a of this._subscriptions)
|
|
1616
|
+
a();
|
|
1617
|
+
}), this.subscribe = (a) => {
|
|
1618
|
+
var f, p;
|
|
1619
|
+
this.listeners.add(a);
|
|
1620
|
+
const m = (p = (f = this.options).onSubscribe) == null ? void 0 : p.call(f, a, this);
|
|
1621
|
+
return () => {
|
|
1622
|
+
this.listeners.delete(a), m?.();
|
|
1623
|
+
};
|
|
1624
|
+
}, this.options = o, this.state = o.fn({
|
|
1625
|
+
prevDepVals: void 0,
|
|
1626
|
+
prevVal: void 0,
|
|
1627
|
+
currDepVals: this.getDepVals().currDepVals
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
registerOnGraph(o = this.options.deps) {
|
|
1631
|
+
for (const a of o)
|
|
1632
|
+
if (a instanceof ne)
|
|
1633
|
+
a.registerOnGraph(), this.registerOnGraph(a.options.deps);
|
|
1634
|
+
else if (a instanceof Ce) {
|
|
1635
|
+
let f = ie.get(a);
|
|
1636
|
+
f || (f = /* @__PURE__ */ new Set(), ie.set(a, f)), f.add(this);
|
|
1637
|
+
let p = be.get(this);
|
|
1638
|
+
p || (p = /* @__PURE__ */ new Set(), be.set(this, p)), p.add(a);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
unregisterFromGraph(o = this.options.deps) {
|
|
1642
|
+
for (const a of o)
|
|
1643
|
+
if (a instanceof ne)
|
|
1644
|
+
this.unregisterFromGraph(a.options.deps);
|
|
1645
|
+
else if (a instanceof Ce) {
|
|
1646
|
+
const f = ie.get(a);
|
|
1647
|
+
f && f.delete(this);
|
|
1648
|
+
const p = be.get(this);
|
|
1649
|
+
p && p.delete(a);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
const ke = "Authorization", Ke = () => ({
|
|
1654
|
+
user: {
|
|
1655
|
+
id: null,
|
|
1656
|
+
email: null,
|
|
1657
|
+
roles: [],
|
|
1658
|
+
is_enabled: !1,
|
|
1659
|
+
is_active: !1
|
|
1660
|
+
},
|
|
1661
|
+
isAuthenticated: !1,
|
|
1662
|
+
isLoaded: !1
|
|
1663
|
+
}), re = new Ce(Ke()), ht = new ne({
|
|
1664
|
+
fn: () => !!re.state.user?.roles.find((b) => b.name === "admin"),
|
|
1665
|
+
deps: [re]
|
|
1666
|
+
});
|
|
1667
|
+
class _t {
|
|
1668
|
+
accountStore;
|
|
1669
|
+
httpClient;
|
|
1670
|
+
constructor(o) {
|
|
1671
|
+
this.httpClient = o, this.accountStore = re;
|
|
1672
|
+
}
|
|
1673
|
+
initAuthData() {
|
|
1674
|
+
const o = localStorage.getItem("token");
|
|
1675
|
+
o && (this.httpClient.defaults.headers.common[ke] = o);
|
|
1676
|
+
}
|
|
1677
|
+
async load() {
|
|
1678
|
+
try {
|
|
1679
|
+
const { data: o } = await this.httpClient.get("/api/auth/account/me");
|
|
1680
|
+
re.setState(() => ({
|
|
1681
|
+
user: o,
|
|
1682
|
+
isAuthenticated: !0,
|
|
1683
|
+
isLoaded: !0
|
|
1684
|
+
}));
|
|
1685
|
+
} catch {
|
|
1686
|
+
re.setState((o) => ({
|
|
1687
|
+
...o,
|
|
1688
|
+
isLoaded: !0
|
|
1689
|
+
}));
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
async login(o) {
|
|
1693
|
+
const a = await this.httpClient.post("/api/auth/account/login", o), { user: f, access_token: p } = a.data;
|
|
1694
|
+
return f.is_active && this._initUserData({ user: f, access_token: p }), f;
|
|
1695
|
+
}
|
|
1696
|
+
register(o) {
|
|
1697
|
+
return this.httpClient.post("/api/auth/account/register", o);
|
|
1698
|
+
}
|
|
1699
|
+
async activate(o) {
|
|
1700
|
+
const a = await this.httpClient.post("/api/auth/account/activate", o);
|
|
1701
|
+
this._initUserData(a.data);
|
|
1702
|
+
}
|
|
1703
|
+
logout() {
|
|
1704
|
+
re.setState(() => ({ ...Ke(), isLoaded: !0 })), this._clearAuthData();
|
|
1705
|
+
}
|
|
1706
|
+
startResetPassword(o) {
|
|
1707
|
+
return this.httpClient.post("/api/auth/account/start-reset-password", o);
|
|
1708
|
+
}
|
|
1709
|
+
async resetPassword(o) {
|
|
1710
|
+
const a = await this.httpClient.post("/api/auth/account/reset-password", o);
|
|
1711
|
+
this._initUserData(a.data);
|
|
1712
|
+
}
|
|
1713
|
+
_initUserData({ user: o, access_token: a }) {
|
|
1714
|
+
this._setAuthData(a), re.setState(() => ({
|
|
1715
|
+
user: o,
|
|
1716
|
+
isAuthenticated: !0,
|
|
1717
|
+
isLoaded: !0
|
|
1718
|
+
}));
|
|
1719
|
+
}
|
|
1720
|
+
_setAuthData(o) {
|
|
1721
|
+
localStorage.setItem("token", o), this.httpClient.defaults.headers.common[ke] = o;
|
|
1722
|
+
}
|
|
1723
|
+
_clearAuthData() {
|
|
1724
|
+
localStorage.removeItem("token"), delete this.httpClient.defaults.headers.common[ke];
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1729
1727
|
export {
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1728
|
+
_t as Auth,
|
|
1729
|
+
dt as LoginForm,
|
|
1730
|
+
ht as isAdmin
|
|
1733
1731
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(W
|
|
1
|
+
(function(W,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(W=typeof globalThis<"u"?globalThis:W||self,q(W.auth={}))})(this,(function(W){"use strict";var q={exports:{}},le={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Pe;function Je(){if(Pe)return le;Pe=1;var b=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function a(f,p,m){var A=null;if(m!==void 0&&(A=""+m),p.key!==void 0&&(A=""+p.key),"key"in p){m={};for(var D in p)D!=="key"&&(m[D]=p[D])}else m=p;return p=m.ref,{$$typeof:b,type:f,key:A,ref:p!==void 0?p:null,props:m}}return le.Fragment=o,le.jsx=a,le.jsxs=a,le}var pe={},ve={exports:{}},_={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Ne;function et(){if(Ne)return _;Ne=1;var b=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),A=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),ie=Symbol.for("react.suspense"),z=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),G=Symbol.iterator;function H(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var F={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},te=Object.assign,B={};function Y(t,n,i){this.props=t,this.context=n,this.refs=B,this.updater=i||F}Y.prototype.isReactComponent={},Y.prototype.setState=function(t,n){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,n,"setState")},Y.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Q(){}Q.prototype=Y.prototype;function re(t,n,i){this.props=t,this.context=n,this.refs=B,this.updater=i||F}var P=re.prototype=new Q;P.constructor=re,te(P,Y.prototype),P.isPureReactComponent=!0;var ce=Array.isArray,T={H:null,A:null,T:null,S:null,V:null},ne=Object.prototype.hasOwnProperty;function oe(t,n,i,c,d,w){return i=w.ref,{$$typeof:b,type:t,key:n,ref:i!==void 0?i:null,props:w}}function L(t,n){return oe(t.type,n,void 0,void 0,void 0,t.props)}function U(t){return typeof t=="object"&&t!==null&&t.$$typeof===b}function he(t){var n={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(i){return n[i]})}var O=/\/+/g;function X(t,n){return typeof t=="object"&&t!==null&&t.key!=null?he(""+t.key):n.toString(36)}function V(){}function M(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(V,V):(t.status="pending",t.then(function(n){t.status==="pending"&&(t.status="fulfilled",t.value=n)},function(n){t.status==="pending"&&(t.status="rejected",t.reason=n)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function k(t,n,i,c,d){var w=typeof t;(w==="undefined"||w==="boolean")&&(t=null);var h=!1;if(t===null)h=!0;else switch(w){case"bigint":case"string":case"number":h=!0;break;case"object":switch(t.$$typeof){case b:case o:h=!0;break;case $:return h=t._init,k(h(t._payload),n,i,c,d)}}if(h)return d=d(t),h=c===""?"."+X(t,0):c,ce(d)?(i="",h!=null&&(i=h.replace(O,"$&/")+"/"),k(d,n,i,"",function(j){return j})):d!=null&&(U(d)&&(d=L(d,i+(d.key==null||t&&t.key===d.key?"":(""+d.key).replace(O,"$&/")+"/")+h)),n.push(d)),1;h=0;var C=c===""?".":c+":";if(ce(t))for(var v=0;v<t.length;v++)c=t[v],w=C+X(c,v),h+=k(c,n,i,w,d);else if(v=H(t),typeof v=="function")for(t=v.call(t),v=0;!(c=t.next()).done;)c=c.value,w=C+X(c,v++),h+=k(c,n,i,w,d);else if(w==="object"){if(typeof t.then=="function")return k(M(t),n,i,c,d);throw n=String(t),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return h}function I(t,n,i){if(t==null)return t;var c=[],d=0;return k(t,c,"","",function(w){return n.call(i,w,d++)}),c}function K(t){if(t._status===-1){var n=t._result;n=n(),n.then(function(i){(t._status===0||t._status===-1)&&(t._status=1,t._result=i)},function(i){(t._status===0||t._status===-1)&&(t._status=2,t._result=i)}),t._status===-1&&(t._status=0,t._result=n)}if(t._status===1)return t._result.default;throw t._result}var x=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function se(){}return _.Children={map:I,forEach:function(t,n,i){I(t,function(){n.apply(this,arguments)},i)},count:function(t){var n=0;return I(t,function(){n++}),n},toArray:function(t){return I(t,function(n){return n})||[]},only:function(t){if(!U(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},_.Component=Y,_.Fragment=a,_.Profiler=p,_.PureComponent=re,_.StrictMode=f,_.Suspense=ie,_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,_.__COMPILER_RUNTIME={__proto__:null,c:function(t){return T.H.useMemoCache(t)}},_.cache=function(t){return function(){return t.apply(null,arguments)}},_.cloneElement=function(t,n,i){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var c=te({},t.props),d=t.key,w=void 0;if(n!=null)for(h in n.ref!==void 0&&(w=void 0),n.key!==void 0&&(d=""+n.key),n)!ne.call(n,h)||h==="key"||h==="__self"||h==="__source"||h==="ref"&&n.ref===void 0||(c[h]=n[h]);var h=arguments.length-2;if(h===1)c.children=i;else if(1<h){for(var C=Array(h),v=0;v<h;v++)C[v]=arguments[v+2];c.children=C}return oe(t.type,d,void 0,void 0,w,c)},_.createContext=function(t){return t={$$typeof:A,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:m,_context:t},t},_.createElement=function(t,n,i){var c,d={},w=null;if(n!=null)for(c in n.key!==void 0&&(w=""+n.key),n)ne.call(n,c)&&c!=="key"&&c!=="__self"&&c!=="__source"&&(d[c]=n[c]);var h=arguments.length-2;if(h===1)d.children=i;else if(1<h){for(var C=Array(h),v=0;v<h;v++)C[v]=arguments[v+2];d.children=C}if(t&&t.defaultProps)for(c in h=t.defaultProps,h)d[c]===void 0&&(d[c]=h[c]);return oe(t,w,void 0,void 0,null,d)},_.createRef=function(){return{current:null}},_.forwardRef=function(t){return{$$typeof:D,render:t}},_.isValidElement=U,_.lazy=function(t){return{$$typeof:$,_payload:{_status:-1,_result:t},_init:K}},_.memo=function(t,n){return{$$typeof:z,type:t,compare:n===void 0?null:n}},_.startTransition=function(t){var n=T.T,i={};T.T=i;try{var c=t(),d=T.S;d!==null&&d(i,c),typeof c=="object"&&c!==null&&typeof c.then=="function"&&c.then(se,x)}catch(w){x(w)}finally{T.T=n}},_.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},_.use=function(t){return T.H.use(t)},_.useActionState=function(t,n,i){return T.H.useActionState(t,n,i)},_.useCallback=function(t,n){return T.H.useCallback(t,n)},_.useContext=function(t){return T.H.useContext(t)},_.useDebugValue=function(){},_.useDeferredValue=function(t,n){return T.H.useDeferredValue(t,n)},_.useEffect=function(t,n,i){var c=T.H;if(typeof i=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return c.useEffect(t,n)},_.useId=function(){return T.H.useId()},_.useImperativeHandle=function(t,n,i){return T.H.useImperativeHandle(t,n,i)},_.useInsertionEffect=function(t,n){return T.H.useInsertionEffect(t,n)},_.useLayoutEffect=function(t,n){return T.H.useLayoutEffect(t,n)},_.useMemo=function(t,n){return T.H.useMemo(t,n)},_.useOptimistic=function(t,n){return T.H.useOptimistic(t,n)},_.useReducer=function(t,n,i){return T.H.useReducer(t,n,i)},_.useRef=function(t){return T.H.useRef(t)},_.useState=function(t){return T.H.useState(t)},_.useSyncExternalStore=function(t,n,i){return T.H.useSyncExternalStore(t,n,i)},_.useTransition=function(){return T.H.useTransition()},_.version="19.1.1",_}var de={exports:{}};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* react.development.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/
|
|
25
|
+
*/de.exports;var De;function tt(){return De||(De=1,(function(b,o){process.env.NODE_ENV!=="production"&&(function(){function a(e,r){Object.defineProperty(m.prototype,e,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",r[0],r[1])}})}function f(e){return e===null||typeof e!="object"?null:(e=ge&&e[ge]||e["@@iterator"],typeof e=="function"?e:null)}function p(e,r){e=(e=e.constructor)&&(e.displayName||e.name)||"ReactClass";var s=e+"."+r;He[s]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",r,e),He[s]=!0)}function m(e,r,s){this.props=e,this.context=r,this.refs=Ce,this.updater=s||Ve}function A(){}function D(e,r,s){this.props=e,this.context=r,this.refs=Ce,this.updater=s||Ve}function ie(e){return""+e}function z(e){try{ie(e);var r=!1}catch{r=!0}if(r){r=console;var s=r.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),ie(e)}}function $(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case t:return"Fragment";case i:return"Profiler";case n:return"StrictMode";case h:return"Suspense";case C:return"SuspenseList";case _e:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case se:return"Portal";case d:return(e.displayName||"Context")+".Provider";case c:return(e._context.displayName||"Context")+".Consumer";case w:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case v:return r=e.displayName||null,r!==null?r:$(e.type)||"Memo";case j:r=e._payload,e=e._init;try{return $(e(r))}catch{}}return null}function G(e){if(e===t)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var r=$(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function H(){var e=g.A;return e===null?null:e.getOwner()}function F(){return Error("react-stack-top-frame")}function te(e){if(we.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function B(e,r){function s(){ze||(ze=!0,console.error("%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://react.dev/link/special-props)",r))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function Y(){var e=$(this.type);return Fe[e]||(Fe[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Q(e,r,s,u,l,R,E,S){return s=R.ref,e={$$typeof:x,type:e,key:r,props:R,_owner:l},(s!==void 0?s:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:Y}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:E}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function re(e,r){return r=Q(e.type,r,void 0,void 0,e._owner,e.props,e._debugStack,e._debugTask),e._store&&(r._store.validated=e._store.validated),r}function P(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}function ce(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(s){return r[s]})}function T(e,r){return typeof e=="object"&&e!==null&&e.key!=null?(z(e.key),ce(""+e.key)):r.toString(36)}function ne(){}function oe(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ne,ne):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function L(e,r,s,u,l){var R=typeof e;(R==="undefined"||R==="boolean")&&(e=null);var E=!1;if(e===null)E=!0;else switch(R){case"bigint":case"string":case"number":E=!0;break;case"object":switch(e.$$typeof){case x:case se:E=!0;break;case j:return E=e._init,L(E(e._payload),r,s,u,l)}}if(E){E=e,l=l(E);var S=u===""?"."+T(E,0):u;return We(l)?(s="",S!=null&&(s=S.replace(Qe,"$&/")+"/"),L(l,r,s,"",function(Z){return Z})):l!=null&&(P(l)&&(l.key!=null&&(E&&E.key===l.key||z(l.key)),s=re(l,s+(l.key==null||E&&E.key===l.key?"":(""+l.key).replace(Qe,"$&/")+"/")+S),u!==""&&E!=null&&P(E)&&E.key==null&&E._store&&!E._store.validated&&(s._store.validated=2),l=s),r.push(l)),1}if(E=0,S=u===""?".":u+":",We(e))for(var y=0;y<e.length;y++)u=e[y],R=S+T(u,y),E+=L(u,r,s,R,l);else if(y=f(e),typeof y=="function")for(y===e.entries&&(Be||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Be=!0),e=y.call(e),y=0;!(u=e.next()).done;)u=u.value,R=S+T(u,y++),E+=L(u,r,s,R,l);else if(R==="object"){if(typeof e.then=="function")return L(oe(e),r,s,u,l);throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return E}function U(e,r,s){if(e==null)return e;var u=[],l=0;return L(e,u,"","",function(R){return r.call(s,R,l++)}),u}function he(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(s){(e._status===0||e._status===-1)&&(e._status=1,e._result=s)},function(s){(e._status===0||e._status===-1)&&(e._status=2,e._result=s)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return r=e._result,r===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
26
26
|
|
|
27
27
|
Your code should look like:
|
|
28
28
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -34,7 +34,7 @@ Your code should look like:
|
|
|
34
34
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
35
35
|
2. You might be breaking the Rules of Hooks
|
|
36
36
|
3. You might have more than one copy of React in the same app
|
|
37
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function X(){}function x(e){if(be===null)try{var r=("require"+Math.random()).slice(0,7);be=(b&&b[r]).call(b,"timers").setImmediate}catch{be=function(u){Ke===!1&&(Ke=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var l=new MessageChannel;l.port1.onmessage=u,l.port2.postMessage(void 0)}}return be(e)}function M(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function k(e,r){r!==Te-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Te=r}function I(e,r,s){var u=g.actQueue;if(u!==null)if(u.length!==0)try{K(u),x(function(){return I(e,r,s)});return}catch(l){g.thrownErrors.push(l)}else g.actQueue=null;0<g.thrownErrors.length?(u=M(g.thrownErrors),g.thrownErrors.length=0,s(u)):r(e)}function K(e){if(!je){je=!0;var r=0;try{for(;r<e.length;r++){var s=e[r];do{g.didUsePromise=!1;var u=s(!1);if(u!==null){if(g.didUsePromise){e[r]=s,e.splice(0,r);return}s=u}else break}while(!0)}e.length=0}catch(l){e.splice(0,r+1),g.thrownErrors.push(l)}finally{je=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var q=Symbol.for("react.transitional.element"),se=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),ge=Symbol.iterator,He={},Ve={isMounted:function(){return!1},enqueueForceUpdate:function(e){p(e,"forceUpdate")},enqueueReplaceState:function(e){p(e,"replaceState")},enqueueSetState:function(e){p(e,"setState")}},xe=Object.assign,Ce={};Object.freeze(Ce),v.prototype.isReactComponent={},v.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var N={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Re;for(Re in N)N.hasOwnProperty(Re)&&a(Re,N[Re]);A.prototype=v.prototype,N=D.prototype=new A,N.constructor=D,xe(N,v.prototype),N.isPureReactComponent=!0;var qe=Array.isArray,pt=Symbol.for("react.client.reference"),g={H:null,A:null,T:null,S:null,V:null,actQueue:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},we=Object.prototype.hasOwnProperty,We=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(e){return e()}};var ze,Ge,Fe={},dt=N.react_stack_bottom_frame.bind(N,F)(),ht=We(G(F)),Be=!1,Qe=/\/+/g,Xe=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ke=!1,be=null,Te=0,Se=!1,je=!1,Ze=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:x;N=Object.freeze({__proto__:null,c:function(e){return O().useMemoCache(e)}}),o.Children={map:H,forEach:function(e,r,s){H(e,function(){r.apply(this,arguments)},s)},count:function(e){var r=0;return H(e,function(){r++}),r},toArray:function(e){return H(e,function(r){return r})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},o.Component=v,o.Fragment=t,o.Profiler=i,o.PureComponent=D,o.StrictMode=n,o.Suspense=h,o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=g,o.__COMPILER_RUNTIME=N,o.act=function(e){var r=g.actQueue,s=Te;Te++;var u=g.actQueue=r!==null?r:[],l=!1;try{var R=e()}catch(y){g.thrownErrors.push(y)}if(0<g.thrownErrors.length)throw k(r,s),e=M(g.thrownErrors),g.thrownErrors.length=0,e;if(R!==null&&typeof R=="object"&&typeof R.then=="function"){var E=R;return Ze(function(){l||Se||(Se=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(y,Z){l=!0,E.then(function(ce){if(k(r,s),s===0){try{K(u),x(function(){return I(ce,y,Z)})}catch(mt){g.thrownErrors.push(mt)}if(0<g.thrownErrors.length){var _t=M(g.thrownErrors);g.thrownErrors.length=0,Z(_t)}}else y(ce)},function(ce){k(r,s),0<g.thrownErrors.length&&(ce=M(g.thrownErrors),g.thrownErrors.length=0),Z(ce)})}}}var S=R;if(k(r,s),s===0&&(K(u),u.length!==0&&Ze(function(){l||Se||(Se=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),g.actQueue=null),0<g.thrownErrors.length)throw e=M(g.thrownErrors),g.thrownErrors.length=0,e;return{then:function(y,Z){l=!0,s===0?(g.actQueue=u,x(function(){return I(S,y,Z)})):y(S)}}},o.cache=function(e){return function(){return e.apply(null,arguments)}},o.captureOwnerStack=function(){var e=g.getCurrentStack;return e===null?null:e()},o.cloneElement=function(e,r,s){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var u=xe({},e.props),l=e.key,R=e._owner;if(r!=null){var E;e:{if(we.call(r,"ref")&&(E=Object.getOwnPropertyDescriptor(r,"ref").get)&&E.isReactWarning){E=!1;break e}E=r.ref!==void 0}E&&(R=V()),te(r)&&(z(r.key),l=""+r.key);for(S in r)!we.call(r,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&r.ref===void 0||(u[S]=r[S])}var S=arguments.length-2;if(S===1)u.children=s;else if(1<S){E=Array(S);for(var y=0;y<S;y++)E[y]=arguments[y+2];u.children=E}for(u=Q(e.type,l,void 0,void 0,R,u,e._debugStack,e._debugTask),l=2;l<arguments.length;l++)R=arguments[l],P(R)&&R._store&&(R._store.validated=1);return u},o.createContext=function(e){return e={$$typeof:d,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:c,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},o.createElement=function(e,r,s){for(var u=2;u<arguments.length;u++){var l=arguments[u];P(l)&&l._store&&(l._store.validated=1)}if(u={},l=null,r!=null)for(y in Ge||!("__self"in r)||"key"in r||(Ge=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),te(r)&&(z(r.key),l=""+r.key),r)we.call(r,y)&&y!=="key"&&y!=="__self"&&y!=="__source"&&(u[y]=r[y]);var R=arguments.length-2;if(R===1)u.children=s;else if(1<R){for(var E=Array(R),S=0;S<R;S++)E[S]=arguments[S+2];Object.freeze&&Object.freeze(E),u.children=E}if(e&&e.defaultProps)for(y in R=e.defaultProps,R)u[y]===void 0&&(u[y]=R[y]);l&&B(u,typeof e=="function"?e.displayName||e.name||"Unknown":e);var y=1e4>g.recentlyCreatedOwnerStacks++;return Q(e,l,void 0,void 0,V(),u,y?Error("react-stack-top-frame"):dt,y?We(G(e)):ht)},o.createRef=function(){var e={current:null};return Object.seal(e),e},o.forwardRef=function(e){e!=null&&e.$$typeof===m?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var r={$$typeof:w,render:e},s;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(u){s=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},o.isValidElement=P,o.lazy=function(e){return{$$typeof:j,_payload:{_status:-1,_result:e},_init:de}},o.memo=function(e,r){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),r={$$typeof:m,type:e,compare:r===void 0?null:r};var s;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(u){s=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},o.startTransition=function(e){var r=g.T,s={};g.T=s,s._updatedFibers=new Set;try{var u=e(),l=g.S;l!==null&&l(s,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&u.then(X,Xe)}catch(R){Xe(R)}finally{r===null&&s._updatedFibers&&(e=s._updatedFibers.size,s._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),g.T=r}},o.unstable_useCacheRefresh=function(){return O().useCacheRefresh()},o.use=function(e){return O().use(e)},o.useActionState=function(e,r,s){return O().useActionState(e,r,s)},o.useCallback=function(e,r){return O().useCallback(e,r)},o.useContext=function(e){var r=O();return e.$$typeof===c&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),r.useContext(e)},o.useDebugValue=function(e,r){return O().useDebugValue(e,r)},o.useDeferredValue=function(e,r){return O().useDeferredValue(e,r)},o.useEffect=function(e,r,s){e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");var u=O();if(typeof s=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return u.useEffect(e,r)},o.useId=function(){return O().useId()},o.useImperativeHandle=function(e,r,s){return O().useImperativeHandle(e,r,s)},o.useInsertionEffect=function(e,r){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),O().useInsertionEffect(e,r)},o.useLayoutEffect=function(e,r){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),O().useLayoutEffect(e,r)},o.useMemo=function(e,r){return O().useMemo(e,r)},o.useOptimistic=function(e,r){return O().useOptimistic(e,r)},o.useReducer=function(e,r,s){return O().useReducer(e,r,s)},o.useRef=function(e){return O().useRef(e)},o.useState=function(e){return O().useState(e)},o.useSyncExternalStore=function(e,r,s){return O().useSyncExternalStore(e,r,s)},o.useTransition=function(){return O().useTransition()},o.version="19.1.1",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})(pe,pe.exports)),pe.exports}var $e;function it(){return $e||($e=1,process.env.NODE_ENV==="production"?ye.exports=ut():ye.exports=at()),ye.exports}/**
|
|
37
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function X(){}function V(e){if(be===null)try{var r=("require"+Math.random()).slice(0,7);be=(b&&b[r]).call(b,"timers").setImmediate}catch{be=function(u){Ke===!1&&(Ke=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var l=new MessageChannel;l.port1.onmessage=u,l.port2.postMessage(void 0)}}return be(e)}function M(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function k(e,r){r!==Te-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Te=r}function I(e,r,s){var u=g.actQueue;if(u!==null)if(u.length!==0)try{K(u),V(function(){return I(e,r,s)});return}catch(l){g.thrownErrors.push(l)}else g.actQueue=null;0<g.thrownErrors.length?(u=M(g.thrownErrors),g.thrownErrors.length=0,s(u)):r(e)}function K(e){if(!je){je=!0;var r=0;try{for(;r<e.length;r++){var s=e[r];do{g.didUsePromise=!1;var u=s(!1);if(u!==null){if(g.didUsePromise){e[r]=s,e.splice(0,r);return}s=u}else break}while(!0)}e.length=0}catch(l){e.splice(0,r+1),g.thrownErrors.push(l)}finally{je=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var x=Symbol.for("react.transitional.element"),se=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),_e=Symbol.for("react.activity"),ge=Symbol.iterator,He={},Ve={isMounted:function(){return!1},enqueueForceUpdate:function(e){p(e,"forceUpdate")},enqueueReplaceState:function(e){p(e,"replaceState")},enqueueSetState:function(e){p(e,"setState")}},xe=Object.assign,Ce={};Object.freeze(Ce),m.prototype.isReactComponent={},m.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var N={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Re;for(Re in N)N.hasOwnProperty(Re)&&a(Re,N[Re]);A.prototype=m.prototype,N=D.prototype=new A,N.constructor=D,xe(N,m.prototype),N.isPureReactComponent=!0;var We=Array.isArray,pt=Symbol.for("react.client.reference"),g={H:null,A:null,T:null,S:null,V:null,actQueue:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},we=Object.prototype.hasOwnProperty,qe=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(e){return e()}};var ze,Ge,Fe={},dt=N.react_stack_bottom_frame.bind(N,F)(),ht=qe(G(F)),Be=!1,Qe=/\/+/g,Xe=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ke=!1,be=null,Te=0,Se=!1,je=!1,Ze=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:V;N=Object.freeze({__proto__:null,c:function(e){return O().useMemoCache(e)}}),o.Children={map:U,forEach:function(e,r,s){U(e,function(){r.apply(this,arguments)},s)},count:function(e){var r=0;return U(e,function(){r++}),r},toArray:function(e){return U(e,function(r){return r})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},o.Component=m,o.Fragment=t,o.Profiler=i,o.PureComponent=D,o.StrictMode=n,o.Suspense=h,o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=g,o.__COMPILER_RUNTIME=N,o.act=function(e){var r=g.actQueue,s=Te;Te++;var u=g.actQueue=r!==null?r:[],l=!1;try{var R=e()}catch(y){g.thrownErrors.push(y)}if(0<g.thrownErrors.length)throw k(r,s),e=M(g.thrownErrors),g.thrownErrors.length=0,e;if(R!==null&&typeof R=="object"&&typeof R.then=="function"){var E=R;return Ze(function(){l||Se||(Se=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(y,Z){l=!0,E.then(function(fe){if(k(r,s),s===0){try{K(u),V(function(){return I(fe,y,Z)})}catch(vt){g.thrownErrors.push(vt)}if(0<g.thrownErrors.length){var _t=M(g.thrownErrors);g.thrownErrors.length=0,Z(_t)}}else y(fe)},function(fe){k(r,s),0<g.thrownErrors.length&&(fe=M(g.thrownErrors),g.thrownErrors.length=0),Z(fe)})}}}var S=R;if(k(r,s),s===0&&(K(u),u.length!==0&&Ze(function(){l||Se||(Se=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),g.actQueue=null),0<g.thrownErrors.length)throw e=M(g.thrownErrors),g.thrownErrors.length=0,e;return{then:function(y,Z){l=!0,s===0?(g.actQueue=u,V(function(){return I(S,y,Z)})):y(S)}}},o.cache=function(e){return function(){return e.apply(null,arguments)}},o.captureOwnerStack=function(){var e=g.getCurrentStack;return e===null?null:e()},o.cloneElement=function(e,r,s){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var u=xe({},e.props),l=e.key,R=e._owner;if(r!=null){var E;e:{if(we.call(r,"ref")&&(E=Object.getOwnPropertyDescriptor(r,"ref").get)&&E.isReactWarning){E=!1;break e}E=r.ref!==void 0}E&&(R=H()),te(r)&&(z(r.key),l=""+r.key);for(S in r)!we.call(r,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&r.ref===void 0||(u[S]=r[S])}var S=arguments.length-2;if(S===1)u.children=s;else if(1<S){E=Array(S);for(var y=0;y<S;y++)E[y]=arguments[y+2];u.children=E}for(u=Q(e.type,l,void 0,void 0,R,u,e._debugStack,e._debugTask),l=2;l<arguments.length;l++)R=arguments[l],P(R)&&R._store&&(R._store.validated=1);return u},o.createContext=function(e){return e={$$typeof:d,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:c,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},o.createElement=function(e,r,s){for(var u=2;u<arguments.length;u++){var l=arguments[u];P(l)&&l._store&&(l._store.validated=1)}if(u={},l=null,r!=null)for(y in Ge||!("__self"in r)||"key"in r||(Ge=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),te(r)&&(z(r.key),l=""+r.key),r)we.call(r,y)&&y!=="key"&&y!=="__self"&&y!=="__source"&&(u[y]=r[y]);var R=arguments.length-2;if(R===1)u.children=s;else if(1<R){for(var E=Array(R),S=0;S<R;S++)E[S]=arguments[S+2];Object.freeze&&Object.freeze(E),u.children=E}if(e&&e.defaultProps)for(y in R=e.defaultProps,R)u[y]===void 0&&(u[y]=R[y]);l&&B(u,typeof e=="function"?e.displayName||e.name||"Unknown":e);var y=1e4>g.recentlyCreatedOwnerStacks++;return Q(e,l,void 0,void 0,H(),u,y?Error("react-stack-top-frame"):dt,y?qe(G(e)):ht)},o.createRef=function(){var e={current:null};return Object.seal(e),e},o.forwardRef=function(e){e!=null&&e.$$typeof===v?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var r={$$typeof:w,render:e},s;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(u){s=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},o.isValidElement=P,o.lazy=function(e){return{$$typeof:j,_payload:{_status:-1,_result:e},_init:he}},o.memo=function(e,r){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),r={$$typeof:v,type:e,compare:r===void 0?null:r};var s;return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(u){s=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),r},o.startTransition=function(e){var r=g.T,s={};g.T=s,s._updatedFibers=new Set;try{var u=e(),l=g.S;l!==null&&l(s,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&u.then(X,Xe)}catch(R){Xe(R)}finally{r===null&&s._updatedFibers&&(e=s._updatedFibers.size,s._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),g.T=r}},o.unstable_useCacheRefresh=function(){return O().useCacheRefresh()},o.use=function(e){return O().use(e)},o.useActionState=function(e,r,s){return O().useActionState(e,r,s)},o.useCallback=function(e,r){return O().useCallback(e,r)},o.useContext=function(e){var r=O();return e.$$typeof===c&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),r.useContext(e)},o.useDebugValue=function(e,r){return O().useDebugValue(e,r)},o.useDeferredValue=function(e,r){return O().useDeferredValue(e,r)},o.useEffect=function(e,r,s){e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");var u=O();if(typeof s=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return u.useEffect(e,r)},o.useId=function(){return O().useId()},o.useImperativeHandle=function(e,r,s){return O().useImperativeHandle(e,r,s)},o.useInsertionEffect=function(e,r){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),O().useInsertionEffect(e,r)},o.useLayoutEffect=function(e,r){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),O().useLayoutEffect(e,r)},o.useMemo=function(e,r){return O().useMemo(e,r)},o.useOptimistic=function(e,r){return O().useOptimistic(e,r)},o.useReducer=function(e,r,s){return O().useReducer(e,r,s)},o.useRef=function(e){return O().useRef(e)},o.useState=function(e){return O().useState(e)},o.useSyncExternalStore=function(e,r,s){return O().useSyncExternalStore(e,r,s)},o.useTransition=function(){return O().useTransition()},o.version="19.1.1",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})(de,de.exports)),de.exports}var Le;function rt(){return Le||(Le=1,process.env.NODE_ENV==="production"?ve.exports=et():ve.exports=tt()),ve.exports}/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-jsx-runtime.development.js
|
|
40
40
|
*
|
|
@@ -42,9 +42,9 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var
|
|
45
|
+
*/var Me;function nt(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&(function(){function b(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case B:return"Fragment";case Q:return"Profiler";case Y:return"StrictMode";case T:return"Suspense";case ne:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case te:return"Portal";case P:return(t.displayName||"Context")+".Provider";case re:return(t._context.displayName||"Context")+".Consumer";case ce:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case oe:return n=t.displayName||null,n!==null?n:b(t.type)||"Memo";case L:n=t._payload,t=t._init;try{return b(t(n))}catch{}}return null}function o(t){return""+t}function a(t){try{o(t);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),o(t)}}function f(t){if(t===B)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===L)return"<...>";try{var n=b(t);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function p(){var t=O.A;return t===null?null:t.getOwner()}function m(){return Error("react-stack-top-frame")}function A(t){if(X.call(t,"key")){var n=Object.getOwnPropertyDescriptor(t,"key").get;if(n&&n.isReactWarning)return!1}return t.key!==void 0}function D(t,n){function i(){k||(k=!0,console.error("%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://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(t,"key",{get:i,configurable:!0})}function ie(){var t=b(this.type);return I[t]||(I[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function z(t,n,i,c,d,w,h,C){return i=w.ref,t={$$typeof:F,type:t,key:n,props:w,_owner:d},(i!==void 0?i:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:ie}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:h}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function $(t,n,i,c,d,w,h,C){var v=n.children;if(v!==void 0)if(c)if(V(v)){for(c=0;c<v.length;c++)G(v[c]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else G(v);if(X.call(n,"key")){v=b(t);var j=Object.keys(n).filter(function(ge){return ge!=="key"});c=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",se[v+c]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
46
46
|
let props = %s;
|
|
47
47
|
<%s {...props} />
|
|
48
48
|
React keys must be passed directly to JSX without using spread:
|
|
49
49
|
let props = %s;
|
|
50
|
-
<%s key={someKey} {...props} />`,c,
|
|
50
|
+
<%s key={someKey} {...props} />`,c,v,j,v),se[v+c]=!0)}if(v=null,i!==void 0&&(a(i),v=""+i),A(n)&&(a(n.key),v=""+n.key),"key"in n){i={};for(var _e in n)_e!=="key"&&(i[_e]=n[_e])}else i=n;return v&&D(i,typeof t=="function"?t.displayName||t.name||"Unknown":t),z(t,v,w,d,p(),i,h,C)}function G(t){typeof t=="object"&&t!==null&&t.$$typeof===F&&t._store&&(t._store.validated=1)}var H=rt(),F=Symbol.for("react.transitional.element"),te=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),P=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),oe=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),he=Symbol.for("react.client.reference"),O=H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,V=Array.isArray,M=console.createTask?console.createTask:function(){return null};H={react_stack_bottom_frame:function(t){return t()}};var k,I={},K=H.react_stack_bottom_frame.bind(H,m)(),x=M(f(m)),se={};pe.Fragment=B,pe.jsx=function(t,n,i,c,d){var w=1e4>O.recentlyCreatedOwnerStacks++;return $(t,n,i,!1,c,d,w?Error("react-stack-top-frame"):K,w?M(f(t)):x)},pe.jsxs=function(t,n,i,c,d){var w=1e4>O.recentlyCreatedOwnerStacks++;return $(t,n,i,!0,c,d,w?Error("react-stack-top-frame"):K,w?M(f(t)):x)}})()),pe}var Ie;function ot(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?q.exports=Je():q.exports=nt()),q.exports}var ue=ot();function st(){return ue.jsxs("form",{children:[ue.jsx("div",{children:ue.jsx("input",{type:"email"})}),ue.jsx("div",{children:ue.jsx("input",{type:"password"})}),ue.jsx("button",{type:"submit"})]})}const ae=new WeakMap,me=new WeakMap,Ee={current:[]};let Oe=!1;const ye=new Set,$e=new Map;function Ye(b){const o=Array.from(b).sort((a,f)=>a instanceof J&&a.options.deps.includes(f)?1:f instanceof J&&f.options.deps.includes(a)?-1:0);for(const a of o){if(Ee.current.includes(a))continue;Ee.current.push(a),a.recompute();const f=me.get(a);if(f)for(const p of f){const m=ae.get(p);m&&Ye(m)}}}function ut(b){b.listeners.forEach(o=>o({prevVal:b.prevState,currentVal:b.state}))}function at(b){b.listeners.forEach(o=>o({prevVal:b.prevState,currentVal:b.state}))}function it(b){if(ye.add(b),!Oe)try{for(Oe=!0;ye.size>0;){const o=Array.from(ye);ye.clear();for(const a of o){const f=$e.get(a)??a.prevState;a.prevState=f,ut(a)}for(const a of o){const f=ae.get(a);f&&(Ee.current.push(a),Ye(f))}for(const a of o){const f=ae.get(a);if(f)for(const p of f)at(p)}}}finally{Oe=!1,Ee.current=[],$e.clear()}}function ct(b){return typeof b=="function"}class Ae{constructor(o,a){this.listeners=new Set,this.subscribe=f=>{var p,m;this.listeners.add(f);const A=(m=(p=this.options)==null?void 0:p.onSubscribe)==null?void 0:m.call(p,f,this);return()=>{this.listeners.delete(f),A?.()}},this.prevState=o,this.state=o,this.options=a}setState(o){var a,f,p;this.prevState=this.state,(a=this.options)!=null&&a.updateFn?this.state=this.options.updateFn(this.prevState)(o):ct(o)?this.state=o(this.prevState):this.state=o,(p=(f=this.options)==null?void 0:f.onUpdate)==null||p.call(f),it(this)}}class J{constructor(o){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const a=[],f=[];for(const p of this.options.deps)a.push(p.prevState),f.push(p.state);return this.lastSeenDepValues=f,{prevDepVals:a,currDepVals:f,prevVal:this.prevState??void 0}},this.recompute=()=>{var a,f;this.prevState=this.state;const{prevDepVals:p,currDepVals:m,prevVal:A}=this.getDepVals();this.state=this.options.fn({prevDepVals:p,currDepVals:m,prevVal:A}),(f=(a=this.options).onUpdate)==null||f.call(a)},this.checkIfRecalculationNeededDeeply=()=>{for(const m of this.options.deps)m instanceof J&&m.checkIfRecalculationNeededDeeply();let a=!1;const f=this.lastSeenDepValues,{currDepVals:p}=this.getDepVals();for(let m=0;m<p.length;m++)if(p[m]!==f[m]){a=!0;break}a&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const a of this._subscriptions)a()}),this.subscribe=a=>{var f,p;this.listeners.add(a);const m=(p=(f=this.options).onSubscribe)==null?void 0:p.call(f,a,this);return()=>{this.listeners.delete(a),m?.()}},this.options=o,this.state=o.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(o=this.options.deps){for(const a of o)if(a instanceof J)a.registerOnGraph(),this.registerOnGraph(a.options.deps);else if(a instanceof Ae){let f=ae.get(a);f||(f=new Set,ae.set(a,f)),f.add(this);let p=me.get(this);p||(p=new Set,me.set(this,p)),p.add(a)}}unregisterFromGraph(o=this.options.deps){for(const a of o)if(a instanceof J)this.unregisterFromGraph(a.options.deps);else if(a instanceof Ae){const f=ae.get(a);f&&f.delete(this);const p=me.get(this);p&&p.delete(a)}}}const ke="Authorization",Ue=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_active:!1},isAuthenticated:!1,isLoaded:!1}),ee=new Ae(Ue()),ft=new J({fn:()=>!!ee.state.user?.roles.find(b=>b.name==="admin"),deps:[ee]});class lt{accountStore;httpClient;constructor(o){this.httpClient=o,this.accountStore=ee}initAuthData(){const o=localStorage.getItem("token");o&&(this.httpClient.defaults.headers.common[ke]=o)}async load(){try{const{data:o}=await this.httpClient.get("/api/auth/account/me");ee.setState(()=>({user:o,isAuthenticated:!0,isLoaded:!0}))}catch{ee.setState(o=>({...o,isLoaded:!0}))}}async login(o){const a=await this.httpClient.post("/api/auth/account/login",o),{user:f,access_token:p}=a.data;return f.is_active&&this._initUserData({user:f,access_token:p}),f}register(o){return this.httpClient.post("/api/auth/account/register",o)}async activate(o){const a=await this.httpClient.post("/api/auth/account/activate",o);this._initUserData(a.data)}logout(){ee.setState(()=>({...Ue(),isLoaded:!0})),this._clearAuthData()}startResetPassword(o){return this.httpClient.post("/api/auth/account/start-reset-password",o)}async resetPassword(o){const a=await this.httpClient.post("/api/auth/account/reset-password",o);this._initUserData(a.data)}_initUserData({user:o,access_token:a}){this._setAuthData(a),ee.setState(()=>({user:o,isAuthenticated:!0,isLoaded:!0}))}_setAuthData(o){localStorage.setItem("token",o),this.httpClient.defaults.headers.common[ke]=o}_clearAuthData(){localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[ke]}}W.Auth=lt,W.LoginForm=st,W.isAdmin=ft,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@service_laboratory/auth",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@tanstack/store": "^0.7.4",
|
|
24
24
|
"axios": "^1.11.0",
|
|
25
25
|
"react": "^19.1.1",
|
|
26
|
-
"react-dom": "
|
|
26
|
+
"react-dom": "19.1.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"typescript": "~5.8.3",
|
|
30
|
-
"vite": "^7.1.4",
|
|
31
|
-
"vite-plugin-dts": "^4.5.4",
|
|
32
29
|
"@types/node": "^24.5.2",
|
|
33
30
|
"@types/react": "^19.1.13",
|
|
34
|
-
"@vitejs/plugin-react": "^5.0.3"
|
|
31
|
+
"@vitejs/plugin-react": "^5.0.3",
|
|
32
|
+
"typescript": "~5.8.3",
|
|
33
|
+
"vite": "^7.1.4",
|
|
34
|
+
"vite-plugin-dts": "^4.5.4"
|
|
35
35
|
}
|
|
36
36
|
}
|