@neuctra/authix 1.2.16 → 1.2.17
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/neuctra-authix.es.js +84 -62
- package/dist/neuctra-authix.umd.js +12 -12
- package/dist/sdk/index.d.ts +11 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ce, { forwardRef as zt, createElement as
|
|
1
|
+
import Ce, { forwardRef as zt, createElement as Je, createContext as cr, useContext as dr, useState as P, useEffect as ee, useRef as dt } from "react";
|
|
2
2
|
function At(t, e) {
|
|
3
3
|
return function() {
|
|
4
4
|
return t.apply(e, arguments);
|
|
@@ -177,7 +177,7 @@ const Hr = (t) => {
|
|
|
177
177
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
178
178
|
typeof setImmediate == "function",
|
|
179
179
|
te(fe.postMessage)
|
|
180
|
-
),
|
|
180
|
+
), Kr = typeof queueMicrotask < "u" ? queueMicrotask.bind(fe) : typeof process < "u" && process.nextTick || Lt, Jr = (t) => t != null && te(t[Fe]), p = {
|
|
181
181
|
isArray: je,
|
|
182
182
|
isArrayBuffer: _t,
|
|
183
183
|
isBuffer: Te,
|
|
@@ -234,8 +234,8 @@ const Hr = (t) => {
|
|
|
234
234
|
isAsyncFn: Vr,
|
|
235
235
|
isThenable: Yr,
|
|
236
236
|
setImmediate: Lt,
|
|
237
|
-
asap:
|
|
238
|
-
isIterable:
|
|
237
|
+
asap: Kr,
|
|
238
|
+
isIterable: Jr
|
|
239
239
|
};
|
|
240
240
|
function $(t, e, n, s, i) {
|
|
241
241
|
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), s && (this.request = s), i && (this.response = i, this.status = i.status ? i.status : null);
|
|
@@ -817,7 +817,7 @@ function Ve(t, e) {
|
|
|
817
817
|
a = c.call(n, a, i.normalize(), e ? e.status : void 0);
|
|
818
818
|
}), i.normalize(), a;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function Kt(t) {
|
|
821
821
|
return !!(t && t.__CANCEL__);
|
|
822
822
|
}
|
|
823
823
|
function ve(t, e, n) {
|
|
@@ -826,7 +826,7 @@ function ve(t, e, n) {
|
|
|
826
826
|
p.inherits(ve, $, {
|
|
827
827
|
__CANCEL__: !0
|
|
828
828
|
});
|
|
829
|
-
function
|
|
829
|
+
function Jt(t, e, n) {
|
|
830
830
|
const s = n.config.validateStatus;
|
|
831
831
|
!n.status || !s || s(n.status) ? t(n) : e(new $(
|
|
832
832
|
"Request failed with status code " + n.status,
|
|
@@ -1044,7 +1044,7 @@ const Xt = (t) => {
|
|
|
1044
1044
|
config: t,
|
|
1045
1045
|
request: h
|
|
1046
1046
|
};
|
|
1047
|
-
|
|
1047
|
+
Jt(function(j) {
|
|
1048
1048
|
n(j), w();
|
|
1049
1049
|
}, function(j) {
|
|
1050
1050
|
s(j), w();
|
|
@@ -1253,7 +1253,7 @@ const Xt = (t) => {
|
|
|
1253
1253
|
}
|
|
1254
1254
|
}
|
|
1255
1255
|
p.isString(O) || (O = O ? "include" : "omit");
|
|
1256
|
-
const M = a && "credentials" in n.prototype,
|
|
1256
|
+
const M = a && "credentials" in n.prototype, J = {
|
|
1257
1257
|
...X,
|
|
1258
1258
|
signal: R,
|
|
1259
1259
|
method: h.toUpperCase(),
|
|
@@ -1262,8 +1262,8 @@ const Xt = (t) => {
|
|
|
1262
1262
|
duplex: "half",
|
|
1263
1263
|
credentials: M ? O : void 0
|
|
1264
1264
|
};
|
|
1265
|
-
G = a && new n(w,
|
|
1266
|
-
let H = await (a ? W(G, X) : W(w,
|
|
1265
|
+
G = a && new n(w, J);
|
|
1266
|
+
let H = await (a ? W(G, X) : W(w, J));
|
|
1267
1267
|
const F = x && (j === "stream" || j === "response");
|
|
1268
1268
|
if (x && (N || F && T)) {
|
|
1269
1269
|
const l = {};
|
|
@@ -1284,7 +1284,7 @@ const Xt = (t) => {
|
|
|
1284
1284
|
j = j || "text";
|
|
1285
1285
|
let Y = await y[p.findKey(y, j) || "text"](H, u);
|
|
1286
1286
|
return !F && T && T(), await new Promise((l, m) => {
|
|
1287
|
-
|
|
1287
|
+
Jt(l, m, {
|
|
1288
1288
|
data: Y,
|
|
1289
1289
|
headers: re.from(H.headers),
|
|
1290
1290
|
status: H.status,
|
|
@@ -1377,7 +1377,7 @@ function Et(t) {
|
|
|
1377
1377
|
s
|
|
1378
1378
|
), s.headers = re.from(s.headers), s;
|
|
1379
1379
|
}, function(s) {
|
|
1380
|
-
return
|
|
1380
|
+
return Kt(s) || (Ye(t), s && s.response && (s.response.data = Ve.call(
|
|
1381
1381
|
t,
|
|
1382
1382
|
t.transformResponse,
|
|
1383
1383
|
s.response
|
|
@@ -1712,31 +1712,31 @@ function rr(t) {
|
|
|
1712
1712
|
return rr(he(t, i));
|
|
1713
1713
|
}, n;
|
|
1714
1714
|
}
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1715
|
+
const K = rr(Ie);
|
|
1716
|
+
K.Axios = xe;
|
|
1717
|
+
K.CanceledError = ve;
|
|
1718
|
+
K.CancelToken = Dn;
|
|
1719
|
+
K.isCancel = Kt;
|
|
1720
|
+
K.VERSION = er;
|
|
1721
|
+
K.toFormData = Me;
|
|
1722
|
+
K.AxiosError = $;
|
|
1723
|
+
K.Cancel = K.CanceledError;
|
|
1724
|
+
K.all = function(e) {
|
|
1725
1725
|
return Promise.all(e);
|
|
1726
1726
|
};
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1727
|
+
K.spread = Nn;
|
|
1728
|
+
K.isAxiosError = Fn;
|
|
1729
|
+
K.mergeConfig = he;
|
|
1730
|
+
K.AxiosHeaders = re;
|
|
1731
|
+
K.formToJSON = (t) => Yt(p.isHTMLForm(t) ? new FormData(t) : t);
|
|
1732
|
+
K.getAdapter = Qt.getAdapter;
|
|
1733
|
+
K.HttpStatusCode = et;
|
|
1734
|
+
K.default = K;
|
|
1735
1735
|
const {
|
|
1736
1736
|
Axios: Vs,
|
|
1737
1737
|
AxiosError: Ys,
|
|
1738
|
-
CanceledError:
|
|
1739
|
-
isCancel:
|
|
1738
|
+
CanceledError: Ks,
|
|
1739
|
+
isCancel: Js,
|
|
1740
1740
|
CancelToken: Gs,
|
|
1741
1741
|
VERSION: Xs,
|
|
1742
1742
|
all: Zs,
|
|
@@ -1749,7 +1749,7 @@ const {
|
|
|
1749
1749
|
formToJSON: ii,
|
|
1750
1750
|
getAdapter: ai,
|
|
1751
1751
|
mergeConfig: oi
|
|
1752
|
-
} =
|
|
1752
|
+
} = K;
|
|
1753
1753
|
class li {
|
|
1754
1754
|
baseUrl;
|
|
1755
1755
|
apiKey;
|
|
@@ -1762,7 +1762,7 @@ class li {
|
|
|
1762
1762
|
constructor(e) {
|
|
1763
1763
|
if (!e || !e.baseUrl)
|
|
1764
1764
|
throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");
|
|
1765
|
-
this.baseUrl = e.baseUrl.replace(/\/$/, ""), this.apiKey = e.apiKey || null, this.appId = e.appId || null, this.client =
|
|
1765
|
+
this.baseUrl = e.baseUrl.replace(/\/$/, ""), this.apiKey = e.apiKey || null, this.appId = e.appId || null, this.client = K.create({
|
|
1766
1766
|
baseURL: this.baseUrl,
|
|
1767
1767
|
headers: {
|
|
1768
1768
|
"Content-Type": "application/json",
|
|
@@ -1796,7 +1796,7 @@ class li {
|
|
|
1796
1796
|
// 👈 override axios default
|
|
1797
1797
|
})).data;
|
|
1798
1798
|
} catch (o) {
|
|
1799
|
-
throw
|
|
1799
|
+
throw K.isAxiosError(o) ? {
|
|
1800
1800
|
message: o.response?.data?.message || o.message || "Request failed",
|
|
1801
1801
|
status: o.response?.status ?? 0
|
|
1802
1802
|
} : { message: o.message || "Unexpected error occurred" };
|
|
@@ -1943,6 +1943,28 @@ class li {
|
|
|
1943
1943
|
return { authenticated: !1 };
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
|
+
/**
|
|
1947
|
+
* 👤 Get user by ID or username
|
|
1948
|
+
*
|
|
1949
|
+
* Route:
|
|
1950
|
+
* GET /users/:appId/user?id=USER_ID
|
|
1951
|
+
* GET /users/:appId/user?username=USERNAME
|
|
1952
|
+
*/
|
|
1953
|
+
async getUser(e) {
|
|
1954
|
+
const n = this.appId;
|
|
1955
|
+
if (!n)
|
|
1956
|
+
throw new Error("getUser: 'appId' is required in SDK config");
|
|
1957
|
+
if (!e?.id && !e?.username)
|
|
1958
|
+
throw new Error("getUser: either 'id' or 'username' is required");
|
|
1959
|
+
const s = new URLSearchParams();
|
|
1960
|
+
return e.id && s.append("id", e.id), e.username && s.append("username", e.username), await this.request(
|
|
1961
|
+
"GET",
|
|
1962
|
+
`/users/${encodeURIComponent(n)}/user?${s.toString()}`,
|
|
1963
|
+
void 0,
|
|
1964
|
+
{},
|
|
1965
|
+
!0
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1946
1968
|
/**
|
|
1947
1969
|
* Update an existing user
|
|
1948
1970
|
* @param params fields to update
|
|
@@ -2479,7 +2501,7 @@ function qn() {
|
|
|
2479
2501
|
}
|
|
2480
2502
|
function d() {
|
|
2481
2503
|
var l = t(this.type);
|
|
2482
|
-
return
|
|
2504
|
+
return J[l] || (J[l] = !0, console.error(
|
|
2483
2505
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
2484
2506
|
)), l = this.props.ref, l !== void 0 ? l : null;
|
|
2485
2507
|
}
|
|
@@ -2578,7 +2600,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
2578
2600
|
return l();
|
|
2579
2601
|
}
|
|
2580
2602
|
};
|
|
2581
|
-
var M,
|
|
2603
|
+
var M, J = {}, H = E.react_stack_bottom_frame.bind(
|
|
2582
2604
|
E,
|
|
2583
2605
|
a
|
|
2584
2606
|
)(), F = z(s(a)), Y = {};
|
|
@@ -2660,7 +2682,7 @@ const Yn = zt(
|
|
|
2660
2682
|
children: a,
|
|
2661
2683
|
iconNode: o,
|
|
2662
2684
|
...c
|
|
2663
|
-
}, d) =>
|
|
2685
|
+
}, d) => Je(
|
|
2664
2686
|
"svg",
|
|
2665
2687
|
{
|
|
2666
2688
|
ref: d,
|
|
@@ -2674,7 +2696,7 @@ const Yn = zt(
|
|
|
2674
2696
|
...c
|
|
2675
2697
|
},
|
|
2676
2698
|
[
|
|
2677
|
-
...o.map(([f, x]) =>
|
|
2699
|
+
...o.map(([f, x]) => Je(f, x)),
|
|
2678
2700
|
...Array.isArray(a) ? a : [a]
|
|
2679
2701
|
]
|
|
2680
2702
|
)
|
|
@@ -2687,7 +2709,7 @@ const Yn = zt(
|
|
|
2687
2709
|
*/
|
|
2688
2710
|
const L = (t, e) => {
|
|
2689
2711
|
const n = zt(
|
|
2690
|
-
({ className: s, ...i }, a) =>
|
|
2712
|
+
({ className: s, ...i }, a) => Je(Yn, {
|
|
2691
2713
|
ref: a,
|
|
2692
2714
|
iconNode: e,
|
|
2693
2715
|
className: nr(
|
|
@@ -2706,7 +2728,7 @@ const L = (t, e) => {
|
|
|
2706
2728
|
* This source code is licensed under the ISC license.
|
|
2707
2729
|
* See the LICENSE file in the root directory of this source tree.
|
|
2708
2730
|
*/
|
|
2709
|
-
const
|
|
2731
|
+
const Kn = [
|
|
2710
2732
|
[
|
|
2711
2733
|
"path",
|
|
2712
2734
|
{
|
|
@@ -2715,7 +2737,7 @@ const Jn = [
|
|
|
2715
2737
|
}
|
|
2716
2738
|
],
|
|
2717
2739
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
2718
|
-
],
|
|
2740
|
+
], Jn = L("badge-check", Kn);
|
|
2719
2741
|
/**
|
|
2720
2742
|
* @license lucide-react v0.544.0 - ISC
|
|
2721
2743
|
*
|
|
@@ -2769,7 +2791,7 @@ const es = [
|
|
|
2769
2791
|
const ts = [
|
|
2770
2792
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
2771
2793
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
2772
|
-
],
|
|
2794
|
+
], Ke = L("circle-check", ts);
|
|
2773
2795
|
/**
|
|
2774
2796
|
* @license lucide-react v0.544.0 - ISC
|
|
2775
2797
|
*
|
|
@@ -3168,7 +3190,7 @@ const Ns = [
|
|
|
3168
3190
|
}, M = () => {
|
|
3169
3191
|
const F = {};
|
|
3170
3192
|
return w.name.trim() || (F.name = "Name is required"), w.email.trim() ? /\S+@\S+\.\S+/.test(w.email) || (F.email = "Invalid email address") : F.email = "Email is required", w.password ? w.password.length < 6 && (F.password = "Password must be at least 6 characters") : F.password = "Password is required", q(F), Object.keys(F).length === 0;
|
|
3171
|
-
},
|
|
3193
|
+
}, J = async (F) => {
|
|
3172
3194
|
if (F.preventDefault(), !!M()) {
|
|
3173
3195
|
A(!0), b(null);
|
|
3174
3196
|
try {
|
|
@@ -3317,7 +3339,7 @@ const Ns = [
|
|
|
3317
3339
|
/* @__PURE__ */ r.jsxs(
|
|
3318
3340
|
"form",
|
|
3319
3341
|
{
|
|
3320
|
-
onSubmit:
|
|
3342
|
+
onSubmit: J,
|
|
3321
3343
|
style: { display: "flex", flexDirection: "column", gap: "14px" },
|
|
3322
3344
|
children: [
|
|
3323
3345
|
f && d && d.length === 2 && /* @__PURE__ */ r.jsxs(
|
|
@@ -3779,7 +3801,7 @@ const Ns = [
|
|
|
3779
3801
|
return m(), window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
|
|
3780
3802
|
}
|
|
3781
3803
|
}, []);
|
|
3782
|
-
const
|
|
3804
|
+
const J = async (m) => {
|
|
3783
3805
|
m.preventDefault(), C(!0), A(null);
|
|
3784
3806
|
try {
|
|
3785
3807
|
const S = await x.loginUser({ email: N, password: j }), { user: D } = S;
|
|
@@ -3934,7 +3956,7 @@ const Ns = [
|
|
|
3934
3956
|
y === "login" && /* @__PURE__ */ r.jsxs(
|
|
3935
3957
|
"form",
|
|
3936
3958
|
{
|
|
3937
|
-
onSubmit:
|
|
3959
|
+
onSubmit: J,
|
|
3938
3960
|
style: { display: "flex", flexDirection: "column", gap: "14px" },
|
|
3939
3961
|
children: [
|
|
3940
3962
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -4754,7 +4776,7 @@ const Ns = [
|
|
|
4754
4776
|
fontWeight: 500
|
|
4755
4777
|
},
|
|
4756
4778
|
children: [
|
|
4757
|
-
/* @__PURE__ */ r.jsx(
|
|
4779
|
+
/* @__PURE__ */ r.jsx(Ke, { size: 16 }),
|
|
4758
4780
|
/* @__PURE__ */ r.jsx("span", { children: "Confirmation accepted" })
|
|
4759
4781
|
]
|
|
4760
4782
|
}
|
|
@@ -5013,7 +5035,7 @@ const Ns = [
|
|
|
5013
5035
|
color: "white",
|
|
5014
5036
|
flexShrink: 0
|
|
5015
5037
|
},
|
|
5016
|
-
children: /* @__PURE__ */ r.jsx(
|
|
5038
|
+
children: /* @__PURE__ */ r.jsx(Ke, { size: 20 })
|
|
5017
5039
|
}
|
|
5018
5040
|
),
|
|
5019
5041
|
/* @__PURE__ */ r.jsxs("div", { style: { flex: 1 }, children: [
|
|
@@ -5059,7 +5081,7 @@ const Ns = [
|
|
|
5059
5081
|
},
|
|
5060
5082
|
children: [
|
|
5061
5083
|
/* @__PURE__ */ r.jsx(
|
|
5062
|
-
|
|
5084
|
+
Ke,
|
|
5063
5085
|
{
|
|
5064
5086
|
size: 48,
|
|
5065
5087
|
style: {
|
|
@@ -6420,7 +6442,7 @@ const Ns = [
|
|
|
6420
6442
|
onVerify: s,
|
|
6421
6443
|
primaryColor: i = "#00C212"
|
|
6422
6444
|
}) => {
|
|
6423
|
-
const a = me(), [o, c] = P(null), [d, f] = P(), [x, y] = P(!0), [k, E] = P(!1), [u, w] = P(!1), [h, I] = P(!1), [C, g] = P(!1), [A, N] = P(!1), [b, j] = P(!1), [q, O] = P(!1), [X, W] = P(!1), [R, G] = P(null), [T, z] = P(!1), [M,
|
|
6445
|
+
const a = me(), [o, c] = P(null), [d, f] = P(), [x, y] = P(!0), [k, E] = P(!1), [u, w] = P(!1), [h, I] = P(!1), [C, g] = P(!1), [A, N] = P(!1), [b, j] = P(!1), [q, O] = P(!1), [X, W] = P(!1), [R, G] = P(null), [T, z] = P(!1), [M, J] = P({
|
|
6424
6446
|
email: "",
|
|
6425
6447
|
otp: ""
|
|
6426
6448
|
}), [H, F] = P(!1), [Y, l] = P(!1);
|
|
@@ -6488,7 +6510,7 @@ const Ns = [
|
|
|
6488
6510
|
if (V) {
|
|
6489
6511
|
m("success", Z || "Email verified!");
|
|
6490
6512
|
const de = { ...d, isVerified: !0 };
|
|
6491
|
-
f(de), typeof s == "function" && s(de),
|
|
6513
|
+
f(de), typeof s == "function" && s(de), J({ email: de.email, otp: "" }), F(!1), j?.(!1);
|
|
6492
6514
|
} else
|
|
6493
6515
|
m("error", Z || "Verification failed");
|
|
6494
6516
|
} catch (_) {
|
|
@@ -6575,7 +6597,7 @@ const Ns = [
|
|
|
6575
6597
|
}
|
|
6576
6598
|
})();
|
|
6577
6599
|
}, []), ee(() => {
|
|
6578
|
-
d?.email &&
|
|
6600
|
+
d?.email && J((v) => ({ ...v, email: d.email }));
|
|
6579
6601
|
}, [d?.email]);
|
|
6580
6602
|
const ge = (v, _) => {
|
|
6581
6603
|
let V = parseInt(v.replace("#", ""), 16), Z = (V >> 16) + _, de = (V >> 8 & 255) + _, Be = (V & 255) + _;
|
|
@@ -7529,12 +7551,12 @@ const Ns = [
|
|
|
7529
7551
|
{
|
|
7530
7552
|
isOpen: b,
|
|
7531
7553
|
onClose: () => {
|
|
7532
|
-
j(!1), F(!1),
|
|
7554
|
+
j(!1), F(!1), J({ email: d?.email || "", otp: "" });
|
|
7533
7555
|
},
|
|
7534
7556
|
onVerify: ne,
|
|
7535
7557
|
onSendOTP: D,
|
|
7536
7558
|
verifyFormData: M,
|
|
7537
|
-
setVerifyFormData:
|
|
7559
|
+
setVerifyFormData: J,
|
|
7538
7560
|
otpSent: H,
|
|
7539
7561
|
verifying: Y,
|
|
7540
7562
|
user: d,
|
|
@@ -7993,7 +8015,7 @@ const Ns = [
|
|
|
7993
8015
|
} finally {
|
|
7994
8016
|
N(!1);
|
|
7995
8017
|
}
|
|
7996
|
-
},
|
|
8018
|
+
}, J = (l, m) => {
|
|
7997
8019
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), m());
|
|
7998
8020
|
}, H = () => o || C?.profileUrl, F = () => {
|
|
7999
8021
|
const l = H();
|
|
@@ -8015,7 +8037,7 @@ const Ns = [
|
|
|
8015
8037
|
{
|
|
8016
8038
|
ref: O,
|
|
8017
8039
|
onClick: () => I((l) => !l),
|
|
8018
|
-
onKeyDown: (l) =>
|
|
8040
|
+
onKeyDown: (l) => J(l, () => I((m) => !m)),
|
|
8019
8041
|
tabIndex: 0,
|
|
8020
8042
|
role: "button",
|
|
8021
8043
|
"aria-haspopup": "true",
|
|
@@ -8067,7 +8089,7 @@ const Ns = [
|
|
|
8067
8089
|
ref: O,
|
|
8068
8090
|
style: z.avatarButton,
|
|
8069
8091
|
onClick: () => I((l) => !l),
|
|
8070
|
-
onKeyDown: (l) =>
|
|
8092
|
+
onKeyDown: (l) => J(l, () => I((m) => !m)),
|
|
8071
8093
|
tabIndex: 0,
|
|
8072
8094
|
role: "button",
|
|
8073
8095
|
"aria-haspopup": "true",
|
|
@@ -8184,7 +8206,7 @@ const Ns = [
|
|
|
8184
8206
|
onMouseOut: (l) => {
|
|
8185
8207
|
l.currentTarget.style.backgroundColor = "transparent";
|
|
8186
8208
|
},
|
|
8187
|
-
onKeyDown: (l) =>
|
|
8209
|
+
onKeyDown: (l) => J(l, F),
|
|
8188
8210
|
role: "menuitem",
|
|
8189
8211
|
tabIndex: 0,
|
|
8190
8212
|
children: [
|
|
@@ -8204,7 +8226,7 @@ const Ns = [
|
|
|
8204
8226
|
onMouseOut: (l) => {
|
|
8205
8227
|
l.currentTarget.style.backgroundColor = "transparent";
|
|
8206
8228
|
},
|
|
8207
|
-
onKeyDown: (l) =>
|
|
8229
|
+
onKeyDown: (l) => J(l, Y),
|
|
8208
8230
|
role: "menuitem",
|
|
8209
8231
|
tabIndex: 0,
|
|
8210
8232
|
children: [
|
|
@@ -8246,7 +8268,7 @@ const Ns = [
|
|
|
8246
8268
|
onMouseOut: (l) => {
|
|
8247
8269
|
l.currentTarget.style.backgroundColor = "transparent";
|
|
8248
8270
|
},
|
|
8249
|
-
onKeyDown: (l) =>
|
|
8271
|
+
onKeyDown: (l) => J(l, n),
|
|
8250
8272
|
role: "menuitem",
|
|
8251
8273
|
tabIndex: 0,
|
|
8252
8274
|
children: [
|
|
@@ -8464,7 +8486,7 @@ const Ns = [
|
|
|
8464
8486
|
gap: 8
|
|
8465
8487
|
},
|
|
8466
8488
|
children: [
|
|
8467
|
-
/* @__PURE__ */ r.jsx(
|
|
8489
|
+
/* @__PURE__ */ r.jsx(Jn, { size: 32, color: h.accent }),
|
|
8468
8490
|
/* @__PURE__ */ r.jsx(
|
|
8469
8491
|
"h2",
|
|
8470
8492
|
{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(ee,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(ee=typeof globalThis<"u"?globalThis:ee||self,S(ee.NeuctraAuthix={},ee.React))})(this,(function(ee,S){"use strict";function lt(t,e){return function(){return t.apply(e,arguments)}}const{toString:sr}=Object.prototype,{getPrototypeOf:We}=Object,{iterator:Oe,toStringTag:dt}=Symbol,_e=(t=>e=>{const n=sr.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ie=t=>(t=t.toLowerCase(),e=>_e(e)===t),Ae=t=>e=>typeof e===t,{isArray:ge}=Array,ye=Ae("undefined");function ve(t){return t!==null&&!ye(t)&&t.constructor!==null&&!ye(t.constructor)&&te(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const ct=ie("ArrayBuffer");function ir(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ct(t.buffer),e}const or=Ae("string"),te=Ae("function"),ut=Ae("number"),Ee=t=>t!==null&&typeof t=="object",ar=t=>t===!0||t===!1,ze=t=>{if(_e(t)!=="object")return!1;const e=We(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(dt in t)&&!(Oe in t)},lr=t=>{if(!Ee(t)||ve(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},dr=ie("Date"),cr=ie("File"),ur=ie("Blob"),pr=ie("FileList"),fr=t=>Ee(t)&&te(t.pipe),xr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||te(t.append)&&((e=_e(t))==="formdata"||e==="object"&&te(t.toString)&&t.toString()==="[object FormData]"))},hr=ie("URLSearchParams"),[mr,gr,yr,br]=["ReadableStream","Request","Response","Headers"].map(ie),wr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ke(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let s,i;if(typeof t!="object"&&(t=[t]),ge(t))for(s=0,i=t.length;s<i;s++)e.call(null,t[s],s,t);else{if(ve(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),a=o.length;let d;for(s=0;s<a;s++)d=o[s],e.call(null,t[d],d,t)}}function pt(t,e){if(ve(t))return null;e=e.toLowerCase();const n=Object.keys(t);let s=n.length,i;for(;s-- >0;)if(i=n[s],e===i.toLowerCase())return i;return null}const fe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ft=t=>!ye(t)&&t!==fe;function Be(){const{caseless:t,skipUndefined:e}=ft(this)&&this||{},n={},s=(i,o)=>{const a=t&&pt(n,o)||o;ze(n[a])&&ze(i)?n[a]=Be(n[a],i):ze(i)?n[a]=Be({},i):ge(i)?n[a]=i.slice():(!e||!ye(i))&&(n[a]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&ke(arguments[i],s);return n}const Sr=(t,e,n,{allOwnKeys:s}={})=>(ke(e,(i,o)=>{n&&te(i)?t[o]=lt(i,n):t[o]=i},{allOwnKeys:s}),t),jr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),vr=(t,e,n,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Er=(t,e,n,s)=>{let i,o,a;const d={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)a=i[o],(!s||s(a,t,e))&&!d[a]&&(e[a]=t[a],d[a]=!0);t=n!==!1&&We(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kr=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const s=t.indexOf(e,n);return s!==-1&&s===n},Cr=t=>{if(!t)return null;if(ge(t))return t;let e=t.length;if(!ut(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Tr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&We(Uint8Array)),Pr=(t,e)=>{const s=(t&&t[Oe]).call(t);let i;for(;(i=s.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},Ir=(t,e)=>{let n;const s=[];for(;(n=t.exec(e))!==null;)s.push(n);return s},Rr=ie("HTMLFormElement"),Or=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,i){return s.toUpperCase()+i}),xt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),_r=ie("RegExp"),ht=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),s={};ke(n,(i,o)=>{let a;(a=e(i,o,t))!==!1&&(s[o]=a||i)}),Object.defineProperties(t,s)},Ar=t=>{ht(t,(e,n)=>{if(te(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=t[n];if(te(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zr=(t,e)=>{const n={},s=i=>{i.forEach(o=>{n[o]=!0})};return ge(t)?s(t):s(String(t).split(e)),n},$r=()=>{},Ur=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Nr(t){return!!(t&&te(t.append)&&t[dt]==="FormData"&&t[Oe])}const Dr=t=>{const e=new Array(10),n=(s,i)=>{if(Ee(s)){if(e.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){e[i]=s;const o=ge(s)?[]:{};return ke(s,(a,d)=>{const c=n(a,i+1);!ye(c)&&(o[d]=c)}),e[i]=void 0,o}}return s};return n(t,0)},Fr=ie("AsyncFunction"),Lr=t=>t&&(Ee(t)||te(t))&&te(t.then)&&te(t.catch),mt=((t,e)=>t?setImmediate:e?((n,s)=>(fe.addEventListener("message",({source:i,data:o})=>{i===fe&&o===n&&s.length&&s.shift()()},!1),i=>{s.push(i),fe.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",te(fe.postMessage)),qr=typeof queueMicrotask<"u"?queueMicrotask.bind(fe):typeof process<"u"&&process.nextTick||mt,p={isArray:ge,isArrayBuffer:ct,isBuffer:ve,isFormData:xr,isArrayBufferView:ir,isString:or,isNumber:ut,isBoolean:ar,isObject:Ee,isPlainObject:ze,isEmptyObject:lr,isReadableStream:mr,isRequest:gr,isResponse:yr,isHeaders:br,isUndefined:ye,isDate:dr,isFile:cr,isBlob:ur,isRegExp:_r,isFunction:te,isStream:fr,isURLSearchParams:hr,isTypedArray:Tr,isFileList:pr,forEach:ke,merge:Be,extend:Sr,trim:wr,stripBOM:jr,inherits:vr,toFlatObject:Er,kindOf:_e,kindOfTest:ie,endsWith:kr,toArray:Cr,forEachEntry:Pr,matchAll:Ir,isHTMLForm:Rr,hasOwnProperty:xt,hasOwnProp:xt,reduceDescriptors:ht,freezeMethods:Ar,toObjectSet:zr,toCamelCase:Or,noop:$r,toFiniteNumber:Ur,findKey:pt,global:fe,isContextDefined:ft,isSpecCompliantForm:Nr,toJSONObject:Dr,isAsyncFn:Fr,isThenable:Lr,setImmediate:mt,asap:qr,isIterable:t=>t!=null&&te(t[Oe])};function U(t,e,n,s,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}p.inherits(U,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});const gt=U.prototype,yt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{yt[t]={value:t}}),Object.defineProperties(U,yt),Object.defineProperty(gt,"isAxiosError",{value:!0}),U.from=(t,e,n,s,i,o)=>{const a=Object.create(gt);p.toFlatObject(t,a,function(x){return x!==Error.prototype},f=>f!=="isAxiosError");const d=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return U.call(a,d,c,n,s,i),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",o&&Object.assign(a,o),a};const Mr=null;function He(t){return p.isPlainObject(t)||p.isArray(t)}function bt(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function wt(t,e,n){return t?t.concat(e).map(function(i,o){return i=bt(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function Wr(t){return p.isArray(t)&&!t.some(He)}const Br=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function $e(t,e,n){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,h){return!p.isUndefined(h[w])});const s=n.metaTokens,i=n.visitor||x,o=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(i))throw new TypeError("visitor must be a function");function f(u){if(u===null)return"";if(p.isDate(u))return u.toISOString();if(p.isBoolean(u))return u.toString();if(!c&&p.isBlob(u))throw new U("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(u)||p.isTypedArray(u)?c&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function x(u,w,h){let R=u;if(u&&!h&&typeof u=="object"){if(p.endsWith(w,"{}"))w=s?w:w.slice(0,-2),u=JSON.stringify(u);else if(p.isArray(u)&&Wr(u)||(p.isFileList(u)||p.endsWith(w,"[]"))&&(R=p.toArray(u)))return w=bt(w),R.forEach(function(g,A){!(p.isUndefined(g)||g===null)&&e.append(a===!0?wt([w],A,o):a===null?w:w+"[]",f(g))}),!1}return He(u)?!0:(e.append(wt(h,w,o),f(u)),!1)}const y=[],k=Object.assign(Br,{defaultVisitor:x,convertValue:f,isVisitable:He});function C(u,w){if(!p.isUndefined(u)){if(y.indexOf(u)!==-1)throw Error("Circular reference detected in "+w.join("."));y.push(u),p.forEach(u,function(R,T){(!(p.isUndefined(R)||R===null)&&i.call(e,R,p.isString(T)?T.trim():T,w,k))===!0&&C(R,w?w.concat(T):[T])}),y.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return C(t),e}function St(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ve(t,e){this._pairs=[],t&&$e(t,this,e)}const jt=Ve.prototype;jt.append=function(e,n){this._pairs.push([e,n])},jt.toString=function(e){const n=e?function(s){return e.call(this,s,St)}:St;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Hr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vt(t,e,n){if(!e)return t;const s=n&&n.encode||Hr;p.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=p.isURLSearchParams(e)?e.toString():new Ve(e,n).toString(s),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Et{constructor(){this.handlers=[]}use(e,n,s){return this.handlers.push({fulfilled:e,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(s){s!==null&&e(s)})}}const kt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Vr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ye=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Yr=Ye&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Jr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kr=Ye&&window.location.href||"http://localhost",Z={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:Yr,hasStandardBrowserWebWorkerEnv:Jr,navigator:Je,origin:Kr},Symbol.toStringTag,{value:"Module"})),...Vr};function Gr(t,e){return $e(t,new Z.classes.URLSearchParams,{visitor:function(n,s,i,o){return Z.isNode&&p.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Xr(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Zr(t){const e={},n=Object.keys(t);let s;const i=n.length;let o;for(s=0;s<i;s++)o=n[s],e[o]=t[o];return e}function Ct(t){function e(n,s,i,o){let a=n[o++];if(a==="__proto__")return!0;const d=Number.isFinite(+a),c=o>=n.length;return a=!a&&p.isArray(i)?i.length:a,c?(p.hasOwnProp(i,a)?i[a]=[i[a],s]:i[a]=s,!d):((!i[a]||!p.isObject(i[a]))&&(i[a]=[]),e(n,s,i[a],o)&&p.isArray(i[a])&&(i[a]=Zr(i[a])),!d)}if(p.isFormData(t)&&p.isFunction(t.entries)){const n={};return p.forEachEntry(t,(s,i)=>{e(Xr(s),i,n,0)}),n}return null}function Qr(t,e,n){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(t)}const Ce={transitional:kt,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const s=n.getContentType()||"",i=s.indexOf("application/json")>-1,o=p.isObject(e);if(o&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return i?JSON.stringify(Ct(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Gr(e,this.formSerializer).toString();if((d=p.isFileList(e))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return $e(d?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Qr(e)):e}],transformResponse:[function(e){const n=this.transitional||Ce.transitional,s=n&&n.forcedJSONParsing,i=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(s&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(d){if(a)throw d.name==="SyntaxError"?U.from(d,U.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Z.classes.FormData,Blob:Z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Ce.headers[t]={}});const en=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tn=t=>{const e={};let n,s,i;return t&&t.split(`
|
|
2
|
-
`).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),s=a.substring(i+1).trim(),!(!n||e[n]&&en[n])&&(n==="set-cookie"?e[n]?e[n].push(s):e[n]=[s]:e[n]=e[n]?e[n]+", "+s:s)}),e},Tt=Symbol("internals");function Te(t){return t&&String(t).trim().toLowerCase()}function Ue(t){return t===!1||t==null?t:p.isArray(t)?t.map(Ue):String(t)}function rn(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(t);)e[s[1]]=s[2];return e}const nn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const s=new this(e);return n.forEach(i=>s.set(i)),s}static accessor(e){const s=(this[Tt]=this[Tt]={accessors:{}}).accessors,i=this.prototype;function o(a){const d=Te(a);s[d]||(on(i,a),s[d]=!0)}return p.isArray(e)?e.forEach(o):o(e),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(re.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[n]=s}}}),p.freezeMethods(re);function Ge(t,e){const n=this||Ce,s=e||n,i=re.from(s.headers);let o=s.data;return p.forEach(t,function(d){o=d.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Pt(t){return!!(t&&t.__CANCEL__)}function be(t,e,n){U.call(this,t??"canceled",U.ERR_CANCELED,e,n),this.name="CanceledError"}p.inherits(be,U,{__CANCEL__:!0});function It(t,e,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?t(n):e(new U("Request failed with status code "+n.status,[U.ERR_BAD_REQUEST,U.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function an(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ln(t,e){t=t||10;const n=new Array(t),s=new Array(t);let i=0,o=0,a;return e=e!==void 0?e:1e3,function(c){const f=Date.now(),x=s[o];a||(a=f),n[i]=c,s[i]=f;let y=o,k=0;for(;y!==i;)k+=n[y++],y=y%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),f-a<e)return;const C=x&&f-x;return C?Math.round(k*1e3/C):void 0}}function dn(t,e){let n=0,s=1e3/e,i,o;const a=(f,x=Date.now())=>{n=x,i=null,o&&(clearTimeout(o),o=null),t(...f)};return[(...f)=>{const x=Date.now(),y=x-n;y>=s?a(f,x):(i=f,o||(o=setTimeout(()=>{o=null,a(i)},s-y)))},()=>i&&a(i)]}const Ne=(t,e,n=3)=>{let s=0;const i=ln(50,250);return dn(o=>{const a=o.loaded,d=o.lengthComputable?o.total:void 0,c=a-s,f=i(c),x=a<=d;s=a;const y={loaded:a,total:d,progress:d?a/d:void 0,bytes:c,rate:f||void 0,estimated:f&&d&&x?(d-a)/f:void 0,event:o,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(y)},n)},Rt=(t,e)=>{const n=t!=null;return[s=>e[0]({lengthComputable:n,total:t,loaded:s}),e[1]]},Ot=t=>(...e)=>p.asap(()=>t(...e)),cn=Z.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Z.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Z.origin),Z.navigator&&/(msie|trident)/i.test(Z.navigator.userAgent)):()=>!0,un=Z.hasStandardBrowserEnv?{write(t,e,n,s,i,o){const a=[t+"="+encodeURIComponent(e)];p.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(i)&&a.push("domain="+i),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _t(t,e,n){let s=!pn(e);return t&&(s||n==!1)?fn(t,e):e}const At=t=>t instanceof re?{...t}:t;function xe(t,e){e=e||{};const n={};function s(f,x,y,k){return p.isPlainObject(f)&&p.isPlainObject(x)?p.merge.call({caseless:k},f,x):p.isPlainObject(x)?p.merge({},x):p.isArray(x)?x.slice():x}function i(f,x,y,k){if(p.isUndefined(x)){if(!p.isUndefined(f))return s(void 0,f,y,k)}else return s(f,x,y,k)}function o(f,x){if(!p.isUndefined(x))return s(void 0,x)}function a(f,x){if(p.isUndefined(x)){if(!p.isUndefined(f))return s(void 0,f)}else return s(void 0,x)}function d(f,x,y){if(y in e)return s(f,x);if(y in t)return s(void 0,f)}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:d,headers:(f,x,y)=>i(At(f),At(x),y,!0)};return p.forEach(Object.keys({...t,...e}),function(x){const y=c[x]||i,k=y(t[x],e[x],x);p.isUndefined(k)&&y!==d||(n[x]=k)}),n}const zt=t=>{const e=xe({},t);let{data:n,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:d}=e;if(e.headers=a=re.from(a),e.url=vt(_t(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&a.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),p.isFormData(n)){if(Z.hasStandardBrowserEnv||Z.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(n.getHeaders)){const c=n.getHeaders(),f=["content-type","content-length"];Object.entries(c).forEach(([x,y])=>{f.includes(x.toLowerCase())&&a.set(x,y)})}}if(Z.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(e)),s||s!==!1&&cn(e.url))){const c=i&&o&&un.read(o);c&&a.set(i,c)}return e},xn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,s){const i=zt(t);let o=i.data;const a=re.from(i.headers).normalize();let{responseType:d,onUploadProgress:c,onDownloadProgress:f}=i,x,y,k,C,u;function w(){C&&C(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(x),i.signal&&i.signal.removeEventListener("abort",x)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function R(){if(!h)return;const g=re.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),D={data:!d||d==="text"||d==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:g,config:t,request:h};It(function(j){n(j),w()},function(j){s(j),w()},D),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(s(new U("Request aborted",U.ECONNABORTED,t,h)),h=null)},h.onerror=function(A){const D=A&&A.message?A.message:"Network Error",b=new U(D,U.ERR_NETWORK,t,h);b.event=A||null,s(b),h=null},h.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const D=i.transitional||kt;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),s(new U(A,D.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,t,h)),h=null},o===void 0&&a.setContentType(null),"setRequestHeader"in h&&p.forEach(a.toJSON(),function(A,D){h.setRequestHeader(D,A)}),p.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),d&&d!=="json"&&(h.responseType=i.responseType),f&&([k,u]=Ne(f,!0),h.addEventListener("progress",k)),c&&h.upload&&([y,C]=Ne(c),h.upload.addEventListener("progress",y),h.upload.addEventListener("loadend",C)),(i.cancelToken||i.signal)&&(x=g=>{h&&(s(!g||g.type?new be(null,t,h):g),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(x),i.signal&&(i.signal.aborted?x():i.signal.addEventListener("abort",x)));const T=an(i.url);if(T&&Z.protocols.indexOf(T)===-1){s(new U("Unsupported protocol "+T+":",U.ERR_BAD_REQUEST,t));return}h.send(o||null)})},hn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let s=new AbortController,i;const o=function(f){if(!i){i=!0,d();const x=f instanceof Error?f:this.reason;s.abort(x instanceof U?x:new be(x instanceof Error?x.message:x))}};let a=e&&setTimeout(()=>{a=null,o(new U(`timeout ${e} of ms exceeded`,U.ETIMEDOUT))},e);const d=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),t=null)};t.forEach(f=>f.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>p.asap(d),c}},mn=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let s=0,i;for(;s<n;)i=s+e,yield t.slice(s,i),s=i},gn=async function*(t,e){for await(const n of yn(t))yield*mn(n,e)},yn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:s}=await e.read();if(n)break;yield s}}finally{await e.cancel()}},$t=(t,e,n,s)=>{const i=gn(t,e);let o=0,a,d=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:f,value:x}=await i.next();if(f){d(),c.close();return}let y=x.byteLength;if(n){let k=o+=y;n(k)}c.enqueue(new Uint8Array(x))}catch(f){throw d(f),f}},cancel(c){return d(c),i.return()}},{highWaterMark:2})},Ut=64*1024,{isFunction:De}=p,bn=(({Request:t,Response:e})=>({Request:t,Response:e}))(p.global),{ReadableStream:Nt,TextEncoder:Dt}=p.global,Ft=(t,...e)=>{try{return!!t(...e)}catch{return!1}},wn=t=>{t=p.merge.call({skipUndefined:!0},bn,t);const{fetch:e,Request:n,Response:s}=t,i=e?De(e):typeof fetch=="function",o=De(n),a=De(s);if(!i)return!1;const d=i&&De(Nt),c=i&&(typeof Dt=="function"?(u=>w=>u.encode(w))(new Dt):async u=>new Uint8Array(await new n(u).arrayBuffer())),f=o&&d&&Ft(()=>{let u=!1;const w=new n(Z.origin,{body:new Nt,method:"POST",get duplex(){return u=!0,"half"}}).headers.has("Content-Type");return u&&!w}),x=a&&d&&Ft(()=>p.isReadableStream(new s("").body)),y={stream:x&&(u=>u.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!y[u]&&(y[u]=(w,h)=>{let R=w&&w[u];if(R)return R.call(w);throw new U(`Response type '${u}' is not supported`,U.ERR_NOT_SUPPORT,h)})});const k=async u=>{if(u==null)return 0;if(p.isBlob(u))return u.size;if(p.isSpecCompliantForm(u))return(await new n(Z.origin,{method:"POST",body:u}).arrayBuffer()).byteLength;if(p.isArrayBufferView(u)||p.isArrayBuffer(u))return u.byteLength;if(p.isURLSearchParams(u)&&(u=u+""),p.isString(u))return(await c(u)).byteLength},C=async(u,w)=>{const h=p.toFiniteNumber(u.getContentLength());return h??k(w)};return async u=>{let{url:w,method:h,data:R,signal:T,cancelToken:g,timeout:A,onDownloadProgress:D,onUploadProgress:b,responseType:j,headers:q,withCredentials:O="same-origin",fetchOptions:X}=zt(u),W=e||fetch;j=j?(j+"").toLowerCase():"text";let I=hn([T,g&&g.toAbortSignal()],A),G=null;const P=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let _;try{if(b&&f&&h!=="get"&&h!=="head"&&(_=await C(q,R))!==0){let l=new n(w,{method:"POST",body:R,duplex:"half"}),m;if(p.isFormData(R)&&(m=l.headers.get("content-type"))&&q.setContentType(m),l.body){const[E,N]=Rt(_,Ne(Ot(b)));R=$t(l.body,Ut,E,N)}}p.isString(O)||(O=O?"include":"omit");const M=o&&"credentials"in n.prototype,K={...X,signal:I,method:h.toUpperCase(),headers:q.normalize().toJSON(),body:R,duplex:"half",credentials:M?O:void 0};G=o&&new n(w,K);let H=await(o?W(G,X):W(w,K));const F=x&&(j==="stream"||j==="response");if(x&&(D||F&&P)){const l={};["status","statusText","headers"].forEach(ne=>{l[ne]=H[ne]});const m=p.toFiniteNumber(H.headers.get("content-length")),[E,N]=D&&Rt(m,Ne(Ot(D),!0))||[];H=new s($t(H.body,Ut,E,()=>{N&&N(),P&&P()}),l)}j=j||"text";let J=await y[p.findKey(y,j)||"text"](H,u);return!F&&P&&P(),await new Promise((l,m)=>{It(l,m,{data:J,headers:re.from(H.headers),status:H.status,statusText:H.statusText,config:u,request:G})})}catch(M){throw P&&P(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,u,G),{cause:M.cause||M}):U.from(M,M&&M.code,u,G)}}},Sn=new Map,Lt=t=>{let e=t?t.env:{};const{fetch:n,Request:s,Response:i}=e,o=[s,i,n];let a=o.length,d=a,c,f,x=Sn;for(;d--;)c=o[d],f=x.get(c),f===void 0&&x.set(c,f=d?new Map:wn(e)),x=f;return f};Lt();const Xe={http:Mr,xhr:xn,fetch:{get:Lt}};p.forEach(Xe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const qt=t=>`- ${t}`,jn=t=>p.isFunction(t)||t===null||t===!1,Mt={getAdapter:(t,e)=>{t=p.isArray(t)?t:[t];const{length:n}=t;let s,i;const o={};for(let a=0;a<n;a++){s=t[a];let d;if(i=s,!jn(s)&&(i=Xe[(d=String(s)).toLowerCase()],i===void 0))throw new U(`Unknown adapter '${d}'`);if(i&&(p.isFunction(i)||(i=i.get(e))))break;o[d||"#"+a]=i}if(!i){const a=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?a.length>1?`since :
|
|
1
|
+
(function(ee,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(ee=typeof globalThis<"u"?globalThis:ee||self,S(ee.NeuctraAuthix={},ee.React))})(this,(function(ee,S){"use strict";function lt(t,e){return function(){return t.apply(e,arguments)}}const{toString:sr}=Object.prototype,{getPrototypeOf:We}=Object,{iterator:Oe,toStringTag:dt}=Symbol,_e=(t=>e=>{const n=sr.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ie=t=>(t=t.toLowerCase(),e=>_e(e)===t),Ae=t=>e=>typeof e===t,{isArray:ge}=Array,ye=Ae("undefined");function ve(t){return t!==null&&!ye(t)&&t.constructor!==null&&!ye(t.constructor)&&te(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const ct=ie("ArrayBuffer");function ir(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ct(t.buffer),e}const or=Ae("string"),te=Ae("function"),ut=Ae("number"),Ee=t=>t!==null&&typeof t=="object",ar=t=>t===!0||t===!1,ze=t=>{if(_e(t)!=="object")return!1;const e=We(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(dt in t)&&!(Oe in t)},lr=t=>{if(!Ee(t)||ve(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},dr=ie("Date"),cr=ie("File"),ur=ie("Blob"),pr=ie("FileList"),fr=t=>Ee(t)&&te(t.pipe),xr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||te(t.append)&&((e=_e(t))==="formdata"||e==="object"&&te(t.toString)&&t.toString()==="[object FormData]"))},hr=ie("URLSearchParams"),[mr,gr,yr,br]=["ReadableStream","Request","Response","Headers"].map(ie),wr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ke(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let s,i;if(typeof t!="object"&&(t=[t]),ge(t))for(s=0,i=t.length;s<i;s++)e.call(null,t[s],s,t);else{if(ve(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),a=o.length;let d;for(s=0;s<a;s++)d=o[s],e.call(null,t[d],d,t)}}function pt(t,e){if(ve(t))return null;e=e.toLowerCase();const n=Object.keys(t);let s=n.length,i;for(;s-- >0;)if(i=n[s],e===i.toLowerCase())return i;return null}const fe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ft=t=>!ye(t)&&t!==fe;function Be(){const{caseless:t,skipUndefined:e}=ft(this)&&this||{},n={},s=(i,o)=>{const a=t&&pt(n,o)||o;ze(n[a])&&ze(i)?n[a]=Be(n[a],i):ze(i)?n[a]=Be({},i):ge(i)?n[a]=i.slice():(!e||!ye(i))&&(n[a]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&ke(arguments[i],s);return n}const Sr=(t,e,n,{allOwnKeys:s}={})=>(ke(e,(i,o)=>{n&&te(i)?t[o]=lt(i,n):t[o]=i},{allOwnKeys:s}),t),jr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),vr=(t,e,n,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Er=(t,e,n,s)=>{let i,o,a;const d={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)a=i[o],(!s||s(a,t,e))&&!d[a]&&(e[a]=t[a],d[a]=!0);t=n!==!1&&We(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kr=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const s=t.indexOf(e,n);return s!==-1&&s===n},Cr=t=>{if(!t)return null;if(ge(t))return t;let e=t.length;if(!ut(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Tr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&We(Uint8Array)),Pr=(t,e)=>{const s=(t&&t[Oe]).call(t);let i;for(;(i=s.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},Ir=(t,e)=>{let n;const s=[];for(;(n=t.exec(e))!==null;)s.push(n);return s},Rr=ie("HTMLFormElement"),Or=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,i){return s.toUpperCase()+i}),xt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),_r=ie("RegExp"),ht=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),s={};ke(n,(i,o)=>{let a;(a=e(i,o,t))!==!1&&(s[o]=a||i)}),Object.defineProperties(t,s)},Ar=t=>{ht(t,(e,n)=>{if(te(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=t[n];if(te(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zr=(t,e)=>{const n={},s=i=>{i.forEach(o=>{n[o]=!0})};return ge(t)?s(t):s(String(t).split(e)),n},$r=()=>{},Ur=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Nr(t){return!!(t&&te(t.append)&&t[dt]==="FormData"&&t[Oe])}const Dr=t=>{const e=new Array(10),n=(s,i)=>{if(Ee(s)){if(e.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){e[i]=s;const o=ge(s)?[]:{};return ke(s,(a,d)=>{const c=n(a,i+1);!ye(c)&&(o[d]=c)}),e[i]=void 0,o}}return s};return n(t,0)},Fr=ie("AsyncFunction"),Lr=t=>t&&(Ee(t)||te(t))&&te(t.then)&&te(t.catch),mt=((t,e)=>t?setImmediate:e?((n,s)=>(fe.addEventListener("message",({source:i,data:o})=>{i===fe&&o===n&&s.length&&s.shift()()},!1),i=>{s.push(i),fe.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",te(fe.postMessage)),qr=typeof queueMicrotask<"u"?queueMicrotask.bind(fe):typeof process<"u"&&process.nextTick||mt,p={isArray:ge,isArrayBuffer:ct,isBuffer:ve,isFormData:xr,isArrayBufferView:ir,isString:or,isNumber:ut,isBoolean:ar,isObject:Ee,isPlainObject:ze,isEmptyObject:lr,isReadableStream:mr,isRequest:gr,isResponse:yr,isHeaders:br,isUndefined:ye,isDate:dr,isFile:cr,isBlob:ur,isRegExp:_r,isFunction:te,isStream:fr,isURLSearchParams:hr,isTypedArray:Tr,isFileList:pr,forEach:ke,merge:Be,extend:Sr,trim:wr,stripBOM:jr,inherits:vr,toFlatObject:Er,kindOf:_e,kindOfTest:ie,endsWith:kr,toArray:Cr,forEachEntry:Pr,matchAll:Ir,isHTMLForm:Rr,hasOwnProperty:xt,hasOwnProp:xt,reduceDescriptors:ht,freezeMethods:Ar,toObjectSet:zr,toCamelCase:Or,noop:$r,toFiniteNumber:Ur,findKey:pt,global:fe,isContextDefined:ft,isSpecCompliantForm:Nr,toJSONObject:Dr,isAsyncFn:Fr,isThenable:Lr,setImmediate:mt,asap:qr,isIterable:t=>t!=null&&te(t[Oe])};function U(t,e,n,s,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}p.inherits(U,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});const gt=U.prototype,yt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{yt[t]={value:t}}),Object.defineProperties(U,yt),Object.defineProperty(gt,"isAxiosError",{value:!0}),U.from=(t,e,n,s,i,o)=>{const a=Object.create(gt);p.toFlatObject(t,a,function(x){return x!==Error.prototype},f=>f!=="isAxiosError");const d=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return U.call(a,d,c,n,s,i),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",o&&Object.assign(a,o),a};const Mr=null;function He(t){return p.isPlainObject(t)||p.isArray(t)}function bt(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function wt(t,e,n){return t?t.concat(e).map(function(i,o){return i=bt(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function Wr(t){return p.isArray(t)&&!t.some(He)}const Br=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function $e(t,e,n){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,h){return!p.isUndefined(h[w])});const s=n.metaTokens,i=n.visitor||x,o=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(i))throw new TypeError("visitor must be a function");function f(u){if(u===null)return"";if(p.isDate(u))return u.toISOString();if(p.isBoolean(u))return u.toString();if(!c&&p.isBlob(u))throw new U("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(u)||p.isTypedArray(u)?c&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function x(u,w,h){let R=u;if(u&&!h&&typeof u=="object"){if(p.endsWith(w,"{}"))w=s?w:w.slice(0,-2),u=JSON.stringify(u);else if(p.isArray(u)&&Wr(u)||(p.isFileList(u)||p.endsWith(w,"[]"))&&(R=p.toArray(u)))return w=bt(w),R.forEach(function(g,A){!(p.isUndefined(g)||g===null)&&e.append(a===!0?wt([w],A,o):a===null?w:w+"[]",f(g))}),!1}return He(u)?!0:(e.append(wt(h,w,o),f(u)),!1)}const y=[],k=Object.assign(Br,{defaultVisitor:x,convertValue:f,isVisitable:He});function C(u,w){if(!p.isUndefined(u)){if(y.indexOf(u)!==-1)throw Error("Circular reference detected in "+w.join("."));y.push(u),p.forEach(u,function(R,T){(!(p.isUndefined(R)||R===null)&&i.call(e,R,p.isString(T)?T.trim():T,w,k))===!0&&C(R,w?w.concat(T):[T])}),y.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return C(t),e}function St(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ve(t,e){this._pairs=[],t&&$e(t,this,e)}const jt=Ve.prototype;jt.append=function(e,n){this._pairs.push([e,n])},jt.toString=function(e){const n=e?function(s){return e.call(this,s,St)}:St;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Hr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vt(t,e,n){if(!e)return t;const s=n&&n.encode||Hr;p.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=p.isURLSearchParams(e)?e.toString():new Ve(e,n).toString(s),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Et{constructor(){this.handlers=[]}use(e,n,s){return this.handlers.push({fulfilled:e,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(s){s!==null&&e(s)})}}const kt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Vr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ye=typeof window<"u"&&typeof document<"u",Ke=typeof navigator=="object"&&navigator||void 0,Yr=Ye&&(!Ke||["ReactNative","NativeScript","NS"].indexOf(Ke.product)<0),Kr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Jr=Ye&&window.location.href||"http://localhost",Z={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:Yr,hasStandardBrowserWebWorkerEnv:Kr,navigator:Ke,origin:Jr},Symbol.toStringTag,{value:"Module"})),...Vr};function Gr(t,e){return $e(t,new Z.classes.URLSearchParams,{visitor:function(n,s,i,o){return Z.isNode&&p.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Xr(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Zr(t){const e={},n=Object.keys(t);let s;const i=n.length;let o;for(s=0;s<i;s++)o=n[s],e[o]=t[o];return e}function Ct(t){function e(n,s,i,o){let a=n[o++];if(a==="__proto__")return!0;const d=Number.isFinite(+a),c=o>=n.length;return a=!a&&p.isArray(i)?i.length:a,c?(p.hasOwnProp(i,a)?i[a]=[i[a],s]:i[a]=s,!d):((!i[a]||!p.isObject(i[a]))&&(i[a]=[]),e(n,s,i[a],o)&&p.isArray(i[a])&&(i[a]=Zr(i[a])),!d)}if(p.isFormData(t)&&p.isFunction(t.entries)){const n={};return p.forEachEntry(t,(s,i)=>{e(Xr(s),i,n,0)}),n}return null}function Qr(t,e,n){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(t)}const Ce={transitional:kt,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const s=n.getContentType()||"",i=s.indexOf("application/json")>-1,o=p.isObject(e);if(o&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return i?JSON.stringify(Ct(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Gr(e,this.formSerializer).toString();if((d=p.isFileList(e))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return $e(d?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Qr(e)):e}],transformResponse:[function(e){const n=this.transitional||Ce.transitional,s=n&&n.forcedJSONParsing,i=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(s&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(d){if(a)throw d.name==="SyntaxError"?U.from(d,U.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Z.classes.FormData,Blob:Z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Ce.headers[t]={}});const en=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tn=t=>{const e={};let n,s,i;return t&&t.split(`
|
|
2
|
+
`).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),s=a.substring(i+1).trim(),!(!n||e[n]&&en[n])&&(n==="set-cookie"?e[n]?e[n].push(s):e[n]=[s]:e[n]=e[n]?e[n]+", "+s:s)}),e},Tt=Symbol("internals");function Te(t){return t&&String(t).trim().toLowerCase()}function Ue(t){return t===!1||t==null?t:p.isArray(t)?t.map(Ue):String(t)}function rn(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(t);)e[s[1]]=s[2];return e}const nn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Je(t,e,n,s,i){if(p.isFunction(s))return s.call(this,e,n);if(i&&(e=n),!!p.isString(e)){if(p.isString(s))return e.indexOf(s)!==-1;if(p.isRegExp(s))return s.test(e)}}function sn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,s)=>n.toUpperCase()+s)}function on(t,e){const n=p.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+n,{value:function(i,o,a){return this[s].call(this,e,i,o,a)},configurable:!0})})}let re=class{constructor(e){e&&this.set(e)}set(e,n,s){const i=this;function o(d,c,f){const x=Te(c);if(!x)throw new Error("header name must be a non-empty string");const y=p.findKey(i,x);(!y||i[y]===void 0||f===!0||f===void 0&&i[y]!==!1)&&(i[y||c]=Ue(d))}const a=(d,c)=>p.forEach(d,(f,x)=>o(f,x,c));if(p.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(p.isString(e)&&(e=e.trim())&&!nn(e))a(tn(e),n);else if(p.isObject(e)&&p.isIterable(e)){let d={},c,f;for(const x of e){if(!p.isArray(x))throw TypeError("Object iterator must return a key-value pair");d[f=x[0]]=(c=d[f])?p.isArray(c)?[...c,x[1]]:[c,x[1]]:x[1]}a(d,n)}else e!=null&&o(n,e,s);return this}get(e,n){if(e=Te(e),e){const s=p.findKey(this,e);if(s){const i=this[s];if(!n)return i;if(n===!0)return rn(i);if(p.isFunction(n))return n.call(this,i,s);if(p.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Te(e),e){const s=p.findKey(this,e);return!!(s&&this[s]!==void 0&&(!n||Je(this,this[s],s,n)))}return!1}delete(e,n){const s=this;let i=!1;function o(a){if(a=Te(a),a){const d=p.findKey(s,a);d&&(!n||Je(s,s[d],d,n))&&(delete s[d],i=!0)}}return p.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let s=n.length,i=!1;for(;s--;){const o=n[s];(!e||Je(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,s={};return p.forEach(this,(i,o)=>{const a=p.findKey(s,o);if(a){n[a]=Ue(i),delete n[o];return}const d=e?sn(o):String(o).trim();d!==o&&delete n[o],n[d]=Ue(i),s[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return p.forEach(this,(s,i)=>{s!=null&&s!==!1&&(n[i]=e&&p.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const s=new this(e);return n.forEach(i=>s.set(i)),s}static accessor(e){const s=(this[Tt]=this[Tt]={accessors:{}}).accessors,i=this.prototype;function o(a){const d=Te(a);s[d]||(on(i,a),s[d]=!0)}return p.isArray(e)?e.forEach(o):o(e),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(re.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[n]=s}}}),p.freezeMethods(re);function Ge(t,e){const n=this||Ce,s=e||n,i=re.from(s.headers);let o=s.data;return p.forEach(t,function(d){o=d.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Pt(t){return!!(t&&t.__CANCEL__)}function be(t,e,n){U.call(this,t??"canceled",U.ERR_CANCELED,e,n),this.name="CanceledError"}p.inherits(be,U,{__CANCEL__:!0});function It(t,e,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?t(n):e(new U("Request failed with status code "+n.status,[U.ERR_BAD_REQUEST,U.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function an(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ln(t,e){t=t||10;const n=new Array(t),s=new Array(t);let i=0,o=0,a;return e=e!==void 0?e:1e3,function(c){const f=Date.now(),x=s[o];a||(a=f),n[i]=c,s[i]=f;let y=o,k=0;for(;y!==i;)k+=n[y++],y=y%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),f-a<e)return;const C=x&&f-x;return C?Math.round(k*1e3/C):void 0}}function dn(t,e){let n=0,s=1e3/e,i,o;const a=(f,x=Date.now())=>{n=x,i=null,o&&(clearTimeout(o),o=null),t(...f)};return[(...f)=>{const x=Date.now(),y=x-n;y>=s?a(f,x):(i=f,o||(o=setTimeout(()=>{o=null,a(i)},s-y)))},()=>i&&a(i)]}const Ne=(t,e,n=3)=>{let s=0;const i=ln(50,250);return dn(o=>{const a=o.loaded,d=o.lengthComputable?o.total:void 0,c=a-s,f=i(c),x=a<=d;s=a;const y={loaded:a,total:d,progress:d?a/d:void 0,bytes:c,rate:f||void 0,estimated:f&&d&&x?(d-a)/f:void 0,event:o,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(y)},n)},Rt=(t,e)=>{const n=t!=null;return[s=>e[0]({lengthComputable:n,total:t,loaded:s}),e[1]]},Ot=t=>(...e)=>p.asap(()=>t(...e)),cn=Z.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Z.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Z.origin),Z.navigator&&/(msie|trident)/i.test(Z.navigator.userAgent)):()=>!0,un=Z.hasStandardBrowserEnv?{write(t,e,n,s,i,o){const a=[t+"="+encodeURIComponent(e)];p.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(i)&&a.push("domain="+i),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _t(t,e,n){let s=!pn(e);return t&&(s||n==!1)?fn(t,e):e}const At=t=>t instanceof re?{...t}:t;function xe(t,e){e=e||{};const n={};function s(f,x,y,k){return p.isPlainObject(f)&&p.isPlainObject(x)?p.merge.call({caseless:k},f,x):p.isPlainObject(x)?p.merge({},x):p.isArray(x)?x.slice():x}function i(f,x,y,k){if(p.isUndefined(x)){if(!p.isUndefined(f))return s(void 0,f,y,k)}else return s(f,x,y,k)}function o(f,x){if(!p.isUndefined(x))return s(void 0,x)}function a(f,x){if(p.isUndefined(x)){if(!p.isUndefined(f))return s(void 0,f)}else return s(void 0,x)}function d(f,x,y){if(y in e)return s(f,x);if(y in t)return s(void 0,f)}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:d,headers:(f,x,y)=>i(At(f),At(x),y,!0)};return p.forEach(Object.keys({...t,...e}),function(x){const y=c[x]||i,k=y(t[x],e[x],x);p.isUndefined(k)&&y!==d||(n[x]=k)}),n}const zt=t=>{const e=xe({},t);let{data:n,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:d}=e;if(e.headers=a=re.from(a),e.url=vt(_t(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&a.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),p.isFormData(n)){if(Z.hasStandardBrowserEnv||Z.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(n.getHeaders)){const c=n.getHeaders(),f=["content-type","content-length"];Object.entries(c).forEach(([x,y])=>{f.includes(x.toLowerCase())&&a.set(x,y)})}}if(Z.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(e)),s||s!==!1&&cn(e.url))){const c=i&&o&&un.read(o);c&&a.set(i,c)}return e},xn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,s){const i=zt(t);let o=i.data;const a=re.from(i.headers).normalize();let{responseType:d,onUploadProgress:c,onDownloadProgress:f}=i,x,y,k,C,u;function w(){C&&C(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(x),i.signal&&i.signal.removeEventListener("abort",x)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function R(){if(!h)return;const g=re.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),D={data:!d||d==="text"||d==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:g,config:t,request:h};It(function(j){n(j),w()},function(j){s(j),w()},D),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(s(new U("Request aborted",U.ECONNABORTED,t,h)),h=null)},h.onerror=function(A){const D=A&&A.message?A.message:"Network Error",b=new U(D,U.ERR_NETWORK,t,h);b.event=A||null,s(b),h=null},h.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const D=i.transitional||kt;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),s(new U(A,D.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,t,h)),h=null},o===void 0&&a.setContentType(null),"setRequestHeader"in h&&p.forEach(a.toJSON(),function(A,D){h.setRequestHeader(D,A)}),p.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),d&&d!=="json"&&(h.responseType=i.responseType),f&&([k,u]=Ne(f,!0),h.addEventListener("progress",k)),c&&h.upload&&([y,C]=Ne(c),h.upload.addEventListener("progress",y),h.upload.addEventListener("loadend",C)),(i.cancelToken||i.signal)&&(x=g=>{h&&(s(!g||g.type?new be(null,t,h):g),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(x),i.signal&&(i.signal.aborted?x():i.signal.addEventListener("abort",x)));const T=an(i.url);if(T&&Z.protocols.indexOf(T)===-1){s(new U("Unsupported protocol "+T+":",U.ERR_BAD_REQUEST,t));return}h.send(o||null)})},hn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let s=new AbortController,i;const o=function(f){if(!i){i=!0,d();const x=f instanceof Error?f:this.reason;s.abort(x instanceof U?x:new be(x instanceof Error?x.message:x))}};let a=e&&setTimeout(()=>{a=null,o(new U(`timeout ${e} of ms exceeded`,U.ETIMEDOUT))},e);const d=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),t=null)};t.forEach(f=>f.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>p.asap(d),c}},mn=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let s=0,i;for(;s<n;)i=s+e,yield t.slice(s,i),s=i},gn=async function*(t,e){for await(const n of yn(t))yield*mn(n,e)},yn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:s}=await e.read();if(n)break;yield s}}finally{await e.cancel()}},$t=(t,e,n,s)=>{const i=gn(t,e);let o=0,a,d=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:f,value:x}=await i.next();if(f){d(),c.close();return}let y=x.byteLength;if(n){let k=o+=y;n(k)}c.enqueue(new Uint8Array(x))}catch(f){throw d(f),f}},cancel(c){return d(c),i.return()}},{highWaterMark:2})},Ut=64*1024,{isFunction:De}=p,bn=(({Request:t,Response:e})=>({Request:t,Response:e}))(p.global),{ReadableStream:Nt,TextEncoder:Dt}=p.global,Ft=(t,...e)=>{try{return!!t(...e)}catch{return!1}},wn=t=>{t=p.merge.call({skipUndefined:!0},bn,t);const{fetch:e,Request:n,Response:s}=t,i=e?De(e):typeof fetch=="function",o=De(n),a=De(s);if(!i)return!1;const d=i&&De(Nt),c=i&&(typeof Dt=="function"?(u=>w=>u.encode(w))(new Dt):async u=>new Uint8Array(await new n(u).arrayBuffer())),f=o&&d&&Ft(()=>{let u=!1;const w=new n(Z.origin,{body:new Nt,method:"POST",get duplex(){return u=!0,"half"}}).headers.has("Content-Type");return u&&!w}),x=a&&d&&Ft(()=>p.isReadableStream(new s("").body)),y={stream:x&&(u=>u.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!y[u]&&(y[u]=(w,h)=>{let R=w&&w[u];if(R)return R.call(w);throw new U(`Response type '${u}' is not supported`,U.ERR_NOT_SUPPORT,h)})});const k=async u=>{if(u==null)return 0;if(p.isBlob(u))return u.size;if(p.isSpecCompliantForm(u))return(await new n(Z.origin,{method:"POST",body:u}).arrayBuffer()).byteLength;if(p.isArrayBufferView(u)||p.isArrayBuffer(u))return u.byteLength;if(p.isURLSearchParams(u)&&(u=u+""),p.isString(u))return(await c(u)).byteLength},C=async(u,w)=>{const h=p.toFiniteNumber(u.getContentLength());return h??k(w)};return async u=>{let{url:w,method:h,data:R,signal:T,cancelToken:g,timeout:A,onDownloadProgress:D,onUploadProgress:b,responseType:j,headers:q,withCredentials:O="same-origin",fetchOptions:X}=zt(u),W=e||fetch;j=j?(j+"").toLowerCase():"text";let I=hn([T,g&&g.toAbortSignal()],A),G=null;const P=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let _;try{if(b&&f&&h!=="get"&&h!=="head"&&(_=await C(q,R))!==0){let l=new n(w,{method:"POST",body:R,duplex:"half"}),m;if(p.isFormData(R)&&(m=l.headers.get("content-type"))&&q.setContentType(m),l.body){const[E,N]=Rt(_,Ne(Ot(b)));R=$t(l.body,Ut,E,N)}}p.isString(O)||(O=O?"include":"omit");const M=o&&"credentials"in n.prototype,J={...X,signal:I,method:h.toUpperCase(),headers:q.normalize().toJSON(),body:R,duplex:"half",credentials:M?O:void 0};G=o&&new n(w,J);let H=await(o?W(G,X):W(w,J));const F=x&&(j==="stream"||j==="response");if(x&&(D||F&&P)){const l={};["status","statusText","headers"].forEach(ne=>{l[ne]=H[ne]});const m=p.toFiniteNumber(H.headers.get("content-length")),[E,N]=D&&Rt(m,Ne(Ot(D),!0))||[];H=new s($t(H.body,Ut,E,()=>{N&&N(),P&&P()}),l)}j=j||"text";let K=await y[p.findKey(y,j)||"text"](H,u);return!F&&P&&P(),await new Promise((l,m)=>{It(l,m,{data:K,headers:re.from(H.headers),status:H.status,statusText:H.statusText,config:u,request:G})})}catch(M){throw P&&P(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,u,G),{cause:M.cause||M}):U.from(M,M&&M.code,u,G)}}},Sn=new Map,Lt=t=>{let e=t?t.env:{};const{fetch:n,Request:s,Response:i}=e,o=[s,i,n];let a=o.length,d=a,c,f,x=Sn;for(;d--;)c=o[d],f=x.get(c),f===void 0&&x.set(c,f=d?new Map:wn(e)),x=f;return f};Lt();const Xe={http:Mr,xhr:xn,fetch:{get:Lt}};p.forEach(Xe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const qt=t=>`- ${t}`,jn=t=>p.isFunction(t)||t===null||t===!1,Mt={getAdapter:(t,e)=>{t=p.isArray(t)?t:[t];const{length:n}=t;let s,i;const o={};for(let a=0;a<n;a++){s=t[a];let d;if(i=s,!jn(s)&&(i=Xe[(d=String(s)).toLowerCase()],i===void 0))throw new U(`Unknown adapter '${d}'`);if(i&&(p.isFunction(i)||(i=i.get(e))))break;o[d||"#"+a]=i}if(!i){const a=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?a.length>1?`since :
|
|
4
4
|
`+a.map(qt).join(`
|
|
5
5
|
`):" "+qt(a[0]):"as no adapter specified";throw new U("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return i},adapters:Xe};function Ze(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new be(null,t)}function Wt(t){return Ze(t),t.headers=re.from(t.headers),t.data=Ge.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mt.getAdapter(t.adapter||Ce.adapter,t)(t).then(function(s){return Ze(t),s.data=Ge.call(t,t.transformResponse,s),s.headers=re.from(s.headers),s},function(s){return Pt(s)||(Ze(t),s&&s.response&&(s.response.data=Ge.call(t,t.transformResponse,s.response),s.response.headers=re.from(s.response.headers))),Promise.reject(s)})}const Bt="1.12.2",Fe={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Fe[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const Ht={};Fe.transitional=function(e,n,s){function i(o,a){return"[Axios v"+Bt+"] Transitional option '"+o+"'"+a+(s?". "+s:"")}return(o,a,d)=>{if(e===!1)throw new U(i(a," has been removed"+(n?" in "+n:"")),U.ERR_DEPRECATED);return n&&!Ht[a]&&(Ht[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,a,d):!0}},Fe.spelling=function(e){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function vn(t,e,n){if(typeof t!="object")throw new U("options must be an object",U.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let i=s.length;for(;i-- >0;){const o=s[i],a=e[o];if(a){const d=t[o],c=d===void 0||a(d,o,t);if(c!==!0)throw new U("option "+o+" must be "+c,U.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new U("Unknown option "+o,U.ERR_BAD_OPTION)}}const Le={assertOptions:vn,validators:Fe},ae=Le.validators;let he=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Et,response:new Et}}async request(e,n){try{return await this._request(e,n)}catch(s){if(s instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
6
|
-
`+o):s.stack=o}catch{}}throw s}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=xe(this.defaults,n);const{transitional:s,paramsSerializer:i,headers:o}=n;s!==void 0&&Le.assertOptions(s,{silentJSONParsing:ae.transitional(ae.boolean),forcedJSONParsing:ae.transitional(ae.boolean),clarifyTimeoutError:ae.transitional(ae.boolean)},!1),i!=null&&(p.isFunction(i)?n.paramsSerializer={serialize:i}:Le.assertOptions(i,{encode:ae.function,serialize:ae.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Le.assertOptions(n,{baseUrl:ae.spelling("baseURL"),withXsrfToken:ae.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&p.merge(o.common,o[n.method]);o&&p.forEach(["delete","get","head","post","put","patch","common"],u=>{delete o[u]}),n.headers=re.concat(a,o);const d=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,d.unshift(w.fulfilled,w.rejected))});const f=[];this.interceptors.response.forEach(function(w){f.push(w.fulfilled,w.rejected)});let x,y=0,k;if(!c){const u=[Wt.bind(this),void 0];for(u.unshift(...d),u.push(...f),k=u.length,x=Promise.resolve(n);y<k;)x=x.then(u[y++],u[y++]);return x}k=d.length;let C=n;for(;y<k;){const u=d[y++],w=d[y++];try{C=u(C)}catch(h){w.call(this,h);break}}try{x=Wt.call(this,C)}catch(u){return Promise.reject(u)}for(y=0,k=f.length;y<k;)x=x.then(f[y++],f[y++]);return x}getUri(e){e=xe(this.defaults,e);const n=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return vt(n,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){he.prototype[e]=function(n,s){return this.request(xe(s||{},{method:e,url:n,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function n(s){return function(o,a,d){return this.request(xe(d||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}he.prototype[e]=n(),he.prototype[e+"Form"]=n(!0)});let En=class nr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(i=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](i);s._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(d=>{s.subscribe(d),o=d}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},e(function(o,a,d){s.reason||(s.reason=new be(o,a,d),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=s=>{e.abort(s)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new nr(function(i){e=i}),cancel:e}}};function kn(t){return function(n){return t.apply(null,n)}}function Cn(t){return p.isObject(t)&&t.isAxiosError===!0}const Qe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Qe).forEach(([t,e])=>{Qe[e]=t});function Vt(t){const e=new he(t),n=lt(he.prototype.request,e);return p.extend(n,he.prototype,e,{allOwnKeys:!0}),p.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return Vt(xe(t,i))},n}const Y=Vt(Ce);Y.Axios=he,Y.CanceledError=be,Y.CancelToken=En,Y.isCancel=Pt,Y.VERSION=Bt,Y.toFormData=$e,Y.AxiosError=U,Y.Cancel=Y.CanceledError,Y.all=function(e){return Promise.all(e)},Y.spread=kn,Y.isAxiosError=Cn,Y.mergeConfig=xe,Y.AxiosHeaders=re,Y.formToJSON=t=>Ct(p.isHTMLForm(t)?new FormData(t):t),Y.getAdapter=Mt.getAdapter,Y.HttpStatusCode=Qe,Y.default=Y;const{Axios:xs,AxiosError:hs,CanceledError:ms,isCancel:gs,CancelToken:ys,VERSION:bs,all:ws,Cancel:Ss,isAxiosError:js,spread:vs,toFormData:Es,AxiosHeaders:ks,HttpStatusCode:Cs,formToJSON:Ts,getAdapter:Ps,mergeConfig:Is}=Y;class Tn{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=Y.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:3e4,withCredentials:!0})}async request(e,n,s,i={},o=!1){try{const a={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:n,method:e,data:a,headers:i,withCredentials:o})).data}catch(a){throw Y.isAxiosError(a)?{message:a.response?.data?.message||a.message||"Request failed",status:a.response?.status??0}:{message:a.message||"Unexpected error occurred"}}}async signupUser(e){const{name:n,email:s,password:i}=e;if(!n||!s||!i)throw new Error("signup: 'name', 'email', and 'password' are required");return await this.request("POST","/users/signup",e,{},!0)}async loginUser(e){const{email:n,password:s}=e;if(!n||!s)throw new Error("login: 'email' and 'password' are required");try{return await this.request("POST","/users/login",{email:n,password:s},{},!0)}catch(i){throw new Error(i.message||"Login failed due to an unknown error")}}async logoutUser(){try{return(await this.request("POST","/users/logout",{},{},!0))?.success?(typeof window<"u"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure"),window.location.reload()),{success:!0}):{success:!1}}catch(e){throw new Error(e?.message||"Logout failed due to an unknown error")}}async changePassword(e){const{userId:n,currentPassword:s,newPassword:i}=e;if(!n)throw new Error("changePassword: 'userId' is required");if(!s||!i)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return await this.request("PUT",`/users/change-password/${n}`,{currentPassword:s,newPassword:i},{},!0)}async requestEmailVerificationOTP(e){const{userId:n,email:s}=e;if(!n)throw{message:"requestEmailVerificationOTP: 'userId' is required",status:400};if(!s)throw{message:"requestEmailVerificationOTP: 'email' is required",status:400};try{return await this.request("POST",`/users/send-verify-otp/${encodeURIComponent(n)}`,{email:s},{},!0)}catch(i){throw console.error("requestEmailVerificationOTP Error:",i),{message:i?.message||"Failed to send verification OTP",status:i?.status||500}}}async verifyEmail(e){const{email:n,otp:s}=e;if(!n)throw new Error("verifyEmail: 'email' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");try{return await this.request("POST","/users/verify-email",{email:n,otp:s},{},!0)}catch(i){throw{message:i.message||"Failed to verify email",status:i.status||500}}}async checkUserSession(){if(typeof window>"u")return{authenticated:!1};try{return await this.request("GET","/users/session",void 0,{},!0)}catch{return{authenticated:!1}}}async updateUser(e){const{userId:n}=e;if(!n)throw new Error("updateUser: 'userId' is required");return await this.request("PUT",`/users/update/${n}`,{...e},{},!0)}async deleteUser(e){const{userId:n}=e;if(!n)throw new Error("deleteUser: 'userId' is required");return await this.request("DELETE",`/users/delete/${n}`,{},{},!0)}async getUserProfile(e){const{userId:n}=e;if(!n)throw new Error("getProfile: 'userId' and 'appId' are required");try{return await this.request("POST","/users/profile",{userId:n},{},!0)}catch(s){throw{message:s.message||"Failed to fetch profile",status:s.status||500}}}async requestResetUserPasswordOTP(e){const{email:n}=e;if(!n)throw new Error("forgotPassword: 'email' is required");return await this.request("POST","/users/forgot-password",{email:n})}async resetUserPassword(e){const{email:n,otp:s,newPassword:i}=e;if(!n||!s||!i)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return await this.request("POST","/users/reset-password",{email:n,otp:s,newPassword:i})}async checkIfUserExists(e){if(!e)throw new Error("checkUser: 'userId' is required");return await this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchUserData(e){const{userId:n,...s}=e;if(!n)throw new Error("userId required");const i=new URLSearchParams(s).toString();return await this.request("GET",`/users/${n}/data/search?${i}`,void 0,{},!1)}async searchUserDataByKeys(e){const{userId:n,...s}=e;if(!n)throw new Error("searchUserDataByKeys: 'userId' is required");const i=new URLSearchParams(Object.entries(s).reduce((o,[a,d])=>(d!=null&&(o[a]=String(d)),o),{})).toString();return await this.request("GET",`/users/${n}/data/searchbyref?${i}`,void 0,{},!1)}async getUserData(e){const{userId:n}=e;if(!n)throw new Error("getUserData: 'userId' is required");return await this.request("GET",`/users/${n}/data`,void 0,{},!1)}async getSingleUserData(e){const{userId:n,dataId:s}=e;if(!n||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return await this.request("GET",`/users/${n}/data/${s}`,void 0,{},!1)}async addUserData(e){const{userId:n,dataCategory:s,data:i}=e;if(!n)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!i)throw new Error("addUserData: 'data' is required");return await this.request("POST",`/users/${n}/data`,{dataCategory:s,...i},{},!1)}async updateUserData(e){const{userId:n,dataId:s,data:i}=e;if(!n||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!i)throw new Error("updateUserData: 'data' is required");return await this.request("PUT",`/users/${n}/data/${s}`,i,{},!1)}async deleteUserData(e){const{userId:n,dataId:s}=e;if(!n||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return await this.request("DELETE",`/users/${n}/data/${s}`,void 0,{},!1)}async searchAllUsersDataFromApp(e){const{dataCategory:n}=e,s=this.appId;if(!s)throw new Error("searchAllUsersDataFromApp: 'appId' is required");if(!n)throw new Error("searchAllUsersDataFromApp: 'category' is required");return await this.request("GET",`/users/app/${encodeURIComponent(s)}/category/${encodeURIComponent(n)}`,void 0,{},!1)}async getAppData(e){const n=this.appId;if(!n)throw new Error("getAppData: 'appId' is required");const s=e?`/app/${encodeURIComponent(n)}/app-data/${encodeURIComponent(e)}`:`/app/${encodeURIComponent(n)}/app-data`;return await this.request("GET",s,void 0,{},!1)}async getAppUsersData(e){const n=this.appId;if(!n)throw new Error("getUsersData: 'appId' is required");const s=e?`/app/${encodeURIComponent(n)}/users-data/${encodeURIComponent(e)}`:`/app/${encodeURIComponent(n)}/users-data`;return await this.request("GET",s,void 0,{},!1)}async getAllAppUsers(){const e=this.appId;if(!e)throw new Error("getAllAppUsers: 'appId' is required");return await this.request("GET",`/app/${encodeURIComponent(e)}/users`,void 0,{},!1)}async getSingleAppData(e){const n=this.appId;if(!n)throw new Error("getSingleAppData: 'appId' is required");if(!e?.dataId)throw new Error("getSingleAppData: 'dataId' is required");return await this.request("GET",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async searchAppDataByKeys(e){const n=this.appId;if(!n)throw new Error("searchAppDataByKeys: 'appId' is required");if(!e||typeof e!="object")throw new Error("searchAppDataByKeys: params object is required");return await this.request("POST",`/app/${encodeURIComponent(n)}/data/searchByKeys`,e,{},!1)}async addAppData(e){const n=this.appId;if(!n)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:i}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!i||typeof i!="object")throw new Error("addAppData: 'data' is required");return await this.request("POST",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(s)}`,{item:i},{},!1)}async updateAppData(e){const n=this.appId;if(!n)throw new Error("updateAppData: 'appId' is required");if(!e?.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e?.data||typeof e.data!="object")throw new Error("updateAppData: 'data' is required");return await this.request("PATCH",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,e.data,{},!1)}async deleteAppData(e){const n=this.appId;if(!n)throw new Error("deleteAppData: 'appId' is required");if(!e?.dataId)throw new Error("deleteAppData: 'dataId' is required");return await this.request("DELETE",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}}var qe={exports:{}},Pe={};/**
|
|
6
|
+
`+o):s.stack=o}catch{}}throw s}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=xe(this.defaults,n);const{transitional:s,paramsSerializer:i,headers:o}=n;s!==void 0&&Le.assertOptions(s,{silentJSONParsing:ae.transitional(ae.boolean),forcedJSONParsing:ae.transitional(ae.boolean),clarifyTimeoutError:ae.transitional(ae.boolean)},!1),i!=null&&(p.isFunction(i)?n.paramsSerializer={serialize:i}:Le.assertOptions(i,{encode:ae.function,serialize:ae.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Le.assertOptions(n,{baseUrl:ae.spelling("baseURL"),withXsrfToken:ae.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&p.merge(o.common,o[n.method]);o&&p.forEach(["delete","get","head","post","put","patch","common"],u=>{delete o[u]}),n.headers=re.concat(a,o);const d=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,d.unshift(w.fulfilled,w.rejected))});const f=[];this.interceptors.response.forEach(function(w){f.push(w.fulfilled,w.rejected)});let x,y=0,k;if(!c){const u=[Wt.bind(this),void 0];for(u.unshift(...d),u.push(...f),k=u.length,x=Promise.resolve(n);y<k;)x=x.then(u[y++],u[y++]);return x}k=d.length;let C=n;for(;y<k;){const u=d[y++],w=d[y++];try{C=u(C)}catch(h){w.call(this,h);break}}try{x=Wt.call(this,C)}catch(u){return Promise.reject(u)}for(y=0,k=f.length;y<k;)x=x.then(f[y++],f[y++]);return x}getUri(e){e=xe(this.defaults,e);const n=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return vt(n,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){he.prototype[e]=function(n,s){return this.request(xe(s||{},{method:e,url:n,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function n(s){return function(o,a,d){return this.request(xe(d||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}he.prototype[e]=n(),he.prototype[e+"Form"]=n(!0)});let En=class nr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(i=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](i);s._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(d=>{s.subscribe(d),o=d}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},e(function(o,a,d){s.reason||(s.reason=new be(o,a,d),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=s=>{e.abort(s)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new nr(function(i){e=i}),cancel:e}}};function kn(t){return function(n){return t.apply(null,n)}}function Cn(t){return p.isObject(t)&&t.isAxiosError===!0}const Qe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Qe).forEach(([t,e])=>{Qe[e]=t});function Vt(t){const e=new he(t),n=lt(he.prototype.request,e);return p.extend(n,he.prototype,e,{allOwnKeys:!0}),p.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return Vt(xe(t,i))},n}const Y=Vt(Ce);Y.Axios=he,Y.CanceledError=be,Y.CancelToken=En,Y.isCancel=Pt,Y.VERSION=Bt,Y.toFormData=$e,Y.AxiosError=U,Y.Cancel=Y.CanceledError,Y.all=function(e){return Promise.all(e)},Y.spread=kn,Y.isAxiosError=Cn,Y.mergeConfig=xe,Y.AxiosHeaders=re,Y.formToJSON=t=>Ct(p.isHTMLForm(t)?new FormData(t):t),Y.getAdapter=Mt.getAdapter,Y.HttpStatusCode=Qe,Y.default=Y;const{Axios:xs,AxiosError:hs,CanceledError:ms,isCancel:gs,CancelToken:ys,VERSION:bs,all:ws,Cancel:Ss,isAxiosError:js,spread:vs,toFormData:Es,AxiosHeaders:ks,HttpStatusCode:Cs,formToJSON:Ts,getAdapter:Ps,mergeConfig:Is}=Y;class Tn{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=Y.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:3e4,withCredentials:!0})}async request(e,n,s,i={},o=!1){try{const a={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:n,method:e,data:a,headers:i,withCredentials:o})).data}catch(a){throw Y.isAxiosError(a)?{message:a.response?.data?.message||a.message||"Request failed",status:a.response?.status??0}:{message:a.message||"Unexpected error occurred"}}}async signupUser(e){const{name:n,email:s,password:i}=e;if(!n||!s||!i)throw new Error("signup: 'name', 'email', and 'password' are required");return await this.request("POST","/users/signup",e,{},!0)}async loginUser(e){const{email:n,password:s}=e;if(!n||!s)throw new Error("login: 'email' and 'password' are required");try{return await this.request("POST","/users/login",{email:n,password:s},{},!0)}catch(i){throw new Error(i.message||"Login failed due to an unknown error")}}async logoutUser(){try{return(await this.request("POST","/users/logout",{},{},!0))?.success?(typeof window<"u"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure"),window.location.reload()),{success:!0}):{success:!1}}catch(e){throw new Error(e?.message||"Logout failed due to an unknown error")}}async changePassword(e){const{userId:n,currentPassword:s,newPassword:i}=e;if(!n)throw new Error("changePassword: 'userId' is required");if(!s||!i)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return await this.request("PUT",`/users/change-password/${n}`,{currentPassword:s,newPassword:i},{},!0)}async requestEmailVerificationOTP(e){const{userId:n,email:s}=e;if(!n)throw{message:"requestEmailVerificationOTP: 'userId' is required",status:400};if(!s)throw{message:"requestEmailVerificationOTP: 'email' is required",status:400};try{return await this.request("POST",`/users/send-verify-otp/${encodeURIComponent(n)}`,{email:s},{},!0)}catch(i){throw console.error("requestEmailVerificationOTP Error:",i),{message:i?.message||"Failed to send verification OTP",status:i?.status||500}}}async verifyEmail(e){const{email:n,otp:s}=e;if(!n)throw new Error("verifyEmail: 'email' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");try{return await this.request("POST","/users/verify-email",{email:n,otp:s},{},!0)}catch(i){throw{message:i.message||"Failed to verify email",status:i.status||500}}}async checkUserSession(){if(typeof window>"u")return{authenticated:!1};try{return await this.request("GET","/users/session",void 0,{},!0)}catch{return{authenticated:!1}}}async getUser(e){const n=this.appId;if(!n)throw new Error("getUser: 'appId' is required in SDK config");if(!e?.id&&!e?.username)throw new Error("getUser: either 'id' or 'username' is required");const s=new URLSearchParams;return e.id&&s.append("id",e.id),e.username&&s.append("username",e.username),await this.request("GET",`/users/${encodeURIComponent(n)}/user?${s.toString()}`,void 0,{},!0)}async updateUser(e){const{userId:n}=e;if(!n)throw new Error("updateUser: 'userId' is required");return await this.request("PUT",`/users/update/${n}`,{...e},{},!0)}async deleteUser(e){const{userId:n}=e;if(!n)throw new Error("deleteUser: 'userId' is required");return await this.request("DELETE",`/users/delete/${n}`,{},{},!0)}async getUserProfile(e){const{userId:n}=e;if(!n)throw new Error("getProfile: 'userId' and 'appId' are required");try{return await this.request("POST","/users/profile",{userId:n},{},!0)}catch(s){throw{message:s.message||"Failed to fetch profile",status:s.status||500}}}async requestResetUserPasswordOTP(e){const{email:n}=e;if(!n)throw new Error("forgotPassword: 'email' is required");return await this.request("POST","/users/forgot-password",{email:n})}async resetUserPassword(e){const{email:n,otp:s,newPassword:i}=e;if(!n||!s||!i)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return await this.request("POST","/users/reset-password",{email:n,otp:s,newPassword:i})}async checkIfUserExists(e){if(!e)throw new Error("checkUser: 'userId' is required");return await this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchUserData(e){const{userId:n,...s}=e;if(!n)throw new Error("userId required");const i=new URLSearchParams(s).toString();return await this.request("GET",`/users/${n}/data/search?${i}`,void 0,{},!1)}async searchUserDataByKeys(e){const{userId:n,...s}=e;if(!n)throw new Error("searchUserDataByKeys: 'userId' is required");const i=new URLSearchParams(Object.entries(s).reduce((o,[a,d])=>(d!=null&&(o[a]=String(d)),o),{})).toString();return await this.request("GET",`/users/${n}/data/searchbyref?${i}`,void 0,{},!1)}async getUserData(e){const{userId:n}=e;if(!n)throw new Error("getUserData: 'userId' is required");return await this.request("GET",`/users/${n}/data`,void 0,{},!1)}async getSingleUserData(e){const{userId:n,dataId:s}=e;if(!n||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return await this.request("GET",`/users/${n}/data/${s}`,void 0,{},!1)}async addUserData(e){const{userId:n,dataCategory:s,data:i}=e;if(!n)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!i)throw new Error("addUserData: 'data' is required");return await this.request("POST",`/users/${n}/data`,{dataCategory:s,...i},{},!1)}async updateUserData(e){const{userId:n,dataId:s,data:i}=e;if(!n||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!i)throw new Error("updateUserData: 'data' is required");return await this.request("PUT",`/users/${n}/data/${s}`,i,{},!1)}async deleteUserData(e){const{userId:n,dataId:s}=e;if(!n||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return await this.request("DELETE",`/users/${n}/data/${s}`,void 0,{},!1)}async searchAllUsersDataFromApp(e){const{dataCategory:n}=e,s=this.appId;if(!s)throw new Error("searchAllUsersDataFromApp: 'appId' is required");if(!n)throw new Error("searchAllUsersDataFromApp: 'category' is required");return await this.request("GET",`/users/app/${encodeURIComponent(s)}/category/${encodeURIComponent(n)}`,void 0,{},!1)}async getAppData(e){const n=this.appId;if(!n)throw new Error("getAppData: 'appId' is required");const s=e?`/app/${encodeURIComponent(n)}/app-data/${encodeURIComponent(e)}`:`/app/${encodeURIComponent(n)}/app-data`;return await this.request("GET",s,void 0,{},!1)}async getAppUsersData(e){const n=this.appId;if(!n)throw new Error("getUsersData: 'appId' is required");const s=e?`/app/${encodeURIComponent(n)}/users-data/${encodeURIComponent(e)}`:`/app/${encodeURIComponent(n)}/users-data`;return await this.request("GET",s,void 0,{},!1)}async getAllAppUsers(){const e=this.appId;if(!e)throw new Error("getAllAppUsers: 'appId' is required");return await this.request("GET",`/app/${encodeURIComponent(e)}/users`,void 0,{},!1)}async getSingleAppData(e){const n=this.appId;if(!n)throw new Error("getSingleAppData: 'appId' is required");if(!e?.dataId)throw new Error("getSingleAppData: 'dataId' is required");return await this.request("GET",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async searchAppDataByKeys(e){const n=this.appId;if(!n)throw new Error("searchAppDataByKeys: 'appId' is required");if(!e||typeof e!="object")throw new Error("searchAppDataByKeys: params object is required");return await this.request("POST",`/app/${encodeURIComponent(n)}/data/searchByKeys`,e,{},!1)}async addAppData(e){const n=this.appId;if(!n)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:i}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!i||typeof i!="object")throw new Error("addAppData: 'data' is required");return await this.request("POST",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(s)}`,{item:i},{},!1)}async updateAppData(e){const n=this.appId;if(!n)throw new Error("updateAppData: 'appId' is required");if(!e?.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e?.data||typeof e.data!="object")throw new Error("updateAppData: 'data' is required");return await this.request("PATCH",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,e.data,{},!1)}async deleteAppData(e){const n=this.appId;if(!n)throw new Error("deleteAppData: 'appId' is required");if(!e?.dataId)throw new Error("deleteAppData: 'dataId' is required");return await this.request("DELETE",`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}}var qe={exports:{}},Pe={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
9
9
|
*
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var
|
|
22
|
+
*/var Kt;function In(){return Kt||(Kt=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===W?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case T:return"Profiler";case R:return"StrictMode";case b:return"Suspense";case j:return"SuspenseList";case X:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case w:return"Portal";case A:return l.displayName||"Context";case g:return(l._context.displayName||"Context")+".Consumer";case D:var m=l.render;return l=l.displayName,l||(l=m.displayName||m.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case q:return m=l.displayName||null,m!==null?m:t(l.type)||"Memo";case O:m=l._payload,l=l._init;try{return t(l(m))}catch{}}return null}function e(l){return""+l}function n(l){try{e(l);var m=!1}catch{m=!0}if(m){m=console;var E=m.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return E.call(m,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),e(l)}}function s(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===O)return"<...>";try{var m=t(l);return m?"<"+m+">":"<...>"}catch{return"<...>"}}function i(){var l=I.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function a(l){if(G.call(l,"key")){var m=Object.getOwnPropertyDescriptor(l,"key").get;if(m&&m.isReactWarning)return!1}return l.key!==void 0}function d(l,m){function E(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",m))}E.isReactWarning=!0,Object.defineProperty(l,"key",{get:E,configurable:!0})}function c(){var l=t(this.type);return J[l]||(J[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function f(l,m,E,N,ne,le){var B=E.ref;return l={$$typeof:u,type:l,key:m,props:E,_owner:N},(B!==void 0?B:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:c}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ne}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function x(l,m,E,N,ne,le){var B=m.children;if(B!==void 0)if(N)if(P(B)){for(N=0;N<B.length;N++)y(B[N]);Object.freeze&&Object.freeze(B)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(B);if(G.call(m,"key")){B=t(l);var de=Object.keys(m).filter(function(z){return z!=="key"});N=0<de.length?"{key: someKey, "+de.join(": ..., ")+": ...}":"{key: someKey}",K[B+N]||(de=0<de.length?"{"+de.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,N,B,de,B),
|
|
27
|
+
<%s key={someKey} {...props} />`,N,B,de,B),K[B+N]=!0)}if(B=null,E!==void 0&&(n(E),B=""+E),a(m)&&(n(m.key),B=""+m.key),"key"in m){E={};for(var je in m)je!=="key"&&(E[je]=m[je])}else E=m;return B&&d(E,typeof l=="function"?l.displayName||l.name||"Unknown":l),f(l,B,E,i(),ne,le)}function y(l){k(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===O&&(l._payload.status==="fulfilled"?k(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function k(l){return typeof l=="object"&&l!==null&&l.$$typeof===u}var C=S,u=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),A=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),W=Symbol.for("react.client.reference"),I=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,P=Array.isArray,_=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(l){return l()}};var M,J={},H=C.react_stack_bottom_frame.bind(C,o)(),F=_(s(o)),K={};Ie.Fragment=h,Ie.jsx=function(l,m,E){var N=1e4>I.recentlyCreatedOwnerStacks++;return x(l,m,E,!1,N?Error("react-stack-top-frame"):H,N?_(s(l)):F)},Ie.jsxs=function(l,m,E){var N=1e4>I.recentlyCreatedOwnerStacks++;return x(l,m,E,!0,N?Error("react-stack-top-frame"):H,N?_(s(l)):F)}})()),Ie}var Jt;function Rn(){return Jt||(Jt=1,process.env.NODE_ENV==="production"?qe.exports=Pn():qe.exports=In()),qe.exports}var r=Rn();/**
|
|
28
28
|
* @license lucide-react v0.544.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
@@ -194,7 +194,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
194
194
|
*
|
|
195
195
|
* This source code is licensed under the ISC license.
|
|
196
196
|
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/const
|
|
197
|
+
*/const Kn=L("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
|
|
198
198
|
* @license lucide-react v0.544.0 - ISC
|
|
199
199
|
*
|
|
200
200
|
* This source code is licensed under the ISC license.
|
|
@@ -204,12 +204,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
204
204
|
*
|
|
205
205
|
* This source code is licensed under the ISC license.
|
|
206
206
|
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
-
*/const Re=L("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rr=S.createContext(null),
|
|
207
|
+
*/const Re=L("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rr=S.createContext(null),Jn=({authix:t,children:e})=>r.jsx(rr.Provider,{value:t,children:e}),me=()=>{const t=S.useContext(rr);if(!t)throw new Error("useAuthix must be used inside <AuthixProvider />");return t},Gn=({logoUrl:t,logoLinkUrl:e,title:n="Create Your Account",subtitle:s="Join our platform today",primaryColor:i="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,showAvatar:d=!1,roles:c=[],showRoleSelector:f=!1,loginUrl:x,onSuccess:y,onError:k})=>{const C=me(),u={name:"",email:"",password:"",role:c.length?c[0]:"user",...d&&{avatarUrl:""}},[w,h]=S.useState(u),[R,T]=S.useState(!1),[g,A]=S.useState(!1),[D,b]=S.useState(null),[j,q]=S.useState({}),[O,X]=S.useState(!1),W=a?"#ffffff":"#111827",I=a?"#a1a1aa":"#6b7280",G=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",P=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";S.useEffect(()=>{if(typeof window<"u"){const F=()=>X(window.innerWidth<768);return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)}},[]);const _=F=>{const{name:K,value:l}=F.target;h(m=>({...m,[K]:l})),j[K]&&q(m=>({...m,[K]:void 0}))},M=()=>{const F={};return w.name.trim()||(F.name="Name is required"),w.email.trim()?/\S+@\S+\.\S+/.test(w.email)||(F.email="Invalid email address"):F.email="Email is required",w.password?w.password.length<6&&(F.password="Password must be at least 6 characters"):F.password="Password is required",q(F),Object.keys(F).length===0},J=async F=>{if(F.preventDefault(),!!M()){A(!0),b(null);try{const K={name:w.name,email:w.email,password:w.password,role:w.role,...w.avatarUrl?{avatarUrl:w.avatarUrl}:{}},l=await C.signupUser(K);l.success?(b({type:"success",text:l.message||"Account created successfully!"}),y?.(l.user)):(b({type:"error",text:l.message||"Signup failed"}),k?.(l))}catch(K){b({type:"error",text:K.message||"Signup failed. Please try again."}),k?.(K)}finally{A(!1)}}},H={width:"100%",padding:O?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:G,border:`1px solid ${P}`,borderRadius:"10px",color:W,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return r.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[r.jsxs("div",{style:{minWidth:O?"320px":"380px",width:"100%",maxWidth:O?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:O?"30px 24px":"20px 28px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?r.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:r.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):r.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:W,margin:0},children:n}),r.jsx("p",{style:{fontSize:"14px",color:I},children:s})]}),d&&w.avatarUrl&&r.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:r.jsx("img",{src:w.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:F=>{const K=F.target;K.style.display="none"}})}),r.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[f&&c&&c.length===2&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{style:{fontSize:"14px",fontWeight:500,color:W},children:"Select Role"}),r.jsxs("div",{style:{position:"relative",display:"flex",borderRadius:"10px",border:`1px solid ${P}`,backgroundColor:G,overflow:"hidden",cursor:"pointer",height:"42px"},children:[r.jsx("div",{style:{position:"absolute",top:0,left:0,width:"50%",height:"100%",backgroundColor:a?"#000000":"#ffffff",boxShadow:a?"0 1px 3px rgba(255,255,255,0.05)":"0 1px 3px rgba(0,0,0,0.1)",borderRadius:"10px",transition:"transform 0.3s ease, background-color 0.3s ease",transform:w.role===c[1]?"translateX(100%)":"translateX(0)",zIndex:0}}),r.jsx("button",{type:"button",onClick:()=>h(F=>({...F,role:c[0]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:w.role===c[0]?i:a?"#9ca3af":"#6b7280",fontWeight:w.role===c[0]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:c[0].charAt(0).toUpperCase()+c[0].slice(1)}),r.jsx("button",{type:"button",onClick:()=>h(F=>({...F,role:c[1]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:w.role===c[1]?i:a?"#9ca3af":"#6b7280",fontWeight:w.role===c[1]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:c[1].charAt(0).toUpperCase()+c[1].slice(1)})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:W},children:"Full Name"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:I}}),r.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:w.name,onChange:_,style:{...H,borderColor:j.name?"#ef4444":P}})]}),j.name&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:j.name})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:W},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:I}}),r.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:w.email,onChange:_,style:{...H,borderColor:j.email?"#ef4444":P}})]}),j.email&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:j.email})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:W},children:"Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:I}}),r.jsx("input",{id:"signup-password",type:R?"text":"password",name:"password",placeholder:"Create a secure password",value:w.password,onChange:_,style:{...H,borderColor:j.password?"#ef4444":P}}),r.jsx("button",{type:"button",onClick:()=>T(!R),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:I,cursor:"pointer",padding:"4px"},children:R?r.jsx(rt,{size:20}):r.jsx(nt,{size:20})})]}),j.password&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:j.password})]}),d&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:W},children:"Avatar URL (Optional)"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(Zt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:I}}),r.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:w.avatarUrl||"",onChange:_,style:H})]})]}),x&&r.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:r.jsx("a",{href:x,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),D&&r.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:D.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:D.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:D.type==="success"?i:"#ef4444"},children:[D.type==="success"?r.jsx(ce,{size:20}):r.jsx(oe,{size:20}),r.jsx("span",{children:D.text})]}),r.jsx("button",{type:"submit",disabled:g,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:g?"not-allowed":"pointer",opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:g?r.jsxs(r.Fragment,{children:[r.jsx(Mn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),r.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:I,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",r.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),r.jsx("style",{children:`
|
|
208
208
|
@keyframes spin {
|
|
209
209
|
from { transform: rotate(0deg); }
|
|
210
210
|
to { transform: rotate(360deg); }
|
|
211
211
|
}
|
|
212
|
-
`})]})},Xn=({logoUrl:t,logoLinkUrl:e,title:n="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",primaryColor:i="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,signupUrl:d,onSuccess:c,onError:f})=>{const x=me(),[y,k]=S.useState("login"),[C,u]=S.useState(1),[w,h]=S.useState(!1),[R,T]=S.useState(!1),[g,A]=S.useState(null),[D,b]=S.useState(""),[j,q]=S.useState(""),[O,X]=S.useState({email:"",otp:"",newPassword:""}),[W,I]=S.useState(!1),G=a?"#ffffff":"#111827",P=a?"#a1a1aa":"#6b7280",_=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",M=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";S.useEffect(()=>{if(typeof window<"u"){const m=()=>I(window.innerWidth<768);return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)}},[]);const K=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.loginUser({email:D,password:j}),{user:N}=E;if(!N)throw new Error(E.message||"Login failed");if(typeof document<"u"){const ne="a_s_b",le="true",B=new Date;B.setTime(B.getTime()+1440*60*1e3),document.cookie=`${ne}=${le}; path=/; expires=${B.toUTCString()}; SameSite=Lax`}A({type:"success",text:`Welcome ${N.name}`}),c?.(N)}catch(E){const N=E.message||"Login failed";A({type:"error",text:N}),f?.(E)}finally{T(!1)}},H=m=>{X({...O,[m.target.name]:m.target.value})},F=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.requestResetUserPasswordOTP({email:O.email});E.success?(u(2),A({type:"success",text:E.message||"OTP sent to your email"})):A({type:"error",text:E.message||"Failed to send OTP"})}catch(E){A({type:"error",text:E.message||"Something went wrong"})}finally{T(!1)}},J=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.resetUserPassword({email:O.email,otp:O.otp,newPassword:O.newPassword});E.success?(A({type:"success",text:E.message||"Password reset successfully!"}),u(1),X({email:"",otp:"",newPassword:""}),k("login")):A({type:"error",text:E.message||"Reset failed"})}catch(E){A({type:"error",text:E.message||"Something went wrong"})}finally{T(!1)}},l={width:"100%",padding:W?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:_,border:`1px solid ${M}`,borderRadius:"10px",color:G,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return r.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:r.jsxs("div",{style:{minWidth:W?"320px":"380px",maxWidth:W?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:W?"30px 24px":"18px 28px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?r.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:r.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):r.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:G,margin:0},children:y==="login"?n:C===1?"Forgot Password":"Reset Password"}),r.jsx("p",{style:{fontSize:"14px",color:P},children:y==="login"?s:"Follow the steps to reset your password"})]}),y==="login"&&r.jsxs("form",{onSubmit:K,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:D,onChange:m=>b(m.target.value),style:l})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"login-password",type:w?"text":"password",placeholder:"Enter your password",value:j,onChange:m=>q(m.target.value),style:l}),r.jsx("button",{type:"button",onClick:()=>h(!w),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:P,cursor:"pointer"},children:w?r.jsx(rt,{size:20}):r.jsx(nt,{size:20})})]})]}),r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[d&&r.jsx("a",{href:d,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),r.jsx("button",{type:"button",onClick:()=>k("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),r.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:R?"Signing In...":"Sign In"})]}),y==="forgot"&&r.jsxs("form",{onSubmit:C===1?F:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[C===1?r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:O.email,onChange:H,style:l})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(Qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:O.otp,onChange:H,style:l})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"New Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:O.newPassword,onChange:H,style:l})]})]})]}),r.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:o,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:R?"Please wait...":C===1?"Send Reset OTP":"Reset Password"}),r.jsx("button",{type:"button",onClick:()=>{k("login"),u(1)},style:{background:"none",border:"none",fontSize:"14px",color:P,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),g&&r.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:g.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:g.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:g.type==="success"?i:"#ef4444"},children:[g.type==="success"?r.jsx(ce,{size:20}):r.jsx(oe,{size:20}),r.jsx("span",{children:g.text})]}),r.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:P,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",r.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},Zn=({children:t,fallback:e=null})=>{const[n,s]=S.useState("loading");S.useEffect(()=>{if(typeof window>"u")return;const d=window.document.cookie.split(";").map(c=>c.trim()).find(c=>c.startsWith("a_s_b="))?.split("=")[1]==="true";s(d?"authenticated":"unauthenticated")},[]);const i=o=>typeof o=="function"?o():o;return n==="loading"?null:n==="unauthenticated"?r.jsx(r.Fragment,{children:i(e)}):r.jsx(r.Fragment,{children:t})},Qn=({children:t,fallback:e=null})=>{const[n,s]=S.useState("loading");S.useEffect(()=>{if(typeof window>"u")return;const d=window.document.cookie.split(";").map(c=>c.trim()).find(c=>c.startsWith("a_s_b="))?.split("=")[1]==="true";s(d?"authenticated":"unauthenticated")},[]);const i=o=>typeof o=="function"?o():o;return n==="loading"?null:n==="authenticated"?r.jsx(r.Fragment,{children:i(e)}):r.jsx(r.Fragment,{children:t})},es=({isOpen:t,onClose:e,onSuccess:n,onError:s,userId:i,colors:o})=>{const a=me(),[d,c]=S.useState(!1),[f,x]=S.useState(""),[y,k]=S.useState("warning"),[C,u]=S.useState(!1);if(S.useEffect(()=>{if(typeof window>"u")return;const g=()=>{u(window.innerWidth<640)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),!t)return null;const w=async()=>{c(!0),k("processing");try{const g=await a.deleteUser({userId:i});g.success?(n(g.message||"Account deleted successfully"),k("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(g.message||"Failed to delete account"),k("warning"))}catch(g){s(g.response?.data?.message||"Something went wrong"),k("warning")}finally{c(!1)}},h=f.toLowerCase()==="delete my account",R=g=>{g.target===g.currentTarget&&y!=="processing"&&y!=="success"&&e()},T=()=>{switch(y){case"warning":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(Me,{size:20})}),r.jsx("div",{children:r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),r.jsx("button",{onClick:e,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:o.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.color=o.textPrimary},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color=o.textTertiary},children:r.jsx(Re,{size:20})})]}),r.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${o.error}15`,border:`1px solid ${o.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[r.jsx("div",{style:{color:o.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:r.jsx(tr,{size:24})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h4",{style:{color:o.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:r.jsx(Dn,{size:16}),text:"All your data will be permanently deleted"},{icon:r.jsx(Jn,{size:16}),text:"This action cannot be reversed"},{icon:r.jsx(it,{size:16}),text:"You will lose access to all services"}].map((g,A)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:o.textSecondary},children:[r.jsx("div",{style:{color:o.error,flexShrink:0},children:g.icon}),r.jsx("span",{children:g.text})]},A))})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:C?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:e,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),r.jsxs("button",{onClick:()=>k("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[r.jsx(Me,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(tr,{size:24})}),r.jsx("div",{style:{flex:1},children:r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),r.jsxs("div",{style:{marginBottom:"24px"},children:[r.jsxs("p",{style:{color:o.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",r.jsx("strong",{style:{color:o.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),r.jsx("input",{type:"text",value:f,onChange:g=>x(g.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${h?o.success:o.error}`,backgroundColor:"transparent",color:o.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:g=>{g.target.style.boxShadow=`0 0 0 3px ${o.accent}20`},onBlur:g=>{g.target.style.boxShadow="none"},autoFocus:!0}),h&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:o.success,fontSize:"14px",fontWeight:500},children:[r.jsx(tt,{size:16}),r.jsx("span",{children:"Confirmation accepted"})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:()=>{k("warning"),x("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),r.jsxs("button",{onClick:w,disabled:!h||d,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!h||d?"not-allowed":"pointer",flex:C?"none":1,minWidth:C?"100%":"140px",opacity:!h||d?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!h||d?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{h&&!d&&(g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:g=>{h&&!d&&(g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[r.jsx(Me,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(se,{size:20,style:{animation:"spin 1s linear infinite"}})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),r.jsx("p",{style:{color:o.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),r.jsx("div",{style:{marginBottom:"20px"},children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((g,A)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:g.active?`${o.accent}10`:"transparent"},children:[r.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:g.active?o.accent:o.textTertiary,transition:"all 0.3s ease",boxShadow:g.active?`0 0 0 4px ${o.accent}20`:"none"}}),r.jsx("span",{style:{fontSize:"14px",color:g.active?o.textPrimary:o.textSecondary,fontWeight:g.active?500:400},children:g.text})]},A))})}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary},children:[r.jsx(er,{size:18,style:{color:o.accent,flexShrink:0}}),r.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(tt,{size:20})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),r.jsx("p",{style:{color:o.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),r.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${o.success}10`,border:`1px solid ${o.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[r.jsx(tt,{size:48,style:{color:o.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),r.jsx("p",{style:{color:o.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),r.jsx("p",{style:{color:o.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary,justifyContent:"center"},children:[r.jsx(se,{size:16,style:{animation:"spin 1s linear infinite",color:o.accent}}),r.jsx("span",{children:"Redirecting to login page..."})]})]})}};return r.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:R,children:[r.jsx("div",{style:{backgroundColor:o.surface,border:`1px solid ${o.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:T()}),r.jsx("style",{children:`
|
|
212
|
+
`})]})},Xn=({logoUrl:t,logoLinkUrl:e,title:n="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",primaryColor:i="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,signupUrl:d,onSuccess:c,onError:f})=>{const x=me(),[y,k]=S.useState("login"),[C,u]=S.useState(1),[w,h]=S.useState(!1),[R,T]=S.useState(!1),[g,A]=S.useState(null),[D,b]=S.useState(""),[j,q]=S.useState(""),[O,X]=S.useState({email:"",otp:"",newPassword:""}),[W,I]=S.useState(!1),G=a?"#ffffff":"#111827",P=a?"#a1a1aa":"#6b7280",_=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",M=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";S.useEffect(()=>{if(typeof window<"u"){const m=()=>I(window.innerWidth<768);return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)}},[]);const J=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.loginUser({email:D,password:j}),{user:N}=E;if(!N)throw new Error(E.message||"Login failed");if(typeof document<"u"){const ne="a_s_b",le="true",B=new Date;B.setTime(B.getTime()+1440*60*1e3),document.cookie=`${ne}=${le}; path=/; expires=${B.toUTCString()}; SameSite=Lax`}A({type:"success",text:`Welcome ${N.name}`}),c?.(N)}catch(E){const N=E.message||"Login failed";A({type:"error",text:N}),f?.(E)}finally{T(!1)}},H=m=>{X({...O,[m.target.name]:m.target.value})},F=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.requestResetUserPasswordOTP({email:O.email});E.success?(u(2),A({type:"success",text:E.message||"OTP sent to your email"})):A({type:"error",text:E.message||"Failed to send OTP"})}catch(E){A({type:"error",text:E.message||"Something went wrong"})}finally{T(!1)}},K=async m=>{m.preventDefault(),T(!0),A(null);try{const E=await x.resetUserPassword({email:O.email,otp:O.otp,newPassword:O.newPassword});E.success?(A({type:"success",text:E.message||"Password reset successfully!"}),u(1),X({email:"",otp:"",newPassword:""}),k("login")):A({type:"error",text:E.message||"Reset failed"})}catch(E){A({type:"error",text:E.message||"Something went wrong"})}finally{T(!1)}},l={width:"100%",padding:W?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:_,border:`1px solid ${M}`,borderRadius:"10px",color:G,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return r.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:r.jsxs("div",{style:{minWidth:W?"320px":"380px",maxWidth:W?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:W?"30px 24px":"18px 28px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?r.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:r.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):r.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:G,margin:0},children:y==="login"?n:C===1?"Forgot Password":"Reset Password"}),r.jsx("p",{style:{fontSize:"14px",color:P},children:y==="login"?s:"Follow the steps to reset your password"})]}),y==="login"&&r.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:D,onChange:m=>b(m.target.value),style:l})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"login-password",type:w?"text":"password",placeholder:"Enter your password",value:j,onChange:m=>q(m.target.value),style:l}),r.jsx("button",{type:"button",onClick:()=>h(!w),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:P,cursor:"pointer"},children:w?r.jsx(rt,{size:20}):r.jsx(nt,{size:20})})]})]}),r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[d&&r.jsx("a",{href:d,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),r.jsx("button",{type:"button",onClick:()=>k("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),r.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:R?"Signing In...":"Sign In"})]}),y==="forgot"&&r.jsxs("form",{onSubmit:C===1?F:K,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[C===1?r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:O.email,onChange:H,style:l})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(Qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:O.otp,onChange:H,style:l})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"New Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:P}}),r.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:O.newPassword,onChange:H,style:l})]})]})]}),r.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:o,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:R?"Please wait...":C===1?"Send Reset OTP":"Reset Password"}),r.jsx("button",{type:"button",onClick:()=>{k("login"),u(1)},style:{background:"none",border:"none",fontSize:"14px",color:P,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),g&&r.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:g.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:g.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:g.type==="success"?i:"#ef4444"},children:[g.type==="success"?r.jsx(ce,{size:20}):r.jsx(oe,{size:20}),r.jsx("span",{children:g.text})]}),r.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:P,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",r.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},Zn=({children:t,fallback:e=null})=>{const[n,s]=S.useState("loading");S.useEffect(()=>{if(typeof window>"u")return;const d=window.document.cookie.split(";").map(c=>c.trim()).find(c=>c.startsWith("a_s_b="))?.split("=")[1]==="true";s(d?"authenticated":"unauthenticated")},[]);const i=o=>typeof o=="function"?o():o;return n==="loading"?null:n==="unauthenticated"?r.jsx(r.Fragment,{children:i(e)}):r.jsx(r.Fragment,{children:t})},Qn=({children:t,fallback:e=null})=>{const[n,s]=S.useState("loading");S.useEffect(()=>{if(typeof window>"u")return;const d=window.document.cookie.split(";").map(c=>c.trim()).find(c=>c.startsWith("a_s_b="))?.split("=")[1]==="true";s(d?"authenticated":"unauthenticated")},[]);const i=o=>typeof o=="function"?o():o;return n==="loading"?null:n==="authenticated"?r.jsx(r.Fragment,{children:i(e)}):r.jsx(r.Fragment,{children:t})},es=({isOpen:t,onClose:e,onSuccess:n,onError:s,userId:i,colors:o})=>{const a=me(),[d,c]=S.useState(!1),[f,x]=S.useState(""),[y,k]=S.useState("warning"),[C,u]=S.useState(!1);if(S.useEffect(()=>{if(typeof window>"u")return;const g=()=>{u(window.innerWidth<640)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),!t)return null;const w=async()=>{c(!0),k("processing");try{const g=await a.deleteUser({userId:i});g.success?(n(g.message||"Account deleted successfully"),k("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(g.message||"Failed to delete account"),k("warning"))}catch(g){s(g.response?.data?.message||"Something went wrong"),k("warning")}finally{c(!1)}},h=f.toLowerCase()==="delete my account",R=g=>{g.target===g.currentTarget&&y!=="processing"&&y!=="success"&&e()},T=()=>{switch(y){case"warning":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(Me,{size:20})}),r.jsx("div",{children:r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),r.jsx("button",{onClick:e,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:o.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.color=o.textPrimary},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color=o.textTertiary},children:r.jsx(Re,{size:20})})]}),r.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${o.error}15`,border:`1px solid ${o.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[r.jsx("div",{style:{color:o.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:r.jsx(tr,{size:24})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h4",{style:{color:o.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:r.jsx(Dn,{size:16}),text:"All your data will be permanently deleted"},{icon:r.jsx(Kn,{size:16}),text:"This action cannot be reversed"},{icon:r.jsx(it,{size:16}),text:"You will lose access to all services"}].map((g,A)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:o.textSecondary},children:[r.jsx("div",{style:{color:o.error,flexShrink:0},children:g.icon}),r.jsx("span",{children:g.text})]},A))})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:C?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:e,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),r.jsxs("button",{onClick:()=>k("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[r.jsx(Me,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(tr,{size:24})}),r.jsx("div",{style:{flex:1},children:r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),r.jsxs("div",{style:{marginBottom:"24px"},children:[r.jsxs("p",{style:{color:o.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",r.jsx("strong",{style:{color:o.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),r.jsx("input",{type:"text",value:f,onChange:g=>x(g.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${h?o.success:o.error}`,backgroundColor:"transparent",color:o.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:g=>{g.target.style.boxShadow=`0 0 0 3px ${o.accent}20`},onBlur:g=>{g.target.style.boxShadow="none"},autoFocus:!0}),h&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:o.success,fontSize:"14px",fontWeight:500},children:[r.jsx(tt,{size:16}),r.jsx("span",{children:"Confirmation accepted"})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:()=>{k("warning"),x("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:C?"none":1,minWidth:C?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),r.jsxs("button",{onClick:w,disabled:!h||d,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!h||d?"not-allowed":"pointer",flex:C?"none":1,minWidth:C?"100%":"140px",opacity:!h||d?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!h||d?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{h&&!d&&(g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:g=>{h&&!d&&(g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[r.jsx(Me,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(se,{size:20,style:{animation:"spin 1s linear infinite"}})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),r.jsx("p",{style:{color:o.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),r.jsx("div",{style:{marginBottom:"20px"},children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((g,A)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:g.active?`${o.accent}10`:"transparent"},children:[r.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:g.active?o.accent:o.textTertiary,transition:"all 0.3s ease",boxShadow:g.active?`0 0 0 4px ${o.accent}20`:"none"}}),r.jsx("span",{style:{fontSize:"14px",color:g.active?o.textPrimary:o.textSecondary,fontWeight:g.active?500:400},children:g.text})]},A))})}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary},children:[r.jsx(er,{size:18,style:{color:o.accent,flexShrink:0}}),r.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:r.jsx(tt,{size:20})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),r.jsx("p",{style:{color:o.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),r.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${o.success}10`,border:`1px solid ${o.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[r.jsx(tt,{size:48,style:{color:o.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),r.jsx("p",{style:{color:o.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),r.jsx("p",{style:{color:o.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary,justifyContent:"center"},children:[r.jsx(se,{size:16,style:{animation:"spin 1s linear infinite",color:o.accent}}),r.jsx("span",{children:"Redirecting to login page..."})]})]})}};return r.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:R,children:[r.jsx("div",{style:{backgroundColor:o.surface,border:`1px solid ${o.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:T()}),r.jsx("style",{children:`
|
|
213
213
|
@keyframes fadeIn {
|
|
214
214
|
from { opacity: 0; }
|
|
215
215
|
to { opacity: 1; }
|
|
@@ -496,7 +496,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
496
496
|
animation: none;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
`})]})},ss=({darkMode:t=!0,homeUrl:e,onLogout:n,onVerify:s,primaryColor:i="#00C212"})=>{const o=me(),[a,d]=S.useState(null),[c,f]=S.useState(),[x,y]=S.useState(!0),[k,C]=S.useState(!1),[u,w]=S.useState(!1),[h,R]=S.useState(!1),[T,g]=S.useState(!1),[A,D]=S.useState(!1),[b,j]=S.useState(!1),[q,O]=S.useState(!1),[X,W]=S.useState(!1),[I,G]=S.useState(null),[P,_]=S.useState(!1),[M,K]=S.useState({email:"",otp:""}),[H,F]=S.useState(!1),[J,l]=S.useState(!1);S.useEffect(()=>{if(typeof window<"u"){const v=()=>d(window.innerWidth);return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)}},[]);const m=(v,$)=>{G({type:v,message:$}),setTimeout(()=>G(null),3e3)},E=()=>{W(!0);const v=setTimeout(()=>{O(!1),W(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=$=>{const V=document.querySelector(".dropdown-container");V&&!V.contains($.target)&&E()};return q&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[q]);const N=async()=>{if(!M.email||!/\S+@\S+\.\S+/.test(M.email)){m("error","Please enter a valid email");return}if(!c?.id){m("error","User not found. Cannot send OTP.");return}try{l(!0);const v=await o.requestEmailVerificationOTP({userId:c.id,email:M.email}),$=v?.data?.success??v?.success,V=v?.data?.message??v?.message;$?(m("success",V||"OTP sent to email!"),F(!0)):m("error",V||"Failed to send OTP")}catch(v){const $=v?.response?.data?.message||v?.message||"Server error";m("error",$)}finally{l(!1)}},ne=async v=>{if(v.preventDefault(),!M.email||!M.otp){m("error","Please fill in all fields");return}if(!c){m("error","User not found");return}try{l(!0);const $=await o.verifyEmail({email:M.email,otp:M.otp}),V=$?.data?.success??$?.success,Q=$?.data?.message??$?.message;if(V){m("success",Q||"Email verified!");const ue={...c,isVerified:!0};f(ue),typeof s=="function"&&s(ue),K({email:ue.email,otp:""}),F(!1),j?.(!1)}else m("error",Q||"Verification failed")}catch($){const V=$?.response?.data?.message||$?.message||"Something went wrong";m("error",V)}finally{l(!1)}},le=async v=>{if(!c)return!1;try{const $=await o.updateUser({userId:c.id,avatarUrl:v});if($?.success){const V={...c,...$.user,avatarUrl:v};return f(V),m("success","Avatar updated successfully!"),!0}return m("error",$?.message||"Failed to update avatar"),!1}catch($){return console.error("Avatar update error:",$),m("error","Failed to update avatar"),!1}},B=async()=>{if(c){w(!0);try{const v=c.email,$=await o.updateUser({userId:c.id,...c});if($.success&&$.user){const V=$.user.email!==v,Q={...c,...$.user,isVerified:V?!1:c.isVerified};f(Q),localStorage.setItem("userInfo",JSON.stringify(Q)),m("success",V?"Email updated. Please verify your new email.":"Profile updated successfully"),C(!1)}else m("error",$.message||"Update failed")}catch(v){console.error(v),m("error","Update failed")}finally{w(!1)}}},de=async v=>{try{const $=await o.checkIfUserExists(v);$?.success===!0&&$?.exists===!1&&(console.warn("❌ User does not exist on server. Clearing session..."),localStorage.removeItem("userInfo"),f(null))}catch($){console.error("⚠️ User validation request failed:",$)}};S.useEffect(()=>{(async()=>{try{y(!0);const $=await o.checkUserSession();if($.user?.id){const V=$.user.id,Q=await o.getUserProfile({userId:V});if(Q.user){const ue=Q.user;f(ue),de(V)}else f(null),localStorage.removeItem("userInfo")}else f(null),localStorage.removeItem("userInfo")}catch($){console.error("User init failed:",$),f(null),localStorage.removeItem("userInfo")}finally{y(!1)}})()},[]),S.useEffect(()=>{c?.email&&K(v=>({...v,email:c.email}))},[c?.email]);const je=(v,$)=>{let V=parseInt(v.replace("#",""),16),Q=(V>>16)+$,ue=(V>>8&255)+$,at=(V&255)+$;return Q=Math.min(255,Math.max(0,Q)),ue=Math.min(255,Math.max(0,ue)),at=Math.min(255,Math.max(0,at)),`#${(at|ue<<8|Q<<16).toString(16).padStart(6,"0")}`},z=t?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:je(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:je(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(x)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[r.jsx(se,{size:40,color:z.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),r.jsx("p",{style:{color:z.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[r.jsx(oe,{size:40,color:z.error,"aria-hidden":"true"}),r.jsx("p",{style:{color:z.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const as=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:c.email,name:"email",type:"email",icon:pe},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:Hn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Wn}];return r.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[I&&r.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...I.type==="success"?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:t?"#34d399":"#059669"}:{backgroundColor:t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:t?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:t?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[I.type==="success"?r.jsx(ce,{size:20,"aria-hidden":"true"}):r.jsx(oe,{size:20,"aria-hidden":"true"}),I.message]}),r.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:r.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...a&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...a&&window.innerWidth>=768&&a&&window.innerWidth<1024&&{gap:"10px"},...a&&window.innerWidth>=600&&a&&window.innerWidth<768&&{gap:"28px"}},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[e&&r.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:r.jsx(Ln,{size:20,style:{color:t?"#ffffff":"#000000"}})}),r.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[r.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${z.border}`},width:128,height:128,loading:"eager"}),r.jsx("button",{onClick:()=>R(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:z.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:r.jsx(et,{size:16,"aria-hidden":"true"})})]}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:z.textPrimary},children:c.name}),r.jsx("p",{style:{color:z.textTertiary,margin:"0 0 8px 0"},children:c.email}),r.jsxs("div",{style:{backgroundColor:c.isVerified?t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?z.success:z.warning,border:`1px solid ${c.isVerified?t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?r.jsx(ce,{size:16,"aria-hidden":"true"}):r.jsx(oe,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),r.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>C(!1),style:{backgroundColor:z.surfaceLight,border:`1px solid ${z.border}`,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Re,{size:16,"aria-hidden":"true"}),"Cancel"]}),r.jsxs("button",{onClick:B,disabled:u,style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,opacity:u?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:u?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[u?r.jsx(se,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(Vn,{size:16,"aria-hidden":"true"}),u?"Saving...":"Save Changes"]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>C(!0),style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Bn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&r.jsxs("button",{onClick:()=>j(!0),disabled:P,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:P?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:P?.7:1,flex:a&&window.innerWidth<1024?"1":"auto"},children:[P?r.jsx(se,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(ot,{size:14,"aria-hidden":"true"}),P?"Sending...":"Verify Email"]}),r.jsxs("div",{style:{position:"relative"},children:[r.jsxs("button",{style:{backgroundColor:z.surfaceLight,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>O(!q),children:[r.jsx(Fn,{size:16,"aria-hidden":"true"}),"More Actions"]}),q&&r.jsxs("div",{className:`dropdown-container ${X?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:z.surface,border:`1px solid ${z.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${X?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[r.jsxs("button",{onClick:()=>{g(!0),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:z.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=z.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(st,{size:14,"aria-hidden":"true"}),"Change Password"]}),n&&r.jsxs("button",{onClick:()=>{n(),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:t?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(it,{size:14,"aria-hidden":"true"}),"Logout"]}),r.jsxs("button",{onClick:()=>{D(!0),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(Me,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),r.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),r.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...a&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:as.map(v=>{const $=v.icon;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[r.jsxs("label",{style:{color:z.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx($,{size:16,"aria-hidden":"true"}),v.label]}),k?r.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:V=>f(Q=>Q&&{...Q,[V.target.name]:V.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:z.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):r.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:z.textPrimary,backgroundColor:t?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(er,{size:20,"aria-hidden":"true"}),"Security Status"]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:z.textSecondary},children:[r.jsx(pe,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:"Email Verification"})]}),r.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:z.success,border:`1px solid ${t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:z.warning,border:`1px solid ${t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?r.jsxs(r.Fragment,{children:[r.jsx(ce,{size:16,"aria-hidden":"true"}),"Verified"]}):r.jsxs(r.Fragment,{children:[r.jsx(oe,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&r.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:t?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:r.jsx("p",{style:{color:z.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),r.jsx(ts,{isOpen:h,onClose:()=>{R(!1)},onUpdate:le,colors:z}),r.jsx(rs,{userId:c.id,isOpen:T,onClose:()=>g(!1),onSuccess:v=>m("success",v),onError:v=>m("error",v),colors:z}),r.jsx(es,{userId:c.id,isOpen:A,onClose:()=>D(!1),onSuccess:v=>m("success",v),onError:v=>m("error",v),colors:z}),r.jsx(ns,{isOpen:b,onClose:()=>{j(!1),F(!1),K({email:c?.email||"",otp:""})},onVerify:ne,onSendOTP:N,verifyFormData:M,setVerifyFormData:K,otpSent:H,verifying:J,user:c,colors:z,darkMode:t}),r.jsx("style",{children:`
|
|
499
|
+
`})]})},ss=({darkMode:t=!0,homeUrl:e,onLogout:n,onVerify:s,primaryColor:i="#00C212"})=>{const o=me(),[a,d]=S.useState(null),[c,f]=S.useState(),[x,y]=S.useState(!0),[k,C]=S.useState(!1),[u,w]=S.useState(!1),[h,R]=S.useState(!1),[T,g]=S.useState(!1),[A,D]=S.useState(!1),[b,j]=S.useState(!1),[q,O]=S.useState(!1),[X,W]=S.useState(!1),[I,G]=S.useState(null),[P,_]=S.useState(!1),[M,J]=S.useState({email:"",otp:""}),[H,F]=S.useState(!1),[K,l]=S.useState(!1);S.useEffect(()=>{if(typeof window<"u"){const v=()=>d(window.innerWidth);return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)}},[]);const m=(v,$)=>{G({type:v,message:$}),setTimeout(()=>G(null),3e3)},E=()=>{W(!0);const v=setTimeout(()=>{O(!1),W(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=$=>{const V=document.querySelector(".dropdown-container");V&&!V.contains($.target)&&E()};return q&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[q]);const N=async()=>{if(!M.email||!/\S+@\S+\.\S+/.test(M.email)){m("error","Please enter a valid email");return}if(!c?.id){m("error","User not found. Cannot send OTP.");return}try{l(!0);const v=await o.requestEmailVerificationOTP({userId:c.id,email:M.email}),$=v?.data?.success??v?.success,V=v?.data?.message??v?.message;$?(m("success",V||"OTP sent to email!"),F(!0)):m("error",V||"Failed to send OTP")}catch(v){const $=v?.response?.data?.message||v?.message||"Server error";m("error",$)}finally{l(!1)}},ne=async v=>{if(v.preventDefault(),!M.email||!M.otp){m("error","Please fill in all fields");return}if(!c){m("error","User not found");return}try{l(!0);const $=await o.verifyEmail({email:M.email,otp:M.otp}),V=$?.data?.success??$?.success,Q=$?.data?.message??$?.message;if(V){m("success",Q||"Email verified!");const ue={...c,isVerified:!0};f(ue),typeof s=="function"&&s(ue),J({email:ue.email,otp:""}),F(!1),j?.(!1)}else m("error",Q||"Verification failed")}catch($){const V=$?.response?.data?.message||$?.message||"Something went wrong";m("error",V)}finally{l(!1)}},le=async v=>{if(!c)return!1;try{const $=await o.updateUser({userId:c.id,avatarUrl:v});if($?.success){const V={...c,...$.user,avatarUrl:v};return f(V),m("success","Avatar updated successfully!"),!0}return m("error",$?.message||"Failed to update avatar"),!1}catch($){return console.error("Avatar update error:",$),m("error","Failed to update avatar"),!1}},B=async()=>{if(c){w(!0);try{const v=c.email,$=await o.updateUser({userId:c.id,...c});if($.success&&$.user){const V=$.user.email!==v,Q={...c,...$.user,isVerified:V?!1:c.isVerified};f(Q),localStorage.setItem("userInfo",JSON.stringify(Q)),m("success",V?"Email updated. Please verify your new email.":"Profile updated successfully"),C(!1)}else m("error",$.message||"Update failed")}catch(v){console.error(v),m("error","Update failed")}finally{w(!1)}}},de=async v=>{try{const $=await o.checkIfUserExists(v);$?.success===!0&&$?.exists===!1&&(console.warn("❌ User does not exist on server. Clearing session..."),localStorage.removeItem("userInfo"),f(null))}catch($){console.error("⚠️ User validation request failed:",$)}};S.useEffect(()=>{(async()=>{try{y(!0);const $=await o.checkUserSession();if($.user?.id){const V=$.user.id,Q=await o.getUserProfile({userId:V});if(Q.user){const ue=Q.user;f(ue),de(V)}else f(null),localStorage.removeItem("userInfo")}else f(null),localStorage.removeItem("userInfo")}catch($){console.error("User init failed:",$),f(null),localStorage.removeItem("userInfo")}finally{y(!1)}})()},[]),S.useEffect(()=>{c?.email&&J(v=>({...v,email:c.email}))},[c?.email]);const je=(v,$)=>{let V=parseInt(v.replace("#",""),16),Q=(V>>16)+$,ue=(V>>8&255)+$,at=(V&255)+$;return Q=Math.min(255,Math.max(0,Q)),ue=Math.min(255,Math.max(0,ue)),at=Math.min(255,Math.max(0,at)),`#${(at|ue<<8|Q<<16).toString(16).padStart(6,"0")}`},z=t?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:je(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:je(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(x)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[r.jsx(se,{size:40,color:z.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),r.jsx("p",{style:{color:z.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[r.jsx(oe,{size:40,color:z.error,"aria-hidden":"true"}),r.jsx("p",{style:{color:z.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const as=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:c.email,name:"email",type:"email",icon:pe},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:Hn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Wn}];return r.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[I&&r.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...I.type==="success"?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:t?"#34d399":"#059669"}:{backgroundColor:t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:t?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:t?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[I.type==="success"?r.jsx(ce,{size:20,"aria-hidden":"true"}):r.jsx(oe,{size:20,"aria-hidden":"true"}),I.message]}),r.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:r.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...a&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...a&&window.innerWidth>=768&&a&&window.innerWidth<1024&&{gap:"10px"},...a&&window.innerWidth>=600&&a&&window.innerWidth<768&&{gap:"28px"}},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[e&&r.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:r.jsx(Ln,{size:20,style:{color:t?"#ffffff":"#000000"}})}),r.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[r.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${z.border}`},width:128,height:128,loading:"eager"}),r.jsx("button",{onClick:()=>R(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:z.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:r.jsx(et,{size:16,"aria-hidden":"true"})})]}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:z.textPrimary},children:c.name}),r.jsx("p",{style:{color:z.textTertiary,margin:"0 0 8px 0"},children:c.email}),r.jsxs("div",{style:{backgroundColor:c.isVerified?t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?z.success:z.warning,border:`1px solid ${c.isVerified?t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?r.jsx(ce,{size:16,"aria-hidden":"true"}):r.jsx(oe,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),r.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>C(!1),style:{backgroundColor:z.surfaceLight,border:`1px solid ${z.border}`,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Re,{size:16,"aria-hidden":"true"}),"Cancel"]}),r.jsxs("button",{onClick:B,disabled:u,style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,opacity:u?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:u?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[u?r.jsx(se,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(Vn,{size:16,"aria-hidden":"true"}),u?"Saving...":"Save Changes"]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>C(!0),style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:a&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Bn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&r.jsxs("button",{onClick:()=>j(!0),disabled:P,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:P?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:P?.7:1,flex:a&&window.innerWidth<1024?"1":"auto"},children:[P?r.jsx(se,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(ot,{size:14,"aria-hidden":"true"}),P?"Sending...":"Verify Email"]}),r.jsxs("div",{style:{position:"relative"},children:[r.jsxs("button",{style:{backgroundColor:z.surfaceLight,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>O(!q),children:[r.jsx(Fn,{size:16,"aria-hidden":"true"}),"More Actions"]}),q&&r.jsxs("div",{className:`dropdown-container ${X?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:z.surface,border:`1px solid ${z.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${X?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[r.jsxs("button",{onClick:()=>{g(!0),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:z.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=z.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(st,{size:14,"aria-hidden":"true"}),"Change Password"]}),n&&r.jsxs("button",{onClick:()=>{n(),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:t?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(it,{size:14,"aria-hidden":"true"}),"Logout"]}),r.jsxs("button",{onClick:()=>{D(!0),E()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[r.jsx(Me,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),r.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),r.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...a&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:as.map(v=>{const $=v.icon;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[r.jsxs("label",{style:{color:z.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx($,{size:16,"aria-hidden":"true"}),v.label]}),k?r.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:V=>f(Q=>Q&&{...Q,[V.target.name]:V.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:z.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):r.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:z.textPrimary,backgroundColor:t?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),r.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(er,{size:20,"aria-hidden":"true"}),"Security Status"]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:z.textSecondary},children:[r.jsx(pe,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:"Email Verification"})]}),r.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:z.success,border:`1px solid ${t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:z.warning,border:`1px solid ${t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?r.jsxs(r.Fragment,{children:[r.jsx(ce,{size:16,"aria-hidden":"true"}),"Verified"]}):r.jsxs(r.Fragment,{children:[r.jsx(oe,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&r.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:t?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:r.jsx("p",{style:{color:z.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),r.jsx(ts,{isOpen:h,onClose:()=>{R(!1)},onUpdate:le,colors:z}),r.jsx(rs,{userId:c.id,isOpen:T,onClose:()=>g(!1),onSuccess:v=>m("success",v),onError:v=>m("error",v),colors:z}),r.jsx(es,{userId:c.id,isOpen:A,onClose:()=>D(!1),onSuccess:v=>m("success",v),onError:v=>m("error",v),colors:z}),r.jsx(ns,{isOpen:b,onClose:()=>{j(!1),F(!1),J({email:c?.email||"",otp:""})},onVerify:ne,onSendOTP:N,verifyFormData:M,setVerifyFormData:J,otpSent:H,verifying:K,user:c,colors:z,darkMode:t}),r.jsx("style",{children:`
|
|
500
500
|
@keyframes slideIn {
|
|
501
501
|
from {
|
|
502
502
|
transform: translateX(100%);
|
|
@@ -584,8 +584,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
584
584
|
transition-duration: 0.01ms !important;
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
`})]})},is=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:n,varient:s="classic",propUser:i,className:o="",profileUrl:a,settingsUrl:d,showProfileMenuItem:c=!0,showSettingsMenuItem:f=!0,showViewProfileMenuItem:x=!0,profileLabel:y="My Profile",settingsLabel:k="Settings",viewProfileLabel:C="View Profile",logoutLabel:u="Sign Out"})=>{const w=me(),[h,R]=S.useState(!1),[T,g]=S.useState(null),[A,D]=S.useState(!0),[b,j]=S.useState(null),q=S.useRef(null),O=S.useRef(null),[X,W]=S.useState(!1),[I,G]=S.useState(!1);S.useEffect(()=>{if(typeof window>"u")return;const l=()=>{G(window.innerWidth<768)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),S.useEffect(()=>{let l=!0;return(async()=>{try{if(D(!0),j(null),i){if(!i.id||!i.name||!i.email)throw new Error("Invalid user data provided");l&&g(i);return}const E=await w.checkUserSession();if(!l)return;if(!E?.authenticated||!E.user){g(null);return}const N={id:E.user.id,email:E.user.email,name:E.user.email.split("@")[0]};g(N)}catch(E){console.error("User initialization failed:",E),l&&(g(null),j(E.message||"Failed to load user"))}finally{l&&D(!1)}})(),()=>{l=!1}},[i,w]),S.useEffect(()=>{if(typeof window>"u")return;const l=()=>{if(!h||!O.current)return;const m=O.current.getBoundingClientRect(),E=window.innerWidth,N=window.innerHeight,ne=280,le=E-m.right,B=m.left;N-m.bottom;const de=le>=ne||le>B;W(de)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[h]),S.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const l=N=>{q.current&&!q.current.contains(N.target)&&!O.current?.contains(N.target)&&R(!1)},m=N=>{N.key==="Escape"&&R(!1)},E=()=>{h&&R(!1)};return h&&(document.addEventListener("mousedown",l),document.addEventListener("keydown",m),window.addEventListener("scroll",E)),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",m),window.removeEventListener("scroll",E)}},[h]);const P=t?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:e,accentHover:`${e}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:e,accentHover:`${e}e6`,error:"#ef4444"},_={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:P.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:P.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:P.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:h?"rotate(180deg)":"rotate(0deg)",color:P.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[X?"left":"right"]:"0",backgroundColor:P.surfaceElevated,border:`1px solid ${P.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:h?1:0,pointerEvents:h?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:h?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:P.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:P.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:P.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:P.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:P.error,textAlign:"left",outline:"none"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:P.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:P.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"},loadingContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"16px"},loadingSkeleton:{display:"flex",alignItems:"center",gap:"10px",width:"100%"},skeletonAvatar:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"},skeletonTextBlock:{flex:1,display:"flex",flexDirection:"column",gap:"6px"},skeletonLineShort:{width:"40%",height:"10px",borderRadius:"6px",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"},skeletonLineLong:{width:"70%",height:"10px",borderRadius:"6px",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"}},M=async()=>{j(null),D(!0);try{if(i){if(!i.id||!i.name||!i.email)throw new Error("Invalid user data provided");g(i);return}const l=await w.checkUserSession();if(!l?.authenticated||!l.user){g(null),j("User is not authenticated");return}const m={id:l.user.id,email:l.user.email,name:l.user.email.split("@")[0]};g(m)}catch(l){console.error("Retry failed:",l),g(null),j(l.message||"Failed to reload user")}finally{D(!1)}},K=(l,m)=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),m())},H=()=>a||T?.profileUrl,F=()=>{const l=H();l&&window.open(l,"_self","noopener,noreferrer")},J=()=>{d&&window.open(d,"_self","noopener,noreferrer")};return r.jsxs("div",{style:_.wrapper,ref:q,className:o,role:"menu","aria-label":"User menu",children:[s==="classic"?r.jsx("div",{ref:O,onClick:()=>R(l=>!l),onKeyDown:l=>K(l,()=>R(m=>!m)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":h,"aria-label":"Toggle user menu",children:T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:I?"34px":"36px",height:I?"34px":"36px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},loading:"lazy",onError:l=>{const m=l.target;m.onerror=null,m.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):r.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},loading:"lazy"})}):r.jsxs("div",{ref:O,style:_.avatarButton,onClick:()=>R(l=>!l),onKeyDown:l=>K(l,()=>R(m=>!m)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":h,"aria-label":"Toggle user menu",onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover,l.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:l=>{l.currentTarget.style.backgroundColor=P.surface,l.currentTarget.style.boxShadow="none"},onBlur:l=>{l.currentTarget.style.outline="none"},children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:_.avatarImage,loading:"lazy",onError:l=>{const m=l.target;m.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):r.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:_.avatarImage,loading:"lazy"}),!I&&r.jsxs("div",{style:_.userInfo,children:[r.jsx("div",{style:_.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&r.jsx("div",{style:_.userEmail,title:T.email,children:T.email})]}),r.jsx(Nn,{size:I?14:16,style:_.chevron,"aria-hidden":"true"})]}),h&&r.jsx("div",{style:_.dropdown,role:"menu","aria-label":"User options",children:A?r.jsxs("div",{style:_.loadingContainer,role:"status","aria-live":"polite",children:[r.jsx(se,{size:18,className:"animate-spin",style:{color:P.textSecondary},"aria-hidden":"true"}),r.jsxs("div",{style:_.loadingSkeleton,children:[r.jsx("div",{style:_.skeletonAvatar}),r.jsxs("div",{style:_.skeletonTextBlock,children:[r.jsx("div",{style:_.skeletonLineShort}),r.jsx("div",{style:_.skeletonLineLong})]})]})]}):T?r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:_.userSection,children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:_.dropdownAvatar,loading:"lazy",onError:l=>{const m=l.target;m.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):r.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:_.dropdownAvatar,loading:"lazy"}),r.jsxs("div",{style:_.dropdownUserInfo,children:[r.jsx("div",{style:_.dropdownUserName,title:T.name,children:T.name}),r.jsx("div",{style:_.dropdownUserEmail,title:T.email,children:T.email})]})]}),r.jsxs("div",{style:_.dropdownSection,children:[c&&H()&&r.jsxs("button",{style:_.menuItem,onClick:F,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>K(l,F),role:"menuitem",tabIndex:0,children:[r.jsx(Se,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:y})]}),f&&d&&r.jsxs("button",{style:_.menuItem,onClick:J,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>K(l,J),role:"menuitem",tabIndex:0,children:[r.jsx(Yn,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:k})]}),x&&T.profileUrl&&r.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:_.menuItem,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[r.jsx(pe,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:C})]})]}),r.jsx("div",{style:_.dropdownSection,children:r.jsxs("button",{style:_.logoutButton,onClick:n,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>K(l,n),role:"menuitem",tabIndex:0,children:[r.jsx(it,{style:{..._.icon,color:P.error},"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:u})]})})]}):r.jsxs("div",{style:_.errorState,role:"alert",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(oe,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:b||"Not signed in"})]}),b&&b!=="Not signed in"&&r.jsx("button",{style:_.retryButton,onClick:M,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.accentHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor=P.accent},children:"Try Again"})]})}),r.jsx("style",{children:`@keyframes pulse {
|
|
587
|
+
`})]})},is=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:n,varient:s="classic",propUser:i,className:o="",profileUrl:a,settingsUrl:d,showProfileMenuItem:c=!0,showSettingsMenuItem:f=!0,showViewProfileMenuItem:x=!0,profileLabel:y="My Profile",settingsLabel:k="Settings",viewProfileLabel:C="View Profile",logoutLabel:u="Sign Out"})=>{const w=me(),[h,R]=S.useState(!1),[T,g]=S.useState(null),[A,D]=S.useState(!0),[b,j]=S.useState(null),q=S.useRef(null),O=S.useRef(null),[X,W]=S.useState(!1),[I,G]=S.useState(!1);S.useEffect(()=>{if(typeof window>"u")return;const l=()=>{G(window.innerWidth<768)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),S.useEffect(()=>{let l=!0;return(async()=>{try{if(D(!0),j(null),i){if(!i.id||!i.name||!i.email)throw new Error("Invalid user data provided");l&&g(i);return}const E=await w.checkUserSession();if(!l)return;if(!E?.authenticated||!E.user){g(null);return}const N={id:E.user.id,email:E.user.email,name:E.user.email.split("@")[0]};g(N)}catch(E){console.error("User initialization failed:",E),l&&(g(null),j(E.message||"Failed to load user"))}finally{l&&D(!1)}})(),()=>{l=!1}},[i,w]),S.useEffect(()=>{if(typeof window>"u")return;const l=()=>{if(!h||!O.current)return;const m=O.current.getBoundingClientRect(),E=window.innerWidth,N=window.innerHeight,ne=280,le=E-m.right,B=m.left;N-m.bottom;const de=le>=ne||le>B;W(de)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[h]),S.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const l=N=>{q.current&&!q.current.contains(N.target)&&!O.current?.contains(N.target)&&R(!1)},m=N=>{N.key==="Escape"&&R(!1)},E=()=>{h&&R(!1)};return h&&(document.addEventListener("mousedown",l),document.addEventListener("keydown",m),window.addEventListener("scroll",E)),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",m),window.removeEventListener("scroll",E)}},[h]);const P=t?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:e,accentHover:`${e}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:e,accentHover:`${e}e6`,error:"#ef4444"},_={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:P.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:P.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:P.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:h?"rotate(180deg)":"rotate(0deg)",color:P.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[X?"left":"right"]:"0",backgroundColor:P.surfaceElevated,border:`1px solid ${P.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:h?1:0,pointerEvents:h?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:h?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:P.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:P.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:P.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:P.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:P.error,textAlign:"left",outline:"none"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:P.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:P.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"},loadingContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"16px"},loadingSkeleton:{display:"flex",alignItems:"center",gap:"10px",width:"100%"},skeletonAvatar:{width:"36px",height:"36px",borderRadius:"50%",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"},skeletonTextBlock:{flex:1,display:"flex",flexDirection:"column",gap:"6px"},skeletonLineShort:{width:"40%",height:"10px",borderRadius:"6px",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"},skeletonLineLong:{width:"70%",height:"10px",borderRadius:"6px",backgroundColor:"#e5e7eb",animation:"pulse 1.5s infinite ease-in-out"}},M=async()=>{j(null),D(!0);try{if(i){if(!i.id||!i.name||!i.email)throw new Error("Invalid user data provided");g(i);return}const l=await w.checkUserSession();if(!l?.authenticated||!l.user){g(null),j("User is not authenticated");return}const m={id:l.user.id,email:l.user.email,name:l.user.email.split("@")[0]};g(m)}catch(l){console.error("Retry failed:",l),g(null),j(l.message||"Failed to reload user")}finally{D(!1)}},J=(l,m)=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),m())},H=()=>a||T?.profileUrl,F=()=>{const l=H();l&&window.open(l,"_self","noopener,noreferrer")},K=()=>{d&&window.open(d,"_self","noopener,noreferrer")};return r.jsxs("div",{style:_.wrapper,ref:q,className:o,role:"menu","aria-label":"User menu",children:[s==="classic"?r.jsx("div",{ref:O,onClick:()=>R(l=>!l),onKeyDown:l=>J(l,()=>R(m=>!m)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":h,"aria-label":"Toggle user menu",children:T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:I?"34px":"36px",height:I?"34px":"36px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},loading:"lazy",onError:l=>{const m=l.target;m.onerror=null,m.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):r.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${P.borderLight}`,flexShrink:0},loading:"lazy"})}):r.jsxs("div",{ref:O,style:_.avatarButton,onClick:()=>R(l=>!l),onKeyDown:l=>J(l,()=>R(m=>!m)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":h,"aria-label":"Toggle user menu",onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover,l.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:l=>{l.currentTarget.style.backgroundColor=P.surface,l.currentTarget.style.boxShadow="none"},onBlur:l=>{l.currentTarget.style.outline="none"},children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:_.avatarImage,loading:"lazy",onError:l=>{const m=l.target;m.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):r.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:_.avatarImage,loading:"lazy"}),!I&&r.jsxs("div",{style:_.userInfo,children:[r.jsx("div",{style:_.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&r.jsx("div",{style:_.userEmail,title:T.email,children:T.email})]}),r.jsx(Nn,{size:I?14:16,style:_.chevron,"aria-hidden":"true"})]}),h&&r.jsx("div",{style:_.dropdown,role:"menu","aria-label":"User options",children:A?r.jsxs("div",{style:_.loadingContainer,role:"status","aria-live":"polite",children:[r.jsx(se,{size:18,className:"animate-spin",style:{color:P.textSecondary},"aria-hidden":"true"}),r.jsxs("div",{style:_.loadingSkeleton,children:[r.jsx("div",{style:_.skeletonAvatar}),r.jsxs("div",{style:_.skeletonTextBlock,children:[r.jsx("div",{style:_.skeletonLineShort}),r.jsx("div",{style:_.skeletonLineLong})]})]})]}):T?r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:_.userSection,children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:_.dropdownAvatar,loading:"lazy",onError:l=>{const m=l.target;m.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):r.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:_.dropdownAvatar,loading:"lazy"}),r.jsxs("div",{style:_.dropdownUserInfo,children:[r.jsx("div",{style:_.dropdownUserName,title:T.name,children:T.name}),r.jsx("div",{style:_.dropdownUserEmail,title:T.email,children:T.email})]})]}),r.jsxs("div",{style:_.dropdownSection,children:[c&&H()&&r.jsxs("button",{style:_.menuItem,onClick:F,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>J(l,F),role:"menuitem",tabIndex:0,children:[r.jsx(Se,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:y})]}),f&&d&&r.jsxs("button",{style:_.menuItem,onClick:K,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>J(l,K),role:"menuitem",tabIndex:0,children:[r.jsx(Yn,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:k})]}),x&&T.profileUrl&&r.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:_.menuItem,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[r.jsx(pe,{style:_.icon,"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:C})]})]}),r.jsx("div",{style:_.dropdownSection,children:r.jsxs("button",{style:_.logoutButton,onClick:n,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.surfaceHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent"},onKeyDown:l=>J(l,n),role:"menuitem",tabIndex:0,children:[r.jsx(it,{style:{..._.icon,color:P.error},"aria-hidden":"true"}),r.jsx("span",{style:_.menuItemText,children:u})]})})]}):r.jsxs("div",{style:_.errorState,role:"alert",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(oe,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:b||"Not signed in"})]}),b&&b!=="Not signed in"&&r.jsx("button",{style:_.retryButton,onClick:M,onMouseOver:l=>{l.currentTarget.style.backgroundColor=P.accentHover},onMouseOut:l=>{l.currentTarget.style.backgroundColor=P.accent},children:"Try Again"})]})}),r.jsx("style",{children:`@keyframes pulse {
|
|
588
588
|
0% { opacity: 1; }
|
|
589
589
|
50% { opacity: 0.5; }
|
|
590
590
|
100% { opacity: 1; }
|
|
591
|
-
}`})]})},os=({user:t,darkMode:e=!0,primaryColor:n="#00C212",onVerify:s})=>{const i=me();if(!t)return r.jsxs("div",{style:{width:"100%",maxWidth:400,padding:24,borderRadius:12,backgroundColor:e?"#000000":"#f4f4f5",color:e?"#fff":"#18181b",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:5},children:[r.jsx(oe,{size:24,style:{marginBottom:8}}),r.jsx("p",{style:{margin:0},children:"User data is required to verify email."})]});const[o,a]=S.useState(!1),[d,c]=S.useState({email:t?.email||"",otp:""}),[f,x]=S.useState(!1),[y,k]=S.useState(!1),[C,u]=S.useState(null);S.useEffect(()=>{if(typeof window<"u"){const b=()=>a(window.innerWidth<768);return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)}},[]);const w=(b,j)=>{let q=parseInt(b.replace("#",""),16),O=(q>>16)+j,X=(q>>8&255)+j,W=(q&255)+j;return O=Math.min(255,Math.max(0,O)),X=Math.min(255,Math.max(0,X)),W=Math.min(255,Math.max(0,W)),`#${(W|X<<8|O<<16).toString(16).padStart(6,"0")}`},h=e?{surface:"#000000",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",border:"#27272a",accent:n,accentHover:w(n,-15),success:w(n,0),warning:"#f59e0b"}:{surface:"#fafafa",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",border:"#e4e4e7",accent:n,accentHover:w(n,-15),success:w(n,0),warning:"#d97706"};S.useEffect(()=>{t?.email&&c(b=>({...b,email:t.email}))},[t?.email]);const R=(b,j)=>{u({type:b,message:j}),setTimeout(()=>u(null),3e3)},T=async()=>{if(!d.email||!/\S+@\S+\.\S+/.test(d.email)){R("error","Please enter a valid email");return}if(!t?.id){R("error","User ID missing");return}try{k(!0);const b=await i.requestEmailVerificationOTP({userId:t.id,email:d.email});if(console.log("Send OTP response:",b),b.success||b.data?.success){const j=b.message||b.data?.message||"OTP sent!";R("success",j),x(!0)}else{const j=b.message||b.data?.message||"Failed to send OTP";R("error",j)}}catch(b){console.error("Send OTP error:",b),R("error",b.message||"Server error")}finally{k(!1)}},g=async b=>{if(b.preventDefault(),!d.email||!d.otp){R("error","Please fill in all fields");return}try{k(!0);const j=await i.verifyEmail({email:d.email,otp:d.otp});if(j.success){const q={...t,isVerified:!0};s?.(q),R("success",j.message||"Email verified!"),x(!1),c({email:t.email,otp:""})}else R("error",j.message||"Verification failed")}catch(j){R("error",j.message||"Server error")}finally{k(!1)}},A={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${h.border}`,backgroundColor:e?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",color:h.textPrimary,fontSize:14,outline:"none"},D=(b=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:b?"not-allowed":"pointer",background:`linear-gradient(to right, ${h.accent}, ${h.accentHover})`,opacity:b?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return r.jsxs("form",{onSubmit:g,style:{width:"100%",maxWidth:o?"340px":"400px",display:"flex",flexDirection:"column",gap:20,backgroundColor:h.surface,padding:24,borderRadius:10,border:`1px solid ${h.border}`,boxShadow:e?"0 6px 24px rgba(0,0,0,0.4)":"0 6px 24px rgba(0,0,0,0.08)"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[r.jsx(Un,{size:32,color:h.accent}),r.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600,color:h.textPrimary},children:"Verify Your Email"}),r.jsx("p",{style:{margin:0,fontSize:13,color:h.textSecondary,textAlign:"center"},children:"Enter your email and OTP to confirm your account"})]}),C&&r.jsxs("div",{style:{padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:500,color:C.type==="success"?h.success:h.warning,border:`1px solid ${C.type==="success"?h.success:h.warning}`,backgroundColor:C.type==="success"?`${h.success}20`:`${h.warning}20`,display:"flex",alignItems:"center",gap:8},children:[C.type==="success"?r.jsx(ce,{size:16}):r.jsx(oe,{size:16}),C.message]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[r.jsx(pe,{size:18,style:{position:"absolute",left:12,color:h.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"email",value:d.email,onChange:b=>c(j=>({...j,email:b.target.value})),placeholder:"Enter your email",style:{...A,paddingLeft:40,height:40,borderRadius:8,boxShadow:e?"0 2px 6px rgba(0,0,0,0.3)":"0 2px 6px rgba(0,0,0,0.08)"},required:!0})]}),r.jsx("small",{style:{fontSize:11,color:h.textTertiary,marginTop:2},children:"We'll send a verification code to this email"})]}),f&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[r.jsx(st,{size:18,style:{position:"absolute",left:12,color:h.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"text",value:d.otp,onChange:b=>c(j=>({...j,otp:b.target.value})),placeholder:"Enter OTP",style:{...A,paddingLeft:40,height:40,borderRadius:8,boxShadow:e?"0 2px 6px rgba(0,0,0,0.3)":"0 2px 6px rgba(0,0,0,0.08)"},required:!0})]}),r.jsx("small",{style:{fontSize:11,color:h.textTertiary,marginTop:2},children:"Check your inbox for the 6-digit code"})]}),r.jsx("div",{style:{display:"flex",gap:12},children:f?r.jsxs("button",{type:"submit",disabled:y,style:{...D(y),borderRadius:12,padding:"12px 16px",fontSize:14},children:[y?r.jsx(se,{size:16,className:"spinner"}):r.jsx(ce,{size:16}),y?"Verifying...":"Verify Email"]}):r.jsxs("button",{type:"button",onClick:T,disabled:y||!t?.id,style:{...D(y),borderRadius:12,padding:"12px 16px",fontSize:14},children:[y?r.jsx(se,{size:16,className:"spinner"}):r.jsx(ot,{size:16}),y?"Sending...":"Send OTP"]})})]})};ee.AuthixProvider=
|
|
591
|
+
}`})]})},os=({user:t,darkMode:e=!0,primaryColor:n="#00C212",onVerify:s})=>{const i=me();if(!t)return r.jsxs("div",{style:{width:"100%",maxWidth:400,padding:24,borderRadius:12,backgroundColor:e?"#000000":"#f4f4f5",color:e?"#fff":"#18181b",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:5},children:[r.jsx(oe,{size:24,style:{marginBottom:8}}),r.jsx("p",{style:{margin:0},children:"User data is required to verify email."})]});const[o,a]=S.useState(!1),[d,c]=S.useState({email:t?.email||"",otp:""}),[f,x]=S.useState(!1),[y,k]=S.useState(!1),[C,u]=S.useState(null);S.useEffect(()=>{if(typeof window<"u"){const b=()=>a(window.innerWidth<768);return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)}},[]);const w=(b,j)=>{let q=parseInt(b.replace("#",""),16),O=(q>>16)+j,X=(q>>8&255)+j,W=(q&255)+j;return O=Math.min(255,Math.max(0,O)),X=Math.min(255,Math.max(0,X)),W=Math.min(255,Math.max(0,W)),`#${(W|X<<8|O<<16).toString(16).padStart(6,"0")}`},h=e?{surface:"#000000",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",border:"#27272a",accent:n,accentHover:w(n,-15),success:w(n,0),warning:"#f59e0b"}:{surface:"#fafafa",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",border:"#e4e4e7",accent:n,accentHover:w(n,-15),success:w(n,0),warning:"#d97706"};S.useEffect(()=>{t?.email&&c(b=>({...b,email:t.email}))},[t?.email]);const R=(b,j)=>{u({type:b,message:j}),setTimeout(()=>u(null),3e3)},T=async()=>{if(!d.email||!/\S+@\S+\.\S+/.test(d.email)){R("error","Please enter a valid email");return}if(!t?.id){R("error","User ID missing");return}try{k(!0);const b=await i.requestEmailVerificationOTP({userId:t.id,email:d.email});if(console.log("Send OTP response:",b),b.success||b.data?.success){const j=b.message||b.data?.message||"OTP sent!";R("success",j),x(!0)}else{const j=b.message||b.data?.message||"Failed to send OTP";R("error",j)}}catch(b){console.error("Send OTP error:",b),R("error",b.message||"Server error")}finally{k(!1)}},g=async b=>{if(b.preventDefault(),!d.email||!d.otp){R("error","Please fill in all fields");return}try{k(!0);const j=await i.verifyEmail({email:d.email,otp:d.otp});if(j.success){const q={...t,isVerified:!0};s?.(q),R("success",j.message||"Email verified!"),x(!1),c({email:t.email,otp:""})}else R("error",j.message||"Verification failed")}catch(j){R("error",j.message||"Server error")}finally{k(!1)}},A={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${h.border}`,backgroundColor:e?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",color:h.textPrimary,fontSize:14,outline:"none"},D=(b=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:b?"not-allowed":"pointer",background:`linear-gradient(to right, ${h.accent}, ${h.accentHover})`,opacity:b?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return r.jsxs("form",{onSubmit:g,style:{width:"100%",maxWidth:o?"340px":"400px",display:"flex",flexDirection:"column",gap:20,backgroundColor:h.surface,padding:24,borderRadius:10,border:`1px solid ${h.border}`,boxShadow:e?"0 6px 24px rgba(0,0,0,0.4)":"0 6px 24px rgba(0,0,0,0.08)"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[r.jsx(Un,{size:32,color:h.accent}),r.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600,color:h.textPrimary},children:"Verify Your Email"}),r.jsx("p",{style:{margin:0,fontSize:13,color:h.textSecondary,textAlign:"center"},children:"Enter your email and OTP to confirm your account"})]}),C&&r.jsxs("div",{style:{padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:500,color:C.type==="success"?h.success:h.warning,border:`1px solid ${C.type==="success"?h.success:h.warning}`,backgroundColor:C.type==="success"?`${h.success}20`:`${h.warning}20`,display:"flex",alignItems:"center",gap:8},children:[C.type==="success"?r.jsx(ce,{size:16}):r.jsx(oe,{size:16}),C.message]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[r.jsx(pe,{size:18,style:{position:"absolute",left:12,color:h.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"email",value:d.email,onChange:b=>c(j=>({...j,email:b.target.value})),placeholder:"Enter your email",style:{...A,paddingLeft:40,height:40,borderRadius:8,boxShadow:e?"0 2px 6px rgba(0,0,0,0.3)":"0 2px 6px rgba(0,0,0,0.08)"},required:!0})]}),r.jsx("small",{style:{fontSize:11,color:h.textTertiary,marginTop:2},children:"We'll send a verification code to this email"})]}),f&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[r.jsx(st,{size:18,style:{position:"absolute",left:12,color:h.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"text",value:d.otp,onChange:b=>c(j=>({...j,otp:b.target.value})),placeholder:"Enter OTP",style:{...A,paddingLeft:40,height:40,borderRadius:8,boxShadow:e?"0 2px 6px rgba(0,0,0,0.3)":"0 2px 6px rgba(0,0,0,0.08)"},required:!0})]}),r.jsx("small",{style:{fontSize:11,color:h.textTertiary,marginTop:2},children:"Check your inbox for the 6-digit code"})]}),r.jsx("div",{style:{display:"flex",gap:12},children:f?r.jsxs("button",{type:"submit",disabled:y,style:{...D(y),borderRadius:12,padding:"12px 16px",fontSize:14},children:[y?r.jsx(se,{size:16,className:"spinner"}):r.jsx(ce,{size:16}),y?"Verifying...":"Verify Email"]}):r.jsxs("button",{type:"button",onClick:T,disabled:y||!t?.id,style:{...D(y),borderRadius:12,padding:"12px 16px",fontSize:14},children:[y?r.jsx(se,{size:16,className:"spinner"}):r.jsx(ot,{size:16}),y?"Sending...":"Send OTP"]})})]})};ee.AuthixProvider=Jn,ee.NeuctraAuthix=Tn,ee.ReactEmailVerification=os,ee.ReactSignedIn=Zn,ee.ReactSignedOut=Qn,ee.ReactUserButton=is,ee.ReactUserLogin=Xn,ee.ReactUserProfile=ss,ee.ReactUserSignUp=Gn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -63,6 +63,17 @@ export declare class NeuctraAuthix {
|
|
|
63
63
|
* Automatically detects logged-in / logged-out state
|
|
64
64
|
*/
|
|
65
65
|
checkUserSession(): Promise<CheckSessionResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* 👤 Get user by ID or username
|
|
68
|
+
*
|
|
69
|
+
* Route:
|
|
70
|
+
* GET /users/:appId/user?id=USER_ID
|
|
71
|
+
* GET /users/:appId/user?username=USERNAME
|
|
72
|
+
*/
|
|
73
|
+
getUser(params: {
|
|
74
|
+
id?: string;
|
|
75
|
+
username?: string;
|
|
76
|
+
}): Promise<any>;
|
|
66
77
|
/**
|
|
67
78
|
* Update an existing user
|
|
68
79
|
* @param params fields to update
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAEhB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAE9B;;;OAGG;gBACS,MAAM,EAAE,mBAAmB;IAoBvC;;;;;;OAMG;YACW,OAAO;IAqCrB;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,YAAY;IASrC;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW;IAqBnC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAmCjD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAmBjD;;;OAGG;IACG,2BAA2B,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAsC3E;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAsBxD;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAoBvD;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAazC;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAazC;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAqB/C;;;OAGG;IACG,2BAA2B,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAS3D;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;KACrB;IAeD;;;;OAIG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAa7D,cAAc,CAAC,MAAM,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IAeD;;;;;;;;;;OAUG;IACG,oBAAoB,CAAC,MAAM,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IA4BD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAa3C;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,uBAAuB;IAcvD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAoB3C;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAejD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAcjD;;;OAGG;IACG,yBAAyB,CAAC,MAAM,EAAE,+BAA+B;IAmBvE;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAY3D;;;;;;;OAOG;IACG,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAYhE;;;;;OAKG;IACG,cAAc,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAgBtC;;;;;OAKG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAiBxE;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,OAAO,CAAC,WAAW,EAAE,CAAC;IAkBzB;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAwBxB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBxB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;CAiBtE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAEhB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,+BAA+B,EAC/B,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAE9B;;;OAGG;gBACS,MAAM,EAAE,mBAAmB;IAoBvC;;;;;;OAMG;YACW,OAAO;IAqCrB;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,YAAY;IASrC;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW;IAqBnC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAmCjD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAmBjD;;;OAGG;IACG,2BAA2B,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAsC3E;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAsBxD;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAoBvD;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAyBxD;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAazC;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAazC;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAqB/C;;;OAGG;IACG,2BAA2B,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAS3D;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;KACrB;IAeD;;;;OAIG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAa7D,cAAc,CAAC,MAAM,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IAeD;;;;;;;;;;OAUG;IACG,oBAAoB,CAAC,MAAM,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IA4BD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAa3C;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,uBAAuB;IAcvD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAoB3C;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAejD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAcjD;;;OAGG;IACG,yBAAyB,CAAC,MAAM,EAAE,+BAA+B;IAmBvE;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAY3D;;;;;;;OAOG;IACG,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAYhE;;;;;OAKG;IACG,cAAc,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAgBtC;;;;;OAKG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAiBxE;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,OAAO,CAAC,WAAW,EAAE,CAAC;IAkBzB;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAwBxB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBxB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;CAiBtE"}
|