@carbon/ibmdotcom-services 2.48.0 → 2.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1027,9 +1027,9 @@
1027
1027
  * also have a `name` and `type` attribute to specify filename and content type
1028
1028
  *
1029
1029
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
1030
- *
1030
+ *
1031
1031
  * @param {*} value The value to test
1032
- *
1032
+ *
1033
1033
  * @returns {boolean} True if value is a React Native Blob, otherwise false
1034
1034
  */
1035
1035
  var isReactNativeBlob = function isReactNativeBlob(value) {
@@ -1039,9 +1039,9 @@
1039
1039
  /**
1040
1040
  * Determine if environment is React Native
1041
1041
  * ReactNative `FormData` has a non-standard `getParts()` method
1042
- *
1042
+ *
1043
1043
  * @param {*} formData The formData to test
1044
- *
1044
+ *
1045
1045
  * @returns {boolean} True if environment is React Native, otherwise false
1046
1046
  */
1047
1047
  var isReactNative = function isReactNative(formData) {
@@ -1062,7 +1062,7 @@
1062
1062
  *
1063
1063
  * @param {*} val The value to test
1064
1064
  *
1065
- * @returns {boolean} True if value is a File, otherwise false
1065
+ * @returns {boolean} True if value is a FileList, otherwise false
1066
1066
  */
1067
1067
  var isFileList = kindOfTest('FileList');
1068
1068
 
@@ -1096,7 +1096,7 @@
1096
1096
  var isFormData = function isFormData(thing) {
1097
1097
  if (!thing) return false;
1098
1098
  if (FormDataCtor && thing instanceof FormDataCtor) return true;
1099
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
1099
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
1100
1100
  var proto = getPrototypeOf$1(thing);
1101
1101
  if (!proto || proto === Object.prototype) return false;
1102
1102
  if (!isFunction$1(thing.append)) return false;
@@ -1236,8 +1236,7 @@
1236
1236
  *
1237
1237
  * @returns {Object} Result of all merge properties
1238
1238
  */
1239
- function merge(/* obj1, obj2, obj3, ... */
1240
- ) {
1239
+ function merge() {
1241
1240
  var _ref2 = isContextDefined(this) && this || {},
1242
1241
  caseless = _ref2.caseless,
1243
1242
  skipUndefined = _ref2.skipUndefined;
@@ -1248,8 +1247,12 @@
1248
1247
  return;
1249
1248
  }
1250
1249
  var targetKey = caseless && findKey(result, key) || key;
1251
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1252
- result[targetKey] = merge(result[targetKey], val);
1250
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
1251
+ // chain, so a polluted Object.prototype value could surface here and get
1252
+ // copied into the merged result.
1253
+ var existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
1254
+ if (isPlainObject(existing) && isPlainObject(val)) {
1255
+ result[targetKey] = merge(existing, val);
1253
1256
  } else if (isPlainObject(val)) {
1254
1257
  result[targetKey] = merge({}, val);
1255
1258
  } else if (isArray(val)) {
@@ -1258,8 +1261,11 @@
1258
1261
  result[targetKey] = val;
1259
1262
  }
1260
1263
  };
1261
- for (var i = 0, l = arguments.length; i < l; i++) {
1262
- arguments[i] && forEach(arguments[i], assignValue);
1264
+ for (var _len = arguments.length, objs = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
1265
+ objs[_key2] = arguments[_key2];
1266
+ }
1267
+ for (var i = 0, l = objs.length; i < l; i++) {
1268
+ objs[i] && forEach(objs[i], assignValue);
1263
1269
  }
1264
1270
  return result;
1265
1271
  }
@@ -1281,6 +1287,9 @@
1281
1287
  forEach(b, function (val, key) {
1282
1288
  if (thisArg && isFunction$1(val)) {
1283
1289
  Object.defineProperty(a, key, {
1290
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
1291
+ // hijack defineProperty's accessor-vs-data resolution.
1292
+ __proto__: null,
1284
1293
  value: bind(val, thisArg),
1285
1294
  writable: true,
1286
1295
  enumerable: true,
@@ -1288,6 +1297,7 @@
1288
1297
  });
1289
1298
  } else {
1290
1299
  Object.defineProperty(a, key, {
1300
+ __proto__: null,
1291
1301
  value: val,
1292
1302
  writable: true,
1293
1303
  enumerable: true,
@@ -1326,12 +1336,14 @@
1326
1336
  var inherits$1 = function inherits(constructor, superConstructor, props, descriptors) {
1327
1337
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1328
1338
  Object.defineProperty(constructor.prototype, 'constructor', {
1339
+ __proto__: null,
1329
1340
  value: constructor,
1330
1341
  writable: true,
1331
1342
  enumerable: false,
1332
1343
  configurable: true
1333
1344
  });
1334
1345
  Object.defineProperty(constructor, 'super', {
1346
+ __proto__: null,
1335
1347
  value: superConstructor.prototype
1336
1348
  });
1337
1349
  props && Object.assign(constructor.prototype, props);
@@ -1502,7 +1514,7 @@
1502
1514
  var freezeMethods = function freezeMethods(obj) {
1503
1515
  reduceDescriptors(obj, function (descriptor, name) {
1504
1516
  // skip restricted props in strict mode
1505
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1517
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
1506
1518
  return false;
1507
1519
  }
1508
1520
  var value = obj[name];
@@ -1561,10 +1573,10 @@
1561
1573
  * @returns {Object} The JSON-compatible object.
1562
1574
  */
1563
1575
  var toJSONObject = function toJSONObject(obj) {
1564
- var stack = new Array(10);
1565
- var _visit = function visit(source, i) {
1576
+ var visited = new WeakSet();
1577
+ var _visit = function visit(source) {
1566
1578
  if (isObject(source)) {
1567
- if (stack.indexOf(source) >= 0) {
1579
+ if (visited.has(source)) {
1568
1580
  return;
1569
1581
  }
1570
1582
 
@@ -1573,19 +1585,20 @@
1573
1585
  return source;
1574
1586
  }
1575
1587
  if (!('toJSON' in source)) {
1576
- stack[i] = source;
1588
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
1589
+ visited.add(source);
1577
1590
  var target = isArray(source) ? [] : {};
1578
1591
  forEach(source, function (value, key) {
1579
- var reducedValue = _visit(value, i + 1);
1592
+ var reducedValue = _visit(value);
1580
1593
  !isUndefined(reducedValue) && (target[key] = reducedValue);
1581
1594
  });
1582
- stack[i] = undefined;
1595
+ visited.delete(source);
1583
1596
  return target;
1584
1597
  }
1585
1598
  }
1586
1599
  return source;
1587
1600
  };
1588
- return _visit(obj, 0);
1601
+ return _visit(obj);
1589
1602
  };
1590
1603
 
1591
1604
  /**
@@ -1856,1175 +1869,1274 @@
1856
1869
  })(wrapNativeSuper);
1857
1870
  var _wrapNativeSuper = /*@__PURE__*/getDefaultExportFromCjs(wrapNativeSuper.exports);
1858
1871
 
1859
- function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1860
- function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
1861
- var AxiosError = /*#__PURE__*/function (_Error) {
1862
- /**
1863
- * Create an Error with the specified message, config, error code, request and response.
1864
- *
1865
- * @param {string} message The error message.
1866
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1867
- * @param {Object} [config] The config.
1868
- * @param {Object} [request] The request.
1869
- * @param {Object} [response] The response.
1870
- *
1871
- * @returns {Error} The created error.
1872
- */
1873
- function AxiosError(message, code, config, request, response) {
1874
- var _this;
1875
- _classCallCheck$1(this, AxiosError);
1876
- _this = _callSuper$1(this, AxiosError, [message]);
1872
+ var toConsumableArray = {exports: {}};
1877
1873
 
1878
- // Make message enumerable to maintain backward compatibility
1879
- // The native Error constructor sets message as non-enumerable,
1880
- // but axios < v1.13.3 had it as enumerable
1881
- Object.defineProperty(_this, 'message', {
1882
- value: message,
1883
- enumerable: true,
1884
- writable: true,
1885
- configurable: true
1886
- });
1887
- _this.name = 'AxiosError';
1888
- _this.isAxiosError = true;
1889
- code && (_this.code = code);
1890
- config && (_this.config = config);
1891
- request && (_this.request = request);
1892
- if (response) {
1893
- _this.response = response;
1894
- _this.status = response.status;
1895
- }
1896
- return _this;
1874
+ var arrayWithoutHoles = {exports: {}};
1875
+
1876
+ (function (module) {
1877
+ var arrayLikeToArray$1 = arrayLikeToArray.exports;
1878
+ function _arrayWithoutHoles(r) {
1879
+ if (Array.isArray(r)) return arrayLikeToArray$1(r);
1897
1880
  }
1898
- _inherits(AxiosError, _Error);
1899
- return _createClass$1(AxiosError, [{
1900
- key: "toJSON",
1901
- value: function toJSON() {
1902
- return {
1903
- // Standard
1904
- message: this.message,
1905
- name: this.name,
1906
- // Microsoft
1907
- description: this.description,
1908
- number: this.number,
1909
- // Mozilla
1910
- fileName: this.fileName,
1911
- lineNumber: this.lineNumber,
1912
- columnNumber: this.columnNumber,
1913
- stack: this.stack,
1914
- // Axios
1915
- config: utils$1.toJSONObject(this.config),
1916
- code: this.code,
1917
- status: this.status
1918
- };
1919
- }
1920
- }], [{
1921
- key: "from",
1922
- value: function from(error, code, config, request, response, customProps) {
1923
- var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1924
- axiosError.cause = error;
1925
- axiosError.name = error.name;
1881
+ module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
1882
+ })(arrayWithoutHoles);
1926
1883
 
1927
- // Preserve status from the original error if not already set from response
1928
- if (error.status != null && axiosError.status == null) {
1929
- axiosError.status = error.status;
1930
- }
1931
- customProps && Object.assign(axiosError, customProps);
1932
- return axiosError;
1933
- }
1934
- }]);
1935
- }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1936
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1937
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1938
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1939
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1940
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1941
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1942
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1943
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1944
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1945
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1946
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1947
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1948
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1949
- var AxiosError$1 = AxiosError;
1884
+ var iterableToArray = {exports: {}};
1950
1885
 
1951
- // eslint-disable-next-line strict
1952
- var httpAdapter = null;
1886
+ (function (module) {
1887
+ function _iterableToArray(r) {
1888
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
1889
+ }
1890
+ module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1891
+ })(iterableToArray);
1953
1892
 
1954
- /**
1955
- * Determines if the given thing is a array or js object.
1956
- *
1957
- * @param {string} thing - The object or array to be visited.
1958
- *
1959
- * @returns {boolean}
1960
- */
1961
- function isVisitable(thing) {
1962
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1963
- }
1893
+ var nonIterableSpread = {exports: {}};
1964
1894
 
1965
- /**
1966
- * It removes the brackets from the end of a string
1967
- *
1968
- * @param {string} key - The key of the parameter.
1969
- *
1970
- * @returns {string} the key without the brackets.
1971
- */
1972
- function removeBrackets(key) {
1973
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1974
- }
1895
+ (function (module) {
1896
+ function _nonIterableSpread() {
1897
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1898
+ }
1899
+ module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
1900
+ })(nonIterableSpread);
1975
1901
 
1976
- /**
1977
- * It takes a path, a key, and a boolean, and returns a string
1978
- *
1979
- * @param {string} path - The path to the current key.
1980
- * @param {string} key - The key of the current object being iterated over.
1981
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1982
- *
1983
- * @returns {string} The path to the current key.
1984
- */
1985
- function renderKey(path, key, dots) {
1986
- if (!path) return key;
1987
- return path.concat(key).map(function each(token, i) {
1988
- // eslint-disable-next-line no-param-reassign
1989
- token = removeBrackets(token);
1990
- return !dots && i ? '[' + token + ']' : token;
1991
- }).join(dots ? '.' : '');
1992
- }
1902
+ (function (module) {
1903
+ var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
1904
+ var iterableToArray$1 = iterableToArray.exports;
1905
+ var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
1906
+ var nonIterableSpread$1 = nonIterableSpread.exports;
1907
+ function _toConsumableArray(r) {
1908
+ return arrayWithoutHoles$1(r) || iterableToArray$1(r) || unsupportedIterableToArray$1(r) || nonIterableSpread$1();
1909
+ }
1910
+ module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1911
+ })(toConsumableArray);
1912
+ var _toConsumableArray = /*@__PURE__*/getDefaultExportFromCjs(toConsumableArray.exports);
1993
1913
 
1994
- /**
1995
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1996
- *
1997
- * @param {Array<any>} arr - The array to check
1998
- *
1999
- * @returns {boolean}
2000
- */
2001
- function isFlatArray(arr) {
2002
- return utils$1.isArray(arr) && !arr.some(isVisitable);
2003
- }
2004
- var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2005
- return /^is[A-Z]/.test(prop);
2006
- });
1914
+ // RawAxiosHeaders whose duplicates are ignored by node
1915
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1916
+ var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
2007
1917
 
2008
1918
  /**
2009
- * Convert a data object to FormData
2010
- *
2011
- * @param {Object} obj
2012
- * @param {?Object} [formData]
2013
- * @param {?Object} [options]
2014
- * @param {Function} [options.visitor]
2015
- * @param {Boolean} [options.metaTokens = true]
2016
- * @param {Boolean} [options.dots = false]
2017
- * @param {?Boolean} [options.indexes = false]
1919
+ * Parse headers into an object
2018
1920
  *
2019
- * @returns {Object}
2020
- **/
2021
-
2022
- /**
2023
- * It converts an object into a FormData object
1921
+ * ```
1922
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1923
+ * Content-Type: application/json
1924
+ * Connection: keep-alive
1925
+ * Transfer-Encoding: chunked
1926
+ * ```
2024
1927
  *
2025
- * @param {Object<any, any>} obj - The object to convert to form data.
2026
- * @param {string} formData - The FormData object to append to.
2027
- * @param {Object<string, any>} options
1928
+ * @param {String} rawHeaders Headers needing to be parsed
2028
1929
  *
2029
- * @returns
1930
+ * @returns {Object} Headers parsed into an object
2030
1931
  */
2031
- function toFormData(obj, formData, options) {
2032
- if (!utils$1.isObject(obj)) {
2033
- throw new TypeError('target must be an object');
1932
+ var parseHeaders = (function (rawHeaders) {
1933
+ var parsed = {};
1934
+ var key;
1935
+ var val;
1936
+ var i;
1937
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1938
+ i = line.indexOf(':');
1939
+ key = line.substring(0, i).trim().toLowerCase();
1940
+ val = line.substring(i + 1).trim();
1941
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1942
+ return;
1943
+ }
1944
+ if (key === 'set-cookie') {
1945
+ if (parsed[key]) {
1946
+ parsed[key].push(val);
1947
+ } else {
1948
+ parsed[key] = [val];
1949
+ }
1950
+ } else {
1951
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1952
+ }
1953
+ });
1954
+ return parsed;
1955
+ });
1956
+
1957
+ function trimSPorHTAB(str) {
1958
+ var start = 0;
1959
+ var end = str.length;
1960
+ while (start < end) {
1961
+ var code = str.charCodeAt(start);
1962
+ if (code !== 0x09 && code !== 0x20) {
1963
+ break;
1964
+ }
1965
+ start += 1;
1966
+ }
1967
+ while (end > start) {
1968
+ var _code = str.charCodeAt(end - 1);
1969
+ if (_code !== 0x09 && _code !== 0x20) {
1970
+ break;
1971
+ }
1972
+ end -= 1;
2034
1973
  }
1974
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1975
+ }
2035
1976
 
2036
- // eslint-disable-next-line no-param-reassign
2037
- formData = formData || new (FormData)();
2038
-
2039
- // eslint-disable-next-line no-param-reassign
2040
- options = utils$1.toFlatObject(options, {
2041
- metaTokens: true,
2042
- dots: false,
2043
- indexes: false
2044
- }, false, function defined(option, source) {
2045
- // eslint-disable-next-line no-eq-null,eqeqeq
2046
- return !utils$1.isUndefined(source[option]);
2047
- });
2048
- var metaTokens = options.metaTokens;
2049
- // eslint-disable-next-line no-use-before-define
2050
- var visitor = options.visitor || defaultVisitor;
2051
- var dots = options.dots;
2052
- var indexes = options.indexes;
2053
- var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2054
- var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2055
- var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2056
- if (!utils$1.isFunction(visitor)) {
2057
- throw new TypeError('visitor must be a function');
2058
- }
2059
- function convertValue(value) {
2060
- if (value === null) return '';
2061
- if (utils$1.isDate(value)) {
2062
- return value.toISOString();
2063
- }
2064
- if (utils$1.isBoolean(value)) {
2065
- return value.toString();
2066
- }
2067
- if (!useBlob && utils$1.isBlob(value)) {
2068
- throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
2069
- }
2070
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2071
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2072
- }
2073
- return value;
2074
- }
2075
-
2076
- /**
2077
- * Default visitor.
2078
- *
2079
- * @param {*} value
2080
- * @param {String|Number} key
2081
- * @param {Array<String|Number>} path
2082
- * @this {FormData}
2083
- *
2084
- * @returns {boolean} return true to visit the each prop of the value recursively
2085
- */
2086
- function defaultVisitor(value, key, path) {
2087
- var arr = value;
2088
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
2089
- formData.append(renderKey(path, key, dots), convertValue(value));
2090
- return false;
2091
- }
2092
- if (value && !path && _typeof$1(value) === 'object') {
2093
- if (utils$1.endsWith(key, '{}')) {
2094
- // eslint-disable-next-line no-param-reassign
2095
- key = metaTokens ? key : key.slice(0, -2);
2096
- // eslint-disable-next-line no-param-reassign
2097
- value = JSON.stringify(value);
2098
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2099
- // eslint-disable-next-line no-param-reassign
2100
- key = removeBrackets(key);
2101
- arr.forEach(function each(el, index) {
2102
- !(utils$1.isUndefined(el) || el === null) && formData.append(
2103
- // eslint-disable-next-line no-nested-ternary
2104
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2105
- });
2106
- return false;
2107
- }
2108
- }
2109
- if (isVisitable(value)) {
2110
- return true;
2111
- }
2112
- formData.append(renderKey(path, key, dots), convertValue(value));
2113
- return false;
2114
- }
2115
- var stack = [];
2116
- var exposedHelpers = Object.assign(predicates, {
2117
- defaultVisitor: defaultVisitor,
2118
- convertValue: convertValue,
2119
- isVisitable: isVisitable
2120
- });
2121
- function build(value, path) {
2122
- var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2123
- if (utils$1.isUndefined(value)) return;
2124
- if (depth > maxDepth) {
2125
- throw new AxiosError$1('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED);
2126
- }
2127
- if (stack.indexOf(value) !== -1) {
2128
- throw Error('Circular reference detected in ' + path.join('.'));
2129
- }
2130
- stack.push(value);
2131
- utils$1.forEach(value, function each(el, key) {
2132
- var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
2133
- if (result === true) {
2134
- build(el, path ? path.concat(key) : [key], depth + 1);
2135
- }
1977
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
1978
+ // eslint-disable-next-line no-control-regex
1979
+ var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", 'g');
1980
+ // eslint-disable-next-line no-control-regex
1981
+ var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", 'g');
1982
+ function sanitizeValue(value, invalidChars) {
1983
+ if (utils$1.isArray(value)) {
1984
+ return value.map(function (item) {
1985
+ return sanitizeValue(item, invalidChars);
2136
1986
  });
2137
- stack.pop();
2138
1987
  }
2139
- if (!utils$1.isObject(obj)) {
2140
- throw new TypeError('data must be an object');
2141
- }
2142
- build(obj);
2143
- return formData;
1988
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
2144
1989
  }
2145
-
2146
- /**
2147
- * It encodes a string by replacing all characters that are not in the unreserved set with
2148
- * their percent-encoded equivalents
2149
- *
2150
- * @param {string} str - The string to encode.
2151
- *
2152
- * @returns {string} The encoded string.
2153
- */
2154
- function encode$1(str) {
2155
- var charMap = {
2156
- '!': '%21',
2157
- "'": '%27',
2158
- '(': '%28',
2159
- ')': '%29',
2160
- '~': '%7E',
2161
- '%20': '+'
2162
- };
2163
- return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
2164
- return charMap[match];
1990
+ var sanitizeHeaderValue = function sanitizeHeaderValue(value) {
1991
+ return sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
1992
+ };
1993
+ var sanitizeByteStringHeaderValue = function sanitizeByteStringHeaderValue(value) {
1994
+ return sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
1995
+ };
1996
+ function toByteStringHeaderObject(headers) {
1997
+ var byteStringHeaders = Object.create(null);
1998
+ utils$1.forEach(headers.toJSON(), function (value, header) {
1999
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
2165
2000
  });
2001
+ return byteStringHeaders;
2166
2002
  }
2167
2003
 
2168
- /**
2169
- * It takes a params object and converts it to a FormData object
2170
- *
2171
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2172
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2173
- *
2174
- * @returns {void}
2175
- */
2176
- function AxiosURLSearchParams(params, options) {
2177
- this._pairs = [];
2178
- params && toFormData(params, this, options);
2004
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2005
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2006
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2007
+ var $internals = Symbol('internals');
2008
+ function normalizeHeader(header) {
2009
+ return header && String(header).trim().toLowerCase();
2179
2010
  }
2180
- var prototype = AxiosURLSearchParams.prototype;
2181
- prototype.append = function append(name, value) {
2182
- this._pairs.push([name, value]);
2183
- };
2184
- prototype.toString = function toString(encoder) {
2185
- var _encode = encoder ? function (value) {
2186
- return encoder.call(this, value, encode$1);
2187
- } : encode$1;
2188
- return this._pairs.map(function each(pair) {
2189
- return _encode(pair[0]) + '=' + _encode(pair[1]);
2190
- }, '').join('&');
2191
- };
2192
-
2193
- /**
2194
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
2195
- * their plain counterparts (`:`, `$`, `,`, `+`).
2196
- *
2197
- * @param {string} val The value to be encoded.
2198
- *
2199
- * @returns {string} The encoded value.
2200
- */
2201
- function encode(val) {
2202
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
2011
+ function normalizeValue(value) {
2012
+ if (value === false || value == null) {
2013
+ return value;
2014
+ }
2015
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
2203
2016
  }
2204
-
2205
- /**
2206
- * Build a URL by appending params to the end
2207
- *
2208
- * @param {string} url The base of the url (e.g., http://www.google.com)
2209
- * @param {object} [params] The params to be appended
2210
- * @param {?(object|Function)} options
2211
- *
2212
- * @returns {string} The formatted url
2213
- */
2214
- function buildURL(url, params, options) {
2215
- if (!params) {
2216
- return url;
2017
+ function parseTokens(str) {
2018
+ var tokens = Object.create(null);
2019
+ var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2020
+ var match;
2021
+ while (match = tokensRE.exec(str)) {
2022
+ tokens[match[1]] = match[2];
2217
2023
  }
2218
- var _encode = options && options.encode || encode;
2219
- var _options = utils$1.isFunction(options) ? {
2220
- serialize: options
2221
- } : options;
2222
- var serializeFn = _options && _options.serialize;
2223
- var serializedParams;
2224
- if (serializeFn) {
2225
- serializedParams = serializeFn(params, _options);
2226
- } else {
2227
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
2024
+ return tokens;
2025
+ }
2026
+ var isValidHeaderName = function isValidHeaderName(str) {
2027
+ return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2028
+ };
2029
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2030
+ if (utils$1.isFunction(filter)) {
2031
+ return filter.call(this, value, header);
2228
2032
  }
2229
- if (serializedParams) {
2230
- var hashmarkIndex = url.indexOf('#');
2231
- if (hashmarkIndex !== -1) {
2232
- url = url.slice(0, hashmarkIndex);
2233
- }
2234
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2033
+ if (isHeaderNameFilter) {
2034
+ value = header;
2035
+ }
2036
+ if (!utils$1.isString(value)) return;
2037
+ if (utils$1.isString(filter)) {
2038
+ return value.indexOf(filter) !== -1;
2039
+ }
2040
+ if (utils$1.isRegExp(filter)) {
2041
+ return filter.test(value);
2235
2042
  }
2236
- return url;
2237
2043
  }
2238
-
2239
- var InterceptorManager = /*#__PURE__*/function () {
2240
- function InterceptorManager() {
2241
- _classCallCheck$1(this, InterceptorManager);
2242
- this.handlers = [];
2044
+ function formatHeader(header) {
2045
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
2046
+ return char.toUpperCase() + str;
2047
+ });
2048
+ }
2049
+ function buildAccessors(obj, header) {
2050
+ var accessorName = utils$1.toCamelCase(' ' + header);
2051
+ ['get', 'set', 'has'].forEach(function (methodName) {
2052
+ Object.defineProperty(obj, methodName + accessorName, {
2053
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2054
+ // this data descriptor into an accessor descriptor on the way in.
2055
+ __proto__: null,
2056
+ value: function value(arg1, arg2, arg3) {
2057
+ return this[methodName].call(this, header, arg1, arg2, arg3);
2058
+ },
2059
+ configurable: true
2060
+ });
2061
+ });
2062
+ }
2063
+ var AxiosHeaders = /*#__PURE__*/function () {
2064
+ function AxiosHeaders(headers) {
2065
+ _classCallCheck$1(this, AxiosHeaders);
2066
+ headers && this.set(headers);
2243
2067
  }
2244
-
2245
- /**
2246
- * Add a new interceptor to the stack
2247
- *
2248
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
2249
- * @param {Function} rejected The function to handle `reject` for a `Promise`
2250
- * @param {Object} options The options for the interceptor, synchronous and runWhen
2251
- *
2252
- * @return {Number} An ID used to remove interceptor later
2253
- */
2254
- return _createClass$1(InterceptorManager, [{
2255
- key: "use",
2256
- value: function use(fulfilled, rejected, options) {
2257
- this.handlers.push({
2258
- fulfilled: fulfilled,
2259
- rejected: rejected,
2260
- synchronous: options ? options.synchronous : false,
2261
- runWhen: options ? options.runWhen : null
2262
- });
2263
- return this.handlers.length - 1;
2068
+ return _createClass$1(AxiosHeaders, [{
2069
+ key: "set",
2070
+ value: function set(header, valueOrRewrite, rewrite) {
2071
+ var self = this;
2072
+ function setHeader(_value, _header, _rewrite) {
2073
+ var lHeader = normalizeHeader(_header);
2074
+ if (!lHeader) {
2075
+ throw new Error('header name must be a non-empty string');
2076
+ }
2077
+ var key = utils$1.findKey(self, lHeader);
2078
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2079
+ self[key || _header] = normalizeValue(_value);
2080
+ }
2081
+ }
2082
+ var setHeaders = function setHeaders(headers, _rewrite) {
2083
+ return utils$1.forEach(headers, function (_value, _header) {
2084
+ return setHeader(_value, _header, _rewrite);
2085
+ });
2086
+ };
2087
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2088
+ setHeaders(header, valueOrRewrite);
2089
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2090
+ setHeaders(parseHeaders(header), valueOrRewrite);
2091
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2092
+ var obj = {},
2093
+ dest,
2094
+ key;
2095
+ var _iterator = _createForOfIteratorHelper(header),
2096
+ _step;
2097
+ try {
2098
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2099
+ var entry = _step.value;
2100
+ if (!utils$1.isArray(entry)) {
2101
+ throw TypeError('Object iterator must return a key-value pair');
2102
+ }
2103
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
2104
+ }
2105
+ } catch (err) {
2106
+ _iterator.e(err);
2107
+ } finally {
2108
+ _iterator.f();
2109
+ }
2110
+ setHeaders(obj, valueOrRewrite);
2111
+ } else {
2112
+ header != null && setHeader(valueOrRewrite, header, rewrite);
2113
+ }
2114
+ return this;
2264
2115
  }
2265
-
2266
- /**
2267
- * Remove an interceptor from the stack
2268
- *
2269
- * @param {Number} id The ID that was returned by `use`
2270
- *
2271
- * @returns {void}
2272
- */
2273
2116
  }, {
2274
- key: "eject",
2275
- value: function eject(id) {
2276
- if (this.handlers[id]) {
2277
- this.handlers[id] = null;
2117
+ key: "get",
2118
+ value: function get(header, parser) {
2119
+ header = normalizeHeader(header);
2120
+ if (header) {
2121
+ var key = utils$1.findKey(this, header);
2122
+ if (key) {
2123
+ var value = this[key];
2124
+ if (!parser) {
2125
+ return value;
2126
+ }
2127
+ if (parser === true) {
2128
+ return parseTokens(value);
2129
+ }
2130
+ if (utils$1.isFunction(parser)) {
2131
+ return parser.call(this, value, key);
2132
+ }
2133
+ if (utils$1.isRegExp(parser)) {
2134
+ return parser.exec(value);
2135
+ }
2136
+ throw new TypeError('parser must be boolean|regexp|function');
2137
+ }
2278
2138
  }
2279
2139
  }
2280
-
2281
- /**
2282
- * Clear all interceptors from the stack
2283
- *
2284
- * @returns {void}
2285
- */
2140
+ }, {
2141
+ key: "has",
2142
+ value: function has(header, matcher) {
2143
+ header = normalizeHeader(header);
2144
+ if (header) {
2145
+ var key = utils$1.findKey(this, header);
2146
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2147
+ }
2148
+ return false;
2149
+ }
2150
+ }, {
2151
+ key: "delete",
2152
+ value: function _delete(header, matcher) {
2153
+ var self = this;
2154
+ var deleted = false;
2155
+ function deleteHeader(_header) {
2156
+ _header = normalizeHeader(_header);
2157
+ if (_header) {
2158
+ var key = utils$1.findKey(self, _header);
2159
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2160
+ delete self[key];
2161
+ deleted = true;
2162
+ }
2163
+ }
2164
+ }
2165
+ if (utils$1.isArray(header)) {
2166
+ header.forEach(deleteHeader);
2167
+ } else {
2168
+ deleteHeader(header);
2169
+ }
2170
+ return deleted;
2171
+ }
2286
2172
  }, {
2287
2173
  key: "clear",
2288
- value: function clear() {
2289
- if (this.handlers) {
2290
- this.handlers = [];
2174
+ value: function clear(matcher) {
2175
+ var keys = Object.keys(this);
2176
+ var i = keys.length;
2177
+ var deleted = false;
2178
+ while (i--) {
2179
+ var key = keys[i];
2180
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2181
+ delete this[key];
2182
+ deleted = true;
2183
+ }
2291
2184
  }
2185
+ return deleted;
2292
2186
  }
2293
-
2294
- /**
2295
- * Iterate over all the registered interceptors
2296
- *
2297
- * This method is particularly useful for skipping over any
2298
- * interceptors that may have become `null` calling `eject`.
2299
- *
2300
- * @param {Function} fn The function to call for each interceptor
2301
- *
2302
- * @returns {void}
2303
- */
2304
2187
  }, {
2305
- key: "forEach",
2306
- value: function forEach(fn) {
2307
- utils$1.forEach(this.handlers, function forEachHandler(h) {
2308
- if (h !== null) {
2309
- fn(h);
2188
+ key: "normalize",
2189
+ value: function normalize(format) {
2190
+ var self = this;
2191
+ var headers = {};
2192
+ utils$1.forEach(this, function (value, header) {
2193
+ var key = utils$1.findKey(headers, header);
2194
+ if (key) {
2195
+ self[key] = normalizeValue(value);
2196
+ delete self[header];
2197
+ return;
2198
+ }
2199
+ var normalized = format ? formatHeader(header) : String(header).trim();
2200
+ if (normalized !== header) {
2201
+ delete self[header];
2310
2202
  }
2203
+ self[normalized] = normalizeValue(value);
2204
+ headers[normalized] = true;
2311
2205
  });
2206
+ return this;
2312
2207
  }
2313
- }]);
2314
- }();
2315
- var InterceptorManager$1 = InterceptorManager;
2316
-
2317
- var transitionalDefaults = {
2318
- silentJSONParsing: true,
2319
- forcedJSONParsing: true,
2320
- clarifyTimeoutError: false,
2321
- legacyInterceptorReqResOrdering: true
2322
- };
2323
-
2324
- var defineProperty = {exports: {}};
2325
-
2326
- (function (module) {
2327
- var toPropertyKey$1 = toPropertyKey.exports;
2328
- function _defineProperty(e, r, t) {
2329
- return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
2330
- value: t,
2331
- enumerable: !0,
2332
- configurable: !0,
2333
- writable: !0
2334
- }) : e[r] = t, e;
2335
- }
2336
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
2337
- })(defineProperty);
2338
- var _defineProperty = /*@__PURE__*/getDefaultExportFromCjs(defineProperty.exports);
2339
-
2340
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2341
-
2342
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2343
-
2344
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2345
-
2346
- var platform$1 = {
2347
- isBrowser: true,
2348
- classes: {
2349
- URLSearchParams: URLSearchParams$1,
2350
- FormData: FormData$1,
2351
- Blob: Blob$1
2352
- },
2353
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2354
- };
2355
-
2356
- var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2357
- var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$1(navigator)) === 'object' && navigator || undefined;
2358
-
2359
- /**
2360
- * Determine if we're running in a standard browser environment
2361
- *
2362
- * This allows axios to run in a web worker, and react-native.
2363
- * Both environments support XMLHttpRequest, but not fully standard globals.
2364
- *
2365
- * web workers:
2366
- * typeof window -> undefined
2367
- * typeof document -> undefined
2368
- *
2369
- * react-native:
2370
- * navigator.product -> 'ReactNative'
2371
- * nativescript
2372
- * navigator.product -> 'NativeScript' or 'NS'
2373
- *
2374
- * @returns {boolean}
2375
- */
2376
- var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2377
-
2378
- /**
2379
- * Determine if we're running in a standard browser webWorker environment
2380
- *
2381
- * Although the `isStandardBrowserEnv` method indicates that
2382
- * `allows axios to run in a web worker`, the WebWorker will still be
2383
- * filtered out due to its judgment standard
2384
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2385
- * This leads to a problem when axios post `FormData` in webWorker
2386
- */
2387
- var hasStandardBrowserWebWorkerEnv = function () {
2388
- return typeof WorkerGlobalScope !== 'undefined' &&
2389
- // eslint-disable-next-line no-undef
2390
- self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
2208
+ }, {
2209
+ key: "concat",
2210
+ value: function concat() {
2211
+ var _this$constructor;
2212
+ for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
2213
+ targets[_key] = arguments[_key];
2214
+ }
2215
+ return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2216
+ }
2217
+ }, {
2218
+ key: "toJSON",
2219
+ value: function toJSON(asStrings) {
2220
+ var obj = Object.create(null);
2221
+ utils$1.forEach(this, function (value, header) {
2222
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2223
+ });
2224
+ return obj;
2225
+ }
2226
+ }, {
2227
+ key: Symbol.iterator,
2228
+ value: function value() {
2229
+ return Object.entries(this.toJSON())[Symbol.iterator]();
2230
+ }
2231
+ }, {
2232
+ key: "toString",
2233
+ value: function toString() {
2234
+ return Object.entries(this.toJSON()).map(function (_ref) {
2235
+ var _ref2 = _slicedToArray(_ref, 2),
2236
+ header = _ref2[0],
2237
+ value = _ref2[1];
2238
+ return header + ': ' + value;
2239
+ }).join('\n');
2240
+ }
2241
+ }, {
2242
+ key: "getSetCookie",
2243
+ value: function getSetCookie() {
2244
+ return this.get('set-cookie') || [];
2245
+ }
2246
+ }, {
2247
+ key: Symbol.toStringTag,
2248
+ get: function get() {
2249
+ return 'AxiosHeaders';
2250
+ }
2251
+ }], [{
2252
+ key: "from",
2253
+ value: function from(thing) {
2254
+ return thing instanceof this ? thing : new this(thing);
2255
+ }
2256
+ }, {
2257
+ key: "concat",
2258
+ value: function concat(first) {
2259
+ var computed = new this(first);
2260
+ for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2261
+ targets[_key2 - 1] = arguments[_key2];
2262
+ }
2263
+ targets.forEach(function (target) {
2264
+ return computed.set(target);
2265
+ });
2266
+ return computed;
2267
+ }
2268
+ }, {
2269
+ key: "accessor",
2270
+ value: function accessor(header) {
2271
+ var internals = this[$internals] = this[$internals] = {
2272
+ accessors: {}
2273
+ };
2274
+ var accessors = internals.accessors;
2275
+ var prototype = this.prototype;
2276
+ function defineAccessor(_header) {
2277
+ var lHeader = normalizeHeader(_header);
2278
+ if (!accessors[lHeader]) {
2279
+ buildAccessors(prototype, _header);
2280
+ accessors[lHeader] = true;
2281
+ }
2282
+ }
2283
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2284
+ return this;
2285
+ }
2286
+ }]);
2391
2287
  }();
2392
- var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2288
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2393
2289
 
2394
- var utils = /*#__PURE__*/Object.freeze({
2395
- __proto__: null,
2396
- hasBrowserEnv: hasBrowserEnv,
2397
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2398
- hasStandardBrowserEnv: hasStandardBrowserEnv,
2399
- navigator: _navigator,
2400
- origin: origin
2290
+ // reserved names hotfix
2291
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
2292
+ var value = _ref3.value;
2293
+ var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2294
+ return {
2295
+ get: function get() {
2296
+ return value;
2297
+ },
2298
+ set: function set(headerValue) {
2299
+ this[mapped] = headerValue;
2300
+ }
2301
+ };
2401
2302
  });
2303
+ utils$1.freezeMethods(AxiosHeaders);
2304
+ var AxiosHeaders$1 = AxiosHeaders;
2402
2305
 
2403
- function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2404
- function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2405
- var platform = _objectSpread$4(_objectSpread$4({}, utils), platform$1);
2306
+ function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
2307
+ function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
2308
+ var REDACTED = '[REDACTED ****]';
2309
+ function hasOwnOrPrototypeToJSON(source) {
2310
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
2311
+ return true;
2312
+ }
2313
+ var prototype = Object.getPrototypeOf(source);
2314
+ while (prototype && prototype !== Object.prototype) {
2315
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
2316
+ return true;
2317
+ }
2318
+ prototype = Object.getPrototypeOf(prototype);
2319
+ }
2320
+ return false;
2321
+ }
2406
2322
 
2407
- function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2408
- function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2409
- function toURLEncodedForm(data, options) {
2410
- return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$3({
2411
- visitor: function visitor(value, key, path, helpers) {
2412
- if (platform.isNode && utils$1.isBuffer(value)) {
2413
- this.append(key, value.toString('base64'));
2414
- return false;
2323
+ // Build a plain-object snapshot of `config` and replace the value of any key
2324
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
2325
+ // and AxiosHeaders, and short-circuits on circular references.
2326
+ function redactConfig(config, redactKeys) {
2327
+ var lowerKeys = new Set(redactKeys.map(function (k) {
2328
+ return String(k).toLowerCase();
2329
+ }));
2330
+ var seen = [];
2331
+ var _visit = function visit(source) {
2332
+ if (source === null || _typeof$1(source) !== 'object') return source;
2333
+ if (utils$1.isBuffer(source)) return source;
2334
+ if (seen.indexOf(source) !== -1) return undefined;
2335
+ if (source instanceof AxiosHeaders$1) {
2336
+ source = source.toJSON();
2337
+ }
2338
+ seen.push(source);
2339
+ var result;
2340
+ if (utils$1.isArray(source)) {
2341
+ result = [];
2342
+ source.forEach(function (v, i) {
2343
+ var reducedValue = _visit(v);
2344
+ if (!utils$1.isUndefined(reducedValue)) {
2345
+ result[i] = reducedValue;
2346
+ }
2347
+ });
2348
+ } else {
2349
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
2350
+ seen.pop();
2351
+ return source;
2352
+ }
2353
+ result = Object.create(null);
2354
+ for (var _i = 0, _Object$entries = Object.entries(source); _i < _Object$entries.length; _i++) {
2355
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2356
+ key = _Object$entries$_i[0],
2357
+ value = _Object$entries$_i[1];
2358
+ var reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : _visit(value);
2359
+ if (!utils$1.isUndefined(reducedValue)) {
2360
+ result[key] = reducedValue;
2361
+ }
2415
2362
  }
2416
- return helpers.defaultVisitor.apply(this, arguments);
2417
2363
  }
2418
- }, options));
2364
+ seen.pop();
2365
+ return result;
2366
+ };
2367
+ return _visit(config);
2419
2368
  }
2369
+ var AxiosError = /*#__PURE__*/function (_Error) {
2370
+ /**
2371
+ * Create an Error with the specified message, config, error code, request and response.
2372
+ *
2373
+ * @param {string} message The error message.
2374
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
2375
+ * @param {Object} [config] The config.
2376
+ * @param {Object} [request] The request.
2377
+ * @param {Object} [response] The response.
2378
+ *
2379
+ * @returns {Error} The created error.
2380
+ */
2381
+ function AxiosError(message, code, config, request, response) {
2382
+ var _this;
2383
+ _classCallCheck$1(this, AxiosError);
2384
+ _this = _callSuper$1(this, AxiosError, [message]);
2385
+
2386
+ // Make message enumerable to maintain backward compatibility
2387
+ // The native Error constructor sets message as non-enumerable,
2388
+ // but axios < v1.13.3 had it as enumerable
2389
+ Object.defineProperty(_this, 'message', {
2390
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2391
+ // this data descriptor into an accessor descriptor on the way in.
2392
+ __proto__: null,
2393
+ value: message,
2394
+ enumerable: true,
2395
+ writable: true,
2396
+ configurable: true
2397
+ });
2398
+ _this.name = 'AxiosError';
2399
+ _this.isAxiosError = true;
2400
+ code && (_this.code = code);
2401
+ config && (_this.config = config);
2402
+ request && (_this.request = request);
2403
+ if (response) {
2404
+ _this.response = response;
2405
+ _this.status = response.status;
2406
+ }
2407
+ return _this;
2408
+ }
2409
+ _inherits(AxiosError, _Error);
2410
+ return _createClass$1(AxiosError, [{
2411
+ key: "toJSON",
2412
+ value: function toJSON() {
2413
+ // Opt-in redaction: when the request config carries a `redact` array, the
2414
+ // value of any matching key (case-insensitive, at any depth) is replaced
2415
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
2416
+ // existing serialization behavior unchanged.
2417
+ var config = this.config;
2418
+ var redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
2419
+ var serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
2420
+ return {
2421
+ // Standard
2422
+ message: this.message,
2423
+ name: this.name,
2424
+ // Microsoft
2425
+ description: this.description,
2426
+ number: this.number,
2427
+ // Mozilla
2428
+ fileName: this.fileName,
2429
+ lineNumber: this.lineNumber,
2430
+ columnNumber: this.columnNumber,
2431
+ stack: this.stack,
2432
+ // Axios
2433
+ config: serializedConfig,
2434
+ code: this.code,
2435
+ status: this.status
2436
+ };
2437
+ }
2438
+ }], [{
2439
+ key: "from",
2440
+ value: function from(error, code, config, request, response, customProps) {
2441
+ var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
2442
+ axiosError.cause = error;
2443
+ axiosError.name = error.name;
2444
+
2445
+ // Preserve status from the original error if not already set from response
2446
+ if (error.status != null && axiosError.status == null) {
2447
+ axiosError.status = error.status;
2448
+ }
2449
+ customProps && Object.assign(axiosError, customProps);
2450
+ return axiosError;
2451
+ }
2452
+ }]);
2453
+ }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
2454
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
2455
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
2456
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
2457
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
2458
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
2459
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
2460
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
2461
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
2462
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
2463
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
2464
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
2465
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
2466
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
2467
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
2468
+ var AxiosError$1 = AxiosError;
2469
+
2470
+ // eslint-disable-next-line strict
2471
+ var httpAdapter = null;
2420
2472
 
2421
2473
  /**
2422
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2474
+ * Determines if the given thing is a array or js object.
2423
2475
  *
2424
- * @param {string} name - The name of the property to get.
2476
+ * @param {string} thing - The object or array to be visited.
2425
2477
  *
2426
- * @returns An array of strings.
2478
+ * @returns {boolean}
2427
2479
  */
2428
- function parsePropPath(name) {
2429
- // foo[x][y][z]
2430
- // foo.x.y.z
2431
- // foo-x-y-z
2432
- // foo x y z
2433
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2434
- return match[0] === '[]' ? '' : match[1] || match[0];
2435
- });
2480
+ function isVisitable(thing) {
2481
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
2436
2482
  }
2437
2483
 
2438
2484
  /**
2439
- * Convert an array to an object.
2485
+ * It removes the brackets from the end of a string
2440
2486
  *
2441
- * @param {Array<any>} arr - The array to convert to an object.
2487
+ * @param {string} key - The key of the parameter.
2442
2488
  *
2443
- * @returns An object with the same keys and values as the array.
2489
+ * @returns {string} the key without the brackets.
2444
2490
  */
2445
- function arrayToObject(arr) {
2446
- var obj = {};
2447
- var keys = Object.keys(arr);
2448
- var i;
2449
- var len = keys.length;
2450
- var key;
2451
- for (i = 0; i < len; i++) {
2452
- key = keys[i];
2453
- obj[key] = arr[key];
2454
- }
2455
- return obj;
2491
+ function removeBrackets(key) {
2492
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
2456
2493
  }
2457
2494
 
2458
2495
  /**
2459
- * It takes a FormData object and returns a JavaScript object
2496
+ * It takes a path, a key, and a boolean, and returns a string
2460
2497
  *
2461
- * @param {string} formData The FormData object to convert to JSON.
2498
+ * @param {string} path - The path to the current key.
2499
+ * @param {string} key - The key of the current object being iterated over.
2500
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
2462
2501
  *
2463
- * @returns {Object<string, any> | null} The converted object.
2502
+ * @returns {string} The path to the current key.
2464
2503
  */
2465
- function formDataToJSON(formData) {
2466
- function buildPath(path, value, target, index) {
2467
- var name = path[index++];
2468
- if (name === '__proto__') return true;
2469
- var isNumericKey = Number.isFinite(+name);
2470
- var isLast = index >= path.length;
2471
- name = !name && utils$1.isArray(target) ? target.length : name;
2472
- if (isLast) {
2473
- if (utils$1.hasOwnProp(target, name)) {
2474
- target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
2475
- } else {
2476
- target[name] = value;
2477
- }
2478
- return !isNumericKey;
2479
- }
2480
- if (!target[name] || !utils$1.isObject(target[name])) {
2481
- target[name] = [];
2482
- }
2483
- var result = buildPath(path, value, target[name], index);
2484
- if (result && utils$1.isArray(target[name])) {
2485
- target[name] = arrayToObject(target[name]);
2486
- }
2487
- return !isNumericKey;
2488
- }
2489
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2490
- var obj = {};
2491
- utils$1.forEachEntry(formData, function (name, value) {
2492
- buildPath(parsePropPath(name), value, obj, 0);
2493
- });
2494
- return obj;
2495
- }
2496
- return null;
2504
+ function renderKey(path, key, dots) {
2505
+ if (!path) return key;
2506
+ return path.concat(key).map(function each(token, i) {
2507
+ // eslint-disable-next-line no-param-reassign
2508
+ token = removeBrackets(token);
2509
+ return !dots && i ? '[' + token + ']' : token;
2510
+ }).join(dots ? '.' : '');
2497
2511
  }
2498
2512
 
2499
- var own = function own(obj, key) {
2500
- return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
2501
- };
2513
+ /**
2514
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
2515
+ *
2516
+ * @param {Array<any>} arr - The array to check
2517
+ *
2518
+ * @returns {boolean}
2519
+ */
2520
+ function isFlatArray(arr) {
2521
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
2522
+ }
2523
+ var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2524
+ return /^is[A-Z]/.test(prop);
2525
+ });
2502
2526
 
2503
2527
  /**
2504
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2505
- * of the input
2528
+ * Convert a data object to FormData
2506
2529
  *
2507
- * @param {any} rawValue - The value to be stringified.
2508
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2509
- * @param {Function} encoder - A function that takes a value and returns a string.
2530
+ * @param {Object} obj
2531
+ * @param {?Object} [formData]
2532
+ * @param {?Object} [options]
2533
+ * @param {Function} [options.visitor]
2534
+ * @param {Boolean} [options.metaTokens = true]
2535
+ * @param {Boolean} [options.dots = false]
2536
+ * @param {?Boolean} [options.indexes = false]
2510
2537
  *
2511
- * @returns {string} A stringified version of the rawValue.
2538
+ * @returns {Object}
2539
+ **/
2540
+
2541
+ /**
2542
+ * It converts an object into a FormData object
2543
+ *
2544
+ * @param {Object<any, any>} obj - The object to convert to form data.
2545
+ * @param {string} formData - The FormData object to append to.
2546
+ * @param {Object<string, any>} options
2547
+ *
2548
+ * @returns
2512
2549
  */
2513
- function stringifySafely(rawValue, parser, encoder) {
2514
- if (utils$1.isString(rawValue)) {
2515
- try {
2516
- (parser || JSON.parse)(rawValue);
2517
- return utils$1.trim(rawValue);
2518
- } catch (e) {
2519
- if (e.name !== 'SyntaxError') {
2520
- throw e;
2521
- }
2522
- }
2550
+ function toFormData(obj, formData, options) {
2551
+ if (!utils$1.isObject(obj)) {
2552
+ throw new TypeError('target must be an object');
2523
2553
  }
2524
- return (encoder || JSON.stringify)(rawValue);
2525
- }
2526
- var defaults = {
2527
- transitional: transitionalDefaults,
2528
- adapter: ['xhr', 'http', 'fetch'],
2529
- transformRequest: [function transformRequest(data, headers) {
2530
- var contentType = headers.getContentType() || '';
2531
- var hasJSONContentType = contentType.indexOf('application/json') > -1;
2532
- var isObjectPayload = utils$1.isObject(data);
2533
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
2534
- data = new FormData(data);
2554
+
2555
+ // eslint-disable-next-line no-param-reassign
2556
+ formData = formData || new (FormData)();
2557
+
2558
+ // eslint-disable-next-line no-param-reassign
2559
+ options = utils$1.toFlatObject(options, {
2560
+ metaTokens: true,
2561
+ dots: false,
2562
+ indexes: false
2563
+ }, false, function defined(option, source) {
2564
+ // eslint-disable-next-line no-eq-null,eqeqeq
2565
+ return !utils$1.isUndefined(source[option]);
2566
+ });
2567
+ var metaTokens = options.metaTokens;
2568
+ // eslint-disable-next-line no-use-before-define
2569
+ var visitor = options.visitor || defaultVisitor;
2570
+ var dots = options.dots;
2571
+ var indexes = options.indexes;
2572
+ var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2573
+ var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2574
+ var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2575
+ if (!utils$1.isFunction(visitor)) {
2576
+ throw new TypeError('visitor must be a function');
2577
+ }
2578
+ function convertValue(value) {
2579
+ if (value === null) return '';
2580
+ if (utils$1.isDate(value)) {
2581
+ return value.toISOString();
2535
2582
  }
2536
- var isFormData = utils$1.isFormData(data);
2537
- if (isFormData) {
2538
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2583
+ if (utils$1.isBoolean(value)) {
2584
+ return value.toString();
2539
2585
  }
2540
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
2541
- return data;
2586
+ if (!useBlob && utils$1.isBlob(value)) {
2587
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
2542
2588
  }
2543
- if (utils$1.isArrayBufferView(data)) {
2544
- return data.buffer;
2589
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2590
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2545
2591
  }
2546
- if (utils$1.isURLSearchParams(data)) {
2547
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2548
- return data.toString();
2592
+ return value;
2593
+ }
2594
+
2595
+ /**
2596
+ * Default visitor.
2597
+ *
2598
+ * @param {*} value
2599
+ * @param {String|Number} key
2600
+ * @param {Array<String|Number>} path
2601
+ * @this {FormData}
2602
+ *
2603
+ * @returns {boolean} return true to visit the each prop of the value recursively
2604
+ */
2605
+ function defaultVisitor(value, key, path) {
2606
+ var arr = value;
2607
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
2608
+ formData.append(renderKey(path, key, dots), convertValue(value));
2609
+ return false;
2549
2610
  }
2550
- var isFileList;
2551
- if (isObjectPayload) {
2552
- var formSerializer = own(this, 'formSerializer');
2553
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2554
- return toURLEncodedForm(data, formSerializer).toString();
2555
- }
2556
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2557
- var env = own(this, 'env');
2558
- var _FormData = env && env.FormData;
2559
- return toFormData(isFileList ? {
2560
- 'files[]': data
2561
- } : data, _FormData && new _FormData(), formSerializer);
2611
+ if (value && !path && _typeof$1(value) === 'object') {
2612
+ if (utils$1.endsWith(key, '{}')) {
2613
+ // eslint-disable-next-line no-param-reassign
2614
+ key = metaTokens ? key : key.slice(0, -2);
2615
+ // eslint-disable-next-line no-param-reassign
2616
+ value = JSON.stringify(value);
2617
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2618
+ // eslint-disable-next-line no-param-reassign
2619
+ key = removeBrackets(key);
2620
+ arr.forEach(function each(el, index) {
2621
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
2622
+ // eslint-disable-next-line no-nested-ternary
2623
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2624
+ });
2625
+ return false;
2562
2626
  }
2563
2627
  }
2564
- if (isObjectPayload || hasJSONContentType) {
2565
- headers.setContentType('application/json', false);
2566
- return stringifySafely(data);
2628
+ if (isVisitable(value)) {
2629
+ return true;
2567
2630
  }
2568
- return data;
2569
- }],
2570
- transformResponse: [function transformResponse(data) {
2571
- var transitional = own(this, 'transitional') || defaults.transitional;
2572
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2573
- var responseType = own(this, 'responseType');
2574
- var JSONRequested = responseType === 'json';
2575
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2576
- return data;
2631
+ formData.append(renderKey(path, key, dots), convertValue(value));
2632
+ return false;
2633
+ }
2634
+ var stack = [];
2635
+ var exposedHelpers = Object.assign(predicates, {
2636
+ defaultVisitor: defaultVisitor,
2637
+ convertValue: convertValue,
2638
+ isVisitable: isVisitable
2639
+ });
2640
+ function build(value, path) {
2641
+ var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2642
+ if (utils$1.isUndefined(value)) return;
2643
+ if (depth > maxDepth) {
2644
+ throw new AxiosError$1('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED);
2577
2645
  }
2578
- if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
2579
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
2580
- var strictJSONParsing = !silentJSONParsing && JSONRequested;
2581
- try {
2582
- return JSON.parse(data, own(this, 'parseReviver'));
2583
- } catch (e) {
2584
- if (strictJSONParsing) {
2585
- if (e.name === 'SyntaxError') {
2586
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
2587
- }
2588
- throw e;
2589
- }
2590
- }
2646
+ if (stack.indexOf(value) !== -1) {
2647
+ throw Error('Circular reference detected in ' + path.join('.'));
2591
2648
  }
2592
- return data;
2593
- }],
2594
- /**
2595
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2596
- * timeout is not created.
2597
- */
2598
- timeout: 0,
2599
- xsrfCookieName: 'XSRF-TOKEN',
2600
- xsrfHeaderName: 'X-XSRF-TOKEN',
2601
- maxContentLength: -1,
2602
- maxBodyLength: -1,
2603
- env: {
2604
- FormData: platform.classes.FormData,
2605
- Blob: platform.classes.Blob
2606
- },
2607
- validateStatus: function validateStatus(status) {
2608
- return status >= 200 && status < 300;
2609
- },
2610
- headers: {
2611
- common: {
2612
- Accept: 'application/json, text/plain, */*',
2613
- 'Content-Type': undefined
2614
- }
2615
- }
2616
- };
2617
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
2618
- defaults.headers[method] = {};
2619
- });
2620
- var defaults$1 = defaults;
2621
-
2622
- var toConsumableArray = {exports: {}};
2623
-
2624
- var arrayWithoutHoles = {exports: {}};
2625
-
2626
- (function (module) {
2627
- var arrayLikeToArray$1 = arrayLikeToArray.exports;
2628
- function _arrayWithoutHoles(r) {
2629
- if (Array.isArray(r)) return arrayLikeToArray$1(r);
2630
- }
2631
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
2632
- })(arrayWithoutHoles);
2633
-
2634
- var iterableToArray = {exports: {}};
2635
-
2636
- (function (module) {
2637
- function _iterableToArray(r) {
2638
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2639
- }
2640
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2641
- })(iterableToArray);
2642
-
2643
- var nonIterableSpread = {exports: {}};
2644
-
2645
- (function (module) {
2646
- function _nonIterableSpread() {
2647
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2649
+ stack.push(value);
2650
+ utils$1.forEach(value, function each(el, key) {
2651
+ var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
2652
+ if (result === true) {
2653
+ build(el, path ? path.concat(key) : [key], depth + 1);
2654
+ }
2655
+ });
2656
+ stack.pop();
2648
2657
  }
2649
- module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
2650
- })(nonIterableSpread);
2651
-
2652
- (function (module) {
2653
- var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
2654
- var iterableToArray$1 = iterableToArray.exports;
2655
- var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
2656
- var nonIterableSpread$1 = nonIterableSpread.exports;
2657
- function _toConsumableArray(r) {
2658
- return arrayWithoutHoles$1(r) || iterableToArray$1(r) || unsupportedIterableToArray$1(r) || nonIterableSpread$1();
2658
+ if (!utils$1.isObject(obj)) {
2659
+ throw new TypeError('data must be an object');
2659
2660
  }
2660
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2661
- })(toConsumableArray);
2662
- var _toConsumableArray = /*@__PURE__*/getDefaultExportFromCjs(toConsumableArray.exports);
2663
-
2664
- // RawAxiosHeaders whose duplicates are ignored by node
2665
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2666
- var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
2661
+ build(obj);
2662
+ return formData;
2663
+ }
2667
2664
 
2668
2665
  /**
2669
- * Parse headers into an object
2670
- *
2671
- * ```
2672
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
2673
- * Content-Type: application/json
2674
- * Connection: keep-alive
2675
- * Transfer-Encoding: chunked
2676
- * ```
2666
+ * It encodes a string by replacing all characters that are not in the unreserved set with
2667
+ * their percent-encoded equivalents
2677
2668
  *
2678
- * @param {String} rawHeaders Headers needing to be parsed
2669
+ * @param {string} str - The string to encode.
2679
2670
  *
2680
- * @returns {Object} Headers parsed into an object
2671
+ * @returns {string} The encoded string.
2681
2672
  */
2682
- var parseHeaders = (function (rawHeaders) {
2683
- var parsed = {};
2684
- var key;
2685
- var val;
2686
- var i;
2687
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2688
- i = line.indexOf(':');
2689
- key = line.substring(0, i).trim().toLowerCase();
2690
- val = line.substring(i + 1).trim();
2691
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2692
- return;
2693
- }
2694
- if (key === 'set-cookie') {
2695
- if (parsed[key]) {
2696
- parsed[key].push(val);
2697
- } else {
2698
- parsed[key] = [val];
2699
- }
2700
- } else {
2701
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2702
- }
2673
+ function encode$1(str) {
2674
+ var charMap = {
2675
+ '!': '%21',
2676
+ "'": '%27',
2677
+ '(': '%28',
2678
+ ')': '%29',
2679
+ '~': '%7E',
2680
+ '%20': '+'
2681
+ };
2682
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
2683
+ return charMap[match];
2703
2684
  });
2704
- return parsed;
2705
- });
2706
-
2707
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2708
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2709
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2710
- var $internals = Symbol('internals');
2711
- var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
2712
- function trimSPorHTAB(str) {
2713
- var start = 0;
2714
- var end = str.length;
2715
- while (start < end) {
2716
- var code = str.charCodeAt(start);
2717
- if (code !== 0x09 && code !== 0x20) {
2718
- break;
2719
- }
2720
- start += 1;
2721
- }
2722
- while (end > start) {
2723
- var _code = str.charCodeAt(end - 1);
2724
- if (_code !== 0x09 && _code !== 0x20) {
2725
- break;
2726
- }
2727
- end -= 1;
2728
- }
2729
- return start === 0 && end === str.length ? str : str.slice(start, end);
2730
- }
2731
- function normalizeHeader(header) {
2732
- return header && String(header).trim().toLowerCase();
2733
- }
2734
- function sanitizeHeaderValue(str) {
2735
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
2736
- }
2737
- function normalizeValue(value) {
2738
- if (value === false || value == null) {
2739
- return value;
2740
- }
2741
- return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
2742
2685
  }
2743
- function parseTokens(str) {
2744
- var tokens = Object.create(null);
2745
- var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2746
- var match;
2747
- while (match = tokensRE.exec(str)) {
2748
- tokens[match[1]] = match[2];
2749
- }
2750
- return tokens;
2686
+
2687
+ /**
2688
+ * It takes a params object and converts it to a FormData object
2689
+ *
2690
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2691
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2692
+ *
2693
+ * @returns {void}
2694
+ */
2695
+ function AxiosURLSearchParams(params, options) {
2696
+ this._pairs = [];
2697
+ params && toFormData(params, this, options);
2751
2698
  }
2752
- var isValidHeaderName = function isValidHeaderName(str) {
2753
- return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2699
+ var prototype = AxiosURLSearchParams.prototype;
2700
+ prototype.append = function append(name, value) {
2701
+ this._pairs.push([name, value]);
2754
2702
  };
2755
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2756
- if (utils$1.isFunction(filter)) {
2757
- return filter.call(this, value, header);
2758
- }
2759
- if (isHeaderNameFilter) {
2760
- value = header;
2703
+ prototype.toString = function toString(encoder) {
2704
+ var _encode = encoder ? function (value) {
2705
+ return encoder.call(this, value, encode$1);
2706
+ } : encode$1;
2707
+ return this._pairs.map(function each(pair) {
2708
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
2709
+ }, '').join('&');
2710
+ };
2711
+
2712
+ /**
2713
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
2714
+ * their plain counterparts (`:`, `$`, `,`, `+`).
2715
+ *
2716
+ * @param {string} val The value to be encoded.
2717
+ *
2718
+ * @returns {string} The encoded value.
2719
+ */
2720
+ function encode(val) {
2721
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
2722
+ }
2723
+
2724
+ /**
2725
+ * Build a URL by appending params to the end
2726
+ *
2727
+ * @param {string} url The base of the url (e.g., http://www.google.com)
2728
+ * @param {object} [params] The params to be appended
2729
+ * @param {?(object|Function)} options
2730
+ *
2731
+ * @returns {string} The formatted url
2732
+ */
2733
+ function buildURL(url, params, options) {
2734
+ if (!params) {
2735
+ return url;
2761
2736
  }
2762
- if (!utils$1.isString(value)) return;
2763
- if (utils$1.isString(filter)) {
2764
- return value.indexOf(filter) !== -1;
2737
+ var _encode = options && options.encode || encode;
2738
+ var _options = utils$1.isFunction(options) ? {
2739
+ serialize: options
2740
+ } : options;
2741
+ var serializeFn = _options && _options.serialize;
2742
+ var serializedParams;
2743
+ if (serializeFn) {
2744
+ serializedParams = serializeFn(params, _options);
2745
+ } else {
2746
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
2765
2747
  }
2766
- if (utils$1.isRegExp(filter)) {
2767
- return filter.test(value);
2748
+ if (serializedParams) {
2749
+ var hashmarkIndex = url.indexOf('#');
2750
+ if (hashmarkIndex !== -1) {
2751
+ url = url.slice(0, hashmarkIndex);
2752
+ }
2753
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2768
2754
  }
2755
+ return url;
2769
2756
  }
2770
- function formatHeader(header) {
2771
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
2772
- return char.toUpperCase() + str;
2773
- });
2774
- }
2775
- function buildAccessors(obj, header) {
2776
- var accessorName = utils$1.toCamelCase(' ' + header);
2777
- ['get', 'set', 'has'].forEach(function (methodName) {
2778
- Object.defineProperty(obj, methodName + accessorName, {
2779
- value: function value(arg1, arg2, arg3) {
2780
- return this[methodName].call(this, header, arg1, arg2, arg3);
2781
- },
2782
- configurable: true
2783
- });
2784
- });
2785
- }
2786
- var AxiosHeaders = /*#__PURE__*/function () {
2787
- function AxiosHeaders(headers) {
2788
- _classCallCheck$1(this, AxiosHeaders);
2789
- headers && this.set(headers);
2757
+
2758
+ var InterceptorManager = /*#__PURE__*/function () {
2759
+ function InterceptorManager() {
2760
+ _classCallCheck$1(this, InterceptorManager);
2761
+ this.handlers = [];
2790
2762
  }
2791
- return _createClass$1(AxiosHeaders, [{
2792
- key: "set",
2793
- value: function set(header, valueOrRewrite, rewrite) {
2794
- var self = this;
2795
- function setHeader(_value, _header, _rewrite) {
2796
- var lHeader = normalizeHeader(_header);
2797
- if (!lHeader) {
2798
- throw new Error('header name must be a non-empty string');
2799
- }
2800
- var key = utils$1.findKey(self, lHeader);
2801
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2802
- self[key || _header] = normalizeValue(_value);
2803
- }
2804
- }
2805
- var setHeaders = function setHeaders(headers, _rewrite) {
2806
- return utils$1.forEach(headers, function (_value, _header) {
2807
- return setHeader(_value, _header, _rewrite);
2808
- });
2809
- };
2810
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2811
- setHeaders(header, valueOrRewrite);
2812
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2813
- setHeaders(parseHeaders(header), valueOrRewrite);
2814
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2815
- var obj = {},
2816
- dest,
2817
- key;
2818
- var _iterator = _createForOfIteratorHelper(header),
2819
- _step;
2820
- try {
2821
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2822
- var entry = _step.value;
2823
- if (!utils$1.isArray(entry)) {
2824
- throw TypeError('Object iterator must return a key-value pair');
2825
- }
2826
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
2827
- }
2828
- } catch (err) {
2829
- _iterator.e(err);
2830
- } finally {
2831
- _iterator.f();
2832
- }
2833
- setHeaders(obj, valueOrRewrite);
2834
- } else {
2835
- header != null && setHeader(valueOrRewrite, header, rewrite);
2836
- }
2837
- return this;
2763
+
2764
+ /**
2765
+ * Add a new interceptor to the stack
2766
+ *
2767
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
2768
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
2769
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
2770
+ *
2771
+ * @return {Number} An ID used to remove interceptor later
2772
+ */
2773
+ return _createClass$1(InterceptorManager, [{
2774
+ key: "use",
2775
+ value: function use(fulfilled, rejected, options) {
2776
+ this.handlers.push({
2777
+ fulfilled: fulfilled,
2778
+ rejected: rejected,
2779
+ synchronous: options ? options.synchronous : false,
2780
+ runWhen: options ? options.runWhen : null
2781
+ });
2782
+ return this.handlers.length - 1;
2838
2783
  }
2784
+
2785
+ /**
2786
+ * Remove an interceptor from the stack
2787
+ *
2788
+ * @param {Number} id The ID that was returned by `use`
2789
+ *
2790
+ * @returns {void}
2791
+ */
2839
2792
  }, {
2840
- key: "get",
2841
- value: function get(header, parser) {
2842
- header = normalizeHeader(header);
2843
- if (header) {
2844
- var key = utils$1.findKey(this, header);
2845
- if (key) {
2846
- var value = this[key];
2847
- if (!parser) {
2848
- return value;
2849
- }
2850
- if (parser === true) {
2851
- return parseTokens(value);
2852
- }
2853
- if (utils$1.isFunction(parser)) {
2854
- return parser.call(this, value, key);
2855
- }
2856
- if (utils$1.isRegExp(parser)) {
2857
- return parser.exec(value);
2858
- }
2859
- throw new TypeError('parser must be boolean|regexp|function');
2860
- }
2793
+ key: "eject",
2794
+ value: function eject(id) {
2795
+ if (this.handlers[id]) {
2796
+ this.handlers[id] = null;
2861
2797
  }
2862
2798
  }
2799
+
2800
+ /**
2801
+ * Clear all interceptors from the stack
2802
+ *
2803
+ * @returns {void}
2804
+ */
2863
2805
  }, {
2864
- key: "has",
2865
- value: function has(header, matcher) {
2866
- header = normalizeHeader(header);
2867
- if (header) {
2868
- var key = utils$1.findKey(this, header);
2869
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2806
+ key: "clear",
2807
+ value: function clear() {
2808
+ if (this.handlers) {
2809
+ this.handlers = [];
2870
2810
  }
2871
- return false;
2872
2811
  }
2812
+
2813
+ /**
2814
+ * Iterate over all the registered interceptors
2815
+ *
2816
+ * This method is particularly useful for skipping over any
2817
+ * interceptors that may have become `null` calling `eject`.
2818
+ *
2819
+ * @param {Function} fn The function to call for each interceptor
2820
+ *
2821
+ * @returns {void}
2822
+ */
2873
2823
  }, {
2874
- key: "delete",
2875
- value: function _delete(header, matcher) {
2876
- var self = this;
2877
- var deleted = false;
2878
- function deleteHeader(_header) {
2879
- _header = normalizeHeader(_header);
2880
- if (_header) {
2881
- var key = utils$1.findKey(self, _header);
2882
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2883
- delete self[key];
2884
- deleted = true;
2885
- }
2824
+ key: "forEach",
2825
+ value: function forEach(fn) {
2826
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2827
+ if (h !== null) {
2828
+ fn(h);
2886
2829
  }
2830
+ });
2831
+ }
2832
+ }]);
2833
+ }();
2834
+ var InterceptorManager$1 = InterceptorManager;
2835
+
2836
+ var transitionalDefaults = {
2837
+ silentJSONParsing: true,
2838
+ forcedJSONParsing: true,
2839
+ clarifyTimeoutError: false,
2840
+ legacyInterceptorReqResOrdering: true
2841
+ };
2842
+
2843
+ var defineProperty = {exports: {}};
2844
+
2845
+ (function (module) {
2846
+ var toPropertyKey$1 = toPropertyKey.exports;
2847
+ function _defineProperty(e, r, t) {
2848
+ return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
2849
+ value: t,
2850
+ enumerable: !0,
2851
+ configurable: !0,
2852
+ writable: !0
2853
+ }) : e[r] = t, e;
2854
+ }
2855
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
2856
+ })(defineProperty);
2857
+ var _defineProperty = /*@__PURE__*/getDefaultExportFromCjs(defineProperty.exports);
2858
+
2859
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2860
+
2861
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2862
+
2863
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2864
+
2865
+ var platform$1 = {
2866
+ isBrowser: true,
2867
+ classes: {
2868
+ URLSearchParams: URLSearchParams$1,
2869
+ FormData: FormData$1,
2870
+ Blob: Blob$1
2871
+ },
2872
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2873
+ };
2874
+
2875
+ var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2876
+ var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$1(navigator)) === 'object' && navigator || undefined;
2877
+
2878
+ /**
2879
+ * Determine if we're running in a standard browser environment
2880
+ *
2881
+ * This allows axios to run in a web worker, and react-native.
2882
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2883
+ *
2884
+ * web workers:
2885
+ * typeof window -> undefined
2886
+ * typeof document -> undefined
2887
+ *
2888
+ * react-native:
2889
+ * navigator.product -> 'ReactNative'
2890
+ * nativescript
2891
+ * navigator.product -> 'NativeScript' or 'NS'
2892
+ *
2893
+ * @returns {boolean}
2894
+ */
2895
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2896
+
2897
+ /**
2898
+ * Determine if we're running in a standard browser webWorker environment
2899
+ *
2900
+ * Although the `isStandardBrowserEnv` method indicates that
2901
+ * `allows axios to run in a web worker`, the WebWorker will still be
2902
+ * filtered out due to its judgment standard
2903
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2904
+ * This leads to a problem when axios post `FormData` in webWorker
2905
+ */
2906
+ var hasStandardBrowserWebWorkerEnv = function () {
2907
+ return typeof WorkerGlobalScope !== 'undefined' &&
2908
+ // eslint-disable-next-line no-undef
2909
+ self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
2910
+ }();
2911
+ var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2912
+
2913
+ var utils = /*#__PURE__*/Object.freeze({
2914
+ __proto__: null,
2915
+ hasBrowserEnv: hasBrowserEnv,
2916
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2917
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2918
+ navigator: _navigator,
2919
+ origin: origin
2920
+ });
2921
+
2922
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2923
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2924
+ var platform = _objectSpread$4(_objectSpread$4({}, utils), platform$1);
2925
+
2926
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2927
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2928
+ function toURLEncodedForm(data, options) {
2929
+ return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$3({
2930
+ visitor: function visitor(value, key, path, helpers) {
2931
+ if (platform.isNode && utils$1.isBuffer(value)) {
2932
+ this.append(key, value.toString('base64'));
2933
+ return false;
2887
2934
  }
2888
- if (utils$1.isArray(header)) {
2889
- header.forEach(deleteHeader);
2935
+ return helpers.defaultVisitor.apply(this, arguments);
2936
+ }
2937
+ }, options));
2938
+ }
2939
+
2940
+ /**
2941
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2942
+ *
2943
+ * @param {string} name - The name of the property to get.
2944
+ *
2945
+ * @returns An array of strings.
2946
+ */
2947
+ function parsePropPath(name) {
2948
+ // foo[x][y][z]
2949
+ // foo.x.y.z
2950
+ // foo-x-y-z
2951
+ // foo x y z
2952
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2953
+ return match[0] === '[]' ? '' : match[1] || match[0];
2954
+ });
2955
+ }
2956
+
2957
+ /**
2958
+ * Convert an array to an object.
2959
+ *
2960
+ * @param {Array<any>} arr - The array to convert to an object.
2961
+ *
2962
+ * @returns An object with the same keys and values as the array.
2963
+ */
2964
+ function arrayToObject(arr) {
2965
+ var obj = {};
2966
+ var keys = Object.keys(arr);
2967
+ var i;
2968
+ var len = keys.length;
2969
+ var key;
2970
+ for (i = 0; i < len; i++) {
2971
+ key = keys[i];
2972
+ obj[key] = arr[key];
2973
+ }
2974
+ return obj;
2975
+ }
2976
+
2977
+ /**
2978
+ * It takes a FormData object and returns a JavaScript object
2979
+ *
2980
+ * @param {string} formData The FormData object to convert to JSON.
2981
+ *
2982
+ * @returns {Object<string, any> | null} The converted object.
2983
+ */
2984
+ function formDataToJSON(formData) {
2985
+ function buildPath(path, value, target, index) {
2986
+ var name = path[index++];
2987
+ if (name === '__proto__') return true;
2988
+ var isNumericKey = Number.isFinite(+name);
2989
+ var isLast = index >= path.length;
2990
+ name = !name && utils$1.isArray(target) ? target.length : name;
2991
+ if (isLast) {
2992
+ if (utils$1.hasOwnProp(target, name)) {
2993
+ target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
2890
2994
  } else {
2891
- deleteHeader(header);
2995
+ target[name] = value;
2892
2996
  }
2893
- return deleted;
2997
+ return !isNumericKey;
2894
2998
  }
2895
- }, {
2896
- key: "clear",
2897
- value: function clear(matcher) {
2898
- var keys = Object.keys(this);
2899
- var i = keys.length;
2900
- var deleted = false;
2901
- while (i--) {
2902
- var key = keys[i];
2903
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2904
- delete this[key];
2905
- deleted = true;
2906
- }
2907
- }
2908
- return deleted;
2999
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
3000
+ target[name] = [];
2909
3001
  }
2910
- }, {
2911
- key: "normalize",
2912
- value: function normalize(format) {
2913
- var self = this;
2914
- var headers = {};
2915
- utils$1.forEach(this, function (value, header) {
2916
- var key = utils$1.findKey(headers, header);
2917
- if (key) {
2918
- self[key] = normalizeValue(value);
2919
- delete self[header];
2920
- return;
2921
- }
2922
- var normalized = format ? formatHeader(header) : String(header).trim();
2923
- if (normalized !== header) {
2924
- delete self[header];
2925
- }
2926
- self[normalized] = normalizeValue(value);
2927
- headers[normalized] = true;
2928
- });
2929
- return this;
3002
+ var result = buildPath(path, value, target[name], index);
3003
+ if (result && utils$1.isArray(target[name])) {
3004
+ target[name] = arrayToObject(target[name]);
2930
3005
  }
2931
- }, {
2932
- key: "concat",
2933
- value: function concat() {
2934
- var _this$constructor;
2935
- for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
2936
- targets[_key] = arguments[_key];
3006
+ return !isNumericKey;
3007
+ }
3008
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
3009
+ var obj = {};
3010
+ utils$1.forEachEntry(formData, function (name, value) {
3011
+ buildPath(parsePropPath(name), value, obj, 0);
3012
+ });
3013
+ return obj;
3014
+ }
3015
+ return null;
3016
+ }
3017
+
3018
+ var own = function own(obj, key) {
3019
+ return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
3020
+ };
3021
+
3022
+ /**
3023
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
3024
+ * of the input
3025
+ *
3026
+ * @param {any} rawValue - The value to be stringified.
3027
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
3028
+ * @param {Function} encoder - A function that takes a value and returns a string.
3029
+ *
3030
+ * @returns {string} A stringified version of the rawValue.
3031
+ */
3032
+ function stringifySafely(rawValue, parser, encoder) {
3033
+ if (utils$1.isString(rawValue)) {
3034
+ try {
3035
+ (parser || JSON.parse)(rawValue);
3036
+ return utils$1.trim(rawValue);
3037
+ } catch (e) {
3038
+ if (e.name !== 'SyntaxError') {
3039
+ throw e;
2937
3040
  }
2938
- return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2939
- }
2940
- }, {
2941
- key: "toJSON",
2942
- value: function toJSON(asStrings) {
2943
- var obj = Object.create(null);
2944
- utils$1.forEach(this, function (value, header) {
2945
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2946
- });
2947
- return obj;
2948
- }
2949
- }, {
2950
- key: Symbol.iterator,
2951
- value: function value() {
2952
- return Object.entries(this.toJSON())[Symbol.iterator]();
2953
3041
  }
2954
- }, {
2955
- key: "toString",
2956
- value: function toString() {
2957
- return Object.entries(this.toJSON()).map(function (_ref) {
2958
- var _ref2 = _slicedToArray(_ref, 2),
2959
- header = _ref2[0],
2960
- value = _ref2[1];
2961
- return header + ': ' + value;
2962
- }).join('\n');
3042
+ }
3043
+ return (encoder || JSON.stringify)(rawValue);
3044
+ }
3045
+ var defaults = {
3046
+ transitional: transitionalDefaults,
3047
+ adapter: ['xhr', 'http', 'fetch'],
3048
+ transformRequest: [function transformRequest(data, headers) {
3049
+ var contentType = headers.getContentType() || '';
3050
+ var hasJSONContentType = contentType.indexOf('application/json') > -1;
3051
+ var isObjectPayload = utils$1.isObject(data);
3052
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
3053
+ data = new FormData(data);
2963
3054
  }
2964
- }, {
2965
- key: "getSetCookie",
2966
- value: function getSetCookie() {
2967
- return this.get('set-cookie') || [];
3055
+ var isFormData = utils$1.isFormData(data);
3056
+ if (isFormData) {
3057
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2968
3058
  }
2969
- }, {
2970
- key: Symbol.toStringTag,
2971
- get: function get() {
2972
- return 'AxiosHeaders';
3059
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
3060
+ return data;
2973
3061
  }
2974
- }], [{
2975
- key: "from",
2976
- value: function from(thing) {
2977
- return thing instanceof this ? thing : new this(thing);
3062
+ if (utils$1.isArrayBufferView(data)) {
3063
+ return data.buffer;
2978
3064
  }
2979
- }, {
2980
- key: "concat",
2981
- value: function concat(first) {
2982
- var computed = new this(first);
2983
- for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2984
- targets[_key2 - 1] = arguments[_key2];
3065
+ if (utils$1.isURLSearchParams(data)) {
3066
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
3067
+ return data.toString();
3068
+ }
3069
+ var isFileList;
3070
+ if (isObjectPayload) {
3071
+ var formSerializer = own(this, 'formSerializer');
3072
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
3073
+ return toURLEncodedForm(data, formSerializer).toString();
3074
+ }
3075
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
3076
+ var env = own(this, 'env');
3077
+ var _FormData = env && env.FormData;
3078
+ return toFormData(isFileList ? {
3079
+ 'files[]': data
3080
+ } : data, _FormData && new _FormData(), formSerializer);
2985
3081
  }
2986
- targets.forEach(function (target) {
2987
- return computed.set(target);
2988
- });
2989
- return computed;
2990
3082
  }
2991
- }, {
2992
- key: "accessor",
2993
- value: function accessor(header) {
2994
- var internals = this[$internals] = this[$internals] = {
2995
- accessors: {}
2996
- };
2997
- var accessors = internals.accessors;
2998
- var prototype = this.prototype;
2999
- function defineAccessor(_header) {
3000
- var lHeader = normalizeHeader(_header);
3001
- if (!accessors[lHeader]) {
3002
- buildAccessors(prototype, _header);
3003
- accessors[lHeader] = true;
3083
+ if (isObjectPayload || hasJSONContentType) {
3084
+ headers.setContentType('application/json', false);
3085
+ return stringifySafely(data);
3086
+ }
3087
+ return data;
3088
+ }],
3089
+ transformResponse: [function transformResponse(data) {
3090
+ var transitional = own(this, 'transitional') || defaults.transitional;
3091
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
3092
+ var responseType = own(this, 'responseType');
3093
+ var JSONRequested = responseType === 'json';
3094
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
3095
+ return data;
3096
+ }
3097
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
3098
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
3099
+ var strictJSONParsing = !silentJSONParsing && JSONRequested;
3100
+ try {
3101
+ return JSON.parse(data, own(this, 'parseReviver'));
3102
+ } catch (e) {
3103
+ if (strictJSONParsing) {
3104
+ if (e.name === 'SyntaxError') {
3105
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
3106
+ }
3107
+ throw e;
3004
3108
  }
3005
3109
  }
3006
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
3007
- return this;
3008
3110
  }
3009
- }]);
3010
- }();
3011
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
3012
-
3013
- // reserved names hotfix
3014
- utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
3015
- var value = _ref3.value;
3016
- var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
3017
- return {
3018
- get: function get() {
3019
- return value;
3020
- },
3021
- set: function set(headerValue) {
3022
- this[mapped] = headerValue;
3111
+ return data;
3112
+ }],
3113
+ /**
3114
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
3115
+ * timeout is not created.
3116
+ */
3117
+ timeout: 0,
3118
+ xsrfCookieName: 'XSRF-TOKEN',
3119
+ xsrfHeaderName: 'X-XSRF-TOKEN',
3120
+ maxContentLength: -1,
3121
+ maxBodyLength: -1,
3122
+ env: {
3123
+ FormData: platform.classes.FormData,
3124
+ Blob: platform.classes.Blob
3125
+ },
3126
+ validateStatus: function validateStatus(status) {
3127
+ return status >= 200 && status < 300;
3128
+ },
3129
+ headers: {
3130
+ common: {
3131
+ Accept: 'application/json, text/plain, */*',
3132
+ 'Content-Type': undefined
3023
3133
  }
3024
- };
3134
+ }
3135
+ };
3136
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
3137
+ defaults.headers[method] = {};
3025
3138
  });
3026
- utils$1.freezeMethods(AxiosHeaders);
3027
- var AxiosHeaders$1 = AxiosHeaders;
3139
+ var defaults$1 = defaults;
3028
3140
 
3029
3141
  /**
3030
3142
  * Transform the data for a request or a response
@@ -3089,12 +3201,12 @@
3089
3201
  if (!response.status || !validateStatus || validateStatus(response.status)) {
3090
3202
  resolve(response);
3091
3203
  } else {
3092
- reject(new AxiosError$1('Request failed with status code ' + response.status, [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
3204
+ reject(new AxiosError$1('Request failed with status code ' + response.status, response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE, response.config, response.request, response));
3093
3205
  }
3094
3206
  }
3095
3207
 
3096
3208
  function parseProtocol(url) {
3097
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3209
+ var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
3098
3210
  return match && match[1] || '';
3099
3211
  }
3100
3212
 
@@ -3188,6 +3300,9 @@
3188
3300
  var bytesNotified = 0;
3189
3301
  var _speedometer = speedometer(50, 250);
3190
3302
  return throttle(function (e) {
3303
+ if (!e || typeof e.loaded !== 'number') {
3304
+ return;
3305
+ }
3191
3306
  var rawLoaded = e.loaded;
3192
3307
  var total = e.lengthComputable ? e.total : undefined;
3193
3308
  var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -3262,8 +3377,20 @@
3262
3377
  },
3263
3378
  read: function read(name) {
3264
3379
  if (typeof document === 'undefined') return null;
3265
- var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
3266
- return match ? decodeURIComponent(match[1]) : null;
3380
+ // Match name=value by splitting on the semicolon separator instead of building a
3381
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
3382
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3383
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3384
+ // "; ", so ignore optional whitespace before each cookie name.
3385
+ var cookies = document.cookie.split(';');
3386
+ for (var i = 0; i < cookies.length; i++) {
3387
+ var cookie = cookies[i].replace(/^\s+/, '');
3388
+ var eq = cookie.indexOf('=');
3389
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
3390
+ return decodeURIComponent(cookie.slice(eq + 1));
3391
+ }
3392
+ }
3393
+ return null;
3267
3394
  },
3268
3395
  remove: function remove(name) {
3269
3396
  this.write(name, '', Date.now() - 86400000, '/');
@@ -3345,11 +3472,14 @@
3345
3472
  config2 = config2 || {};
3346
3473
 
3347
3474
  // Use a null-prototype object so that downstream reads such as `config.auth`
3348
- // or `config.baseURL` cannot inherit polluted values from Object.prototype
3349
- // (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
3350
- // own slot to preserve ergonomics for user code that relies on it.
3475
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
3476
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
3477
+ // ergonomics for user code that relies on it.
3351
3478
  var config = Object.create(null);
3352
3479
  Object.defineProperty(config, 'hasOwnProperty', {
3480
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
3481
+ // this data descriptor into an accessor descriptor on the way in.
3482
+ __proto__: null,
3353
3483
  value: Object.prototype.hasOwnProperty,
3354
3484
  enumerable: false,
3355
3485
  writable: true,
@@ -3444,11 +3574,40 @@
3444
3574
  return config;
3445
3575
  }
3446
3576
 
3577
+ var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
3578
+ function setFormDataHeaders(headers, formHeaders, policy) {
3579
+ if (policy !== 'content-only') {
3580
+ headers.set(formHeaders);
3581
+ return;
3582
+ }
3583
+ Object.entries(formHeaders).forEach(function (_ref) {
3584
+ var _ref2 = _slicedToArray(_ref, 2),
3585
+ key = _ref2[0],
3586
+ val = _ref2[1];
3587
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
3588
+ headers.set(key, val);
3589
+ }
3590
+ });
3591
+ }
3592
+
3593
+ /**
3594
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3595
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3596
+ *
3597
+ * @param {string} str The string to encode
3598
+ *
3599
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3600
+ */
3601
+ var encodeUTF8 = function encodeUTF8(str) {
3602
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3603
+ return String.fromCharCode(parseInt(hex, 16));
3604
+ });
3605
+ };
3447
3606
  var resolveConfig = (function (config) {
3448
3607
  var newConfig = mergeConfig({}, config);
3449
3608
 
3450
3609
  // Read only own properties to prevent prototype pollution gadgets
3451
- // (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
3610
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
3452
3611
  var own = function own(key) {
3453
3612
  return utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
3454
3613
  };
@@ -3466,24 +3625,14 @@
3466
3625
 
3467
3626
  // HTTP basic authentication
3468
3627
  if (auth) {
3469
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3628
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
3470
3629
  }
3471
3630
  if (utils$1.isFormData(data)) {
3472
3631
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3473
3632
  headers.setContentType(undefined); // browser handles it
3474
3633
  } else if (utils$1.isFunction(data.getHeaders)) {
3475
3634
  // Node.js FormData (like form-data package)
3476
- var formHeaders = data.getHeaders();
3477
- // Only set safe headers to avoid overwriting security headers
3478
- var allowedHeaders = ['content-type', 'content-length'];
3479
- Object.entries(formHeaders).forEach(function (_ref) {
3480
- var _ref2 = _slicedToArray(_ref, 2),
3481
- key = _ref2[0],
3482
- val = _ref2[1];
3483
- if (allowedHeaders.includes(key.toLowerCase())) {
3484
- headers.set(key, val);
3485
- }
3486
- });
3635
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3487
3636
  }
3488
3637
  }
3489
3638
 
@@ -3498,7 +3647,7 @@
3498
3647
 
3499
3648
  // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
3500
3649
  // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
3501
- // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
3650
+ // the XSRF token cross-origin.
3502
3651
  var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
3503
3652
  if (shouldSendXSRF) {
3504
3653
  var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
@@ -3574,7 +3723,7 @@
3574
3723
  // handled by onerror instead
3575
3724
  // With one exception: request that using file: protocol, most browsers
3576
3725
  // will return status as 0 even though it's a successful request
3577
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3726
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
3578
3727
  return;
3579
3728
  }
3580
3729
  // readystate handler is calling before onerror or ontimeout handlers,
@@ -3589,6 +3738,7 @@
3589
3738
  return;
3590
3739
  }
3591
3740
  reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
3741
+ done();
3592
3742
 
3593
3743
  // Clean up request
3594
3744
  request = null;
@@ -3604,6 +3754,7 @@
3604
3754
  // attach the underlying event for consumers who want details
3605
3755
  err.event = event || null;
3606
3756
  reject(err);
3757
+ done();
3607
3758
  request = null;
3608
3759
  };
3609
3760
 
@@ -3615,6 +3766,7 @@
3615
3766
  timeoutErrorMessage = _config.timeoutErrorMessage;
3616
3767
  }
3617
3768
  reject(new AxiosError$1(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, config, request));
3769
+ done();
3618
3770
 
3619
3771
  // Clean up request
3620
3772
  request = null;
@@ -3625,7 +3777,7 @@
3625
3777
 
3626
3778
  // Add headers to the request
3627
3779
  if ('setRequestHeader' in request) {
3628
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3780
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3629
3781
  request.setRequestHeader(key, val);
3630
3782
  });
3631
3783
  }
@@ -3667,6 +3819,7 @@
3667
3819
  }
3668
3820
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
3669
3821
  request.abort();
3822
+ done();
3670
3823
  request = null;
3671
3824
  };
3672
3825
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -3675,7 +3828,7 @@
3675
3828
  }
3676
3829
  }
3677
3830
  var protocol = parseProtocol(_config.url);
3678
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3831
+ if (protocol && !platform.protocols.includes(protocol)) {
3679
3832
  reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
3680
3833
  return;
3681
3834
  }
@@ -3686,42 +3839,43 @@
3686
3839
  };
3687
3840
 
3688
3841
  var composeSignals = function composeSignals(signals, timeout) {
3689
- var _signals = signals = signals ? signals.filter(Boolean) : [],
3690
- length = _signals.length;
3691
- if (timeout || length) {
3692
- var controller = new AbortController();
3693
- var aborted;
3694
- var onabort = function onabort(reason) {
3695
- if (!aborted) {
3696
- aborted = true;
3697
- unsubscribe();
3698
- var err = reason instanceof Error ? reason : this.reason;
3699
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
3700
- }
3701
- };
3702
- var timer = timeout && setTimeout(function () {
3703
- timer = null;
3704
- onabort(new AxiosError$1("timeout of ".concat(timeout, "ms exceeded"), AxiosError$1.ETIMEDOUT));
3705
- }, timeout);
3706
- var unsubscribe = function unsubscribe() {
3707
- if (signals) {
3708
- timer && clearTimeout(timer);
3709
- timer = null;
3710
- signals.forEach(function (signal) {
3711
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3712
- });
3713
- signals = null;
3714
- }
3715
- };
3842
+ signals = signals ? signals.filter(Boolean) : [];
3843
+ if (!timeout && !signals.length) {
3844
+ return;
3845
+ }
3846
+ var controller = new AbortController();
3847
+ var aborted = false;
3848
+ var onabort = function onabort(reason) {
3849
+ if (!aborted) {
3850
+ aborted = true;
3851
+ unsubscribe();
3852
+ var err = reason instanceof Error ? reason : this.reason;
3853
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
3854
+ }
3855
+ };
3856
+ var timer = timeout && setTimeout(function () {
3857
+ timer = null;
3858
+ onabort(new AxiosError$1("timeout of ".concat(timeout, "ms exceeded"), AxiosError$1.ETIMEDOUT));
3859
+ }, timeout);
3860
+ var unsubscribe = function unsubscribe() {
3861
+ if (!signals) {
3862
+ return;
3863
+ }
3864
+ timer && clearTimeout(timer);
3865
+ timer = null;
3716
3866
  signals.forEach(function (signal) {
3717
- return signal.addEventListener('abort', onabort);
3867
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3718
3868
  });
3719
- var signal = controller.signal;
3720
- signal.unsubscribe = function () {
3721
- return utils$1.asap(unsubscribe);
3722
- };
3723
- return signal;
3724
- }
3869
+ signals = null;
3870
+ };
3871
+ signals.forEach(function (signal) {
3872
+ return signal.addEventListener('abort', onabort);
3873
+ });
3874
+ var signal = controller.signal;
3875
+ signal.unsubscribe = function () {
3876
+ return utils$1.asap(unsubscribe);
3877
+ };
3878
+ return signal;
3725
3879
  };
3726
3880
  var composeSignals$1 = composeSignals;
3727
3881
 
@@ -4059,21 +4213,104 @@
4059
4213
  });
4060
4214
  };
4061
4215
 
4216
+ /**
4217
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
4218
+ * - For base64: compute exact decoded size using length and padding;
4219
+ * handle %XX at the character-count level (no string allocation).
4220
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
4221
+ *
4222
+ * @param {string} url
4223
+ * @returns {number}
4224
+ */
4225
+ function estimateDataURLDecodedBytes(url) {
4226
+ if (!url || typeof url !== 'string') return 0;
4227
+ if (!url.startsWith('data:')) return 0;
4228
+ var comma = url.indexOf(',');
4229
+ if (comma < 0) return 0;
4230
+ var meta = url.slice(5, comma);
4231
+ var body = url.slice(comma + 1);
4232
+ var isBase64 = /;base64/i.test(meta);
4233
+ if (isBase64) {
4234
+ var effectiveLen = body.length;
4235
+ var len = body.length; // cache length
4236
+
4237
+ for (var i = 0; i < len; i++) {
4238
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
4239
+ var a = body.charCodeAt(i + 1);
4240
+ var b = body.charCodeAt(i + 2);
4241
+ var isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
4242
+ if (isHex) {
4243
+ effectiveLen -= 2;
4244
+ i += 2;
4245
+ }
4246
+ }
4247
+ }
4248
+ var pad = 0;
4249
+ var idx = len - 1;
4250
+ var tailIsPct3D = function tailIsPct3D(j) {
4251
+ return j >= 2 && body.charCodeAt(j - 2) === 37 &&
4252
+ // '%'
4253
+ body.charCodeAt(j - 1) === 51 && (
4254
+ // '3'
4255
+ body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
4256
+ }; // 'D' or 'd'
4257
+
4258
+ if (idx >= 0) {
4259
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
4260
+ pad++;
4261
+ idx--;
4262
+ } else if (tailIsPct3D(idx)) {
4263
+ pad++;
4264
+ idx -= 3;
4265
+ }
4266
+ }
4267
+ if (pad === 1 && idx >= 0) {
4268
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
4269
+ pad++;
4270
+ } else if (tailIsPct3D(idx)) {
4271
+ pad++;
4272
+ }
4273
+ }
4274
+ var groups = Math.floor(effectiveLen / 4);
4275
+ var _bytes = groups * 3 - (pad || 0);
4276
+ return _bytes > 0 ? _bytes : 0;
4277
+ }
4278
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
4279
+ return Buffer.byteLength(body, 'utf8');
4280
+ }
4281
+
4282
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
4283
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
4284
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
4285
+ // but 3 UTF-8 bytes).
4286
+ var bytes = 0;
4287
+ for (var _i = 0, _len = body.length; _i < _len; _i++) {
4288
+ var c = body.charCodeAt(_i);
4289
+ if (c < 0x80) {
4290
+ bytes += 1;
4291
+ } else if (c < 0x800) {
4292
+ bytes += 2;
4293
+ } else if (c >= 0xd800 && c <= 0xdbff && _i + 1 < _len) {
4294
+ var next = body.charCodeAt(_i + 1);
4295
+ if (next >= 0xdc00 && next <= 0xdfff) {
4296
+ bytes += 4;
4297
+ _i++;
4298
+ } else {
4299
+ bytes += 3;
4300
+ }
4301
+ } else {
4302
+ bytes += 3;
4303
+ }
4304
+ }
4305
+ return bytes;
4306
+ }
4307
+
4308
+ var VERSION = "1.16.1";
4309
+
4062
4310
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4063
4311
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4064
4312
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
4065
4313
  var isFunction = utils$1.isFunction;
4066
- var globalFetchAPI = function (_ref) {
4067
- var Request = _ref.Request,
4068
- Response = _ref.Response;
4069
- return {
4070
- Request: Request,
4071
- Response: Response
4072
- };
4073
- }(utils$1.global);
4074
- var _utils$global = utils$1.global,
4075
- ReadableStream$1 = _utils$global.ReadableStream,
4076
- TextEncoder = _utils$global.TextEncoder;
4077
4314
  var test = function test(fn) {
4078
4315
  try {
4079
4316
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -4085,9 +4322,15 @@
4085
4322
  }
4086
4323
  };
4087
4324
  var factory = function factory(env) {
4325
+ var globalObject = utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
4326
+ var ReadableStream = globalObject.ReadableStream,
4327
+ TextEncoder = globalObject.TextEncoder;
4088
4328
  env = utils$1.merge.call({
4089
4329
  skipUndefined: true
4090
- }, globalFetchAPI, env);
4330
+ }, {
4331
+ Request: globalObject.Request,
4332
+ Response: globalObject.Response
4333
+ }, env);
4091
4334
  var _env = env,
4092
4335
  envFetch = _env.fetch,
4093
4336
  Request = _env.Request,
@@ -4098,13 +4341,13 @@
4098
4341
  if (!isFetchSupported) {
4099
4342
  return false;
4100
4343
  }
4101
- var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
4344
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
4102
4345
  var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
4103
4346
  return function (str) {
4104
4347
  return encoder.encode(str);
4105
4348
  };
4106
4349
  }(new TextEncoder()) : (/*#__PURE__*/function () {
4107
- var _ref2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(str) {
4350
+ var _ref = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(str) {
4108
4351
  var _t, _t2;
4109
4352
  return regenerator.wrap(function (_context) {
4110
4353
  while (1) switch (_context.prev = _context.next) {
@@ -4122,13 +4365,13 @@
4122
4365
  }, _callee);
4123
4366
  }));
4124
4367
  return function (_x) {
4125
- return _ref2.apply(this, arguments);
4368
+ return _ref.apply(this, arguments);
4126
4369
  };
4127
4370
  }()));
4128
4371
  var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
4129
4372
  var duplexAccessed = false;
4130
4373
  var request = new Request(platform.origin, {
4131
- body: new ReadableStream$1(),
4374
+ body: new ReadableStream(),
4132
4375
  method: 'POST',
4133
4376
  get duplex() {
4134
4377
  duplexAccessed = true;
@@ -4161,7 +4404,7 @@
4161
4404
  });
4162
4405
  }();
4163
4406
  var getBodyLength = /*#__PURE__*/function () {
4164
- var _ref3 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(body) {
4407
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(body) {
4165
4408
  var _request;
4166
4409
  return regenerator.wrap(function (_context2) {
4167
4410
  while (1) switch (_context2.prev = _context2.next) {
@@ -4215,11 +4458,11 @@
4215
4458
  }, _callee2);
4216
4459
  }));
4217
4460
  return function getBodyLength(_x2) {
4218
- return _ref3.apply(this, arguments);
4461
+ return _ref2.apply(this, arguments);
4219
4462
  };
4220
4463
  }();
4221
4464
  var resolveBodyLength = /*#__PURE__*/function () {
4222
- var _ref4 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3(headers, body) {
4465
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3(headers, body) {
4223
4466
  var length;
4224
4467
  return regenerator.wrap(function (_context3) {
4225
4468
  while (1) switch (_context3.prev = _context3.next) {
@@ -4233,16 +4476,18 @@
4233
4476
  }, _callee3);
4234
4477
  }));
4235
4478
  return function resolveBodyLength(_x3, _x4) {
4236
- return _ref4.apply(this, arguments);
4479
+ return _ref3.apply(this, arguments);
4237
4480
  };
4238
4481
  }();
4239
4482
  return /*#__PURE__*/function () {
4240
- var _ref5 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4(config) {
4241
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _fetch, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, isStreamResponse, options, responseContentLength, _ref6, _ref7, _onProgress, _flush, responseData, _t3, _t4, _t5;
4483
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4(config) {
4484
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, _fetch, composedSignal, request, unsubscribe, requestContentLength, estimated, outboundLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, declaredLength, isStreamResponse, options, responseContentLength, _ref5, _ref6, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4, _t5;
4242
4485
  return regenerator.wrap(function (_context4) {
4243
4486
  while (1) switch (_context4.prev = _context4.next) {
4244
4487
  case 0:
4245
- _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
4488
+ _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
4489
+ hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
4490
+ hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
4246
4491
  _fetch = envFetch || fetch;
4247
4492
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
4248
4493
  composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
@@ -4251,19 +4496,44 @@
4251
4496
  composedSignal.unsubscribe();
4252
4497
  };
4253
4498
  _context4.prev = 1;
4499
+ if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
4500
+ _context4.next = 2;
4501
+ break;
4502
+ }
4503
+ estimated = estimateDataURLDecodedBytes(url);
4504
+ if (!(estimated > maxContentLength)) {
4505
+ _context4.next = 2;
4506
+ break;
4507
+ }
4508
+ throw new AxiosError$1('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError$1.ERR_BAD_RESPONSE, config, request);
4509
+ case 2:
4510
+ if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
4511
+ _context4.next = 4;
4512
+ break;
4513
+ }
4514
+ _context4.next = 3;
4515
+ return resolveBodyLength(headers, data);
4516
+ case 3:
4517
+ outboundLength = _context4.sent;
4518
+ if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
4519
+ _context4.next = 4;
4520
+ break;
4521
+ }
4522
+ throw new AxiosError$1('Request body larger than maxBodyLength limit', AxiosError$1.ERR_BAD_REQUEST, config, request);
4523
+ case 4:
4254
4524
  _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
4255
4525
  if (!_t3) {
4256
- _context4.next = 3;
4526
+ _context4.next = 6;
4257
4527
  break;
4258
4528
  }
4259
- _context4.next = 2;
4529
+ _context4.next = 5;
4260
4530
  return resolveBodyLength(headers, data);
4261
- case 2:
4531
+ case 5:
4262
4532
  _t4 = requestContentLength = _context4.sent;
4263
4533
  _t3 = _t4 !== 0;
4264
- case 3:
4534
+ case 6:
4265
4535
  if (!_t3) {
4266
- _context4.next = 4;
4536
+ _context4.next = 7;
4267
4537
  break;
4268
4538
  }
4269
4539
  _request = new Request(url, {
@@ -4278,7 +4548,7 @@
4278
4548
  _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
4279
4549
  data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
4280
4550
  }
4281
- case 4:
4551
+ case 7:
4282
4552
  if (!utils$1.isString(withCredentials)) {
4283
4553
  withCredentials = withCredentials ? 'include' : 'omit';
4284
4554
  }
@@ -4293,39 +4563,82 @@
4293
4563
  headers.delete('content-type');
4294
4564
  }
4295
4565
  }
4566
+
4567
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
4568
+ headers.set('User-Agent', 'axios/' + VERSION, false);
4296
4569
  resolvedOptions = _objectSpread$1(_objectSpread$1({}, fetchOptions), {}, {
4297
4570
  signal: composedSignal,
4298
4571
  method: method.toUpperCase(),
4299
- headers: headers.normalize().toJSON(),
4572
+ headers: toByteStringHeaderObject(headers.normalize()),
4300
4573
  body: data,
4301
4574
  duplex: 'half',
4302
4575
  credentials: isCredentialsSupported ? withCredentials : undefined
4303
4576
  });
4304
4577
  request = isRequestSupported && new Request(url, resolvedOptions);
4305
- _context4.next = 5;
4578
+ _context4.next = 8;
4306
4579
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
4307
- case 5:
4580
+ case 8:
4308
4581
  response = _context4.sent;
4582
+ if (!hasMaxContentLength) {
4583
+ _context4.next = 9;
4584
+ break;
4585
+ }
4586
+ declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4587
+ if (!(declaredLength != null && declaredLength > maxContentLength)) {
4588
+ _context4.next = 9;
4589
+ break;
4590
+ }
4591
+ throw new AxiosError$1('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError$1.ERR_BAD_RESPONSE, config, request);
4592
+ case 9:
4309
4593
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
4310
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
4594
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
4311
4595
  options = {};
4312
4596
  ['status', 'statusText', 'headers'].forEach(function (prop) {
4313
4597
  options[prop] = response[prop];
4314
4598
  });
4315
4599
  responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4316
- _ref6 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref7 = _slicedToArray(_ref6, 2), _onProgress = _ref7[0], _flush = _ref7[1];
4317
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
4600
+ _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
4601
+ bytesRead = 0;
4602
+ onChunkProgress = function onChunkProgress(loadedBytes) {
4603
+ if (hasMaxContentLength) {
4604
+ bytesRead = loadedBytes;
4605
+ if (bytesRead > maxContentLength) {
4606
+ throw new AxiosError$1('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError$1.ERR_BAD_RESPONSE, config, request);
4607
+ }
4608
+ }
4609
+ _onProgress && _onProgress(loadedBytes);
4610
+ };
4611
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, function () {
4318
4612
  _flush && _flush();
4319
4613
  unsubscribe && unsubscribe();
4320
4614
  }), options);
4321
4615
  }
4322
4616
  responseType = responseType || 'text';
4323
- _context4.next = 6;
4617
+ _context4.next = 10;
4324
4618
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
4325
- case 6:
4619
+ case 10:
4326
4620
  responseData = _context4.sent;
4621
+ if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
4622
+ _context4.next = 11;
4623
+ break;
4624
+ }
4625
+ if (responseData != null) {
4626
+ if (typeof responseData.byteLength === 'number') {
4627
+ materializedSize = responseData.byteLength;
4628
+ } else if (typeof responseData.size === 'number') {
4629
+ materializedSize = responseData.size;
4630
+ } else if (typeof responseData === 'string') {
4631
+ materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
4632
+ }
4633
+ }
4634
+ if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
4635
+ _context4.next = 11;
4636
+ break;
4637
+ }
4638
+ throw new AxiosError$1('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError$1.ERR_BAD_RESPONSE, config, request);
4639
+ case 11:
4327
4640
  !isStreamResponse && unsubscribe && unsubscribe();
4328
- _context4.next = 7;
4641
+ _context4.next = 12;
4329
4642
  return new Promise(function (resolve, reject) {
4330
4643
  settle(resolve, reject, {
4331
4644
  data: responseData,
@@ -4336,29 +4649,43 @@
4336
4649
  request: request
4337
4650
  });
4338
4651
  });
4339
- case 7:
4652
+ case 12:
4340
4653
  return _context4.abrupt("return", _context4.sent);
4341
- case 8:
4342
- _context4.prev = 8;
4654
+ case 13:
4655
+ _context4.prev = 13;
4343
4656
  _t5 = _context4["catch"](1);
4344
4657
  unsubscribe && unsubscribe();
4658
+
4659
+ // Safari can surface fetch aborts as a DOMException-like object whose
4660
+ // branded getters throw. Prefer our composed signal reason before reading
4661
+ // the caught error, preserving timeout vs cancellation semantics.
4662
+ if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1)) {
4663
+ _context4.next = 14;
4664
+ break;
4665
+ }
4666
+ canceledError = composedSignal.reason;
4667
+ canceledError.config = config;
4668
+ request && (canceledError.request = request);
4669
+ _t5 !== canceledError && (canceledError.cause = _t5);
4670
+ throw canceledError;
4671
+ case 14:
4345
4672
  if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
4346
- _context4.next = 9;
4673
+ _context4.next = 15;
4347
4674
  break;
4348
4675
  }
4349
4676
  throw Object.assign(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, _t5 && _t5.response), {
4350
4677
  cause: _t5.cause || _t5
4351
4678
  });
4352
- case 9:
4679
+ case 15:
4353
4680
  throw AxiosError$1.from(_t5, _t5 && _t5.code, config, request, _t5 && _t5.response);
4354
- case 10:
4681
+ case 16:
4355
4682
  case "end":
4356
4683
  return _context4.stop();
4357
4684
  }
4358
- }, _callee4, null, [[1, 8]]);
4685
+ }, _callee4, null, [[1, 13]]);
4359
4686
  }));
4360
4687
  return function (_x5) {
4361
- return _ref5.apply(this, arguments);
4688
+ return _ref4.apply(this, arguments);
4362
4689
  };
4363
4690
  }();
4364
4691
  };
@@ -4405,13 +4732,17 @@
4405
4732
  utils$1.forEach(knownAdapters, function (fn, value) {
4406
4733
  if (fn) {
4407
4734
  try {
4735
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
4736
+ // these data descriptors into accessor descriptors on the way in.
4408
4737
  Object.defineProperty(fn, 'name', {
4738
+ __proto__: null,
4409
4739
  value: value
4410
4740
  });
4411
4741
  } catch (e) {
4412
4742
  // eslint-disable-next-line no-empty
4413
4743
  }
4414
4744
  Object.defineProperty(fn, 'adapterName', {
4745
+ __proto__: null,
4415
4746
  value: value
4416
4747
  });
4417
4748
  }
@@ -4534,8 +4865,15 @@
4534
4865
  return adapter(config).then(function onAdapterResolution(response) {
4535
4866
  throwIfCancellationRequested(config);
4536
4867
 
4537
- // Transform response data
4538
- response.data = transformData.call(config, config.transformResponse, response);
4868
+ // Expose the current response on config so that transformResponse can
4869
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
4870
+ // We clean it up afterwards to avoid polluting the config object.
4871
+ config.response = response;
4872
+ try {
4873
+ response.data = transformData.call(config, config.transformResponse, response);
4874
+ } finally {
4875
+ delete config.response;
4876
+ }
4539
4877
  response.headers = AxiosHeaders$1.from(response.headers);
4540
4878
  return response;
4541
4879
  }, function onAdapterRejection(reason) {
@@ -4544,7 +4882,12 @@
4544
4882
 
4545
4883
  // Transform response data
4546
4884
  if (reason && reason.response) {
4547
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4885
+ config.response = reason.response;
4886
+ try {
4887
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4888
+ } finally {
4889
+ delete config.response;
4890
+ }
4548
4891
  reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4549
4892
  }
4550
4893
  }
@@ -4552,8 +4895,6 @@
4552
4895
  });
4553
4896
  }
4554
4897
 
4555
- var VERSION = "1.15.2";
4556
-
4557
4898
  var validators$1 = {};
4558
4899
 
4559
4900
  // eslint-disable-next-line func-names
@@ -4618,7 +4959,7 @@
4618
4959
  while (i-- > 0) {
4619
4960
  var opt = keys[i];
4620
4961
  // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4621
- // a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
4962
+ // a non-function validator and cause a TypeError.
4622
4963
  var validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
4623
4964
  if (validator) {
4624
4965
  var value = options[opt];
@@ -4774,7 +5115,7 @@
4774
5115
 
4775
5116
  // Flatten headers
4776
5117
  var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4777
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
5118
+ headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
4778
5119
  delete headers[method];
4779
5120
  });
4780
5121
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
@@ -4856,7 +5197,7 @@
4856
5197
  }));
4857
5198
  };
4858
5199
  });
4859
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
5200
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4860
5201
  function generateHTTPMethod(isForm) {
4861
5202
  return function httpMethod(url, data, config) {
4862
5203
  return this.request(mergeConfig(config || {}, {
@@ -4870,7 +5211,12 @@
4870
5211
  };
4871
5212
  }
4872
5213
  Axios.prototype[method] = generateHTTPMethod();
4873
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
5214
+
5215
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
5216
+ // its semantics, so no queryForm shorthand is generated.
5217
+ if (method !== 'query') {
5218
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
5219
+ }
4874
5220
  });
4875
5221
  var Axios$1 = Axios;
4876
5222
 
@@ -5208,6 +5554,7 @@
5208
5554
  axios$1.formToJSON;
5209
5555
  axios$1.getAdapter;
5210
5556
  axios$1.mergeConfig;
5557
+ axios$1.create;
5211
5558
 
5212
5559
  var js_cookie = {exports: {}};
5213
5560