@xchainjs/xchain-aggregator 2.3.1 → 2.3.2

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 (3) hide show
  1. package/lib/index.esm.js +1078 -766
  2. package/lib/index.js +1078 -766
  3. package/package.json +17 -17
package/lib/index.esm.js CHANGED
@@ -350,7 +350,7 @@ const { isArray } = Array;
350
350
  *
351
351
  * @returns {boolean} True if the value is undefined, otherwise false
352
352
  */
353
- const isUndefined = typeOfTest("undefined");
353
+ const isUndefined = typeOfTest('undefined');
354
354
 
355
355
  /**
356
356
  * Determine if a value is a Buffer
@@ -377,7 +377,7 @@ function isBuffer(val) {
377
377
  *
378
378
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
379
379
  */
380
- const isArrayBuffer = kindOfTest("ArrayBuffer");
380
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
381
381
 
382
382
  /**
383
383
  * Determine if a value is a view on an ArrayBuffer
@@ -388,7 +388,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
388
388
  */
389
389
  function isArrayBufferView(val) {
390
390
  let result;
391
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
391
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
392
392
  result = ArrayBuffer.isView(val);
393
393
  } else {
394
394
  result = val && val.buffer && isArrayBuffer(val.buffer);
@@ -403,7 +403,7 @@ function isArrayBufferView(val) {
403
403
  *
404
404
  * @returns {boolean} True if value is a String, otherwise false
405
405
  */
406
- const isString = typeOfTest("string");
406
+ const isString = typeOfTest('string');
407
407
 
408
408
  /**
409
409
  * Determine if a value is a Function
@@ -411,7 +411,7 @@ const isString = typeOfTest("string");
411
411
  * @param {*} val The value to test
412
412
  * @returns {boolean} True if value is a Function, otherwise false
413
413
  */
414
- const isFunction$1 = typeOfTest("function");
414
+ const isFunction$1 = typeOfTest('function');
415
415
 
416
416
  /**
417
417
  * Determine if a value is a Number
@@ -420,7 +420,7 @@ const isFunction$1 = typeOfTest("function");
420
420
  *
421
421
  * @returns {boolean} True if value is a Number, otherwise false
422
422
  */
423
- const isNumber = typeOfTest("number");
423
+ const isNumber = typeOfTest('number');
424
424
 
425
425
  /**
426
426
  * Determine if a value is an Object
@@ -429,7 +429,7 @@ const isNumber = typeOfTest("number");
429
429
  *
430
430
  * @returns {boolean} True if value is an Object, otherwise false
431
431
  */
432
- const isObject = (thing) => thing !== null && typeof thing === "object";
432
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
433
433
 
434
434
  /**
435
435
  * Determine if a value is a Boolean
@@ -447,7 +447,7 @@ const isBoolean = (thing) => thing === true || thing === false;
447
447
  * @returns {boolean} True if value is a plain Object, otherwise false
448
448
  */
449
449
  const isPlainObject = (val) => {
450
- if (kindOf(val) !== "object") {
450
+ if (kindOf(val) !== 'object') {
451
451
  return false;
452
452
  }
453
453
 
@@ -475,10 +475,7 @@ const isEmptyObject = (val) => {
475
475
  }
476
476
 
477
477
  try {
478
- return (
479
- Object.keys(val).length === 0 &&
480
- Object.getPrototypeOf(val) === Object.prototype
481
- );
478
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
482
479
  } catch (e) {
483
480
  // Fallback for any other objects that might cause RangeError with Object.keys()
484
481
  return false;
@@ -492,7 +489,7 @@ const isEmptyObject = (val) => {
492
489
  *
493
490
  * @returns {boolean} True if value is a Date, otherwise false
494
491
  */
495
- const isDate = kindOfTest("Date");
492
+ const isDate = kindOfTest('Date');
496
493
 
497
494
  /**
498
495
  * Determine if a value is a File
@@ -501,7 +498,32 @@ const isDate = kindOfTest("Date");
501
498
  *
502
499
  * @returns {boolean} True if value is a File, otherwise false
503
500
  */
504
- const isFile = kindOfTest("File");
501
+ const isFile = kindOfTest('File');
502
+
503
+ /**
504
+ * Determine if a value is a React Native Blob
505
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
506
+ * also have a `name` and `type` attribute to specify filename and content type
507
+ *
508
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
509
+ *
510
+ * @param {*} value The value to test
511
+ *
512
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
513
+ */
514
+ const isReactNativeBlob = (value) => {
515
+ return !!(value && typeof value.uri !== 'undefined');
516
+ };
517
+
518
+ /**
519
+ * Determine if environment is React Native
520
+ * ReactNative `FormData` has a non-standard `getParts()` method
521
+ *
522
+ * @param {*} formData The formData to test
523
+ *
524
+ * @returns {boolean} True if environment is React Native, otherwise false
525
+ */
526
+ const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
505
527
 
506
528
  /**
507
529
  * Determine if a value is a Blob
@@ -510,7 +532,7 @@ const isFile = kindOfTest("File");
510
532
  *
511
533
  * @returns {boolean} True if value is a Blob, otherwise false
512
534
  */
513
- const isBlob = kindOfTest("Blob");
535
+ const isBlob = kindOfTest('Blob');
514
536
 
515
537
  /**
516
538
  * Determine if a value is a FileList
@@ -519,7 +541,7 @@ const isBlob = kindOfTest("Blob");
519
541
  *
520
542
  * @returns {boolean} True if value is a File, otherwise false
521
543
  */
522
- const isFileList = kindOfTest("FileList");
544
+ const isFileList = kindOfTest('FileList');
523
545
 
524
546
  /**
525
547
  * Determine if a value is a Stream
@@ -537,17 +559,27 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
537
559
  *
538
560
  * @returns {boolean} True if value is an FormData, otherwise false
539
561
  */
562
+ function getGlobal() {
563
+ if (typeof globalThis !== 'undefined') return globalThis;
564
+ if (typeof self !== 'undefined') return self;
565
+ if (typeof window !== 'undefined') return window;
566
+ if (typeof global !== 'undefined') return global;
567
+ return {};
568
+ }
569
+
570
+ const G = getGlobal();
571
+ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
572
+
540
573
  const isFormData = (thing) => {
541
574
  let kind;
542
- return (
543
- thing &&
544
- ((typeof FormData === "function" && thing instanceof FormData) ||
545
- (isFunction$1(thing.append) &&
546
- ((kind = kindOf(thing)) === "formdata" ||
547
- // detect form-data instance
548
- (kind === "object" &&
549
- isFunction$1(thing.toString) &&
550
- thing.toString() === "[object FormData]"))))
575
+ return thing && (
576
+ (FormDataCtor && thing instanceof FormDataCtor) || (
577
+ isFunction$1(thing.append) && (
578
+ (kind = kindOf(thing)) === 'formdata' ||
579
+ // detect form-data instance
580
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
581
+ )
582
+ )
551
583
  );
552
584
  };
553
585
 
@@ -558,13 +590,13 @@ const isFormData = (thing) => {
558
590
  *
559
591
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
560
592
  */
561
- const isURLSearchParams = kindOfTest("URLSearchParams");
593
+ const isURLSearchParams = kindOfTest('URLSearchParams');
562
594
 
563
595
  const [isReadableStream, isRequest, isResponse, isHeaders] = [
564
- "ReadableStream",
565
- "Request",
566
- "Response",
567
- "Headers",
596
+ 'ReadableStream',
597
+ 'Request',
598
+ 'Response',
599
+ 'Headers',
568
600
  ].map(kindOfTest);
569
601
 
570
602
  /**
@@ -574,9 +606,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
574
606
  *
575
607
  * @returns {String} The String freed of excess whitespace
576
608
  */
577
- const trim = (str) =>
578
- str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
579
-
609
+ const trim = (str) => {
610
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
611
+ };
580
612
  /**
581
613
  * Iterate over an Array or an Object invoking a function for each item.
582
614
  *
@@ -595,7 +627,7 @@ const trim = (str) =>
595
627
  */
596
628
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
597
629
  // Don't bother if no value provided
598
- if (obj === null || typeof obj === "undefined") {
630
+ if (obj === null || typeof obj === 'undefined') {
599
631
  return;
600
632
  }
601
633
 
@@ -603,7 +635,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
603
635
  let l;
604
636
 
605
637
  // Force an array if not already something iterable
606
- if (typeof obj !== "object") {
638
+ if (typeof obj !== 'object') {
607
639
  /*eslint no-param-reassign:0*/
608
640
  obj = [obj];
609
641
  }
@@ -620,9 +652,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
620
652
  }
621
653
 
622
654
  // Iterate over object keys
623
- const keys = allOwnKeys
624
- ? Object.getOwnPropertyNames(obj)
625
- : Object.keys(obj);
655
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
626
656
  const len = keys.length;
627
657
  let key;
628
658
 
@@ -633,6 +663,14 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
633
663
  }
634
664
  }
635
665
 
666
+ /**
667
+ * Finds a key in an object, case-insensitive, returning the actual key name.
668
+ * Returns null if the object is a Buffer or if no match is found.
669
+ *
670
+ * @param {Object} obj - The object to search.
671
+ * @param {string} key - The key to find (case-insensitive).
672
+ * @returns {?string} The actual key name if found, otherwise null.
673
+ */
636
674
  function findKey(obj, key) {
637
675
  if (isBuffer(obj)) {
638
676
  return null;
@@ -653,16 +691,11 @@ function findKey(obj, key) {
653
691
 
654
692
  const _global = (() => {
655
693
  /*eslint no-undef:0*/
656
- if (typeof globalThis !== "undefined") return globalThis;
657
- return typeof self !== "undefined"
658
- ? self
659
- : typeof window !== "undefined"
660
- ? window
661
- : global;
694
+ if (typeof globalThis !== 'undefined') return globalThis;
695
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
662
696
  })();
663
697
 
664
- const isContextDefined = (context) =>
665
- !isUndefined(context) && context !== _global;
698
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
666
699
 
667
700
  /**
668
701
  * Accepts varargs expecting each argument to be an object, then
@@ -687,7 +720,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
687
720
  const result = {};
688
721
  const assignValue = (val, key) => {
689
722
  // Skip dangerous property names to prevent prototype pollution
690
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
723
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
691
724
  return;
692
725
  }
693
726
 
@@ -740,7 +773,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
740
773
  });
741
774
  }
742
775
  },
743
- { allOwnKeys },
776
+ { allOwnKeys }
744
777
  );
745
778
  return a;
746
779
  };
@@ -769,17 +802,14 @@ const stripBOM = (content) => {
769
802
  * @returns {void}
770
803
  */
771
804
  const inherits = (constructor, superConstructor, props, descriptors) => {
772
- constructor.prototype = Object.create(
773
- superConstructor.prototype,
774
- descriptors,
775
- );
776
- Object.defineProperty(constructor.prototype, "constructor", {
805
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
806
+ Object.defineProperty(constructor.prototype, 'constructor', {
777
807
  value: constructor,
778
808
  writable: true,
779
809
  enumerable: false,
780
810
  configurable: true,
781
811
  });
782
- Object.defineProperty(constructor, "super", {
812
+ Object.defineProperty(constructor, 'super', {
783
813
  value: superConstructor.prototype,
784
814
  });
785
815
  props && Object.assign(constructor.prototype, props);
@@ -809,20 +839,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
809
839
  i = props.length;
810
840
  while (i-- > 0) {
811
841
  prop = props[i];
812
- if (
813
- (!propFilter || propFilter(prop, sourceObj, destObj)) &&
814
- !merged[prop]
815
- ) {
842
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
816
843
  destObj[prop] = sourceObj[prop];
817
844
  merged[prop] = true;
818
845
  }
819
846
  }
820
847
  sourceObj = filter !== false && getPrototypeOf(sourceObj);
821
- } while (
822
- sourceObj &&
823
- (!filter || filter(sourceObj, destObj)) &&
824
- sourceObj !== Object.prototype
825
- );
848
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
826
849
 
827
850
  return destObj;
828
851
  };
@@ -879,7 +902,7 @@ const isTypedArray = ((TypedArray) => {
879
902
  return (thing) => {
880
903
  return TypedArray && thing instanceof TypedArray;
881
904
  };
882
- })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
905
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
883
906
 
884
907
  /**
885
908
  * For each entry in the object, call the function with the key and value.
@@ -922,14 +945,12 @@ const matchAll = (regExp, str) => {
922
945
  };
923
946
 
924
947
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
925
- const isHTMLForm = kindOfTest("HTMLFormElement");
948
+ const isHTMLForm = kindOfTest('HTMLFormElement');
926
949
 
927
950
  const toCamelCase = (str) => {
928
- return str
929
- .toLowerCase()
930
- .replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
931
- return p1.toUpperCase() + p2;
932
- });
951
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
952
+ return p1.toUpperCase() + p2;
953
+ });
933
954
  };
934
955
 
935
956
  /* Creating a function that will check if an object has a property. */
@@ -946,7 +967,7 @@ const hasOwnProperty = (
946
967
  *
947
968
  * @returns {boolean} True if value is a RegExp object, otherwise false
948
969
  */
949
- const isRegExp = kindOfTest("RegExp");
970
+ const isRegExp = kindOfTest('RegExp');
950
971
 
951
972
  const reduceDescriptors = (obj, reducer) => {
952
973
  const descriptors = Object.getOwnPropertyDescriptors(obj);
@@ -970,10 +991,7 @@ const reduceDescriptors = (obj, reducer) => {
970
991
  const freezeMethods = (obj) => {
971
992
  reduceDescriptors(obj, (descriptor, name) => {
972
993
  // skip restricted props in strict mode
973
- if (
974
- isFunction$1(obj) &&
975
- ["arguments", "caller", "callee"].indexOf(name) !== -1
976
- ) {
994
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
977
995
  return false;
978
996
  }
979
997
 
@@ -983,7 +1001,7 @@ const freezeMethods = (obj) => {
983
1001
 
984
1002
  descriptor.enumerable = false;
985
1003
 
986
- if ("writable" in descriptor) {
1004
+ if ('writable' in descriptor) {
987
1005
  descriptor.writable = false;
988
1006
  return;
989
1007
  }
@@ -996,6 +1014,14 @@ const freezeMethods = (obj) => {
996
1014
  });
997
1015
  };
998
1016
 
1017
+ /**
1018
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
1019
+ * Useful for fast membership checks.
1020
+ *
1021
+ * @param {Array|string} arrayOrString - The array or string to convert.
1022
+ * @param {string} delimiter - The delimiter to use if input is a string.
1023
+ * @returns {Object} An object with keys from the array or string, values set to true.
1024
+ */
999
1025
  const toObjectSet = (arrayOrString, delimiter) => {
1000
1026
  const obj = {};
1001
1027
 
@@ -1005,9 +1031,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
1005
1031
  });
1006
1032
  };
1007
1033
 
1008
- isArray(arrayOrString)
1009
- ? define(arrayOrString)
1010
- : define(String(arrayOrString).split(delimiter));
1034
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
1011
1035
 
1012
1036
  return obj;
1013
1037
  };
@@ -1015,9 +1039,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
1015
1039
  const noop = () => {};
1016
1040
 
1017
1041
  const toFiniteNumber = (value, defaultValue) => {
1018
- return value != null && Number.isFinite((value = +value))
1019
- ? value
1020
- : defaultValue;
1042
+ return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
1021
1043
  };
1022
1044
 
1023
1045
  /**
@@ -1031,11 +1053,17 @@ function isSpecCompliantForm(thing) {
1031
1053
  return !!(
1032
1054
  thing &&
1033
1055
  isFunction$1(thing.append) &&
1034
- thing[toStringTag] === "FormData" &&
1056
+ thing[toStringTag] === 'FormData' &&
1035
1057
  thing[iterator]
1036
1058
  );
1037
1059
  }
1038
1060
 
1061
+ /**
1062
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
1063
+ *
1064
+ * @param {Object} obj - The object to convert.
1065
+ * @returns {Object} The JSON-compatible object.
1066
+ */
1039
1067
  const toJSONObject = (obj) => {
1040
1068
  const stack = new Array(10);
1041
1069
 
@@ -1050,7 +1078,7 @@ const toJSONObject = (obj) => {
1050
1078
  return source;
1051
1079
  }
1052
1080
 
1053
- if (!("toJSON" in source)) {
1081
+ if (!('toJSON' in source)) {
1054
1082
  stack[i] = source;
1055
1083
  const target = isArray(source) ? [] : {};
1056
1084
 
@@ -1071,8 +1099,20 @@ const toJSONObject = (obj) => {
1071
1099
  return visit(obj, 0);
1072
1100
  };
1073
1101
 
1074
- const isAsyncFn = kindOfTest("AsyncFunction");
1102
+ /**
1103
+ * Determines if a value is an async function.
1104
+ *
1105
+ * @param {*} thing - The value to test.
1106
+ * @returns {boolean} True if value is an async function, otherwise false.
1107
+ */
1108
+ const isAsyncFn = kindOfTest('AsyncFunction');
1075
1109
 
1110
+ /**
1111
+ * Determines if a value is thenable (has then and catch methods).
1112
+ *
1113
+ * @param {*} thing - The value to test.
1114
+ * @returns {boolean} True if value is thenable, otherwise false.
1115
+ */
1076
1116
  const isThenable = (thing) =>
1077
1117
  thing &&
1078
1118
  (isObject(thing) || isFunction$1(thing)) &&
@@ -1082,6 +1122,14 @@ const isThenable = (thing) =>
1082
1122
  // original code
1083
1123
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
1084
1124
 
1125
+ /**
1126
+ * Provides a cross-platform setImmediate implementation.
1127
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
1128
+ *
1129
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
1130
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
1131
+ * @returns {Function} A function to schedule a callback asynchronously.
1132
+ */
1085
1133
  const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
1086
1134
  if (setImmediateSupported) {
1087
1135
  return setImmediate;
@@ -1090,27 +1138,33 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
1090
1138
  return postMessageSupported
1091
1139
  ? ((token, callbacks) => {
1092
1140
  _global.addEventListener(
1093
- "message",
1141
+ 'message',
1094
1142
  ({ source, data }) => {
1095
1143
  if (source === _global && data === token) {
1096
1144
  callbacks.length && callbacks.shift()();
1097
1145
  }
1098
1146
  },
1099
- false,
1147
+ false
1100
1148
  );
1101
1149
 
1102
1150
  return (cb) => {
1103
1151
  callbacks.push(cb);
1104
- _global.postMessage(token, "*");
1152
+ _global.postMessage(token, '*');
1105
1153
  };
1106
1154
  })(`axios@${Math.random()}`, [])
1107
1155
  : (cb) => setTimeout(cb);
1108
- })(typeof setImmediate === "function", isFunction$1(_global.postMessage));
1156
+ })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
1109
1157
 
1158
+ /**
1159
+ * Schedules a microtask or asynchronous callback as soon as possible.
1160
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
1161
+ *
1162
+ * @type {Function}
1163
+ */
1110
1164
  const asap =
1111
- typeof queueMicrotask !== "undefined"
1165
+ typeof queueMicrotask !== 'undefined'
1112
1166
  ? queueMicrotask.bind(_global)
1113
- : (typeof process !== "undefined" && process.nextTick) || _setImmediate;
1167
+ : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
1114
1168
 
1115
1169
  // *********************
1116
1170
 
@@ -1135,6 +1189,8 @@ var utils$1 = {
1135
1189
  isUndefined,
1136
1190
  isDate,
1137
1191
  isFile,
1192
+ isReactNativeBlob,
1193
+ isReactNative,
1138
1194
  isBlob,
1139
1195
  isRegExp,
1140
1196
  isFunction: isFunction$1,
@@ -1177,14 +1233,20 @@ var utils$1 = {
1177
1233
  };
1178
1234
 
1179
1235
  let AxiosError$1 = class AxiosError extends Error {
1180
- static from(error, code, config, request, response, customProps) {
1181
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1182
- axiosError.cause = error;
1183
- axiosError.name = error.name;
1184
- customProps && Object.assign(axiosError, customProps);
1185
- return axiosError;
1236
+ static from(error, code, config, request, response, customProps) {
1237
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1238
+ axiosError.cause = error;
1239
+ axiosError.name = error.name;
1240
+
1241
+ // Preserve status from the original error if not already set from response
1242
+ if (error.status != null && axiosError.status == null) {
1243
+ axiosError.status = error.status;
1186
1244
  }
1187
1245
 
1246
+ customProps && Object.assign(axiosError, customProps);
1247
+ return axiosError;
1248
+ }
1249
+
1188
1250
  /**
1189
1251
  * Create an Error with the specified message, config, error code, request and response.
1190
1252
  *
@@ -1197,37 +1259,48 @@ let AxiosError$1 = class AxiosError extends Error {
1197
1259
  * @returns {Error} The created error.
1198
1260
  */
1199
1261
  constructor(message, code, config, request, response) {
1200
- super(message);
1201
- this.name = 'AxiosError';
1202
- this.isAxiosError = true;
1203
- code && (this.code = code);
1204
- config && (this.config = config);
1205
- request && (this.request = request);
1206
- if (response) {
1207
- this.response = response;
1208
- this.status = response.status;
1209
- }
1262
+ super(message);
1263
+
1264
+ // Make message enumerable to maintain backward compatibility
1265
+ // The native Error constructor sets message as non-enumerable,
1266
+ // but axios < v1.13.3 had it as enumerable
1267
+ Object.defineProperty(this, 'message', {
1268
+ value: message,
1269
+ enumerable: true,
1270
+ writable: true,
1271
+ configurable: true
1272
+ });
1273
+
1274
+ this.name = 'AxiosError';
1275
+ this.isAxiosError = true;
1276
+ code && (this.code = code);
1277
+ config && (this.config = config);
1278
+ request && (this.request = request);
1279
+ if (response) {
1280
+ this.response = response;
1281
+ this.status = response.status;
1282
+ }
1210
1283
  }
1211
1284
 
1212
- toJSON() {
1213
- return {
1214
- // Standard
1215
- message: this.message,
1216
- name: this.name,
1217
- // Microsoft
1218
- description: this.description,
1219
- number: this.number,
1220
- // Mozilla
1221
- fileName: this.fileName,
1222
- lineNumber: this.lineNumber,
1223
- columnNumber: this.columnNumber,
1224
- stack: this.stack,
1225
- // Axios
1226
- config: utils$1.toJSONObject(this.config),
1227
- code: this.code,
1228
- status: this.status,
1229
- };
1230
- }
1285
+ toJSON() {
1286
+ return {
1287
+ // Standard
1288
+ message: this.message,
1289
+ name: this.name,
1290
+ // Microsoft
1291
+ description: this.description,
1292
+ number: this.number,
1293
+ // Mozilla
1294
+ fileName: this.fileName,
1295
+ lineNumber: this.lineNumber,
1296
+ columnNumber: this.columnNumber,
1297
+ stack: this.stack,
1298
+ // Axios
1299
+ config: utils$1.toJSONObject(this.config),
1300
+ code: this.code,
1301
+ status: this.status,
1302
+ };
1303
+ }
1231
1304
  };
1232
1305
 
1233
1306
  // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
@@ -1280,11 +1353,14 @@ function removeBrackets(key) {
1280
1353
  */
1281
1354
  function renderKey(path, key, dots) {
1282
1355
  if (!path) return key;
1283
- return path.concat(key).map(function each(token, i) {
1284
- // eslint-disable-next-line no-param-reassign
1285
- token = removeBrackets(token);
1286
- return !dots && i ? '[' + token + ']' : token;
1287
- }).join(dots ? '.' : '');
1356
+ return path
1357
+ .concat(key)
1358
+ .map(function each(token, i) {
1359
+ // eslint-disable-next-line no-param-reassign
1360
+ token = removeBrackets(token);
1361
+ return !dots && i ? '[' + token + ']' : token;
1362
+ })
1363
+ .join(dots ? '.' : '');
1288
1364
  }
1289
1365
 
1290
1366
  /**
@@ -1334,21 +1410,26 @@ function toFormData$1(obj, formData, options) {
1334
1410
  formData = formData || new (FormData)();
1335
1411
 
1336
1412
  // eslint-disable-next-line no-param-reassign
1337
- options = utils$1.toFlatObject(options, {
1338
- metaTokens: true,
1339
- dots: false,
1340
- indexes: false
1341
- }, false, function defined(option, source) {
1342
- // eslint-disable-next-line no-eq-null,eqeqeq
1343
- return !utils$1.isUndefined(source[option]);
1344
- });
1413
+ options = utils$1.toFlatObject(
1414
+ options,
1415
+ {
1416
+ metaTokens: true,
1417
+ dots: false,
1418
+ indexes: false,
1419
+ },
1420
+ false,
1421
+ function defined(option, source) {
1422
+ // eslint-disable-next-line no-eq-null,eqeqeq
1423
+ return !utils$1.isUndefined(source[option]);
1424
+ }
1425
+ );
1345
1426
 
1346
1427
  const metaTokens = options.metaTokens;
1347
1428
  // eslint-disable-next-line no-use-before-define
1348
1429
  const visitor = options.visitor || defaultVisitor;
1349
1430
  const dots = options.dots;
1350
1431
  const indexes = options.indexes;
1351
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1432
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1352
1433
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1353
1434
 
1354
1435
  if (!utils$1.isFunction(visitor)) {
@@ -1390,6 +1471,11 @@ function toFormData$1(obj, formData, options) {
1390
1471
  function defaultVisitor(value, key, path) {
1391
1472
  let arr = value;
1392
1473
 
1474
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1475
+ formData.append(renderKey(path, key, dots), convertValue(value));
1476
+ return false;
1477
+ }
1478
+
1393
1479
  if (value && !path && typeof value === 'object') {
1394
1480
  if (utils$1.endsWith(key, '{}')) {
1395
1481
  // eslint-disable-next-line no-param-reassign
@@ -1398,17 +1484,22 @@ function toFormData$1(obj, formData, options) {
1398
1484
  value = JSON.stringify(value);
1399
1485
  } else if (
1400
1486
  (utils$1.isArray(value) && isFlatArray(value)) ||
1401
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
1402
- )) {
1487
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
1488
+ ) {
1403
1489
  // eslint-disable-next-line no-param-reassign
1404
1490
  key = removeBrackets(key);
1405
1491
 
1406
1492
  arr.forEach(function each(el, index) {
1407
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1408
- // eslint-disable-next-line no-nested-ternary
1409
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1410
- convertValue(el)
1411
- );
1493
+ !(utils$1.isUndefined(el) || el === null) &&
1494
+ formData.append(
1495
+ // eslint-disable-next-line no-nested-ternary
1496
+ indexes === true
1497
+ ? renderKey([key], index, dots)
1498
+ : indexes === null
1499
+ ? key
1500
+ : key + '[]',
1501
+ convertValue(el)
1502
+ );
1412
1503
  });
1413
1504
  return false;
1414
1505
  }
@@ -1428,7 +1519,7 @@ function toFormData$1(obj, formData, options) {
1428
1519
  const exposedHelpers = Object.assign(predicates, {
1429
1520
  defaultVisitor,
1430
1521
  convertValue,
1431
- isVisitable
1522
+ isVisitable,
1432
1523
  });
1433
1524
 
1434
1525
  function build(value, path) {
@@ -1441,9 +1532,9 @@ function toFormData$1(obj, formData, options) {
1441
1532
  stack.push(value);
1442
1533
 
1443
1534
  utils$1.forEach(value, function each(el, key) {
1444
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1445
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1446
- );
1535
+ const result =
1536
+ !(utils$1.isUndefined(el) || el === null) &&
1537
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1447
1538
 
1448
1539
  if (result === true) {
1449
1540
  build(el, path ? path.concat(key) : [key]);
@@ -1478,7 +1569,7 @@ function encode$1(str) {
1478
1569
  ')': '%29',
1479
1570
  '~': '%7E',
1480
1571
  '%20': '+',
1481
- '%00': '\x00'
1572
+ '%00': '\x00',
1482
1573
  };
1483
1574
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1484
1575
  return charMap[match];
@@ -1506,29 +1597,33 @@ prototype.append = function append(name, value) {
1506
1597
  };
1507
1598
 
1508
1599
  prototype.toString = function toString(encoder) {
1509
- const _encode = encoder ? function(value) {
1510
- return encoder.call(this, value, encode$1);
1511
- } : encode$1;
1600
+ const _encode = encoder
1601
+ ? function (value) {
1602
+ return encoder.call(this, value, encode$1);
1603
+ }
1604
+ : encode$1;
1512
1605
 
1513
- return this._pairs.map(function each(pair) {
1514
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1515
- }, '').join('&');
1606
+ return this._pairs
1607
+ .map(function each(pair) {
1608
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1609
+ }, '')
1610
+ .join('&');
1516
1611
  };
1517
1612
 
1518
1613
  /**
1519
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1520
- * URI encoded counterparts
1614
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1615
+ * their plain counterparts (`:`, `$`, `,`, `+`).
1521
1616
  *
1522
1617
  * @param {string} val The value to be encoded.
1523
1618
  *
1524
1619
  * @returns {string} The encoded value.
1525
1620
  */
1526
1621
  function encode(val) {
1527
- return encodeURIComponent(val).
1528
- replace(/%3A/gi, ':').
1529
- replace(/%24/g, '$').
1530
- replace(/%2C/gi, ',').
1531
- replace(/%20/g, '+');
1622
+ return encodeURIComponent(val)
1623
+ .replace(/%3A/gi, ':')
1624
+ .replace(/%24/g, '$')
1625
+ .replace(/%2C/gi, ',')
1626
+ .replace(/%20/g, '+');
1532
1627
  }
1533
1628
 
1534
1629
  /**
@@ -1545,11 +1640,13 @@ function buildURL(url, params, options) {
1545
1640
  return url;
1546
1641
  }
1547
1642
 
1548
- const _encode = options && options.encode || encode;
1643
+ const _encode = (options && options.encode) || encode;
1549
1644
 
1550
- const _options = utils$1.isFunction(options) ? {
1551
- serialize: options
1552
- } : options;
1645
+ const _options = utils$1.isFunction(options)
1646
+ ? {
1647
+ serialize: options,
1648
+ }
1649
+ : options;
1553
1650
 
1554
1651
  const serializeFn = _options && _options.serialize;
1555
1652
 
@@ -1558,13 +1655,13 @@ function buildURL(url, params, options) {
1558
1655
  if (serializeFn) {
1559
1656
  serializedParams = serializeFn(params, _options);
1560
1657
  } else {
1561
- serializedParams = utils$1.isURLSearchParams(params) ?
1562
- params.toString() :
1563
- new AxiosURLSearchParams(params, _options).toString(_encode);
1658
+ serializedParams = utils$1.isURLSearchParams(params)
1659
+ ? params.toString()
1660
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
1564
1661
  }
1565
1662
 
1566
1663
  if (serializedParams) {
1567
- const hashmarkIndex = url.indexOf("#");
1664
+ const hashmarkIndex = url.indexOf('#');
1568
1665
 
1569
1666
  if (hashmarkIndex !== -1) {
1570
1667
  url = url.slice(0, hashmarkIndex);
@@ -1594,7 +1691,7 @@ class InterceptorManager {
1594
1691
  fulfilled,
1595
1692
  rejected,
1596
1693
  synchronous: options ? options.synchronous : false,
1597
- runWhen: options ? options.runWhen : null
1694
+ runWhen: options ? options.runWhen : null,
1598
1695
  });
1599
1696
  return this.handlers.length - 1;
1600
1697
  }
@@ -1646,7 +1743,7 @@ var transitionalDefaults = {
1646
1743
  silentJSONParsing: true,
1647
1744
  forcedJSONParsing: true,
1648
1745
  clarifyTimeoutError: false,
1649
- legacyInterceptorReqResOrdering: true
1746
+ legacyInterceptorReqResOrdering: true,
1650
1747
  };
1651
1748
 
1652
1749
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -1660,14 +1757,14 @@ var platform$1 = {
1660
1757
  classes: {
1661
1758
  URLSearchParams: URLSearchParams$1,
1662
1759
  FormData: FormData$1,
1663
- Blob: Blob$1
1760
+ Blob: Blob$1,
1664
1761
  },
1665
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1762
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
1666
1763
  };
1667
1764
 
1668
1765
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1669
1766
 
1670
- const _navigator = typeof navigator === 'object' && navigator || undefined;
1767
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
1671
1768
 
1672
1769
  /**
1673
1770
  * Determine if we're running in a standard browser environment
@@ -1686,7 +1783,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
1686
1783
  *
1687
1784
  * @returns {boolean}
1688
1785
  */
1689
- const hasStandardBrowserEnv = hasBrowserEnv &&
1786
+ const hasStandardBrowserEnv =
1787
+ hasBrowserEnv &&
1690
1788
  (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1691
1789
 
1692
1790
  /**
@@ -1707,7 +1805,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
1707
1805
  );
1708
1806
  })();
1709
1807
 
1710
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1808
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
1711
1809
 
1712
1810
  var utils = /*#__PURE__*/Object.freeze({
1713
1811
  __proto__: null,
@@ -1720,12 +1818,12 @@ var utils = /*#__PURE__*/Object.freeze({
1720
1818
 
1721
1819
  var platform = {
1722
1820
  ...utils,
1723
- ...platform$1
1821
+ ...platform$1,
1724
1822
  };
1725
1823
 
1726
1824
  function toURLEncodedForm(data, options) {
1727
1825
  return toFormData$1(data, new platform.classes.URLSearchParams(), {
1728
- visitor: function(value, key, path, helpers) {
1826
+ visitor: function (value, key, path, helpers) {
1729
1827
  if (platform.isNode && utils$1.isBuffer(value)) {
1730
1828
  this.append(key, value.toString('base64'));
1731
1829
  return false;
@@ -1733,7 +1831,7 @@ function toURLEncodedForm(data, options) {
1733
1831
 
1734
1832
  return helpers.defaultVisitor.apply(this, arguments);
1735
1833
  },
1736
- ...options
1834
+ ...options,
1737
1835
  });
1738
1836
  }
1739
1837
 
@@ -1749,7 +1847,7 @@ function parsePropPath(name) {
1749
1847
  // foo.x.y.z
1750
1848
  // foo-x-y-z
1751
1849
  // foo x y z
1752
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1850
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1753
1851
  return match[0] === '[]' ? '' : match[1] || match[0];
1754
1852
  });
1755
1853
  }
@@ -1853,96 +1951,107 @@ function stringifySafely(rawValue, parser, encoder) {
1853
1951
  }
1854
1952
 
1855
1953
  const defaults = {
1856
-
1857
1954
  transitional: transitionalDefaults,
1858
1955
 
1859
1956
  adapter: ['xhr', 'http', 'fetch'],
1860
1957
 
1861
- transformRequest: [function transformRequest(data, headers) {
1862
- const contentType = headers.getContentType() || '';
1863
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1864
- const isObjectPayload = utils$1.isObject(data);
1958
+ transformRequest: [
1959
+ function transformRequest(data, headers) {
1960
+ const contentType = headers.getContentType() || '';
1961
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1962
+ const isObjectPayload = utils$1.isObject(data);
1865
1963
 
1866
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1867
- data = new FormData(data);
1868
- }
1964
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1965
+ data = new FormData(data);
1966
+ }
1869
1967
 
1870
- const isFormData = utils$1.isFormData(data);
1968
+ const isFormData = utils$1.isFormData(data);
1871
1969
 
1872
- if (isFormData) {
1873
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1874
- }
1970
+ if (isFormData) {
1971
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1972
+ }
1875
1973
 
1876
- if (utils$1.isArrayBuffer(data) ||
1877
- utils$1.isBuffer(data) ||
1878
- utils$1.isStream(data) ||
1879
- utils$1.isFile(data) ||
1880
- utils$1.isBlob(data) ||
1881
- utils$1.isReadableStream(data)
1882
- ) {
1883
- return data;
1884
- }
1885
- if (utils$1.isArrayBufferView(data)) {
1886
- return data.buffer;
1887
- }
1888
- if (utils$1.isURLSearchParams(data)) {
1889
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1890
- return data.toString();
1891
- }
1974
+ if (
1975
+ utils$1.isArrayBuffer(data) ||
1976
+ utils$1.isBuffer(data) ||
1977
+ utils$1.isStream(data) ||
1978
+ utils$1.isFile(data) ||
1979
+ utils$1.isBlob(data) ||
1980
+ utils$1.isReadableStream(data)
1981
+ ) {
1982
+ return data;
1983
+ }
1984
+ if (utils$1.isArrayBufferView(data)) {
1985
+ return data.buffer;
1986
+ }
1987
+ if (utils$1.isURLSearchParams(data)) {
1988
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1989
+ return data.toString();
1990
+ }
1892
1991
 
1893
- let isFileList;
1992
+ let isFileList;
1894
1993
 
1895
- if (isObjectPayload) {
1896
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1897
- return toURLEncodedForm(data, this.formSerializer).toString();
1898
- }
1994
+ if (isObjectPayload) {
1995
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1996
+ return toURLEncodedForm(data, this.formSerializer).toString();
1997
+ }
1899
1998
 
1900
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1901
- const _FormData = this.env && this.env.FormData;
1999
+ if (
2000
+ (isFileList = utils$1.isFileList(data)) ||
2001
+ contentType.indexOf('multipart/form-data') > -1
2002
+ ) {
2003
+ const _FormData = this.env && this.env.FormData;
1902
2004
 
1903
- return toFormData$1(
1904
- isFileList ? {'files[]': data} : data,
1905
- _FormData && new _FormData(),
1906
- this.formSerializer
1907
- );
2005
+ return toFormData$1(
2006
+ isFileList ? { 'files[]': data } : data,
2007
+ _FormData && new _FormData(),
2008
+ this.formSerializer
2009
+ );
2010
+ }
1908
2011
  }
1909
- }
1910
2012
 
1911
- if (isObjectPayload || hasJSONContentType ) {
1912
- headers.setContentType('application/json', false);
1913
- return stringifySafely(data);
1914
- }
2013
+ if (isObjectPayload || hasJSONContentType) {
2014
+ headers.setContentType('application/json', false);
2015
+ return stringifySafely(data);
2016
+ }
1915
2017
 
1916
- return data;
1917
- }],
2018
+ return data;
2019
+ },
2020
+ ],
1918
2021
 
1919
- transformResponse: [function transformResponse(data) {
1920
- const transitional = this.transitional || defaults.transitional;
1921
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1922
- const JSONRequested = this.responseType === 'json';
2022
+ transformResponse: [
2023
+ function transformResponse(data) {
2024
+ const transitional = this.transitional || defaults.transitional;
2025
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2026
+ const JSONRequested = this.responseType === 'json';
1923
2027
 
1924
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1925
- return data;
1926
- }
2028
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2029
+ return data;
2030
+ }
1927
2031
 
1928
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1929
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
1930
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
2032
+ if (
2033
+ data &&
2034
+ utils$1.isString(data) &&
2035
+ ((forcedJSONParsing && !this.responseType) || JSONRequested)
2036
+ ) {
2037
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
2038
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1931
2039
 
1932
- try {
1933
- return JSON.parse(data, this.parseReviver);
1934
- } catch (e) {
1935
- if (strictJSONParsing) {
1936
- if (e.name === 'SyntaxError') {
1937
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2040
+ try {
2041
+ return JSON.parse(data, this.parseReviver);
2042
+ } catch (e) {
2043
+ if (strictJSONParsing) {
2044
+ if (e.name === 'SyntaxError') {
2045
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2046
+ }
2047
+ throw e;
1938
2048
  }
1939
- throw e;
1940
2049
  }
1941
2050
  }
1942
- }
1943
2051
 
1944
- return data;
1945
- }],
2052
+ return data;
2053
+ },
2054
+ ],
1946
2055
 
1947
2056
  /**
1948
2057
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -1958,7 +2067,7 @@ const defaults = {
1958
2067
 
1959
2068
  env: {
1960
2069
  FormData: platform.classes.FormData,
1961
- Blob: platform.classes.Blob
2070
+ Blob: platform.classes.Blob,
1962
2071
  },
1963
2072
 
1964
2073
  validateStatus: function validateStatus(status) {
@@ -1967,10 +2076,10 @@ const defaults = {
1967
2076
 
1968
2077
  headers: {
1969
2078
  common: {
1970
- 'Accept': 'application/json, text/plain, */*',
1971
- 'Content-Type': undefined
1972
- }
1973
- }
2079
+ Accept: 'application/json, text/plain, */*',
2080
+ 'Content-Type': undefined,
2081
+ },
2082
+ },
1974
2083
  };
1975
2084
 
1976
2085
  utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
@@ -1980,10 +2089,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1980
2089
  // RawAxiosHeaders whose duplicates are ignored by node
1981
2090
  // c.f. https://nodejs.org/api/http.html#http_message_headers
1982
2091
  const ignoreDuplicateOf = utils$1.toObjectSet([
1983
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
1984
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1985
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1986
- 'referer', 'retry-after', 'user-agent'
2092
+ 'age',
2093
+ 'authorization',
2094
+ 'content-length',
2095
+ 'content-type',
2096
+ 'etag',
2097
+ 'expires',
2098
+ 'from',
2099
+ 'host',
2100
+ 'if-modified-since',
2101
+ 'if-unmodified-since',
2102
+ 'last-modified',
2103
+ 'location',
2104
+ 'max-forwards',
2105
+ 'proxy-authorization',
2106
+ 'referer',
2107
+ 'retry-after',
2108
+ 'user-agent',
1987
2109
  ]);
1988
2110
 
1989
2111
  /**
@@ -2000,47 +2122,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
2000
2122
  *
2001
2123
  * @returns {Object} Headers parsed into an object
2002
2124
  */
2003
- var parseHeaders = rawHeaders => {
2125
+ var parseHeaders = (rawHeaders) => {
2004
2126
  const parsed = {};
2005
2127
  let key;
2006
2128
  let val;
2007
2129
  let i;
2008
2130
 
2009
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2010
- i = line.indexOf(':');
2011
- key = line.substring(0, i).trim().toLowerCase();
2012
- val = line.substring(i + 1).trim();
2131
+ rawHeaders &&
2132
+ rawHeaders.split('\n').forEach(function parser(line) {
2133
+ i = line.indexOf(':');
2134
+ key = line.substring(0, i).trim().toLowerCase();
2135
+ val = line.substring(i + 1).trim();
2013
2136
 
2014
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
2015
- return;
2016
- }
2137
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
2138
+ return;
2139
+ }
2017
2140
 
2018
- if (key === 'set-cookie') {
2019
- if (parsed[key]) {
2020
- parsed[key].push(val);
2141
+ if (key === 'set-cookie') {
2142
+ if (parsed[key]) {
2143
+ parsed[key].push(val);
2144
+ } else {
2145
+ parsed[key] = [val];
2146
+ }
2021
2147
  } else {
2022
- parsed[key] = [val];
2148
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2023
2149
  }
2024
- } else {
2025
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2026
- }
2027
- });
2150
+ });
2028
2151
 
2029
2152
  return parsed;
2030
2153
  };
2031
2154
 
2032
2155
  const $internals = Symbol('internals');
2033
2156
 
2157
+ const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
2158
+
2159
+ function assertValidHeaderValue(value, header) {
2160
+ if (value === false || value == null) {
2161
+ return;
2162
+ }
2163
+
2164
+ if (utils$1.isArray(value)) {
2165
+ value.forEach((v) => assertValidHeaderValue(v, header));
2166
+ return;
2167
+ }
2168
+
2169
+ if (!isValidHeaderValue(String(value))) {
2170
+ throw new Error(`Invalid character in header content ["${header}"]`);
2171
+ }
2172
+ }
2173
+
2034
2174
  function normalizeHeader(header) {
2035
2175
  return header && String(header).trim().toLowerCase();
2036
2176
  }
2037
2177
 
2178
+ function stripTrailingCRLF(str) {
2179
+ let end = str.length;
2180
+
2181
+ while (end > 0) {
2182
+ const charCode = str.charCodeAt(end - 1);
2183
+
2184
+ if (charCode !== 10 && charCode !== 13) {
2185
+ break;
2186
+ }
2187
+
2188
+ end -= 1;
2189
+ }
2190
+
2191
+ return end === str.length ? str : str.slice(0, end);
2192
+ }
2193
+
2038
2194
  function normalizeValue(value) {
2039
2195
  if (value === false || value == null) {
2040
2196
  return value;
2041
2197
  }
2042
2198
 
2043
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
2199
+ return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
2044
2200
  }
2045
2201
 
2046
2202
  function parseTokens(str) {
@@ -2078,8 +2234,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2078
2234
  }
2079
2235
 
2080
2236
  function formatHeader(header) {
2081
- return header.trim()
2082
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2237
+ return header
2238
+ .trim()
2239
+ .toLowerCase()
2240
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2083
2241
  return char.toUpperCase() + str;
2084
2242
  });
2085
2243
  }
@@ -2087,12 +2245,12 @@ function formatHeader(header) {
2087
2245
  function buildAccessors(obj, header) {
2088
2246
  const accessorName = utils$1.toCamelCase(' ' + header);
2089
2247
 
2090
- ['get', 'set', 'has'].forEach(methodName => {
2248
+ ['get', 'set', 'has'].forEach((methodName) => {
2091
2249
  Object.defineProperty(obj, methodName + accessorName, {
2092
- value: function(arg1, arg2, arg3) {
2250
+ value: function (arg1, arg2, arg3) {
2093
2251
  return this[methodName].call(this, header, arg1, arg2, arg3);
2094
2252
  },
2095
- configurable: true
2253
+ configurable: true,
2096
2254
  });
2097
2255
  });
2098
2256
  }
@@ -2114,7 +2272,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
2114
2272
 
2115
2273
  const key = utils$1.findKey(self, lHeader);
2116
2274
 
2117
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
2275
+ if (
2276
+ !key ||
2277
+ self[key] === undefined ||
2278
+ _rewrite === true ||
2279
+ (_rewrite === undefined && self[key] !== false)
2280
+ ) {
2281
+ assertValidHeaderValue(_value, _header);
2118
2282
  self[key || _header] = normalizeValue(_value);
2119
2283
  }
2120
2284
  }
@@ -2124,17 +2288,22 @@ let AxiosHeaders$1 = class AxiosHeaders {
2124
2288
 
2125
2289
  if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2126
2290
  setHeaders(header, valueOrRewrite);
2127
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2291
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2128
2292
  setHeaders(parseHeaders(header), valueOrRewrite);
2129
2293
  } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2130
- let obj = {}, dest, key;
2294
+ let obj = {},
2295
+ dest,
2296
+ key;
2131
2297
  for (const entry of header) {
2132
2298
  if (!utils$1.isArray(entry)) {
2133
2299
  throw TypeError('Object iterator must return a key-value pair');
2134
2300
  }
2135
2301
 
2136
- obj[key = entry[0]] = (dest = obj[key]) ?
2137
- (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
2302
+ obj[(key = entry[0])] = (dest = obj[key])
2303
+ ? utils$1.isArray(dest)
2304
+ ? [...dest, entry[1]]
2305
+ : [dest, entry[1]]
2306
+ : entry[1];
2138
2307
  }
2139
2308
 
2140
2309
  setHeaders(obj, valueOrRewrite);
@@ -2181,7 +2350,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
2181
2350
  if (header) {
2182
2351
  const key = utils$1.findKey(this, header);
2183
2352
 
2184
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2353
+ return !!(
2354
+ key &&
2355
+ this[key] !== undefined &&
2356
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
2357
+ );
2185
2358
  }
2186
2359
 
2187
2360
  return false;
@@ -2221,7 +2394,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
2221
2394
 
2222
2395
  while (i--) {
2223
2396
  const key = keys[i];
2224
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2397
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2225
2398
  delete this[key];
2226
2399
  deleted = true;
2227
2400
  }
@@ -2265,7 +2438,9 @@ let AxiosHeaders$1 = class AxiosHeaders {
2265
2438
  const obj = Object.create(null);
2266
2439
 
2267
2440
  utils$1.forEach(this, (value, header) => {
2268
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2441
+ value != null &&
2442
+ value !== false &&
2443
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2269
2444
  });
2270
2445
 
2271
2446
  return obj;
@@ -2276,11 +2451,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
2276
2451
  }
2277
2452
 
2278
2453
  toString() {
2279
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
2454
+ return Object.entries(this.toJSON())
2455
+ .map(([header, value]) => header + ': ' + value)
2456
+ .join('\n');
2280
2457
  }
2281
2458
 
2282
2459
  getSetCookie() {
2283
- return this.get("set-cookie") || [];
2460
+ return this.get('set-cookie') || [];
2284
2461
  }
2285
2462
 
2286
2463
  get [Symbol.toStringTag]() {
@@ -2300,9 +2477,12 @@ let AxiosHeaders$1 = class AxiosHeaders {
2300
2477
  }
2301
2478
 
2302
2479
  static accessor(header) {
2303
- const internals = this[$internals] = (this[$internals] = {
2304
- accessors: {}
2305
- });
2480
+ const internals =
2481
+ (this[$internals] =
2482
+ this[$internals] =
2483
+ {
2484
+ accessors: {},
2485
+ });
2306
2486
 
2307
2487
  const accessors = internals.accessors;
2308
2488
  const prototype = this.prototype;
@@ -2322,17 +2502,24 @@ let AxiosHeaders$1 = class AxiosHeaders {
2322
2502
  }
2323
2503
  };
2324
2504
 
2325
- AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2505
+ AxiosHeaders$1.accessor([
2506
+ 'Content-Type',
2507
+ 'Content-Length',
2508
+ 'Accept',
2509
+ 'Accept-Encoding',
2510
+ 'User-Agent',
2511
+ 'Authorization',
2512
+ ]);
2326
2513
 
2327
2514
  // reserved names hotfix
2328
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
2515
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
2329
2516
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2330
2517
  return {
2331
2518
  get: () => value,
2332
2519
  set(headerValue) {
2333
2520
  this[mapped] = headerValue;
2334
- }
2335
- }
2521
+ },
2522
+ };
2336
2523
  });
2337
2524
 
2338
2525
  utils$1.freezeMethods(AxiosHeaders$1);
@@ -2395,19 +2582,23 @@ function settle(resolve, reject, response) {
2395
2582
  if (!response.status || !validateStatus || validateStatus(response.status)) {
2396
2583
  resolve(response);
2397
2584
  } else {
2398
- reject(new AxiosError$1(
2399
- 'Request failed with status code ' + response.status,
2400
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2401
- response.config,
2402
- response.request,
2403
- response
2404
- ));
2585
+ reject(
2586
+ new AxiosError$1(
2587
+ 'Request failed with status code ' + response.status,
2588
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
2589
+ Math.floor(response.status / 100) - 4
2590
+ ],
2591
+ response.config,
2592
+ response.request,
2593
+ response
2594
+ )
2595
+ );
2405
2596
  }
2406
2597
  }
2407
2598
 
2408
2599
  function parseProtocol(url) {
2409
2600
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2410
- return match && match[1] || '';
2601
+ return (match && match[1]) || '';
2411
2602
  }
2412
2603
 
2413
2604
  /**
@@ -2458,7 +2649,7 @@ function speedometer(samplesCount, min) {
2458
2649
 
2459
2650
  const passed = startedAt && now - startedAt;
2460
2651
 
2461
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2652
+ return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
2462
2653
  };
2463
2654
  }
2464
2655
 
@@ -2487,7 +2678,7 @@ function throttle(fn, freq) {
2487
2678
  const throttled = (...args) => {
2488
2679
  const now = Date.now();
2489
2680
  const passed = now - timestamp;
2490
- if ( passed >= threshold) {
2681
+ if (passed >= threshold) {
2491
2682
  invoke(args, now);
2492
2683
  } else {
2493
2684
  lastArgs = args;
@@ -2509,7 +2700,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2509
2700
  let bytesNotified = 0;
2510
2701
  const _speedometer = speedometer(50, 250);
2511
2702
 
2512
- return throttle(e => {
2703
+ return throttle((e) => {
2513
2704
  const loaded = e.loaded;
2514
2705
  const total = e.lengthComputable ? e.total : undefined;
2515
2706
  const progressBytes = loaded - bytesNotified;
@@ -2521,13 +2712,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2521
2712
  const data = {
2522
2713
  loaded,
2523
2714
  total,
2524
- progress: total ? (loaded / total) : undefined,
2715
+ progress: total ? loaded / total : undefined,
2525
2716
  bytes: progressBytes,
2526
2717
  rate: rate ? rate : undefined,
2527
2718
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2528
2719
  event: e,
2529
2720
  lengthComputable: total != null,
2530
- [isDownloadStream ? 'download' : 'upload']: true
2721
+ [isDownloadStream ? 'download' : 'upload']: true,
2531
2722
  };
2532
2723
 
2533
2724
  listener(data);
@@ -2537,77 +2728,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2537
2728
  const progressEventDecorator = (total, throttled) => {
2538
2729
  const lengthComputable = total != null;
2539
2730
 
2540
- return [(loaded) => throttled[0]({
2541
- lengthComputable,
2542
- total,
2543
- loaded
2544
- }), throttled[1]];
2731
+ return [
2732
+ (loaded) =>
2733
+ throttled[0]({
2734
+ lengthComputable,
2735
+ total,
2736
+ loaded,
2737
+ }),
2738
+ throttled[1],
2739
+ ];
2545
2740
  };
2546
2741
 
2547
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2548
-
2549
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
2550
- url = new URL(url, platform.origin);
2742
+ const asyncDecorator =
2743
+ (fn) =>
2744
+ (...args) =>
2745
+ utils$1.asap(() => fn(...args));
2551
2746
 
2552
- return (
2553
- origin.protocol === url.protocol &&
2554
- origin.host === url.host &&
2555
- (isMSIE || origin.port === url.port)
2556
- );
2557
- })(
2558
- new URL(platform.origin),
2559
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2560
- ) : () => true;
2561
-
2562
- var cookies = platform.hasStandardBrowserEnv ?
2747
+ var isURLSameOrigin = platform.hasStandardBrowserEnv
2748
+ ? ((origin, isMSIE) => (url) => {
2749
+ url = new URL(url, platform.origin);
2563
2750
 
2564
- // Standard browser envs support document.cookie
2565
- {
2566
- write(name, value, expires, path, domain, secure, sameSite) {
2567
- if (typeof document === 'undefined') return;
2568
-
2569
- const cookie = [`${name}=${encodeURIComponent(value)}`];
2570
-
2571
- if (utils$1.isNumber(expires)) {
2572
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
2573
- }
2574
- if (utils$1.isString(path)) {
2575
- cookie.push(`path=${path}`);
2576
- }
2577
- if (utils$1.isString(domain)) {
2578
- cookie.push(`domain=${domain}`);
2579
- }
2580
- if (secure === true) {
2581
- cookie.push('secure');
2582
- }
2583
- if (utils$1.isString(sameSite)) {
2584
- cookie.push(`SameSite=${sameSite}`);
2585
- }
2751
+ return (
2752
+ origin.protocol === url.protocol &&
2753
+ origin.host === url.host &&
2754
+ (isMSIE || origin.port === url.port)
2755
+ );
2756
+ })(
2757
+ new URL(platform.origin),
2758
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2759
+ )
2760
+ : () => true;
2761
+
2762
+ var cookies = platform.hasStandardBrowserEnv
2763
+ ? // Standard browser envs support document.cookie
2764
+ {
2765
+ write(name, value, expires, path, domain, secure, sameSite) {
2766
+ if (typeof document === 'undefined') return;
2767
+
2768
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
2769
+
2770
+ if (utils$1.isNumber(expires)) {
2771
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
2772
+ }
2773
+ if (utils$1.isString(path)) {
2774
+ cookie.push(`path=${path}`);
2775
+ }
2776
+ if (utils$1.isString(domain)) {
2777
+ cookie.push(`domain=${domain}`);
2778
+ }
2779
+ if (secure === true) {
2780
+ cookie.push('secure');
2781
+ }
2782
+ if (utils$1.isString(sameSite)) {
2783
+ cookie.push(`SameSite=${sameSite}`);
2784
+ }
2586
2785
 
2587
- document.cookie = cookie.join('; ');
2588
- },
2786
+ document.cookie = cookie.join('; ');
2787
+ },
2589
2788
 
2590
- read(name) {
2591
- if (typeof document === 'undefined') return null;
2592
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2593
- return match ? decodeURIComponent(match[1]) : null;
2594
- },
2789
+ read(name) {
2790
+ if (typeof document === 'undefined') return null;
2791
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2792
+ return match ? decodeURIComponent(match[1]) : null;
2793
+ },
2595
2794
 
2596
- remove(name) {
2597
- this.write(name, '', Date.now() - 86400000, '/');
2795
+ remove(name) {
2796
+ this.write(name, '', Date.now() - 86400000, '/');
2797
+ },
2598
2798
  }
2599
- }
2600
-
2601
- :
2602
-
2603
- // Non-standard browser env (web workers, react-native) lack needed support.
2604
- {
2605
- write() {},
2606
- read() {
2607
- return null;
2608
- },
2609
- remove() {}
2610
- };
2799
+ : // Non-standard browser env (web workers, react-native) lack needed support.
2800
+ {
2801
+ write() {},
2802
+ read() {
2803
+ return null;
2804
+ },
2805
+ remove() {},
2806
+ };
2611
2807
 
2612
2808
  /**
2613
2809
  * Determines whether the specified URL is absolute
@@ -2659,8 +2855,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2659
2855
  return requestedURL;
2660
2856
  }
2661
2857
 
2662
- const headersToObject = (thing) =>
2663
- thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2858
+ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
2664
2859
 
2665
2860
  /**
2666
2861
  * Config-specific merge-function which creates a new config-object
@@ -2753,23 +2948,12 @@ function mergeConfig$1(config1, config2) {
2753
2948
  mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
2754
2949
  };
2755
2950
 
2756
- utils$1.forEach(
2757
- Object.keys({ ...config1, ...config2 }),
2758
- function computeConfigValue(prop) {
2759
- if (
2760
- prop === "__proto__" ||
2761
- prop === "constructor" ||
2762
- prop === "prototype"
2763
- )
2764
- return;
2765
- const merge = utils$1.hasOwnProp(mergeMap, prop)
2766
- ? mergeMap[prop]
2767
- : mergeDeepProperties;
2768
- const configValue = merge(config1[prop], config2[prop], prop);
2769
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
2770
- (config[prop] = configValue);
2771
- },
2772
- );
2951
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2952
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2953
+ const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2954
+ const configValue = merge(config1[prop], config2[prop], prop);
2955
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2956
+ });
2773
2957
 
2774
2958
  return config;
2775
2959
  }
@@ -2781,12 +2965,22 @@ var resolveConfig = (config) => {
2781
2965
 
2782
2966
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2783
2967
 
2784
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2968
+ newConfig.url = buildURL(
2969
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
2970
+ config.params,
2971
+ config.paramsSerializer
2972
+ );
2785
2973
 
2786
2974
  // HTTP basic authentication
2787
2975
  if (auth) {
2788
- headers.set('Authorization', 'Basic ' +
2789
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
2976
+ headers.set(
2977
+ 'Authorization',
2978
+ 'Basic ' +
2979
+ btoa(
2980
+ (auth.username || '') +
2981
+ ':' +
2982
+ (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
2983
+ )
2790
2984
  );
2791
2985
  }
2792
2986
 
@@ -2804,7 +2998,7 @@ var resolveConfig = (config) => {
2804
2998
  }
2805
2999
  });
2806
3000
  }
2807
- }
3001
+ }
2808
3002
 
2809
3003
  // Add xsrf header
2810
3004
  // This is only done if running in a standard browser environment.
@@ -2828,196 +3022,218 @@ var resolveConfig = (config) => {
2828
3022
 
2829
3023
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2830
3024
 
2831
- var xhrAdapter = isXHRAdapterSupported && function (config) {
2832
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2833
- const _config = resolveConfig(config);
2834
- let requestData = _config.data;
2835
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2836
- let {responseType, onUploadProgress, onDownloadProgress} = _config;
2837
- let onCanceled;
2838
- let uploadThrottled, downloadThrottled;
2839
- let flushUpload, flushDownload;
3025
+ var xhrAdapter = isXHRAdapterSupported &&
3026
+ function (config) {
3027
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
3028
+ const _config = resolveConfig(config);
3029
+ let requestData = _config.data;
3030
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3031
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
3032
+ let onCanceled;
3033
+ let uploadThrottled, downloadThrottled;
3034
+ let flushUpload, flushDownload;
2840
3035
 
2841
- function done() {
2842
- flushUpload && flushUpload(); // flush events
2843
- flushDownload && flushDownload(); // flush events
3036
+ function done() {
3037
+ flushUpload && flushUpload(); // flush events
3038
+ flushDownload && flushDownload(); // flush events
2844
3039
 
2845
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3040
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2846
3041
 
2847
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2848
- }
3042
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
3043
+ }
2849
3044
 
2850
- let request = new XMLHttpRequest();
3045
+ let request = new XMLHttpRequest();
2851
3046
 
2852
- request.open(_config.method.toUpperCase(), _config.url, true);
3047
+ request.open(_config.method.toUpperCase(), _config.url, true);
2853
3048
 
2854
- // Set the request timeout in MS
2855
- request.timeout = _config.timeout;
3049
+ // Set the request timeout in MS
3050
+ request.timeout = _config.timeout;
2856
3051
 
2857
- function onloadend() {
2858
- if (!request) {
2859
- return;
3052
+ function onloadend() {
3053
+ if (!request) {
3054
+ return;
3055
+ }
3056
+ // Prepare the response
3057
+ const responseHeaders = AxiosHeaders$1.from(
3058
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
3059
+ );
3060
+ const responseData =
3061
+ !responseType || responseType === 'text' || responseType === 'json'
3062
+ ? request.responseText
3063
+ : request.response;
3064
+ const response = {
3065
+ data: responseData,
3066
+ status: request.status,
3067
+ statusText: request.statusText,
3068
+ headers: responseHeaders,
3069
+ config,
3070
+ request,
3071
+ };
3072
+
3073
+ settle(
3074
+ function _resolve(value) {
3075
+ resolve(value);
3076
+ done();
3077
+ },
3078
+ function _reject(err) {
3079
+ reject(err);
3080
+ done();
3081
+ },
3082
+ response
3083
+ );
3084
+
3085
+ // Clean up request
3086
+ request = null;
2860
3087
  }
2861
- // Prepare the response
2862
- const responseHeaders = AxiosHeaders$1.from(
2863
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2864
- );
2865
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2866
- request.responseText : request.response;
2867
- const response = {
2868
- data: responseData,
2869
- status: request.status,
2870
- statusText: request.statusText,
2871
- headers: responseHeaders,
2872
- config,
2873
- request
2874
- };
2875
3088
 
2876
- settle(function _resolve(value) {
2877
- resolve(value);
2878
- done();
2879
- }, function _reject(err) {
2880
- reject(err);
2881
- done();
2882
- }, response);
3089
+ if ('onloadend' in request) {
3090
+ // Use onloadend if available
3091
+ request.onloadend = onloadend;
3092
+ } else {
3093
+ // Listen for ready state to emulate onloadend
3094
+ request.onreadystatechange = function handleLoad() {
3095
+ if (!request || request.readyState !== 4) {
3096
+ return;
3097
+ }
2883
3098
 
2884
- // Clean up request
2885
- request = null;
2886
- }
3099
+ // The request errored out and we didn't get a response, this will be
3100
+ // handled by onerror instead
3101
+ // With one exception: request that using file: protocol, most browsers
3102
+ // will return status as 0 even though it's a successful request
3103
+ if (
3104
+ request.status === 0 &&
3105
+ !(request.responseURL && request.responseURL.indexOf('file:') === 0)
3106
+ ) {
3107
+ return;
3108
+ }
3109
+ // readystate handler is calling before onerror or ontimeout handlers,
3110
+ // so we should call onloadend on the next 'tick'
3111
+ setTimeout(onloadend);
3112
+ };
3113
+ }
2887
3114
 
2888
- if ('onloadend' in request) {
2889
- // Use onloadend if available
2890
- request.onloadend = onloadend;
2891
- } else {
2892
- // Listen for ready state to emulate onloadend
2893
- request.onreadystatechange = function handleLoad() {
2894
- if (!request || request.readyState !== 4) {
3115
+ // Handle browser request cancellation (as opposed to a manual cancellation)
3116
+ request.onabort = function handleAbort() {
3117
+ if (!request) {
2895
3118
  return;
2896
3119
  }
2897
3120
 
2898
- // The request errored out and we didn't get a response, this will be
2899
- // handled by onerror instead
2900
- // With one exception: request that using file: protocol, most browsers
2901
- // will return status as 0 even though it's a successful request
2902
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2903
- return;
2904
- }
2905
- // readystate handler is calling before onerror or ontimeout handlers,
2906
- // so we should call onloadend on the next 'tick'
2907
- setTimeout(onloadend);
3121
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
3122
+
3123
+ // Clean up request
3124
+ request = null;
2908
3125
  };
2909
- }
2910
3126
 
2911
- // Handle browser request cancellation (as opposed to a manual cancellation)
2912
- request.onabort = function handleAbort() {
2913
- if (!request) {
2914
- return;
2915
- }
3127
+ // Handle low level network errors
3128
+ request.onerror = function handleError(event) {
3129
+ // Browsers deliver a ProgressEvent in XHR onerror
3130
+ // (message may be empty; when present, surface it)
3131
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3132
+ const msg = event && event.message ? event.message : 'Network Error';
3133
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
3134
+ // attach the underlying event for consumers who want details
3135
+ err.event = event || null;
3136
+ reject(err);
3137
+ request = null;
3138
+ };
3139
+
3140
+ // Handle timeout
3141
+ request.ontimeout = function handleTimeout() {
3142
+ let timeoutErrorMessage = _config.timeout
3143
+ ? 'timeout of ' + _config.timeout + 'ms exceeded'
3144
+ : 'timeout exceeded';
3145
+ const transitional = _config.transitional || transitionalDefaults;
3146
+ if (_config.timeoutErrorMessage) {
3147
+ timeoutErrorMessage = _config.timeoutErrorMessage;
3148
+ }
3149
+ reject(
3150
+ new AxiosError$1(
3151
+ timeoutErrorMessage,
3152
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
3153
+ config,
3154
+ request
3155
+ )
3156
+ );
2916
3157
 
2917
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
3158
+ // Clean up request
3159
+ request = null;
3160
+ };
2918
3161
 
2919
- // Clean up request
2920
- request = null;
2921
- };
3162
+ // Remove Content-Type if data is undefined
3163
+ requestData === undefined && requestHeaders.setContentType(null);
2922
3164
 
2923
- // Handle low level network errors
2924
- request.onerror = function handleError(event) {
2925
- // Browsers deliver a ProgressEvent in XHR onerror
2926
- // (message may be empty; when present, surface it)
2927
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2928
- const msg = event && event.message ? event.message : 'Network Error';
2929
- const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
2930
- // attach the underlying event for consumers who want details
2931
- err.event = event || null;
2932
- reject(err);
2933
- request = null;
2934
- };
2935
-
2936
- // Handle timeout
2937
- request.ontimeout = function handleTimeout() {
2938
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2939
- const transitional = _config.transitional || transitionalDefaults;
2940
- if (_config.timeoutErrorMessage) {
2941
- timeoutErrorMessage = _config.timeoutErrorMessage;
3165
+ // Add headers to the request
3166
+ if ('setRequestHeader' in request) {
3167
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3168
+ request.setRequestHeader(key, val);
3169
+ });
2942
3170
  }
2943
- reject(new AxiosError$1(
2944
- timeoutErrorMessage,
2945
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2946
- config,
2947
- request));
2948
-
2949
- // Clean up request
2950
- request = null;
2951
- };
2952
-
2953
- // Remove Content-Type if data is undefined
2954
- requestData === undefined && requestHeaders.setContentType(null);
2955
3171
 
2956
- // Add headers to the request
2957
- if ('setRequestHeader' in request) {
2958
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2959
- request.setRequestHeader(key, val);
2960
- });
2961
- }
3172
+ // Add withCredentials to request if needed
3173
+ if (!utils$1.isUndefined(_config.withCredentials)) {
3174
+ request.withCredentials = !!_config.withCredentials;
3175
+ }
2962
3176
 
2963
- // Add withCredentials to request if needed
2964
- if (!utils$1.isUndefined(_config.withCredentials)) {
2965
- request.withCredentials = !!_config.withCredentials;
2966
- }
3177
+ // Add responseType to request if needed
3178
+ if (responseType && responseType !== 'json') {
3179
+ request.responseType = _config.responseType;
3180
+ }
2967
3181
 
2968
- // Add responseType to request if needed
2969
- if (responseType && responseType !== 'json') {
2970
- request.responseType = _config.responseType;
2971
- }
3182
+ // Handle progress if needed
3183
+ if (onDownloadProgress) {
3184
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
3185
+ request.addEventListener('progress', downloadThrottled);
3186
+ }
2972
3187
 
2973
- // Handle progress if needed
2974
- if (onDownloadProgress) {
2975
- ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
2976
- request.addEventListener('progress', downloadThrottled);
2977
- }
3188
+ // Not all browsers support upload events
3189
+ if (onUploadProgress && request.upload) {
3190
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
2978
3191
 
2979
- // Not all browsers support upload events
2980
- if (onUploadProgress && request.upload) {
2981
- ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
3192
+ request.upload.addEventListener('progress', uploadThrottled);
2982
3193
 
2983
- request.upload.addEventListener('progress', uploadThrottled);
3194
+ request.upload.addEventListener('loadend', flushUpload);
3195
+ }
2984
3196
 
2985
- request.upload.addEventListener('loadend', flushUpload);
2986
- }
3197
+ if (_config.cancelToken || _config.signal) {
3198
+ // Handle cancellation
3199
+ // eslint-disable-next-line func-names
3200
+ onCanceled = (cancel) => {
3201
+ if (!request) {
3202
+ return;
3203
+ }
3204
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
3205
+ request.abort();
3206
+ request = null;
3207
+ };
2987
3208
 
2988
- if (_config.cancelToken || _config.signal) {
2989
- // Handle cancellation
2990
- // eslint-disable-next-line func-names
2991
- onCanceled = cancel => {
2992
- if (!request) {
2993
- return;
3209
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3210
+ if (_config.signal) {
3211
+ _config.signal.aborted
3212
+ ? onCanceled()
3213
+ : _config.signal.addEventListener('abort', onCanceled);
2994
3214
  }
2995
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2996
- request.abort();
2997
- request = null;
2998
- };
2999
-
3000
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3001
- if (_config.signal) {
3002
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
3003
3215
  }
3004
- }
3005
3216
 
3006
- const protocol = parseProtocol(_config.url);
3007
-
3008
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3009
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
3010
- return;
3011
- }
3217
+ const protocol = parseProtocol(_config.url);
3012
3218
 
3219
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
3220
+ reject(
3221
+ new AxiosError$1(
3222
+ 'Unsupported protocol ' + protocol + ':',
3223
+ AxiosError$1.ERR_BAD_REQUEST,
3224
+ config
3225
+ )
3226
+ );
3227
+ return;
3228
+ }
3013
3229
 
3014
- // Send the request
3015
- request.send(requestData || null);
3016
- });
3017
- };
3230
+ // Send the request
3231
+ request.send(requestData || null);
3232
+ });
3233
+ };
3018
3234
 
3019
3235
  const composeSignals = (signals, timeout) => {
3020
- const {length} = (signals = signals ? signals.filter(Boolean) : []);
3236
+ const { length } = (signals = signals ? signals.filter(Boolean) : []);
3021
3237
 
3022
3238
  if (timeout || length) {
3023
3239
  let controller = new AbortController();
@@ -3029,21 +3245,29 @@ const composeSignals = (signals, timeout) => {
3029
3245
  aborted = true;
3030
3246
  unsubscribe();
3031
3247
  const err = reason instanceof Error ? reason : this.reason;
3032
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
3248
+ controller.abort(
3249
+ err instanceof AxiosError$1
3250
+ ? err
3251
+ : new CanceledError$1(err instanceof Error ? err.message : err)
3252
+ );
3033
3253
  }
3034
3254
  };
3035
3255
 
3036
- let timer = timeout && setTimeout(() => {
3037
- timer = null;
3038
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
3039
- }, timeout);
3256
+ let timer =
3257
+ timeout &&
3258
+ setTimeout(() => {
3259
+ timer = null;
3260
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
3261
+ }, timeout);
3040
3262
 
3041
3263
  const unsubscribe = () => {
3042
3264
  if (signals) {
3043
3265
  timer && clearTimeout(timer);
3044
3266
  timer = null;
3045
- signals.forEach(signal => {
3046
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3267
+ signals.forEach((signal) => {
3268
+ signal.unsubscribe
3269
+ ? signal.unsubscribe(onabort)
3270
+ : signal.removeEventListener('abort', onabort);
3047
3271
  });
3048
3272
  signals = null;
3049
3273
  }
@@ -3051,7 +3275,7 @@ const composeSignals = (signals, timeout) => {
3051
3275
 
3052
3276
  signals.forEach((signal) => signal.addEventListener('abort', onabort));
3053
3277
 
3054
- const {signal} = controller;
3278
+ const { signal } = controller;
3055
3279
 
3056
3280
  signal.unsubscribe = () => utils$1.asap(unsubscribe);
3057
3281
 
@@ -3092,7 +3316,7 @@ const readStream = async function* (stream) {
3092
3316
  const reader = stream.getReader();
3093
3317
  try {
3094
3318
  for (;;) {
3095
- const {done, value} = await reader.read();
3319
+ const { done, value } = await reader.read();
3096
3320
  if (done) {
3097
3321
  break;
3098
3322
  }
@@ -3115,64 +3339,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3115
3339
  }
3116
3340
  };
3117
3341
 
3118
- return new ReadableStream({
3119
- async pull(controller) {
3120
- try {
3121
- const {done, value} = await iterator.next();
3342
+ return new ReadableStream(
3343
+ {
3344
+ async pull(controller) {
3345
+ try {
3346
+ const { done, value } = await iterator.next();
3122
3347
 
3123
- if (done) {
3124
- _onFinish();
3125
- controller.close();
3126
- return;
3127
- }
3348
+ if (done) {
3349
+ _onFinish();
3350
+ controller.close();
3351
+ return;
3352
+ }
3128
3353
 
3129
- let len = value.byteLength;
3130
- if (onProgress) {
3131
- let loadedBytes = bytes += len;
3132
- onProgress(loadedBytes);
3354
+ let len = value.byteLength;
3355
+ if (onProgress) {
3356
+ let loadedBytes = (bytes += len);
3357
+ onProgress(loadedBytes);
3358
+ }
3359
+ controller.enqueue(new Uint8Array(value));
3360
+ } catch (err) {
3361
+ _onFinish(err);
3362
+ throw err;
3133
3363
  }
3134
- controller.enqueue(new Uint8Array(value));
3135
- } catch (err) {
3136
- _onFinish(err);
3137
- throw err;
3138
- }
3364
+ },
3365
+ cancel(reason) {
3366
+ _onFinish(reason);
3367
+ return iterator.return();
3368
+ },
3139
3369
  },
3140
- cancel(reason) {
3141
- _onFinish(reason);
3142
- return iterator.return();
3370
+ {
3371
+ highWaterMark: 2,
3143
3372
  }
3144
- }, {
3145
- highWaterMark: 2
3146
- })
3373
+ );
3147
3374
  };
3148
3375
 
3149
3376
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
3150
3377
 
3151
- const {isFunction} = utils$1;
3378
+ const { isFunction } = utils$1;
3152
3379
 
3153
- const globalFetchAPI = (({Request, Response}) => ({
3154
- Request, Response
3380
+ const globalFetchAPI = (({ Request, Response }) => ({
3381
+ Request,
3382
+ Response,
3155
3383
  }))(utils$1.global);
3156
3384
 
3157
- const {
3158
- ReadableStream: ReadableStream$1, TextEncoder
3159
- } = utils$1.global;
3160
-
3385
+ const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
3161
3386
 
3162
3387
  const test = (fn, ...args) => {
3163
3388
  try {
3164
3389
  return !!fn(...args);
3165
3390
  } catch (e) {
3166
- return false
3391
+ return false;
3167
3392
  }
3168
3393
  };
3169
3394
 
3170
3395
  const factory = (env) => {
3171
- env = utils$1.merge.call({
3172
- skipUndefined: true
3173
- }, globalFetchAPI, env);
3396
+ env = utils$1.merge.call(
3397
+ {
3398
+ skipUndefined: true,
3399
+ },
3400
+ globalFetchAPI,
3401
+ env
3402
+ );
3174
3403
 
3175
- const {fetch: envFetch, Request, Response} = env;
3404
+ const { fetch: envFetch, Request, Response } = env;
3176
3405
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3177
3406
  const isRequestSupported = isFunction(Request);
3178
3407
  const isResponseSupported = isFunction(Response);
@@ -3183,46 +3412,65 @@ const factory = (env) => {
3183
3412
 
3184
3413
  const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3185
3414
 
3186
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
3187
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
3188
- async (str) => new Uint8Array(await new Request(str).arrayBuffer())
3189
- );
3415
+ const encodeText =
3416
+ isFetchSupported &&
3417
+ (typeof TextEncoder === 'function'
3418
+ ? (
3419
+ (encoder) => (str) =>
3420
+ encoder.encode(str)
3421
+ )(new TextEncoder())
3422
+ : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
3190
3423
 
3191
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
3192
- let duplexAccessed = false;
3424
+ const supportsRequestStream =
3425
+ isRequestSupported &&
3426
+ isReadableStreamSupported &&
3427
+ test(() => {
3428
+ let duplexAccessed = false;
3193
3429
 
3194
- const hasContentType = new Request(platform.origin, {
3195
- body: new ReadableStream$1(),
3196
- method: 'POST',
3197
- get duplex() {
3198
- duplexAccessed = true;
3199
- return 'half';
3200
- },
3201
- }).headers.has('Content-Type');
3430
+ const body = new ReadableStream$1();
3202
3431
 
3203
- return duplexAccessed && !hasContentType;
3204
- });
3432
+ const hasContentType = new Request(platform.origin, {
3433
+ body,
3434
+ method: 'POST',
3435
+ get duplex() {
3436
+ duplexAccessed = true;
3437
+ return 'half';
3438
+ },
3439
+ }).headers.has('Content-Type');
3440
+
3441
+ body.cancel();
3205
3442
 
3206
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
3443
+ return duplexAccessed && !hasContentType;
3444
+ });
3445
+
3446
+ const supportsResponseStream =
3447
+ isResponseSupported &&
3448
+ isReadableStreamSupported &&
3207
3449
  test(() => utils$1.isReadableStream(new Response('').body));
3208
3450
 
3209
3451
  const resolvers = {
3210
- stream: supportsResponseStream && ((res) => res.body)
3452
+ stream: supportsResponseStream && ((res) => res.body),
3211
3453
  };
3212
3454
 
3213
- isFetchSupported && ((() => {
3214
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
3215
- !resolvers[type] && (resolvers[type] = (res, config) => {
3216
- let method = res && res[type];
3455
+ isFetchSupported &&
3456
+ (() => {
3457
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
3458
+ !resolvers[type] &&
3459
+ (resolvers[type] = (res, config) => {
3460
+ let method = res && res[type];
3217
3461
 
3218
- if (method) {
3219
- return method.call(res);
3220
- }
3462
+ if (method) {
3463
+ return method.call(res);
3464
+ }
3221
3465
 
3222
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
3466
+ throw new AxiosError$1(
3467
+ `Response type '${type}' is not supported`,
3468
+ AxiosError$1.ERR_NOT_SUPPORT,
3469
+ config
3470
+ );
3471
+ });
3223
3472
  });
3224
- });
3225
- })());
3473
+ })();
3226
3474
 
3227
3475
  const getBodyLength = async (body) => {
3228
3476
  if (body == null) {
@@ -3273,32 +3521,41 @@ const factory = (env) => {
3273
3521
  responseType,
3274
3522
  headers,
3275
3523
  withCredentials = 'same-origin',
3276
- fetchOptions
3524
+ fetchOptions,
3277
3525
  } = resolveConfig(config);
3278
3526
 
3279
3527
  let _fetch = envFetch || fetch;
3280
3528
 
3281
3529
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3282
3530
 
3283
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3531
+ let composedSignal = composeSignals(
3532
+ [signal, cancelToken && cancelToken.toAbortSignal()],
3533
+ timeout
3534
+ );
3284
3535
 
3285
3536
  let request = null;
3286
3537
 
3287
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3288
- composedSignal.unsubscribe();
3289
- });
3538
+ const unsubscribe =
3539
+ composedSignal &&
3540
+ composedSignal.unsubscribe &&
3541
+ (() => {
3542
+ composedSignal.unsubscribe();
3543
+ });
3290
3544
 
3291
3545
  let requestContentLength;
3292
3546
 
3293
3547
  try {
3294
3548
  if (
3295
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
3549
+ onUploadProgress &&
3550
+ supportsRequestStream &&
3551
+ method !== 'get' &&
3552
+ method !== 'head' &&
3296
3553
  (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3297
3554
  ) {
3298
3555
  let _request = new Request(url, {
3299
3556
  method: 'POST',
3300
3557
  body: data,
3301
- duplex: "half"
3558
+ duplex: 'half',
3302
3559
  });
3303
3560
 
3304
3561
  let contentTypeHeader;
@@ -3323,7 +3580,7 @@ const factory = (env) => {
3323
3580
 
3324
3581
  // Cloudflare Workers throws when credentials are defined
3325
3582
  // see https://github.com/cloudflare/workerd/issues/902
3326
- const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
3583
+ const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3327
3584
 
3328
3585
  const resolvedOptions = {
3329
3586
  ...fetchOptions,
@@ -3331,29 +3588,35 @@ const factory = (env) => {
3331
3588
  method: method.toUpperCase(),
3332
3589
  headers: headers.normalize().toJSON(),
3333
3590
  body: data,
3334
- duplex: "half",
3335
- credentials: isCredentialsSupported ? withCredentials : undefined
3591
+ duplex: 'half',
3592
+ credentials: isCredentialsSupported ? withCredentials : undefined,
3336
3593
  };
3337
3594
 
3338
3595
  request = isRequestSupported && new Request(url, resolvedOptions);
3339
3596
 
3340
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
3597
+ let response = await (isRequestSupported
3598
+ ? _fetch(request, fetchOptions)
3599
+ : _fetch(url, resolvedOptions));
3341
3600
 
3342
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3601
+ const isStreamResponse =
3602
+ supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3343
3603
 
3344
3604
  if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3345
3605
  const options = {};
3346
3606
 
3347
- ['status', 'statusText', 'headers'].forEach(prop => {
3607
+ ['status', 'statusText', 'headers'].forEach((prop) => {
3348
3608
  options[prop] = response[prop];
3349
3609
  });
3350
3610
 
3351
3611
  const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3352
3612
 
3353
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3354
- responseContentLength,
3355
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
3356
- ) || [];
3613
+ const [onProgress, flush] =
3614
+ (onDownloadProgress &&
3615
+ progressEventDecorator(
3616
+ responseContentLength,
3617
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
3618
+ )) ||
3619
+ [];
3357
3620
 
3358
3621
  response = new Response(
3359
3622
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
@@ -3366,7 +3629,10 @@ const factory = (env) => {
3366
3629
 
3367
3630
  responseType = responseType || 'text';
3368
3631
 
3369
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3632
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
3633
+ response,
3634
+ config
3635
+ );
3370
3636
 
3371
3637
  !isStreamResponse && unsubscribe && unsubscribe();
3372
3638
 
@@ -3377,43 +3643,50 @@ const factory = (env) => {
3377
3643
  status: response.status,
3378
3644
  statusText: response.statusText,
3379
3645
  config,
3380
- request
3646
+ request,
3381
3647
  });
3382
- })
3648
+ });
3383
3649
  } catch (err) {
3384
3650
  unsubscribe && unsubscribe();
3385
3651
 
3386
3652
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3387
3653
  throw Object.assign(
3388
- new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, err && err.response),
3654
+ new AxiosError$1(
3655
+ 'Network Error',
3656
+ AxiosError$1.ERR_NETWORK,
3657
+ config,
3658
+ request,
3659
+ err && err.response
3660
+ ),
3389
3661
  {
3390
- cause: err.cause || err
3662
+ cause: err.cause || err,
3391
3663
  }
3392
- )
3664
+ );
3393
3665
  }
3394
3666
 
3395
3667
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
3396
3668
  }
3397
- }
3669
+ };
3398
3670
  };
3399
3671
 
3400
3672
  const seedCache = new Map();
3401
3673
 
3402
3674
  const getFetch = (config) => {
3403
3675
  let env = (config && config.env) || {};
3404
- const {fetch, Request, Response} = env;
3405
- const seeds = [
3406
- Request, Response, fetch
3407
- ];
3676
+ const { fetch, Request, Response } = env;
3677
+ const seeds = [Request, Response, fetch];
3408
3678
 
3409
- let len = seeds.length, i = len,
3410
- seed, target, map = seedCache;
3679
+ let len = seeds.length,
3680
+ i = len,
3681
+ seed,
3682
+ target,
3683
+ map = seedCache;
3411
3684
 
3412
3685
  while (i--) {
3413
3686
  seed = seeds[i];
3414
3687
  target = map.get(seed);
3415
3688
 
3416
- target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
3689
+ target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
3417
3690
 
3418
3691
  map = target;
3419
3692
  }
@@ -3429,7 +3702,7 @@ getFetch();
3429
3702
  * - `http` for Node.js
3430
3703
  * - `xhr` for browsers
3431
3704
  * - `fetch` for fetch API-based requests
3432
- *
3705
+ *
3433
3706
  * @type {Object<string, Function|Object>}
3434
3707
  */
3435
3708
  const knownAdapters = {
@@ -3437,7 +3710,7 @@ const knownAdapters = {
3437
3710
  xhr: xhrAdapter,
3438
3711
  fetch: {
3439
3712
  get: getFetch,
3440
- }
3713
+ },
3441
3714
  };
3442
3715
 
3443
3716
  // Assign adapter names for easier debugging and identification
@@ -3454,7 +3727,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
3454
3727
 
3455
3728
  /**
3456
3729
  * Render a rejection reason string for unknown or unsupported adapters
3457
- *
3730
+ *
3458
3731
  * @param {string} reason
3459
3732
  * @returns {string}
3460
3733
  */
@@ -3462,17 +3735,18 @@ const renderReason = (reason) => `- ${reason}`;
3462
3735
 
3463
3736
  /**
3464
3737
  * Check if the adapter is resolved (function, null, or false)
3465
- *
3738
+ *
3466
3739
  * @param {Function|null|false} adapter
3467
3740
  * @returns {boolean}
3468
3741
  */
3469
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3742
+ const isResolvedHandle = (adapter) =>
3743
+ utils$1.isFunction(adapter) || adapter === null || adapter === false;
3470
3744
 
3471
3745
  /**
3472
3746
  * Get the first suitable adapter from the provided list.
3473
3747
  * Tries each adapter in order until a supported one is found.
3474
3748
  * Throws an AxiosError if no adapter is suitable.
3475
- *
3749
+ *
3476
3750
  * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
3477
3751
  * @param {Object} config - Axios request configuration
3478
3752
  * @throws {AxiosError} If no suitable adapter is available
@@ -3509,14 +3783,17 @@ function getAdapter$1(adapters, config) {
3509
3783
  }
3510
3784
 
3511
3785
  if (!adapter) {
3512
- const reasons = Object.entries(rejectedReasons)
3513
- .map(([id, state]) => `adapter ${id} ` +
3786
+ const reasons = Object.entries(rejectedReasons).map(
3787
+ ([id, state]) =>
3788
+ `adapter ${id} ` +
3514
3789
  (state === false ? 'is not supported by the environment' : 'is not available in the build')
3515
- );
3790
+ );
3516
3791
 
3517
- let s = length ?
3518
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3519
- 'as no adapter specified';
3792
+ let s = length
3793
+ ? reasons.length > 1
3794
+ ? 'since :\n' + reasons.map(renderReason).join('\n')
3795
+ : ' ' + renderReason(reasons[0])
3796
+ : 'as no adapter specified';
3520
3797
 
3521
3798
  throw new AxiosError$1(
3522
3799
  `There is no suitable adapter to dispatch the request ` + s,
@@ -3541,7 +3818,7 @@ var adapters = {
3541
3818
  * Exposes all known adapters
3542
3819
  * @type {Object<string, Function|Object>}
3543
3820
  */
3544
- adapters: knownAdapters
3821
+ adapters: knownAdapters,
3545
3822
  };
3546
3823
 
3547
3824
  /**
@@ -3574,10 +3851,7 @@ function dispatchRequest(config) {
3574
3851
  config.headers = AxiosHeaders$1.from(config.headers);
3575
3852
 
3576
3853
  // Transform request data
3577
- config.data = transformData.call(
3578
- config,
3579
- config.transformRequest
3580
- );
3854
+ config.data = transformData.call(config, config.transformRequest);
3581
3855
 
3582
3856
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3583
3857
  config.headers.setContentType('application/x-www-form-urlencoded', false);
@@ -3585,39 +3859,38 @@ function dispatchRequest(config) {
3585
3859
 
3586
3860
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
3587
3861
 
3588
- return adapter(config).then(function onAdapterResolution(response) {
3589
- throwIfCancellationRequested(config);
3590
-
3591
- // Transform response data
3592
- response.data = transformData.call(
3593
- config,
3594
- config.transformResponse,
3595
- response
3596
- );
3597
-
3598
- response.headers = AxiosHeaders$1.from(response.headers);
3599
-
3600
- return response;
3601
- }, function onAdapterRejection(reason) {
3602
- if (!isCancel$1(reason)) {
3862
+ return adapter(config).then(
3863
+ function onAdapterResolution(response) {
3603
3864
  throwIfCancellationRequested(config);
3604
3865
 
3605
3866
  // Transform response data
3606
- if (reason && reason.response) {
3607
- reason.response.data = transformData.call(
3608
- config,
3609
- config.transformResponse,
3610
- reason.response
3611
- );
3612
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3867
+ response.data = transformData.call(config, config.transformResponse, response);
3868
+
3869
+ response.headers = AxiosHeaders$1.from(response.headers);
3870
+
3871
+ return response;
3872
+ },
3873
+ function onAdapterRejection(reason) {
3874
+ if (!isCancel$1(reason)) {
3875
+ throwIfCancellationRequested(config);
3876
+
3877
+ // Transform response data
3878
+ if (reason && reason.response) {
3879
+ reason.response.data = transformData.call(
3880
+ config,
3881
+ config.transformResponse,
3882
+ reason.response
3883
+ );
3884
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3885
+ }
3613
3886
  }
3614
- }
3615
3887
 
3616
- return Promise.reject(reason);
3617
- });
3888
+ return Promise.reject(reason);
3889
+ }
3890
+ );
3618
3891
  }
3619
3892
 
3620
- const VERSION$1 = "1.13.5";
3893
+ const VERSION$1 = "1.15.0";
3621
3894
 
3622
3895
  const validators$1 = {};
3623
3896
 
@@ -3641,7 +3914,15 @@ const deprecatedWarnings = {};
3641
3914
  */
3642
3915
  validators$1.transitional = function transitional(validator, version, message) {
3643
3916
  function formatMessage(opt, desc) {
3644
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3917
+ return (
3918
+ '[Axios v' +
3919
+ VERSION$1 +
3920
+ "] Transitional option '" +
3921
+ opt +
3922
+ "'" +
3923
+ desc +
3924
+ (message ? '. ' + message : '')
3925
+ );
3645
3926
  }
3646
3927
 
3647
3928
  // eslint-disable-next-line func-names
@@ -3673,7 +3954,7 @@ validators$1.spelling = function spelling(correctSpelling) {
3673
3954
  // eslint-disable-next-line no-console
3674
3955
  console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
3675
3956
  return true;
3676
- }
3957
+ };
3677
3958
  };
3678
3959
 
3679
3960
  /**
@@ -3699,7 +3980,10 @@ function assertOptions(options, schema, allowUnknown) {
3699
3980
  const value = options[opt];
3700
3981
  const result = value === undefined || validator(value, opt, options);
3701
3982
  if (result !== true) {
3702
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3983
+ throw new AxiosError$1(
3984
+ 'option ' + opt + ' must be ' + result,
3985
+ AxiosError$1.ERR_BAD_OPTION_VALUE
3986
+ );
3703
3987
  }
3704
3988
  continue;
3705
3989
  }
@@ -3711,7 +3995,7 @@ function assertOptions(options, schema, allowUnknown) {
3711
3995
 
3712
3996
  var validator = {
3713
3997
  assertOptions,
3714
- validators: validators$1
3998
+ validators: validators$1,
3715
3999
  };
3716
4000
 
3717
4001
  const validators = validator.validators;
@@ -3728,7 +4012,7 @@ let Axios$1 = class Axios {
3728
4012
  this.defaults = instanceConfig || {};
3729
4013
  this.interceptors = {
3730
4014
  request: new InterceptorManager(),
3731
- response: new InterceptorManager()
4015
+ response: new InterceptorManager(),
3732
4016
  };
3733
4017
  }
3734
4018
 
@@ -3750,13 +4034,29 @@ let Axios$1 = class Axios {
3750
4034
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
3751
4035
 
3752
4036
  // slice off the Error: ... line
3753
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
4037
+ const stack = (() => {
4038
+ if (!dummy.stack) {
4039
+ return '';
4040
+ }
4041
+
4042
+ const firstNewlineIndex = dummy.stack.indexOf('\n');
4043
+
4044
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4045
+ })();
3754
4046
  try {
3755
4047
  if (!err.stack) {
3756
4048
  err.stack = stack;
3757
4049
  // match without the 2 top stack lines
3758
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3759
- err.stack += '\n' + stack;
4050
+ } else if (stack) {
4051
+ const firstNewlineIndex = stack.indexOf('\n');
4052
+ const secondNewlineIndex =
4053
+ firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
4054
+ const stackWithoutTwoTopLines =
4055
+ secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
4056
+
4057
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
4058
+ err.stack += '\n' + stack;
4059
+ }
3760
4060
  }
3761
4061
  } catch (e) {
3762
4062
  // ignore the case where "stack" is an un-writable property
@@ -3779,27 +4079,35 @@ let Axios$1 = class Axios {
3779
4079
 
3780
4080
  config = mergeConfig$1(this.defaults, config);
3781
4081
 
3782
- const {transitional, paramsSerializer, headers} = config;
4082
+ const { transitional, paramsSerializer, headers } = config;
3783
4083
 
3784
4084
  if (transitional !== undefined) {
3785
- validator.assertOptions(transitional, {
3786
- silentJSONParsing: validators.transitional(validators.boolean),
3787
- forcedJSONParsing: validators.transitional(validators.boolean),
3788
- clarifyTimeoutError: validators.transitional(validators.boolean),
3789
- legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
3790
- }, false);
4085
+ validator.assertOptions(
4086
+ transitional,
4087
+ {
4088
+ silentJSONParsing: validators.transitional(validators.boolean),
4089
+ forcedJSONParsing: validators.transitional(validators.boolean),
4090
+ clarifyTimeoutError: validators.transitional(validators.boolean),
4091
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4092
+ },
4093
+ false
4094
+ );
3791
4095
  }
3792
4096
 
3793
4097
  if (paramsSerializer != null) {
3794
4098
  if (utils$1.isFunction(paramsSerializer)) {
3795
4099
  config.paramsSerializer = {
3796
- serialize: paramsSerializer
4100
+ serialize: paramsSerializer,
3797
4101
  };
3798
4102
  } else {
3799
- validator.assertOptions(paramsSerializer, {
3800
- encode: validators.function,
3801
- serialize: validators.function
3802
- }, true);
4103
+ validator.assertOptions(
4104
+ paramsSerializer,
4105
+ {
4106
+ encode: validators.function,
4107
+ serialize: validators.function,
4108
+ },
4109
+ true
4110
+ );
3803
4111
  }
3804
4112
  }
3805
4113
 
@@ -3810,26 +4118,25 @@ let Axios$1 = class Axios {
3810
4118
  config.allowAbsoluteUrls = true;
3811
4119
  }
3812
4120
 
3813
- validator.assertOptions(config, {
3814
- baseUrl: validators.spelling('baseURL'),
3815
- withXsrfToken: validators.spelling('withXSRFToken')
3816
- }, true);
4121
+ validator.assertOptions(
4122
+ config,
4123
+ {
4124
+ baseUrl: validators.spelling('baseURL'),
4125
+ withXsrfToken: validators.spelling('withXSRFToken'),
4126
+ },
4127
+ true
4128
+ );
3817
4129
 
3818
4130
  // Set config.method
3819
4131
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3820
4132
 
3821
4133
  // Flatten headers
3822
- let contextHeaders = headers && utils$1.merge(
3823
- headers.common,
3824
- headers[config.method]
3825
- );
4134
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3826
4135
 
3827
- headers && utils$1.forEach(
3828
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3829
- (method) => {
4136
+ headers &&
4137
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
3830
4138
  delete headers[method];
3831
- }
3832
- );
4139
+ });
3833
4140
 
3834
4141
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3835
4142
 
@@ -3844,7 +4151,8 @@ let Axios$1 = class Axios {
3844
4151
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3845
4152
 
3846
4153
  const transitional = config.transitional || transitionalDefaults;
3847
- const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
4154
+ const legacyInterceptorReqResOrdering =
4155
+ transitional && transitional.legacyInterceptorReqResOrdering;
3848
4156
 
3849
4157
  if (legacyInterceptorReqResOrdering) {
3850
4158
  requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
@@ -3918,28 +4226,32 @@ let Axios$1 = class Axios {
3918
4226
  // Provide aliases for supported request methods
3919
4227
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3920
4228
  /*eslint func-names:0*/
3921
- Axios$1.prototype[method] = function(url, config) {
3922
- return this.request(mergeConfig$1(config || {}, {
3923
- method,
3924
- url,
3925
- data: (config || {}).data
3926
- }));
4229
+ Axios$1.prototype[method] = function (url, config) {
4230
+ return this.request(
4231
+ mergeConfig$1(config || {}, {
4232
+ method,
4233
+ url,
4234
+ data: (config || {}).data,
4235
+ })
4236
+ );
3927
4237
  };
3928
4238
  });
3929
4239
 
3930
4240
  utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3931
- /*eslint func-names:0*/
3932
-
3933
4241
  function generateHTTPMethod(isForm) {
3934
4242
  return function httpMethod(url, data, config) {
3935
- return this.request(mergeConfig$1(config || {}, {
3936
- method,
3937
- headers: isForm ? {
3938
- 'Content-Type': 'multipart/form-data'
3939
- } : {},
3940
- url,
3941
- data
3942
- }));
4243
+ return this.request(
4244
+ mergeConfig$1(config || {}, {
4245
+ method,
4246
+ headers: isForm
4247
+ ? {
4248
+ 'Content-Type': 'multipart/form-data',
4249
+ }
4250
+ : {},
4251
+ url,
4252
+ data,
4253
+ })
4254
+ );
3943
4255
  };
3944
4256
  }
3945
4257
 
@@ -3970,7 +4282,7 @@ let CancelToken$1 = class CancelToken {
3970
4282
  const token = this;
3971
4283
 
3972
4284
  // eslint-disable-next-line func-names
3973
- this.promise.then(cancel => {
4285
+ this.promise.then((cancel) => {
3974
4286
  if (!token._listeners) return;
3975
4287
 
3976
4288
  let i = token._listeners.length;
@@ -3982,10 +4294,10 @@ let CancelToken$1 = class CancelToken {
3982
4294
  });
3983
4295
 
3984
4296
  // eslint-disable-next-line func-names
3985
- this.promise.then = onfulfilled => {
4297
+ this.promise.then = (onfulfilled) => {
3986
4298
  let _resolve;
3987
4299
  // eslint-disable-next-line func-names
3988
- const promise = new Promise(resolve => {
4300
+ const promise = new Promise((resolve) => {
3989
4301
  token.subscribe(resolve);
3990
4302
  _resolve = resolve;
3991
4303
  }).then(onfulfilled);
@@ -4073,7 +4385,7 @@ let CancelToken$1 = class CancelToken {
4073
4385
  });
4074
4386
  return {
4075
4387
  token,
4076
- cancel
4388
+ cancel,
4077
4389
  };
4078
4390
  }
4079
4391
  };
@@ -4113,7 +4425,7 @@ function spread$1(callback) {
4113
4425
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4114
4426
  */
4115
4427
  function isAxiosError$1(payload) {
4116
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
4428
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
4117
4429
  }
4118
4430
 
4119
4431
  const HttpStatusCode$1 = {
@@ -4204,10 +4516,10 @@ function createInstance(defaultConfig) {
4204
4516
  const instance = bind(Axios$1.prototype.request, context);
4205
4517
 
4206
4518
  // Copy axios.prototype to instance
4207
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
4519
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
4208
4520
 
4209
4521
  // Copy context to instance
4210
- utils$1.extend(instance, context, null, {allOwnKeys: true});
4522
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
4211
4523
 
4212
4524
  // Factory for creating new instances
4213
4525
  instance.create = function create(instanceConfig) {
@@ -4251,7 +4563,7 @@ axios.mergeConfig = mergeConfig$1;
4251
4563
 
4252
4564
  axios.AxiosHeaders = AxiosHeaders$1;
4253
4565
 
4254
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4566
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4255
4567
 
4256
4568
  axios.getAdapter = adapters.getAdapter;
4257
4569
 
@@ -4278,7 +4590,7 @@ const {
4278
4590
  HttpStatusCode,
4279
4591
  formToJSON,
4280
4592
  getAdapter,
4281
- mergeConfig
4593
+ mergeConfig,
4282
4594
  } = axios;
4283
4595
 
4284
4596
  /******************************************************************************
@@ -7367,9 +7679,9 @@ class MayachainProtocol {
7367
7679
  }
7368
7680
 
7369
7681
  /**
7370
- * The base URL for the Midgard API provided by Nine Realms.
7682
+ * The base URL for the Midgard API endpoint.
7371
7683
  */
7372
- const MIDGARD_API_9R_URL = 'https://midgard.ninerealms.com/';
7684
+ const MIDGARD_API_URL = 'https://gateway.liquify.com/chain/thorchain_midgard/';
7373
7685
 
7374
7686
  /******************************************************************************
7375
7687
  Copyright (c) Microsoft Corporation.
@@ -9844,7 +10156,7 @@ class Configuration {
9844
10156
  /**
9845
10157
  * The base URL for the Midgard API.
9846
10158
  */
9847
- const baseUrl = MIDGARD_API_9R_URL;
10159
+ const baseUrl = MIDGARD_API_URL;
9848
10160
  /**
9849
10161
  * Default configuration for the Midgard API client.
9850
10162
  */
@@ -10198,15 +10510,15 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
10198
10510
  const defaultMidgardConfig = {
10199
10511
  mainnet: {
10200
10512
  apiRetries: 3,
10201
- midgardBaseUrls: ['https://midgard.ninerealms.com'],
10513
+ midgardBaseUrls: ['https://gateway.liquify.com/chain/thorchain_midgard'],
10202
10514
  },
10203
10515
  stagenet: {
10204
10516
  apiRetries: 3,
10205
- midgardBaseUrls: ['https://stagenet-midgard.ninerealms.com'],
10517
+ midgardBaseUrls: [],
10206
10518
  },
10207
10519
  testnet: {
10208
10520
  apiRetries: 3,
10209
- midgardBaseUrls: ['https://testnet.midgard.thorchain.info'],
10521
+ midgardBaseUrls: ['deprecated'],
10210
10522
  },
10211
10523
  };
10212
10524
  class Midgard {
@@ -10432,7 +10744,7 @@ class MidgardQuery {
10432
10744
  getFallbackDecimals(asset) {
10433
10745
  const assetString = assetToString(asset);
10434
10746
  // Map of assets to their actual decimal places from THORChain pools
10435
- // Data sourced from https://thornode-v2.ninerealms.com/thorchain/pools
10747
+ // Data sourced from https://gateway.liquify.com/chain/thorchain_api/thorchain/pools
10436
10748
  const fallbackDecimalMap = {
10437
10749
  // Bitcoin and forks
10438
10750
  'BTC.BTC': 8,