@a-cube-io/ereceipts-js-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +41 -0
  2. package/README.md +444 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/auth-D6UEILKY.cjs +56 -0
  5. package/dist/auth-D6UEILKY.cjs.map +1 -0
  6. package/dist/auth-RZRIC4PK.js +7 -0
  7. package/dist/auth-RZRIC4PK.js.map +1 -0
  8. package/dist/chunk-24ZJ6SNG.cjs +624 -0
  9. package/dist/chunk-24ZJ6SNG.cjs.map +1 -0
  10. package/dist/chunk-C3YEL4ED.js +511 -0
  11. package/dist/chunk-C3YEL4ED.js.map +1 -0
  12. package/dist/chunk-K65HAAAO.js +44 -0
  13. package/dist/chunk-K65HAAAO.js.map +1 -0
  14. package/dist/chunk-NARXAXFL.cjs +215 -0
  15. package/dist/chunk-NARXAXFL.cjs.map +1 -0
  16. package/dist/chunk-UBEIMFLN.js +209 -0
  17. package/dist/chunk-UBEIMFLN.js.map +1 -0
  18. package/dist/chunk-UVUWF5FV.cjs +3964 -0
  19. package/dist/chunk-UVUWF5FV.cjs.map +1 -0
  20. package/dist/chunk-UXVFQRZK.cjs +533 -0
  21. package/dist/chunk-UXVFQRZK.cjs.map +1 -0
  22. package/dist/chunk-VDHN3FKS.js +3929 -0
  23. package/dist/chunk-VDHN3FKS.js.map +1 -0
  24. package/dist/chunk-XQKCXG4I.cjs +52 -0
  25. package/dist/chunk-XQKCXG4I.cjs.map +1 -0
  26. package/dist/chunk-YX3PJ4FC.js +590 -0
  27. package/dist/chunk-YX3PJ4FC.js.map +1 -0
  28. package/dist/client-WPBRHPKX.cjs +31 -0
  29. package/dist/client-WPBRHPKX.cjs.map +1 -0
  30. package/dist/client-Z2LXQJMF.js +6 -0
  31. package/dist/client-Z2LXQJMF.js.map +1 -0
  32. package/dist/index.cjs +1326 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +960 -0
  35. package/dist/index.d.ts +960 -0
  36. package/dist/index.js +1065 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/metafile-cjs.json +1 -0
  39. package/dist/metafile-esm.json +1 -0
  40. package/dist/queue-D7PJ536B.js +4 -0
  41. package/dist/queue-D7PJ536B.js.map +1 -0
  42. package/dist/queue-JHWXWX2B.cjs +13 -0
  43. package/dist/queue-JHWXWX2B.cjs.map +1 -0
  44. package/dist/token-3CIX4E64.cjs +13 -0
  45. package/dist/token-3CIX4E64.cjs.map +1 -0
  46. package/dist/token-4OAGWTVG.js +4 -0
  47. package/dist/token-4OAGWTVG.js.map +1 -0
  48. package/openapi.yaml +2732 -0
  49. package/package.json +115 -0
@@ -0,0 +1,3964 @@
1
+ 'use strict';
2
+
3
+ var chunk24ZJ6SNG_cjs = require('./chunk-24ZJ6SNG.cjs');
4
+ var chunkNARXAXFL_cjs = require('./chunk-NARXAXFL.cjs');
5
+ var chunkXQKCXG4I_cjs = require('./chunk-XQKCXG4I.cjs');
6
+ var FormData2 = require('form-data');
7
+ var crypto = require('crypto');
8
+ var url = require('url');
9
+ var proxyFromEnv = require('proxy-from-env');
10
+ var http = require('http');
11
+ var https = require('https');
12
+ var util = require('util');
13
+ var followRedirects = require('follow-redirects');
14
+ var zlib = require('zlib');
15
+ var stream3 = require('stream');
16
+ var events = require('events');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
+
20
+ var FormData2__default = /*#__PURE__*/_interopDefault(FormData2);
21
+ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
22
+ var url__default = /*#__PURE__*/_interopDefault(url);
23
+ var proxyFromEnv__default = /*#__PURE__*/_interopDefault(proxyFromEnv);
24
+ var http__default = /*#__PURE__*/_interopDefault(http);
25
+ var https__default = /*#__PURE__*/_interopDefault(https);
26
+ var util__default = /*#__PURE__*/_interopDefault(util);
27
+ var followRedirects__default = /*#__PURE__*/_interopDefault(followRedirects);
28
+ var zlib__default = /*#__PURE__*/_interopDefault(zlib);
29
+ var stream3__default = /*#__PURE__*/_interopDefault(stream3);
30
+
31
+ /* A-Cube SDK - Professional TypeScript SDK for Italian e-receipt system */
32
+
33
+ // node_modules/axios/lib/helpers/bind.js
34
+ function bind(fn, thisArg) {
35
+ return /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function wrap() {
36
+ return fn.apply(thisArg, arguments);
37
+ }, "wrap");
38
+ }
39
+ chunkXQKCXG4I_cjs.__name(bind, "bind");
40
+
41
+ // node_modules/axios/lib/utils.js
42
+ var { toString } = Object.prototype;
43
+ var { getPrototypeOf } = Object;
44
+ var { iterator, toStringTag } = Symbol;
45
+ var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
46
+ const str = toString.call(thing);
47
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
48
+ })(/* @__PURE__ */ Object.create(null));
49
+ var kindOfTest = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((type) => {
50
+ type = type.toLowerCase();
51
+ return (thing) => kindOf(thing) === type;
52
+ }, "kindOfTest");
53
+ var typeOfTest = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((type) => (thing) => typeof thing === type, "typeOfTest");
54
+ var { isArray } = Array;
55
+ var isUndefined = typeOfTest("undefined");
56
+ function isBuffer(val) {
57
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
58
+ }
59
+ chunkXQKCXG4I_cjs.__name(isBuffer, "isBuffer");
60
+ var isArrayBuffer = kindOfTest("ArrayBuffer");
61
+ function isArrayBufferView(val) {
62
+ let result;
63
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
64
+ result = ArrayBuffer.isView(val);
65
+ } else {
66
+ result = val && val.buffer && isArrayBuffer(val.buffer);
67
+ }
68
+ return result;
69
+ }
70
+ chunkXQKCXG4I_cjs.__name(isArrayBufferView, "isArrayBufferView");
71
+ var isString = typeOfTest("string");
72
+ var isFunction = typeOfTest("function");
73
+ var isNumber = typeOfTest("number");
74
+ var isObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => thing !== null && typeof thing === "object", "isObject");
75
+ var isBoolean = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => thing === true || thing === false, "isBoolean");
76
+ var isPlainObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((val) => {
77
+ if (kindOf(val) !== "object") {
78
+ return false;
79
+ }
80
+ const prototype3 = getPrototypeOf(val);
81
+ return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(toStringTag in val) && !(iterator in val);
82
+ }, "isPlainObject");
83
+ var isEmptyObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((val) => {
84
+ if (!isObject(val) || isBuffer(val)) {
85
+ return false;
86
+ }
87
+ try {
88
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
89
+ } catch (e) {
90
+ return false;
91
+ }
92
+ }, "isEmptyObject");
93
+ var isDate = kindOfTest("Date");
94
+ var isFile = kindOfTest("File");
95
+ var isBlob = kindOfTest("Blob");
96
+ var isFileList = kindOfTest("FileList");
97
+ var isStream = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((val) => isObject(val) && isFunction(val.pipe), "isStream");
98
+ var isFormData = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => {
99
+ let kind;
100
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
101
+ kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
102
+ }, "isFormData");
103
+ var isURLSearchParams = kindOfTest("URLSearchParams");
104
+ var [isReadableStream, isRequest, isResponse, isHeaders] = [
105
+ "ReadableStream",
106
+ "Request",
107
+ "Response",
108
+ "Headers"
109
+ ].map(kindOfTest);
110
+ var trim = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), "trim");
111
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
112
+ if (obj === null || typeof obj === "undefined") {
113
+ return;
114
+ }
115
+ let i;
116
+ let l;
117
+ if (typeof obj !== "object") {
118
+ obj = [
119
+ obj
120
+ ];
121
+ }
122
+ if (isArray(obj)) {
123
+ for (i = 0, l = obj.length; i < l; i++) {
124
+ fn.call(null, obj[i], i, obj);
125
+ }
126
+ } else {
127
+ if (isBuffer(obj)) {
128
+ return;
129
+ }
130
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
131
+ const len = keys.length;
132
+ let key;
133
+ for (i = 0; i < len; i++) {
134
+ key = keys[i];
135
+ fn.call(null, obj[key], key, obj);
136
+ }
137
+ }
138
+ }
139
+ chunkXQKCXG4I_cjs.__name(forEach, "forEach");
140
+ function findKey(obj, key) {
141
+ if (isBuffer(obj)) {
142
+ return null;
143
+ }
144
+ key = key.toLowerCase();
145
+ const keys = Object.keys(obj);
146
+ let i = keys.length;
147
+ let _key;
148
+ while (i-- > 0) {
149
+ _key = keys[i];
150
+ if (key === _key.toLowerCase()) {
151
+ return _key;
152
+ }
153
+ }
154
+ return null;
155
+ }
156
+ chunkXQKCXG4I_cjs.__name(findKey, "findKey");
157
+ var _global = (() => {
158
+ if (typeof globalThis !== "undefined") return globalThis;
159
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : globalThis;
160
+ })();
161
+ var isContextDefined = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((context) => !isUndefined(context) && context !== _global, "isContextDefined");
162
+ function merge() {
163
+ const { caseless } = isContextDefined(this) && this || {};
164
+ const result = {};
165
+ const assignValue = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((val, key) => {
166
+ const targetKey = caseless && findKey(result, key) || key;
167
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
168
+ result[targetKey] = merge(result[targetKey], val);
169
+ } else if (isPlainObject(val)) {
170
+ result[targetKey] = merge({}, val);
171
+ } else if (isArray(val)) {
172
+ result[targetKey] = val.slice();
173
+ } else {
174
+ result[targetKey] = val;
175
+ }
176
+ }, "assignValue");
177
+ for (let i = 0, l = arguments.length; i < l; i++) {
178
+ arguments[i] && forEach(arguments[i], assignValue);
179
+ }
180
+ return result;
181
+ }
182
+ chunkXQKCXG4I_cjs.__name(merge, "merge");
183
+ var extend = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((a, b, thisArg, { allOwnKeys } = {}) => {
184
+ forEach(b, (val, key) => {
185
+ if (thisArg && isFunction(val)) {
186
+ a[key] = bind(val, thisArg);
187
+ } else {
188
+ a[key] = val;
189
+ }
190
+ }, {
191
+ allOwnKeys
192
+ });
193
+ return a;
194
+ }, "extend");
195
+ var stripBOM = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((content) => {
196
+ if (content.charCodeAt(0) === 65279) {
197
+ content = content.slice(1);
198
+ }
199
+ return content;
200
+ }, "stripBOM");
201
+ var inherits = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((constructor, superConstructor, props, descriptors2) => {
202
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
203
+ constructor.prototype.constructor = constructor;
204
+ Object.defineProperty(constructor, "super", {
205
+ value: superConstructor.prototype
206
+ });
207
+ props && Object.assign(constructor.prototype, props);
208
+ }, "inherits");
209
+ var toFlatObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((sourceObj, destObj, filter2, propFilter) => {
210
+ let props;
211
+ let i;
212
+ let prop;
213
+ const merged = {};
214
+ destObj = destObj || {};
215
+ if (sourceObj == null) return destObj;
216
+ do {
217
+ props = Object.getOwnPropertyNames(sourceObj);
218
+ i = props.length;
219
+ while (i-- > 0) {
220
+ prop = props[i];
221
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
222
+ destObj[prop] = sourceObj[prop];
223
+ merged[prop] = true;
224
+ }
225
+ }
226
+ sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
227
+ } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
228
+ return destObj;
229
+ }, "toFlatObject");
230
+ var endsWith = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((str, searchString, position) => {
231
+ str = String(str);
232
+ if (position === void 0 || position > str.length) {
233
+ position = str.length;
234
+ }
235
+ position -= searchString.length;
236
+ const lastIndex = str.indexOf(searchString, position);
237
+ return lastIndex !== -1 && lastIndex === position;
238
+ }, "endsWith");
239
+ var toArray = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => {
240
+ if (!thing) return null;
241
+ if (isArray(thing)) return thing;
242
+ let i = thing.length;
243
+ if (!isNumber(i)) return null;
244
+ const arr = new Array(i);
245
+ while (i-- > 0) {
246
+ arr[i] = thing[i];
247
+ }
248
+ return arr;
249
+ }, "toArray");
250
+ var isTypedArray = /* @__PURE__ */ ((TypedArray) => {
251
+ return (thing) => {
252
+ return TypedArray && thing instanceof TypedArray;
253
+ };
254
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
255
+ var forEachEntry = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((obj, fn) => {
256
+ const generator = obj && obj[iterator];
257
+ const _iterator = generator.call(obj);
258
+ let result;
259
+ while ((result = _iterator.next()) && !result.done) {
260
+ const pair = result.value;
261
+ fn.call(obj, pair[0], pair[1]);
262
+ }
263
+ }, "forEachEntry");
264
+ var matchAll = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((regExp, str) => {
265
+ let matches;
266
+ const arr = [];
267
+ while ((matches = regExp.exec(str)) !== null) {
268
+ arr.push(matches);
269
+ }
270
+ return arr;
271
+ }, "matchAll");
272
+ var isHTMLForm = kindOfTest("HTMLFormElement");
273
+ var toCamelCase = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((str) => {
274
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function replacer(m, p1, p2) {
275
+ return p1.toUpperCase() + p2;
276
+ }, "replacer"));
277
+ }, "toCamelCase");
278
+ var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
279
+ var isRegExp = kindOfTest("RegExp");
280
+ var reduceDescriptors = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((obj, reducer) => {
281
+ const descriptors2 = Object.getOwnPropertyDescriptors(obj);
282
+ const reducedDescriptors = {};
283
+ forEach(descriptors2, (descriptor, name) => {
284
+ let ret;
285
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
286
+ reducedDescriptors[name] = ret || descriptor;
287
+ }
288
+ });
289
+ Object.defineProperties(obj, reducedDescriptors);
290
+ }, "reduceDescriptors");
291
+ var freezeMethods = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((obj) => {
292
+ reduceDescriptors(obj, (descriptor, name) => {
293
+ if (isFunction(obj) && [
294
+ "arguments",
295
+ "caller",
296
+ "callee"
297
+ ].indexOf(name) !== -1) {
298
+ return false;
299
+ }
300
+ const value = obj[name];
301
+ if (!isFunction(value)) return;
302
+ descriptor.enumerable = false;
303
+ if ("writable" in descriptor) {
304
+ descriptor.writable = false;
305
+ return;
306
+ }
307
+ if (!descriptor.set) {
308
+ descriptor.set = () => {
309
+ throw Error("Can not rewrite read-only method '" + name + "'");
310
+ };
311
+ }
312
+ });
313
+ }, "freezeMethods");
314
+ var toObjectSet = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((arrayOrString, delimiter) => {
315
+ const obj = {};
316
+ const define = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((arr) => {
317
+ arr.forEach((value) => {
318
+ obj[value] = true;
319
+ });
320
+ }, "define");
321
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
322
+ return obj;
323
+ }, "toObjectSet");
324
+ var noop = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => {
325
+ }, "noop");
326
+ var toFiniteNumber = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((value, defaultValue) => {
327
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
328
+ }, "toFiniteNumber");
329
+ function isSpecCompliantForm(thing) {
330
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
331
+ }
332
+ chunkXQKCXG4I_cjs.__name(isSpecCompliantForm, "isSpecCompliantForm");
333
+ var toJSONObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((obj) => {
334
+ const stack = new Array(10);
335
+ const visit = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((source, i) => {
336
+ if (isObject(source)) {
337
+ if (stack.indexOf(source) >= 0) {
338
+ return;
339
+ }
340
+ if (isBuffer(source)) {
341
+ return source;
342
+ }
343
+ if (!("toJSON" in source)) {
344
+ stack[i] = source;
345
+ const target = isArray(source) ? [] : {};
346
+ forEach(source, (value, key) => {
347
+ const reducedValue = visit(value, i + 1);
348
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
349
+ });
350
+ stack[i] = void 0;
351
+ return target;
352
+ }
353
+ }
354
+ return source;
355
+ }, "visit");
356
+ return visit(obj, 0);
357
+ }, "toJSONObject");
358
+ var isAsyncFn = kindOfTest("AsyncFunction");
359
+ var isThenable = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch), "isThenable");
360
+ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
361
+ if (setImmediateSupported) {
362
+ return setImmediate;
363
+ }
364
+ return postMessageSupported ? ((token, callbacks) => {
365
+ _global.addEventListener("message", ({ source, data }) => {
366
+ if (source === _global && data === token) {
367
+ callbacks.length && callbacks.shift()();
368
+ }
369
+ }, false);
370
+ return (cb) => {
371
+ callbacks.push(cb);
372
+ _global.postMessage(token, "*");
373
+ };
374
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
375
+ })(typeof setImmediate === "function", isFunction(_global.postMessage));
376
+ var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
377
+ var isIterable = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => thing != null && isFunction(thing[iterator]), "isIterable");
378
+ var utils_default = {
379
+ isArray,
380
+ isArrayBuffer,
381
+ isBuffer,
382
+ isFormData,
383
+ isArrayBufferView,
384
+ isString,
385
+ isNumber,
386
+ isBoolean,
387
+ isObject,
388
+ isPlainObject,
389
+ isEmptyObject,
390
+ isReadableStream,
391
+ isRequest,
392
+ isResponse,
393
+ isHeaders,
394
+ isUndefined,
395
+ isDate,
396
+ isFile,
397
+ isBlob,
398
+ isRegExp,
399
+ isFunction,
400
+ isStream,
401
+ isURLSearchParams,
402
+ isTypedArray,
403
+ isFileList,
404
+ forEach,
405
+ merge,
406
+ extend,
407
+ trim,
408
+ stripBOM,
409
+ inherits,
410
+ toFlatObject,
411
+ kindOf,
412
+ kindOfTest,
413
+ endsWith,
414
+ toArray,
415
+ forEachEntry,
416
+ matchAll,
417
+ isHTMLForm,
418
+ hasOwnProperty,
419
+ hasOwnProp: hasOwnProperty,
420
+ reduceDescriptors,
421
+ freezeMethods,
422
+ toObjectSet,
423
+ toCamelCase,
424
+ noop,
425
+ toFiniteNumber,
426
+ findKey,
427
+ global: _global,
428
+ isContextDefined,
429
+ isSpecCompliantForm,
430
+ toJSONObject,
431
+ isAsyncFn,
432
+ isThenable,
433
+ setImmediate: _setImmediate,
434
+ asap,
435
+ isIterable
436
+ };
437
+
438
+ // node_modules/axios/lib/core/AxiosError.js
439
+ function AxiosError(message, code, config, request, response) {
440
+ Error.call(this);
441
+ if (Error.captureStackTrace) {
442
+ Error.captureStackTrace(this, this.constructor);
443
+ } else {
444
+ this.stack = new Error().stack;
445
+ }
446
+ this.message = message;
447
+ this.name = "AxiosError";
448
+ code && (this.code = code);
449
+ config && (this.config = config);
450
+ request && (this.request = request);
451
+ if (response) {
452
+ this.response = response;
453
+ this.status = response.status ? response.status : null;
454
+ }
455
+ }
456
+ chunkXQKCXG4I_cjs.__name(AxiosError, "AxiosError");
457
+ utils_default.inherits(AxiosError, Error, {
458
+ toJSON: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function toJSON() {
459
+ return {
460
+ // Standard
461
+ message: this.message,
462
+ name: this.name,
463
+ // Microsoft
464
+ description: this.description,
465
+ number: this.number,
466
+ // Mozilla
467
+ fileName: this.fileName,
468
+ lineNumber: this.lineNumber,
469
+ columnNumber: this.columnNumber,
470
+ stack: this.stack,
471
+ // Axios
472
+ config: utils_default.toJSONObject(this.config),
473
+ code: this.code,
474
+ status: this.status
475
+ };
476
+ }, "toJSON")
477
+ });
478
+ var prototype = AxiosError.prototype;
479
+ var descriptors = {};
480
+ [
481
+ "ERR_BAD_OPTION_VALUE",
482
+ "ERR_BAD_OPTION",
483
+ "ECONNABORTED",
484
+ "ETIMEDOUT",
485
+ "ERR_NETWORK",
486
+ "ERR_FR_TOO_MANY_REDIRECTS",
487
+ "ERR_DEPRECATED",
488
+ "ERR_BAD_RESPONSE",
489
+ "ERR_BAD_REQUEST",
490
+ "ERR_CANCELED",
491
+ "ERR_NOT_SUPPORT",
492
+ "ERR_INVALID_URL"
493
+ ].forEach((code) => {
494
+ descriptors[code] = {
495
+ value: code
496
+ };
497
+ });
498
+ Object.defineProperties(AxiosError, descriptors);
499
+ Object.defineProperty(prototype, "isAxiosError", {
500
+ value: true
501
+ });
502
+ AxiosError.from = (error, code, config, request, response, customProps) => {
503
+ const axiosError = Object.create(prototype);
504
+ utils_default.toFlatObject(error, axiosError, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function filter2(obj) {
505
+ return obj !== Error.prototype;
506
+ }, "filter"), (prop) => {
507
+ return prop !== "isAxiosError";
508
+ });
509
+ AxiosError.call(axiosError, error.message, code, config, request, response);
510
+ axiosError.cause = error;
511
+ axiosError.name = error.name;
512
+ customProps && Object.assign(axiosError, customProps);
513
+ return axiosError;
514
+ };
515
+ var AxiosError_default = AxiosError;
516
+ var FormData_default = FormData2__default.default;
517
+
518
+ // node_modules/axios/lib/helpers/toFormData.js
519
+ function isVisitable(thing) {
520
+ return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
521
+ }
522
+ chunkXQKCXG4I_cjs.__name(isVisitable, "isVisitable");
523
+ function removeBrackets(key) {
524
+ return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
525
+ }
526
+ chunkXQKCXG4I_cjs.__name(removeBrackets, "removeBrackets");
527
+ function renderKey(path, key, dots) {
528
+ if (!path) return key;
529
+ return path.concat(key).map(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function each(token, i) {
530
+ token = removeBrackets(token);
531
+ return !dots && i ? "[" + token + "]" : token;
532
+ }, "each")).join(dots ? "." : "");
533
+ }
534
+ chunkXQKCXG4I_cjs.__name(renderKey, "renderKey");
535
+ function isFlatArray(arr) {
536
+ return utils_default.isArray(arr) && !arr.some(isVisitable);
537
+ }
538
+ chunkXQKCXG4I_cjs.__name(isFlatArray, "isFlatArray");
539
+ var predicates = utils_default.toFlatObject(utils_default, {}, null, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function filter(prop) {
540
+ return /^is[A-Z]/.test(prop);
541
+ }, "filter"));
542
+ function toFormData(obj, formData, options) {
543
+ if (!utils_default.isObject(obj)) {
544
+ throw new TypeError("target must be an object");
545
+ }
546
+ formData = formData || new (FormData_default || FormData)();
547
+ options = utils_default.toFlatObject(options, {
548
+ metaTokens: true,
549
+ dots: false,
550
+ indexes: false
551
+ }, false, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function defined(option, source) {
552
+ return !utils_default.isUndefined(source[option]);
553
+ }, "defined"));
554
+ const metaTokens = options.metaTokens;
555
+ const visitor = options.visitor || defaultVisitor;
556
+ const dots = options.dots;
557
+ const indexes = options.indexes;
558
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
559
+ const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
560
+ if (!utils_default.isFunction(visitor)) {
561
+ throw new TypeError("visitor must be a function");
562
+ }
563
+ function convertValue(value) {
564
+ if (value === null) return "";
565
+ if (utils_default.isDate(value)) {
566
+ return value.toISOString();
567
+ }
568
+ if (utils_default.isBoolean(value)) {
569
+ return value.toString();
570
+ }
571
+ if (!useBlob && utils_default.isBlob(value)) {
572
+ throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
573
+ }
574
+ if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
575
+ return useBlob && typeof Blob === "function" ? new Blob([
576
+ value
577
+ ]) : Buffer.from(value);
578
+ }
579
+ return value;
580
+ }
581
+ chunkXQKCXG4I_cjs.__name(convertValue, "convertValue");
582
+ function defaultVisitor(value, key, path) {
583
+ let arr = value;
584
+ if (value && !path && typeof value === "object") {
585
+ if (utils_default.endsWith(key, "{}")) {
586
+ key = metaTokens ? key : key.slice(0, -2);
587
+ value = JSON.stringify(value);
588
+ } else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
589
+ key = removeBrackets(key);
590
+ arr.forEach(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function each(el, index) {
591
+ !(utils_default.isUndefined(el) || el === null) && formData.append(
592
+ // eslint-disable-next-line no-nested-ternary
593
+ indexes === true ? renderKey([
594
+ key
595
+ ], index, dots) : indexes === null ? key : key + "[]",
596
+ convertValue(el)
597
+ );
598
+ }, "each"));
599
+ return false;
600
+ }
601
+ }
602
+ if (isVisitable(value)) {
603
+ return true;
604
+ }
605
+ formData.append(renderKey(path, key, dots), convertValue(value));
606
+ return false;
607
+ }
608
+ chunkXQKCXG4I_cjs.__name(defaultVisitor, "defaultVisitor");
609
+ const stack = [];
610
+ const exposedHelpers = Object.assign(predicates, {
611
+ defaultVisitor,
612
+ convertValue,
613
+ isVisitable
614
+ });
615
+ function build(value, path) {
616
+ if (utils_default.isUndefined(value)) return;
617
+ if (stack.indexOf(value) !== -1) {
618
+ throw Error("Circular reference detected in " + path.join("."));
619
+ }
620
+ stack.push(value);
621
+ utils_default.forEach(value, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function each(el, key) {
622
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path, exposedHelpers);
623
+ if (result === true) {
624
+ build(el, path ? path.concat(key) : [
625
+ key
626
+ ]);
627
+ }
628
+ }, "each"));
629
+ stack.pop();
630
+ }
631
+ chunkXQKCXG4I_cjs.__name(build, "build");
632
+ if (!utils_default.isObject(obj)) {
633
+ throw new TypeError("data must be an object");
634
+ }
635
+ build(obj);
636
+ return formData;
637
+ }
638
+ chunkXQKCXG4I_cjs.__name(toFormData, "toFormData");
639
+ var toFormData_default = toFormData;
640
+
641
+ // node_modules/axios/lib/helpers/AxiosURLSearchParams.js
642
+ function encode(str) {
643
+ const charMap = {
644
+ "!": "%21",
645
+ "'": "%27",
646
+ "(": "%28",
647
+ ")": "%29",
648
+ "~": "%7E",
649
+ "%20": "+",
650
+ "%00": "\0"
651
+ };
652
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function replacer(match) {
653
+ return charMap[match];
654
+ }, "replacer"));
655
+ }
656
+ chunkXQKCXG4I_cjs.__name(encode, "encode");
657
+ function AxiosURLSearchParams(params, options) {
658
+ this._pairs = [];
659
+ params && toFormData_default(params, this, options);
660
+ }
661
+ chunkXQKCXG4I_cjs.__name(AxiosURLSearchParams, "AxiosURLSearchParams");
662
+ var prototype2 = AxiosURLSearchParams.prototype;
663
+ prototype2.append = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function append(name, value) {
664
+ this._pairs.push([
665
+ name,
666
+ value
667
+ ]);
668
+ }, "append");
669
+ prototype2.toString = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function toString2(encoder) {
670
+ const _encode = encoder ? function(value) {
671
+ return encoder.call(this, value, encode);
672
+ } : encode;
673
+ return this._pairs.map(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function each(pair) {
674
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
675
+ }, "each"), "").join("&");
676
+ }, "toString");
677
+ var AxiosURLSearchParams_default = AxiosURLSearchParams;
678
+
679
+ // node_modules/axios/lib/helpers/buildURL.js
680
+ function encode2(val) {
681
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
682
+ }
683
+ chunkXQKCXG4I_cjs.__name(encode2, "encode");
684
+ function buildURL(url2, params, options) {
685
+ if (!params) {
686
+ return url2;
687
+ }
688
+ const _encode = options && options.encode || encode2;
689
+ if (utils_default.isFunction(options)) {
690
+ options = {
691
+ serialize: options
692
+ };
693
+ }
694
+ const serializeFn = options && options.serialize;
695
+ let serializedParams;
696
+ if (serializeFn) {
697
+ serializedParams = serializeFn(params, options);
698
+ } else {
699
+ serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode);
700
+ }
701
+ if (serializedParams) {
702
+ const hashmarkIndex = url2.indexOf("#");
703
+ if (hashmarkIndex !== -1) {
704
+ url2 = url2.slice(0, hashmarkIndex);
705
+ }
706
+ url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams;
707
+ }
708
+ return url2;
709
+ }
710
+ chunkXQKCXG4I_cjs.__name(buildURL, "buildURL");
711
+
712
+ // node_modules/axios/lib/core/InterceptorManager.js
713
+ var _a;
714
+ var InterceptorManager = (_a = class {
715
+ constructor() {
716
+ this.handlers = [];
717
+ }
718
+ /**
719
+ * Add a new interceptor to the stack
720
+ *
721
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
722
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
723
+ *
724
+ * @return {Number} An ID used to remove interceptor later
725
+ */
726
+ use(fulfilled, rejected, options) {
727
+ this.handlers.push({
728
+ fulfilled,
729
+ rejected,
730
+ synchronous: options ? options.synchronous : false,
731
+ runWhen: options ? options.runWhen : null
732
+ });
733
+ return this.handlers.length - 1;
734
+ }
735
+ /**
736
+ * Remove an interceptor from the stack
737
+ *
738
+ * @param {Number} id The ID that was returned by `use`
739
+ *
740
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
741
+ */
742
+ eject(id) {
743
+ if (this.handlers[id]) {
744
+ this.handlers[id] = null;
745
+ }
746
+ }
747
+ /**
748
+ * Clear all interceptors from the stack
749
+ *
750
+ * @returns {void}
751
+ */
752
+ clear() {
753
+ if (this.handlers) {
754
+ this.handlers = [];
755
+ }
756
+ }
757
+ /**
758
+ * Iterate over all the registered interceptors
759
+ *
760
+ * This method is particularly useful for skipping over any
761
+ * interceptors that may have become `null` calling `eject`.
762
+ *
763
+ * @param {Function} fn The function to call for each interceptor
764
+ *
765
+ * @returns {void}
766
+ */
767
+ forEach(fn) {
768
+ utils_default.forEach(this.handlers, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function forEachHandler(h) {
769
+ if (h !== null) {
770
+ fn(h);
771
+ }
772
+ }, "forEachHandler"));
773
+ }
774
+ }, chunkXQKCXG4I_cjs.__name(_a, "InterceptorManager"), _a);
775
+ var InterceptorManager_default = InterceptorManager;
776
+
777
+ // node_modules/axios/lib/defaults/transitional.js
778
+ var transitional_default = {
779
+ silentJSONParsing: true,
780
+ forcedJSONParsing: true,
781
+ clarifyTimeoutError: false
782
+ };
783
+ var URLSearchParams_default = url__default.default.URLSearchParams;
784
+
785
+ // node_modules/axios/lib/platform/node/index.js
786
+ var ALPHA = "abcdefghijklmnopqrstuvwxyz";
787
+ var DIGIT = "0123456789";
788
+ var ALPHABET = {
789
+ DIGIT,
790
+ ALPHA,
791
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
792
+ };
793
+ var generateString = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
794
+ let str = "";
795
+ const { length } = alphabet;
796
+ const randomValues = new Uint32Array(size);
797
+ crypto__default.default.randomFillSync(randomValues);
798
+ for (let i = 0; i < size; i++) {
799
+ str += alphabet[randomValues[i] % length];
800
+ }
801
+ return str;
802
+ }, "generateString");
803
+ var node_default = {
804
+ isNode: true,
805
+ classes: {
806
+ URLSearchParams: URLSearchParams_default,
807
+ FormData: FormData_default,
808
+ Blob: typeof Blob !== "undefined" && Blob || null
809
+ },
810
+ ALPHABET,
811
+ generateString,
812
+ protocols: [
813
+ "http",
814
+ "https",
815
+ "file",
816
+ "data"
817
+ ]
818
+ };
819
+
820
+ // node_modules/axios/lib/platform/common/utils.js
821
+ var utils_exports = {};
822
+ chunkXQKCXG4I_cjs.__export(utils_exports, {
823
+ hasBrowserEnv: () => hasBrowserEnv,
824
+ hasStandardBrowserEnv: () => hasStandardBrowserEnv,
825
+ hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
826
+ navigator: () => _navigator,
827
+ origin: () => origin
828
+ });
829
+ var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
830
+ var _navigator = typeof navigator === "object" && navigator || void 0;
831
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || [
832
+ "ReactNative",
833
+ "NativeScript",
834
+ "NS"
835
+ ].indexOf(_navigator.product) < 0);
836
+ var hasStandardBrowserWebWorkerEnv = (() => {
837
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
838
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
839
+ })();
840
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
841
+
842
+ // node_modules/axios/lib/platform/index.js
843
+ var platform_default = {
844
+ ...utils_exports,
845
+ ...node_default
846
+ };
847
+
848
+ // node_modules/axios/lib/helpers/toURLEncodedForm.js
849
+ function toURLEncodedForm(data, options) {
850
+ return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
851
+ visitor: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function(value, key, path, helpers) {
852
+ if (platform_default.isNode && utils_default.isBuffer(value)) {
853
+ this.append(key, value.toString("base64"));
854
+ return false;
855
+ }
856
+ return helpers.defaultVisitor.apply(this, arguments);
857
+ }, "visitor"),
858
+ ...options
859
+ });
860
+ }
861
+ chunkXQKCXG4I_cjs.__name(toURLEncodedForm, "toURLEncodedForm");
862
+
863
+ // node_modules/axios/lib/helpers/formDataToJSON.js
864
+ function parsePropPath(name) {
865
+ return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
866
+ return match[0] === "[]" ? "" : match[1] || match[0];
867
+ });
868
+ }
869
+ chunkXQKCXG4I_cjs.__name(parsePropPath, "parsePropPath");
870
+ function arrayToObject(arr) {
871
+ const obj = {};
872
+ const keys = Object.keys(arr);
873
+ let i;
874
+ const len = keys.length;
875
+ let key;
876
+ for (i = 0; i < len; i++) {
877
+ key = keys[i];
878
+ obj[key] = arr[key];
879
+ }
880
+ return obj;
881
+ }
882
+ chunkXQKCXG4I_cjs.__name(arrayToObject, "arrayToObject");
883
+ function formDataToJSON(formData) {
884
+ function buildPath(path, value, target, index) {
885
+ let name = path[index++];
886
+ if (name === "__proto__") return true;
887
+ const isNumericKey = Number.isFinite(+name);
888
+ const isLast = index >= path.length;
889
+ name = !name && utils_default.isArray(target) ? target.length : name;
890
+ if (isLast) {
891
+ if (utils_default.hasOwnProp(target, name)) {
892
+ target[name] = [
893
+ target[name],
894
+ value
895
+ ];
896
+ } else {
897
+ target[name] = value;
898
+ }
899
+ return !isNumericKey;
900
+ }
901
+ if (!target[name] || !utils_default.isObject(target[name])) {
902
+ target[name] = [];
903
+ }
904
+ const result = buildPath(path, value, target[name], index);
905
+ if (result && utils_default.isArray(target[name])) {
906
+ target[name] = arrayToObject(target[name]);
907
+ }
908
+ return !isNumericKey;
909
+ }
910
+ chunkXQKCXG4I_cjs.__name(buildPath, "buildPath");
911
+ if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
912
+ const obj = {};
913
+ utils_default.forEachEntry(formData, (name, value) => {
914
+ buildPath(parsePropPath(name), value, obj, 0);
915
+ });
916
+ return obj;
917
+ }
918
+ return null;
919
+ }
920
+ chunkXQKCXG4I_cjs.__name(formDataToJSON, "formDataToJSON");
921
+ var formDataToJSON_default = formDataToJSON;
922
+
923
+ // node_modules/axios/lib/defaults/index.js
924
+ function stringifySafely(rawValue, parser, encoder) {
925
+ if (utils_default.isString(rawValue)) {
926
+ try {
927
+ (parser || JSON.parse)(rawValue);
928
+ return utils_default.trim(rawValue);
929
+ } catch (e) {
930
+ if (e.name !== "SyntaxError") {
931
+ throw e;
932
+ }
933
+ }
934
+ }
935
+ return (encoder || JSON.stringify)(rawValue);
936
+ }
937
+ chunkXQKCXG4I_cjs.__name(stringifySafely, "stringifySafely");
938
+ var defaults = {
939
+ transitional: transitional_default,
940
+ adapter: [
941
+ "xhr",
942
+ "http",
943
+ "fetch"
944
+ ],
945
+ transformRequest: [
946
+ /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function transformRequest(data, headers) {
947
+ const contentType = headers.getContentType() || "";
948
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
949
+ const isObjectPayload = utils_default.isObject(data);
950
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
951
+ data = new FormData(data);
952
+ }
953
+ const isFormData2 = utils_default.isFormData(data);
954
+ if (isFormData2) {
955
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
956
+ }
957
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
958
+ return data;
959
+ }
960
+ if (utils_default.isArrayBufferView(data)) {
961
+ return data.buffer;
962
+ }
963
+ if (utils_default.isURLSearchParams(data)) {
964
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
965
+ return data.toString();
966
+ }
967
+ let isFileList2;
968
+ if (isObjectPayload) {
969
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
970
+ return toURLEncodedForm(data, this.formSerializer).toString();
971
+ }
972
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
973
+ const _FormData = this.env && this.env.FormData;
974
+ return toFormData_default(isFileList2 ? {
975
+ "files[]": data
976
+ } : data, _FormData && new _FormData(), this.formSerializer);
977
+ }
978
+ }
979
+ if (isObjectPayload || hasJSONContentType) {
980
+ headers.setContentType("application/json", false);
981
+ return stringifySafely(data);
982
+ }
983
+ return data;
984
+ }, "transformRequest")
985
+ ],
986
+ transformResponse: [
987
+ /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function transformResponse(data) {
988
+ const transitional2 = this.transitional || defaults.transitional;
989
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
990
+ const JSONRequested = this.responseType === "json";
991
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
992
+ return data;
993
+ }
994
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
995
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
996
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
997
+ try {
998
+ return JSON.parse(data);
999
+ } catch (e) {
1000
+ if (strictJSONParsing) {
1001
+ if (e.name === "SyntaxError") {
1002
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
1003
+ }
1004
+ throw e;
1005
+ }
1006
+ }
1007
+ }
1008
+ return data;
1009
+ }, "transformResponse")
1010
+ ],
1011
+ /**
1012
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1013
+ * timeout is not created.
1014
+ */
1015
+ timeout: 0,
1016
+ xsrfCookieName: "XSRF-TOKEN",
1017
+ xsrfHeaderName: "X-XSRF-TOKEN",
1018
+ maxContentLength: -1,
1019
+ maxBodyLength: -1,
1020
+ env: {
1021
+ FormData: platform_default.classes.FormData,
1022
+ Blob: platform_default.classes.Blob
1023
+ },
1024
+ validateStatus: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function validateStatus(status) {
1025
+ return status >= 200 && status < 300;
1026
+ }, "validateStatus"),
1027
+ headers: {
1028
+ common: {
1029
+ "Accept": "application/json, text/plain, */*",
1030
+ "Content-Type": void 0
1031
+ }
1032
+ }
1033
+ };
1034
+ utils_default.forEach([
1035
+ "delete",
1036
+ "get",
1037
+ "head",
1038
+ "post",
1039
+ "put",
1040
+ "patch"
1041
+ ], (method) => {
1042
+ defaults.headers[method] = {};
1043
+ });
1044
+ var defaults_default = defaults;
1045
+
1046
+ // node_modules/axios/lib/helpers/parseHeaders.js
1047
+ var ignoreDuplicateOf = utils_default.toObjectSet([
1048
+ "age",
1049
+ "authorization",
1050
+ "content-length",
1051
+ "content-type",
1052
+ "etag",
1053
+ "expires",
1054
+ "from",
1055
+ "host",
1056
+ "if-modified-since",
1057
+ "if-unmodified-since",
1058
+ "last-modified",
1059
+ "location",
1060
+ "max-forwards",
1061
+ "proxy-authorization",
1062
+ "referer",
1063
+ "retry-after",
1064
+ "user-agent"
1065
+ ]);
1066
+ var parseHeaders_default = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((rawHeaders) => {
1067
+ const parsed = {};
1068
+ let key;
1069
+ let val;
1070
+ let i;
1071
+ rawHeaders && rawHeaders.split("\n").forEach(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function parser(line) {
1072
+ i = line.indexOf(":");
1073
+ key = line.substring(0, i).trim().toLowerCase();
1074
+ val = line.substring(i + 1).trim();
1075
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1076
+ return;
1077
+ }
1078
+ if (key === "set-cookie") {
1079
+ if (parsed[key]) {
1080
+ parsed[key].push(val);
1081
+ } else {
1082
+ parsed[key] = [
1083
+ val
1084
+ ];
1085
+ }
1086
+ } else {
1087
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1088
+ }
1089
+ }, "parser"));
1090
+ return parsed;
1091
+ }, "default");
1092
+
1093
+ // node_modules/axios/lib/core/AxiosHeaders.js
1094
+ var $internals = Symbol("internals");
1095
+ function normalizeHeader(header) {
1096
+ return header && String(header).trim().toLowerCase();
1097
+ }
1098
+ chunkXQKCXG4I_cjs.__name(normalizeHeader, "normalizeHeader");
1099
+ function normalizeValue(value) {
1100
+ if (value === false || value == null) {
1101
+ return value;
1102
+ }
1103
+ return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
1104
+ }
1105
+ chunkXQKCXG4I_cjs.__name(normalizeValue, "normalizeValue");
1106
+ function parseTokens(str) {
1107
+ const tokens = /* @__PURE__ */ Object.create(null);
1108
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1109
+ let match;
1110
+ while (match = tokensRE.exec(str)) {
1111
+ tokens[match[1]] = match[2];
1112
+ }
1113
+ return tokens;
1114
+ }
1115
+ chunkXQKCXG4I_cjs.__name(parseTokens, "parseTokens");
1116
+ var isValidHeaderName = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()), "isValidHeaderName");
1117
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1118
+ if (utils_default.isFunction(filter2)) {
1119
+ return filter2.call(this, value, header);
1120
+ }
1121
+ if (isHeaderNameFilter) {
1122
+ value = header;
1123
+ }
1124
+ if (!utils_default.isString(value)) return;
1125
+ if (utils_default.isString(filter2)) {
1126
+ return value.indexOf(filter2) !== -1;
1127
+ }
1128
+ if (utils_default.isRegExp(filter2)) {
1129
+ return filter2.test(value);
1130
+ }
1131
+ }
1132
+ chunkXQKCXG4I_cjs.__name(matchHeaderValue, "matchHeaderValue");
1133
+ function formatHeader(header) {
1134
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1135
+ return char.toUpperCase() + str;
1136
+ });
1137
+ }
1138
+ chunkXQKCXG4I_cjs.__name(formatHeader, "formatHeader");
1139
+ function buildAccessors(obj, header) {
1140
+ const accessorName = utils_default.toCamelCase(" " + header);
1141
+ [
1142
+ "get",
1143
+ "set",
1144
+ "has"
1145
+ ].forEach((methodName) => {
1146
+ Object.defineProperty(obj, methodName + accessorName, {
1147
+ value: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function(arg1, arg2, arg3) {
1148
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1149
+ }, "value"),
1150
+ configurable: true
1151
+ });
1152
+ });
1153
+ }
1154
+ chunkXQKCXG4I_cjs.__name(buildAccessors, "buildAccessors");
1155
+ var _a2;
1156
+ var AxiosHeaders = (_a2 = class {
1157
+ constructor(headers) {
1158
+ headers && this.set(headers);
1159
+ }
1160
+ set(header, valueOrRewrite, rewrite) {
1161
+ const self2 = this;
1162
+ function setHeader(_value, _header, _rewrite) {
1163
+ const lHeader = normalizeHeader(_header);
1164
+ if (!lHeader) {
1165
+ throw new Error("header name must be a non-empty string");
1166
+ }
1167
+ const key = utils_default.findKey(self2, lHeader);
1168
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1169
+ self2[key || _header] = normalizeValue(_value);
1170
+ }
1171
+ }
1172
+ chunkXQKCXG4I_cjs.__name(setHeader, "setHeader");
1173
+ const setHeaders = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)), "setHeaders");
1174
+ if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
1175
+ setHeaders(header, valueOrRewrite);
1176
+ } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1177
+ setHeaders(parseHeaders_default(header), valueOrRewrite);
1178
+ } else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
1179
+ let obj = {}, dest, key;
1180
+ for (const entry of header) {
1181
+ if (!utils_default.isArray(entry)) {
1182
+ throw TypeError("Object iterator must return a key-value pair");
1183
+ }
1184
+ obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [
1185
+ ...dest,
1186
+ entry[1]
1187
+ ] : [
1188
+ dest,
1189
+ entry[1]
1190
+ ] : entry[1];
1191
+ }
1192
+ setHeaders(obj, valueOrRewrite);
1193
+ } else {
1194
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1195
+ }
1196
+ return this;
1197
+ }
1198
+ get(header, parser) {
1199
+ header = normalizeHeader(header);
1200
+ if (header) {
1201
+ const key = utils_default.findKey(this, header);
1202
+ if (key) {
1203
+ const value = this[key];
1204
+ if (!parser) {
1205
+ return value;
1206
+ }
1207
+ if (parser === true) {
1208
+ return parseTokens(value);
1209
+ }
1210
+ if (utils_default.isFunction(parser)) {
1211
+ return parser.call(this, value, key);
1212
+ }
1213
+ if (utils_default.isRegExp(parser)) {
1214
+ return parser.exec(value);
1215
+ }
1216
+ throw new TypeError("parser must be boolean|regexp|function");
1217
+ }
1218
+ }
1219
+ }
1220
+ has(header, matcher) {
1221
+ header = normalizeHeader(header);
1222
+ if (header) {
1223
+ const key = utils_default.findKey(this, header);
1224
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1225
+ }
1226
+ return false;
1227
+ }
1228
+ delete(header, matcher) {
1229
+ const self2 = this;
1230
+ let deleted = false;
1231
+ function deleteHeader(_header) {
1232
+ _header = normalizeHeader(_header);
1233
+ if (_header) {
1234
+ const key = utils_default.findKey(self2, _header);
1235
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1236
+ delete self2[key];
1237
+ deleted = true;
1238
+ }
1239
+ }
1240
+ }
1241
+ chunkXQKCXG4I_cjs.__name(deleteHeader, "deleteHeader");
1242
+ if (utils_default.isArray(header)) {
1243
+ header.forEach(deleteHeader);
1244
+ } else {
1245
+ deleteHeader(header);
1246
+ }
1247
+ return deleted;
1248
+ }
1249
+ clear(matcher) {
1250
+ const keys = Object.keys(this);
1251
+ let i = keys.length;
1252
+ let deleted = false;
1253
+ while (i--) {
1254
+ const key = keys[i];
1255
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1256
+ delete this[key];
1257
+ deleted = true;
1258
+ }
1259
+ }
1260
+ return deleted;
1261
+ }
1262
+ normalize(format) {
1263
+ const self2 = this;
1264
+ const headers = {};
1265
+ utils_default.forEach(this, (value, header) => {
1266
+ const key = utils_default.findKey(headers, header);
1267
+ if (key) {
1268
+ self2[key] = normalizeValue(value);
1269
+ delete self2[header];
1270
+ return;
1271
+ }
1272
+ const normalized = format ? formatHeader(header) : String(header).trim();
1273
+ if (normalized !== header) {
1274
+ delete self2[header];
1275
+ }
1276
+ self2[normalized] = normalizeValue(value);
1277
+ headers[normalized] = true;
1278
+ });
1279
+ return this;
1280
+ }
1281
+ concat(...targets) {
1282
+ return this.constructor.concat(this, ...targets);
1283
+ }
1284
+ toJSON(asStrings) {
1285
+ const obj = /* @__PURE__ */ Object.create(null);
1286
+ utils_default.forEach(this, (value, header) => {
1287
+ value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
1288
+ });
1289
+ return obj;
1290
+ }
1291
+ [Symbol.iterator]() {
1292
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1293
+ }
1294
+ toString() {
1295
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1296
+ }
1297
+ getSetCookie() {
1298
+ return this.get("set-cookie") || [];
1299
+ }
1300
+ get [Symbol.toStringTag]() {
1301
+ return "AxiosHeaders";
1302
+ }
1303
+ static from(thing) {
1304
+ return thing instanceof this ? thing : new this(thing);
1305
+ }
1306
+ static concat(first, ...targets) {
1307
+ const computed = new this(first);
1308
+ targets.forEach((target) => computed.set(target));
1309
+ return computed;
1310
+ }
1311
+ static accessor(header) {
1312
+ const internals = this[$internals] = this[$internals] = {
1313
+ accessors: {}
1314
+ };
1315
+ const accessors = internals.accessors;
1316
+ const prototype3 = this.prototype;
1317
+ function defineAccessor(_header) {
1318
+ const lHeader = normalizeHeader(_header);
1319
+ if (!accessors[lHeader]) {
1320
+ buildAccessors(prototype3, _header);
1321
+ accessors[lHeader] = true;
1322
+ }
1323
+ }
1324
+ chunkXQKCXG4I_cjs.__name(defineAccessor, "defineAccessor");
1325
+ utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1326
+ return this;
1327
+ }
1328
+ }, chunkXQKCXG4I_cjs.__name(_a2, "AxiosHeaders"), _a2);
1329
+ AxiosHeaders.accessor([
1330
+ "Content-Type",
1331
+ "Content-Length",
1332
+ "Accept",
1333
+ "Accept-Encoding",
1334
+ "User-Agent",
1335
+ "Authorization"
1336
+ ]);
1337
+ utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
1338
+ let mapped = key[0].toUpperCase() + key.slice(1);
1339
+ return {
1340
+ get: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => value, "get"),
1341
+ set(headerValue) {
1342
+ this[mapped] = headerValue;
1343
+ }
1344
+ };
1345
+ });
1346
+ utils_default.freezeMethods(AxiosHeaders);
1347
+ var AxiosHeaders_default = AxiosHeaders;
1348
+
1349
+ // node_modules/axios/lib/core/transformData.js
1350
+ function transformData(fns, response) {
1351
+ const config = this || defaults_default;
1352
+ const context = response || config;
1353
+ const headers = AxiosHeaders_default.from(context.headers);
1354
+ let data = context.data;
1355
+ utils_default.forEach(fns, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function transform(fn) {
1356
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
1357
+ }, "transform"));
1358
+ headers.normalize();
1359
+ return data;
1360
+ }
1361
+ chunkXQKCXG4I_cjs.__name(transformData, "transformData");
1362
+
1363
+ // node_modules/axios/lib/cancel/isCancel.js
1364
+ function isCancel(value) {
1365
+ return !!(value && value.__CANCEL__);
1366
+ }
1367
+ chunkXQKCXG4I_cjs.__name(isCancel, "isCancel");
1368
+
1369
+ // node_modules/axios/lib/cancel/CanceledError.js
1370
+ function CanceledError(message, config, request) {
1371
+ AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
1372
+ this.name = "CanceledError";
1373
+ }
1374
+ chunkXQKCXG4I_cjs.__name(CanceledError, "CanceledError");
1375
+ utils_default.inherits(CanceledError, AxiosError_default, {
1376
+ __CANCEL__: true
1377
+ });
1378
+ var CanceledError_default = CanceledError;
1379
+
1380
+ // node_modules/axios/lib/core/settle.js
1381
+ function settle(resolve, reject, response) {
1382
+ const validateStatus2 = response.config.validateStatus;
1383
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
1384
+ resolve(response);
1385
+ } else {
1386
+ reject(new AxiosError_default("Request failed with status code " + response.status, [
1387
+ AxiosError_default.ERR_BAD_REQUEST,
1388
+ AxiosError_default.ERR_BAD_RESPONSE
1389
+ ][Math.floor(response.status / 100) - 4], response.config, response.request, response));
1390
+ }
1391
+ }
1392
+ chunkXQKCXG4I_cjs.__name(settle, "settle");
1393
+
1394
+ // node_modules/axios/lib/helpers/isAbsoluteURL.js
1395
+ function isAbsoluteURL(url2) {
1396
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
1397
+ }
1398
+ chunkXQKCXG4I_cjs.__name(isAbsoluteURL, "isAbsoluteURL");
1399
+
1400
+ // node_modules/axios/lib/helpers/combineURLs.js
1401
+ function combineURLs(baseURL, relativeURL) {
1402
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1403
+ }
1404
+ chunkXQKCXG4I_cjs.__name(combineURLs, "combineURLs");
1405
+
1406
+ // node_modules/axios/lib/core/buildFullPath.js
1407
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1408
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
1409
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
1410
+ return combineURLs(baseURL, requestedURL);
1411
+ }
1412
+ return requestedURL;
1413
+ }
1414
+ chunkXQKCXG4I_cjs.__name(buildFullPath, "buildFullPath");
1415
+
1416
+ // node_modules/axios/lib/env/data.js
1417
+ var VERSION = "1.11.0";
1418
+
1419
+ // node_modules/axios/lib/helpers/parseProtocol.js
1420
+ function parseProtocol(url2) {
1421
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
1422
+ return match && match[1] || "";
1423
+ }
1424
+ chunkXQKCXG4I_cjs.__name(parseProtocol, "parseProtocol");
1425
+
1426
+ // node_modules/axios/lib/helpers/fromDataURI.js
1427
+ var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
1428
+ function fromDataURI(uri, asBlob, options) {
1429
+ const _Blob = options && options.Blob || platform_default.classes.Blob;
1430
+ const protocol = parseProtocol(uri);
1431
+ if (asBlob === void 0 && _Blob) {
1432
+ asBlob = true;
1433
+ }
1434
+ if (protocol === "data") {
1435
+ uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
1436
+ const match = DATA_URL_PATTERN.exec(uri);
1437
+ if (!match) {
1438
+ throw new AxiosError_default("Invalid URL", AxiosError_default.ERR_INVALID_URL);
1439
+ }
1440
+ const mime = match[1];
1441
+ const isBase64 = match[2];
1442
+ const body = match[3];
1443
+ const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
1444
+ if (asBlob) {
1445
+ if (!_Blob) {
1446
+ throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
1447
+ }
1448
+ return new _Blob([
1449
+ buffer
1450
+ ], {
1451
+ type: mime
1452
+ });
1453
+ }
1454
+ return buffer;
1455
+ }
1456
+ throw new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_NOT_SUPPORT);
1457
+ }
1458
+ chunkXQKCXG4I_cjs.__name(fromDataURI, "fromDataURI");
1459
+ var kInternals = Symbol("internals");
1460
+ var _a3;
1461
+ var AxiosTransformStream = (_a3 = class extends stream3__default.default.Transform {
1462
+ constructor(options) {
1463
+ options = utils_default.toFlatObject(options, {
1464
+ maxRate: 0,
1465
+ chunkSize: 64 * 1024,
1466
+ minChunkSize: 100,
1467
+ timeWindow: 500,
1468
+ ticksRate: 2,
1469
+ samplesCount: 15
1470
+ }, null, (prop, source) => {
1471
+ return !utils_default.isUndefined(source[prop]);
1472
+ });
1473
+ super({
1474
+ readableHighWaterMark: options.chunkSize
1475
+ });
1476
+ const internals = this[kInternals] = {
1477
+ timeWindow: options.timeWindow,
1478
+ chunkSize: options.chunkSize,
1479
+ maxRate: options.maxRate,
1480
+ minChunkSize: options.minChunkSize,
1481
+ bytesSeen: 0,
1482
+ isCaptured: false,
1483
+ notifiedBytesLoaded: 0,
1484
+ ts: Date.now(),
1485
+ bytes: 0,
1486
+ onReadCallback: null
1487
+ };
1488
+ this.on("newListener", (event) => {
1489
+ if (event === "progress") {
1490
+ if (!internals.isCaptured) {
1491
+ internals.isCaptured = true;
1492
+ }
1493
+ }
1494
+ });
1495
+ }
1496
+ _read(size) {
1497
+ const internals = this[kInternals];
1498
+ if (internals.onReadCallback) {
1499
+ internals.onReadCallback();
1500
+ }
1501
+ return super._read(size);
1502
+ }
1503
+ _transform(chunk, encoding, callback) {
1504
+ const internals = this[kInternals];
1505
+ const maxRate = internals.maxRate;
1506
+ const readableHighWaterMark = this.readableHighWaterMark;
1507
+ const timeWindow = internals.timeWindow;
1508
+ const divider = 1e3 / timeWindow;
1509
+ const bytesThreshold = maxRate / divider;
1510
+ const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
1511
+ const pushChunk = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((_chunk, _callback) => {
1512
+ const bytes = Buffer.byteLength(_chunk);
1513
+ internals.bytesSeen += bytes;
1514
+ internals.bytes += bytes;
1515
+ internals.isCaptured && this.emit("progress", internals.bytesSeen);
1516
+ if (this.push(_chunk)) {
1517
+ process.nextTick(_callback);
1518
+ } else {
1519
+ internals.onReadCallback = () => {
1520
+ internals.onReadCallback = null;
1521
+ process.nextTick(_callback);
1522
+ };
1523
+ }
1524
+ }, "pushChunk");
1525
+ const transformChunk = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((_chunk, _callback) => {
1526
+ const chunkSize = Buffer.byteLength(_chunk);
1527
+ let chunkRemainder = null;
1528
+ let maxChunkSize = readableHighWaterMark;
1529
+ let bytesLeft;
1530
+ let passed = 0;
1531
+ if (maxRate) {
1532
+ const now = Date.now();
1533
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
1534
+ internals.ts = now;
1535
+ bytesLeft = bytesThreshold - internals.bytes;
1536
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
1537
+ passed = 0;
1538
+ }
1539
+ bytesLeft = bytesThreshold - internals.bytes;
1540
+ }
1541
+ if (maxRate) {
1542
+ if (bytesLeft <= 0) {
1543
+ return setTimeout(() => {
1544
+ _callback(null, _chunk);
1545
+ }, timeWindow - passed);
1546
+ }
1547
+ if (bytesLeft < maxChunkSize) {
1548
+ maxChunkSize = bytesLeft;
1549
+ }
1550
+ }
1551
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
1552
+ chunkRemainder = _chunk.subarray(maxChunkSize);
1553
+ _chunk = _chunk.subarray(0, maxChunkSize);
1554
+ }
1555
+ pushChunk(_chunk, chunkRemainder ? () => {
1556
+ process.nextTick(_callback, null, chunkRemainder);
1557
+ } : _callback);
1558
+ }, "transformChunk");
1559
+ transformChunk(chunk, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function transformNextChunk(err, _chunk) {
1560
+ if (err) {
1561
+ return callback(err);
1562
+ }
1563
+ if (_chunk) {
1564
+ transformChunk(_chunk, transformNextChunk);
1565
+ } else {
1566
+ callback(null);
1567
+ }
1568
+ }, "transformNextChunk"));
1569
+ }
1570
+ }, chunkXQKCXG4I_cjs.__name(_a3, "AxiosTransformStream"), _a3);
1571
+ var AxiosTransformStream_default = AxiosTransformStream;
1572
+
1573
+ // node_modules/axios/lib/helpers/readBlob.js
1574
+ var { asyncIterator } = Symbol;
1575
+ var readBlob = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async function* (blob) {
1576
+ if (blob.stream) {
1577
+ yield* blob.stream();
1578
+ } else if (blob.arrayBuffer) {
1579
+ yield await blob.arrayBuffer();
1580
+ } else if (blob[asyncIterator]) {
1581
+ yield* blob[asyncIterator]();
1582
+ } else {
1583
+ yield blob;
1584
+ }
1585
+ }, "readBlob");
1586
+ var readBlob_default = readBlob;
1587
+
1588
+ // node_modules/axios/lib/helpers/formDataToStream.js
1589
+ var BOUNDARY_ALPHABET = platform_default.ALPHABET.ALPHA_DIGIT + "-_";
1590
+ var textEncoder = typeof TextEncoder === "function" ? new TextEncoder() : new util__default.default.TextEncoder();
1591
+ var CRLF = "\r\n";
1592
+ var CRLF_BYTES = textEncoder.encode(CRLF);
1593
+ var CRLF_BYTES_COUNT = 2;
1594
+ var _a4;
1595
+ var FormDataPart = (_a4 = class {
1596
+ constructor(name, value) {
1597
+ const { escapeName } = this.constructor;
1598
+ const isStringValue = utils_default.isString(value);
1599
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
1600
+ if (isStringValue) {
1601
+ value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
1602
+ } else {
1603
+ headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
1604
+ }
1605
+ this.headers = textEncoder.encode(headers + CRLF);
1606
+ this.contentLength = isStringValue ? value.byteLength : value.size;
1607
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
1608
+ this.name = name;
1609
+ this.value = value;
1610
+ }
1611
+ async *encode() {
1612
+ yield this.headers;
1613
+ const { value } = this;
1614
+ if (utils_default.isTypedArray(value)) {
1615
+ yield value;
1616
+ } else {
1617
+ yield* readBlob_default(value);
1618
+ }
1619
+ yield CRLF_BYTES;
1620
+ }
1621
+ static escapeName(name) {
1622
+ return String(name).replace(/[\r\n"]/g, (match) => ({
1623
+ "\r": "%0D",
1624
+ "\n": "%0A",
1625
+ '"': "%22"
1626
+ })[match]);
1627
+ }
1628
+ }, chunkXQKCXG4I_cjs.__name(_a4, "FormDataPart"), _a4);
1629
+ var formDataToStream = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((form, headersHandler, options) => {
1630
+ const { tag = "form-data-boundary", size = 25, boundary = tag + "-" + platform_default.generateString(size, BOUNDARY_ALPHABET) } = options || {};
1631
+ if (!utils_default.isFormData(form)) {
1632
+ throw TypeError("FormData instance required");
1633
+ }
1634
+ if (boundary.length < 1 || boundary.length > 70) {
1635
+ throw Error("boundary must be 10-70 characters long");
1636
+ }
1637
+ const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
1638
+ const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF);
1639
+ let contentLength = footerBytes.byteLength;
1640
+ const parts = Array.from(form.entries()).map(([name, value]) => {
1641
+ const part = new FormDataPart(name, value);
1642
+ contentLength += part.size;
1643
+ return part;
1644
+ });
1645
+ contentLength += boundaryBytes.byteLength * parts.length;
1646
+ contentLength = utils_default.toFiniteNumber(contentLength);
1647
+ const computedHeaders = {
1648
+ "Content-Type": `multipart/form-data; boundary=${boundary}`
1649
+ };
1650
+ if (Number.isFinite(contentLength)) {
1651
+ computedHeaders["Content-Length"] = contentLength;
1652
+ }
1653
+ headersHandler && headersHandler(computedHeaders);
1654
+ return stream3.Readable.from(async function* () {
1655
+ for (const part of parts) {
1656
+ yield boundaryBytes;
1657
+ yield* part.encode();
1658
+ }
1659
+ yield footerBytes;
1660
+ }());
1661
+ }, "formDataToStream");
1662
+ var formDataToStream_default = formDataToStream;
1663
+ var _a5;
1664
+ var ZlibHeaderTransformStream = (_a5 = class extends stream3__default.default.Transform {
1665
+ __transform(chunk, encoding, callback) {
1666
+ this.push(chunk);
1667
+ callback();
1668
+ }
1669
+ _transform(chunk, encoding, callback) {
1670
+ if (chunk.length !== 0) {
1671
+ this._transform = this.__transform;
1672
+ if (chunk[0] !== 120) {
1673
+ const header = Buffer.alloc(2);
1674
+ header[0] = 120;
1675
+ header[1] = 156;
1676
+ this.push(header, encoding);
1677
+ }
1678
+ }
1679
+ this.__transform(chunk, encoding, callback);
1680
+ }
1681
+ }, chunkXQKCXG4I_cjs.__name(_a5, "ZlibHeaderTransformStream"), _a5);
1682
+ var ZlibHeaderTransformStream_default = ZlibHeaderTransformStream;
1683
+
1684
+ // node_modules/axios/lib/helpers/callbackify.js
1685
+ var callbackify = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((fn, reducer) => {
1686
+ return utils_default.isAsyncFn(fn) ? function(...args) {
1687
+ const cb = args.pop();
1688
+ fn.apply(this, args).then((value) => {
1689
+ try {
1690
+ reducer ? cb(null, ...reducer(value)) : cb(null, value);
1691
+ } catch (err) {
1692
+ cb(err);
1693
+ }
1694
+ }, cb);
1695
+ } : fn;
1696
+ }, "callbackify");
1697
+ var callbackify_default = callbackify;
1698
+
1699
+ // node_modules/axios/lib/helpers/speedometer.js
1700
+ function speedometer(samplesCount, min) {
1701
+ samplesCount = samplesCount || 10;
1702
+ const bytes = new Array(samplesCount);
1703
+ const timestamps = new Array(samplesCount);
1704
+ let head = 0;
1705
+ let tail = 0;
1706
+ let firstSampleTS;
1707
+ min = min !== void 0 ? min : 1e3;
1708
+ return /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function push(chunkLength) {
1709
+ const now = Date.now();
1710
+ const startedAt = timestamps[tail];
1711
+ if (!firstSampleTS) {
1712
+ firstSampleTS = now;
1713
+ }
1714
+ bytes[head] = chunkLength;
1715
+ timestamps[head] = now;
1716
+ let i = tail;
1717
+ let bytesCount = 0;
1718
+ while (i !== head) {
1719
+ bytesCount += bytes[i++];
1720
+ i = i % samplesCount;
1721
+ }
1722
+ head = (head + 1) % samplesCount;
1723
+ if (head === tail) {
1724
+ tail = (tail + 1) % samplesCount;
1725
+ }
1726
+ if (now - firstSampleTS < min) {
1727
+ return;
1728
+ }
1729
+ const passed = startedAt && now - startedAt;
1730
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1731
+ }, "push");
1732
+ }
1733
+ chunkXQKCXG4I_cjs.__name(speedometer, "speedometer");
1734
+ var speedometer_default = speedometer;
1735
+
1736
+ // node_modules/axios/lib/helpers/throttle.js
1737
+ function throttle(fn, freq) {
1738
+ let timestamp = 0;
1739
+ let threshold = 1e3 / freq;
1740
+ let lastArgs;
1741
+ let timer;
1742
+ const invoke = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((args, now = Date.now()) => {
1743
+ timestamp = now;
1744
+ lastArgs = null;
1745
+ if (timer) {
1746
+ clearTimeout(timer);
1747
+ timer = null;
1748
+ }
1749
+ fn(...args);
1750
+ }, "invoke");
1751
+ const throttled = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((...args) => {
1752
+ const now = Date.now();
1753
+ const passed = now - timestamp;
1754
+ if (passed >= threshold) {
1755
+ invoke(args, now);
1756
+ } else {
1757
+ lastArgs = args;
1758
+ if (!timer) {
1759
+ timer = setTimeout(() => {
1760
+ timer = null;
1761
+ invoke(lastArgs);
1762
+ }, threshold - passed);
1763
+ }
1764
+ }
1765
+ }, "throttled");
1766
+ const flush = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => lastArgs && invoke(lastArgs), "flush");
1767
+ return [
1768
+ throttled,
1769
+ flush
1770
+ ];
1771
+ }
1772
+ chunkXQKCXG4I_cjs.__name(throttle, "throttle");
1773
+ var throttle_default = throttle;
1774
+
1775
+ // node_modules/axios/lib/helpers/progressEventReducer.js
1776
+ var progressEventReducer = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((listener, isDownloadStream, freq = 3) => {
1777
+ let bytesNotified = 0;
1778
+ const _speedometer = speedometer_default(50, 250);
1779
+ return throttle_default((e) => {
1780
+ const loaded = e.loaded;
1781
+ const total = e.lengthComputable ? e.total : void 0;
1782
+ const progressBytes = loaded - bytesNotified;
1783
+ const rate = _speedometer(progressBytes);
1784
+ const inRange = loaded <= total;
1785
+ bytesNotified = loaded;
1786
+ const data = {
1787
+ loaded,
1788
+ total,
1789
+ progress: total ? loaded / total : void 0,
1790
+ bytes: progressBytes,
1791
+ rate: rate ? rate : void 0,
1792
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1793
+ event: e,
1794
+ lengthComputable: total != null,
1795
+ [isDownloadStream ? "download" : "upload"]: true
1796
+ };
1797
+ listener(data);
1798
+ }, freq);
1799
+ }, "progressEventReducer");
1800
+ var progressEventDecorator = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((total, throttled) => {
1801
+ const lengthComputable = total != null;
1802
+ return [
1803
+ (loaded) => throttled[0]({
1804
+ lengthComputable,
1805
+ total,
1806
+ loaded
1807
+ }),
1808
+ throttled[1]
1809
+ ];
1810
+ }, "progressEventDecorator");
1811
+ var asyncDecorator = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((fn) => (...args) => utils_default.asap(() => fn(...args)), "asyncDecorator");
1812
+
1813
+ // node_modules/axios/lib/adapters/http.js
1814
+ var zlibOptions = {
1815
+ flush: zlib__default.default.constants.Z_SYNC_FLUSH,
1816
+ finishFlush: zlib__default.default.constants.Z_SYNC_FLUSH
1817
+ };
1818
+ var brotliOptions = {
1819
+ flush: zlib__default.default.constants.BROTLI_OPERATION_FLUSH,
1820
+ finishFlush: zlib__default.default.constants.BROTLI_OPERATION_FLUSH
1821
+ };
1822
+ var isBrotliSupported = utils_default.isFunction(zlib__default.default.createBrotliDecompress);
1823
+ var { http: httpFollow, https: httpsFollow } = followRedirects__default.default;
1824
+ var isHttps = /https:?/;
1825
+ var supportedProtocols = platform_default.protocols.map((protocol) => {
1826
+ return protocol + ":";
1827
+ });
1828
+ var flushOnFinish = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((stream4, [throttled, flush]) => {
1829
+ stream4.on("end", flush).on("error", flush);
1830
+ return throttled;
1831
+ }, "flushOnFinish");
1832
+ function dispatchBeforeRedirect(options, responseDetails) {
1833
+ if (options.beforeRedirects.proxy) {
1834
+ options.beforeRedirects.proxy(options);
1835
+ }
1836
+ if (options.beforeRedirects.config) {
1837
+ options.beforeRedirects.config(options, responseDetails);
1838
+ }
1839
+ }
1840
+ chunkXQKCXG4I_cjs.__name(dispatchBeforeRedirect, "dispatchBeforeRedirect");
1841
+ function setProxy(options, configProxy, location) {
1842
+ let proxy = configProxy;
1843
+ if (!proxy && proxy !== false) {
1844
+ const proxyUrl = proxyFromEnv__default.default.getProxyForUrl(location);
1845
+ if (proxyUrl) {
1846
+ proxy = new URL(proxyUrl);
1847
+ }
1848
+ }
1849
+ if (proxy) {
1850
+ if (proxy.username) {
1851
+ proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
1852
+ }
1853
+ if (proxy.auth) {
1854
+ if (proxy.auth.username || proxy.auth.password) {
1855
+ proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
1856
+ }
1857
+ const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
1858
+ options.headers["Proxy-Authorization"] = "Basic " + base64;
1859
+ }
1860
+ options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
1861
+ const proxyHost = proxy.hostname || proxy.host;
1862
+ options.hostname = proxyHost;
1863
+ options.host = proxyHost;
1864
+ options.port = proxy.port;
1865
+ options.path = location;
1866
+ if (proxy.protocol) {
1867
+ options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`;
1868
+ }
1869
+ }
1870
+ options.beforeRedirects.proxy = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function beforeRedirect(redirectOptions) {
1871
+ setProxy(redirectOptions, configProxy, redirectOptions.href);
1872
+ }, "beforeRedirect");
1873
+ }
1874
+ chunkXQKCXG4I_cjs.__name(setProxy, "setProxy");
1875
+ var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
1876
+ var wrapAsync = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((asyncExecutor) => {
1877
+ return new Promise((resolve, reject) => {
1878
+ let onDone;
1879
+ let isDone;
1880
+ const done = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((value, isRejected) => {
1881
+ if (isDone) return;
1882
+ isDone = true;
1883
+ onDone && onDone(value, isRejected);
1884
+ }, "done");
1885
+ const _resolve = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((value) => {
1886
+ done(value);
1887
+ resolve(value);
1888
+ }, "_resolve");
1889
+ const _reject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((reason) => {
1890
+ done(reason, true);
1891
+ reject(reason);
1892
+ }, "_reject");
1893
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
1894
+ });
1895
+ }, "wrapAsync");
1896
+ var resolveFamily = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(({ address, family }) => {
1897
+ if (!utils_default.isString(address)) {
1898
+ throw TypeError("address must be a string");
1899
+ }
1900
+ return {
1901
+ address,
1902
+ family: family || (address.indexOf(".") < 0 ? 6 : 4)
1903
+ };
1904
+ }, "resolveFamily");
1905
+ var buildAddressEntry = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((address, family) => resolveFamily(utils_default.isObject(address) ? address : {
1906
+ address,
1907
+ family
1908
+ }), "buildAddressEntry");
1909
+ var http_default = isHttpAdapterSupported && /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function httpAdapter(config) {
1910
+ return wrapAsync(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async function dispatchHttpRequest(resolve, reject, onDone) {
1911
+ let { data, lookup, family } = config;
1912
+ const { responseType, responseEncoding } = config;
1913
+ const method = config.method.toUpperCase();
1914
+ let isDone;
1915
+ let rejected = false;
1916
+ let req;
1917
+ if (lookup) {
1918
+ const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [
1919
+ value
1920
+ ]);
1921
+ lookup = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((hostname, opt, cb) => {
1922
+ _lookup(hostname, opt, (err, arg0, arg1) => {
1923
+ if (err) {
1924
+ return cb(err);
1925
+ }
1926
+ const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [
1927
+ buildAddressEntry(arg0, arg1)
1928
+ ];
1929
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
1930
+ });
1931
+ }, "lookup");
1932
+ }
1933
+ const emitter = new events.EventEmitter();
1934
+ const onFinished = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => {
1935
+ if (config.cancelToken) {
1936
+ config.cancelToken.unsubscribe(abort);
1937
+ }
1938
+ if (config.signal) {
1939
+ config.signal.removeEventListener("abort", abort);
1940
+ }
1941
+ emitter.removeAllListeners();
1942
+ }, "onFinished");
1943
+ onDone((value, isRejected) => {
1944
+ isDone = true;
1945
+ if (isRejected) {
1946
+ rejected = true;
1947
+ onFinished();
1948
+ }
1949
+ });
1950
+ function abort(reason) {
1951
+ emitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config, req) : reason);
1952
+ }
1953
+ chunkXQKCXG4I_cjs.__name(abort, "abort");
1954
+ emitter.once("abort", reject);
1955
+ if (config.cancelToken || config.signal) {
1956
+ config.cancelToken && config.cancelToken.subscribe(abort);
1957
+ if (config.signal) {
1958
+ config.signal.aborted ? abort() : config.signal.addEventListener("abort", abort);
1959
+ }
1960
+ }
1961
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
1962
+ const parsed = new URL(fullPath, platform_default.hasBrowserEnv ? platform_default.origin : void 0);
1963
+ const protocol = parsed.protocol || supportedProtocols[0];
1964
+ if (protocol === "data:") {
1965
+ let convertedData;
1966
+ if (method !== "GET") {
1967
+ return settle(resolve, reject, {
1968
+ status: 405,
1969
+ statusText: "method not allowed",
1970
+ headers: {},
1971
+ config
1972
+ });
1973
+ }
1974
+ try {
1975
+ convertedData = fromDataURI(config.url, responseType === "blob", {
1976
+ Blob: config.env && config.env.Blob
1977
+ });
1978
+ } catch (err) {
1979
+ throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config);
1980
+ }
1981
+ if (responseType === "text") {
1982
+ convertedData = convertedData.toString(responseEncoding);
1983
+ if (!responseEncoding || responseEncoding === "utf8") {
1984
+ convertedData = utils_default.stripBOM(convertedData);
1985
+ }
1986
+ } else if (responseType === "stream") {
1987
+ convertedData = stream3__default.default.Readable.from(convertedData);
1988
+ }
1989
+ return settle(resolve, reject, {
1990
+ data: convertedData,
1991
+ status: 200,
1992
+ statusText: "OK",
1993
+ headers: new AxiosHeaders_default(),
1994
+ config
1995
+ });
1996
+ }
1997
+ if (supportedProtocols.indexOf(protocol) === -1) {
1998
+ return reject(new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_BAD_REQUEST, config));
1999
+ }
2000
+ const headers = AxiosHeaders_default.from(config.headers).normalize();
2001
+ headers.set("User-Agent", "axios/" + VERSION, false);
2002
+ const { onUploadProgress, onDownloadProgress } = config;
2003
+ const maxRate = config.maxRate;
2004
+ let maxUploadRate = void 0;
2005
+ let maxDownloadRate = void 0;
2006
+ if (utils_default.isSpecCompliantForm(data)) {
2007
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
2008
+ data = formDataToStream_default(data, (formHeaders) => {
2009
+ headers.set(formHeaders);
2010
+ }, {
2011
+ tag: `axios-${VERSION}-boundary`,
2012
+ boundary: userBoundary && userBoundary[1] || void 0
2013
+ });
2014
+ } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders)) {
2015
+ headers.set(data.getHeaders());
2016
+ if (!headers.hasContentLength()) {
2017
+ try {
2018
+ const knownLength = await util__default.default.promisify(data.getLength).call(data);
2019
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
2020
+ } catch (e) {
2021
+ }
2022
+ }
2023
+ } else if (utils_default.isBlob(data) || utils_default.isFile(data)) {
2024
+ data.size && headers.setContentType(data.type || "application/octet-stream");
2025
+ headers.setContentLength(data.size || 0);
2026
+ data = stream3__default.default.Readable.from(readBlob_default(data));
2027
+ } else if (data && !utils_default.isStream(data)) {
2028
+ if (Buffer.isBuffer(data)) ; else if (utils_default.isArrayBuffer(data)) {
2029
+ data = Buffer.from(new Uint8Array(data));
2030
+ } else if (utils_default.isString(data)) {
2031
+ data = Buffer.from(data, "utf-8");
2032
+ } else {
2033
+ return reject(new AxiosError_default("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", AxiosError_default.ERR_BAD_REQUEST, config));
2034
+ }
2035
+ headers.setContentLength(data.length, false);
2036
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
2037
+ return reject(new AxiosError_default("Request body larger than maxBodyLength limit", AxiosError_default.ERR_BAD_REQUEST, config));
2038
+ }
2039
+ }
2040
+ const contentLength = utils_default.toFiniteNumber(headers.getContentLength());
2041
+ if (utils_default.isArray(maxRate)) {
2042
+ maxUploadRate = maxRate[0];
2043
+ maxDownloadRate = maxRate[1];
2044
+ } else {
2045
+ maxUploadRate = maxDownloadRate = maxRate;
2046
+ }
2047
+ if (data && (onUploadProgress || maxUploadRate)) {
2048
+ if (!utils_default.isStream(data)) {
2049
+ data = stream3__default.default.Readable.from(data, {
2050
+ objectMode: false
2051
+ });
2052
+ }
2053
+ data = stream3__default.default.pipeline([
2054
+ data,
2055
+ new AxiosTransformStream_default({
2056
+ maxRate: utils_default.toFiniteNumber(maxUploadRate)
2057
+ })
2058
+ ], utils_default.noop);
2059
+ onUploadProgress && data.on("progress", flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
2060
+ }
2061
+ let auth = void 0;
2062
+ if (config.auth) {
2063
+ const username = config.auth.username || "";
2064
+ const password = config.auth.password || "";
2065
+ auth = username + ":" + password;
2066
+ }
2067
+ if (!auth && parsed.username) {
2068
+ const urlUsername = parsed.username;
2069
+ const urlPassword = parsed.password;
2070
+ auth = urlUsername + ":" + urlPassword;
2071
+ }
2072
+ auth && headers.delete("authorization");
2073
+ let path;
2074
+ try {
2075
+ path = buildURL(parsed.pathname + parsed.search, config.params, config.paramsSerializer).replace(/^\?/, "");
2076
+ } catch (err) {
2077
+ const customErr = new Error(err.message);
2078
+ customErr.config = config;
2079
+ customErr.url = config.url;
2080
+ customErr.exists = true;
2081
+ return reject(customErr);
2082
+ }
2083
+ headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
2084
+ const options = {
2085
+ path,
2086
+ method,
2087
+ headers: headers.toJSON(),
2088
+ agents: {
2089
+ http: config.httpAgent,
2090
+ https: config.httpsAgent
2091
+ },
2092
+ auth,
2093
+ protocol,
2094
+ family,
2095
+ beforeRedirect: dispatchBeforeRedirect,
2096
+ beforeRedirects: {}
2097
+ };
2098
+ !utils_default.isUndefined(lookup) && (options.lookup = lookup);
2099
+ if (config.socketPath) {
2100
+ options.socketPath = config.socketPath;
2101
+ } else {
2102
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
2103
+ options.port = parsed.port;
2104
+ setProxy(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
2105
+ }
2106
+ let transport;
2107
+ const isHttpsRequest = isHttps.test(options.protocol);
2108
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
2109
+ if (config.transport) {
2110
+ transport = config.transport;
2111
+ } else if (config.maxRedirects === 0) {
2112
+ transport = isHttpsRequest ? https__default.default : http__default.default;
2113
+ } else {
2114
+ if (config.maxRedirects) {
2115
+ options.maxRedirects = config.maxRedirects;
2116
+ }
2117
+ if (config.beforeRedirect) {
2118
+ options.beforeRedirects.config = config.beforeRedirect;
2119
+ }
2120
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
2121
+ }
2122
+ if (config.maxBodyLength > -1) {
2123
+ options.maxBodyLength = config.maxBodyLength;
2124
+ } else {
2125
+ options.maxBodyLength = Infinity;
2126
+ }
2127
+ if (config.insecureHTTPParser) {
2128
+ options.insecureHTTPParser = config.insecureHTTPParser;
2129
+ }
2130
+ req = transport.request(options, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleResponse(res) {
2131
+ if (req.destroyed) return;
2132
+ const streams = [
2133
+ res
2134
+ ];
2135
+ const responseLength = +res.headers["content-length"];
2136
+ if (onDownloadProgress || maxDownloadRate) {
2137
+ const transformStream = new AxiosTransformStream_default({
2138
+ maxRate: utils_default.toFiniteNumber(maxDownloadRate)
2139
+ });
2140
+ onDownloadProgress && transformStream.on("progress", flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
2141
+ streams.push(transformStream);
2142
+ }
2143
+ let responseStream = res;
2144
+ const lastRequest = res.req || req;
2145
+ if (config.decompress !== false && res.headers["content-encoding"]) {
2146
+ if (method === "HEAD" || res.statusCode === 204) {
2147
+ delete res.headers["content-encoding"];
2148
+ }
2149
+ switch ((res.headers["content-encoding"] || "").toLowerCase()) {
2150
+ /*eslint default-case:0*/
2151
+ case "gzip":
2152
+ case "x-gzip":
2153
+ case "compress":
2154
+ case "x-compress":
2155
+ streams.push(zlib__default.default.createUnzip(zlibOptions));
2156
+ delete res.headers["content-encoding"];
2157
+ break;
2158
+ case "deflate":
2159
+ streams.push(new ZlibHeaderTransformStream_default());
2160
+ streams.push(zlib__default.default.createUnzip(zlibOptions));
2161
+ delete res.headers["content-encoding"];
2162
+ break;
2163
+ case "br":
2164
+ if (isBrotliSupported) {
2165
+ streams.push(zlib__default.default.createBrotliDecompress(brotliOptions));
2166
+ delete res.headers["content-encoding"];
2167
+ }
2168
+ }
2169
+ }
2170
+ responseStream = streams.length > 1 ? stream3__default.default.pipeline(streams, utils_default.noop) : streams[0];
2171
+ const offListeners = stream3__default.default.finished(responseStream, () => {
2172
+ offListeners();
2173
+ onFinished();
2174
+ });
2175
+ const response = {
2176
+ status: res.statusCode,
2177
+ statusText: res.statusMessage,
2178
+ headers: new AxiosHeaders_default(res.headers),
2179
+ config,
2180
+ request: lastRequest
2181
+ };
2182
+ if (responseType === "stream") {
2183
+ response.data = responseStream;
2184
+ settle(resolve, reject, response);
2185
+ } else {
2186
+ const responseBuffer = [];
2187
+ let totalResponseBytes = 0;
2188
+ responseStream.on("data", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleStreamData(chunk) {
2189
+ responseBuffer.push(chunk);
2190
+ totalResponseBytes += chunk.length;
2191
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
2192
+ rejected = true;
2193
+ responseStream.destroy();
2194
+ reject(new AxiosError_default("maxContentLength size of " + config.maxContentLength + " exceeded", AxiosError_default.ERR_BAD_RESPONSE, config, lastRequest));
2195
+ }
2196
+ }, "handleStreamData"));
2197
+ responseStream.on("aborted", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handlerStreamAborted() {
2198
+ if (rejected) {
2199
+ return;
2200
+ }
2201
+ const err = new AxiosError_default("stream has been aborted", AxiosError_default.ERR_BAD_RESPONSE, config, lastRequest);
2202
+ responseStream.destroy(err);
2203
+ reject(err);
2204
+ }, "handlerStreamAborted"));
2205
+ responseStream.on("error", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleStreamError(err) {
2206
+ if (req.destroyed) return;
2207
+ reject(AxiosError_default.from(err, null, config, lastRequest));
2208
+ }, "handleStreamError"));
2209
+ responseStream.on("end", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleStreamEnd() {
2210
+ try {
2211
+ let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
2212
+ if (responseType !== "arraybuffer") {
2213
+ responseData = responseData.toString(responseEncoding);
2214
+ if (!responseEncoding || responseEncoding === "utf8") {
2215
+ responseData = utils_default.stripBOM(responseData);
2216
+ }
2217
+ }
2218
+ response.data = responseData;
2219
+ } catch (err) {
2220
+ return reject(AxiosError_default.from(err, null, config, response.request, response));
2221
+ }
2222
+ settle(resolve, reject, response);
2223
+ }, "handleStreamEnd"));
2224
+ }
2225
+ emitter.once("abort", (err) => {
2226
+ if (!responseStream.destroyed) {
2227
+ responseStream.emit("error", err);
2228
+ responseStream.destroy();
2229
+ }
2230
+ });
2231
+ }, "handleResponse"));
2232
+ emitter.once("abort", (err) => {
2233
+ reject(err);
2234
+ req.destroy(err);
2235
+ });
2236
+ req.on("error", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleRequestError(err) {
2237
+ reject(AxiosError_default.from(err, null, config, req));
2238
+ }, "handleRequestError"));
2239
+ req.on("socket", /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleRequestSocket(socket) {
2240
+ socket.setKeepAlive(true, 1e3 * 60);
2241
+ }, "handleRequestSocket"));
2242
+ if (config.timeout) {
2243
+ const timeout = parseInt(config.timeout, 10);
2244
+ if (Number.isNaN(timeout)) {
2245
+ reject(new AxiosError_default("error trying to parse `config.timeout` to int", AxiosError_default.ERR_BAD_OPTION_VALUE, config, req));
2246
+ return;
2247
+ }
2248
+ req.setTimeout(timeout, /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleRequestTimeout() {
2249
+ if (isDone) return;
2250
+ let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
2251
+ const transitional2 = config.transitional || transitional_default;
2252
+ if (config.timeoutErrorMessage) {
2253
+ timeoutErrorMessage = config.timeoutErrorMessage;
2254
+ }
2255
+ reject(new AxiosError_default(timeoutErrorMessage, transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED, config, req));
2256
+ abort();
2257
+ }, "handleRequestTimeout"));
2258
+ }
2259
+ if (utils_default.isStream(data)) {
2260
+ let ended = false;
2261
+ let errored = false;
2262
+ data.on("end", () => {
2263
+ ended = true;
2264
+ });
2265
+ data.once("error", (err) => {
2266
+ errored = true;
2267
+ req.destroy(err);
2268
+ });
2269
+ data.on("close", () => {
2270
+ if (!ended && !errored) {
2271
+ abort(new CanceledError_default("Request stream has been aborted", config, req));
2272
+ }
2273
+ });
2274
+ data.pipe(req);
2275
+ } else {
2276
+ req.end(data);
2277
+ }
2278
+ }, "dispatchHttpRequest"));
2279
+ }, "httpAdapter");
2280
+
2281
+ // node_modules/axios/lib/helpers/isURLSameOrigin.js
2282
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
2283
+ url2 = new URL(url2, platform_default.origin);
2284
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
2285
+ })(new URL(platform_default.origin), platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)) : () => true;
2286
+
2287
+ // node_modules/axios/lib/helpers/cookies.js
2288
+ var cookies_default = platform_default.hasStandardBrowserEnv ? (
2289
+ // Standard browser envs support document.cookie
2290
+ {
2291
+ write(name, value, expires, path, domain, secure) {
2292
+ const cookie = [
2293
+ name + "=" + encodeURIComponent(value)
2294
+ ];
2295
+ utils_default.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
2296
+ utils_default.isString(path) && cookie.push("path=" + path);
2297
+ utils_default.isString(domain) && cookie.push("domain=" + domain);
2298
+ secure === true && cookie.push("secure");
2299
+ document.cookie = cookie.join("; ");
2300
+ },
2301
+ read(name) {
2302
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
2303
+ return match ? decodeURIComponent(match[3]) : null;
2304
+ },
2305
+ remove(name) {
2306
+ this.write(name, "", Date.now() - 864e5);
2307
+ }
2308
+ }
2309
+ ) : (
2310
+ // Non-standard browser env (web workers, react-native) lack needed support.
2311
+ {
2312
+ write() {
2313
+ },
2314
+ read() {
2315
+ return null;
2316
+ },
2317
+ remove() {
2318
+ }
2319
+ }
2320
+ );
2321
+
2322
+ // node_modules/axios/lib/core/mergeConfig.js
2323
+ var headersToObject = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((thing) => thing instanceof AxiosHeaders_default ? {
2324
+ ...thing
2325
+ } : thing, "headersToObject");
2326
+ function mergeConfig(config1, config2) {
2327
+ config2 = config2 || {};
2328
+ const config = {};
2329
+ function getMergedValue(target, source, prop, caseless) {
2330
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
2331
+ return utils_default.merge.call({
2332
+ caseless
2333
+ }, target, source);
2334
+ } else if (utils_default.isPlainObject(source)) {
2335
+ return utils_default.merge({}, source);
2336
+ } else if (utils_default.isArray(source)) {
2337
+ return source.slice();
2338
+ }
2339
+ return source;
2340
+ }
2341
+ chunkXQKCXG4I_cjs.__name(getMergedValue, "getMergedValue");
2342
+ function mergeDeepProperties(a, b, prop, caseless) {
2343
+ if (!utils_default.isUndefined(b)) {
2344
+ return getMergedValue(a, b, prop, caseless);
2345
+ } else if (!utils_default.isUndefined(a)) {
2346
+ return getMergedValue(void 0, a, prop, caseless);
2347
+ }
2348
+ }
2349
+ chunkXQKCXG4I_cjs.__name(mergeDeepProperties, "mergeDeepProperties");
2350
+ function valueFromConfig2(a, b) {
2351
+ if (!utils_default.isUndefined(b)) {
2352
+ return getMergedValue(void 0, b);
2353
+ }
2354
+ }
2355
+ chunkXQKCXG4I_cjs.__name(valueFromConfig2, "valueFromConfig2");
2356
+ function defaultToConfig2(a, b) {
2357
+ if (!utils_default.isUndefined(b)) {
2358
+ return getMergedValue(void 0, b);
2359
+ } else if (!utils_default.isUndefined(a)) {
2360
+ return getMergedValue(void 0, a);
2361
+ }
2362
+ }
2363
+ chunkXQKCXG4I_cjs.__name(defaultToConfig2, "defaultToConfig2");
2364
+ function mergeDirectKeys(a, b, prop) {
2365
+ if (prop in config2) {
2366
+ return getMergedValue(a, b);
2367
+ } else if (prop in config1) {
2368
+ return getMergedValue(void 0, a);
2369
+ }
2370
+ }
2371
+ chunkXQKCXG4I_cjs.__name(mergeDirectKeys, "mergeDirectKeys");
2372
+ const mergeMap = {
2373
+ url: valueFromConfig2,
2374
+ method: valueFromConfig2,
2375
+ data: valueFromConfig2,
2376
+ baseURL: defaultToConfig2,
2377
+ transformRequest: defaultToConfig2,
2378
+ transformResponse: defaultToConfig2,
2379
+ paramsSerializer: defaultToConfig2,
2380
+ timeout: defaultToConfig2,
2381
+ timeoutMessage: defaultToConfig2,
2382
+ withCredentials: defaultToConfig2,
2383
+ withXSRFToken: defaultToConfig2,
2384
+ adapter: defaultToConfig2,
2385
+ responseType: defaultToConfig2,
2386
+ xsrfCookieName: defaultToConfig2,
2387
+ xsrfHeaderName: defaultToConfig2,
2388
+ onUploadProgress: defaultToConfig2,
2389
+ onDownloadProgress: defaultToConfig2,
2390
+ decompress: defaultToConfig2,
2391
+ maxContentLength: defaultToConfig2,
2392
+ maxBodyLength: defaultToConfig2,
2393
+ beforeRedirect: defaultToConfig2,
2394
+ transport: defaultToConfig2,
2395
+ httpAgent: defaultToConfig2,
2396
+ httpsAgent: defaultToConfig2,
2397
+ cancelToken: defaultToConfig2,
2398
+ socketPath: defaultToConfig2,
2399
+ responseEncoding: defaultToConfig2,
2400
+ validateStatus: mergeDirectKeys,
2401
+ headers: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true), "headers")
2402
+ };
2403
+ utils_default.forEach(Object.keys({
2404
+ ...config1,
2405
+ ...config2
2406
+ }), /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function computeConfigValue(prop) {
2407
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
2408
+ const configValue = merge2(config1[prop], config2[prop], prop);
2409
+ utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2410
+ }, "computeConfigValue"));
2411
+ return config;
2412
+ }
2413
+ chunkXQKCXG4I_cjs.__name(mergeConfig, "mergeConfig");
2414
+
2415
+ // node_modules/axios/lib/helpers/resolveConfig.js
2416
+ var resolveConfig_default = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((config) => {
2417
+ const newConfig = mergeConfig({}, config);
2418
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2419
+ newConfig.headers = headers = AxiosHeaders_default.from(headers);
2420
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2421
+ if (auth) {
2422
+ headers.set("Authorization", "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")));
2423
+ }
2424
+ let contentType;
2425
+ if (utils_default.isFormData(data)) {
2426
+ if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
2427
+ headers.setContentType(void 0);
2428
+ } else if ((contentType = headers.getContentType()) !== false) {
2429
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
2430
+ headers.setContentType([
2431
+ type || "multipart/form-data",
2432
+ ...tokens
2433
+ ].join("; "));
2434
+ }
2435
+ }
2436
+ if (platform_default.hasStandardBrowserEnv) {
2437
+ withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2438
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(newConfig.url)) {
2439
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
2440
+ if (xsrfValue) {
2441
+ headers.set(xsrfHeaderName, xsrfValue);
2442
+ }
2443
+ }
2444
+ }
2445
+ return newConfig;
2446
+ }, "default");
2447
+
2448
+ // node_modules/axios/lib/adapters/xhr.js
2449
+ var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
2450
+ var xhr_default = isXHRAdapterSupported && function(config) {
2451
+ return new Promise(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function dispatchXhrRequest(resolve, reject) {
2452
+ const _config = resolveConfig_default(config);
2453
+ let requestData = _config.data;
2454
+ const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
2455
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
2456
+ let onCanceled;
2457
+ let uploadThrottled, downloadThrottled;
2458
+ let flushUpload, flushDownload;
2459
+ function done() {
2460
+ flushUpload && flushUpload();
2461
+ flushDownload && flushDownload();
2462
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2463
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
2464
+ }
2465
+ chunkXQKCXG4I_cjs.__name(done, "done");
2466
+ let request = new XMLHttpRequest();
2467
+ request.open(_config.method.toUpperCase(), _config.url, true);
2468
+ request.timeout = _config.timeout;
2469
+ function onloadend() {
2470
+ if (!request) {
2471
+ return;
2472
+ }
2473
+ const responseHeaders = AxiosHeaders_default.from("getAllResponseHeaders" in request && request.getAllResponseHeaders());
2474
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
2475
+ const response = {
2476
+ data: responseData,
2477
+ status: request.status,
2478
+ statusText: request.statusText,
2479
+ headers: responseHeaders,
2480
+ config,
2481
+ request
2482
+ };
2483
+ settle(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function _resolve(value) {
2484
+ resolve(value);
2485
+ done();
2486
+ }, "_resolve"), /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function _reject(err) {
2487
+ reject(err);
2488
+ done();
2489
+ }, "_reject"), response);
2490
+ request = null;
2491
+ }
2492
+ chunkXQKCXG4I_cjs.__name(onloadend, "onloadend");
2493
+ if ("onloadend" in request) {
2494
+ request.onloadend = onloadend;
2495
+ } else {
2496
+ request.onreadystatechange = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleLoad() {
2497
+ if (!request || request.readyState !== 4) {
2498
+ return;
2499
+ }
2500
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
2501
+ return;
2502
+ }
2503
+ setTimeout(onloadend);
2504
+ }, "handleLoad");
2505
+ }
2506
+ request.onabort = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleAbort() {
2507
+ if (!request) {
2508
+ return;
2509
+ }
2510
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
2511
+ request = null;
2512
+ }, "handleAbort");
2513
+ request.onerror = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleError() {
2514
+ reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request));
2515
+ request = null;
2516
+ }, "handleError");
2517
+ request.ontimeout = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function handleTimeout() {
2518
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
2519
+ const transitional2 = _config.transitional || transitional_default;
2520
+ if (_config.timeoutErrorMessage) {
2521
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2522
+ }
2523
+ reject(new AxiosError_default(timeoutErrorMessage, transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED, config, request));
2524
+ request = null;
2525
+ }, "handleTimeout");
2526
+ requestData === void 0 && requestHeaders.setContentType(null);
2527
+ if ("setRequestHeader" in request) {
2528
+ utils_default.forEach(requestHeaders.toJSON(), /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function setRequestHeader(val, key) {
2529
+ request.setRequestHeader(key, val);
2530
+ }, "setRequestHeader"));
2531
+ }
2532
+ if (!utils_default.isUndefined(_config.withCredentials)) {
2533
+ request.withCredentials = !!_config.withCredentials;
2534
+ }
2535
+ if (responseType && responseType !== "json") {
2536
+ request.responseType = _config.responseType;
2537
+ }
2538
+ if (onDownloadProgress) {
2539
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
2540
+ request.addEventListener("progress", downloadThrottled);
2541
+ }
2542
+ if (onUploadProgress && request.upload) {
2543
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
2544
+ request.upload.addEventListener("progress", uploadThrottled);
2545
+ request.upload.addEventListener("loadend", flushUpload);
2546
+ }
2547
+ if (_config.cancelToken || _config.signal) {
2548
+ onCanceled = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((cancel) => {
2549
+ if (!request) {
2550
+ return;
2551
+ }
2552
+ reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
2553
+ request.abort();
2554
+ request = null;
2555
+ }, "onCanceled");
2556
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2557
+ if (_config.signal) {
2558
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
2559
+ }
2560
+ }
2561
+ const protocol = parseProtocol(_config.url);
2562
+ if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
2563
+ reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config));
2564
+ return;
2565
+ }
2566
+ request.send(requestData || null);
2567
+ }, "dispatchXhrRequest"));
2568
+ };
2569
+
2570
+ // node_modules/axios/lib/helpers/composeSignals.js
2571
+ var composeSignals = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((signals, timeout) => {
2572
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
2573
+ if (timeout || length) {
2574
+ let controller = new AbortController();
2575
+ let aborted;
2576
+ const onabort = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function(reason) {
2577
+ if (!aborted) {
2578
+ aborted = true;
2579
+ unsubscribe();
2580
+ const err = reason instanceof Error ? reason : this.reason;
2581
+ controller.abort(err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err));
2582
+ }
2583
+ }, "onabort");
2584
+ let timer = timeout && setTimeout(() => {
2585
+ timer = null;
2586
+ onabort(new AxiosError_default(`timeout ${timeout} of ms exceeded`, AxiosError_default.ETIMEDOUT));
2587
+ }, timeout);
2588
+ const unsubscribe = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => {
2589
+ if (signals) {
2590
+ timer && clearTimeout(timer);
2591
+ timer = null;
2592
+ signals.forEach((signal2) => {
2593
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
2594
+ });
2595
+ signals = null;
2596
+ }
2597
+ }, "unsubscribe");
2598
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
2599
+ const { signal } = controller;
2600
+ signal.unsubscribe = () => utils_default.asap(unsubscribe);
2601
+ return signal;
2602
+ }
2603
+ }, "composeSignals");
2604
+ var composeSignals_default = composeSignals;
2605
+
2606
+ // node_modules/axios/lib/helpers/trackStream.js
2607
+ var streamChunk = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function* (chunk, chunkSize) {
2608
+ let len = chunk.byteLength;
2609
+ if (!chunkSize || len < chunkSize) {
2610
+ yield chunk;
2611
+ return;
2612
+ }
2613
+ let pos = 0;
2614
+ let end;
2615
+ while (pos < len) {
2616
+ end = pos + chunkSize;
2617
+ yield chunk.slice(pos, end);
2618
+ pos = end;
2619
+ }
2620
+ }, "streamChunk");
2621
+ var readBytes = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async function* (iterable, chunkSize) {
2622
+ for await (const chunk of readStream(iterable)) {
2623
+ yield* streamChunk(chunk, chunkSize);
2624
+ }
2625
+ }, "readBytes");
2626
+ var readStream = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async function* (stream4) {
2627
+ if (stream4[Symbol.asyncIterator]) {
2628
+ yield* stream4;
2629
+ return;
2630
+ }
2631
+ const reader = stream4.getReader();
2632
+ try {
2633
+ for (; ; ) {
2634
+ const { done, value } = await reader.read();
2635
+ if (done) {
2636
+ break;
2637
+ }
2638
+ yield value;
2639
+ }
2640
+ } finally {
2641
+ await reader.cancel();
2642
+ }
2643
+ }, "readStream");
2644
+ var trackStream = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((stream4, chunkSize, onProgress, onFinish) => {
2645
+ const iterator2 = readBytes(stream4, chunkSize);
2646
+ let bytes = 0;
2647
+ let done;
2648
+ let _onFinish = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((e) => {
2649
+ if (!done) {
2650
+ done = true;
2651
+ onFinish && onFinish(e);
2652
+ }
2653
+ }, "_onFinish");
2654
+ return new ReadableStream({
2655
+ async pull(controller) {
2656
+ try {
2657
+ const { done: done2, value } = await iterator2.next();
2658
+ if (done2) {
2659
+ _onFinish();
2660
+ controller.close();
2661
+ return;
2662
+ }
2663
+ let len = value.byteLength;
2664
+ if (onProgress) {
2665
+ let loadedBytes = bytes += len;
2666
+ onProgress(loadedBytes);
2667
+ }
2668
+ controller.enqueue(new Uint8Array(value));
2669
+ } catch (err) {
2670
+ _onFinish(err);
2671
+ throw err;
2672
+ }
2673
+ },
2674
+ cancel(reason) {
2675
+ _onFinish(reason);
2676
+ return iterator2.return();
2677
+ }
2678
+ }, {
2679
+ highWaterMark: 2
2680
+ });
2681
+ }, "trackStream");
2682
+
2683
+ // node_modules/axios/lib/adapters/fetch.js
2684
+ var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
2685
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
2686
+ var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
2687
+ var test = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((fn, ...args) => {
2688
+ try {
2689
+ return !!fn(...args);
2690
+ } catch (e) {
2691
+ return false;
2692
+ }
2693
+ }, "test");
2694
+ var supportsRequestStream = isReadableStreamSupported && test(() => {
2695
+ let duplexAccessed = false;
2696
+ const hasContentType = new Request(platform_default.origin, {
2697
+ body: new ReadableStream(),
2698
+ method: "POST",
2699
+ get duplex() {
2700
+ duplexAccessed = true;
2701
+ return "half";
2702
+ }
2703
+ }).headers.has("Content-Type");
2704
+ return duplexAccessed && !hasContentType;
2705
+ });
2706
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
2707
+ var supportsResponseStream = isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
2708
+ var resolvers = {
2709
+ stream: supportsResponseStream && ((res) => res.body)
2710
+ };
2711
+ isFetchSupported && ((res) => {
2712
+ [
2713
+ "text",
2714
+ "arrayBuffer",
2715
+ "blob",
2716
+ "formData",
2717
+ "stream"
2718
+ ].forEach((type) => {
2719
+ !resolvers[type] && (resolvers[type] = utils_default.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
2720
+ throw new AxiosError_default(`Response type '${type}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
2721
+ });
2722
+ });
2723
+ })(new Response());
2724
+ var getBodyLength = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async (body) => {
2725
+ if (body == null) {
2726
+ return 0;
2727
+ }
2728
+ if (utils_default.isBlob(body)) {
2729
+ return body.size;
2730
+ }
2731
+ if (utils_default.isSpecCompliantForm(body)) {
2732
+ const _request = new Request(platform_default.origin, {
2733
+ method: "POST",
2734
+ body
2735
+ });
2736
+ return (await _request.arrayBuffer()).byteLength;
2737
+ }
2738
+ if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
2739
+ return body.byteLength;
2740
+ }
2741
+ if (utils_default.isURLSearchParams(body)) {
2742
+ body = body + "";
2743
+ }
2744
+ if (utils_default.isString(body)) {
2745
+ return (await encodeText(body)).byteLength;
2746
+ }
2747
+ }, "getBodyLength");
2748
+ var resolveBodyLength = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(async (headers, body) => {
2749
+ const length = utils_default.toFiniteNumber(headers.getContentLength());
2750
+ return length == null ? getBodyLength(body) : length;
2751
+ }, "resolveBodyLength");
2752
+ var fetch_default = isFetchSupported && (async (config) => {
2753
+ let { url: url2, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, withCredentials = "same-origin", fetchOptions } = resolveConfig_default(config);
2754
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
2755
+ let composedSignal = composeSignals_default([
2756
+ signal,
2757
+ cancelToken && cancelToken.toAbortSignal()
2758
+ ], timeout);
2759
+ let request;
2760
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2761
+ composedSignal.unsubscribe();
2762
+ });
2763
+ let requestContentLength;
2764
+ try {
2765
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
2766
+ let _request = new Request(url2, {
2767
+ method: "POST",
2768
+ body: data,
2769
+ duplex: "half"
2770
+ });
2771
+ let contentTypeHeader;
2772
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2773
+ headers.setContentType(contentTypeHeader);
2774
+ }
2775
+ if (_request.body) {
2776
+ const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
2777
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2778
+ }
2779
+ }
2780
+ if (!utils_default.isString(withCredentials)) {
2781
+ withCredentials = withCredentials ? "include" : "omit";
2782
+ }
2783
+ const isCredentialsSupported = "credentials" in Request.prototype;
2784
+ request = new Request(url2, {
2785
+ ...fetchOptions,
2786
+ signal: composedSignal,
2787
+ method: method.toUpperCase(),
2788
+ headers: headers.normalize().toJSON(),
2789
+ body: data,
2790
+ duplex: "half",
2791
+ credentials: isCredentialsSupported ? withCredentials : void 0
2792
+ });
2793
+ let response = await fetch(request, fetchOptions);
2794
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2795
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2796
+ const options = {};
2797
+ [
2798
+ "status",
2799
+ "statusText",
2800
+ "headers"
2801
+ ].forEach((prop) => {
2802
+ options[prop] = response[prop];
2803
+ });
2804
+ const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
2805
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
2806
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2807
+ flush && flush();
2808
+ unsubscribe && unsubscribe();
2809
+ }), options);
2810
+ }
2811
+ responseType = responseType || "text";
2812
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
2813
+ !isStreamResponse && unsubscribe && unsubscribe();
2814
+ return await new Promise((resolve, reject) => {
2815
+ settle(resolve, reject, {
2816
+ data: responseData,
2817
+ headers: AxiosHeaders_default.from(response.headers),
2818
+ status: response.status,
2819
+ statusText: response.statusText,
2820
+ config,
2821
+ request
2822
+ });
2823
+ });
2824
+ } catch (err) {
2825
+ unsubscribe && unsubscribe();
2826
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2827
+ throw Object.assign(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request), {
2828
+ cause: err.cause || err
2829
+ });
2830
+ }
2831
+ throw AxiosError_default.from(err, err && err.code, config, request);
2832
+ }
2833
+ });
2834
+
2835
+ // node_modules/axios/lib/adapters/adapters.js
2836
+ var knownAdapters = {
2837
+ http: http_default,
2838
+ xhr: xhr_default,
2839
+ fetch: fetch_default
2840
+ };
2841
+ utils_default.forEach(knownAdapters, (fn, value) => {
2842
+ if (fn) {
2843
+ try {
2844
+ Object.defineProperty(fn, "name", {
2845
+ value
2846
+ });
2847
+ } catch (e) {
2848
+ }
2849
+ Object.defineProperty(fn, "adapterName", {
2850
+ value
2851
+ });
2852
+ }
2853
+ });
2854
+ var renderReason = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((reason) => `- ${reason}`, "renderReason");
2855
+ var isResolvedHandle = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false, "isResolvedHandle");
2856
+ var adapters_default = {
2857
+ getAdapter: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((adapters) => {
2858
+ adapters = utils_default.isArray(adapters) ? adapters : [
2859
+ adapters
2860
+ ];
2861
+ const { length } = adapters;
2862
+ let nameOrAdapter;
2863
+ let adapter;
2864
+ const rejectedReasons = {};
2865
+ for (let i = 0; i < length; i++) {
2866
+ nameOrAdapter = adapters[i];
2867
+ let id;
2868
+ adapter = nameOrAdapter;
2869
+ if (!isResolvedHandle(nameOrAdapter)) {
2870
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2871
+ if (adapter === void 0) {
2872
+ throw new AxiosError_default(`Unknown adapter '${id}'`);
2873
+ }
2874
+ }
2875
+ if (adapter) {
2876
+ break;
2877
+ }
2878
+ rejectedReasons[id || "#" + i] = adapter;
2879
+ }
2880
+ if (!adapter) {
2881
+ const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
2882
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
2883
+ throw new AxiosError_default(`There is no suitable adapter to dispatch the request ` + s, "ERR_NOT_SUPPORT");
2884
+ }
2885
+ return adapter;
2886
+ }, "getAdapter"),
2887
+ adapters: knownAdapters
2888
+ };
2889
+
2890
+ // node_modules/axios/lib/core/dispatchRequest.js
2891
+ function throwIfCancellationRequested(config) {
2892
+ if (config.cancelToken) {
2893
+ config.cancelToken.throwIfRequested();
2894
+ }
2895
+ if (config.signal && config.signal.aborted) {
2896
+ throw new CanceledError_default(null, config);
2897
+ }
2898
+ }
2899
+ chunkXQKCXG4I_cjs.__name(throwIfCancellationRequested, "throwIfCancellationRequested");
2900
+ function dispatchRequest(config) {
2901
+ throwIfCancellationRequested(config);
2902
+ config.headers = AxiosHeaders_default.from(config.headers);
2903
+ config.data = transformData.call(config, config.transformRequest);
2904
+ if ([
2905
+ "post",
2906
+ "put",
2907
+ "patch"
2908
+ ].indexOf(config.method) !== -1) {
2909
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
2910
+ }
2911
+ const adapter = adapters_default.getAdapter(config.adapter || defaults_default.adapter);
2912
+ return adapter(config).then(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function onAdapterResolution(response) {
2913
+ throwIfCancellationRequested(config);
2914
+ response.data = transformData.call(config, config.transformResponse, response);
2915
+ response.headers = AxiosHeaders_default.from(response.headers);
2916
+ return response;
2917
+ }, "onAdapterResolution"), /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function onAdapterRejection(reason) {
2918
+ if (!isCancel(reason)) {
2919
+ throwIfCancellationRequested(config);
2920
+ if (reason && reason.response) {
2921
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
2922
+ reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
2923
+ }
2924
+ }
2925
+ return Promise.reject(reason);
2926
+ }, "onAdapterRejection"));
2927
+ }
2928
+ chunkXQKCXG4I_cjs.__name(dispatchRequest, "dispatchRequest");
2929
+
2930
+ // node_modules/axios/lib/helpers/validator.js
2931
+ var validators = {};
2932
+ [
2933
+ "object",
2934
+ "boolean",
2935
+ "number",
2936
+ "function",
2937
+ "string",
2938
+ "symbol"
2939
+ ].forEach((type, i) => {
2940
+ validators[type] = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function validator(thing) {
2941
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
2942
+ }, "validator");
2943
+ });
2944
+ var deprecatedWarnings = {};
2945
+ validators.transitional = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function transitional(validator, version, message) {
2946
+ function formatMessage(opt, desc) {
2947
+ return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
2948
+ }
2949
+ chunkXQKCXG4I_cjs.__name(formatMessage, "formatMessage");
2950
+ return (value, opt, opts) => {
2951
+ if (validator === false) {
2952
+ throw new AxiosError_default(formatMessage(opt, " has been removed" + (version ? " in " + version : "")), AxiosError_default.ERR_DEPRECATED);
2953
+ }
2954
+ if (version && !deprecatedWarnings[opt]) {
2955
+ deprecatedWarnings[opt] = true;
2956
+ console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
2957
+ }
2958
+ return validator ? validator(value, opt, opts) : true;
2959
+ };
2960
+ }, "transitional");
2961
+ validators.spelling = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function spelling(correctSpelling) {
2962
+ return (value, opt) => {
2963
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
2964
+ return true;
2965
+ };
2966
+ }, "spelling");
2967
+ function assertOptions(options, schema, allowUnknown) {
2968
+ if (typeof options !== "object") {
2969
+ throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
2970
+ }
2971
+ const keys = Object.keys(options);
2972
+ let i = keys.length;
2973
+ while (i-- > 0) {
2974
+ const opt = keys[i];
2975
+ const validator = schema[opt];
2976
+ if (validator) {
2977
+ const value = options[opt];
2978
+ const result = value === void 0 || validator(value, opt, options);
2979
+ if (result !== true) {
2980
+ throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
2981
+ }
2982
+ continue;
2983
+ }
2984
+ if (allowUnknown !== true) {
2985
+ throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
2986
+ }
2987
+ }
2988
+ }
2989
+ chunkXQKCXG4I_cjs.__name(assertOptions, "assertOptions");
2990
+ var validator_default = {
2991
+ assertOptions,
2992
+ validators
2993
+ };
2994
+
2995
+ // node_modules/axios/lib/core/Axios.js
2996
+ var validators2 = validator_default.validators;
2997
+ var _a6;
2998
+ var Axios = (_a6 = class {
2999
+ constructor(instanceConfig) {
3000
+ this.defaults = instanceConfig || {};
3001
+ this.interceptors = {
3002
+ request: new InterceptorManager_default(),
3003
+ response: new InterceptorManager_default()
3004
+ };
3005
+ }
3006
+ /**
3007
+ * Dispatch a request
3008
+ *
3009
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3010
+ * @param {?Object} config
3011
+ *
3012
+ * @returns {Promise} The Promise to be fulfilled
3013
+ */
3014
+ async request(configOrUrl, config) {
3015
+ try {
3016
+ return await this._request(configOrUrl, config);
3017
+ } catch (err) {
3018
+ if (err instanceof Error) {
3019
+ let dummy = {};
3020
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3021
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
3022
+ try {
3023
+ if (!err.stack) {
3024
+ err.stack = stack;
3025
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
3026
+ err.stack += "\n" + stack;
3027
+ }
3028
+ } catch (e) {
3029
+ }
3030
+ }
3031
+ throw err;
3032
+ }
3033
+ }
3034
+ _request(configOrUrl, config) {
3035
+ if (typeof configOrUrl === "string") {
3036
+ config = config || {};
3037
+ config.url = configOrUrl;
3038
+ } else {
3039
+ config = configOrUrl || {};
3040
+ }
3041
+ config = mergeConfig(this.defaults, config);
3042
+ const { transitional: transitional2, paramsSerializer, headers } = config;
3043
+ if (transitional2 !== void 0) {
3044
+ validator_default.assertOptions(transitional2, {
3045
+ silentJSONParsing: validators2.transitional(validators2.boolean),
3046
+ forcedJSONParsing: validators2.transitional(validators2.boolean),
3047
+ clarifyTimeoutError: validators2.transitional(validators2.boolean)
3048
+ }, false);
3049
+ }
3050
+ if (paramsSerializer != null) {
3051
+ if (utils_default.isFunction(paramsSerializer)) {
3052
+ config.paramsSerializer = {
3053
+ serialize: paramsSerializer
3054
+ };
3055
+ } else {
3056
+ validator_default.assertOptions(paramsSerializer, {
3057
+ encode: validators2.function,
3058
+ serialize: validators2.function
3059
+ }, true);
3060
+ }
3061
+ }
3062
+ if (config.allowAbsoluteUrls !== void 0) ; else if (this.defaults.allowAbsoluteUrls !== void 0) {
3063
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3064
+ } else {
3065
+ config.allowAbsoluteUrls = true;
3066
+ }
3067
+ validator_default.assertOptions(config, {
3068
+ baseUrl: validators2.spelling("baseURL"),
3069
+ withXsrfToken: validators2.spelling("withXSRFToken")
3070
+ }, true);
3071
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
3072
+ let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
3073
+ headers && utils_default.forEach([
3074
+ "delete",
3075
+ "get",
3076
+ "head",
3077
+ "post",
3078
+ "put",
3079
+ "patch",
3080
+ "common"
3081
+ ], (method) => {
3082
+ delete headers[method];
3083
+ });
3084
+ config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
3085
+ const requestInterceptorChain = [];
3086
+ let synchronousRequestInterceptors = true;
3087
+ this.interceptors.request.forEach(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function unshiftRequestInterceptors(interceptor) {
3088
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
3089
+ return;
3090
+ }
3091
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3092
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3093
+ }, "unshiftRequestInterceptors"));
3094
+ const responseInterceptorChain = [];
3095
+ this.interceptors.response.forEach(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function pushResponseInterceptors(interceptor) {
3096
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3097
+ }, "pushResponseInterceptors"));
3098
+ let promise;
3099
+ let i = 0;
3100
+ let len;
3101
+ if (!synchronousRequestInterceptors) {
3102
+ const chain = [
3103
+ dispatchRequest.bind(this),
3104
+ void 0
3105
+ ];
3106
+ chain.unshift(...requestInterceptorChain);
3107
+ chain.push(...responseInterceptorChain);
3108
+ len = chain.length;
3109
+ promise = Promise.resolve(config);
3110
+ while (i < len) {
3111
+ promise = promise.then(chain[i++], chain[i++]);
3112
+ }
3113
+ return promise;
3114
+ }
3115
+ len = requestInterceptorChain.length;
3116
+ let newConfig = config;
3117
+ i = 0;
3118
+ while (i < len) {
3119
+ const onFulfilled = requestInterceptorChain[i++];
3120
+ const onRejected = requestInterceptorChain[i++];
3121
+ try {
3122
+ newConfig = onFulfilled(newConfig);
3123
+ } catch (error) {
3124
+ onRejected.call(this, error);
3125
+ break;
3126
+ }
3127
+ }
3128
+ try {
3129
+ promise = dispatchRequest.call(this, newConfig);
3130
+ } catch (error) {
3131
+ return Promise.reject(error);
3132
+ }
3133
+ i = 0;
3134
+ len = responseInterceptorChain.length;
3135
+ while (i < len) {
3136
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3137
+ }
3138
+ return promise;
3139
+ }
3140
+ getUri(config) {
3141
+ config = mergeConfig(this.defaults, config);
3142
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3143
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3144
+ }
3145
+ }, chunkXQKCXG4I_cjs.__name(_a6, "Axios"), _a6);
3146
+ utils_default.forEach([
3147
+ "delete",
3148
+ "get",
3149
+ "head",
3150
+ "options"
3151
+ ], /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function forEachMethodNoData(method) {
3152
+ Axios.prototype[method] = function(url2, config) {
3153
+ return this.request(mergeConfig(config || {}, {
3154
+ method,
3155
+ url: url2,
3156
+ data: (config || {}).data
3157
+ }));
3158
+ };
3159
+ }, "forEachMethodNoData"));
3160
+ utils_default.forEach([
3161
+ "post",
3162
+ "put",
3163
+ "patch"
3164
+ ], /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function forEachMethodWithData(method) {
3165
+ function generateHTTPMethod(isForm) {
3166
+ return /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function httpMethod(url2, data, config) {
3167
+ return this.request(mergeConfig(config || {}, {
3168
+ method,
3169
+ headers: isForm ? {
3170
+ "Content-Type": "multipart/form-data"
3171
+ } : {},
3172
+ url: url2,
3173
+ data
3174
+ }));
3175
+ }, "httpMethod");
3176
+ }
3177
+ chunkXQKCXG4I_cjs.__name(generateHTTPMethod, "generateHTTPMethod");
3178
+ Axios.prototype[method] = generateHTTPMethod();
3179
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
3180
+ }, "forEachMethodWithData"));
3181
+ var Axios_default = Axios;
3182
+
3183
+ // node_modules/axios/lib/cancel/CancelToken.js
3184
+ var _a7;
3185
+ var CancelToken = (_a7 = class {
3186
+ constructor(executor) {
3187
+ if (typeof executor !== "function") {
3188
+ throw new TypeError("executor must be a function.");
3189
+ }
3190
+ let resolvePromise;
3191
+ this.promise = new Promise(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function promiseExecutor(resolve) {
3192
+ resolvePromise = resolve;
3193
+ }, "promiseExecutor"));
3194
+ const token = this;
3195
+ this.promise.then((cancel) => {
3196
+ if (!token._listeners) return;
3197
+ let i = token._listeners.length;
3198
+ while (i-- > 0) {
3199
+ token._listeners[i](cancel);
3200
+ }
3201
+ token._listeners = null;
3202
+ });
3203
+ this.promise.then = (onfulfilled) => {
3204
+ let _resolve;
3205
+ const promise = new Promise((resolve) => {
3206
+ token.subscribe(resolve);
3207
+ _resolve = resolve;
3208
+ }).then(onfulfilled);
3209
+ promise.cancel = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function reject() {
3210
+ token.unsubscribe(_resolve);
3211
+ }, "reject");
3212
+ return promise;
3213
+ };
3214
+ executor(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function cancel(message, config, request) {
3215
+ if (token.reason) {
3216
+ return;
3217
+ }
3218
+ token.reason = new CanceledError_default(message, config, request);
3219
+ resolvePromise(token.reason);
3220
+ }, "cancel"));
3221
+ }
3222
+ /**
3223
+ * Throws a `CanceledError` if cancellation has been requested.
3224
+ */
3225
+ throwIfRequested() {
3226
+ if (this.reason) {
3227
+ throw this.reason;
3228
+ }
3229
+ }
3230
+ /**
3231
+ * Subscribe to the cancel signal
3232
+ */
3233
+ subscribe(listener) {
3234
+ if (this.reason) {
3235
+ listener(this.reason);
3236
+ return;
3237
+ }
3238
+ if (this._listeners) {
3239
+ this._listeners.push(listener);
3240
+ } else {
3241
+ this._listeners = [
3242
+ listener
3243
+ ];
3244
+ }
3245
+ }
3246
+ /**
3247
+ * Unsubscribe from the cancel signal
3248
+ */
3249
+ unsubscribe(listener) {
3250
+ if (!this._listeners) {
3251
+ return;
3252
+ }
3253
+ const index = this._listeners.indexOf(listener);
3254
+ if (index !== -1) {
3255
+ this._listeners.splice(index, 1);
3256
+ }
3257
+ }
3258
+ toAbortSignal() {
3259
+ const controller = new AbortController();
3260
+ const abort = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((err) => {
3261
+ controller.abort(err);
3262
+ }, "abort");
3263
+ this.subscribe(abort);
3264
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
3265
+ return controller.signal;
3266
+ }
3267
+ /**
3268
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3269
+ * cancels the `CancelToken`.
3270
+ */
3271
+ static source() {
3272
+ let cancel;
3273
+ const token = new _a7(/* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function executor(c) {
3274
+ cancel = c;
3275
+ }, "executor"));
3276
+ return {
3277
+ token,
3278
+ cancel
3279
+ };
3280
+ }
3281
+ }, chunkXQKCXG4I_cjs.__name(_a7, "CancelToken"), _a7);
3282
+ var CancelToken_default = CancelToken;
3283
+
3284
+ // node_modules/axios/lib/helpers/spread.js
3285
+ function spread(callback) {
3286
+ return /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function wrap(arr) {
3287
+ return callback.apply(null, arr);
3288
+ }, "wrap");
3289
+ }
3290
+ chunkXQKCXG4I_cjs.__name(spread, "spread");
3291
+
3292
+ // node_modules/axios/lib/helpers/isAxiosError.js
3293
+ function isAxiosError(payload) {
3294
+ return utils_default.isObject(payload) && payload.isAxiosError === true;
3295
+ }
3296
+ chunkXQKCXG4I_cjs.__name(isAxiosError, "isAxiosError");
3297
+
3298
+ // node_modules/axios/lib/helpers/HttpStatusCode.js
3299
+ var HttpStatusCode = {
3300
+ Continue: 100,
3301
+ SwitchingProtocols: 101,
3302
+ Processing: 102,
3303
+ EarlyHints: 103,
3304
+ Ok: 200,
3305
+ Created: 201,
3306
+ Accepted: 202,
3307
+ NonAuthoritativeInformation: 203,
3308
+ NoContent: 204,
3309
+ ResetContent: 205,
3310
+ PartialContent: 206,
3311
+ MultiStatus: 207,
3312
+ AlreadyReported: 208,
3313
+ ImUsed: 226,
3314
+ MultipleChoices: 300,
3315
+ MovedPermanently: 301,
3316
+ Found: 302,
3317
+ SeeOther: 303,
3318
+ NotModified: 304,
3319
+ UseProxy: 305,
3320
+ Unused: 306,
3321
+ TemporaryRedirect: 307,
3322
+ PermanentRedirect: 308,
3323
+ BadRequest: 400,
3324
+ Unauthorized: 401,
3325
+ PaymentRequired: 402,
3326
+ Forbidden: 403,
3327
+ NotFound: 404,
3328
+ MethodNotAllowed: 405,
3329
+ NotAcceptable: 406,
3330
+ ProxyAuthenticationRequired: 407,
3331
+ RequestTimeout: 408,
3332
+ Conflict: 409,
3333
+ Gone: 410,
3334
+ LengthRequired: 411,
3335
+ PreconditionFailed: 412,
3336
+ PayloadTooLarge: 413,
3337
+ UriTooLong: 414,
3338
+ UnsupportedMediaType: 415,
3339
+ RangeNotSatisfiable: 416,
3340
+ ExpectationFailed: 417,
3341
+ ImATeapot: 418,
3342
+ MisdirectedRequest: 421,
3343
+ UnprocessableEntity: 422,
3344
+ Locked: 423,
3345
+ FailedDependency: 424,
3346
+ TooEarly: 425,
3347
+ UpgradeRequired: 426,
3348
+ PreconditionRequired: 428,
3349
+ TooManyRequests: 429,
3350
+ RequestHeaderFieldsTooLarge: 431,
3351
+ UnavailableForLegalReasons: 451,
3352
+ InternalServerError: 500,
3353
+ NotImplemented: 501,
3354
+ BadGateway: 502,
3355
+ ServiceUnavailable: 503,
3356
+ GatewayTimeout: 504,
3357
+ HttpVersionNotSupported: 505,
3358
+ VariantAlsoNegotiates: 506,
3359
+ InsufficientStorage: 507,
3360
+ LoopDetected: 508,
3361
+ NotExtended: 510,
3362
+ NetworkAuthenticationRequired: 511
3363
+ };
3364
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3365
+ HttpStatusCode[value] = key;
3366
+ });
3367
+ var HttpStatusCode_default = HttpStatusCode;
3368
+
3369
+ // node_modules/axios/lib/axios.js
3370
+ function createInstance(defaultConfig) {
3371
+ const context = new Axios_default(defaultConfig);
3372
+ const instance = bind(Axios_default.prototype.request, context);
3373
+ utils_default.extend(instance, Axios_default.prototype, context, {
3374
+ allOwnKeys: true
3375
+ });
3376
+ utils_default.extend(instance, context, null, {
3377
+ allOwnKeys: true
3378
+ });
3379
+ instance.create = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function create(instanceConfig) {
3380
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3381
+ }, "create");
3382
+ return instance;
3383
+ }
3384
+ chunkXQKCXG4I_cjs.__name(createInstance, "createInstance");
3385
+ var axios = createInstance(defaults_default);
3386
+ axios.Axios = Axios_default;
3387
+ axios.CanceledError = CanceledError_default;
3388
+ axios.CancelToken = CancelToken_default;
3389
+ axios.isCancel = isCancel;
3390
+ axios.VERSION = VERSION;
3391
+ axios.toFormData = toFormData_default;
3392
+ axios.AxiosError = AxiosError_default;
3393
+ axios.Cancel = axios.CanceledError;
3394
+ axios.all = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(function all(promises) {
3395
+ return Promise.all(promises);
3396
+ }, "all");
3397
+ axios.spread = spread;
3398
+ axios.isAxiosError = isAxiosError;
3399
+ axios.mergeConfig = mergeConfig;
3400
+ axios.AxiosHeaders = AxiosHeaders_default;
3401
+ axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
3402
+ axios.getAdapter = adapters_default.getAdapter;
3403
+ axios.HttpStatusCode = HttpStatusCode_default;
3404
+ axios.default = axios;
3405
+ var axios_default = axios;
3406
+
3407
+ // node_modules/axios/index.js
3408
+ var { Axios: Axios2, AxiosError: AxiosError2, CanceledError: CanceledError2, isCancel: isCancel2, CancelToken: CancelToken2, VERSION: VERSION2, all: all2, Cancel, isAxiosError: isAxiosError2, spread: spread2, toFormData: toFormData2, AxiosHeaders: AxiosHeaders2, HttpStatusCode: HttpStatusCode2, formToJSON, getAdapter, mergeConfig: mergeConfig2 } = axios_default;
3409
+
3410
+ // src/utils/network.ts
3411
+ var isWeb = typeof window !== "undefined" && !!window.document;
3412
+ var _a8;
3413
+ var NetworkManager = (_a8 = class {
3414
+ constructor() {
3415
+ chunkXQKCXG4I_cjs.__publicField(this, "listeners", /* @__PURE__ */ new Set());
3416
+ chunkXQKCXG4I_cjs.__publicField(this, "currentState", {
3417
+ isConnected: true
3418
+ });
3419
+ chunkXQKCXG4I_cjs.__publicField(this, "webEventListener");
3420
+ void this.initializeNetworkMonitoring();
3421
+ }
3422
+ async initializeNetworkMonitoring() {
3423
+ if (isWeb) {
3424
+ this.initializeWebNetworkMonitoring();
3425
+ } else {
3426
+ await this.initializeRNNetworkMonitoring();
3427
+ }
3428
+ }
3429
+ initializeWebNetworkMonitoring() {
3430
+ this.currentState = {
3431
+ isConnected: navigator.onLine,
3432
+ connectionType: "unknown",
3433
+ isInternetReachable: navigator.onLine
3434
+ };
3435
+ this.webEventListener = () => {
3436
+ const newState = {
3437
+ isConnected: navigator.onLine,
3438
+ connectionType: "unknown",
3439
+ isInternetReachable: navigator.onLine
3440
+ };
3441
+ this.updateNetworkState(newState);
3442
+ };
3443
+ window.addEventListener("online", this.webEventListener);
3444
+ window.addEventListener("offline", this.webEventListener);
3445
+ }
3446
+ async initializeRNNetworkMonitoring() {
3447
+ try {
3448
+ const NetInfo = await import('@react-native-community/netinfo');
3449
+ const initialState = await NetInfo.default.fetch();
3450
+ this.currentState = {
3451
+ isConnected: initialState.isConnected ?? false,
3452
+ connectionType: initialState.type,
3453
+ isInternetReachable: initialState.isInternetReachable ?? false
3454
+ };
3455
+ NetInfo.default.addEventListener((state) => {
3456
+ const newState = {
3457
+ isConnected: state.isConnected ?? false,
3458
+ connectionType: state.type,
3459
+ isInternetReachable: state.isInternetReachable ?? false
3460
+ };
3461
+ this.updateNetworkState(newState);
3462
+ });
3463
+ } catch (error) {
3464
+ console.warn("NetInfo not available, using fallback:", error);
3465
+ this.currentState = {
3466
+ isConnected: true
3467
+ };
3468
+ }
3469
+ }
3470
+ updateNetworkState(newState) {
3471
+ const wasConnected = this.currentState.isConnected;
3472
+ const isConnected2 = newState.isConnected;
3473
+ this.currentState = newState;
3474
+ this.listeners.forEach((listener) => {
3475
+ try {
3476
+ listener(newState);
3477
+ } catch (error) {
3478
+ console.warn("Network state listener error:", error);
3479
+ }
3480
+ });
3481
+ if (wasConnected !== isConnected2) {
3482
+ console.log(`Network status changed: ${isConnected2 ? "connected" : "disconnected"}`);
3483
+ }
3484
+ }
3485
+ getNetworkState() {
3486
+ return {
3487
+ ...this.currentState
3488
+ };
3489
+ }
3490
+ isConnected() {
3491
+ return this.currentState.isConnected;
3492
+ }
3493
+ addListener(listener) {
3494
+ this.listeners.add(listener);
3495
+ return () => {
3496
+ this.listeners.delete(listener);
3497
+ };
3498
+ }
3499
+ removeListener(listener) {
3500
+ this.listeners.delete(listener);
3501
+ }
3502
+ async checkInternetConnectivity() {
3503
+ if (!this.currentState.isConnected) {
3504
+ return false;
3505
+ }
3506
+ try {
3507
+ if (isWeb) {
3508
+ const response = await fetch("https://www.google.com/generate_204", {
3509
+ method: "HEAD",
3510
+ cache: "no-cache",
3511
+ signal: AbortSignal.timeout(5e3)
3512
+ });
3513
+ return response.ok;
3514
+ } else {
3515
+ return this.currentState.isInternetReachable ?? false;
3516
+ }
3517
+ } catch (error) {
3518
+ console.warn("Internet connectivity check failed:", error);
3519
+ return false;
3520
+ }
3521
+ }
3522
+ cleanup() {
3523
+ if (isWeb && this.webEventListener) {
3524
+ window.removeEventListener("online", this.webEventListener);
3525
+ window.removeEventListener("offline", this.webEventListener);
3526
+ }
3527
+ this.listeners.clear();
3528
+ }
3529
+ }, chunkXQKCXG4I_cjs.__name(_a8, "NetworkManager"), _a8);
3530
+ var networkManager = new NetworkManager();
3531
+ var getNetworkState = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => networkManager.getNetworkState(), "getNetworkState");
3532
+ var isConnected = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => networkManager.isConnected(), "isConnected");
3533
+ var addNetworkListener = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((listener) => networkManager.addListener(listener), "addNetworkListener");
3534
+ var removeNetworkListener = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((listener) => networkManager.removeListener(listener), "removeNetworkListener");
3535
+ var checkInternetConnectivity = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => networkManager.checkInternetConnectivity(), "checkInternetConnectivity");
3536
+ var waitForConnection = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((timeoutMs = 3e4) => {
3537
+ return new Promise((resolve) => {
3538
+ if (isConnected()) {
3539
+ resolve(true);
3540
+ return;
3541
+ }
3542
+ const timeout = setTimeout(() => {
3543
+ unsubscribe();
3544
+ resolve(false);
3545
+ }, timeoutMs);
3546
+ const unsubscribe = addNetworkListener((state) => {
3547
+ if (state.isConnected) {
3548
+ clearTimeout(timeout);
3549
+ unsubscribe();
3550
+ resolve(true);
3551
+ }
3552
+ });
3553
+ });
3554
+ }, "waitForConnection");
3555
+
3556
+ // src/utils/retry.ts
3557
+ var DEFAULT_RETRY_CONFIG = {
3558
+ retries: 3,
3559
+ retryDelay: 1e3,
3560
+ exponentialBackoff: true,
3561
+ maxRetryDelay: 1e4,
3562
+ retryCondition: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((error) => {
3563
+ if (!error.response) return true;
3564
+ const status = error.response.status;
3565
+ return status >= 500 || status === 429;
3566
+ }, "retryCondition")
3567
+ };
3568
+ var sleep = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((ms) => new Promise((resolve) => setTimeout(resolve, ms)), "sleep");
3569
+ var calculateRetryDelay = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((retryCount, baseDelay, exponentialBackoff = true, maxDelay = 1e4) => {
3570
+ if (!exponentialBackoff) {
3571
+ return baseDelay;
3572
+ }
3573
+ const delay = baseDelay * Math.pow(2, retryCount);
3574
+ return Math.min(delay, maxDelay);
3575
+ }, "calculateRetryDelay");
3576
+ async function retryAsync(fn, config = {}) {
3577
+ const finalConfig = {
3578
+ ...DEFAULT_RETRY_CONFIG,
3579
+ ...config
3580
+ };
3581
+ let lastError;
3582
+ for (let attempt = 0; attempt <= finalConfig.retries; attempt++) {
3583
+ try {
3584
+ if (!isConnected()) {
3585
+ const connected = await waitForConnection(3e4);
3586
+ if (!connected) {
3587
+ throw new Error("Network connection timeout");
3588
+ }
3589
+ }
3590
+ return await fn();
3591
+ } catch (error) {
3592
+ lastError = error;
3593
+ if (attempt === finalConfig.retries) {
3594
+ break;
3595
+ }
3596
+ if (finalConfig.retryCondition && !finalConfig.retryCondition(error)) {
3597
+ break;
3598
+ }
3599
+ if (finalConfig.onRetry) {
3600
+ finalConfig.onRetry(attempt + 1, error);
3601
+ }
3602
+ const delay = calculateRetryDelay(attempt, finalConfig.retryDelay, finalConfig.exponentialBackoff, finalConfig.maxRetryDelay);
3603
+ console.log(`Retrying in ${delay}ms (attempt ${attempt + 1}/${finalConfig.retries})`);
3604
+ await sleep(delay);
3605
+ }
3606
+ }
3607
+ throw lastError;
3608
+ }
3609
+ chunkXQKCXG4I_cjs.__name(retryAsync, "retryAsync");
3610
+ var _AxiosRetryInterceptor = class _AxiosRetryInterceptor {
3611
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3612
+ static setupInterceptors(axiosInstance, config = {}) {
3613
+ const finalConfig = {
3614
+ ...DEFAULT_RETRY_CONFIG,
3615
+ ...config
3616
+ };
3617
+ axiosInstance.interceptors.response.use((response) => response, async (error) => {
3618
+ const originalRequest = error.config;
3619
+ if (!originalRequest._retryCount) {
3620
+ originalRequest._retryCount = 0;
3621
+ }
3622
+ const shouldRetry = originalRequest._retryCount < finalConfig.retries && !originalRequest._retried && (finalConfig.retryCondition ? finalConfig.retryCondition(error) : true);
3623
+ if (!shouldRetry) {
3624
+ return Promise.reject(error);
3625
+ }
3626
+ originalRequest._retryCount += 1;
3627
+ if (!isConnected()) {
3628
+ const connected = await waitForConnection(3e4);
3629
+ if (!connected) {
3630
+ return Promise.reject(new Error("Network connection timeout"));
3631
+ }
3632
+ }
3633
+ if (finalConfig.onRetry) {
3634
+ finalConfig.onRetry(originalRequest._retryCount, error);
3635
+ }
3636
+ const delay = calculateRetryDelay(originalRequest._retryCount - 1, finalConfig.retryDelay, finalConfig.exponentialBackoff, finalConfig.maxRetryDelay);
3637
+ await sleep(delay);
3638
+ originalRequest._retried = true;
3639
+ return axiosInstance(originalRequest);
3640
+ });
3641
+ }
3642
+ };
3643
+ chunkXQKCXG4I_cjs.__name(_AxiosRetryInterceptor, "AxiosRetryInterceptor");
3644
+ var AxiosRetryInterceptor = _AxiosRetryInterceptor;
3645
+ var isRetryableError = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((error) => {
3646
+ if (!error.response) {
3647
+ return true;
3648
+ }
3649
+ const status = error.response.status;
3650
+ if (status >= 500) {
3651
+ return true;
3652
+ }
3653
+ if (status === 429) {
3654
+ return true;
3655
+ }
3656
+ if (status === 401) {
3657
+ return true;
3658
+ }
3659
+ if (status === 408) {
3660
+ return true;
3661
+ }
3662
+ return false;
3663
+ }, "isRetryableError");
3664
+ var withRetry = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((fn, config) => {
3665
+ return (...args) => {
3666
+ return retryAsync(() => fn(...args), config);
3667
+ };
3668
+ }, "withRetry");
3669
+ var calculateJitteredDelay = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((retryCount, baseDelay, maxDelay = 1e4, jitterFactor = 0.1) => {
3670
+ const exponentialDelay = baseDelay * Math.pow(2, retryCount);
3671
+ const jitter = exponentialDelay * jitterFactor * Math.random();
3672
+ const delay = exponentialDelay + jitter;
3673
+ return Math.min(delay, maxDelay);
3674
+ }, "calculateJitteredDelay");
3675
+
3676
+ // src/constants/endpoints.ts
3677
+ var API_ENDPOINTS = {
3678
+ SANDBOX: "https://api-sandbox.acube.it",
3679
+ PRODUCTION: "https://api.acube.it"
3680
+ };
3681
+ var MF1_PATHS = {
3682
+ // Authentication
3683
+ LOGIN: "/mf1/login",
3684
+ // Cashiers
3685
+ CASHIERS: "/mf1/cashiers/",
3686
+ CASHIER_ME: "/mf1/cashiers/me",
3687
+ CASHIER_BY_ID: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((id) => `/mf1/cashiers/${id}`, "CASHIER_BY_ID"),
3688
+ // Point of Sales
3689
+ POINT_OF_SALES: "/mf1/point-of-sales/",
3690
+ POINT_OF_SALE_BY_SERIAL: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((serialNumber) => `/mf1/point-of-sales/${serialNumber}`, "POINT_OF_SALE_BY_SERIAL"),
3691
+ POINT_OF_SALE_ACTIVATION: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((serialNumber) => `/mf1/point-of-sales/${serialNumber}/activation`, "POINT_OF_SALE_ACTIVATION"),
3692
+ POINT_OF_SALE_INACTIVITY: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((serialNumber) => `/mf1/point-of-sales/${serialNumber}/inactivity`, "POINT_OF_SALE_INACTIVITY"),
3693
+ POINT_OF_SALE_OFFLINE: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((serialNumber) => `/mf1/point-of-sales/${serialNumber}/status/offline`, "POINT_OF_SALE_OFFLINE"),
3694
+ CLOSE_JOURNAL: "/mf1/point-of-sales/close",
3695
+ // Receipts
3696
+ RECEIPTS: "/mf1/receipts/",
3697
+ RECEIPT_BY_UUID: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((uuid) => `/mf1/receipts/${uuid}`, "RECEIPT_BY_UUID"),
3698
+ RECEIPT_DETAILS: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((uuid) => `/mf1/receipts/${uuid}/details`, "RECEIPT_DETAILS"),
3699
+ RECEIPT_VOID_WITH_PROOF: "/mf1/receipts/void-with-proof",
3700
+ RECEIPT_RETURN: "/mf1/receipts/return",
3701
+ RECEIPT_RETURN_WITH_PROOF: "/mf1/receipts/return-with-proof",
3702
+ // Cash Register
3703
+ CASH_REGISTER: "/mf1/cash-register/",
3704
+ CASH_REGISTER_BY_ID: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((id) => `/mf1/cash-register/${id}`, "CASH_REGISTER_BY_ID"),
3705
+ CASH_REGISTER_MTLS_CERT: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((id) => `/mf1/cash-register/${id}/mtls-certificate`, "CASH_REGISTER_MTLS_CERT")
3706
+ };
3707
+ var MF2_PATHS = {
3708
+ // Merchants
3709
+ MERCHANTS: "/mf2/merchants",
3710
+ MERCHANT_BY_UUID: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((uuid) => `/mf2/merchants/${uuid}`, "MERCHANT_BY_UUID")
3711
+ };
3712
+ var getBaseURL = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((environment = "sandbox") => {
3713
+ return environment === "production" ? API_ENDPOINTS.PRODUCTION : API_ENDPOINTS.SANDBOX;
3714
+ }, "getBaseURL");
3715
+
3716
+ // src/api/client.ts
3717
+ var DEFAULT_CONFIG = {
3718
+ environment: "sandbox",
3719
+ timeout: 3e4,
3720
+ enableRetry: true,
3721
+ enableOfflineQueue: true,
3722
+ maxRetries: 3,
3723
+ retryDelay: 1e3,
3724
+ enableLogging: true
3725
+ };
3726
+ var _a9;
3727
+ var APIClient = (_a9 = class {
3728
+ constructor(config = {}) {
3729
+ chunkXQKCXG4I_cjs.__publicField(this, "axiosInstance");
3730
+ chunkXQKCXG4I_cjs.__publicField(this, "config");
3731
+ this.config = {
3732
+ ...DEFAULT_CONFIG,
3733
+ ...config
3734
+ };
3735
+ this.axiosInstance = this.createAxiosInstance();
3736
+ this.setupInterceptors();
3737
+ }
3738
+ createAxiosInstance() {
3739
+ const baseURL = this.config.baseURL ?? getBaseURL(this.config.environment);
3740
+ return axios_default.create({
3741
+ baseURL,
3742
+ timeout: this.config.timeout,
3743
+ headers: {
3744
+ "Content-Type": "application/json",
3745
+ "Accept": "application/json"
3746
+ }
3747
+ });
3748
+ }
3749
+ setupInterceptors() {
3750
+ this.axiosInstance.interceptors.request.use(async (config) => {
3751
+ const token = await chunk24ZJ6SNG_cjs.SecureTokenStorage.getToken();
3752
+ if (token && await chunk24ZJ6SNG_cjs.SecureTokenStorage.isTokenValid()) {
3753
+ config.headers.Authorization = `Bearer ${token}`;
3754
+ }
3755
+ if (this.config.enableLogging) {
3756
+ chunk24ZJ6SNG_cjs.apiLogger.apiRequest(config.url ?? "", config.method?.toUpperCase() ?? "GET", config.data);
3757
+ }
3758
+ return config;
3759
+ }, (error) => {
3760
+ chunk24ZJ6SNG_cjs.apiLogger.error("Request interceptor error", error);
3761
+ return Promise.reject(error);
3762
+ });
3763
+ this.axiosInstance.interceptors.response.use((response) => {
3764
+ if (this.config.enableLogging) {
3765
+ chunk24ZJ6SNG_cjs.apiLogger.apiResponse(response.config.url ?? "", response.status, response.data);
3766
+ }
3767
+ return response;
3768
+ }, async (error) => {
3769
+ const originalRequest = error.config;
3770
+ if (this.config.enableLogging) {
3771
+ chunk24ZJ6SNG_cjs.apiLogger.apiError(originalRequest?.url ?? "", error);
3772
+ }
3773
+ if (error.response?.status === 401 && !originalRequest?._retry) {
3774
+ originalRequest._retry = true;
3775
+ await this.handleAuthError();
3776
+ return Promise.reject(error);
3777
+ }
3778
+ if (!isConnected() && this.config.enableOfflineQueue) {
3779
+ await this.handleOfflineRequest(originalRequest, error);
3780
+ }
3781
+ return Promise.reject(error);
3782
+ });
3783
+ if (this.config.enableRetry) {
3784
+ AxiosRetryInterceptor.setupInterceptors(this.axiosInstance, {
3785
+ retries: this.config.maxRetries ?? 3,
3786
+ retryDelay: this.config.retryDelay ?? 1e3,
3787
+ onRetry: /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((retryCount, error) => {
3788
+ chunk24ZJ6SNG_cjs.apiLogger.warn(`Retrying request (${retryCount})`, {
3789
+ url: error.config?.url,
3790
+ method: error.config?.method,
3791
+ status: error.response?.status
3792
+ });
3793
+ chunk24ZJ6SNG_cjs.apiLogger.retryAttempt(retryCount, this.config.maxRetries ?? 3, this.config.retryDelay ?? 1e3);
3794
+ }, "onRetry")
3795
+ });
3796
+ }
3797
+ }
3798
+ async handleAuthError() {
3799
+ await chunk24ZJ6SNG_cjs.SecureTokenStorage.removeToken();
3800
+ chunk24ZJ6SNG_cjs.apiLogger.warn("Authentication token expired or invalid, cleared from storage");
3801
+ }
3802
+ async handleOfflineRequest(originalRequest, _error) {
3803
+ if (!originalRequest || originalRequest._queued) {
3804
+ return;
3805
+ }
3806
+ const method = originalRequest.method?.toUpperCase();
3807
+ if (method === "POST" || method === "PUT" || method === "PATCH") {
3808
+ originalRequest._queued = true;
3809
+ const priority = this.determinePriority(originalRequest);
3810
+ await chunkNARXAXFL_cjs.RequestQueue.enqueueRequest(originalRequest, priority);
3811
+ chunk24ZJ6SNG_cjs.apiLogger.info(`Request queued for retry: ${method} ${originalRequest.url}`, {
3812
+ priority,
3813
+ queueSize: (await chunkNARXAXFL_cjs.RequestQueue.getQueueStats()).total
3814
+ });
3815
+ }
3816
+ }
3817
+ determinePriority(request) {
3818
+ const url2 = request.url ?? "";
3819
+ if (url2.includes("/receipts") || url2.includes("/activation")) {
3820
+ return "high";
3821
+ }
3822
+ if (url2.includes("/merchants") || url2.includes("/cash-register")) {
3823
+ return "medium";
3824
+ }
3825
+ return "low";
3826
+ }
3827
+ // Public API methods
3828
+ updateConfig(config) {
3829
+ this.config = {
3830
+ ...this.config,
3831
+ ...config
3832
+ };
3833
+ if (config.baseURL ?? config.environment) {
3834
+ this.axiosInstance = this.createAxiosInstance();
3835
+ this.setupInterceptors();
3836
+ }
3837
+ }
3838
+ getConfig() {
3839
+ return {
3840
+ ...this.config
3841
+ };
3842
+ }
3843
+ // HTTP methods
3844
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3845
+ async get(url2, config) {
3846
+ return this.axiosInstance.get(url2, config);
3847
+ }
3848
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3849
+ async post(url2, data, config) {
3850
+ return this.axiosInstance.post(url2, data, config);
3851
+ }
3852
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3853
+ async put(url2, data, config) {
3854
+ return this.axiosInstance.put(url2, data, config);
3855
+ }
3856
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3857
+ async patch(url2, data, config) {
3858
+ return this.axiosInstance.patch(url2, data, config);
3859
+ }
3860
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3861
+ async delete(url2, config) {
3862
+ return this.axiosInstance.delete(url2, config);
3863
+ }
3864
+ // Advanced methods
3865
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3866
+ async request(config) {
3867
+ return this.axiosInstance.request(config);
3868
+ }
3869
+ getAxiosInstance() {
3870
+ return this.axiosInstance;
3871
+ }
3872
+ // Utility methods
3873
+ async isAuthenticated() {
3874
+ const token = await chunk24ZJ6SNG_cjs.SecureTokenStorage.getToken();
3875
+ return token !== null && await chunk24ZJ6SNG_cjs.SecureTokenStorage.isTokenValid();
3876
+ }
3877
+ async getCurrentToken() {
3878
+ return await chunk24ZJ6SNG_cjs.SecureTokenStorage.getToken();
3879
+ }
3880
+ // Offline queue management
3881
+ async processOfflineQueue() {
3882
+ if (!isConnected()) {
3883
+ chunk24ZJ6SNG_cjs.apiLogger.warn("Cannot process offline queue: no network connection");
3884
+ return;
3885
+ }
3886
+ const stats = await chunkNARXAXFL_cjs.RequestQueue.getQueueStats();
3887
+ if (stats.total === 0) {
3888
+ return;
3889
+ }
3890
+ chunk24ZJ6SNG_cjs.apiLogger.info(`Processing offline queue: ${stats.total} requests`);
3891
+ let nextRequest = await chunkNARXAXFL_cjs.RequestQueue.getNextRequest();
3892
+ while (nextRequest) {
3893
+ try {
3894
+ const token = await chunk24ZJ6SNG_cjs.SecureTokenStorage.getToken();
3895
+ if (token && await chunk24ZJ6SNG_cjs.SecureTokenStorage.isTokenValid()) {
3896
+ nextRequest.config.headers = {
3897
+ ...nextRequest.config.headers,
3898
+ Authorization: `Bearer ${token}`
3899
+ };
3900
+ }
3901
+ await this.axiosInstance.request(nextRequest.config);
3902
+ await chunkNARXAXFL_cjs.RequestQueue.removeRequest(nextRequest.id);
3903
+ chunk24ZJ6SNG_cjs.apiLogger.info(`Successfully processed queued request: ${nextRequest.id}`);
3904
+ } catch (error) {
3905
+ await chunkNARXAXFL_cjs.RequestQueue.incrementRetryCount(nextRequest.id);
3906
+ if (nextRequest.retryCount >= nextRequest.maxRetries) {
3907
+ await chunkNARXAXFL_cjs.RequestQueue.removeRequest(nextRequest.id);
3908
+ chunk24ZJ6SNG_cjs.apiLogger.error(`Failed to process queued request after max retries: ${nextRequest.id}`, error);
3909
+ } else {
3910
+ chunk24ZJ6SNG_cjs.apiLogger.warn(`Failed to process queued request, will retry: ${nextRequest.id}`, error);
3911
+ }
3912
+ }
3913
+ nextRequest = await chunkNARXAXFL_cjs.RequestQueue.getNextRequest();
3914
+ }
3915
+ await chunkNARXAXFL_cjs.RequestQueue.cleanupExpiredRequests();
3916
+ const finalStats = await chunkNARXAXFL_cjs.RequestQueue.getQueueStats();
3917
+ chunk24ZJ6SNG_cjs.apiLogger.info(`Offline queue processing complete. Remaining: ${finalStats.total} requests`);
3918
+ }
3919
+ async getOfflineQueueStats() {
3920
+ return await chunkNARXAXFL_cjs.RequestQueue.getQueueStats();
3921
+ }
3922
+ async clearOfflineQueue() {
3923
+ await chunkNARXAXFL_cjs.RequestQueue.clearQueue();
3924
+ chunk24ZJ6SNG_cjs.apiLogger.info("Offline queue cleared");
3925
+ }
3926
+ }, chunkXQKCXG4I_cjs.__name(_a9, "APIClient"), _a9);
3927
+ var apiClient;
3928
+ var initializeAPIClient = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((config) => {
3929
+ apiClient = new APIClient(config);
3930
+ return apiClient;
3931
+ }, "initializeAPIClient");
3932
+ var getAPIClient = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name(() => {
3933
+ if (!apiClient) {
3934
+ apiClient = new APIClient();
3935
+ }
3936
+ return apiClient;
3937
+ }, "getAPIClient");
3938
+ var configureSDK = /* @__PURE__ */ chunkXQKCXG4I_cjs.__name((config) => {
3939
+ getAPIClient().updateConfig(config);
3940
+ }, "configureSDK");
3941
+
3942
+ exports.APIClient = APIClient;
3943
+ exports.API_ENDPOINTS = API_ENDPOINTS;
3944
+ exports.AxiosRetryInterceptor = AxiosRetryInterceptor;
3945
+ exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
3946
+ exports.MF1_PATHS = MF1_PATHS;
3947
+ exports.MF2_PATHS = MF2_PATHS;
3948
+ exports.addNetworkListener = addNetworkListener;
3949
+ exports.calculateJitteredDelay = calculateJitteredDelay;
3950
+ exports.calculateRetryDelay = calculateRetryDelay;
3951
+ exports.checkInternetConnectivity = checkInternetConnectivity;
3952
+ exports.configureSDK = configureSDK;
3953
+ exports.getAPIClient = getAPIClient;
3954
+ exports.getBaseURL = getBaseURL;
3955
+ exports.getNetworkState = getNetworkState;
3956
+ exports.initializeAPIClient = initializeAPIClient;
3957
+ exports.isConnected = isConnected;
3958
+ exports.isRetryableError = isRetryableError;
3959
+ exports.removeNetworkListener = removeNetworkListener;
3960
+ exports.retryAsync = retryAsync;
3961
+ exports.waitForConnection = waitForConnection;
3962
+ exports.withRetry = withRetry;
3963
+ //# sourceMappingURL=chunk-UVUWF5FV.cjs.map
3964
+ //# sourceMappingURL=chunk-UVUWF5FV.cjs.map