authifyer-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2531 @@
1
+ var Ft = Object.defineProperty;
2
+ var It = (t, e, r) => e in t ? Ft(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var V = (t, e, r) => It(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import Bt, { createContext as Dt, useMemo as qt, useState as F, useEffect as Mt, useContext as Ht } from "react";
5
+ var be = { exports: {} }, se = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var We;
16
+ function $t() {
17
+ if (We) return se;
18
+ We = 1;
19
+ var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
+ function r(n, s, o) {
21
+ var i = null;
22
+ if (o !== void 0 && (i = "" + o), s.key !== void 0 && (i = "" + s.key), "key" in s) {
23
+ o = {};
24
+ for (var c in s)
25
+ c !== "key" && (o[c] = s[c]);
26
+ } else o = s;
27
+ return s = o.ref, {
28
+ $$typeof: t,
29
+ type: n,
30
+ key: i,
31
+ ref: s !== void 0 ? s : null,
32
+ props: o
33
+ };
34
+ }
35
+ return se.Fragment = e, se.jsx = r, se.jsxs = r, se;
36
+ }
37
+ var oe = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var Je;
48
+ function zt() {
49
+ return Je || (Je = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function t(l) {
51
+ if (l == null) return null;
52
+ if (typeof l == "function")
53
+ return l.$$typeof === me ? null : l.displayName || l.name || null;
54
+ if (typeof l == "string") return l;
55
+ switch (l) {
56
+ case h:
57
+ return "Fragment";
58
+ case j:
59
+ return "Profiler";
60
+ case S:
61
+ return "StrictMode";
62
+ case q:
63
+ return "Suspense";
64
+ case v:
65
+ return "SuspenseList";
66
+ case pe:
67
+ return "Activity";
68
+ }
69
+ if (typeof l == "object")
70
+ switch (typeof l.tag == "number" && console.error(
71
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
+ ), l.$$typeof) {
73
+ case y:
74
+ return "Portal";
75
+ case C:
76
+ return l.displayName || "Context";
77
+ case _:
78
+ return (l._context.displayName || "Context") + ".Consumer";
79
+ case U:
80
+ var w = l.render;
81
+ return l = l.displayName, l || (l = w.displayName || w.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
82
+ case te:
83
+ return w = l.displayName || null, w !== null ? w : t(l.type) || "Memo";
84
+ case $:
85
+ w = l._payload, l = l._init;
86
+ try {
87
+ return t(l(w));
88
+ } catch {
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function e(l) {
94
+ return "" + l;
95
+ }
96
+ function r(l) {
97
+ try {
98
+ e(l);
99
+ var w = !1;
100
+ } catch {
101
+ w = !0;
102
+ }
103
+ if (w) {
104
+ w = console;
105
+ var T = w.error, A = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object";
106
+ return T.call(
107
+ w,
108
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
+ A
110
+ ), e(l);
111
+ }
112
+ }
113
+ function n(l) {
114
+ if (l === h) return "<>";
115
+ if (typeof l == "object" && l !== null && l.$$typeof === $)
116
+ return "<...>";
117
+ try {
118
+ var w = t(l);
119
+ return w ? "<" + w + ">" : "<...>";
120
+ } catch {
121
+ return "<...>";
122
+ }
123
+ }
124
+ function s() {
125
+ var l = z.A;
126
+ return l === null ? null : l.getOwner();
127
+ }
128
+ function o() {
129
+ return Error("react-stack-top-frame");
130
+ }
131
+ function i(l) {
132
+ if (W.call(l, "key")) {
133
+ var w = Object.getOwnPropertyDescriptor(l, "key").get;
134
+ if (w && w.isReactWarning) return !1;
135
+ }
136
+ return l.key !== void 0;
137
+ }
138
+ function c(l, w) {
139
+ function T() {
140
+ N || (N = !0, console.error(
141
+ "%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)",
142
+ w
143
+ ));
144
+ }
145
+ T.isReactWarning = !0, Object.defineProperty(l, "key", {
146
+ get: T,
147
+ configurable: !0
148
+ });
149
+ }
150
+ function p() {
151
+ var l = t(this.type);
152
+ return re[l] || (re[l] = !0, console.error(
153
+ "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."
154
+ )), l = this.props.ref, l !== void 0 ? l : null;
155
+ }
156
+ function d(l, w, T, A, J, Ne) {
157
+ var O = T.ref;
158
+ return l = {
159
+ $$typeof: f,
160
+ type: l,
161
+ key: w,
162
+ props: T,
163
+ _owner: A
164
+ }, (O !== void 0 ? O : null) !== null ? Object.defineProperty(l, "ref", {
165
+ enumerable: !1,
166
+ get: p
167
+ }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
168
+ configurable: !1,
169
+ enumerable: !1,
170
+ writable: !0,
171
+ value: 0
172
+ }), Object.defineProperty(l, "_debugInfo", {
173
+ configurable: !1,
174
+ enumerable: !1,
175
+ writable: !0,
176
+ value: null
177
+ }), Object.defineProperty(l, "_debugStack", {
178
+ configurable: !1,
179
+ enumerable: !1,
180
+ writable: !0,
181
+ value: J
182
+ }), Object.defineProperty(l, "_debugTask", {
183
+ configurable: !1,
184
+ enumerable: !1,
185
+ writable: !0,
186
+ value: Ne
187
+ }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
188
+ }
189
+ function u(l, w, T, A, J, Ne) {
190
+ var O = w.children;
191
+ if (O !== void 0)
192
+ if (A)
193
+ if (M(O)) {
194
+ for (A = 0; A < O.length; A++)
195
+ m(O[A]);
196
+ Object.freeze && Object.freeze(O);
197
+ } else
198
+ console.error(
199
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
200
+ );
201
+ else m(O);
202
+ if (W.call(w, "key")) {
203
+ O = t(l);
204
+ var Q = Object.keys(w).filter(function(Ut) {
205
+ return Ut !== "key";
206
+ });
207
+ A = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", ye[O + A] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
208
+ `A props object containing a "key" prop is being spread into JSX:
209
+ let props = %s;
210
+ <%s {...props} />
211
+ React keys must be passed directly to JSX without using spread:
212
+ let props = %s;
213
+ <%s key={someKey} {...props} />`,
214
+ A,
215
+ O,
216
+ Q,
217
+ O
218
+ ), ye[O + A] = !0);
219
+ }
220
+ if (O = null, T !== void 0 && (r(T), O = "" + T), i(w) && (r(w.key), O = "" + w.key), "key" in w) {
221
+ T = {};
222
+ for (var Ce in w)
223
+ Ce !== "key" && (T[Ce] = w[Ce]);
224
+ } else T = w;
225
+ return O && c(
226
+ T,
227
+ typeof l == "function" ? l.displayName || l.name || "Unknown" : l
228
+ ), d(
229
+ l,
230
+ O,
231
+ T,
232
+ s(),
233
+ J,
234
+ Ne
235
+ );
236
+ }
237
+ function m(l) {
238
+ E(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === $ && (l._payload.status === "fulfilled" ? E(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
239
+ }
240
+ function E(l) {
241
+ return typeof l == "object" && l !== null && l.$$typeof === f;
242
+ }
243
+ var R = Bt, f = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), C = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), pe = Symbol.for("react.activity"), me = Symbol.for("react.client.reference"), z = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, M = Array.isArray, G = console.createTask ? console.createTask : function() {
244
+ return null;
245
+ };
246
+ R = {
247
+ react_stack_bottom_frame: function(l) {
248
+ return l();
249
+ }
250
+ };
251
+ var N, re = {}, B = R.react_stack_bottom_frame.bind(
252
+ R,
253
+ o
254
+ )(), ne = G(n(o)), ye = {};
255
+ oe.Fragment = h, oe.jsx = function(l, w, T) {
256
+ var A = 1e4 > z.recentlyCreatedOwnerStacks++;
257
+ return u(
258
+ l,
259
+ w,
260
+ T,
261
+ !1,
262
+ A ? Error("react-stack-top-frame") : B,
263
+ A ? G(n(l)) : ne
264
+ );
265
+ }, oe.jsxs = function(l, w, T) {
266
+ var A = 1e4 > z.recentlyCreatedOwnerStacks++;
267
+ return u(
268
+ l,
269
+ w,
270
+ T,
271
+ !0,
272
+ A ? Error("react-stack-top-frame") : B,
273
+ A ? G(n(l)) : ne
274
+ );
275
+ };
276
+ })()), oe;
277
+ }
278
+ var Ve;
279
+ function Wt() {
280
+ return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? be.exports = $t() : be.exports = zt()), be.exports;
281
+ }
282
+ var b = Wt();
283
+ function dt(t, e) {
284
+ return function() {
285
+ return t.apply(e, arguments);
286
+ };
287
+ }
288
+ const { toString: Jt } = Object.prototype, { getPrototypeOf: qe } = Object, { iterator: Te, toStringTag: ht } = Symbol, Ae = /* @__PURE__ */ ((t) => (e) => {
289
+ const r = Jt.call(e);
290
+ return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
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");
292
+ function ce(t) {
293
+ return t !== null && !Z(t) && t.constructor !== null && !Z(t.constructor) && k(t.constructor.isBuffer) && t.constructor.isBuffer(t);
294
+ }
295
+ const pt = D("ArrayBuffer");
296
+ function Vt(t) {
297
+ let e;
298
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && pt(t.buffer), e;
299
+ }
300
+ const Yt = xe("string"), k = xe("function"), mt = xe("number"), le = (t) => t !== null && typeof t == "object", Kt = (t) => t === !0 || t === !1, we = (t) => {
301
+ if (Ae(t) !== "object")
302
+ return !1;
303
+ const e = qe(t);
304
+ return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(ht in t) && !(Te in t);
305
+ }, Xt = (t) => {
306
+ if (!le(t) || ce(t))
307
+ return !1;
308
+ try {
309
+ return Object.keys(t).length === 0 && Object.getPrototypeOf(t) === Object.prototype;
310
+ } catch {
311
+ return !1;
312
+ }
313
+ }, Gt = D("Date"), Qt = D("File"), Zt = D("Blob"), er = D("FileList"), tr = (t) => le(t) && k(t.pipe), rr = (t) => {
314
+ let e;
315
+ return t && (typeof FormData == "function" && t instanceof FormData || k(t.append) && ((e = Ae(t)) === "formdata" || // detect form-data instance
316
+ e === "object" && k(t.toString) && t.toString() === "[object FormData]"));
317
+ }, nr = D("URLSearchParams"), [sr, or, ir, ar] = [
318
+ "ReadableStream",
319
+ "Request",
320
+ "Response",
321
+ "Headers"
322
+ ].map(D), cr = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
323
+ function ue(t, e, { allOwnKeys: r = !1 } = {}) {
324
+ if (t === null || typeof t > "u")
325
+ return;
326
+ let n, s;
327
+ if (typeof t != "object" && (t = [t]), ee(t))
328
+ for (n = 0, s = t.length; n < s; n++)
329
+ e.call(null, t[n], n, t);
330
+ else {
331
+ if (ce(t))
332
+ return;
333
+ const o = r ? Object.getOwnPropertyNames(t) : Object.keys(t), i = o.length;
334
+ let c;
335
+ for (n = 0; n < i; n++)
336
+ c = o[n], e.call(null, t[c], c, t);
337
+ }
338
+ }
339
+ function yt(t, e) {
340
+ if (ce(t))
341
+ return null;
342
+ e = e.toLowerCase();
343
+ const r = Object.keys(t);
344
+ let n = r.length, s;
345
+ for (; n-- > 0; )
346
+ if (s = r[n], e === s.toLowerCase())
347
+ return s;
348
+ return null;
349
+ }
350
+ const Y = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, bt = (t) => !Z(t) && t !== Y;
351
+ function Le() {
352
+ const { caseless: t, skipUndefined: e } = bt(this) && this || {}, r = {}, n = (s, o) => {
353
+ if (o === "__proto__" || o === "constructor" || o === "prototype")
354
+ return;
355
+ const i = t && yt(r, o) || o;
356
+ we(r[i]) && we(s) ? r[i] = Le(r[i], s) : we(s) ? r[i] = Le({}, s) : ee(s) ? r[i] = s.slice() : (!e || !Z(s)) && (r[i] = s);
357
+ };
358
+ for (let s = 0, o = arguments.length; s < o; s++)
359
+ arguments[s] && ue(arguments[s], n);
360
+ return r;
361
+ }
362
+ const lr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
363
+ e,
364
+ (s, o) => {
365
+ r && k(s) ? Object.defineProperty(t, o, {
366
+ value: dt(s, r),
367
+ writable: !0,
368
+ enumerable: !0,
369
+ configurable: !0
370
+ }) : Object.defineProperty(t, o, {
371
+ value: s,
372
+ writable: !0,
373
+ enumerable: !0,
374
+ configurable: !0
375
+ });
376
+ },
377
+ { allOwnKeys: n }
378
+ ), t), ur = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), fr = (t, e, r, n) => {
379
+ t.prototype = Object.create(
380
+ e.prototype,
381
+ n
382
+ ), Object.defineProperty(t.prototype, "constructor", {
383
+ value: t,
384
+ writable: !0,
385
+ enumerable: !1,
386
+ configurable: !0
387
+ }), Object.defineProperty(t, "super", {
388
+ value: e.prototype
389
+ }), r && Object.assign(t.prototype, r);
390
+ }, dr = (t, e, r, n) => {
391
+ let s, o, i;
392
+ const c = {};
393
+ if (e = e || {}, t == null) return e;
394
+ do {
395
+ for (s = Object.getOwnPropertyNames(t), o = s.length; o-- > 0; )
396
+ i = s[o], (!n || n(i, t, e)) && !c[i] && (e[i] = t[i], c[i] = !0);
397
+ t = r !== !1 && qe(t);
398
+ } while (t && (!r || r(t, e)) && t !== Object.prototype);
399
+ return e;
400
+ }, hr = (t, e, r) => {
401
+ t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
402
+ const n = t.indexOf(e, r);
403
+ return n !== -1 && n === r;
404
+ }, pr = (t) => {
405
+ if (!t) return null;
406
+ if (ee(t)) return t;
407
+ let e = t.length;
408
+ if (!mt(e)) return null;
409
+ const r = new Array(e);
410
+ for (; e-- > 0; )
411
+ r[e] = t[e];
412
+ return r;
413
+ }, mr = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && qe(Uint8Array)), yr = (t, e) => {
414
+ const n = (t && t[Te]).call(t);
415
+ let s;
416
+ for (; (s = n.next()) && !s.done; ) {
417
+ const o = s.value;
418
+ e.call(t, o[0], o[1]);
419
+ }
420
+ }, br = (t, e) => {
421
+ let r;
422
+ const n = [];
423
+ for (; (r = t.exec(e)) !== null; )
424
+ n.push(r);
425
+ return n;
426
+ }, gr = D("HTMLFormElement"), wr = (t) => t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(r, n, s) {
427
+ return n.toUpperCase() + s;
428
+ }), Ye = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Er = D("RegExp"), gt = (t, e) => {
429
+ const r = Object.getOwnPropertyDescriptors(t), n = {};
430
+ ue(r, (s, o) => {
431
+ let i;
432
+ (i = e(s, o, t)) !== !1 && (n[o] = i || s);
433
+ }), Object.defineProperties(t, n);
434
+ }, Rr = (t) => {
435
+ gt(t, (e, r) => {
436
+ if (k(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
437
+ return !1;
438
+ const n = t[r];
439
+ if (k(n)) {
440
+ if (e.enumerable = !1, "writable" in e) {
441
+ e.writable = !1;
442
+ return;
443
+ }
444
+ e.set || (e.set = () => {
445
+ throw Error("Can not rewrite read-only method '" + r + "'");
446
+ });
447
+ }
448
+ });
449
+ }, Sr = (t, e) => {
450
+ const r = {}, n = (s) => {
451
+ s.forEach((o) => {
452
+ r[o] = !0;
453
+ });
454
+ };
455
+ return ee(t) ? n(t) : n(String(t).split(e)), r;
456
+ }, Tr = () => {
457
+ }, Ar = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
458
+ function xr(t) {
459
+ return !!(t && k(t.append) && t[ht] === "FormData" && t[Te]);
460
+ }
461
+ const _r = (t) => {
462
+ const e = new Array(10), r = (n, s) => {
463
+ if (le(n)) {
464
+ if (e.indexOf(n) >= 0)
465
+ return;
466
+ if (ce(n))
467
+ return n;
468
+ if (!("toJSON" in n)) {
469
+ e[s] = n;
470
+ const o = ee(n) ? [] : {};
471
+ return ue(n, (i, c) => {
472
+ const p = r(i, s + 1);
473
+ !Z(p) && (o[c] = p);
474
+ }), e[s] = void 0, o;
475
+ }
476
+ }
477
+ return n;
478
+ };
479
+ return r(t, 0);
480
+ }, Or = D("AsyncFunction"), Nr = (t) => t && (le(t) || k(t)) && k(t.then) && k(t.catch), wt = ((t, e) => t ? setImmediate : e ? ((r, n) => (Y.addEventListener(
481
+ "message",
482
+ ({ source: s, data: o }) => {
483
+ s === Y && o === r && n.length && n.shift()();
484
+ },
485
+ !1
486
+ ), (s) => {
487
+ n.push(s), Y.postMessage(r, "*");
488
+ }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(typeof setImmediate == "function", k(Y.postMessage)), Cr = typeof queueMicrotask < "u" ? queueMicrotask.bind(Y) : typeof process < "u" && process.nextTick || wt, Pr = (t) => t != null && k(t[Te]), a = {
489
+ isArray: ee,
490
+ isArrayBuffer: pt,
491
+ isBuffer: ce,
492
+ isFormData: rr,
493
+ isArrayBufferView: Vt,
494
+ isString: Yt,
495
+ isNumber: mt,
496
+ isBoolean: Kt,
497
+ isObject: le,
498
+ isPlainObject: we,
499
+ isEmptyObject: Xt,
500
+ isReadableStream: sr,
501
+ isRequest: or,
502
+ isResponse: ir,
503
+ isHeaders: ar,
504
+ isUndefined: Z,
505
+ isDate: Gt,
506
+ isFile: Qt,
507
+ isBlob: Zt,
508
+ isRegExp: Er,
509
+ isFunction: k,
510
+ isStream: tr,
511
+ isURLSearchParams: nr,
512
+ isTypedArray: mr,
513
+ isFileList: er,
514
+ forEach: ue,
515
+ merge: Le,
516
+ extend: lr,
517
+ trim: cr,
518
+ stripBOM: ur,
519
+ inherits: fr,
520
+ toFlatObject: dr,
521
+ kindOf: Ae,
522
+ kindOfTest: D,
523
+ endsWith: hr,
524
+ toArray: pr,
525
+ forEachEntry: yr,
526
+ matchAll: br,
527
+ isHTMLForm: gr,
528
+ hasOwnProperty: Ye,
529
+ hasOwnProp: Ye,
530
+ // an alias to avoid ESLint no-prototype-builtins detection
531
+ reduceDescriptors: gt,
532
+ freezeMethods: Rr,
533
+ toObjectSet: Sr,
534
+ toCamelCase: wr,
535
+ noop: Tr,
536
+ toFiniteNumber: Ar,
537
+ findKey: yt,
538
+ global: Y,
539
+ isContextDefined: bt,
540
+ isSpecCompliantForm: xr,
541
+ toJSONObject: _r,
542
+ isAsyncFn: Or,
543
+ isThenable: Nr,
544
+ setImmediate: wt,
545
+ asap: Cr,
546
+ isIterable: Pr
547
+ };
548
+ let g = class Et extends Error {
549
+ static from(e, r, n, s, o, i) {
550
+ const c = new Et(e.message, r || e.code, n, s, o);
551
+ return c.cause = e, c.name = e.name, i && Object.assign(c, i), c;
552
+ }
553
+ /**
554
+ * Create an Error with the specified message, config, error code, request and response.
555
+ *
556
+ * @param {string} message The error message.
557
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
558
+ * @param {Object} [config] The config.
559
+ * @param {Object} [request] The request.
560
+ * @param {Object} [response] The response.
561
+ *
562
+ * @returns {Error} The created error.
563
+ */
564
+ constructor(e, r, n, s, o) {
565
+ 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);
566
+ }
567
+ toJSON() {
568
+ return {
569
+ // Standard
570
+ message: this.message,
571
+ name: this.name,
572
+ // Microsoft
573
+ description: this.description,
574
+ number: this.number,
575
+ // Mozilla
576
+ fileName: this.fileName,
577
+ lineNumber: this.lineNumber,
578
+ columnNumber: this.columnNumber,
579
+ stack: this.stack,
580
+ // Axios
581
+ config: a.toJSONObject(this.config),
582
+ code: this.code,
583
+ status: this.status
584
+ };
585
+ }
586
+ };
587
+ g.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
588
+ g.ERR_BAD_OPTION = "ERR_BAD_OPTION";
589
+ g.ECONNABORTED = "ECONNABORTED";
590
+ g.ETIMEDOUT = "ETIMEDOUT";
591
+ g.ERR_NETWORK = "ERR_NETWORK";
592
+ g.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
593
+ g.ERR_DEPRECATED = "ERR_DEPRECATED";
594
+ g.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
595
+ g.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
596
+ g.ERR_CANCELED = "ERR_CANCELED";
597
+ g.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
598
+ g.ERR_INVALID_URL = "ERR_INVALID_URL";
599
+ const jr = null;
600
+ function Ue(t) {
601
+ return a.isPlainObject(t) || a.isArray(t);
602
+ }
603
+ function Rt(t) {
604
+ return a.endsWith(t, "[]") ? t.slice(0, -2) : t;
605
+ }
606
+ function Ke(t, e, r) {
607
+ return t ? t.concat(e).map(function(s, o) {
608
+ return s = Rt(s), !r && o ? "[" + s + "]" : s;
609
+ }).join(r ? "." : "") : e;
610
+ }
611
+ function vr(t) {
612
+ return a.isArray(t) && !t.some(Ue);
613
+ }
614
+ const kr = a.toFlatObject(a, {}, null, function(e) {
615
+ return /^is[A-Z]/.test(e);
616
+ });
617
+ function _e(t, e, r) {
618
+ if (!a.isObject(t))
619
+ throw new TypeError("target must be an object");
620
+ e = e || new FormData(), r = a.toFlatObject(r, {
621
+ metaTokens: !0,
622
+ dots: !1,
623
+ indexes: !1
624
+ }, !1, function(y, h) {
625
+ return !a.isUndefined(h[y]);
626
+ });
627
+ const n = r.metaTokens, s = r.visitor || u, o = r.dots, i = r.indexes, p = (r.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(e);
628
+ if (!a.isFunction(s))
629
+ throw new TypeError("visitor must be a function");
630
+ function d(f) {
631
+ if (f === null) return "";
632
+ if (a.isDate(f))
633
+ return f.toISOString();
634
+ if (a.isBoolean(f))
635
+ return f.toString();
636
+ if (!p && a.isBlob(f))
637
+ throw new g("Blob is not supported. Use a Buffer instead.");
638
+ return a.isArrayBuffer(f) || a.isTypedArray(f) ? p && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
639
+ }
640
+ function u(f, y, h) {
641
+ let S = f;
642
+ if (f && !h && typeof f == "object") {
643
+ if (a.endsWith(y, "{}"))
644
+ y = n ? y : y.slice(0, -2), f = JSON.stringify(f);
645
+ else if (a.isArray(f) && vr(f) || (a.isFileList(f) || a.endsWith(y, "[]")) && (S = a.toArray(f)))
646
+ return y = Rt(y), S.forEach(function(_, C) {
647
+ !(a.isUndefined(_) || _ === null) && e.append(
648
+ // eslint-disable-next-line no-nested-ternary
649
+ i === !0 ? Ke([y], C, o) : i === null ? y : y + "[]",
650
+ d(_)
651
+ );
652
+ }), !1;
653
+ }
654
+ return Ue(f) ? !0 : (e.append(Ke(h, y, o), d(f)), !1);
655
+ }
656
+ const m = [], E = Object.assign(kr, {
657
+ defaultVisitor: u,
658
+ convertValue: d,
659
+ isVisitable: Ue
660
+ });
661
+ function R(f, y) {
662
+ if (!a.isUndefined(f)) {
663
+ if (m.indexOf(f) !== -1)
664
+ throw Error("Circular reference detected in " + y.join("."));
665
+ m.push(f), a.forEach(f, function(S, j) {
666
+ (!(a.isUndefined(S) || S === null) && s.call(
667
+ e,
668
+ S,
669
+ a.isString(j) ? j.trim() : j,
670
+ y,
671
+ E
672
+ )) === !0 && R(S, y ? y.concat(j) : [j]);
673
+ }), m.pop();
674
+ }
675
+ }
676
+ if (!a.isObject(t))
677
+ throw new TypeError("data must be an object");
678
+ return R(t), e;
679
+ }
680
+ function Xe(t) {
681
+ const e = {
682
+ "!": "%21",
683
+ "'": "%27",
684
+ "(": "%28",
685
+ ")": "%29",
686
+ "~": "%7E",
687
+ "%20": "+",
688
+ "%00": "\0"
689
+ };
690
+ return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) {
691
+ return e[n];
692
+ });
693
+ }
694
+ function Me(t, e) {
695
+ this._pairs = [], t && _e(t, this, e);
696
+ }
697
+ const St = Me.prototype;
698
+ St.append = function(e, r) {
699
+ this._pairs.push([e, r]);
700
+ };
701
+ St.toString = function(e) {
702
+ const r = e ? function(n) {
703
+ return e.call(this, n, Xe);
704
+ } : Xe;
705
+ return this._pairs.map(function(s) {
706
+ return r(s[0]) + "=" + r(s[1]);
707
+ }, "").join("&");
708
+ };
709
+ function Lr(t) {
710
+ return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
711
+ }
712
+ function Tt(t, e, r) {
713
+ if (!e)
714
+ return t;
715
+ const n = r && r.encode || Lr, s = a.isFunction(r) ? {
716
+ serialize: r
717
+ } : r, o = s && s.serialize;
718
+ let i;
719
+ if (o ? i = o(e, s) : i = a.isURLSearchParams(e) ? e.toString() : new Me(e, s).toString(n), i) {
720
+ const c = t.indexOf("#");
721
+ c !== -1 && (t = t.slice(0, c)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
722
+ }
723
+ return t;
724
+ }
725
+ class Ge {
726
+ constructor() {
727
+ this.handlers = [];
728
+ }
729
+ /**
730
+ * Add a new interceptor to the stack
731
+ *
732
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
733
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
734
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
735
+ *
736
+ * @return {Number} An ID used to remove interceptor later
737
+ */
738
+ use(e, r, n) {
739
+ return this.handlers.push({
740
+ fulfilled: e,
741
+ rejected: r,
742
+ synchronous: n ? n.synchronous : !1,
743
+ runWhen: n ? n.runWhen : null
744
+ }), this.handlers.length - 1;
745
+ }
746
+ /**
747
+ * Remove an interceptor from the stack
748
+ *
749
+ * @param {Number} id The ID that was returned by `use`
750
+ *
751
+ * @returns {void}
752
+ */
753
+ eject(e) {
754
+ this.handlers[e] && (this.handlers[e] = null);
755
+ }
756
+ /**
757
+ * Clear all interceptors from the stack
758
+ *
759
+ * @returns {void}
760
+ */
761
+ clear() {
762
+ this.handlers && (this.handlers = []);
763
+ }
764
+ /**
765
+ * Iterate over all the registered interceptors
766
+ *
767
+ * This method is particularly useful for skipping over any
768
+ * interceptors that may have become `null` calling `eject`.
769
+ *
770
+ * @param {Function} fn The function to call for each interceptor
771
+ *
772
+ * @returns {void}
773
+ */
774
+ forEach(e) {
775
+ a.forEach(this.handlers, function(n) {
776
+ n !== null && e(n);
777
+ });
778
+ }
779
+ }
780
+ const He = {
781
+ silentJSONParsing: !0,
782
+ forcedJSONParsing: !0,
783
+ clarifyTimeoutError: !1,
784
+ legacyInterceptorReqResOrdering: !0
785
+ }, Ur = typeof URLSearchParams < "u" ? URLSearchParams : Me, Fr = typeof FormData < "u" ? FormData : null, Ir = typeof Blob < "u" ? Blob : null, Br = {
786
+ isBrowser: !0,
787
+ classes: {
788
+ URLSearchParams: Ur,
789
+ FormData: Fr,
790
+ Blob: Ir
791
+ },
792
+ protocols: ["http", "https", "file", "blob", "url", "data"]
793
+ }, $e = typeof window < "u" && typeof document < "u", Fe = typeof navigator == "object" && navigator || void 0, Dr = $e && (!Fe || ["ReactNative", "NativeScript", "NS"].indexOf(Fe.product) < 0), qr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
794
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Mr = $e && window.location.href || "http://localhost", Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
795
+ __proto__: null,
796
+ hasBrowserEnv: $e,
797
+ hasStandardBrowserEnv: Dr,
798
+ hasStandardBrowserWebWorkerEnv: qr,
799
+ navigator: Fe,
800
+ origin: Mr
801
+ }, Symbol.toStringTag, { value: "Module" })), P = {
802
+ ...Hr,
803
+ ...Br
804
+ };
805
+ function $r(t, e) {
806
+ return _e(t, new P.classes.URLSearchParams(), {
807
+ visitor: function(r, n, s, o) {
808
+ return P.isNode && a.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
809
+ },
810
+ ...e
811
+ });
812
+ }
813
+ function zr(t) {
814
+ return a.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
815
+ }
816
+ function Wr(t) {
817
+ const e = {}, r = Object.keys(t);
818
+ let n;
819
+ const s = r.length;
820
+ let o;
821
+ for (n = 0; n < s; n++)
822
+ o = r[n], e[o] = t[o];
823
+ return e;
824
+ }
825
+ function At(t) {
826
+ function e(r, n, s, o) {
827
+ let i = r[o++];
828
+ if (i === "__proto__") return !0;
829
+ const c = Number.isFinite(+i), p = o >= r.length;
830
+ 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] = Wr(s[i])), !c);
831
+ }
832
+ if (a.isFormData(t) && a.isFunction(t.entries)) {
833
+ const r = {};
834
+ return a.forEachEntry(t, (n, s) => {
835
+ e(zr(n), s, r, 0);
836
+ }), r;
837
+ }
838
+ return null;
839
+ }
840
+ function Jr(t, e, r) {
841
+ if (a.isString(t))
842
+ try {
843
+ return (e || JSON.parse)(t), a.trim(t);
844
+ } catch (n) {
845
+ if (n.name !== "SyntaxError")
846
+ throw n;
847
+ }
848
+ return (r || JSON.stringify)(t);
849
+ }
850
+ const fe = {
851
+ transitional: He,
852
+ adapter: ["xhr", "http", "fetch"],
853
+ transformRequest: [function(e, r) {
854
+ const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, o = a.isObject(e);
855
+ if (o && a.isHTMLForm(e) && (e = new FormData(e)), a.isFormData(e))
856
+ return s ? JSON.stringify(At(e)) : e;
857
+ if (a.isArrayBuffer(e) || a.isBuffer(e) || a.isStream(e) || a.isFile(e) || a.isBlob(e) || a.isReadableStream(e))
858
+ return e;
859
+ if (a.isArrayBufferView(e))
860
+ return e.buffer;
861
+ if (a.isURLSearchParams(e))
862
+ return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
863
+ let c;
864
+ if (o) {
865
+ if (n.indexOf("application/x-www-form-urlencoded") > -1)
866
+ return $r(e, this.formSerializer).toString();
867
+ if ((c = a.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
868
+ const p = this.env && this.env.FormData;
869
+ return _e(
870
+ c ? { "files[]": e } : e,
871
+ p && new p(),
872
+ this.formSerializer
873
+ );
874
+ }
875
+ }
876
+ return o || s ? (r.setContentType("application/json", !1), Jr(e)) : e;
877
+ }],
878
+ transformResponse: [function(e) {
879
+ const r = this.transitional || fe.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
880
+ if (a.isResponse(e) || a.isReadableStream(e))
881
+ return e;
882
+ if (e && a.isString(e) && (n && !this.responseType || s)) {
883
+ const i = !(r && r.silentJSONParsing) && s;
884
+ try {
885
+ return JSON.parse(e, this.parseReviver);
886
+ } catch (c) {
887
+ if (i)
888
+ throw c.name === "SyntaxError" ? g.from(c, g.ERR_BAD_RESPONSE, this, null, this.response) : c;
889
+ }
890
+ }
891
+ return e;
892
+ }],
893
+ /**
894
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
895
+ * timeout is not created.
896
+ */
897
+ timeout: 0,
898
+ xsrfCookieName: "XSRF-TOKEN",
899
+ xsrfHeaderName: "X-XSRF-TOKEN",
900
+ maxContentLength: -1,
901
+ maxBodyLength: -1,
902
+ env: {
903
+ FormData: P.classes.FormData,
904
+ Blob: P.classes.Blob
905
+ },
906
+ validateStatus: function(e) {
907
+ return e >= 200 && e < 300;
908
+ },
909
+ headers: {
910
+ common: {
911
+ Accept: "application/json, text/plain, */*",
912
+ "Content-Type": void 0
913
+ }
914
+ }
915
+ };
916
+ a.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
917
+ fe.headers[t] = {};
918
+ });
919
+ const Vr = a.toObjectSet([
920
+ "age",
921
+ "authorization",
922
+ "content-length",
923
+ "content-type",
924
+ "etag",
925
+ "expires",
926
+ "from",
927
+ "host",
928
+ "if-modified-since",
929
+ "if-unmodified-since",
930
+ "last-modified",
931
+ "location",
932
+ "max-forwards",
933
+ "proxy-authorization",
934
+ "referer",
935
+ "retry-after",
936
+ "user-agent"
937
+ ]), Yr = (t) => {
938
+ const e = {};
939
+ let r, n, s;
940
+ return t && t.split(`
941
+ `).forEach(function(i) {
942
+ s = i.indexOf(":"), r = i.substring(0, s).trim().toLowerCase(), n = i.substring(s + 1).trim(), !(!r || e[r] && Vr[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
943
+ }), e;
944
+ }, Qe = Symbol("internals");
945
+ function ie(t) {
946
+ return t && String(t).trim().toLowerCase();
947
+ }
948
+ function Ee(t) {
949
+ return t === !1 || t == null ? t : a.isArray(t) ? t.map(Ee) : String(t);
950
+ }
951
+ function Kr(t) {
952
+ const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
953
+ let n;
954
+ for (; n = r.exec(t); )
955
+ e[n[1]] = n[2];
956
+ return e;
957
+ }
958
+ const Xr = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
959
+ function Pe(t, e, r, n, s) {
960
+ if (a.isFunction(n))
961
+ return n.call(this, e, r);
962
+ if (s && (e = r), !!a.isString(e)) {
963
+ if (a.isString(n))
964
+ return e.indexOf(n) !== -1;
965
+ if (a.isRegExp(n))
966
+ return n.test(e);
967
+ }
968
+ }
969
+ function Gr(t) {
970
+ return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
971
+ }
972
+ function Qr(t, e) {
973
+ const r = a.toCamelCase(" " + e);
974
+ ["get", "set", "has"].forEach((n) => {
975
+ Object.defineProperty(t, n + r, {
976
+ value: function(s, o, i) {
977
+ return this[n].call(this, e, s, o, i);
978
+ },
979
+ configurable: !0
980
+ });
981
+ });
982
+ }
983
+ let L = class {
984
+ constructor(e) {
985
+ e && this.set(e);
986
+ }
987
+ set(e, r, n) {
988
+ const s = this;
989
+ function o(c, p, d) {
990
+ const u = ie(p);
991
+ if (!u)
992
+ throw new Error("header name must be a non-empty string");
993
+ const m = a.findKey(s, u);
994
+ (!m || s[m] === void 0 || d === !0 || d === void 0 && s[m] !== !1) && (s[m || p] = Ee(c));
995
+ }
996
+ const i = (c, p) => a.forEach(c, (d, u) => o(d, u, p));
997
+ if (a.isPlainObject(e) || e instanceof this.constructor)
998
+ i(e, r);
999
+ else if (a.isString(e) && (e = e.trim()) && !Xr(e))
1000
+ i(Yr(e), r);
1001
+ else if (a.isObject(e) && a.isIterable(e)) {
1002
+ let c = {}, p, d;
1003
+ for (const u of e) {
1004
+ if (!a.isArray(u))
1005
+ throw TypeError("Object iterator must return a key-value pair");
1006
+ c[d = u[0]] = (p = c[d]) ? a.isArray(p) ? [...p, u[1]] : [p, u[1]] : u[1];
1007
+ }
1008
+ i(c, r);
1009
+ } else
1010
+ e != null && o(r, e, n);
1011
+ return this;
1012
+ }
1013
+ get(e, r) {
1014
+ if (e = ie(e), e) {
1015
+ const n = a.findKey(this, e);
1016
+ if (n) {
1017
+ const s = this[n];
1018
+ if (!r)
1019
+ return s;
1020
+ if (r === !0)
1021
+ return Kr(s);
1022
+ if (a.isFunction(r))
1023
+ return r.call(this, s, n);
1024
+ if (a.isRegExp(r))
1025
+ return r.exec(s);
1026
+ throw new TypeError("parser must be boolean|regexp|function");
1027
+ }
1028
+ }
1029
+ }
1030
+ has(e, r) {
1031
+ if (e = ie(e), e) {
1032
+ const n = a.findKey(this, e);
1033
+ return !!(n && this[n] !== void 0 && (!r || Pe(this, this[n], n, r)));
1034
+ }
1035
+ return !1;
1036
+ }
1037
+ delete(e, r) {
1038
+ const n = this;
1039
+ let s = !1;
1040
+ function o(i) {
1041
+ if (i = ie(i), i) {
1042
+ const c = a.findKey(n, i);
1043
+ c && (!r || Pe(n, n[c], c, r)) && (delete n[c], s = !0);
1044
+ }
1045
+ }
1046
+ return a.isArray(e) ? e.forEach(o) : o(e), s;
1047
+ }
1048
+ clear(e) {
1049
+ const r = Object.keys(this);
1050
+ let n = r.length, s = !1;
1051
+ for (; n--; ) {
1052
+ const o = r[n];
1053
+ (!e || Pe(this, this[o], o, e, !0)) && (delete this[o], s = !0);
1054
+ }
1055
+ return s;
1056
+ }
1057
+ normalize(e) {
1058
+ const r = this, n = {};
1059
+ return a.forEach(this, (s, o) => {
1060
+ const i = a.findKey(n, o);
1061
+ if (i) {
1062
+ r[i] = Ee(s), delete r[o];
1063
+ return;
1064
+ }
1065
+ const c = e ? Gr(o) : String(o).trim();
1066
+ c !== o && delete r[o], r[c] = Ee(s), n[c] = !0;
1067
+ }), this;
1068
+ }
1069
+ concat(...e) {
1070
+ return this.constructor.concat(this, ...e);
1071
+ }
1072
+ toJSON(e) {
1073
+ const r = /* @__PURE__ */ Object.create(null);
1074
+ return a.forEach(this, (n, s) => {
1075
+ n != null && n !== !1 && (r[s] = e && a.isArray(n) ? n.join(", ") : n);
1076
+ }), r;
1077
+ }
1078
+ [Symbol.iterator]() {
1079
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1080
+ }
1081
+ toString() {
1082
+ return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(`
1083
+ `);
1084
+ }
1085
+ getSetCookie() {
1086
+ return this.get("set-cookie") || [];
1087
+ }
1088
+ get [Symbol.toStringTag]() {
1089
+ return "AxiosHeaders";
1090
+ }
1091
+ static from(e) {
1092
+ return e instanceof this ? e : new this(e);
1093
+ }
1094
+ static concat(e, ...r) {
1095
+ const n = new this(e);
1096
+ return r.forEach((s) => n.set(s)), n;
1097
+ }
1098
+ static accessor(e) {
1099
+ const n = (this[Qe] = this[Qe] = {
1100
+ accessors: {}
1101
+ }).accessors, s = this.prototype;
1102
+ function o(i) {
1103
+ const c = ie(i);
1104
+ n[c] || (Qr(s, i), n[c] = !0);
1105
+ }
1106
+ return a.isArray(e) ? e.forEach(o) : o(e), this;
1107
+ }
1108
+ };
1109
+ L.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1110
+ a.reduceDescriptors(L.prototype, ({ value: t }, e) => {
1111
+ let r = e[0].toUpperCase() + e.slice(1);
1112
+ return {
1113
+ get: () => t,
1114
+ set(n) {
1115
+ this[r] = n;
1116
+ }
1117
+ };
1118
+ });
1119
+ a.freezeMethods(L);
1120
+ function je(t, e) {
1121
+ const r = this || fe, n = e || r, s = L.from(n.headers);
1122
+ let o = n.data;
1123
+ return a.forEach(t, function(c) {
1124
+ o = c.call(r, o, s.normalize(), e ? e.status : void 0);
1125
+ }), s.normalize(), o;
1126
+ }
1127
+ function xt(t) {
1128
+ return !!(t && t.__CANCEL__);
1129
+ }
1130
+ let de = class extends g {
1131
+ /**
1132
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1133
+ *
1134
+ * @param {string=} message The message.
1135
+ * @param {Object=} config The config.
1136
+ * @param {Object=} request The request.
1137
+ *
1138
+ * @returns {CanceledError} The created error.
1139
+ */
1140
+ constructor(e, r, n) {
1141
+ super(e ?? "canceled", g.ERR_CANCELED, r, n), this.name = "CanceledError", this.__CANCEL__ = !0;
1142
+ }
1143
+ };
1144
+ function _t(t, e, r) {
1145
+ const n = r.config.validateStatus;
1146
+ !r.status || !n || n(r.status) ? t(r) : e(new g(
1147
+ "Request failed with status code " + r.status,
1148
+ [g.ERR_BAD_REQUEST, g.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
1149
+ r.config,
1150
+ r.request,
1151
+ r
1152
+ ));
1153
+ }
1154
+ function Zr(t) {
1155
+ const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
1156
+ return e && e[1] || "";
1157
+ }
1158
+ function en(t, e) {
1159
+ t = t || 10;
1160
+ const r = new Array(t), n = new Array(t);
1161
+ let s = 0, o = 0, i;
1162
+ return e = e !== void 0 ? e : 1e3, function(p) {
1163
+ const d = Date.now(), u = n[o];
1164
+ i || (i = d), r[s] = p, n[s] = d;
1165
+ let m = o, E = 0;
1166
+ for (; m !== s; )
1167
+ E += r[m++], m = m % t;
1168
+ if (s = (s + 1) % t, s === o && (o = (o + 1) % t), d - i < e)
1169
+ return;
1170
+ const R = u && d - u;
1171
+ return R ? Math.round(E * 1e3 / R) : void 0;
1172
+ };
1173
+ }
1174
+ function tn(t, e) {
1175
+ let r = 0, n = 1e3 / e, s, o;
1176
+ const i = (d, u = Date.now()) => {
1177
+ r = u, s = null, o && (clearTimeout(o), o = null), t(...d);
1178
+ };
1179
+ return [(...d) => {
1180
+ const u = Date.now(), m = u - r;
1181
+ m >= n ? i(d, u) : (s = d, o || (o = setTimeout(() => {
1182
+ o = null, i(s);
1183
+ }, n - m)));
1184
+ }, () => s && i(s)];
1185
+ }
1186
+ const Se = (t, e, r = 3) => {
1187
+ let n = 0;
1188
+ const s = en(50, 250);
1189
+ return tn((o) => {
1190
+ const i = o.loaded, c = o.lengthComputable ? o.total : void 0, p = i - n, d = s(p), u = i <= c;
1191
+ n = i;
1192
+ const m = {
1193
+ loaded: i,
1194
+ total: c,
1195
+ progress: c ? i / c : void 0,
1196
+ bytes: p,
1197
+ rate: d || void 0,
1198
+ estimated: d && c && u ? (c - i) / d : void 0,
1199
+ event: o,
1200
+ lengthComputable: c != null,
1201
+ [e ? "download" : "upload"]: !0
1202
+ };
1203
+ t(m);
1204
+ }, r);
1205
+ }, Ze = (t, e) => {
1206
+ const r = t != null;
1207
+ return [(n) => e[0]({
1208
+ lengthComputable: r,
1209
+ total: t,
1210
+ loaded: n
1211
+ }), e[1]];
1212
+ }, et = (t) => (...e) => a.asap(() => t(...e)), rn = 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
+ new URL(P.origin),
1214
+ P.navigator && /(msie|trident)/i.test(P.navigator.userAgent)
1215
+ ) : () => !0, nn = P.hasStandardBrowserEnv ? (
1216
+ // Standard browser envs support document.cookie
1217
+ {
1218
+ write(t, e, r, n, s, o, i) {
1219
+ if (typeof document > "u") return;
1220
+ const c = [`${t}=${encodeURIComponent(e)}`];
1221
+ 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("; ");
1222
+ },
1223
+ read(t) {
1224
+ if (typeof document > "u") return null;
1225
+ const e = document.cookie.match(new RegExp("(?:^|; )" + t + "=([^;]*)"));
1226
+ return e ? decodeURIComponent(e[1]) : null;
1227
+ },
1228
+ remove(t) {
1229
+ this.write(t, "", Date.now() - 864e5, "/");
1230
+ }
1231
+ }
1232
+ ) : (
1233
+ // Non-standard browser env (web workers, react-native) lack needed support.
1234
+ {
1235
+ write() {
1236
+ },
1237
+ read() {
1238
+ return null;
1239
+ },
1240
+ remove() {
1241
+ }
1242
+ }
1243
+ );
1244
+ function sn(t) {
1245
+ return typeof t != "string" ? !1 : /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
1246
+ }
1247
+ function on(t, e) {
1248
+ return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
1249
+ }
1250
+ function Ot(t, e, r) {
1251
+ let n = !sn(e);
1252
+ return t && (n || r == !1) ? on(t, e) : e;
1253
+ }
1254
+ const tt = (t) => t instanceof L ? { ...t } : t;
1255
+ function X(t, e) {
1256
+ e = e || {};
1257
+ const r = {};
1258
+ function n(d, u, m, E) {
1259
+ return a.isPlainObject(d) && a.isPlainObject(u) ? a.merge.call({ caseless: E }, d, u) : a.isPlainObject(u) ? a.merge({}, u) : a.isArray(u) ? u.slice() : u;
1260
+ }
1261
+ function s(d, u, m, E) {
1262
+ if (a.isUndefined(u)) {
1263
+ if (!a.isUndefined(d))
1264
+ return n(void 0, d, m, E);
1265
+ } else return n(d, u, m, E);
1266
+ }
1267
+ function o(d, u) {
1268
+ if (!a.isUndefined(u))
1269
+ return n(void 0, u);
1270
+ }
1271
+ function i(d, u) {
1272
+ if (a.isUndefined(u)) {
1273
+ if (!a.isUndefined(d))
1274
+ return n(void 0, d);
1275
+ } else return n(void 0, u);
1276
+ }
1277
+ function c(d, u, m) {
1278
+ if (m in e)
1279
+ return n(d, u);
1280
+ if (m in t)
1281
+ return n(void 0, d);
1282
+ }
1283
+ const p = {
1284
+ url: o,
1285
+ method: o,
1286
+ data: o,
1287
+ baseURL: i,
1288
+ transformRequest: i,
1289
+ transformResponse: i,
1290
+ paramsSerializer: i,
1291
+ timeout: i,
1292
+ timeoutMessage: i,
1293
+ withCredentials: i,
1294
+ withXSRFToken: i,
1295
+ adapter: i,
1296
+ responseType: i,
1297
+ xsrfCookieName: i,
1298
+ xsrfHeaderName: i,
1299
+ onUploadProgress: i,
1300
+ onDownloadProgress: i,
1301
+ decompress: i,
1302
+ maxContentLength: i,
1303
+ maxBodyLength: i,
1304
+ beforeRedirect: i,
1305
+ transport: i,
1306
+ httpAgent: i,
1307
+ httpsAgent: i,
1308
+ cancelToken: i,
1309
+ socketPath: i,
1310
+ responseEncoding: i,
1311
+ validateStatus: c,
1312
+ headers: (d, u, m) => s(tt(d), tt(u), m, !0)
1313
+ };
1314
+ return a.forEach(
1315
+ Object.keys({ ...t, ...e }),
1316
+ function(u) {
1317
+ if (u === "__proto__" || u === "constructor" || u === "prototype")
1318
+ return;
1319
+ const m = a.hasOwnProp(p, u) ? p[u] : s, E = m(t[u], e[u], u);
1320
+ a.isUndefined(E) && m !== c || (r[u] = E);
1321
+ }
1322
+ ), r;
1323
+ }
1324
+ const Nt = (t) => {
1325
+ const e = X({}, t);
1326
+ let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = e;
1327
+ if (e.headers = i = L.from(i), e.url = Tt(Ot(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), c && i.set(
1328
+ "Authorization",
1329
+ "Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
1330
+ ), a.isFormData(r)) {
1331
+ if (P.hasStandardBrowserEnv || P.hasStandardBrowserWebWorkerEnv)
1332
+ i.setContentType(void 0);
1333
+ else if (a.isFunction(r.getHeaders)) {
1334
+ const p = r.getHeaders(), d = ["content-type", "content-length"];
1335
+ Object.entries(p).forEach(([u, m]) => {
1336
+ d.includes(u.toLowerCase()) && i.set(u, m);
1337
+ });
1338
+ }
1339
+ }
1340
+ if (P.hasStandardBrowserEnv && (n && a.isFunction(n) && (n = n(e)), n || n !== !1 && rn(e.url))) {
1341
+ const p = s && o && nn.read(o);
1342
+ p && i.set(s, p);
1343
+ }
1344
+ return e;
1345
+ }, an = typeof XMLHttpRequest < "u", cn = an && function(t) {
1346
+ return new Promise(function(r, n) {
1347
+ const s = Nt(t);
1348
+ let o = s.data;
1349
+ const i = L.from(s.headers).normalize();
1350
+ let { responseType: c, onUploadProgress: p, onDownloadProgress: d } = s, u, m, E, R, f;
1351
+ function y() {
1352
+ R && R(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
1353
+ }
1354
+ let h = new XMLHttpRequest();
1355
+ h.open(s.method.toUpperCase(), s.url, !0), h.timeout = s.timeout;
1356
+ function S() {
1357
+ if (!h)
1358
+ return;
1359
+ const _ = L.from(
1360
+ "getAllResponseHeaders" in h && h.getAllResponseHeaders()
1361
+ ), U = {
1362
+ data: !c || c === "text" || c === "json" ? h.responseText : h.response,
1363
+ status: h.status,
1364
+ statusText: h.statusText,
1365
+ headers: _,
1366
+ config: t,
1367
+ request: h
1368
+ };
1369
+ _t(function(v) {
1370
+ r(v), y();
1371
+ }, function(v) {
1372
+ n(v), y();
1373
+ }, U), h = null;
1374
+ }
1375
+ "onloadend" in h ? h.onloadend = S : h.onreadystatechange = function() {
1376
+ !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(S);
1377
+ }, h.onabort = function() {
1378
+ h && (n(new g("Request aborted", g.ECONNABORTED, t, h)), h = null);
1379
+ }, h.onerror = function(C) {
1380
+ const U = C && C.message ? C.message : "Network Error", q = new g(U, g.ERR_NETWORK, t, h);
1381
+ q.event = C || null, n(q), h = null;
1382
+ }, h.ontimeout = function() {
1383
+ let C = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1384
+ const U = s.transitional || He;
1385
+ s.timeoutErrorMessage && (C = s.timeoutErrorMessage), n(new g(
1386
+ C,
1387
+ U.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
1388
+ t,
1389
+ h
1390
+ )), h = null;
1391
+ }, o === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(C, U) {
1392
+ h.setRequestHeader(U, C);
1393
+ }), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), d && ([E, f] = Se(d, !0), h.addEventListener("progress", E)), p && h.upload && ([m, R] = Se(p), h.upload.addEventListener("progress", m), h.upload.addEventListener("loadend", R)), (s.cancelToken || s.signal) && (u = (_) => {
1394
+ h && (n(!_ || _.type ? new de(null, t, h) : _), h.abort(), h = null);
1395
+ }, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
1396
+ const j = Zr(s.url);
1397
+ if (j && P.protocols.indexOf(j) === -1) {
1398
+ n(new g("Unsupported protocol " + j + ":", g.ERR_BAD_REQUEST, t));
1399
+ return;
1400
+ }
1401
+ h.send(o || null);
1402
+ });
1403
+ }, ln = (t, e) => {
1404
+ const { length: r } = t = t ? t.filter(Boolean) : [];
1405
+ if (e || r) {
1406
+ let n = new AbortController(), s;
1407
+ const o = function(d) {
1408
+ if (!s) {
1409
+ s = !0, c();
1410
+ const u = d instanceof Error ? d : this.reason;
1411
+ n.abort(u instanceof g ? u : new de(u instanceof Error ? u.message : u));
1412
+ }
1413
+ };
1414
+ let i = e && setTimeout(() => {
1415
+ i = null, o(new g(`timeout of ${e}ms exceeded`, g.ETIMEDOUT));
1416
+ }, e);
1417
+ const c = () => {
1418
+ t && (i && clearTimeout(i), i = null, t.forEach((d) => {
1419
+ d.unsubscribe ? d.unsubscribe(o) : d.removeEventListener("abort", o);
1420
+ }), t = null);
1421
+ };
1422
+ t.forEach((d) => d.addEventListener("abort", o));
1423
+ const { signal: p } = n;
1424
+ return p.unsubscribe = () => a.asap(c), p;
1425
+ }
1426
+ }, un = function* (t, e) {
1427
+ let r = t.byteLength;
1428
+ if (r < e) {
1429
+ yield t;
1430
+ return;
1431
+ }
1432
+ let n = 0, s;
1433
+ for (; n < r; )
1434
+ s = n + e, yield t.slice(n, s), n = s;
1435
+ }, fn = async function* (t, e) {
1436
+ for await (const r of dn(t))
1437
+ yield* un(r, e);
1438
+ }, dn = async function* (t) {
1439
+ if (t[Symbol.asyncIterator]) {
1440
+ yield* t;
1441
+ return;
1442
+ }
1443
+ const e = t.getReader();
1444
+ try {
1445
+ for (; ; ) {
1446
+ const { done: r, value: n } = await e.read();
1447
+ if (r)
1448
+ break;
1449
+ yield n;
1450
+ }
1451
+ } finally {
1452
+ await e.cancel();
1453
+ }
1454
+ }, rt = (t, e, r, n) => {
1455
+ const s = fn(t, e);
1456
+ let o = 0, i, c = (p) => {
1457
+ i || (i = !0, n && n(p));
1458
+ };
1459
+ return new ReadableStream({
1460
+ async pull(p) {
1461
+ try {
1462
+ const { done: d, value: u } = await s.next();
1463
+ if (d) {
1464
+ c(), p.close();
1465
+ return;
1466
+ }
1467
+ let m = u.byteLength;
1468
+ if (r) {
1469
+ let E = o += m;
1470
+ r(E);
1471
+ }
1472
+ p.enqueue(new Uint8Array(u));
1473
+ } catch (d) {
1474
+ throw c(d), d;
1475
+ }
1476
+ },
1477
+ cancel(p) {
1478
+ return c(p), s.return();
1479
+ }
1480
+ }, {
1481
+ highWaterMark: 2
1482
+ });
1483
+ }, nt = 64 * 1024, { isFunction: ge } = a, hn = (({ Request: t, Response: e }) => ({
1484
+ Request: t,
1485
+ Response: e
1486
+ }))(a.global), {
1487
+ ReadableStream: st,
1488
+ TextEncoder: ot
1489
+ } = a.global, it = (t, ...e) => {
1490
+ try {
1491
+ return !!t(...e);
1492
+ } catch {
1493
+ return !1;
1494
+ }
1495
+ }, pn = (t) => {
1496
+ t = a.merge.call({
1497
+ skipUndefined: !0
1498
+ }, hn, t);
1499
+ const { fetch: e, Request: r, Response: n } = t, s = e ? ge(e) : typeof fetch == "function", o = ge(r), i = ge(n);
1500
+ if (!s)
1501
+ return !1;
1502
+ const c = s && ge(st), p = s && (typeof ot == "function" ? /* @__PURE__ */ ((f) => (y) => f.encode(y))(new ot()) : async (f) => new Uint8Array(await new r(f).arrayBuffer())), d = o && c && it(() => {
1503
+ let f = !1;
1504
+ const y = new r(P.origin, {
1505
+ body: new st(),
1506
+ method: "POST",
1507
+ get duplex() {
1508
+ return f = !0, "half";
1509
+ }
1510
+ }).headers.has("Content-Type");
1511
+ return f && !y;
1512
+ }), u = i && c && it(() => a.isReadableStream(new n("").body)), m = {
1513
+ stream: u && ((f) => f.body)
1514
+ };
1515
+ s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
1516
+ !m[f] && (m[f] = (y, h) => {
1517
+ let S = y && y[f];
1518
+ if (S)
1519
+ return S.call(y);
1520
+ throw new g(`Response type '${f}' is not supported`, g.ERR_NOT_SUPPORT, h);
1521
+ });
1522
+ });
1523
+ const E = async (f) => {
1524
+ if (f == null)
1525
+ return 0;
1526
+ if (a.isBlob(f))
1527
+ return f.size;
1528
+ if (a.isSpecCompliantForm(f))
1529
+ return (await new r(P.origin, {
1530
+ method: "POST",
1531
+ body: f
1532
+ }).arrayBuffer()).byteLength;
1533
+ if (a.isArrayBufferView(f) || a.isArrayBuffer(f))
1534
+ return f.byteLength;
1535
+ if (a.isURLSearchParams(f) && (f = f + ""), a.isString(f))
1536
+ return (await p(f)).byteLength;
1537
+ }, R = async (f, y) => {
1538
+ const h = a.toFiniteNumber(f.getContentLength());
1539
+ return h ?? E(y);
1540
+ };
1541
+ return async (f) => {
1542
+ let {
1543
+ url: y,
1544
+ method: h,
1545
+ data: S,
1546
+ signal: j,
1547
+ cancelToken: _,
1548
+ timeout: C,
1549
+ onDownloadProgress: U,
1550
+ onUploadProgress: q,
1551
+ responseType: v,
1552
+ headers: te,
1553
+ withCredentials: $ = "same-origin",
1554
+ fetchOptions: pe
1555
+ } = Nt(f), me = e || fetch;
1556
+ v = v ? (v + "").toLowerCase() : "text";
1557
+ let z = ln([j, _ && _.toAbortSignal()], C), W = null;
1558
+ const M = z && z.unsubscribe && (() => {
1559
+ z.unsubscribe();
1560
+ });
1561
+ let G;
1562
+ try {
1563
+ if (q && d && h !== "get" && h !== "head" && (G = await R(te, S)) !== 0) {
1564
+ let l = new r(y, {
1565
+ method: "POST",
1566
+ body: S,
1567
+ duplex: "half"
1568
+ }), w;
1569
+ if (a.isFormData(S) && (w = l.headers.get("content-type")) && te.setContentType(w), l.body) {
1570
+ const [T, A] = Ze(
1571
+ G,
1572
+ Se(et(q))
1573
+ );
1574
+ S = rt(l.body, nt, T, A);
1575
+ }
1576
+ }
1577
+ a.isString($) || ($ = $ ? "include" : "omit");
1578
+ const N = o && "credentials" in r.prototype, re = {
1579
+ ...pe,
1580
+ signal: z,
1581
+ method: h.toUpperCase(),
1582
+ headers: te.normalize().toJSON(),
1583
+ body: S,
1584
+ duplex: "half",
1585
+ credentials: N ? $ : void 0
1586
+ };
1587
+ W = o && new r(y, re);
1588
+ let B = await (o ? me(W, pe) : me(y, re));
1589
+ const ne = u && (v === "stream" || v === "response");
1590
+ if (u && (U || ne && M)) {
1591
+ const l = {};
1592
+ ["status", "statusText", "headers"].forEach((J) => {
1593
+ l[J] = B[J];
1594
+ });
1595
+ const w = a.toFiniteNumber(B.headers.get("content-length")), [T, A] = U && Ze(
1596
+ w,
1597
+ Se(et(U), !0)
1598
+ ) || [];
1599
+ B = new n(
1600
+ rt(B.body, nt, T, () => {
1601
+ A && A(), M && M();
1602
+ }),
1603
+ l
1604
+ );
1605
+ }
1606
+ v = v || "text";
1607
+ let ye = await m[a.findKey(m, v) || "text"](B, f);
1608
+ return !ne && M && M(), await new Promise((l, w) => {
1609
+ _t(l, w, {
1610
+ data: ye,
1611
+ headers: L.from(B.headers),
1612
+ status: B.status,
1613
+ statusText: B.statusText,
1614
+ config: f,
1615
+ request: W
1616
+ });
1617
+ });
1618
+ } catch (N) {
1619
+ throw M && M(), N && N.name === "TypeError" && /Load failed|fetch/i.test(N.message) ? Object.assign(
1620
+ new g("Network Error", g.ERR_NETWORK, f, W, N && N.response),
1621
+ {
1622
+ cause: N.cause || N
1623
+ }
1624
+ ) : g.from(N, N && N.code, f, W, N && N.response);
1625
+ }
1626
+ };
1627
+ }, mn = /* @__PURE__ */ new Map(), Ct = (t) => {
1628
+ let e = t && t.env || {};
1629
+ const { fetch: r, Request: n, Response: s } = e, o = [
1630
+ n,
1631
+ s,
1632
+ r
1633
+ ];
1634
+ let i = o.length, c = i, p, d, u = mn;
1635
+ for (; c--; )
1636
+ p = o[c], d = u.get(p), d === void 0 && u.set(p, d = c ? /* @__PURE__ */ new Map() : pn(e)), u = d;
1637
+ return d;
1638
+ };
1639
+ Ct();
1640
+ const ze = {
1641
+ http: jr,
1642
+ xhr: cn,
1643
+ fetch: {
1644
+ get: Ct
1645
+ }
1646
+ };
1647
+ a.forEach(ze, (t, e) => {
1648
+ if (t) {
1649
+ try {
1650
+ Object.defineProperty(t, "name", { value: e });
1651
+ } catch {
1652
+ }
1653
+ Object.defineProperty(t, "adapterName", { value: e });
1654
+ }
1655
+ });
1656
+ const at = (t) => `- ${t}`, yn = (t) => a.isFunction(t) || t === null || t === !1;
1657
+ function bn(t, e) {
1658
+ t = a.isArray(t) ? t : [t];
1659
+ const { length: r } = t;
1660
+ let n, s;
1661
+ const o = {};
1662
+ for (let i = 0; i < r; i++) {
1663
+ n = t[i];
1664
+ let c;
1665
+ if (s = n, !yn(n) && (s = ze[(c = String(n)).toLowerCase()], s === void 0))
1666
+ throw new g(`Unknown adapter '${c}'`);
1667
+ if (s && (a.isFunction(s) || (s = s.get(e))))
1668
+ break;
1669
+ o[c || "#" + i] = s;
1670
+ }
1671
+ if (!s) {
1672
+ const i = Object.entries(o).map(
1673
+ ([p, d]) => `adapter ${p} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
1674
+ );
1675
+ let c = r ? i.length > 1 ? `since :
1676
+ ` + i.map(at).join(`
1677
+ `) : " " + at(i[0]) : "as no adapter specified";
1678
+ throw new g(
1679
+ "There is no suitable adapter to dispatch the request " + c,
1680
+ "ERR_NOT_SUPPORT"
1681
+ );
1682
+ }
1683
+ return s;
1684
+ }
1685
+ const Pt = {
1686
+ /**
1687
+ * Resolve an adapter from a list of adapter names or functions.
1688
+ * @type {Function}
1689
+ */
1690
+ getAdapter: bn,
1691
+ /**
1692
+ * Exposes all known adapters
1693
+ * @type {Object<string, Function|Object>}
1694
+ */
1695
+ adapters: ze
1696
+ };
1697
+ function ve(t) {
1698
+ if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1699
+ throw new de(null, t);
1700
+ }
1701
+ function ct(t) {
1702
+ return ve(t), t.headers = L.from(t.headers), t.data = je.call(
1703
+ t,
1704
+ t.transformRequest
1705
+ ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), Pt.getAdapter(t.adapter || fe.adapter, t)(t).then(function(n) {
1706
+ return ve(t), n.data = je.call(
1707
+ t,
1708
+ t.transformResponse,
1709
+ n
1710
+ ), n.headers = L.from(n.headers), n;
1711
+ }, function(n) {
1712
+ return xt(n) || (ve(t), n && n.response && (n.response.data = je.call(
1713
+ t,
1714
+ t.transformResponse,
1715
+ n.response
1716
+ ), n.response.headers = L.from(n.response.headers))), Promise.reject(n);
1717
+ });
1718
+ }
1719
+ const jt = "1.13.5", Oe = {};
1720
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1721
+ Oe[t] = function(n) {
1722
+ return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
1723
+ };
1724
+ });
1725
+ const lt = {};
1726
+ Oe.transitional = function(e, r, n) {
1727
+ function s(o, i) {
1728
+ return "[Axios v" + jt + "] Transitional option '" + o + "'" + i + (n ? ". " + n : "");
1729
+ }
1730
+ return (o, i, c) => {
1731
+ if (e === !1)
1732
+ throw new g(
1733
+ s(i, " has been removed" + (r ? " in " + r : "")),
1734
+ g.ERR_DEPRECATED
1735
+ );
1736
+ return r && !lt[i] && (lt[i] = !0, console.warn(
1737
+ s(
1738
+ i,
1739
+ " has been deprecated since v" + r + " and will be removed in the near future"
1740
+ )
1741
+ )), e ? e(o, i, c) : !0;
1742
+ };
1743
+ };
1744
+ Oe.spelling = function(e) {
1745
+ return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1746
+ };
1747
+ function gn(t, e, r) {
1748
+ if (typeof t != "object")
1749
+ throw new g("options must be an object", g.ERR_BAD_OPTION_VALUE);
1750
+ const n = Object.keys(t);
1751
+ let s = n.length;
1752
+ for (; s-- > 0; ) {
1753
+ const o = n[s], i = e[o];
1754
+ if (i) {
1755
+ const c = t[o], p = c === void 0 || i(c, o, t);
1756
+ if (p !== !0)
1757
+ throw new g("option " + o + " must be " + p, g.ERR_BAD_OPTION_VALUE);
1758
+ continue;
1759
+ }
1760
+ if (r !== !0)
1761
+ throw new g("Unknown option " + o, g.ERR_BAD_OPTION);
1762
+ }
1763
+ }
1764
+ const Re = {
1765
+ assertOptions: gn,
1766
+ validators: Oe
1767
+ }, I = Re.validators;
1768
+ let K = class {
1769
+ constructor(e) {
1770
+ this.defaults = e || {}, this.interceptors = {
1771
+ request: new Ge(),
1772
+ response: new Ge()
1773
+ };
1774
+ }
1775
+ /**
1776
+ * Dispatch a request
1777
+ *
1778
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1779
+ * @param {?Object} config
1780
+ *
1781
+ * @returns {Promise} The Promise to be fulfilled
1782
+ */
1783
+ async request(e, r) {
1784
+ try {
1785
+ return await this._request(e, r);
1786
+ } catch (n) {
1787
+ if (n instanceof Error) {
1788
+ let s = {};
1789
+ Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
1790
+ const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1791
+ try {
1792
+ n.stack ? o && !String(n.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (n.stack += `
1793
+ ` + o) : n.stack = o;
1794
+ } catch {
1795
+ }
1796
+ }
1797
+ throw n;
1798
+ }
1799
+ }
1800
+ _request(e, r) {
1801
+ typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = X(this.defaults, r);
1802
+ const { transitional: n, paramsSerializer: s, headers: o } = r;
1803
+ n !== void 0 && Re.assertOptions(n, {
1804
+ silentJSONParsing: I.transitional(I.boolean),
1805
+ forcedJSONParsing: I.transitional(I.boolean),
1806
+ clarifyTimeoutError: I.transitional(I.boolean),
1807
+ legacyInterceptorReqResOrdering: I.transitional(I.boolean)
1808
+ }, !1), s != null && (a.isFunction(s) ? r.paramsSerializer = {
1809
+ serialize: s
1810
+ } : Re.assertOptions(s, {
1811
+ encode: I.function,
1812
+ serialize: I.function
1813
+ }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Re.assertOptions(r, {
1814
+ baseUrl: I.spelling("baseURL"),
1815
+ withXsrfToken: I.spelling("withXSRFToken")
1816
+ }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
1817
+ let i = o && a.merge(
1818
+ o.common,
1819
+ o[r.method]
1820
+ );
1821
+ o && a.forEach(
1822
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1823
+ (f) => {
1824
+ delete o[f];
1825
+ }
1826
+ ), r.headers = L.concat(i, o);
1827
+ const c = [];
1828
+ let p = !0;
1829
+ this.interceptors.request.forEach(function(y) {
1830
+ if (typeof y.runWhen == "function" && y.runWhen(r) === !1)
1831
+ return;
1832
+ p = p && y.synchronous;
1833
+ const h = r.transitional || He;
1834
+ h && h.legacyInterceptorReqResOrdering ? c.unshift(y.fulfilled, y.rejected) : c.push(y.fulfilled, y.rejected);
1835
+ });
1836
+ const d = [];
1837
+ this.interceptors.response.forEach(function(y) {
1838
+ d.push(y.fulfilled, y.rejected);
1839
+ });
1840
+ let u, m = 0, E;
1841
+ if (!p) {
1842
+ const f = [ct.bind(this), void 0];
1843
+ for (f.unshift(...c), f.push(...d), E = f.length, u = Promise.resolve(r); m < E; )
1844
+ u = u.then(f[m++], f[m++]);
1845
+ return u;
1846
+ }
1847
+ E = c.length;
1848
+ let R = r;
1849
+ for (; m < E; ) {
1850
+ const f = c[m++], y = c[m++];
1851
+ try {
1852
+ R = f(R);
1853
+ } catch (h) {
1854
+ y.call(this, h);
1855
+ break;
1856
+ }
1857
+ }
1858
+ try {
1859
+ u = ct.call(this, R);
1860
+ } catch (f) {
1861
+ return Promise.reject(f);
1862
+ }
1863
+ for (m = 0, E = d.length; m < E; )
1864
+ u = u.then(d[m++], d[m++]);
1865
+ return u;
1866
+ }
1867
+ getUri(e) {
1868
+ e = X(this.defaults, e);
1869
+ const r = Ot(e.baseURL, e.url, e.allowAbsoluteUrls);
1870
+ return Tt(r, e.params, e.paramsSerializer);
1871
+ }
1872
+ };
1873
+ a.forEach(["delete", "get", "head", "options"], function(e) {
1874
+ K.prototype[e] = function(r, n) {
1875
+ return this.request(X(n || {}, {
1876
+ method: e,
1877
+ url: r,
1878
+ data: (n || {}).data
1879
+ }));
1880
+ };
1881
+ });
1882
+ a.forEach(["post", "put", "patch"], function(e) {
1883
+ function r(n) {
1884
+ return function(o, i, c) {
1885
+ return this.request(X(c || {}, {
1886
+ method: e,
1887
+ headers: n ? {
1888
+ "Content-Type": "multipart/form-data"
1889
+ } : {},
1890
+ url: o,
1891
+ data: i
1892
+ }));
1893
+ };
1894
+ }
1895
+ K.prototype[e] = r(), K.prototype[e + "Form"] = r(!0);
1896
+ });
1897
+ let wn = class vt {
1898
+ constructor(e) {
1899
+ if (typeof e != "function")
1900
+ throw new TypeError("executor must be a function.");
1901
+ let r;
1902
+ this.promise = new Promise(function(o) {
1903
+ r = o;
1904
+ });
1905
+ const n = this;
1906
+ this.promise.then((s) => {
1907
+ if (!n._listeners) return;
1908
+ let o = n._listeners.length;
1909
+ for (; o-- > 0; )
1910
+ n._listeners[o](s);
1911
+ n._listeners = null;
1912
+ }), this.promise.then = (s) => {
1913
+ let o;
1914
+ const i = new Promise((c) => {
1915
+ n.subscribe(c), o = c;
1916
+ }).then(s);
1917
+ return i.cancel = function() {
1918
+ n.unsubscribe(o);
1919
+ }, i;
1920
+ }, e(function(o, i, c) {
1921
+ n.reason || (n.reason = new de(o, i, c), r(n.reason));
1922
+ });
1923
+ }
1924
+ /**
1925
+ * Throws a `CanceledError` if cancellation has been requested.
1926
+ */
1927
+ throwIfRequested() {
1928
+ if (this.reason)
1929
+ throw this.reason;
1930
+ }
1931
+ /**
1932
+ * Subscribe to the cancel signal
1933
+ */
1934
+ subscribe(e) {
1935
+ if (this.reason) {
1936
+ e(this.reason);
1937
+ return;
1938
+ }
1939
+ this._listeners ? this._listeners.push(e) : this._listeners = [e];
1940
+ }
1941
+ /**
1942
+ * Unsubscribe from the cancel signal
1943
+ */
1944
+ unsubscribe(e) {
1945
+ if (!this._listeners)
1946
+ return;
1947
+ const r = this._listeners.indexOf(e);
1948
+ r !== -1 && this._listeners.splice(r, 1);
1949
+ }
1950
+ toAbortSignal() {
1951
+ const e = new AbortController(), r = (n) => {
1952
+ e.abort(n);
1953
+ };
1954
+ return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal;
1955
+ }
1956
+ /**
1957
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1958
+ * cancels the `CancelToken`.
1959
+ */
1960
+ static source() {
1961
+ let e;
1962
+ return {
1963
+ token: new vt(function(s) {
1964
+ e = s;
1965
+ }),
1966
+ cancel: e
1967
+ };
1968
+ }
1969
+ };
1970
+ function En(t) {
1971
+ return function(r) {
1972
+ return t.apply(null, r);
1973
+ };
1974
+ }
1975
+ function Rn(t) {
1976
+ return a.isObject(t) && t.isAxiosError === !0;
1977
+ }
1978
+ const Ie = {
1979
+ Continue: 100,
1980
+ SwitchingProtocols: 101,
1981
+ Processing: 102,
1982
+ EarlyHints: 103,
1983
+ Ok: 200,
1984
+ Created: 201,
1985
+ Accepted: 202,
1986
+ NonAuthoritativeInformation: 203,
1987
+ NoContent: 204,
1988
+ ResetContent: 205,
1989
+ PartialContent: 206,
1990
+ MultiStatus: 207,
1991
+ AlreadyReported: 208,
1992
+ ImUsed: 226,
1993
+ MultipleChoices: 300,
1994
+ MovedPermanently: 301,
1995
+ Found: 302,
1996
+ SeeOther: 303,
1997
+ NotModified: 304,
1998
+ UseProxy: 305,
1999
+ Unused: 306,
2000
+ TemporaryRedirect: 307,
2001
+ PermanentRedirect: 308,
2002
+ BadRequest: 400,
2003
+ Unauthorized: 401,
2004
+ PaymentRequired: 402,
2005
+ Forbidden: 403,
2006
+ NotFound: 404,
2007
+ MethodNotAllowed: 405,
2008
+ NotAcceptable: 406,
2009
+ ProxyAuthenticationRequired: 407,
2010
+ RequestTimeout: 408,
2011
+ Conflict: 409,
2012
+ Gone: 410,
2013
+ LengthRequired: 411,
2014
+ PreconditionFailed: 412,
2015
+ PayloadTooLarge: 413,
2016
+ UriTooLong: 414,
2017
+ UnsupportedMediaType: 415,
2018
+ RangeNotSatisfiable: 416,
2019
+ ExpectationFailed: 417,
2020
+ ImATeapot: 418,
2021
+ MisdirectedRequest: 421,
2022
+ UnprocessableEntity: 422,
2023
+ Locked: 423,
2024
+ FailedDependency: 424,
2025
+ TooEarly: 425,
2026
+ UpgradeRequired: 426,
2027
+ PreconditionRequired: 428,
2028
+ TooManyRequests: 429,
2029
+ RequestHeaderFieldsTooLarge: 431,
2030
+ UnavailableForLegalReasons: 451,
2031
+ InternalServerError: 500,
2032
+ NotImplemented: 501,
2033
+ BadGateway: 502,
2034
+ ServiceUnavailable: 503,
2035
+ GatewayTimeout: 504,
2036
+ HttpVersionNotSupported: 505,
2037
+ VariantAlsoNegotiates: 506,
2038
+ InsufficientStorage: 507,
2039
+ LoopDetected: 508,
2040
+ NotExtended: 510,
2041
+ NetworkAuthenticationRequired: 511,
2042
+ WebServerIsDown: 521,
2043
+ ConnectionTimedOut: 522,
2044
+ OriginIsUnreachable: 523,
2045
+ TimeoutOccurred: 524,
2046
+ SslHandshakeFailed: 525,
2047
+ InvalidSslCertificate: 526
2048
+ };
2049
+ Object.entries(Ie).forEach(([t, e]) => {
2050
+ Ie[e] = t;
2051
+ });
2052
+ function kt(t) {
2053
+ const e = new K(t), r = dt(K.prototype.request, e);
2054
+ return a.extend(r, K.prototype, e, { allOwnKeys: !0 }), a.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
2055
+ return kt(X(t, s));
2056
+ }, r;
2057
+ }
2058
+ const x = kt(fe);
2059
+ x.Axios = K;
2060
+ x.CanceledError = de;
2061
+ x.CancelToken = wn;
2062
+ x.isCancel = xt;
2063
+ x.VERSION = jt;
2064
+ x.toFormData = _e;
2065
+ x.AxiosError = g;
2066
+ x.Cancel = x.CanceledError;
2067
+ x.all = function(e) {
2068
+ return Promise.all(e);
2069
+ };
2070
+ x.spread = En;
2071
+ x.isAxiosError = Rn;
2072
+ x.mergeConfig = X;
2073
+ x.AxiosHeaders = L;
2074
+ x.formToJSON = (t) => At(a.isHTMLForm(t) ? new FormData(t) : t);
2075
+ x.getAdapter = Pt.getAdapter;
2076
+ x.HttpStatusCode = Ie;
2077
+ x.default = x;
2078
+ const {
2079
+ Axios: kn,
2080
+ AxiosError: Ln,
2081
+ CanceledError: Un,
2082
+ isCancel: Fn,
2083
+ CancelToken: In,
2084
+ VERSION: Bn,
2085
+ all: Dn,
2086
+ Cancel: qn,
2087
+ isAxiosError: Mn,
2088
+ spread: Hn,
2089
+ toFormData: $n,
2090
+ AxiosHeaders: zn,
2091
+ HttpStatusCode: Wn,
2092
+ formToJSON: Jn,
2093
+ getAdapter: Vn,
2094
+ mergeConfig: Yn
2095
+ } = x, Sn = "https://api.authifyer.com", H = x.create({
2096
+ baseURL: Sn,
2097
+ withCredentials: !0,
2098
+ // Kept for legacy compatibility if cookies are ever used
2099
+ headers: {
2100
+ "Content-Type": "application/json"
2101
+ }
2102
+ }), ut = (t) => {
2103
+ t ? H.defaults.headers.common.Authorization = `Bearer ${t}` : delete H.defaults.headers.common.Authorization;
2104
+ }, Be = "authifyer_refresh_token", ke = (t) => {
2105
+ try {
2106
+ t ? localStorage.setItem(Be, t) : localStorage.removeItem(Be);
2107
+ } catch (e) {
2108
+ console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("auth:storage_error"));
2109
+ }
2110
+ }, ft = () => {
2111
+ try {
2112
+ return localStorage.getItem(Be);
2113
+ } catch (t) {
2114
+ return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.", t), typeof window < "u" && window.dispatchEvent(new CustomEvent("auth:storage_error")), null;
2115
+ }
2116
+ };
2117
+ class ae extends Error {
2118
+ }
2119
+ ae.prototype.name = "InvalidTokenError";
2120
+ function Tn(t) {
2121
+ return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
2122
+ let n = r.charCodeAt(0).toString(16).toUpperCase();
2123
+ return n.length < 2 && (n = "0" + n), "%" + n;
2124
+ }));
2125
+ }
2126
+ function An(t) {
2127
+ let e = t.replace(/-/g, "+").replace(/_/g, "/");
2128
+ switch (e.length % 4) {
2129
+ case 0:
2130
+ break;
2131
+ case 2:
2132
+ e += "==";
2133
+ break;
2134
+ case 3:
2135
+ e += "=";
2136
+ break;
2137
+ default:
2138
+ throw new Error("base64 string is not of the correct length");
2139
+ }
2140
+ try {
2141
+ return Tn(e);
2142
+ } catch {
2143
+ return atob(e);
2144
+ }
2145
+ }
2146
+ function xn(t, e) {
2147
+ if (typeof t != "string")
2148
+ throw new ae("Invalid token specified: must be a string");
2149
+ e || (e = {});
2150
+ const r = e.header === !0 ? 0 : 1, n = t.split(".")[r];
2151
+ if (typeof n != "string")
2152
+ throw new ae(`Invalid token specified: missing part #${r + 1}`);
2153
+ let s;
2154
+ try {
2155
+ s = An(n);
2156
+ } catch (o) {
2157
+ throw new ae(`Invalid token specified: invalid base64 for part #${r + 1} (${o.message})`);
2158
+ }
2159
+ try {
2160
+ return JSON.parse(s);
2161
+ } catch (o) {
2162
+ throw new ae(`Invalid token specified: invalid json for part #${r + 1} (${o.message})`);
2163
+ }
2164
+ }
2165
+ const _n = (t) => {
2166
+ try {
2167
+ const e = xn(t), r = Date.now() / 1e3;
2168
+ if (e.exp < r)
2169
+ return null;
2170
+ const n = {
2171
+ authifyerId: e.sub,
2172
+ name: e.name,
2173
+ email: e.email,
2174
+ emailVerified: !1,
2175
+ // JWT might not have this, need to fetch user details or infer
2176
+ isActive: !0,
2177
+ provider: "email"
2178
+ // Defaulting, might need to be in claims
2179
+ };
2180
+ return {
2181
+ token: t,
2182
+ sessionId: e.sid,
2183
+ expireAt: e.exp,
2184
+ user: n
2185
+ };
2186
+ } catch (e) {
2187
+ return console.error("Invalid token", e), null;
2188
+ }
2189
+ };
2190
+ class On {
2191
+ constructor(e, r) {
2192
+ V(this, "publishableKey");
2193
+ V(this, "refreshTimer", null);
2194
+ // State
2195
+ V(this, "session", null);
2196
+ V(this, "config", null);
2197
+ V(this, "isLoading", !0);
2198
+ V(this, "listeners", []);
2199
+ this.publishableKey = e, r != null && r.backendUrl && (H.defaults.baseURL = r.backendUrl);
2200
+ }
2201
+ // --- API Methods ---
2202
+ async load() {
2203
+ try {
2204
+ this.isLoading = !0, this.notifyListeners(), await this.refreshSession();
2205
+ } catch (e) {
2206
+ console.error("Failed to load Authifyer client", e);
2207
+ } finally {
2208
+ this.isLoading = !1, this.notifyListeners();
2209
+ }
2210
+ }
2211
+ // --- Auth Actions ---
2212
+ async signInWithEmail(e, r) {
2213
+ try {
2214
+ const n = await H.post("/authifyer/project/login/email", {
2215
+ email: e,
2216
+ password: r,
2217
+ publicProjectId: this.publishableKey
2218
+ // The user said "dont mind the publisc project id its the publishable key"
2219
+ });
2220
+ this.handleAuthResponse(n.data);
2221
+ } catch (n) {
2222
+ throw n;
2223
+ }
2224
+ }
2225
+ async signUpWithEmail(e, r) {
2226
+ try {
2227
+ const n = await H.post("/authifyer/project/register/email", {
2228
+ email: e,
2229
+ password: r,
2230
+ publicProjectId: this.publishableKey
2231
+ });
2232
+ this.handleAuthResponse(n.data);
2233
+ } catch (n) {
2234
+ throw n;
2235
+ }
2236
+ }
2237
+ async signOut() {
2238
+ try {
2239
+ await H.post("/authifyer/session/logout");
2240
+ } catch (e) {
2241
+ console.warn("Logout failed", e);
2242
+ } finally {
2243
+ this.clearSession();
2244
+ }
2245
+ }
2246
+ signInWithOAuth(e) {
2247
+ const r = window.location.origin, n = `${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;
2248
+ window.location.href = n;
2249
+ }
2250
+ // --- Session Management ---
2251
+ async refreshSession() {
2252
+ try {
2253
+ const e = ft(), r = await H.post("/authifyer/jwt/refresh-jwt", {
2254
+ refresh_token: e || void 0
2255
+ }), { access_token: n, refresh_token: s } = r.data;
2256
+ if (n) {
2257
+ const o = n.accessToken || n;
2258
+ this.setSession(o);
2259
+ }
2260
+ s && ke(s);
2261
+ } catch {
2262
+ this.clearSession();
2263
+ }
2264
+ }
2265
+ /**
2266
+ * Rotates the underlying long-lived session.
2267
+ * In a real app, this might be triggered if a specific error is caught
2268
+ * or based on an internal timer if the session age is known.
2269
+ */
2270
+ async rotateSession() {
2271
+ try {
2272
+ const e = ft();
2273
+ await H.post("/authifyer/session/refresh", {
2274
+ refresh_token: e || void 0
2275
+ }), await this.refreshSession();
2276
+ } catch (e) {
2277
+ console.warn("Session rotation failed", e), this.clearSession();
2278
+ }
2279
+ }
2280
+ handleAuthResponse(e) {
2281
+ e.accessToken && this.setSession(e.accessToken), (e.refreshToken || e.refresh_token) && ke(e.refreshToken || e.refresh_token);
2282
+ }
2283
+ setSession(e) {
2284
+ const r = _n(e);
2285
+ r && (this.session = r, ut(e), this.startRefreshTimer(), this.notifyListeners());
2286
+ }
2287
+ clearSession() {
2288
+ this.session = null, ut(null), ke(null), this.stopRefreshTimer(), this.notifyListeners();
2289
+ }
2290
+ // --- Timer ---
2291
+ startRefreshTimer() {
2292
+ this.stopRefreshTimer(), this.refreshTimer = setInterval(() => {
2293
+ this.refreshSession();
2294
+ }, 270 * 1e3);
2295
+ }
2296
+ stopRefreshTimer() {
2297
+ this.refreshTimer && (clearInterval(this.refreshTimer), this.refreshTimer = null);
2298
+ }
2299
+ // --- Listeners (Observer Pattern) ---
2300
+ subscribe(e) {
2301
+ return this.listeners.push(e), () => {
2302
+ this.listeners = this.listeners.filter((r) => r !== e);
2303
+ };
2304
+ }
2305
+ notifyListeners() {
2306
+ this.listeners.forEach((e) => e(this));
2307
+ }
2308
+ }
2309
+ const Lt = Dt(void 0), Kn = ({
2310
+ publishableKey: t,
2311
+ backendUrl: e,
2312
+ config: r,
2313
+ children: n
2314
+ }) => {
2315
+ var f;
2316
+ const s = qt(() => {
2317
+ const y = (
2318
+ // @ts-ignore (Vite)
2319
+ // @ts-ignore (Next.js / CRA)
2320
+ typeof process < "u" && process.env && (process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY || process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY)
2321
+ ), h = t || y;
2322
+ 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).");
2323
+ const S = new On(h || "", { backendUrl: e });
2324
+ return r && (S.config = r), S;
2325
+ }, [t, e, r]), [o, i] = F(((f = s.session) == null ? void 0 : f.user) || null), [c, p] = F(s.session), [d, u] = F(s.config), [m, E] = F(s.isLoading);
2326
+ Mt(() => {
2327
+ const y = s.subscribe((h) => {
2328
+ var S;
2329
+ i(((S = h.session) == null ? void 0 : S.user) || null), p(h.session), r || u(h.config), E(h.isLoading);
2330
+ });
2331
+ return s.load(), () => {
2332
+ y();
2333
+ };
2334
+ }, [s, r]);
2335
+ const R = {
2336
+ client: s,
2337
+ user: o,
2338
+ session: c,
2339
+ config: r || d,
2340
+ isLoading: m
2341
+ };
2342
+ return /* @__PURE__ */ b.jsx(Lt.Provider, { value: R, children: n });
2343
+ }, he = () => {
2344
+ const t = Ht(Lt);
2345
+ if (t === void 0)
2346
+ throw new Error("useAuth must be used within an AuthifyerProvider");
2347
+ return t;
2348
+ }, Xn = () => {
2349
+ const { user: t, isLoading: e } = he();
2350
+ return { user: t, isLoading: e, isSignedIn: !!t };
2351
+ }, Gn = () => {
2352
+ const { session: t, isLoading: e } = he();
2353
+ return { session: t, isLoading: e, isSignedIn: !!t };
2354
+ }, Qn = () => {
2355
+ const { client: t } = he();
2356
+ return t;
2357
+ }, De = ({ title: t, subtitle: e, children: r }) => /* @__PURE__ */ b.jsx("div", { className: "authifyer-root", children: /* @__PURE__ */ b.jsxs("div", { className: "authifyer-card", children: [
2358
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-card-header", children: [
2359
+ /* @__PURE__ */ b.jsx("h2", { className: "authifyer-card-title", children: t }),
2360
+ e && /* @__PURE__ */ b.jsx("p", { className: "authifyer-card-subtitle", children: e })
2361
+ ] }),
2362
+ /* @__PURE__ */ b.jsx("div", { className: "authifyer-card-content", children: r }),
2363
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-footer", children: [
2364
+ /* @__PURE__ */ b.jsx("span", { className: "authifyer-secured-text", children: "Secured by" }),
2365
+ /* @__PURE__ */ b.jsxs("span", { className: "authifyer-brand", children: [
2366
+ /* @__PURE__ */ b.jsx("svg", { className: "authifyer-logo-icon", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ b.jsx("path", { d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" }) }),
2367
+ "Authifyer"
2368
+ ] })
2369
+ ] })
2370
+ ] }) }), Zn = () => {
2371
+ const { client: t, config: e } = he(), [r, n] = F(""), [s, o] = F(""), [i, c] = F(""), [p, d] = F(!1), u = (e == null ? void 0 : e.emailPasswordEnabled) ?? !0, m = (e == null ? void 0 : e.oauthProviders) ?? ["google", "github"], E = async (R) => {
2372
+ R.preventDefault(), d(!0), c("");
2373
+ try {
2374
+ await t.signInWithEmail(r, s);
2375
+ } catch {
2376
+ c("Invalid credentials");
2377
+ } finally {
2378
+ d(!1);
2379
+ }
2380
+ };
2381
+ return /* @__PURE__ */ b.jsxs(De, { title: "Sign in", subtitle: "to continue to Authifyer", children: [
2382
+ i && /* @__PURE__ */ b.jsx("p", { className: "authifyer-error", children: i }),
2383
+ (m.includes("google") || m.includes("github")) && /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form", children: [
2384
+ m.includes("google") && /* @__PURE__ */ b.jsxs(
2385
+ "button",
2386
+ {
2387
+ className: "authifyer-provider-btn",
2388
+ onClick: () => t.signInWithOAuth("google"),
2389
+ children: [
2390
+ /* @__PURE__ */ b.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2391
+ /* @__PURE__ */ b.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" }),
2392
+ /* @__PURE__ */ b.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" }),
2393
+ /* @__PURE__ */ b.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" }),
2394
+ /* @__PURE__ */ b.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" })
2395
+ ] }),
2396
+ "Continue with Google"
2397
+ ]
2398
+ }
2399
+ ),
2400
+ m.includes("github") && /* @__PURE__ */ b.jsxs(
2401
+ "button",
2402
+ {
2403
+ className: "authifyer-provider-btn",
2404
+ onClick: () => t.signInWithOAuth("github"),
2405
+ children: [
2406
+ /* @__PURE__ */ b.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ b.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" }) }),
2407
+ "Continue with GitHub"
2408
+ ]
2409
+ }
2410
+ )
2411
+ ] }),
2412
+ (m.includes("google") || m.includes("github")) && u && /* @__PURE__ */ b.jsx("div", { className: "authifyer-divider", children: "or" }),
2413
+ u && /* @__PURE__ */ b.jsxs("form", { onSubmit: E, className: "authifyer-form", children: [
2414
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form-group", children: [
2415
+ /* @__PURE__ */ b.jsx("label", { className: "authifyer-label", children: "Email address" }),
2416
+ /* @__PURE__ */ b.jsx(
2417
+ "input",
2418
+ {
2419
+ type: "email",
2420
+ className: "authifyer-input",
2421
+ value: r,
2422
+ onChange: (R) => n(R.target.value),
2423
+ required: !0
2424
+ }
2425
+ )
2426
+ ] }),
2427
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form-group", children: [
2428
+ /* @__PURE__ */ b.jsx("label", { className: "authifyer-label", children: "Password" }),
2429
+ /* @__PURE__ */ b.jsx(
2430
+ "input",
2431
+ {
2432
+ type: "password",
2433
+ className: "authifyer-input",
2434
+ value: s,
2435
+ onChange: (R) => o(R.target.value),
2436
+ required: !0
2437
+ }
2438
+ )
2439
+ ] }),
2440
+ /* @__PURE__ */ b.jsx("button", { type: "submit", className: "authifyer-submit-btn", disabled: p, children: p ? "Signing In..." : "Continue" })
2441
+ ] })
2442
+ ] });
2443
+ }, es = () => {
2444
+ const { client: t, config: e } = he(), [r, n] = F(""), [s, o] = F(""), [i, c] = F(""), [p, d] = F(!1), [u, m] = F(!1), E = (e == null ? void 0 : e.emailPasswordEnabled) ?? !0, R = (e == null ? void 0 : e.oauthProviders) ?? ["google", "github"], f = async (y) => {
2445
+ y.preventDefault(), d(!0), c("");
2446
+ try {
2447
+ await t.signUpWithEmail(r, s), m(!0);
2448
+ } catch {
2449
+ c("Registration failed. User might already exist.");
2450
+ } finally {
2451
+ d(!1);
2452
+ }
2453
+ };
2454
+ return u ? /* @__PURE__ */ b.jsx(De, { title: "Welcome!", children: /* @__PURE__ */ b.jsxs("div", { className: "authifyer-success", children: [
2455
+ /* @__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" }) }),
2456
+ /* @__PURE__ */ b.jsxs("div", { children: [
2457
+ /* @__PURE__ */ b.jsx("h3", { className: "authifyer-success-title", children: "Success" }),
2458
+ /* @__PURE__ */ b.jsx("p", { className: "authifyer-success-text", children: "Registration completed. Please verify your email." })
2459
+ ] })
2460
+ ] }) }) : /* @__PURE__ */ b.jsxs(De, { title: "Create your account", subtitle: "Welcome to Authifyer", children: [
2461
+ i && /* @__PURE__ */ b.jsx("p", { className: "authifyer-error", children: i }),
2462
+ (R.includes("google") || R.includes("github")) && /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form", children: [
2463
+ R.includes("google") && /* @__PURE__ */ b.jsxs(
2464
+ "button",
2465
+ {
2466
+ className: "authifyer-provider-btn",
2467
+ onClick: () => t.signInWithOAuth("google"),
2468
+ children: [
2469
+ /* @__PURE__ */ b.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2470
+ /* @__PURE__ */ b.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" }),
2471
+ /* @__PURE__ */ b.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" }),
2472
+ /* @__PURE__ */ b.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" }),
2473
+ /* @__PURE__ */ b.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" })
2474
+ ] }),
2475
+ "Continue with Google"
2476
+ ]
2477
+ }
2478
+ ),
2479
+ R.includes("github") && /* @__PURE__ */ b.jsxs(
2480
+ "button",
2481
+ {
2482
+ className: "authifyer-provider-btn",
2483
+ onClick: () => t.signInWithOAuth("github"),
2484
+ children: [
2485
+ /* @__PURE__ */ b.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ b.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" }) }),
2486
+ "Continue with GitHub"
2487
+ ]
2488
+ }
2489
+ )
2490
+ ] }),
2491
+ (R.includes("google") || R.includes("github")) && E && /* @__PURE__ */ b.jsx("div", { className: "authifyer-divider", children: "or" }),
2492
+ E && /* @__PURE__ */ b.jsxs("form", { onSubmit: f, className: "authifyer-form", children: [
2493
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form-group", children: [
2494
+ /* @__PURE__ */ b.jsx("label", { className: "authifyer-label", children: "Email address" }),
2495
+ /* @__PURE__ */ b.jsx(
2496
+ "input",
2497
+ {
2498
+ type: "email",
2499
+ className: "authifyer-input",
2500
+ value: r,
2501
+ onChange: (y) => n(y.target.value),
2502
+ required: !0
2503
+ }
2504
+ )
2505
+ ] }),
2506
+ /* @__PURE__ */ b.jsxs("div", { className: "authifyer-form-group", children: [
2507
+ /* @__PURE__ */ b.jsx("label", { className: "authifyer-label", children: "Password" }),
2508
+ /* @__PURE__ */ b.jsx(
2509
+ "input",
2510
+ {
2511
+ type: "password",
2512
+ className: "authifyer-input",
2513
+ value: s,
2514
+ onChange: (y) => o(y.target.value),
2515
+ required: !0
2516
+ }
2517
+ )
2518
+ ] }),
2519
+ /* @__PURE__ */ b.jsx("button", { type: "submit", className: "authifyer-submit-btn", disabled: p, children: p ? "Signing Up..." : "Continue" })
2520
+ ] })
2521
+ ] });
2522
+ };
2523
+ export {
2524
+ Kn as AuthifyerProvider,
2525
+ Zn as SignIn,
2526
+ es as SignUp,
2527
+ he as useAuth,
2528
+ Qn as useAuthifyer,
2529
+ Gn as useSession,
2530
+ Xn as useUser
2531
+ };