@odynn/awayz-core 0.10.30 → 0.10.31

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.
Files changed (42) hide show
  1. package/dist/AccountService-B582vLTc.js +2149 -0
  2. package/dist/{TripsService-B2m7Yy9W.js → TripsService-BwBvXdDC.js} +6 -6
  3. package/dist/assets/_styles5.css +1 -1
  4. package/dist/assets/_styles6.css +1 -1
  5. package/dist/assets/_styles7.css +1 -0
  6. package/dist/components/CashValue/CashValue.js +15 -13
  7. package/dist/components/CashValue/CashValue.stories.js +22 -21
  8. package/dist/components/ClientPointsValue/ClientPointsValue.js +20 -18
  9. package/dist/components/Modal/Modal.js +1 -1
  10. package/dist/components/Tooltip/Tooltip.js +1 -1
  11. package/dist/components/Wallet/Card/Card.stories.js +16 -14
  12. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +15 -13
  13. package/dist/hooks/useBookingManagement/useBookingManagement.js +6 -4
  14. package/dist/hooks/useBookingManagement/useBookingManagement.test.js +5 -3
  15. package/dist/hooks/useFeatureFlags.js +1 -1
  16. package/dist/hooks/useSearchLimit.js +1 -1
  17. package/dist/hooks/useTripManagement/useTripManagement.js +7 -5
  18. package/dist/hooks/useTripManagement/useTripManagement.test.js +5 -3
  19. package/dist/hooks/useWallet/useWallet.js +31 -29
  20. package/dist/hooks/useWallet/useWallet.test.js +4 -2
  21. package/dist/lib/services/account/AccountService.d.ts +12 -2
  22. package/dist/lib/services/account/AccountServices.types.d.ts +13 -0
  23. package/dist/lib/services/index.d.ts +2 -0
  24. package/dist/lib/services/instanceConfig.d.ts +1 -1
  25. package/dist/main.js +43 -39
  26. package/dist/providers/AwayzProvider.js +10 -8
  27. package/dist/services/account/AccountService.js +3 -2
  28. package/dist/services/bookings/BookingService.js +3 -3
  29. package/dist/services/currency/CurrencyService.js +16 -14
  30. package/dist/services/features/featureService.js +1 -1
  31. package/dist/services/index.js +13 -9
  32. package/dist/services/instance.js +1 -1
  33. package/dist/services/instanceConfig.js +8 -20
  34. package/dist/services/noRetryInstance.js +9 -2
  35. package/dist/services/preferences/PreferencesService.js +1 -1
  36. package/dist/services/rewards/RewardsService.js +1 -1
  37. package/dist/services/trips/TripsService.js +2 -2
  38. package/dist/services/wallet/WalletService.js +1 -1
  39. package/dist/utils/clientPoints.js +6 -4
  40. package/package.json +1 -1
  41. package/dist/assets/noRetryInstance.css +0 -1
  42. package/dist/noRetryInstance-DNLgOg0E.js +0 -2134
@@ -1,2134 +0,0 @@
1
- import './assets/_styles4.css';import './assets/_styles6.css';import './assets/_styles5.css';import './assets/_styles2.css';import './assets/_styles.css';import './assets/_styles3.css';import './assets/noRetryInstance.css';var pt = Object.defineProperty;
2
- var ht = (e, t, n) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var I = (e, t, n) => ht(e, typeof t != "symbol" ? t + "" : t, n);
4
- import "react/jsx-runtime";
5
- import "./arrayExtensions-DlcBOj5a.js";
6
- import { a as U } from "./keys-BcBfU51M.js";
7
- import "react";
8
- import { getBaseUrl as He } from "./configs/baseUrl.js";
9
- import { EAuthEndpoints as T } from "./configs/endpoints.js";
10
- import { getGatewayBaseUrl as mt } from "./configs/gatewayBaseUrl.js";
11
- import "@tanstack/react-query";
12
- import "react-i18next";
13
- /* empty css */
14
- /* empty css */
15
- /* empty css */
16
- import { awayzClient as G } from "./configs/awayzClient.js";
17
- /* empty css */
18
- /* empty css */
19
- import "./index-Cv-wvFlM.js";
20
- import "./context/AwayzContext.js";
21
- /* empty css */
22
- import { EAuthFlow as Et } from "./types/EAuthFlow.js";
23
- const L = (e) => Array.isArray(e) ? e.map((t) => L(t)) : typeof e == "object" && e !== null ? Object.keys(e).reduce((t, n) => {
24
- const r = St(n);
25
- return t[r] = L(e[n]), t;
26
- }, {}) : e;
27
- function Rt(e) {
28
- return e.replace(/([A-Z])/g, "_$1").toLowerCase();
29
- }
30
- const Te = (e) => Array.isArray(e) ? e.map((t) => Te(t)) : typeof e == "object" && e !== null ? Object.keys(e).reduce((t, n) => {
31
- const r = Rt(n);
32
- return t[r] = Te(e[n]), t;
33
- }, {}) : e, gt = (e) => (Object.keys(e).forEach(
34
- (t) => !e[t] && delete e[t]
35
- ), e), St = (e) => (e = e.replace(/^_+/, ""), e.replace(/_([a-z])/gi, (t, n) => n.toUpperCase()));
36
- var q = /* @__PURE__ */ ((e) => (e.LOCATIONS = "LOCATIONS", e.CHECK_USER = "CHECK_USER", e.USER_REGIONS = "USER_REGIONS", e.CONVERT_CURRENCY = "CONVERT_CURRENCY", e.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", e.SEARCH_LIMIT = "SEARCH_LIMIT", e.PROGRAMS = "PROGRAMS", e.USER_PROGRAMS = "USER_PROGRAMS", e.LINKED_USER_PROGRAMS = "LINKED_USER_PROGRAMS", e.BANKS = "BANKS", e.CARDS = "CARDS", e.USER_CARDS = "USER_CARDS", e.TRIPS = "TRIPS", e.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", e.BOOKING = "BOOKING", e.VALUE_CENTS = "VALUE_CENTS", e.AVAILABILITY_ALERTS = "AVAILABILITY_ALERTS", e.ALERT_NOTIFICATIONS = "ALERT_NOTIFICATIONS", e.POINTS_AS_CASH = "POINTS_AS_CASH", e.GET_USER_REGION = "get_user_region", e.PRICING = "pricing", e.FAQS = "faqs", e.FEATURES = "features", e.AIRLINE_HEALTH = "airline_health", e.SUPPORTED_AIRLINE_PROGRAMS = "supported_airline_programs", e.CLIENT_DETAILS = "client-details", e))(q || {}), yt = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.AIRLINE = "Airline", e.BANK = "Bank", e))(yt || {});
37
- function Me(e, t) {
38
- return function() {
39
- return e.apply(t, arguments);
40
- };
41
- }
42
- const { toString: wt } = Object.prototype, { getPrototypeOf: ge } = Object, { iterator: te, toStringTag: je } = Symbol, ne = /* @__PURE__ */ ((e) => (t) => {
43
- const n = wt.call(t);
44
- return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
45
- })(/* @__PURE__ */ Object.create(null)), x = (e) => (e = e.toLowerCase(), (t) => ne(t) === e), re = (e) => (t) => typeof t === e, { isArray: z } = Array, v = re("undefined");
46
- function Tt(e) {
47
- return e !== null && !v(e) && e.constructor !== null && !v(e.constructor) && N(e.constructor.isBuffer) && e.constructor.isBuffer(e);
48
- }
49
- const Ge = x("ArrayBuffer");
50
- function bt(e) {
51
- let t;
52
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ge(e.buffer), t;
53
- }
54
- const Ot = re("string"), N = re("function"), ze = re("number"), se = (e) => e !== null && typeof e == "object", At = (e) => e === !0 || e === !1, X = (e) => {
55
- if (ne(e) !== "object")
56
- return !1;
57
- const t = ge(e);
58
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(je in e) && !(te in e);
59
- }, _t = x("Date"), Nt = x("File"), Ct = x("Blob"), It = x("FileList"), Ut = (e) => se(e) && N(e.pipe), Lt = (e) => {
60
- let t;
61
- return e && (typeof FormData == "function" && e instanceof FormData || N(e.append) && ((t = ne(e)) === "formdata" || // detect form-data instance
62
- t === "object" && N(e.toString) && e.toString() === "[object FormData]"));
63
- }, xt = x("URLSearchParams"), [Pt, kt, Ft, Dt] = ["ReadableStream", "Request", "Response", "Headers"].map(x), Bt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
64
- function V(e, t, { allOwnKeys: n = !1 } = {}) {
65
- if (e === null || typeof e > "u")
66
- return;
67
- let r, s;
68
- if (typeof e != "object" && (e = [e]), z(e))
69
- for (r = 0, s = e.length; r < s; r++)
70
- t.call(null, e[r], r, e);
71
- else {
72
- const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
73
- let c;
74
- for (r = 0; r < i; r++)
75
- c = o[r], t.call(null, e[c], c, e);
76
- }
77
- }
78
- function $e(e, t) {
79
- t = t.toLowerCase();
80
- const n = Object.keys(e);
81
- let r = n.length, s;
82
- for (; r-- > 0; )
83
- if (s = n[r], t === s.toLowerCase())
84
- return s;
85
- return null;
86
- }
87
- const H = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ke = (e) => !v(e) && e !== H;
88
- function fe() {
89
- const { caseless: e } = Ke(this) && this || {}, t = {}, n = (r, s) => {
90
- const o = e && $e(t, s) || s;
91
- X(t[o]) && X(r) ? t[o] = fe(t[o], r) : X(r) ? t[o] = fe({}, r) : z(r) ? t[o] = r.slice() : t[o] = r;
92
- };
93
- for (let r = 0, s = arguments.length; r < s; r++)
94
- arguments[r] && V(arguments[r], n);
95
- return t;
96
- }
97
- const qt = (e, t, n, { allOwnKeys: r } = {}) => (V(t, (s, o) => {
98
- n && N(s) ? e[o] = Me(s, n) : e[o] = s;
99
- }, { allOwnKeys: r }), e), Ht = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Mt = (e, t, n, r) => {
100
- e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
101
- value: t.prototype
102
- }), n && Object.assign(e.prototype, n);
103
- }, jt = (e, t, n, r) => {
104
- let s, o, i;
105
- const c = {};
106
- if (t = t || {}, e == null) return t;
107
- do {
108
- for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
109
- i = s[o], (!r || r(i, e, t)) && !c[i] && (t[i] = e[i], c[i] = !0);
110
- e = n !== !1 && ge(e);
111
- } while (e && (!n || n(e, t)) && e !== Object.prototype);
112
- return t;
113
- }, Gt = (e, t, n) => {
114
- e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
115
- const r = e.indexOf(t, n);
116
- return r !== -1 && r === n;
117
- }, zt = (e) => {
118
- if (!e) return null;
119
- if (z(e)) return e;
120
- let t = e.length;
121
- if (!ze(t)) return null;
122
- const n = new Array(t);
123
- for (; t-- > 0; )
124
- n[t] = e[t];
125
- return n;
126
- }, $t = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ge(Uint8Array)), Kt = (e, t) => {
127
- const r = (e && e[te]).call(e);
128
- let s;
129
- for (; (s = r.next()) && !s.done; ) {
130
- const o = s.value;
131
- t.call(e, o[0], o[1]);
132
- }
133
- }, vt = (e, t) => {
134
- let n;
135
- const r = [];
136
- for (; (n = e.exec(t)) !== null; )
137
- r.push(n);
138
- return r;
139
- }, Vt = x("HTMLFormElement"), Jt = (e) => e.toLowerCase().replace(
140
- /[-_\s]([a-z\d])(\w*)/g,
141
- function(n, r, s) {
142
- return r.toUpperCase() + s;
143
- }
144
- ), be = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Wt = x("RegExp"), ve = (e, t) => {
145
- const n = Object.getOwnPropertyDescriptors(e), r = {};
146
- V(n, (s, o) => {
147
- let i;
148
- (i = t(s, o, e)) !== !1 && (r[o] = i || s);
149
- }), Object.defineProperties(e, r);
150
- }, Xt = (e) => {
151
- ve(e, (t, n) => {
152
- if (N(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
153
- return !1;
154
- const r = e[n];
155
- if (N(r)) {
156
- if (t.enumerable = !1, "writable" in t) {
157
- t.writable = !1;
158
- return;
159
- }
160
- t.set || (t.set = () => {
161
- throw Error("Can not rewrite read-only method '" + n + "'");
162
- });
163
- }
164
- });
165
- }, Yt = (e, t) => {
166
- const n = {}, r = (s) => {
167
- s.forEach((o) => {
168
- n[o] = !0;
169
- });
170
- };
171
- return z(e) ? r(e) : r(String(e).split(t)), n;
172
- }, Zt = () => {
173
- }, Qt = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
174
- function en(e) {
175
- return !!(e && N(e.append) && e[je] === "FormData" && e[te]);
176
- }
177
- const tn = (e) => {
178
- const t = new Array(10), n = (r, s) => {
179
- if (se(r)) {
180
- if (t.indexOf(r) >= 0)
181
- return;
182
- if (!("toJSON" in r)) {
183
- t[s] = r;
184
- const o = z(r) ? [] : {};
185
- return V(r, (i, c) => {
186
- const f = n(i, s + 1);
187
- !v(f) && (o[c] = f);
188
- }), t[s] = void 0, o;
189
- }
190
- }
191
- return r;
192
- };
193
- return n(e, 0);
194
- }, nn = x("AsyncFunction"), rn = (e) => e && (se(e) || N(e)) && N(e.then) && N(e.catch), Ve = ((e, t) => e ? setImmediate : t ? ((n, r) => (H.addEventListener("message", ({ source: s, data: o }) => {
195
- s === H && o === n && r.length && r.shift()();
196
- }, !1), (s) => {
197
- r.push(s), H.postMessage(n, "*");
198
- }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
199
- typeof setImmediate == "function",
200
- N(H.postMessage)
201
- ), sn = typeof queueMicrotask < "u" ? queueMicrotask.bind(H) : typeof process < "u" && process.nextTick || Ve, on = (e) => e != null && N(e[te]), a = {
202
- isArray: z,
203
- isArrayBuffer: Ge,
204
- isBuffer: Tt,
205
- isFormData: Lt,
206
- isArrayBufferView: bt,
207
- isString: Ot,
208
- isNumber: ze,
209
- isBoolean: At,
210
- isObject: se,
211
- isPlainObject: X,
212
- isReadableStream: Pt,
213
- isRequest: kt,
214
- isResponse: Ft,
215
- isHeaders: Dt,
216
- isUndefined: v,
217
- isDate: _t,
218
- isFile: Nt,
219
- isBlob: Ct,
220
- isRegExp: Wt,
221
- isFunction: N,
222
- isStream: Ut,
223
- isURLSearchParams: xt,
224
- isTypedArray: $t,
225
- isFileList: It,
226
- forEach: V,
227
- merge: fe,
228
- extend: qt,
229
- trim: Bt,
230
- stripBOM: Ht,
231
- inherits: Mt,
232
- toFlatObject: jt,
233
- kindOf: ne,
234
- kindOfTest: x,
235
- endsWith: Gt,
236
- toArray: zt,
237
- forEachEntry: Kt,
238
- matchAll: vt,
239
- isHTMLForm: Vt,
240
- hasOwnProperty: be,
241
- hasOwnProp: be,
242
- // an alias to avoid ESLint no-prototype-builtins detection
243
- reduceDescriptors: ve,
244
- freezeMethods: Xt,
245
- toObjectSet: Yt,
246
- toCamelCase: Jt,
247
- noop: Zt,
248
- toFiniteNumber: Qt,
249
- findKey: $e,
250
- global: H,
251
- isContextDefined: Ke,
252
- isSpecCompliantForm: en,
253
- toJSONObject: tn,
254
- isAsyncFn: nn,
255
- isThenable: rn,
256
- setImmediate: Ve,
257
- asap: sn,
258
- isIterable: on
259
- };
260
- function E(e, t, n, r, s) {
261
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
262
- }
263
- a.inherits(E, Error, {
264
- toJSON: function() {
265
- return {
266
- // Standard
267
- message: this.message,
268
- name: this.name,
269
- // Microsoft
270
- description: this.description,
271
- number: this.number,
272
- // Mozilla
273
- fileName: this.fileName,
274
- lineNumber: this.lineNumber,
275
- columnNumber: this.columnNumber,
276
- stack: this.stack,
277
- // Axios
278
- config: a.toJSONObject(this.config),
279
- code: this.code,
280
- status: this.status
281
- };
282
- }
283
- });
284
- const Je = E.prototype, We = {};
285
- [
286
- "ERR_BAD_OPTION_VALUE",
287
- "ERR_BAD_OPTION",
288
- "ECONNABORTED",
289
- "ETIMEDOUT",
290
- "ERR_NETWORK",
291
- "ERR_FR_TOO_MANY_REDIRECTS",
292
- "ERR_DEPRECATED",
293
- "ERR_BAD_RESPONSE",
294
- "ERR_BAD_REQUEST",
295
- "ERR_CANCELED",
296
- "ERR_NOT_SUPPORT",
297
- "ERR_INVALID_URL"
298
- // eslint-disable-next-line func-names
299
- ].forEach((e) => {
300
- We[e] = { value: e };
301
- });
302
- Object.defineProperties(E, We);
303
- Object.defineProperty(Je, "isAxiosError", { value: !0 });
304
- E.from = (e, t, n, r, s, o) => {
305
- const i = Object.create(Je);
306
- return a.toFlatObject(e, i, function(f) {
307
- return f !== Error.prototype;
308
- }, (c) => c !== "isAxiosError"), E.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
309
- };
310
- const an = null;
311
- function de(e) {
312
- return a.isPlainObject(e) || a.isArray(e);
313
- }
314
- function Xe(e) {
315
- return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
316
- }
317
- function Oe(e, t, n) {
318
- return e ? e.concat(t).map(function(s, o) {
319
- return s = Xe(s), !n && o ? "[" + s + "]" : s;
320
- }).join(n ? "." : "") : t;
321
- }
322
- function cn(e) {
323
- return a.isArray(e) && !e.some(de);
324
- }
325
- const un = a.toFlatObject(a, {}, null, function(t) {
326
- return /^is[A-Z]/.test(t);
327
- });
328
- function oe(e, t, n) {
329
- if (!a.isObject(e))
330
- throw new TypeError("target must be an object");
331
- t = t || new FormData(), n = a.toFlatObject(n, {
332
- metaTokens: !0,
333
- dots: !1,
334
- indexes: !1
335
- }, !1, function(m, p) {
336
- return !a.isUndefined(p[m]);
337
- });
338
- const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
339
- if (!a.isFunction(s))
340
- throw new TypeError("visitor must be a function");
341
- function u(h) {
342
- if (h === null) return "";
343
- if (a.isDate(h))
344
- return h.toISOString();
345
- if (!f && a.isBlob(h))
346
- throw new E("Blob is not supported. Use a Buffer instead.");
347
- return a.isArrayBuffer(h) || a.isTypedArray(h) ? f && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
348
- }
349
- function l(h, m, p) {
350
- let y = h;
351
- if (h && !p && typeof h == "object") {
352
- if (a.endsWith(m, "{}"))
353
- m = r ? m : m.slice(0, -2), h = JSON.stringify(h);
354
- else if (a.isArray(h) && cn(h) || (a.isFileList(h) || a.endsWith(m, "[]")) && (y = a.toArray(h)))
355
- return m = Xe(m), y.forEach(function(b, k) {
356
- !(a.isUndefined(b) || b === null) && t.append(
357
- // eslint-disable-next-line no-nested-ternary
358
- i === !0 ? Oe([m], k, o) : i === null ? m : m + "[]",
359
- u(b)
360
- );
361
- }), !1;
362
- }
363
- return de(h) ? !0 : (t.append(Oe(p, m, o), u(h)), !1);
364
- }
365
- const d = [], R = Object.assign(un, {
366
- defaultVisitor: l,
367
- convertValue: u,
368
- isVisitable: de
369
- });
370
- function g(h, m) {
371
- if (!a.isUndefined(h)) {
372
- if (d.indexOf(h) !== -1)
373
- throw Error("Circular reference detected in " + m.join("."));
374
- d.push(h), a.forEach(h, function(y, w) {
375
- (!(a.isUndefined(y) || y === null) && s.call(
376
- t,
377
- y,
378
- a.isString(w) ? w.trim() : w,
379
- m,
380
- R
381
- )) === !0 && g(y, m ? m.concat(w) : [w]);
382
- }), d.pop();
383
- }
384
- }
385
- if (!a.isObject(e))
386
- throw new TypeError("data must be an object");
387
- return g(e), t;
388
- }
389
- function Ae(e) {
390
- const t = {
391
- "!": "%21",
392
- "'": "%27",
393
- "(": "%28",
394
- ")": "%29",
395
- "~": "%7E",
396
- "%20": "+",
397
- "%00": "\0"
398
- };
399
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
400
- return t[r];
401
- });
402
- }
403
- function Se(e, t) {
404
- this._pairs = [], e && oe(e, this, t);
405
- }
406
- const Ye = Se.prototype;
407
- Ye.append = function(t, n) {
408
- this._pairs.push([t, n]);
409
- };
410
- Ye.toString = function(t) {
411
- const n = t ? function(r) {
412
- return t.call(this, r, Ae);
413
- } : Ae;
414
- return this._pairs.map(function(s) {
415
- return n(s[0]) + "=" + n(s[1]);
416
- }, "").join("&");
417
- };
418
- function ln(e) {
419
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
420
- }
421
- function Ze(e, t, n) {
422
- if (!t)
423
- return e;
424
- const r = n && n.encode || ln;
425
- a.isFunction(n) && (n = {
426
- serialize: n
427
- });
428
- const s = n && n.serialize;
429
- let o;
430
- if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new Se(t, n).toString(r), o) {
431
- const i = e.indexOf("#");
432
- i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
433
- }
434
- return e;
435
- }
436
- class _e {
437
- constructor() {
438
- this.handlers = [];
439
- }
440
- /**
441
- * Add a new interceptor to the stack
442
- *
443
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
444
- * @param {Function} rejected The function to handle `reject` for a `Promise`
445
- *
446
- * @return {Number} An ID used to remove interceptor later
447
- */
448
- use(t, n, r) {
449
- return this.handlers.push({
450
- fulfilled: t,
451
- rejected: n,
452
- synchronous: r ? r.synchronous : !1,
453
- runWhen: r ? r.runWhen : null
454
- }), this.handlers.length - 1;
455
- }
456
- /**
457
- * Remove an interceptor from the stack
458
- *
459
- * @param {Number} id The ID that was returned by `use`
460
- *
461
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
462
- */
463
- eject(t) {
464
- this.handlers[t] && (this.handlers[t] = null);
465
- }
466
- /**
467
- * Clear all interceptors from the stack
468
- *
469
- * @returns {void}
470
- */
471
- clear() {
472
- this.handlers && (this.handlers = []);
473
- }
474
- /**
475
- * Iterate over all the registered interceptors
476
- *
477
- * This method is particularly useful for skipping over any
478
- * interceptors that may have become `null` calling `eject`.
479
- *
480
- * @param {Function} fn The function to call for each interceptor
481
- *
482
- * @returns {void}
483
- */
484
- forEach(t) {
485
- a.forEach(this.handlers, function(r) {
486
- r !== null && t(r);
487
- });
488
- }
489
- }
490
- const Qe = {
491
- silentJSONParsing: !0,
492
- forcedJSONParsing: !0,
493
- clarifyTimeoutError: !1
494
- }, fn = typeof URLSearchParams < "u" ? URLSearchParams : Se, dn = typeof FormData < "u" ? FormData : null, pn = typeof Blob < "u" ? Blob : null, hn = {
495
- isBrowser: !0,
496
- classes: {
497
- URLSearchParams: fn,
498
- FormData: dn,
499
- Blob: pn
500
- },
501
- protocols: ["http", "https", "file", "blob", "url", "data"]
502
- }, ye = typeof window < "u" && typeof document < "u", pe = typeof navigator == "object" && navigator || void 0, mn = ye && (!pe || ["ReactNative", "NativeScript", "NS"].indexOf(pe.product) < 0), En = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
503
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Rn = ye && window.location.href || "http://localhost", gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
504
- __proto__: null,
505
- hasBrowserEnv: ye,
506
- hasStandardBrowserEnv: mn,
507
- hasStandardBrowserWebWorkerEnv: En,
508
- navigator: pe,
509
- origin: Rn
510
- }, Symbol.toStringTag, { value: "Module" })), O = {
511
- ...gn,
512
- ...hn
513
- };
514
- function Sn(e, t) {
515
- return oe(e, new O.classes.URLSearchParams(), Object.assign({
516
- visitor: function(n, r, s, o) {
517
- return O.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
518
- }
519
- }, t));
520
- }
521
- function yn(e) {
522
- return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
523
- }
524
- function wn(e) {
525
- const t = {}, n = Object.keys(e);
526
- let r;
527
- const s = n.length;
528
- let o;
529
- for (r = 0; r < s; r++)
530
- o = n[r], t[o] = e[o];
531
- return t;
532
- }
533
- function et(e) {
534
- function t(n, r, s, o) {
535
- let i = n[o++];
536
- if (i === "__proto__") return !0;
537
- const c = Number.isFinite(+i), f = o >= n.length;
538
- return i = !i && a.isArray(s) ? s.length : i, f ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !c) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = wn(s[i])), !c);
539
- }
540
- if (a.isFormData(e) && a.isFunction(e.entries)) {
541
- const n = {};
542
- return a.forEachEntry(e, (r, s) => {
543
- t(yn(r), s, n, 0);
544
- }), n;
545
- }
546
- return null;
547
- }
548
- function Tn(e, t, n) {
549
- if (a.isString(e))
550
- try {
551
- return (t || JSON.parse)(e), a.trim(e);
552
- } catch (r) {
553
- if (r.name !== "SyntaxError")
554
- throw r;
555
- }
556
- return (n || JSON.stringify)(e);
557
- }
558
- const J = {
559
- transitional: Qe,
560
- adapter: ["xhr", "http", "fetch"],
561
- transformRequest: [function(t, n) {
562
- const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
563
- if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
564
- return s ? JSON.stringify(et(t)) : t;
565
- if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t) || a.isReadableStream(t))
566
- return t;
567
- if (a.isArrayBufferView(t))
568
- return t.buffer;
569
- if (a.isURLSearchParams(t))
570
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
571
- let c;
572
- if (o) {
573
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
574
- return Sn(t, this.formSerializer).toString();
575
- if ((c = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
576
- const f = this.env && this.env.FormData;
577
- return oe(
578
- c ? { "files[]": t } : t,
579
- f && new f(),
580
- this.formSerializer
581
- );
582
- }
583
- }
584
- return o || s ? (n.setContentType("application/json", !1), Tn(t)) : t;
585
- }],
586
- transformResponse: [function(t) {
587
- const n = this.transitional || J.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
588
- if (a.isResponse(t) || a.isReadableStream(t))
589
- return t;
590
- if (t && a.isString(t) && (r && !this.responseType || s)) {
591
- const i = !(n && n.silentJSONParsing) && s;
592
- try {
593
- return JSON.parse(t);
594
- } catch (c) {
595
- if (i)
596
- throw c.name === "SyntaxError" ? E.from(c, E.ERR_BAD_RESPONSE, this, null, this.response) : c;
597
- }
598
- }
599
- return t;
600
- }],
601
- /**
602
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
603
- * timeout is not created.
604
- */
605
- timeout: 0,
606
- xsrfCookieName: "XSRF-TOKEN",
607
- xsrfHeaderName: "X-XSRF-TOKEN",
608
- maxContentLength: -1,
609
- maxBodyLength: -1,
610
- env: {
611
- FormData: O.classes.FormData,
612
- Blob: O.classes.Blob
613
- },
614
- validateStatus: function(t) {
615
- return t >= 200 && t < 300;
616
- },
617
- headers: {
618
- common: {
619
- Accept: "application/json, text/plain, */*",
620
- "Content-Type": void 0
621
- }
622
- }
623
- };
624
- a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
625
- J.headers[e] = {};
626
- });
627
- const bn = a.toObjectSet([
628
- "age",
629
- "authorization",
630
- "content-length",
631
- "content-type",
632
- "etag",
633
- "expires",
634
- "from",
635
- "host",
636
- "if-modified-since",
637
- "if-unmodified-since",
638
- "last-modified",
639
- "location",
640
- "max-forwards",
641
- "proxy-authorization",
642
- "referer",
643
- "retry-after",
644
- "user-agent"
645
- ]), On = (e) => {
646
- const t = {};
647
- let n, r, s;
648
- return e && e.split(`
649
- `).forEach(function(i) {
650
- s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && bn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
651
- }), t;
652
- }, Ne = Symbol("internals");
653
- function K(e) {
654
- return e && String(e).trim().toLowerCase();
655
- }
656
- function Y(e) {
657
- return e === !1 || e == null ? e : a.isArray(e) ? e.map(Y) : String(e);
658
- }
659
- function An(e) {
660
- const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
661
- let r;
662
- for (; r = n.exec(e); )
663
- t[r[1]] = r[2];
664
- return t;
665
- }
666
- const _n = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
667
- function ce(e, t, n, r, s) {
668
- if (a.isFunction(r))
669
- return r.call(this, t, n);
670
- if (s && (t = n), !!a.isString(t)) {
671
- if (a.isString(r))
672
- return t.indexOf(r) !== -1;
673
- if (a.isRegExp(r))
674
- return r.test(t);
675
- }
676
- }
677
- function Nn(e) {
678
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
679
- }
680
- function Cn(e, t) {
681
- const n = a.toCamelCase(" " + t);
682
- ["get", "set", "has"].forEach((r) => {
683
- Object.defineProperty(e, r + n, {
684
- value: function(s, o, i) {
685
- return this[r].call(this, t, s, o, i);
686
- },
687
- configurable: !0
688
- });
689
- });
690
- }
691
- let C = class {
692
- constructor(t) {
693
- t && this.set(t);
694
- }
695
- set(t, n, r) {
696
- const s = this;
697
- function o(c, f, u) {
698
- const l = K(f);
699
- if (!l)
700
- throw new Error("header name must be a non-empty string");
701
- const d = a.findKey(s, l);
702
- (!d || s[d] === void 0 || u === !0 || u === void 0 && s[d] !== !1) && (s[d || f] = Y(c));
703
- }
704
- const i = (c, f) => a.forEach(c, (u, l) => o(u, l, f));
705
- if (a.isPlainObject(t) || t instanceof this.constructor)
706
- i(t, n);
707
- else if (a.isString(t) && (t = t.trim()) && !_n(t))
708
- i(On(t), n);
709
- else if (a.isObject(t) && a.isIterable(t)) {
710
- let c = {}, f, u;
711
- for (const l of t) {
712
- if (!a.isArray(l))
713
- throw TypeError("Object iterator must return a key-value pair");
714
- c[u = l[0]] = (f = c[u]) ? a.isArray(f) ? [...f, l[1]] : [f, l[1]] : l[1];
715
- }
716
- i(c, n);
717
- } else
718
- t != null && o(n, t, r);
719
- return this;
720
- }
721
- get(t, n) {
722
- if (t = K(t), t) {
723
- const r = a.findKey(this, t);
724
- if (r) {
725
- const s = this[r];
726
- if (!n)
727
- return s;
728
- if (n === !0)
729
- return An(s);
730
- if (a.isFunction(n))
731
- return n.call(this, s, r);
732
- if (a.isRegExp(n))
733
- return n.exec(s);
734
- throw new TypeError("parser must be boolean|regexp|function");
735
- }
736
- }
737
- }
738
- has(t, n) {
739
- if (t = K(t), t) {
740
- const r = a.findKey(this, t);
741
- return !!(r && this[r] !== void 0 && (!n || ce(this, this[r], r, n)));
742
- }
743
- return !1;
744
- }
745
- delete(t, n) {
746
- const r = this;
747
- let s = !1;
748
- function o(i) {
749
- if (i = K(i), i) {
750
- const c = a.findKey(r, i);
751
- c && (!n || ce(r, r[c], c, n)) && (delete r[c], s = !0);
752
- }
753
- }
754
- return a.isArray(t) ? t.forEach(o) : o(t), s;
755
- }
756
- clear(t) {
757
- const n = Object.keys(this);
758
- let r = n.length, s = !1;
759
- for (; r--; ) {
760
- const o = n[r];
761
- (!t || ce(this, this[o], o, t, !0)) && (delete this[o], s = !0);
762
- }
763
- return s;
764
- }
765
- normalize(t) {
766
- const n = this, r = {};
767
- return a.forEach(this, (s, o) => {
768
- const i = a.findKey(r, o);
769
- if (i) {
770
- n[i] = Y(s), delete n[o];
771
- return;
772
- }
773
- const c = t ? Nn(o) : String(o).trim();
774
- c !== o && delete n[o], n[c] = Y(s), r[c] = !0;
775
- }), this;
776
- }
777
- concat(...t) {
778
- return this.constructor.concat(this, ...t);
779
- }
780
- toJSON(t) {
781
- const n = /* @__PURE__ */ Object.create(null);
782
- return a.forEach(this, (r, s) => {
783
- r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
784
- }), n;
785
- }
786
- [Symbol.iterator]() {
787
- return Object.entries(this.toJSON())[Symbol.iterator]();
788
- }
789
- toString() {
790
- return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
791
- `);
792
- }
793
- getSetCookie() {
794
- return this.get("set-cookie") || [];
795
- }
796
- get [Symbol.toStringTag]() {
797
- return "AxiosHeaders";
798
- }
799
- static from(t) {
800
- return t instanceof this ? t : new this(t);
801
- }
802
- static concat(t, ...n) {
803
- const r = new this(t);
804
- return n.forEach((s) => r.set(s)), r;
805
- }
806
- static accessor(t) {
807
- const r = (this[Ne] = this[Ne] = {
808
- accessors: {}
809
- }).accessors, s = this.prototype;
810
- function o(i) {
811
- const c = K(i);
812
- r[c] || (Cn(s, i), r[c] = !0);
813
- }
814
- return a.isArray(t) ? t.forEach(o) : o(t), this;
815
- }
816
- };
817
- C.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
818
- a.reduceDescriptors(C.prototype, ({ value: e }, t) => {
819
- let n = t[0].toUpperCase() + t.slice(1);
820
- return {
821
- get: () => e,
822
- set(r) {
823
- this[n] = r;
824
- }
825
- };
826
- });
827
- a.freezeMethods(C);
828
- function ue(e, t) {
829
- const n = this || J, r = t || n, s = C.from(r.headers);
830
- let o = r.data;
831
- return a.forEach(e, function(c) {
832
- o = c.call(n, o, s.normalize(), t ? t.status : void 0);
833
- }), s.normalize(), o;
834
- }
835
- function tt(e) {
836
- return !!(e && e.__CANCEL__);
837
- }
838
- function $(e, t, n) {
839
- E.call(this, e ?? "canceled", E.ERR_CANCELED, t, n), this.name = "CanceledError";
840
- }
841
- a.inherits($, E, {
842
- __CANCEL__: !0
843
- });
844
- function nt(e, t, n) {
845
- const r = n.config.validateStatus;
846
- !n.status || !r || r(n.status) ? e(n) : t(new E(
847
- "Request failed with status code " + n.status,
848
- [E.ERR_BAD_REQUEST, E.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
849
- n.config,
850
- n.request,
851
- n
852
- ));
853
- }
854
- function In(e) {
855
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
856
- return t && t[1] || "";
857
- }
858
- function Un(e, t) {
859
- e = e || 10;
860
- const n = new Array(e), r = new Array(e);
861
- let s = 0, o = 0, i;
862
- return t = t !== void 0 ? t : 1e3, function(f) {
863
- const u = Date.now(), l = r[o];
864
- i || (i = u), n[s] = f, r[s] = u;
865
- let d = o, R = 0;
866
- for (; d !== s; )
867
- R += n[d++], d = d % e;
868
- if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
869
- return;
870
- const g = l && u - l;
871
- return g ? Math.round(R * 1e3 / g) : void 0;
872
- };
873
- }
874
- function Ln(e, t) {
875
- let n = 0, r = 1e3 / t, s, o;
876
- const i = (u, l = Date.now()) => {
877
- n = l, s = null, o && (clearTimeout(o), o = null), e.apply(null, u);
878
- };
879
- return [(...u) => {
880
- const l = Date.now(), d = l - n;
881
- d >= r ? i(u, l) : (s = u, o || (o = setTimeout(() => {
882
- o = null, i(s);
883
- }, r - d)));
884
- }, () => s && i(s)];
885
- }
886
- const Q = (e, t, n = 3) => {
887
- let r = 0;
888
- const s = Un(50, 250);
889
- return Ln((o) => {
890
- const i = o.loaded, c = o.lengthComputable ? o.total : void 0, f = i - r, u = s(f), l = i <= c;
891
- r = i;
892
- const d = {
893
- loaded: i,
894
- total: c,
895
- progress: c ? i / c : void 0,
896
- bytes: f,
897
- rate: u || void 0,
898
- estimated: u && c && l ? (c - i) / u : void 0,
899
- event: o,
900
- lengthComputable: c != null,
901
- [t ? "download" : "upload"]: !0
902
- };
903
- e(d);
904
- }, n);
905
- }, Ce = (e, t) => {
906
- const n = e != null;
907
- return [(r) => t[0]({
908
- lengthComputable: n,
909
- total: e,
910
- loaded: r
911
- }), t[1]];
912
- }, Ie = (e) => (...t) => a.asap(() => e(...t)), xn = O.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, O.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
913
- new URL(O.origin),
914
- O.navigator && /(msie|trident)/i.test(O.navigator.userAgent)
915
- ) : () => !0, Pn = O.hasStandardBrowserEnv ? (
916
- // Standard browser envs support document.cookie
917
- {
918
- write(e, t, n, r, s, o) {
919
- const i = [e + "=" + encodeURIComponent(t)];
920
- a.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), a.isString(r) && i.push("path=" + r), a.isString(s) && i.push("domain=" + s), o === !0 && i.push("secure"), document.cookie = i.join("; ");
921
- },
922
- read(e) {
923
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
924
- return t ? decodeURIComponent(t[3]) : null;
925
- },
926
- remove(e) {
927
- this.write(e, "", Date.now() - 864e5);
928
- }
929
- }
930
- ) : (
931
- // Non-standard browser env (web workers, react-native) lack needed support.
932
- {
933
- write() {
934
- },
935
- read() {
936
- return null;
937
- },
938
- remove() {
939
- }
940
- }
941
- );
942
- function kn(e) {
943
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
944
- }
945
- function Fn(e, t) {
946
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
947
- }
948
- function rt(e, t, n) {
949
- let r = !kn(t);
950
- return e && (r || n == !1) ? Fn(e, t) : t;
951
- }
952
- const Ue = (e) => e instanceof C ? { ...e } : e;
953
- function j(e, t) {
954
- t = t || {};
955
- const n = {};
956
- function r(u, l, d, R) {
957
- return a.isPlainObject(u) && a.isPlainObject(l) ? a.merge.call({ caseless: R }, u, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
958
- }
959
- function s(u, l, d, R) {
960
- if (a.isUndefined(l)) {
961
- if (!a.isUndefined(u))
962
- return r(void 0, u, d, R);
963
- } else return r(u, l, d, R);
964
- }
965
- function o(u, l) {
966
- if (!a.isUndefined(l))
967
- return r(void 0, l);
968
- }
969
- function i(u, l) {
970
- if (a.isUndefined(l)) {
971
- if (!a.isUndefined(u))
972
- return r(void 0, u);
973
- } else return r(void 0, l);
974
- }
975
- function c(u, l, d) {
976
- if (d in t)
977
- return r(u, l);
978
- if (d in e)
979
- return r(void 0, u);
980
- }
981
- const f = {
982
- url: o,
983
- method: o,
984
- data: o,
985
- baseURL: i,
986
- transformRequest: i,
987
- transformResponse: i,
988
- paramsSerializer: i,
989
- timeout: i,
990
- timeoutMessage: i,
991
- withCredentials: i,
992
- withXSRFToken: i,
993
- adapter: i,
994
- responseType: i,
995
- xsrfCookieName: i,
996
- xsrfHeaderName: i,
997
- onUploadProgress: i,
998
- onDownloadProgress: i,
999
- decompress: i,
1000
- maxContentLength: i,
1001
- maxBodyLength: i,
1002
- beforeRedirect: i,
1003
- transport: i,
1004
- httpAgent: i,
1005
- httpsAgent: i,
1006
- cancelToken: i,
1007
- socketPath: i,
1008
- responseEncoding: i,
1009
- validateStatus: c,
1010
- headers: (u, l, d) => s(Ue(u), Ue(l), d, !0)
1011
- };
1012
- return a.forEach(Object.keys(Object.assign({}, e, t)), function(l) {
1013
- const d = f[l] || s, R = d(e[l], t[l], l);
1014
- a.isUndefined(R) && d !== c || (n[l] = R);
1015
- }), n;
1016
- }
1017
- const st = (e) => {
1018
- const t = j({}, e);
1019
- let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = t;
1020
- t.headers = i = C.from(i), t.url = Ze(rt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && i.set(
1021
- "Authorization",
1022
- "Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
1023
- );
1024
- let f;
1025
- if (a.isFormData(n)) {
1026
- if (O.hasStandardBrowserEnv || O.hasStandardBrowserWebWorkerEnv)
1027
- i.setContentType(void 0);
1028
- else if ((f = i.getContentType()) !== !1) {
1029
- const [u, ...l] = f ? f.split(";").map((d) => d.trim()).filter(Boolean) : [];
1030
- i.setContentType([u || "multipart/form-data", ...l].join("; "));
1031
- }
1032
- }
1033
- if (O.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 && xn(t.url))) {
1034
- const u = s && o && Pn.read(o);
1035
- u && i.set(s, u);
1036
- }
1037
- return t;
1038
- }, Dn = typeof XMLHttpRequest < "u", Bn = Dn && function(e) {
1039
- return new Promise(function(n, r) {
1040
- const s = st(e);
1041
- let o = s.data;
1042
- const i = C.from(s.headers).normalize();
1043
- let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, d, R, g, h;
1044
- function m() {
1045
- g && g(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1046
- }
1047
- let p = new XMLHttpRequest();
1048
- p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
1049
- function y() {
1050
- if (!p)
1051
- return;
1052
- const b = C.from(
1053
- "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1054
- ), _ = {
1055
- data: !c || c === "text" || c === "json" ? p.responseText : p.response,
1056
- status: p.status,
1057
- statusText: p.statusText,
1058
- headers: b,
1059
- config: e,
1060
- request: p
1061
- };
1062
- nt(function(B) {
1063
- n(B), m();
1064
- }, function(B) {
1065
- r(B), m();
1066
- }, _), p = null;
1067
- }
1068
- "onloadend" in p ? p.onloadend = y : p.onreadystatechange = function() {
1069
- !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(y);
1070
- }, p.onabort = function() {
1071
- p && (r(new E("Request aborted", E.ECONNABORTED, e, p)), p = null);
1072
- }, p.onerror = function() {
1073
- r(new E("Network Error", E.ERR_NETWORK, e, p)), p = null;
1074
- }, p.ontimeout = function() {
1075
- let k = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1076
- const _ = s.transitional || Qe;
1077
- s.timeoutErrorMessage && (k = s.timeoutErrorMessage), r(new E(
1078
- k,
1079
- _.clarifyTimeoutError ? E.ETIMEDOUT : E.ECONNABORTED,
1080
- e,
1081
- p
1082
- )), p = null;
1083
- }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && a.forEach(i.toJSON(), function(k, _) {
1084
- p.setRequestHeader(_, k);
1085
- }), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([R, h] = Q(u, !0), p.addEventListener("progress", R)), f && p.upload && ([d, g] = Q(f), p.upload.addEventListener("progress", d), p.upload.addEventListener("loadend", g)), (s.cancelToken || s.signal) && (l = (b) => {
1086
- p && (r(!b || b.type ? new $(null, e, p) : b), p.abort(), p = null);
1087
- }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1088
- const w = In(s.url);
1089
- if (w && O.protocols.indexOf(w) === -1) {
1090
- r(new E("Unsupported protocol " + w + ":", E.ERR_BAD_REQUEST, e));
1091
- return;
1092
- }
1093
- p.send(o || null);
1094
- });
1095
- }, qn = (e, t) => {
1096
- const { length: n } = e = e ? e.filter(Boolean) : [];
1097
- if (t || n) {
1098
- let r = new AbortController(), s;
1099
- const o = function(u) {
1100
- if (!s) {
1101
- s = !0, c();
1102
- const l = u instanceof Error ? u : this.reason;
1103
- r.abort(l instanceof E ? l : new $(l instanceof Error ? l.message : l));
1104
- }
1105
- };
1106
- let i = t && setTimeout(() => {
1107
- i = null, o(new E(`timeout ${t} of ms exceeded`, E.ETIMEDOUT));
1108
- }, t);
1109
- const c = () => {
1110
- e && (i && clearTimeout(i), i = null, e.forEach((u) => {
1111
- u.unsubscribe ? u.unsubscribe(o) : u.removeEventListener("abort", o);
1112
- }), e = null);
1113
- };
1114
- e.forEach((u) => u.addEventListener("abort", o));
1115
- const { signal: f } = r;
1116
- return f.unsubscribe = () => a.asap(c), f;
1117
- }
1118
- }, Hn = function* (e, t) {
1119
- let n = e.byteLength;
1120
- if (n < t) {
1121
- yield e;
1122
- return;
1123
- }
1124
- let r = 0, s;
1125
- for (; r < n; )
1126
- s = r + t, yield e.slice(r, s), r = s;
1127
- }, Mn = async function* (e, t) {
1128
- for await (const n of jn(e))
1129
- yield* Hn(n, t);
1130
- }, jn = async function* (e) {
1131
- if (e[Symbol.asyncIterator]) {
1132
- yield* e;
1133
- return;
1134
- }
1135
- const t = e.getReader();
1136
- try {
1137
- for (; ; ) {
1138
- const { done: n, value: r } = await t.read();
1139
- if (n)
1140
- break;
1141
- yield r;
1142
- }
1143
- } finally {
1144
- await t.cancel();
1145
- }
1146
- }, Le = (e, t, n, r) => {
1147
- const s = Mn(e, t);
1148
- let o = 0, i, c = (f) => {
1149
- i || (i = !0, r && r(f));
1150
- };
1151
- return new ReadableStream({
1152
- async pull(f) {
1153
- try {
1154
- const { done: u, value: l } = await s.next();
1155
- if (u) {
1156
- c(), f.close();
1157
- return;
1158
- }
1159
- let d = l.byteLength;
1160
- if (n) {
1161
- let R = o += d;
1162
- n(R);
1163
- }
1164
- f.enqueue(new Uint8Array(l));
1165
- } catch (u) {
1166
- throw c(u), u;
1167
- }
1168
- },
1169
- cancel(f) {
1170
- return c(f), s.return();
1171
- }
1172
- }, {
1173
- highWaterMark: 2
1174
- });
1175
- }, ie = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", ot = ie && typeof ReadableStream == "function", Gn = ie && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), it = (e, ...t) => {
1176
- try {
1177
- return !!e(...t);
1178
- } catch {
1179
- return !1;
1180
- }
1181
- }, zn = ot && it(() => {
1182
- let e = !1;
1183
- const t = new Request(O.origin, {
1184
- body: new ReadableStream(),
1185
- method: "POST",
1186
- get duplex() {
1187
- return e = !0, "half";
1188
- }
1189
- }).headers.has("Content-Type");
1190
- return e && !t;
1191
- }), xe = 64 * 1024, he = ot && it(() => a.isReadableStream(new Response("").body)), ee = {
1192
- stream: he && ((e) => e.body)
1193
- };
1194
- ie && ((e) => {
1195
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
1196
- !ee[t] && (ee[t] = a.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
1197
- throw new E(`Response type '${t}' is not supported`, E.ERR_NOT_SUPPORT, r);
1198
- });
1199
- });
1200
- })(new Response());
1201
- const $n = async (e) => {
1202
- if (e == null)
1203
- return 0;
1204
- if (a.isBlob(e))
1205
- return e.size;
1206
- if (a.isSpecCompliantForm(e))
1207
- return (await new Request(O.origin, {
1208
- method: "POST",
1209
- body: e
1210
- }).arrayBuffer()).byteLength;
1211
- if (a.isArrayBufferView(e) || a.isArrayBuffer(e))
1212
- return e.byteLength;
1213
- if (a.isURLSearchParams(e) && (e = e + ""), a.isString(e))
1214
- return (await Gn(e)).byteLength;
1215
- }, Kn = async (e, t) => {
1216
- const n = a.toFiniteNumber(e.getContentLength());
1217
- return n ?? $n(t);
1218
- }, vn = ie && (async (e) => {
1219
- let {
1220
- url: t,
1221
- method: n,
1222
- data: r,
1223
- signal: s,
1224
- cancelToken: o,
1225
- timeout: i,
1226
- onDownloadProgress: c,
1227
- onUploadProgress: f,
1228
- responseType: u,
1229
- headers: l,
1230
- withCredentials: d = "same-origin",
1231
- fetchOptions: R
1232
- } = st(e);
1233
- u = u ? (u + "").toLowerCase() : "text";
1234
- let g = qn([s, o && o.toAbortSignal()], i), h;
1235
- const m = g && g.unsubscribe && (() => {
1236
- g.unsubscribe();
1237
- });
1238
- let p;
1239
- try {
1240
- if (f && zn && n !== "get" && n !== "head" && (p = await Kn(l, r)) !== 0) {
1241
- let _ = new Request(t, {
1242
- method: "POST",
1243
- body: r,
1244
- duplex: "half"
1245
- }), D;
1246
- if (a.isFormData(r) && (D = _.headers.get("content-type")) && l.setContentType(D), _.body) {
1247
- const [B, W] = Ce(
1248
- p,
1249
- Q(Ie(f))
1250
- );
1251
- r = Le(_.body, xe, B, W);
1252
- }
1253
- }
1254
- a.isString(d) || (d = d ? "include" : "omit");
1255
- const y = "credentials" in Request.prototype;
1256
- h = new Request(t, {
1257
- ...R,
1258
- signal: g,
1259
- method: n.toUpperCase(),
1260
- headers: l.normalize().toJSON(),
1261
- body: r,
1262
- duplex: "half",
1263
- credentials: y ? d : void 0
1264
- });
1265
- let w = await fetch(h);
1266
- const b = he && (u === "stream" || u === "response");
1267
- if (he && (c || b && m)) {
1268
- const _ = {};
1269
- ["status", "statusText", "headers"].forEach((we) => {
1270
- _[we] = w[we];
1271
- });
1272
- const D = a.toFiniteNumber(w.headers.get("content-length")), [B, W] = c && Ce(
1273
- D,
1274
- Q(Ie(c), !0)
1275
- ) || [];
1276
- w = new Response(
1277
- Le(w.body, xe, B, () => {
1278
- W && W(), m && m();
1279
- }),
1280
- _
1281
- );
1282
- }
1283
- u = u || "text";
1284
- let k = await ee[a.findKey(ee, u) || "text"](w, e);
1285
- return !b && m && m(), await new Promise((_, D) => {
1286
- nt(_, D, {
1287
- data: k,
1288
- headers: C.from(w.headers),
1289
- status: w.status,
1290
- statusText: w.statusText,
1291
- config: e,
1292
- request: h
1293
- });
1294
- });
1295
- } catch (y) {
1296
- throw m && m(), y && y.name === "TypeError" && /Load failed|fetch/i.test(y.message) ? Object.assign(
1297
- new E("Network Error", E.ERR_NETWORK, e, h),
1298
- {
1299
- cause: y.cause || y
1300
- }
1301
- ) : E.from(y, y && y.code, e, h);
1302
- }
1303
- }), me = {
1304
- http: an,
1305
- xhr: Bn,
1306
- fetch: vn
1307
- };
1308
- a.forEach(me, (e, t) => {
1309
- if (e) {
1310
- try {
1311
- Object.defineProperty(e, "name", { value: t });
1312
- } catch {
1313
- }
1314
- Object.defineProperty(e, "adapterName", { value: t });
1315
- }
1316
- });
1317
- const Pe = (e) => `- ${e}`, Vn = (e) => a.isFunction(e) || e === null || e === !1, at = {
1318
- getAdapter: (e) => {
1319
- e = a.isArray(e) ? e : [e];
1320
- const { length: t } = e;
1321
- let n, r;
1322
- const s = {};
1323
- for (let o = 0; o < t; o++) {
1324
- n = e[o];
1325
- let i;
1326
- if (r = n, !Vn(n) && (r = me[(i = String(n)).toLowerCase()], r === void 0))
1327
- throw new E(`Unknown adapter '${i}'`);
1328
- if (r)
1329
- break;
1330
- s[i || "#" + o] = r;
1331
- }
1332
- if (!r) {
1333
- const o = Object.entries(s).map(
1334
- ([c, f]) => `adapter ${c} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
1335
- );
1336
- let i = t ? o.length > 1 ? `since :
1337
- ` + o.map(Pe).join(`
1338
- `) : " " + Pe(o[0]) : "as no adapter specified";
1339
- throw new E(
1340
- "There is no suitable adapter to dispatch the request " + i,
1341
- "ERR_NOT_SUPPORT"
1342
- );
1343
- }
1344
- return r;
1345
- },
1346
- adapters: me
1347
- };
1348
- function le(e) {
1349
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1350
- throw new $(null, e);
1351
- }
1352
- function ke(e) {
1353
- return le(e), e.headers = C.from(e.headers), e.data = ue.call(
1354
- e,
1355
- e.transformRequest
1356
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), at.getAdapter(e.adapter || J.adapter)(e).then(function(r) {
1357
- return le(e), r.data = ue.call(
1358
- e,
1359
- e.transformResponse,
1360
- r
1361
- ), r.headers = C.from(r.headers), r;
1362
- }, function(r) {
1363
- return tt(r) || (le(e), r && r.response && (r.response.data = ue.call(
1364
- e,
1365
- e.transformResponse,
1366
- r.response
1367
- ), r.response.headers = C.from(r.response.headers))), Promise.reject(r);
1368
- });
1369
- }
1370
- const ct = "1.9.0", ae = {};
1371
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1372
- ae[e] = function(r) {
1373
- return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1374
- };
1375
- });
1376
- const Fe = {};
1377
- ae.transitional = function(t, n, r) {
1378
- function s(o, i) {
1379
- return "[Axios v" + ct + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1380
- }
1381
- return (o, i, c) => {
1382
- if (t === !1)
1383
- throw new E(
1384
- s(i, " has been removed" + (n ? " in " + n : "")),
1385
- E.ERR_DEPRECATED
1386
- );
1387
- return n && !Fe[i] && (Fe[i] = !0, console.warn(
1388
- s(
1389
- i,
1390
- " has been deprecated since v" + n + " and will be removed in the near future"
1391
- )
1392
- )), t ? t(o, i, c) : !0;
1393
- };
1394
- };
1395
- ae.spelling = function(t) {
1396
- return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
1397
- };
1398
- function Jn(e, t, n) {
1399
- if (typeof e != "object")
1400
- throw new E("options must be an object", E.ERR_BAD_OPTION_VALUE);
1401
- const r = Object.keys(e);
1402
- let s = r.length;
1403
- for (; s-- > 0; ) {
1404
- const o = r[s], i = t[o];
1405
- if (i) {
1406
- const c = e[o], f = c === void 0 || i(c, o, e);
1407
- if (f !== !0)
1408
- throw new E("option " + o + " must be " + f, E.ERR_BAD_OPTION_VALUE);
1409
- continue;
1410
- }
1411
- if (n !== !0)
1412
- throw new E("Unknown option " + o, E.ERR_BAD_OPTION);
1413
- }
1414
- }
1415
- const Z = {
1416
- assertOptions: Jn,
1417
- validators: ae
1418
- }, P = Z.validators;
1419
- let M = class {
1420
- constructor(t) {
1421
- this.defaults = t || {}, this.interceptors = {
1422
- request: new _e(),
1423
- response: new _e()
1424
- };
1425
- }
1426
- /**
1427
- * Dispatch a request
1428
- *
1429
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1430
- * @param {?Object} config
1431
- *
1432
- * @returns {Promise} The Promise to be fulfilled
1433
- */
1434
- async request(t, n) {
1435
- try {
1436
- return await this._request(t, n);
1437
- } catch (r) {
1438
- if (r instanceof Error) {
1439
- let s = {};
1440
- Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
1441
- const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1442
- try {
1443
- r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
1444
- ` + o) : r.stack = o;
1445
- } catch {
1446
- }
1447
- }
1448
- throw r;
1449
- }
1450
- }
1451
- _request(t, n) {
1452
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = j(this.defaults, n);
1453
- const { transitional: r, paramsSerializer: s, headers: o } = n;
1454
- r !== void 0 && Z.assertOptions(r, {
1455
- silentJSONParsing: P.transitional(P.boolean),
1456
- forcedJSONParsing: P.transitional(P.boolean),
1457
- clarifyTimeoutError: P.transitional(P.boolean)
1458
- }, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
1459
- serialize: s
1460
- } : Z.assertOptions(s, {
1461
- encode: P.function,
1462
- serialize: P.function
1463
- }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), Z.assertOptions(n, {
1464
- baseUrl: P.spelling("baseURL"),
1465
- withXsrfToken: P.spelling("withXSRFToken")
1466
- }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1467
- let i = o && a.merge(
1468
- o.common,
1469
- o[n.method]
1470
- );
1471
- o && a.forEach(
1472
- ["delete", "get", "head", "post", "put", "patch", "common"],
1473
- (h) => {
1474
- delete o[h];
1475
- }
1476
- ), n.headers = C.concat(i, o);
1477
- const c = [];
1478
- let f = !0;
1479
- this.interceptors.request.forEach(function(m) {
1480
- typeof m.runWhen == "function" && m.runWhen(n) === !1 || (f = f && m.synchronous, c.unshift(m.fulfilled, m.rejected));
1481
- });
1482
- const u = [];
1483
- this.interceptors.response.forEach(function(m) {
1484
- u.push(m.fulfilled, m.rejected);
1485
- });
1486
- let l, d = 0, R;
1487
- if (!f) {
1488
- const h = [ke.bind(this), void 0];
1489
- for (h.unshift.apply(h, c), h.push.apply(h, u), R = h.length, l = Promise.resolve(n); d < R; )
1490
- l = l.then(h[d++], h[d++]);
1491
- return l;
1492
- }
1493
- R = c.length;
1494
- let g = n;
1495
- for (d = 0; d < R; ) {
1496
- const h = c[d++], m = c[d++];
1497
- try {
1498
- g = h(g);
1499
- } catch (p) {
1500
- m.call(this, p);
1501
- break;
1502
- }
1503
- }
1504
- try {
1505
- l = ke.call(this, g);
1506
- } catch (h) {
1507
- return Promise.reject(h);
1508
- }
1509
- for (d = 0, R = u.length; d < R; )
1510
- l = l.then(u[d++], u[d++]);
1511
- return l;
1512
- }
1513
- getUri(t) {
1514
- t = j(this.defaults, t);
1515
- const n = rt(t.baseURL, t.url, t.allowAbsoluteUrls);
1516
- return Ze(n, t.params, t.paramsSerializer);
1517
- }
1518
- };
1519
- a.forEach(["delete", "get", "head", "options"], function(t) {
1520
- M.prototype[t] = function(n, r) {
1521
- return this.request(j(r || {}, {
1522
- method: t,
1523
- url: n,
1524
- data: (r || {}).data
1525
- }));
1526
- };
1527
- });
1528
- a.forEach(["post", "put", "patch"], function(t) {
1529
- function n(r) {
1530
- return function(o, i, c) {
1531
- return this.request(j(c || {}, {
1532
- method: t,
1533
- headers: r ? {
1534
- "Content-Type": "multipart/form-data"
1535
- } : {},
1536
- url: o,
1537
- data: i
1538
- }));
1539
- };
1540
- }
1541
- M.prototype[t] = n(), M.prototype[t + "Form"] = n(!0);
1542
- });
1543
- let Wn = class ut {
1544
- constructor(t) {
1545
- if (typeof t != "function")
1546
- throw new TypeError("executor must be a function.");
1547
- let n;
1548
- this.promise = new Promise(function(o) {
1549
- n = o;
1550
- });
1551
- const r = this;
1552
- this.promise.then((s) => {
1553
- if (!r._listeners) return;
1554
- let o = r._listeners.length;
1555
- for (; o-- > 0; )
1556
- r._listeners[o](s);
1557
- r._listeners = null;
1558
- }), this.promise.then = (s) => {
1559
- let o;
1560
- const i = new Promise((c) => {
1561
- r.subscribe(c), o = c;
1562
- }).then(s);
1563
- return i.cancel = function() {
1564
- r.unsubscribe(o);
1565
- }, i;
1566
- }, t(function(o, i, c) {
1567
- r.reason || (r.reason = new $(o, i, c), n(r.reason));
1568
- });
1569
- }
1570
- /**
1571
- * Throws a `CanceledError` if cancellation has been requested.
1572
- */
1573
- throwIfRequested() {
1574
- if (this.reason)
1575
- throw this.reason;
1576
- }
1577
- /**
1578
- * Subscribe to the cancel signal
1579
- */
1580
- subscribe(t) {
1581
- if (this.reason) {
1582
- t(this.reason);
1583
- return;
1584
- }
1585
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
1586
- }
1587
- /**
1588
- * Unsubscribe from the cancel signal
1589
- */
1590
- unsubscribe(t) {
1591
- if (!this._listeners)
1592
- return;
1593
- const n = this._listeners.indexOf(t);
1594
- n !== -1 && this._listeners.splice(n, 1);
1595
- }
1596
- toAbortSignal() {
1597
- const t = new AbortController(), n = (r) => {
1598
- t.abort(r);
1599
- };
1600
- return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
1601
- }
1602
- /**
1603
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1604
- * cancels the `CancelToken`.
1605
- */
1606
- static source() {
1607
- let t;
1608
- return {
1609
- token: new ut(function(s) {
1610
- t = s;
1611
- }),
1612
- cancel: t
1613
- };
1614
- }
1615
- };
1616
- function Xn(e) {
1617
- return function(n) {
1618
- return e.apply(null, n);
1619
- };
1620
- }
1621
- function Yn(e) {
1622
- return a.isObject(e) && e.isAxiosError === !0;
1623
- }
1624
- const Ee = {
1625
- Continue: 100,
1626
- SwitchingProtocols: 101,
1627
- Processing: 102,
1628
- EarlyHints: 103,
1629
- Ok: 200,
1630
- Created: 201,
1631
- Accepted: 202,
1632
- NonAuthoritativeInformation: 203,
1633
- NoContent: 204,
1634
- ResetContent: 205,
1635
- PartialContent: 206,
1636
- MultiStatus: 207,
1637
- AlreadyReported: 208,
1638
- ImUsed: 226,
1639
- MultipleChoices: 300,
1640
- MovedPermanently: 301,
1641
- Found: 302,
1642
- SeeOther: 303,
1643
- NotModified: 304,
1644
- UseProxy: 305,
1645
- Unused: 306,
1646
- TemporaryRedirect: 307,
1647
- PermanentRedirect: 308,
1648
- BadRequest: 400,
1649
- Unauthorized: 401,
1650
- PaymentRequired: 402,
1651
- Forbidden: 403,
1652
- NotFound: 404,
1653
- MethodNotAllowed: 405,
1654
- NotAcceptable: 406,
1655
- ProxyAuthenticationRequired: 407,
1656
- RequestTimeout: 408,
1657
- Conflict: 409,
1658
- Gone: 410,
1659
- LengthRequired: 411,
1660
- PreconditionFailed: 412,
1661
- PayloadTooLarge: 413,
1662
- UriTooLong: 414,
1663
- UnsupportedMediaType: 415,
1664
- RangeNotSatisfiable: 416,
1665
- ExpectationFailed: 417,
1666
- ImATeapot: 418,
1667
- MisdirectedRequest: 421,
1668
- UnprocessableEntity: 422,
1669
- Locked: 423,
1670
- FailedDependency: 424,
1671
- TooEarly: 425,
1672
- UpgradeRequired: 426,
1673
- PreconditionRequired: 428,
1674
- TooManyRequests: 429,
1675
- RequestHeaderFieldsTooLarge: 431,
1676
- UnavailableForLegalReasons: 451,
1677
- InternalServerError: 500,
1678
- NotImplemented: 501,
1679
- BadGateway: 502,
1680
- ServiceUnavailable: 503,
1681
- GatewayTimeout: 504,
1682
- HttpVersionNotSupported: 505,
1683
- VariantAlsoNegotiates: 506,
1684
- InsufficientStorage: 507,
1685
- LoopDetected: 508,
1686
- NotExtended: 510,
1687
- NetworkAuthenticationRequired: 511
1688
- };
1689
- Object.entries(Ee).forEach(([e, t]) => {
1690
- Ee[t] = e;
1691
- });
1692
- function lt(e) {
1693
- const t = new M(e), n = Me(M.prototype.request, t);
1694
- return a.extend(n, M.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1695
- return lt(j(e, s));
1696
- }, n;
1697
- }
1698
- const S = lt(J);
1699
- S.Axios = M;
1700
- S.CanceledError = $;
1701
- S.CancelToken = Wn;
1702
- S.isCancel = tt;
1703
- S.VERSION = ct;
1704
- S.toFormData = oe;
1705
- S.AxiosError = E;
1706
- S.Cancel = S.CanceledError;
1707
- S.all = function(t) {
1708
- return Promise.all(t);
1709
- };
1710
- S.spread = Xn;
1711
- S.isAxiosError = Yn;
1712
- S.mergeConfig = j;
1713
- S.AxiosHeaders = C;
1714
- S.formToJSON = (e) => et(a.isHTMLForm(e) ? new FormData(e) : e);
1715
- S.getAdapter = at.getAdapter;
1716
- S.HttpStatusCode = Ee;
1717
- S.default = S;
1718
- const {
1719
- Axios: Pr,
1720
- AxiosError: Zn,
1721
- CanceledError: kr,
1722
- isCancel: Fr,
1723
- CancelToken: Dr,
1724
- VERSION: Br,
1725
- all: qr,
1726
- Cancel: Hr,
1727
- isAxiosError: Mr,
1728
- spread: jr,
1729
- toFormData: Gr,
1730
- AxiosHeaders: zr,
1731
- HttpStatusCode: F,
1732
- formToJSON: $r,
1733
- getAdapter: Kr,
1734
- mergeConfig: vr
1735
- } = S, ft = (e) => (e.baseURL = He(), e.headers.Authorization = localStorage.getItem(U.TOKEN), e.headers["client-id"] = localStorage.getItem(U.CLIENT_ID), e.metadata = { startTime: /* @__PURE__ */ new Date() }, { ...e }), Qn = (e) => (e.baseURL = mt(), e.headers.Authorization = localStorage.getItem(U.TOKEN), e.headers["client-id"] = localStorage.getItem(U.CLIENT_ID), e.headers["Api-Version"] = "1.0", e.metadata = { startTime: /* @__PURE__ */ new Date() }, { ...e }), De = (e, t, n) => {
1736
- for (const r of e)
1737
- t ? r.rej(t) : r.res(n);
1738
- }, er = async (e) => new Promise((t, n) => {
1739
- setTimeout(t, e);
1740
- }), tr = async (e, t) => (await er(t), e()), Be = (e, t) => {
1741
- var s, o;
1742
- let n = "", r = t;
1743
- typeof t == "string" ? n = t : t instanceof Zn ? (n = t.message, r = {
1744
- message: t.message,
1745
- cause: t.cause,
1746
- status: t.status,
1747
- data: (s = t == null ? void 0 : t.response) == null ? void 0 : s.data
1748
- }) : n = t.message, (o = window.parent) == null || o.postMessage(
1749
- { type: "auth_error", details: { message: n, action: e, info: r } },
1750
- "*"
1751
- );
1752
- }, dt = async (e, t, n, r, s) => {
1753
- var f, u, l;
1754
- const o = t.config, i = localStorage.getItem(U.REFRESH_TOKEN), c = ((f = t.response) == null ? void 0 : f.status) || F.InternalServerError;
1755
- if (!o || o.__retries === n)
1756
- throw t;
1757
- if (c === F.Unauthorized && o.url !== T.REFRESH_EMBED_TOKEN && o.url !== T.REFRESH_TOKEN && o.url !== T.SIGN_IN && o.url !== T.SIGN_UP && o.url !== T.OTP) {
1758
- if (!i)
1759
- throw Be(
1760
- "refresh_token",
1761
- "no refresh token found to reauthenticate user"
1762
- ), t;
1763
- if (r)
1764
- return new Promise((p, y) => {
1765
- e.push({ res: p, rej: y });
1766
- }).then((p) => (o.headers && (o.headers.Authorization = `Bearer ${p}`), s(o))).catch((p) => {
1767
- throw p;
1768
- });
1769
- r = !0;
1770
- const R = localStorage.getItem(U.AUTH_FLOW) === Et.POST_MESSAGE ? qe.refreshEmbedToken : qe.refreshToken, { data: g, success: h, message: m } = await R(i);
1771
- if (!h)
1772
- throw (u = o == null ? void 0 : o.url) != null && u.includes(T.EXCHANGE_TOKEN) || Be("refresh_token", m), r = !1, De(e, t), t;
1773
- return (l = o.url) != null && l.includes(T.EXCHANGE_TOKEN) && "id_token" in g && (o.data = JSON.stringify({ idToken: g.id_token })), r = !1, o.headers && (o.headers.Authorization = `Bearer ${g.token}`), De(e, null, g.token), s(o);
1774
- }
1775
- if ([
1776
- F.BadRequest,
1777
- F.Unauthorized,
1778
- F.Forbidden,
1779
- F.InternalServerError,
1780
- F.Conflict,
1781
- F.NotFound,
1782
- F.UnprocessableEntity
1783
- ].includes(c) || (o.__retries || (o.__retries = 0), o.__retries += 1, o.__retries > n))
1784
- throw t;
1785
- return tr(
1786
- () => s(o),
1787
- Math.pow(10, o.__retries + 1) / 2
1788
- // Exponential backoff 50ms, 500ms, 5000ms
1789
- );
1790
- }, nr = S.create();
1791
- nr.interceptors.request.use((e) => (e.baseURL = He(), e.headers.Authorization = localStorage.getItem(U.TOKEN), e.metadata = { startTime: /* @__PURE__ */ new Date() }, { ...e }));
1792
- const A = S.create();
1793
- A.interceptors.request.use((e) => (e = ft(e), e));
1794
- const rr = S.create();
1795
- rr.interceptors.request.use((e) => (e = Qn(e), e));
1796
- const sr = 3;
1797
- let or = !1;
1798
- const ir = [];
1799
- A.interceptors.response.use(
1800
- null,
1801
- (e) => dt(
1802
- ir,
1803
- e,
1804
- sr,
1805
- or,
1806
- A
1807
- )
1808
- );
1809
- class ar {
1810
- constructor() {
1811
- /**
1812
- * Logs in a user with the provided email and password.
1813
- *
1814
- * @param params - The sign-in parameters containing email and password.
1815
- * @returns A promise that resolves to a service response containing authentication data.
1816
- */
1817
- I(this, "login", async (t) => {
1818
- var n, r, s, o;
1819
- try {
1820
- const { data: i } = await A.post(T.SIGN_IN, {
1821
- email_address: t.email,
1822
- password: t.password
1823
- }), c = await G.ensureQueryData({
1824
- queryKey: [q.USER_REGIONS],
1825
- queryFn: this.getRegions
1826
- }), f = L(i.data), u = (n = i.data) == null ? void 0 : n.accessToken;
1827
- return localStorage.setItem(U.TOKEN, u), {
1828
- success: !0,
1829
- data: L({
1830
- ...i.data,
1831
- token: u,
1832
- user: {
1833
- ...f.user,
1834
- userRegion: c.find(
1835
- (l) => l.code === i.data.user.user_region
1836
- )
1837
- }
1838
- })
1839
- };
1840
- } catch (i) {
1841
- return console.error(i), {
1842
- success: !1,
1843
- message: ((s = (r = i.response) == null ? void 0 : r.data) == null ? void 0 : s.message) || ((o = i == null ? void 0 : i.response) == null ? void 0 : o.data) || i.message || "error signing in"
1844
- };
1845
- }
1846
- });
1847
- /**
1848
- * Registers a new user with the provided email, password, and region.
1849
- *
1850
- * @param params - The sign-up parameters containing email, password, and region.
1851
- * @returns A promise that resolves to a service response containing authentication data.
1852
- */
1853
- I(this, "signUp", async (t) => {
1854
- var n, r, s, o, i;
1855
- try {
1856
- const { data: c } = await A.post(T.SIGN_UP, {
1857
- user: {
1858
- email_address: t.email,
1859
- password: t.password,
1860
- user_region: t.region
1861
- },
1862
- success_url: t.successUrl,
1863
- cancel_url: t.cancelUrl,
1864
- price_id: t.priceId
1865
- }), f = await G.ensureQueryData({
1866
- queryKey: [q.USER_REGIONS],
1867
- queryFn: this.getRegions
1868
- }), u = L(c.data), l = (n = c.data) == null ? void 0 : n.tokens.accessToken;
1869
- return localStorage.setItem(U.TOKEN, l), {
1870
- success: !0,
1871
- data: {
1872
- token: l,
1873
- ...(r = c.data) == null ? void 0 : r.tokens,
1874
- user: {
1875
- ...u.user,
1876
- userRegion: f.find(
1877
- (d) => d.code === c.data.user.user_region
1878
- )
1879
- }
1880
- }
1881
- };
1882
- } catch (c) {
1883
- return console.error(c), {
1884
- success: !1,
1885
- message: ((o = (s = c.response) == null ? void 0 : s.data) == null ? void 0 : o.message) || ((i = c.response) == null ? void 0 : i.data) || c.message || "error signing up"
1886
- };
1887
- }
1888
- });
1889
- I(this, "getOrCreateGoogleUser", async (t, n) => {
1890
- var r, s, o, i, c;
1891
- try {
1892
- const { data: f } = await A.post(T.GOOGLE_AUTH, {
1893
- google_access_token: t,
1894
- user_region: n
1895
- }), u = await G.ensureQueryData({
1896
- queryKey: [q.USER_REGIONS],
1897
- queryFn: this.getRegions
1898
- }), l = L(f.data), d = (r = f.data) == null ? void 0 : r.tokens.accessToken;
1899
- return localStorage.setItem(U.TOKEN, d), {
1900
- success: !0,
1901
- data: {
1902
- token: d,
1903
- ...(s = f.data) == null ? void 0 : s.tokens,
1904
- user: {
1905
- ...l.user,
1906
- userRegion: u.find(
1907
- (R) => R.code === f.data.user.user_region
1908
- )
1909
- }
1910
- }
1911
- };
1912
- } catch (f) {
1913
- return console.error(f), {
1914
- success: !1,
1915
- message: ((i = (o = f.response) == null ? void 0 : o.data) == null ? void 0 : i.message) || ((c = f == null ? void 0 : f.response) == null ? void 0 : c.data) || f.message || "error getting or creating google user"
1916
- };
1917
- }
1918
- });
1919
- I(this, "resendVerificationEmail", async (t) => {
1920
- var n, r, s;
1921
- try {
1922
- return (await A.post(
1923
- T.RESEND_VERIFICATION_EMAIL,
1924
- {
1925
- email_address: t.email,
1926
- success_url: t.successUrl,
1927
- cancel_url: t.cancelUrl
1928
- }
1929
- )).data;
1930
- } catch (o) {
1931
- return console.error(o), {
1932
- success: !1,
1933
- message: ((r = (n = o.response) == null ? void 0 : n.data) == null ? void 0 : r.message) || ((s = o.response) == null ? void 0 : s.data) || o.message || "error resending verification email"
1934
- };
1935
- }
1936
- });
1937
- /**
1938
- * Authenticates a user using an ID token.
1939
- *
1940
- * @param idToken - The ID token to authenticate with.
1941
- * @param refreshToken - The refresh token for user
1942
- * @returns A promise that resolves to a service response containing authentication data.
1943
- */
1944
- I(this, "authenticateWithToken", async (t, n, r) => {
1945
- var s, o, i;
1946
- try {
1947
- const { data: c } = await A.post(
1948
- T.EXCHANGE_TOKEN,
1949
- gt({
1950
- idToken: t,
1951
- refreshToken: n,
1952
- exchangeTokenEndPoint: r
1953
- })
1954
- ), f = await G.ensureQueryData({
1955
- queryKey: [q.USER_REGIONS],
1956
- queryFn: this.getRegions
1957
- }), u = L(c.data);
1958
- return {
1959
- success: !0,
1960
- data: {
1961
- ...u,
1962
- user: {
1963
- ...u.user,
1964
- userRegion: f.find(
1965
- (l) => l.code === c.data.user.user_region
1966
- )
1967
- }
1968
- }
1969
- };
1970
- } catch (c) {
1971
- return console.error(c), {
1972
- success: !1,
1973
- message: ((o = (s = c.response) == null ? void 0 : s.data) == null ? void 0 : o.message) || ((i = c == null ? void 0 : c.response) == null ? void 0 : i.data) || c.message || "error exchanging token"
1974
- };
1975
- }
1976
- });
1977
- /**
1978
- * If token is available in local storage, check if it is valid and return user details
1979
- *
1980
- * @returns A promise that resolves to a service response containing the user details.
1981
- */
1982
- I(this, "checkUser", async () => {
1983
- try {
1984
- const { data: t } = await A.get(T.ME), n = await G.ensureQueryData({
1985
- queryKey: [q.USER_REGIONS],
1986
- queryFn: this.getRegions
1987
- }), r = {
1988
- ...t.data,
1989
- userRegion: n.find(
1990
- (s) => s.code === t.data.user_region
1991
- )
1992
- };
1993
- return {
1994
- success: !0,
1995
- data: L(r)
1996
- };
1997
- } catch (t) {
1998
- console.error(t);
1999
- const { response: n } = t;
2000
- return {
2001
- success: !1,
2002
- message: (n == null ? void 0 : n.data.message) || "error retrieving user details"
2003
- };
2004
- }
2005
- });
2006
- /**
2007
- * @description In the case of a 401 error, the refresh token is used to get a new access token and user details, by exchanging the
2008
- * refresh token for a new id_token and in turn exchanging that for a new awayz token
2009
- *
2010
- * @param refreshToken - The refresh token
2011
- */
2012
- I(this, "refreshEmbedToken", async (t) => {
2013
- try {
2014
- const { data: n } = await A.post(
2015
- T.REFRESH_EMBED_TOKEN,
2016
- {
2017
- refreshToken: t
2018
- }
2019
- ), r = n.data.token;
2020
- return localStorage.setItem(U.TOKEN, r), {
2021
- success: !0,
2022
- data: n.data
2023
- };
2024
- } catch (n) {
2025
- const { response: r } = n;
2026
- return localStorage.removeItem("refreshToken"), localStorage.removeItem("token"), {
2027
- success: !1,
2028
- message: r == null ? void 0 : r.data.message
2029
- };
2030
- }
2031
- });
2032
- /**
2033
- * @description In the case of a 401 error, the refresh token is used to get a new access token and user details
2034
- *
2035
- * @param refreshToken - The refresh token
2036
- */
2037
- I(this, "refreshToken", async (t) => {
2038
- try {
2039
- const { data: n } = await A.post(
2040
- T.REFRESH_TOKEN,
2041
- {
2042
- refreshToken: t
2043
- }
2044
- ), r = n.data.accessToken;
2045
- return localStorage.setItem(U.TOKEN, r), {
2046
- success: !0,
2047
- data: {
2048
- ...n.data,
2049
- token: r
2050
- }
2051
- };
2052
- } catch (n) {
2053
- const { response: r } = n;
2054
- return localStorage.removeItem("refreshToken"), localStorage.removeItem("token"), {
2055
- success: !1,
2056
- message: r == null ? void 0 : r.data.message
2057
- };
2058
- }
2059
- });
2060
- /**
2061
- * Retrieves the request limit for the authenticated user.
2062
- *
2063
- * @returns A promise that resolves to a service response containing the request limit data.
2064
- */
2065
- I(this, "getRequestLimit", async () => (await A.get(T.REQUEST_LIMIT)).data);
2066
- /**
2067
- * Retrieves the regions available for user registration.
2068
- *
2069
- * @returns A promise that resolves to a service response containing the available regions.
2070
- */
2071
- I(this, "getRegions", async () => {
2072
- var n;
2073
- const t = await A.get(T.REGIONS);
2074
- return L((n = t.data) == null ? void 0 : n.data);
2075
- });
2076
- I(this, "getClientDetails", async () => {
2077
- const { data: t } = await A.get(T.CLIENT);
2078
- return L(t.data);
2079
- });
2080
- I(this, "validate2FA", async (t, n) => {
2081
- var r, s, o;
2082
- try {
2083
- const { data: i } = await A.post(T.OTP, {
2084
- email_address: t,
2085
- otp: n
2086
- }), c = await G.ensureQueryData({
2087
- queryKey: [q.USER_REGIONS],
2088
- queryFn: this.getRegions
2089
- });
2090
- return { success: !0, data: L({
2091
- ...i.data,
2092
- user: {
2093
- ...i.data.user,
2094
- userRegion: c.find(
2095
- (u) => u.code === i.data.user.user_region
2096
- )
2097
- }
2098
- }) };
2099
- } catch (i) {
2100
- return console.error(i), {
2101
- success: !1,
2102
- message: ((s = (r = i.response) == null ? void 0 : r.data) == null ? void 0 : s.message) || ((o = i == null ? void 0 : i.response) == null ? void 0 : o.data) || i.message || "error signing in"
2103
- };
2104
- }
2105
- });
2106
- }
2107
- }
2108
- const qe = new ar(), Re = S.create();
2109
- Re.interceptors.request.use((e) => (e = ft(e), e));
2110
- const cr = 1;
2111
- let ur = !1;
2112
- const lr = [];
2113
- Re.interceptors.response.use(null, (e) => dt(lr, e, cr, ur, Re));
2114
- export {
2115
- qe as A,
2116
- q as E,
2117
- Re as a,
2118
- L as b,
2119
- A as c,
2120
- yt as d,
2121
- Zn as e,
2122
- Te as f,
2123
- rr as g,
2124
- ft as h,
2125
- nr as i,
2126
- Qn as j,
2127
- er as k,
2128
- tr as l,
2129
- Be as m,
2130
- dt as n,
2131
- De as p,
2132
- gt as r,
2133
- St as t
2134
- };