@stacksee/analytics 0.12.0 → 0.13.1

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