@xchainjs/xchain-dash 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/index.esm.js +124 -102
  2. package/lib/index.js +123 -101
  3. package/package.json +5 -5
package/lib/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ExplorerProvider, Network, TxType, FeeOption, checkFeeBounds } from '@xchainjs/xchain-client';
2
- import { AssetType, baseAmount, assetToBase, assetAmount } from '@xchainjs/xchain-util';
2
+ import { AssetType, assetToBase, assetAmount, baseAmount } from '@xchainjs/xchain-util';
3
3
  import { BlockcypherProvider, BlockcypherNetwork, BitgoProvider } from '@xchainjs/xchain-utxo-providers';
4
4
  import dashcore from '@dashevo/dashcore-lib';
5
5
  import { toBitcoinJS, Client as Client$1, UtxoTransactionValidator, UtxoError } from '@xchainjs/xchain-utxo';
@@ -995,7 +995,7 @@ var utils$1 = {
995
995
  isIterable,
996
996
  };
997
997
 
998
- class AxiosError extends Error {
998
+ let AxiosError$1 = class AxiosError extends Error {
999
999
  static from(error, code, config, request, response, customProps) {
1000
1000
  const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1001
1001
  axiosError.cause = error;
@@ -1047,21 +1047,21 @@ class AxiosError extends Error {
1047
1047
  status: this.status,
1048
1048
  };
1049
1049
  }
1050
- }
1050
+ };
1051
1051
 
1052
1052
  // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1053
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1054
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1055
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1056
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1057
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1058
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1059
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1060
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1061
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1062
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1063
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1064
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1053
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1054
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1055
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
1056
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
1057
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
1058
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1059
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
1060
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1061
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1062
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
1063
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1064
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
1065
1065
 
1066
1066
  // eslint-disable-next-line strict
1067
1067
  var httpAdapter = null;
@@ -1144,7 +1144,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
1144
1144
  *
1145
1145
  * @returns
1146
1146
  */
1147
- function toFormData(obj, formData, options) {
1147
+ function toFormData$1(obj, formData, options) {
1148
1148
  if (!utils$1.isObject(obj)) {
1149
1149
  throw new TypeError('target must be an object');
1150
1150
  }
@@ -1186,7 +1186,7 @@ function toFormData(obj, formData, options) {
1186
1186
  }
1187
1187
 
1188
1188
  if (!useBlob && utils$1.isBlob(value)) {
1189
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1189
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
1190
1190
  }
1191
1191
 
1192
1192
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
@@ -1315,7 +1315,7 @@ function encode$1(str) {
1315
1315
  function AxiosURLSearchParams(params, options) {
1316
1316
  this._pairs = [];
1317
1317
 
1318
- params && toFormData(params, this, options);
1318
+ params && toFormData$1(params, this, options);
1319
1319
  }
1320
1320
 
1321
1321
  const prototype = AxiosURLSearchParams.prototype;
@@ -1543,7 +1543,7 @@ var platform = {
1543
1543
  };
1544
1544
 
1545
1545
  function toURLEncodedForm(data, options) {
1546
- return toFormData(data, new platform.classes.URLSearchParams(), {
1546
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
1547
1547
  visitor: function(value, key, path, helpers) {
1548
1548
  if (platform.isNode && utils$1.isBuffer(value)) {
1549
1549
  this.append(key, value.toString('base64'));
@@ -1668,7 +1668,7 @@ function stringifySafely(rawValue, parser, encoder) {
1668
1668
  }
1669
1669
  }
1670
1670
 
1671
- return (0, JSON.stringify)(rawValue);
1671
+ return (encoder || JSON.stringify)(rawValue);
1672
1672
  }
1673
1673
 
1674
1674
  const defaults = {
@@ -1719,7 +1719,7 @@ const defaults = {
1719
1719
  if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1720
1720
  const _FormData = this.env && this.env.FormData;
1721
1721
 
1722
- return toFormData(
1722
+ return toFormData$1(
1723
1723
  isFileList ? {'files[]': data} : data,
1724
1724
  _FormData && new _FormData(),
1725
1725
  this.formSerializer
@@ -1753,7 +1753,7 @@ const defaults = {
1753
1753
  } catch (e) {
1754
1754
  if (strictJSONParsing) {
1755
1755
  if (e.name === 'SyntaxError') {
1756
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1756
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1757
1757
  }
1758
1758
  throw e;
1759
1759
  }
@@ -1916,7 +1916,7 @@ function buildAccessors(obj, header) {
1916
1916
  });
1917
1917
  }
1918
1918
 
1919
- class AxiosHeaders {
1919
+ let AxiosHeaders$1 = class AxiosHeaders {
1920
1920
  constructor(headers) {
1921
1921
  headers && this.set(headers);
1922
1922
  }
@@ -2139,12 +2139,12 @@ class AxiosHeaders {
2139
2139
 
2140
2140
  return this;
2141
2141
  }
2142
- }
2142
+ };
2143
2143
 
2144
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2144
+ AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2145
2145
 
2146
2146
  // reserved names hotfix
2147
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
2147
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
2148
2148
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2149
2149
  return {
2150
2150
  get: () => value,
@@ -2154,7 +2154,7 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
2154
2154
  }
2155
2155
  });
2156
2156
 
2157
- utils$1.freezeMethods(AxiosHeaders);
2157
+ utils$1.freezeMethods(AxiosHeaders$1);
2158
2158
 
2159
2159
  /**
2160
2160
  * Transform the data for a request or a response
@@ -2167,7 +2167,7 @@ utils$1.freezeMethods(AxiosHeaders);
2167
2167
  function transformData(fns, response) {
2168
2168
  const config = this || defaults;
2169
2169
  const context = response || config;
2170
- const headers = AxiosHeaders.from(context.headers);
2170
+ const headers = AxiosHeaders$1.from(context.headers);
2171
2171
  let data = context.data;
2172
2172
 
2173
2173
  utils$1.forEach(fns, function transform(fn) {
@@ -2179,11 +2179,11 @@ function transformData(fns, response) {
2179
2179
  return data;
2180
2180
  }
2181
2181
 
2182
- function isCancel(value) {
2182
+ function isCancel$1(value) {
2183
2183
  return !!(value && value.__CANCEL__);
2184
2184
  }
2185
2185
 
2186
- class CanceledError extends AxiosError {
2186
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
2187
2187
  /**
2188
2188
  * A `CanceledError` is an object that is thrown when an operation is canceled.
2189
2189
  *
@@ -2194,11 +2194,11 @@ class CanceledError extends AxiosError {
2194
2194
  * @returns {CanceledError} The created error.
2195
2195
  */
2196
2196
  constructor(message, config, request) {
2197
- super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2197
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
2198
2198
  this.name = 'CanceledError';
2199
2199
  this.__CANCEL__ = true;
2200
2200
  }
2201
- }
2201
+ };
2202
2202
 
2203
2203
  /**
2204
2204
  * Resolve or reject a Promise based on response status.
@@ -2214,9 +2214,9 @@ function settle(resolve, reject, response) {
2214
2214
  if (!response.status || !validateStatus || validateStatus(response.status)) {
2215
2215
  resolve(response);
2216
2216
  } else {
2217
- reject(new AxiosError(
2217
+ reject(new AxiosError$1(
2218
2218
  'Request failed with status code ' + response.status,
2219
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2219
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2220
2220
  response.config,
2221
2221
  response.request,
2222
2222
  response
@@ -2479,7 +2479,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2479
2479
  }
2480
2480
 
2481
2481
  const headersToObject = (thing) =>
2482
- thing instanceof AxiosHeaders ? { ...thing } : thing;
2482
+ thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2483
2483
 
2484
2484
  /**
2485
2485
  * Config-specific merge-function which creates a new config-object
@@ -2490,7 +2490,7 @@ const headersToObject = (thing) =>
2490
2490
  *
2491
2491
  * @returns {Object} New object resulting from merging config2 to config1
2492
2492
  */
2493
- function mergeConfig(config1, config2) {
2493
+ function mergeConfig$1(config1, config2) {
2494
2494
  // eslint-disable-next-line no-param-reassign
2495
2495
  config2 = config2 || {};
2496
2496
  const config = {};
@@ -2594,11 +2594,11 @@ function mergeConfig(config1, config2) {
2594
2594
  }
2595
2595
 
2596
2596
  var resolveConfig = (config) => {
2597
- const newConfig = mergeConfig({}, config);
2597
+ const newConfig = mergeConfig$1({}, config);
2598
2598
 
2599
2599
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2600
2600
 
2601
- newConfig.headers = headers = AxiosHeaders.from(headers);
2601
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
2602
2602
 
2603
2603
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2604
2604
 
@@ -2651,7 +2651,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2651
2651
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2652
2652
  const _config = resolveConfig(config);
2653
2653
  let requestData = _config.data;
2654
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
2654
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2655
2655
  let {responseType, onUploadProgress, onDownloadProgress} = _config;
2656
2656
  let onCanceled;
2657
2657
  let uploadThrottled, downloadThrottled;
@@ -2678,7 +2678,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2678
2678
  return;
2679
2679
  }
2680
2680
  // Prepare the response
2681
- const responseHeaders = AxiosHeaders.from(
2681
+ const responseHeaders = AxiosHeaders$1.from(
2682
2682
  'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2683
2683
  );
2684
2684
  const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
@@ -2733,7 +2733,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2733
2733
  return;
2734
2734
  }
2735
2735
 
2736
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2736
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
2737
2737
 
2738
2738
  // Clean up request
2739
2739
  request = null;
@@ -2745,7 +2745,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2745
2745
  // (message may be empty; when present, surface it)
2746
2746
  // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2747
2747
  const msg = event && event.message ? event.message : 'Network Error';
2748
- const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
2748
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
2749
2749
  // attach the underlying event for consumers who want details
2750
2750
  err.event = event || null;
2751
2751
  reject(err);
@@ -2759,9 +2759,9 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2759
2759
  if (_config.timeoutErrorMessage) {
2760
2760
  timeoutErrorMessage = _config.timeoutErrorMessage;
2761
2761
  }
2762
- reject(new AxiosError(
2762
+ reject(new AxiosError$1(
2763
2763
  timeoutErrorMessage,
2764
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2764
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2765
2765
  config,
2766
2766
  request));
2767
2767
 
@@ -2811,7 +2811,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2811
2811
  if (!request) {
2812
2812
  return;
2813
2813
  }
2814
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2814
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2815
2815
  request.abort();
2816
2816
  request = null;
2817
2817
  };
@@ -2825,7 +2825,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2825
2825
  const protocol = parseProtocol(_config.url);
2826
2826
 
2827
2827
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
2828
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2828
+ reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
2829
2829
  return;
2830
2830
  }
2831
2831
 
@@ -2848,13 +2848,13 @@ const composeSignals = (signals, timeout) => {
2848
2848
  aborted = true;
2849
2849
  unsubscribe();
2850
2850
  const err = reason instanceof Error ? reason : this.reason;
2851
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2851
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
2852
2852
  }
2853
2853
  };
2854
2854
 
2855
2855
  let timer = timeout && setTimeout(() => {
2856
2856
  timer = null;
2857
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
2857
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
2858
2858
  }, timeout);
2859
2859
 
2860
2860
  const unsubscribe = () => {
@@ -3038,7 +3038,7 @@ const factory = (env) => {
3038
3038
  return method.call(res);
3039
3039
  }
3040
3040
 
3041
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
3041
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
3042
3042
  });
3043
3043
  });
3044
3044
  })());
@@ -3192,7 +3192,7 @@ const factory = (env) => {
3192
3192
  return await new Promise((resolve, reject) => {
3193
3193
  settle(resolve, reject, {
3194
3194
  data: responseData,
3195
- headers: AxiosHeaders.from(response.headers),
3195
+ headers: AxiosHeaders$1.from(response.headers),
3196
3196
  status: response.status,
3197
3197
  statusText: response.statusText,
3198
3198
  config,
@@ -3204,14 +3204,14 @@ const factory = (env) => {
3204
3204
 
3205
3205
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3206
3206
  throw Object.assign(
3207
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response),
3207
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, err && err.response),
3208
3208
  {
3209
3209
  cause: err.cause || err
3210
3210
  }
3211
3211
  )
3212
3212
  }
3213
3213
 
3214
- throw AxiosError.from(err, err && err.code, config, request, err && err.response);
3214
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
3215
3215
  }
3216
3216
  }
3217
3217
  };
@@ -3297,7 +3297,7 @@ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter ===
3297
3297
  * @throws {AxiosError} If no suitable adapter is available
3298
3298
  * @returns {Function} The resolved adapter function
3299
3299
  */
3300
- function getAdapter(adapters, config) {
3300
+ function getAdapter$1(adapters, config) {
3301
3301
  adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3302
3302
 
3303
3303
  const { length } = adapters;
@@ -3316,7 +3316,7 @@ function getAdapter(adapters, config) {
3316
3316
  adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3317
3317
 
3318
3318
  if (adapter === undefined) {
3319
- throw new AxiosError(`Unknown adapter '${id}'`);
3319
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
3320
3320
  }
3321
3321
  }
3322
3322
 
@@ -3337,7 +3337,7 @@ function getAdapter(adapters, config) {
3337
3337
  (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3338
3338
  'as no adapter specified';
3339
3339
 
3340
- throw new AxiosError(
3340
+ throw new AxiosError$1(
3341
3341
  `There is no suitable adapter to dispatch the request ` + s,
3342
3342
  'ERR_NOT_SUPPORT'
3343
3343
  );
@@ -3354,7 +3354,7 @@ var adapters = {
3354
3354
  * Resolve an adapter from a list of adapter names or functions.
3355
3355
  * @type {Function}
3356
3356
  */
3357
- getAdapter,
3357
+ getAdapter: getAdapter$1,
3358
3358
 
3359
3359
  /**
3360
3360
  * Exposes all known adapters
@@ -3376,7 +3376,7 @@ function throwIfCancellationRequested(config) {
3376
3376
  }
3377
3377
 
3378
3378
  if (config.signal && config.signal.aborted) {
3379
- throw new CanceledError(null, config);
3379
+ throw new CanceledError$1(null, config);
3380
3380
  }
3381
3381
  }
3382
3382
 
@@ -3390,7 +3390,7 @@ function throwIfCancellationRequested(config) {
3390
3390
  function dispatchRequest(config) {
3391
3391
  throwIfCancellationRequested(config);
3392
3392
 
3393
- config.headers = AxiosHeaders.from(config.headers);
3393
+ config.headers = AxiosHeaders$1.from(config.headers);
3394
3394
 
3395
3395
  // Transform request data
3396
3396
  config.data = transformData.call(
@@ -3414,11 +3414,11 @@ function dispatchRequest(config) {
3414
3414
  response
3415
3415
  );
3416
3416
 
3417
- response.headers = AxiosHeaders.from(response.headers);
3417
+ response.headers = AxiosHeaders$1.from(response.headers);
3418
3418
 
3419
3419
  return response;
3420
3420
  }, function onAdapterRejection(reason) {
3421
- if (!isCancel(reason)) {
3421
+ if (!isCancel$1(reason)) {
3422
3422
  throwIfCancellationRequested(config);
3423
3423
 
3424
3424
  // Transform response data
@@ -3428,7 +3428,7 @@ function dispatchRequest(config) {
3428
3428
  config.transformResponse,
3429
3429
  reason.response
3430
3430
  );
3431
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
3431
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3432
3432
  }
3433
3433
  }
3434
3434
 
@@ -3436,7 +3436,7 @@ function dispatchRequest(config) {
3436
3436
  });
3437
3437
  }
3438
3438
 
3439
- const VERSION = "1.13.5";
3439
+ const VERSION$1 = "1.13.5";
3440
3440
 
3441
3441
  const validators$1 = {};
3442
3442
 
@@ -3460,15 +3460,15 @@ const deprecatedWarnings = {};
3460
3460
  */
3461
3461
  validators$1.transitional = function transitional(validator, version, message) {
3462
3462
  function formatMessage(opt, desc) {
3463
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3463
+ return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3464
3464
  }
3465
3465
 
3466
3466
  // eslint-disable-next-line func-names
3467
3467
  return (value, opt, opts) => {
3468
3468
  if (validator === false) {
3469
- throw new AxiosError(
3469
+ throw new AxiosError$1(
3470
3470
  formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3471
- AxiosError.ERR_DEPRECATED
3471
+ AxiosError$1.ERR_DEPRECATED
3472
3472
  );
3473
3473
  }
3474
3474
 
@@ -3507,7 +3507,7 @@ validators$1.spelling = function spelling(correctSpelling) {
3507
3507
 
3508
3508
  function assertOptions(options, schema, allowUnknown) {
3509
3509
  if (typeof options !== 'object') {
3510
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3510
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
3511
3511
  }
3512
3512
  const keys = Object.keys(options);
3513
3513
  let i = keys.length;
@@ -3518,12 +3518,12 @@ function assertOptions(options, schema, allowUnknown) {
3518
3518
  const value = options[opt];
3519
3519
  const result = value === undefined || validator(value, opt, options);
3520
3520
  if (result !== true) {
3521
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3521
+ throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3522
3522
  }
3523
3523
  continue;
3524
3524
  }
3525
3525
  if (allowUnknown !== true) {
3526
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3526
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
3527
3527
  }
3528
3528
  }
3529
3529
  }
@@ -3542,7 +3542,7 @@ const validators = validator.validators;
3542
3542
  *
3543
3543
  * @return {Axios} A new instance of Axios
3544
3544
  */
3545
- class Axios {
3545
+ let Axios$1 = class Axios {
3546
3546
  constructor(instanceConfig) {
3547
3547
  this.defaults = instanceConfig || {};
3548
3548
  this.interceptors = {
@@ -3596,7 +3596,7 @@ class Axios {
3596
3596
  config = configOrUrl || {};
3597
3597
  }
3598
3598
 
3599
- config = mergeConfig(this.defaults, config);
3599
+ config = mergeConfig$1(this.defaults, config);
3600
3600
 
3601
3601
  const {transitional, paramsSerializer, headers} = config;
3602
3602
 
@@ -3650,7 +3650,7 @@ class Axios {
3650
3650
  }
3651
3651
  );
3652
3652
 
3653
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
3653
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3654
3654
 
3655
3655
  // filter out skipped interceptors
3656
3656
  const requestInterceptorChain = [];
@@ -3728,17 +3728,17 @@ class Axios {
3728
3728
  }
3729
3729
 
3730
3730
  getUri(config) {
3731
- config = mergeConfig(this.defaults, config);
3731
+ config = mergeConfig$1(this.defaults, config);
3732
3732
  const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3733
3733
  return buildURL(fullPath, config.params, config.paramsSerializer);
3734
3734
  }
3735
- }
3735
+ };
3736
3736
 
3737
3737
  // Provide aliases for supported request methods
3738
3738
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3739
3739
  /*eslint func-names:0*/
3740
- Axios.prototype[method] = function(url, config) {
3741
- return this.request(mergeConfig(config || {}, {
3740
+ Axios$1.prototype[method] = function(url, config) {
3741
+ return this.request(mergeConfig$1(config || {}, {
3742
3742
  method,
3743
3743
  url,
3744
3744
  data: (config || {}).data
@@ -3751,7 +3751,7 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
3751
3751
 
3752
3752
  function generateHTTPMethod(isForm) {
3753
3753
  return function httpMethod(url, data, config) {
3754
- return this.request(mergeConfig(config || {}, {
3754
+ return this.request(mergeConfig$1(config || {}, {
3755
3755
  method,
3756
3756
  headers: isForm ? {
3757
3757
  'Content-Type': 'multipart/form-data'
@@ -3762,9 +3762,9 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
3762
3762
  };
3763
3763
  }
3764
3764
 
3765
- Axios.prototype[method] = generateHTTPMethod();
3765
+ Axios$1.prototype[method] = generateHTTPMethod();
3766
3766
 
3767
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3767
+ Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
3768
3768
  });
3769
3769
 
3770
3770
  /**
@@ -3774,7 +3774,7 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
3774
3774
  *
3775
3775
  * @returns {CancelToken}
3776
3776
  */
3777
- class CancelToken {
3777
+ let CancelToken$1 = class CancelToken {
3778
3778
  constructor(executor) {
3779
3779
  if (typeof executor !== 'function') {
3780
3780
  throw new TypeError('executor must be a function.');
@@ -3822,7 +3822,7 @@ class CancelToken {
3822
3822
  return;
3823
3823
  }
3824
3824
 
3825
- token.reason = new CanceledError(message, config, request);
3825
+ token.reason = new CanceledError$1(message, config, request);
3826
3826
  resolvePromise(token.reason);
3827
3827
  });
3828
3828
  }
@@ -3895,7 +3895,7 @@ class CancelToken {
3895
3895
  cancel
3896
3896
  };
3897
3897
  }
3898
- }
3898
+ };
3899
3899
 
3900
3900
  /**
3901
3901
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -3918,7 +3918,7 @@ class CancelToken {
3918
3918
  *
3919
3919
  * @returns {Function}
3920
3920
  */
3921
- function spread(callback) {
3921
+ function spread$1(callback) {
3922
3922
  return function wrap(arr) {
3923
3923
  return callback.apply(null, arr);
3924
3924
  };
@@ -3931,11 +3931,11 @@ function spread(callback) {
3931
3931
  *
3932
3932
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3933
3933
  */
3934
- function isAxiosError(payload) {
3934
+ function isAxiosError$1(payload) {
3935
3935
  return utils$1.isObject(payload) && (payload.isAxiosError === true);
3936
3936
  }
3937
3937
 
3938
- const HttpStatusCode = {
3938
+ const HttpStatusCode$1 = {
3939
3939
  Continue: 100,
3940
3940
  SwitchingProtocols: 101,
3941
3941
  Processing: 102,
@@ -4007,8 +4007,8 @@ const HttpStatusCode = {
4007
4007
  InvalidSslCertificate: 526,
4008
4008
  };
4009
4009
 
4010
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
4011
- HttpStatusCode[value] = key;
4010
+ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
4011
+ HttpStatusCode$1[value] = key;
4012
4012
  });
4013
4013
 
4014
4014
  /**
@@ -4019,18 +4019,18 @@ Object.entries(HttpStatusCode).forEach(([key, value]) => {
4019
4019
  * @returns {Axios} A new instance of Axios
4020
4020
  */
4021
4021
  function createInstance(defaultConfig) {
4022
- const context = new Axios(defaultConfig);
4023
- const instance = bind(Axios.prototype.request, context);
4022
+ const context = new Axios$1(defaultConfig);
4023
+ const instance = bind(Axios$1.prototype.request, context);
4024
4024
 
4025
4025
  // Copy axios.prototype to instance
4026
- utils$1.extend(instance, Axios.prototype, context, {allOwnKeys: true});
4026
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
4027
4027
 
4028
4028
  // Copy context to instance
4029
4029
  utils$1.extend(instance, context, null, {allOwnKeys: true});
4030
4030
 
4031
4031
  // Factory for creating new instances
4032
4032
  instance.create = function create(instanceConfig) {
4033
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
4033
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
4034
4034
  };
4035
4035
 
4036
4036
  return instance;
@@ -4040,17 +4040,17 @@ function createInstance(defaultConfig) {
4040
4040
  const axios = createInstance(defaults);
4041
4041
 
4042
4042
  // Expose Axios class to allow class inheritance
4043
- axios.Axios = Axios;
4043
+ axios.Axios = Axios$1;
4044
4044
 
4045
4045
  // Expose Cancel & CancelToken
4046
- axios.CanceledError = CanceledError;
4047
- axios.CancelToken = CancelToken;
4048
- axios.isCancel = isCancel;
4049
- axios.VERSION = VERSION;
4050
- axios.toFormData = toFormData;
4046
+ axios.CanceledError = CanceledError$1;
4047
+ axios.CancelToken = CancelToken$1;
4048
+ axios.isCancel = isCancel$1;
4049
+ axios.VERSION = VERSION$1;
4050
+ axios.toFormData = toFormData$1;
4051
4051
 
4052
4052
  // Expose AxiosError class
4053
- axios.AxiosError = AxiosError;
4053
+ axios.AxiosError = AxiosError$1;
4054
4054
 
4055
4055
  // alias for CanceledError for backward compatibility
4056
4056
  axios.Cancel = axios.CanceledError;
@@ -4060,24 +4060,46 @@ axios.all = function all(promises) {
4060
4060
  return Promise.all(promises);
4061
4061
  };
4062
4062
 
4063
- axios.spread = spread;
4063
+ axios.spread = spread$1;
4064
4064
 
4065
4065
  // Expose isAxiosError
4066
- axios.isAxiosError = isAxiosError;
4066
+ axios.isAxiosError = isAxiosError$1;
4067
4067
 
4068
4068
  // Expose mergeConfig
4069
- axios.mergeConfig = mergeConfig;
4069
+ axios.mergeConfig = mergeConfig$1;
4070
4070
 
4071
- axios.AxiosHeaders = AxiosHeaders;
4071
+ axios.AxiosHeaders = AxiosHeaders$1;
4072
4072
 
4073
4073
  axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4074
4074
 
4075
4075
  axios.getAdapter = adapters.getAdapter;
4076
4076
 
4077
- axios.HttpStatusCode = HttpStatusCode;
4077
+ axios.HttpStatusCode = HttpStatusCode$1;
4078
4078
 
4079
4079
  axios.default = axios;
4080
4080
 
4081
+ // This module is intended to unwrap Axios default export as named.
4082
+ // Keep top-level export same with static properties
4083
+ // so that it can keep same with es module or cjs
4084
+ const {
4085
+ Axios,
4086
+ AxiosError,
4087
+ CanceledError,
4088
+ isCancel,
4089
+ CancelToken,
4090
+ VERSION,
4091
+ all,
4092
+ Cancel,
4093
+ isAxiosError,
4094
+ spread,
4095
+ toFormData,
4096
+ AxiosHeaders,
4097
+ HttpStatusCode,
4098
+ formToJSON,
4099
+ getAdapter,
4100
+ mergeConfig
4101
+ } = axios;
4102
+
4081
4103
  /**
4082
4104
  * Function to generate the URL for the given network.
4083
4105
  *