@azuro-org/images-generator 1.3.15 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import fs$1 from'fs';import require$$1 from'util';import stream,{Readable}from'stream';import path$1 from'path';import require$$3 from'http';import require$$4 from'https';import require$$0$1 from'url';import require$$8 from'crypto';import require$$4$1 from'assert';import require$$0$2 from'tty';import zlib from'zlib';import {EventEmitter}from'events';/******************************************************************************
1
+ import fs$1 from'fs';import require$$1 from'util';import stream,{Readable}from'stream';import path$1 from'path';import require$$3 from'http';import require$$4 from'https';import require$$0$1 from'url';import require$$8 from'crypto';import http2 from'http2';import require$$4$1 from'assert';import require$$0$2 from'tty';import zlib from'zlib';import {EventEmitter}from'events';/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -49,36 +49,43 @@ function __generator(thisArg, body) {
49
49
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
- }function bind$2(fn, thisArg) {
52
+ }/**
53
+ * Create a bound version of a function with a specified `this` context
54
+ *
55
+ * @param {Function} fn - The function to bind
56
+ * @param {*} thisArg - The value to be passed as the `this` parameter
57
+ * @returns {Function} A new function that will call the original function with the specified `this` context
58
+ */
59
+ function bind$2(fn, thisArg) {
53
60
  return function wrap() {
54
61
  return fn.apply(thisArg, arguments);
55
62
  };
56
63
  }// utils is a library of generic helper functions non-specific to axios
57
64
 
58
- const {toString} = Object.prototype;
59
- const {getPrototypeOf} = Object;
60
- const {iterator, toStringTag: toStringTag$1} = Symbol;
65
+ const { toString } = Object.prototype;
66
+ const { getPrototypeOf } = Object;
67
+ const { iterator, toStringTag: toStringTag$1 } = Symbol;
61
68
 
62
- const kindOf = (cache => thing => {
63
- const str = toString.call(thing);
64
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
69
+ const kindOf = ((cache) => (thing) => {
70
+ const str = toString.call(thing);
71
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
65
72
  })(Object.create(null));
66
73
 
67
74
  const kindOfTest = (type) => {
68
75
  type = type.toLowerCase();
69
- return (thing) => kindOf(thing) === type
76
+ return (thing) => kindOf(thing) === type;
70
77
  };
71
78
 
72
- const typeOfTest = type => thing => typeof thing === type;
79
+ const typeOfTest = (type) => (thing) => typeof thing === type;
73
80
 
74
81
  /**
75
- * Determine if a value is an Array
82
+ * Determine if a value is a non-null object
76
83
  *
77
84
  * @param {Object} val The value to test
78
85
  *
79
86
  * @returns {boolean} True if value is an Array, otherwise false
80
87
  */
81
- const {isArray} = Array;
88
+ const { isArray } = Array;
82
89
 
83
90
  /**
84
91
  * Determine if a value is undefined
@@ -97,8 +104,14 @@ const isUndefined = typeOfTest('undefined');
97
104
  * @returns {boolean} True if value is a Buffer, otherwise false
98
105
  */
99
106
  function isBuffer$1(val) {
100
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
101
- && isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
107
+ return (
108
+ val !== null &&
109
+ !isUndefined(val) &&
110
+ val.constructor !== null &&
111
+ !isUndefined(val.constructor) &&
112
+ isFunction$2(val.constructor.isBuffer) &&
113
+ val.constructor.isBuffer(val)
114
+ );
102
115
  }
103
116
 
104
117
  /**
@@ -110,7 +123,6 @@ function isBuffer$1(val) {
110
123
  */
111
124
  const isArrayBuffer = kindOfTest('ArrayBuffer');
112
125
 
113
-
114
126
  /**
115
127
  * Determine if a value is a view on an ArrayBuffer
116
128
  *
@@ -120,10 +132,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
120
132
  */
121
133
  function isArrayBufferView(val) {
122
134
  let result;
123
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
135
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
124
136
  result = ArrayBuffer.isView(val);
125
137
  } else {
126
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
138
+ result = val && val.buffer && isArrayBuffer(val.buffer);
127
139
  }
128
140
  return result;
129
141
  }
@@ -169,7 +181,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
169
181
  * @param {*} thing The value to test
170
182
  * @returns {boolean} True if value is a Boolean, otherwise false
171
183
  */
172
- const isBoolean = thing => thing === true || thing === false;
184
+ const isBoolean = (thing) => thing === true || thing === false;
173
185
 
174
186
  /**
175
187
  * Determine if a value is a plain Object
@@ -184,7 +196,13 @@ const isPlainObject = (val) => {
184
196
  }
185
197
 
186
198
  const prototype = getPrototypeOf(val);
187
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag$1 in val) && !(iterator in val);
199
+ return (
200
+ (prototype === null ||
201
+ prototype === Object.prototype ||
202
+ Object.getPrototypeOf(prototype) === null) &&
203
+ !(toStringTag$1 in val) &&
204
+ !(iterator in val)
205
+ );
188
206
  };
189
207
 
190
208
  /**
@@ -226,6 +244,31 @@ const isDate = kindOfTest('Date');
226
244
  */
227
245
  const isFile = kindOfTest('File');
228
246
 
247
+ /**
248
+ * Determine if a value is a React Native Blob
249
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
250
+ * also have a `name` and `type` attribute to specify filename and content type
251
+ *
252
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
253
+ *
254
+ * @param {*} value The value to test
255
+ *
256
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
257
+ */
258
+ const isReactNativeBlob = (value) => {
259
+ return !!(value && typeof value.uri !== 'undefined');
260
+ };
261
+
262
+ /**
263
+ * Determine if environment is React Native
264
+ * ReactNative `FormData` has a non-standard `getParts()` method
265
+ *
266
+ * @param {*} formData The formData to test
267
+ *
268
+ * @returns {boolean} True if environment is React Native, otherwise false
269
+ */
270
+ const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
271
+
229
272
  /**
230
273
  * Determine if a value is a Blob
231
274
  *
@@ -260,17 +303,28 @@ const isStream = (val) => isObject(val) && isFunction$2(val.pipe);
260
303
  *
261
304
  * @returns {boolean} True if value is an FormData, otherwise false
262
305
  */
306
+ function getGlobal() {
307
+ if (typeof globalThis !== 'undefined') return globalThis;
308
+ if (typeof self !== 'undefined') return self;
309
+ if (typeof window !== 'undefined') return window;
310
+ if (typeof global !== 'undefined') return global;
311
+ return {};
312
+ }
313
+
314
+ const G = getGlobal();
315
+ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
316
+
263
317
  const isFormData = (thing) => {
264
318
  let kind;
265
319
  return thing && (
266
- (typeof FormData === 'function' && thing instanceof FormData) || (
320
+ (FormDataCtor && thing instanceof FormDataCtor) || (
267
321
  isFunction$2(thing.append) && (
268
322
  (kind = kindOf(thing)) === 'formdata' ||
269
323
  // detect form-data instance
270
324
  (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
271
325
  )
272
326
  )
273
- )
327
+ );
274
328
  };
275
329
 
276
330
  /**
@@ -282,7 +336,12 @@ const isFormData = (thing) => {
282
336
  */
283
337
  const isURLSearchParams = kindOfTest('URLSearchParams');
284
338
 
285
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
339
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
340
+ 'ReadableStream',
341
+ 'Request',
342
+ 'Response',
343
+ 'Headers',
344
+ ].map(kindOfTest);
286
345
 
287
346
  /**
288
347
  * Trim excess whitespace off the beginning and end of a string
@@ -291,9 +350,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
291
350
  *
292
351
  * @returns {String} The String freed of excess whitespace
293
352
  */
294
- const trim = (str) => str.trim ?
295
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
296
-
353
+ const trim = (str) => {
354
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
355
+ };
297
356
  /**
298
357
  * Iterate over an Array or an Object invoking a function for each item.
299
358
  *
@@ -303,13 +362,14 @@ const trim = (str) => str.trim ?
303
362
  * If 'obj' is an Object callback will be called passing
304
363
  * the value, key, and complete object for each property.
305
364
  *
306
- * @param {Object|Array} obj The object to iterate
365
+ * @param {Object|Array<unknown>} obj The object to iterate
307
366
  * @param {Function} fn The callback to invoke for each item
308
367
  *
309
- * @param {Boolean} [allOwnKeys = false]
368
+ * @param {Object} [options]
369
+ * @param {Boolean} [options.allOwnKeys = false]
310
370
  * @returns {any}
311
371
  */
312
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
372
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
313
373
  // Don't bother if no value provided
314
374
  if (obj === null || typeof obj === 'undefined') {
315
375
  return;
@@ -347,8 +407,16 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
347
407
  }
348
408
  }
349
409
 
410
+ /**
411
+ * Finds a key in an object, case-insensitive, returning the actual key name.
412
+ * Returns null if the object is a Buffer or if no match is found.
413
+ *
414
+ * @param {Object} obj - The object to search.
415
+ * @param {string} key - The key to find (case-insensitive).
416
+ * @returns {?string} The actual key name if found, otherwise null.
417
+ */
350
418
  function findKey(obj, key) {
351
- if (isBuffer$1(obj)){
419
+ if (isBuffer$1(obj)) {
352
420
  return null;
353
421
  }
354
422
 
@@ -367,8 +435,8 @@ function findKey(obj, key) {
367
435
 
368
436
  const _global = (() => {
369
437
  /*eslint no-undef:0*/
370
- if (typeof globalThis !== "undefined") return globalThis;
371
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
438
+ if (typeof globalThis !== 'undefined') return globalThis;
439
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
372
440
  })();
373
441
 
374
442
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
@@ -383,7 +451,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
383
451
  * Example:
384
452
  *
385
453
  * ```js
386
- * var result = merge({foo: 123}, {foo: 456});
454
+ * const result = merge({foo: 123}, {foo: 456});
387
455
  * console.log(result.foo); // outputs 456
388
456
  * ```
389
457
  *
@@ -392,10 +460,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
392
460
  * @returns {Object} Result of all merge properties
393
461
  */
394
462
  function merge(/* obj1, obj2, obj3, ... */) {
395
- const {caseless, skipUndefined} = isContextDefined(this) && this || {};
463
+ const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
396
464
  const result = {};
397
465
  const assignValue = (val, key) => {
398
- const targetKey = caseless && findKey(result, key) || key;
466
+ // Skip dangerous property names to prevent prototype pollution
467
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
468
+ return;
469
+ }
470
+
471
+ const targetKey = (caseless && findKey(result, key)) || key;
399
472
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
400
473
  result[targetKey] = merge(result[targetKey], val);
401
474
  } else if (isPlainObject(val)) {
@@ -420,17 +493,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
420
493
  * @param {Object} b The object to copy properties from
421
494
  * @param {Object} thisArg The object to bind function to
422
495
  *
423
- * @param {Boolean} [allOwnKeys]
496
+ * @param {Object} [options]
497
+ * @param {Boolean} [options.allOwnKeys]
424
498
  * @returns {Object} The resulting value of object a
425
499
  */
426
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
427
- forEach(b, (val, key) => {
428
- if (thisArg && isFunction$2(val)) {
429
- a[key] = bind$2(val, thisArg);
430
- } else {
431
- a[key] = val;
432
- }
433
- }, {allOwnKeys});
500
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
501
+ forEach(
502
+ b,
503
+ (val, key) => {
504
+ if (thisArg && isFunction$2(val)) {
505
+ Object.defineProperty(a, key, {
506
+ value: bind$2(val, thisArg),
507
+ writable: true,
508
+ enumerable: true,
509
+ configurable: true,
510
+ });
511
+ } else {
512
+ Object.defineProperty(a, key, {
513
+ value: val,
514
+ writable: true,
515
+ enumerable: true,
516
+ configurable: true,
517
+ });
518
+ }
519
+ },
520
+ { allOwnKeys }
521
+ );
434
522
  return a;
435
523
  };
436
524
 
@@ -442,7 +530,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
442
530
  * @returns {string} content value without BOM
443
531
  */
444
532
  const stripBOM = (content) => {
445
- if (content.charCodeAt(0) === 0xFEFF) {
533
+ if (content.charCodeAt(0) === 0xfeff) {
446
534
  content = content.slice(1);
447
535
  }
448
536
  return content;
@@ -459,9 +547,14 @@ const stripBOM = (content) => {
459
547
  */
460
548
  const inherits = (constructor, superConstructor, props, descriptors) => {
461
549
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
462
- constructor.prototype.constructor = constructor;
550
+ Object.defineProperty(constructor.prototype, 'constructor', {
551
+ value: constructor,
552
+ writable: true,
553
+ enumerable: false,
554
+ configurable: true,
555
+ });
463
556
  Object.defineProperty(constructor, 'super', {
464
- value: superConstructor.prototype
557
+ value: superConstructor.prototype,
465
558
  });
466
559
  props && Object.assign(constructor.prototype, props);
467
560
  };
@@ -520,7 +613,6 @@ const endsWith = (str, searchString, position) => {
520
613
  return lastIndex !== -1 && lastIndex === position;
521
614
  };
522
615
 
523
-
524
616
  /**
525
617
  * Returns new array from array like object or null if failed
526
618
  *
@@ -549,9 +641,9 @@ const toArray = (thing) => {
549
641
  * @returns {Array}
550
642
  */
551
643
  // eslint-disable-next-line func-names
552
- const isTypedArray = (TypedArray => {
644
+ const isTypedArray = ((TypedArray) => {
553
645
  // eslint-disable-next-line func-names
554
- return thing => {
646
+ return (thing) => {
555
647
  return TypedArray && thing instanceof TypedArray;
556
648
  };
557
649
  })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
@@ -599,16 +691,18 @@ const matchAll = (regExp, str) => {
599
691
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
600
692
  const isHTMLForm = kindOfTest('HTMLFormElement');
601
693
 
602
- const toCamelCase = str => {
603
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
604
- function replacer(m, p1, p2) {
605
- return p1.toUpperCase() + p2;
606
- }
607
- );
694
+ const toCamelCase = (str) => {
695
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
696
+ return p1.toUpperCase() + p2;
697
+ });
608
698
  };
609
699
 
610
700
  /* Creating a function that will check if an object has a property. */
611
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
701
+ const hasOwnProperty = (
702
+ ({ hasOwnProperty }) =>
703
+ (obj, prop) =>
704
+ hasOwnProperty.call(obj, prop)
705
+ )(Object.prototype);
612
706
 
613
707
  /**
614
708
  * Determine if a value is a RegExp object
@@ -658,17 +752,25 @@ const freezeMethods = (obj) => {
658
752
 
659
753
  if (!descriptor.set) {
660
754
  descriptor.set = () => {
661
- throw Error('Can not rewrite read-only method \'' + name + '\'');
755
+ throw Error("Can not rewrite read-only method '" + name + "'");
662
756
  };
663
757
  }
664
758
  });
665
759
  };
666
760
 
761
+ /**
762
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
763
+ * Useful for fast membership checks.
764
+ *
765
+ * @param {Array|string} arrayOrString - The array or string to convert.
766
+ * @param {string} delimiter - The delimiter to use if input is a string.
767
+ * @returns {Object} An object with keys from the array or string, values set to true.
768
+ */
667
769
  const toObjectSet = (arrayOrString, delimiter) => {
668
770
  const obj = {};
669
771
 
670
772
  const define = (arr) => {
671
- arr.forEach(value => {
773
+ arr.forEach((value) => {
672
774
  obj[value] = true;
673
775
  });
674
776
  };
@@ -681,11 +783,9 @@ const toObjectSet = (arrayOrString, delimiter) => {
681
783
  const noop$1 = () => {};
682
784
 
683
785
  const toFiniteNumber = (value, defaultValue) => {
684
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
786
+ return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
685
787
  };
686
788
 
687
-
688
-
689
789
  /**
690
790
  * If the thing is a FormData object, return true, otherwise return false.
691
791
  *
@@ -694,14 +794,24 @@ const toFiniteNumber = (value, defaultValue) => {
694
794
  * @returns {boolean}
695
795
  */
696
796
  function isSpecCompliantForm(thing) {
697
- return !!(thing && isFunction$2(thing.append) && thing[toStringTag$1] === 'FormData' && thing[iterator]);
797
+ return !!(
798
+ thing &&
799
+ isFunction$2(thing.append) &&
800
+ thing[toStringTag$1] === 'FormData' &&
801
+ thing[iterator]
802
+ );
698
803
  }
699
804
 
805
+ /**
806
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
807
+ *
808
+ * @param {Object} obj - The object to convert.
809
+ * @returns {Object} The JSON-compatible object.
810
+ */
700
811
  const toJSONObject = (obj) => {
701
812
  const stack = new Array(10);
702
813
 
703
814
  const visit = (source, i) => {
704
-
705
815
  if (isObject(source)) {
706
816
  if (stack.indexOf(source) >= 0) {
707
817
  return;
@@ -712,7 +822,7 @@ const toJSONObject = (obj) => {
712
822
  return source;
713
823
  }
714
824
 
715
- if(!('toJSON' in source)) {
825
+ if (!('toJSON' in source)) {
716
826
  stack[i] = source;
717
827
  const target = isArray(source) ? [] : {};
718
828
 
@@ -733,45 +843,77 @@ const toJSONObject = (obj) => {
733
843
  return visit(obj, 0);
734
844
  };
735
845
 
846
+ /**
847
+ * Determines if a value is an async function.
848
+ *
849
+ * @param {*} thing - The value to test.
850
+ * @returns {boolean} True if value is an async function, otherwise false.
851
+ */
736
852
  const isAsyncFn = kindOfTest('AsyncFunction');
737
853
 
854
+ /**
855
+ * Determines if a value is thenable (has then and catch methods).
856
+ *
857
+ * @param {*} thing - The value to test.
858
+ * @returns {boolean} True if value is thenable, otherwise false.
859
+ */
738
860
  const isThenable = (thing) =>
739
- thing && (isObject(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
861
+ thing &&
862
+ (isObject(thing) || isFunction$2(thing)) &&
863
+ isFunction$2(thing.then) &&
864
+ isFunction$2(thing.catch);
740
865
 
741
866
  // original code
742
867
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
743
868
 
869
+ /**
870
+ * Provides a cross-platform setImmediate implementation.
871
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
872
+ *
873
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
874
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
875
+ * @returns {Function} A function to schedule a callback asynchronously.
876
+ */
744
877
  const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
745
878
  if (setImmediateSupported) {
746
879
  return setImmediate;
747
880
  }
748
881
 
749
- return postMessageSupported ? ((token, callbacks) => {
750
- _global.addEventListener("message", ({source, data}) => {
751
- if (source === _global && data === token) {
752
- callbacks.length && callbacks.shift()();
753
- }
754
- }, false);
882
+ return postMessageSupported
883
+ ? ((token, callbacks) => {
884
+ _global.addEventListener(
885
+ 'message',
886
+ ({ source, data }) => {
887
+ if (source === _global && data === token) {
888
+ callbacks.length && callbacks.shift()();
889
+ }
890
+ },
891
+ false
892
+ );
755
893
 
756
- return (cb) => {
757
- callbacks.push(cb);
758
- _global.postMessage(token, "*");
759
- }
760
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
761
- })(
762
- typeof setImmediate === 'function',
763
- isFunction$2(_global.postMessage)
764
- );
894
+ return (cb) => {
895
+ callbacks.push(cb);
896
+ _global.postMessage(token, '*');
897
+ };
898
+ })(`axios@${Math.random()}`, [])
899
+ : (cb) => setTimeout(cb);
900
+ })(typeof setImmediate === 'function', isFunction$2(_global.postMessage));
765
901
 
766
- const asap = typeof queueMicrotask !== 'undefined' ?
767
- queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
902
+ /**
903
+ * Schedules a microtask or asynchronous callback as soon as possible.
904
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
905
+ *
906
+ * @type {Function}
907
+ */
908
+ const asap =
909
+ typeof queueMicrotask !== 'undefined'
910
+ ? queueMicrotask.bind(_global)
911
+ : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
768
912
 
769
913
  // *********************
770
914
 
771
-
772
915
  const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
773
916
 
774
-
775
917
  var utils$1 = {
776
918
  isArray,
777
919
  isArrayBuffer,
@@ -791,6 +933,8 @@ var utils$1 = {
791
933
  isUndefined,
792
934
  isDate,
793
935
  isFile,
936
+ isReactNativeBlob,
937
+ isReactNative,
794
938
  isBlob,
795
939
  isRegExp,
796
940
  isFunction: isFunction$2,
@@ -829,40 +973,58 @@ var utils$1 = {
829
973
  isThenable,
830
974
  setImmediate: _setImmediate,
831
975
  asap,
832
- isIterable
833
- };/**
834
- * Create an Error with the specified message, config, error code, request and response.
835
- *
836
- * @param {string} message The error message.
837
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
838
- * @param {Object} [config] The config.
839
- * @param {Object} [request] The request.
840
- * @param {Object} [response] The response.
841
- *
842
- * @returns {Error} The created error.
843
- */
844
- function AxiosError(message, code, config, request, response) {
845
- Error.call(this);
976
+ isIterable,
977
+ };class AxiosError extends Error {
978
+ static from(error, code, config, request, response, customProps) {
979
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
980
+ axiosError.cause = error;
981
+ axiosError.name = error.name;
982
+
983
+ // Preserve status from the original error if not already set from response
984
+ if (error.status != null && axiosError.status == null) {
985
+ axiosError.status = error.status;
986
+ }
846
987
 
847
- if (Error.captureStackTrace) {
848
- Error.captureStackTrace(this, this.constructor);
849
- } else {
850
- this.stack = (new Error()).stack;
988
+ customProps && Object.assign(axiosError, customProps);
989
+ return axiosError;
851
990
  }
852
991
 
853
- this.message = message;
854
- this.name = 'AxiosError';
855
- code && (this.code = code);
856
- config && (this.config = config);
857
- request && (this.request = request);
858
- if (response) {
859
- this.response = response;
860
- this.status = response.status ? response.status : null;
861
- }
862
- }
992
+ /**
993
+ * Create an Error with the specified message, config, error code, request and response.
994
+ *
995
+ * @param {string} message The error message.
996
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
997
+ * @param {Object} [config] The config.
998
+ * @param {Object} [request] The request.
999
+ * @param {Object} [response] The response.
1000
+ *
1001
+ * @returns {Error} The created error.
1002
+ */
1003
+ constructor(message, code, config, request, response) {
1004
+ super(message);
1005
+
1006
+ // Make message enumerable to maintain backward compatibility
1007
+ // The native Error constructor sets message as non-enumerable,
1008
+ // but axios < v1.13.3 had it as enumerable
1009
+ Object.defineProperty(this, 'message', {
1010
+ value: message,
1011
+ enumerable: true,
1012
+ writable: true,
1013
+ configurable: true
1014
+ });
1015
+
1016
+ this.name = 'AxiosError';
1017
+ this.isAxiosError = true;
1018
+ code && (this.code = code);
1019
+ config && (this.config = config);
1020
+ request && (this.request = request);
1021
+ if (response) {
1022
+ this.response = response;
1023
+ this.status = response.status;
1024
+ }
1025
+ }
863
1026
 
864
- utils$1.inherits(AxiosError, Error, {
865
- toJSON: function toJSON() {
1027
+ toJSON() {
866
1028
  return {
867
1029
  // Standard
868
1030
  message: this.message,
@@ -878,62 +1040,26 @@ utils$1.inherits(AxiosError, Error, {
878
1040
  // Axios
879
1041
  config: utils$1.toJSONObject(this.config),
880
1042
  code: this.code,
881
- status: this.status
1043
+ status: this.status,
882
1044
  };
883
1045
  }
884
- });
885
-
886
- const prototype$1 = AxiosError.prototype;
887
- const descriptors = {};
888
-
889
- [
890
- 'ERR_BAD_OPTION_VALUE',
891
- 'ERR_BAD_OPTION',
892
- 'ECONNABORTED',
893
- 'ETIMEDOUT',
894
- 'ERR_NETWORK',
895
- 'ERR_FR_TOO_MANY_REDIRECTS',
896
- 'ERR_DEPRECATED',
897
- 'ERR_BAD_RESPONSE',
898
- 'ERR_BAD_REQUEST',
899
- 'ERR_CANCELED',
900
- 'ERR_NOT_SUPPORT',
901
- 'ERR_INVALID_URL'
902
- // eslint-disable-next-line func-names
903
- ].forEach(code => {
904
- descriptors[code] = {value: code};
905
- });
906
-
907
- Object.defineProperties(AxiosError, descriptors);
908
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
909
-
910
- // eslint-disable-next-line func-names
911
- AxiosError.from = (error, code, config, request, response, customProps) => {
912
- const axiosError = Object.create(prototype$1);
913
-
914
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
915
- return obj !== Error.prototype;
916
- }, prop => {
917
- return prop !== 'isAxiosError';
918
- });
919
-
920
- const msg = error && error.message ? error.message : 'Error';
921
-
922
- // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
923
- const errCode = code == null && error ? error.code : code;
924
- AxiosError.call(axiosError, msg, errCode, config, request, response);
925
-
926
- // Chain the original error on the standard field; non-enumerable to avoid JSON noise
927
- if (error && axiosError.cause == null) {
928
- Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
929
- }
930
-
931
- axiosError.name = (error && error.name) || 'Error';
932
-
933
- customProps && Object.assign(axiosError, customProps);
1046
+ }
934
1047
 
935
- return axiosError;
936
- };var Stream$2 = stream.Stream;
1048
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1049
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1050
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1051
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
1052
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1053
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1054
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1055
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1056
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1057
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1058
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1059
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1060
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1061
+
1062
+ var AxiosError$1 = AxiosError;var Stream$2 = stream.Stream;
937
1063
  var util$2 = require$$1;
938
1064
 
939
1065
  var delayed_stream = DelayedStream$1;
@@ -13776,7 +13902,7 @@ FormData$1.prototype.submit = function (params, cb) {
13776
13902
  request.removeListener('error', callback);
13777
13903
  request.removeListener('response', onResponse);
13778
13904
 
13779
- return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
13905
+ return cb.call(this, error, responce);
13780
13906
  };
13781
13907
 
13782
13908
  onResponse = callback.bind(this, null);
@@ -13800,7 +13926,7 @@ FormData$1.prototype._error = function (err) {
13800
13926
  FormData$1.prototype.toString = function () {
13801
13927
  return '[object FormData]';
13802
13928
  };
13803
- setToStringTag(FormData$1, 'FormData');
13929
+ setToStringTag(FormData$1.prototype, 'FormData');
13804
13930
 
13805
13931
  // Public API
13806
13932
  var form_data = FormData$1;
@@ -13838,11 +13964,14 @@ function removeBrackets(key) {
13838
13964
  */
13839
13965
  function renderKey(path, key, dots) {
13840
13966
  if (!path) return key;
13841
- return path.concat(key).map(function each(token, i) {
13842
- // eslint-disable-next-line no-param-reassign
13843
- token = removeBrackets(token);
13844
- return !dots && i ? '[' + token + ']' : token;
13845
- }).join(dots ? '.' : '');
13967
+ return path
13968
+ .concat(key)
13969
+ .map(function each(token, i) {
13970
+ // eslint-disable-next-line no-param-reassign
13971
+ token = removeBrackets(token);
13972
+ return !dots && i ? '[' + token + ']' : token;
13973
+ })
13974
+ .join(dots ? '.' : '');
13846
13975
  }
13847
13976
 
13848
13977
  /**
@@ -13892,21 +14021,26 @@ function toFormData(obj, formData, options) {
13892
14021
  formData = formData || new (FormData$2 || FormData)();
13893
14022
 
13894
14023
  // eslint-disable-next-line no-param-reassign
13895
- options = utils$1.toFlatObject(options, {
13896
- metaTokens: true,
13897
- dots: false,
13898
- indexes: false
13899
- }, false, function defined(option, source) {
13900
- // eslint-disable-next-line no-eq-null,eqeqeq
13901
- return !utils$1.isUndefined(source[option]);
13902
- });
14024
+ options = utils$1.toFlatObject(
14025
+ options,
14026
+ {
14027
+ metaTokens: true,
14028
+ dots: false,
14029
+ indexes: false,
14030
+ },
14031
+ false,
14032
+ function defined(option, source) {
14033
+ // eslint-disable-next-line no-eq-null,eqeqeq
14034
+ return !utils$1.isUndefined(source[option]);
14035
+ }
14036
+ );
13903
14037
 
13904
14038
  const metaTokens = options.metaTokens;
13905
14039
  // eslint-disable-next-line no-use-before-define
13906
14040
  const visitor = options.visitor || defaultVisitor;
13907
14041
  const dots = options.dots;
13908
14042
  const indexes = options.indexes;
13909
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
14043
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
13910
14044
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
13911
14045
 
13912
14046
  if (!utils$1.isFunction(visitor)) {
@@ -13925,7 +14059,7 @@ function toFormData(obj, formData, options) {
13925
14059
  }
13926
14060
 
13927
14061
  if (!useBlob && utils$1.isBlob(value)) {
13928
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
14062
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
13929
14063
  }
13930
14064
 
13931
14065
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
@@ -13948,6 +14082,11 @@ function toFormData(obj, formData, options) {
13948
14082
  function defaultVisitor(value, key, path) {
13949
14083
  let arr = value;
13950
14084
 
14085
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
14086
+ formData.append(renderKey(path, key, dots), convertValue(value));
14087
+ return false;
14088
+ }
14089
+
13951
14090
  if (value && !path && typeof value === 'object') {
13952
14091
  if (utils$1.endsWith(key, '{}')) {
13953
14092
  // eslint-disable-next-line no-param-reassign
@@ -13956,17 +14095,22 @@ function toFormData(obj, formData, options) {
13956
14095
  value = JSON.stringify(value);
13957
14096
  } else if (
13958
14097
  (utils$1.isArray(value) && isFlatArray(value)) ||
13959
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
13960
- )) {
14098
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
14099
+ ) {
13961
14100
  // eslint-disable-next-line no-param-reassign
13962
14101
  key = removeBrackets(key);
13963
14102
 
13964
14103
  arr.forEach(function each(el, index) {
13965
- !(utils$1.isUndefined(el) || el === null) && formData.append(
13966
- // eslint-disable-next-line no-nested-ternary
13967
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
13968
- convertValue(el)
13969
- );
14104
+ !(utils$1.isUndefined(el) || el === null) &&
14105
+ formData.append(
14106
+ // eslint-disable-next-line no-nested-ternary
14107
+ indexes === true
14108
+ ? renderKey([key], index, dots)
14109
+ : indexes === null
14110
+ ? key
14111
+ : key + '[]',
14112
+ convertValue(el)
14113
+ );
13970
14114
  });
13971
14115
  return false;
13972
14116
  }
@@ -13986,7 +14130,7 @@ function toFormData(obj, formData, options) {
13986
14130
  const exposedHelpers = Object.assign(predicates, {
13987
14131
  defaultVisitor,
13988
14132
  convertValue,
13989
- isVisitable
14133
+ isVisitable,
13990
14134
  });
13991
14135
 
13992
14136
  function build(value, path) {
@@ -13999,9 +14143,9 @@ function toFormData(obj, formData, options) {
13999
14143
  stack.push(value);
14000
14144
 
14001
14145
  utils$1.forEach(value, function each(el, key) {
14002
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
14003
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
14004
- );
14146
+ const result =
14147
+ !(utils$1.isUndefined(el) || el === null) &&
14148
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
14005
14149
 
14006
14150
  if (result === true) {
14007
14151
  build(el, path ? path.concat(key) : [key]);
@@ -14034,7 +14178,7 @@ function encode$1(str) {
14034
14178
  ')': '%29',
14035
14179
  '~': '%7E',
14036
14180
  '%20': '+',
14037
- '%00': '\x00'
14181
+ '%00': '\x00',
14038
14182
  };
14039
14183
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
14040
14184
  return charMap[match];
@@ -14062,13 +14206,17 @@ prototype.append = function append(name, value) {
14062
14206
  };
14063
14207
 
14064
14208
  prototype.toString = function toString(encoder) {
14065
- const _encode = encoder ? function(value) {
14066
- return encoder.call(this, value, encode$1);
14067
- } : encode$1;
14209
+ const _encode = encoder
14210
+ ? function (value) {
14211
+ return encoder.call(this, value, encode$1);
14212
+ }
14213
+ : encode$1;
14068
14214
 
14069
- return this._pairs.map(function each(pair) {
14070
- return _encode(pair[0]) + '=' + _encode(pair[1]);
14071
- }, '').join('&');
14215
+ return this._pairs
14216
+ .map(function each(pair) {
14217
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
14218
+ }, '')
14219
+ .join('&');
14072
14220
  };/**
14073
14221
  * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
14074
14222
  * URI encoded counterparts
@@ -14078,11 +14226,11 @@ prototype.toString = function toString(encoder) {
14078
14226
  * @returns {string} The encoded value.
14079
14227
  */
14080
14228
  function encode(val) {
14081
- return encodeURIComponent(val).
14082
- replace(/%3A/gi, ':').
14083
- replace(/%24/g, '$').
14084
- replace(/%2C/gi, ',').
14085
- replace(/%20/g, '+');
14229
+ return encodeURIComponent(val)
14230
+ .replace(/%3A/gi, ':')
14231
+ .replace(/%24/g, '$')
14232
+ .replace(/%2C/gi, ',')
14233
+ .replace(/%20/g, '+');
14086
14234
  }
14087
14235
 
14088
14236
  /**
@@ -14095,33 +14243,32 @@ function encode(val) {
14095
14243
  * @returns {string} The formatted url
14096
14244
  */
14097
14245
  function buildURL(url, params, options) {
14098
- /*eslint no-param-reassign:0*/
14099
14246
  if (!params) {
14100
14247
  return url;
14101
14248
  }
14102
-
14103
- const _encode = options && options.encode || encode;
14104
14249
 
14105
- if (utils$1.isFunction(options)) {
14106
- options = {
14107
- serialize: options
14108
- };
14109
- }
14250
+ const _encode = (options && options.encode) || encode;
14251
+
14252
+ const _options = utils$1.isFunction(options)
14253
+ ? {
14254
+ serialize: options,
14255
+ }
14256
+ : options;
14110
14257
 
14111
- const serializeFn = options && options.serialize;
14258
+ const serializeFn = _options && _options.serialize;
14112
14259
 
14113
14260
  let serializedParams;
14114
14261
 
14115
14262
  if (serializeFn) {
14116
- serializedParams = serializeFn(params, options);
14263
+ serializedParams = serializeFn(params, _options);
14117
14264
  } else {
14118
- serializedParams = utils$1.isURLSearchParams(params) ?
14119
- params.toString() :
14120
- new AxiosURLSearchParams(params, options).toString(_encode);
14265
+ serializedParams = utils$1.isURLSearchParams(params)
14266
+ ? params.toString()
14267
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
14121
14268
  }
14122
14269
 
14123
14270
  if (serializedParams) {
14124
- const hashmarkIndex = url.indexOf("#");
14271
+ const hashmarkIndex = url.indexOf('#');
14125
14272
 
14126
14273
  if (hashmarkIndex !== -1) {
14127
14274
  url = url.slice(0, hashmarkIndex);
@@ -14140,6 +14287,7 @@ function buildURL(url, params, options) {
14140
14287
  *
14141
14288
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
14142
14289
  * @param {Function} rejected The function to handle `reject` for a `Promise`
14290
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
14143
14291
  *
14144
14292
  * @return {Number} An ID used to remove interceptor later
14145
14293
  */
@@ -14148,7 +14296,7 @@ function buildURL(url, params, options) {
14148
14296
  fulfilled,
14149
14297
  rejected,
14150
14298
  synchronous: options ? options.synchronous : false,
14151
- runWhen: options ? options.runWhen : null
14299
+ runWhen: options ? options.runWhen : null,
14152
14300
  });
14153
14301
  return this.handlers.length - 1;
14154
14302
  }
@@ -14158,7 +14306,7 @@ function buildURL(url, params, options) {
14158
14306
  *
14159
14307
  * @param {Number} id The ID that was returned by `use`
14160
14308
  *
14161
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
14309
+ * @returns {void}
14162
14310
  */
14163
14311
  eject(id) {
14164
14312
  if (this.handlers[id]) {
@@ -14199,7 +14347,8 @@ function buildURL(url, params, options) {
14199
14347
  var InterceptorManager$1 = InterceptorManager;var transitionalDefaults = {
14200
14348
  silentJSONParsing: true,
14201
14349
  forcedJSONParsing: true,
14202
- clarifyTimeoutError: false
14350
+ clarifyTimeoutError: false,
14351
+ legacyInterceptorReqResOrdering: true,
14203
14352
  };var URLSearchParams = require$$0$1.URLSearchParams;const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
14204
14353
 
14205
14354
  const DIGIT = '0123456789';
@@ -14207,12 +14356,12 @@ const DIGIT = '0123456789';
14207
14356
  const ALPHABET = {
14208
14357
  DIGIT,
14209
14358
  ALPHA,
14210
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
14359
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT,
14211
14360
  };
14212
14361
 
14213
14362
  const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
14214
14363
  let str = '';
14215
- const {length} = alphabet;
14364
+ const { length } = alphabet;
14216
14365
  const randomValues = new Uint32Array(size);
14217
14366
  require$$8.randomFillSync(randomValues);
14218
14367
  for (let i = 0; i < size; i++) {
@@ -14222,20 +14371,19 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
14222
14371
  return str;
14223
14372
  };
14224
14373
 
14225
-
14226
14374
  var platform$1 = {
14227
14375
  isNode: true,
14228
14376
  classes: {
14229
14377
  URLSearchParams,
14230
14378
  FormData: FormData$2,
14231
- Blob: typeof Blob !== 'undefined' && Blob || null
14379
+ Blob: (typeof Blob !== 'undefined' && Blob) || null,
14232
14380
  },
14233
14381
  ALPHABET,
14234
14382
  generateString,
14235
- protocols: [ 'http', 'https', 'file', 'data' ]
14383
+ protocols: ['http', 'https', 'file', 'data'],
14236
14384
  };const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
14237
14385
 
14238
- const _navigator = typeof navigator === 'object' && navigator || undefined;
14386
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
14239
14387
 
14240
14388
  /**
14241
14389
  * Determine if we're running in a standard browser environment
@@ -14254,7 +14402,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
14254
14402
  *
14255
14403
  * @returns {boolean}
14256
14404
  */
14257
- const hasStandardBrowserEnv = hasBrowserEnv &&
14405
+ const hasStandardBrowserEnv =
14406
+ hasBrowserEnv &&
14258
14407
  (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
14259
14408
 
14260
14409
  /**
@@ -14275,13 +14424,13 @@ const hasStandardBrowserWebWorkerEnv = (() => {
14275
14424
  );
14276
14425
  })();
14277
14426
 
14278
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
14427
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
14279
14428
  var utils=/*#__PURE__*/Object.freeze({__proto__:null,hasBrowserEnv:hasBrowserEnv,hasStandardBrowserWebWorkerEnv:hasStandardBrowserWebWorkerEnv,hasStandardBrowserEnv:hasStandardBrowserEnv,navigator:_navigator,origin:origin});var platform = {
14280
14429
  ...utils,
14281
- ...platform$1
14430
+ ...platform$1,
14282
14431
  };function toURLEncodedForm(data, options) {
14283
14432
  return toFormData(data, new platform.classes.URLSearchParams(), {
14284
- visitor: function(value, key, path, helpers) {
14433
+ visitor: function (value, key, path, helpers) {
14285
14434
  if (platform.isNode && utils$1.isBuffer(value)) {
14286
14435
  this.append(key, value.toString('base64'));
14287
14436
  return false;
@@ -14289,7 +14438,7 @@ var utils=/*#__PURE__*/Object.freeze({__proto__:null,hasBrowserEnv:hasBrowserEnv
14289
14438
 
14290
14439
  return helpers.defaultVisitor.apply(this, arguments);
14291
14440
  },
14292
- ...options
14441
+ ...options,
14293
14442
  });
14294
14443
  }/**
14295
14444
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
@@ -14303,7 +14452,7 @@ function parsePropPath(name) {
14303
14452
  // foo.x.y.z
14304
14453
  // foo-x-y-z
14305
14454
  // foo x y z
14306
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
14455
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
14307
14456
  return match[0] === '[]' ? '' : match[1] || match[0];
14308
14457
  });
14309
14458
  }
@@ -14405,96 +14554,107 @@ function stringifySafely(rawValue, parser, encoder) {
14405
14554
  }
14406
14555
 
14407
14556
  const defaults = {
14408
-
14409
14557
  transitional: transitionalDefaults,
14410
14558
 
14411
14559
  adapter: ['xhr', 'http', 'fetch'],
14412
14560
 
14413
- transformRequest: [function transformRequest(data, headers) {
14414
- const contentType = headers.getContentType() || '';
14415
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
14416
- const isObjectPayload = utils$1.isObject(data);
14561
+ transformRequest: [
14562
+ function transformRequest(data, headers) {
14563
+ const contentType = headers.getContentType() || '';
14564
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
14565
+ const isObjectPayload = utils$1.isObject(data);
14417
14566
 
14418
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
14419
- data = new FormData(data);
14420
- }
14567
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
14568
+ data = new FormData(data);
14569
+ }
14421
14570
 
14422
- const isFormData = utils$1.isFormData(data);
14571
+ const isFormData = utils$1.isFormData(data);
14423
14572
 
14424
- if (isFormData) {
14425
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
14426
- }
14573
+ if (isFormData) {
14574
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
14575
+ }
14427
14576
 
14428
- if (utils$1.isArrayBuffer(data) ||
14429
- utils$1.isBuffer(data) ||
14430
- utils$1.isStream(data) ||
14431
- utils$1.isFile(data) ||
14432
- utils$1.isBlob(data) ||
14433
- utils$1.isReadableStream(data)
14434
- ) {
14435
- return data;
14436
- }
14437
- if (utils$1.isArrayBufferView(data)) {
14438
- return data.buffer;
14439
- }
14440
- if (utils$1.isURLSearchParams(data)) {
14441
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
14442
- return data.toString();
14443
- }
14577
+ if (
14578
+ utils$1.isArrayBuffer(data) ||
14579
+ utils$1.isBuffer(data) ||
14580
+ utils$1.isStream(data) ||
14581
+ utils$1.isFile(data) ||
14582
+ utils$1.isBlob(data) ||
14583
+ utils$1.isReadableStream(data)
14584
+ ) {
14585
+ return data;
14586
+ }
14587
+ if (utils$1.isArrayBufferView(data)) {
14588
+ return data.buffer;
14589
+ }
14590
+ if (utils$1.isURLSearchParams(data)) {
14591
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
14592
+ return data.toString();
14593
+ }
14444
14594
 
14445
- let isFileList;
14595
+ let isFileList;
14446
14596
 
14447
- if (isObjectPayload) {
14448
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
14449
- return toURLEncodedForm(data, this.formSerializer).toString();
14450
- }
14597
+ if (isObjectPayload) {
14598
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
14599
+ return toURLEncodedForm(data, this.formSerializer).toString();
14600
+ }
14451
14601
 
14452
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
14453
- const _FormData = this.env && this.env.FormData;
14602
+ if (
14603
+ (isFileList = utils$1.isFileList(data)) ||
14604
+ contentType.indexOf('multipart/form-data') > -1
14605
+ ) {
14606
+ const _FormData = this.env && this.env.FormData;
14454
14607
 
14455
- return toFormData(
14456
- isFileList ? {'files[]': data} : data,
14457
- _FormData && new _FormData(),
14458
- this.formSerializer
14459
- );
14608
+ return toFormData(
14609
+ isFileList ? { 'files[]': data } : data,
14610
+ _FormData && new _FormData(),
14611
+ this.formSerializer
14612
+ );
14613
+ }
14460
14614
  }
14461
- }
14462
14615
 
14463
- if (isObjectPayload || hasJSONContentType ) {
14464
- headers.setContentType('application/json', false);
14465
- return stringifySafely(data);
14466
- }
14616
+ if (isObjectPayload || hasJSONContentType) {
14617
+ headers.setContentType('application/json', false);
14618
+ return stringifySafely(data);
14619
+ }
14467
14620
 
14468
- return data;
14469
- }],
14621
+ return data;
14622
+ },
14623
+ ],
14470
14624
 
14471
- transformResponse: [function transformResponse(data) {
14472
- const transitional = this.transitional || defaults.transitional;
14473
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
14474
- const JSONRequested = this.responseType === 'json';
14625
+ transformResponse: [
14626
+ function transformResponse(data) {
14627
+ const transitional = this.transitional || defaults.transitional;
14628
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
14629
+ const JSONRequested = this.responseType === 'json';
14475
14630
 
14476
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
14477
- return data;
14478
- }
14631
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
14632
+ return data;
14633
+ }
14479
14634
 
14480
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
14481
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
14482
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
14635
+ if (
14636
+ data &&
14637
+ utils$1.isString(data) &&
14638
+ ((forcedJSONParsing && !this.responseType) || JSONRequested)
14639
+ ) {
14640
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
14641
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
14483
14642
 
14484
- try {
14485
- return JSON.parse(data, this.parseReviver);
14486
- } catch (e) {
14487
- if (strictJSONParsing) {
14488
- if (e.name === 'SyntaxError') {
14489
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
14643
+ try {
14644
+ return JSON.parse(data, this.parseReviver);
14645
+ } catch (e) {
14646
+ if (strictJSONParsing) {
14647
+ if (e.name === 'SyntaxError') {
14648
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
14649
+ }
14650
+ throw e;
14490
14651
  }
14491
- throw e;
14492
14652
  }
14493
14653
  }
14494
- }
14495
14654
 
14496
- return data;
14497
- }],
14655
+ return data;
14656
+ },
14657
+ ],
14498
14658
 
14499
14659
  /**
14500
14660
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -14510,7 +14670,7 @@ const defaults = {
14510
14670
 
14511
14671
  env: {
14512
14672
  FormData: platform.classes.FormData,
14513
- Blob: platform.classes.Blob
14673
+ Blob: platform.classes.Blob,
14514
14674
  },
14515
14675
 
14516
14676
  validateStatus: function validateStatus(status) {
@@ -14519,10 +14679,10 @@ const defaults = {
14519
14679
 
14520
14680
  headers: {
14521
14681
  common: {
14522
- 'Accept': 'application/json, text/plain, */*',
14523
- 'Content-Type': undefined
14524
- }
14525
- }
14682
+ Accept: 'application/json, text/plain, */*',
14683
+ 'Content-Type': undefined,
14684
+ },
14685
+ },
14526
14686
  };
14527
14687
 
14528
14688
  utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
@@ -14532,10 +14692,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
14532
14692
  var defaults$1 = defaults;// RawAxiosHeaders whose duplicates are ignored by node
14533
14693
  // c.f. https://nodejs.org/api/http.html#http_message_headers
14534
14694
  const ignoreDuplicateOf = utils$1.toObjectSet([
14535
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
14536
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
14537
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
14538
- 'referer', 'retry-after', 'user-agent'
14695
+ 'age',
14696
+ 'authorization',
14697
+ 'content-length',
14698
+ 'content-type',
14699
+ 'etag',
14700
+ 'expires',
14701
+ 'from',
14702
+ 'host',
14703
+ 'if-modified-since',
14704
+ 'if-unmodified-since',
14705
+ 'last-modified',
14706
+ 'location',
14707
+ 'max-forwards',
14708
+ 'proxy-authorization',
14709
+ 'referer',
14710
+ 'retry-after',
14711
+ 'user-agent',
14539
14712
  ]);
14540
14713
 
14541
14714
  /**
@@ -14552,31 +14725,32 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
14552
14725
  *
14553
14726
  * @returns {Object} Headers parsed into an object
14554
14727
  */
14555
- var parseHeaders = rawHeaders => {
14728
+ var parseHeaders = (rawHeaders) => {
14556
14729
  const parsed = {};
14557
14730
  let key;
14558
14731
  let val;
14559
14732
  let i;
14560
14733
 
14561
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
14562
- i = line.indexOf(':');
14563
- key = line.substring(0, i).trim().toLowerCase();
14564
- val = line.substring(i + 1).trim();
14734
+ rawHeaders &&
14735
+ rawHeaders.split('\n').forEach(function parser(line) {
14736
+ i = line.indexOf(':');
14737
+ key = line.substring(0, i).trim().toLowerCase();
14738
+ val = line.substring(i + 1).trim();
14565
14739
 
14566
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
14567
- return;
14568
- }
14740
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
14741
+ return;
14742
+ }
14569
14743
 
14570
- if (key === 'set-cookie') {
14571
- if (parsed[key]) {
14572
- parsed[key].push(val);
14744
+ if (key === 'set-cookie') {
14745
+ if (parsed[key]) {
14746
+ parsed[key].push(val);
14747
+ } else {
14748
+ parsed[key] = [val];
14749
+ }
14573
14750
  } else {
14574
- parsed[key] = [val];
14751
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
14575
14752
  }
14576
- } else {
14577
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
14578
- }
14579
- });
14753
+ });
14580
14754
 
14581
14755
  return parsed;
14582
14756
  };const $internals = Symbol('internals');
@@ -14628,8 +14802,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
14628
14802
  }
14629
14803
 
14630
14804
  function formatHeader(header) {
14631
- return header.trim()
14632
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
14805
+ return header
14806
+ .trim()
14807
+ .toLowerCase()
14808
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
14633
14809
  return char.toUpperCase() + str;
14634
14810
  });
14635
14811
  }
@@ -14637,12 +14813,12 @@ function formatHeader(header) {
14637
14813
  function buildAccessors(obj, header) {
14638
14814
  const accessorName = utils$1.toCamelCase(' ' + header);
14639
14815
 
14640
- ['get', 'set', 'has'].forEach(methodName => {
14816
+ ['get', 'set', 'has'].forEach((methodName) => {
14641
14817
  Object.defineProperty(obj, methodName + accessorName, {
14642
- value: function(arg1, arg2, arg3) {
14818
+ value: function (arg1, arg2, arg3) {
14643
14819
  return this[methodName].call(this, header, arg1, arg2, arg3);
14644
14820
  },
14645
- configurable: true
14821
+ configurable: true,
14646
14822
  });
14647
14823
  });
14648
14824
  }
@@ -14664,7 +14840,12 @@ class AxiosHeaders {
14664
14840
 
14665
14841
  const key = utils$1.findKey(self, lHeader);
14666
14842
 
14667
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
14843
+ if (
14844
+ !key ||
14845
+ self[key] === undefined ||
14846
+ _rewrite === true ||
14847
+ (_rewrite === undefined && self[key] !== false)
14848
+ ) {
14668
14849
  self[key || _header] = normalizeValue(_value);
14669
14850
  }
14670
14851
  }
@@ -14674,17 +14855,22 @@ class AxiosHeaders {
14674
14855
 
14675
14856
  if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
14676
14857
  setHeaders(header, valueOrRewrite);
14677
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
14858
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
14678
14859
  setHeaders(parseHeaders(header), valueOrRewrite);
14679
14860
  } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
14680
- let obj = {}, dest, key;
14861
+ let obj = {},
14862
+ dest,
14863
+ key;
14681
14864
  for (const entry of header) {
14682
14865
  if (!utils$1.isArray(entry)) {
14683
14866
  throw TypeError('Object iterator must return a key-value pair');
14684
14867
  }
14685
14868
 
14686
- obj[key = entry[0]] = (dest = obj[key]) ?
14687
- (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
14869
+ obj[(key = entry[0])] = (dest = obj[key])
14870
+ ? utils$1.isArray(dest)
14871
+ ? [...dest, entry[1]]
14872
+ : [dest, entry[1]]
14873
+ : entry[1];
14688
14874
  }
14689
14875
 
14690
14876
  setHeaders(obj, valueOrRewrite);
@@ -14731,7 +14917,11 @@ class AxiosHeaders {
14731
14917
  if (header) {
14732
14918
  const key = utils$1.findKey(this, header);
14733
14919
 
14734
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
14920
+ return !!(
14921
+ key &&
14922
+ this[key] !== undefined &&
14923
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
14924
+ );
14735
14925
  }
14736
14926
 
14737
14927
  return false;
@@ -14771,7 +14961,7 @@ class AxiosHeaders {
14771
14961
 
14772
14962
  while (i--) {
14773
14963
  const key = keys[i];
14774
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
14964
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
14775
14965
  delete this[key];
14776
14966
  deleted = true;
14777
14967
  }
@@ -14815,7 +15005,9 @@ class AxiosHeaders {
14815
15005
  const obj = Object.create(null);
14816
15006
 
14817
15007
  utils$1.forEach(this, (value, header) => {
14818
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
15008
+ value != null &&
15009
+ value !== false &&
15010
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
14819
15011
  });
14820
15012
 
14821
15013
  return obj;
@@ -14826,11 +15018,13 @@ class AxiosHeaders {
14826
15018
  }
14827
15019
 
14828
15020
  toString() {
14829
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
15021
+ return Object.entries(this.toJSON())
15022
+ .map(([header, value]) => header + ': ' + value)
15023
+ .join('\n');
14830
15024
  }
14831
15025
 
14832
15026
  getSetCookie() {
14833
- return this.get("set-cookie") || [];
15027
+ return this.get('set-cookie') || [];
14834
15028
  }
14835
15029
 
14836
15030
  get [Symbol.toStringTag]() {
@@ -14850,9 +15044,12 @@ class AxiosHeaders {
14850
15044
  }
14851
15045
 
14852
15046
  static accessor(header) {
14853
- const internals = this[$internals] = (this[$internals] = {
14854
- accessors: {}
14855
- });
15047
+ const internals =
15048
+ (this[$internals] =
15049
+ this[$internals] =
15050
+ {
15051
+ accessors: {},
15052
+ });
14856
15053
 
14857
15054
  const accessors = internals.accessors;
14858
15055
  const prototype = this.prototype;
@@ -14872,17 +15069,24 @@ class AxiosHeaders {
14872
15069
  }
14873
15070
  }
14874
15071
 
14875
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
15072
+ AxiosHeaders.accessor([
15073
+ 'Content-Type',
15074
+ 'Content-Length',
15075
+ 'Accept',
15076
+ 'Accept-Encoding',
15077
+ 'User-Agent',
15078
+ 'Authorization',
15079
+ ]);
14876
15080
 
14877
15081
  // reserved names hotfix
14878
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
15082
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
14879
15083
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
14880
15084
  return {
14881
15085
  get: () => value,
14882
15086
  set(headerValue) {
14883
15087
  this[mapped] = headerValue;
14884
- }
14885
- }
15088
+ },
15089
+ };
14886
15090
  });
14887
15091
 
14888
15092
  utils$1.freezeMethods(AxiosHeaders);
@@ -14910,24 +15114,24 @@ function transformData(fns, response) {
14910
15114
  return data;
14911
15115
  }function isCancel(value) {
14912
15116
  return !!(value && value.__CANCEL__);
14913
- }/**
14914
- * A `CanceledError` is an object that is thrown when an operation is canceled.
14915
- *
14916
- * @param {string=} message The message.
14917
- * @param {Object=} config The config.
14918
- * @param {Object=} request The request.
14919
- *
14920
- * @returns {CanceledError} The created error.
14921
- */
14922
- function CanceledError(message, config, request) {
14923
- // eslint-disable-next-line no-eq-null,eqeqeq
14924
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
14925
- this.name = 'CanceledError';
15117
+ }class CanceledError extends AxiosError$1 {
15118
+ /**
15119
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
15120
+ *
15121
+ * @param {string=} message The message.
15122
+ * @param {Object=} config The config.
15123
+ * @param {Object=} request The request.
15124
+ *
15125
+ * @returns {CanceledError} The created error.
15126
+ */
15127
+ constructor(message, config, request) {
15128
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
15129
+ this.name = 'CanceledError';
15130
+ this.__CANCEL__ = true;
15131
+ }
14926
15132
  }
14927
15133
 
14928
- utils$1.inherits(CanceledError, AxiosError, {
14929
- __CANCEL__: true
14930
- });/**
15134
+ var CanceledError$1 = CanceledError;/**
14931
15135
  * Resolve or reject a Promise based on response status.
14932
15136
  *
14933
15137
  * @param {Function} resolve A function that resolves the promise.
@@ -14941,13 +15145,17 @@ function settle(resolve, reject, response) {
14941
15145
  if (!response.status || !validateStatus || validateStatus(response.status)) {
14942
15146
  resolve(response);
14943
15147
  } else {
14944
- reject(new AxiosError(
14945
- 'Request failed with status code ' + response.status,
14946
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
14947
- response.config,
14948
- response.request,
14949
- response
14950
- ));
15148
+ reject(
15149
+ new AxiosError$1(
15150
+ 'Request failed with status code ' + response.status,
15151
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
15152
+ Math.floor(response.status / 100) - 4
15153
+ ],
15154
+ response.config,
15155
+ response.request,
15156
+ response
15157
+ )
15158
+ );
14951
15159
  }
14952
15160
  }/**
14953
15161
  * Determines whether the specified URL is absolute
@@ -14960,6 +15168,10 @@ function isAbsoluteURL(url) {
14960
15168
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
14961
15169
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
14962
15170
  // by any combination of letters, digits, plus, period, or hyphen.
15171
+ if (typeof url !== 'string') {
15172
+ return false;
15173
+ }
15174
+
14963
15175
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14964
15176
  }/**
14965
15177
  * Creates a new URL by combining the specified URLs
@@ -16829,9 +17041,9 @@ function isURL(value) {
16829
17041
 
16830
17042
  // Exports
16831
17043
  followRedirects.exports = wrap({ http: http, https: https });
16832
- followRedirects.exports.wrap = wrap;const VERSION = "1.12.2";function parseProtocol(url) {
17044
+ followRedirects.exports.wrap = wrap;const VERSION = "1.13.6";function parseProtocol(url) {
16833
17045
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
16834
- return match && match[1] || '';
17046
+ return (match && match[1]) || '';
16835
17047
  }const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
16836
17048
 
16837
17049
  /**
@@ -16845,7 +17057,7 @@ followRedirects.exports.wrap = wrap;const VERSION = "1.12.2";function parseProto
16845
17057
  * @returns {Buffer|Blob}
16846
17058
  */
16847
17059
  function fromDataURI(uri, asBlob, options) {
16848
- const _Blob = options && options.Blob || platform.classes.Blob;
17060
+ const _Blob = (options && options.Blob) || platform.classes.Blob;
16849
17061
  const protocol = parseProtocol(uri);
16850
17062
 
16851
17063
  if (asBlob === undefined && _Blob) {
@@ -16858,7 +17070,7 @@ function fromDataURI(uri, asBlob, options) {
16858
17070
  const match = DATA_URL_PATTERN.exec(uri);
16859
17071
 
16860
17072
  if (!match) {
16861
- throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
17073
+ throw new AxiosError$1('Invalid URL', AxiosError$1.ERR_INVALID_URL);
16862
17074
  }
16863
17075
 
16864
17076
  const mime = match[1];
@@ -16868,36 +17080,41 @@ function fromDataURI(uri, asBlob, options) {
16868
17080
 
16869
17081
  if (asBlob) {
16870
17082
  if (!_Blob) {
16871
- throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
17083
+ throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
16872
17084
  }
16873
17085
 
16874
- return new _Blob([buffer], {type: mime});
17086
+ return new _Blob([buffer], { type: mime });
16875
17087
  }
16876
17088
 
16877
17089
  return buffer;
16878
17090
  }
16879
17091
 
16880
- throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
17092
+ throw new AxiosError$1('Unsupported protocol ' + protocol, AxiosError$1.ERR_NOT_SUPPORT);
16881
17093
  }const kInternals = Symbol('internals');
16882
17094
 
16883
- class AxiosTransformStream extends stream.Transform{
17095
+ class AxiosTransformStream extends stream.Transform {
16884
17096
  constructor(options) {
16885
- options = utils$1.toFlatObject(options, {
16886
- maxRate: 0,
16887
- chunkSize: 64 * 1024,
16888
- minChunkSize: 100,
16889
- timeWindow: 500,
16890
- ticksRate: 2,
16891
- samplesCount: 15
16892
- }, null, (prop, source) => {
16893
- return !utils$1.isUndefined(source[prop]);
16894
- });
17097
+ options = utils$1.toFlatObject(
17098
+ options,
17099
+ {
17100
+ maxRate: 0,
17101
+ chunkSize: 64 * 1024,
17102
+ minChunkSize: 100,
17103
+ timeWindow: 500,
17104
+ ticksRate: 2,
17105
+ samplesCount: 15,
17106
+ },
17107
+ null,
17108
+ (prop, source) => {
17109
+ return !utils$1.isUndefined(source[prop]);
17110
+ }
17111
+ );
16895
17112
 
16896
17113
  super({
16897
- readableHighWaterMark: options.chunkSize
17114
+ readableHighWaterMark: options.chunkSize,
16898
17115
  });
16899
17116
 
16900
- const internals = this[kInternals] = {
17117
+ const internals = (this[kInternals] = {
16901
17118
  timeWindow: options.timeWindow,
16902
17119
  chunkSize: options.chunkSize,
16903
17120
  maxRate: options.maxRate,
@@ -16907,10 +17124,10 @@ class AxiosTransformStream extends stream.Transform{
16907
17124
  notifiedBytesLoaded: 0,
16908
17125
  ts: Date.now(),
16909
17126
  bytes: 0,
16910
- onReadCallback: null
16911
- };
17127
+ onReadCallback: null,
17128
+ });
16912
17129
 
16913
- this.on('newListener', event => {
17130
+ this.on('newListener', (event) => {
16914
17131
  if (event === 'progress') {
16915
17132
  if (!internals.isCaptured) {
16916
17133
  internals.isCaptured = true;
@@ -16938,8 +17155,11 @@ class AxiosTransformStream extends stream.Transform{
16938
17155
  const timeWindow = internals.timeWindow;
16939
17156
 
16940
17157
  const divider = 1000 / timeWindow;
16941
- const bytesThreshold = (maxRate / divider);
16942
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
17158
+ const bytesThreshold = maxRate / divider;
17159
+ const minChunkSize =
17160
+ internals.minChunkSize !== false
17161
+ ? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
17162
+ : 0;
16943
17163
 
16944
17164
  const pushChunk = (_chunk, _callback) => {
16945
17165
  const bytes = Buffer.byteLength(_chunk);
@@ -16968,7 +17188,7 @@ class AxiosTransformStream extends stream.Transform{
16968
17188
  if (maxRate) {
16969
17189
  const now = Date.now();
16970
17190
 
16971
- if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {
17191
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
16972
17192
  internals.ts = now;
16973
17193
  bytesLeft = bytesThreshold - internals.bytes;
16974
17194
  internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
@@ -16991,14 +17211,19 @@ class AxiosTransformStream extends stream.Transform{
16991
17211
  }
16992
17212
  }
16993
17213
 
16994
- if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {
17214
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
16995
17215
  chunkRemainder = _chunk.subarray(maxChunkSize);
16996
17216
  _chunk = _chunk.subarray(0, maxChunkSize);
16997
17217
  }
16998
17218
 
16999
- pushChunk(_chunk, chunkRemainder ? () => {
17000
- process.nextTick(_callback, null, chunkRemainder);
17001
- } : _callback);
17219
+ pushChunk(
17220
+ _chunk,
17221
+ chunkRemainder
17222
+ ? () => {
17223
+ process.nextTick(_callback, null, chunkRemainder);
17224
+ }
17225
+ : _callback
17226
+ );
17002
17227
  };
17003
17228
 
17004
17229
  transformChunk(chunk, function transformNextChunk(err, _chunk) {
@@ -17015,7 +17240,7 @@ class AxiosTransformStream extends stream.Transform{
17015
17240
  }
17016
17241
  }
17017
17242
 
17018
- var AxiosTransformStream$1 = AxiosTransformStream;const {asyncIterator} = Symbol;
17243
+ var AxiosTransformStream$1 = AxiosTransformStream;const { asyncIterator } = Symbol;
17019
17244
 
17020
17245
  const readBlob = async function* (blob) {
17021
17246
  if (blob.stream) {
@@ -17039,7 +17264,7 @@ const CRLF_BYTES_COUNT = 2;
17039
17264
 
17040
17265
  class FormDataPart {
17041
17266
  constructor(name, value) {
17042
- const {escapeName} = this.constructor;
17267
+ const { escapeName } = this.constructor;
17043
17268
  const isStringValue = utils$1.isString(value);
17044
17269
 
17045
17270
  let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
@@ -17049,7 +17274,7 @@ class FormDataPart {
17049
17274
  if (isStringValue) {
17050
17275
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
17051
17276
  } else {
17052
- headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
17277
+ headers += `Content-Type: ${value.type || 'application/octet-stream'}${CRLF}`;
17053
17278
  }
17054
17279
 
17055
17280
  this.headers = textEncoder.encode(headers + CRLF);
@@ -17062,12 +17287,12 @@ class FormDataPart {
17062
17287
  this.value = value;
17063
17288
  }
17064
17289
 
17065
- async *encode(){
17290
+ async *encode() {
17066
17291
  yield this.headers;
17067
17292
 
17068
- const {value} = this;
17293
+ const { value } = this;
17069
17294
 
17070
- if(utils$1.isTypedArray(value)) {
17295
+ if (utils$1.isTypedArray(value)) {
17071
17296
  yield value;
17072
17297
  } else {
17073
17298
  yield* readBlob$1(value);
@@ -17077,11 +17302,15 @@ class FormDataPart {
17077
17302
  }
17078
17303
 
17079
17304
  static escapeName(name) {
17080
- return String(name).replace(/[\r\n"]/g, (match) => ({
17081
- '\r' : '%0D',
17082
- '\n' : '%0A',
17083
- '"' : '%22',
17084
- }[match]));
17305
+ return String(name).replace(
17306
+ /[\r\n"]/g,
17307
+ (match) =>
17308
+ ({
17309
+ '\r': '%0D',
17310
+ '\n': '%0A',
17311
+ '"': '%22',
17312
+ })[match]
17313
+ );
17085
17314
  }
17086
17315
  }
17087
17316
 
@@ -17089,15 +17318,15 @@ const formDataToStream = (form, headersHandler, options) => {
17089
17318
  const {
17090
17319
  tag = 'form-data-boundary',
17091
17320
  size = 25,
17092
- boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
17321
+ boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET),
17093
17322
  } = options || {};
17094
17323
 
17095
- if(!utils$1.isFormData(form)) {
17324
+ if (!utils$1.isFormData(form)) {
17096
17325
  throw TypeError('FormData instance required');
17097
17326
  }
17098
17327
 
17099
17328
  if (boundary.length < 1 || boundary.length > 70) {
17100
- throw Error('boundary must be 10-70 characters long')
17329
+ throw Error('boundary must be 10-70 characters long');
17101
17330
  }
17102
17331
 
17103
17332
  const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
@@ -17115,7 +17344,7 @@ const formDataToStream = (form, headersHandler, options) => {
17115
17344
  contentLength = utils$1.toFiniteNumber(contentLength);
17116
17345
 
17117
17346
  const computedHeaders = {
17118
- 'Content-Type': `multipart/form-data; boundary=${boundary}`
17347
+ 'Content-Type': `multipart/form-data; boundary=${boundary}`,
17119
17348
  };
17120
17349
 
17121
17350
  if (Number.isFinite(contentLength)) {
@@ -17124,14 +17353,16 @@ const formDataToStream = (form, headersHandler, options) => {
17124
17353
 
17125
17354
  headersHandler && headersHandler(computedHeaders);
17126
17355
 
17127
- return Readable.from((async function *() {
17128
- for(const part of parts) {
17129
- yield boundaryBytes;
17130
- yield* part.encode();
17131
- }
17356
+ return Readable.from(
17357
+ (async function* () {
17358
+ for (const part of parts) {
17359
+ yield boundaryBytes;
17360
+ yield* part.encode();
17361
+ }
17132
17362
 
17133
- yield footerBytes;
17134
- })());
17363
+ yield footerBytes;
17364
+ })()
17365
+ );
17135
17366
  };
17136
17367
 
17137
17368
  var formDataToStream$1 = formDataToStream;class ZlibHeaderTransformStream extends stream.Transform {
@@ -17145,10 +17376,11 @@ var formDataToStream$1 = formDataToStream;class ZlibHeaderTransformStream extend
17145
17376
  this._transform = this.__transform;
17146
17377
 
17147
17378
  // Add Default Compression headers if no zlib headers are present
17148
- if (chunk[0] !== 120) { // Hex: 78
17379
+ if (chunk[0] !== 120) {
17380
+ // Hex: 78
17149
17381
  const header = Buffer.alloc(2);
17150
17382
  header[0] = 120; // Hex: 78
17151
- header[1] = 156; // Hex: 9C
17383
+ header[1] = 156; // Hex: 9C
17152
17384
  this.push(header, encoding);
17153
17385
  }
17154
17386
  }
@@ -17158,16 +17390,18 @@ var formDataToStream$1 = formDataToStream;class ZlibHeaderTransformStream extend
17158
17390
  }
17159
17391
 
17160
17392
  var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;const callbackify = (fn, reducer) => {
17161
- return utils$1.isAsyncFn(fn) ? function (...args) {
17162
- const cb = args.pop();
17163
- fn.apply(this, args).then((value) => {
17164
- try {
17165
- reducer ? cb(null, ...reducer(value)) : cb(null, value);
17166
- } catch (err) {
17167
- cb(err);
17393
+ return utils$1.isAsyncFn(fn)
17394
+ ? function (...args) {
17395
+ const cb = args.pop();
17396
+ fn.apply(this, args).then((value) => {
17397
+ try {
17398
+ reducer ? cb(null, ...reducer(value)) : cb(null, value);
17399
+ } catch (err) {
17400
+ cb(err);
17401
+ }
17402
+ }, cb);
17168
17403
  }
17169
- }, cb);
17170
- } : fn;
17404
+ : fn;
17171
17405
  };
17172
17406
 
17173
17407
  var callbackify$1 = callbackify;/**
@@ -17218,7 +17452,7 @@ function speedometer(samplesCount, min) {
17218
17452
 
17219
17453
  const passed = startedAt && now - startedAt;
17220
17454
 
17221
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
17455
+ return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
17222
17456
  };
17223
17457
  }/**
17224
17458
  * Throttle decorator
@@ -17245,7 +17479,7 @@ function throttle(fn, freq) {
17245
17479
  const throttled = (...args) => {
17246
17480
  const now = Date.now();
17247
17481
  const passed = now - timestamp;
17248
- if ( passed >= threshold) {
17482
+ if (passed >= threshold) {
17249
17483
  invoke(args, now);
17250
17484
  } else {
17251
17485
  lastArgs = args;
@@ -17265,7 +17499,7 @@ function throttle(fn, freq) {
17265
17499
  let bytesNotified = 0;
17266
17500
  const _speedometer = speedometer(50, 250);
17267
17501
 
17268
- return throttle(e => {
17502
+ return throttle((e) => {
17269
17503
  const loaded = e.loaded;
17270
17504
  const total = e.lengthComputable ? e.total : undefined;
17271
17505
  const progressBytes = loaded - bytesNotified;
@@ -17277,13 +17511,13 @@ function throttle(fn, freq) {
17277
17511
  const data = {
17278
17512
  loaded,
17279
17513
  total,
17280
- progress: total ? (loaded / total) : undefined,
17514
+ progress: total ? loaded / total : undefined,
17281
17515
  bytes: progressBytes,
17282
17516
  rate: rate ? rate : undefined,
17283
17517
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
17284
17518
  event: e,
17285
17519
  lengthComputable: total != null,
17286
- [isDownloadStream ? 'download' : 'upload']: true
17520
+ [isDownloadStream ? 'download' : 'upload']: true,
17287
17521
  };
17288
17522
 
17289
17523
  listener(data);
@@ -17293,14 +17527,21 @@ function throttle(fn, freq) {
17293
17527
  const progressEventDecorator = (total, throttled) => {
17294
17528
  const lengthComputable = total != null;
17295
17529
 
17296
- return [(loaded) => throttled[0]({
17297
- lengthComputable,
17298
- total,
17299
- loaded
17300
- }), throttled[1]];
17530
+ return [
17531
+ (loaded) =>
17532
+ throttled[0]({
17533
+ lengthComputable,
17534
+ total,
17535
+ loaded,
17536
+ }),
17537
+ throttled[1],
17538
+ ];
17301
17539
  };
17302
17540
 
17303
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));/**
17541
+ const asyncDecorator =
17542
+ (fn) =>
17543
+ (...args) =>
17544
+ utils$1.asap(() => fn(...args));/**
17304
17545
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
17305
17546
  * - For base64: compute exact decoded size using length and padding;
17306
17547
  * handle %XX at the character-count level (no string allocation).
@@ -17374,82 +17615,184 @@ function estimateDataURLDecodedBytes(url) {
17374
17615
  return Buffer.byteLength(body, 'utf8');
17375
17616
  }const zlibOptions = {
17376
17617
  flush: zlib.constants.Z_SYNC_FLUSH,
17377
- finishFlush: zlib.constants.Z_SYNC_FLUSH
17618
+ finishFlush: zlib.constants.Z_SYNC_FLUSH,
17378
17619
  };
17379
17620
 
17380
17621
  const brotliOptions = {
17381
17622
  flush: zlib.constants.BROTLI_OPERATION_FLUSH,
17382
- finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
17623
+ finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
17383
17624
  };
17384
17625
 
17385
17626
  const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
17386
17627
 
17387
- const {http: httpFollow, https: httpsFollow} = followRedirects.exports;
17628
+ const { http: httpFollow, https: httpsFollow } = followRedirects.exports;
17388
17629
 
17389
17630
  const isHttps = /https:?/;
17390
17631
 
17391
- const supportedProtocols = platform.protocols.map(protocol => {
17632
+ const supportedProtocols = platform.protocols.map((protocol) => {
17392
17633
  return protocol + ':';
17393
17634
  });
17394
17635
 
17395
-
17396
17636
  const flushOnFinish = (stream, [throttled, flush]) => {
17397
- stream
17398
- .on('end', flush)
17399
- .on('error', flush);
17637
+ stream.on('end', flush).on('error', flush);
17400
17638
 
17401
17639
  return throttled;
17402
17640
  };
17403
17641
 
17404
-
17405
- /**
17406
- * If the proxy or config beforeRedirects functions are defined, call them with the options
17407
- * object.
17408
- *
17409
- * @param {Object<string, any>} options - The options object that was passed to the request.
17410
- *
17411
- * @returns {Object<string, any>}
17412
- */
17413
- function dispatchBeforeRedirect(options, responseDetails) {
17414
- if (options.beforeRedirects.proxy) {
17415
- options.beforeRedirects.proxy(options);
17416
- }
17417
- if (options.beforeRedirects.config) {
17418
- options.beforeRedirects.config(options, responseDetails);
17642
+ class Http2Sessions {
17643
+ constructor() {
17644
+ this.sessions = Object.create(null);
17419
17645
  }
17420
- }
17421
17646
 
17422
- /**
17423
- * If the proxy or config afterRedirects functions are defined, call them with the options
17424
- *
17425
- * @param {http.ClientRequestArgs} options
17426
- * @param {AxiosProxyConfig} configProxy configuration from Axios options object
17427
- * @param {string} location
17428
- *
17429
- * @returns {http.ClientRequestArgs}
17430
- */
17431
- function setProxy(options, configProxy, location) {
17432
- let proxy = configProxy;
17433
- if (!proxy && proxy !== false) {
17434
- const proxyUrl = proxyFromEnv.getProxyForUrl(location);
17435
- if (proxyUrl) {
17436
- proxy = new URL(proxyUrl);
17437
- }
17438
- }
17439
- if (proxy) {
17440
- // Basic proxy authorization
17441
- if (proxy.username) {
17442
- proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
17443
- }
17647
+ getSession(authority, options) {
17648
+ options = Object.assign(
17649
+ {
17650
+ sessionTimeout: 1000,
17651
+ },
17652
+ options
17653
+ );
17444
17654
 
17445
- if (proxy.auth) {
17655
+ let authoritySessions = this.sessions[authority];
17656
+
17657
+ if (authoritySessions) {
17658
+ let len = authoritySessions.length;
17659
+
17660
+ for (let i = 0; i < len; i++) {
17661
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
17662
+ if (
17663
+ !sessionHandle.destroyed &&
17664
+ !sessionHandle.closed &&
17665
+ require$$1.isDeepStrictEqual(sessionOptions, options)
17666
+ ) {
17667
+ return sessionHandle;
17668
+ }
17669
+ }
17670
+ }
17671
+
17672
+ const session = http2.connect(authority, options);
17673
+
17674
+ let removed;
17675
+
17676
+ const removeSession = () => {
17677
+ if (removed) {
17678
+ return;
17679
+ }
17680
+
17681
+ removed = true;
17682
+
17683
+ let entries = authoritySessions,
17684
+ len = entries.length,
17685
+ i = len;
17686
+
17687
+ while (i--) {
17688
+ if (entries[i][0] === session) {
17689
+ if (len === 1) {
17690
+ delete this.sessions[authority];
17691
+ } else {
17692
+ entries.splice(i, 1);
17693
+ }
17694
+ return;
17695
+ }
17696
+ }
17697
+ };
17698
+
17699
+ const originalRequestFn = session.request;
17700
+
17701
+ const { sessionTimeout } = options;
17702
+
17703
+ if (sessionTimeout != null) {
17704
+ let timer;
17705
+ let streamsCount = 0;
17706
+
17707
+ session.request = function () {
17708
+ const stream = originalRequestFn.apply(this, arguments);
17709
+
17710
+ streamsCount++;
17711
+
17712
+ if (timer) {
17713
+ clearTimeout(timer);
17714
+ timer = null;
17715
+ }
17716
+
17717
+ stream.once('close', () => {
17718
+ if (!--streamsCount) {
17719
+ timer = setTimeout(() => {
17720
+ timer = null;
17721
+ removeSession();
17722
+ }, sessionTimeout);
17723
+ }
17724
+ });
17725
+
17726
+ return stream;
17727
+ };
17728
+ }
17729
+
17730
+ session.once('close', removeSession);
17731
+
17732
+ let entry = [session, options];
17733
+
17734
+ authoritySessions
17735
+ ? authoritySessions.push(entry)
17736
+ : (authoritySessions = this.sessions[authority] = [entry]);
17737
+
17738
+ return session;
17739
+ }
17740
+ }
17741
+
17742
+ const http2Sessions = new Http2Sessions();
17743
+
17744
+ /**
17745
+ * If the proxy or config beforeRedirects functions are defined, call them with the options
17746
+ * object.
17747
+ *
17748
+ * @param {Object<string, any>} options - The options object that was passed to the request.
17749
+ *
17750
+ * @returns {Object<string, any>}
17751
+ */
17752
+ function dispatchBeforeRedirect(options, responseDetails) {
17753
+ if (options.beforeRedirects.proxy) {
17754
+ options.beforeRedirects.proxy(options);
17755
+ }
17756
+ if (options.beforeRedirects.config) {
17757
+ options.beforeRedirects.config(options, responseDetails);
17758
+ }
17759
+ }
17760
+
17761
+ /**
17762
+ * If the proxy or config afterRedirects functions are defined, call them with the options
17763
+ *
17764
+ * @param {http.ClientRequestArgs} options
17765
+ * @param {AxiosProxyConfig} configProxy configuration from Axios options object
17766
+ * @param {string} location
17767
+ *
17768
+ * @returns {http.ClientRequestArgs}
17769
+ */
17770
+ function setProxy(options, configProxy, location) {
17771
+ let proxy = configProxy;
17772
+ if (!proxy && proxy !== false) {
17773
+ const proxyUrl = proxyFromEnv.getProxyForUrl(location);
17774
+ if (proxyUrl) {
17775
+ proxy = new URL(proxyUrl);
17776
+ }
17777
+ }
17778
+ if (proxy) {
17779
+ // Basic proxy authorization
17780
+ if (proxy.username) {
17781
+ proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
17782
+ }
17783
+
17784
+ if (proxy.auth) {
17446
17785
  // Support proxy auth object form
17447
- if (proxy.auth.username || proxy.auth.password) {
17786
+ const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
17787
+
17788
+ if (validProxyAuth) {
17448
17789
  proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
17790
+ } else if (typeof proxy.auth === 'object') {
17791
+ throw new AxiosError$1('Invalid proxy authorization', AxiosError$1.ERR_BAD_OPTION, { proxy });
17449
17792
  }
17450
- const base64 = Buffer
17451
- .from(proxy.auth, 'utf8')
17452
- .toString('base64');
17793
+
17794
+ const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
17795
+
17453
17796
  options.headers['Proxy-Authorization'] = 'Basic ' + base64;
17454
17797
  }
17455
17798
 
@@ -17472,7 +17815,8 @@ function setProxy(options, configProxy, location) {
17472
17815
  };
17473
17816
  }
17474
17817
 
17475
- const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
17818
+ const isHttpAdapterSupported =
17819
+ typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
17476
17820
 
17477
17821
  // temporary hotfix
17478
17822
 
@@ -17498,608 +17842,747 @@ const wrapAsync = (asyncExecutor) => {
17498
17842
  };
17499
17843
 
17500
17844
  asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
17501
- })
17845
+ });
17502
17846
  };
17503
17847
 
17504
- const resolveFamily = ({address, family}) => {
17848
+ const resolveFamily = ({ address, family }) => {
17505
17849
  if (!utils$1.isString(address)) {
17506
17850
  throw TypeError('address must be a string');
17507
17851
  }
17508
- return ({
17852
+ return {
17509
17853
  address,
17510
- family: family || (address.indexOf('.') < 0 ? 6 : 4)
17511
- });
17854
+ family: family || (address.indexOf('.') < 0 ? 6 : 4),
17855
+ };
17512
17856
  };
17513
17857
 
17514
- const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
17515
-
17516
- /*eslint consistent-return:0*/
17517
- var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
17518
- return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
17519
- let {data, lookup, family} = config;
17520
- const {responseType, responseEncoding} = config;
17521
- const method = config.method.toUpperCase();
17522
- let isDone;
17523
- let rejected = false;
17524
- let req;
17525
-
17526
- if (lookup) {
17527
- const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]);
17528
- // hotfix to support opt.all option which is required for node 20.x
17529
- lookup = (hostname, opt, cb) => {
17530
- _lookup(hostname, opt, (err, arg0, arg1) => {
17531
- if (err) {
17532
- return cb(err);
17533
- }
17534
-
17535
- const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
17858
+ const buildAddressEntry = (address, family) =>
17859
+ resolveFamily(utils$1.isObject(address) ? address : { address, family });
17536
17860
 
17537
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
17538
- });
17539
- };
17540
- }
17861
+ const http2Transport = {
17862
+ request(options, cb) {
17863
+ const authority =
17864
+ options.protocol +
17865
+ '//' +
17866
+ options.hostname +
17867
+ ':' +
17868
+ (options.port || (options.protocol === 'https:' ? 443 : 80));
17541
17869
 
17542
- // temporary internal emitter until the AxiosRequest class will be implemented
17543
- const emitter = new EventEmitter();
17870
+ const { http2Options, headers } = options;
17544
17871
 
17545
- const onFinished = () => {
17546
- if (config.cancelToken) {
17547
- config.cancelToken.unsubscribe(abort);
17548
- }
17872
+ const session = http2Sessions.getSession(authority, http2Options);
17549
17873
 
17550
- if (config.signal) {
17551
- config.signal.removeEventListener('abort', abort);
17552
- }
17874
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } =
17875
+ http2.constants;
17553
17876
 
17554
- emitter.removeAllListeners();
17877
+ const http2Headers = {
17878
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
17879
+ [HTTP2_HEADER_METHOD]: options.method,
17880
+ [HTTP2_HEADER_PATH]: options.path,
17555
17881
  };
17556
17882
 
17557
- onDone((value, isRejected) => {
17558
- isDone = true;
17559
- if (isRejected) {
17560
- rejected = true;
17561
- onFinished();
17562
- }
17883
+ utils$1.forEach(headers, (header, name) => {
17884
+ name.charAt(0) !== ':' && (http2Headers[name] = header);
17563
17885
  });
17564
17886
 
17565
- function abort(reason) {
17566
- emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
17567
- }
17887
+ const req = session.request(http2Headers);
17568
17888
 
17569
- emitter.once('abort', reject);
17889
+ req.once('response', (responseHeaders) => {
17890
+ const response = req; //duplex
17570
17891
 
17571
- if (config.cancelToken || config.signal) {
17572
- config.cancelToken && config.cancelToken.subscribe(abort);
17573
- if (config.signal) {
17574
- config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
17575
- }
17576
- }
17892
+ responseHeaders = Object.assign({}, responseHeaders);
17577
17893
 
17578
- // Parse url
17579
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
17580
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
17581
- const protocol = parsed.protocol || supportedProtocols[0];
17582
-
17583
- if (protocol === 'data:') {
17584
- // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
17585
- if (config.maxContentLength > -1) {
17586
- // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
17587
- const dataUrl = String(config.url || fullPath || '');
17588
- const estimated = estimateDataURLDecodedBytes(dataUrl);
17589
-
17590
- if (estimated > config.maxContentLength) {
17591
- return reject(new AxiosError(
17592
- 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
17593
- AxiosError.ERR_BAD_RESPONSE,
17594
- config
17595
- ));
17596
- }
17597
- }
17894
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
17598
17895
 
17599
- let convertedData;
17896
+ delete responseHeaders[HTTP2_HEADER_STATUS];
17600
17897
 
17601
- if (method !== 'GET') {
17602
- return settle(resolve, reject, {
17603
- status: 405,
17604
- statusText: 'method not allowed',
17605
- headers: {},
17606
- config
17607
- });
17608
- }
17898
+ response.headers = responseHeaders;
17609
17899
 
17610
- try {
17611
- convertedData = fromDataURI(config.url, responseType === 'blob', {
17612
- Blob: config.env && config.env.Blob
17613
- });
17614
- } catch (err) {
17615
- throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
17616
- }
17900
+ response.statusCode = +status;
17617
17901
 
17618
- if (responseType === 'text') {
17619
- convertedData = convertedData.toString(responseEncoding);
17902
+ cb(response);
17903
+ });
17620
17904
 
17621
- if (!responseEncoding || responseEncoding === 'utf8') {
17622
- convertedData = utils$1.stripBOM(convertedData);
17623
- }
17624
- } else if (responseType === 'stream') {
17625
- convertedData = stream.Readable.from(convertedData);
17626
- }
17905
+ return req;
17906
+ },
17907
+ };
17627
17908
 
17628
- return settle(resolve, reject, {
17629
- data: convertedData,
17630
- status: 200,
17631
- statusText: 'OK',
17632
- headers: new AxiosHeaders$1(),
17633
- config
17634
- });
17635
- }
17909
+ /*eslint consistent-return:0*/
17910
+ var httpAdapter = isHttpAdapterSupported &&
17911
+ function httpAdapter(config) {
17912
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
17913
+ let { data, lookup, family, httpVersion = 1, http2Options } = config;
17914
+ const { responseType, responseEncoding } = config;
17915
+ const method = config.method.toUpperCase();
17916
+ let isDone;
17917
+ let rejected = false;
17918
+ let req;
17919
+
17920
+ httpVersion = +httpVersion;
17921
+
17922
+ if (Number.isNaN(httpVersion)) {
17923
+ throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
17924
+ }
17636
17925
 
17637
- if (supportedProtocols.indexOf(protocol) === -1) {
17638
- return reject(new AxiosError(
17639
- 'Unsupported protocol ' + protocol,
17640
- AxiosError.ERR_BAD_REQUEST,
17641
- config
17642
- ));
17643
- }
17926
+ if (httpVersion !== 1 && httpVersion !== 2) {
17927
+ throw TypeError(`Unsupported protocol version '${httpVersion}'`);
17928
+ }
17644
17929
 
17645
- const headers = AxiosHeaders$1.from(config.headers).normalize();
17930
+ const isHttp2 = httpVersion === 2;
17646
17931
 
17647
- // Set User-Agent (required by some servers)
17648
- // See https://github.com/axios/axios/issues/69
17649
- // User-Agent is specified; handle case where no UA header is desired
17650
- // Only set header if it hasn't been set in config
17651
- headers.set('User-Agent', 'axios/' + VERSION, false);
17932
+ if (lookup) {
17933
+ const _lookup = callbackify$1(lookup, (value) => (utils$1.isArray(value) ? value : [value]));
17934
+ // hotfix to support opt.all option which is required for node 20.x
17935
+ lookup = (hostname, opt, cb) => {
17936
+ _lookup(hostname, opt, (err, arg0, arg1) => {
17937
+ if (err) {
17938
+ return cb(err);
17939
+ }
17652
17940
 
17653
- const {onUploadProgress, onDownloadProgress} = config;
17654
- const maxRate = config.maxRate;
17655
- let maxUploadRate = undefined;
17656
- let maxDownloadRate = undefined;
17941
+ const addresses = utils$1.isArray(arg0)
17942
+ ? arg0.map((addr) => buildAddressEntry(addr))
17943
+ : [buildAddressEntry(arg0, arg1)];
17657
17944
 
17658
- // support for spec compliant FormData objects
17659
- if (utils$1.isSpecCompliantForm(data)) {
17660
- const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
17945
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
17946
+ });
17947
+ };
17948
+ }
17661
17949
 
17662
- data = formDataToStream$1(data, (formHeaders) => {
17663
- headers.set(formHeaders);
17664
- }, {
17665
- tag: `axios-${VERSION}-boundary`,
17666
- boundary: userBoundary && userBoundary[1] || undefined
17667
- });
17668
- // support for https://www.npmjs.com/package/form-data api
17669
- } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
17670
- headers.set(data.getHeaders());
17950
+ const abortEmitter = new EventEmitter();
17671
17951
 
17672
- if (!headers.hasContentLength()) {
17952
+ function abort(reason) {
17673
17953
  try {
17674
- const knownLength = await require$$1.promisify(data.getLength).call(data);
17675
- Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
17676
- /*eslint no-empty:0*/
17677
- } catch (e) {
17954
+ abortEmitter.emit(
17955
+ 'abort',
17956
+ !reason || reason.type ? new CanceledError$1(null, config, req) : reason
17957
+ );
17958
+ } catch (err) {
17959
+ console.warn('emit error', err);
17678
17960
  }
17679
17961
  }
17680
- } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
17681
- data.size && headers.setContentType(data.type || 'application/octet-stream');
17682
- headers.setContentLength(data.size || 0);
17683
- data = stream.Readable.from(readBlob$1(data));
17684
- } else if (data && !utils$1.isStream(data)) {
17685
- if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
17686
- data = Buffer.from(new Uint8Array(data));
17687
- } else if (utils$1.isString(data)) {
17688
- data = Buffer.from(data, 'utf-8');
17689
- } else {
17690
- return reject(new AxiosError(
17691
- 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
17692
- AxiosError.ERR_BAD_REQUEST,
17693
- config
17694
- ));
17695
- }
17696
17962
 
17697
- // Add Content-Length header if data exists
17698
- headers.setContentLength(data.length, false);
17963
+ abortEmitter.once('abort', reject);
17699
17964
 
17700
- if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
17701
- return reject(new AxiosError(
17702
- 'Request body larger than maxBodyLength limit',
17703
- AxiosError.ERR_BAD_REQUEST,
17704
- config
17705
- ));
17706
- }
17707
- }
17965
+ const onFinished = () => {
17966
+ if (config.cancelToken) {
17967
+ config.cancelToken.unsubscribe(abort);
17968
+ }
17708
17969
 
17709
- const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
17970
+ if (config.signal) {
17971
+ config.signal.removeEventListener('abort', abort);
17972
+ }
17710
17973
 
17711
- if (utils$1.isArray(maxRate)) {
17712
- maxUploadRate = maxRate[0];
17713
- maxDownloadRate = maxRate[1];
17714
- } else {
17715
- maxUploadRate = maxDownloadRate = maxRate;
17716
- }
17974
+ abortEmitter.removeAllListeners();
17975
+ };
17717
17976
 
17718
- if (data && (onUploadProgress || maxUploadRate)) {
17719
- if (!utils$1.isStream(data)) {
17720
- data = stream.Readable.from(data, {objectMode: false});
17977
+ if (config.cancelToken || config.signal) {
17978
+ config.cancelToken && config.cancelToken.subscribe(abort);
17979
+ if (config.signal) {
17980
+ config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
17981
+ }
17721
17982
  }
17722
17983
 
17723
- data = stream.pipeline([data, new AxiosTransformStream$1({
17724
- maxRate: utils$1.toFiniteNumber(maxUploadRate)
17725
- })], utils$1.noop);
17726
-
17727
- onUploadProgress && data.on('progress', flushOnFinish(
17728
- data,
17729
- progressEventDecorator(
17730
- contentLength,
17731
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
17732
- )
17733
- ));
17734
- }
17984
+ onDone((response, isRejected) => {
17985
+ isDone = true;
17735
17986
 
17736
- // HTTP basic authentication
17737
- let auth = undefined;
17738
- if (config.auth) {
17739
- const username = config.auth.username || '';
17740
- const password = config.auth.password || '';
17741
- auth = username + ':' + password;
17742
- }
17987
+ if (isRejected) {
17988
+ rejected = true;
17989
+ onFinished();
17990
+ return;
17991
+ }
17743
17992
 
17744
- if (!auth && parsed.username) {
17745
- const urlUsername = parsed.username;
17746
- const urlPassword = parsed.password;
17747
- auth = urlUsername + ':' + urlPassword;
17748
- }
17993
+ const { data } = response;
17749
17994
 
17750
- auth && headers.delete('authorization');
17995
+ if (data instanceof stream.Readable || data instanceof stream.Duplex) {
17996
+ const offListeners = stream.finished(data, () => {
17997
+ offListeners();
17998
+ onFinished();
17999
+ });
18000
+ } else {
18001
+ onFinished();
18002
+ }
18003
+ });
17751
18004
 
17752
- let path;
18005
+ // Parse url
18006
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
18007
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
18008
+ const protocol = parsed.protocol || supportedProtocols[0];
18009
+
18010
+ if (protocol === 'data:') {
18011
+ // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
18012
+ if (config.maxContentLength > -1) {
18013
+ // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
18014
+ const dataUrl = String(config.url || fullPath || '');
18015
+ const estimated = estimateDataURLDecodedBytes(dataUrl);
18016
+
18017
+ if (estimated > config.maxContentLength) {
18018
+ return reject(
18019
+ new AxiosError$1(
18020
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
18021
+ AxiosError$1.ERR_BAD_RESPONSE,
18022
+ config
18023
+ )
18024
+ );
18025
+ }
18026
+ }
17753
18027
 
17754
- try {
17755
- path = buildURL(
17756
- parsed.pathname + parsed.search,
17757
- config.params,
17758
- config.paramsSerializer
17759
- ).replace(/^\?/, '');
17760
- } catch (err) {
17761
- const customErr = new Error(err.message);
17762
- customErr.config = config;
17763
- customErr.url = config.url;
17764
- customErr.exists = true;
17765
- return reject(customErr);
17766
- }
18028
+ let convertedData;
17767
18029
 
17768
- headers.set(
17769
- 'Accept-Encoding',
17770
- 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false
17771
- );
18030
+ if (method !== 'GET') {
18031
+ return settle(resolve, reject, {
18032
+ status: 405,
18033
+ statusText: 'method not allowed',
18034
+ headers: {},
18035
+ config,
18036
+ });
18037
+ }
17772
18038
 
17773
- const options = {
17774
- path,
17775
- method: method,
17776
- headers: headers.toJSON(),
17777
- agents: { http: config.httpAgent, https: config.httpsAgent },
17778
- auth,
17779
- protocol,
17780
- family,
17781
- beforeRedirect: dispatchBeforeRedirect,
17782
- beforeRedirects: {}
17783
- };
18039
+ try {
18040
+ convertedData = fromDataURI(config.url, responseType === 'blob', {
18041
+ Blob: config.env && config.env.Blob,
18042
+ });
18043
+ } catch (err) {
18044
+ throw AxiosError$1.from(err, AxiosError$1.ERR_BAD_REQUEST, config);
18045
+ }
17784
18046
 
17785
- // cacheable-lookup integration hotfix
17786
- !utils$1.isUndefined(lookup) && (options.lookup = lookup);
18047
+ if (responseType === 'text') {
18048
+ convertedData = convertedData.toString(responseEncoding);
17787
18049
 
17788
- if (config.socketPath) {
17789
- options.socketPath = config.socketPath;
17790
- } else {
17791
- options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
17792
- options.port = parsed.port;
17793
- setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
17794
- }
18050
+ if (!responseEncoding || responseEncoding === 'utf8') {
18051
+ convertedData = utils$1.stripBOM(convertedData);
18052
+ }
18053
+ } else if (responseType === 'stream') {
18054
+ convertedData = stream.Readable.from(convertedData);
18055
+ }
17795
18056
 
17796
- let transport;
17797
- const isHttpsRequest = isHttps.test(options.protocol);
17798
- options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
17799
- if (config.transport) {
17800
- transport = config.transport;
17801
- } else if (config.maxRedirects === 0) {
17802
- transport = isHttpsRequest ? require$$4 : require$$3;
17803
- } else {
17804
- if (config.maxRedirects) {
17805
- options.maxRedirects = config.maxRedirects;
18057
+ return settle(resolve, reject, {
18058
+ data: convertedData,
18059
+ status: 200,
18060
+ statusText: 'OK',
18061
+ headers: new AxiosHeaders$1(),
18062
+ config,
18063
+ });
17806
18064
  }
17807
- if (config.beforeRedirect) {
17808
- options.beforeRedirects.config = config.beforeRedirect;
18065
+
18066
+ if (supportedProtocols.indexOf(protocol) === -1) {
18067
+ return reject(
18068
+ new AxiosError$1('Unsupported protocol ' + protocol, AxiosError$1.ERR_BAD_REQUEST, config)
18069
+ );
17809
18070
  }
17810
- transport = isHttpsRequest ? httpsFollow : httpFollow;
17811
- }
17812
18071
 
17813
- if (config.maxBodyLength > -1) {
17814
- options.maxBodyLength = config.maxBodyLength;
17815
- } else {
17816
- // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
17817
- options.maxBodyLength = Infinity;
17818
- }
18072
+ const headers = AxiosHeaders$1.from(config.headers).normalize();
17819
18073
 
17820
- if (config.insecureHTTPParser) {
17821
- options.insecureHTTPParser = config.insecureHTTPParser;
17822
- }
18074
+ // Set User-Agent (required by some servers)
18075
+ // See https://github.com/axios/axios/issues/69
18076
+ // User-Agent is specified; handle case where no UA header is desired
18077
+ // Only set header if it hasn't been set in config
18078
+ headers.set('User-Agent', 'axios/' + VERSION, false);
17823
18079
 
17824
- // Create the request
17825
- req = transport.request(options, function handleResponse(res) {
17826
- if (req.destroyed) return;
18080
+ const { onUploadProgress, onDownloadProgress } = config;
18081
+ const maxRate = config.maxRate;
18082
+ let maxUploadRate = undefined;
18083
+ let maxDownloadRate = undefined;
17827
18084
 
17828
- const streams = [res];
18085
+ // support for spec compliant FormData objects
18086
+ if (utils$1.isSpecCompliantForm(data)) {
18087
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
17829
18088
 
17830
- const responseLength = +res.headers['content-length'];
18089
+ data = formDataToStream$1(
18090
+ data,
18091
+ (formHeaders) => {
18092
+ headers.set(formHeaders);
18093
+ },
18094
+ {
18095
+ tag: `axios-${VERSION}-boundary`,
18096
+ boundary: (userBoundary && userBoundary[1]) || undefined,
18097
+ }
18098
+ );
18099
+ // support for https://www.npmjs.com/package/form-data api
18100
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
18101
+ headers.set(data.getHeaders());
17831
18102
 
17832
- if (onDownloadProgress || maxDownloadRate) {
17833
- const transformStream = new AxiosTransformStream$1({
17834
- maxRate: utils$1.toFiniteNumber(maxDownloadRate)
17835
- });
18103
+ if (!headers.hasContentLength()) {
18104
+ try {
18105
+ const knownLength = await require$$1.promisify(data.getLength).call(data);
18106
+ Number.isFinite(knownLength) &&
18107
+ knownLength >= 0 &&
18108
+ headers.setContentLength(knownLength);
18109
+ /*eslint no-empty:0*/
18110
+ } catch (e) {}
18111
+ }
18112
+ } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
18113
+ data.size && headers.setContentType(data.type || 'application/octet-stream');
18114
+ headers.setContentLength(data.size || 0);
18115
+ data = stream.Readable.from(readBlob$1(data));
18116
+ } else if (data && !utils$1.isStream(data)) {
18117
+ if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
18118
+ data = Buffer.from(new Uint8Array(data));
18119
+ } else if (utils$1.isString(data)) {
18120
+ data = Buffer.from(data, 'utf-8');
18121
+ } else {
18122
+ return reject(
18123
+ new AxiosError$1(
18124
+ 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
18125
+ AxiosError$1.ERR_BAD_REQUEST,
18126
+ config
18127
+ )
18128
+ );
18129
+ }
17836
18130
 
17837
- onDownloadProgress && transformStream.on('progress', flushOnFinish(
17838
- transformStream,
17839
- progressEventDecorator(
17840
- responseLength,
17841
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
17842
- )
17843
- ));
18131
+ // Add Content-Length header if data exists
18132
+ headers.setContentLength(data.length, false);
17844
18133
 
17845
- streams.push(transformStream);
18134
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
18135
+ return reject(
18136
+ new AxiosError$1(
18137
+ 'Request body larger than maxBodyLength limit',
18138
+ AxiosError$1.ERR_BAD_REQUEST,
18139
+ config
18140
+ )
18141
+ );
18142
+ }
17846
18143
  }
17847
18144
 
17848
- // decompress the response body transparently if required
17849
- let responseStream = res;
18145
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
17850
18146
 
17851
- // return the last request in case of redirects
17852
- const lastRequest = res.req || req;
18147
+ if (utils$1.isArray(maxRate)) {
18148
+ maxUploadRate = maxRate[0];
18149
+ maxDownloadRate = maxRate[1];
18150
+ } else {
18151
+ maxUploadRate = maxDownloadRate = maxRate;
18152
+ }
17853
18153
 
17854
- // if decompress disabled we should not decompress
17855
- if (config.decompress !== false && res.headers['content-encoding']) {
17856
- // if no content, but headers still say that it is encoded,
17857
- // remove the header not confuse downstream operations
17858
- if (method === 'HEAD' || res.statusCode === 204) {
17859
- delete res.headers['content-encoding'];
18154
+ if (data && (onUploadProgress || maxUploadRate)) {
18155
+ if (!utils$1.isStream(data)) {
18156
+ data = stream.Readable.from(data, { objectMode: false });
17860
18157
  }
17861
18158
 
17862
- switch ((res.headers['content-encoding'] || '').toLowerCase()) {
17863
- /*eslint default-case:0*/
17864
- case 'gzip':
17865
- case 'x-gzip':
17866
- case 'compress':
17867
- case 'x-compress':
17868
- // add the unzipper to the body stream processing pipeline
17869
- streams.push(zlib.createUnzip(zlibOptions));
17870
-
17871
- // remove the content-encoding in order to not confuse downstream operations
17872
- delete res.headers['content-encoding'];
17873
- break;
17874
- case 'deflate':
17875
- streams.push(new ZlibHeaderTransformStream$1());
17876
-
17877
- // add the unzipper to the body stream processing pipeline
17878
- streams.push(zlib.createUnzip(zlibOptions));
17879
-
17880
- // remove the content-encoding in order to not confuse downstream operations
17881
- delete res.headers['content-encoding'];
17882
- break;
17883
- case 'br':
17884
- if (isBrotliSupported) {
17885
- streams.push(zlib.createBrotliDecompress(brotliOptions));
17886
- delete res.headers['content-encoding'];
17887
- }
17888
- }
18159
+ data = stream.pipeline(
18160
+ [
18161
+ data,
18162
+ new AxiosTransformStream$1({
18163
+ maxRate: utils$1.toFiniteNumber(maxUploadRate),
18164
+ }),
18165
+ ],
18166
+ utils$1.noop
18167
+ );
18168
+
18169
+ onUploadProgress &&
18170
+ data.on(
18171
+ 'progress',
18172
+ flushOnFinish(
18173
+ data,
18174
+ progressEventDecorator(
18175
+ contentLength,
18176
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
18177
+ )
18178
+ )
18179
+ );
17889
18180
  }
17890
18181
 
17891
- responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
18182
+ // HTTP basic authentication
18183
+ let auth = undefined;
18184
+ if (config.auth) {
18185
+ const username = config.auth.username || '';
18186
+ const password = config.auth.password || '';
18187
+ auth = username + ':' + password;
18188
+ }
17892
18189
 
17893
- const offListeners = stream.finished(responseStream, () => {
17894
- offListeners();
17895
- onFinished();
17896
- });
18190
+ if (!auth && parsed.username) {
18191
+ const urlUsername = parsed.username;
18192
+ const urlPassword = parsed.password;
18193
+ auth = urlUsername + ':' + urlPassword;
18194
+ }
18195
+
18196
+ auth && headers.delete('authorization');
17897
18197
 
17898
- const response = {
17899
- status: res.statusCode,
17900
- statusText: res.statusMessage,
17901
- headers: new AxiosHeaders$1(res.headers),
17902
- config,
17903
- request: lastRequest
18198
+ let path;
18199
+
18200
+ try {
18201
+ path = buildURL(
18202
+ parsed.pathname + parsed.search,
18203
+ config.params,
18204
+ config.paramsSerializer
18205
+ ).replace(/^\?/, '');
18206
+ } catch (err) {
18207
+ const customErr = new Error(err.message);
18208
+ customErr.config = config;
18209
+ customErr.url = config.url;
18210
+ customErr.exists = true;
18211
+ return reject(customErr);
18212
+ }
18213
+
18214
+ headers.set(
18215
+ 'Accept-Encoding',
18216
+ 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''),
18217
+ false
18218
+ );
18219
+
18220
+ const options = {
18221
+ path,
18222
+ method: method,
18223
+ headers: headers.toJSON(),
18224
+ agents: { http: config.httpAgent, https: config.httpsAgent },
18225
+ auth,
18226
+ protocol,
18227
+ family,
18228
+ beforeRedirect: dispatchBeforeRedirect,
18229
+ beforeRedirects: {},
18230
+ http2Options,
17904
18231
  };
17905
18232
 
17906
- if (responseType === 'stream') {
17907
- response.data = responseStream;
17908
- settle(resolve, reject, response);
18233
+ // cacheable-lookup integration hotfix
18234
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
18235
+
18236
+ if (config.socketPath) {
18237
+ options.socketPath = config.socketPath;
17909
18238
  } else {
17910
- const responseBuffer = [];
17911
- let totalResponseBytes = 0;
18239
+ options.hostname = parsed.hostname.startsWith('[')
18240
+ ? parsed.hostname.slice(1, -1)
18241
+ : parsed.hostname;
18242
+ options.port = parsed.port;
18243
+ setProxy(
18244
+ options,
18245
+ config.proxy,
18246
+ protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path
18247
+ );
18248
+ }
17912
18249
 
17913
- responseStream.on('data', function handleStreamData(chunk) {
17914
- responseBuffer.push(chunk);
17915
- totalResponseBytes += chunk.length;
18250
+ let transport;
18251
+ const isHttpsRequest = isHttps.test(options.protocol);
18252
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
17916
18253
 
17917
- // make sure the content length is not over the maxContentLength if specified
17918
- if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
17919
- // stream.destroy() emit aborted event before calling reject() on Node.js v16
17920
- rejected = true;
17921
- responseStream.destroy();
17922
- reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
17923
- AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
18254
+ if (isHttp2) {
18255
+ transport = http2Transport;
18256
+ } else {
18257
+ if (config.transport) {
18258
+ transport = config.transport;
18259
+ } else if (config.maxRedirects === 0) {
18260
+ transport = isHttpsRequest ? require$$4 : require$$3;
18261
+ } else {
18262
+ if (config.maxRedirects) {
18263
+ options.maxRedirects = config.maxRedirects;
17924
18264
  }
17925
- });
17926
-
17927
- responseStream.on('aborted', function handlerStreamAborted() {
17928
- if (rejected) {
17929
- return;
18265
+ if (config.beforeRedirect) {
18266
+ options.beforeRedirects.config = config.beforeRedirect;
17930
18267
  }
18268
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
18269
+ }
18270
+ }
17931
18271
 
17932
- const err = new AxiosError(
17933
- 'stream has been aborted',
17934
- AxiosError.ERR_BAD_RESPONSE,
17935
- config,
17936
- lastRequest
17937
- );
17938
- responseStream.destroy(err);
17939
- reject(err);
17940
- });
17941
-
17942
- responseStream.on('error', function handleStreamError(err) {
17943
- if (req.destroyed) return;
17944
- reject(AxiosError.from(err, null, config, lastRequest));
17945
- });
18272
+ if (config.maxBodyLength > -1) {
18273
+ options.maxBodyLength = config.maxBodyLength;
18274
+ } else {
18275
+ // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
18276
+ options.maxBodyLength = Infinity;
18277
+ }
17946
18278
 
17947
- responseStream.on('end', function handleStreamEnd() {
17948
- try {
17949
- let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
17950
- if (responseType !== 'arraybuffer') {
17951
- responseData = responseData.toString(responseEncoding);
17952
- if (!responseEncoding || responseEncoding === 'utf8') {
17953
- responseData = utils$1.stripBOM(responseData);
17954
- }
17955
- }
17956
- response.data = responseData;
17957
- } catch (err) {
17958
- return reject(AxiosError.from(err, null, config, response.request, response));
17959
- }
17960
- settle(resolve, reject, response);
17961
- });
18279
+ if (config.insecureHTTPParser) {
18280
+ options.insecureHTTPParser = config.insecureHTTPParser;
17962
18281
  }
17963
18282
 
17964
- emitter.once('abort', err => {
17965
- if (!responseStream.destroyed) {
17966
- responseStream.emit('error', err);
17967
- responseStream.destroy();
18283
+ // Create the request
18284
+ req = transport.request(options, function handleResponse(res) {
18285
+ if (req.destroyed) return;
18286
+
18287
+ const streams = [res];
18288
+
18289
+ const responseLength = utils$1.toFiniteNumber(res.headers['content-length']);
18290
+
18291
+ if (onDownloadProgress || maxDownloadRate) {
18292
+ const transformStream = new AxiosTransformStream$1({
18293
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate),
18294
+ });
18295
+
18296
+ onDownloadProgress &&
18297
+ transformStream.on(
18298
+ 'progress',
18299
+ flushOnFinish(
18300
+ transformStream,
18301
+ progressEventDecorator(
18302
+ responseLength,
18303
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
18304
+ )
18305
+ )
18306
+ );
18307
+
18308
+ streams.push(transformStream);
17968
18309
  }
17969
- });
17970
- });
17971
18310
 
17972
- emitter.once('abort', err => {
17973
- reject(err);
17974
- req.destroy(err);
17975
- });
18311
+ // decompress the response body transparently if required
18312
+ let responseStream = res;
17976
18313
 
17977
- // Handle errors
17978
- req.on('error', function handleRequestError(err) {
17979
- // @todo remove
17980
- // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
17981
- reject(AxiosError.from(err, null, config, req));
17982
- });
18314
+ // return the last request in case of redirects
18315
+ const lastRequest = res.req || req;
17983
18316
 
17984
- // set tcp keep alive to prevent drop connection by peer
17985
- req.on('socket', function handleRequestSocket(socket) {
17986
- // default interval of sending ack packet is 1 minute
17987
- socket.setKeepAlive(true, 1000 * 60);
17988
- });
18317
+ // if decompress disabled we should not decompress
18318
+ if (config.decompress !== false && res.headers['content-encoding']) {
18319
+ // if no content, but headers still say that it is encoded,
18320
+ // remove the header not confuse downstream operations
18321
+ if (method === 'HEAD' || res.statusCode === 204) {
18322
+ delete res.headers['content-encoding'];
18323
+ }
18324
+
18325
+ switch ((res.headers['content-encoding'] || '').toLowerCase()) {
18326
+ /*eslint default-case:0*/
18327
+ case 'gzip':
18328
+ case 'x-gzip':
18329
+ case 'compress':
18330
+ case 'x-compress':
18331
+ // add the unzipper to the body stream processing pipeline
18332
+ streams.push(zlib.createUnzip(zlibOptions));
18333
+
18334
+ // remove the content-encoding in order to not confuse downstream operations
18335
+ delete res.headers['content-encoding'];
18336
+ break;
18337
+ case 'deflate':
18338
+ streams.push(new ZlibHeaderTransformStream$1());
18339
+
18340
+ // add the unzipper to the body stream processing pipeline
18341
+ streams.push(zlib.createUnzip(zlibOptions));
18342
+
18343
+ // remove the content-encoding in order to not confuse downstream operations
18344
+ delete res.headers['content-encoding'];
18345
+ break;
18346
+ case 'br':
18347
+ if (isBrotliSupported) {
18348
+ streams.push(zlib.createBrotliDecompress(brotliOptions));
18349
+ delete res.headers['content-encoding'];
18350
+ }
18351
+ }
18352
+ }
17989
18353
 
17990
- // Handle request timeout
17991
- if (config.timeout) {
17992
- // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
17993
- const timeout = parseInt(config.timeout, 10);
18354
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
17994
18355
 
17995
- if (Number.isNaN(timeout)) {
17996
- reject(new AxiosError(
17997
- 'error trying to parse `config.timeout` to int',
17998
- AxiosError.ERR_BAD_OPTION_VALUE,
18356
+ const response = {
18357
+ status: res.statusCode,
18358
+ statusText: res.statusMessage,
18359
+ headers: new AxiosHeaders$1(res.headers),
17999
18360
  config,
18000
- req
18001
- ));
18361
+ request: lastRequest,
18362
+ };
18002
18363
 
18003
- return;
18004
- }
18364
+ if (responseType === 'stream') {
18365
+ response.data = responseStream;
18366
+ settle(resolve, reject, response);
18367
+ } else {
18368
+ const responseBuffer = [];
18369
+ let totalResponseBytes = 0;
18370
+
18371
+ responseStream.on('data', function handleStreamData(chunk) {
18372
+ responseBuffer.push(chunk);
18373
+ totalResponseBytes += chunk.length;
18374
+
18375
+ // make sure the content length is not over the maxContentLength if specified
18376
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
18377
+ // stream.destroy() emit aborted event before calling reject() on Node.js v16
18378
+ rejected = true;
18379
+ responseStream.destroy();
18380
+ abort(
18381
+ new AxiosError$1(
18382
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
18383
+ AxiosError$1.ERR_BAD_RESPONSE,
18384
+ config,
18385
+ lastRequest
18386
+ )
18387
+ );
18388
+ }
18389
+ });
18005
18390
 
18006
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
18007
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
18008
- // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
18009
- // And then these socket which be hang up will devouring CPU little by little.
18010
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
18011
- req.setTimeout(timeout, function handleRequestTimeout() {
18012
- if (isDone) return;
18013
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
18014
- const transitional = config.transitional || transitionalDefaults;
18015
- if (config.timeoutErrorMessage) {
18016
- timeoutErrorMessage = config.timeoutErrorMessage;
18017
- }
18018
- reject(new AxiosError(
18019
- timeoutErrorMessage,
18020
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
18021
- config,
18022
- req
18023
- ));
18024
- abort();
18025
- });
18026
- }
18391
+ responseStream.on('aborted', function handlerStreamAborted() {
18392
+ if (rejected) {
18393
+ return;
18394
+ }
18027
18395
 
18396
+ const err = new AxiosError$1(
18397
+ 'stream has been aborted',
18398
+ AxiosError$1.ERR_BAD_RESPONSE,
18399
+ config,
18400
+ lastRequest
18401
+ );
18402
+ responseStream.destroy(err);
18403
+ reject(err);
18404
+ });
18405
+
18406
+ responseStream.on('error', function handleStreamError(err) {
18407
+ if (req.destroyed) return;
18408
+ reject(AxiosError$1.from(err, null, config, lastRequest));
18409
+ });
18410
+
18411
+ responseStream.on('end', function handleStreamEnd() {
18412
+ try {
18413
+ let responseData =
18414
+ responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
18415
+ if (responseType !== 'arraybuffer') {
18416
+ responseData = responseData.toString(responseEncoding);
18417
+ if (!responseEncoding || responseEncoding === 'utf8') {
18418
+ responseData = utils$1.stripBOM(responseData);
18419
+ }
18420
+ }
18421
+ response.data = responseData;
18422
+ } catch (err) {
18423
+ return reject(AxiosError$1.from(err, null, config, response.request, response));
18424
+ }
18425
+ settle(resolve, reject, response);
18426
+ });
18427
+ }
18028
18428
 
18029
- // Send the request
18030
- if (utils$1.isStream(data)) {
18031
- let ended = false;
18032
- let errored = false;
18429
+ abortEmitter.once('abort', (err) => {
18430
+ if (!responseStream.destroyed) {
18431
+ responseStream.emit('error', err);
18432
+ responseStream.destroy();
18433
+ }
18434
+ });
18435
+ });
18033
18436
 
18034
- data.on('end', () => {
18035
- ended = true;
18437
+ abortEmitter.once('abort', (err) => {
18438
+ if (req.close) {
18439
+ req.close();
18440
+ } else {
18441
+ req.destroy(err);
18442
+ }
18036
18443
  });
18037
18444
 
18038
- data.once('error', err => {
18039
- errored = true;
18040
- req.destroy(err);
18445
+ // Handle errors
18446
+ req.on('error', function handleRequestError(err) {
18447
+ reject(AxiosError$1.from(err, null, config, req));
18041
18448
  });
18042
18449
 
18043
- data.on('close', () => {
18044
- if (!ended && !errored) {
18045
- abort(new CanceledError('Request stream has been aborted', config, req));
18046
- }
18450
+ // set tcp keep alive to prevent drop connection by peer
18451
+ req.on('socket', function handleRequestSocket(socket) {
18452
+ // default interval of sending ack packet is 1 minute
18453
+ socket.setKeepAlive(true, 1000 * 60);
18047
18454
  });
18048
18455
 
18049
- data.pipe(req);
18050
- } else {
18051
- req.end(data);
18052
- }
18053
- });
18054
- };var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
18055
- url = new URL(url, platform.origin);
18456
+ // Handle request timeout
18457
+ if (config.timeout) {
18458
+ // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
18459
+ const timeout = parseInt(config.timeout, 10);
18460
+
18461
+ if (Number.isNaN(timeout)) {
18462
+ abort(
18463
+ new AxiosError$1(
18464
+ 'error trying to parse `config.timeout` to int',
18465
+ AxiosError$1.ERR_BAD_OPTION_VALUE,
18466
+ config,
18467
+ req
18468
+ )
18469
+ );
18056
18470
 
18057
- return (
18058
- origin.protocol === url.protocol &&
18059
- origin.host === url.host &&
18060
- (isMSIE || origin.port === url.port)
18061
- );
18062
- })(
18063
- new URL(platform.origin),
18064
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
18065
- ) : () => true;var cookies = platform.hasStandardBrowserEnv ?
18471
+ return;
18472
+ }
18066
18473
 
18067
- // Standard browser envs support document.cookie
18068
- {
18069
- write(name, value, expires, path, domain, secure) {
18070
- const cookie = [name + '=' + encodeURIComponent(value)];
18474
+ // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
18475
+ // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
18476
+ // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
18477
+ // And then these socket which be hang up will devouring CPU little by little.
18478
+ // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
18479
+ req.setTimeout(timeout, function handleRequestTimeout() {
18480
+ if (isDone) return;
18481
+ let timeoutErrorMessage = config.timeout
18482
+ ? 'timeout of ' + config.timeout + 'ms exceeded'
18483
+ : 'timeout exceeded';
18484
+ const transitional = config.transitional || transitionalDefaults;
18485
+ if (config.timeoutErrorMessage) {
18486
+ timeoutErrorMessage = config.timeoutErrorMessage;
18487
+ }
18488
+ abort(
18489
+ new AxiosError$1(
18490
+ timeoutErrorMessage,
18491
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
18492
+ config,
18493
+ req
18494
+ )
18495
+ );
18496
+ });
18497
+ } else {
18498
+ // explicitly reset the socket timeout value for a possible `keep-alive` request
18499
+ req.setTimeout(0);
18500
+ }
18071
18501
 
18072
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
18502
+ // Send the request
18503
+ if (utils$1.isStream(data)) {
18504
+ let ended = false;
18505
+ let errored = false;
18073
18506
 
18074
- utils$1.isString(path) && cookie.push('path=' + path);
18507
+ data.on('end', () => {
18508
+ ended = true;
18509
+ });
18075
18510
 
18076
- utils$1.isString(domain) && cookie.push('domain=' + domain);
18511
+ data.once('error', (err) => {
18512
+ errored = true;
18513
+ req.destroy(err);
18514
+ });
18077
18515
 
18078
- secure === true && cookie.push('secure');
18516
+ data.on('close', () => {
18517
+ if (!ended && !errored) {
18518
+ abort(new CanceledError$1('Request stream has been aborted', config, req));
18519
+ }
18520
+ });
18079
18521
 
18080
- document.cookie = cookie.join('; ');
18081
- },
18522
+ data.pipe(req);
18523
+ } else {
18524
+ data && req.write(data);
18525
+ req.end();
18526
+ }
18527
+ });
18528
+ };var isURLSameOrigin = platform.hasStandardBrowserEnv
18529
+ ? ((origin, isMSIE) => (url) => {
18530
+ url = new URL(url, platform.origin);
18531
+
18532
+ return (
18533
+ origin.protocol === url.protocol &&
18534
+ origin.host === url.host &&
18535
+ (isMSIE || origin.port === url.port)
18536
+ );
18537
+ })(
18538
+ new URL(platform.origin),
18539
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
18540
+ )
18541
+ : () => true;var cookies = platform.hasStandardBrowserEnv
18542
+ ? // Standard browser envs support document.cookie
18543
+ {
18544
+ write(name, value, expires, path, domain, secure, sameSite) {
18545
+ if (typeof document === 'undefined') return;
18082
18546
 
18083
- read(name) {
18084
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
18085
- return (match ? decodeURIComponent(match[3]) : null);
18086
- },
18547
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
18087
18548
 
18088
- remove(name) {
18089
- this.write(name, '', Date.now() - 86400000);
18090
- }
18091
- }
18549
+ if (utils$1.isNumber(expires)) {
18550
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
18551
+ }
18552
+ if (utils$1.isString(path)) {
18553
+ cookie.push(`path=${path}`);
18554
+ }
18555
+ if (utils$1.isString(domain)) {
18556
+ cookie.push(`domain=${domain}`);
18557
+ }
18558
+ if (secure === true) {
18559
+ cookie.push('secure');
18560
+ }
18561
+ if (utils$1.isString(sameSite)) {
18562
+ cookie.push(`SameSite=${sameSite}`);
18563
+ }
18092
18564
 
18093
- :
18565
+ document.cookie = cookie.join('; ');
18566
+ },
18094
18567
 
18095
- // Non-standard browser env (web workers, react-native) lack needed support.
18096
- {
18097
- write() {},
18098
- read() {
18099
- return null;
18100
- },
18101
- remove() {}
18102
- };const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
18568
+ read(name) {
18569
+ if (typeof document === 'undefined') return null;
18570
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
18571
+ return match ? decodeURIComponent(match[1]) : null;
18572
+ },
18573
+
18574
+ remove(name) {
18575
+ this.write(name, '', Date.now() - 86400000, '/');
18576
+ },
18577
+ }
18578
+ : // Non-standard browser env (web workers, react-native) lack needed support.
18579
+ {
18580
+ write() {},
18581
+ read() {
18582
+ return null;
18583
+ },
18584
+ remove() {},
18585
+ };const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
18103
18586
 
18104
18587
  /**
18105
18588
  * Config-specific merge-function which creates a new config-object
@@ -18117,7 +18600,7 @@ function mergeConfig(config1, config2) {
18117
18600
 
18118
18601
  function getMergedValue(target, source, prop, caseless) {
18119
18602
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
18120
- return utils$1.merge.call({caseless}, target, source);
18603
+ return utils$1.merge.call({ caseless }, target, source);
18121
18604
  } else if (utils$1.isPlainObject(source)) {
18122
18605
  return utils$1.merge({}, source);
18123
18606
  } else if (utils$1.isArray(source)) {
@@ -18126,12 +18609,11 @@ function mergeConfig(config1, config2) {
18126
18609
  return source;
18127
18610
  }
18128
18611
 
18129
- // eslint-disable-next-line consistent-return
18130
- function mergeDeepProperties(a, b, prop , caseless) {
18612
+ function mergeDeepProperties(a, b, prop, caseless) {
18131
18613
  if (!utils$1.isUndefined(b)) {
18132
- return getMergedValue(a, b, prop , caseless);
18614
+ return getMergedValue(a, b, prop, caseless);
18133
18615
  } else if (!utils$1.isUndefined(a)) {
18134
- return getMergedValue(undefined, a, prop , caseless);
18616
+ return getMergedValue(undefined, a, prop, caseless);
18135
18617
  }
18136
18618
  }
18137
18619
 
@@ -18189,11 +18671,13 @@ function mergeConfig(config1, config2) {
18189
18671
  socketPath: defaultToConfig2,
18190
18672
  responseEncoding: defaultToConfig2,
18191
18673
  validateStatus: mergeDirectKeys,
18192
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
18674
+ headers: (a, b, prop) =>
18675
+ mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
18193
18676
  };
18194
18677
 
18195
- utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
18196
- const merge = mergeMap[prop] || mergeDeepProperties;
18678
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
18679
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
18680
+ const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
18197
18681
  const configValue = merge(config1[prop], config2[prop], prop);
18198
18682
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
18199
18683
  });
@@ -18206,12 +18690,22 @@ function mergeConfig(config1, config2) {
18206
18690
 
18207
18691
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
18208
18692
 
18209
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
18693
+ newConfig.url = buildURL(
18694
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
18695
+ config.params,
18696
+ config.paramsSerializer
18697
+ );
18210
18698
 
18211
18699
  // HTTP basic authentication
18212
18700
  if (auth) {
18213
- headers.set('Authorization', 'Basic ' +
18214
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
18701
+ headers.set(
18702
+ 'Authorization',
18703
+ 'Basic ' +
18704
+ btoa(
18705
+ (auth.username || '') +
18706
+ ':' +
18707
+ (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
18708
+ )
18215
18709
  );
18216
18710
  }
18217
18711
 
@@ -18229,7 +18723,7 @@ function mergeConfig(config1, config2) {
18229
18723
  }
18230
18724
  });
18231
18725
  }
18232
- }
18726
+ }
18233
18727
 
18234
18728
  // Add xsrf header
18235
18729
  // This is only done if running in a standard browser environment.
@@ -18251,194 +18745,216 @@ function mergeConfig(config1, config2) {
18251
18745
  return newConfig;
18252
18746
  };const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
18253
18747
 
18254
- var xhrAdapter = isXHRAdapterSupported && function (config) {
18255
- return new Promise(function dispatchXhrRequest(resolve, reject) {
18256
- const _config = resolveConfig(config);
18257
- let requestData = _config.data;
18258
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
18259
- let {responseType, onUploadProgress, onDownloadProgress} = _config;
18260
- let onCanceled;
18261
- let uploadThrottled, downloadThrottled;
18262
- let flushUpload, flushDownload;
18748
+ var xhrAdapter = isXHRAdapterSupported &&
18749
+ function (config) {
18750
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
18751
+ const _config = resolveConfig(config);
18752
+ let requestData = _config.data;
18753
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
18754
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
18755
+ let onCanceled;
18756
+ let uploadThrottled, downloadThrottled;
18757
+ let flushUpload, flushDownload;
18263
18758
 
18264
- function done() {
18265
- flushUpload && flushUpload(); // flush events
18266
- flushDownload && flushDownload(); // flush events
18759
+ function done() {
18760
+ flushUpload && flushUpload(); // flush events
18761
+ flushDownload && flushDownload(); // flush events
18267
18762
 
18268
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
18763
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
18269
18764
 
18270
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
18271
- }
18765
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
18766
+ }
18272
18767
 
18273
- let request = new XMLHttpRequest();
18768
+ let request = new XMLHttpRequest();
18274
18769
 
18275
- request.open(_config.method.toUpperCase(), _config.url, true);
18770
+ request.open(_config.method.toUpperCase(), _config.url, true);
18276
18771
 
18277
- // Set the request timeout in MS
18278
- request.timeout = _config.timeout;
18772
+ // Set the request timeout in MS
18773
+ request.timeout = _config.timeout;
18279
18774
 
18280
- function onloadend() {
18281
- if (!request) {
18282
- return;
18775
+ function onloadend() {
18776
+ if (!request) {
18777
+ return;
18778
+ }
18779
+ // Prepare the response
18780
+ const responseHeaders = AxiosHeaders$1.from(
18781
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
18782
+ );
18783
+ const responseData =
18784
+ !responseType || responseType === 'text' || responseType === 'json'
18785
+ ? request.responseText
18786
+ : request.response;
18787
+ const response = {
18788
+ data: responseData,
18789
+ status: request.status,
18790
+ statusText: request.statusText,
18791
+ headers: responseHeaders,
18792
+ config,
18793
+ request,
18794
+ };
18795
+
18796
+ settle(
18797
+ function _resolve(value) {
18798
+ resolve(value);
18799
+ done();
18800
+ },
18801
+ function _reject(err) {
18802
+ reject(err);
18803
+ done();
18804
+ },
18805
+ response
18806
+ );
18807
+
18808
+ // Clean up request
18809
+ request = null;
18283
18810
  }
18284
- // Prepare the response
18285
- const responseHeaders = AxiosHeaders$1.from(
18286
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
18287
- );
18288
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
18289
- request.responseText : request.response;
18290
- const response = {
18291
- data: responseData,
18292
- status: request.status,
18293
- statusText: request.statusText,
18294
- headers: responseHeaders,
18295
- config,
18296
- request
18297
- };
18298
18811
 
18299
- settle(function _resolve(value) {
18300
- resolve(value);
18301
- done();
18302
- }, function _reject(err) {
18303
- reject(err);
18304
- done();
18305
- }, response);
18812
+ if ('onloadend' in request) {
18813
+ // Use onloadend if available
18814
+ request.onloadend = onloadend;
18815
+ } else {
18816
+ // Listen for ready state to emulate onloadend
18817
+ request.onreadystatechange = function handleLoad() {
18818
+ if (!request || request.readyState !== 4) {
18819
+ return;
18820
+ }
18306
18821
 
18307
- // Clean up request
18308
- request = null;
18309
- }
18822
+ // The request errored out and we didn't get a response, this will be
18823
+ // handled by onerror instead
18824
+ // With one exception: request that using file: protocol, most browsers
18825
+ // will return status as 0 even though it's a successful request
18826
+ if (
18827
+ request.status === 0 &&
18828
+ !(request.responseURL && request.responseURL.indexOf('file:') === 0)
18829
+ ) {
18830
+ return;
18831
+ }
18832
+ // readystate handler is calling before onerror or ontimeout handlers,
18833
+ // so we should call onloadend on the next 'tick'
18834
+ setTimeout(onloadend);
18835
+ };
18836
+ }
18310
18837
 
18311
- if ('onloadend' in request) {
18312
- // Use onloadend if available
18313
- request.onloadend = onloadend;
18314
- } else {
18315
- // Listen for ready state to emulate onloadend
18316
- request.onreadystatechange = function handleLoad() {
18317
- if (!request || request.readyState !== 4) {
18838
+ // Handle browser request cancellation (as opposed to a manual cancellation)
18839
+ request.onabort = function handleAbort() {
18840
+ if (!request) {
18318
18841
  return;
18319
18842
  }
18320
18843
 
18321
- // The request errored out and we didn't get a response, this will be
18322
- // handled by onerror instead
18323
- // With one exception: request that using file: protocol, most browsers
18324
- // will return status as 0 even though it's a successful request
18325
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
18326
- return;
18327
- }
18328
- // readystate handler is calling before onerror or ontimeout handlers,
18329
- // so we should call onloadend on the next 'tick'
18330
- setTimeout(onloadend);
18844
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
18845
+
18846
+ // Clean up request
18847
+ request = null;
18331
18848
  };
18332
- }
18333
18849
 
18334
- // Handle browser request cancellation (as opposed to a manual cancellation)
18335
- request.onabort = function handleAbort() {
18336
- if (!request) {
18337
- return;
18338
- }
18850
+ // Handle low level network errors
18851
+ request.onerror = function handleError(event) {
18852
+ // Browsers deliver a ProgressEvent in XHR onerror
18853
+ // (message may be empty; when present, surface it)
18854
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
18855
+ const msg = event && event.message ? event.message : 'Network Error';
18856
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
18857
+ // attach the underlying event for consumers who want details
18858
+ err.event = event || null;
18859
+ reject(err);
18860
+ request = null;
18861
+ };
18339
18862
 
18340
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
18863
+ // Handle timeout
18864
+ request.ontimeout = function handleTimeout() {
18865
+ let timeoutErrorMessage = _config.timeout
18866
+ ? 'timeout of ' + _config.timeout + 'ms exceeded'
18867
+ : 'timeout exceeded';
18868
+ const transitional = _config.transitional || transitionalDefaults;
18869
+ if (_config.timeoutErrorMessage) {
18870
+ timeoutErrorMessage = _config.timeoutErrorMessage;
18871
+ }
18872
+ reject(
18873
+ new AxiosError$1(
18874
+ timeoutErrorMessage,
18875
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
18876
+ config,
18877
+ request
18878
+ )
18879
+ );
18341
18880
 
18342
- // Clean up request
18343
- request = null;
18344
- };
18881
+ // Clean up request
18882
+ request = null;
18883
+ };
18345
18884
 
18346
- // Handle low level network errors
18347
- request.onerror = function handleError(event) {
18348
- // Browsers deliver a ProgressEvent in XHR onerror
18349
- // (message may be empty; when present, surface it)
18350
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
18351
- const msg = event && event.message ? event.message : 'Network Error';
18352
- const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
18353
- // attach the underlying event for consumers who want details
18354
- err.event = event || null;
18355
- reject(err);
18356
- request = null;
18357
- };
18358
-
18359
- // Handle timeout
18360
- request.ontimeout = function handleTimeout() {
18361
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
18362
- const transitional = _config.transitional || transitionalDefaults;
18363
- if (_config.timeoutErrorMessage) {
18364
- timeoutErrorMessage = _config.timeoutErrorMessage;
18365
- }
18366
- reject(new AxiosError(
18367
- timeoutErrorMessage,
18368
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
18369
- config,
18370
- request));
18371
-
18372
- // Clean up request
18373
- request = null;
18374
- };
18885
+ // Remove Content-Type if data is undefined
18886
+ requestData === undefined && requestHeaders.setContentType(null);
18375
18887
 
18376
- // Remove Content-Type if data is undefined
18377
- requestData === undefined && requestHeaders.setContentType(null);
18888
+ // Add headers to the request
18889
+ if ('setRequestHeader' in request) {
18890
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
18891
+ request.setRequestHeader(key, val);
18892
+ });
18893
+ }
18378
18894
 
18379
- // Add headers to the request
18380
- if ('setRequestHeader' in request) {
18381
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
18382
- request.setRequestHeader(key, val);
18383
- });
18384
- }
18895
+ // Add withCredentials to request if needed
18896
+ if (!utils$1.isUndefined(_config.withCredentials)) {
18897
+ request.withCredentials = !!_config.withCredentials;
18898
+ }
18385
18899
 
18386
- // Add withCredentials to request if needed
18387
- if (!utils$1.isUndefined(_config.withCredentials)) {
18388
- request.withCredentials = !!_config.withCredentials;
18389
- }
18900
+ // Add responseType to request if needed
18901
+ if (responseType && responseType !== 'json') {
18902
+ request.responseType = _config.responseType;
18903
+ }
18390
18904
 
18391
- // Add responseType to request if needed
18392
- if (responseType && responseType !== 'json') {
18393
- request.responseType = _config.responseType;
18394
- }
18905
+ // Handle progress if needed
18906
+ if (onDownloadProgress) {
18907
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
18908
+ request.addEventListener('progress', downloadThrottled);
18909
+ }
18395
18910
 
18396
- // Handle progress if needed
18397
- if (onDownloadProgress) {
18398
- ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
18399
- request.addEventListener('progress', downloadThrottled);
18400
- }
18911
+ // Not all browsers support upload events
18912
+ if (onUploadProgress && request.upload) {
18913
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
18401
18914
 
18402
- // Not all browsers support upload events
18403
- if (onUploadProgress && request.upload) {
18404
- ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
18915
+ request.upload.addEventListener('progress', uploadThrottled);
18405
18916
 
18406
- request.upload.addEventListener('progress', uploadThrottled);
18917
+ request.upload.addEventListener('loadend', flushUpload);
18918
+ }
18407
18919
 
18408
- request.upload.addEventListener('loadend', flushUpload);
18409
- }
18920
+ if (_config.cancelToken || _config.signal) {
18921
+ // Handle cancellation
18922
+ // eslint-disable-next-line func-names
18923
+ onCanceled = (cancel) => {
18924
+ if (!request) {
18925
+ return;
18926
+ }
18927
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
18928
+ request.abort();
18929
+ request = null;
18930
+ };
18410
18931
 
18411
- if (_config.cancelToken || _config.signal) {
18412
- // Handle cancellation
18413
- // eslint-disable-next-line func-names
18414
- onCanceled = cancel => {
18415
- if (!request) {
18416
- return;
18932
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
18933
+ if (_config.signal) {
18934
+ _config.signal.aborted
18935
+ ? onCanceled()
18936
+ : _config.signal.addEventListener('abort', onCanceled);
18417
18937
  }
18418
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
18419
- request.abort();
18420
- request = null;
18421
- };
18422
-
18423
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
18424
- if (_config.signal) {
18425
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
18426
18938
  }
18427
- }
18428
-
18429
- const protocol = parseProtocol(_config.url);
18430
18939
 
18431
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
18432
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
18433
- return;
18434
- }
18940
+ const protocol = parseProtocol(_config.url);
18435
18941
 
18942
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
18943
+ reject(
18944
+ new AxiosError$1(
18945
+ 'Unsupported protocol ' + protocol + ':',
18946
+ AxiosError$1.ERR_BAD_REQUEST,
18947
+ config
18948
+ )
18949
+ );
18950
+ return;
18951
+ }
18436
18952
 
18437
- // Send the request
18438
- request.send(requestData || null);
18439
- });
18440
- };const composeSignals = (signals, timeout) => {
18441
- const {length} = (signals = signals ? signals.filter(Boolean) : []);
18953
+ // Send the request
18954
+ request.send(requestData || null);
18955
+ });
18956
+ };const composeSignals = (signals, timeout) => {
18957
+ const { length } = (signals = signals ? signals.filter(Boolean) : []);
18442
18958
 
18443
18959
  if (timeout || length) {
18444
18960
  let controller = new AbortController();
@@ -18450,21 +18966,29 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
18450
18966
  aborted = true;
18451
18967
  unsubscribe();
18452
18968
  const err = reason instanceof Error ? reason : this.reason;
18453
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
18969
+ controller.abort(
18970
+ err instanceof AxiosError$1
18971
+ ? err
18972
+ : new CanceledError$1(err instanceof Error ? err.message : err)
18973
+ );
18454
18974
  }
18455
18975
  };
18456
18976
 
18457
- let timer = timeout && setTimeout(() => {
18458
- timer = null;
18459
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
18460
- }, timeout);
18977
+ let timer =
18978
+ timeout &&
18979
+ setTimeout(() => {
18980
+ timer = null;
18981
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
18982
+ }, timeout);
18461
18983
 
18462
18984
  const unsubscribe = () => {
18463
18985
  if (signals) {
18464
18986
  timer && clearTimeout(timer);
18465
18987
  timer = null;
18466
- signals.forEach(signal => {
18467
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
18988
+ signals.forEach((signal) => {
18989
+ signal.unsubscribe
18990
+ ? signal.unsubscribe(onabort)
18991
+ : signal.removeEventListener('abort', onabort);
18468
18992
  });
18469
18993
  signals = null;
18470
18994
  }
@@ -18472,7 +18996,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
18472
18996
 
18473
18997
  signals.forEach((signal) => signal.addEventListener('abort', onabort));
18474
18998
 
18475
- const {signal} = controller;
18999
+ const { signal } = controller;
18476
19000
 
18477
19001
  signal.unsubscribe = () => utils$1.asap(unsubscribe);
18478
19002
 
@@ -18513,7 +19037,7 @@ const readStream = async function* (stream) {
18513
19037
  const reader = stream.getReader();
18514
19038
  try {
18515
19039
  for (;;) {
18516
- const {done, value} = await reader.read();
19040
+ const { done, value } = await reader.read();
18517
19041
  if (done) {
18518
19042
  break;
18519
19043
  }
@@ -18536,62 +19060,67 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
18536
19060
  }
18537
19061
  };
18538
19062
 
18539
- return new ReadableStream({
18540
- async pull(controller) {
18541
- try {
18542
- const {done, value} = await iterator.next();
19063
+ return new ReadableStream(
19064
+ {
19065
+ async pull(controller) {
19066
+ try {
19067
+ const { done, value } = await iterator.next();
18543
19068
 
18544
- if (done) {
18545
- _onFinish();
18546
- controller.close();
18547
- return;
18548
- }
19069
+ if (done) {
19070
+ _onFinish();
19071
+ controller.close();
19072
+ return;
19073
+ }
18549
19074
 
18550
- let len = value.byteLength;
18551
- if (onProgress) {
18552
- let loadedBytes = bytes += len;
18553
- onProgress(loadedBytes);
19075
+ let len = value.byteLength;
19076
+ if (onProgress) {
19077
+ let loadedBytes = (bytes += len);
19078
+ onProgress(loadedBytes);
19079
+ }
19080
+ controller.enqueue(new Uint8Array(value));
19081
+ } catch (err) {
19082
+ _onFinish(err);
19083
+ throw err;
18554
19084
  }
18555
- controller.enqueue(new Uint8Array(value));
18556
- } catch (err) {
18557
- _onFinish(err);
18558
- throw err;
18559
- }
19085
+ },
19086
+ cancel(reason) {
19087
+ _onFinish(reason);
19088
+ return iterator.return();
19089
+ },
18560
19090
  },
18561
- cancel(reason) {
18562
- _onFinish(reason);
18563
- return iterator.return();
19091
+ {
19092
+ highWaterMark: 2,
18564
19093
  }
18565
- }, {
18566
- highWaterMark: 2
18567
- })
19094
+ );
18568
19095
  };const DEFAULT_CHUNK_SIZE = 64 * 1024;
18569
19096
 
18570
- const {isFunction} = utils$1;
19097
+ const { isFunction } = utils$1;
18571
19098
 
18572
- const globalFetchAPI = (({Request, Response}) => ({
18573
- Request, Response
19099
+ const globalFetchAPI = (({ Request, Response }) => ({
19100
+ Request,
19101
+ Response,
18574
19102
  }))(utils$1.global);
18575
19103
 
18576
- const {
18577
- ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1
18578
- } = utils$1.global;
18579
-
19104
+ const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
18580
19105
 
18581
19106
  const test = (fn, ...args) => {
18582
19107
  try {
18583
19108
  return !!fn(...args);
18584
19109
  } catch (e) {
18585
- return false
19110
+ return false;
18586
19111
  }
18587
19112
  };
18588
19113
 
18589
19114
  const factory = (env) => {
18590
- env = utils$1.merge.call({
18591
- skipUndefined: true
18592
- }, globalFetchAPI, env);
19115
+ env = utils$1.merge.call(
19116
+ {
19117
+ skipUndefined: true,
19118
+ },
19119
+ globalFetchAPI,
19120
+ env
19121
+ );
18593
19122
 
18594
- const {fetch: envFetch, Request, Response} = env;
19123
+ const { fetch: envFetch, Request, Response } = env;
18595
19124
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
18596
19125
  const isRequestSupported = isFunction(Request);
18597
19126
  const isResponseSupported = isFunction(Response);
@@ -18602,46 +19131,61 @@ const factory = (env) => {
18602
19131
 
18603
19132
  const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
18604
19133
 
18605
- const encodeText = isFetchSupported && (typeof TextEncoder$1 === 'function' ?
18606
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) :
18607
- async (str) => new Uint8Array(await new Request(str).arrayBuffer())
18608
- );
18609
-
18610
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
18611
- let duplexAccessed = false;
18612
-
18613
- const hasContentType = new Request(platform.origin, {
18614
- body: new ReadableStream$1(),
18615
- method: 'POST',
18616
- get duplex() {
18617
- duplexAccessed = true;
18618
- return 'half';
18619
- },
18620
- }).headers.has('Content-Type');
19134
+ const encodeText =
19135
+ isFetchSupported &&
19136
+ (typeof TextEncoder$1 === 'function'
19137
+ ? (
19138
+ (encoder) => (str) =>
19139
+ encoder.encode(str)
19140
+ )(new TextEncoder$1())
19141
+ : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
19142
+
19143
+ const supportsRequestStream =
19144
+ isRequestSupported &&
19145
+ isReadableStreamSupported &&
19146
+ test(() => {
19147
+ let duplexAccessed = false;
19148
+
19149
+ const hasContentType = new Request(platform.origin, {
19150
+ body: new ReadableStream$1(),
19151
+ method: 'POST',
19152
+ get duplex() {
19153
+ duplexAccessed = true;
19154
+ return 'half';
19155
+ },
19156
+ }).headers.has('Content-Type');
18621
19157
 
18622
- return duplexAccessed && !hasContentType;
18623
- });
19158
+ return duplexAccessed && !hasContentType;
19159
+ });
18624
19160
 
18625
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
19161
+ const supportsResponseStream =
19162
+ isResponseSupported &&
19163
+ isReadableStreamSupported &&
18626
19164
  test(() => utils$1.isReadableStream(new Response('').body));
18627
19165
 
18628
19166
  const resolvers = {
18629
- stream: supportsResponseStream && ((res) => res.body)
19167
+ stream: supportsResponseStream && ((res) => res.body),
18630
19168
  };
18631
19169
 
18632
- isFetchSupported && ((() => {
18633
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
18634
- !resolvers[type] && (resolvers[type] = (res, config) => {
18635
- let method = res && res[type];
19170
+ isFetchSupported &&
19171
+ (() => {
19172
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
19173
+ !resolvers[type] &&
19174
+ (resolvers[type] = (res, config) => {
19175
+ let method = res && res[type];
18636
19176
 
18637
- if (method) {
18638
- return method.call(res);
18639
- }
19177
+ if (method) {
19178
+ return method.call(res);
19179
+ }
18640
19180
 
18641
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
19181
+ throw new AxiosError$1(
19182
+ `Response type '${type}' is not supported`,
19183
+ AxiosError$1.ERR_NOT_SUPPORT,
19184
+ config
19185
+ );
19186
+ });
18642
19187
  });
18643
- });
18644
- })());
19188
+ })();
18645
19189
 
18646
19190
  const getBodyLength = async (body) => {
18647
19191
  if (body == null) {
@@ -18692,32 +19236,41 @@ const factory = (env) => {
18692
19236
  responseType,
18693
19237
  headers,
18694
19238
  withCredentials = 'same-origin',
18695
- fetchOptions
19239
+ fetchOptions,
18696
19240
  } = resolveConfig(config);
18697
19241
 
18698
19242
  let _fetch = envFetch || fetch;
18699
19243
 
18700
19244
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
18701
19245
 
18702
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
19246
+ let composedSignal = composeSignals$1(
19247
+ [signal, cancelToken && cancelToken.toAbortSignal()],
19248
+ timeout
19249
+ );
18703
19250
 
18704
19251
  let request = null;
18705
19252
 
18706
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
18707
- composedSignal.unsubscribe();
18708
- });
19253
+ const unsubscribe =
19254
+ composedSignal &&
19255
+ composedSignal.unsubscribe &&
19256
+ (() => {
19257
+ composedSignal.unsubscribe();
19258
+ });
18709
19259
 
18710
19260
  let requestContentLength;
18711
19261
 
18712
19262
  try {
18713
19263
  if (
18714
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
19264
+ onUploadProgress &&
19265
+ supportsRequestStream &&
19266
+ method !== 'get' &&
19267
+ method !== 'head' &&
18715
19268
  (requestContentLength = await resolveBodyLength(headers, data)) !== 0
18716
19269
  ) {
18717
19270
  let _request = new Request(url, {
18718
19271
  method: 'POST',
18719
19272
  body: data,
18720
- duplex: "half"
19273
+ duplex: 'half',
18721
19274
  });
18722
19275
 
18723
19276
  let contentTypeHeader;
@@ -18742,7 +19295,7 @@ const factory = (env) => {
18742
19295
 
18743
19296
  // Cloudflare Workers throws when credentials are defined
18744
19297
  // see https://github.com/cloudflare/workerd/issues/902
18745
- const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
19298
+ const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
18746
19299
 
18747
19300
  const resolvedOptions = {
18748
19301
  ...fetchOptions,
@@ -18750,29 +19303,35 @@ const factory = (env) => {
18750
19303
  method: method.toUpperCase(),
18751
19304
  headers: headers.normalize().toJSON(),
18752
19305
  body: data,
18753
- duplex: "half",
18754
- credentials: isCredentialsSupported ? withCredentials : undefined
19306
+ duplex: 'half',
19307
+ credentials: isCredentialsSupported ? withCredentials : undefined,
18755
19308
  };
18756
19309
 
18757
19310
  request = isRequestSupported && new Request(url, resolvedOptions);
18758
19311
 
18759
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
19312
+ let response = await (isRequestSupported
19313
+ ? _fetch(request, fetchOptions)
19314
+ : _fetch(url, resolvedOptions));
18760
19315
 
18761
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
19316
+ const isStreamResponse =
19317
+ supportsResponseStream && (responseType === 'stream' || responseType === 'response');
18762
19318
 
18763
19319
  if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
18764
19320
  const options = {};
18765
19321
 
18766
- ['status', 'statusText', 'headers'].forEach(prop => {
19322
+ ['status', 'statusText', 'headers'].forEach((prop) => {
18767
19323
  options[prop] = response[prop];
18768
19324
  });
18769
19325
 
18770
19326
  const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
18771
19327
 
18772
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
18773
- responseContentLength,
18774
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
18775
- ) || [];
19328
+ const [onProgress, flush] =
19329
+ (onDownloadProgress &&
19330
+ progressEventDecorator(
19331
+ responseContentLength,
19332
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
19333
+ )) ||
19334
+ [];
18776
19335
 
18777
19336
  response = new Response(
18778
19337
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
@@ -18785,7 +19344,10 @@ const factory = (env) => {
18785
19344
 
18786
19345
  responseType = responseType || 'text';
18787
19346
 
18788
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
19347
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
19348
+ response,
19349
+ config
19350
+ );
18789
19351
 
18790
19352
  !isStreamResponse && unsubscribe && unsubscribe();
18791
19353
 
@@ -18796,43 +19358,50 @@ const factory = (env) => {
18796
19358
  status: response.status,
18797
19359
  statusText: response.statusText,
18798
19360
  config,
18799
- request
19361
+ request,
18800
19362
  });
18801
- })
19363
+ });
18802
19364
  } catch (err) {
18803
19365
  unsubscribe && unsubscribe();
18804
19366
 
18805
19367
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
18806
19368
  throw Object.assign(
18807
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
19369
+ new AxiosError$1(
19370
+ 'Network Error',
19371
+ AxiosError$1.ERR_NETWORK,
19372
+ config,
19373
+ request,
19374
+ err && err.response
19375
+ ),
18808
19376
  {
18809
- cause: err.cause || err
19377
+ cause: err.cause || err,
18810
19378
  }
18811
- )
19379
+ );
18812
19380
  }
18813
19381
 
18814
- throw AxiosError.from(err, err && err.code, config, request);
19382
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
18815
19383
  }
18816
- }
19384
+ };
18817
19385
  };
18818
19386
 
18819
19387
  const seedCache = new Map();
18820
19388
 
18821
19389
  const getFetch = (config) => {
18822
- let env = config ? config.env : {};
18823
- const {fetch, Request, Response} = env;
18824
- const seeds = [
18825
- Request, Response, fetch
18826
- ];
19390
+ let env = (config && config.env) || {};
19391
+ const { fetch, Request, Response } = env;
19392
+ const seeds = [Request, Response, fetch];
18827
19393
 
18828
- let len = seeds.length, i = len,
18829
- seed, target, map = seedCache;
19394
+ let len = seeds.length,
19395
+ i = len,
19396
+ seed,
19397
+ target,
19398
+ map = seedCache;
18830
19399
 
18831
19400
  while (i--) {
18832
19401
  seed = seeds[i];
18833
19402
  target = map.get(seed);
18834
19403
 
18835
- target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
19404
+ target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
18836
19405
 
18837
19406
  map = target;
18838
19407
  }
@@ -18840,80 +19409,129 @@ const getFetch = (config) => {
18840
19409
  return target;
18841
19410
  };
18842
19411
 
18843
- getFetch();const knownAdapters = {
19412
+ getFetch();/**
19413
+ * Known adapters mapping.
19414
+ * Provides environment-specific adapters for Axios:
19415
+ * - `http` for Node.js
19416
+ * - `xhr` for browsers
19417
+ * - `fetch` for fetch API-based requests
19418
+ *
19419
+ * @type {Object<string, Function|Object>}
19420
+ */
19421
+ const knownAdapters = {
18844
19422
  http: httpAdapter,
18845
19423
  xhr: xhrAdapter,
18846
19424
  fetch: {
18847
19425
  get: getFetch,
18848
- }
19426
+ },
18849
19427
  };
18850
19428
 
19429
+ // Assign adapter names for easier debugging and identification
18851
19430
  utils$1.forEach(knownAdapters, (fn, value) => {
18852
19431
  if (fn) {
18853
19432
  try {
18854
- Object.defineProperty(fn, 'name', {value});
19433
+ Object.defineProperty(fn, 'name', { value });
18855
19434
  } catch (e) {
18856
19435
  // eslint-disable-next-line no-empty
18857
19436
  }
18858
- Object.defineProperty(fn, 'adapterName', {value});
19437
+ Object.defineProperty(fn, 'adapterName', { value });
18859
19438
  }
18860
19439
  });
18861
19440
 
19441
+ /**
19442
+ * Render a rejection reason string for unknown or unsupported adapters
19443
+ *
19444
+ * @param {string} reason
19445
+ * @returns {string}
19446
+ */
18862
19447
  const renderReason = (reason) => `- ${reason}`;
18863
19448
 
18864
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
18865
-
18866
- var adapters = {
18867
- getAdapter: (adapters, config) => {
18868
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
19449
+ /**
19450
+ * Check if the adapter is resolved (function, null, or false)
19451
+ *
19452
+ * @param {Function|null|false} adapter
19453
+ * @returns {boolean}
19454
+ */
19455
+ const isResolvedHandle = (adapter) =>
19456
+ utils$1.isFunction(adapter) || adapter === null || adapter === false;
18869
19457
 
18870
- const {length} = adapters;
18871
- let nameOrAdapter;
18872
- let adapter;
19458
+ /**
19459
+ * Get the first suitable adapter from the provided list.
19460
+ * Tries each adapter in order until a supported one is found.
19461
+ * Throws an AxiosError if no adapter is suitable.
19462
+ *
19463
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
19464
+ * @param {Object} config - Axios request configuration
19465
+ * @throws {AxiosError} If no suitable adapter is available
19466
+ * @returns {Function} The resolved adapter function
19467
+ */
19468
+ function getAdapter(adapters, config) {
19469
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
18873
19470
 
18874
- const rejectedReasons = {};
19471
+ const { length } = adapters;
19472
+ let nameOrAdapter;
19473
+ let adapter;
18875
19474
 
18876
- for (let i = 0; i < length; i++) {
18877
- nameOrAdapter = adapters[i];
18878
- let id;
19475
+ const rejectedReasons = {};
18879
19476
 
18880
- adapter = nameOrAdapter;
19477
+ for (let i = 0; i < length; i++) {
19478
+ nameOrAdapter = adapters[i];
19479
+ let id;
18881
19480
 
18882
- if (!isResolvedHandle(nameOrAdapter)) {
18883
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
19481
+ adapter = nameOrAdapter;
18884
19482
 
18885
- if (adapter === undefined) {
18886
- throw new AxiosError(`Unknown adapter '${id}'`);
18887
- }
18888
- }
19483
+ if (!isResolvedHandle(nameOrAdapter)) {
19484
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
18889
19485
 
18890
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
18891
- break;
19486
+ if (adapter === undefined) {
19487
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
18892
19488
  }
19489
+ }
18893
19490
 
18894
- rejectedReasons[id || '#' + i] = adapter;
19491
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
19492
+ break;
18895
19493
  }
18896
19494
 
18897
- if (!adapter) {
19495
+ rejectedReasons[id || '#' + i] = adapter;
19496
+ }
18898
19497
 
18899
- const reasons = Object.entries(rejectedReasons)
18900
- .map(([id, state]) => `adapter ${id} ` +
18901
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
18902
- );
19498
+ if (!adapter) {
19499
+ const reasons = Object.entries(rejectedReasons).map(
19500
+ ([id, state]) =>
19501
+ `adapter ${id} ` +
19502
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
19503
+ );
18903
19504
 
18904
- let s = length ?
18905
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
18906
- 'as no adapter specified';
19505
+ let s = length
19506
+ ? reasons.length > 1
19507
+ ? 'since :\n' + reasons.map(renderReason).join('\n')
19508
+ : ' ' + renderReason(reasons[0])
19509
+ : 'as no adapter specified';
18907
19510
 
18908
- throw new AxiosError(
18909
- `There is no suitable adapter to dispatch the request ` + s,
18910
- 'ERR_NOT_SUPPORT'
18911
- );
18912
- }
19511
+ throw new AxiosError$1(
19512
+ `There is no suitable adapter to dispatch the request ` + s,
19513
+ 'ERR_NOT_SUPPORT'
19514
+ );
19515
+ }
18913
19516
 
18914
- return adapter;
18915
- },
18916
- adapters: knownAdapters
19517
+ return adapter;
19518
+ }
19519
+
19520
+ /**
19521
+ * Exports Axios adapters and utility to resolve an adapter
19522
+ */
19523
+ var adapters = {
19524
+ /**
19525
+ * Resolve an adapter from a list of adapter names or functions.
19526
+ * @type {Function}
19527
+ */
19528
+ getAdapter,
19529
+
19530
+ /**
19531
+ * Exposes all known adapters
19532
+ * @type {Object<string, Function|Object>}
19533
+ */
19534
+ adapters: knownAdapters,
18917
19535
  };/**
18918
19536
  * Throws a `CanceledError` if cancellation has been requested.
18919
19537
  *
@@ -18927,7 +19545,7 @@ function throwIfCancellationRequested(config) {
18927
19545
  }
18928
19546
 
18929
19547
  if (config.signal && config.signal.aborted) {
18930
- throw new CanceledError(null, config);
19548
+ throw new CanceledError$1(null, config);
18931
19549
  }
18932
19550
  }
18933
19551
 
@@ -18944,10 +19562,7 @@ function dispatchRequest(config) {
18944
19562
  config.headers = AxiosHeaders$1.from(config.headers);
18945
19563
 
18946
19564
  // Transform request data
18947
- config.data = transformData.call(
18948
- config,
18949
- config.transformRequest
18950
- );
19565
+ config.data = transformData.call(config, config.transformRequest);
18951
19566
 
18952
19567
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
18953
19568
  config.headers.setContentType('application/x-www-form-urlencoded', false);
@@ -18955,36 +19570,35 @@ function dispatchRequest(config) {
18955
19570
 
18956
19571
  const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
18957
19572
 
18958
- return adapter(config).then(function onAdapterResolution(response) {
18959
- throwIfCancellationRequested(config);
19573
+ return adapter(config).then(
19574
+ function onAdapterResolution(response) {
19575
+ throwIfCancellationRequested(config);
18960
19576
 
18961
- // Transform response data
18962
- response.data = transformData.call(
18963
- config,
18964
- config.transformResponse,
18965
- response
18966
- );
19577
+ // Transform response data
19578
+ response.data = transformData.call(config, config.transformResponse, response);
18967
19579
 
18968
- response.headers = AxiosHeaders$1.from(response.headers);
19580
+ response.headers = AxiosHeaders$1.from(response.headers);
18969
19581
 
18970
- return response;
18971
- }, function onAdapterRejection(reason) {
18972
- if (!isCancel(reason)) {
18973
- throwIfCancellationRequested(config);
19582
+ return response;
19583
+ },
19584
+ function onAdapterRejection(reason) {
19585
+ if (!isCancel(reason)) {
19586
+ throwIfCancellationRequested(config);
18974
19587
 
18975
- // Transform response data
18976
- if (reason && reason.response) {
18977
- reason.response.data = transformData.call(
18978
- config,
18979
- config.transformResponse,
18980
- reason.response
18981
- );
18982
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
19588
+ // Transform response data
19589
+ if (reason && reason.response) {
19590
+ reason.response.data = transformData.call(
19591
+ config,
19592
+ config.transformResponse,
19593
+ reason.response
19594
+ );
19595
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
19596
+ }
18983
19597
  }
18984
- }
18985
19598
 
18986
- return Promise.reject(reason);
18987
- });
19599
+ return Promise.reject(reason);
19600
+ }
19601
+ );
18988
19602
  }const validators$1 = {};
18989
19603
 
18990
19604
  // eslint-disable-next-line func-names
@@ -19007,15 +19621,23 @@ const deprecatedWarnings = {};
19007
19621
  */
19008
19622
  validators$1.transitional = function transitional(validator, version, message) {
19009
19623
  function formatMessage(opt, desc) {
19010
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
19624
+ return (
19625
+ '[Axios v' +
19626
+ VERSION +
19627
+ "] Transitional option '" +
19628
+ opt +
19629
+ "'" +
19630
+ desc +
19631
+ (message ? '. ' + message : '')
19632
+ );
19011
19633
  }
19012
19634
 
19013
19635
  // eslint-disable-next-line func-names
19014
19636
  return (value, opt, opts) => {
19015
19637
  if (validator === false) {
19016
- throw new AxiosError(
19638
+ throw new AxiosError$1(
19017
19639
  formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
19018
- AxiosError.ERR_DEPRECATED
19640
+ AxiosError$1.ERR_DEPRECATED
19019
19641
  );
19020
19642
  }
19021
19643
 
@@ -19039,7 +19661,7 @@ validators$1.spelling = function spelling(correctSpelling) {
19039
19661
  // eslint-disable-next-line no-console
19040
19662
  console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
19041
19663
  return true;
19042
- }
19664
+ };
19043
19665
  };
19044
19666
 
19045
19667
  /**
@@ -19054,7 +19676,7 @@ validators$1.spelling = function spelling(correctSpelling) {
19054
19676
 
19055
19677
  function assertOptions(options, schema, allowUnknown) {
19056
19678
  if (typeof options !== 'object') {
19057
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
19679
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
19058
19680
  }
19059
19681
  const keys = Object.keys(options);
19060
19682
  let i = keys.length;
@@ -19065,19 +19687,22 @@ function assertOptions(options, schema, allowUnknown) {
19065
19687
  const value = options[opt];
19066
19688
  const result = value === undefined || validator(value, opt, options);
19067
19689
  if (result !== true) {
19068
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
19690
+ throw new AxiosError$1(
19691
+ 'option ' + opt + ' must be ' + result,
19692
+ AxiosError$1.ERR_BAD_OPTION_VALUE
19693
+ );
19069
19694
  }
19070
19695
  continue;
19071
19696
  }
19072
19697
  if (allowUnknown !== true) {
19073
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
19698
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
19074
19699
  }
19075
19700
  }
19076
19701
  }
19077
19702
 
19078
19703
  var validator = {
19079
19704
  assertOptions,
19080
- validators: validators$1
19705
+ validators: validators$1,
19081
19706
  };const validators = validator.validators;
19082
19707
 
19083
19708
  /**
@@ -19092,7 +19717,7 @@ class Axios {
19092
19717
  this.defaults = instanceConfig || {};
19093
19718
  this.interceptors = {
19094
19719
  request: new InterceptorManager$1(),
19095
- response: new InterceptorManager$1()
19720
+ response: new InterceptorManager$1(),
19096
19721
  };
19097
19722
  }
19098
19723
 
@@ -19143,26 +19768,35 @@ class Axios {
19143
19768
 
19144
19769
  config = mergeConfig(this.defaults, config);
19145
19770
 
19146
- const {transitional, paramsSerializer, headers} = config;
19771
+ const { transitional, paramsSerializer, headers } = config;
19147
19772
 
19148
19773
  if (transitional !== undefined) {
19149
- validator.assertOptions(transitional, {
19150
- silentJSONParsing: validators.transitional(validators.boolean),
19151
- forcedJSONParsing: validators.transitional(validators.boolean),
19152
- clarifyTimeoutError: validators.transitional(validators.boolean)
19153
- }, false);
19774
+ validator.assertOptions(
19775
+ transitional,
19776
+ {
19777
+ silentJSONParsing: validators.transitional(validators.boolean),
19778
+ forcedJSONParsing: validators.transitional(validators.boolean),
19779
+ clarifyTimeoutError: validators.transitional(validators.boolean),
19780
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
19781
+ },
19782
+ false
19783
+ );
19154
19784
  }
19155
19785
 
19156
19786
  if (paramsSerializer != null) {
19157
19787
  if (utils$1.isFunction(paramsSerializer)) {
19158
19788
  config.paramsSerializer = {
19159
- serialize: paramsSerializer
19789
+ serialize: paramsSerializer,
19160
19790
  };
19161
19791
  } else {
19162
- validator.assertOptions(paramsSerializer, {
19163
- encode: validators.function,
19164
- serialize: validators.function
19165
- }, true);
19792
+ validator.assertOptions(
19793
+ paramsSerializer,
19794
+ {
19795
+ encode: validators.function,
19796
+ serialize: validators.function,
19797
+ },
19798
+ true
19799
+ );
19166
19800
  }
19167
19801
  }
19168
19802
 
@@ -19173,26 +19807,25 @@ class Axios {
19173
19807
  config.allowAbsoluteUrls = true;
19174
19808
  }
19175
19809
 
19176
- validator.assertOptions(config, {
19177
- baseUrl: validators.spelling('baseURL'),
19178
- withXsrfToken: validators.spelling('withXSRFToken')
19179
- }, true);
19810
+ validator.assertOptions(
19811
+ config,
19812
+ {
19813
+ baseUrl: validators.spelling('baseURL'),
19814
+ withXsrfToken: validators.spelling('withXSRFToken'),
19815
+ },
19816
+ true
19817
+ );
19180
19818
 
19181
19819
  // Set config.method
19182
19820
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
19183
19821
 
19184
19822
  // Flatten headers
19185
- let contextHeaders = headers && utils$1.merge(
19186
- headers.common,
19187
- headers[config.method]
19188
- );
19823
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
19189
19824
 
19190
- headers && utils$1.forEach(
19191
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
19192
- (method) => {
19825
+ headers &&
19826
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
19193
19827
  delete headers[method];
19194
- }
19195
- );
19828
+ });
19196
19829
 
19197
19830
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
19198
19831
 
@@ -19206,7 +19839,15 @@ class Axios {
19206
19839
 
19207
19840
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
19208
19841
 
19209
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
19842
+ const transitional = config.transitional || transitionalDefaults;
19843
+ const legacyInterceptorReqResOrdering =
19844
+ transitional && transitional.legacyInterceptorReqResOrdering;
19845
+
19846
+ if (legacyInterceptorReqResOrdering) {
19847
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
19848
+ } else {
19849
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
19850
+ }
19210
19851
  });
19211
19852
 
19212
19853
  const responseInterceptorChain = [];
@@ -19274,12 +19915,14 @@ class Axios {
19274
19915
  // Provide aliases for supported request methods
19275
19916
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
19276
19917
  /*eslint func-names:0*/
19277
- Axios.prototype[method] = function(url, config) {
19278
- return this.request(mergeConfig(config || {}, {
19279
- method,
19280
- url,
19281
- data: (config || {}).data
19282
- }));
19918
+ Axios.prototype[method] = function (url, config) {
19919
+ return this.request(
19920
+ mergeConfig(config || {}, {
19921
+ method,
19922
+ url,
19923
+ data: (config || {}).data,
19924
+ })
19925
+ );
19283
19926
  };
19284
19927
  });
19285
19928
 
@@ -19288,14 +19931,18 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
19288
19931
 
19289
19932
  function generateHTTPMethod(isForm) {
19290
19933
  return function httpMethod(url, data, config) {
19291
- return this.request(mergeConfig(config || {}, {
19292
- method,
19293
- headers: isForm ? {
19294
- 'Content-Type': 'multipart/form-data'
19295
- } : {},
19296
- url,
19297
- data
19298
- }));
19934
+ return this.request(
19935
+ mergeConfig(config || {}, {
19936
+ method,
19937
+ headers: isForm
19938
+ ? {
19939
+ 'Content-Type': 'multipart/form-data',
19940
+ }
19941
+ : {},
19942
+ url,
19943
+ data,
19944
+ })
19945
+ );
19299
19946
  };
19300
19947
  }
19301
19948
 
@@ -19326,7 +19973,7 @@ class CancelToken {
19326
19973
  const token = this;
19327
19974
 
19328
19975
  // eslint-disable-next-line func-names
19329
- this.promise.then(cancel => {
19976
+ this.promise.then((cancel) => {
19330
19977
  if (!token._listeners) return;
19331
19978
 
19332
19979
  let i = token._listeners.length;
@@ -19338,10 +19985,10 @@ class CancelToken {
19338
19985
  });
19339
19986
 
19340
19987
  // eslint-disable-next-line func-names
19341
- this.promise.then = onfulfilled => {
19988
+ this.promise.then = (onfulfilled) => {
19342
19989
  let _resolve;
19343
19990
  // eslint-disable-next-line func-names
19344
- const promise = new Promise(resolve => {
19991
+ const promise = new Promise((resolve) => {
19345
19992
  token.subscribe(resolve);
19346
19993
  _resolve = resolve;
19347
19994
  }).then(onfulfilled);
@@ -19359,7 +20006,7 @@ class CancelToken {
19359
20006
  return;
19360
20007
  }
19361
20008
 
19362
- token.reason = new CanceledError(message, config, request);
20009
+ token.reason = new CanceledError$1(message, config, request);
19363
20010
  resolvePromise(token.reason);
19364
20011
  });
19365
20012
  }
@@ -19429,7 +20076,7 @@ class CancelToken {
19429
20076
  });
19430
20077
  return {
19431
20078
  token,
19432
- cancel
20079
+ cancel,
19433
20080
  };
19434
20081
  }
19435
20082
  }
@@ -19441,7 +20088,7 @@ var CancelToken$1 = CancelToken;/**
19441
20088
  *
19442
20089
  * ```js
19443
20090
  * function f(x, y, z) {}
19444
- * var args = [1, 2, 3];
20091
+ * const args = [1, 2, 3];
19445
20092
  * f.apply(null, args);
19446
20093
  * ```
19447
20094
  *
@@ -19467,7 +20114,7 @@ function spread(callback) {
19467
20114
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
19468
20115
  */
19469
20116
  function isAxiosError(payload) {
19470
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
20117
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
19471
20118
  }const HttpStatusCode = {
19472
20119
  Continue: 100,
19473
20120
  SwitchingProtocols: 101,
@@ -19532,6 +20179,12 @@ function isAxiosError(payload) {
19532
20179
  LoopDetected: 508,
19533
20180
  NotExtended: 510,
19534
20181
  NetworkAuthenticationRequired: 511,
20182
+ WebServerIsDown: 521,
20183
+ ConnectionTimedOut: 522,
20184
+ OriginIsUnreachable: 523,
20185
+ TimeoutOccurred: 524,
20186
+ SslHandshakeFailed: 525,
20187
+ InvalidSslCertificate: 526,
19535
20188
  };
19536
20189
 
19537
20190
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
@@ -19550,10 +20203,10 @@ function createInstance(defaultConfig) {
19550
20203
  const instance = bind$2(Axios$1.prototype.request, context);
19551
20204
 
19552
20205
  // Copy axios.prototype to instance
19553
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
20206
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
19554
20207
 
19555
20208
  // Copy context to instance
19556
- utils$1.extend(instance, context, null, {allOwnKeys: true});
20209
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
19557
20210
 
19558
20211
  // Factory for creating new instances
19559
20212
  instance.create = function create(instanceConfig) {
@@ -19570,14 +20223,14 @@ const axios = createInstance(defaults$1);
19570
20223
  axios.Axios = Axios$1;
19571
20224
 
19572
20225
  // Expose Cancel & CancelToken
19573
- axios.CanceledError = CanceledError;
20226
+ axios.CanceledError = CanceledError$1;
19574
20227
  axios.CancelToken = CancelToken$1;
19575
20228
  axios.isCancel = isCancel;
19576
20229
  axios.VERSION = VERSION;
19577
20230
  axios.toFormData = toFormData;
19578
20231
 
19579
20232
  // Expose AxiosError class
19580
- axios.AxiosError = AxiosError;
20233
+ axios.AxiosError = AxiosError$1;
19581
20234
 
19582
20235
  // alias for CanceledError for backward compatibility
19583
20236
  axios.Cancel = axios.CanceledError;
@@ -19597,7 +20250,7 @@ axios.mergeConfig = mergeConfig;
19597
20250
 
19598
20251
  axios.AxiosHeaders = AxiosHeaders$1;
19599
20252
 
19600
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
20253
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
19601
20254
 
19602
20255
  axios.getAdapter = adapters.getAdapter;
19603
20256