thecore-auth 0.0.0 → 0.0.1
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/thecore-auth.cjs.js +30 -0
- package/dist/thecore-auth.es.js +485 -532
- package/package.json +10 -4
- package/dist/thecore-auth.umd.js +0 -30
package/dist/thecore-auth.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import M, { createContext as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import M, { createContext as de, useState as A, useContext as ge, useEffect as Y } from "react";
|
|
2
|
+
import Dt from "jwt-decode";
|
|
3
|
+
import { useNavigate as tt, Outlet as rt, Navigate as Lt, useParams as Ft } from "react-router-dom";
|
|
4
|
+
import Mt from "axios";
|
|
4
5
|
var le = { exports: {} }, ee = {};
|
|
5
6
|
/**
|
|
6
7
|
* @license React
|
|
@@ -11,19 +12,19 @@ var le = { exports: {} }, ee = {};
|
|
|
11
12
|
* This source code is licensed under the MIT license found in the
|
|
12
13
|
* LICENSE file in the root directory of this source tree.
|
|
13
14
|
*/
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
var t = M, n = Symbol.for("react.element"),
|
|
19
|
-
function
|
|
20
|
-
var w,
|
|
21
|
-
y !== void 0 && (E = "" + y),
|
|
22
|
-
for (w in
|
|
23
|
-
if (
|
|
24
|
-
return { $$typeof: n, type:
|
|
15
|
+
var Ke;
|
|
16
|
+
function zt() {
|
|
17
|
+
if (Ke) return ee;
|
|
18
|
+
Ke = 1;
|
|
19
|
+
var t = M, n = Symbol.for("react.element"), a = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, u = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function p(v, c, y) {
|
|
21
|
+
var w, h = {}, E = null, T = null;
|
|
22
|
+
y !== void 0 && (E = "" + y), c.key !== void 0 && (E = "" + c.key), c.ref !== void 0 && (T = c.ref);
|
|
23
|
+
for (w in c) s.call(c, w) && !g.hasOwnProperty(w) && (h[w] = c[w]);
|
|
24
|
+
if (v && v.defaultProps) for (w in c = v.defaultProps, c) h[w] === void 0 && (h[w] = c[w]);
|
|
25
|
+
return { $$typeof: n, type: v, key: E, ref: T, props: h, _owner: u.current };
|
|
25
26
|
}
|
|
26
|
-
return ee.Fragment =
|
|
27
|
+
return ee.Fragment = a, ee.jsx = p, ee.jsxs = p, ee;
|
|
27
28
|
}
|
|
28
29
|
var te = {};
|
|
29
30
|
/**
|
|
@@ -35,11 +36,11 @@ var te = {};
|
|
|
35
36
|
* This source code is licensed under the MIT license found in the
|
|
36
37
|
* LICENSE file in the root directory of this source tree.
|
|
37
38
|
*/
|
|
38
|
-
var
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
var t = M, n = Symbol.for("react.element"),
|
|
42
|
-
function
|
|
39
|
+
var Ge;
|
|
40
|
+
function Wt() {
|
|
41
|
+
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
+
var t = M, n = Symbol.for("react.element"), a = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), v = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), N = Symbol.iterator, L = "@@iterator";
|
|
43
|
+
function P(e) {
|
|
43
44
|
if (e === null || typeof e != "object")
|
|
44
45
|
return null;
|
|
45
46
|
var r = N && e[N] || e[L];
|
|
@@ -48,38 +49,38 @@ function Ut() {
|
|
|
48
49
|
var b = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
50
|
function j(e) {
|
|
50
51
|
{
|
|
51
|
-
for (var r = arguments.length,
|
|
52
|
-
|
|
53
|
-
D("error", e,
|
|
52
|
+
for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
|
53
|
+
o[l - 1] = arguments[l];
|
|
54
|
+
D("error", e, o);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
function D(e, r,
|
|
57
|
+
function D(e, r, o) {
|
|
57
58
|
{
|
|
58
|
-
var l = b.ReactDebugCurrentFrame,
|
|
59
|
-
|
|
60
|
-
var x =
|
|
61
|
-
return String(
|
|
59
|
+
var l = b.ReactDebugCurrentFrame, m = l.getStackAddendum();
|
|
60
|
+
m !== "" && (r += "%s", o = o.concat([m]));
|
|
61
|
+
var x = o.map(function(d) {
|
|
62
|
+
return String(d);
|
|
62
63
|
});
|
|
63
64
|
x.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, x);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
var I = !1, H = !1, X = !1, _ = !1,
|
|
67
|
+
var I = !1, H = !1, X = !1, _ = !1, O = !1, z;
|
|
67
68
|
z = Symbol.for("react.module.reference");
|
|
68
69
|
function F(e) {
|
|
69
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === g || O || e === u || e === y || e === w || _ || e === T || I || H || X || typeof e == "object" && e !== null && (e.$$typeof === E || e.$$typeof === h || e.$$typeof === p || e.$$typeof === v || e.$$typeof === c || // This needs to include all possible module reference object
|
|
70
71
|
// types supported by any Flight configuration anywhere since
|
|
71
72
|
// we don't know which Flight build this will end up being used
|
|
72
73
|
// with.
|
|
73
74
|
e.$$typeof === z || e.getModuleId !== void 0));
|
|
74
75
|
}
|
|
75
|
-
function ne(e, r,
|
|
76
|
+
function ne(e, r, o) {
|
|
76
77
|
var l = e.displayName;
|
|
77
78
|
if (l)
|
|
78
79
|
return l;
|
|
79
|
-
var
|
|
80
|
-
return
|
|
80
|
+
var m = r.displayName || r.name || "";
|
|
81
|
+
return m !== "" ? o + "(" + m + ")" : o;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function U(e) {
|
|
83
84
|
return e.displayName || "Context";
|
|
84
85
|
}
|
|
85
86
|
function W(e) {
|
|
@@ -90,13 +91,13 @@ function Ut() {
|
|
|
90
91
|
if (typeof e == "string")
|
|
91
92
|
return e;
|
|
92
93
|
switch (e) {
|
|
93
|
-
case
|
|
94
|
+
case s:
|
|
94
95
|
return "Fragment";
|
|
95
|
-
case
|
|
96
|
+
case a:
|
|
96
97
|
return "Portal";
|
|
97
|
-
case
|
|
98
|
+
case g:
|
|
98
99
|
return "Profiler";
|
|
99
|
-
case
|
|
100
|
+
case u:
|
|
100
101
|
return "StrictMode";
|
|
101
102
|
case y:
|
|
102
103
|
return "Suspense";
|
|
@@ -105,21 +106,21 @@ function Ut() {
|
|
|
105
106
|
}
|
|
106
107
|
if (typeof e == "object")
|
|
107
108
|
switch (e.$$typeof) {
|
|
108
|
-
case
|
|
109
|
+
case v:
|
|
109
110
|
var r = e;
|
|
110
|
-
return
|
|
111
|
-
case
|
|
112
|
-
var
|
|
113
|
-
return
|
|
114
|
-
case
|
|
111
|
+
return U(r) + ".Consumer";
|
|
112
|
+
case p:
|
|
113
|
+
var o = e;
|
|
114
|
+
return U(o._context) + ".Provider";
|
|
115
|
+
case c:
|
|
115
116
|
return ne(e, e.render, "ForwardRef");
|
|
116
|
-
case
|
|
117
|
+
case h:
|
|
117
118
|
var l = e.displayName || null;
|
|
118
119
|
return l !== null ? l : W(e.type) || "Memo";
|
|
119
120
|
case E: {
|
|
120
|
-
var
|
|
121
|
+
var m = e, x = m._payload, d = m._init;
|
|
121
122
|
try {
|
|
122
|
-
return W(
|
|
123
|
+
return W(d(x));
|
|
123
124
|
} catch {
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
@@ -127,18 +128,18 @@ function Ut() {
|
|
|
127
128
|
}
|
|
128
129
|
return null;
|
|
129
130
|
}
|
|
130
|
-
var B = Object.assign, Z = 0,
|
|
131
|
-
function
|
|
131
|
+
var B = Object.assign, Z = 0, Re, Te, _e, Se, Pe, Oe, ke;
|
|
132
|
+
function Ae() {
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
function
|
|
134
|
+
Ae.__reactDisabledLog = !0;
|
|
135
|
+
function ct() {
|
|
135
136
|
{
|
|
136
137
|
if (Z === 0) {
|
|
137
|
-
|
|
138
|
+
Re = console.log, Te = console.info, _e = console.warn, Se = console.error, Pe = console.group, Oe = console.groupCollapsed, ke = console.groupEnd;
|
|
138
139
|
var e = {
|
|
139
140
|
configurable: !0,
|
|
140
141
|
enumerable: !0,
|
|
141
|
-
value:
|
|
142
|
+
value: Ae,
|
|
142
143
|
writable: !0
|
|
143
144
|
};
|
|
144
145
|
Object.defineProperties(console, {
|
|
@@ -154,7 +155,7 @@ function Ut() {
|
|
|
154
155
|
Z++;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
+
function ut() {
|
|
158
159
|
{
|
|
159
160
|
if (Z--, Z === 0) {
|
|
160
161
|
var e = {
|
|
@@ -164,87 +165,87 @@ function Ut() {
|
|
|
164
165
|
};
|
|
165
166
|
Object.defineProperties(console, {
|
|
166
167
|
log: B({}, e, {
|
|
167
|
-
value:
|
|
168
|
+
value: Re
|
|
168
169
|
}),
|
|
169
170
|
info: B({}, e, {
|
|
170
|
-
value:
|
|
171
|
+
value: Te
|
|
171
172
|
}),
|
|
172
173
|
warn: B({}, e, {
|
|
173
|
-
value:
|
|
174
|
+
value: _e
|
|
174
175
|
}),
|
|
175
176
|
error: B({}, e, {
|
|
176
|
-
value:
|
|
177
|
+
value: Se
|
|
177
178
|
}),
|
|
178
179
|
group: B({}, e, {
|
|
179
|
-
value:
|
|
180
|
+
value: Pe
|
|
180
181
|
}),
|
|
181
182
|
groupCollapsed: B({}, e, {
|
|
182
|
-
value:
|
|
183
|
+
value: Oe
|
|
183
184
|
}),
|
|
184
185
|
groupEnd: B({}, e, {
|
|
185
|
-
value:
|
|
186
|
+
value: ke
|
|
186
187
|
})
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
Z < 0 && j("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
var
|
|
193
|
-
function
|
|
193
|
+
var pe = b.ReactCurrentDispatcher, me;
|
|
194
|
+
function ae(e, r, o) {
|
|
194
195
|
{
|
|
195
196
|
if (me === void 0)
|
|
196
197
|
try {
|
|
197
198
|
throw Error();
|
|
198
|
-
} catch (
|
|
199
|
-
var l =
|
|
199
|
+
} catch (m) {
|
|
200
|
+
var l = m.stack.trim().match(/\n( *(at )?)/);
|
|
200
201
|
me = l && l[1] || "";
|
|
201
202
|
}
|
|
202
203
|
return `
|
|
203
204
|
` + me + e;
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
var
|
|
207
|
+
var he = !1, oe;
|
|
207
208
|
{
|
|
208
|
-
var
|
|
209
|
-
|
|
209
|
+
var ft = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
oe = new ft();
|
|
210
211
|
}
|
|
211
|
-
function
|
|
212
|
-
if (!e ||
|
|
212
|
+
function Ie(e, r) {
|
|
213
|
+
if (!e || he)
|
|
213
214
|
return "";
|
|
214
215
|
{
|
|
215
|
-
var
|
|
216
|
-
if (
|
|
217
|
-
return
|
|
216
|
+
var o = oe.get(e);
|
|
217
|
+
if (o !== void 0)
|
|
218
|
+
return o;
|
|
218
219
|
}
|
|
219
220
|
var l;
|
|
220
|
-
|
|
221
|
-
var
|
|
221
|
+
he = !0;
|
|
222
|
+
var m = Error.prepareStackTrace;
|
|
222
223
|
Error.prepareStackTrace = void 0;
|
|
223
224
|
var x;
|
|
224
|
-
x =
|
|
225
|
+
x = pe.current, pe.current = null, ct();
|
|
225
226
|
try {
|
|
226
227
|
if (r) {
|
|
227
|
-
var
|
|
228
|
+
var d = function() {
|
|
228
229
|
throw Error();
|
|
229
230
|
};
|
|
230
|
-
if (Object.defineProperty(
|
|
231
|
+
if (Object.defineProperty(d.prototype, "props", {
|
|
231
232
|
set: function() {
|
|
232
233
|
throw Error();
|
|
233
234
|
}
|
|
234
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
236
|
try {
|
|
236
|
-
Reflect.construct(
|
|
237
|
+
Reflect.construct(d, []);
|
|
237
238
|
} catch (k) {
|
|
238
239
|
l = k;
|
|
239
240
|
}
|
|
240
|
-
Reflect.construct(e, [],
|
|
241
|
+
Reflect.construct(e, [], d);
|
|
241
242
|
} else {
|
|
242
243
|
try {
|
|
243
|
-
|
|
244
|
+
d.call();
|
|
244
245
|
} catch (k) {
|
|
245
246
|
l = k;
|
|
246
247
|
}
|
|
247
|
-
e.call(
|
|
248
|
+
e.call(d.prototype);
|
|
248
249
|
}
|
|
249
250
|
} else {
|
|
250
251
|
try {
|
|
@@ -256,123 +257,123 @@ function Ut() {
|
|
|
256
257
|
}
|
|
257
258
|
} catch (k) {
|
|
258
259
|
if (k && l && typeof k.stack == "string") {
|
|
259
|
-
for (var
|
|
260
|
+
for (var f = k.stack.split(`
|
|
260
261
|
`), S = l.stack.split(`
|
|
261
|
-
`), C =
|
|
262
|
+
`), C = f.length - 1, R = S.length - 1; C >= 1 && R >= 0 && f[C] !== S[R]; )
|
|
262
263
|
R--;
|
|
263
264
|
for (; C >= 1 && R >= 0; C--, R--)
|
|
264
|
-
if (
|
|
265
|
+
if (f[C] !== S[R]) {
|
|
265
266
|
if (C !== 1 || R !== 1)
|
|
266
267
|
do
|
|
267
|
-
if (C--, R--, R < 0 ||
|
|
268
|
+
if (C--, R--, R < 0 || f[C] !== S[R]) {
|
|
268
269
|
var $ = `
|
|
269
|
-
` +
|
|
270
|
-
return e.displayName && $.includes("<anonymous>") && ($ = $.replace("<anonymous>", e.displayName)), typeof e == "function" &&
|
|
270
|
+
` + f[C].replace(" at new ", " at ");
|
|
271
|
+
return e.displayName && $.includes("<anonymous>") && ($ = $.replace("<anonymous>", e.displayName)), typeof e == "function" && oe.set(e, $), $;
|
|
271
272
|
}
|
|
272
273
|
while (C >= 1 && R >= 0);
|
|
273
274
|
break;
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
} finally {
|
|
277
|
-
|
|
278
|
+
he = !1, pe.current = x, ut(), Error.prepareStackTrace = m;
|
|
278
279
|
}
|
|
279
|
-
var J = e ? e.displayName || e.name : "",
|
|
280
|
-
return typeof e == "function" &&
|
|
280
|
+
var J = e ? e.displayName || e.name : "", V = J ? ae(J) : "";
|
|
281
|
+
return typeof e == "function" && oe.set(e, V), V;
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
283
|
+
function dt(e, r, o) {
|
|
284
|
+
return Ie(e, !1);
|
|
284
285
|
}
|
|
285
|
-
function
|
|
286
|
+
function gt(e) {
|
|
286
287
|
var r = e.prototype;
|
|
287
288
|
return !!(r && r.isReactComponent);
|
|
288
289
|
}
|
|
289
|
-
function se(e, r,
|
|
290
|
+
function se(e, r, o) {
|
|
290
291
|
if (e == null)
|
|
291
292
|
return "";
|
|
292
293
|
if (typeof e == "function")
|
|
293
|
-
return
|
|
294
|
+
return Ie(e, gt(e));
|
|
294
295
|
if (typeof e == "string")
|
|
295
|
-
return
|
|
296
|
+
return ae(e);
|
|
296
297
|
switch (e) {
|
|
297
298
|
case y:
|
|
298
|
-
return
|
|
299
|
+
return ae("Suspense");
|
|
299
300
|
case w:
|
|
300
|
-
return
|
|
301
|
+
return ae("SuspenseList");
|
|
301
302
|
}
|
|
302
303
|
if (typeof e == "object")
|
|
303
304
|
switch (e.$$typeof) {
|
|
304
|
-
case
|
|
305
|
-
return
|
|
306
|
-
case
|
|
307
|
-
return se(e.type, r,
|
|
305
|
+
case c:
|
|
306
|
+
return dt(e.render);
|
|
307
|
+
case h:
|
|
308
|
+
return se(e.type, r, o);
|
|
308
309
|
case E: {
|
|
309
|
-
var l = e,
|
|
310
|
+
var l = e, m = l._payload, x = l._init;
|
|
310
311
|
try {
|
|
311
|
-
return se(x(
|
|
312
|
+
return se(x(m), r, o);
|
|
312
313
|
} catch {
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
return "";
|
|
317
318
|
}
|
|
318
|
-
var Q = Object.prototype.hasOwnProperty,
|
|
319
|
+
var Q = Object.prototype.hasOwnProperty, Ne = {}, $e = b.ReactDebugCurrentFrame;
|
|
319
320
|
function ie(e) {
|
|
320
321
|
if (e) {
|
|
321
|
-
var r = e._owner,
|
|
322
|
-
|
|
322
|
+
var r = e._owner, o = se(e.type, e._source, r ? r.type : null);
|
|
323
|
+
$e.setExtraStackFrame(o);
|
|
323
324
|
} else
|
|
324
|
-
|
|
325
|
+
$e.setExtraStackFrame(null);
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function vt(e, r, o, l, m) {
|
|
327
328
|
{
|
|
328
329
|
var x = Function.call.bind(Q);
|
|
329
|
-
for (var
|
|
330
|
-
if (x(e,
|
|
331
|
-
var
|
|
330
|
+
for (var d in e)
|
|
331
|
+
if (x(e, d)) {
|
|
332
|
+
var f = void 0;
|
|
332
333
|
try {
|
|
333
|
-
if (typeof e[
|
|
334
|
-
var S = Error((l || "React class") + ": " +
|
|
334
|
+
if (typeof e[d] != "function") {
|
|
335
|
+
var S = Error((l || "React class") + ": " + o + " type `" + d + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[d] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
336
|
throw S.name = "Invariant Violation", S;
|
|
336
337
|
}
|
|
337
|
-
|
|
338
|
+
f = e[d](r, d, l, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
339
|
} catch (C) {
|
|
339
|
-
|
|
340
|
+
f = C;
|
|
340
341
|
}
|
|
341
|
-
|
|
342
|
+
f && !(f instanceof Error) && (ie(m), j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", l || "React class", o, d, typeof f), ie(null)), f instanceof Error && !(f.message in Ne) && (Ne[f.message] = !0, ie(m), j("Failed %s type: %s", o, f.message), ie(null));
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
|
-
var
|
|
346
|
-
function
|
|
347
|
-
return
|
|
346
|
+
var pt = Array.isArray;
|
|
347
|
+
function be(e) {
|
|
348
|
+
return pt(e);
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
+
function mt(e) {
|
|
350
351
|
{
|
|
351
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag,
|
|
352
|
-
return
|
|
352
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, o = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
353
|
+
return o;
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
|
-
function
|
|
356
|
+
function ht(e) {
|
|
356
357
|
try {
|
|
357
|
-
return
|
|
358
|
+
return De(e), !1;
|
|
358
359
|
} catch {
|
|
359
360
|
return !0;
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
|
-
function
|
|
363
|
+
function De(e) {
|
|
363
364
|
return "" + e;
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
-
if (
|
|
367
|
-
return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
366
|
+
function Le(e) {
|
|
367
|
+
if (ht(e))
|
|
368
|
+
return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mt(e)), De(e);
|
|
368
369
|
}
|
|
369
|
-
var
|
|
370
|
+
var Fe = b.ReactCurrentOwner, bt = {
|
|
370
371
|
key: !0,
|
|
371
372
|
ref: !0,
|
|
372
373
|
__self: !0,
|
|
373
374
|
__source: !0
|
|
374
|
-
},
|
|
375
|
-
function
|
|
375
|
+
}, Me, ze;
|
|
376
|
+
function xt(e) {
|
|
376
377
|
if (Q.call(e, "ref")) {
|
|
377
378
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
378
379
|
if (r && r.isReactWarning)
|
|
@@ -380,7 +381,7 @@ function Ut() {
|
|
|
380
381
|
}
|
|
381
382
|
return e.ref !== void 0;
|
|
382
383
|
}
|
|
383
|
-
function
|
|
384
|
+
function yt(e) {
|
|
384
385
|
if (Q.call(e, "key")) {
|
|
385
386
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
386
387
|
if (r && r.isReactWarning)
|
|
@@ -388,95 +389,95 @@ function Ut() {
|
|
|
388
389
|
}
|
|
389
390
|
return e.key !== void 0;
|
|
390
391
|
}
|
|
391
|
-
function
|
|
392
|
-
typeof e.ref == "string" &&
|
|
392
|
+
function wt(e, r) {
|
|
393
|
+
typeof e.ref == "string" && Fe.current;
|
|
393
394
|
}
|
|
394
|
-
function
|
|
395
|
+
function jt(e, r) {
|
|
395
396
|
{
|
|
396
|
-
var
|
|
397
|
-
|
|
397
|
+
var o = function() {
|
|
398
|
+
Me || (Me = !0, j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
398
399
|
};
|
|
399
|
-
|
|
400
|
-
get:
|
|
400
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
|
+
get: o,
|
|
401
402
|
configurable: !0
|
|
402
403
|
});
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
|
-
function
|
|
406
|
+
function Et(e, r) {
|
|
406
407
|
{
|
|
407
|
-
var
|
|
408
|
-
|
|
408
|
+
var o = function() {
|
|
409
|
+
ze || (ze = !0, j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
409
410
|
};
|
|
410
|
-
|
|
411
|
-
get:
|
|
411
|
+
o.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
|
+
get: o,
|
|
412
413
|
configurable: !0
|
|
413
414
|
});
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
|
-
var
|
|
417
|
-
var
|
|
417
|
+
var Ct = function(e, r, o, l, m, x, d) {
|
|
418
|
+
var f = {
|
|
418
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
420
|
$$typeof: n,
|
|
420
421
|
// Built-in properties that belong on the element
|
|
421
422
|
type: e,
|
|
422
423
|
key: r,
|
|
423
|
-
ref:
|
|
424
|
-
props:
|
|
424
|
+
ref: o,
|
|
425
|
+
props: d,
|
|
425
426
|
// Record the component responsible for creating this element.
|
|
426
427
|
_owner: x
|
|
427
428
|
};
|
|
428
|
-
return
|
|
429
|
+
return f._store = {}, Object.defineProperty(f._store, "validated", {
|
|
429
430
|
configurable: !1,
|
|
430
431
|
enumerable: !1,
|
|
431
432
|
writable: !0,
|
|
432
433
|
value: !1
|
|
433
|
-
}), Object.defineProperty(
|
|
434
|
+
}), Object.defineProperty(f, "_self", {
|
|
434
435
|
configurable: !1,
|
|
435
436
|
enumerable: !1,
|
|
436
437
|
writable: !1,
|
|
437
438
|
value: l
|
|
438
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(f, "_source", {
|
|
439
440
|
configurable: !1,
|
|
440
441
|
enumerable: !1,
|
|
441
442
|
writable: !1,
|
|
442
|
-
value:
|
|
443
|
-
}), Object.freeze && (Object.freeze(
|
|
443
|
+
value: m
|
|
444
|
+
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
444
445
|
};
|
|
445
|
-
function
|
|
446
|
+
function Rt(e, r, o, l, m) {
|
|
446
447
|
{
|
|
447
|
-
var x,
|
|
448
|
-
|
|
448
|
+
var x, d = {}, f = null, S = null;
|
|
449
|
+
o !== void 0 && (Le(o), f = "" + o), yt(r) && (Le(r.key), f = "" + r.key), xt(r) && (S = r.ref, wt(r, m));
|
|
449
450
|
for (x in r)
|
|
450
|
-
Q.call(r, x) && !
|
|
451
|
+
Q.call(r, x) && !bt.hasOwnProperty(x) && (d[x] = r[x]);
|
|
451
452
|
if (e && e.defaultProps) {
|
|
452
453
|
var C = e.defaultProps;
|
|
453
454
|
for (x in C)
|
|
454
|
-
|
|
455
|
+
d[x] === void 0 && (d[x] = C[x]);
|
|
455
456
|
}
|
|
456
|
-
if (
|
|
457
|
+
if (f || S) {
|
|
457
458
|
var R = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
458
|
-
|
|
459
|
+
f && jt(d, R), S && Et(d, R);
|
|
459
460
|
}
|
|
460
|
-
return
|
|
461
|
+
return Ct(e, f, S, m, l, Fe.current, d);
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
|
-
var
|
|
464
|
+
var xe = b.ReactCurrentOwner, We = b.ReactDebugCurrentFrame;
|
|
464
465
|
function q(e) {
|
|
465
466
|
if (e) {
|
|
466
|
-
var r = e._owner,
|
|
467
|
-
|
|
467
|
+
var r = e._owner, o = se(e.type, e._source, r ? r.type : null);
|
|
468
|
+
We.setExtraStackFrame(o);
|
|
468
469
|
} else
|
|
469
|
-
|
|
470
|
+
We.setExtraStackFrame(null);
|
|
470
471
|
}
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
function
|
|
472
|
+
var ye;
|
|
473
|
+
ye = !1;
|
|
474
|
+
function we(e) {
|
|
474
475
|
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
475
476
|
}
|
|
476
|
-
function
|
|
477
|
+
function Be() {
|
|
477
478
|
{
|
|
478
|
-
if (
|
|
479
|
-
var e = W(
|
|
479
|
+
if (xe.current) {
|
|
480
|
+
var e = W(xe.current.type);
|
|
480
481
|
if (e)
|
|
481
482
|
return `
|
|
482
483
|
|
|
@@ -485,83 +486,83 @@ Check the render method of \`` + e + "`.";
|
|
|
485
486
|
return "";
|
|
486
487
|
}
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
+
function Tt(e) {
|
|
489
490
|
return "";
|
|
490
491
|
}
|
|
491
|
-
var
|
|
492
|
-
function
|
|
492
|
+
var Ve = {};
|
|
493
|
+
function _t(e) {
|
|
493
494
|
{
|
|
494
|
-
var r =
|
|
495
|
+
var r = Be();
|
|
495
496
|
if (!r) {
|
|
496
|
-
var
|
|
497
|
-
|
|
497
|
+
var o = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
|
+
o && (r = `
|
|
498
499
|
|
|
499
|
-
Check the top-level render call using <` +
|
|
500
|
+
Check the top-level render call using <` + o + ">.");
|
|
500
501
|
}
|
|
501
502
|
return r;
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
|
-
function
|
|
505
|
+
function Ye(e, r) {
|
|
505
506
|
{
|
|
506
507
|
if (!e._store || e._store.validated || e.key != null)
|
|
507
508
|
return;
|
|
508
509
|
e._store.validated = !0;
|
|
509
|
-
var
|
|
510
|
-
if (
|
|
510
|
+
var o = _t(r);
|
|
511
|
+
if (Ve[o])
|
|
511
512
|
return;
|
|
512
|
-
|
|
513
|
+
Ve[o] = !0;
|
|
513
514
|
var l = "";
|
|
514
|
-
e && e._owner && e._owner !==
|
|
515
|
+
e && e._owner && e._owner !== xe.current && (l = " It was passed a child from " + W(e._owner.type) + "."), q(e), j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, l), q(null);
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
|
-
function
|
|
518
|
+
function Ue(e, r) {
|
|
518
519
|
{
|
|
519
520
|
if (typeof e != "object")
|
|
520
521
|
return;
|
|
521
|
-
if (
|
|
522
|
-
for (var
|
|
523
|
-
var l = e[
|
|
524
|
-
|
|
522
|
+
if (be(e))
|
|
523
|
+
for (var o = 0; o < e.length; o++) {
|
|
524
|
+
var l = e[o];
|
|
525
|
+
we(l) && Ye(l, r);
|
|
525
526
|
}
|
|
526
|
-
else if (
|
|
527
|
+
else if (we(e))
|
|
527
528
|
e._store && (e._store.validated = !0);
|
|
528
529
|
else if (e) {
|
|
529
|
-
var
|
|
530
|
-
if (typeof
|
|
531
|
-
for (var x =
|
|
532
|
-
|
|
530
|
+
var m = P(e);
|
|
531
|
+
if (typeof m == "function" && m !== e.entries)
|
|
532
|
+
for (var x = m.call(e), d; !(d = x.next()).done; )
|
|
533
|
+
we(d.value) && Ye(d.value, r);
|
|
533
534
|
}
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
|
-
function
|
|
537
|
+
function St(e) {
|
|
537
538
|
{
|
|
538
539
|
var r = e.type;
|
|
539
540
|
if (r == null || typeof r == "string")
|
|
540
541
|
return;
|
|
541
|
-
var
|
|
542
|
+
var o;
|
|
542
543
|
if (typeof r == "function")
|
|
543
|
-
|
|
544
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
544
|
+
o = r.propTypes;
|
|
545
|
+
else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
|
|
545
546
|
// Inner props are checked in the reconciler.
|
|
546
|
-
r.$$typeof ===
|
|
547
|
-
|
|
547
|
+
r.$$typeof === h))
|
|
548
|
+
o = r.propTypes;
|
|
548
549
|
else
|
|
549
550
|
return;
|
|
550
|
-
if (
|
|
551
|
+
if (o) {
|
|
551
552
|
var l = W(r);
|
|
552
|
-
|
|
553
|
-
} else if (r.PropTypes !== void 0 && !
|
|
554
|
-
|
|
555
|
-
var
|
|
556
|
-
j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
553
|
+
vt(o, e.props, "prop", l, e);
|
|
554
|
+
} else if (r.PropTypes !== void 0 && !ye) {
|
|
555
|
+
ye = !0;
|
|
556
|
+
var m = W(r);
|
|
557
|
+
j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
|
|
557
558
|
}
|
|
558
559
|
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
560
|
}
|
|
560
561
|
}
|
|
561
|
-
function
|
|
562
|
+
function Pt(e) {
|
|
562
563
|
{
|
|
563
|
-
for (var r = Object.keys(e.props),
|
|
564
|
-
var l = r[
|
|
564
|
+
for (var r = Object.keys(e.props), o = 0; o < r.length; o++) {
|
|
565
|
+
var l = r[o];
|
|
565
566
|
if (l !== "children" && l !== "key") {
|
|
566
567
|
q(e), j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), q(null);
|
|
567
568
|
break;
|
|
@@ -570,159 +571,111 @@ Check the top-level render call using <` + s + ">.");
|
|
|
570
571
|
e.ref !== null && (q(e), j("Invalid attribute `ref` supplied to `React.Fragment`."), q(null));
|
|
571
572
|
}
|
|
572
573
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
574
|
+
var qe = {};
|
|
575
|
+
function Je(e, r, o, l, m, x) {
|
|
575
576
|
{
|
|
576
|
-
var
|
|
577
|
-
if (!
|
|
578
|
-
var
|
|
579
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
580
|
-
var S =
|
|
581
|
-
S ?
|
|
577
|
+
var d = F(e);
|
|
578
|
+
if (!d) {
|
|
579
|
+
var f = "";
|
|
580
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (f += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
|
+
var S = Tt();
|
|
582
|
+
S ? f += S : f += Be();
|
|
582
583
|
var C;
|
|
583
|
-
e === null ? C = "null" :
|
|
584
|
+
e === null ? C = "null" : be(e) ? C = "array" : e !== void 0 && e.$$typeof === n ? (C = "<" + (W(e.type) || "Unknown") + " />", f = " Did you accidentally export a JSX literal instead of a component?") : C = typeof e, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", C, f);
|
|
584
585
|
}
|
|
585
|
-
var R =
|
|
586
|
+
var R = Rt(e, r, o, m, x);
|
|
586
587
|
if (R == null)
|
|
587
588
|
return R;
|
|
588
|
-
if (
|
|
589
|
+
if (d) {
|
|
589
590
|
var $ = r.children;
|
|
590
591
|
if ($ !== void 0)
|
|
591
592
|
if (l)
|
|
592
|
-
if (
|
|
593
|
+
if (be($)) {
|
|
593
594
|
for (var J = 0; J < $.length; J++)
|
|
594
|
-
|
|
595
|
+
Ue($[J], e);
|
|
595
596
|
Object.freeze && Object.freeze($);
|
|
596
597
|
} else
|
|
597
598
|
j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
599
|
else
|
|
599
|
-
|
|
600
|
+
Ue($, e);
|
|
600
601
|
}
|
|
601
602
|
if (Q.call(r, "key")) {
|
|
602
|
-
var
|
|
603
|
-
return
|
|
604
|
-
}),
|
|
605
|
-
if (!
|
|
606
|
-
var
|
|
603
|
+
var V = W(e), k = Object.keys(r).filter(function($t) {
|
|
604
|
+
return $t !== "key";
|
|
605
|
+
}), je = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!qe[V + je]) {
|
|
607
|
+
var Nt = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
|
|
607
608
|
j(`A props object containing a "key" prop is being spread into JSX:
|
|
608
609
|
let props = %s;
|
|
609
610
|
<%s {...props} />
|
|
610
611
|
React keys must be passed directly to JSX without using spread:
|
|
611
612
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`,
|
|
613
|
+
<%s key={someKey} {...props} />`, je, V, Nt, V), qe[V + je] = !0;
|
|
613
614
|
}
|
|
614
615
|
}
|
|
615
|
-
return e ===
|
|
616
|
+
return e === s ? Pt(R) : St(R), R;
|
|
616
617
|
}
|
|
617
618
|
}
|
|
618
|
-
function
|
|
619
|
-
return
|
|
619
|
+
function Ot(e, r, o) {
|
|
620
|
+
return Je(e, r, o, !0);
|
|
620
621
|
}
|
|
621
|
-
function
|
|
622
|
-
return
|
|
622
|
+
function kt(e, r, o) {
|
|
623
|
+
return Je(e, r, o, !1);
|
|
623
624
|
}
|
|
624
|
-
var
|
|
625
|
-
te.Fragment =
|
|
625
|
+
var At = kt, It = Ot;
|
|
626
|
+
te.Fragment = s, te.jsx = At, te.jsxs = It;
|
|
626
627
|
}()), te;
|
|
627
628
|
}
|
|
628
|
-
var
|
|
629
|
-
function
|
|
630
|
-
return
|
|
629
|
+
var He;
|
|
630
|
+
function Bt() {
|
|
631
|
+
return He || (He = 1, process.env.NODE_ENV === "production" ? le.exports = zt() : le.exports = Wt()), le.exports;
|
|
631
632
|
}
|
|
632
|
-
var i =
|
|
633
|
-
const
|
|
634
|
-
const [n,
|
|
635
|
-
return /* @__PURE__ */ i.jsx(
|
|
636
|
-
},
|
|
637
|
-
const t =
|
|
633
|
+
var i = Bt();
|
|
634
|
+
const nt = de(), lr = ({ children: t }) => {
|
|
635
|
+
const [n, a] = A(!1);
|
|
636
|
+
return /* @__PURE__ */ i.jsx(nt.Provider, { value: { isLoading: n, setIsLoading: a }, children: t });
|
|
637
|
+
}, Ee = () => {
|
|
638
|
+
const t = ge(nt);
|
|
638
639
|
if (t === void 0) throw new Error("Non puoi settare il loading");
|
|
639
640
|
return t;
|
|
640
|
-
},
|
|
641
|
-
const [n,
|
|
641
|
+
}, at = de(), cr = ({ children: t }) => {
|
|
642
|
+
const [n, a] = A({}), s = async () => {
|
|
642
643
|
try {
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
} catch (
|
|
646
|
-
console.error(
|
|
644
|
+
const g = await (await fetch("/config.json")).json();
|
|
645
|
+
a(g);
|
|
646
|
+
} catch (u) {
|
|
647
|
+
console.error(u);
|
|
647
648
|
}
|
|
648
649
|
};
|
|
649
|
-
return
|
|
650
|
-
|
|
651
|
-
}, []), Object.keys(n).length === 0 ? null : /* @__PURE__ */ i.jsx(
|
|
652
|
-
},
|
|
653
|
-
const t =
|
|
650
|
+
return Y(() => {
|
|
651
|
+
s();
|
|
652
|
+
}, []), Object.keys(n).length === 0 ? null : /* @__PURE__ */ i.jsx(at.Provider, { value: n, children: t });
|
|
653
|
+
}, ve = () => {
|
|
654
|
+
const t = ge(at);
|
|
654
655
|
if (t === void 0) throw new Error("Non puoi leggere i config");
|
|
655
656
|
return t;
|
|
656
|
-
},
|
|
657
|
-
const [n,
|
|
657
|
+
}, ot = de(), ur = ({ children: t }) => {
|
|
658
|
+
const [n, a] = A(!1), [s, u] = A(), [g, p] = A(), v = {
|
|
658
659
|
showAlert: n,
|
|
659
|
-
setShowAlert:
|
|
660
|
-
typeAlert:
|
|
661
|
-
setTypeAlert:
|
|
662
|
-
messageAlert:
|
|
663
|
-
setMessageAlert:
|
|
660
|
+
setShowAlert: a,
|
|
661
|
+
typeAlert: s,
|
|
662
|
+
setTypeAlert: u,
|
|
663
|
+
messageAlert: g,
|
|
664
|
+
setMessageAlert: p
|
|
664
665
|
};
|
|
665
|
-
return /* @__PURE__ */ i.jsx(
|
|
666
|
+
return /* @__PURE__ */ i.jsx(ot.Provider, { value: v, children: t });
|
|
666
667
|
}, G = () => {
|
|
667
|
-
const t =
|
|
668
|
+
const t = ge(ot);
|
|
668
669
|
if (t === void 0) throw new Error("Non puoi modificare l'alert");
|
|
669
670
|
return t;
|
|
670
671
|
};
|
|
671
|
-
function Ce(t) {
|
|
672
|
-
this.message = t;
|
|
673
|
-
}
|
|
674
|
-
Ce.prototype = new Error(), Ce.prototype.name = "InvalidCharacterError";
|
|
675
|
-
var Qe = typeof window < "u" && window.atob && window.atob.bind(window) || function(t) {
|
|
676
|
-
var n = String(t).replace(/=+$/, "");
|
|
677
|
-
if (n.length % 4 == 1) throw new Ce("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
678
|
-
for (var o, a, c = 0, u = 0, g = ""; a = n.charAt(u++); ~a && (o = c % 4 ? 64 * o + a : a, c++ % 4) ? g += String.fromCharCode(255 & o >> (-2 * c & 6)) : 0) a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);
|
|
679
|
-
return g;
|
|
680
|
-
};
|
|
681
|
-
function Yt(t) {
|
|
682
|
-
var n = t.replace(/-/g, "+").replace(/_/g, "/");
|
|
683
|
-
switch (n.length % 4) {
|
|
684
|
-
case 0:
|
|
685
|
-
break;
|
|
686
|
-
case 2:
|
|
687
|
-
n += "==";
|
|
688
|
-
break;
|
|
689
|
-
case 3:
|
|
690
|
-
n += "=";
|
|
691
|
-
break;
|
|
692
|
-
default:
|
|
693
|
-
throw "Illegal base64url string!";
|
|
694
|
-
}
|
|
695
|
-
try {
|
|
696
|
-
return function(o) {
|
|
697
|
-
return decodeURIComponent(Qe(o).replace(/(.)/g, function(a, c) {
|
|
698
|
-
var u = c.charCodeAt(0).toString(16).toUpperCase();
|
|
699
|
-
return u.length < 2 && (u = "0" + u), "%" + u;
|
|
700
|
-
}));
|
|
701
|
-
}(n);
|
|
702
|
-
} catch {
|
|
703
|
-
return Qe(n);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
function ce(t) {
|
|
707
|
-
this.message = t;
|
|
708
|
-
}
|
|
709
|
-
function qt(t, n) {
|
|
710
|
-
if (typeof t != "string") throw new ce("Invalid token specified");
|
|
711
|
-
var o = (n = n || {}).header === !0 ? 0 : 1;
|
|
712
|
-
try {
|
|
713
|
-
return JSON.parse(Yt(t.split(".")[o]));
|
|
714
|
-
} catch (a) {
|
|
715
|
-
throw new ce("Invalid token specified: " + a.message);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
ce.prototype = new Error(), ce.prototype.name = "InvalidTokenError";
|
|
719
672
|
let K;
|
|
720
|
-
const
|
|
673
|
+
const ce = async (t, n, a) => {
|
|
721
674
|
if (K) return K;
|
|
722
675
|
try {
|
|
723
|
-
const
|
|
724
|
-
return K =
|
|
725
|
-
baseURL:
|
|
676
|
+
const u = await (await fetch("/config.json")).json(), g = u.baseUri, { unauthorized: p, notFound: v, defaultMessage: c } = u.axiosErrors;
|
|
677
|
+
return K = Mt.create({
|
|
678
|
+
baseURL: g,
|
|
726
679
|
timeout: 3e3
|
|
727
680
|
}), K.interceptors.request.use(
|
|
728
681
|
(y) => y
|
|
@@ -732,37 +685,37 @@ const ue = async (t, n, o) => {
|
|
|
732
685
|
if (y.response)
|
|
733
686
|
switch (t(!0), n("danger"), y.response.status) {
|
|
734
687
|
case 401:
|
|
735
|
-
localStorage.removeItem("accessToken"),
|
|
688
|
+
localStorage.removeItem("accessToken"), a(p);
|
|
736
689
|
break;
|
|
737
690
|
case 404:
|
|
738
|
-
|
|
691
|
+
a(v);
|
|
739
692
|
break;
|
|
740
693
|
default:
|
|
741
|
-
|
|
694
|
+
a(`${c} ${y.response.status} ${y.response.data.error}`);
|
|
742
695
|
}
|
|
743
696
|
return Promise.reject(y);
|
|
744
697
|
}
|
|
745
698
|
), K;
|
|
746
|
-
} catch (
|
|
747
|
-
console.error(
|
|
699
|
+
} catch (s) {
|
|
700
|
+
console.error(s);
|
|
748
701
|
}
|
|
749
|
-
},
|
|
750
|
-
const { heartbeatEndpoint: n, infiniteSession:
|
|
702
|
+
}, st = de(), fr = ({ children: t }) => {
|
|
703
|
+
const { heartbeatEndpoint: n, infiniteSession: a, timeDeducted: s, authenticatedEndpoint: u } = ve(), { setIsLoading: g } = Ee(), { setShowAlert: p, setMessageAlert: v, setTypeAlert: c } = G(), y = tt(), [w, h] = A(null), [E, T] = A(), [N, L] = A(), [P, b] = A(), j = async (_, O) => {
|
|
751
704
|
_.preventDefault();
|
|
752
705
|
try {
|
|
753
|
-
|
|
754
|
-
const F = await (await
|
|
755
|
-
auth:
|
|
756
|
-
}), ne = F.data.id,
|
|
757
|
-
|
|
706
|
+
g(!0), p(!1);
|
|
707
|
+
const F = await (await ce(p, c, v)).post(u, {
|
|
708
|
+
auth: O
|
|
709
|
+
}), ne = F.data.id, U = F.headers.token;
|
|
710
|
+
U && (localStorage.setItem("accessToken", U), localStorage.setItem("id", ne), h(!0), T(U), y(`/dashboard/${ne}`));
|
|
758
711
|
} catch (z) {
|
|
759
|
-
console.error(z),
|
|
712
|
+
console.error(z), g(!1);
|
|
760
713
|
}
|
|
761
714
|
}, D = () => {
|
|
762
|
-
localStorage.removeItem("accessToken"), localStorage.removeItem("id"),
|
|
715
|
+
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), h(!1), T(null);
|
|
763
716
|
}, I = async () => {
|
|
764
717
|
try {
|
|
765
|
-
const _ = localStorage.getItem("accessToken"), F = (await (await
|
|
718
|
+
const _ = localStorage.getItem("accessToken"), F = (await (await ce(p, c, v)).get(
|
|
766
719
|
`${n}`,
|
|
767
720
|
{ headers: {
|
|
768
721
|
Authorization: _
|
|
@@ -775,176 +728,176 @@ const ue = async (t, n, o) => {
|
|
|
775
728
|
}, H = () => {
|
|
776
729
|
if (!E)
|
|
777
730
|
return;
|
|
778
|
-
const
|
|
779
|
-
b(F), L(F -
|
|
731
|
+
const O = Dt(E).exp, z = Math.floor(Date.now() / 1e3), F = (O - z) * 1e3;
|
|
732
|
+
b(F), L(F - s);
|
|
780
733
|
};
|
|
781
|
-
|
|
734
|
+
Y(() => {
|
|
782
735
|
if (localStorage.getItem("accessToken"))
|
|
783
|
-
|
|
736
|
+
h(!0);
|
|
784
737
|
else {
|
|
785
|
-
|
|
738
|
+
h(!1);
|
|
786
739
|
return;
|
|
787
740
|
}
|
|
788
|
-
}, []),
|
|
741
|
+
}, []), Y(() => {
|
|
789
742
|
H();
|
|
790
743
|
let _;
|
|
791
|
-
|
|
744
|
+
a && E && N && (_ = setInterval(() => {
|
|
792
745
|
I();
|
|
793
746
|
}, N));
|
|
794
|
-
let
|
|
795
|
-
return !
|
|
796
|
-
D(),
|
|
797
|
-
},
|
|
798
|
-
_ && clearInterval(_),
|
|
747
|
+
let O;
|
|
748
|
+
return !a && E && P && (O = setTimeout(() => {
|
|
749
|
+
D(), p(!0), c("danger"), v("Sessione scaduta");
|
|
750
|
+
}, P)), () => {
|
|
751
|
+
_ && clearInterval(_), O && clearTimeout(O);
|
|
799
752
|
};
|
|
800
753
|
}, [E, N]);
|
|
801
754
|
const X = {
|
|
802
755
|
isAuthenticated: w,
|
|
803
|
-
setIsAuthenticated:
|
|
756
|
+
setIsAuthenticated: h,
|
|
804
757
|
login: j,
|
|
805
758
|
logout: D,
|
|
806
759
|
setCurrentToken: T
|
|
807
760
|
};
|
|
808
|
-
return /* @__PURE__ */ i.jsx(
|
|
809
|
-
},
|
|
810
|
-
const t =
|
|
761
|
+
return /* @__PURE__ */ i.jsx(st.Provider, { value: X, children: t });
|
|
762
|
+
}, Ce = () => {
|
|
763
|
+
const t = ge(st);
|
|
811
764
|
if (t === void 0) throw new Error("Non sei dentro al Auth Provider");
|
|
812
765
|
return t;
|
|
813
|
-
},
|
|
814
|
-
const { isAuthenticated: t } =
|
|
815
|
-
return
|
|
816
|
-
!t && !
|
|
817
|
-
}, []), t === null ? null : t ? /* @__PURE__ */ i.jsx(
|
|
766
|
+
}, dr = () => {
|
|
767
|
+
const { isAuthenticated: t } = Ce(), { setShowAlert: n, setTypeAlert: a, setMessageAlert: s } = G(), u = localStorage.getItem("accessToken");
|
|
768
|
+
return Y(() => {
|
|
769
|
+
!t && !u && (n(!0), a("danger"), s("Non sei autorizzato"));
|
|
770
|
+
}, []), t === null ? null : t ? /* @__PURE__ */ i.jsx(rt, {}) : /* @__PURE__ */ i.jsx(Lt, { to: "/" });
|
|
818
771
|
};
|
|
819
|
-
var
|
|
772
|
+
var it = {
|
|
820
773
|
color: void 0,
|
|
821
774
|
size: void 0,
|
|
822
775
|
className: void 0,
|
|
823
776
|
style: void 0,
|
|
824
777
|
attr: void 0
|
|
825
|
-
},
|
|
826
|
-
function
|
|
778
|
+
}, Xe = M.createContext && /* @__PURE__ */ M.createContext(it), Vt = ["attr", "size", "title"];
|
|
779
|
+
function Yt(t, n) {
|
|
827
780
|
if (t == null) return {};
|
|
828
|
-
var
|
|
781
|
+
var a = Ut(t, n), s, u;
|
|
829
782
|
if (Object.getOwnPropertySymbols) {
|
|
830
|
-
var
|
|
831
|
-
for (
|
|
832
|
-
|
|
783
|
+
var g = Object.getOwnPropertySymbols(t);
|
|
784
|
+
for (u = 0; u < g.length; u++)
|
|
785
|
+
s = g[u], !(n.indexOf(s) >= 0) && Object.prototype.propertyIsEnumerable.call(t, s) && (a[s] = t[s]);
|
|
833
786
|
}
|
|
834
|
-
return
|
|
787
|
+
return a;
|
|
835
788
|
}
|
|
836
|
-
function
|
|
789
|
+
function Ut(t, n) {
|
|
837
790
|
if (t == null) return {};
|
|
838
|
-
var
|
|
839
|
-
for (var
|
|
840
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
841
|
-
if (n.indexOf(
|
|
842
|
-
|
|
791
|
+
var a = {};
|
|
792
|
+
for (var s in t)
|
|
793
|
+
if (Object.prototype.hasOwnProperty.call(t, s)) {
|
|
794
|
+
if (n.indexOf(s) >= 0) continue;
|
|
795
|
+
a[s] = t[s];
|
|
843
796
|
}
|
|
844
|
-
return
|
|
797
|
+
return a;
|
|
845
798
|
}
|
|
846
|
-
function
|
|
847
|
-
return
|
|
799
|
+
function ue() {
|
|
800
|
+
return ue = Object.assign ? Object.assign.bind() : function(t) {
|
|
848
801
|
for (var n = 1; n < arguments.length; n++) {
|
|
849
|
-
var
|
|
850
|
-
for (var
|
|
851
|
-
Object.prototype.hasOwnProperty.call(
|
|
802
|
+
var a = arguments[n];
|
|
803
|
+
for (var s in a)
|
|
804
|
+
Object.prototype.hasOwnProperty.call(a, s) && (t[s] = a[s]);
|
|
852
805
|
}
|
|
853
806
|
return t;
|
|
854
|
-
},
|
|
807
|
+
}, ue.apply(this, arguments);
|
|
855
808
|
}
|
|
856
|
-
function
|
|
857
|
-
var
|
|
809
|
+
function Ze(t, n) {
|
|
810
|
+
var a = Object.keys(t);
|
|
858
811
|
if (Object.getOwnPropertySymbols) {
|
|
859
|
-
var
|
|
860
|
-
n && (
|
|
861
|
-
return Object.getOwnPropertyDescriptor(t,
|
|
862
|
-
})),
|
|
812
|
+
var s = Object.getOwnPropertySymbols(t);
|
|
813
|
+
n && (s = s.filter(function(u) {
|
|
814
|
+
return Object.getOwnPropertyDescriptor(t, u).enumerable;
|
|
815
|
+
})), a.push.apply(a, s);
|
|
863
816
|
}
|
|
864
|
-
return
|
|
817
|
+
return a;
|
|
865
818
|
}
|
|
866
|
-
function
|
|
819
|
+
function fe(t) {
|
|
867
820
|
for (var n = 1; n < arguments.length; n++) {
|
|
868
|
-
var
|
|
869
|
-
n % 2 ?
|
|
870
|
-
|
|
871
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(
|
|
872
|
-
Object.defineProperty(t,
|
|
821
|
+
var a = arguments[n] != null ? arguments[n] : {};
|
|
822
|
+
n % 2 ? Ze(Object(a), !0).forEach(function(s) {
|
|
823
|
+
qt(t, s, a[s]);
|
|
824
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(a)) : Ze(Object(a)).forEach(function(s) {
|
|
825
|
+
Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(a, s));
|
|
873
826
|
});
|
|
874
827
|
}
|
|
875
828
|
return t;
|
|
876
829
|
}
|
|
877
|
-
function
|
|
878
|
-
return n =
|
|
830
|
+
function qt(t, n, a) {
|
|
831
|
+
return n = Jt(n), n in t ? Object.defineProperty(t, n, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = a, t;
|
|
879
832
|
}
|
|
880
|
-
function
|
|
881
|
-
var n =
|
|
833
|
+
function Jt(t) {
|
|
834
|
+
var n = Kt(t, "string");
|
|
882
835
|
return typeof n == "symbol" ? n : n + "";
|
|
883
836
|
}
|
|
884
|
-
function
|
|
837
|
+
function Kt(t, n) {
|
|
885
838
|
if (typeof t != "object" || !t) return t;
|
|
886
|
-
var
|
|
887
|
-
if (
|
|
888
|
-
var
|
|
889
|
-
if (typeof
|
|
839
|
+
var a = t[Symbol.toPrimitive];
|
|
840
|
+
if (a !== void 0) {
|
|
841
|
+
var s = a.call(t, n || "default");
|
|
842
|
+
if (typeof s != "object") return s;
|
|
890
843
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
891
844
|
}
|
|
892
845
|
return (n === "string" ? String : Number)(t);
|
|
893
846
|
}
|
|
894
|
-
function
|
|
895
|
-
return t && t.map((n,
|
|
896
|
-
key:
|
|
897
|
-
}, n.attr),
|
|
847
|
+
function lt(t) {
|
|
848
|
+
return t && t.map((n, a) => /* @__PURE__ */ M.createElement(n.tag, fe({
|
|
849
|
+
key: a
|
|
850
|
+
}, n.attr), lt(n.child)));
|
|
898
851
|
}
|
|
899
852
|
function re(t) {
|
|
900
|
-
return (n) => /* @__PURE__ */ M.createElement(
|
|
901
|
-
attr:
|
|
902
|
-
}, n),
|
|
853
|
+
return (n) => /* @__PURE__ */ M.createElement(Gt, ue({
|
|
854
|
+
attr: fe({}, t.attr)
|
|
855
|
+
}, n), lt(t.child));
|
|
903
856
|
}
|
|
904
|
-
function
|
|
905
|
-
var n = (
|
|
857
|
+
function Gt(t) {
|
|
858
|
+
var n = (a) => {
|
|
906
859
|
var {
|
|
907
|
-
attr:
|
|
908
|
-
size:
|
|
909
|
-
title:
|
|
910
|
-
} = t,
|
|
911
|
-
return
|
|
860
|
+
attr: s,
|
|
861
|
+
size: u,
|
|
862
|
+
title: g
|
|
863
|
+
} = t, p = Yt(t, Vt), v = u || a.size || "1em", c;
|
|
864
|
+
return a.className && (c = a.className), t.className && (c = (c ? c + " " : "") + t.className), /* @__PURE__ */ M.createElement("svg", ue({
|
|
912
865
|
stroke: "currentColor",
|
|
913
866
|
fill: "currentColor",
|
|
914
867
|
strokeWidth: "0"
|
|
915
|
-
},
|
|
916
|
-
className:
|
|
917
|
-
style:
|
|
918
|
-
color: t.color ||
|
|
919
|
-
},
|
|
920
|
-
height:
|
|
921
|
-
width:
|
|
868
|
+
}, a.attr, s, p, {
|
|
869
|
+
className: c,
|
|
870
|
+
style: fe(fe({
|
|
871
|
+
color: t.color || a.color
|
|
872
|
+
}, a.style), t.style),
|
|
873
|
+
height: v,
|
|
874
|
+
width: v,
|
|
922
875
|
xmlns: "http://www.w3.org/2000/svg"
|
|
923
|
-
}),
|
|
876
|
+
}), g && /* @__PURE__ */ M.createElement("title", null, g), t.children);
|
|
924
877
|
};
|
|
925
|
-
return
|
|
878
|
+
return Xe !== void 0 ? /* @__PURE__ */ M.createElement(Xe.Consumer, null, (a) => n(a)) : n(it);
|
|
926
879
|
}
|
|
927
|
-
function
|
|
880
|
+
function Ht(t) {
|
|
928
881
|
return re({ tag: "svg", attr: { version: "1.1", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M8 0c-4.355 0-7.898 3.481-7.998 7.812 0.092-3.779 2.966-6.812 6.498-6.812 3.59 0 6.5 3.134 6.5 7 0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-4.418-3.582-8-8-8zM8 16c4.355 0 7.898-3.481 7.998-7.812-0.092 3.779-2.966 6.812-6.498 6.812-3.59 0-6.5-3.134-6.5-7 0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5c0 4.418 3.582 8 8 8z" }, child: [] }] })(t);
|
|
929
882
|
}
|
|
930
|
-
const
|
|
931
|
-
/* @__PURE__ */ i.jsx(
|
|
883
|
+
const Xt = () => /* @__PURE__ */ i.jsxs("div", { className: "fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-[#00000080]", children: [
|
|
884
|
+
/* @__PURE__ */ i.jsx(Ht, { className: "text-[20rem] relative animate-spin text-white" }),
|
|
932
885
|
/* @__PURE__ */ i.jsx("p", { className: "text-white text-2xl select-none absolute", children: "Loading..." })
|
|
933
886
|
] });
|
|
934
|
-
function
|
|
887
|
+
function Zt(t) {
|
|
935
888
|
return re({ tag: "svg", attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(t);
|
|
936
889
|
}
|
|
937
|
-
function
|
|
890
|
+
function Qt(t) {
|
|
938
891
|
return re({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, child: [] }] })(t);
|
|
939
892
|
}
|
|
940
|
-
function
|
|
893
|
+
function er(t) {
|
|
941
894
|
return re({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, child: [] }] })(t);
|
|
942
895
|
}
|
|
943
|
-
function
|
|
896
|
+
function tr(t) {
|
|
944
897
|
return re({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M17.47 250.9C88.82 328.1 158 397.6 224.5 485.5c72.3-143.8 146.3-288.1 268.4-444.37L460 26.06C356.9 135.4 276.8 238.9 207.2 361.9c-48.4-43.6-126.62-105.3-174.38-137z" }, child: [] }] })(t);
|
|
945
898
|
}
|
|
946
|
-
const
|
|
947
|
-
const { showAlert: t, setShowAlert: n, messageAlert:
|
|
899
|
+
const rr = () => {
|
|
900
|
+
const { showAlert: t, setShowAlert: n, messageAlert: a, typeAlert: s } = G(), { alertTimeout: u } = ve(), [g, p] = A(0), v = {
|
|
948
901
|
danger: {
|
|
949
902
|
bgColor: "bg-red-50",
|
|
950
903
|
textColor: "text-red-700",
|
|
@@ -969,98 +922,98 @@ const sr = () => {
|
|
|
969
922
|
focusRing: "focus:ring-green-400",
|
|
970
923
|
progressColor: "bg-green-400"
|
|
971
924
|
}
|
|
972
|
-
}, { bgColor:
|
|
973
|
-
switch (
|
|
925
|
+
}, { bgColor: c, textColor: y, buttonBg: w, hoverBg: h, focusRing: E, progressColor: T } = v[s], N = (P) => {
|
|
926
|
+
switch (P) {
|
|
974
927
|
case "danger":
|
|
975
|
-
return /* @__PURE__ */ i.jsx(
|
|
928
|
+
return /* @__PURE__ */ i.jsx(er, { className: "text-xl" });
|
|
976
929
|
case "info":
|
|
977
|
-
return /* @__PURE__ */ i.jsx(
|
|
930
|
+
return /* @__PURE__ */ i.jsx(Qt, { className: "text-xl" });
|
|
978
931
|
case "success":
|
|
979
|
-
return /* @__PURE__ */ i.jsx(
|
|
932
|
+
return /* @__PURE__ */ i.jsx(tr, { className: "text-xl" });
|
|
980
933
|
}
|
|
981
934
|
}, L = () => {
|
|
982
935
|
n(!t);
|
|
983
936
|
};
|
|
984
|
-
return
|
|
985
|
-
let
|
|
986
|
-
const j = 100 / (
|
|
987
|
-
|
|
988
|
-
|
|
937
|
+
return Y(() => {
|
|
938
|
+
let P;
|
|
939
|
+
const j = 100 / (u / 100);
|
|
940
|
+
P = setInterval(() => {
|
|
941
|
+
p((I) => I >= 100 ? (clearInterval(P), 100) : I + j);
|
|
989
942
|
}, 100);
|
|
990
943
|
const D = setTimeout(() => {
|
|
991
944
|
L();
|
|
992
|
-
},
|
|
945
|
+
}, u);
|
|
993
946
|
return () => {
|
|
994
|
-
clearTimeout(D), clearInterval(
|
|
947
|
+
clearTimeout(D), clearInterval(P);
|
|
995
948
|
};
|
|
996
|
-
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${y} rounded-lg ${
|
|
997
|
-
/* @__PURE__ */ i.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 dark:bg-gray-700 absolute top-0 left-0 right-0", children: /* @__PURE__ */ i.jsx("div", { className: `${T} h-2.5 rounded-t-lg`, style: { width: `${
|
|
998
|
-
N(
|
|
999
|
-
/* @__PURE__ */ i.jsx("div", { className: "px-4 text-sm font-medium", children:
|
|
949
|
+
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${y} rounded-lg ${c} mx-auto fixed top-[calc(100vh-100px)] right-10`, role: "alert", children: [
|
|
950
|
+
/* @__PURE__ */ i.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 dark:bg-gray-700 absolute top-0 left-0 right-0", children: /* @__PURE__ */ i.jsx("div", { className: `${T} h-2.5 rounded-t-lg`, style: { width: `${g}%` } }) }),
|
|
951
|
+
N(s),
|
|
952
|
+
/* @__PURE__ */ i.jsx("div", { className: "px-4 text-sm font-medium", children: a }),
|
|
1000
953
|
/* @__PURE__ */ i.jsx(
|
|
1001
954
|
"button",
|
|
1002
955
|
{
|
|
1003
956
|
type: "button",
|
|
1004
|
-
className: `ms-auto ${w} rounded-lg focus:ring-2 ${E} p-1.5 ${
|
|
957
|
+
className: `ms-auto ${w} rounded-lg focus:ring-2 ${E} p-1.5 ${h} inline-flex items-center justify-center h-8 w-8`,
|
|
1005
958
|
title: "Close",
|
|
1006
959
|
onClick: L,
|
|
1007
|
-
children: /* @__PURE__ */ i.jsx(
|
|
960
|
+
children: /* @__PURE__ */ i.jsx(Zt, { className: "text-xl" })
|
|
1008
961
|
}
|
|
1009
962
|
)
|
|
1010
963
|
] });
|
|
1011
|
-
},
|
|
1012
|
-
const { isLoading: t } =
|
|
964
|
+
}, gr = () => {
|
|
965
|
+
const { isLoading: t } = Ee(), { showAlert: n } = G();
|
|
1013
966
|
return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
1014
|
-
t && /* @__PURE__ */ i.jsx(
|
|
967
|
+
t && /* @__PURE__ */ i.jsx(Xt, {}),
|
|
1015
968
|
/* @__PURE__ */ i.jsxs("main", { className: t ? "hidden" : "", children: [
|
|
1016
|
-
n && /* @__PURE__ */ i.jsx(
|
|
1017
|
-
/* @__PURE__ */ i.jsx(
|
|
969
|
+
n && /* @__PURE__ */ i.jsx(rr, {}),
|
|
970
|
+
/* @__PURE__ */ i.jsx(rt, {})
|
|
1018
971
|
] })
|
|
1019
972
|
] });
|
|
1020
|
-
},
|
|
973
|
+
}, Qe = (t) => {
|
|
1021
974
|
const {
|
|
1022
975
|
inputType: n,
|
|
1023
|
-
inputId:
|
|
1024
|
-
inputPlaceholder:
|
|
1025
|
-
inputRequired:
|
|
1026
|
-
inputValue:
|
|
1027
|
-
inputChange:
|
|
1028
|
-
} = t,
|
|
976
|
+
inputId: a,
|
|
977
|
+
inputPlaceholder: s,
|
|
978
|
+
inputRequired: u,
|
|
979
|
+
inputValue: g,
|
|
980
|
+
inputChange: p
|
|
981
|
+
} = t, c = ["text", "email", "password", "search", "tel", "url"].includes(n) ? n : "text";
|
|
1029
982
|
return /* @__PURE__ */ i.jsx(
|
|
1030
983
|
"input",
|
|
1031
984
|
{
|
|
1032
|
-
type:
|
|
1033
|
-
id:
|
|
985
|
+
type: c,
|
|
986
|
+
id: a,
|
|
1034
987
|
className: "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5",
|
|
1035
|
-
placeholder:
|
|
1036
|
-
required:
|
|
1037
|
-
value:
|
|
1038
|
-
onChange:
|
|
988
|
+
placeholder: s,
|
|
989
|
+
required: u ?? !0,
|
|
990
|
+
value: g,
|
|
991
|
+
onChange: p
|
|
1039
992
|
}
|
|
1040
993
|
);
|
|
1041
|
-
},
|
|
994
|
+
}, et = ({ label: t, labelId: n, labelStyle: a }) => /* @__PURE__ */ i.jsx("label", { htmlFor: n, className: `${a ?? "block mb-2 text-sm font-medium text-gray-900"}`, children: t }), nr = (t) => {
|
|
1042
995
|
const {
|
|
1043
996
|
// Variabili funzionamento della Login
|
|
1044
997
|
submitForm: n,
|
|
1045
|
-
formData:
|
|
1046
|
-
changeValue:
|
|
998
|
+
formData: a,
|
|
999
|
+
changeValue: s,
|
|
1047
1000
|
// Stile form
|
|
1048
|
-
formSize:
|
|
1049
|
-
formBgColor:
|
|
1050
|
-
formRounded:
|
|
1051
|
-
formShadow:
|
|
1001
|
+
formSize: u = "w-[800px]",
|
|
1002
|
+
formBgColor: g = "bg-slate-50",
|
|
1003
|
+
formRounded: p = "rounded-lg",
|
|
1004
|
+
formShadow: v = "shadow-lg",
|
|
1052
1005
|
// Input email/username
|
|
1053
|
-
userData:
|
|
1006
|
+
userData: c,
|
|
1054
1007
|
userLabel: y = "Email",
|
|
1055
1008
|
userType: w = "email",
|
|
1056
|
-
userPlaceholder:
|
|
1009
|
+
userPlaceholder: h = "email@email.it",
|
|
1057
1010
|
// Titolo
|
|
1058
1011
|
formTitle: E = "Login",
|
|
1059
1012
|
titleSize: T = "text-4xl",
|
|
1060
1013
|
titlePosition: N = "text-center",
|
|
1061
1014
|
titleSpacing: L = "my-12",
|
|
1062
1015
|
// Bottone
|
|
1063
|
-
buttonPosition:
|
|
1016
|
+
buttonPosition: P = "justify-center",
|
|
1064
1017
|
buttonSpacing: b = "my-12",
|
|
1065
1018
|
buttonColor: j = "bg-blue-500",
|
|
1066
1019
|
buttonHoverColor: D = "hoverbg-blue-700",
|
|
@@ -1069,113 +1022,113 @@ const sr = () => {
|
|
|
1069
1022
|
buttonRounded: X = "rounded-full",
|
|
1070
1023
|
buttonText: _ = "Login"
|
|
1071
1024
|
} = t;
|
|
1072
|
-
return /* @__PURE__ */ i.jsxs("form", { onSubmit: n, className: `${
|
|
1025
|
+
return /* @__PURE__ */ i.jsxs("form", { onSubmit: n, className: `${u} ${p} ${v} ${g}`, children: [
|
|
1073
1026
|
/* @__PURE__ */ i.jsx("h1", { className: `${T} ${N} ${L}`, children: E }),
|
|
1074
1027
|
/* @__PURE__ */ i.jsxs("div", { className: "flex justify-center flex-col gap-1 my-4 w-1/2 mx-auto", children: [
|
|
1075
|
-
/* @__PURE__ */ i.jsx(
|
|
1028
|
+
/* @__PURE__ */ i.jsx(et, { labelId: "user-email", label: y }),
|
|
1076
1029
|
/* @__PURE__ */ i.jsx(
|
|
1077
|
-
|
|
1030
|
+
Qe,
|
|
1078
1031
|
{
|
|
1079
1032
|
inputType: w,
|
|
1080
1033
|
inputId: "user-email",
|
|
1081
|
-
inputPlaceholder:
|
|
1082
|
-
inputValue:
|
|
1083
|
-
inputChange: (
|
|
1084
|
-
|
|
1034
|
+
inputPlaceholder: h,
|
|
1035
|
+
inputValue: c ? a[c] : a.email,
|
|
1036
|
+
inputChange: (O) => {
|
|
1037
|
+
s(c || "email", O.target.value);
|
|
1085
1038
|
}
|
|
1086
1039
|
}
|
|
1087
1040
|
)
|
|
1088
1041
|
] }),
|
|
1089
1042
|
/* @__PURE__ */ i.jsxs("div", { className: "flex justify-center flex-col gap-1 my-4 w-1/2 mx-auto", children: [
|
|
1090
|
-
/* @__PURE__ */ i.jsx(
|
|
1043
|
+
/* @__PURE__ */ i.jsx(et, { labelId: "password", label: "Password" }),
|
|
1091
1044
|
/* @__PURE__ */ i.jsx(
|
|
1092
|
-
|
|
1045
|
+
Qe,
|
|
1093
1046
|
{
|
|
1094
1047
|
inputType: "password",
|
|
1095
1048
|
inputId: "password",
|
|
1096
1049
|
inputPlaceholder: "Password",
|
|
1097
|
-
inputValue:
|
|
1098
|
-
inputChange: (
|
|
1099
|
-
|
|
1050
|
+
inputValue: a.password,
|
|
1051
|
+
inputChange: (O) => {
|
|
1052
|
+
s("password", O.target.value);
|
|
1100
1053
|
}
|
|
1101
1054
|
}
|
|
1102
1055
|
)
|
|
1103
1056
|
] }),
|
|
1104
|
-
/* @__PURE__ */ i.jsx("div", { className: `flex ${
|
|
1057
|
+
/* @__PURE__ */ i.jsx("div", { className: `flex ${P} items-center ${b}`, children: /* @__PURE__ */ i.jsx("button", { className: `${j} ${D} ${I} font-bold ${H} ${X}`, children: _ }) })
|
|
1105
1058
|
] });
|
|
1106
|
-
},
|
|
1107
|
-
const { login: t } =
|
|
1059
|
+
}, vr = () => {
|
|
1060
|
+
const { login: t } = Ce(), { setShowAlert: n, setTypeAlert: a, setMessageAlert: s } = G(), { clearLoginFormOnError: u } = ve(), g = tt(), p = {
|
|
1108
1061
|
email: "",
|
|
1109
1062
|
password: ""
|
|
1110
|
-
}, [
|
|
1111
|
-
|
|
1112
|
-
}, w = (
|
|
1113
|
-
t(
|
|
1063
|
+
}, [v, c] = A(p), y = (h, E) => {
|
|
1064
|
+
c((T) => ({ ...T, [h]: E }));
|
|
1065
|
+
}, w = (h) => {
|
|
1066
|
+
t(h, v), u && c(p);
|
|
1114
1067
|
};
|
|
1115
|
-
return
|
|
1116
|
-
const
|
|
1117
|
-
localStorage.getItem("accessToken") &&
|
|
1068
|
+
return Y(() => {
|
|
1069
|
+
const h = localStorage.getItem("id");
|
|
1070
|
+
localStorage.getItem("accessToken") && h && (g(`/dashboard/${h}`), n(!0), a("info"), s("Sei già loggato"));
|
|
1118
1071
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsx("div", { className: "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ i.jsx(
|
|
1119
|
-
|
|
1072
|
+
nr,
|
|
1120
1073
|
{
|
|
1121
1074
|
submitForm: w,
|
|
1122
|
-
formData:
|
|
1075
|
+
formData: v,
|
|
1123
1076
|
changeValue: y
|
|
1124
1077
|
}
|
|
1125
1078
|
) }) });
|
|
1126
|
-
},
|
|
1127
|
-
const { id: t } =
|
|
1079
|
+
}, pr = () => {
|
|
1080
|
+
const { id: t } = Ft(), { logout: n, setCurrentToken: a } = Ce(), { usersEndpoint: s } = ve(), { setIsLoading: u } = Ee(), { setShowAlert: g, setTypeAlert: p, setMessageAlert: v } = G(), [c, y] = A({}), [w, h] = A(null), [E, T] = A(!1), N = async () => {
|
|
1128
1081
|
try {
|
|
1129
|
-
|
|
1082
|
+
u(!0);
|
|
1130
1083
|
const b = localStorage.getItem("accessToken");
|
|
1131
1084
|
if (!b) {
|
|
1132
|
-
n(),
|
|
1085
|
+
n(), g(!0), p("danger"), v("Sessione scaduta");
|
|
1133
1086
|
return;
|
|
1134
1087
|
}
|
|
1135
|
-
|
|
1136
|
-
const I = (await (await
|
|
1137
|
-
`${
|
|
1088
|
+
a(b);
|
|
1089
|
+
const I = (await (await ce(g, p, v)).get(
|
|
1090
|
+
`${s}${t}`,
|
|
1138
1091
|
{ headers: {
|
|
1139
1092
|
Authorization: b
|
|
1140
1093
|
} }
|
|
1141
1094
|
)).data;
|
|
1142
|
-
y(I),
|
|
1095
|
+
y(I), u(!1);
|
|
1143
1096
|
} catch (b) {
|
|
1144
|
-
console.error(b),
|
|
1097
|
+
console.error(b), u(!1), n();
|
|
1145
1098
|
}
|
|
1146
1099
|
}, L = async () => {
|
|
1147
1100
|
try {
|
|
1148
1101
|
T(!0);
|
|
1149
1102
|
const b = localStorage.getItem("accessToken");
|
|
1150
1103
|
if (!b) {
|
|
1151
|
-
n(),
|
|
1104
|
+
n(), g(!0), p("danger"), v("Sessione scaduta");
|
|
1152
1105
|
return;
|
|
1153
1106
|
}
|
|
1154
|
-
const I = (await (await
|
|
1155
|
-
`${
|
|
1107
|
+
const I = (await (await ce(g, p, v)).get(
|
|
1108
|
+
`${s}`,
|
|
1156
1109
|
{ headers: {
|
|
1157
1110
|
Authorization: b
|
|
1158
1111
|
} }
|
|
1159
1112
|
)).data;
|
|
1160
|
-
|
|
1113
|
+
h(I), I && T(!1);
|
|
1161
1114
|
} catch (b) {
|
|
1162
|
-
console.error(b),
|
|
1115
|
+
console.error(b), u(!1), b.status === 401 && n(), T(!1);
|
|
1163
1116
|
}
|
|
1164
|
-
},
|
|
1165
|
-
n(),
|
|
1117
|
+
}, P = () => {
|
|
1118
|
+
n(), g(!0), p("info"), v("Hai effettuato il logout");
|
|
1166
1119
|
};
|
|
1167
|
-
return
|
|
1120
|
+
return Y(() => {
|
|
1168
1121
|
N();
|
|
1169
1122
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsxs("div", { className: "container mx-auto py-8", children: [
|
|
1170
1123
|
/* @__PURE__ */ i.jsxs("div", { className: "flex items-center justify-center gap-8 h-20", children: [
|
|
1171
1124
|
/* @__PURE__ */ i.jsxs("h1", { className: "text-4xl text-center text-slate-800", children: [
|
|
1172
1125
|
"Email: ",
|
|
1173
|
-
|
|
1126
|
+
c.email
|
|
1174
1127
|
] }),
|
|
1175
1128
|
/* @__PURE__ */ i.jsx(
|
|
1176
1129
|
"button",
|
|
1177
1130
|
{
|
|
1178
|
-
onClick:
|
|
1131
|
+
onClick: P,
|
|
1179
1132
|
className: "bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full",
|
|
1180
1133
|
children: "Logout"
|
|
1181
1134
|
}
|
|
@@ -1198,18 +1151,18 @@ const sr = () => {
|
|
|
1198
1151
|
] }) });
|
|
1199
1152
|
};
|
|
1200
1153
|
export {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1154
|
+
rr as Alert,
|
|
1155
|
+
ur as AlertProvider,
|
|
1156
|
+
dr as AuthPage,
|
|
1157
|
+
fr as AuthProvider,
|
|
1158
|
+
cr as ConfigProvider,
|
|
1159
|
+
pr as Dashboard,
|
|
1160
|
+
gr as DefaultLayout,
|
|
1161
|
+
Qe as Input,
|
|
1162
|
+
et as InputLabel,
|
|
1163
|
+
Xt as Loading,
|
|
1164
|
+
lr as LoadingProvider,
|
|
1165
|
+
vr as Login,
|
|
1166
|
+
nr as LoginForm,
|
|
1167
|
+
ce as fetchAxiosConfig
|
|
1215
1168
|
};
|