@ciscode/ui-authentication-kit 1.0.1 → 1.0.3
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/components/actions/InputField.d.ts.map +1 -1
- package/dist/components/actions/InputField.js +4 -7
- package/dist/components/actions/InputField.js.map +1 -1
- package/dist/components/actions/SocialButton.d.ts.map +1 -1
- package/dist/components/actions/SocialButton.js +2 -4
- package/dist/components/actions/SocialButton.js.map +1 -1
- package/dist/index.mjs +151 -156
- package/dist/index.umd.js +5 -5
- package/dist/pages/auth/SignInPage.js +2 -2
- package/dist/pages/auth/SignInPage.js.map +1 -1
- package/dist/pages/auth/SignUpPage.js +2 -2
- package/dist/pages/auth/SignUpPage.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import l, { createContext as He, useContext as Ke, useState as j, useRef as We, useEffect as K, useCallback as ut, forwardRef as Ge, createElement as me, useMemo as
|
|
1
|
+
import * as W from "react";
|
|
2
|
+
import l, { createContext as He, useContext as Ke, useState as j, useRef as We, useEffect as K, useCallback as ut, forwardRef as Ge, createElement as me, useMemo as re } from "react";
|
|
3
3
|
import pe from "axios";
|
|
4
4
|
import { jwtDecode as dt } from "jwt-decode";
|
|
5
5
|
import ft from "react-dom";
|
|
6
|
-
import { useNavigate as Ee, useLocation as Se, Routes as ht, Route as
|
|
6
|
+
import { useNavigate as Ee, useLocation as Se, Routes as ht, Route as Q, Navigate as ae } from "react-router";
|
|
7
7
|
const Ze = l.createContext(null);
|
|
8
8
|
function Ye() {
|
|
9
9
|
const r = l.useContext(Ze);
|
|
@@ -12,7 +12,7 @@ function Ye() {
|
|
|
12
12
|
return r;
|
|
13
13
|
}
|
|
14
14
|
const Je = He(null);
|
|
15
|
-
function
|
|
15
|
+
function Z() {
|
|
16
16
|
const r = Ke(Je);
|
|
17
17
|
if (!r)
|
|
18
18
|
throw new Error("useAuthState must be inside <AuthProvider>");
|
|
@@ -69,7 +69,7 @@ function mt(r, e) {
|
|
|
69
69
|
}
|
|
70
70
|
), r;
|
|
71
71
|
}
|
|
72
|
-
const x = (r) => typeof r == "string",
|
|
72
|
+
const x = (r) => typeof r == "string", _ = () => {
|
|
73
73
|
let r, e;
|
|
74
74
|
const t = new Promise((s, n) => {
|
|
75
75
|
r = s, e = n;
|
|
@@ -79,7 +79,7 @@ const x = (r) => typeof r == "string", X = () => {
|
|
|
79
79
|
r.forEach((s) => {
|
|
80
80
|
e[s] && (t[s] = e[s]);
|
|
81
81
|
});
|
|
82
|
-
}, xt = /###/g, Ie = (r) => r && r.indexOf("###") > -1 ? r.replace(xt, ".") : r, Oe = (r) => !r || x(r),
|
|
82
|
+
}, xt = /###/g, Ie = (r) => r && r.indexOf("###") > -1 ? r.replace(xt, ".") : r, Oe = (r) => !r || x(r), q = (r, e, t) => {
|
|
83
83
|
const s = x(e) ? e.split(".") : e;
|
|
84
84
|
let n = 0;
|
|
85
85
|
for (; n < s.length - 1; ) {
|
|
@@ -96,36 +96,36 @@ const x = (r) => typeof r == "string", X = () => {
|
|
|
96
96
|
const {
|
|
97
97
|
obj: s,
|
|
98
98
|
k: n
|
|
99
|
-
} =
|
|
99
|
+
} = q(r, e, Object);
|
|
100
100
|
if (s !== void 0 || e.length === 1) {
|
|
101
101
|
s[n] = t;
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
let a = e[e.length - 1], i = e.slice(0, e.length - 1), o =
|
|
104
|
+
let a = e[e.length - 1], i = e.slice(0, e.length - 1), o = q(r, i, Object);
|
|
105
105
|
for (; o.obj === void 0 && i.length; )
|
|
106
|
-
a = `${i[i.length - 1]}.${a}`, i = i.slice(0, i.length - 1), o =
|
|
106
|
+
a = `${i[i.length - 1]}.${a}`, i = i.slice(0, i.length - 1), o = q(r, i, Object), o != null && o.obj && typeof o.obj[`${o.k}.${a}`] < "u" && (o.obj = void 0);
|
|
107
107
|
o.obj[`${o.k}.${a}`] = t;
|
|
108
108
|
}, yt = (r, e, t, s) => {
|
|
109
109
|
const {
|
|
110
110
|
obj: n,
|
|
111
111
|
k: a
|
|
112
|
-
} =
|
|
112
|
+
} = q(r, e, Object);
|
|
113
113
|
n[a] = n[a] || [], n[a].push(t);
|
|
114
|
-
},
|
|
114
|
+
}, ie = (r, e) => {
|
|
115
115
|
const {
|
|
116
116
|
obj: t,
|
|
117
117
|
k: s
|
|
118
|
-
} =
|
|
118
|
+
} = q(r, e);
|
|
119
119
|
if (t && Object.prototype.hasOwnProperty.call(t, s))
|
|
120
120
|
return t[s];
|
|
121
121
|
}, bt = (r, e, t) => {
|
|
122
|
-
const s =
|
|
123
|
-
return s !== void 0 ? s :
|
|
122
|
+
const s = ie(r, t);
|
|
123
|
+
return s !== void 0 ? s : ie(e, t);
|
|
124
124
|
}, Qe = (r, e, t) => {
|
|
125
125
|
for (const s in e)
|
|
126
126
|
s !== "__proto__" && s !== "constructor" && (s in r ? x(r[s]) || r[s] instanceof String || x(e[s]) || e[s] instanceof String ? t && (r[s] = e[s]) : Qe(r[s], e[s], t) : r[s] = e[s]);
|
|
127
127
|
return r;
|
|
128
|
-
},
|
|
128
|
+
}, Y = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
129
129
|
var wt = {
|
|
130
130
|
"&": "&",
|
|
131
131
|
"<": "<",
|
|
@@ -180,7 +180,7 @@ const Et = [" ", ",", "?", "!", ";"], St = new vt(20), Lt = (r, e, t) => {
|
|
|
180
180
|
n = i;
|
|
181
181
|
}
|
|
182
182
|
return n;
|
|
183
|
-
},
|
|
183
|
+
}, se = (r) => r == null ? void 0 : r.replace("_", "-"), Ct = {
|
|
184
184
|
type: "logger",
|
|
185
185
|
log(r) {
|
|
186
186
|
this.output("log", r);
|
|
@@ -196,7 +196,7 @@ const Et = [" ", ",", "?", "!", ";"], St = new vt(20), Lt = (r, e, t) => {
|
|
|
196
196
|
(s = (t = console == null ? void 0 : console[r]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
class
|
|
199
|
+
class oe {
|
|
200
200
|
constructor(e, t = {}) {
|
|
201
201
|
this.init(e, t);
|
|
202
202
|
}
|
|
@@ -219,17 +219,17 @@ class le {
|
|
|
219
219
|
return n && !this.debug ? null : (x(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
220
220
|
}
|
|
221
221
|
create(e) {
|
|
222
|
-
return new
|
|
222
|
+
return new oe(this.logger, {
|
|
223
223
|
prefix: `${this.prefix}:${e}:`,
|
|
224
224
|
...this.options
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
clone(e) {
|
|
228
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
228
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new oe(this.logger, e);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
var B = new
|
|
232
|
-
class
|
|
231
|
+
var B = new oe();
|
|
232
|
+
class ce {
|
|
233
233
|
constructor() {
|
|
234
234
|
this.observers = {};
|
|
235
235
|
}
|
|
@@ -259,7 +259,7 @@ class ue {
|
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class Pe extends
|
|
262
|
+
class Pe extends ce {
|
|
263
263
|
constructor(e, t = {
|
|
264
264
|
ns: ["translation"],
|
|
265
265
|
defaultNS: "translation"
|
|
@@ -278,7 +278,7 @@ class Pe extends ue {
|
|
|
278
278
|
const a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, i = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
279
279
|
let o;
|
|
280
280
|
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : x(s) && a ? o.push(...s.split(a)) : o.push(s)));
|
|
281
|
-
const u =
|
|
281
|
+
const u = ie(this.data, o);
|
|
282
282
|
return !u && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), u || !i || !x(s) ? u : ye((d = (c = this.data) == null ? void 0 : c[e]) == null ? void 0 : d[t], s, a);
|
|
283
283
|
}
|
|
284
284
|
addResource(e, t, s, n, a = {
|
|
@@ -303,7 +303,7 @@ class Pe extends ue {
|
|
|
303
303
|
}) {
|
|
304
304
|
let o = [e, t];
|
|
305
305
|
e.indexOf(".") > -1 && (o = e.split("."), n = s, s = t, t = o[1]), this.addNamespaces(t);
|
|
306
|
-
let u =
|
|
306
|
+
let u = ie(this.data, o) || {};
|
|
307
307
|
i.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? Qe(u, s, a) : u = {
|
|
308
308
|
...u,
|
|
309
309
|
...s
|
|
@@ -357,7 +357,7 @@ function be(r, e) {
|
|
|
357
357
|
return t.join((e == null ? void 0 : e.keySeparator) ?? ".");
|
|
358
358
|
}
|
|
359
359
|
const Me = {}, fe = (r) => !x(r) && typeof r != "boolean" && typeof r != "number";
|
|
360
|
-
class
|
|
360
|
+
class le extends ce {
|
|
361
361
|
constructor(e, t = {}) {
|
|
362
362
|
super(), pt(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = B.create("translator");
|
|
363
363
|
}
|
|
@@ -436,7 +436,7 @@ class ce extends ue {
|
|
|
436
436
|
} : o;
|
|
437
437
|
const g = this.resolve(e, n);
|
|
438
438
|
let h = g == null ? void 0 : g.res;
|
|
439
|
-
const p = (g == null ? void 0 : g.usedKey) || o, y = (g == null ? void 0 : g.exactUsedKey) || o, L = ["[object Number]", "[object Function]", "[object RegExp]"], b = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, w = n.count !== void 0 && !x(n.count), C =
|
|
439
|
+
const p = (g == null ? void 0 : g.usedKey) || o, y = (g == null ? void 0 : g.exactUsedKey) || o, L = ["[object Number]", "[object Function]", "[object RegExp]"], b = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, w = n.count !== void 0 && !x(n.count), C = le.hasDefaultValue(n), A = w ? this.pluralResolver.getSuffix(f, n.count, n) : "", P = n.ordinal && w ? this.pluralResolver.getSuffix(f, n.count, {
|
|
440
440
|
ordinal: !1
|
|
441
441
|
}) : "", E = w && !n.ordinal && n.count === 0, v = E && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${A}`] || n[`defaultValue${P}`] || n.defaultValue;
|
|
442
442
|
let N = h;
|
|
@@ -445,37 +445,37 @@ class ce extends ue {
|
|
|
445
445
|
if (S && N && U && L.indexOf(M) < 0 && !(x(b) && Array.isArray(N))) {
|
|
446
446
|
if (!n.returnObjects && !this.options.returnObjects) {
|
|
447
447
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
448
|
-
const
|
|
448
|
+
const $ = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, N, {
|
|
449
449
|
...n,
|
|
450
450
|
ns: u
|
|
451
451
|
}) : `key '${o} (${this.language})' returned an object instead of string.`;
|
|
452
|
-
return a ? (g.res =
|
|
452
|
+
return a ? (g.res = $, g.usedParams = this.getUsedParamsDetails(n), g) : $;
|
|
453
453
|
}
|
|
454
454
|
if (i) {
|
|
455
|
-
const
|
|
456
|
-
for (const
|
|
457
|
-
if (Object.prototype.hasOwnProperty.call(N,
|
|
458
|
-
const T = `${k}${i}${
|
|
459
|
-
C && !h ? I[
|
|
455
|
+
const $ = Array.isArray(N), I = $ ? [] : {}, k = $ ? y : p;
|
|
456
|
+
for (const R in N)
|
|
457
|
+
if (Object.prototype.hasOwnProperty.call(N, R)) {
|
|
458
|
+
const T = `${k}${i}${R}`;
|
|
459
|
+
C && !h ? I[R] = this.translate(T, {
|
|
460
460
|
...n,
|
|
461
|
-
defaultValue: fe(v) ? v[
|
|
461
|
+
defaultValue: fe(v) ? v[R] : void 0,
|
|
462
462
|
joinArrays: !1,
|
|
463
463
|
ns: u
|
|
464
|
-
}) : I[
|
|
464
|
+
}) : I[R] = this.translate(T, {
|
|
465
465
|
...n,
|
|
466
466
|
joinArrays: !1,
|
|
467
467
|
ns: u
|
|
468
|
-
}), I[
|
|
468
|
+
}), I[R] === T && (I[R] = N[R]);
|
|
469
469
|
}
|
|
470
470
|
h = I;
|
|
471
471
|
}
|
|
472
472
|
} else if (S && x(b) && Array.isArray(h))
|
|
473
473
|
h = h.join(b), h && (h = this.extendTranslation(h, e, n, s));
|
|
474
474
|
else {
|
|
475
|
-
let
|
|
476
|
-
!this.isValidLookup(h) && C && (
|
|
477
|
-
const
|
|
478
|
-
if (I ||
|
|
475
|
+
let $ = !1, I = !1;
|
|
476
|
+
!this.isValidLookup(h) && C && ($ = !0, h = v), this.isValidLookup(h) || (I = !0, h = o);
|
|
477
|
+
const R = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && I ? void 0 : h, T = C && v !== h && this.options.updateMissing;
|
|
478
|
+
if (I || $ || T) {
|
|
479
479
|
if (this.logger.log(T ? "updateKey" : "missingKey", f, c, o, T ? v : h), i) {
|
|
480
480
|
const D = this.resolve(o, {
|
|
481
481
|
...n,
|
|
@@ -490,19 +490,19 @@ class ce extends ue {
|
|
|
490
490
|
F.push(O[D]);
|
|
491
491
|
else
|
|
492
492
|
this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(n.lng || this.language) : F.push(n.lng || this.language);
|
|
493
|
-
const H = (D, V,
|
|
493
|
+
const H = (D, V, J) => {
|
|
494
494
|
var Ce;
|
|
495
|
-
const Le = C &&
|
|
495
|
+
const Le = C && J !== h ? J : R;
|
|
496
496
|
this.options.missingKeyHandler ? this.options.missingKeyHandler(D, c, V, Le, T, n) : (Ce = this.backendConnector) != null && Ce.saveMissing && this.backendConnector.saveMissing(D, c, V, Le, T, n), this.emit("missingKey", D, c, V, h);
|
|
497
497
|
};
|
|
498
498
|
this.options.saveMissing && (this.options.saveMissingPlurals && w ? F.forEach((D) => {
|
|
499
499
|
const V = this.pluralResolver.getSuffixes(D, n);
|
|
500
|
-
E && n[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((
|
|
501
|
-
H([D], o +
|
|
500
|
+
E && n[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((J) => {
|
|
501
|
+
H([D], o + J, n[`defaultValue${J}`] || v);
|
|
502
502
|
});
|
|
503
503
|
}) : H(F, o, v));
|
|
504
504
|
}
|
|
505
|
-
h = this.extendTranslation(h, e, n, g, s), I && h === o && this.options.appendNamespaceToMissingKey && (h = `${c}${d}${o}`), (I ||
|
|
505
|
+
h = this.extendTranslation(h, e, n, g, s), I && h === o && this.options.appendNamespaceToMissingKey && (h = `${c}${d}${o}`), (I || $) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${d}${o}` : o, $ ? h : void 0, n));
|
|
506
506
|
}
|
|
507
507
|
return a ? (g.res = h, g.usedParams = this.getUsedParamsDetails(n), g) : h;
|
|
508
508
|
}
|
|
@@ -625,13 +625,13 @@ class Te {
|
|
|
625
625
|
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = B.create("languageUtils");
|
|
626
626
|
}
|
|
627
627
|
getScriptPartFromCode(e) {
|
|
628
|
-
if (e =
|
|
628
|
+
if (e = se(e), !e || e.indexOf("-") < 0)
|
|
629
629
|
return null;
|
|
630
630
|
const t = e.split("-");
|
|
631
631
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
632
632
|
}
|
|
633
633
|
getLanguagePartFromCode(e) {
|
|
634
|
-
if (e =
|
|
634
|
+
if (e = se(e), !e || e.indexOf("-") < 0)
|
|
635
635
|
return e;
|
|
636
636
|
const t = e.split("-");
|
|
637
637
|
return this.formatLanguageCode(t[0]);
|
|
@@ -695,14 +695,14 @@ class Te {
|
|
|
695
695
|
}), n;
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
const
|
|
698
|
+
const Re = {
|
|
699
699
|
zero: 0,
|
|
700
700
|
one: 1,
|
|
701
701
|
two: 2,
|
|
702
702
|
few: 3,
|
|
703
703
|
many: 4,
|
|
704
704
|
other: 5
|
|
705
|
-
},
|
|
705
|
+
}, $e = {
|
|
706
706
|
select: (r) => r === 1 ? "one" : "other",
|
|
707
707
|
resolvedOptions: () => ({
|
|
708
708
|
pluralCategories: ["one", "other"]
|
|
@@ -716,7 +716,7 @@ class It {
|
|
|
716
716
|
this.pluralRulesCache = {};
|
|
717
717
|
}
|
|
718
718
|
getRule(e, t = {}) {
|
|
719
|
-
const s =
|
|
719
|
+
const s = se(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", a = JSON.stringify({
|
|
720
720
|
cleanedCode: s,
|
|
721
721
|
type: n
|
|
722
722
|
});
|
|
@@ -729,9 +729,9 @@ class It {
|
|
|
729
729
|
});
|
|
730
730
|
} catch {
|
|
731
731
|
if (!Intl)
|
|
732
|
-
return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
732
|
+
return this.logger.error("No Intl support, please use an Intl polyfill!"), $e;
|
|
733
733
|
if (!e.match(/-|_/))
|
|
734
|
-
return
|
|
734
|
+
return $e;
|
|
735
735
|
const u = this.languageUtils.getLanguagePartFromCode(e);
|
|
736
736
|
i = this.getRule(u, t);
|
|
737
737
|
}
|
|
@@ -746,7 +746,7 @@ class It {
|
|
|
746
746
|
}
|
|
747
747
|
getSuffixes(e, t = {}) {
|
|
748
748
|
let s = this.getRule(e, t);
|
|
749
|
-
return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, a) =>
|
|
749
|
+
return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, a) => Re[n] - Re[a]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
|
|
750
750
|
}
|
|
751
751
|
getSuffix(e, t, s = {}) {
|
|
752
752
|
const n = this.getRule(e, s);
|
|
@@ -785,7 +785,7 @@ class Ae {
|
|
|
785
785
|
maxReplaces: L,
|
|
786
786
|
alwaysFormat: b
|
|
787
787
|
} = e.interpolation;
|
|
788
|
-
this.escape = t !== void 0 ? t : Nt, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = a ?
|
|
788
|
+
this.escape = t !== void 0 ? t : Nt, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = a ? Y(a) : i || "{{", this.suffix = o ? Y(o) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = d ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = m ? Y(m) : g || Y("$t("), this.nestingSuffix = h ? Y(h) : p || Y(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = b !== void 0 ? b : !1, this.resetRegExp();
|
|
789
789
|
}
|
|
790
790
|
reset() {
|
|
791
791
|
this.options && this.init(this.options);
|
|
@@ -908,9 +908,9 @@ const Ot = (r) => {
|
|
|
908
908
|
});
|
|
909
909
|
const i = s + JSON.stringify(a);
|
|
910
910
|
let o = e[i];
|
|
911
|
-
return o || (o = r(
|
|
911
|
+
return o || (o = r(se(s), n), e[i] = o), o(t);
|
|
912
912
|
};
|
|
913
|
-
}, jt = (r) => (e, t, s) => r(
|
|
913
|
+
}, jt = (r) => (e, t, s) => r(se(t), s)(e);
|
|
914
914
|
class Pt {
|
|
915
915
|
constructor(e = {}) {
|
|
916
916
|
this.logger = B.create("formatter"), this.options = e, this.init(e);
|
|
@@ -994,7 +994,7 @@ class Pt {
|
|
|
994
994
|
const Mt = (r, e) => {
|
|
995
995
|
r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
|
|
996
996
|
};
|
|
997
|
-
class Tt extends
|
|
997
|
+
class Tt extends ce {
|
|
998
998
|
constructor(e, t, s, n = {}) {
|
|
999
999
|
var a, i;
|
|
1000
1000
|
super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = B.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], (i = (a = this.backend) == null ? void 0 : a.init) == null || i.call(a, s, n.backend, n);
|
|
@@ -1187,17 +1187,17 @@ const ge = () => ({
|
|
|
1187
1187
|
}), Fe = (r) => {
|
|
1188
1188
|
var e, t;
|
|
1189
1189
|
return x(r.ns) && (r.ns = [r.ns]), x(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), x(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), ((t = (e = r.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r;
|
|
1190
|
-
},
|
|
1191
|
-
},
|
|
1190
|
+
}, ne = () => {
|
|
1191
|
+
}, Rt = (r) => {
|
|
1192
1192
|
Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
|
|
1193
1193
|
typeof r[t] == "function" && (r[t] = r[t].bind(r));
|
|
1194
1194
|
});
|
|
1195
1195
|
};
|
|
1196
|
-
class
|
|
1196
|
+
class ee extends ce {
|
|
1197
1197
|
constructor(e = {}, t) {
|
|
1198
1198
|
if (super(), this.options = Fe(e), this.services = {}, this.logger = B, this.modules = {
|
|
1199
1199
|
external: []
|
|
1200
|
-
},
|
|
1200
|
+
}, Rt(this), t && !this.isInitialized && !e.isClone) {
|
|
1201
1201
|
if (!this.options.initAsync)
|
|
1202
1202
|
return this.init(e, t), this;
|
|
1203
1203
|
setTimeout(() => {
|
|
@@ -1231,13 +1231,13 @@ class te extends ue {
|
|
|
1231
1231
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1232
1232
|
}, f.backendConnector = new Tt(n(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (g, ...h) => {
|
|
1233
1233
|
this.emit(g, ...h);
|
|
1234
|
-
}), this.modules.languageDetector && (f.languageDetector = n(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = n(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new
|
|
1234
|
+
}), this.modules.languageDetector && (f.languageDetector = n(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = n(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new le(this.services, this.options), this.translator.on("*", (g, ...h) => {
|
|
1235
1235
|
this.emit(g, ...h);
|
|
1236
1236
|
}), this.modules.external.forEach((g) => {
|
|
1237
1237
|
g.init && g.init(this);
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
|
-
if (this.format = this.options.interpolation.format, t || (t =
|
|
1240
|
+
if (this.format = this.options.interpolation.format, t || (t = ne), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1241
1241
|
const c = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1242
1242
|
c.length > 0 && c[0] !== "dev" && (this.options.lng = c[0]);
|
|
1243
1243
|
}
|
|
@@ -1246,7 +1246,7 @@ class te extends ue {
|
|
|
1246
1246
|
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((c) => {
|
|
1247
1247
|
this[c] = (...d) => (this.store[c](...d), this);
|
|
1248
1248
|
});
|
|
1249
|
-
const o =
|
|
1249
|
+
const o = _(), u = () => {
|
|
1250
1250
|
const c = (d, f) => {
|
|
1251
1251
|
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(f), t(d, f);
|
|
1252
1252
|
};
|
|
@@ -1256,7 +1256,7 @@ class te extends ue {
|
|
|
1256
1256
|
};
|
|
1257
1257
|
return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), o;
|
|
1258
1258
|
}
|
|
1259
|
-
loadResources(e, t =
|
|
1259
|
+
loadResources(e, t = ne) {
|
|
1260
1260
|
var a, i;
|
|
1261
1261
|
let s = t;
|
|
1262
1262
|
const n = x(e) ? e : this.language;
|
|
@@ -1277,8 +1277,8 @@ class te extends ue {
|
|
|
1277
1277
|
s(null);
|
|
1278
1278
|
}
|
|
1279
1279
|
reloadResources(e, t, s) {
|
|
1280
|
-
const n =
|
|
1281
|
-
return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s =
|
|
1280
|
+
const n = _();
|
|
1281
|
+
return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = ne), this.services.backendConnector.reload(e, t, (a) => {
|
|
1282
1282
|
n.resolve(), s(a);
|
|
1283
1283
|
}), n;
|
|
1284
1284
|
}
|
|
@@ -1303,7 +1303,7 @@ class te extends ue {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
changeLanguage(e, t) {
|
|
1305
1305
|
this.isLanguageChangingTo = e;
|
|
1306
|
-
const s =
|
|
1306
|
+
const s = _();
|
|
1307
1307
|
this.emit("languageChanging", e);
|
|
1308
1308
|
const n = (o) => {
|
|
1309
1309
|
this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
|
|
@@ -1368,7 +1368,7 @@ class te extends ue {
|
|
|
1368
1368
|
return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || i(s, e) && (!n || i(a, e)));
|
|
1369
1369
|
}
|
|
1370
1370
|
loadNamespaces(e, t) {
|
|
1371
|
-
const s =
|
|
1371
|
+
const s = _();
|
|
1372
1372
|
return this.options.ns ? (x(e) && (e = [e]), e.forEach((n) => {
|
|
1373
1373
|
this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
|
|
1374
1374
|
}), this.loadResources((n) => {
|
|
@@ -1376,7 +1376,7 @@ class te extends ue {
|
|
|
1376
1376
|
}), s) : (t && t(), Promise.resolve());
|
|
1377
1377
|
}
|
|
1378
1378
|
loadLanguages(e, t) {
|
|
1379
|
-
const s =
|
|
1379
|
+
const s = _();
|
|
1380
1380
|
x(e) && (e = [e]);
|
|
1381
1381
|
const n = this.options.preload || [], a = e.filter((i) => n.indexOf(i) < 0 && this.services.languageUtils.isSupportedCode(i));
|
|
1382
1382
|
return a.length ? (this.options.preload = n.concat(a), this.loadResources((i) => {
|
|
@@ -1400,17 +1400,17 @@ class te extends ue {
|
|
|
1400
1400
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1401
1401
|
}
|
|
1402
1402
|
static createInstance(e = {}, t) {
|
|
1403
|
-
const s = new
|
|
1404
|
-
return s.createInstance =
|
|
1403
|
+
const s = new ee(e, t);
|
|
1404
|
+
return s.createInstance = ee.createInstance, s;
|
|
1405
1405
|
}
|
|
1406
|
-
cloneInstance(e = {}, t =
|
|
1406
|
+
cloneInstance(e = {}, t = ne) {
|
|
1407
1407
|
const s = e.forkResourceStore;
|
|
1408
1408
|
s && delete e.forkResourceStore;
|
|
1409
1409
|
const n = {
|
|
1410
1410
|
...this.options,
|
|
1411
1411
|
...e,
|
|
1412
1412
|
isClone: !0
|
|
1413
|
-
}, a = new
|
|
1413
|
+
}, a = new ee(n);
|
|
1414
1414
|
if ((e.debug !== void 0 || e.prefix !== void 0) && (a.logger = a.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
1415
1415
|
a[o] = this[o];
|
|
1416
1416
|
}), a.services = {
|
|
@@ -1436,7 +1436,7 @@ class te extends ue {
|
|
|
1436
1436
|
};
|
|
1437
1437
|
a.services.interpolator = new Ae(c);
|
|
1438
1438
|
}
|
|
1439
|
-
return a.translator = new
|
|
1439
|
+
return a.translator = new le(a.services, n), a.translator.on("*", (o, ...u) => {
|
|
1440
1440
|
a.emit(o, ...u);
|
|
1441
1441
|
}), a.init(n, t), a.translator.options = n, a.translator.backendConnector.services.utils = {
|
|
1442
1442
|
hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
|
|
@@ -1452,7 +1452,7 @@ class te extends ue {
|
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
const z =
|
|
1455
|
+
const z = ee.createInstance();
|
|
1456
1456
|
z.createInstance;
|
|
1457
1457
|
z.dir;
|
|
1458
1458
|
z.init;
|
|
@@ -1467,7 +1467,7 @@ z.setDefaultNamespace;
|
|
|
1467
1467
|
z.hasLoadedNamespace;
|
|
1468
1468
|
z.loadNamespaces;
|
|
1469
1469
|
z.loadLanguages;
|
|
1470
|
-
const
|
|
1470
|
+
const $t = (r, e, t, s) => {
|
|
1471
1471
|
var a, i, o, u;
|
|
1472
1472
|
const n = [t, {
|
|
1473
1473
|
code: e,
|
|
@@ -1475,9 +1475,9 @@ const Rt = (r, e, t, s) => {
|
|
|
1475
1475
|
}];
|
|
1476
1476
|
if ((i = (a = r == null ? void 0 : r.services) == null ? void 0 : a.logger) != null && i.forward)
|
|
1477
1477
|
return r.services.logger.forward(n, "warn", "react-i18next::", !0);
|
|
1478
|
-
|
|
1478
|
+
G(n[0]) && (n[0] = `react-i18next:: ${n[0]}`), (u = (o = r == null ? void 0 : r.services) == null ? void 0 : o.logger) != null && u.warn ? r.services.logger.warn(...n) : console != null && console.warn && console.warn(...n);
|
|
1479
1479
|
}, ze = {}, we = (r, e, t, s) => {
|
|
1480
|
-
|
|
1480
|
+
G(t) && ze[t] || (G(t) && (ze[t] = /* @__PURE__ */ new Date()), $t(r, e, t, s));
|
|
1481
1481
|
}, qe = (r, e) => () => {
|
|
1482
1482
|
if (r.isInitialized)
|
|
1483
1483
|
e();
|
|
@@ -1492,7 +1492,7 @@ const Rt = (r, e, t, s) => {
|
|
|
1492
1492
|
}, Ne = (r, e, t) => {
|
|
1493
1493
|
r.loadNamespaces(e, qe(r, t));
|
|
1494
1494
|
}, Ve = (r, e, t, s) => {
|
|
1495
|
-
if (
|
|
1495
|
+
if (G(t) && (t = [t]), r.options.preload && r.options.preload.indexOf(e) > -1)
|
|
1496
1496
|
return Ne(r, t, s);
|
|
1497
1497
|
t.forEach((n) => {
|
|
1498
1498
|
r.options.ns.indexOf(n) < 0 && r.options.ns.push(n);
|
|
@@ -1505,7 +1505,7 @@ const Rt = (r, e, t, s) => {
|
|
|
1505
1505
|
if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !n(s.isLanguageChangingTo, r))
|
|
1506
1506
|
return !1;
|
|
1507
1507
|
}
|
|
1508
|
-
}),
|
|
1508
|
+
}), G = (r) => typeof r == "string", At = (r) => typeof r == "object" && r !== null, Ut = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, Ft = {
|
|
1509
1509
|
"&": "&",
|
|
1510
1510
|
"&": "&",
|
|
1511
1511
|
"<": "<",
|
|
@@ -1568,7 +1568,7 @@ const Yt = (r, e) => {
|
|
|
1568
1568
|
} = Ke(Gt) || {}, a = t || s || Wt();
|
|
1569
1569
|
if (a && !a.reportNamespaces && (a.reportNamespaces = new Zt()), !a) {
|
|
1570
1570
|
we(a, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
1571
|
-
const E = (N, U) =>
|
|
1571
|
+
const E = (N, U) => G(U) ? U : At(U) && G(U.defaultValue) ? U.defaultValue : Array.isArray(N) ? N[N.length - 1] : N, v = [E, {}, !1];
|
|
1572
1572
|
return v.t = E, v.i18n = {}, v.ready = !1, v;
|
|
1573
1573
|
}
|
|
1574
1574
|
(w = a.options.react) != null && w.wait && we(a, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
@@ -1581,7 +1581,7 @@ const Yt = (r, e) => {
|
|
|
1581
1581
|
keyPrefix: u
|
|
1582
1582
|
} = i;
|
|
1583
1583
|
let c = r || n || ((C = a.options) == null ? void 0 : C.defaultNS);
|
|
1584
|
-
c =
|
|
1584
|
+
c = G(c) ? [c] : c || ["translation"], (P = (A = a.reportNamespaces).addUsedNamespaces) == null || P.call(A, c);
|
|
1585
1585
|
const d = (a.isInitialized || a.initializedStoreOnce) && c.every((E) => Dt(E, a, i)), f = Jt(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), m = () => f, g = () => et(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), [h, p] = j(m);
|
|
1586
1586
|
let y = c.join();
|
|
1587
1587
|
e.lng && (y = `${e.lng}${y}`);
|
|
@@ -1617,12 +1617,12 @@ try {
|
|
|
1617
1617
|
document.cookie, _t = !0;
|
|
1618
1618
|
} catch {
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function ue(r) {
|
|
1621
1621
|
const { t: e } = Qt(r);
|
|
1622
1622
|
return e;
|
|
1623
1623
|
}
|
|
1624
1624
|
const Xt = ({ onConfirm: r }) => {
|
|
1625
|
-
const e =
|
|
1625
|
+
const e = ue("authLib");
|
|
1626
1626
|
return K(() => {
|
|
1627
1627
|
const { body: t } = document, s = t.style.overflow, n = t.style.pointerEvents;
|
|
1628
1628
|
return t.style.overflow = "hidden", t.style.pointerEvents = "none", () => {
|
|
@@ -1643,30 +1643,28 @@ const Xt = ({ onConfirm: r }) => {
|
|
|
1643
1643
|
)))),
|
|
1644
1644
|
document.body
|
|
1645
1645
|
);
|
|
1646
|
-
},
|
|
1646
|
+
}, te = ({
|
|
1647
1647
|
label: r,
|
|
1648
|
-
// translation key for the label
|
|
1649
1648
|
type: e = "text",
|
|
1650
1649
|
placeholder: t,
|
|
1651
|
-
// translation key for the placeholder
|
|
1652
1650
|
color: s = "",
|
|
1653
1651
|
value: n,
|
|
1654
1652
|
onChange: a
|
|
1655
1653
|
}) => {
|
|
1656
|
-
const i =
|
|
1657
|
-
return /* @__PURE__ */
|
|
1654
|
+
const i = W.useId();
|
|
1655
|
+
return /* @__PURE__ */ W.createElement("div", { className: "mt-8 flex flex-col" }, r && /* @__PURE__ */ W.createElement(
|
|
1658
1656
|
"label",
|
|
1659
1657
|
{
|
|
1660
|
-
htmlFor:
|
|
1658
|
+
htmlFor: i,
|
|
1661
1659
|
className: "self-start text-base text-black dark:text-white block ltr:text-left rtl:text-right"
|
|
1662
1660
|
},
|
|
1663
|
-
|
|
1664
|
-
), /* @__PURE__ */
|
|
1661
|
+
r
|
|
1662
|
+
), /* @__PURE__ */ W.createElement(
|
|
1665
1663
|
"input",
|
|
1666
1664
|
{
|
|
1667
|
-
id:
|
|
1665
|
+
id: i,
|
|
1668
1666
|
type: e,
|
|
1669
|
-
placeholder: t
|
|
1667
|
+
placeholder: t || void 0,
|
|
1670
1668
|
value: n,
|
|
1671
1669
|
onChange: (o) => a == null ? void 0 : a(o.target.value),
|
|
1672
1670
|
className: `
|
|
@@ -1676,29 +1674,26 @@ const Xt = ({ onConfirm: r }) => {
|
|
|
1676
1674
|
`
|
|
1677
1675
|
}
|
|
1678
1676
|
));
|
|
1679
|
-
}, tt = ({ icon: r, label: e }) => {
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
"
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
), e && /* @__PURE__ */ Y.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, t(e)));
|
|
1690
|
-
}, st = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", nt = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
|
|
1691
|
-
function q(r, e, t) {
|
|
1677
|
+
}, tt = ({ icon: r, label: e }) => /* @__PURE__ */ W.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ W.createElement(
|
|
1678
|
+
"img",
|
|
1679
|
+
{
|
|
1680
|
+
loading: "lazy",
|
|
1681
|
+
src: r,
|
|
1682
|
+
alt: e || "",
|
|
1683
|
+
className: "object-contain shrink-0 aspect-square w-[26px]"
|
|
1684
|
+
}
|
|
1685
|
+
), e && /* @__PURE__ */ W.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, e)), st = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", nt = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
|
|
1686
|
+
function X(r, e, t) {
|
|
1692
1687
|
return r ? r.startsWith(`${e}-`) ? r : r.startsWith("#") ? `${r}` : t : t;
|
|
1693
1688
|
}
|
|
1694
1689
|
function rt(r, e) {
|
|
1695
1690
|
const t = (e == null ? void 0 : e.bg) || "bg-sky-500", s = (e == null ? void 0 : e.text) || "text-gray-800", n = (e == null ? void 0 : e.border) || "border-gray-300", a = (e == null ? void 0 : e.fill) || "fill-current", i = (e == null ? void 0 : e.stroke) || "stroke-current";
|
|
1696
1691
|
return {
|
|
1697
|
-
bgClass:
|
|
1698
|
-
textClass:
|
|
1699
|
-
borderClass:
|
|
1700
|
-
fillClass:
|
|
1701
|
-
strokeClass:
|
|
1692
|
+
bgClass: X(r.bg ?? "", "bg", t),
|
|
1693
|
+
textClass: X(r.text ?? "", "text", s),
|
|
1694
|
+
borderClass: X(r.border ?? "", "border", n),
|
|
1695
|
+
fillClass: X(r.fill ?? "", "fill", a),
|
|
1696
|
+
strokeClass: X(r.stroke ?? "", "stroke", i)
|
|
1702
1697
|
};
|
|
1703
1698
|
}
|
|
1704
1699
|
/**
|
|
@@ -1806,7 +1801,7 @@ const rs = [
|
|
|
1806
1801
|
message: r,
|
|
1807
1802
|
dismissAfterMs: e = 4e3
|
|
1808
1803
|
}) => {
|
|
1809
|
-
const t =
|
|
1804
|
+
const t = ue("authLib"), [s, n] = j(!1);
|
|
1810
1805
|
return K(() => {
|
|
1811
1806
|
if (n(!!r), r && e > 0) {
|
|
1812
1807
|
const a = window.setTimeout(() => n(!1), e);
|
|
@@ -1843,7 +1838,7 @@ const rs = [
|
|
|
1843
1838
|
)
|
|
1844
1839
|
);
|
|
1845
1840
|
}, is = () => {
|
|
1846
|
-
const r =
|
|
1841
|
+
const r = ue("authLib"), e = Ee(), t = Se(), {
|
|
1847
1842
|
brandName: s = r("brandName", { defaultValue: "MyBrand" }),
|
|
1848
1843
|
colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
|
|
1849
1844
|
logoUrl: a,
|
|
@@ -1857,35 +1852,35 @@ const rs = [
|
|
|
1857
1852
|
},
|
|
1858
1853
|
baseUrl: c
|
|
1859
1854
|
// IMPORTANT: used for Google OAuth redirect
|
|
1860
|
-
} = Ye(), { login: d } =
|
|
1861
|
-
google: { icon: st, label: "social.google" },
|
|
1862
|
-
microsoft: { icon: nt, label: "social.microsoft" }
|
|
1855
|
+
} = Ye(), { login: d } = Z(), [f, m] = j(""), [g, h] = j(""), [p, y] = j(!1), [L, b] = j(null), S = {
|
|
1856
|
+
google: { icon: st, label: r("social.google") },
|
|
1857
|
+
microsoft: { icon: nt, label: r("social.microsoft") }
|
|
1863
1858
|
}, w = i.filter((M) => M in S).map((M) => ({
|
|
1864
1859
|
id: M,
|
|
1865
1860
|
icon: S[M].icon,
|
|
1866
1861
|
label: S[M].label
|
|
1867
1862
|
})), { bgClass: C, textClass: A, borderClass: P } = rt(n), E = `${C} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
|
|
1868
1863
|
async function v(M) {
|
|
1869
|
-
var
|
|
1864
|
+
var $;
|
|
1870
1865
|
if (M.preventDefault(), !p) {
|
|
1871
1866
|
b(null), y(!0);
|
|
1872
1867
|
try {
|
|
1873
1868
|
await d({ email: f, password: g });
|
|
1874
1869
|
} catch (I) {
|
|
1875
|
-
((
|
|
1870
|
+
(($ = I == null ? void 0 : I.response) == null ? void 0 : $.status) === 401 ? b(r("errors.invalidCredentials")) : b(r("errors.generic"));
|
|
1876
1871
|
} finally {
|
|
1877
1872
|
y(!1);
|
|
1878
1873
|
}
|
|
1879
1874
|
}
|
|
1880
1875
|
}
|
|
1881
1876
|
function N(M) {
|
|
1882
|
-
var I, k,
|
|
1877
|
+
var I, k, R;
|
|
1883
1878
|
if (!c) {
|
|
1884
1879
|
console.error("Auth baseUrl is not configured.");
|
|
1885
1880
|
return;
|
|
1886
1881
|
}
|
|
1887
|
-
const
|
|
1888
|
-
if (sessionStorage.setItem("postLoginRedirect",
|
|
1882
|
+
const $ = ((k = (I = t.state) == null ? void 0 : I.from) == null ? void 0 : k.pathname) || ((R = t.state) == null ? void 0 : R.from) || "/";
|
|
1883
|
+
if (sessionStorage.setItem("postLoginRedirect", $), M === "google") {
|
|
1889
1884
|
const T = "/oauth/google/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/google`);
|
|
1890
1885
|
O.searchParams.set("redirect", F), window.location.href = O.toString();
|
|
1891
1886
|
return;
|
|
@@ -1947,7 +1942,7 @@ const rs = [
|
|
|
1947
1942
|
},
|
|
1948
1943
|
r("SignInPage.signUp")
|
|
1949
1944
|
))), L && /* @__PURE__ */ l.createElement(ot, { message: L }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: v }, /* @__PURE__ */ l.createElement(
|
|
1950
|
-
|
|
1945
|
+
te,
|
|
1951
1946
|
{
|
|
1952
1947
|
label: r("form.emailLabel"),
|
|
1953
1948
|
type: "email",
|
|
@@ -1957,7 +1952,7 @@ const rs = [
|
|
|
1957
1952
|
onChange: m
|
|
1958
1953
|
}
|
|
1959
1954
|
), /* @__PURE__ */ l.createElement(
|
|
1960
|
-
|
|
1955
|
+
te,
|
|
1961
1956
|
{
|
|
1962
1957
|
label: r("form.passwordLabel"),
|
|
1963
1958
|
type: "password",
|
|
@@ -1986,7 +1981,7 @@ const rs = [
|
|
|
1986
1981
|
/* @__PURE__ */ l.createElement(tt, { icon: M.icon, label: M.label })
|
|
1987
1982
|
))))))));
|
|
1988
1983
|
}, os = () => {
|
|
1989
|
-
const r =
|
|
1984
|
+
const r = ue("authLib"), e = Ee(), t = Se(), {
|
|
1990
1985
|
brandName: s = r("brandName", { defaultValue: "MyBrand" }),
|
|
1991
1986
|
colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
|
|
1992
1987
|
logoUrl: a,
|
|
@@ -2000,16 +1995,16 @@ const rs = [
|
|
|
2000
1995
|
},
|
|
2001
1996
|
baseUrl: c
|
|
2002
1997
|
// IMPORTANT: used for OAuth redirect (same as SignIn)
|
|
2003
|
-
} = Ye(), { login: d, api: f } =
|
|
2004
|
-
google: { icon: st, label: "social.google" },
|
|
2005
|
-
microsoft: { icon: nt, label: "social.microsoft" }
|
|
1998
|
+
} = Ye(), { login: d, api: f } = Z(), [m, g] = j(""), [h, p] = j(""), [y, L] = j(""), [b, S] = j(!1), [w, C] = j(null), A = {
|
|
1999
|
+
google: { icon: st, label: r("social.google") },
|
|
2000
|
+
microsoft: { icon: nt, label: r("social.microsoft") }
|
|
2006
2001
|
}, P = i.filter((k) => k in A).map((k) => ({
|
|
2007
2002
|
id: k,
|
|
2008
2003
|
icon: A[k].icon,
|
|
2009
2004
|
label: A[k].label
|
|
2010
2005
|
})), { bgClass: E, textClass: v, borderClass: N } = rt(n), U = `${E} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
|
|
2011
2006
|
async function M(k) {
|
|
2012
|
-
var
|
|
2007
|
+
var R, T, F;
|
|
2013
2008
|
if (k.preventDefault(), !b) {
|
|
2014
2009
|
C(null), S(!0);
|
|
2015
2010
|
try {
|
|
@@ -2019,7 +2014,7 @@ const rs = [
|
|
|
2019
2014
|
name: m || void 0
|
|
2020
2015
|
}), await d({ email: h, password: y });
|
|
2021
2016
|
} catch (O) {
|
|
2022
|
-
const H = (
|
|
2017
|
+
const H = (R = O == null ? void 0 : O.response) == null ? void 0 : R.status;
|
|
2023
2018
|
C(
|
|
2024
2019
|
H === 400 ? ((F = (T = O == null ? void 0 : O.response) == null ? void 0 : T.data) == null ? void 0 : F.message) || r("errors.invalidData", {
|
|
2025
2020
|
defaultValue: "Please check the fields and try again."
|
|
@@ -2034,14 +2029,14 @@ const rs = [
|
|
|
2034
2029
|
}
|
|
2035
2030
|
}
|
|
2036
2031
|
}
|
|
2037
|
-
function
|
|
2032
|
+
function $(k) {
|
|
2038
2033
|
var T, F, O;
|
|
2039
2034
|
if (!c) {
|
|
2040
2035
|
console.error("Auth baseUrl is not configured.");
|
|
2041
2036
|
return;
|
|
2042
2037
|
}
|
|
2043
|
-
const
|
|
2044
|
-
if (sessionStorage.setItem("postLoginRedirect",
|
|
2038
|
+
const R = ((F = (T = t.state) == null ? void 0 : T.from) == null ? void 0 : F.pathname) || ((O = t.state) == null ? void 0 : O.from) || "/";
|
|
2039
|
+
if (sessionStorage.setItem("postLoginRedirect", R), k === "google") {
|
|
2045
2040
|
const H = "/oauth/google/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/google`);
|
|
2046
2041
|
V.searchParams.set("redirect", D), window.location.href = V.toString();
|
|
2047
2042
|
return;
|
|
@@ -2105,7 +2100,7 @@ const rs = [
|
|
|
2105
2100
|
},
|
|
2106
2101
|
r("SignUpPage.signIn", { defaultValue: "Sign in" })
|
|
2107
2102
|
))), w && /* @__PURE__ */ l.createElement(ot, { message: w }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: M }, /* @__PURE__ */ l.createElement(
|
|
2108
|
-
|
|
2103
|
+
te,
|
|
2109
2104
|
{
|
|
2110
2105
|
label: r("form.nameLabel", { defaultValue: "Name" }),
|
|
2111
2106
|
type: "text",
|
|
@@ -2117,7 +2112,7 @@ const rs = [
|
|
|
2117
2112
|
onChange: g
|
|
2118
2113
|
}
|
|
2119
2114
|
), /* @__PURE__ */ l.createElement(
|
|
2120
|
-
|
|
2115
|
+
te,
|
|
2121
2116
|
{
|
|
2122
2117
|
label: r("form.emailLabel"),
|
|
2123
2118
|
type: "email",
|
|
@@ -2127,7 +2122,7 @@ const rs = [
|
|
|
2127
2122
|
onChange: p
|
|
2128
2123
|
}
|
|
2129
2124
|
), /* @__PURE__ */ l.createElement(
|
|
2130
|
-
|
|
2125
|
+
te,
|
|
2131
2126
|
{
|
|
2132
2127
|
label: r("form.passwordLabel"),
|
|
2133
2128
|
type: "password",
|
|
@@ -2154,7 +2149,7 @@ const rs = [
|
|
|
2154
2149
|
{
|
|
2155
2150
|
key: k.id,
|
|
2156
2151
|
type: "button",
|
|
2157
|
-
onClick: () =>
|
|
2152
|
+
onClick: () => $(k.id),
|
|
2158
2153
|
className: "flex-1"
|
|
2159
2154
|
},
|
|
2160
2155
|
/* @__PURE__ */ l.createElement(tt, { icon: k.icon, label: k.label })
|
|
@@ -2165,8 +2160,8 @@ const rs = [
|
|
|
2165
2160
|
const s = sessionStorage.getItem("postLoginRedirect") || "/";
|
|
2166
2161
|
sessionStorage.removeItem("postLoginRedirect"), window.location.replace(s);
|
|
2167
2162
|
}, []), /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), ls = ({ children: r }) => {
|
|
2168
|
-
const { isAuthenticated: e } =
|
|
2169
|
-
return e ? r : /* @__PURE__ */ l.createElement(
|
|
2163
|
+
const { isAuthenticated: e } = Z(), t = Se();
|
|
2164
|
+
return e ? r : /* @__PURE__ */ l.createElement(ae, { to: "/login", state: { from: t }, replace: !0 });
|
|
2170
2165
|
}, gs = ({ config: r, children: e }) => {
|
|
2171
2166
|
const t = Ee(), [s, n] = j(
|
|
2172
2167
|
() => localStorage.getItem("authToken")
|
|
@@ -2179,7 +2174,7 @@ const rs = [
|
|
|
2179
2174
|
}
|
|
2180
2175
|
n(null), i(null), localStorage.removeItem("authToken"), sessionStorage.clear(), d(!1), t("/login", { replace: !0 });
|
|
2181
2176
|
}
|
|
2182
|
-
const m =
|
|
2177
|
+
const m = re(() => {
|
|
2183
2178
|
const p = pe.create({
|
|
2184
2179
|
baseURL: r.baseUrl,
|
|
2185
2180
|
withCredentials: !0
|
|
@@ -2214,7 +2209,7 @@ const rs = [
|
|
|
2214
2209
|
const { data: y } = await m.post("/auth/clients/login", p);
|
|
2215
2210
|
n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken), gt(), t("/", { replace: !0 });
|
|
2216
2211
|
}
|
|
2217
|
-
const h =
|
|
2212
|
+
const h = re(
|
|
2218
2213
|
() => ({
|
|
2219
2214
|
isAuthenticated: !!s,
|
|
2220
2215
|
accessToken: s,
|
|
@@ -2227,31 +2222,31 @@ const rs = [
|
|
|
2227
2222
|
[s, a, m]
|
|
2228
2223
|
);
|
|
2229
2224
|
return /* @__PURE__ */ l.createElement(Ze.Provider, { value: r }, /* @__PURE__ */ l.createElement(Je.Provider, { value: h }, /* @__PURE__ */ l.createElement(ht, null, /* @__PURE__ */ l.createElement(
|
|
2230
|
-
|
|
2225
|
+
Q,
|
|
2231
2226
|
{
|
|
2232
2227
|
path: "login",
|
|
2233
|
-
element: s ? /* @__PURE__ */ l.createElement(
|
|
2228
|
+
element: s ? /* @__PURE__ */ l.createElement(ae, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(is, { baseUrl: r.baseUrl, colors: r.colors })
|
|
2234
2229
|
}
|
|
2235
2230
|
), /* @__PURE__ */ l.createElement(
|
|
2236
|
-
|
|
2231
|
+
Q,
|
|
2237
2232
|
{
|
|
2238
2233
|
path: "signup",
|
|
2239
|
-
element: s ? /* @__PURE__ */ l.createElement(
|
|
2234
|
+
element: s ? /* @__PURE__ */ l.createElement(ae, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(os, null)
|
|
2240
2235
|
}
|
|
2241
2236
|
), /* @__PURE__ */ l.createElement(
|
|
2242
|
-
|
|
2237
|
+
Q,
|
|
2243
2238
|
{
|
|
2244
2239
|
path: "oauth/google/callback",
|
|
2245
2240
|
element: /* @__PURE__ */ l.createElement(Be, null)
|
|
2246
2241
|
}
|
|
2247
2242
|
), /* @__PURE__ */ l.createElement(
|
|
2248
|
-
|
|
2243
|
+
Q,
|
|
2249
2244
|
{
|
|
2250
2245
|
path: "/oauth/microsoft/callback",
|
|
2251
2246
|
element: /* @__PURE__ */ l.createElement(Be, null)
|
|
2252
2247
|
}
|
|
2253
2248
|
), /* @__PURE__ */ l.createElement(
|
|
2254
|
-
|
|
2249
|
+
Q,
|
|
2255
2250
|
{
|
|
2256
2251
|
path: "*",
|
|
2257
2252
|
element: /* @__PURE__ */ l.createElement(ls, null, e)
|
|
@@ -2259,15 +2254,15 @@ const rs = [
|
|
|
2259
2254
|
)), c && /* @__PURE__ */ l.createElement(Xt, { onConfirm: f })));
|
|
2260
2255
|
};
|
|
2261
2256
|
function lt(...r) {
|
|
2262
|
-
const { user: e } =
|
|
2257
|
+
const { user: e } = Z(), t = (e == null ? void 0 : e.roles) ?? [];
|
|
2263
2258
|
return r.some((s) => t.includes(s));
|
|
2264
2259
|
}
|
|
2265
2260
|
function ms(r) {
|
|
2266
|
-
const { user: e } =
|
|
2261
|
+
const { user: e } = Z();
|
|
2267
2262
|
return (e == null ? void 0 : e.modules.includes(r)) ?? !1;
|
|
2268
2263
|
}
|
|
2269
2264
|
function ve(...r) {
|
|
2270
|
-
const { user: e } =
|
|
2265
|
+
const { user: e } = Z(), t = (e == null ? void 0 : e.permissions) ?? [];
|
|
2271
2266
|
return r.every((s) => t.includes(s));
|
|
2272
2267
|
}
|
|
2273
2268
|
const ps = ({
|
|
@@ -2280,7 +2275,7 @@ const ps = ({
|
|
|
2280
2275
|
if (s.some((u) => lt(u)))
|
|
2281
2276
|
return /* @__PURE__ */ l.createElement(l.Fragment, null, r);
|
|
2282
2277
|
const i = e.length === 0 || e.every((u) => ve(u)), o = t.length === 0 || t.some((u) => ve(u));
|
|
2283
|
-
return i && o ? /* @__PURE__ */ l.createElement(l.Fragment, null, r) : /* @__PURE__ */ l.createElement(
|
|
2278
|
+
return i && o ? /* @__PURE__ */ l.createElement(l.Fragment, null, r) : /* @__PURE__ */ l.createElement(ae, { to: n, replace: !0 });
|
|
2284
2279
|
}, ct = l.createContext({}), xs = ct.Provider;
|
|
2285
2280
|
function ys(r, e) {
|
|
2286
2281
|
var n, a, i;
|
|
@@ -2288,7 +2283,7 @@ function ys(r, e) {
|
|
|
2288
2283
|
return s ? !!((a = s.perms) != null && a.some((o) => ve(o)) || (i = s.fallbackRoles) != null && i.some((o) => lt(o))) : !1;
|
|
2289
2284
|
}
|
|
2290
2285
|
const bs = () => {
|
|
2291
|
-
const { user: r, api: e, setUser: t } =
|
|
2286
|
+
const { user: r, api: e, setUser: t } = Z(), [s, n] = j((r == null ? void 0 : r.name) ?? ""), [a, i] = j((r == null ? void 0 : r.email) ?? ""), [o, u] = j(!1), [c, d] = j(!1), [f, m] = j({
|
|
2292
2287
|
open: !1,
|
|
2293
2288
|
type: "success",
|
|
2294
2289
|
title: "",
|
|
@@ -2315,7 +2310,7 @@ const bs = () => {
|
|
|
2315
2310
|
b = !0;
|
|
2316
2311
|
};
|
|
2317
2312
|
}, [e, t]);
|
|
2318
|
-
const h =
|
|
2313
|
+
const h = re(() => (s || (r == null ? void 0 : r.name) || (r == null ? void 0 : r.email) || "").trim(), [s, r == null ? void 0 : r.name, r == null ? void 0 : r.email]), p = re(() => h.charAt(0).toUpperCase() || "?", [h]);
|
|
2319
2314
|
async function y() {
|
|
2320
2315
|
if (r) {
|
|
2321
2316
|
d(!0);
|
|
@@ -2588,7 +2583,7 @@ export {
|
|
|
2588
2583
|
ct as RbacContext,
|
|
2589
2584
|
xs as RbacProvider,
|
|
2590
2585
|
ps as RequirePermissions,
|
|
2591
|
-
|
|
2586
|
+
Z as useAuthState,
|
|
2592
2587
|
ve as useCan,
|
|
2593
2588
|
ys as useGrant,
|
|
2594
2589
|
ms as useHasModule,
|