authifyer-sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authifyer-sdk.es.js +100 -92
- package/dist/authifyer-sdk.umd.js +8 -8
- package/package.json +1 -1
- package/src/core/client.ts +12 -2
package/dist/authifyer-sdk.es.js
CHANGED
|
@@ -12,10 +12,10 @@ var be = { exports: {} }, se = {};
|
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
15
|
+
var Ke;
|
|
16
16
|
function Wt() {
|
|
17
|
-
if (
|
|
18
|
-
|
|
17
|
+
if (Ke) return se;
|
|
18
|
+
Ke = 1;
|
|
19
19
|
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
20
20
|
function r(n, s, o) {
|
|
21
21
|
var i = null;
|
|
@@ -44,9 +44,9 @@ var oe = {};
|
|
|
44
44
|
* This source code is licensed under the MIT license found in the
|
|
45
45
|
* LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
|
-
var
|
|
47
|
+
var Ye;
|
|
48
48
|
function Jt() {
|
|
49
|
-
return
|
|
49
|
+
return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
50
50
|
function t(l) {
|
|
51
51
|
if (l == null) return null;
|
|
52
52
|
if (typeof l == "function")
|
|
@@ -275,9 +275,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
275
275
|
};
|
|
276
276
|
})()), oe;
|
|
277
277
|
}
|
|
278
|
-
var
|
|
278
|
+
var Xe;
|
|
279
279
|
function Vt() {
|
|
280
|
-
return
|
|
280
|
+
return Xe || (Xe = 1, process.env.NODE_ENV === "production" ? be.exports = Wt() : be.exports = Jt()), be.exports;
|
|
281
281
|
}
|
|
282
282
|
var b = Vt();
|
|
283
283
|
function pt(t, e) {
|
|
@@ -285,7 +285,7 @@ function pt(t, e) {
|
|
|
285
285
|
return t.apply(e, arguments);
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
const { toString: Kt } = Object.prototype, { getPrototypeOf:
|
|
288
|
+
const { toString: Kt } = Object.prototype, { getPrototypeOf: $e } = Object, { iterator: Te, toStringTag: mt } = Symbol, Ae = /* @__PURE__ */ ((t) => (e) => {
|
|
289
289
|
const r = Kt.call(e);
|
|
290
290
|
return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
|
|
291
291
|
})(/* @__PURE__ */ Object.create(null)), D = (t) => (t = t.toLowerCase(), (e) => Ae(e) === t), xe = (t) => (e) => typeof e === t, { isArray: ee } = Array, Z = xe("undefined");
|
|
@@ -300,7 +300,7 @@ function Yt(t) {
|
|
|
300
300
|
const Xt = xe("string"), k = xe("function"), bt = xe("number"), le = (t) => t !== null && typeof t == "object", Gt = (t) => t === !0 || t === !1, Ee = (t) => {
|
|
301
301
|
if (Ae(t) !== "object")
|
|
302
302
|
return !1;
|
|
303
|
-
const e =
|
|
303
|
+
const e = $e(t);
|
|
304
304
|
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(mt in t) && !(Te in t);
|
|
305
305
|
}, Qt = (t) => {
|
|
306
306
|
if (!le(t) || ce(t))
|
|
@@ -348,12 +348,12 @@ function gt(t, e) {
|
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
350
|
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Et = (t) => !Z(t) && t !== K;
|
|
351
|
-
function
|
|
351
|
+
function Ie() {
|
|
352
352
|
const { caseless: t, skipUndefined: e } = Et(this) && this || {}, r = {}, n = (s, o) => {
|
|
353
353
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
354
354
|
return;
|
|
355
355
|
const i = t && gt(r, o) || o;
|
|
356
|
-
Ee(r[i]) && Ee(s) ? r[i] =
|
|
356
|
+
Ee(r[i]) && Ee(s) ? r[i] = Ie(r[i], s) : Ee(s) ? r[i] = Ie({}, s) : ee(s) ? r[i] = s.slice() : (!e || !Z(s)) && (r[i] = s);
|
|
357
357
|
};
|
|
358
358
|
for (let s = 0, o = arguments.length; s < o; s++)
|
|
359
359
|
arguments[s] && ue(arguments[s], n);
|
|
@@ -394,7 +394,7 @@ const fr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
|
|
|
394
394
|
do {
|
|
395
395
|
for (s = Object.getOwnPropertyNames(t), o = s.length; o-- > 0; )
|
|
396
396
|
i = s[o], (!n || n(i, t, e)) && !c[i] && (e[i] = t[i], c[i] = !0);
|
|
397
|
-
t = r !== !1 &&
|
|
397
|
+
t = r !== !1 && $e(t);
|
|
398
398
|
} while (t && (!r || r(t, e)) && t !== Object.prototype);
|
|
399
399
|
return e;
|
|
400
400
|
}, mr = (t, e, r) => {
|
|
@@ -410,7 +410,7 @@ const fr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
|
|
|
410
410
|
for (; e-- > 0; )
|
|
411
411
|
r[e] = t[e];
|
|
412
412
|
return r;
|
|
413
|
-
}, br = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" &&
|
|
413
|
+
}, br = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && $e(Uint8Array)), gr = (t, e) => {
|
|
414
414
|
const n = (t && t[Te]).call(t);
|
|
415
415
|
let s;
|
|
416
416
|
for (; (s = n.next()) && !s.done; ) {
|
|
@@ -425,7 +425,7 @@ const fr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
|
|
|
425
425
|
return n;
|
|
426
426
|
}, wr = D("HTMLFormElement"), Rr = (t) => t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(r, n, s) {
|
|
427
427
|
return n.toUpperCase() + s;
|
|
428
|
-
}),
|
|
428
|
+
}), Ge = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Sr = D("RegExp"), wt = (t, e) => {
|
|
429
429
|
const r = Object.getOwnPropertyDescriptors(t), n = {};
|
|
430
430
|
ue(r, (s, o) => {
|
|
431
431
|
let i;
|
|
@@ -512,7 +512,7 @@ const Nr = (t) => {
|
|
|
512
512
|
isTypedArray: br,
|
|
513
513
|
isFileList: rr,
|
|
514
514
|
forEach: ue,
|
|
515
|
-
merge:
|
|
515
|
+
merge: Ie,
|
|
516
516
|
extend: fr,
|
|
517
517
|
trim: ur,
|
|
518
518
|
stripBOM: dr,
|
|
@@ -525,8 +525,8 @@ const Nr = (t) => {
|
|
|
525
525
|
forEachEntry: gr,
|
|
526
526
|
matchAll: Er,
|
|
527
527
|
isHTMLForm: wr,
|
|
528
|
-
hasOwnProperty:
|
|
529
|
-
hasOwnProp:
|
|
528
|
+
hasOwnProperty: Ge,
|
|
529
|
+
hasOwnProp: Ge,
|
|
530
530
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
531
531
|
reduceDescriptors: wt,
|
|
532
532
|
freezeMethods: Tr,
|
|
@@ -597,19 +597,19 @@ g.ERR_CANCELED = "ERR_CANCELED";
|
|
|
597
597
|
g.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
598
598
|
g.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
599
599
|
const kr = null;
|
|
600
|
-
function
|
|
600
|
+
function Fe(t) {
|
|
601
601
|
return a.isPlainObject(t) || a.isArray(t);
|
|
602
602
|
}
|
|
603
603
|
function Tt(t) {
|
|
604
604
|
return a.endsWith(t, "[]") ? t.slice(0, -2) : t;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function Qe(t, e, r) {
|
|
607
607
|
return t ? t.concat(e).map(function(s, o) {
|
|
608
608
|
return s = Tt(s), !r && o ? "[" + s + "]" : s;
|
|
609
609
|
}).join(r ? "." : "") : e;
|
|
610
610
|
}
|
|
611
611
|
function Lr(t) {
|
|
612
|
-
return a.isArray(t) && !t.some(
|
|
612
|
+
return a.isArray(t) && !t.some(Fe);
|
|
613
613
|
}
|
|
614
614
|
const Ur = a.toFlatObject(a, {}, null, function(e) {
|
|
615
615
|
return /^is[A-Z]/.test(e);
|
|
@@ -646,17 +646,17 @@ function _e(t, e, r) {
|
|
|
646
646
|
return y = Tt(y), S.forEach(function(_, C) {
|
|
647
647
|
!(a.isUndefined(_) || _ === null) && e.append(
|
|
648
648
|
// eslint-disable-next-line no-nested-ternary
|
|
649
|
-
i === !0 ?
|
|
649
|
+
i === !0 ? Qe([y], C, o) : i === null ? y : y + "[]",
|
|
650
650
|
d(_)
|
|
651
651
|
);
|
|
652
652
|
}), !1;
|
|
653
653
|
}
|
|
654
|
-
return
|
|
654
|
+
return Fe(f) ? !0 : (e.append(Qe(h, y, o), d(f)), !1);
|
|
655
655
|
}
|
|
656
656
|
const m = [], w = Object.assign(Ur, {
|
|
657
657
|
defaultVisitor: u,
|
|
658
658
|
convertValue: d,
|
|
659
|
-
isVisitable:
|
|
659
|
+
isVisitable: Fe
|
|
660
660
|
});
|
|
661
661
|
function R(f, y) {
|
|
662
662
|
if (!a.isUndefined(f)) {
|
|
@@ -677,7 +677,7 @@ function _e(t, e, r) {
|
|
|
677
677
|
throw new TypeError("data must be an object");
|
|
678
678
|
return R(t), e;
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Ze(t) {
|
|
681
681
|
const e = {
|
|
682
682
|
"!": "%21",
|
|
683
683
|
"'": "%27",
|
|
@@ -691,17 +691,17 @@ function Qe(t) {
|
|
|
691
691
|
return e[n];
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function ze(t, e) {
|
|
695
695
|
this._pairs = [], t && _e(t, this, e);
|
|
696
696
|
}
|
|
697
|
-
const At =
|
|
697
|
+
const At = ze.prototype;
|
|
698
698
|
At.append = function(e, r) {
|
|
699
699
|
this._pairs.push([e, r]);
|
|
700
700
|
};
|
|
701
701
|
At.toString = function(e) {
|
|
702
702
|
const r = e ? function(n) {
|
|
703
|
-
return e.call(this, n,
|
|
704
|
-
} :
|
|
703
|
+
return e.call(this, n, Ze);
|
|
704
|
+
} : Ze;
|
|
705
705
|
return this._pairs.map(function(s) {
|
|
706
706
|
return r(s[0]) + "=" + r(s[1]);
|
|
707
707
|
}, "").join("&");
|
|
@@ -716,13 +716,13 @@ function xt(t, e, r) {
|
|
|
716
716
|
serialize: r
|
|
717
717
|
} : r, o = s && s.serialize;
|
|
718
718
|
let i;
|
|
719
|
-
if (o ? i = o(e, s) : i = a.isURLSearchParams(e) ? e.toString() : new
|
|
719
|
+
if (o ? i = o(e, s) : i = a.isURLSearchParams(e) ? e.toString() : new ze(e, s).toString(n), i) {
|
|
720
720
|
const c = t.indexOf("#");
|
|
721
721
|
c !== -1 && (t = t.slice(0, c)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
|
|
722
722
|
}
|
|
723
723
|
return t;
|
|
724
724
|
}
|
|
725
|
-
class
|
|
725
|
+
class et {
|
|
726
726
|
constructor() {
|
|
727
727
|
this.handlers = [];
|
|
728
728
|
}
|
|
@@ -777,12 +777,12 @@ class Ze {
|
|
|
777
777
|
});
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
|
-
const
|
|
780
|
+
const We = {
|
|
781
781
|
silentJSONParsing: !0,
|
|
782
782
|
forcedJSONParsing: !0,
|
|
783
783
|
clarifyTimeoutError: !1,
|
|
784
784
|
legacyInterceptorReqResOrdering: !0
|
|
785
|
-
}, Fr = typeof URLSearchParams < "u" ? URLSearchParams :
|
|
785
|
+
}, Fr = typeof URLSearchParams < "u" ? URLSearchParams : ze, Br = typeof FormData < "u" ? FormData : null, Dr = typeof Blob < "u" ? Blob : null, qr = {
|
|
786
786
|
isBrowser: !0,
|
|
787
787
|
classes: {
|
|
788
788
|
URLSearchParams: Fr,
|
|
@@ -790,13 +790,13 @@ const ze = {
|
|
|
790
790
|
Blob: Dr
|
|
791
791
|
},
|
|
792
792
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
793
|
-
},
|
|
794
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", $r =
|
|
793
|
+
}, Je = typeof window < "u" && typeof document < "u", Be = typeof navigator == "object" && navigator || void 0, Mr = Je && (!Be || ["ReactNative", "NativeScript", "NS"].indexOf(Be.product) < 0), Hr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
794
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", $r = Je && window.location.href || "http://localhost", zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
795
795
|
__proto__: null,
|
|
796
|
-
hasBrowserEnv:
|
|
796
|
+
hasBrowserEnv: Je,
|
|
797
797
|
hasStandardBrowserEnv: Mr,
|
|
798
798
|
hasStandardBrowserWebWorkerEnv: Hr,
|
|
799
|
-
navigator:
|
|
799
|
+
navigator: Be,
|
|
800
800
|
origin: $r
|
|
801
801
|
}, Symbol.toStringTag, { value: "Module" })), P = {
|
|
802
802
|
...zr,
|
|
@@ -848,7 +848,7 @@ function Kr(t, e, r) {
|
|
|
848
848
|
return (r || JSON.stringify)(t);
|
|
849
849
|
}
|
|
850
850
|
const fe = {
|
|
851
|
-
transitional:
|
|
851
|
+
transitional: We,
|
|
852
852
|
adapter: ["xhr", "http", "fetch"],
|
|
853
853
|
transformRequest: [function(e, r) {
|
|
854
854
|
const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, o = a.isObject(e);
|
|
@@ -941,7 +941,7 @@ const Yr = a.toObjectSet([
|
|
|
941
941
|
`).forEach(function(i) {
|
|
942
942
|
s = i.indexOf(":"), r = i.substring(0, s).trim().toLowerCase(), n = i.substring(s + 1).trim(), !(!r || e[r] && Yr[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
|
|
943
943
|
}), e;
|
|
944
|
-
},
|
|
944
|
+
}, tt = Symbol("internals");
|
|
945
945
|
function ie(t) {
|
|
946
946
|
return t && String(t).trim().toLowerCase();
|
|
947
947
|
}
|
|
@@ -1096,7 +1096,7 @@ let L = class {
|
|
|
1096
1096
|
return r.forEach((s) => n.set(s)), n;
|
|
1097
1097
|
}
|
|
1098
1098
|
static accessor(e) {
|
|
1099
|
-
const n = (this[
|
|
1099
|
+
const n = (this[tt] = this[tt] = {
|
|
1100
1100
|
accessors: {}
|
|
1101
1101
|
}).accessors, s = this.prototype;
|
|
1102
1102
|
function o(i) {
|
|
@@ -1202,14 +1202,14 @@ const Se = (t, e, r = 3) => {
|
|
|
1202
1202
|
};
|
|
1203
1203
|
t(m);
|
|
1204
1204
|
}, r);
|
|
1205
|
-
},
|
|
1205
|
+
}, rt = (t, e) => {
|
|
1206
1206
|
const r = t != null;
|
|
1207
1207
|
return [(n) => e[0]({
|
|
1208
1208
|
lengthComputable: r,
|
|
1209
1209
|
total: t,
|
|
1210
1210
|
loaded: n
|
|
1211
1211
|
}), e[1]];
|
|
1212
|
-
},
|
|
1212
|
+
}, nt = (t) => (...e) => a.asap(() => t(...e)), sn = P.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, P.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
|
|
1213
1213
|
new URL(P.origin),
|
|
1214
1214
|
P.navigator && /(msie|trident)/i.test(P.navigator.userAgent)
|
|
1215
1215
|
) : () => !0, on = P.hasStandardBrowserEnv ? (
|
|
@@ -1251,7 +1251,7 @@ function Ct(t, e, r) {
|
|
|
1251
1251
|
let n = !an(e);
|
|
1252
1252
|
return t && (n || r == !1) ? cn(t, e) : e;
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const st = (t) => t instanceof L ? { ...t } : t;
|
|
1255
1255
|
function X(t, e) {
|
|
1256
1256
|
e = e || {};
|
|
1257
1257
|
const r = {};
|
|
@@ -1309,7 +1309,7 @@ function X(t, e) {
|
|
|
1309
1309
|
socketPath: i,
|
|
1310
1310
|
responseEncoding: i,
|
|
1311
1311
|
validateStatus: c,
|
|
1312
|
-
headers: (d, u, m) => s(
|
|
1312
|
+
headers: (d, u, m) => s(st(d), st(u), m, !0)
|
|
1313
1313
|
};
|
|
1314
1314
|
return a.forEach(
|
|
1315
1315
|
Object.keys({ ...t, ...e }),
|
|
@@ -1381,7 +1381,7 @@ const Pt = (t) => {
|
|
|
1381
1381
|
M.event = C || null, n(M), h = null;
|
|
1382
1382
|
}, h.ontimeout = function() {
|
|
1383
1383
|
let C = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1384
|
-
const U = s.transitional ||
|
|
1384
|
+
const U = s.transitional || We;
|
|
1385
1385
|
s.timeoutErrorMessage && (C = s.timeoutErrorMessage), n(new g(
|
|
1386
1386
|
C,
|
|
1387
1387
|
U.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
|
|
@@ -1451,7 +1451,7 @@ const Pt = (t) => {
|
|
|
1451
1451
|
} finally {
|
|
1452
1452
|
await e.cancel();
|
|
1453
1453
|
}
|
|
1454
|
-
},
|
|
1454
|
+
}, ot = (t, e, r, n) => {
|
|
1455
1455
|
const s = hn(t, e);
|
|
1456
1456
|
let o = 0, i, c = (p) => {
|
|
1457
1457
|
i || (i = !0, n && n(p));
|
|
@@ -1480,13 +1480,13 @@ const Pt = (t) => {
|
|
|
1480
1480
|
}, {
|
|
1481
1481
|
highWaterMark: 2
|
|
1482
1482
|
});
|
|
1483
|
-
},
|
|
1483
|
+
}, it = 64 * 1024, { isFunction: ge } = a, mn = (({ Request: t, Response: e }) => ({
|
|
1484
1484
|
Request: t,
|
|
1485
1485
|
Response: e
|
|
1486
1486
|
}))(a.global), {
|
|
1487
|
-
ReadableStream:
|
|
1488
|
-
TextEncoder:
|
|
1489
|
-
} = a.global,
|
|
1487
|
+
ReadableStream: at,
|
|
1488
|
+
TextEncoder: ct
|
|
1489
|
+
} = a.global, lt = (t, ...e) => {
|
|
1490
1490
|
try {
|
|
1491
1491
|
return !!t(...e);
|
|
1492
1492
|
} catch {
|
|
@@ -1499,17 +1499,17 @@ const Pt = (t) => {
|
|
|
1499
1499
|
const { fetch: e, Request: r, Response: n } = t, s = e ? ge(e) : typeof fetch == "function", o = ge(r), i = ge(n);
|
|
1500
1500
|
if (!s)
|
|
1501
1501
|
return !1;
|
|
1502
|
-
const c = s && ge(
|
|
1502
|
+
const c = s && ge(at), p = s && (typeof ct == "function" ? /* @__PURE__ */ ((f) => (y) => f.encode(y))(new ct()) : async (f) => new Uint8Array(await new r(f).arrayBuffer())), d = o && c && lt(() => {
|
|
1503
1503
|
let f = !1;
|
|
1504
1504
|
const y = new r(P.origin, {
|
|
1505
|
-
body: new
|
|
1505
|
+
body: new at(),
|
|
1506
1506
|
method: "POST",
|
|
1507
1507
|
get duplex() {
|
|
1508
1508
|
return f = !0, "half";
|
|
1509
1509
|
}
|
|
1510
1510
|
}).headers.has("Content-Type");
|
|
1511
1511
|
return f && !y;
|
|
1512
|
-
}), u = i && c &&
|
|
1512
|
+
}), u = i && c && lt(() => a.isReadableStream(new n("").body)), m = {
|
|
1513
1513
|
stream: u && ((f) => f.body)
|
|
1514
1514
|
};
|
|
1515
1515
|
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
|
|
@@ -1567,11 +1567,11 @@ const Pt = (t) => {
|
|
|
1567
1567
|
duplex: "half"
|
|
1568
1568
|
}), E;
|
|
1569
1569
|
if (a.isFormData(S) && (E = l.headers.get("content-type")) && te.setContentType(E), l.body) {
|
|
1570
|
-
const [T, A] =
|
|
1570
|
+
const [T, A] = rt(
|
|
1571
1571
|
G,
|
|
1572
|
-
Se(
|
|
1572
|
+
Se(nt(M))
|
|
1573
1573
|
);
|
|
1574
|
-
S =
|
|
1574
|
+
S = ot(l.body, it, T, A);
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
1577
|
a.isString($) || ($ = $ ? "include" : "omit");
|
|
@@ -1592,12 +1592,12 @@ const Pt = (t) => {
|
|
|
1592
1592
|
["status", "statusText", "headers"].forEach((J) => {
|
|
1593
1593
|
l[J] = B[J];
|
|
1594
1594
|
});
|
|
1595
|
-
const E = a.toFiniteNumber(B.headers.get("content-length")), [T, A] = U &&
|
|
1595
|
+
const E = a.toFiniteNumber(B.headers.get("content-length")), [T, A] = U && rt(
|
|
1596
1596
|
E,
|
|
1597
|
-
Se(
|
|
1597
|
+
Se(nt(U), !0)
|
|
1598
1598
|
) || [];
|
|
1599
1599
|
B = new n(
|
|
1600
|
-
|
|
1600
|
+
ot(B.body, it, T, () => {
|
|
1601
1601
|
A && A(), H && H();
|
|
1602
1602
|
}),
|
|
1603
1603
|
l
|
|
@@ -1637,14 +1637,14 @@ const Pt = (t) => {
|
|
|
1637
1637
|
return d;
|
|
1638
1638
|
};
|
|
1639
1639
|
jt();
|
|
1640
|
-
const
|
|
1640
|
+
const Ve = {
|
|
1641
1641
|
http: kr,
|
|
1642
1642
|
xhr: un,
|
|
1643
1643
|
fetch: {
|
|
1644
1644
|
get: jt
|
|
1645
1645
|
}
|
|
1646
1646
|
};
|
|
1647
|
-
a.forEach(
|
|
1647
|
+
a.forEach(Ve, (t, e) => {
|
|
1648
1648
|
if (t) {
|
|
1649
1649
|
try {
|
|
1650
1650
|
Object.defineProperty(t, "name", { value: e });
|
|
@@ -1653,7 +1653,7 @@ a.forEach(Je, (t, e) => {
|
|
|
1653
1653
|
Object.defineProperty(t, "adapterName", { value: e });
|
|
1654
1654
|
}
|
|
1655
1655
|
});
|
|
1656
|
-
const
|
|
1656
|
+
const ut = (t) => `- ${t}`, gn = (t) => a.isFunction(t) || t === null || t === !1;
|
|
1657
1657
|
function En(t, e) {
|
|
1658
1658
|
t = a.isArray(t) ? t : [t];
|
|
1659
1659
|
const { length: r } = t;
|
|
@@ -1662,7 +1662,7 @@ function En(t, e) {
|
|
|
1662
1662
|
for (let i = 0; i < r; i++) {
|
|
1663
1663
|
n = t[i];
|
|
1664
1664
|
let c;
|
|
1665
|
-
if (s = n, !gn(n) && (s =
|
|
1665
|
+
if (s = n, !gn(n) && (s = Ve[(c = String(n)).toLowerCase()], s === void 0))
|
|
1666
1666
|
throw new g(`Unknown adapter '${c}'`);
|
|
1667
1667
|
if (s && (a.isFunction(s) || (s = s.get(e))))
|
|
1668
1668
|
break;
|
|
@@ -1673,8 +1673,8 @@ function En(t, e) {
|
|
|
1673
1673
|
([p, d]) => `adapter ${p} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1674
1674
|
);
|
|
1675
1675
|
let c = r ? i.length > 1 ? `since :
|
|
1676
|
-
` + i.map(
|
|
1677
|
-
`) : " " +
|
|
1676
|
+
` + i.map(ut).join(`
|
|
1677
|
+
`) : " " + ut(i[0]) : "as no adapter specified";
|
|
1678
1678
|
throw new g(
|
|
1679
1679
|
"There is no suitable adapter to dispatch the request " + c,
|
|
1680
1680
|
"ERR_NOT_SUPPORT"
|
|
@@ -1692,13 +1692,13 @@ const vt = {
|
|
|
1692
1692
|
* Exposes all known adapters
|
|
1693
1693
|
* @type {Object<string, Function|Object>}
|
|
1694
1694
|
*/
|
|
1695
|
-
adapters:
|
|
1695
|
+
adapters: Ve
|
|
1696
1696
|
};
|
|
1697
1697
|
function ve(t) {
|
|
1698
1698
|
if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
|
|
1699
1699
|
throw new de(null, t);
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1701
|
+
function ft(t) {
|
|
1702
1702
|
return ve(t), t.headers = L.from(t.headers), t.data = je.call(
|
|
1703
1703
|
t,
|
|
1704
1704
|
t.transformRequest
|
|
@@ -1722,7 +1722,7 @@ const kt = "1.13.5", Oe = {};
|
|
|
1722
1722
|
return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
|
|
1723
1723
|
};
|
|
1724
1724
|
});
|
|
1725
|
-
const
|
|
1725
|
+
const dt = {};
|
|
1726
1726
|
Oe.transitional = function(e, r, n) {
|
|
1727
1727
|
function s(o, i) {
|
|
1728
1728
|
return "[Axios v" + kt + "] Transitional option '" + o + "'" + i + (n ? ". " + n : "");
|
|
@@ -1733,7 +1733,7 @@ Oe.transitional = function(e, r, n) {
|
|
|
1733
1733
|
s(i, " has been removed" + (r ? " in " + r : "")),
|
|
1734
1734
|
g.ERR_DEPRECATED
|
|
1735
1735
|
);
|
|
1736
|
-
return r && !
|
|
1736
|
+
return r && !dt[i] && (dt[i] = !0, console.warn(
|
|
1737
1737
|
s(
|
|
1738
1738
|
i,
|
|
1739
1739
|
" has been deprecated since v" + r + " and will be removed in the near future"
|
|
@@ -1768,8 +1768,8 @@ const Re = {
|
|
|
1768
1768
|
let Y = class {
|
|
1769
1769
|
constructor(e) {
|
|
1770
1770
|
this.defaults = e || {}, this.interceptors = {
|
|
1771
|
-
request: new
|
|
1772
|
-
response: new
|
|
1771
|
+
request: new et(),
|
|
1772
|
+
response: new et()
|
|
1773
1773
|
};
|
|
1774
1774
|
}
|
|
1775
1775
|
/**
|
|
@@ -1830,7 +1830,7 @@ let Y = class {
|
|
|
1830
1830
|
if (typeof y.runWhen == "function" && y.runWhen(r) === !1)
|
|
1831
1831
|
return;
|
|
1832
1832
|
p = p && y.synchronous;
|
|
1833
|
-
const h = r.transitional ||
|
|
1833
|
+
const h = r.transitional || We;
|
|
1834
1834
|
h && h.legacyInterceptorReqResOrdering ? c.unshift(y.fulfilled, y.rejected) : c.push(y.fulfilled, y.rejected);
|
|
1835
1835
|
});
|
|
1836
1836
|
const d = [];
|
|
@@ -1839,7 +1839,7 @@ let Y = class {
|
|
|
1839
1839
|
});
|
|
1840
1840
|
let u, m = 0, w;
|
|
1841
1841
|
if (!p) {
|
|
1842
|
-
const f = [
|
|
1842
|
+
const f = [ft.bind(this), void 0];
|
|
1843
1843
|
for (f.unshift(...c), f.push(...d), w = f.length, u = Promise.resolve(r); m < w; )
|
|
1844
1844
|
u = u.then(f[m++], f[m++]);
|
|
1845
1845
|
return u;
|
|
@@ -1856,7 +1856,7 @@ let Y = class {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
}
|
|
1858
1858
|
try {
|
|
1859
|
-
u =
|
|
1859
|
+
u = ft.call(this, R);
|
|
1860
1860
|
} catch (f) {
|
|
1861
1861
|
return Promise.reject(f);
|
|
1862
1862
|
}
|
|
@@ -1975,7 +1975,7 @@ function Sn(t) {
|
|
|
1975
1975
|
function Tn(t) {
|
|
1976
1976
|
return a.isObject(t) && t.isAxiosError === !0;
|
|
1977
1977
|
}
|
|
1978
|
-
const
|
|
1978
|
+
const De = {
|
|
1979
1979
|
Continue: 100,
|
|
1980
1980
|
SwitchingProtocols: 101,
|
|
1981
1981
|
Processing: 102,
|
|
@@ -2046,8 +2046,8 @@ const Be = {
|
|
|
2046
2046
|
SslHandshakeFailed: 525,
|
|
2047
2047
|
InvalidSslCertificate: 526
|
|
2048
2048
|
};
|
|
2049
|
-
Object.entries(
|
|
2050
|
-
|
|
2049
|
+
Object.entries(De).forEach(([t, e]) => {
|
|
2050
|
+
De[e] = t;
|
|
2051
2051
|
});
|
|
2052
2052
|
function Ut(t) {
|
|
2053
2053
|
const e = new Y(t), r = pt(Y.prototype.request, e);
|
|
@@ -2073,7 +2073,7 @@ x.mergeConfig = X;
|
|
|
2073
2073
|
x.AxiosHeaders = L;
|
|
2074
2074
|
x.formToJSON = (t) => _t(a.isHTMLForm(t) ? new FormData(t) : t);
|
|
2075
2075
|
x.getAdapter = vt.getAdapter;
|
|
2076
|
-
x.HttpStatusCode =
|
|
2076
|
+
x.HttpStatusCode = De;
|
|
2077
2077
|
x.default = x;
|
|
2078
2078
|
const {
|
|
2079
2079
|
Axios: Un,
|
|
@@ -2097,27 +2097,27 @@ const {
|
|
|
2097
2097
|
headers: {
|
|
2098
2098
|
"Content-Type": "application/json"
|
|
2099
2099
|
}
|
|
2100
|
-
}),
|
|
2100
|
+
}), qe = "authifyer_access_token", ke = (t) => {
|
|
2101
2101
|
try {
|
|
2102
|
-
t ? (localStorage.setItem(
|
|
2102
|
+
t ? (localStorage.setItem(qe, t), q.defaults.headers.common.Authorization = `Bearer ${t}`) : (localStorage.removeItem(qe), delete q.defaults.headers.common.Authorization);
|
|
2103
2103
|
} catch (e) {
|
|
2104
2104
|
console.warn("Authifyer: localStorage is not accessible.", e);
|
|
2105
2105
|
}
|
|
2106
2106
|
}, xn = () => {
|
|
2107
2107
|
try {
|
|
2108
|
-
return localStorage.getItem(
|
|
2108
|
+
return localStorage.getItem(qe);
|
|
2109
2109
|
} catch {
|
|
2110
2110
|
return null;
|
|
2111
2111
|
}
|
|
2112
|
-
},
|
|
2112
|
+
}, Me = "authifyer_refresh_token", Le = (t) => {
|
|
2113
2113
|
try {
|
|
2114
|
-
t ? localStorage.setItem(
|
|
2114
|
+
t ? localStorage.setItem(Me, t) : localStorage.removeItem(Me);
|
|
2115
2115
|
} catch (e) {
|
|
2116
2116
|
console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("auth:storage_error"));
|
|
2117
2117
|
}
|
|
2118
|
-
},
|
|
2118
|
+
}, Ue = () => {
|
|
2119
2119
|
try {
|
|
2120
|
-
return localStorage.getItem(
|
|
2120
|
+
return localStorage.getItem(Me);
|
|
2121
2121
|
} catch (t) {
|
|
2122
2122
|
return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.", t), typeof window < "u" && window.dispatchEvent(new CustomEvent("auth:storage_error")), null;
|
|
2123
2123
|
}
|
|
@@ -2262,7 +2262,10 @@ class Cn {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
async signOut() {
|
|
2264
2264
|
try {
|
|
2265
|
-
|
|
2265
|
+
const e = Ue();
|
|
2266
|
+
await q.post("/authifyer/session/logout", {
|
|
2267
|
+
refresh_token: e || void 0
|
|
2268
|
+
});
|
|
2266
2269
|
} catch (e) {
|
|
2267
2270
|
console.warn("Logout failed", e);
|
|
2268
2271
|
} finally {
|
|
@@ -2276,8 +2279,13 @@ class Cn {
|
|
|
2276
2279
|
// --- Session Management ---
|
|
2277
2280
|
async refreshSession() {
|
|
2278
2281
|
try {
|
|
2279
|
-
const e =
|
|
2280
|
-
|
|
2282
|
+
const e = Ue();
|
|
2283
|
+
if (!e) {
|
|
2284
|
+
this.clearSession();
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
const r = await q.post("/authifyer/jwt/refresh-jwt", {
|
|
2288
|
+
refresh_token: e
|
|
2281
2289
|
}), { access_token: n, refresh_token: s } = r.data;
|
|
2282
2290
|
if (n) {
|
|
2283
2291
|
const o = n.accessToken || n;
|
|
@@ -2295,7 +2303,7 @@ class Cn {
|
|
|
2295
2303
|
*/
|
|
2296
2304
|
async rotateSession() {
|
|
2297
2305
|
try {
|
|
2298
|
-
const e =
|
|
2306
|
+
const e = Ue();
|
|
2299
2307
|
await q.post("/authifyer/session/refresh", {
|
|
2300
2308
|
refresh_token: e || void 0
|
|
2301
2309
|
}), await this.refreshSession();
|
|
@@ -2380,7 +2388,7 @@ const It = Mt(void 0), Gn = ({
|
|
|
2380
2388
|
}, es = () => {
|
|
2381
2389
|
const { client: t } = he();
|
|
2382
2390
|
return t;
|
|
2383
|
-
},
|
|
2391
|
+
}, He = ({ title: t, subtitle: e, children: r }) => /* @__PURE__ */ b.jsx("div", { className: "authifyer-root", children: /* @__PURE__ */ b.jsxs("div", { className: "authifyer-card", children: [
|
|
2384
2392
|
/* @__PURE__ */ b.jsxs("div", { className: "authifyer-card-header", children: [
|
|
2385
2393
|
/* @__PURE__ */ b.jsx("h2", { className: "authifyer-card-title", children: t }),
|
|
2386
2394
|
e && /* @__PURE__ */ b.jsx("p", { className: "authifyer-card-subtitle", children: e })
|
|
@@ -2404,7 +2412,7 @@ const It = Mt(void 0), Gn = ({
|
|
|
2404
2412
|
d(!1);
|
|
2405
2413
|
}
|
|
2406
2414
|
};
|
|
2407
|
-
return /* @__PURE__ */ b.jsxs(
|
|
2415
|
+
return /* @__PURE__ */ b.jsxs(He, { title: "Sign in", subtitle: "to continue to Authifyer", children: [
|
|
2408
2416
|
i && /* @__PURE__ */ b.jsx("p", { className: "authifyer-error", children: i }),
|
|
2409
2417
|
(m.includes("google") || m.includes("github")) && /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form", children: [
|
|
2410
2418
|
m.includes("google") && /* @__PURE__ */ b.jsxs(
|
|
@@ -2477,13 +2485,13 @@ const It = Mt(void 0), Gn = ({
|
|
|
2477
2485
|
d(!1);
|
|
2478
2486
|
}
|
|
2479
2487
|
};
|
|
2480
|
-
return u ? /* @__PURE__ */ b.jsx(
|
|
2488
|
+
return u ? /* @__PURE__ */ b.jsx(He, { title: "Welcome!", children: /* @__PURE__ */ b.jsxs("div", { className: "authifyer-success", children: [
|
|
2481
2489
|
/* @__PURE__ */ b.jsx("svg", { className: "authifyer-success-icon", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ b.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
2482
2490
|
/* @__PURE__ */ b.jsxs("div", { children: [
|
|
2483
2491
|
/* @__PURE__ */ b.jsx("h3", { className: "authifyer-success-title", children: "Success" }),
|
|
2484
2492
|
/* @__PURE__ */ b.jsx("p", { className: "authifyer-success-text", children: "Registration completed. Please verify your email." })
|
|
2485
2493
|
] })
|
|
2486
|
-
] }) }) : /* @__PURE__ */ b.jsxs(
|
|
2494
|
+
] }) }) : /* @__PURE__ */ b.jsxs(He, { title: "Create your account", subtitle: "Welcome to Authifyer", children: [
|
|
2487
2495
|
i && /* @__PURE__ */ b.jsx("p", { className: "authifyer-error", children: i }),
|
|
2488
2496
|
(R.includes("google") || R.includes("github")) && /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form", children: [
|
|
2489
2497
|
R.includes("google") && /* @__PURE__ */ b.jsxs(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ye;function Bt(){if(Ye)return se;Ye=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:t,type:n,key:i,ref:s!==void 0?s:null,props:o}}return se.Fragment=e,se.jsx=r,se.jsxs=r,se}var oe={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Xe;function Dt(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===xe?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case U:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case I:return"SuspenseList";case Oe: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 b:return"Portal";case v:return l.displayName||"Context";case x:return(l._context.displayName||"Context")+".Consumer";case F:var E=l.render;return l=l.displayName,l||(l=E.displayName||E.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return E=l.displayName||null,E!==null?E:t(l.type)||"Memo";case J:E=l._payload,l=l._init;try{return t(l(E))}catch{}}return null}function e(l){return""+l}function r(l){try{e(l);var E=!1}catch{E=!0}if(E){E=console;var A=E.error,_=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return A.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",_),e(l)}}function n(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===J)return"<...>";try{var E=t(l);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function s(){var l=V.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if($.call(l,"key")){var E=Object.getOwnPropertyDescriptor(l,"key").get;if(E&&E.isReactWarning)return!1}return l.key!==void 0}function c(l,E){function A(){P||(P=!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)",E))}A.isReactWarning=!0,Object.defineProperty(l,"key",{get:A,configurable:!0})}function p(){var l=t(this.type);return pe[l]||(pe[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 d(l,E,A,_,G,$e){var C=A.ref;return l={$$typeof:f,type:l,key:E,props:A,_owner:_},(C!==void 0?C:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:p}):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:G}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$e}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function u(l,E,A,_,G,$e){var C=E.children;if(C!==void 0)if(_)if(W(C)){for(_=0;_<C.length;_++)m(C[_]);Object.freeze&&Object.freeze(C)}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 m(C);if($.call(E,"key")){C=t(l);var ne=Object.keys(E).filter(function(Sn){return Sn!=="key"});_=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+_]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,_,C,ne,C),Ne[C+_]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(E)&&(r(E.key),C=""+E.key),"key"in E){A={};for(var $e in E)$e!=="key"&&(A[$e]=E[$e])}else A=E;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,Ve)}function m(l){w(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?w(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function w(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Oe=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!1,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)},oe.jsxs=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!0,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)}})()),oe}var Xe;function Mt(){return Xe||(Xe=1,process.env.NODE_ENV==="production"?q.exports=Bt():q.exports=Dt()),q.exports}var y=Mt();function Ge(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ht}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Qe}=Symbol,be=(t=>e=>{const r=Ht.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ze=D("ArrayBuffer");function qt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ze(t.buffer),e}const zt=ge("string"),k=ge("function"),et=ge("number"),ae=t=>t!==null&&typeof t=="object",Wt=t=>t===!0||t===!1,Ee=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Qe in t)&&!(ye in t)},Jt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Vt=D("Date"),$t=D("File"),Kt=D("Blob"),Yt=D("FileList"),Xt=t=>ae(t)&&k(t.pipe),Gt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Qt=D("URLSearchParams"),[Zt,er,tr,rr]=["ReadableStream","Request","Response","Headers"].map(D),nr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function tt(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rt=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=rt(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&tt(r,o)||o;Ee(r[i])&&Ee(s)?r[i]=Pe(r[i],s):Ee(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const sr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ge(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),or=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),ir=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ar=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},cr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},lr=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!et(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},ur=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),fr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},dr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},hr=D("HTMLFormElement"),pr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),nt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),mr=D("RegExp"),st=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},yr=t=>{st(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},br=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},gr=()=>{},Er=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function wr(t){return!!(t&&k(t.append)&&t[Qe]==="FormData"&&t[ye])}const Rr=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Sr=D("AsyncFunction"),Tr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),ot=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Ar=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||ot,a={isArray:Z,isArrayBuffer:Ze,isBuffer:ie,isFormData:Gt,isArrayBufferView:qt,isString:zt,isNumber:et,isBoolean:Wt,isObject:ae,isPlainObject:Ee,isEmptyObject:Jt,isReadableStream:Zt,isRequest:er,isResponse:tr,isHeaders:rr,isUndefined:ee,isDate:Vt,isFile:$t,isBlob:Kt,isRegExp:mr,isFunction:k,isStream:Xt,isURLSearchParams:Qt,isTypedArray:ur,isFileList:Yt,forEach:ce,merge:Pe,extend:sr,trim:nr,stripBOM:or,inherits:ir,toFlatObject:ar,kindOf:be,kindOfTest:D,endsWith:cr,toArray:lr,forEachEntry:fr,matchAll:dr,isHTMLForm:hr,hasOwnProperty:nt,hasOwnProp:nt,reduceDescriptors:st,freezeMethods:yr,toObjectSet:br,toCamelCase:pr,noop:gr,toFiniteNumber:Er,findKey:tt,global:K,isContextDefined:rt,isSpecCompliantForm:wr,toJSONObject:Rr,isAsyncFn:Sr,isThenable:Tr,setImmediate:ot,asap:Ar,isIterable:t=>t!=null&&k(t[ye])};let g=class It extends Error{static from(e,r,n,s,o,i){const c=new It(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){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:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const _r=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function it(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function at(t,e,r){return t?t.concat(e).map(function(s,o){return s=it(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Or(t){return a.isArray(t)&&!t.some(je)}const xr=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function we(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Or(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=it(b),T.forEach(function(x,v){!(a.isUndefined(x)||x===null)&&e.append(i===!0?at([b],v,o):i===null?b:b+"[]",d(x))}),!1}return je(f)?!0:(e.append(at(h,b,o),d(f)),!1)}const m=[],w=Object.assign(xr,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,w))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function ct(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&we(t,this,e)}const lt=ve.prototype;lt.append=function(e,r){this._pairs.push([e,r])},lt.toString=function(e){const r=e?function(n){return e.call(this,n,ct)}:ct;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Nr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ut(t,e,r){if(!e)return t;const n=r&&r.encode||Nr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class ft{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Cr={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"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Pr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),jr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Pr,hasStandardBrowserWebWorkerEnv:jr,navigator:Ue,origin:vr},Symbol.toStringTag,{value:"Module"})),...Cr};function kr(t,e){return we(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Lr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ur(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function dt(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=Ur(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(Lr(n),s,r,0)}),r}return null}function Ir(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(dt(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return kr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return we(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Ir(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Fr=a.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"]),Br=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
23
|
-
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Fr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},
|
|
24
|
-
`)}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,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ht]=this[ht]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(qr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Fe(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function pt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function mt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function zr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Wr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,w=0;for(;m!==s;)w+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(w*1e3/R):void 0}}function Jr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=Wr(50,250);return Jr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},yt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},bt=t=>(...e)=>a.asap(()=>t(...e)),Vr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,$r=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Yr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function gt(t,e,r){let n=!Kr(e);return t&&(n||r==!1)?Yr(t,e):e}const Et=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,w){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:w},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,w){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,w)}else return n(d,u,m,w)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(Et(d),Et(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,w=m(t[u],e[u],u);a.isUndefined(w)&&m!==c||(r[u]=w)}),r}const wt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ut(gt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Vr(e.url))){const p=s&&o&&$r.read(o);p&&i.set(s,p)}return e},Xr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=wt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,w,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const x=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:t,request:h};mt(function(I){r(I),b()},function(I){n(I),b()},F),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const F=v&&v.message?v.message:"Network Error",z=new g(F,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,F.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,F){h.setRequestHeader(F,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([w,f]=Se(d,!0),h.addEventListener("progress",w)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=x=>{h&&(n(!x||x.type?new fe(null,t,h):x),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=zr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Gr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Qr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Zr=async function*(t,e){for await(const r of en(t))yield*Qr(r,e)},en=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Rt=(t,e,r,n)=>{const s=Zr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let w=o+=m;r(w)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},St=64*1024,{isFunction:Te}=a,tn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Tt,TextEncoder:At}=a.global,_t=(t,...e)=>{try{return!!t(...e)}catch{return!1}},rn=t=>{t=a.merge.call({skipUndefined:!0},tn,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Tt),p=s&&(typeof At=="function"?(f=>b=>f.encode(b))(new At):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&_t(()=>{let f=!1;const b=new r(j.origin,{body:new Tt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&_t(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??w(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:x,timeout:v,onDownloadProgress:F,onUploadProgress:z,responseType:I,headers:he,withCredentials:J="same-origin",fetchOptions:Oe}=wt(f),xe=e||fetch;I=I?(I+"").toLowerCase():"text";let V=Gr([U,x&&x.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),E;if(a.isFormData(T)&&(E=l.headers.get("content-type"))&&he.setContentType(E),l.body){const[A,_]=yt(re,Se(bt(z)));T=Rt(l.body,St,A,_)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={...Oe,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?xe($,Oe):xe(b,pe));const me=u&&(I==="stream"||I==="response");if(u&&(F||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const E=a.toFiniteNumber(M.headers.get("content-length")),[A,_]=F&&yt(E,Se(bt(F),!0))||[];M=new n(Rt(M.body,St,A,()=>{_&&_(),W&&W()}),l)}I=I||"text";let Ne=await m[a.findKey(m,I)||"text"](M,f);return!me&&W&&W(),await new Promise((l,E)=>{mt(l,E,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},nn=new Map,Ot=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=nn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:rn(e)),u=d;return d};Ot();const Be={http:_r,xhr:Xr,fetch:{get:Ot}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const xt=t=>`- ${t}`,sn=t=>a.isFunction(t)||t===null||t===!1;function on(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!sn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
25
|
-
`+i.map(
|
|
26
|
-
`):" "+
|
|
27
|
-
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&_e.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:_e.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),_e.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,w;if(!p){const f=[Ct.bind(this),void 0];for(f.unshift(...c),f.push(...d),w=f.length,u=Promise.resolve(r);m<w;)u=u.then(f[m++],f[m++]);return u}w=c.length;let R=r;for(;m<w;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=Ct.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,w=d.length;m<w;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=gt(e.baseURL,e.url,e.allowAbsoluteUrls);return ut(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let cn=class Ft{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(n.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 r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ft(function(s){e=s}),cancel:e}}};function ln(t){return function(r){return t.apply(null,r)}}function un(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Me).forEach(([t,e])=>{Me[e]=t});function vt(t){const e=new X(t),r=Ge(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return vt(Y(t,s))},r}const O=vt(le);O.Axios=X,O.CanceledError=fe,O.CancelToken=cn,O.isCancel=pt,O.VERSION=Pt,O.toFormData=we,O.AxiosError=g,O.Cancel=O.CanceledError,O.all=function(e){return Promise.all(e)},O.spread=ln,O.isAxiosError=un,O.mergeConfig=Y,O.AxiosHeaders=L,O.formToJSON=t=>dt(a.isHTMLForm(t)?new FormData(t):t),O.getAdapter=Nt.getAdapter,O.HttpStatusCode=Me,O.default=O;const{Axios:jn,AxiosError:vn,CanceledError:kn,isCancel:Ln,CancelToken:Un,VERSION:In,all:Fn,Cancel:Bn,isAxiosError:Dn,spread:Mn,toFormData:Hn,AxiosHeaders:qn,HttpStatusCode:zn,formToJSON:Wn,getAdapter:Jn,mergeConfig:Vn}=O,H=O.create({baseURL:"https://authifyer-backend.onrender.com",headers:{"Content-Type":"application/json"}}),He="authifyer_access_token",qe=t=>{try{t?(localStorage.setItem(He,t),H.defaults.headers.common.Authorization=`Bearer ${t}`):(localStorage.removeItem(He),delete H.defaults.headers.common.Authorization)}catch(e){console.warn("Authifyer: localStorage is not accessible.",e)}},fn=()=>{try{return localStorage.getItem(He)}catch{return null}},ze="authifyer_refresh_token",We=t=>{try{t?localStorage.setItem(ze,t):localStorage.removeItem(ze)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},kt=()=>{try{return localStorage.getItem(ze)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function dn(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function hn(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return dn(e)}catch{return atob(e)}}function pn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=hn(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const Lt=t=>{try{const e=pn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class mn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(H.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners();try{const n=(await H.get(`/public/config/${this.publishableKey}`)).data,s=[];n.isGoogleOauthEnabled&&s.push("google"),n.isGithubOauthEnabled&&s.push("github"),this.config={emailPasswordEnabled:n.isEmailPassEnabled,oauthProviders:s}}catch(r){console.warn("Authifyer: Failed to fetch public project configuration. Using defaults.",r),this.config={emailPasswordEnabled:!0,oauthProviders:["google","github"]}}const e=fn();if(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer())}this.session||await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await H.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await H.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await H.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=kt(),r=await H.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&We(s)}catch{this.clearSession()}}async rotateSession(){try{const e=kt();await H.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&We(e.refreshToken||e.refresh_token)}setSession(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,qe(null),We(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const Ut=S.createContext(void 0),yn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new mn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,w]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),w(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(Ut.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(Ut);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},bn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},gn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},En=()=>{const{client:t}=te();return t},Je=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),wn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],w=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(Je,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:w,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},Rn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),w=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(Je,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(Je,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&w&&y.jsx("div",{className:"authifyer-divider",children:"or"}),w&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=yn,N.SignIn=wn,N.SignUp=Rn,N.useAuth=te,N.useAuthifyer=En,N.useSession=gn,N.useUser=bn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,_,C,ne,C),Ne[C+_]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(E)&&(r(E.key),C=""+E.key),"key"in E){A={};for(var Ke in E)Ke!=="key"&&(A[Ke]=E[Ke])}else A=E;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,$e)}function m(l){w(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?w(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function w(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Oe=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!1,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)},oe.jsxs=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!0,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)}})()),oe}var Ge;function Mt(){return Ge||(Ge=1,process.env.NODE_ENV==="production"?q.exports=Bt():q.exports=Dt()),q.exports}var y=Mt();function Qe(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ht}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Ze}=Symbol,be=(t=>e=>{const r=Ht.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const et=D("ArrayBuffer");function qt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&et(t.buffer),e}const zt=ge("string"),k=ge("function"),tt=ge("number"),ae=t=>t!==null&&typeof t=="object",Wt=t=>t===!0||t===!1,Ee=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ze in t)&&!(ye in t)},Jt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Vt=D("Date"),$t=D("File"),Kt=D("Blob"),Yt=D("FileList"),Xt=t=>ae(t)&&k(t.pipe),Gt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Qt=D("URLSearchParams"),[Zt,er,tr,rr]=["ReadableStream","Request","Response","Headers"].map(D),nr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function rt(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nt=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=nt(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&rt(r,o)||o;Ee(r[i])&&Ee(s)?r[i]=Pe(r[i],s):Ee(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const sr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Qe(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),or=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),ir=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ar=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},cr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},lr=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!tt(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},ur=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),fr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},dr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},hr=D("HTMLFormElement"),pr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),st=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),mr=D("RegExp"),ot=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},yr=t=>{ot(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},br=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},gr=()=>{},Er=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function wr(t){return!!(t&&k(t.append)&&t[Ze]==="FormData"&&t[ye])}const Rr=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Sr=D("AsyncFunction"),Tr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),it=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Ar=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||it,a={isArray:Z,isArrayBuffer:et,isBuffer:ie,isFormData:Gt,isArrayBufferView:qt,isString:zt,isNumber:tt,isBoolean:Wt,isObject:ae,isPlainObject:Ee,isEmptyObject:Jt,isReadableStream:Zt,isRequest:er,isResponse:tr,isHeaders:rr,isUndefined:ee,isDate:Vt,isFile:$t,isBlob:Kt,isRegExp:mr,isFunction:k,isStream:Xt,isURLSearchParams:Qt,isTypedArray:ur,isFileList:Yt,forEach:ce,merge:Pe,extend:sr,trim:nr,stripBOM:or,inherits:ir,toFlatObject:ar,kindOf:be,kindOfTest:D,endsWith:cr,toArray:lr,forEachEntry:fr,matchAll:dr,isHTMLForm:hr,hasOwnProperty:st,hasOwnProp:st,reduceDescriptors:ot,freezeMethods:yr,toObjectSet:br,toCamelCase:pr,noop:gr,toFiniteNumber:Er,findKey:rt,global:K,isContextDefined:nt,isSpecCompliantForm:wr,toJSONObject:Rr,isAsyncFn:Sr,isThenable:Tr,setImmediate:it,asap:Ar,isIterable:t=>t!=null&&k(t[ye])};let g=class It extends Error{static from(e,r,n,s,o,i){const c=new It(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){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:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const _r=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function at(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ct(t,e,r){return t?t.concat(e).map(function(s,o){return s=at(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Or(t){return a.isArray(t)&&!t.some(je)}const xr=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function we(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Or(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=at(b),T.forEach(function(x,v){!(a.isUndefined(x)||x===null)&&e.append(i===!0?ct([b],v,o):i===null?b:b+"[]",d(x))}),!1}return je(f)?!0:(e.append(ct(h,b,o),d(f)),!1)}const m=[],w=Object.assign(xr,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,w))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function lt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&we(t,this,e)}const ut=ve.prototype;ut.append=function(e,r){this._pairs.push([e,r])},ut.toString=function(e){const r=e?function(n){return e.call(this,n,lt)}:lt;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Nr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(t,e,r){if(!e)return t;const n=r&&r.encode||Nr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class dt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Cr={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"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Pr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),jr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Pr,hasStandardBrowserWebWorkerEnv:jr,navigator:Ue,origin:vr},Symbol.toStringTag,{value:"Module"})),...Cr};function kr(t,e){return we(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Lr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ur(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function ht(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=Ur(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(Lr(n),s,r,0)}),r}return null}function Ir(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ht(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return kr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return we(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Ir(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Fr=a.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"]),Br=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
23
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Fr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},pt=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function Dr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Mr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ie(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Hr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function qr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function o(c,p,d){const u=ue(p);if(!u)throw new Error("header name must be a non-empty string");const m=a.findKey(s,u);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||p]=Re(c))}const i=(c,p)=>a.forEach(c,(d,u)=>o(d,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Mr(e))i(Br(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,d;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[d=u[0]]=(p=c[d])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=ue(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Dr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ue(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Ie(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function o(i){if(i=ue(i),i){const c=a.findKey(n,i);c&&(!r||Ie(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!e||Ie(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,o)=>{const i=a.findKey(n,o);if(i){r[i]=Re(s),delete r[o];return}const c=e?Hr(o):String(o).trim();c!==o&&delete r[o],r[c]=Re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
24
|
+
`)}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,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[pt]=this[pt]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(qr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Fe(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function mt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function yt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function zr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Wr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,w=0;for(;m!==s;)w+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(w*1e3/R):void 0}}function Jr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=Wr(50,250);return Jr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},bt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},gt=t=>(...e)=>a.asap(()=>t(...e)),Vr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,$r=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Yr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Et(t,e,r){let n=!Kr(e);return t&&(n||r==!1)?Yr(t,e):e}const wt=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,w){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:w},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,w){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,w)}else return n(d,u,m,w)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(wt(d),wt(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,w=m(t[u],e[u],u);a.isUndefined(w)&&m!==c||(r[u]=w)}),r}const Rt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ft(Et(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Vr(e.url))){const p=s&&o&&$r.read(o);p&&i.set(s,p)}return e},Xr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=Rt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,w,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const x=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:t,request:h};yt(function(I){r(I),b()},function(I){n(I),b()},F),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const F=v&&v.message?v.message:"Network Error",z=new g(F,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,F.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,F){h.setRequestHeader(F,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([w,f]=Se(d,!0),h.addEventListener("progress",w)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=x=>{h&&(n(!x||x.type?new fe(null,t,h):x),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=zr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Gr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Qr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Zr=async function*(t,e){for await(const r of en(t))yield*Qr(r,e)},en=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},St=(t,e,r,n)=>{const s=Zr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let w=o+=m;r(w)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},Tt=64*1024,{isFunction:Te}=a,tn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:At,TextEncoder:_t}=a.global,Ot=(t,...e)=>{try{return!!t(...e)}catch{return!1}},rn=t=>{t=a.merge.call({skipUndefined:!0},tn,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(At),p=s&&(typeof _t=="function"?(f=>b=>f.encode(b))(new _t):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&Ot(()=>{let f=!1;const b=new r(j.origin,{body:new At,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&Ot(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??w(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:x,timeout:v,onDownloadProgress:F,onUploadProgress:z,responseType:I,headers:he,withCredentials:J="same-origin",fetchOptions:Oe}=Rt(f),xe=e||fetch;I=I?(I+"").toLowerCase():"text";let V=Gr([U,x&&x.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),E;if(a.isFormData(T)&&(E=l.headers.get("content-type"))&&he.setContentType(E),l.body){const[A,_]=bt(re,Se(gt(z)));T=St(l.body,Tt,A,_)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={...Oe,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?xe($,Oe):xe(b,pe));const me=u&&(I==="stream"||I==="response");if(u&&(F||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const E=a.toFiniteNumber(M.headers.get("content-length")),[A,_]=F&&bt(E,Se(gt(F),!0))||[];M=new n(St(M.body,Tt,A,()=>{_&&_(),W&&W()}),l)}I=I||"text";let Ne=await m[a.findKey(m,I)||"text"](M,f);return!me&&W&&W(),await new Promise((l,E)=>{yt(l,E,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},nn=new Map,xt=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=nn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:rn(e)),u=d;return d};xt();const Be={http:_r,xhr:Xr,fetch:{get:xt}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Nt=t=>`- ${t}`,sn=t=>a.isFunction(t)||t===null||t===!1;function on(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!sn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
25
|
+
`+i.map(Nt).join(`
|
|
26
|
+
`):" "+Nt(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Ct={getAdapter:on,adapters:Be};function De(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function Pt(t){return De(t),t.headers=L.from(t.headers),t.data=Fe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Ct.getAdapter(t.adapter||le.adapter,t)(t).then(function(n){return De(t),n.data=Fe.call(t,t.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return mt(n)||(De(t),n&&n.response&&(n.response.data=Fe.call(t,t.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const jt="1.13.5",Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const vt={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+jt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!vt[i]&&(vt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}},Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function an(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const o=n[s],i=e[o];if(i){const c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const _e={assertOptions:an,validators:Ae},B=_e.validators;let X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dt,response:new dt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
27
|
+
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&_e.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:_e.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),_e.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,w;if(!p){const f=[Pt.bind(this),void 0];for(f.unshift(...c),f.push(...d),w=f.length,u=Promise.resolve(r);m<w;)u=u.then(f[m++],f[m++]);return u}w=c.length;let R=r;for(;m<w;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=Pt.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,w=d.length;m<w;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=Et(e.baseURL,e.url,e.allowAbsoluteUrls);return ft(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let cn=class Ft{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(n.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 r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ft(function(s){e=s}),cancel:e}}};function ln(t){return function(r){return t.apply(null,r)}}function un(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Me).forEach(([t,e])=>{Me[e]=t});function kt(t){const e=new X(t),r=Qe(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return kt(Y(t,s))},r}const O=kt(le);O.Axios=X,O.CanceledError=fe,O.CancelToken=cn,O.isCancel=mt,O.VERSION=jt,O.toFormData=we,O.AxiosError=g,O.Cancel=O.CanceledError,O.all=function(e){return Promise.all(e)},O.spread=ln,O.isAxiosError=un,O.mergeConfig=Y,O.AxiosHeaders=L,O.formToJSON=t=>ht(a.isHTMLForm(t)?new FormData(t):t),O.getAdapter=Ct.getAdapter,O.HttpStatusCode=Me,O.default=O;const{Axios:jn,AxiosError:vn,CanceledError:kn,isCancel:Ln,CancelToken:Un,VERSION:In,all:Fn,Cancel:Bn,isAxiosError:Dn,spread:Mn,toFormData:Hn,AxiosHeaders:qn,HttpStatusCode:zn,formToJSON:Wn,getAdapter:Jn,mergeConfig:Vn}=O,H=O.create({baseURL:"https://authifyer-backend.onrender.com",headers:{"Content-Type":"application/json"}}),He="authifyer_access_token",qe=t=>{try{t?(localStorage.setItem(He,t),H.defaults.headers.common.Authorization=`Bearer ${t}`):(localStorage.removeItem(He),delete H.defaults.headers.common.Authorization)}catch(e){console.warn("Authifyer: localStorage is not accessible.",e)}},fn=()=>{try{return localStorage.getItem(He)}catch{return null}},ze="authifyer_refresh_token",We=t=>{try{t?localStorage.setItem(ze,t):localStorage.removeItem(ze)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},Je=()=>{try{return localStorage.getItem(ze)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function dn(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function hn(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return dn(e)}catch{return atob(e)}}function pn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=hn(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const Lt=t=>{try{const e=pn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class mn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(H.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners();try{const n=(await H.get(`/public/config/${this.publishableKey}`)).data,s=[];n.isGoogleOauthEnabled&&s.push("google"),n.isGithubOauthEnabled&&s.push("github"),this.config={emailPasswordEnabled:n.isEmailPassEnabled,oauthProviders:s}}catch(r){console.warn("Authifyer: Failed to fetch public project configuration. Using defaults.",r),this.config={emailPasswordEnabled:!0,oauthProviders:["google","github"]}}const e=fn();if(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer())}this.session||await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await H.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await H.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{const e=Je();await H.post("/authifyer/session/logout",{refresh_token:e||void 0})}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=Je();if(!e){this.clearSession();return}const r=await H.post("/authifyer/jwt/refresh-jwt",{refresh_token:e}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&We(s)}catch{this.clearSession()}}async rotateSession(){try{const e=Je();await H.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&We(e.refreshToken||e.refresh_token)}setSession(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,qe(null),We(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const Ut=S.createContext(void 0),yn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new mn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,w]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),w(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(Ut.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(Ut);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},bn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},gn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},En=()=>{const{client:t}=te();return t},Ve=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),wn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],w=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(Ve,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:w,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},Rn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),w=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(Ve,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(Ve,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&w&&y.jsx("div",{className:"authifyer-divider",children:"or"}),w&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=yn,N.SignIn=wn,N.SignUp=Rn,N.useAuth=te,N.useAuthifyer=En,N.useSession=gn,N.useUser=bn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
package/src/core/client.ts
CHANGED
|
@@ -103,7 +103,10 @@ export class AuthifyerClient {
|
|
|
103
103
|
|
|
104
104
|
public async signOut(): Promise<void> {
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
const currentRefreshToken = getRefreshToken();
|
|
107
|
+
await api.post('/authifyer/session/logout', {
|
|
108
|
+
refresh_token: currentRefreshToken || undefined
|
|
109
|
+
});
|
|
107
110
|
} catch (e) {
|
|
108
111
|
console.warn("Logout failed", e);
|
|
109
112
|
} finally {
|
|
@@ -125,9 +128,16 @@ export class AuthifyerClient {
|
|
|
125
128
|
try {
|
|
126
129
|
const currentRefreshToken = getRefreshToken();
|
|
127
130
|
|
|
131
|
+
if (!currentRefreshToken) {
|
|
132
|
+
// If there is no refresh token natively available, we cannot refresh.
|
|
133
|
+
// Avoid calling the backend to prevent unnecessary 401 Unauthorized errors.
|
|
134
|
+
this.clearSession();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
128
138
|
// Retrieve new short-lived JWT using the refresh_token from local storage
|
|
129
139
|
const response = await api.post('/authifyer/jwt/refresh-jwt', {
|
|
130
|
-
refresh_token: currentRefreshToken
|
|
140
|
+
refresh_token: currentRefreshToken
|
|
131
141
|
});
|
|
132
142
|
|
|
133
143
|
const { access_token, refresh_token } = response.data;
|