jrs-react 1.1.0 → 1.1.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/build/index.es.js +455 -893
  2. package/build/index.js +456 -894
  3. package/package.json +2 -2
package/build/index.es.js CHANGED
@@ -1,16 +1,15 @@
1
- import require$$1 from 'util';
1
+ import require$$1, { TextEncoder } from 'util';
2
2
  import stream, { Readable } from 'stream';
3
3
  import require$$1$1 from 'path';
4
4
  import require$$3 from 'http';
5
5
  import require$$4 from 'https';
6
6
  import require$$0$1 from 'url';
7
7
  import require$$6 from 'fs';
8
- import crypto from 'crypto';
9
8
  import require$$4$1 from 'assert';
10
9
  import require$$1$2 from 'tty';
11
10
  import require$$0$2 from 'os';
12
11
  import zlib from 'zlib';
13
- import { EventEmitter } from 'events';
12
+ import EventEmitter from 'events';
14
13
 
15
14
  function getDefaultExportFromCjs (x) {
16
15
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -3034,8 +3033,6 @@ const isFormData = (thing) => {
3034
3033
  */
3035
3034
  const isURLSearchParams = kindOfTest('URLSearchParams');
3036
3035
 
3037
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
3038
-
3039
3036
  /**
3040
3037
  * Trim excess whitespace off the beginning and end of a string
3041
3038
  *
@@ -3424,7 +3421,28 @@ const toObjectSet = (arrayOrString, delimiter) => {
3424
3421
  const noop = () => {};
3425
3422
 
3426
3423
  const toFiniteNumber = (value, defaultValue) => {
3427
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
3424
+ value = +value;
3425
+ return Number.isFinite(value) ? value : defaultValue;
3426
+ };
3427
+
3428
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
3429
+
3430
+ const DIGIT = '0123456789';
3431
+
3432
+ const ALPHABET = {
3433
+ DIGIT,
3434
+ ALPHA,
3435
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
3436
+ };
3437
+
3438
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
3439
+ let str = '';
3440
+ const {length} = alphabet;
3441
+ while (size--) {
3442
+ str += alphabet[Math.random() * length|0];
3443
+ }
3444
+
3445
+ return str;
3428
3446
  };
3429
3447
 
3430
3448
  /**
@@ -3474,36 +3492,6 @@ const isAsyncFn = kindOfTest('AsyncFunction');
3474
3492
  const isThenable = (thing) =>
3475
3493
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
3476
3494
 
3477
- // original code
3478
- // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
3479
-
3480
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
3481
- if (setImmediateSupported) {
3482
- return setImmediate;
3483
- }
3484
-
3485
- return postMessageSupported ? ((token, callbacks) => {
3486
- _global.addEventListener("message", ({source, data}) => {
3487
- if (source === _global && data === token) {
3488
- callbacks.length && callbacks.shift()();
3489
- }
3490
- }, false);
3491
-
3492
- return (cb) => {
3493
- callbacks.push(cb);
3494
- _global.postMessage(token, "*");
3495
- }
3496
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
3497
- })(
3498
- typeof setImmediate === 'function',
3499
- isFunction(_global.postMessage)
3500
- );
3501
-
3502
- const asap = typeof queueMicrotask !== 'undefined' ?
3503
- queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
3504
-
3505
- // *********************
3506
-
3507
3495
  var utils$1 = {
3508
3496
  isArray,
3509
3497
  isArrayBuffer,
@@ -3515,10 +3503,6 @@ var utils$1 = {
3515
3503
  isBoolean,
3516
3504
  isObject,
3517
3505
  isPlainObject,
3518
- isReadableStream,
3519
- isRequest,
3520
- isResponse,
3521
- isHeaders,
3522
3506
  isUndefined,
3523
3507
  isDate,
3524
3508
  isFile,
@@ -3554,12 +3538,12 @@ var utils$1 = {
3554
3538
  findKey,
3555
3539
  global: _global,
3556
3540
  isContextDefined,
3541
+ ALPHABET,
3542
+ generateString,
3557
3543
  isSpecCompliantForm,
3558
3544
  toJSONObject,
3559
3545
  isAsyncFn,
3560
- isThenable,
3561
- setImmediate: _setImmediate,
3562
- asap
3546
+ isThenable
3563
3547
  };
3564
3548
 
3565
3549
  /**
@@ -3587,10 +3571,7 @@ function AxiosError(message, code, config, request, response) {
3587
3571
  code && (this.code = code);
3588
3572
  config && (this.config = config);
3589
3573
  request && (this.request = request);
3590
- if (response) {
3591
- this.response = response;
3592
- this.status = response.status ? response.status : null;
3593
- }
3574
+ response && (this.response = response);
3594
3575
  }
3595
3576
 
3596
3577
  utils$1.inherits(AxiosError, Error, {
@@ -3610,7 +3591,7 @@ utils$1.inherits(AxiosError, Error, {
3610
3591
  // Axios
3611
3592
  config: utils$1.toJSONObject(this.config),
3612
3593
  code: this.code,
3613
- status: this.status
3594
+ status: this.response && this.response.status ? this.response.status : null
3614
3595
  };
3615
3596
  }
3616
3597
  });
@@ -17274,7 +17255,7 @@ function encode(val) {
17274
17255
  *
17275
17256
  * @param {string} url The base of the url (e.g., http://www.google.com)
17276
17257
  * @param {object} [params] The params to be appended
17277
- * @param {?(object|Function)} options
17258
+ * @param {?object} options
17278
17259
  *
17279
17260
  * @returns {string} The formatted url
17280
17261
  */
@@ -17286,12 +17267,6 @@ function buildURL(url, params, options) {
17286
17267
 
17287
17268
  const _encode = options && options.encode || encode;
17288
17269
 
17289
- if (utils$1.isFunction(options)) {
17290
- options = {
17291
- serialize: options
17292
- };
17293
- }
17294
-
17295
17270
  const serializeFn = options && options.serialize;
17296
17271
 
17297
17272
  let serializedParams;
@@ -17392,29 +17367,6 @@ var transitionalDefaults = {
17392
17367
 
17393
17368
  var URLSearchParams = require$$0$1.URLSearchParams;
17394
17369
 
17395
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
17396
-
17397
- const DIGIT = '0123456789';
17398
-
17399
- const ALPHABET = {
17400
- DIGIT,
17401
- ALPHA,
17402
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
17403
- };
17404
-
17405
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
17406
- let str = '';
17407
- const {length} = alphabet;
17408
- const randomValues = new Uint32Array(size);
17409
- crypto.randomFillSync(randomValues);
17410
- for (let i = 0; i < size; i++) {
17411
- str += alphabet[randomValues[i] % length];
17412
- }
17413
-
17414
- return str;
17415
- };
17416
-
17417
-
17418
17370
  var platform$1 = {
17419
17371
  isNode: true,
17420
17372
  classes: {
@@ -17422,15 +17374,11 @@ var platform$1 = {
17422
17374
  FormData: FormData$1,
17423
17375
  Blob: typeof Blob !== 'undefined' && Blob || null
17424
17376
  },
17425
- ALPHABET,
17426
- generateString,
17427
17377
  protocols: [ 'http', 'https', 'file', 'data' ]
17428
17378
  };
17429
17379
 
17430
17380
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
17431
17381
 
17432
- const _navigator = typeof navigator === 'object' && navigator || undefined;
17433
-
17434
17382
  /**
17435
17383
  * Determine if we're running in a standard browser environment
17436
17384
  *
@@ -17448,8 +17396,10 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
17448
17396
  *
17449
17397
  * @returns {boolean}
17450
17398
  */
17451
- const hasStandardBrowserEnv = hasBrowserEnv &&
17452
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
17399
+ const hasStandardBrowserEnv = (
17400
+ (product) => {
17401
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
17402
+ })(typeof navigator !== 'undefined' && navigator.product);
17453
17403
 
17454
17404
  /**
17455
17405
  * Determine if we're running in a standard browser webWorker environment
@@ -17469,15 +17419,11 @@ const hasStandardBrowserWebWorkerEnv = (() => {
17469
17419
  );
17470
17420
  })();
17471
17421
 
17472
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
17473
-
17474
17422
  var utils = /*#__PURE__*/Object.freeze({
17475
17423
  __proto__: null,
17476
17424
  hasBrowserEnv: hasBrowserEnv,
17477
17425
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
17478
- hasStandardBrowserEnv: hasStandardBrowserEnv,
17479
- navigator: _navigator,
17480
- origin: origin
17426
+ hasStandardBrowserEnv: hasStandardBrowserEnv
17481
17427
  });
17482
17428
 
17483
17429
  var platform = {
@@ -17545,9 +17491,6 @@ function arrayToObject(arr) {
17545
17491
  function formDataToJSON(formData) {
17546
17492
  function buildPath(path, value, target, index) {
17547
17493
  let name = path[index++];
17548
-
17549
- if (name === '__proto__') return true;
17550
-
17551
17494
  const isNumericKey = Number.isFinite(+name);
17552
17495
  const isLast = index >= path.length;
17553
17496
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -17617,7 +17560,7 @@ const defaults = {
17617
17560
 
17618
17561
  transitional: transitionalDefaults,
17619
17562
 
17620
- adapter: ['xhr', 'http', 'fetch'],
17563
+ adapter: ['xhr', 'http'],
17621
17564
 
17622
17565
  transformRequest: [function transformRequest(data, headers) {
17623
17566
  const contentType = headers.getContentType() || '';
@@ -17631,6 +17574,9 @@ const defaults = {
17631
17574
  const isFormData = utils$1.isFormData(data);
17632
17575
 
17633
17576
  if (isFormData) {
17577
+ if (!hasJSONContentType) {
17578
+ return data;
17579
+ }
17634
17580
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
17635
17581
  }
17636
17582
 
@@ -17638,8 +17584,7 @@ const defaults = {
17638
17584
  utils$1.isBuffer(data) ||
17639
17585
  utils$1.isStream(data) ||
17640
17586
  utils$1.isFile(data) ||
17641
- utils$1.isBlob(data) ||
17642
- utils$1.isReadableStream(data)
17587
+ utils$1.isBlob(data)
17643
17588
  ) {
17644
17589
  return data;
17645
17590
  }
@@ -17682,10 +17627,6 @@ const defaults = {
17682
17627
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
17683
17628
  const JSONRequested = this.responseType === 'json';
17684
17629
 
17685
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
17686
- return data;
17687
- }
17688
-
17689
17630
  if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
17690
17631
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
17691
17632
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -17889,10 +17830,6 @@ class AxiosHeaders {
17889
17830
  setHeaders(header, valueOrRewrite);
17890
17831
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
17891
17832
  setHeaders(parseHeaders(header), valueOrRewrite);
17892
- } else if (utils$1.isHeaders(header)) {
17893
- for (const [key, value] of header.entries()) {
17894
- setHeader(value, key, rewrite);
17895
- }
17896
17833
  } else {
17897
17834
  header != null && setHeader(valueOrRewrite, header, rewrite);
17898
17835
  }
@@ -18184,7 +18121,7 @@ function isAbsoluteURL(url) {
18184
18121
  */
18185
18122
  function combineURLs(baseURL, relativeURL) {
18186
18123
  return relativeURL
18187
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
18124
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
18188
18125
  : baseURL;
18189
18126
  }
18190
18127
 
@@ -18198,20 +18135,19 @@ function combineURLs(baseURL, relativeURL) {
18198
18135
  *
18199
18136
  * @returns {string} The combined full path
18200
18137
  */
18201
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
18202
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
18203
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
18138
+ function buildFullPath(baseURL, requestedURL) {
18139
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
18204
18140
  return combineURLs(baseURL, requestedURL);
18205
18141
  }
18206
18142
  return requestedURL;
18207
18143
  }
18208
18144
 
18209
- var proxyFromEnv$1 = {};
18145
+ var proxyFromEnv = {};
18210
18146
 
18211
18147
  var hasRequiredProxyFromEnv;
18212
18148
 
18213
18149
  function requireProxyFromEnv () {
18214
- if (hasRequiredProxyFromEnv) return proxyFromEnv$1;
18150
+ if (hasRequiredProxyFromEnv) return proxyFromEnv;
18215
18151
  hasRequiredProxyFromEnv = 1;
18216
18152
 
18217
18153
  var parseUrl = require$$0$1.parse;
@@ -18319,12 +18255,11 @@ function requireProxyFromEnv () {
18319
18255
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
18320
18256
  }
18321
18257
 
18322
- proxyFromEnv$1.getProxyForUrl = getProxyForUrl;
18323
- return proxyFromEnv$1;
18258
+ proxyFromEnv.getProxyForUrl = getProxyForUrl;
18259
+ return proxyFromEnv;
18324
18260
  }
18325
18261
 
18326
18262
  var proxyFromEnvExports = requireProxyFromEnv();
18327
- var proxyFromEnv = /*@__PURE__*/getDefaultExportFromCjs(proxyFromEnvExports);
18328
18263
 
18329
18264
  var followRedirects$1 = {exports: {}};
18330
18265
 
@@ -20260,7 +20195,7 @@ function requireFollowRedirects () {
20260
20195
  var followRedirectsExports = requireFollowRedirects();
20261
20196
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
20262
20197
 
20263
- const VERSION = "1.8.3";
20198
+ const VERSION = "1.6.2";
20264
20199
 
20265
20200
  function parseProtocol(url) {
20266
20201
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -20315,6 +20250,88 @@ function fromDataURI(uri, asBlob, options) {
20315
20250
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
20316
20251
  }
20317
20252
 
20253
+ /**
20254
+ * Throttle decorator
20255
+ * @param {Function} fn
20256
+ * @param {Number} freq
20257
+ * @return {Function}
20258
+ */
20259
+ function throttle(fn, freq) {
20260
+ let timestamp = 0;
20261
+ const threshold = 1000 / freq;
20262
+ let timer = null;
20263
+ return function throttled(force, args) {
20264
+ const now = Date.now();
20265
+ if (force || now - timestamp > threshold) {
20266
+ if (timer) {
20267
+ clearTimeout(timer);
20268
+ timer = null;
20269
+ }
20270
+ timestamp = now;
20271
+ return fn.apply(null, args);
20272
+ }
20273
+ if (!timer) {
20274
+ timer = setTimeout(() => {
20275
+ timer = null;
20276
+ timestamp = Date.now();
20277
+ return fn.apply(null, args);
20278
+ }, threshold - (now - timestamp));
20279
+ }
20280
+ };
20281
+ }
20282
+
20283
+ /**
20284
+ * Calculate data maxRate
20285
+ * @param {Number} [samplesCount= 10]
20286
+ * @param {Number} [min= 1000]
20287
+ * @returns {Function}
20288
+ */
20289
+ function speedometer(samplesCount, min) {
20290
+ samplesCount = samplesCount || 10;
20291
+ const bytes = new Array(samplesCount);
20292
+ const timestamps = new Array(samplesCount);
20293
+ let head = 0;
20294
+ let tail = 0;
20295
+ let firstSampleTS;
20296
+
20297
+ min = min !== undefined ? min : 1000;
20298
+
20299
+ return function push(chunkLength) {
20300
+ const now = Date.now();
20301
+
20302
+ const startedAt = timestamps[tail];
20303
+
20304
+ if (!firstSampleTS) {
20305
+ firstSampleTS = now;
20306
+ }
20307
+
20308
+ bytes[head] = chunkLength;
20309
+ timestamps[head] = now;
20310
+
20311
+ let i = tail;
20312
+ let bytesCount = 0;
20313
+
20314
+ while (i !== head) {
20315
+ bytesCount += bytes[i++];
20316
+ i = i % samplesCount;
20317
+ }
20318
+
20319
+ head = (head + 1) % samplesCount;
20320
+
20321
+ if (head === tail) {
20322
+ tail = (tail + 1) % samplesCount;
20323
+ }
20324
+
20325
+ if (now - firstSampleTS < min) {
20326
+ return;
20327
+ }
20328
+
20329
+ const passed = startedAt && now - startedAt;
20330
+
20331
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
20332
+ };
20333
+ }
20334
+
20318
20335
  const kInternals = Symbol('internals');
20319
20336
 
20320
20337
  class AxiosTransformStream extends stream.Transform{
@@ -20334,8 +20351,12 @@ class AxiosTransformStream extends stream.Transform{
20334
20351
  readableHighWaterMark: options.chunkSize
20335
20352
  });
20336
20353
 
20354
+ const self = this;
20355
+
20337
20356
  const internals = this[kInternals] = {
20357
+ length: options.length,
20338
20358
  timeWindow: options.timeWindow,
20359
+ ticksRate: options.ticksRate,
20339
20360
  chunkSize: options.chunkSize,
20340
20361
  maxRate: options.maxRate,
20341
20362
  minChunkSize: options.minChunkSize,
@@ -20347,6 +20368,8 @@ class AxiosTransformStream extends stream.Transform{
20347
20368
  onReadCallback: null
20348
20369
  };
20349
20370
 
20371
+ const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
20372
+
20350
20373
  this.on('newListener', event => {
20351
20374
  if (event === 'progress') {
20352
20375
  if (!internals.isCaptured) {
@@ -20354,6 +20377,38 @@ class AxiosTransformStream extends stream.Transform{
20354
20377
  }
20355
20378
  }
20356
20379
  });
20380
+
20381
+ let bytesNotified = 0;
20382
+
20383
+ internals.updateProgress = throttle(function throttledHandler() {
20384
+ const totalBytes = internals.length;
20385
+ const bytesTransferred = internals.bytesSeen;
20386
+ const progressBytes = bytesTransferred - bytesNotified;
20387
+ if (!progressBytes || self.destroyed) return;
20388
+
20389
+ const rate = _speedometer(progressBytes);
20390
+
20391
+ bytesNotified = bytesTransferred;
20392
+
20393
+ process.nextTick(() => {
20394
+ self.emit('progress', {
20395
+ 'loaded': bytesTransferred,
20396
+ 'total': totalBytes,
20397
+ 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
20398
+ 'bytes': progressBytes,
20399
+ 'rate': rate ? rate : undefined,
20400
+ 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
20401
+ (totalBytes - bytesTransferred) / rate : undefined
20402
+ });
20403
+ });
20404
+ }, internals.ticksRate);
20405
+
20406
+ const onFinish = () => {
20407
+ internals.updateProgress(true);
20408
+ };
20409
+
20410
+ this.once('end', onFinish);
20411
+ this.once('error', onFinish);
20357
20412
  }
20358
20413
 
20359
20414
  _read(size) {
@@ -20367,6 +20422,7 @@ class AxiosTransformStream extends stream.Transform{
20367
20422
  }
20368
20423
 
20369
20424
  _transform(chunk, encoding, callback) {
20425
+ const self = this;
20370
20426
  const internals = this[kInternals];
20371
20427
  const maxRate = internals.maxRate;
20372
20428
 
@@ -20378,14 +20434,16 @@ class AxiosTransformStream extends stream.Transform{
20378
20434
  const bytesThreshold = (maxRate / divider);
20379
20435
  const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
20380
20436
 
20381
- const pushChunk = (_chunk, _callback) => {
20437
+ function pushChunk(_chunk, _callback) {
20382
20438
  const bytes = Buffer.byteLength(_chunk);
20383
20439
  internals.bytesSeen += bytes;
20384
20440
  internals.bytes += bytes;
20385
20441
 
20386
- internals.isCaptured && this.emit('progress', internals.bytesSeen);
20442
+ if (internals.isCaptured) {
20443
+ internals.updateProgress();
20444
+ }
20387
20445
 
20388
- if (this.push(_chunk)) {
20446
+ if (self.push(_chunk)) {
20389
20447
  process.nextTick(_callback);
20390
20448
  } else {
20391
20449
  internals.onReadCallback = () => {
@@ -20393,7 +20451,7 @@ class AxiosTransformStream extends stream.Transform{
20393
20451
  process.nextTick(_callback);
20394
20452
  };
20395
20453
  }
20396
- };
20454
+ }
20397
20455
 
20398
20456
  const transformChunk = (_chunk, _callback) => {
20399
20457
  const chunkSize = Buffer.byteLength(_chunk);
@@ -20450,6 +20508,11 @@ class AxiosTransformStream extends stream.Transform{
20450
20508
  }
20451
20509
  });
20452
20510
  }
20511
+
20512
+ setLength(length) {
20513
+ this[kInternals].length = +length;
20514
+ return this;
20515
+ }
20453
20516
  }
20454
20517
 
20455
20518
  var AxiosTransformStream$1 = AxiosTransformStream;
@@ -20470,9 +20533,9 @@ const readBlob = async function* (blob) {
20470
20533
 
20471
20534
  var readBlob$1 = readBlob;
20472
20535
 
20473
- const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
20536
+ const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
20474
20537
 
20475
- const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new require$$1.TextEncoder();
20538
+ const textEncoder = new TextEncoder();
20476
20539
 
20477
20540
  const CRLF = '\r\n';
20478
20541
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -20530,7 +20593,7 @@ const formDataToStream = (form, headersHandler, options) => {
20530
20593
  const {
20531
20594
  tag = 'form-data-boundary',
20532
20595
  size = 25,
20533
- boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
20596
+ boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
20534
20597
  } = options || {};
20535
20598
 
20536
20599
  if(!utils$1.isFormData(form)) {
@@ -20617,142 +20680,6 @@ const callbackify = (fn, reducer) => {
20617
20680
 
20618
20681
  var callbackify$1 = callbackify;
20619
20682
 
20620
- /**
20621
- * Calculate data maxRate
20622
- * @param {Number} [samplesCount= 10]
20623
- * @param {Number} [min= 1000]
20624
- * @returns {Function}
20625
- */
20626
- function speedometer(samplesCount, min) {
20627
- samplesCount = samplesCount || 10;
20628
- const bytes = new Array(samplesCount);
20629
- const timestamps = new Array(samplesCount);
20630
- let head = 0;
20631
- let tail = 0;
20632
- let firstSampleTS;
20633
-
20634
- min = min !== undefined ? min : 1000;
20635
-
20636
- return function push(chunkLength) {
20637
- const now = Date.now();
20638
-
20639
- const startedAt = timestamps[tail];
20640
-
20641
- if (!firstSampleTS) {
20642
- firstSampleTS = now;
20643
- }
20644
-
20645
- bytes[head] = chunkLength;
20646
- timestamps[head] = now;
20647
-
20648
- let i = tail;
20649
- let bytesCount = 0;
20650
-
20651
- while (i !== head) {
20652
- bytesCount += bytes[i++];
20653
- i = i % samplesCount;
20654
- }
20655
-
20656
- head = (head + 1) % samplesCount;
20657
-
20658
- if (head === tail) {
20659
- tail = (tail + 1) % samplesCount;
20660
- }
20661
-
20662
- if (now - firstSampleTS < min) {
20663
- return;
20664
- }
20665
-
20666
- const passed = startedAt && now - startedAt;
20667
-
20668
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
20669
- };
20670
- }
20671
-
20672
- /**
20673
- * Throttle decorator
20674
- * @param {Function} fn
20675
- * @param {Number} freq
20676
- * @return {Function}
20677
- */
20678
- function throttle(fn, freq) {
20679
- let timestamp = 0;
20680
- let threshold = 1000 / freq;
20681
- let lastArgs;
20682
- let timer;
20683
-
20684
- const invoke = (args, now = Date.now()) => {
20685
- timestamp = now;
20686
- lastArgs = null;
20687
- if (timer) {
20688
- clearTimeout(timer);
20689
- timer = null;
20690
- }
20691
- fn.apply(null, args);
20692
- };
20693
-
20694
- const throttled = (...args) => {
20695
- const now = Date.now();
20696
- const passed = now - timestamp;
20697
- if ( passed >= threshold) {
20698
- invoke(args, now);
20699
- } else {
20700
- lastArgs = args;
20701
- if (!timer) {
20702
- timer = setTimeout(() => {
20703
- timer = null;
20704
- invoke(lastArgs);
20705
- }, threshold - passed);
20706
- }
20707
- }
20708
- };
20709
-
20710
- const flush = () => lastArgs && invoke(lastArgs);
20711
-
20712
- return [throttled, flush];
20713
- }
20714
-
20715
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
20716
- let bytesNotified = 0;
20717
- const _speedometer = speedometer(50, 250);
20718
-
20719
- return throttle(e => {
20720
- const loaded = e.loaded;
20721
- const total = e.lengthComputable ? e.total : undefined;
20722
- const progressBytes = loaded - bytesNotified;
20723
- const rate = _speedometer(progressBytes);
20724
- const inRange = loaded <= total;
20725
-
20726
- bytesNotified = loaded;
20727
-
20728
- const data = {
20729
- loaded,
20730
- total,
20731
- progress: total ? (loaded / total) : undefined,
20732
- bytes: progressBytes,
20733
- rate: rate ? rate : undefined,
20734
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
20735
- event: e,
20736
- lengthComputable: total != null,
20737
- [isDownloadStream ? 'download' : 'upload']: true
20738
- };
20739
-
20740
- listener(data);
20741
- }, freq);
20742
- };
20743
-
20744
- const progressEventDecorator = (total, throttled) => {
20745
- const lengthComputable = total != null;
20746
-
20747
- return [(loaded) => throttled[0]({
20748
- lengthComputable,
20749
- total,
20750
- loaded
20751
- }), throttled[1]];
20752
- };
20753
-
20754
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
20755
-
20756
20683
  const zlibOptions = {
20757
20684
  flush: zlib.constants.Z_SYNC_FLUSH,
20758
20685
  finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -20773,14 +20700,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
20773
20700
  return protocol + ':';
20774
20701
  });
20775
20702
 
20776
- const flushOnFinish = (stream, [throttled, flush]) => {
20777
- stream
20778
- .on('end', flush)
20779
- .on('error', flush);
20780
-
20781
- return throttled;
20782
- };
20783
-
20784
20703
  /**
20785
20704
  * If the proxy or config beforeRedirects functions are defined, call them with the options
20786
20705
  * object.
@@ -20789,12 +20708,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
20789
20708
  *
20790
20709
  * @returns {Object<string, any>}
20791
20710
  */
20792
- function dispatchBeforeRedirect(options, responseDetails) {
20711
+ function dispatchBeforeRedirect(options) {
20793
20712
  if (options.beforeRedirects.proxy) {
20794
20713
  options.beforeRedirects.proxy(options);
20795
20714
  }
20796
20715
  if (options.beforeRedirects.config) {
20797
- options.beforeRedirects.config(options, responseDetails);
20716
+ options.beforeRedirects.config(options);
20798
20717
  }
20799
20718
  }
20800
20719
 
@@ -20810,7 +20729,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
20810
20729
  function setProxy(options, configProxy, location) {
20811
20730
  let proxy = configProxy;
20812
20731
  if (!proxy && proxy !== false) {
20813
- const proxyUrl = proxyFromEnv.getProxyForUrl(location);
20732
+ const proxyUrl = proxyFromEnvExports.getProxyForUrl(location);
20814
20733
  if (proxyUrl) {
20815
20734
  proxy = new URL(proxyUrl);
20816
20735
  }
@@ -20907,10 +20826,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
20907
20826
  // hotfix to support opt.all option which is required for node 20.x
20908
20827
  lookup = (hostname, opt, cb) => {
20909
20828
  _lookup(hostname, opt, (err, arg0, arg1) => {
20910
- if (err) {
20911
- return cb(err);
20912
- }
20913
-
20914
20829
  const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
20915
20830
 
20916
20831
  opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
@@ -20955,8 +20870,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
20955
20870
  }
20956
20871
 
20957
20872
  // Parse url
20958
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
20959
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
20873
+ const fullPath = buildFullPath(config.baseURL, config.url);
20874
+ const parsed = new URL(fullPath, 'http://localhost');
20960
20875
  const protocol = parsed.protocol || supportedProtocols[0];
20961
20876
 
20962
20877
  if (protocol === 'data:') {
@@ -21014,7 +20929,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21014
20929
  // Only set header if it hasn't been set in config
21015
20930
  headers.set('User-Agent', 'axios/' + VERSION, false);
21016
20931
 
21017
- const {onUploadProgress, onDownloadProgress} = config;
20932
+ const onDownloadProgress = config.onDownloadProgress;
20933
+ const onUploadProgress = config.onUploadProgress;
21018
20934
  const maxRate = config.maxRate;
21019
20935
  let maxUploadRate = undefined;
21020
20936
  let maxDownloadRate = undefined;
@@ -21041,7 +20957,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21041
20957
  } catch (e) {
21042
20958
  }
21043
20959
  }
21044
- } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
20960
+ } else if (utils$1.isBlob(data)) {
21045
20961
  data.size && headers.setContentType(data.type || 'application/octet-stream');
21046
20962
  headers.setContentLength(data.size || 0);
21047
20963
  data = stream.Readable.from(readBlob$1(data));
@@ -21085,16 +21001,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21085
21001
  }
21086
21002
 
21087
21003
  data = stream.pipeline([data, new AxiosTransformStream$1({
21004
+ length: contentLength,
21088
21005
  maxRate: utils$1.toFiniteNumber(maxUploadRate)
21089
21006
  })], utils$1.noop);
21090
21007
 
21091
- onUploadProgress && data.on('progress', flushOnFinish(
21092
- data,
21093
- progressEventDecorator(
21094
- contentLength,
21095
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
21096
- )
21097
- ));
21008
+ onUploadProgress && data.on('progress', progress => {
21009
+ onUploadProgress(Object.assign(progress, {
21010
+ upload: true
21011
+ }));
21012
+ });
21098
21013
  }
21099
21014
 
21100
21015
  // HTTP basic authentication
@@ -21152,7 +21067,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21152
21067
  if (config.socketPath) {
21153
21068
  options.socketPath = config.socketPath;
21154
21069
  } else {
21155
- options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
21070
+ options.hostname = parsed.hostname;
21156
21071
  options.port = parsed.port;
21157
21072
  setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
21158
21073
  }
@@ -21193,18 +21108,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21193
21108
 
21194
21109
  const responseLength = +res.headers['content-length'];
21195
21110
 
21196
- if (onDownloadProgress || maxDownloadRate) {
21111
+ if (onDownloadProgress) {
21197
21112
  const transformStream = new AxiosTransformStream$1({
21113
+ length: utils$1.toFiniteNumber(responseLength),
21198
21114
  maxRate: utils$1.toFiniteNumber(maxDownloadRate)
21199
21115
  });
21200
21116
 
21201
- onDownloadProgress && transformStream.on('progress', flushOnFinish(
21202
- transformStream,
21203
- progressEventDecorator(
21204
- responseLength,
21205
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
21206
- )
21207
- ));
21117
+ onDownloadProgress && transformStream.on('progress', progress => {
21118
+ onDownloadProgress(Object.assign(progress, {
21119
+ download: true
21120
+ }));
21121
+ });
21208
21122
 
21209
21123
  streams.push(transformStream);
21210
21124
  }
@@ -21294,7 +21208,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21294
21208
  }
21295
21209
 
21296
21210
  const err = new AxiosError(
21297
- 'stream has been aborted',
21211
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
21298
21212
  AxiosError.ERR_BAD_RESPONSE,
21299
21213
  config,
21300
21214
  lastRequest
@@ -21417,19 +21331,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21417
21331
  });
21418
21332
  };
21419
21333
 
21420
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
21421
- url = new URL(url, platform.origin);
21422
-
21423
- return (
21424
- origin.protocol === url.protocol &&
21425
- origin.host === url.host &&
21426
- (isMSIE || origin.port === url.port)
21427
- );
21428
- })(
21429
- new URL(platform.origin),
21430
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
21431
- ) : () => true;
21432
-
21433
21334
  var cookies = platform.hasStandardBrowserEnv ?
21434
21335
 
21435
21336
  // Standard browser envs support document.cookie
@@ -21469,183 +21370,143 @@ var cookies = platform.hasStandardBrowserEnv ?
21469
21370
  remove() {}
21470
21371
  };
21471
21372
 
21472
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
21473
-
21474
- /**
21475
- * Config-specific merge-function which creates a new config-object
21476
- * by merging two configuration objects together.
21477
- *
21478
- * @param {Object} config1
21479
- * @param {Object} config2
21480
- *
21481
- * @returns {Object} New object resulting from merging config2 to config1
21482
- */
21483
- function mergeConfig(config1, config2) {
21484
- // eslint-disable-next-line no-param-reassign
21485
- config2 = config2 || {};
21486
- const config = {};
21487
-
21488
- function getMergedValue(target, source, prop, caseless) {
21489
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
21490
- return utils$1.merge.call({caseless}, target, source);
21491
- } else if (utils$1.isPlainObject(source)) {
21492
- return utils$1.merge({}, source);
21493
- } else if (utils$1.isArray(source)) {
21494
- return source.slice();
21495
- }
21496
- return source;
21497
- }
21498
-
21499
- // eslint-disable-next-line consistent-return
21500
- function mergeDeepProperties(a, b, prop , caseless) {
21501
- if (!utils$1.isUndefined(b)) {
21502
- return getMergedValue(a, b, prop , caseless);
21503
- } else if (!utils$1.isUndefined(a)) {
21504
- return getMergedValue(undefined, a, prop , caseless);
21505
- }
21506
- }
21507
-
21508
- // eslint-disable-next-line consistent-return
21509
- function valueFromConfig2(a, b) {
21510
- if (!utils$1.isUndefined(b)) {
21511
- return getMergedValue(undefined, b);
21512
- }
21513
- }
21514
-
21515
- // eslint-disable-next-line consistent-return
21516
- function defaultToConfig2(a, b) {
21517
- if (!utils$1.isUndefined(b)) {
21518
- return getMergedValue(undefined, b);
21519
- } else if (!utils$1.isUndefined(a)) {
21520
- return getMergedValue(undefined, a);
21521
- }
21522
- }
21373
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
21374
+
21375
+ // Standard browser envs have full support of the APIs needed to test
21376
+ // whether the request URL is of the same origin as current location.
21377
+ (function standardBrowserEnv() {
21378
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
21379
+ const urlParsingNode = document.createElement('a');
21380
+ let originURL;
21381
+
21382
+ /**
21383
+ * Parse a URL to discover its components
21384
+ *
21385
+ * @param {String} url The URL to be parsed
21386
+ * @returns {Object}
21387
+ */
21388
+ function resolveURL(url) {
21389
+ let href = url;
21390
+
21391
+ if (msie) {
21392
+ // IE needs attribute set twice to normalize properties
21393
+ urlParsingNode.setAttribute('href', href);
21394
+ href = urlParsingNode.href;
21395
+ }
21523
21396
 
21524
- // eslint-disable-next-line consistent-return
21525
- function mergeDirectKeys(a, b, prop) {
21526
- if (prop in config2) {
21527
- return getMergedValue(a, b);
21528
- } else if (prop in config1) {
21529
- return getMergedValue(undefined, a);
21397
+ urlParsingNode.setAttribute('href', href);
21398
+
21399
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
21400
+ return {
21401
+ href: urlParsingNode.href,
21402
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
21403
+ host: urlParsingNode.host,
21404
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
21405
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
21406
+ hostname: urlParsingNode.hostname,
21407
+ port: urlParsingNode.port,
21408
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
21409
+ urlParsingNode.pathname :
21410
+ '/' + urlParsingNode.pathname
21411
+ };
21530
21412
  }
21531
- }
21532
-
21533
- const mergeMap = {
21534
- url: valueFromConfig2,
21535
- method: valueFromConfig2,
21536
- data: valueFromConfig2,
21537
- baseURL: defaultToConfig2,
21538
- transformRequest: defaultToConfig2,
21539
- transformResponse: defaultToConfig2,
21540
- paramsSerializer: defaultToConfig2,
21541
- timeout: defaultToConfig2,
21542
- timeoutMessage: defaultToConfig2,
21543
- withCredentials: defaultToConfig2,
21544
- withXSRFToken: defaultToConfig2,
21545
- adapter: defaultToConfig2,
21546
- responseType: defaultToConfig2,
21547
- xsrfCookieName: defaultToConfig2,
21548
- xsrfHeaderName: defaultToConfig2,
21549
- onUploadProgress: defaultToConfig2,
21550
- onDownloadProgress: defaultToConfig2,
21551
- decompress: defaultToConfig2,
21552
- maxContentLength: defaultToConfig2,
21553
- maxBodyLength: defaultToConfig2,
21554
- beforeRedirect: defaultToConfig2,
21555
- transport: defaultToConfig2,
21556
- httpAgent: defaultToConfig2,
21557
- httpsAgent: defaultToConfig2,
21558
- cancelToken: defaultToConfig2,
21559
- socketPath: defaultToConfig2,
21560
- responseEncoding: defaultToConfig2,
21561
- validateStatus: mergeDirectKeys,
21562
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
21563
- };
21564
-
21565
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
21566
- const merge = mergeMap[prop] || mergeDeepProperties;
21567
- const configValue = merge(config1[prop], config2[prop], prop);
21568
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
21569
- });
21570
-
21571
- return config;
21572
- }
21573
-
21574
- var resolveConfig = (config) => {
21575
- const newConfig = mergeConfig({}, config);
21576
21413
 
21577
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
21578
-
21579
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
21580
-
21581
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
21414
+ originURL = resolveURL(window.location.href);
21415
+
21416
+ /**
21417
+ * Determine if a URL shares the same origin as the current location
21418
+ *
21419
+ * @param {String} requestURL The URL to test
21420
+ * @returns {boolean} True if URL shares the same origin, otherwise false
21421
+ */
21422
+ return function isURLSameOrigin(requestURL) {
21423
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
21424
+ return (parsed.protocol === originURL.protocol &&
21425
+ parsed.host === originURL.host);
21426
+ };
21427
+ })() :
21582
21428
 
21583
- // HTTP basic authentication
21584
- if (auth) {
21585
- headers.set('Authorization', 'Basic ' +
21586
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
21587
- );
21588
- }
21429
+ // Non standard browser envs (web workers, react-native) lack needed support.
21430
+ (function nonStandardBrowserEnv() {
21431
+ return function isURLSameOrigin() {
21432
+ return true;
21433
+ };
21434
+ })();
21589
21435
 
21590
- let contentType;
21436
+ function progressEventReducer(listener, isDownloadStream) {
21437
+ let bytesNotified = 0;
21438
+ const _speedometer = speedometer(50, 250);
21591
21439
 
21592
- if (utils$1.isFormData(data)) {
21593
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
21594
- headers.setContentType(undefined); // Let the browser set it
21595
- } else if ((contentType = headers.getContentType()) !== false) {
21596
- // fix semicolon duplication issue for ReactNative FormData implementation
21597
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
21598
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
21599
- }
21600
- }
21440
+ return e => {
21441
+ const loaded = e.loaded;
21442
+ const total = e.lengthComputable ? e.total : undefined;
21443
+ const progressBytes = loaded - bytesNotified;
21444
+ const rate = _speedometer(progressBytes);
21445
+ const inRange = loaded <= total;
21601
21446
 
21602
- // Add xsrf header
21603
- // This is only done if running in a standard browser environment.
21604
- // Specifically not if we're in a web worker, or react-native.
21447
+ bytesNotified = loaded;
21605
21448
 
21606
- if (platform.hasStandardBrowserEnv) {
21607
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
21449
+ const data = {
21450
+ loaded,
21451
+ total,
21452
+ progress: total ? (loaded / total) : undefined,
21453
+ bytes: progressBytes,
21454
+ rate: rate ? rate : undefined,
21455
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
21456
+ event: e
21457
+ };
21608
21458
 
21609
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
21610
- // Add xsrf header
21611
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
21459
+ data[isDownloadStream ? 'download' : 'upload'] = true;
21612
21460
 
21613
- if (xsrfValue) {
21614
- headers.set(xsrfHeaderName, xsrfValue);
21615
- }
21616
- }
21617
- }
21618
-
21619
- return newConfig;
21620
- };
21461
+ listener(data);
21462
+ };
21463
+ }
21621
21464
 
21622
21465
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
21623
21466
 
21624
21467
  var xhrAdapter = isXHRAdapterSupported && function (config) {
21625
21468
  return new Promise(function dispatchXhrRequest(resolve, reject) {
21626
- const _config = resolveConfig(config);
21627
- let requestData = _config.data;
21628
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
21629
- let {responseType, onUploadProgress, onDownloadProgress} = _config;
21469
+ let requestData = config.data;
21470
+ const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
21471
+ let {responseType, withXSRFToken} = config;
21630
21472
  let onCanceled;
21631
- let uploadThrottled, downloadThrottled;
21632
- let flushUpload, flushDownload;
21633
-
21634
21473
  function done() {
21635
- flushUpload && flushUpload(); // flush events
21636
- flushDownload && flushDownload(); // flush events
21474
+ if (config.cancelToken) {
21475
+ config.cancelToken.unsubscribe(onCanceled);
21476
+ }
21477
+
21478
+ if (config.signal) {
21479
+ config.signal.removeEventListener('abort', onCanceled);
21480
+ }
21481
+ }
21637
21482
 
21638
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
21483
+ let contentType;
21639
21484
 
21640
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
21485
+ if (utils$1.isFormData(requestData)) {
21486
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
21487
+ requestHeaders.setContentType(false); // Let the browser set it
21488
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
21489
+ // fix semicolon duplication issue for ReactNative FormData implementation
21490
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
21491
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
21492
+ }
21641
21493
  }
21642
21494
 
21643
21495
  let request = new XMLHttpRequest();
21644
21496
 
21645
- request.open(_config.method.toUpperCase(), _config.url, true);
21497
+ // HTTP basic authentication
21498
+ if (config.auth) {
21499
+ const username = config.auth.username || '';
21500
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
21501
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
21502
+ }
21503
+
21504
+ const fullPath = buildFullPath(config.baseURL, config.url);
21505
+
21506
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
21646
21507
 
21647
21508
  // Set the request timeout in MS
21648
- request.timeout = _config.timeout;
21509
+ request.timeout = config.timeout;
21649
21510
 
21650
21511
  function onloadend() {
21651
21512
  if (!request) {
@@ -21725,10 +21586,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21725
21586
 
21726
21587
  // Handle timeout
21727
21588
  request.ontimeout = function handleTimeout() {
21728
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
21729
- const transitional = _config.transitional || transitionalDefaults;
21730
- if (_config.timeoutErrorMessage) {
21731
- timeoutErrorMessage = _config.timeoutErrorMessage;
21589
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
21590
+ const transitional = config.transitional || transitionalDefaults;
21591
+ if (config.timeoutErrorMessage) {
21592
+ timeoutErrorMessage = config.timeoutErrorMessage;
21732
21593
  }
21733
21594
  reject(new AxiosError(
21734
21595
  timeoutErrorMessage,
@@ -21740,6 +21601,22 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21740
21601
  request = null;
21741
21602
  };
21742
21603
 
21604
+ // Add xsrf header
21605
+ // This is only done if running in a standard browser environment.
21606
+ // Specifically not if we're in a web worker, or react-native.
21607
+ if(platform.hasStandardBrowserEnv) {
21608
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
21609
+
21610
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
21611
+ // Add xsrf header
21612
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
21613
+
21614
+ if (xsrfValue) {
21615
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
21616
+ }
21617
+ }
21618
+ }
21619
+
21743
21620
  // Remove Content-Type if data is undefined
21744
21621
  requestData === undefined && requestHeaders.setContentType(null);
21745
21622
 
@@ -21751,31 +21628,26 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21751
21628
  }
21752
21629
 
21753
21630
  // Add withCredentials to request if needed
21754
- if (!utils$1.isUndefined(_config.withCredentials)) {
21755
- request.withCredentials = !!_config.withCredentials;
21631
+ if (!utils$1.isUndefined(config.withCredentials)) {
21632
+ request.withCredentials = !!config.withCredentials;
21756
21633
  }
21757
21634
 
21758
21635
  // Add responseType to request if needed
21759
21636
  if (responseType && responseType !== 'json') {
21760
- request.responseType = _config.responseType;
21637
+ request.responseType = config.responseType;
21761
21638
  }
21762
21639
 
21763
21640
  // Handle progress if needed
21764
- if (onDownloadProgress) {
21765
- ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
21766
- request.addEventListener('progress', downloadThrottled);
21641
+ if (typeof config.onDownloadProgress === 'function') {
21642
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
21767
21643
  }
21768
21644
 
21769
21645
  // Not all browsers support upload events
21770
- if (onUploadProgress && request.upload) {
21771
- ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
21772
-
21773
- request.upload.addEventListener('progress', uploadThrottled);
21774
-
21775
- request.upload.addEventListener('loadend', flushUpload);
21646
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
21647
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
21776
21648
  }
21777
21649
 
21778
- if (_config.cancelToken || _config.signal) {
21650
+ if (config.cancelToken || config.signal) {
21779
21651
  // Handle cancellation
21780
21652
  // eslint-disable-next-line func-names
21781
21653
  onCanceled = cancel => {
@@ -21787,13 +21659,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21787
21659
  request = null;
21788
21660
  };
21789
21661
 
21790
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
21791
- if (_config.signal) {
21792
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
21662
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
21663
+ if (config.signal) {
21664
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
21793
21665
  }
21794
21666
  }
21795
21667
 
21796
- const protocol = parseProtocol(_config.url);
21668
+ const protocol = parseProtocol(fullPath);
21797
21669
 
21798
21670
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
21799
21671
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -21806,360 +21678,9 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21806
21678
  });
21807
21679
  };
21808
21680
 
21809
- const composeSignals = (signals, timeout) => {
21810
- const {length} = (signals = signals ? signals.filter(Boolean) : []);
21811
-
21812
- if (timeout || length) {
21813
- let controller = new AbortController();
21814
-
21815
- let aborted;
21816
-
21817
- const onabort = function (reason) {
21818
- if (!aborted) {
21819
- aborted = true;
21820
- unsubscribe();
21821
- const err = reason instanceof Error ? reason : this.reason;
21822
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
21823
- }
21824
- };
21825
-
21826
- let timer = timeout && setTimeout(() => {
21827
- timer = null;
21828
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
21829
- }, timeout);
21830
-
21831
- const unsubscribe = () => {
21832
- if (signals) {
21833
- timer && clearTimeout(timer);
21834
- timer = null;
21835
- signals.forEach(signal => {
21836
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
21837
- });
21838
- signals = null;
21839
- }
21840
- };
21841
-
21842
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
21843
-
21844
- const {signal} = controller;
21845
-
21846
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
21847
-
21848
- return signal;
21849
- }
21850
- };
21851
-
21852
- var composeSignals$1 = composeSignals;
21853
-
21854
- const streamChunk = function* (chunk, chunkSize) {
21855
- let len = chunk.byteLength;
21856
-
21857
- if (!chunkSize || len < chunkSize) {
21858
- yield chunk;
21859
- return;
21860
- }
21861
-
21862
- let pos = 0;
21863
- let end;
21864
-
21865
- while (pos < len) {
21866
- end = pos + chunkSize;
21867
- yield chunk.slice(pos, end);
21868
- pos = end;
21869
- }
21870
- };
21871
-
21872
- const readBytes = async function* (iterable, chunkSize) {
21873
- for await (const chunk of readStream(iterable)) {
21874
- yield* streamChunk(chunk, chunkSize);
21875
- }
21876
- };
21877
-
21878
- const readStream = async function* (stream) {
21879
- if (stream[Symbol.asyncIterator]) {
21880
- yield* stream;
21881
- return;
21882
- }
21883
-
21884
- const reader = stream.getReader();
21885
- try {
21886
- for (;;) {
21887
- const {done, value} = await reader.read();
21888
- if (done) {
21889
- break;
21890
- }
21891
- yield value;
21892
- }
21893
- } finally {
21894
- await reader.cancel();
21895
- }
21896
- };
21897
-
21898
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
21899
- const iterator = readBytes(stream, chunkSize);
21900
-
21901
- let bytes = 0;
21902
- let done;
21903
- let _onFinish = (e) => {
21904
- if (!done) {
21905
- done = true;
21906
- onFinish && onFinish(e);
21907
- }
21908
- };
21909
-
21910
- return new ReadableStream({
21911
- async pull(controller) {
21912
- try {
21913
- const {done, value} = await iterator.next();
21914
-
21915
- if (done) {
21916
- _onFinish();
21917
- controller.close();
21918
- return;
21919
- }
21920
-
21921
- let len = value.byteLength;
21922
- if (onProgress) {
21923
- let loadedBytes = bytes += len;
21924
- onProgress(loadedBytes);
21925
- }
21926
- controller.enqueue(new Uint8Array(value));
21927
- } catch (err) {
21928
- _onFinish(err);
21929
- throw err;
21930
- }
21931
- },
21932
- cancel(reason) {
21933
- _onFinish(reason);
21934
- return iterator.return();
21935
- }
21936
- }, {
21937
- highWaterMark: 2
21938
- })
21939
- };
21940
-
21941
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
21942
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
21943
-
21944
- // used only inside the fetch adapter
21945
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
21946
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
21947
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
21948
- );
21949
-
21950
- const test = (fn, ...args) => {
21951
- try {
21952
- return !!fn(...args);
21953
- } catch (e) {
21954
- return false
21955
- }
21956
- };
21957
-
21958
- const supportsRequestStream = isReadableStreamSupported && test(() => {
21959
- let duplexAccessed = false;
21960
-
21961
- const hasContentType = new Request(platform.origin, {
21962
- body: new ReadableStream(),
21963
- method: 'POST',
21964
- get duplex() {
21965
- duplexAccessed = true;
21966
- return 'half';
21967
- },
21968
- }).headers.has('Content-Type');
21969
-
21970
- return duplexAccessed && !hasContentType;
21971
- });
21972
-
21973
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
21974
-
21975
- const supportsResponseStream = isReadableStreamSupported &&
21976
- test(() => utils$1.isReadableStream(new Response('').body));
21977
-
21978
-
21979
- const resolvers = {
21980
- stream: supportsResponseStream && ((res) => res.body)
21981
- };
21982
-
21983
- isFetchSupported && (((res) => {
21984
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
21985
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
21986
- (_, config) => {
21987
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
21988
- });
21989
- });
21990
- })(new Response));
21991
-
21992
- const getBodyLength = async (body) => {
21993
- if (body == null) {
21994
- return 0;
21995
- }
21996
-
21997
- if(utils$1.isBlob(body)) {
21998
- return body.size;
21999
- }
22000
-
22001
- if(utils$1.isSpecCompliantForm(body)) {
22002
- const _request = new Request(platform.origin, {
22003
- method: 'POST',
22004
- body,
22005
- });
22006
- return (await _request.arrayBuffer()).byteLength;
22007
- }
22008
-
22009
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
22010
- return body.byteLength;
22011
- }
22012
-
22013
- if(utils$1.isURLSearchParams(body)) {
22014
- body = body + '';
22015
- }
22016
-
22017
- if(utils$1.isString(body)) {
22018
- return (await encodeText(body)).byteLength;
22019
- }
22020
- };
22021
-
22022
- const resolveBodyLength = async (headers, body) => {
22023
- const length = utils$1.toFiniteNumber(headers.getContentLength());
22024
-
22025
- return length == null ? getBodyLength(body) : length;
22026
- };
22027
-
22028
- var fetchAdapter = isFetchSupported && (async (config) => {
22029
- let {
22030
- url,
22031
- method,
22032
- data,
22033
- signal,
22034
- cancelToken,
22035
- timeout,
22036
- onDownloadProgress,
22037
- onUploadProgress,
22038
- responseType,
22039
- headers,
22040
- withCredentials = 'same-origin',
22041
- fetchOptions
22042
- } = resolveConfig(config);
22043
-
22044
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
22045
-
22046
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
22047
-
22048
- let request;
22049
-
22050
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
22051
- composedSignal.unsubscribe();
22052
- });
22053
-
22054
- let requestContentLength;
22055
-
22056
- try {
22057
- if (
22058
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
22059
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
22060
- ) {
22061
- let _request = new Request(url, {
22062
- method: 'POST',
22063
- body: data,
22064
- duplex: "half"
22065
- });
22066
-
22067
- let contentTypeHeader;
22068
-
22069
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
22070
- headers.setContentType(contentTypeHeader);
22071
- }
22072
-
22073
- if (_request.body) {
22074
- const [onProgress, flush] = progressEventDecorator(
22075
- requestContentLength,
22076
- progressEventReducer(asyncDecorator(onUploadProgress))
22077
- );
22078
-
22079
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
22080
- }
22081
- }
22082
-
22083
- if (!utils$1.isString(withCredentials)) {
22084
- withCredentials = withCredentials ? 'include' : 'omit';
22085
- }
22086
-
22087
- // Cloudflare Workers throws when credentials are defined
22088
- // see https://github.com/cloudflare/workerd/issues/902
22089
- const isCredentialsSupported = "credentials" in Request.prototype;
22090
- request = new Request(url, {
22091
- ...fetchOptions,
22092
- signal: composedSignal,
22093
- method: method.toUpperCase(),
22094
- headers: headers.normalize().toJSON(),
22095
- body: data,
22096
- duplex: "half",
22097
- credentials: isCredentialsSupported ? withCredentials : undefined
22098
- });
22099
-
22100
- let response = await fetch(request);
22101
-
22102
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
22103
-
22104
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
22105
- const options = {};
22106
-
22107
- ['status', 'statusText', 'headers'].forEach(prop => {
22108
- options[prop] = response[prop];
22109
- });
22110
-
22111
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
22112
-
22113
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
22114
- responseContentLength,
22115
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
22116
- ) || [];
22117
-
22118
- response = new Response(
22119
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
22120
- flush && flush();
22121
- unsubscribe && unsubscribe();
22122
- }),
22123
- options
22124
- );
22125
- }
22126
-
22127
- responseType = responseType || 'text';
22128
-
22129
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
22130
-
22131
- !isStreamResponse && unsubscribe && unsubscribe();
22132
-
22133
- return await new Promise((resolve, reject) => {
22134
- settle(resolve, reject, {
22135
- data: responseData,
22136
- headers: AxiosHeaders$1.from(response.headers),
22137
- status: response.status,
22138
- statusText: response.statusText,
22139
- config,
22140
- request
22141
- });
22142
- })
22143
- } catch (err) {
22144
- unsubscribe && unsubscribe();
22145
-
22146
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
22147
- throw Object.assign(
22148
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
22149
- {
22150
- cause: err.cause || err
22151
- }
22152
- )
22153
- }
22154
-
22155
- throw AxiosError.from(err, err && err.code, config, request);
22156
- }
22157
- });
22158
-
22159
21681
  const knownAdapters = {
22160
21682
  http: httpAdapter,
22161
- xhr: xhrAdapter,
22162
- fetch: fetchAdapter
21683
+ xhr: xhrAdapter
22163
21684
  };
22164
21685
 
22165
21686
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -22303,6 +21824,108 @@ function dispatchRequest(config) {
22303
21824
  });
22304
21825
  }
22305
21826
 
21827
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
21828
+
21829
+ /**
21830
+ * Config-specific merge-function which creates a new config-object
21831
+ * by merging two configuration objects together.
21832
+ *
21833
+ * @param {Object} config1
21834
+ * @param {Object} config2
21835
+ *
21836
+ * @returns {Object} New object resulting from merging config2 to config1
21837
+ */
21838
+ function mergeConfig(config1, config2) {
21839
+ // eslint-disable-next-line no-param-reassign
21840
+ config2 = config2 || {};
21841
+ const config = {};
21842
+
21843
+ function getMergedValue(target, source, caseless) {
21844
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
21845
+ return utils$1.merge.call({caseless}, target, source);
21846
+ } else if (utils$1.isPlainObject(source)) {
21847
+ return utils$1.merge({}, source);
21848
+ } else if (utils$1.isArray(source)) {
21849
+ return source.slice();
21850
+ }
21851
+ return source;
21852
+ }
21853
+
21854
+ // eslint-disable-next-line consistent-return
21855
+ function mergeDeepProperties(a, b, caseless) {
21856
+ if (!utils$1.isUndefined(b)) {
21857
+ return getMergedValue(a, b, caseless);
21858
+ } else if (!utils$1.isUndefined(a)) {
21859
+ return getMergedValue(undefined, a, caseless);
21860
+ }
21861
+ }
21862
+
21863
+ // eslint-disable-next-line consistent-return
21864
+ function valueFromConfig2(a, b) {
21865
+ if (!utils$1.isUndefined(b)) {
21866
+ return getMergedValue(undefined, b);
21867
+ }
21868
+ }
21869
+
21870
+ // eslint-disable-next-line consistent-return
21871
+ function defaultToConfig2(a, b) {
21872
+ if (!utils$1.isUndefined(b)) {
21873
+ return getMergedValue(undefined, b);
21874
+ } else if (!utils$1.isUndefined(a)) {
21875
+ return getMergedValue(undefined, a);
21876
+ }
21877
+ }
21878
+
21879
+ // eslint-disable-next-line consistent-return
21880
+ function mergeDirectKeys(a, b, prop) {
21881
+ if (prop in config2) {
21882
+ return getMergedValue(a, b);
21883
+ } else if (prop in config1) {
21884
+ return getMergedValue(undefined, a);
21885
+ }
21886
+ }
21887
+
21888
+ const mergeMap = {
21889
+ url: valueFromConfig2,
21890
+ method: valueFromConfig2,
21891
+ data: valueFromConfig2,
21892
+ baseURL: defaultToConfig2,
21893
+ transformRequest: defaultToConfig2,
21894
+ transformResponse: defaultToConfig2,
21895
+ paramsSerializer: defaultToConfig2,
21896
+ timeout: defaultToConfig2,
21897
+ timeoutMessage: defaultToConfig2,
21898
+ withCredentials: defaultToConfig2,
21899
+ withXSRFToken: defaultToConfig2,
21900
+ adapter: defaultToConfig2,
21901
+ responseType: defaultToConfig2,
21902
+ xsrfCookieName: defaultToConfig2,
21903
+ xsrfHeaderName: defaultToConfig2,
21904
+ onUploadProgress: defaultToConfig2,
21905
+ onDownloadProgress: defaultToConfig2,
21906
+ decompress: defaultToConfig2,
21907
+ maxContentLength: defaultToConfig2,
21908
+ maxBodyLength: defaultToConfig2,
21909
+ beforeRedirect: defaultToConfig2,
21910
+ transport: defaultToConfig2,
21911
+ httpAgent: defaultToConfig2,
21912
+ httpsAgent: defaultToConfig2,
21913
+ cancelToken: defaultToConfig2,
21914
+ socketPath: defaultToConfig2,
21915
+ responseEncoding: defaultToConfig2,
21916
+ validateStatus: mergeDirectKeys,
21917
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
21918
+ };
21919
+
21920
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
21921
+ const merge = mergeMap[prop] || mergeDeepProperties;
21922
+ const configValue = merge(config1[prop], config2[prop], prop);
21923
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
21924
+ });
21925
+
21926
+ return config;
21927
+ }
21928
+
22306
21929
  const validators$1 = {};
22307
21930
 
22308
21931
  // eslint-disable-next-line func-names
@@ -22352,14 +21975,6 @@ validators$1.transitional = function transitional(validator, version, message) {
22352
21975
  };
22353
21976
  };
22354
21977
 
22355
- validators$1.spelling = function spelling(correctSpelling) {
22356
- return (value, opt) => {
22357
- // eslint-disable-next-line no-console
22358
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
22359
- return true;
22360
- }
22361
- };
22362
-
22363
21978
  /**
22364
21979
  * Assert object's properties type
22365
21980
  *
@@ -22424,34 +22039,7 @@ class Axios {
22424
22039
  *
22425
22040
  * @returns {Promise} The Promise to be fulfilled
22426
22041
  */
22427
- async request(configOrUrl, config) {
22428
- try {
22429
- return await this._request(configOrUrl, config);
22430
- } catch (err) {
22431
- if (err instanceof Error) {
22432
- let dummy = {};
22433
-
22434
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
22435
-
22436
- // slice off the Error: ... line
22437
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
22438
- try {
22439
- if (!err.stack) {
22440
- err.stack = stack;
22441
- // match without the 2 top stack lines
22442
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
22443
- err.stack += '\n' + stack;
22444
- }
22445
- } catch (e) {
22446
- // ignore the case where "stack" is an un-writable property
22447
- }
22448
- }
22449
-
22450
- throw err;
22451
- }
22452
- }
22453
-
22454
- _request(configOrUrl, config) {
22042
+ request(configOrUrl, config) {
22455
22043
  /*eslint no-param-reassign:0*/
22456
22044
  // Allow for axios('example/url'[, config]) a la fetch API
22457
22045
  if (typeof configOrUrl === 'string') {
@@ -22486,18 +22074,6 @@ class Axios {
22486
22074
  }
22487
22075
  }
22488
22076
 
22489
- // Set config.allowAbsoluteUrls
22490
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
22491
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
22492
- } else {
22493
- config.allowAbsoluteUrls = true;
22494
- }
22495
-
22496
- validator.assertOptions(config, {
22497
- baseUrl: validators.spelling('baseURL'),
22498
- withXsrfToken: validators.spelling('withXSRFToken')
22499
- }, true);
22500
-
22501
22077
  // Set config.method
22502
22078
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
22503
22079
 
@@ -22588,7 +22164,7 @@ class Axios {
22588
22164
 
22589
22165
  getUri(config) {
22590
22166
  config = mergeConfig(this.defaults, config);
22591
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
22167
+ const fullPath = buildFullPath(config.baseURL, config.url);
22592
22168
  return buildURL(fullPath, config.params, config.paramsSerializer);
22593
22169
  }
22594
22170
  }
@@ -22728,20 +22304,6 @@ class CancelToken {
22728
22304
  }
22729
22305
  }
22730
22306
 
22731
- toAbortSignal() {
22732
- const controller = new AbortController();
22733
-
22734
- const abort = (err) => {
22735
- controller.abort(err);
22736
- };
22737
-
22738
- this.subscribe(abort);
22739
-
22740
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
22741
-
22742
- return controller.signal;
22743
- }
22744
-
22745
22307
  /**
22746
22308
  * Returns an object that contains a new `CancelToken` and a function that, when called,
22747
22309
  * cancels the `CancelToken`.