@nsshunt/stsutils 1.19.32 → 1.19.34

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.
@@ -1,5 +1,5 @@
1
- (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("ajv/dist/jtd.js")) : typeof define === "function" && define.amd ? define(["exports", "ajv/dist/jtd.js"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nsshunt/stsutils"] = {}, global2.Ajv));
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("ajv/dist/jtd.js")) : typeof define === "function" && define.amd ? define(["exports", "ajv/dist/jtd.js"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsutils"] = {}, global.Ajv));
3
3
  })(this, function(exports2, Ajv) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __typeError = (msg) => {
@@ -1202,7 +1202,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1202
1202
  ["e", "\x1B"],
1203
1203
  ["a", "\x07"]
1204
1204
  ]);
1205
- function unescape2(c) {
1205
+ function unescape(c) {
1206
1206
  const u = c[0] === "u";
1207
1207
  const bracket = c[1] === "{";
1208
1208
  if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
@@ -1222,7 +1222,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1222
1222
  if (!Number.isNaN(number)) {
1223
1223
  results.push(number);
1224
1224
  } else if (matches = chunk.match(STRING_REGEX)) {
1225
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape2(escape) : character));
1225
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1226
1226
  } else {
1227
1227
  throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1228
1228
  }
@@ -1269,7 +1269,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1269
1269
  let chunk = [];
1270
1270
  temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1271
1271
  if (escapeCharacter) {
1272
- chunk.push(unescape2(escapeCharacter));
1272
+ chunk.push(unescape(escapeCharacter));
1273
1273
  } else if (style) {
1274
1274
  const string = chunk.join("");
1275
1275
  chunk = [];
@@ -1306,7 +1306,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1306
1306
  stringReplaceAll,
1307
1307
  stringEncaseCRLFWithFirstIndex
1308
1308
  } = requireUtil();
1309
- const { isArray: isArray2 } = Array;
1309
+ const { isArray } = Array;
1310
1310
  const levelMapping = [
1311
1311
  "ansi",
1312
1312
  "ansi",
@@ -1414,7 +1414,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1414
1414
  };
1415
1415
  const createBuilder = (self2, _styler, _isEmpty) => {
1416
1416
  const builder = (...arguments_) => {
1417
- if (isArray2(arguments_[0]) && isArray2(arguments_[0].raw)) {
1417
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
1418
1418
  return applyStyle(builder, chalkTag(builder, ...arguments_));
1419
1419
  }
1420
1420
  return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
@@ -1449,7 +1449,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1449
1449
  let template;
1450
1450
  const chalkTag = (chalk3, ...strings) => {
1451
1451
  const [firstString] = strings;
1452
- if (!isArray2(firstString) || !isArray2(firstString.raw)) {
1452
+ if (!isArray(firstString) || !isArray(firstString.raw)) {
1453
1453
  return strings.join(" ");
1454
1454
  }
1455
1455
  const arguments_ = strings.slice(1);
@@ -1538,10 +1538,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1538
1538
  };
1539
1539
  }
1540
1540
  const ajv = new Ajv();
1541
- const _Validate = (validator2, payload) => {
1542
- const valid = validator2(payload);
1541
+ const _Validate = (validator, payload) => {
1542
+ const valid = validator(payload);
1543
1543
  if (!valid) {
1544
- return validator2.errors;
1544
+ return validator.errors;
1545
1545
  } else {
1546
1546
  return null;
1547
1547
  }
@@ -1550,9 +1550,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1550
1550
  ajv.addSchema(schema, name);
1551
1551
  }
1552
1552
  function Validate(name, payload) {
1553
- const validator2 = ajv.getSchema(name);
1554
- if (validator2) {
1555
- return _Validate(validator2, payload);
1553
+ const validator = ajv.getSchema(name);
1554
+ if (validator) {
1555
+ return _Validate(validator, payload);
1556
1556
  }
1557
1557
  }
1558
1558
  class STSOptionsBase {
@@ -1688,11 +1688,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1688
1688
  __privateSet(this, _timeout, timeout);
1689
1689
  }
1690
1690
  }
1691
- withCookies(cookies2) {
1691
+ withCookies(cookies) {
1692
1692
  if (!__privateGet(this, _headers)) {
1693
1693
  __privateSet(this, _headers, {});
1694
1694
  }
1695
- __privateGet(this, _headers)["Cookie"] = cookies2.join("; ");
1695
+ __privateGet(this, _headers)["Cookie"] = cookies.join("; ");
1696
1696
  return this;
1697
1697
  }
1698
1698
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1888,2460 +1888,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
1888
1888
  _httpsAgent = new WeakMap();
1889
1889
  _SetupResetInterval = new WeakMap();
1890
1890
  _GetAgentOptions = new WeakMap();
1891
- function bind(fn, thisArg) {
1892
- return function wrap() {
1893
- return fn.apply(thisArg, arguments);
1894
- };
1895
- }
1896
- const { toString } = Object.prototype;
1897
- const { getPrototypeOf } = Object;
1898
- const { iterator, toStringTag } = Symbol;
1899
- const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
1900
- const str = toString.call(thing);
1901
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
1902
- })(/* @__PURE__ */ Object.create(null));
1903
- const kindOfTest = (type) => {
1904
- type = type.toLowerCase();
1905
- return (thing) => kindOf(thing) === type;
1906
- };
1907
- const typeOfTest = (type) => (thing) => typeof thing === type;
1908
- const { isArray } = Array;
1909
- const isUndefined = typeOfTest("undefined");
1910
- function isBuffer(val) {
1911
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
1912
- }
1913
- const isArrayBuffer = kindOfTest("ArrayBuffer");
1914
- function isArrayBufferView(val) {
1915
- let result;
1916
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
1917
- result = ArrayBuffer.isView(val);
1918
- } else {
1919
- result = val && val.buffer && isArrayBuffer(val.buffer);
1920
- }
1921
- return result;
1922
- }
1923
- const isString = typeOfTest("string");
1924
- const isFunction = typeOfTest("function");
1925
- const isNumber = typeOfTest("number");
1926
- const isObject = (thing) => thing !== null && typeof thing === "object";
1927
- const isBoolean = (thing) => thing === true || thing === false;
1928
- const isPlainObject = (val) => {
1929
- if (kindOf(val) !== "object") {
1930
- return false;
1931
- }
1932
- const prototype2 = getPrototypeOf(val);
1933
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
1934
- };
1935
- const isDate = kindOfTest("Date");
1936
- const isFile = kindOfTest("File");
1937
- const isBlob = kindOfTest("Blob");
1938
- const isFileList = kindOfTest("FileList");
1939
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
1940
- const isFormData = (thing) => {
1941
- let kind;
1942
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
1943
- kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
1944
- };
1945
- const isURLSearchParams = kindOfTest("URLSearchParams");
1946
- const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
1947
- const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
1948
- function forEach(obj, fn, { allOwnKeys = false } = {}) {
1949
- if (obj === null || typeof obj === "undefined") {
1950
- return;
1951
- }
1952
- let i;
1953
- let l;
1954
- if (typeof obj !== "object") {
1955
- obj = [obj];
1956
- }
1957
- if (isArray(obj)) {
1958
- for (i = 0, l = obj.length; i < l; i++) {
1959
- fn.call(null, obj[i], i, obj);
1960
- }
1961
- } else {
1962
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1963
- const len = keys.length;
1964
- let key;
1965
- for (i = 0; i < len; i++) {
1966
- key = keys[i];
1967
- fn.call(null, obj[key], key, obj);
1968
- }
1969
- }
1970
- }
1971
- function findKey(obj, key) {
1972
- key = key.toLowerCase();
1973
- const keys = Object.keys(obj);
1974
- let i = keys.length;
1975
- let _key;
1976
- while (i-- > 0) {
1977
- _key = keys[i];
1978
- if (key === _key.toLowerCase()) {
1979
- return _key;
1980
- }
1981
- }
1982
- return null;
1983
- }
1984
- const _global = (() => {
1985
- if (typeof globalThis !== "undefined") return globalThis;
1986
- return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
1987
- })();
1988
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
1989
- function merge() {
1990
- const { caseless } = isContextDefined(this) && this || {};
1991
- const result = {};
1992
- const assignValue = (val, key) => {
1993
- const targetKey = caseless && findKey(result, key) || key;
1994
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1995
- result[targetKey] = merge(result[targetKey], val);
1996
- } else if (isPlainObject(val)) {
1997
- result[targetKey] = merge({}, val);
1998
- } else if (isArray(val)) {
1999
- result[targetKey] = val.slice();
2000
- } else {
2001
- result[targetKey] = val;
2002
- }
2003
- };
2004
- for (let i = 0, l = arguments.length; i < l; i++) {
2005
- arguments[i] && forEach(arguments[i], assignValue);
2006
- }
2007
- return result;
2008
- }
2009
- const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
2010
- forEach(b, (val, key) => {
2011
- if (thisArg && isFunction(val)) {
2012
- a[key] = bind(val, thisArg);
2013
- } else {
2014
- a[key] = val;
2015
- }
2016
- }, { allOwnKeys });
2017
- return a;
2018
- };
2019
- const stripBOM = (content) => {
2020
- if (content.charCodeAt(0) === 65279) {
2021
- content = content.slice(1);
2022
- }
2023
- return content;
2024
- };
2025
- const inherits = (constructor, superConstructor, props, descriptors2) => {
2026
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
2027
- constructor.prototype.constructor = constructor;
2028
- Object.defineProperty(constructor, "super", {
2029
- value: superConstructor.prototype
2030
- });
2031
- props && Object.assign(constructor.prototype, props);
2032
- };
2033
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
2034
- let props;
2035
- let i;
2036
- let prop;
2037
- const merged = {};
2038
- destObj = destObj || {};
2039
- if (sourceObj == null) return destObj;
2040
- do {
2041
- props = Object.getOwnPropertyNames(sourceObj);
2042
- i = props.length;
2043
- while (i-- > 0) {
2044
- prop = props[i];
2045
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
2046
- destObj[prop] = sourceObj[prop];
2047
- merged[prop] = true;
2048
- }
2049
- }
2050
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
2051
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
2052
- return destObj;
2053
- };
2054
- const endsWith = (str, searchString, position) => {
2055
- str = String(str);
2056
- if (position === void 0 || position > str.length) {
2057
- position = str.length;
2058
- }
2059
- position -= searchString.length;
2060
- const lastIndex = str.indexOf(searchString, position);
2061
- return lastIndex !== -1 && lastIndex === position;
2062
- };
2063
- const toArray = (thing) => {
2064
- if (!thing) return null;
2065
- if (isArray(thing)) return thing;
2066
- let i = thing.length;
2067
- if (!isNumber(i)) return null;
2068
- const arr = new Array(i);
2069
- while (i-- > 0) {
2070
- arr[i] = thing[i];
2071
- }
2072
- return arr;
2073
- };
2074
- const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
2075
- return (thing) => {
2076
- return TypedArray && thing instanceof TypedArray;
2077
- };
2078
- })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
2079
- const forEachEntry = (obj, fn) => {
2080
- const generator = obj && obj[iterator];
2081
- const _iterator = generator.call(obj);
2082
- let result;
2083
- while ((result = _iterator.next()) && !result.done) {
2084
- const pair = result.value;
2085
- fn.call(obj, pair[0], pair[1]);
2086
- }
2087
- };
2088
- const matchAll = (regExp, str) => {
2089
- let matches;
2090
- const arr = [];
2091
- while ((matches = regExp.exec(str)) !== null) {
2092
- arr.push(matches);
2093
- }
2094
- return arr;
2095
- };
2096
- const isHTMLForm = kindOfTest("HTMLFormElement");
2097
- const toCamelCase = (str) => {
2098
- return str.toLowerCase().replace(
2099
- /[-_\s]([a-z\d])(\w*)/g,
2100
- function replacer(m, p1, p2) {
2101
- return p1.toUpperCase() + p2;
2102
- }
2103
- );
2104
- };
2105
- const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
2106
- const isRegExp = kindOfTest("RegExp");
2107
- const reduceDescriptors = (obj, reducer) => {
2108
- const descriptors2 = Object.getOwnPropertyDescriptors(obj);
2109
- const reducedDescriptors = {};
2110
- forEach(descriptors2, (descriptor, name) => {
2111
- let ret;
2112
- if ((ret = reducer(descriptor, name, obj)) !== false) {
2113
- reducedDescriptors[name] = ret || descriptor;
2114
- }
2115
- });
2116
- Object.defineProperties(obj, reducedDescriptors);
2117
- };
2118
- const freezeMethods = (obj) => {
2119
- reduceDescriptors(obj, (descriptor, name) => {
2120
- if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
2121
- return false;
2122
- }
2123
- const value = obj[name];
2124
- if (!isFunction(value)) return;
2125
- descriptor.enumerable = false;
2126
- if ("writable" in descriptor) {
2127
- descriptor.writable = false;
2128
- return;
2129
- }
2130
- if (!descriptor.set) {
2131
- descriptor.set = () => {
2132
- throw Error("Can not rewrite read-only method '" + name + "'");
2133
- };
2134
- }
2135
- });
2136
- };
2137
- const toObjectSet = (arrayOrString, delimiter) => {
2138
- const obj = {};
2139
- const define2 = (arr) => {
2140
- arr.forEach((value) => {
2141
- obj[value] = true;
2142
- });
2143
- };
2144
- isArray(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
2145
- return obj;
2146
- };
2147
- const noop = () => {
2148
- };
2149
- const toFiniteNumber = (value, defaultValue) => {
2150
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
2151
- };
2152
- function isSpecCompliantForm(thing) {
2153
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
2154
- }
2155
- const toJSONObject = (obj) => {
2156
- const stack = new Array(10);
2157
- const visit = (source2, i) => {
2158
- if (isObject(source2)) {
2159
- if (stack.indexOf(source2) >= 0) {
2160
- return;
2161
- }
2162
- if (!("toJSON" in source2)) {
2163
- stack[i] = source2;
2164
- const target = isArray(source2) ? [] : {};
2165
- forEach(source2, (value, key) => {
2166
- const reducedValue = visit(value, i + 1);
2167
- !isUndefined(reducedValue) && (target[key] = reducedValue);
2168
- });
2169
- stack[i] = void 0;
2170
- return target;
2171
- }
2172
- }
2173
- return source2;
2174
- };
2175
- return visit(obj, 0);
2176
- };
2177
- const isAsyncFn = kindOfTest("AsyncFunction");
2178
- const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
2179
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
2180
- if (setImmediateSupported) {
2181
- return setImmediate;
2182
- }
2183
- return postMessageSupported ? ((token, callbacks) => {
2184
- _global.addEventListener("message", ({ source: source2, data }) => {
2185
- if (source2 === _global && data === token) {
2186
- callbacks.length && callbacks.shift()();
2187
- }
2188
- }, false);
2189
- return (cb) => {
2190
- callbacks.push(cb);
2191
- _global.postMessage(token, "*");
2192
- };
2193
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
2194
- })(
2195
- typeof setImmediate === "function",
2196
- isFunction(_global.postMessage)
2197
- );
2198
- const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
2199
- const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
2200
- const utils$1 = {
2201
- isArray,
2202
- isArrayBuffer,
2203
- isBuffer,
2204
- isFormData,
2205
- isArrayBufferView,
2206
- isString,
2207
- isNumber,
2208
- isBoolean,
2209
- isObject,
2210
- isPlainObject,
2211
- isReadableStream,
2212
- isRequest,
2213
- isResponse,
2214
- isHeaders,
2215
- isUndefined,
2216
- isDate,
2217
- isFile,
2218
- isBlob,
2219
- isRegExp,
2220
- isFunction,
2221
- isStream,
2222
- isURLSearchParams,
2223
- isTypedArray,
2224
- isFileList,
2225
- forEach,
2226
- merge,
2227
- extend,
2228
- trim,
2229
- stripBOM,
2230
- inherits,
2231
- toFlatObject,
2232
- kindOf,
2233
- kindOfTest,
2234
- endsWith,
2235
- toArray,
2236
- forEachEntry,
2237
- matchAll,
2238
- isHTMLForm,
2239
- hasOwnProperty,
2240
- hasOwnProp: hasOwnProperty,
2241
- // an alias to avoid ESLint no-prototype-builtins detection
2242
- reduceDescriptors,
2243
- freezeMethods,
2244
- toObjectSet,
2245
- toCamelCase,
2246
- noop,
2247
- toFiniteNumber,
2248
- findKey,
2249
- global: _global,
2250
- isContextDefined,
2251
- isSpecCompliantForm,
2252
- toJSONObject,
2253
- isAsyncFn,
2254
- isThenable,
2255
- setImmediate: _setImmediate,
2256
- asap,
2257
- isIterable
2258
- };
2259
- function AxiosError$1(message, code, config, request, response) {
2260
- Error.call(this);
2261
- if (Error.captureStackTrace) {
2262
- Error.captureStackTrace(this, this.constructor);
2263
- } else {
2264
- this.stack = new Error().stack;
2265
- }
2266
- this.message = message;
2267
- this.name = "AxiosError";
2268
- code && (this.code = code);
2269
- config && (this.config = config);
2270
- request && (this.request = request);
2271
- if (response) {
2272
- this.response = response;
2273
- this.status = response.status ? response.status : null;
2274
- }
2275
- }
2276
- utils$1.inherits(AxiosError$1, Error, {
2277
- toJSON: function toJSON() {
2278
- return {
2279
- // Standard
2280
- message: this.message,
2281
- name: this.name,
2282
- // Microsoft
2283
- description: this.description,
2284
- number: this.number,
2285
- // Mozilla
2286
- fileName: this.fileName,
2287
- lineNumber: this.lineNumber,
2288
- columnNumber: this.columnNumber,
2289
- stack: this.stack,
2290
- // Axios
2291
- config: utils$1.toJSONObject(this.config),
2292
- code: this.code,
2293
- status: this.status
2294
- };
2295
- }
2296
- });
2297
- const prototype$1 = AxiosError$1.prototype;
2298
- const descriptors = {};
2299
- [
2300
- "ERR_BAD_OPTION_VALUE",
2301
- "ERR_BAD_OPTION",
2302
- "ECONNABORTED",
2303
- "ETIMEDOUT",
2304
- "ERR_NETWORK",
2305
- "ERR_FR_TOO_MANY_REDIRECTS",
2306
- "ERR_DEPRECATED",
2307
- "ERR_BAD_RESPONSE",
2308
- "ERR_BAD_REQUEST",
2309
- "ERR_CANCELED",
2310
- "ERR_NOT_SUPPORT",
2311
- "ERR_INVALID_URL"
2312
- // eslint-disable-next-line func-names
2313
- ].forEach((code) => {
2314
- descriptors[code] = { value: code };
2315
- });
2316
- Object.defineProperties(AxiosError$1, descriptors);
2317
- Object.defineProperty(prototype$1, "isAxiosError", { value: true });
2318
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
2319
- const axiosError = Object.create(prototype$1);
2320
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
2321
- return obj !== Error.prototype;
2322
- }, (prop) => {
2323
- return prop !== "isAxiosError";
2324
- });
2325
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
2326
- axiosError.cause = error;
2327
- axiosError.name = error.name;
2328
- customProps && Object.assign(axiosError, customProps);
2329
- return axiosError;
2330
- };
2331
- const httpAdapter = null;
2332
- function isVisitable(thing) {
2333
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
2334
- }
2335
- function removeBrackets(key) {
2336
- return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
2337
- }
2338
- function renderKey(path, key, dots) {
2339
- if (!path) return key;
2340
- return path.concat(key).map(function each(token, i) {
2341
- token = removeBrackets(token);
2342
- return !dots && i ? "[" + token + "]" : token;
2343
- }).join(dots ? "." : "");
2344
- }
2345
- function isFlatArray(arr) {
2346
- return utils$1.isArray(arr) && !arr.some(isVisitable);
2347
- }
2348
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2349
- return /^is[A-Z]/.test(prop);
2350
- });
2351
- function toFormData$1(obj, formData, options) {
2352
- if (!utils$1.isObject(obj)) {
2353
- throw new TypeError("target must be an object");
2354
- }
2355
- formData = formData || new FormData();
2356
- options = utils$1.toFlatObject(options, {
2357
- metaTokens: true,
2358
- dots: false,
2359
- indexes: false
2360
- }, false, function defined(option, source2) {
2361
- return !utils$1.isUndefined(source2[option]);
2362
- });
2363
- const metaTokens = options.metaTokens;
2364
- const visitor = options.visitor || defaultVisitor;
2365
- const dots = options.dots;
2366
- const indexes = options.indexes;
2367
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
2368
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2369
- if (!utils$1.isFunction(visitor)) {
2370
- throw new TypeError("visitor must be a function");
2371
- }
2372
- function convertValue(value) {
2373
- if (value === null) return "";
2374
- if (utils$1.isDate(value)) {
2375
- return value.toISOString();
2376
- }
2377
- if (utils$1.isBoolean(value)) {
2378
- return value.toString();
2379
- }
2380
- if (!useBlob && utils$1.isBlob(value)) {
2381
- throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
2382
- }
2383
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2384
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
2385
- }
2386
- return value;
2387
- }
2388
- function defaultVisitor(value, key, path) {
2389
- let arr = value;
2390
- if (value && !path && typeof value === "object") {
2391
- if (utils$1.endsWith(key, "{}")) {
2392
- key = metaTokens ? key : key.slice(0, -2);
2393
- value = JSON.stringify(value);
2394
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
2395
- key = removeBrackets(key);
2396
- arr.forEach(function each(el, index) {
2397
- !(utils$1.isUndefined(el) || el === null) && formData.append(
2398
- // eslint-disable-next-line no-nested-ternary
2399
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
2400
- convertValue(el)
2401
- );
2402
- });
2403
- return false;
2404
- }
2405
- }
2406
- if (isVisitable(value)) {
2407
- return true;
2408
- }
2409
- formData.append(renderKey(path, key, dots), convertValue(value));
2410
- return false;
2411
- }
2412
- const stack = [];
2413
- const exposedHelpers = Object.assign(predicates, {
2414
- defaultVisitor,
2415
- convertValue,
2416
- isVisitable
2417
- });
2418
- function build(value, path) {
2419
- if (utils$1.isUndefined(value)) return;
2420
- if (stack.indexOf(value) !== -1) {
2421
- throw Error("Circular reference detected in " + path.join("."));
2422
- }
2423
- stack.push(value);
2424
- utils$1.forEach(value, function each(el, key) {
2425
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
2426
- formData,
2427
- el,
2428
- utils$1.isString(key) ? key.trim() : key,
2429
- path,
2430
- exposedHelpers
2431
- );
2432
- if (result === true) {
2433
- build(el, path ? path.concat(key) : [key]);
2434
- }
2435
- });
2436
- stack.pop();
2437
- }
2438
- if (!utils$1.isObject(obj)) {
2439
- throw new TypeError("data must be an object");
2440
- }
2441
- build(obj);
2442
- return formData;
2443
- }
2444
- function encode$1(str) {
2445
- const charMap = {
2446
- "!": "%21",
2447
- "'": "%27",
2448
- "(": "%28",
2449
- ")": "%29",
2450
- "~": "%7E",
2451
- "%20": "+",
2452
- "%00": "\0"
2453
- };
2454
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
2455
- return charMap[match];
2456
- });
2457
- }
2458
- function AxiosURLSearchParams(params, options) {
2459
- this._pairs = [];
2460
- params && toFormData$1(params, this, options);
2461
- }
2462
- const prototype = AxiosURLSearchParams.prototype;
2463
- prototype.append = function append(name, value) {
2464
- this._pairs.push([name, value]);
2465
- };
2466
- prototype.toString = function toString2(encoder) {
2467
- const _encode = encoder ? function(value) {
2468
- return encoder.call(this, value, encode$1);
2469
- } : encode$1;
2470
- return this._pairs.map(function each(pair) {
2471
- return _encode(pair[0]) + "=" + _encode(pair[1]);
2472
- }, "").join("&");
2473
- };
2474
- function encode(val) {
2475
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
2476
- }
2477
- function buildURL(url, params, options) {
2478
- if (!params) {
2479
- return url;
2480
- }
2481
- const _encode = options && options.encode || encode;
2482
- if (utils$1.isFunction(options)) {
2483
- options = {
2484
- serialize: options
2485
- };
2486
- }
2487
- const serializeFn = options && options.serialize;
2488
- let serializedParams;
2489
- if (serializeFn) {
2490
- serializedParams = serializeFn(params, options);
2491
- } else {
2492
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
2493
- }
2494
- if (serializedParams) {
2495
- const hashmarkIndex = url.indexOf("#");
2496
- if (hashmarkIndex !== -1) {
2497
- url = url.slice(0, hashmarkIndex);
2498
- }
2499
- url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
2500
- }
2501
- return url;
2502
- }
2503
- class InterceptorManager {
2504
- constructor() {
2505
- this.handlers = [];
2506
- }
2507
- /**
2508
- * Add a new interceptor to the stack
2509
- *
2510
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
2511
- * @param {Function} rejected The function to handle `reject` for a `Promise`
2512
- *
2513
- * @return {Number} An ID used to remove interceptor later
2514
- */
2515
- use(fulfilled, rejected, options) {
2516
- this.handlers.push({
2517
- fulfilled,
2518
- rejected,
2519
- synchronous: options ? options.synchronous : false,
2520
- runWhen: options ? options.runWhen : null
2521
- });
2522
- return this.handlers.length - 1;
2523
- }
2524
- /**
2525
- * Remove an interceptor from the stack
2526
- *
2527
- * @param {Number} id The ID that was returned by `use`
2528
- *
2529
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2530
- */
2531
- eject(id) {
2532
- if (this.handlers[id]) {
2533
- this.handlers[id] = null;
2534
- }
2535
- }
2536
- /**
2537
- * Clear all interceptors from the stack
2538
- *
2539
- * @returns {void}
2540
- */
2541
- clear() {
2542
- if (this.handlers) {
2543
- this.handlers = [];
2544
- }
2545
- }
2546
- /**
2547
- * Iterate over all the registered interceptors
2548
- *
2549
- * This method is particularly useful for skipping over any
2550
- * interceptors that may have become `null` calling `eject`.
2551
- *
2552
- * @param {Function} fn The function to call for each interceptor
2553
- *
2554
- * @returns {void}
2555
- */
2556
- forEach(fn) {
2557
- utils$1.forEach(this.handlers, function forEachHandler(h) {
2558
- if (h !== null) {
2559
- fn(h);
2560
- }
2561
- });
2562
- }
2563
- }
2564
- const transitionalDefaults = {
2565
- silentJSONParsing: true,
2566
- forcedJSONParsing: true,
2567
- clarifyTimeoutError: false
2568
- };
2569
- const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
2570
- const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
2571
- const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
2572
- const platform$1 = {
2573
- isBrowser: true,
2574
- classes: {
2575
- URLSearchParams: URLSearchParams$1,
2576
- FormData: FormData$1,
2577
- Blob: Blob$1
2578
- },
2579
- protocols: ["http", "https", "file", "blob", "url", "data"]
2580
- };
2581
- const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
2582
- const _navigator = typeof navigator === "object" && navigator || void 0;
2583
- const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
2584
- const hasStandardBrowserWebWorkerEnv = (() => {
2585
- return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
2586
- self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
2587
- })();
2588
- const origin = hasBrowserEnv && window.location.href || "http://localhost";
2589
- const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2590
- __proto__: null,
2591
- hasBrowserEnv,
2592
- hasStandardBrowserEnv,
2593
- hasStandardBrowserWebWorkerEnv,
2594
- navigator: _navigator,
2595
- origin
2596
- }, Symbol.toStringTag, { value: "Module" }));
2597
- const platform = {
2598
- ...utils,
2599
- ...platform$1
2600
- };
2601
- function toURLEncodedForm(data, options) {
2602
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
2603
- visitor: function(value, key, path, helpers) {
2604
- if (platform.isNode && utils$1.isBuffer(value)) {
2605
- this.append(key, value.toString("base64"));
2606
- return false;
2607
- }
2608
- return helpers.defaultVisitor.apply(this, arguments);
2609
- }
2610
- }, options));
2611
- }
2612
- function parsePropPath(name) {
2613
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2614
- return match[0] === "[]" ? "" : match[1] || match[0];
2615
- });
2616
- }
2617
- function arrayToObject(arr) {
2618
- const obj = {};
2619
- const keys = Object.keys(arr);
2620
- let i;
2621
- const len = keys.length;
2622
- let key;
2623
- for (i = 0; i < len; i++) {
2624
- key = keys[i];
2625
- obj[key] = arr[key];
2626
- }
2627
- return obj;
2628
- }
2629
- function formDataToJSON(formData) {
2630
- function buildPath(path, value, target, index) {
2631
- let name = path[index++];
2632
- if (name === "__proto__") return true;
2633
- const isNumericKey = Number.isFinite(+name);
2634
- const isLast = index >= path.length;
2635
- name = !name && utils$1.isArray(target) ? target.length : name;
2636
- if (isLast) {
2637
- if (utils$1.hasOwnProp(target, name)) {
2638
- target[name] = [target[name], value];
2639
- } else {
2640
- target[name] = value;
2641
- }
2642
- return !isNumericKey;
2643
- }
2644
- if (!target[name] || !utils$1.isObject(target[name])) {
2645
- target[name] = [];
2646
- }
2647
- const result = buildPath(path, value, target[name], index);
2648
- if (result && utils$1.isArray(target[name])) {
2649
- target[name] = arrayToObject(target[name]);
2650
- }
2651
- return !isNumericKey;
2652
- }
2653
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2654
- const obj = {};
2655
- utils$1.forEachEntry(formData, (name, value) => {
2656
- buildPath(parsePropPath(name), value, obj, 0);
2657
- });
2658
- return obj;
2659
- }
2660
- return null;
2661
- }
2662
- function stringifySafely(rawValue, parser, encoder) {
2663
- if (utils$1.isString(rawValue)) {
2664
- try {
2665
- (parser || JSON.parse)(rawValue);
2666
- return utils$1.trim(rawValue);
2667
- } catch (e) {
2668
- if (e.name !== "SyntaxError") {
2669
- throw e;
2670
- }
2671
- }
2672
- }
2673
- return (encoder || JSON.stringify)(rawValue);
2674
- }
2675
- const defaults = {
2676
- transitional: transitionalDefaults,
2677
- adapter: ["xhr", "http", "fetch"],
2678
- transformRequest: [function transformRequest(data, headers) {
2679
- const contentType = headers.getContentType() || "";
2680
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
2681
- const isObjectPayload = utils$1.isObject(data);
2682
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
2683
- data = new FormData(data);
2684
- }
2685
- const isFormData2 = utils$1.isFormData(data);
2686
- if (isFormData2) {
2687
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2688
- }
2689
- 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)) {
2690
- return data;
2691
- }
2692
- if (utils$1.isArrayBufferView(data)) {
2693
- return data.buffer;
2694
- }
2695
- if (utils$1.isURLSearchParams(data)) {
2696
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
2697
- return data.toString();
2698
- }
2699
- let isFileList2;
2700
- if (isObjectPayload) {
2701
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
2702
- return toURLEncodedForm(data, this.formSerializer).toString();
2703
- }
2704
- if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
2705
- const _FormData = this.env && this.env.FormData;
2706
- return toFormData$1(
2707
- isFileList2 ? { "files[]": data } : data,
2708
- _FormData && new _FormData(),
2709
- this.formSerializer
2710
- );
2711
- }
2712
- }
2713
- if (isObjectPayload || hasJSONContentType) {
2714
- headers.setContentType("application/json", false);
2715
- return stringifySafely(data);
2716
- }
2717
- return data;
2718
- }],
2719
- transformResponse: [function transformResponse(data) {
2720
- const transitional = this.transitional || defaults.transitional;
2721
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2722
- const JSONRequested = this.responseType === "json";
2723
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2724
- return data;
2725
- }
2726
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2727
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
2728
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
2729
- try {
2730
- return JSON.parse(data);
2731
- } catch (e) {
2732
- if (strictJSONParsing) {
2733
- if (e.name === "SyntaxError") {
2734
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2735
- }
2736
- throw e;
2737
- }
2738
- }
2739
- }
2740
- return data;
2741
- }],
2742
- /**
2743
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2744
- * timeout is not created.
2745
- */
2746
- timeout: 0,
2747
- xsrfCookieName: "XSRF-TOKEN",
2748
- xsrfHeaderName: "X-XSRF-TOKEN",
2749
- maxContentLength: -1,
2750
- maxBodyLength: -1,
2751
- env: {
2752
- FormData: platform.classes.FormData,
2753
- Blob: platform.classes.Blob
2754
- },
2755
- validateStatus: function validateStatus(status) {
2756
- return status >= 200 && status < 300;
2757
- },
2758
- headers: {
2759
- common: {
2760
- "Accept": "application/json, text/plain, */*",
2761
- "Content-Type": void 0
2762
- }
2763
- }
2764
- };
2765
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
2766
- defaults.headers[method] = {};
2767
- });
2768
- const ignoreDuplicateOf = utils$1.toObjectSet([
2769
- "age",
2770
- "authorization",
2771
- "content-length",
2772
- "content-type",
2773
- "etag",
2774
- "expires",
2775
- "from",
2776
- "host",
2777
- "if-modified-since",
2778
- "if-unmodified-since",
2779
- "last-modified",
2780
- "location",
2781
- "max-forwards",
2782
- "proxy-authorization",
2783
- "referer",
2784
- "retry-after",
2785
- "user-agent"
2786
- ]);
2787
- const parseHeaders = (rawHeaders) => {
2788
- const parsed = {};
2789
- let key;
2790
- let val;
2791
- let i;
2792
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
2793
- i = line.indexOf(":");
2794
- key = line.substring(0, i).trim().toLowerCase();
2795
- val = line.substring(i + 1).trim();
2796
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2797
- return;
2798
- }
2799
- if (key === "set-cookie") {
2800
- if (parsed[key]) {
2801
- parsed[key].push(val);
2802
- } else {
2803
- parsed[key] = [val];
2804
- }
2805
- } else {
2806
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
2807
- }
2808
- });
2809
- return parsed;
2810
- };
2811
- const $internals = Symbol("internals");
2812
- function normalizeHeader(header) {
2813
- return header && String(header).trim().toLowerCase();
2814
- }
2815
- function normalizeValue(value) {
2816
- if (value === false || value == null) {
2817
- return value;
2818
- }
2819
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
2820
- }
2821
- function parseTokens(str) {
2822
- const tokens = /* @__PURE__ */ Object.create(null);
2823
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2824
- let match;
2825
- while (match = tokensRE.exec(str)) {
2826
- tokens[match[1]] = match[2];
2827
- }
2828
- return tokens;
2829
- }
2830
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2831
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2832
- if (utils$1.isFunction(filter)) {
2833
- return filter.call(this, value, header);
2834
- }
2835
- if (isHeaderNameFilter) {
2836
- value = header;
2837
- }
2838
- if (!utils$1.isString(value)) return;
2839
- if (utils$1.isString(filter)) {
2840
- return value.indexOf(filter) !== -1;
2841
- }
2842
- if (utils$1.isRegExp(filter)) {
2843
- return filter.test(value);
2844
- }
2845
- }
2846
- function formatHeader(header) {
2847
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2848
- return char.toUpperCase() + str;
2849
- });
2850
- }
2851
- function buildAccessors(obj, header) {
2852
- const accessorName = utils$1.toCamelCase(" " + header);
2853
- ["get", "set", "has"].forEach((methodName) => {
2854
- Object.defineProperty(obj, methodName + accessorName, {
2855
- value: function(arg1, arg2, arg3) {
2856
- return this[methodName].call(this, header, arg1, arg2, arg3);
2857
- },
2858
- configurable: true
2859
- });
2860
- });
2861
- }
2862
- let AxiosHeaders$1 = class AxiosHeaders {
2863
- constructor(headers) {
2864
- headers && this.set(headers);
2865
- }
2866
- set(header, valueOrRewrite, rewrite) {
2867
- const self2 = this;
2868
- function setHeader(_value, _header, _rewrite) {
2869
- const lHeader = normalizeHeader(_header);
2870
- if (!lHeader) {
2871
- throw new Error("header name must be a non-empty string");
2872
- }
2873
- const key = utils$1.findKey(self2, lHeader);
2874
- if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
2875
- self2[key || _header] = normalizeValue(_value);
2876
- }
2877
- }
2878
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
2879
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2880
- setHeaders(header, valueOrRewrite);
2881
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2882
- setHeaders(parseHeaders(header), valueOrRewrite);
2883
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2884
- let obj = {}, dest, key;
2885
- for (const entry of header) {
2886
- if (!utils$1.isArray(entry)) {
2887
- throw TypeError("Object iterator must return a key-value pair");
2888
- }
2889
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
2890
- }
2891
- setHeaders(obj, valueOrRewrite);
2892
- } else {
2893
- header != null && setHeader(valueOrRewrite, header, rewrite);
2894
- }
2895
- return this;
2896
- }
2897
- get(header, parser) {
2898
- header = normalizeHeader(header);
2899
- if (header) {
2900
- const key = utils$1.findKey(this, header);
2901
- if (key) {
2902
- const value = this[key];
2903
- if (!parser) {
2904
- return value;
2905
- }
2906
- if (parser === true) {
2907
- return parseTokens(value);
2908
- }
2909
- if (utils$1.isFunction(parser)) {
2910
- return parser.call(this, value, key);
2911
- }
2912
- if (utils$1.isRegExp(parser)) {
2913
- return parser.exec(value);
2914
- }
2915
- throw new TypeError("parser must be boolean|regexp|function");
2916
- }
2917
- }
2918
- }
2919
- has(header, matcher) {
2920
- header = normalizeHeader(header);
2921
- if (header) {
2922
- const key = utils$1.findKey(this, header);
2923
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2924
- }
2925
- return false;
2926
- }
2927
- delete(header, matcher) {
2928
- const self2 = this;
2929
- let deleted = false;
2930
- function deleteHeader(_header) {
2931
- _header = normalizeHeader(_header);
2932
- if (_header) {
2933
- const key = utils$1.findKey(self2, _header);
2934
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
2935
- delete self2[key];
2936
- deleted = true;
2937
- }
2938
- }
2939
- }
2940
- if (utils$1.isArray(header)) {
2941
- header.forEach(deleteHeader);
2942
- } else {
2943
- deleteHeader(header);
2944
- }
2945
- return deleted;
2946
- }
2947
- clear(matcher) {
2948
- const keys = Object.keys(this);
2949
- let i = keys.length;
2950
- let deleted = false;
2951
- while (i--) {
2952
- const key = keys[i];
2953
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2954
- delete this[key];
2955
- deleted = true;
2956
- }
2957
- }
2958
- return deleted;
2959
- }
2960
- normalize(format) {
2961
- const self2 = this;
2962
- const headers = {};
2963
- utils$1.forEach(this, (value, header) => {
2964
- const key = utils$1.findKey(headers, header);
2965
- if (key) {
2966
- self2[key] = normalizeValue(value);
2967
- delete self2[header];
2968
- return;
2969
- }
2970
- const normalized = format ? formatHeader(header) : String(header).trim();
2971
- if (normalized !== header) {
2972
- delete self2[header];
2973
- }
2974
- self2[normalized] = normalizeValue(value);
2975
- headers[normalized] = true;
2976
- });
2977
- return this;
2978
- }
2979
- concat(...targets) {
2980
- return this.constructor.concat(this, ...targets);
2981
- }
2982
- toJSON(asStrings) {
2983
- const obj = /* @__PURE__ */ Object.create(null);
2984
- utils$1.forEach(this, (value, header) => {
2985
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
2986
- });
2987
- return obj;
2988
- }
2989
- [Symbol.iterator]() {
2990
- return Object.entries(this.toJSON())[Symbol.iterator]();
2991
- }
2992
- toString() {
2993
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
2994
- }
2995
- getSetCookie() {
2996
- return this.get("set-cookie") || [];
2997
- }
2998
- get [Symbol.toStringTag]() {
2999
- return "AxiosHeaders";
3000
- }
3001
- static from(thing) {
3002
- return thing instanceof this ? thing : new this(thing);
3003
- }
3004
- static concat(first, ...targets) {
3005
- const computed = new this(first);
3006
- targets.forEach((target) => computed.set(target));
3007
- return computed;
3008
- }
3009
- static accessor(header) {
3010
- const internals = this[$internals] = this[$internals] = {
3011
- accessors: {}
3012
- };
3013
- const accessors = internals.accessors;
3014
- const prototype2 = this.prototype;
3015
- function defineAccessor(_header) {
3016
- const lHeader = normalizeHeader(_header);
3017
- if (!accessors[lHeader]) {
3018
- buildAccessors(prototype2, _header);
3019
- accessors[lHeader] = true;
3020
- }
3021
- }
3022
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
3023
- return this;
3024
- }
3025
- };
3026
- AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
3027
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
3028
- let mapped = key[0].toUpperCase() + key.slice(1);
3029
- return {
3030
- get: () => value,
3031
- set(headerValue) {
3032
- this[mapped] = headerValue;
3033
- }
3034
- };
3035
- });
3036
- utils$1.freezeMethods(AxiosHeaders$1);
3037
- function transformData(fns, response) {
3038
- const config = this || defaults;
3039
- const context = response || config;
3040
- const headers = AxiosHeaders$1.from(context.headers);
3041
- let data = context.data;
3042
- utils$1.forEach(fns, function transform(fn) {
3043
- data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
3044
- });
3045
- headers.normalize();
3046
- return data;
3047
- }
3048
- function isCancel$1(value) {
3049
- return !!(value && value.__CANCEL__);
3050
- }
3051
- function CanceledError$1(message, config, request) {
3052
- AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
3053
- this.name = "CanceledError";
3054
- }
3055
- utils$1.inherits(CanceledError$1, AxiosError$1, {
3056
- __CANCEL__: true
3057
- });
3058
- function settle(resolve, reject, response) {
3059
- const validateStatus = response.config.validateStatus;
3060
- if (!response.status || !validateStatus || validateStatus(response.status)) {
3061
- resolve(response);
3062
- } else {
3063
- reject(new AxiosError$1(
3064
- "Request failed with status code " + response.status,
3065
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
3066
- response.config,
3067
- response.request,
3068
- response
3069
- ));
3070
- }
3071
- }
3072
- function parseProtocol(url) {
3073
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3074
- return match && match[1] || "";
3075
- }
3076
- function speedometer(samplesCount, min) {
3077
- samplesCount = samplesCount || 10;
3078
- const bytes = new Array(samplesCount);
3079
- const timestamps = new Array(samplesCount);
3080
- let head = 0;
3081
- let tail = 0;
3082
- let firstSampleTS;
3083
- min = min !== void 0 ? min : 1e3;
3084
- return function push(chunkLength) {
3085
- const now = Date.now();
3086
- const startedAt = timestamps[tail];
3087
- if (!firstSampleTS) {
3088
- firstSampleTS = now;
3089
- }
3090
- bytes[head] = chunkLength;
3091
- timestamps[head] = now;
3092
- let i = tail;
3093
- let bytesCount = 0;
3094
- while (i !== head) {
3095
- bytesCount += bytes[i++];
3096
- i = i % samplesCount;
3097
- }
3098
- head = (head + 1) % samplesCount;
3099
- if (head === tail) {
3100
- tail = (tail + 1) % samplesCount;
3101
- }
3102
- if (now - firstSampleTS < min) {
3103
- return;
3104
- }
3105
- const passed = startedAt && now - startedAt;
3106
- return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
3107
- };
3108
- }
3109
- function throttle(fn, freq) {
3110
- let timestamp = 0;
3111
- let threshold = 1e3 / freq;
3112
- let lastArgs;
3113
- let timer;
3114
- const invoke = (args, now = Date.now()) => {
3115
- timestamp = now;
3116
- lastArgs = null;
3117
- if (timer) {
3118
- clearTimeout(timer);
3119
- timer = null;
3120
- }
3121
- fn.apply(null, args);
3122
- };
3123
- const throttled = (...args) => {
3124
- const now = Date.now();
3125
- const passed = now - timestamp;
3126
- if (passed >= threshold) {
3127
- invoke(args, now);
3128
- } else {
3129
- lastArgs = args;
3130
- if (!timer) {
3131
- timer = setTimeout(() => {
3132
- timer = null;
3133
- invoke(lastArgs);
3134
- }, threshold - passed);
3135
- }
3136
- }
3137
- };
3138
- const flush = () => lastArgs && invoke(lastArgs);
3139
- return [throttled, flush];
3140
- }
3141
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
3142
- let bytesNotified = 0;
3143
- const _speedometer = speedometer(50, 250);
3144
- return throttle((e) => {
3145
- const loaded = e.loaded;
3146
- const total = e.lengthComputable ? e.total : void 0;
3147
- const progressBytes = loaded - bytesNotified;
3148
- const rate = _speedometer(progressBytes);
3149
- const inRange = loaded <= total;
3150
- bytesNotified = loaded;
3151
- const data = {
3152
- loaded,
3153
- total,
3154
- progress: total ? loaded / total : void 0,
3155
- bytes: progressBytes,
3156
- rate: rate ? rate : void 0,
3157
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
3158
- event: e,
3159
- lengthComputable: total != null,
3160
- [isDownloadStream ? "download" : "upload"]: true
3161
- };
3162
- listener(data);
3163
- }, freq);
3164
- };
3165
- const progressEventDecorator = (total, throttled) => {
3166
- const lengthComputable = total != null;
3167
- return [(loaded) => throttled[0]({
3168
- lengthComputable,
3169
- total,
3170
- loaded
3171
- }), throttled[1]];
3172
- };
3173
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
3174
- const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
3175
- url = new URL(url, platform.origin);
3176
- return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
3177
- })(
3178
- new URL(platform.origin),
3179
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
3180
- ) : () => true;
3181
- const cookies = platform.hasStandardBrowserEnv ? (
3182
- // Standard browser envs support document.cookie
3183
- {
3184
- write(name, value, expires, path, domain, secure) {
3185
- const cookie = [name + "=" + encodeURIComponent(value)];
3186
- utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
3187
- utils$1.isString(path) && cookie.push("path=" + path);
3188
- utils$1.isString(domain) && cookie.push("domain=" + domain);
3189
- secure === true && cookie.push("secure");
3190
- document.cookie = cookie.join("; ");
3191
- },
3192
- read(name) {
3193
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
3194
- return match ? decodeURIComponent(match[3]) : null;
3195
- },
3196
- remove(name) {
3197
- this.write(name, "", Date.now() - 864e5);
3198
- }
3199
- }
3200
- ) : (
3201
- // Non-standard browser env (web workers, react-native) lack needed support.
3202
- {
3203
- write() {
3204
- },
3205
- read() {
3206
- return null;
3207
- },
3208
- remove() {
3209
- }
3210
- }
3211
- );
3212
- function isAbsoluteURL(url) {
3213
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3214
- }
3215
- function combineURLs(baseURL, relativeURL) {
3216
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
3217
- }
3218
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3219
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
3220
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
3221
- return combineURLs(baseURL, requestedURL);
3222
- }
3223
- return requestedURL;
3224
- }
3225
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3226
- function mergeConfig$1(config1, config2) {
3227
- config2 = config2 || {};
3228
- const config = {};
3229
- function getMergedValue(target, source2, prop, caseless) {
3230
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source2)) {
3231
- return utils$1.merge.call({ caseless }, target, source2);
3232
- } else if (utils$1.isPlainObject(source2)) {
3233
- return utils$1.merge({}, source2);
3234
- } else if (utils$1.isArray(source2)) {
3235
- return source2.slice();
3236
- }
3237
- return source2;
3238
- }
3239
- function mergeDeepProperties(a, b, prop, caseless) {
3240
- if (!utils$1.isUndefined(b)) {
3241
- return getMergedValue(a, b, prop, caseless);
3242
- } else if (!utils$1.isUndefined(a)) {
3243
- return getMergedValue(void 0, a, prop, caseless);
3244
- }
3245
- }
3246
- function valueFromConfig2(a, b) {
3247
- if (!utils$1.isUndefined(b)) {
3248
- return getMergedValue(void 0, b);
3249
- }
3250
- }
3251
- function defaultToConfig2(a, b) {
3252
- if (!utils$1.isUndefined(b)) {
3253
- return getMergedValue(void 0, b);
3254
- } else if (!utils$1.isUndefined(a)) {
3255
- return getMergedValue(void 0, a);
3256
- }
3257
- }
3258
- function mergeDirectKeys(a, b, prop) {
3259
- if (prop in config2) {
3260
- return getMergedValue(a, b);
3261
- } else if (prop in config1) {
3262
- return getMergedValue(void 0, a);
3263
- }
3264
- }
3265
- const mergeMap = {
3266
- url: valueFromConfig2,
3267
- method: valueFromConfig2,
3268
- data: valueFromConfig2,
3269
- baseURL: defaultToConfig2,
3270
- transformRequest: defaultToConfig2,
3271
- transformResponse: defaultToConfig2,
3272
- paramsSerializer: defaultToConfig2,
3273
- timeout: defaultToConfig2,
3274
- timeoutMessage: defaultToConfig2,
3275
- withCredentials: defaultToConfig2,
3276
- withXSRFToken: defaultToConfig2,
3277
- adapter: defaultToConfig2,
3278
- responseType: defaultToConfig2,
3279
- xsrfCookieName: defaultToConfig2,
3280
- xsrfHeaderName: defaultToConfig2,
3281
- onUploadProgress: defaultToConfig2,
3282
- onDownloadProgress: defaultToConfig2,
3283
- decompress: defaultToConfig2,
3284
- maxContentLength: defaultToConfig2,
3285
- maxBodyLength: defaultToConfig2,
3286
- beforeRedirect: defaultToConfig2,
3287
- transport: defaultToConfig2,
3288
- httpAgent: defaultToConfig2,
3289
- httpsAgent: defaultToConfig2,
3290
- cancelToken: defaultToConfig2,
3291
- socketPath: defaultToConfig2,
3292
- responseEncoding: defaultToConfig2,
3293
- validateStatus: mergeDirectKeys,
3294
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3295
- };
3296
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3297
- const merge2 = mergeMap[prop] || mergeDeepProperties;
3298
- const configValue = merge2(config1[prop], config2[prop], prop);
3299
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
3300
- });
3301
- return config;
3302
- }
3303
- const resolveConfig = (config) => {
3304
- const newConfig = mergeConfig$1({}, config);
3305
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3306
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
3307
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3308
- if (auth) {
3309
- headers.set(
3310
- "Authorization",
3311
- "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
3312
- );
3313
- }
3314
- let contentType;
3315
- if (utils$1.isFormData(data)) {
3316
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3317
- headers.setContentType(void 0);
3318
- } else if ((contentType = headers.getContentType()) !== false) {
3319
- const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
3320
- headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
3321
- }
3322
- }
3323
- if (platform.hasStandardBrowserEnv) {
3324
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3325
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
3326
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
3327
- if (xsrfValue) {
3328
- headers.set(xsrfHeaderName, xsrfValue);
3329
- }
3330
- }
3331
- }
3332
- return newConfig;
3333
- };
3334
- const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
3335
- const xhrAdapter = isXHRAdapterSupported && function(config) {
3336
- return new Promise(function dispatchXhrRequest(resolve, reject) {
3337
- const _config = resolveConfig(config);
3338
- let requestData = _config.data;
3339
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3340
- let { responseType, onUploadProgress, onDownloadProgress } = _config;
3341
- let onCanceled;
3342
- let uploadThrottled, downloadThrottled;
3343
- let flushUpload, flushDownload;
3344
- function done() {
3345
- flushUpload && flushUpload();
3346
- flushDownload && flushDownload();
3347
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3348
- _config.signal && _config.signal.removeEventListener("abort", onCanceled);
3349
- }
3350
- let request = new XMLHttpRequest();
3351
- request.open(_config.method.toUpperCase(), _config.url, true);
3352
- request.timeout = _config.timeout;
3353
- function onloadend() {
3354
- if (!request) {
3355
- return;
3356
- }
3357
- const responseHeaders = AxiosHeaders$1.from(
3358
- "getAllResponseHeaders" in request && request.getAllResponseHeaders()
3359
- );
3360
- const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
3361
- const response = {
3362
- data: responseData,
3363
- status: request.status,
3364
- statusText: request.statusText,
3365
- headers: responseHeaders,
3366
- config,
3367
- request
3368
- };
3369
- settle(function _resolve(value) {
3370
- resolve(value);
3371
- done();
3372
- }, function _reject(err) {
3373
- reject(err);
3374
- done();
3375
- }, response);
3376
- request = null;
3377
- }
3378
- if ("onloadend" in request) {
3379
- request.onloadend = onloadend;
3380
- } else {
3381
- request.onreadystatechange = function handleLoad() {
3382
- if (!request || request.readyState !== 4) {
3383
- return;
3384
- }
3385
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
3386
- return;
3387
- }
3388
- setTimeout(onloadend);
3389
- };
3390
- }
3391
- request.onabort = function handleAbort() {
3392
- if (!request) {
3393
- return;
3394
- }
3395
- reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
3396
- request = null;
3397
- };
3398
- request.onerror = function handleError() {
3399
- reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
3400
- request = null;
3401
- };
3402
- request.ontimeout = function handleTimeout() {
3403
- let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
3404
- const transitional = _config.transitional || transitionalDefaults;
3405
- if (_config.timeoutErrorMessage) {
3406
- timeoutErrorMessage = _config.timeoutErrorMessage;
3407
- }
3408
- reject(new AxiosError$1(
3409
- timeoutErrorMessage,
3410
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
3411
- config,
3412
- request
3413
- ));
3414
- request = null;
3415
- };
3416
- requestData === void 0 && requestHeaders.setContentType(null);
3417
- if ("setRequestHeader" in request) {
3418
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3419
- request.setRequestHeader(key, val);
3420
- });
3421
- }
3422
- if (!utils$1.isUndefined(_config.withCredentials)) {
3423
- request.withCredentials = !!_config.withCredentials;
3424
- }
3425
- if (responseType && responseType !== "json") {
3426
- request.responseType = _config.responseType;
3427
- }
3428
- if (onDownloadProgress) {
3429
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
3430
- request.addEventListener("progress", downloadThrottled);
3431
- }
3432
- if (onUploadProgress && request.upload) {
3433
- [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
3434
- request.upload.addEventListener("progress", uploadThrottled);
3435
- request.upload.addEventListener("loadend", flushUpload);
3436
- }
3437
- if (_config.cancelToken || _config.signal) {
3438
- onCanceled = (cancel) => {
3439
- if (!request) {
3440
- return;
3441
- }
3442
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
3443
- request.abort();
3444
- request = null;
3445
- };
3446
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3447
- if (_config.signal) {
3448
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
3449
- }
3450
- }
3451
- const protocol = parseProtocol(_config.url);
3452
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3453
- reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
3454
- return;
3455
- }
3456
- request.send(requestData || null);
3457
- });
3458
- };
3459
- const composeSignals = (signals, timeout) => {
3460
- const { length } = signals = signals ? signals.filter(Boolean) : [];
3461
- if (timeout || length) {
3462
- let controller = new AbortController();
3463
- let aborted;
3464
- const onabort = function(reason) {
3465
- if (!aborted) {
3466
- aborted = true;
3467
- unsubscribe();
3468
- const err = reason instanceof Error ? reason : this.reason;
3469
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
3470
- }
3471
- };
3472
- let timer = timeout && setTimeout(() => {
3473
- timer = null;
3474
- onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
3475
- }, timeout);
3476
- const unsubscribe = () => {
3477
- if (signals) {
3478
- timer && clearTimeout(timer);
3479
- timer = null;
3480
- signals.forEach((signal2) => {
3481
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
3482
- });
3483
- signals = null;
3484
- }
3485
- };
3486
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
3487
- const { signal } = controller;
3488
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
3489
- return signal;
3490
- }
3491
- };
3492
- const streamChunk = function* (chunk, chunkSize) {
3493
- let len = chunk.byteLength;
3494
- if (len < chunkSize) {
3495
- yield chunk;
3496
- return;
3497
- }
3498
- let pos = 0;
3499
- let end;
3500
- while (pos < len) {
3501
- end = pos + chunkSize;
3502
- yield chunk.slice(pos, end);
3503
- pos = end;
3504
- }
3505
- };
3506
- const readBytes = async function* (iterable, chunkSize) {
3507
- for await (const chunk of readStream(iterable)) {
3508
- yield* streamChunk(chunk, chunkSize);
3509
- }
3510
- };
3511
- const readStream = async function* (stream) {
3512
- if (stream[Symbol.asyncIterator]) {
3513
- yield* stream;
3514
- return;
3515
- }
3516
- const reader = stream.getReader();
3517
- try {
3518
- for (; ; ) {
3519
- const { done, value } = await reader.read();
3520
- if (done) {
3521
- break;
3522
- }
3523
- yield value;
3524
- }
3525
- } finally {
3526
- await reader.cancel();
3527
- }
3528
- };
3529
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3530
- const iterator2 = readBytes(stream, chunkSize);
3531
- let bytes = 0;
3532
- let done;
3533
- let _onFinish = (e) => {
3534
- if (!done) {
3535
- done = true;
3536
- onFinish && onFinish(e);
3537
- }
3538
- };
3539
- return new ReadableStream({
3540
- async pull(controller) {
3541
- try {
3542
- const { done: done2, value } = await iterator2.next();
3543
- if (done2) {
3544
- _onFinish();
3545
- controller.close();
3546
- return;
3547
- }
3548
- let len = value.byteLength;
3549
- if (onProgress) {
3550
- let loadedBytes = bytes += len;
3551
- onProgress(loadedBytes);
3552
- }
3553
- controller.enqueue(new Uint8Array(value));
3554
- } catch (err) {
3555
- _onFinish(err);
3556
- throw err;
3557
- }
3558
- },
3559
- cancel(reason) {
3560
- _onFinish(reason);
3561
- return iterator2.return();
3562
- }
3563
- }, {
3564
- highWaterMark: 2
3565
- });
3566
- };
3567
- const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
3568
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
3569
- const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
3570
- const test = (fn, ...args) => {
3571
- try {
3572
- return !!fn(...args);
3573
- } catch (e) {
3574
- return false;
3575
- }
3576
- };
3577
- const supportsRequestStream = isReadableStreamSupported && test(() => {
3578
- let duplexAccessed = false;
3579
- const hasContentType = new Request(platform.origin, {
3580
- body: new ReadableStream(),
3581
- method: "POST",
3582
- get duplex() {
3583
- duplexAccessed = true;
3584
- return "half";
3585
- }
3586
- }).headers.has("Content-Type");
3587
- return duplexAccessed && !hasContentType;
3588
- });
3589
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3590
- const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
3591
- const resolvers = {
3592
- stream: supportsResponseStream && ((res) => res.body)
3593
- };
3594
- isFetchSupported && ((res) => {
3595
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
3596
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
3597
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
3598
- });
3599
- });
3600
- })(new Response());
3601
- const getBodyLength = async (body) => {
3602
- if (body == null) {
3603
- return 0;
3604
- }
3605
- if (utils$1.isBlob(body)) {
3606
- return body.size;
3607
- }
3608
- if (utils$1.isSpecCompliantForm(body)) {
3609
- const _request = new Request(platform.origin, {
3610
- method: "POST",
3611
- body
3612
- });
3613
- return (await _request.arrayBuffer()).byteLength;
3614
- }
3615
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3616
- return body.byteLength;
3617
- }
3618
- if (utils$1.isURLSearchParams(body)) {
3619
- body = body + "";
3620
- }
3621
- if (utils$1.isString(body)) {
3622
- return (await encodeText(body)).byteLength;
3623
- }
3624
- };
3625
- const resolveBodyLength = async (headers, body) => {
3626
- const length = utils$1.toFiniteNumber(headers.getContentLength());
3627
- return length == null ? getBodyLength(body) : length;
3628
- };
3629
- const fetchAdapter = isFetchSupported && (async (config) => {
3630
- let {
3631
- url,
3632
- method,
3633
- data,
3634
- signal,
3635
- cancelToken,
3636
- timeout,
3637
- onDownloadProgress,
3638
- onUploadProgress,
3639
- responseType,
3640
- headers,
3641
- withCredentials = "same-origin",
3642
- fetchOptions
3643
- } = resolveConfig(config);
3644
- responseType = responseType ? (responseType + "").toLowerCase() : "text";
3645
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3646
- let request;
3647
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3648
- composedSignal.unsubscribe();
3649
- });
3650
- let requestContentLength;
3651
- try {
3652
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
3653
- let _request = new Request(url, {
3654
- method: "POST",
3655
- body: data,
3656
- duplex: "half"
3657
- });
3658
- let contentTypeHeader;
3659
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
3660
- headers.setContentType(contentTypeHeader);
3661
- }
3662
- if (_request.body) {
3663
- const [onProgress, flush] = progressEventDecorator(
3664
- requestContentLength,
3665
- progressEventReducer(asyncDecorator(onUploadProgress))
3666
- );
3667
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3668
- }
3669
- }
3670
- if (!utils$1.isString(withCredentials)) {
3671
- withCredentials = withCredentials ? "include" : "omit";
3672
- }
3673
- const isCredentialsSupported = "credentials" in Request.prototype;
3674
- request = new Request(url, {
3675
- ...fetchOptions,
3676
- signal: composedSignal,
3677
- method: method.toUpperCase(),
3678
- headers: headers.normalize().toJSON(),
3679
- body: data,
3680
- duplex: "half",
3681
- credentials: isCredentialsSupported ? withCredentials : void 0
3682
- });
3683
- let response = await fetch(request, fetchOptions);
3684
- const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
3685
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3686
- const options = {};
3687
- ["status", "statusText", "headers"].forEach((prop) => {
3688
- options[prop] = response[prop];
3689
- });
3690
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
3691
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3692
- responseContentLength,
3693
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
3694
- ) || [];
3695
- response = new Response(
3696
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3697
- flush && flush();
3698
- unsubscribe && unsubscribe();
3699
- }),
3700
- options
3701
- );
3702
- }
3703
- responseType = responseType || "text";
3704
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
3705
- !isStreamResponse && unsubscribe && unsubscribe();
3706
- return await new Promise((resolve, reject) => {
3707
- settle(resolve, reject, {
3708
- data: responseData,
3709
- headers: AxiosHeaders$1.from(response.headers),
3710
- status: response.status,
3711
- statusText: response.statusText,
3712
- config,
3713
- request
3714
- });
3715
- });
3716
- } catch (err) {
3717
- unsubscribe && unsubscribe();
3718
- if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
3719
- throw Object.assign(
3720
- new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
3721
- {
3722
- cause: err.cause || err
3723
- }
3724
- );
3725
- }
3726
- throw AxiosError$1.from(err, err && err.code, config, request);
3727
- }
3728
- });
3729
- const knownAdapters = {
3730
- http: httpAdapter,
3731
- xhr: xhrAdapter,
3732
- fetch: fetchAdapter
3733
- };
3734
- utils$1.forEach(knownAdapters, (fn, value) => {
3735
- if (fn) {
3736
- try {
3737
- Object.defineProperty(fn, "name", { value });
3738
- } catch (e) {
3739
- }
3740
- Object.defineProperty(fn, "adapterName", { value });
3741
- }
3742
- });
3743
- const renderReason = (reason) => `- ${reason}`;
3744
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3745
- const adapters = {
3746
- getAdapter: (adapters2) => {
3747
- adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
3748
- const { length } = adapters2;
3749
- let nameOrAdapter;
3750
- let adapter;
3751
- const rejectedReasons = {};
3752
- for (let i = 0; i < length; i++) {
3753
- nameOrAdapter = adapters2[i];
3754
- let id;
3755
- adapter = nameOrAdapter;
3756
- if (!isResolvedHandle(nameOrAdapter)) {
3757
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3758
- if (adapter === void 0) {
3759
- throw new AxiosError$1(`Unknown adapter '${id}'`);
3760
- }
3761
- }
3762
- if (adapter) {
3763
- break;
3764
- }
3765
- rejectedReasons[id || "#" + i] = adapter;
3766
- }
3767
- if (!adapter) {
3768
- const reasons = Object.entries(rejectedReasons).map(
3769
- ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
3770
- );
3771
- let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
3772
- throw new AxiosError$1(
3773
- `There is no suitable adapter to dispatch the request ` + s,
3774
- "ERR_NOT_SUPPORT"
3775
- );
3776
- }
3777
- return adapter;
3778
- },
3779
- adapters: knownAdapters
3780
- };
3781
- function throwIfCancellationRequested(config) {
3782
- if (config.cancelToken) {
3783
- config.cancelToken.throwIfRequested();
3784
- }
3785
- if (config.signal && config.signal.aborted) {
3786
- throw new CanceledError$1(null, config);
3787
- }
3788
- }
3789
- function dispatchRequest(config) {
3790
- throwIfCancellationRequested(config);
3791
- config.headers = AxiosHeaders$1.from(config.headers);
3792
- config.data = transformData.call(
3793
- config,
3794
- config.transformRequest
3795
- );
3796
- if (["post", "put", "patch"].indexOf(config.method) !== -1) {
3797
- config.headers.setContentType("application/x-www-form-urlencoded", false);
3798
- }
3799
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
3800
- return adapter(config).then(function onAdapterResolution(response) {
3801
- throwIfCancellationRequested(config);
3802
- response.data = transformData.call(
3803
- config,
3804
- config.transformResponse,
3805
- response
3806
- );
3807
- response.headers = AxiosHeaders$1.from(response.headers);
3808
- return response;
3809
- }, function onAdapterRejection(reason) {
3810
- if (!isCancel$1(reason)) {
3811
- throwIfCancellationRequested(config);
3812
- if (reason && reason.response) {
3813
- reason.response.data = transformData.call(
3814
- config,
3815
- config.transformResponse,
3816
- reason.response
3817
- );
3818
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3819
- }
3820
- }
3821
- return Promise.reject(reason);
3822
- });
3823
- }
3824
- const VERSION$1 = "1.10.0";
3825
- const validators$1 = {};
3826
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
3827
- validators$1[type] = function validator2(thing) {
3828
- return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
3829
- };
3830
- });
3831
- const deprecatedWarnings = {};
3832
- validators$1.transitional = function transitional(validator2, version, message) {
3833
- function formatMessage(opt, desc) {
3834
- return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
3835
- }
3836
- return (value, opt, opts) => {
3837
- if (validator2 === false) {
3838
- throw new AxiosError$1(
3839
- formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
3840
- AxiosError$1.ERR_DEPRECATED
3841
- );
3842
- }
3843
- if (version && !deprecatedWarnings[opt]) {
3844
- deprecatedWarnings[opt] = true;
3845
- console.warn(
3846
- formatMessage(
3847
- opt,
3848
- " has been deprecated since v" + version + " and will be removed in the near future"
3849
- )
3850
- );
3851
- }
3852
- return validator2 ? validator2(value, opt, opts) : true;
3853
- };
3854
- };
3855
- validators$1.spelling = function spelling(correctSpelling) {
3856
- return (value, opt) => {
3857
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
3858
- return true;
3859
- };
3860
- };
3861
- function assertOptions(options, schema, allowUnknown) {
3862
- if (typeof options !== "object") {
3863
- throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
3864
- }
3865
- const keys = Object.keys(options);
3866
- let i = keys.length;
3867
- while (i-- > 0) {
3868
- const opt = keys[i];
3869
- const validator2 = schema[opt];
3870
- if (validator2) {
3871
- const value = options[opt];
3872
- const result = value === void 0 || validator2(value, opt, options);
3873
- if (result !== true) {
3874
- throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3875
- }
3876
- continue;
3877
- }
3878
- if (allowUnknown !== true) {
3879
- throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
3880
- }
3881
- }
3882
- }
3883
- const validator = {
3884
- assertOptions,
3885
- validators: validators$1
3886
- };
3887
- const validators = validator.validators;
3888
- let Axios$1 = class Axios {
3889
- constructor(instanceConfig) {
3890
- this.defaults = instanceConfig || {};
3891
- this.interceptors = {
3892
- request: new InterceptorManager(),
3893
- response: new InterceptorManager()
3894
- };
3895
- }
3896
- /**
3897
- * Dispatch a request
3898
- *
3899
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3900
- * @param {?Object} config
3901
- *
3902
- * @returns {Promise} The Promise to be fulfilled
3903
- */
3904
- async request(configOrUrl, config) {
3905
- try {
3906
- return await this._request(configOrUrl, config);
3907
- } catch (err) {
3908
- if (err instanceof Error) {
3909
- let dummy = {};
3910
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3911
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
3912
- try {
3913
- if (!err.stack) {
3914
- err.stack = stack;
3915
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
3916
- err.stack += "\n" + stack;
3917
- }
3918
- } catch (e) {
3919
- }
3920
- }
3921
- throw err;
3922
- }
3923
- }
3924
- _request(configOrUrl, config) {
3925
- if (typeof configOrUrl === "string") {
3926
- config = config || {};
3927
- config.url = configOrUrl;
3928
- } else {
3929
- config = configOrUrl || {};
3930
- }
3931
- config = mergeConfig$1(this.defaults, config);
3932
- const { transitional, paramsSerializer, headers } = config;
3933
- if (transitional !== void 0) {
3934
- validator.assertOptions(transitional, {
3935
- silentJSONParsing: validators.transitional(validators.boolean),
3936
- forcedJSONParsing: validators.transitional(validators.boolean),
3937
- clarifyTimeoutError: validators.transitional(validators.boolean)
3938
- }, false);
3939
- }
3940
- if (paramsSerializer != null) {
3941
- if (utils$1.isFunction(paramsSerializer)) {
3942
- config.paramsSerializer = {
3943
- serialize: paramsSerializer
3944
- };
3945
- } else {
3946
- validator.assertOptions(paramsSerializer, {
3947
- encode: validators.function,
3948
- serialize: validators.function
3949
- }, true);
3950
- }
3951
- }
3952
- if (config.allowAbsoluteUrls !== void 0) ;
3953
- else if (this.defaults.allowAbsoluteUrls !== void 0) {
3954
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3955
- } else {
3956
- config.allowAbsoluteUrls = true;
3957
- }
3958
- validator.assertOptions(config, {
3959
- baseUrl: validators.spelling("baseURL"),
3960
- withXsrfToken: validators.spelling("withXSRFToken")
3961
- }, true);
3962
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
3963
- let contextHeaders = headers && utils$1.merge(
3964
- headers.common,
3965
- headers[config.method]
3966
- );
3967
- headers && utils$1.forEach(
3968
- ["delete", "get", "head", "post", "put", "patch", "common"],
3969
- (method) => {
3970
- delete headers[method];
3971
- }
3972
- );
3973
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3974
- const requestInterceptorChain = [];
3975
- let synchronousRequestInterceptors = true;
3976
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3977
- if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
3978
- return;
3979
- }
3980
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3981
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3982
- });
3983
- const responseInterceptorChain = [];
3984
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3985
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3986
- });
3987
- let promise;
3988
- let i = 0;
3989
- let len;
3990
- if (!synchronousRequestInterceptors) {
3991
- const chain = [dispatchRequest.bind(this), void 0];
3992
- chain.unshift.apply(chain, requestInterceptorChain);
3993
- chain.push.apply(chain, responseInterceptorChain);
3994
- len = chain.length;
3995
- promise = Promise.resolve(config);
3996
- while (i < len) {
3997
- promise = promise.then(chain[i++], chain[i++]);
3998
- }
3999
- return promise;
4000
- }
4001
- len = requestInterceptorChain.length;
4002
- let newConfig = config;
4003
- i = 0;
4004
- while (i < len) {
4005
- const onFulfilled = requestInterceptorChain[i++];
4006
- const onRejected = requestInterceptorChain[i++];
4007
- try {
4008
- newConfig = onFulfilled(newConfig);
4009
- } catch (error) {
4010
- onRejected.call(this, error);
4011
- break;
4012
- }
4013
- }
4014
- try {
4015
- promise = dispatchRequest.call(this, newConfig);
4016
- } catch (error) {
4017
- return Promise.reject(error);
4018
- }
4019
- i = 0;
4020
- len = responseInterceptorChain.length;
4021
- while (i < len) {
4022
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
4023
- }
4024
- return promise;
4025
- }
4026
- getUri(config) {
4027
- config = mergeConfig$1(this.defaults, config);
4028
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4029
- return buildURL(fullPath, config.params, config.paramsSerializer);
4030
- }
4031
- };
4032
- utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
4033
- Axios$1.prototype[method] = function(url, config) {
4034
- return this.request(mergeConfig$1(config || {}, {
4035
- method,
4036
- url,
4037
- data: (config || {}).data
4038
- }));
4039
- };
4040
- });
4041
- utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
4042
- function generateHTTPMethod(isForm) {
4043
- return function httpMethod(url, data, config) {
4044
- return this.request(mergeConfig$1(config || {}, {
4045
- method,
4046
- headers: isForm ? {
4047
- "Content-Type": "multipart/form-data"
4048
- } : {},
4049
- url,
4050
- data
4051
- }));
4052
- };
4053
- }
4054
- Axios$1.prototype[method] = generateHTTPMethod();
4055
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
4056
- });
4057
- let CancelToken$1 = class CancelToken2 {
4058
- constructor(executor) {
4059
- if (typeof executor !== "function") {
4060
- throw new TypeError("executor must be a function.");
4061
- }
4062
- let resolvePromise;
4063
- this.promise = new Promise(function promiseExecutor(resolve) {
4064
- resolvePromise = resolve;
4065
- });
4066
- const token = this;
4067
- this.promise.then((cancel) => {
4068
- if (!token._listeners) return;
4069
- let i = token._listeners.length;
4070
- while (i-- > 0) {
4071
- token._listeners[i](cancel);
4072
- }
4073
- token._listeners = null;
4074
- });
4075
- this.promise.then = (onfulfilled) => {
4076
- let _resolve;
4077
- const promise = new Promise((resolve) => {
4078
- token.subscribe(resolve);
4079
- _resolve = resolve;
4080
- }).then(onfulfilled);
4081
- promise.cancel = function reject() {
4082
- token.unsubscribe(_resolve);
4083
- };
4084
- return promise;
4085
- };
4086
- executor(function cancel(message, config, request) {
4087
- if (token.reason) {
4088
- return;
4089
- }
4090
- token.reason = new CanceledError$1(message, config, request);
4091
- resolvePromise(token.reason);
4092
- });
4093
- }
4094
- /**
4095
- * Throws a `CanceledError` if cancellation has been requested.
4096
- */
4097
- throwIfRequested() {
4098
- if (this.reason) {
4099
- throw this.reason;
4100
- }
4101
- }
4102
- /**
4103
- * Subscribe to the cancel signal
4104
- */
4105
- subscribe(listener) {
4106
- if (this.reason) {
4107
- listener(this.reason);
4108
- return;
4109
- }
4110
- if (this._listeners) {
4111
- this._listeners.push(listener);
4112
- } else {
4113
- this._listeners = [listener];
4114
- }
4115
- }
4116
- /**
4117
- * Unsubscribe from the cancel signal
4118
- */
4119
- unsubscribe(listener) {
4120
- if (!this._listeners) {
4121
- return;
4122
- }
4123
- const index = this._listeners.indexOf(listener);
4124
- if (index !== -1) {
4125
- this._listeners.splice(index, 1);
4126
- }
4127
- }
4128
- toAbortSignal() {
4129
- const controller = new AbortController();
4130
- const abort = (err) => {
4131
- controller.abort(err);
4132
- };
4133
- this.subscribe(abort);
4134
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
4135
- return controller.signal;
4136
- }
4137
- /**
4138
- * Returns an object that contains a new `CancelToken` and a function that, when called,
4139
- * cancels the `CancelToken`.
4140
- */
4141
- static source() {
4142
- let cancel;
4143
- const token = new CancelToken2(function executor(c) {
4144
- cancel = c;
4145
- });
4146
- return {
4147
- token,
4148
- cancel
4149
- };
4150
- }
4151
- };
4152
- function spread$1(callback) {
4153
- return function wrap(arr) {
4154
- return callback.apply(null, arr);
4155
- };
4156
- }
4157
- function isAxiosError$1(payload) {
4158
- return utils$1.isObject(payload) && payload.isAxiosError === true;
4159
- }
4160
- const HttpStatusCode$1 = {
4161
- Continue: 100,
4162
- SwitchingProtocols: 101,
4163
- Processing: 102,
4164
- EarlyHints: 103,
4165
- Ok: 200,
4166
- Created: 201,
4167
- Accepted: 202,
4168
- NonAuthoritativeInformation: 203,
4169
- NoContent: 204,
4170
- ResetContent: 205,
4171
- PartialContent: 206,
4172
- MultiStatus: 207,
4173
- AlreadyReported: 208,
4174
- ImUsed: 226,
4175
- MultipleChoices: 300,
4176
- MovedPermanently: 301,
4177
- Found: 302,
4178
- SeeOther: 303,
4179
- NotModified: 304,
4180
- UseProxy: 305,
4181
- Unused: 306,
4182
- TemporaryRedirect: 307,
4183
- PermanentRedirect: 308,
4184
- BadRequest: 400,
4185
- Unauthorized: 401,
4186
- PaymentRequired: 402,
4187
- Forbidden: 403,
4188
- NotFound: 404,
4189
- MethodNotAllowed: 405,
4190
- NotAcceptable: 406,
4191
- ProxyAuthenticationRequired: 407,
4192
- RequestTimeout: 408,
4193
- Conflict: 409,
4194
- Gone: 410,
4195
- LengthRequired: 411,
4196
- PreconditionFailed: 412,
4197
- PayloadTooLarge: 413,
4198
- UriTooLong: 414,
4199
- UnsupportedMediaType: 415,
4200
- RangeNotSatisfiable: 416,
4201
- ExpectationFailed: 417,
4202
- ImATeapot: 418,
4203
- MisdirectedRequest: 421,
4204
- UnprocessableEntity: 422,
4205
- Locked: 423,
4206
- FailedDependency: 424,
4207
- TooEarly: 425,
4208
- UpgradeRequired: 426,
4209
- PreconditionRequired: 428,
4210
- TooManyRequests: 429,
4211
- RequestHeaderFieldsTooLarge: 431,
4212
- UnavailableForLegalReasons: 451,
4213
- InternalServerError: 500,
4214
- NotImplemented: 501,
4215
- BadGateway: 502,
4216
- ServiceUnavailable: 503,
4217
- GatewayTimeout: 504,
4218
- HttpVersionNotSupported: 505,
4219
- VariantAlsoNegotiates: 506,
4220
- InsufficientStorage: 507,
4221
- LoopDetected: 508,
4222
- NotExtended: 510,
4223
- NetworkAuthenticationRequired: 511
4224
- };
4225
- Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
4226
- HttpStatusCode$1[value] = key;
4227
- });
4228
- function createInstance(defaultConfig) {
4229
- const context = new Axios$1(defaultConfig);
4230
- const instance = bind(Axios$1.prototype.request, context);
4231
- utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
4232
- utils$1.extend(instance, context, null, { allOwnKeys: true });
4233
- instance.create = function create(instanceConfig) {
4234
- return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
4235
- };
4236
- return instance;
4237
- }
4238
- const axios = createInstance(defaults);
4239
- axios.Axios = Axios$1;
4240
- axios.CanceledError = CanceledError$1;
4241
- axios.CancelToken = CancelToken$1;
4242
- axios.isCancel = isCancel$1;
4243
- axios.VERSION = VERSION$1;
4244
- axios.toFormData = toFormData$1;
4245
- axios.AxiosError = AxiosError$1;
4246
- axios.Cancel = axios.CanceledError;
4247
- axios.all = function all2(promises) {
4248
- return Promise.all(promises);
4249
- };
4250
- axios.spread = spread$1;
4251
- axios.isAxiosError = isAxiosError$1;
4252
- axios.mergeConfig = mergeConfig$1;
4253
- axios.AxiosHeaders = AxiosHeaders$1;
4254
- axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4255
- axios.getAdapter = adapters.getAdapter;
4256
- axios.HttpStatusCode = HttpStatusCode$1;
4257
- axios.default = axios;
4258
- const {
4259
- Axios,
4260
- AxiosError,
4261
- CanceledError,
4262
- isCancel,
4263
- CancelToken,
4264
- VERSION,
4265
- all,
4266
- Cancel,
4267
- isAxiosError,
4268
- spread,
4269
- toFormData,
4270
- AxiosHeaders,
4271
- HttpStatusCode,
4272
- formToJSON,
4273
- getAdapter,
4274
- mergeConfig
4275
- } = axios;
4276
- function sleep(ms) {
4277
- return new Promise((resolve) => setTimeout(resolve, ms));
4278
- }
4279
- function getJitteredDelay(base, jitter) {
4280
- const random = Math.floor(Math.random() * jitter);
4281
- return base + random;
4282
- }
4283
- function createRetryAxiosClient(retryConfig) {
4284
- const {
4285
- maxRetries = 3,
4286
- retryDelayMs = 300,
4287
- retryJitterMs = 100,
4288
- retryMethods = ["get", "head", "put", "delete", "options"],
4289
- // post, patch
4290
- retryStatusCodes = [408, 429, 500, 502, 503, 504],
4291
- retryErrorCodes = [
4292
- "ECONNRESET",
4293
- "ETIMEDOUT",
4294
- "EAI_AGAIN",
4295
- "ECONNREFUSED",
4296
- "ENOTFOUND",
4297
- "EHOSTUNREACH",
4298
- "EPIPE"
4299
- ],
4300
- maxRetryDurationMs = 1e4,
4301
- onRetryAttempt,
4302
- stsAxiosConfig
4303
- } = retryConfig || {};
4304
- const instance = axios.create();
4305
- instance.interceptors.request.use((config) => {
4306
- const now = Date.now();
4307
- config.metadata = {
4308
- startTime: now,
4309
- __retryCount: 0
4310
- };
4311
- if (stsAxiosConfig) {
4312
- Object.assign(config, stsAxiosConfig.config);
4313
- }
4314
- return config;
4315
- });
4316
- instance.interceptors.response.use(
4317
- (response) => response,
4318
- async (error) => {
4319
- var _a;
4320
- const config = error.config;
4321
- if (!config || !config.method || !config.metadata) {
4322
- return Promise.reject(error);
4323
- }
4324
- const now = Date.now();
4325
- const elapsed = now - config.metadata.startTime;
4326
- const method = config.method.toLowerCase();
4327
- const status = (_a = error.response) == null ? void 0 : _a.status;
4328
- const code = error.code;
4329
- const isRetryable = retryMethods.includes(method) && (retryErrorCodes.includes(code || "") || retryStatusCodes.includes(status || 0));
4330
- if (config.metadata.__retryCount < maxRetries && isRetryable && elapsed < maxRetryDurationMs) {
4331
- config.metadata.__retryCount += 1;
4332
- const delayBase = retryDelayMs * Math.pow(2, config.metadata.__retryCount - 1);
4333
- const jitteredDelay = getJitteredDelay(delayBase, retryJitterMs);
4334
- if (onRetryAttempt) {
4335
- onRetryAttempt(config.metadata.__retryCount, error, jitteredDelay);
4336
- }
4337
- await sleep(jitteredDelay);
4338
- return instance(config);
4339
- }
4340
- return Promise.reject(error);
4341
- }
4342
- );
4343
- return instance;
4344
- }
4345
1891
  exports2.AddSchema = AddSchema;
4346
1892
  exports2.AgentManager = AgentManager;
4347
1893
  exports2.CheckValidChar = CheckValidChar;
@@ -4357,7 +1903,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4357
1903
  exports2.Sleep = Sleep;
4358
1904
  exports2.Validate = Validate;
4359
1905
  exports2.compareParameterTypes = compareParameterTypes;
4360
- exports2.createRetryAxiosClient = createRetryAxiosClient;
4361
1906
  exports2.defaultLogger = defaultLogger;
4362
1907
  exports2.edbaction = edbaction;
4363
1908
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });