@cccsaurora/clue-ui 1.5.0-dev.467 → 1.5.0-dev.471

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 (60) hide show
  1. package/{ActionForm-BT7_k0EL.js → ActionForm-DIAUGhSr.js} +5 -5
  2. package/{AnnotationDetails-Y_WoZhcI.js → AnnotationDetails-DmrYK0Qc.js} +2 -2
  3. package/{AnnotationPreview-cStKX0if.js → AnnotationPreview-DAswA7fu.js} +2 -2
  4. package/{ClueEnrichContext-C7sNEECP.js → ClueEnrichContext-B76X-cLH.js} +17 -21
  5. package/components/AnnotationBody.js +1 -1
  6. package/components/AnnotationDetailPopover.js +3 -3
  7. package/components/AnnotationDetails.js +3 -3
  8. package/components/AnnotationEntry.js +1 -1
  9. package/components/AnnotationPreview.js +2 -2
  10. package/components/ClassificationChip.js +2 -2
  11. package/components/EnrichedCard.js +2 -2
  12. package/components/EnrichedChip.js +4 -4
  13. package/components/EnrichedTypography.js +2 -2
  14. package/components/ErrorBoundary.js +2 -2
  15. package/components/RetryFailedEnrichments.js +1 -1
  16. package/components/SourcePicker.js +1 -1
  17. package/components/actions/ActionForm.js +1 -1
  18. package/components/actions/ExecutePopover.js +2 -2
  19. package/components/actions/ResultModal.js +2 -2
  20. package/components/actions/formats/index.js +1 -1
  21. package/components/display/graph/elements/NodeCard.js +2 -9
  22. package/components/display/icons/Iconified.js +1 -1
  23. package/components/display/markdown/index.js +1813 -665
  24. package/components/enrichment/EnrichPopover.js +1 -1
  25. package/components/fetchers/Fetcher.js +4 -4
  26. package/components/fetchers/FetcherResultView.js +1 -1
  27. package/components/fetchers/StatusChip.js +1 -1
  28. package/components/group/GroupControl.js +1 -1
  29. package/components/stats/QueryStatus.js +1 -1
  30. package/database/index.js +2 -2
  31. package/database/replication.js +2 -2
  32. package/hooks/ClueActionContext.js +2 -2
  33. package/hooks/ClueDatabaseContext.js +1 -1
  34. package/hooks/ClueEnrichContext.js +3 -3
  35. package/hooks/ClueFetcherContext.js +1 -1
  36. package/hooks/ClueGroupContext.js +1 -1
  37. package/hooks/CluePopupContext.js +2 -2
  38. package/hooks/ClueProvider.js +3 -3
  39. package/hooks/ClueUIPluginContext.js +1 -1
  40. package/hooks/selectors.js +2 -2
  41. package/hooks/useActionResult.js +1 -1
  42. package/hooks/useAnnotations.js +2 -2
  43. package/hooks/useClue.js +1 -1
  44. package/hooks/useClueActions.js +1 -1
  45. package/hooks/useClueTypeConfig.js +1 -1
  46. package/hooks/useErrors.js +1 -1
  47. package/hooks/useFetcherResult.js +1 -1
  48. package/{iconify-DJxl6dC-.js → iconify-CYJTToEF.js} +9 -9
  49. package/icons/Action.js +3 -3
  50. package/icons/Assessment.js +2 -2
  51. package/icons/Context.js +2 -2
  52. package/icons/Opinion.js +2 -2
  53. package/{index-hzIDv8Mx.js → index-8lXdRRpV.js} +541 -144
  54. package/{index-DpJxD74E.js → index-CPetQxOc.js} +2002 -882
  55. package/{index-CtFzsHDu.js → index-DT_sunCV.js} +1 -1
  56. package/main.js +5 -5
  57. package/package.json +3 -3
  58. package/plugins/store.js +1 -1
  59. package/{replication-C5IO7X30.js → replication-DDxxY_CX.js} +1 -1
  60. package/{store-DHP48fQB.js → store-C0DRfMxZ.js} +3 -3
@@ -257,6 +257,83 @@ function bind(fn, thisArg) {
257
257
  const { toString } = Object.prototype;
258
258
  const { getPrototypeOf } = Object;
259
259
  const { iterator, toStringTag } = Symbol;
260
+ const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
261
+ const isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
262
+ const isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
263
+ const isSafeAndFullyMutable = (obj) => {
264
+ if (!Object.isExtensible(obj)) {
265
+ return false;
266
+ }
267
+ const props = Object.getOwnPropertyNames(obj);
268
+ if (Object.getOwnPropertySymbols) {
269
+ props.push(...Object.getOwnPropertySymbols(obj));
270
+ }
271
+ return props.every((prop) => {
272
+ if (isUnsafeObjectKey(prop)) {
273
+ return false;
274
+ }
275
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
276
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
277
+ });
278
+ };
279
+ const hasOwnInPrototypeChain = (thing, prop) => {
280
+ let obj = thing;
281
+ const seen = [];
282
+ while (obj != null) {
283
+ if (seen.indexOf(obj) !== -1) {
284
+ return false;
285
+ }
286
+ seen.push(obj);
287
+ const prototype2 = getPrototypeOf(obj);
288
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
289
+ return false;
290
+ }
291
+ if (hasOwnProperty(obj, prop)) {
292
+ return true;
293
+ }
294
+ obj = prototype2;
295
+ }
296
+ return false;
297
+ };
298
+ const getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
299
+ const toSafeFlatObject = (thing) => {
300
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
301
+ return thing;
302
+ }
303
+ const sourcePrototype = getPrototypeOf(thing);
304
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
305
+ return thing;
306
+ }
307
+ const result = /* @__PURE__ */ Object.create(null);
308
+ const merged = /* @__PURE__ */ Object.create(null);
309
+ const seen = [];
310
+ let current = thing;
311
+ while (current != null) {
312
+ if (seen.indexOf(current) !== -1) {
313
+ break;
314
+ }
315
+ seen.push(current);
316
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
317
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
318
+ break;
319
+ }
320
+ const props = Object.getOwnPropertyNames(current);
321
+ if (Object.getOwnPropertySymbols) {
322
+ props.push(...Object.getOwnPropertySymbols(current));
323
+ }
324
+ for (const prop of props) {
325
+ if (isUnsafeObjectKey(prop)) {
326
+ continue;
327
+ }
328
+ if (!hasOwnProperty(merged, prop)) {
329
+ result[prop] = thing[prop];
330
+ merged[prop] = true;
331
+ }
332
+ }
333
+ current = prototype2;
334
+ }
335
+ return result;
336
+ };
260
337
  const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
261
338
  const str = toString.call(thing);
262
339
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -287,11 +364,14 @@ const isNumber = typeOfTest("number");
287
364
  const isObject = (thing) => thing !== null && typeof thing === "object";
288
365
  const isBoolean = (thing) => thing === true || thing === false;
289
366
  const isPlainObject = (val) => {
290
- if (kindOf(val) !== "object") {
367
+ if (!isObject(val)) {
291
368
  return false;
292
369
  }
293
370
  const prototype2 = getPrototypeOf(val);
294
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
371
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
372
+ // evidence the value is tagged/iterable, while ignoring members reachable
373
+ // only through shared or terminal prototype boundaries.
374
+ !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
295
375
  };
296
376
  const isEmptyObject = (val) => {
297
377
  if (!isObject(val) || isBuffer(val)) {
@@ -305,13 +385,32 @@ const isEmptyObject = (val) => {
305
385
  };
306
386
  const isDate = kindOfTest("Date");
307
387
  const isFile = kindOfTest("File");
388
+ const isReactNativeBlob = (value) => {
389
+ return !!(value && typeof value.uri !== "undefined");
390
+ };
391
+ const isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
308
392
  const isBlob = kindOfTest("Blob");
309
393
  const isFileList = kindOfTest("FileList");
394
+ const isSet = kindOfTest("Set");
310
395
  const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
396
+ function getGlobal() {
397
+ if (typeof globalThis !== "undefined") return globalThis;
398
+ if (typeof self !== "undefined") return self;
399
+ if (typeof window !== "undefined") return window;
400
+ if (typeof global !== "undefined") return global;
401
+ return {};
402
+ }
403
+ const G = getGlobal();
404
+ const FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
311
405
  const isFormData = (thing) => {
312
- let kind;
313
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
314
- kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
406
+ if (!thing) return false;
407
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
408
+ const proto = getPrototypeOf(thing);
409
+ if (!proto || proto === Object.prototype) return false;
410
+ if (!isFunction$1(thing.append)) return false;
411
+ const kind = kindOf(thing);
412
+ return kind === "formdata" || // detect form-data instance
413
+ kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]";
315
414
  };
316
415
  const isURLSearchParams = kindOfTest("URLSearchParams");
317
416
  const [isReadableStream, isRequest, isResponse, isHeaders] = [
@@ -320,7 +419,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
320
419
  "Response",
321
420
  "Headers"
322
421
  ].map(kindOfTest);
323
- const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
422
+ const trim = (str) => {
423
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
424
+ };
324
425
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
325
426
  if (obj === null || typeof obj === "undefined") {
326
427
  return;
@@ -368,16 +469,17 @@ const _global = (() => {
368
469
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
369
470
  })();
370
471
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
371
- function merge() {
472
+ function merge(...objs) {
372
473
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
373
474
  const result = {};
374
475
  const assignValue = (val, key) => {
375
476
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
376
477
  return;
377
478
  }
378
- const targetKey = caseless && findKey(result, key) || key;
379
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
380
- result[targetKey] = merge(result[targetKey], val);
479
+ const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
480
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
481
+ if (isPlainObject(existing) && isPlainObject(val)) {
482
+ result[targetKey] = merge(existing, val);
381
483
  } else if (isPlainObject(val)) {
382
484
  result[targetKey] = merge({}, val);
383
485
  } else if (isArray(val)) {
@@ -386,8 +488,22 @@ function merge() {
386
488
  result[targetKey] = val;
387
489
  }
388
490
  };
389
- for (let i = 0, l = arguments.length; i < l; i++) {
390
- arguments[i] && forEach(arguments[i], assignValue);
491
+ for (let i = 0, l = objs.length; i < l; i++) {
492
+ const source = objs[i];
493
+ if (!source || isBuffer(source)) {
494
+ continue;
495
+ }
496
+ forEach(source, assignValue);
497
+ if (typeof source !== "object" || isArray(source)) {
498
+ continue;
499
+ }
500
+ const symbols = Object.getOwnPropertySymbols(source);
501
+ for (let j = 0; j < symbols.length; j++) {
502
+ const symbol = symbols[j];
503
+ if (propertyIsEnumerable.call(source, symbol)) {
504
+ assignValue(source[symbol], symbol);
505
+ }
506
+ }
391
507
  }
392
508
  return result;
393
509
  }
@@ -397,6 +513,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
397
513
  (val, key) => {
398
514
  if (thisArg && isFunction$1(val)) {
399
515
  Object.defineProperty(a, key, {
516
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
517
+ // hijack defineProperty's accessor-vs-data resolution.
518
+ __proto__: null,
400
519
  value: bind(val, thisArg),
401
520
  writable: true,
402
521
  enumerable: true,
@@ -404,6 +523,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
404
523
  });
405
524
  } else {
406
525
  Object.defineProperty(a, key, {
526
+ __proto__: null,
407
527
  value: val,
408
528
  writable: true,
409
529
  enumerable: true,
@@ -422,17 +542,16 @@ const stripBOM = (content) => {
422
542
  return content;
423
543
  };
424
544
  const inherits = (constructor, superConstructor, props, descriptors) => {
425
- constructor.prototype = Object.create(
426
- superConstructor.prototype,
427
- descriptors
428
- );
545
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
429
546
  Object.defineProperty(constructor.prototype, "constructor", {
547
+ __proto__: null,
430
548
  value: constructor,
431
549
  writable: true,
432
550
  enumerable: false,
433
551
  configurable: true
434
552
  });
435
553
  Object.defineProperty(constructor, "super", {
554
+ __proto__: null,
436
555
  value: superConstructor.prototype
437
556
  });
438
557
  props && Object.assign(constructor.prototype, props);
@@ -506,7 +625,7 @@ const toCamelCase = (str) => {
506
625
  return p1.toUpperCase() + p2;
507
626
  });
508
627
  };
509
- const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
628
+ const { propertyIsEnumerable } = Object.prototype;
510
629
  const isRegExp = kindOfTest("RegExp");
511
630
  const reduceDescriptors = (obj, reducer) => {
512
631
  const descriptors = Object.getOwnPropertyDescriptors(obj);
@@ -521,7 +640,7 @@ const reduceDescriptors = (obj, reducer) => {
521
640
  };
522
641
  const freezeMethods = (obj) => {
523
642
  reduceDescriptors(obj, (descriptor, name) => {
524
- if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
643
+ if (isFunction$1(obj) && ["arguments", "caller", "callee"].includes(name)) {
525
644
  return false;
526
645
  }
527
646
  const value = obj[name];
@@ -557,29 +676,38 @@ function isSpecCompliantForm(thing) {
557
676
  return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
558
677
  }
559
678
  const toJSONObject = (obj) => {
560
- const stack = new Array(10);
561
- const visit = (source, i) => {
679
+ const visited = /* @__PURE__ */ new WeakSet();
680
+ const visit = (source) => {
562
681
  if (isObject(source)) {
563
- if (stack.indexOf(source) >= 0) {
682
+ if (visited.has(source)) {
564
683
  return;
565
684
  }
566
685
  if (isBuffer(source)) {
567
686
  return source;
568
687
  }
569
688
  if (!("toJSON" in source)) {
570
- stack[i] = source;
571
- const target = isArray(source) ? [] : {};
572
- forEach(source, (value, key) => {
573
- const reducedValue = visit(value, i + 1);
574
- !isUndefined(reducedValue) && (target[key] = reducedValue);
575
- });
576
- stack[i] = void 0;
689
+ visited.add(source);
690
+ let target;
691
+ if (isSet(source)) {
692
+ target = [];
693
+ for (const value of source) {
694
+ const reducedValue = visit(value);
695
+ !isUndefined(reducedValue) && target.push(reducedValue);
696
+ }
697
+ } else {
698
+ target = isArray(source) ? [] : {};
699
+ forEach(source, (value, key) => {
700
+ const reducedValue = visit(value);
701
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
702
+ });
703
+ }
704
+ visited.delete(source);
577
705
  return target;
578
706
  }
579
707
  }
580
708
  return source;
581
709
  };
582
- return visit(obj, 0);
710
+ return visit(obj);
583
711
  };
584
712
  const isAsyncFn = kindOfTest("AsyncFunction");
585
713
  const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
@@ -605,6 +733,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
605
733
  })(typeof setImmediate === "function", isFunction$1(_global.postMessage));
606
734
  const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
607
735
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
736
+ const isSafeIterable = (thing) => thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
608
737
  const utils$1 = {
609
738
  isArray,
610
739
  isArrayBuffer,
@@ -624,6 +753,8 @@ const utils$1 = {
624
753
  isUndefined,
625
754
  isDate,
626
755
  isFile,
756
+ isReactNativeBlob,
757
+ isReactNative,
627
758
  isBlob,
628
759
  isRegExp,
629
760
  isFunction: isFunction$1,
@@ -648,6 +779,9 @@ const utils$1 = {
648
779
  hasOwnProperty,
649
780
  hasOwnProp: hasOwnProperty,
650
781
  // an alias to avoid ESLint no-prototype-builtins detection
782
+ hasOwnInPrototypeChain,
783
+ getSafeProp,
784
+ toSafeFlatObject,
651
785
  reduceDescriptors,
652
786
  freezeMethods,
653
787
  toObjectSet,
@@ -663,195 +797,730 @@ const utils$1 = {
663
797
  isThenable,
664
798
  setImmediate: _setImmediate,
665
799
  asap,
666
- isIterable
800
+ isIterable,
801
+ isSafeIterable
667
802
  };
668
- let AxiosError$1 = class AxiosError extends Error {
669
- static from(error, code, config, request, response, customProps) {
670
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
671
- axiosError.cause = error;
672
- axiosError.name = error.name;
673
- customProps && Object.assign(axiosError, customProps);
674
- return axiosError;
675
- }
676
- /**
677
- * Create an Error with the specified message, config, error code, request and response.
678
- *
679
- * @param {string} message The error message.
680
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
681
- * @param {Object} [config] The config.
682
- * @param {Object} [request] The request.
683
- * @param {Object} [response] The response.
684
- *
685
- * @returns {Error} The created error.
686
- */
687
- constructor(message, code, config, request, response) {
688
- super(message);
689
- this.name = "AxiosError";
690
- this.isAxiosError = true;
691
- code && (this.code = code);
692
- config && (this.config = config);
693
- request && (this.request = request);
694
- if (response) {
695
- this.response = response;
696
- this.status = response.status;
803
+ const ignoreDuplicateOf = utils$1.toObjectSet([
804
+ "age",
805
+ "authorization",
806
+ "content-length",
807
+ "content-type",
808
+ "etag",
809
+ "expires",
810
+ "from",
811
+ "host",
812
+ "if-modified-since",
813
+ "if-unmodified-since",
814
+ "last-modified",
815
+ "location",
816
+ "max-forwards",
817
+ "proxy-authorization",
818
+ "referer",
819
+ "retry-after",
820
+ "user-agent"
821
+ ]);
822
+ const parseHeaders = (rawHeaders) => {
823
+ const parsed = {};
824
+ let key;
825
+ let val;
826
+ let i;
827
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
828
+ i = line.indexOf(":");
829
+ key = line.substring(0, i).trim().toLowerCase();
830
+ val = line.substring(i + 1).trim();
831
+ const hasKey = utils$1.hasOwnProp(parsed, key);
832
+ if (!key || hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key)) {
833
+ return;
834
+ }
835
+ if (key === "set-cookie") {
836
+ if (hasKey) {
837
+ parsed[key].push(val);
838
+ } else {
839
+ parsed[key] = [val];
840
+ }
841
+ } else {
842
+ parsed[key] = hasKey ? parsed[key] + ", " + val : val;
843
+ }
844
+ });
845
+ return parsed;
846
+ };
847
+ function trimSPorHTAB(str) {
848
+ let start = 0;
849
+ let end = str.length;
850
+ while (start < end) {
851
+ const code = str.charCodeAt(start);
852
+ if (code !== 9 && code !== 32) {
853
+ break;
697
854
  }
855
+ start += 1;
698
856
  }
699
- toJSON() {
700
- return {
701
- // Standard
702
- message: this.message,
703
- name: this.name,
704
- // Microsoft
705
- description: this.description,
706
- number: this.number,
707
- // Mozilla
708
- fileName: this.fileName,
709
- lineNumber: this.lineNumber,
710
- columnNumber: this.columnNumber,
711
- stack: this.stack,
712
- // Axios
713
- config: utils$1.toJSONObject(this.config),
714
- code: this.code,
715
- status: this.status
716
- };
857
+ while (end > start) {
858
+ const code = str.charCodeAt(end - 1);
859
+ if (code !== 9 && code !== 32) {
860
+ break;
861
+ }
862
+ end -= 1;
717
863
  }
718
- };
719
- AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
720
- AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
721
- AxiosError$1.ECONNABORTED = "ECONNABORTED";
722
- AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
723
- AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
724
- AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
725
- AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
726
- AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
727
- AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
728
- AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
729
- AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
730
- AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
731
- const httpAdapter = null;
732
- function isVisitable(thing) {
733
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
864
+ return start === 0 && end === str.length ? str : str.slice(start, end);
734
865
  }
735
- function removeBrackets(key) {
736
- return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
866
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
867
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
868
+ function sanitizeValue(value, invalidChars) {
869
+ if (utils$1.isArray(value)) {
870
+ return value.map((item) => sanitizeValue(item, invalidChars));
871
+ }
872
+ return trimSPorHTAB(String(value).replace(invalidChars, ""));
737
873
  }
738
- function renderKey(path, key, dots) {
739
- if (!path) return key;
740
- return path.concat(key).map(function each(token, i) {
741
- token = removeBrackets(token);
742
- return !dots && i ? "[" + token + "]" : token;
743
- }).join(dots ? "." : "");
874
+ const sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
875
+ const sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
876
+ function toByteStringHeaderObject(headers) {
877
+ const byteStringHeaders = /* @__PURE__ */ Object.create(null);
878
+ utils$1.forEach(headers.toJSON(), (value, header) => {
879
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
880
+ });
881
+ return byteStringHeaders;
744
882
  }
745
- function isFlatArray(arr) {
746
- return utils$1.isArray(arr) && !arr.some(isVisitable);
883
+ const $internals$1 = Symbol("internals");
884
+ function normalizeHeader(header) {
885
+ return header && String(header).trim().toLowerCase();
747
886
  }
748
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
749
- return /^is[A-Z]/.test(prop);
750
- });
751
- function toFormData$1(obj, formData, options) {
752
- if (!utils$1.isObject(obj)) {
753
- throw new TypeError("target must be an object");
887
+ function normalizeValue(value) {
888
+ if (value === false || value == null) {
889
+ return value;
754
890
  }
755
- formData = formData || new FormData();
756
- options = utils$1.toFlatObject(options, {
757
- metaTokens: true,
758
- dots: false,
759
- indexes: false
760
- }, false, function defined(option, source) {
761
- return !utils$1.isUndefined(source[option]);
762
- });
763
- const metaTokens = options.metaTokens;
764
- const visitor = options.visitor || defaultVisitor;
765
- const dots = options.dots;
766
- const indexes = options.indexes;
767
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
768
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
769
- if (!utils$1.isFunction(visitor)) {
770
- throw new TypeError("visitor must be a function");
891
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
892
+ }
893
+ function parseTokens(str) {
894
+ const tokens = /* @__PURE__ */ Object.create(null);
895
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
896
+ let match;
897
+ while (match = tokensRE.exec(str)) {
898
+ tokens[match[1]] = match[2];
771
899
  }
772
- function convertValue(value) {
773
- if (value === null) return "";
774
- if (utils$1.isDate(value)) {
775
- return value.toISOString();
776
- }
777
- if (utils$1.isBoolean(value)) {
778
- return value.toString();
779
- }
780
- if (!useBlob && utils$1.isBlob(value)) {
781
- throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
900
+ return tokens;
901
+ }
902
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
903
+ function trimOWS(value) {
904
+ let start = 0;
905
+ let end = value.length;
906
+ while (start < end) {
907
+ const code = value.charCodeAt(start);
908
+ if (code !== 9 && code !== 32) {
909
+ break;
782
910
  }
783
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
784
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
911
+ start += 1;
912
+ }
913
+ while (end > start) {
914
+ const code = value.charCodeAt(end - 1);
915
+ if (code !== 9 && code !== 32) {
916
+ break;
785
917
  }
918
+ end -= 1;
919
+ }
920
+ return start === 0 && end === value.length ? value : value.slice(start, end);
921
+ }
922
+ function decodeQuotedString(value) {
923
+ const last = value.length - 1;
924
+ if (last < 1 || value.charCodeAt(0) !== 34 || value.charCodeAt(last) !== 34) {
786
925
  return value;
787
926
  }
788
- function defaultVisitor(value, key, path) {
789
- let arr = value;
790
- if (value && !path && typeof value === "object") {
791
- if (utils$1.endsWith(key, "{}")) {
792
- key = metaTokens ? key : key.slice(0, -2);
793
- value = JSON.stringify(value);
794
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
795
- key = removeBrackets(key);
796
- arr.forEach(function each(el, index) {
797
- !(utils$1.isUndefined(el) || el === null) && formData.append(
798
- // eslint-disable-next-line no-nested-ternary
799
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
800
- convertValue(el)
801
- );
802
- });
803
- return false;
804
- }
927
+ let decoded = "";
928
+ for (let i = 1; i < last; i++) {
929
+ const code = value.charCodeAt(i);
930
+ if (code === 34) {
931
+ return value;
805
932
  }
806
- if (isVisitable(value)) {
807
- return true;
933
+ if (code === 92) {
934
+ i += 1;
935
+ if (i >= last) {
936
+ return value;
937
+ }
808
938
  }
809
- formData.append(renderKey(path, key, dots), convertValue(value));
810
- return false;
939
+ decoded += value[i];
811
940
  }
812
- const stack = [];
813
- const exposedHelpers = Object.assign(predicates, {
814
- defaultVisitor,
815
- convertValue,
816
- isVisitable
817
- });
818
- function build(value, path) {
819
- if (utils$1.isUndefined(value)) return;
820
- if (stack.indexOf(value) !== -1) {
821
- throw Error("Circular reference detected in " + path.join("."));
941
+ return decoded;
942
+ }
943
+ function parseParameters(value) {
944
+ const parameters = /* @__PURE__ */ Object.create(null);
945
+ const str = String(value);
946
+ let start = 0;
947
+ let quoted = false;
948
+ let escaped = false;
949
+ function parseParameter(end) {
950
+ const part = trimOWS(str.slice(start, end));
951
+ const equals = part.indexOf("=");
952
+ if (equals < 1) {
953
+ return;
822
954
  }
823
- stack.push(value);
824
- utils$1.forEach(value, function each(el, key) {
825
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
826
- formData,
827
- el,
828
- utils$1.isString(key) ? key.trim() : key,
829
- path,
830
- exposedHelpers
831
- );
832
- if (result === true) {
833
- build(el, path ? path.concat(key) : [key]);
955
+ const name = trimOWS(part.slice(0, equals));
956
+ if (!parameterNameRE.test(name)) {
957
+ return;
958
+ }
959
+ const normalizedName = name.toLowerCase();
960
+ if (normalizedName === "__proto__" || normalizedName === "constructor" || normalizedName === "prototype") {
961
+ return;
962
+ }
963
+ const parameterValue = trimOWS(part.slice(equals + 1));
964
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
965
+ }
966
+ for (let i = 0; i < str.length; i++) {
967
+ const code = str.charCodeAt(i);
968
+ if (quoted) {
969
+ if (escaped) {
970
+ escaped = false;
971
+ } else if (code === 92) {
972
+ escaped = true;
973
+ } else if (code === 34) {
974
+ quoted = false;
834
975
  }
835
- });
836
- stack.pop();
837
- }
838
- if (!utils$1.isObject(obj)) {
839
- throw new TypeError("data must be an object");
976
+ } else if (code === 34) {
977
+ quoted = true;
978
+ } else if (code === 44 || code === 59) {
979
+ parseParameter(i);
980
+ start = i + 1;
981
+ }
840
982
  }
841
- build(obj);
842
- return formData;
983
+ parseParameter(str.length);
984
+ return parameters;
843
985
  }
844
- function encode$1(str) {
845
- const charMap = {
846
- "!": "%21",
847
- "'": "%27",
848
- "(": "%28",
849
- ")": "%29",
850
- "~": "%7E",
851
- "%20": "+",
852
- "%00": "\0"
853
- };
854
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
986
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
987
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
988
+ if (utils$1.isFunction(filter2)) {
989
+ return filter2.call(this, value, header);
990
+ }
991
+ if (isHeaderNameFilter) {
992
+ value = header;
993
+ }
994
+ if (!utils$1.isString(value)) return;
995
+ if (utils$1.isString(filter2)) {
996
+ return value.indexOf(filter2) !== -1;
997
+ }
998
+ if (utils$1.isRegExp(filter2)) {
999
+ return filter2.test(value);
1000
+ }
1001
+ }
1002
+ function formatHeader(header) {
1003
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1004
+ return char.toUpperCase() + str;
1005
+ });
1006
+ }
1007
+ function buildAccessors(obj, header) {
1008
+ const accessorName = utils$1.toCamelCase(" " + header);
1009
+ ["get", "set", "has"].forEach((methodName) => {
1010
+ Object.defineProperty(obj, methodName + accessorName, {
1011
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1012
+ // this data descriptor into an accessor descriptor on the way in.
1013
+ __proto__: null,
1014
+ value: function(arg1, arg2, arg3) {
1015
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1016
+ },
1017
+ configurable: true
1018
+ });
1019
+ });
1020
+ }
1021
+ let AxiosHeaders$1 = class AxiosHeaders {
1022
+ constructor(headers) {
1023
+ headers && this.set(headers);
1024
+ }
1025
+ set(header, valueOrRewrite, rewrite) {
1026
+ const self2 = this;
1027
+ function setHeader(_value, _header, _rewrite) {
1028
+ const lHeader = normalizeHeader(_header);
1029
+ if (!lHeader) {
1030
+ return;
1031
+ }
1032
+ const key = utils$1.findKey(self2, lHeader);
1033
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1034
+ self2[key || _header] = normalizeValue(_value);
1035
+ }
1036
+ }
1037
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1038
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1039
+ setHeaders(header, valueOrRewrite);
1040
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1041
+ setHeaders(parseHeaders(header), valueOrRewrite);
1042
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1043
+ let obj = /* @__PURE__ */ Object.create(null), dest, key;
1044
+ for (const entry of header) {
1045
+ if (!utils$1.isArray(entry)) {
1046
+ throw new TypeError("Object iterator must return a key-value pair");
1047
+ }
1048
+ key = entry[0];
1049
+ if (utils$1.hasOwnProp(obj, key)) {
1050
+ dest = obj[key];
1051
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
1052
+ } else {
1053
+ obj[key] = entry[1];
1054
+ }
1055
+ }
1056
+ setHeaders(obj, valueOrRewrite);
1057
+ } else {
1058
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1059
+ }
1060
+ return this;
1061
+ }
1062
+ get(header, parser) {
1063
+ header = normalizeHeader(header);
1064
+ if (header) {
1065
+ const key = utils$1.findKey(this, header);
1066
+ if (key) {
1067
+ const value = this[key];
1068
+ if (!parser) {
1069
+ return value;
1070
+ }
1071
+ if (parser === true) {
1072
+ return parseTokens(value);
1073
+ }
1074
+ if (utils$1.isFunction(parser)) {
1075
+ return parser.call(this, value, key);
1076
+ }
1077
+ if (utils$1.isRegExp(parser)) {
1078
+ return parser.exec(value);
1079
+ }
1080
+ throw new TypeError("parser must be boolean|regexp|function");
1081
+ }
1082
+ }
1083
+ }
1084
+ has(header, matcher) {
1085
+ header = normalizeHeader(header);
1086
+ if (header) {
1087
+ const key = utils$1.findKey(this, header);
1088
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1089
+ }
1090
+ return false;
1091
+ }
1092
+ delete(header, matcher) {
1093
+ const self2 = this;
1094
+ let deleted = false;
1095
+ function deleteHeader(_header) {
1096
+ _header = normalizeHeader(_header);
1097
+ if (_header) {
1098
+ const key = utils$1.findKey(self2, _header);
1099
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1100
+ delete self2[key];
1101
+ deleted = true;
1102
+ }
1103
+ }
1104
+ }
1105
+ if (utils$1.isArray(header)) {
1106
+ header.forEach(deleteHeader);
1107
+ } else {
1108
+ deleteHeader(header);
1109
+ }
1110
+ return deleted;
1111
+ }
1112
+ clear(matcher) {
1113
+ const keys = Object.keys(this);
1114
+ let i = keys.length;
1115
+ let deleted = false;
1116
+ while (i--) {
1117
+ const key = keys[i];
1118
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1119
+ delete this[key];
1120
+ deleted = true;
1121
+ }
1122
+ }
1123
+ return deleted;
1124
+ }
1125
+ normalize(format2) {
1126
+ const self2 = this;
1127
+ const headers = {};
1128
+ utils$1.forEach(this, (value, header) => {
1129
+ const key = utils$1.findKey(headers, header);
1130
+ if (key) {
1131
+ self2[key] = normalizeValue(value);
1132
+ delete self2[header];
1133
+ return;
1134
+ }
1135
+ const normalized = format2 ? formatHeader(header) : String(header).trim();
1136
+ if (normalized !== header) {
1137
+ delete self2[header];
1138
+ }
1139
+ self2[normalized] = normalizeValue(value);
1140
+ headers[normalized] = true;
1141
+ });
1142
+ return this;
1143
+ }
1144
+ concat(...targets) {
1145
+ return this.constructor.concat(this, ...targets);
1146
+ }
1147
+ toJSON(asStrings) {
1148
+ const obj = /* @__PURE__ */ Object.create(null);
1149
+ utils$1.forEach(this, (value, header) => {
1150
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
1151
+ });
1152
+ return obj;
1153
+ }
1154
+ [Symbol.iterator]() {
1155
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1156
+ }
1157
+ toString() {
1158
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1159
+ }
1160
+ getSetCookie() {
1161
+ const value = this.get("set-cookie");
1162
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
1163
+ }
1164
+ get [Symbol.toStringTag]() {
1165
+ return "AxiosHeaders";
1166
+ }
1167
+ static from(thing) {
1168
+ return thing instanceof this ? thing : new this(thing);
1169
+ }
1170
+ static parseParameters(value) {
1171
+ return parseParameters(value);
1172
+ }
1173
+ static concat(first, ...targets) {
1174
+ const computed = new this(first);
1175
+ targets.forEach((target) => computed.set(target));
1176
+ return computed;
1177
+ }
1178
+ static accessor(header) {
1179
+ const internals = this[$internals$1] = this[$internals$1] = {
1180
+ accessors: {}
1181
+ };
1182
+ const accessors = internals.accessors;
1183
+ const prototype2 = this.prototype;
1184
+ function defineAccessor(_header) {
1185
+ const lHeader = normalizeHeader(_header);
1186
+ if (!accessors[lHeader]) {
1187
+ buildAccessors(prototype2, _header);
1188
+ accessors[lHeader] = true;
1189
+ }
1190
+ }
1191
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1192
+ return this;
1193
+ }
1194
+ };
1195
+ AxiosHeaders$1.accessor([
1196
+ "Content-Type",
1197
+ "Content-Length",
1198
+ "Accept",
1199
+ "Accept-Encoding",
1200
+ "User-Agent",
1201
+ "Authorization"
1202
+ ]);
1203
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1204
+ let mapped = key[0].toUpperCase() + key.slice(1);
1205
+ return {
1206
+ get: () => value,
1207
+ set(headerValue) {
1208
+ this[mapped] = headerValue;
1209
+ }
1210
+ };
1211
+ });
1212
+ utils$1.freezeMethods(AxiosHeaders$1);
1213
+ const REDACTED = "[REDACTED ****]";
1214
+ function hasOwnOrPrototypeToJSON(source) {
1215
+ if (utils$1.hasOwnProp(source, "toJSON")) {
1216
+ return true;
1217
+ }
1218
+ let prototype2 = Object.getPrototypeOf(source);
1219
+ while (prototype2 && prototype2 !== Object.prototype) {
1220
+ if (utils$1.hasOwnProp(prototype2, "toJSON")) {
1221
+ return true;
1222
+ }
1223
+ prototype2 = Object.getPrototypeOf(prototype2);
1224
+ }
1225
+ return false;
1226
+ }
1227
+ function redactConfig(config, redactKeys) {
1228
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
1229
+ const seen = [];
1230
+ const visit = (source) => {
1231
+ if (source === null || typeof source !== "object") return source;
1232
+ if (utils$1.isBuffer(source)) return source;
1233
+ if (seen.indexOf(source) !== -1) return void 0;
1234
+ if (source instanceof AxiosHeaders$1) {
1235
+ source = source.toJSON();
1236
+ }
1237
+ seen.push(source);
1238
+ let result;
1239
+ if (utils$1.isArray(source)) {
1240
+ result = [];
1241
+ source.forEach((v, i) => {
1242
+ const reducedValue = visit(v);
1243
+ if (!utils$1.isUndefined(reducedValue)) {
1244
+ result[i] = reducedValue;
1245
+ }
1246
+ });
1247
+ } else {
1248
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1249
+ seen.pop();
1250
+ return source;
1251
+ }
1252
+ result = /* @__PURE__ */ Object.create(null);
1253
+ for (const [key, value] of Object.entries(source)) {
1254
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
1255
+ if (!utils$1.isUndefined(reducedValue)) {
1256
+ result[key] = reducedValue;
1257
+ }
1258
+ }
1259
+ }
1260
+ seen.pop();
1261
+ return result;
1262
+ };
1263
+ return visit(config);
1264
+ }
1265
+ function stringifySafely$1(value) {
1266
+ try {
1267
+ return String(value);
1268
+ } catch (err) {
1269
+ return "";
1270
+ }
1271
+ }
1272
+ function aggregateErrorMessage(error) {
1273
+ const message = error.errors.map((entry) => {
1274
+ try {
1275
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
1276
+ } catch (err) {
1277
+ return "";
1278
+ }
1279
+ }).filter(Boolean).join("; ");
1280
+ return message || error.name || "AggregateError";
1281
+ }
1282
+ let AxiosError$1 = class AxiosError extends Error {
1283
+ static from(error, code, config, request, response, customProps) {
1284
+ let message = error.message;
1285
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
1286
+ message = aggregateErrorMessage(error);
1287
+ }
1288
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
1289
+ Object.defineProperty(axiosError, "cause", {
1290
+ __proto__: null,
1291
+ value: error,
1292
+ writable: true,
1293
+ enumerable: false,
1294
+ configurable: true
1295
+ });
1296
+ axiosError.name = error.name;
1297
+ if (error.status != null && axiosError.status == null) {
1298
+ axiosError.status = error.status;
1299
+ }
1300
+ customProps && Object.assign(axiosError, customProps);
1301
+ return axiosError;
1302
+ }
1303
+ /**
1304
+ * Create an Error with the specified message, config, error code, request and response.
1305
+ *
1306
+ * @param {string} message The error message.
1307
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1308
+ * @param {Object} [config] The config.
1309
+ * @param {Object} [request] The request.
1310
+ * @param {Object} [response] The response.
1311
+ *
1312
+ * @returns {Error} The created error.
1313
+ */
1314
+ constructor(message, code, config, request, response) {
1315
+ super(message);
1316
+ Object.defineProperty(this, "message", {
1317
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1318
+ // this data descriptor into an accessor descriptor on the way in.
1319
+ __proto__: null,
1320
+ value: message,
1321
+ enumerable: true,
1322
+ writable: true,
1323
+ configurable: true
1324
+ });
1325
+ this.name = "AxiosError";
1326
+ this.isAxiosError = true;
1327
+ code && (this.code = code);
1328
+ config && (this.config = config);
1329
+ request && (this.request = request);
1330
+ if (response) {
1331
+ this.response = response;
1332
+ this.status = response.status;
1333
+ }
1334
+ }
1335
+ toJSON() {
1336
+ const config = this.config;
1337
+ const redactKeys = config && utils$1.hasOwnProp(config, "redact") ? config.redact : void 0;
1338
+ const serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
1339
+ return {
1340
+ // Standard
1341
+ message: this.message,
1342
+ name: this.name,
1343
+ // Microsoft
1344
+ description: this.description,
1345
+ number: this.number,
1346
+ // Mozilla
1347
+ fileName: this.fileName,
1348
+ lineNumber: this.lineNumber,
1349
+ columnNumber: this.columnNumber,
1350
+ stack: this.stack,
1351
+ // Axios
1352
+ config: serializedConfig,
1353
+ code: this.code,
1354
+ status: this.status
1355
+ };
1356
+ }
1357
+ };
1358
+ AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
1359
+ AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
1360
+ AxiosError$1.ECONNABORTED = "ECONNABORTED";
1361
+ AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
1362
+ AxiosError$1.ECONNREFUSED = "ECONNREFUSED";
1363
+ AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
1364
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
1365
+ AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
1366
+ AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
1367
+ AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
1368
+ AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
1369
+ AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
1370
+ AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
1371
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
1372
+ const httpAdapter = null;
1373
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1374
+ function isVisitable(thing) {
1375
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1376
+ }
1377
+ function removeBrackets(key) {
1378
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
1379
+ }
1380
+ function renderKey(path, key, dots) {
1381
+ if (!path) return key;
1382
+ return path.concat(key).map(function each(token, i) {
1383
+ token = removeBrackets(token);
1384
+ return !dots && i ? "[" + token + "]" : token;
1385
+ }).join(dots ? "." : "");
1386
+ }
1387
+ function isFlatArray(arr) {
1388
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
1389
+ }
1390
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1391
+ return /^is[A-Z]/.test(prop);
1392
+ });
1393
+ function toFormData$1(obj, formData, options) {
1394
+ if (!utils$1.isObject(obj)) {
1395
+ throw new TypeError("target must be an object");
1396
+ }
1397
+ formData = formData || new FormData();
1398
+ const option = (name, fallback) => {
1399
+ const value = utils$1.getSafeProp(options, name);
1400
+ return utils$1.isUndefined(value) ? fallback : value;
1401
+ };
1402
+ const metaTokens = option("metaTokens", true);
1403
+ const visitor = option("visitor") || defaultVisitor;
1404
+ const dots = option("dots", false);
1405
+ const indexes = option("indexes", false);
1406
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
1407
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
1408
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1409
+ const stack = [];
1410
+ if (!utils$1.isFunction(visitor)) {
1411
+ throw new TypeError("visitor must be a function");
1412
+ }
1413
+ function convertValue(value) {
1414
+ if (value === null) return "";
1415
+ if (utils$1.isDate(value)) {
1416
+ return value.toISOString();
1417
+ }
1418
+ if (utils$1.isBoolean(value)) {
1419
+ return value.toString();
1420
+ }
1421
+ if (!useBlob && utils$1.isBlob(value)) {
1422
+ throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
1423
+ }
1424
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1425
+ if (useBlob && typeof _Blob === "function") {
1426
+ return new _Blob([value]);
1427
+ }
1428
+ throw new AxiosError$1(
1429
+ "Blob is not supported. Use a Buffer instead.",
1430
+ AxiosError$1.ERR_NOT_SUPPORT
1431
+ );
1432
+ }
1433
+ return value;
1434
+ }
1435
+ function throwIfMaxDepthExceeded(depth) {
1436
+ if (depth > maxDepth) {
1437
+ throw new AxiosError$1(
1438
+ "Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
1439
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1440
+ );
1441
+ }
1442
+ }
1443
+ function stringifyWithDepthLimit(value, depth) {
1444
+ if (maxDepth === Infinity) {
1445
+ return JSON.stringify(value);
1446
+ }
1447
+ const ancestors = [];
1448
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1449
+ if (!utils$1.isObject(currentValue)) {
1450
+ return currentValue;
1451
+ }
1452
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1453
+ ancestors.pop();
1454
+ }
1455
+ ancestors.push(currentValue);
1456
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1457
+ return currentValue;
1458
+ });
1459
+ }
1460
+ function defaultVisitor(value, key, path) {
1461
+ let arr = value;
1462
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1463
+ formData.append(renderKey(path, key, dots), convertValue(value));
1464
+ return false;
1465
+ }
1466
+ if (value && !path && typeof value === "object") {
1467
+ if (utils$1.endsWith(key, "{}")) {
1468
+ key = metaTokens ? key : key.slice(0, -2);
1469
+ value = stringifyWithDepthLimit(value, 1);
1470
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
1471
+ key = removeBrackets(key);
1472
+ arr.forEach(function each(el, index) {
1473
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1474
+ // eslint-disable-next-line no-nested-ternary
1475
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
1476
+ convertValue(el)
1477
+ );
1478
+ });
1479
+ return false;
1480
+ }
1481
+ }
1482
+ if (isVisitable(value)) {
1483
+ return true;
1484
+ }
1485
+ formData.append(renderKey(path, key, dots), convertValue(value));
1486
+ return false;
1487
+ }
1488
+ const exposedHelpers = Object.assign(predicates, {
1489
+ defaultVisitor,
1490
+ convertValue,
1491
+ isVisitable
1492
+ });
1493
+ function build(value, path, depth = 0) {
1494
+ if (utils$1.isUndefined(value)) return;
1495
+ throwIfMaxDepthExceeded(depth);
1496
+ if (stack.indexOf(value) !== -1) {
1497
+ throw new Error("Circular reference detected in " + path.join("."));
1498
+ }
1499
+ stack.push(value);
1500
+ utils$1.forEach(value, function each(el, key) {
1501
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1502
+ if (result === true) {
1503
+ build(el, path ? path.concat(key) : [key], depth + 1);
1504
+ }
1505
+ });
1506
+ stack.pop();
1507
+ }
1508
+ if (!utils$1.isObject(obj)) {
1509
+ throw new TypeError("data must be an object");
1510
+ }
1511
+ build(obj);
1512
+ return formData;
1513
+ }
1514
+ function encode$1(str) {
1515
+ const charMap = {
1516
+ "!": "%21",
1517
+ "'": "%27",
1518
+ "(": "%28",
1519
+ ")": "%29",
1520
+ "~": "%7E",
1521
+ "%20": "+"
1522
+ };
1523
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
855
1524
  return charMap[match];
856
1525
  });
857
1526
  }
@@ -864,9 +1533,7 @@ prototype.append = function append(name, value) {
864
1533
  this._pairs.push([name, value]);
865
1534
  };
866
1535
  prototype.toString = function toString2(encoder) {
867
- const _encode = encoder ? function(value) {
868
- return encoder.call(this, value, encode$1);
869
- } : encode$1;
1536
+ const _encode = encoder ? (value) => encoder.call(this, value, encode$1) : encode$1;
870
1537
  return this._pairs.map(function each(pair) {
871
1538
  return _encode(pair[0]) + "=" + _encode(pair[1]);
872
1539
  }, "").join("&");
@@ -878,11 +1545,12 @@ function buildURL(url, params, options) {
878
1545
  if (!params) {
879
1546
  return url;
880
1547
  }
881
- const _encode = options && options.encode || encode;
1548
+ url = url || "";
882
1549
  const _options = utils$1.isFunction(options) ? {
883
1550
  serialize: options
884
1551
  } : options;
885
- const serializeFn = _options && _options.serialize;
1552
+ const _encode = utils$1.getSafeProp(_options, "encode") || encode;
1553
+ const serializeFn = utils$1.getSafeProp(_options, "serialize");
886
1554
  let serializedParams;
887
1555
  if (serializeFn) {
888
1556
  serializedParams = serializeFn(params, _options);
@@ -898,9 +1566,47 @@ function buildURL(url, params, options) {
898
1566
  }
899
1567
  return url;
900
1568
  }
1569
+ const $internals = Symbol("internals");
1570
+ function countHandlers(handlers) {
1571
+ return handlers ? handlers.length : 0;
1572
+ }
1573
+ function trimHandlers(handlers) {
1574
+ if (!handlers) {
1575
+ return;
1576
+ }
1577
+ while (handlers.length && handlers[handlers.length - 1] === null) {
1578
+ handlers.pop();
1579
+ }
1580
+ }
1581
+ function syncHandlerEntries(manager, internals) {
1582
+ const handlers = manager.handlers;
1583
+ const length = countHandlers(handlers);
1584
+ if (handlers !== internals.handlersRef) {
1585
+ internals.handlersRef = handlers;
1586
+ internals.handlerEntries.clear();
1587
+ } else if (length !== internals.handlersLength) {
1588
+ if (!length) {
1589
+ internals.handlerEntries.clear();
1590
+ } else {
1591
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
1592
+ if (handlers[entry.index] !== entry.handler) {
1593
+ internals.handlerEntries.delete(id);
1594
+ }
1595
+ });
1596
+ }
1597
+ }
1598
+ internals.handlersLength = length;
1599
+ }
901
1600
  class InterceptorManager {
902
1601
  constructor() {
903
1602
  this.handlers = [];
1603
+ this[$internals] = {
1604
+ handlersRef: this.handlers,
1605
+ handlersLength: this.handlers.length,
1606
+ handlerEntries: /* @__PURE__ */ new Map(),
1607
+ iterationDepth: 0,
1608
+ nextId: 0
1609
+ };
904
1610
  }
905
1611
  /**
906
1612
  * Add a new interceptor to the stack
@@ -912,13 +1618,25 @@ class InterceptorManager {
912
1618
  * @return {Number} An ID used to remove interceptor later
913
1619
  */
914
1620
  use(fulfilled, rejected, options) {
915
- this.handlers.push({
1621
+ const handler = {
916
1622
  fulfilled,
917
1623
  rejected,
918
1624
  synchronous: options ? options.synchronous : false,
919
1625
  runWhen: options ? options.runWhen : null
1626
+ };
1627
+ const internals = this[$internals];
1628
+ if (this.handlers == null) {
1629
+ this.handlers = [];
1630
+ }
1631
+ syncHandlerEntries(this, internals);
1632
+ const id = internals.nextId++;
1633
+ this.handlers.push(handler);
1634
+ internals.handlerEntries.set(id, {
1635
+ handler,
1636
+ index: this.handlers.length - 1
920
1637
  });
921
- return this.handlers.length - 1;
1638
+ internals.handlersLength = this.handlers.length;
1639
+ return id;
922
1640
  }
923
1641
  /**
924
1642
  * Remove an interceptor from the stack
@@ -928,8 +1646,19 @@ class InterceptorManager {
928
1646
  * @returns {void}
929
1647
  */
930
1648
  eject(id) {
931
- if (this.handlers[id]) {
932
- this.handlers[id] = null;
1649
+ const internals = this[$internals];
1650
+ syncHandlerEntries(this, internals);
1651
+ const entry = internals.handlerEntries.get(id);
1652
+ if (entry) {
1653
+ internals.handlerEntries.delete(id);
1654
+ if (this.handlers[entry.index] !== entry.handler) {
1655
+ return;
1656
+ }
1657
+ this.handlers[entry.index] = null;
1658
+ if (!internals.iterationDepth) {
1659
+ trimHandlers(this.handlers);
1660
+ internals.handlersLength = this.handlers.length;
1661
+ }
933
1662
  }
934
1663
  }
935
1664
  /**
@@ -940,6 +1669,7 @@ class InterceptorManager {
940
1669
  clear() {
941
1670
  if (this.handlers) {
942
1671
  this.handlers = [];
1672
+ syncHandlerEntries(this, this[$internals]);
943
1673
  }
944
1674
  }
945
1675
  /**
@@ -953,18 +1683,31 @@ class InterceptorManager {
953
1683
  * @returns {void}
954
1684
  */
955
1685
  forEach(fn) {
956
- utils$1.forEach(this.handlers, function forEachHandler(h) {
957
- if (h !== null) {
958
- fn(h);
1686
+ const internals = this[$internals];
1687
+ syncHandlerEntries(this, internals);
1688
+ internals.iterationDepth++;
1689
+ try {
1690
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1691
+ if (h !== null) {
1692
+ fn(h);
1693
+ }
1694
+ });
1695
+ } finally {
1696
+ if (!--internals.iterationDepth) {
1697
+ syncHandlerEntries(this, internals);
1698
+ trimHandlers(this.handlers);
1699
+ internals.handlersLength = countHandlers(this.handlers);
959
1700
  }
960
- });
1701
+ }
961
1702
  }
962
1703
  }
963
1704
  const transitionalDefaults = {
964
1705
  silentJSONParsing: true,
965
1706
  forcedJSONParsing: true,
966
1707
  clarifyTimeoutError: false,
967
- legacyInterceptorReqResOrdering: true
1708
+ legacyInterceptorReqResOrdering: true,
1709
+ advertiseZstdAcceptEncoding: false,
1710
+ validateStatusUndefinedResolves: true
968
1711
  };
969
1712
  const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
970
1713
  const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
@@ -1006,435 +1749,202 @@ function toURLEncodedForm(data, options) {
1006
1749
  return false;
1007
1750
  }
1008
1751
  return helpers.defaultVisitor.apply(this, arguments);
1009
- },
1010
- ...options
1011
- });
1012
- }
1013
- function parsePropPath(name) {
1014
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1015
- return match[0] === "[]" ? "" : match[1] || match[0];
1016
- });
1017
- }
1018
- function arrayToObject(arr) {
1019
- const obj = {};
1020
- const keys = Object.keys(arr);
1021
- let i;
1022
- const len = keys.length;
1023
- let key;
1024
- for (i = 0; i < len; i++) {
1025
- key = keys[i];
1026
- obj[key] = arr[key];
1027
- }
1028
- return obj;
1029
- }
1030
- function formDataToJSON(formData) {
1031
- function buildPath(path, value, target, index) {
1032
- let name = path[index++];
1033
- if (name === "__proto__") return true;
1034
- const isNumericKey = Number.isFinite(+name);
1035
- const isLast = index >= path.length;
1036
- name = !name && utils$1.isArray(target) ? target.length : name;
1037
- if (isLast) {
1038
- if (utils$1.hasOwnProp(target, name)) {
1039
- target[name] = [target[name], value];
1040
- } else {
1041
- target[name] = value;
1042
- }
1043
- return !isNumericKey;
1044
- }
1045
- if (!target[name] || !utils$1.isObject(target[name])) {
1046
- target[name] = [];
1047
- }
1048
- const result = buildPath(path, value, target[name], index);
1049
- if (result && utils$1.isArray(target[name])) {
1050
- target[name] = arrayToObject(target[name]);
1051
- }
1052
- return !isNumericKey;
1053
- }
1054
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1055
- const obj = {};
1056
- utils$1.forEachEntry(formData, (name, value) => {
1057
- buildPath(parsePropPath(name), value, obj, 0);
1058
- });
1059
- return obj;
1060
- }
1061
- return null;
1062
- }
1063
- function stringifySafely(rawValue, parser, encoder) {
1064
- if (utils$1.isString(rawValue)) {
1065
- try {
1066
- (parser || JSON.parse)(rawValue);
1067
- return utils$1.trim(rawValue);
1068
- } catch (e) {
1069
- if (e.name !== "SyntaxError") {
1070
- throw e;
1071
- }
1072
- }
1073
- }
1074
- return (encoder || JSON.stringify)(rawValue);
1075
- }
1076
- const defaults = {
1077
- transitional: transitionalDefaults,
1078
- adapter: ["xhr", "http", "fetch"],
1079
- transformRequest: [function transformRequest(data, headers) {
1080
- const contentType = headers.getContentType() || "";
1081
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
1082
- const isObjectPayload = utils$1.isObject(data);
1083
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1084
- data = new FormData(data);
1085
- }
1086
- const isFormData2 = utils$1.isFormData(data);
1087
- if (isFormData2) {
1088
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1089
- }
1090
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1091
- return data;
1092
- }
1093
- if (utils$1.isArrayBufferView(data)) {
1094
- return data.buffer;
1095
- }
1096
- if (utils$1.isURLSearchParams(data)) {
1097
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
1098
- return data.toString();
1099
- }
1100
- let isFileList2;
1101
- if (isObjectPayload) {
1102
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
1103
- return toURLEncodedForm(data, this.formSerializer).toString();
1104
- }
1105
- if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
1106
- const _FormData = this.env && this.env.FormData;
1107
- return toFormData$1(
1108
- isFileList2 ? { "files[]": data } : data,
1109
- _FormData && new _FormData(),
1110
- this.formSerializer
1111
- );
1112
- }
1113
- }
1114
- if (isObjectPayload || hasJSONContentType) {
1115
- headers.setContentType("application/json", false);
1116
- return stringifySafely(data);
1117
- }
1118
- return data;
1119
- }],
1120
- transformResponse: [function transformResponse(data) {
1121
- const transitional2 = this.transitional || defaults.transitional;
1122
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
1123
- const JSONRequested = this.responseType === "json";
1124
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1125
- return data;
1126
- }
1127
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1128
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
1129
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1130
- try {
1131
- return JSON.parse(data, this.parseReviver);
1132
- } catch (e) {
1133
- if (strictJSONParsing) {
1134
- if (e.name === "SyntaxError") {
1135
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1136
- }
1137
- throw e;
1138
- }
1139
- }
1140
- }
1141
- return data;
1142
- }],
1143
- /**
1144
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1145
- * timeout is not created.
1146
- */
1147
- timeout: 0,
1148
- xsrfCookieName: "XSRF-TOKEN",
1149
- xsrfHeaderName: "X-XSRF-TOKEN",
1150
- maxContentLength: -1,
1151
- maxBodyLength: -1,
1152
- env: {
1153
- FormData: platform.classes.FormData,
1154
- Blob: platform.classes.Blob
1155
- },
1156
- validateStatus: function validateStatus(status2) {
1157
- return status2 >= 200 && status2 < 300;
1158
- },
1159
- headers: {
1160
- common: {
1161
- "Accept": "application/json, text/plain, */*",
1162
- "Content-Type": void 0
1163
- }
1164
- }
1165
- };
1166
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
1167
- defaults.headers[method] = {};
1168
- });
1169
- const ignoreDuplicateOf = utils$1.toObjectSet([
1170
- "age",
1171
- "authorization",
1172
- "content-length",
1173
- "content-type",
1174
- "etag",
1175
- "expires",
1176
- "from",
1177
- "host",
1178
- "if-modified-since",
1179
- "if-unmodified-since",
1180
- "last-modified",
1181
- "location",
1182
- "max-forwards",
1183
- "proxy-authorization",
1184
- "referer",
1185
- "retry-after",
1186
- "user-agent"
1187
- ]);
1188
- const parseHeaders = (rawHeaders) => {
1189
- const parsed = {};
1190
- let key;
1191
- let val;
1192
- let i;
1193
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
1194
- i = line.indexOf(":");
1195
- key = line.substring(0, i).trim().toLowerCase();
1196
- val = line.substring(i + 1).trim();
1197
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1198
- return;
1199
- }
1200
- if (key === "set-cookie") {
1201
- if (parsed[key]) {
1202
- parsed[key].push(val);
1203
- } else {
1204
- parsed[key] = [val];
1205
- }
1206
- } else {
1207
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1208
- }
1209
- });
1210
- return parsed;
1211
- };
1212
- const $internals = Symbol("internals");
1213
- function normalizeHeader(header) {
1214
- return header && String(header).trim().toLowerCase();
1215
- }
1216
- function normalizeValue(value) {
1217
- if (value === false || value == null) {
1218
- return value;
1219
- }
1220
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1221
- }
1222
- function parseTokens(str) {
1223
- const tokens = /* @__PURE__ */ Object.create(null);
1224
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1225
- let match;
1226
- while (match = tokensRE.exec(str)) {
1227
- tokens[match[1]] = match[2];
1228
- }
1229
- return tokens;
1230
- }
1231
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1232
- function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1233
- if (utils$1.isFunction(filter2)) {
1234
- return filter2.call(this, value, header);
1235
- }
1236
- if (isHeaderNameFilter) {
1237
- value = header;
1238
- }
1239
- if (!utils$1.isString(value)) return;
1240
- if (utils$1.isString(filter2)) {
1241
- return value.indexOf(filter2) !== -1;
1242
- }
1243
- if (utils$1.isRegExp(filter2)) {
1244
- return filter2.test(value);
1245
- }
1246
- }
1247
- function formatHeader(header) {
1248
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1249
- return char.toUpperCase() + str;
1250
- });
1251
- }
1252
- function buildAccessors(obj, header) {
1253
- const accessorName = utils$1.toCamelCase(" " + header);
1254
- ["get", "set", "has"].forEach((methodName) => {
1255
- Object.defineProperty(obj, methodName + accessorName, {
1256
- value: function(arg1, arg2, arg3) {
1257
- return this[methodName].call(this, header, arg1, arg2, arg3);
1258
- },
1259
- configurable: true
1260
- });
1752
+ },
1753
+ ...options
1261
1754
  });
1262
1755
  }
1263
- let AxiosHeaders$1 = class AxiosHeaders {
1264
- constructor(headers) {
1265
- headers && this.set(headers);
1756
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
1757
+ function throwIfDepthExceeded(index) {
1758
+ if (index > MAX_DEPTH) {
1759
+ throw new AxiosError$1(
1760
+ "FormData field is too deeply nested (" + index + " levels). Max depth: " + MAX_DEPTH,
1761
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1762
+ );
1266
1763
  }
1267
- set(header, valueOrRewrite, rewrite) {
1268
- const self2 = this;
1269
- function setHeader(_value, _header, _rewrite) {
1270
- const lHeader = normalizeHeader(_header);
1271
- if (!lHeader) {
1272
- throw new Error("header name must be a non-empty string");
1273
- }
1274
- const key = utils$1.findKey(self2, lHeader);
1275
- if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1276
- self2[key || _header] = normalizeValue(_value);
1764
+ }
1765
+ function parsePropPath(name) {
1766
+ const path = [];
1767
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
1768
+ let match;
1769
+ while ((match = pattern.exec(name)) !== null) {
1770
+ throwIfDepthExceeded(path.length);
1771
+ path.push(match[0] === "[]" ? "" : match[1] || match[0]);
1772
+ }
1773
+ return path;
1774
+ }
1775
+ function arrayToObject(arr) {
1776
+ const obj = {};
1777
+ const keys = Object.keys(arr);
1778
+ let i;
1779
+ const len = keys.length;
1780
+ let key;
1781
+ for (i = 0; i < len; i++) {
1782
+ key = keys[i];
1783
+ obj[key] = arr[key];
1784
+ }
1785
+ return obj;
1786
+ }
1787
+ function formDataToJSON(formData) {
1788
+ function buildPath(path, value, target, index) {
1789
+ throwIfDepthExceeded(index);
1790
+ let name = path[index++];
1791
+ if (name === "__proto__") return true;
1792
+ const isNumericKey = Number.isFinite(+name);
1793
+ const isLast = index >= path.length;
1794
+ name = !name && utils$1.isArray(target) ? target.length : name;
1795
+ if (isLast) {
1796
+ if (utils$1.hasOwnProp(target, name)) {
1797
+ target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
1798
+ } else {
1799
+ target[name] = value;
1277
1800
  }
1801
+ return !isNumericKey;
1278
1802
  }
1279
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1280
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1281
- setHeaders(header, valueOrRewrite);
1282
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1283
- setHeaders(parseHeaders(header), valueOrRewrite);
1284
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1285
- let obj = {}, dest, key;
1286
- for (const entry of header) {
1287
- if (!utils$1.isArray(entry)) {
1288
- throw TypeError("Object iterator must return a key-value pair");
1289
- }
1290
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1291
- }
1292
- setHeaders(obj, valueOrRewrite);
1293
- } else {
1294
- header != null && setHeader(valueOrRewrite, header, rewrite);
1803
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
1804
+ target[name] = [];
1295
1805
  }
1296
- return this;
1297
- }
1298
- get(header, parser) {
1299
- header = normalizeHeader(header);
1300
- if (header) {
1301
- const key = utils$1.findKey(this, header);
1302
- if (key) {
1303
- const value = this[key];
1304
- if (!parser) {
1305
- return value;
1306
- }
1307
- if (parser === true) {
1308
- return parseTokens(value);
1309
- }
1310
- if (utils$1.isFunction(parser)) {
1311
- return parser.call(this, value, key);
1312
- }
1313
- if (utils$1.isRegExp(parser)) {
1314
- return parser.exec(value);
1315
- }
1316
- throw new TypeError("parser must be boolean|regexp|function");
1317
- }
1806
+ const result = buildPath(path, value, target[name], index);
1807
+ if (result && utils$1.isArray(target[name])) {
1808
+ target[name] = arrayToObject(target[name]);
1318
1809
  }
1810
+ return !isNumericKey;
1319
1811
  }
1320
- has(header, matcher) {
1321
- header = normalizeHeader(header);
1322
- if (header) {
1323
- const key = utils$1.findKey(this, header);
1324
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1325
- }
1326
- return false;
1812
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1813
+ const obj = {};
1814
+ utils$1.forEachEntry(formData, (name, value) => {
1815
+ buildPath(parsePropPath(name), value, obj, 0);
1816
+ });
1817
+ return obj;
1327
1818
  }
1328
- delete(header, matcher) {
1329
- const self2 = this;
1330
- let deleted = false;
1331
- function deleteHeader(_header) {
1332
- _header = normalizeHeader(_header);
1333
- if (_header) {
1334
- const key = utils$1.findKey(self2, _header);
1335
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1336
- delete self2[key];
1337
- deleted = true;
1338
- }
1819
+ return null;
1820
+ }
1821
+ const methodList = Object.freeze([
1822
+ "get",
1823
+ "delete",
1824
+ "head",
1825
+ "options",
1826
+ "post",
1827
+ "put",
1828
+ "patch",
1829
+ "purge",
1830
+ "link",
1831
+ "unlink",
1832
+ "query"
1833
+ ]);
1834
+ const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
1835
+ function stringifySafely(rawValue, parser, encoder) {
1836
+ if (utils$1.isString(rawValue)) {
1837
+ try {
1838
+ (parser || JSON.parse)(rawValue);
1839
+ return utils$1.trim(rawValue);
1840
+ } catch (e) {
1841
+ if (e.name !== "SyntaxError") {
1842
+ throw e;
1339
1843
  }
1340
1844
  }
1341
- if (utils$1.isArray(header)) {
1342
- header.forEach(deleteHeader);
1343
- } else {
1344
- deleteHeader(header);
1345
- }
1346
- return deleted;
1347
1845
  }
1348
- clear(matcher) {
1349
- const keys = Object.keys(this);
1350
- let i = keys.length;
1351
- let deleted = false;
1352
- while (i--) {
1353
- const key = keys[i];
1354
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1355
- delete this[key];
1356
- deleted = true;
1846
+ return (encoder || JSON.stringify)(rawValue);
1847
+ }
1848
+ const defaults = {
1849
+ transitional: transitionalDefaults,
1850
+ adapter: ["xhr", "http", "fetch"],
1851
+ transformRequest: [
1852
+ function transformRequest(data, headers) {
1853
+ const contentType = headers.getContentType() || "";
1854
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
1855
+ const isObjectPayload = utils$1.isObject(data);
1856
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1857
+ data = new FormData(data);
1357
1858
  }
1358
- }
1359
- return deleted;
1360
- }
1361
- normalize(format2) {
1362
- const self2 = this;
1363
- const headers = {};
1364
- utils$1.forEach(this, (value, header) => {
1365
- const key = utils$1.findKey(headers, header);
1366
- if (key) {
1367
- self2[key] = normalizeValue(value);
1368
- delete self2[header];
1369
- return;
1859
+ const isFormData2 = utils$1.isFormData(data);
1860
+ if (isFormData2) {
1861
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1370
1862
  }
1371
- const normalized = format2 ? formatHeader(header) : String(header).trim();
1372
- if (normalized !== header) {
1373
- delete self2[header];
1863
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1864
+ return data;
1374
1865
  }
1375
- self2[normalized] = normalizeValue(value);
1376
- headers[normalized] = true;
1377
- });
1378
- return this;
1379
- }
1380
- concat(...targets) {
1381
- return this.constructor.concat(this, ...targets);
1382
- }
1383
- toJSON(asStrings) {
1384
- const obj = /* @__PURE__ */ Object.create(null);
1385
- utils$1.forEach(this, (value, header) => {
1386
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
1387
- });
1388
- return obj;
1389
- }
1390
- [Symbol.iterator]() {
1391
- return Object.entries(this.toJSON())[Symbol.iterator]();
1392
- }
1393
- toString() {
1394
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1395
- }
1396
- getSetCookie() {
1397
- return this.get("set-cookie") || [];
1398
- }
1399
- get [Symbol.toStringTag]() {
1400
- return "AxiosHeaders";
1401
- }
1402
- static from(thing) {
1403
- return thing instanceof this ? thing : new this(thing);
1404
- }
1405
- static concat(first, ...targets) {
1406
- const computed = new this(first);
1407
- targets.forEach((target) => computed.set(target));
1408
- return computed;
1409
- }
1410
- static accessor(header) {
1411
- const internals = this[$internals] = this[$internals] = {
1412
- accessors: {}
1413
- };
1414
- const accessors = internals.accessors;
1415
- const prototype2 = this.prototype;
1416
- function defineAccessor(_header) {
1417
- const lHeader = normalizeHeader(_header);
1418
- if (!accessors[lHeader]) {
1419
- buildAccessors(prototype2, _header);
1420
- accessors[lHeader] = true;
1866
+ if (utils$1.isArrayBufferView(data)) {
1867
+ return data.buffer;
1868
+ }
1869
+ if (utils$1.isURLSearchParams(data)) {
1870
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
1871
+ return data.toString();
1872
+ }
1873
+ let isFileList2;
1874
+ if (isObjectPayload) {
1875
+ const formSerializer = own(this, "formSerializer");
1876
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
1877
+ return toURLEncodedForm(data, formSerializer).toString();
1878
+ }
1879
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
1880
+ const env = own(this, "env");
1881
+ const _FormData = env && env.FormData;
1882
+ return toFormData$1(
1883
+ isFileList2 ? { "files[]": data } : data,
1884
+ _FormData && new _FormData(),
1885
+ formSerializer
1886
+ );
1887
+ }
1888
+ }
1889
+ if (isObjectPayload || hasJSONContentType) {
1890
+ headers.setContentType("application/json", false);
1891
+ return stringifySafely(data);
1421
1892
  }
1893
+ return data;
1894
+ }
1895
+ ],
1896
+ transformResponse: [
1897
+ function transformResponse(data) {
1898
+ const transitional2 = own(this, "transitional") || defaults.transitional;
1899
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
1900
+ const responseType = own(this, "responseType");
1901
+ const JSONRequested = responseType === "json";
1902
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1903
+ return data;
1904
+ }
1905
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
1906
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
1907
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1908
+ try {
1909
+ return JSON.parse(data, own(this, "parseReviver"));
1910
+ } catch (e) {
1911
+ if (strictJSONParsing) {
1912
+ if (e.name === "SyntaxError") {
1913
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, "response"));
1914
+ }
1915
+ throw e;
1916
+ }
1917
+ }
1918
+ }
1919
+ return data;
1920
+ }
1921
+ ],
1922
+ /**
1923
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1924
+ * timeout is not created.
1925
+ */
1926
+ timeout: 0,
1927
+ xsrfCookieName: "XSRF-TOKEN",
1928
+ xsrfHeaderName: "X-XSRF-TOKEN",
1929
+ maxContentLength: -1,
1930
+ maxBodyLength: -1,
1931
+ env: {
1932
+ FormData: platform.classes.FormData,
1933
+ Blob: platform.classes.Blob
1934
+ },
1935
+ validateStatus: function validateStatus(status2) {
1936
+ return status2 >= 200 && status2 < 300;
1937
+ },
1938
+ headers: {
1939
+ common: {
1940
+ Accept: "application/json, text/plain, */*",
1941
+ "Content-Type": void 0
1422
1942
  }
1423
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1424
- return this;
1425
1943
  }
1426
1944
  };
1427
- AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1428
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1429
- let mapped = key[0].toUpperCase() + key.slice(1);
1430
- return {
1431
- get: () => value,
1432
- set(headerValue) {
1433
- this[mapped] = headerValue;
1434
- }
1435
- };
1945
+ utils$1.forEach(methodList, (method) => {
1946
+ defaults.headers[method] = {};
1436
1947
  });
1437
- utils$1.freezeMethods(AxiosHeaders$1);
1438
1948
  function transformData(fns, response) {
1439
1949
  const config = this || defaults;
1440
1950
  const context = response || config;
@@ -1472,15 +1982,26 @@ function settle(resolve, reject, response) {
1472
1982
  } else {
1473
1983
  reject(new AxiosError$1(
1474
1984
  "Request failed with status code " + response.status,
1475
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1985
+ response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
1476
1986
  response.config,
1477
1987
  response.request,
1478
1988
  response
1479
1989
  ));
1480
1990
  }
1481
1991
  }
1992
+ const urlParserControlCharacters = /[\t\n\r]/g;
1993
+ function normalizeURLForProtocolCheck(url) {
1994
+ if (typeof url !== "string") {
1995
+ return url;
1996
+ }
1997
+ let start = 0;
1998
+ while (start < url.length && url.charCodeAt(start) <= 32) {
1999
+ start++;
2000
+ }
2001
+ return url.slice(start).replace(urlParserControlCharacters, "");
2002
+ }
1482
2003
  function parseProtocol(url) {
1483
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2004
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
1484
2005
  return match && match[1] || "";
1485
2006
  }
1486
2007
  function speedometer(samplesCount, min) {
@@ -1546,25 +2067,29 @@ function throttle(fn, freq) {
1546
2067
  }
1547
2068
  };
1548
2069
  const flush = () => lastArgs && invoke(lastArgs);
1549
- return [throttled, flush];
2070
+ const flushWith = (...args) => invoke(args);
2071
+ return [throttled, flush, flushWith];
1550
2072
  }
1551
2073
  const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1552
2074
  let bytesNotified = 0;
1553
2075
  const _speedometer = speedometer(50, 250);
1554
2076
  return throttle((e) => {
1555
- const loaded = e.loaded;
2077
+ if (!e || !utils$1.isNumber(e.loaded)) {
2078
+ return;
2079
+ }
2080
+ const rawLoaded = e.loaded;
1556
2081
  const total = e.lengthComputable ? e.total : void 0;
1557
- const progressBytes = loaded - bytesNotified;
2082
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
2083
+ const progressBytes = Math.max(0, loaded - bytesNotified);
1558
2084
  const rate = _speedometer(progressBytes);
1559
- const inRange = loaded <= total;
1560
- bytesNotified = loaded;
2085
+ bytesNotified = Math.max(bytesNotified, loaded);
1561
2086
  const data = {
1562
2087
  loaded,
1563
2088
  total,
1564
2089
  progress: total ? loaded / total : void 0,
1565
2090
  bytes: progressBytes,
1566
2091
  rate: rate ? rate : void 0,
1567
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
2092
+ estimated: rate && total ? (total - loaded) / rate : void 0,
1568
2093
  event: e,
1569
2094
  lengthComputable: total != null,
1570
2095
  [isDownloadStream ? "download" : "upload"]: true
@@ -1574,13 +2099,16 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1574
2099
  };
1575
2100
  const progressEventDecorator = (total, throttled) => {
1576
2101
  const lengthComputable = total != null;
1577
- return [(loaded) => throttled[0]({
1578
- lengthComputable,
1579
- total,
1580
- loaded
1581
- }), throttled[1]];
2102
+ return [
2103
+ (loaded) => throttled[0]({
2104
+ lengthComputable,
2105
+ total,
2106
+ loaded
2107
+ }),
2108
+ throttled[1]
2109
+ ];
1582
2110
  };
1583
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2111
+ const asyncDecorator = (fn, scheduler = utils$1.asap) => (...args) => scheduler(() => fn(...args));
1584
2112
  const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
1585
2113
  url = new URL(url, platform.origin);
1586
2114
  return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
@@ -1613,8 +2141,19 @@ const cookies = platform.hasStandardBrowserEnv ? (
1613
2141
  },
1614
2142
  read(name) {
1615
2143
  if (typeof document === "undefined") return null;
1616
- const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
1617
- return match ? decodeURIComponent(match[1]) : null;
2144
+ const cookies2 = document.cookie.split(";");
2145
+ for (let i = 0; i < cookies2.length; i++) {
2146
+ const cookie = cookies2[i].replace(/^\s+/, "");
2147
+ const eq = cookie.indexOf("=");
2148
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
2149
+ try {
2150
+ return decodeURIComponent(cookie.slice(eq + 1));
2151
+ } catch (e) {
2152
+ return cookie.slice(eq + 1);
2153
+ }
2154
+ }
2155
+ }
2156
+ return null;
1618
2157
  },
1619
2158
  remove(name) {
1620
2159
  this.write(name, "", Date.now() - 864e5, "/");
@@ -1639,19 +2178,82 @@ function isAbsoluteURL(url) {
1639
2178
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1640
2179
  }
1641
2180
  function combineURLs(baseURL, relativeURL) {
1642
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
2181
+ if (!relativeURL) {
2182
+ return baseURL;
2183
+ }
2184
+ let end = baseURL.length;
2185
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
2186
+ end--;
2187
+ }
2188
+ return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
2189
+ }
2190
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
2191
+ function redactFragment(fragment) {
2192
+ if (!fragment) {
2193
+ return fragment;
2194
+ }
2195
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = "") => {
2196
+ return `${separator}${parameterName}${REDACTED}`;
2197
+ });
2198
+ }
2199
+ function redactSensitiveURLParts(url) {
2200
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
2201
+ const fragmentIndex = redactedURL.indexOf("#");
2202
+ const urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
2203
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
2204
+ /([?&][^=&#]*=)[^&#]*/g,
2205
+ `$1${REDACTED}`
2206
+ );
2207
+ if (fragmentIndex === -1) {
2208
+ return redactedURLWithoutFragment;
2209
+ }
2210
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
2211
+ }
2212
+ function assertValidHttpProtocolURL(url, config) {
2213
+ if (typeof url === "string") {
2214
+ const normalizedURL = normalizeURLForProtocolCheck(url);
2215
+ if (malformedHttpProtocol.test(normalizedURL)) {
2216
+ throw new AxiosError$1(
2217
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
2218
+ AxiosError$1.ERR_INVALID_URL,
2219
+ config
2220
+ );
2221
+ }
2222
+ }
1643
2223
  }
1644
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2224
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2225
+ assertValidHttpProtocolURL(requestedURL, config);
1645
2226
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
1646
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2227
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2228
+ assertValidHttpProtocolURL(baseURL, config);
1647
2229
  return combineURLs(baseURL, requestedURL);
1648
2230
  }
1649
2231
  return requestedURL;
1650
2232
  }
1651
2233
  const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2234
+ const ownEnumerableKeys = (thing) => {
2235
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
2236
+ return Object.keys(thing).concat(
2237
+ Object.getOwnPropertySymbols(thing).filter(
2238
+ (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
2239
+ )
2240
+ );
2241
+ }
2242
+ return Object.keys(thing);
2243
+ };
1652
2244
  function mergeConfig$1(config1, config2) {
2245
+ config1 = config1 || {};
1653
2246
  config2 = config2 || {};
1654
- const config = {};
2247
+ const config = /* @__PURE__ */ Object.create(null);
2248
+ Object.defineProperty(config, "hasOwnProperty", {
2249
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2250
+ // this data descriptor into an accessor descriptor on the way in.
2251
+ __proto__: null,
2252
+ value: Object.prototype.hasOwnProperty,
2253
+ enumerable: false,
2254
+ writable: true,
2255
+ configurable: true
2256
+ });
1655
2257
  function getMergedValue(target, source, prop, caseless) {
1656
2258
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
1657
2259
  return utils$1.merge.call({ caseless }, target, source);
@@ -1681,10 +2283,27 @@ function mergeConfig$1(config1, config2) {
1681
2283
  return getMergedValue(void 0, a);
1682
2284
  }
1683
2285
  }
2286
+ function getMergedTransitionalOption(prop) {
2287
+ const transitional2 = utils$1.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
2288
+ if (!utils$1.isUndefined(transitional2)) {
2289
+ if (utils$1.isPlainObject(transitional2)) {
2290
+ if (utils$1.hasOwnProp(transitional2, prop)) {
2291
+ return transitional2[prop];
2292
+ }
2293
+ } else {
2294
+ return void 0;
2295
+ }
2296
+ }
2297
+ const transitional1 = utils$1.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
2298
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2299
+ return transitional1[prop];
2300
+ }
2301
+ return void 0;
2302
+ }
1684
2303
  function mergeDirectKeys(a, b, prop) {
1685
- if (prop in config2) {
2304
+ if (utils$1.hasOwnProp(config2, prop)) {
1686
2305
  return getMergedValue(a, b);
1687
- } else if (prop in config1) {
2306
+ } else if (utils$1.hasOwnProp(config1, prop)) {
1688
2307
  return getMergedValue(void 0, a);
1689
2308
  }
1690
2309
  }
@@ -1697,7 +2316,7 @@ function mergeConfig$1(config1, config2) {
1697
2316
  transformResponse: defaultToConfig2,
1698
2317
  paramsSerializer: defaultToConfig2,
1699
2318
  timeout: defaultToConfig2,
1700
- timeoutMessage: defaultToConfig2,
2319
+ timeoutErrorMessage: defaultToConfig2,
1701
2320
  withCredentials: defaultToConfig2,
1702
2321
  withXSRFToken: defaultToConfig2,
1703
2322
  adapter: defaultToConfig2,
@@ -1715,49 +2334,88 @@ function mergeConfig$1(config1, config2) {
1715
2334
  httpsAgent: defaultToConfig2,
1716
2335
  cancelToken: defaultToConfig2,
1717
2336
  socketPath: defaultToConfig2,
2337
+ allowedSocketPaths: defaultToConfig2,
1718
2338
  responseEncoding: defaultToConfig2,
1719
2339
  validateStatus: mergeDirectKeys,
1720
2340
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
1721
2341
  };
1722
- utils$1.forEach(
1723
- Object.keys({ ...config1, ...config2 }),
1724
- function computeConfigValue(prop) {
1725
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
1726
- return;
1727
- const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
1728
- const configValue = merge2(config1[prop], config2[prop], prop);
1729
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2342
+ utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2343
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
2344
+ const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2345
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : void 0;
2346
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : void 0;
2347
+ const configValue = merge2(a, b, prop);
2348
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2349
+ });
2350
+ if (utils$1.hasOwnProp(config2, "validateStatus") && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
2351
+ if (utils$1.hasOwnProp(config1, "validateStatus")) {
2352
+ config.validateStatus = getMergedValue(void 0, config1.validateStatus);
2353
+ } else {
2354
+ delete config.validateStatus;
1730
2355
  }
1731
- );
2356
+ }
1732
2357
  return config;
1733
2358
  }
1734
- const resolveConfig = (config) => {
2359
+ const FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
2360
+ function setFormDataHeaders(headers, formHeaders, policy) {
2361
+ if (policy !== "content-only") {
2362
+ headers.set(formHeaders);
2363
+ return;
2364
+ }
2365
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
2366
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2367
+ headers.set(key, val);
2368
+ }
2369
+ });
2370
+ }
2371
+ const encodeUTF8$1 = (str) => encodeURIComponent(str).replace(
2372
+ /%([0-9A-F]{2})/gi,
2373
+ (_, hex) => String.fromCharCode(parseInt(hex, 16))
2374
+ );
2375
+ function resolveConfig(config) {
1735
2376
  const newConfig = mergeConfig$1({}, config);
1736
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth: auth2 } = newConfig;
2377
+ const own2 = (key) => utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
2378
+ const data = own2("data");
2379
+ let withXSRFToken = own2("withXSRFToken");
2380
+ const xsrfHeaderName = own2("xsrfHeaderName");
2381
+ const xsrfCookieName = own2("xsrfCookieName");
2382
+ let headers = own2("headers");
2383
+ const auth2 = own2("auth");
2384
+ const baseURL = own2("baseURL");
2385
+ const allowAbsoluteUrls = own2("allowAbsoluteUrls");
2386
+ const url = own2("url");
1737
2387
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
1738
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2388
+ newConfig.url = buildURL(
2389
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
2390
+ own2("params"),
2391
+ own2("paramsSerializer")
2392
+ );
1739
2393
  if (auth2) {
1740
- headers.set(
1741
- "Authorization",
1742
- "Basic " + btoa((auth2.username || "") + ":" + (auth2.password ? unescape(encodeURIComponent(auth2.password)) : ""))
1743
- );
2394
+ const username = utils$1.getSafeProp(auth2, "username") || "";
2395
+ const password = utils$1.getSafeProp(auth2, "password") || "";
2396
+ try {
2397
+ headers.set(
2398
+ "Authorization",
2399
+ "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
2400
+ );
2401
+ } catch (e) {
2402
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
2403
+ }
1744
2404
  }
1745
2405
  if (utils$1.isFormData(data)) {
1746
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2406
+ const getHeaders = utils$1.getSafeProp(data, "getHeaders");
2407
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
1747
2408
  headers.setContentType(void 0);
1748
- } else if (utils$1.isFunction(data.getHeaders)) {
1749
- const formHeaders = data.getHeaders();
1750
- const allowedHeaders = ["content-type", "content-length"];
1751
- Object.entries(formHeaders).forEach(([key, val]) => {
1752
- if (allowedHeaders.includes(key.toLowerCase())) {
1753
- headers.set(key, val);
1754
- }
1755
- });
2409
+ } else if (utils$1.isFunction(getHeaders)) {
2410
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
1756
2411
  }
1757
2412
  }
1758
2413
  if (platform.hasStandardBrowserEnv) {
1759
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
1760
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2414
+ if (utils$1.isFunction(withXSRFToken)) {
2415
+ withXSRFToken = withXSRFToken(newConfig);
2416
+ }
2417
+ const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
2418
+ if (shouldSendXSRF) {
1761
2419
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
1762
2420
  if (xsrfValue) {
1763
2421
  headers.set(xsrfHeaderName, xsrfValue);
@@ -1765,7 +2423,7 @@ const resolveConfig = (config) => {
1765
2423
  }
1766
2424
  }
1767
2425
  return newConfig;
1768
- };
2426
+ }
1769
2427
  const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
1770
2428
  const xhrAdapter = isXHRAdapterSupported && function(config) {
1771
2429
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -1775,7 +2433,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1775
2433
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
1776
2434
  let onCanceled;
1777
2435
  let uploadThrottled, downloadThrottled;
1778
- let flushUpload, flushDownload;
2436
+ let flushUpload, flushDownload, flushDownloadWithEvent;
1779
2437
  function done() {
1780
2438
  flushUpload && flushUpload();
1781
2439
  flushDownload && flushDownload();
@@ -1785,7 +2443,27 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1785
2443
  let request = new XMLHttpRequest();
1786
2444
  request.open(_config.method.toUpperCase(), _config.url, true);
1787
2445
  request.timeout = _config.timeout;
1788
- function onloadend() {
2446
+ function onloadend(event) {
2447
+ if (!request) {
2448
+ return;
2449
+ }
2450
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
2451
+ reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
2452
+ done();
2453
+ request = null;
2454
+ return;
2455
+ }
2456
+ try {
2457
+ if (event) {
2458
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
2459
+ } else {
2460
+ flushDownload && flushDownload();
2461
+ }
2462
+ } catch (err) {
2463
+ setTimeout(() => {
2464
+ throw err;
2465
+ });
2466
+ }
1789
2467
  if (!request) {
1790
2468
  return;
1791
2469
  }
@@ -1801,13 +2479,17 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1801
2479
  config,
1802
2480
  request
1803
2481
  };
1804
- settle(function _resolve(value) {
1805
- resolve(value);
1806
- done();
1807
- }, function _reject(err) {
1808
- reject(err);
1809
- done();
1810
- }, response);
2482
+ settle(
2483
+ function _resolve(value) {
2484
+ resolve(value);
2485
+ done();
2486
+ },
2487
+ function _reject(err) {
2488
+ reject(err);
2489
+ done();
2490
+ },
2491
+ response
2492
+ );
1811
2493
  request = null;
1812
2494
  }
1813
2495
  if ("onloadend" in request) {
@@ -1817,7 +2499,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1817
2499
  if (!request || request.readyState !== 4) {
1818
2500
  return;
1819
2501
  }
1820
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
2502
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith("file:"))) {
1821
2503
  return;
1822
2504
  }
1823
2505
  setTimeout(onloadend);
@@ -1828,6 +2510,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1828
2510
  return;
1829
2511
  }
1830
2512
  reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
2513
+ done();
1831
2514
  request = null;
1832
2515
  };
1833
2516
  request.onerror = function handleError(event) {
@@ -1835,6 +2518,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1835
2518
  const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
1836
2519
  err.event = event || null;
1837
2520
  reject(err);
2521
+ done();
1838
2522
  request = null;
1839
2523
  };
1840
2524
  request.ontimeout = function handleTimeout() {
@@ -1843,17 +2527,20 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1843
2527
  if (_config.timeoutErrorMessage) {
1844
2528
  timeoutErrorMessage = _config.timeoutErrorMessage;
1845
2529
  }
1846
- reject(new AxiosError$1(
1847
- timeoutErrorMessage,
1848
- transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
1849
- config,
1850
- request
1851
- ));
2530
+ reject(
2531
+ new AxiosError$1(
2532
+ timeoutErrorMessage,
2533
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2534
+ config,
2535
+ request
2536
+ )
2537
+ );
2538
+ done();
1852
2539
  request = null;
1853
2540
  };
1854
2541
  requestData === void 0 && requestHeaders.setContentType(null);
1855
2542
  if ("setRequestHeader" in request) {
1856
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2543
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
1857
2544
  request.setRequestHeader(key, val);
1858
2545
  });
1859
2546
  }
@@ -1864,7 +2551,10 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1864
2551
  request.responseType = _config.responseType;
1865
2552
  }
1866
2553
  if (onDownloadProgress) {
1867
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
2554
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
2555
+ onDownloadProgress,
2556
+ true
2557
+ );
1868
2558
  request.addEventListener("progress", downloadThrottled);
1869
2559
  }
1870
2560
  if (onUploadProgress && request.upload) {
@@ -1879,6 +2569,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1879
2569
  }
1880
2570
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
1881
2571
  request.abort();
2572
+ done();
1882
2573
  request = null;
1883
2574
  };
1884
2575
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -1887,45 +2578,65 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1887
2578
  }
1888
2579
  }
1889
2580
  const protocol = parseProtocol(_config.url);
1890
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
1891
- reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
2581
+ if (protocol && !platform.protocols.includes(protocol)) {
2582
+ reject(
2583
+ new AxiosError$1(
2584
+ "Unsupported protocol " + protocol + ":",
2585
+ AxiosError$1.ERR_BAD_REQUEST,
2586
+ config
2587
+ )
2588
+ );
2589
+ done();
1892
2590
  return;
1893
2591
  }
1894
2592
  request.send(requestData || null);
1895
2593
  });
1896
2594
  };
1897
2595
  const composeSignals = (signals, timeout) => {
1898
- const { length } = signals = signals ? signals.filter(Boolean) : [];
1899
- if (timeout || length) {
1900
- let controller = new AbortController();
1901
- let aborted;
1902
- const onabort = function(reason) {
1903
- if (!aborted) {
1904
- aborted = true;
1905
- unsubscribe();
1906
- const err = reason instanceof Error ? reason : this.reason;
1907
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
1908
- }
1909
- };
1910
- let timer = timeout && setTimeout(() => {
1911
- timer = null;
1912
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
1913
- }, timeout);
1914
- const unsubscribe = () => {
1915
- if (signals) {
1916
- timer && clearTimeout(timer);
1917
- timer = null;
1918
- signals.forEach((signal2) => {
1919
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
1920
- });
1921
- signals = null;
1922
- }
1923
- };
1924
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
1925
- const { signal } = controller;
1926
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
1927
- return signal;
2596
+ signals = signals ? signals.filter(Boolean) : [];
2597
+ if (!timeout && !signals.length) {
2598
+ return;
1928
2599
  }
2600
+ const controller = new AbortController();
2601
+ let aborted = false;
2602
+ const onabort = function(reason) {
2603
+ if (!aborted) {
2604
+ aborted = true;
2605
+ unsubscribe();
2606
+ const err = reason instanceof Error ? reason : this.reason;
2607
+ controller.abort(
2608
+ err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
2609
+ );
2610
+ }
2611
+ };
2612
+ let timer = timeout && setTimeout(() => {
2613
+ timer = null;
2614
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
2615
+ }, timeout);
2616
+ const unsubscribe = () => {
2617
+ if (!signals) {
2618
+ return;
2619
+ }
2620
+ timer && clearTimeout(timer);
2621
+ timer = null;
2622
+ signals.forEach((signal2) => {
2623
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
2624
+ });
2625
+ signals = null;
2626
+ };
2627
+ signals.forEach((signal2) => {
2628
+ if (aborted) {
2629
+ return;
2630
+ }
2631
+ if (signal2.aborted) {
2632
+ onabort.call(signal2);
2633
+ return;
2634
+ }
2635
+ signal2.addEventListener("abort", onabort, { once: true });
2636
+ });
2637
+ const { signal } = controller;
2638
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
2639
+ return signal;
1929
2640
  };
1930
2641
  const streamChunk = function* (chunk, chunkSize) {
1931
2642
  let len = chunk.byteLength;
@@ -1974,44 +2685,163 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
1974
2685
  onFinish && onFinish(e);
1975
2686
  }
1976
2687
  };
1977
- return new ReadableStream({
1978
- async pull(controller) {
1979
- try {
1980
- const { done: done2, value } = await iterator2.next();
1981
- if (done2) {
1982
- _onFinish();
1983
- controller.close();
1984
- return;
1985
- }
1986
- let len = value.byteLength;
1987
- if (onProgress) {
1988
- let loadedBytes = bytes += len;
1989
- onProgress(loadedBytes);
2688
+ return new ReadableStream(
2689
+ {
2690
+ async pull(controller) {
2691
+ try {
2692
+ const { done: done2, value } = await iterator2.next();
2693
+ if (done2) {
2694
+ _onFinish();
2695
+ controller.close();
2696
+ return;
2697
+ }
2698
+ let len = value.byteLength;
2699
+ if (onProgress) {
2700
+ let loadedBytes = bytes += len;
2701
+ onProgress(loadedBytes);
2702
+ }
2703
+ controller.enqueue(new Uint8Array(value));
2704
+ } catch (err) {
2705
+ _onFinish(err);
2706
+ throw err;
1990
2707
  }
1991
- controller.enqueue(new Uint8Array(value));
1992
- } catch (err) {
1993
- _onFinish(err);
1994
- throw err;
2708
+ },
2709
+ cancel(reason) {
2710
+ _onFinish(reason);
2711
+ return iterator2.return();
1995
2712
  }
1996
2713
  },
1997
- cancel(reason) {
1998
- _onFinish(reason);
1999
- return iterator2.return();
2714
+ {
2715
+ highWaterMark: 2
2000
2716
  }
2001
- }, {
2002
- highWaterMark: 2
2003
- });
2717
+ );
2718
+ };
2719
+ const isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
2720
+ const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
2721
+ const hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
2722
+ const isBase64Char = (charCode) => charCode >= 65 && charCode <= 90 || // A-Z
2723
+ charCode >= 97 && charCode <= 122 || // a-z
2724
+ charCode >= 48 && charCode <= 57 || // 0-9
2725
+ charCode === 43 || // +
2726
+ charCode === 47 || // /
2727
+ charCode === 45 || // - (base64url)
2728
+ charCode === 95;
2729
+ const isBase64Whitespace = (charCode) => charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
2730
+ const base64Bytes = (significant) => {
2731
+ const groups = Math.floor(significant / 4);
2732
+ const remainder = significant % 4;
2733
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
2734
+ };
2735
+ const estimateBase64BufferAllocation = (body) => {
2736
+ const len = body.length;
2737
+ let padding = 0;
2738
+ if (len > 0 && body.charCodeAt(len - 1) === 61) {
2739
+ padding++;
2740
+ if (len > 1 && body.charCodeAt(len - 2) === 61) {
2741
+ padding++;
2742
+ }
2743
+ }
2744
+ return Math.floor((len - padding) * 3 / 4);
2745
+ };
2746
+ const estimatePercentDecodedBase64Bytes = (body) => {
2747
+ const len = body.length;
2748
+ let significant = 0;
2749
+ let padding = 0;
2750
+ let invalid = false;
2751
+ for (let i = 0; i < len; i++) {
2752
+ let code = body.charCodeAt(i);
2753
+ if (code === 37 && isPercentEncodedByte(body, i, len)) {
2754
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
2755
+ i += 2;
2756
+ }
2757
+ if (isBase64Whitespace(code)) {
2758
+ continue;
2759
+ }
2760
+ if (code === 61) {
2761
+ padding++;
2762
+ continue;
2763
+ }
2764
+ if (!isBase64Char(code) || padding > 0) {
2765
+ invalid = true;
2766
+ continue;
2767
+ }
2768
+ significant++;
2769
+ }
2770
+ if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
2771
+ return estimateBase64BufferAllocation(body);
2772
+ }
2773
+ return base64Bytes(significant);
2774
+ };
2775
+ const estimateDataURLBytes = (url, estimateBase64) => {
2776
+ if (!url || typeof url !== "string") return 0;
2777
+ if (!url.startsWith("data:")) return 0;
2778
+ const comma = url.indexOf(",");
2779
+ if (comma < 0) return 0;
2780
+ const meta = url.slice(5, comma);
2781
+ const body = url.slice(comma + 1);
2782
+ const isBase64 = /;base64/i.test(meta);
2783
+ if (isBase64) {
2784
+ return estimateBase64(body);
2785
+ }
2786
+ let bytes = 0;
2787
+ for (let i = 0, len = body.length; i < len; i++) {
2788
+ const c = body.charCodeAt(i);
2789
+ if (c === 37 && isPercentEncodedByte(body, i, len)) {
2790
+ bytes += 1;
2791
+ i += 2;
2792
+ } else if (c < 128) {
2793
+ bytes += 1;
2794
+ } else if (c < 2048) {
2795
+ bytes += 2;
2796
+ } else if (c >= 55296 && c <= 56319 && i + 1 < len) {
2797
+ const next = body.charCodeAt(i + 1);
2798
+ if (next >= 56320 && next <= 57343) {
2799
+ bytes += 4;
2800
+ i++;
2801
+ } else {
2802
+ bytes += 3;
2803
+ }
2804
+ } else {
2805
+ bytes += 3;
2806
+ }
2807
+ }
2808
+ return bytes;
2004
2809
  };
2810
+ function estimateDataURLDecodedBytes(url) {
2811
+ const fragmentIndex = typeof url === "string" ? url.indexOf("#") : -1;
2812
+ return estimateDataURLBytes(
2813
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
2814
+ estimatePercentDecodedBase64Bytes
2815
+ );
2816
+ }
2817
+ const VERSION$1 = "1.20.0";
2005
2818
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
2819
+ const DEFAULT_REQUEST_OPTIONS = {
2820
+ cache: "default",
2821
+ redirect: "follow",
2822
+ referrer: "about:client",
2823
+ referrerPolicy: "",
2824
+ mode: "cors",
2825
+ integrity: "",
2826
+ keepalive: false,
2827
+ priority: "auto",
2828
+ window: null
2829
+ };
2006
2830
  const { isFunction } = utils$1;
2007
- const globalFetchAPI = (({ Request, Response }) => ({
2008
- Request,
2009
- Response
2010
- }))(utils$1.global);
2011
- const {
2012
- ReadableStream: ReadableStream$1,
2013
- TextEncoder
2014
- } = utils$1.global;
2831
+ const encodeUTF8 = (str) => encodeURIComponent(str).replace(
2832
+ /%([0-9A-F]{2})/gi,
2833
+ (_, hex) => String.fromCharCode(parseInt(hex, 16))
2834
+ );
2835
+ const decodeURIComponentSafe = (value) => {
2836
+ if (!utils$1.isString(value)) {
2837
+ return value;
2838
+ }
2839
+ try {
2840
+ return decodeURIComponent(value);
2841
+ } catch (error) {
2842
+ return value;
2843
+ }
2844
+ };
2015
2845
  const test = (fn, ...args) => {
2016
2846
  try {
2017
2847
  return !!fn(...args);
@@ -2019,10 +2849,27 @@ const test = (fn, ...args) => {
2019
2849
  return false;
2020
2850
  }
2021
2851
  };
2852
+ const maybeWithAuthCredentials = (url) => {
2853
+ const protocolIndex = url.indexOf("://");
2854
+ let urlToCheck = url;
2855
+ if (protocolIndex !== -1) {
2856
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
2857
+ }
2858
+ return urlToCheck.includes("@") || urlToCheck.includes(":");
2859
+ };
2022
2860
  const factory = (env) => {
2023
- env = utils$1.merge.call({
2024
- skipUndefined: true
2025
- }, globalFetchAPI, env);
2861
+ const globalObject = utils$1.global !== void 0 && utils$1.global !== null ? utils$1.global : globalThis;
2862
+ const { ReadableStream: ReadableStream2, TextEncoder } = globalObject;
2863
+ env = utils$1.merge.call(
2864
+ {
2865
+ skipUndefined: true
2866
+ },
2867
+ {
2868
+ Request: globalObject.Request,
2869
+ Response: globalObject.Response
2870
+ },
2871
+ env
2872
+ );
2026
2873
  const { fetch: envFetch, Request, Response } = env;
2027
2874
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
2028
2875
  const isRequestSupported = isFunction(Request);
@@ -2030,18 +2877,22 @@ const factory = (env) => {
2030
2877
  if (!isFetchSupported) {
2031
2878
  return false;
2032
2879
  }
2033
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2880
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream2);
2034
2881
  const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
2035
2882
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2036
2883
  let duplexAccessed = false;
2037
- const hasContentType = new Request(platform.origin, {
2038
- body: new ReadableStream$1(),
2884
+ const request = new Request(platform.origin, {
2885
+ body: new ReadableStream2(),
2039
2886
  method: "POST",
2040
2887
  get duplex() {
2041
2888
  duplexAccessed = true;
2042
2889
  return "half";
2043
2890
  }
2044
- }).headers.has("Content-Type");
2891
+ });
2892
+ const hasContentType = request.headers.has("Content-Type");
2893
+ if (request.body != null) {
2894
+ request.body.cancel();
2895
+ }
2045
2896
  return duplexAccessed && !hasContentType;
2046
2897
  });
2047
2898
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
@@ -2055,7 +2906,11 @@ const factory = (env) => {
2055
2906
  if (method) {
2056
2907
  return method.call(res);
2057
2908
  }
2058
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
2909
+ throw new AxiosError$1(
2910
+ `Response type '${type}' is not supported`,
2911
+ AxiosError$1.ERR_NOT_SUPPORT,
2912
+ config
2913
+ );
2059
2914
  });
2060
2915
  });
2061
2916
  })();
@@ -2100,63 +2955,217 @@ const factory = (env) => {
2100
2955
  responseType,
2101
2956
  headers,
2102
2957
  withCredentials = "same-origin",
2103
- fetchOptions
2958
+ fetchOptions,
2959
+ maxContentLength,
2960
+ maxBodyLength,
2961
+ maxRedirects
2104
2962
  } = resolveConfig(config);
2963
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
2964
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
2965
+ const own2 = (key) => utils$1.hasOwnProp(config, key) ? config[key] : void 0;
2105
2966
  let _fetch = envFetch || fetch;
2106
2967
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
2107
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2968
+ let composedSignal = composeSignals(
2969
+ [signal, cancelToken && cancelToken.toAbortSignal()],
2970
+ timeout
2971
+ );
2108
2972
  let request = null;
2109
2973
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2110
2974
  composedSignal.unsubscribe();
2111
2975
  });
2112
2976
  let requestContentLength;
2977
+ let pendingBodyError = null;
2978
+ const maxBodyLengthError = () => new AxiosError$1(
2979
+ "Request body larger than maxBodyLength limit",
2980
+ AxiosError$1.ERR_BAD_REQUEST,
2981
+ config,
2982
+ request
2983
+ );
2113
2984
  try {
2114
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
2115
- let _request = new Request(url, {
2116
- method: "POST",
2117
- body: data,
2118
- duplex: "half"
2119
- });
2120
- let contentTypeHeader;
2121
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2122
- headers.setContentType(contentTypeHeader);
2985
+ let auth2 = void 0;
2986
+ const configAuth = own2("auth");
2987
+ if (configAuth) {
2988
+ const username = utils$1.getSafeProp(configAuth, "username") || "";
2989
+ const password = utils$1.getSafeProp(configAuth, "password") || "";
2990
+ auth2 = {
2991
+ username,
2992
+ password
2993
+ };
2994
+ }
2995
+ if (maybeWithAuthCredentials(url)) {
2996
+ const parsedURL = new URL(url, platform.origin);
2997
+ if (!auth2 && (parsedURL.username || parsedURL.password)) {
2998
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
2999
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
3000
+ auth2 = {
3001
+ username: urlUsername,
3002
+ password: urlPassword
3003
+ };
2123
3004
  }
2124
- if (_request.body) {
2125
- const [onProgress, flush] = progressEventDecorator(
2126
- requestContentLength,
2127
- progressEventReducer(asyncDecorator(onUploadProgress))
3005
+ if (parsedURL.username || parsedURL.password) {
3006
+ parsedURL.username = "";
3007
+ parsedURL.password = "";
3008
+ url = parsedURL.href;
3009
+ }
3010
+ }
3011
+ if (auth2) {
3012
+ headers.delete("authorization");
3013
+ headers.set(
3014
+ "Authorization",
3015
+ "Basic " + btoa(encodeUTF8((auth2.username || "") + ":" + (auth2.password || "")))
3016
+ );
3017
+ }
3018
+ if (hasMaxContentLength && typeof url === "string" && url.startsWith("data:")) {
3019
+ const estimated = estimateDataURLDecodedBytes(url);
3020
+ if (estimated > maxContentLength) {
3021
+ throw new AxiosError$1(
3022
+ "maxContentLength size of " + maxContentLength + " exceeded",
3023
+ AxiosError$1.ERR_BAD_RESPONSE,
3024
+ config,
3025
+ request
2128
3026
  );
2129
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2130
3027
  }
2131
3028
  }
3029
+ if (hasMaxBodyLength && method !== "get" && method !== "head") {
3030
+ const outboundLength = await getBodyLength(data);
3031
+ if (typeof outboundLength === "number" && isFinite(outboundLength)) {
3032
+ requestContentLength = outboundLength;
3033
+ if (outboundLength > maxBodyLength) {
3034
+ throw maxBodyLengthError();
3035
+ }
3036
+ }
3037
+ }
3038
+ const mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
3039
+ const trackRequestStream = (stream, onProgress, flush) => trackStream(
3040
+ stream,
3041
+ DEFAULT_CHUNK_SIZE,
3042
+ (loadedBytes) => {
3043
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
3044
+ throw pendingBodyError = maxBodyLengthError();
3045
+ }
3046
+ onProgress && onProgress(loadedBytes);
3047
+ },
3048
+ flush
3049
+ );
3050
+ if (supportsRequestStream && method !== "get" && method !== "head" && (onUploadProgress || mustEnforceStreamBody)) {
3051
+ requestContentLength = requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
3052
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
3053
+ let _request = new Request(url, {
3054
+ method: "POST",
3055
+ body: data,
3056
+ duplex: "half"
3057
+ });
3058
+ let contentTypeHeader;
3059
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
3060
+ headers.setContentType(contentTypeHeader);
3061
+ }
3062
+ if (_request.body) {
3063
+ const [onProgress, flush] = onUploadProgress && progressEventDecorator(
3064
+ requestContentLength,
3065
+ progressEventReducer(asyncDecorator(onUploadProgress))
3066
+ ) || [];
3067
+ data = trackRequestStream(_request.body, onProgress, flush);
3068
+ }
3069
+ }
3070
+ } else if (mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== "get" && method !== "head") {
3071
+ data = trackRequestStream(data);
3072
+ } else if (mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== "get" && method !== "head") {
3073
+ throw new AxiosError$1(
3074
+ "Stream request bodies are not supported by the current fetch implementation",
3075
+ AxiosError$1.ERR_NOT_SUPPORT,
3076
+ config,
3077
+ request
3078
+ );
3079
+ }
2132
3080
  if (!utils$1.isString(withCredentials)) {
2133
3081
  withCredentials = withCredentials ? "include" : "omit";
2134
3082
  }
2135
3083
  const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2136
- const resolvedOptions = {
2137
- ...fetchOptions,
3084
+ if (utils$1.isFormData(data)) {
3085
+ const contentType = headers.getContentType();
3086
+ if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
3087
+ headers.delete("content-type");
3088
+ }
3089
+ }
3090
+ headers.set("User-Agent", "axios/" + VERSION$1, false);
3091
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
3092
+ if (safeFetchOptions) {
3093
+ delete safeFetchOptions.body;
3094
+ delete safeFetchOptions.headers;
3095
+ delete safeFetchOptions.method;
3096
+ delete safeFetchOptions.signal;
3097
+ delete safeFetchOptions.duplex;
3098
+ delete safeFetchOptions.credentials;
3099
+ }
3100
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
2138
3101
  signal: composedSignal,
2139
3102
  method: method.toUpperCase(),
2140
- headers: headers.normalize().toJSON(),
3103
+ headers: toByteStringHeaderObject(headers.normalize()),
2141
3104
  body: data,
2142
3105
  duplex: "half",
2143
3106
  credentials: isCredentialsSupported ? withCredentials : void 0
2144
- };
3107
+ });
3108
+ if (isRequestSupported) {
3109
+ utils$1.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
3110
+ if (resolvedOptions[key] === void 0) {
3111
+ resolvedOptions[key] = value;
3112
+ }
3113
+ });
3114
+ if (resolvedOptions.signal === void 0) {
3115
+ resolvedOptions.signal = null;
3116
+ }
3117
+ if (resolvedOptions.body === void 0) {
3118
+ resolvedOptions.body = null;
3119
+ }
3120
+ }
3121
+ if (maxRedirects === 0) {
3122
+ resolvedOptions.redirect = "manual";
3123
+ if (safeFetchOptions) {
3124
+ safeFetchOptions.redirect = "manual";
3125
+ }
3126
+ }
2145
3127
  request = isRequestSupported && new Request(url, resolvedOptions);
2146
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
3128
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url, resolvedOptions));
3129
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
3130
+ if (hasMaxContentLength) {
3131
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3132
+ if (declaredLength != null && declaredLength > maxContentLength) {
3133
+ throw new AxiosError$1(
3134
+ "maxContentLength size of " + maxContentLength + " exceeded",
3135
+ AxiosError$1.ERR_BAD_RESPONSE,
3136
+ config,
3137
+ request
3138
+ );
3139
+ }
3140
+ }
2147
3141
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2148
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3142
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
2149
3143
  const options = {};
2150
3144
  ["status", "statusText", "headers"].forEach((prop) => {
2151
3145
  options[prop] = response[prop];
2152
3146
  });
2153
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
3147
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
2154
3148
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2155
3149
  responseContentLength,
2156
3150
  progressEventReducer(asyncDecorator(onDownloadProgress), true)
2157
3151
  ) || [];
3152
+ let bytesRead = 0;
3153
+ const onChunkProgress = (loadedBytes) => {
3154
+ if (hasMaxContentLength) {
3155
+ bytesRead = loadedBytes;
3156
+ if (bytesRead > maxContentLength) {
3157
+ throw new AxiosError$1(
3158
+ "maxContentLength size of " + maxContentLength + " exceeded",
3159
+ AxiosError$1.ERR_BAD_RESPONSE,
3160
+ config,
3161
+ request
3162
+ );
3163
+ }
3164
+ }
3165
+ onProgress && onProgress(loadedBytes);
3166
+ };
2158
3167
  response = new Response(
2159
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3168
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
2160
3169
  flush && flush();
2161
3170
  unsubscribe && unsubscribe();
2162
3171
  }),
@@ -2164,7 +3173,30 @@ const factory = (env) => {
2164
3173
  );
2165
3174
  }
2166
3175
  responseType = responseType || "text";
2167
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
3176
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
3177
+ response,
3178
+ config
3179
+ );
3180
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
3181
+ let materializedSize;
3182
+ if (responseData != null) {
3183
+ if (typeof responseData.byteLength === "number") {
3184
+ materializedSize = responseData.byteLength;
3185
+ } else if (typeof responseData.size === "number") {
3186
+ materializedSize = responseData.size;
3187
+ } else if (typeof responseData === "string") {
3188
+ materializedSize = typeof TextEncoder === "function" ? new TextEncoder().encode(responseData).byteLength : responseData.length;
3189
+ }
3190
+ }
3191
+ if (typeof materializedSize === "number" && materializedSize > maxContentLength) {
3192
+ throw new AxiosError$1(
3193
+ "maxContentLength size of " + maxContentLength + " exceeded",
3194
+ AxiosError$1.ERR_BAD_RESPONSE,
3195
+ config,
3196
+ request
3197
+ );
3198
+ }
3199
+ }
2168
3200
  !isStreamResponse && unsubscribe && unsubscribe();
2169
3201
  return await new Promise((resolve, reject) => {
2170
3202
  settle(resolve, reject, {
@@ -2178,13 +3210,45 @@ const factory = (env) => {
2178
3210
  });
2179
3211
  } catch (err) {
2180
3212
  unsubscribe && unsubscribe();
3213
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
3214
+ const canceledError = composedSignal.reason;
3215
+ canceledError.config = config;
3216
+ request && (canceledError.request = request);
3217
+ if (err !== canceledError) {
3218
+ Object.defineProperty(canceledError, "cause", {
3219
+ __proto__: null,
3220
+ value: err,
3221
+ writable: true,
3222
+ enumerable: false,
3223
+ configurable: true
3224
+ });
3225
+ }
3226
+ throw canceledError;
3227
+ }
3228
+ if (pendingBodyError) {
3229
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
3230
+ throw pendingBodyError;
3231
+ }
3232
+ if (err instanceof AxiosError$1) {
3233
+ request && !err.request && (err.request = request);
3234
+ throw err;
3235
+ }
2181
3236
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2182
- throw Object.assign(
2183
- new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request, err && err.response),
2184
- {
2185
- cause: err.cause || err
2186
- }
3237
+ const networkError = new AxiosError$1(
3238
+ "Network Error",
3239
+ AxiosError$1.ERR_NETWORK,
3240
+ config,
3241
+ request,
3242
+ err && err.response
2187
3243
  );
3244
+ Object.defineProperty(networkError, "cause", {
3245
+ __proto__: null,
3246
+ value: err.cause || err,
3247
+ writable: true,
3248
+ enumerable: false,
3249
+ configurable: true
3250
+ });
3251
+ throw networkError;
2188
3252
  }
2189
3253
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
2190
3254
  }
@@ -2194,11 +3258,7 @@ const seedCache = /* @__PURE__ */ new Map();
2194
3258
  const getFetch = (config) => {
2195
3259
  let env = config && config.env || {};
2196
3260
  const { fetch: fetch2, Request, Response } = env;
2197
- const seeds = [
2198
- Request,
2199
- Response,
2200
- fetch2
2201
- ];
3261
+ const seeds = [Request, Response, fetch2];
2202
3262
  let len = seeds.length, i = len, seed, target, map = seedCache;
2203
3263
  while (i--) {
2204
3264
  seed = seeds[i];
@@ -2219,10 +3279,10 @@ const knownAdapters = {
2219
3279
  utils$1.forEach(knownAdapters, (fn, value) => {
2220
3280
  if (fn) {
2221
3281
  try {
2222
- Object.defineProperty(fn, "name", { value });
3282
+ Object.defineProperty(fn, "name", { __proto__: null, value });
2223
3283
  } catch (e) {
2224
3284
  }
2225
- Object.defineProperty(fn, "adapterName", { value });
3285
+ Object.defineProperty(fn, "adapterName", { __proto__: null, value });
2226
3286
  }
2227
3287
  });
2228
3288
  const renderReason = (reason) => `- ${reason}`;
@@ -2255,7 +3315,7 @@ function getAdapter$1(adapters2, config) {
2255
3315
  let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
2256
3316
  throw new AxiosError$1(
2257
3317
  `There is no suitable adapter to dispatch the request ` + s,
2258
- "ERR_NOT_SUPPORT"
3318
+ AxiosError$1.ERR_NOT_SUPPORT
2259
3319
  );
2260
3320
  }
2261
3321
  return adapter;
@@ -2280,42 +3340,48 @@ function throwIfCancellationRequested(config) {
2280
3340
  throw new CanceledError$1(null, config);
2281
3341
  }
2282
3342
  }
2283
- function dispatchRequest(config) {
3343
+ function dispatchRequest(_config) {
3344
+ const config = utils$1.toSafeFlatObject(_config);
2284
3345
  throwIfCancellationRequested(config);
2285
- config.headers = AxiosHeaders$1.from(config.headers);
2286
- config.data = transformData.call(
2287
- config,
2288
- config.transformRequest
2289
- );
3346
+ config.headers = AxiosHeaders$1.from(utils$1.getSafeProp(config, "headers"));
3347
+ config.data = transformData.call(config, config.transformRequest);
2290
3348
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
2291
3349
  config.headers.setContentType("application/x-www-form-urlencoded", false);
2292
3350
  }
2293
3351
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
2294
- return adapter(config).then(function onAdapterResolution(response) {
2295
- throwIfCancellationRequested(config);
2296
- response.data = transformData.call(
2297
- config,
2298
- config.transformResponse,
2299
- response
2300
- );
2301
- response.headers = AxiosHeaders$1.from(response.headers);
2302
- return response;
2303
- }, function onAdapterRejection(reason) {
2304
- if (!isCancel$1(reason)) {
3352
+ return adapter(config).then(
3353
+ function onAdapterResolution(response) {
2305
3354
  throwIfCancellationRequested(config);
2306
- if (reason && reason.response) {
2307
- reason.response.data = transformData.call(
2308
- config,
2309
- config.transformResponse,
2310
- reason.response
2311
- );
2312
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3355
+ config.response = response;
3356
+ try {
3357
+ response.data = transformData.call(config, config.transformResponse, response);
3358
+ } finally {
3359
+ delete config.response;
3360
+ }
3361
+ response.headers = AxiosHeaders$1.from(response.headers);
3362
+ return response;
3363
+ },
3364
+ function onAdapterRejection(reason) {
3365
+ if (!isCancel$1(reason)) {
3366
+ throwIfCancellationRequested(config);
3367
+ if (reason && reason.response) {
3368
+ config.response = reason.response;
3369
+ try {
3370
+ reason.response.data = transformData.call(
3371
+ config,
3372
+ config.transformResponse,
3373
+ reason.response
3374
+ );
3375
+ } finally {
3376
+ delete config.response;
3377
+ }
3378
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3379
+ }
2313
3380
  }
3381
+ return Promise.reject(reason);
2314
3382
  }
2315
- return Promise.reject(reason);
2316
- });
3383
+ );
2317
3384
  }
2318
- const VERSION$1 = "1.13.5";
2319
3385
  const validators$1 = {};
2320
3386
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2321
3387
  validators$1[type] = function validator2(thing) {
@@ -2353,19 +3419,22 @@ validators$1.spelling = function spelling(correctSpelling) {
2353
3419
  };
2354
3420
  };
2355
3421
  function assertOptions(options, schema, allowUnknown) {
2356
- if (typeof options !== "object") {
3422
+ if (typeof options !== "object" || options === null) {
2357
3423
  throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
2358
3424
  }
2359
3425
  const keys = Object.keys(options);
2360
3426
  let i = keys.length;
2361
3427
  while (i-- > 0) {
2362
3428
  const opt = keys[i];
2363
- const validator2 = schema[opt];
3429
+ const validator2 = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
2364
3430
  if (validator2) {
2365
3431
  const value = options[opt];
2366
3432
  const result = value === void 0 || validator2(value, opt, options);
2367
3433
  if (result !== true) {
2368
- throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3434
+ throw new AxiosError$1(
3435
+ "option " + opt + " must be " + result,
3436
+ AxiosError$1.ERR_BAD_OPTION_VALUE
3437
+ );
2369
3438
  }
2370
3439
  continue;
2371
3440
  }
@@ -2400,14 +3469,24 @@ let Axios$1 = class Axios {
2400
3469
  return await this._request(configOrUrl, config);
2401
3470
  } catch (err) {
2402
3471
  if (err instanceof Error) {
2403
- let dummy = {};
2404
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
2405
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
2406
3472
  try {
3473
+ let dummy = {};
3474
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3475
+ const dummyStack = dummy.stack;
3476
+ let stack = "";
3477
+ if (typeof dummyStack === "string") {
3478
+ const firstNewlineIndex = dummyStack.indexOf("\n");
3479
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
3480
+ }
2407
3481
  if (!err.stack) {
2408
3482
  err.stack = stack;
2409
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2410
- err.stack += "\n" + stack;
3483
+ } else if (stack) {
3484
+ const firstNewlineIndex = stack.indexOf("\n");
3485
+ const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
3486
+ const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
3487
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
3488
+ err.stack += "\n" + stack;
3489
+ }
2411
3490
  }
2412
3491
  } catch (e) {
2413
3492
  }
@@ -2425,12 +3504,18 @@ let Axios$1 = class Axios {
2425
3504
  config = mergeConfig$1(this.defaults, config);
2426
3505
  const { transitional: transitional2, paramsSerializer, headers } = config;
2427
3506
  if (transitional2 !== void 0) {
2428
- validator.assertOptions(transitional2, {
2429
- silentJSONParsing: validators.transitional(validators.boolean),
2430
- forcedJSONParsing: validators.transitional(validators.boolean),
2431
- clarifyTimeoutError: validators.transitional(validators.boolean),
2432
- legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
2433
- }, false);
3507
+ validator.assertOptions(
3508
+ transitional2,
3509
+ {
3510
+ silentJSONParsing: validators.transitional(validators.boolean),
3511
+ forcedJSONParsing: validators.transitional(validators.boolean),
3512
+ clarifyTimeoutError: validators.transitional(validators.boolean),
3513
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
3514
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
3515
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean)
3516
+ },
3517
+ false
3518
+ );
2434
3519
  }
2435
3520
  if (paramsSerializer != null) {
2436
3521
  if (utils$1.isFunction(paramsSerializer)) {
@@ -2438,10 +3523,14 @@ let Axios$1 = class Axios {
2438
3523
  serialize: paramsSerializer
2439
3524
  };
2440
3525
  } else {
2441
- validator.assertOptions(paramsSerializer, {
2442
- encode: validators.function,
2443
- serialize: validators.function
2444
- }, true);
3526
+ validator.assertOptions(
3527
+ paramsSerializer,
3528
+ {
3529
+ encode: validators.function,
3530
+ serialize: validators.function
3531
+ },
3532
+ true
3533
+ );
2445
3534
  }
2446
3535
  }
2447
3536
  if (config.allowAbsoluteUrls !== void 0) ;
@@ -2450,21 +3539,19 @@ let Axios$1 = class Axios {
2450
3539
  } else {
2451
3540
  config.allowAbsoluteUrls = true;
2452
3541
  }
2453
- validator.assertOptions(config, {
2454
- baseUrl: validators.spelling("baseURL"),
2455
- withXsrfToken: validators.spelling("withXSRFToken")
2456
- }, true);
2457
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
2458
- let contextHeaders = headers && utils$1.merge(
2459
- headers.common,
2460
- headers[config.method]
2461
- );
2462
- headers && utils$1.forEach(
2463
- ["delete", "get", "head", "post", "put", "patch", "common"],
2464
- (method) => {
2465
- delete headers[method];
2466
- }
3542
+ validator.assertOptions(
3543
+ config,
3544
+ {
3545
+ baseUrl: validators.spelling("baseURL"),
3546
+ withXsrfToken: validators.spelling("withXSRFToken")
3547
+ },
3548
+ true
2467
3549
  );
3550
+ config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
3551
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3552
+ headers && utils$1.forEach(methodList.concat("common"), (method) => {
3553
+ delete headers[method];
3554
+ });
2468
3555
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2469
3556
  const requestInterceptorChain = [];
2470
3557
  let synchronousRequestInterceptors = true;
@@ -2505,16 +3592,31 @@ let Axios$1 = class Axios {
2505
3592
  const onFulfilled = requestInterceptorChain[i++];
2506
3593
  const onRejected = requestInterceptorChain[i++];
2507
3594
  try {
2508
- newConfig = onFulfilled(newConfig);
3595
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
2509
3596
  } catch (error) {
2510
- onRejected.call(this, error);
3597
+ if (!onRejected) {
3598
+ promise = Promise.reject(error);
3599
+ break;
3600
+ }
3601
+ try {
3602
+ const rejectedResult = onRejected.call(this, error);
3603
+ if (utils$1.isThenable(rejectedResult)) {
3604
+ promise = Promise.resolve(rejectedResult).then(
3605
+ () => dispatchRequest.call(this, newConfig)
3606
+ );
3607
+ }
3608
+ } catch (rejectedError) {
3609
+ promise = Promise.reject(rejectedError);
3610
+ }
2511
3611
  break;
2512
3612
  }
2513
3613
  }
2514
- try {
2515
- promise = dispatchRequest.call(this, newConfig);
2516
- } catch (error) {
2517
- return Promise.reject(error);
3614
+ if (!promise) {
3615
+ try {
3616
+ promise = dispatchRequest.call(this, newConfig);
3617
+ } catch (error) {
3618
+ promise = Promise.reject(error);
3619
+ }
2518
3620
  }
2519
3621
  i = 0;
2520
3622
  len = responseInterceptorChain.length;
@@ -2525,34 +3627,40 @@ let Axios$1 = class Axios {
2525
3627
  }
2526
3628
  getUri(config) {
2527
3629
  config = mergeConfig$1(this.defaults, config);
2528
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3630
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
2529
3631
  return buildURL(fullPath, config.params, config.paramsSerializer);
2530
3632
  }
2531
3633
  };
2532
3634
  utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
2533
3635
  Axios$1.prototype[method] = function(url, config) {
2534
- return this.request(mergeConfig$1(config || {}, {
2535
- method,
2536
- url,
2537
- data: (config || {}).data
2538
- }));
3636
+ return this.request(
3637
+ mergeConfig$1(config || {}, {
3638
+ method,
3639
+ url,
3640
+ data: config && utils$1.hasOwnProp(config, "data") ? config.data : void 0
3641
+ })
3642
+ );
2539
3643
  };
2540
3644
  });
2541
- utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
3645
+ utils$1.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
2542
3646
  function generateHTTPMethod(isForm) {
2543
3647
  return function httpMethod(url, data, config) {
2544
- return this.request(mergeConfig$1(config || {}, {
2545
- method,
2546
- headers: isForm ? {
2547
- "Content-Type": "multipart/form-data"
2548
- } : {},
2549
- url,
2550
- data
2551
- }));
3648
+ return this.request(
3649
+ mergeConfig$1(config || {}, {
3650
+ method,
3651
+ headers: isForm ? {
3652
+ "Content-Type": "multipart/form-data"
3653
+ } : {},
3654
+ url,
3655
+ data
3656
+ })
3657
+ );
2552
3658
  };
2553
3659
  }
2554
3660
  Axios$1.prototype[method] = generateHTTPMethod();
2555
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
3661
+ if (method !== "query") {
3662
+ Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
3663
+ }
2556
3664
  });
2557
3665
  let CancelToken$1 = class CancelToken {
2558
3666
  constructor(executor) {
@@ -2694,14 +3802,22 @@ const HttpStatusCode$1 = {
2694
3802
  Gone: 410,
2695
3803
  LengthRequired: 411,
2696
3804
  PreconditionFailed: 412,
3805
+ /**
3806
+ * @deprecated Use `ContentTooLarge` instead.
3807
+ */
2697
3808
  PayloadTooLarge: 413,
3809
+ ContentTooLarge: 413,
2698
3810
  UriTooLong: 414,
2699
3811
  UnsupportedMediaType: 415,
2700
3812
  RangeNotSatisfiable: 416,
2701
3813
  ExpectationFailed: 417,
2702
3814
  ImATeapot: 418,
2703
3815
  MisdirectedRequest: 421,
3816
+ /**
3817
+ * @deprecated Use `UnprocessableContent` instead.
3818
+ */
2704
3819
  UnprocessableEntity: 422,
3820
+ UnprocessableContent: 422,
2705
3821
  Locked: 423,
2706
3822
  FailedDependency: 424,
2707
3823
  TooEarly: 425,
@@ -2721,6 +3837,7 @@ const HttpStatusCode$1 = {
2721
3837
  LoopDetected: 508,
2722
3838
  NotExtended: 510,
2723
3839
  NetworkAuthenticationRequired: 511,
3840
+ WebServerReturnsAnUnknownError: 520,
2724
3841
  WebServerIsDown: 521,
2725
3842
  ConnectionTimedOut: 522,
2726
3843
  OriginIsUnreachable: 523,
@@ -2729,14 +3846,16 @@ const HttpStatusCode$1 = {
2729
3846
  InvalidSslCertificate: 526
2730
3847
  };
2731
3848
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
2732
- HttpStatusCode$1[value] = key;
3849
+ if (HttpStatusCode$1[value] === void 0) {
3850
+ HttpStatusCode$1[value] = key;
3851
+ }
2733
3852
  });
2734
3853
  function createInstance(defaultConfig) {
2735
3854
  const context = new Axios$1(defaultConfig);
2736
3855
  const instance = bind(Axios$1.prototype.request, context);
2737
3856
  utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
2738
3857
  utils$1.extend(instance, context, null, { allOwnKeys: true });
2739
- instance.create = function create(instanceConfig) {
3858
+ instance.create = function create2(instanceConfig) {
2740
3859
  return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
2741
3860
  };
2742
3861
  return instance;
@@ -2777,7 +3896,8 @@ const {
2777
3896
  HttpStatusCode,
2778
3897
  formToJSON,
2779
3898
  getAdapter,
2780
- mergeConfig
3899
+ mergeConfig,
3900
+ create
2781
3901
  } = axios;
2782
3902
  var isRetryAllowed$1;
2783
3903
  var hasRequiredIsRetryAllowed;