source: node_modules/axios/dist/esm/axios.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 83.9 KB
Line 
1// Axios v1.6.7 Copyright (c) 2024 Matt Zabriskie and contributors
2function bind(fn, thisArg) {
3 return function wrap() {
4 return fn.apply(thisArg, arguments);
5 };
6}
7
8// utils is a library of generic helper functions non-specific to axios
9
10const {toString} = Object.prototype;
11const {getPrototypeOf} = Object;
12
13const kindOf = (cache => thing => {
14 const str = toString.call(thing);
15 return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
16})(Object.create(null));
17
18const kindOfTest = (type) => {
19 type = type.toLowerCase();
20 return (thing) => kindOf(thing) === type
21};
22
23const typeOfTest = type => thing => typeof thing === type;
24
25/**
26 * Determine if a value is an Array
27 *
28 * @param {Object} val The value to test
29 *
30 * @returns {boolean} True if value is an Array, otherwise false
31 */
32const {isArray} = Array;
33
34/**
35 * Determine if a value is undefined
36 *
37 * @param {*} val The value to test
38 *
39 * @returns {boolean} True if the value is undefined, otherwise false
40 */
41const isUndefined = typeOfTest('undefined');
42
43/**
44 * Determine if a value is a Buffer
45 *
46 * @param {*} val The value to test
47 *
48 * @returns {boolean} True if value is a Buffer, otherwise false
49 */
50function isBuffer(val) {
51 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
52 && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
53}
54
55/**
56 * Determine if a value is an ArrayBuffer
57 *
58 * @param {*} val The value to test
59 *
60 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
61 */
62const isArrayBuffer = kindOfTest('ArrayBuffer');
63
64
65/**
66 * Determine if a value is a view on an ArrayBuffer
67 *
68 * @param {*} val The value to test
69 *
70 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
71 */
72function isArrayBufferView(val) {
73 let result;
74 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
75 result = ArrayBuffer.isView(val);
76 } else {
77 result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
78 }
79 return result;
80}
81
82/**
83 * Determine if a value is a String
84 *
85 * @param {*} val The value to test
86 *
87 * @returns {boolean} True if value is a String, otherwise false
88 */
89const isString = typeOfTest('string');
90
91/**
92 * Determine if a value is a Function
93 *
94 * @param {*} val The value to test
95 * @returns {boolean} True if value is a Function, otherwise false
96 */
97const isFunction = typeOfTest('function');
98
99/**
100 * Determine if a value is a Number
101 *
102 * @param {*} val The value to test
103 *
104 * @returns {boolean} True if value is a Number, otherwise false
105 */
106const isNumber = typeOfTest('number');
107
108/**
109 * Determine if a value is an Object
110 *
111 * @param {*} thing The value to test
112 *
113 * @returns {boolean} True if value is an Object, otherwise false
114 */
115const isObject = (thing) => thing !== null && typeof thing === 'object';
116
117/**
118 * Determine if a value is a Boolean
119 *
120 * @param {*} thing The value to test
121 * @returns {boolean} True if value is a Boolean, otherwise false
122 */
123const isBoolean = thing => thing === true || thing === false;
124
125/**
126 * Determine if a value is a plain Object
127 *
128 * @param {*} val The value to test
129 *
130 * @returns {boolean} True if value is a plain Object, otherwise false
131 */
132const isPlainObject = (val) => {
133 if (kindOf(val) !== 'object') {
134 return false;
135 }
136
137 const prototype = getPrototypeOf(val);
138 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
139};
140
141/**
142 * Determine if a value is a Date
143 *
144 * @param {*} val The value to test
145 *
146 * @returns {boolean} True if value is a Date, otherwise false
147 */
148const isDate = kindOfTest('Date');
149
150/**
151 * Determine if a value is a File
152 *
153 * @param {*} val The value to test
154 *
155 * @returns {boolean} True if value is a File, otherwise false
156 */
157const isFile = kindOfTest('File');
158
159/**
160 * Determine if a value is a Blob
161 *
162 * @param {*} val The value to test
163 *
164 * @returns {boolean} True if value is a Blob, otherwise false
165 */
166const isBlob = kindOfTest('Blob');
167
168/**
169 * Determine if a value is a FileList
170 *
171 * @param {*} val The value to test
172 *
173 * @returns {boolean} True if value is a File, otherwise false
174 */
175const isFileList = kindOfTest('FileList');
176
177/**
178 * Determine if a value is a Stream
179 *
180 * @param {*} val The value to test
181 *
182 * @returns {boolean} True if value is a Stream, otherwise false
183 */
184const isStream = (val) => isObject(val) && isFunction(val.pipe);
185
186/**
187 * Determine if a value is a FormData
188 *
189 * @param {*} thing The value to test
190 *
191 * @returns {boolean} True if value is an FormData, otherwise false
192 */
193const isFormData = (thing) => {
194 let kind;
195 return thing && (
196 (typeof FormData === 'function' && thing instanceof FormData) || (
197 isFunction(thing.append) && (
198 (kind = kindOf(thing)) === 'formdata' ||
199 // detect form-data instance
200 (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
201 )
202 )
203 )
204};
205
206/**
207 * Determine if a value is a URLSearchParams object
208 *
209 * @param {*} val The value to test
210 *
211 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
212 */
213const isURLSearchParams = kindOfTest('URLSearchParams');
214
215/**
216 * Trim excess whitespace off the beginning and end of a string
217 *
218 * @param {String} str The String to trim
219 *
220 * @returns {String} The String freed of excess whitespace
221 */
222const trim = (str) => str.trim ?
223 str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
224
225/**
226 * Iterate over an Array or an Object invoking a function for each item.
227 *
228 * If `obj` is an Array callback will be called passing
229 * the value, index, and complete array for each item.
230 *
231 * If 'obj' is an Object callback will be called passing
232 * the value, key, and complete object for each property.
233 *
234 * @param {Object|Array} obj The object to iterate
235 * @param {Function} fn The callback to invoke for each item
236 *
237 * @param {Boolean} [allOwnKeys = false]
238 * @returns {any}
239 */
240function forEach(obj, fn, {allOwnKeys = false} = {}) {
241 // Don't bother if no value provided
242 if (obj === null || typeof obj === 'undefined') {
243 return;
244 }
245
246 let i;
247 let l;
248
249 // Force an array if not already something iterable
250 if (typeof obj !== 'object') {
251 /*eslint no-param-reassign:0*/
252 obj = [obj];
253 }
254
255 if (isArray(obj)) {
256 // Iterate over array values
257 for (i = 0, l = obj.length; i < l; i++) {
258 fn.call(null, obj[i], i, obj);
259 }
260 } else {
261 // Iterate over object keys
262 const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
263 const len = keys.length;
264 let key;
265
266 for (i = 0; i < len; i++) {
267 key = keys[i];
268 fn.call(null, obj[key], key, obj);
269 }
270 }
271}
272
273function findKey(obj, key) {
274 key = key.toLowerCase();
275 const keys = Object.keys(obj);
276 let i = keys.length;
277 let _key;
278 while (i-- > 0) {
279 _key = keys[i];
280 if (key === _key.toLowerCase()) {
281 return _key;
282 }
283 }
284 return null;
285}
286
287const _global = (() => {
288 /*eslint no-undef:0*/
289 if (typeof globalThis !== "undefined") return globalThis;
290 return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
291})();
292
293const isContextDefined = (context) => !isUndefined(context) && context !== _global;
294
295/**
296 * Accepts varargs expecting each argument to be an object, then
297 * immutably merges the properties of each object and returns result.
298 *
299 * When multiple objects contain the same key the later object in
300 * the arguments list will take precedence.
301 *
302 * Example:
303 *
304 * ```js
305 * var result = merge({foo: 123}, {foo: 456});
306 * console.log(result.foo); // outputs 456
307 * ```
308 *
309 * @param {Object} obj1 Object to merge
310 *
311 * @returns {Object} Result of all merge properties
312 */
313function merge(/* obj1, obj2, obj3, ... */) {
314 const {caseless} = isContextDefined(this) && this || {};
315 const result = {};
316 const assignValue = (val, key) => {
317 const targetKey = caseless && findKey(result, key) || key;
318 if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
319 result[targetKey] = merge(result[targetKey], val);
320 } else if (isPlainObject(val)) {
321 result[targetKey] = merge({}, val);
322 } else if (isArray(val)) {
323 result[targetKey] = val.slice();
324 } else {
325 result[targetKey] = val;
326 }
327 };
328
329 for (let i = 0, l = arguments.length; i < l; i++) {
330 arguments[i] && forEach(arguments[i], assignValue);
331 }
332 return result;
333}
334
335/**
336 * Extends object a by mutably adding to it the properties of object b.
337 *
338 * @param {Object} a The object to be extended
339 * @param {Object} b The object to copy properties from
340 * @param {Object} thisArg The object to bind function to
341 *
342 * @param {Boolean} [allOwnKeys]
343 * @returns {Object} The resulting value of object a
344 */
345const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
346 forEach(b, (val, key) => {
347 if (thisArg && isFunction(val)) {
348 a[key] = bind(val, thisArg);
349 } else {
350 a[key] = val;
351 }
352 }, {allOwnKeys});
353 return a;
354};
355
356/**
357 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
358 *
359 * @param {string} content with BOM
360 *
361 * @returns {string} content value without BOM
362 */
363const stripBOM = (content) => {
364 if (content.charCodeAt(0) === 0xFEFF) {
365 content = content.slice(1);
366 }
367 return content;
368};
369
370/**
371 * Inherit the prototype methods from one constructor into another
372 * @param {function} constructor
373 * @param {function} superConstructor
374 * @param {object} [props]
375 * @param {object} [descriptors]
376 *
377 * @returns {void}
378 */
379const inherits = (constructor, superConstructor, props, descriptors) => {
380 constructor.prototype = Object.create(superConstructor.prototype, descriptors);
381 constructor.prototype.constructor = constructor;
382 Object.defineProperty(constructor, 'super', {
383 value: superConstructor.prototype
384 });
385 props && Object.assign(constructor.prototype, props);
386};
387
388/**
389 * Resolve object with deep prototype chain to a flat object
390 * @param {Object} sourceObj source object
391 * @param {Object} [destObj]
392 * @param {Function|Boolean} [filter]
393 * @param {Function} [propFilter]
394 *
395 * @returns {Object}
396 */
397const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
398 let props;
399 let i;
400 let prop;
401 const merged = {};
402
403 destObj = destObj || {};
404 // eslint-disable-next-line no-eq-null,eqeqeq
405 if (sourceObj == null) return destObj;
406
407 do {
408 props = Object.getOwnPropertyNames(sourceObj);
409 i = props.length;
410 while (i-- > 0) {
411 prop = props[i];
412 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
413 destObj[prop] = sourceObj[prop];
414 merged[prop] = true;
415 }
416 }
417 sourceObj = filter !== false && getPrototypeOf(sourceObj);
418 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
419
420 return destObj;
421};
422
423/**
424 * Determines whether a string ends with the characters of a specified string
425 *
426 * @param {String} str
427 * @param {String} searchString
428 * @param {Number} [position= 0]
429 *
430 * @returns {boolean}
431 */
432const endsWith = (str, searchString, position) => {
433 str = String(str);
434 if (position === undefined || position > str.length) {
435 position = str.length;
436 }
437 position -= searchString.length;
438 const lastIndex = str.indexOf(searchString, position);
439 return lastIndex !== -1 && lastIndex === position;
440};
441
442
443/**
444 * Returns new array from array like object or null if failed
445 *
446 * @param {*} [thing]
447 *
448 * @returns {?Array}
449 */
450const toArray = (thing) => {
451 if (!thing) return null;
452 if (isArray(thing)) return thing;
453 let i = thing.length;
454 if (!isNumber(i)) return null;
455 const arr = new Array(i);
456 while (i-- > 0) {
457 arr[i] = thing[i];
458 }
459 return arr;
460};
461
462/**
463 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
464 * thing passed in is an instance of Uint8Array
465 *
466 * @param {TypedArray}
467 *
468 * @returns {Array}
469 */
470// eslint-disable-next-line func-names
471const isTypedArray = (TypedArray => {
472 // eslint-disable-next-line func-names
473 return thing => {
474 return TypedArray && thing instanceof TypedArray;
475 };
476})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
477
478/**
479 * For each entry in the object, call the function with the key and value.
480 *
481 * @param {Object<any, any>} obj - The object to iterate over.
482 * @param {Function} fn - The function to call for each entry.
483 *
484 * @returns {void}
485 */
486const forEachEntry = (obj, fn) => {
487 const generator = obj && obj[Symbol.iterator];
488
489 const iterator = generator.call(obj);
490
491 let result;
492
493 while ((result = iterator.next()) && !result.done) {
494 const pair = result.value;
495 fn.call(obj, pair[0], pair[1]);
496 }
497};
498
499/**
500 * It takes a regular expression and a string, and returns an array of all the matches
501 *
502 * @param {string} regExp - The regular expression to match against.
503 * @param {string} str - The string to search.
504 *
505 * @returns {Array<boolean>}
506 */
507const matchAll = (regExp, str) => {
508 let matches;
509 const arr = [];
510
511 while ((matches = regExp.exec(str)) !== null) {
512 arr.push(matches);
513 }
514
515 return arr;
516};
517
518/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
519const isHTMLForm = kindOfTest('HTMLFormElement');
520
521const toCamelCase = str => {
522 return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
523 function replacer(m, p1, p2) {
524 return p1.toUpperCase() + p2;
525 }
526 );
527};
528
529/* Creating a function that will check if an object has a property. */
530const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
531
532/**
533 * Determine if a value is a RegExp object
534 *
535 * @param {*} val The value to test
536 *
537 * @returns {boolean} True if value is a RegExp object, otherwise false
538 */
539const isRegExp = kindOfTest('RegExp');
540
541const reduceDescriptors = (obj, reducer) => {
542 const descriptors = Object.getOwnPropertyDescriptors(obj);
543 const reducedDescriptors = {};
544
545 forEach(descriptors, (descriptor, name) => {
546 let ret;
547 if ((ret = reducer(descriptor, name, obj)) !== false) {
548 reducedDescriptors[name] = ret || descriptor;
549 }
550 });
551
552 Object.defineProperties(obj, reducedDescriptors);
553};
554
555/**
556 * Makes all methods read-only
557 * @param {Object} obj
558 */
559
560const freezeMethods = (obj) => {
561 reduceDescriptors(obj, (descriptor, name) => {
562 // skip restricted props in strict mode
563 if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
564 return false;
565 }
566
567 const value = obj[name];
568
569 if (!isFunction(value)) return;
570
571 descriptor.enumerable = false;
572
573 if ('writable' in descriptor) {
574 descriptor.writable = false;
575 return;
576 }
577
578 if (!descriptor.set) {
579 descriptor.set = () => {
580 throw Error('Can not rewrite read-only method \'' + name + '\'');
581 };
582 }
583 });
584};
585
586const toObjectSet = (arrayOrString, delimiter) => {
587 const obj = {};
588
589 const define = (arr) => {
590 arr.forEach(value => {
591 obj[value] = true;
592 });
593 };
594
595 isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
596
597 return obj;
598};
599
600const noop = () => {};
601
602const toFiniteNumber = (value, defaultValue) => {
603 value = +value;
604 return Number.isFinite(value) ? value : defaultValue;
605};
606
607const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
608
609const DIGIT = '0123456789';
610
611const ALPHABET = {
612 DIGIT,
613 ALPHA,
614 ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
615};
616
617const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
618 let str = '';
619 const {length} = alphabet;
620 while (size--) {
621 str += alphabet[Math.random() * length|0];
622 }
623
624 return str;
625};
626
627/**
628 * If the thing is a FormData object, return true, otherwise return false.
629 *
630 * @param {unknown} thing - The thing to check.
631 *
632 * @returns {boolean}
633 */
634function isSpecCompliantForm(thing) {
635 return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
636}
637
638const toJSONObject = (obj) => {
639 const stack = new Array(10);
640
641 const visit = (source, i) => {
642
643 if (isObject(source)) {
644 if (stack.indexOf(source) >= 0) {
645 return;
646 }
647
648 if(!('toJSON' in source)) {
649 stack[i] = source;
650 const target = isArray(source) ? [] : {};
651
652 forEach(source, (value, key) => {
653 const reducedValue = visit(value, i + 1);
654 !isUndefined(reducedValue) && (target[key] = reducedValue);
655 });
656
657 stack[i] = undefined;
658
659 return target;
660 }
661 }
662
663 return source;
664 };
665
666 return visit(obj, 0);
667};
668
669const isAsyncFn = kindOfTest('AsyncFunction');
670
671const isThenable = (thing) =>
672 thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
673
674const utils$1 = {
675 isArray,
676 isArrayBuffer,
677 isBuffer,
678 isFormData,
679 isArrayBufferView,
680 isString,
681 isNumber,
682 isBoolean,
683 isObject,
684 isPlainObject,
685 isUndefined,
686 isDate,
687 isFile,
688 isBlob,
689 isRegExp,
690 isFunction,
691 isStream,
692 isURLSearchParams,
693 isTypedArray,
694 isFileList,
695 forEach,
696 merge,
697 extend,
698 trim,
699 stripBOM,
700 inherits,
701 toFlatObject,
702 kindOf,
703 kindOfTest,
704 endsWith,
705 toArray,
706 forEachEntry,
707 matchAll,
708 isHTMLForm,
709 hasOwnProperty,
710 hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
711 reduceDescriptors,
712 freezeMethods,
713 toObjectSet,
714 toCamelCase,
715 noop,
716 toFiniteNumber,
717 findKey,
718 global: _global,
719 isContextDefined,
720 ALPHABET,
721 generateString,
722 isSpecCompliantForm,
723 toJSONObject,
724 isAsyncFn,
725 isThenable
726};
727
728/**
729 * Create an Error with the specified message, config, error code, request and response.
730 *
731 * @param {string} message The error message.
732 * @param {string} [code] The error code (for example, 'ECONNABORTED').
733 * @param {Object} [config] The config.
734 * @param {Object} [request] The request.
735 * @param {Object} [response] The response.
736 *
737 * @returns {Error} The created error.
738 */
739function AxiosError$1(message, code, config, request, response) {
740 Error.call(this);
741
742 if (Error.captureStackTrace) {
743 Error.captureStackTrace(this, this.constructor);
744 } else {
745 this.stack = (new Error()).stack;
746 }
747
748 this.message = message;
749 this.name = 'AxiosError';
750 code && (this.code = code);
751 config && (this.config = config);
752 request && (this.request = request);
753 response && (this.response = response);
754}
755
756utils$1.inherits(AxiosError$1, Error, {
757 toJSON: function toJSON() {
758 return {
759 // Standard
760 message: this.message,
761 name: this.name,
762 // Microsoft
763 description: this.description,
764 number: this.number,
765 // Mozilla
766 fileName: this.fileName,
767 lineNumber: this.lineNumber,
768 columnNumber: this.columnNumber,
769 stack: this.stack,
770 // Axios
771 config: utils$1.toJSONObject(this.config),
772 code: this.code,
773 status: this.response && this.response.status ? this.response.status : null
774 };
775 }
776});
777
778const prototype$1 = AxiosError$1.prototype;
779const descriptors = {};
780
781[
782 'ERR_BAD_OPTION_VALUE',
783 'ERR_BAD_OPTION',
784 'ECONNABORTED',
785 'ETIMEDOUT',
786 'ERR_NETWORK',
787 'ERR_FR_TOO_MANY_REDIRECTS',
788 'ERR_DEPRECATED',
789 'ERR_BAD_RESPONSE',
790 'ERR_BAD_REQUEST',
791 'ERR_CANCELED',
792 'ERR_NOT_SUPPORT',
793 'ERR_INVALID_URL'
794// eslint-disable-next-line func-names
795].forEach(code => {
796 descriptors[code] = {value: code};
797});
798
799Object.defineProperties(AxiosError$1, descriptors);
800Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
801
802// eslint-disable-next-line func-names
803AxiosError$1.from = (error, code, config, request, response, customProps) => {
804 const axiosError = Object.create(prototype$1);
805
806 utils$1.toFlatObject(error, axiosError, function filter(obj) {
807 return obj !== Error.prototype;
808 }, prop => {
809 return prop !== 'isAxiosError';
810 });
811
812 AxiosError$1.call(axiosError, error.message, code, config, request, response);
813
814 axiosError.cause = error;
815
816 axiosError.name = error.name;
817
818 customProps && Object.assign(axiosError, customProps);
819
820 return axiosError;
821};
822
823// eslint-disable-next-line strict
824const httpAdapter = null;
825
826/**
827 * Determines if the given thing is a array or js object.
828 *
829 * @param {string} thing - The object or array to be visited.
830 *
831 * @returns {boolean}
832 */
833function isVisitable(thing) {
834 return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
835}
836
837/**
838 * It removes the brackets from the end of a string
839 *
840 * @param {string} key - The key of the parameter.
841 *
842 * @returns {string} the key without the brackets.
843 */
844function removeBrackets(key) {
845 return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
846}
847
848/**
849 * It takes a path, a key, and a boolean, and returns a string
850 *
851 * @param {string} path - The path to the current key.
852 * @param {string} key - The key of the current object being iterated over.
853 * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
854 *
855 * @returns {string} The path to the current key.
856 */
857function renderKey(path, key, dots) {
858 if (!path) return key;
859 return path.concat(key).map(function each(token, i) {
860 // eslint-disable-next-line no-param-reassign
861 token = removeBrackets(token);
862 return !dots && i ? '[' + token + ']' : token;
863 }).join(dots ? '.' : '');
864}
865
866/**
867 * If the array is an array and none of its elements are visitable, then it's a flat array.
868 *
869 * @param {Array<any>} arr - The array to check
870 *
871 * @returns {boolean}
872 */
873function isFlatArray(arr) {
874 return utils$1.isArray(arr) && !arr.some(isVisitable);
875}
876
877const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
878 return /^is[A-Z]/.test(prop);
879});
880
881/**
882 * Convert a data object to FormData
883 *
884 * @param {Object} obj
885 * @param {?Object} [formData]
886 * @param {?Object} [options]
887 * @param {Function} [options.visitor]
888 * @param {Boolean} [options.metaTokens = true]
889 * @param {Boolean} [options.dots = false]
890 * @param {?Boolean} [options.indexes = false]
891 *
892 * @returns {Object}
893 **/
894
895/**
896 * It converts an object into a FormData object
897 *
898 * @param {Object<any, any>} obj - The object to convert to form data.
899 * @param {string} formData - The FormData object to append to.
900 * @param {Object<string, any>} options
901 *
902 * @returns
903 */
904function toFormData$1(obj, formData, options) {
905 if (!utils$1.isObject(obj)) {
906 throw new TypeError('target must be an object');
907 }
908
909 // eslint-disable-next-line no-param-reassign
910 formData = formData || new (FormData)();
911
912 // eslint-disable-next-line no-param-reassign
913 options = utils$1.toFlatObject(options, {
914 metaTokens: true,
915 dots: false,
916 indexes: false
917 }, false, function defined(option, source) {
918 // eslint-disable-next-line no-eq-null,eqeqeq
919 return !utils$1.isUndefined(source[option]);
920 });
921
922 const metaTokens = options.metaTokens;
923 // eslint-disable-next-line no-use-before-define
924 const visitor = options.visitor || defaultVisitor;
925 const dots = options.dots;
926 const indexes = options.indexes;
927 const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
928 const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
929
930 if (!utils$1.isFunction(visitor)) {
931 throw new TypeError('visitor must be a function');
932 }
933
934 function convertValue(value) {
935 if (value === null) return '';
936
937 if (utils$1.isDate(value)) {
938 return value.toISOString();
939 }
940
941 if (!useBlob && utils$1.isBlob(value)) {
942 throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
943 }
944
945 if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
946 return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
947 }
948
949 return value;
950 }
951
952 /**
953 * Default visitor.
954 *
955 * @param {*} value
956 * @param {String|Number} key
957 * @param {Array<String|Number>} path
958 * @this {FormData}
959 *
960 * @returns {boolean} return true to visit the each prop of the value recursively
961 */
962 function defaultVisitor(value, key, path) {
963 let arr = value;
964
965 if (value && !path && typeof value === 'object') {
966 if (utils$1.endsWith(key, '{}')) {
967 // eslint-disable-next-line no-param-reassign
968 key = metaTokens ? key : key.slice(0, -2);
969 // eslint-disable-next-line no-param-reassign
970 value = JSON.stringify(value);
971 } else if (
972 (utils$1.isArray(value) && isFlatArray(value)) ||
973 ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
974 )) {
975 // eslint-disable-next-line no-param-reassign
976 key = removeBrackets(key);
977
978 arr.forEach(function each(el, index) {
979 !(utils$1.isUndefined(el) || el === null) && formData.append(
980 // eslint-disable-next-line no-nested-ternary
981 indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
982 convertValue(el)
983 );
984 });
985 return false;
986 }
987 }
988
989 if (isVisitable(value)) {
990 return true;
991 }
992
993 formData.append(renderKey(path, key, dots), convertValue(value));
994
995 return false;
996 }
997
998 const stack = [];
999
1000 const exposedHelpers = Object.assign(predicates, {
1001 defaultVisitor,
1002 convertValue,
1003 isVisitable
1004 });
1005
1006 function build(value, path) {
1007 if (utils$1.isUndefined(value)) return;
1008
1009 if (stack.indexOf(value) !== -1) {
1010 throw Error('Circular reference detected in ' + path.join('.'));
1011 }
1012
1013 stack.push(value);
1014
1015 utils$1.forEach(value, function each(el, key) {
1016 const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1017 formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1018 );
1019
1020 if (result === true) {
1021 build(el, path ? path.concat(key) : [key]);
1022 }
1023 });
1024
1025 stack.pop();
1026 }
1027
1028 if (!utils$1.isObject(obj)) {
1029 throw new TypeError('data must be an object');
1030 }
1031
1032 build(obj);
1033
1034 return formData;
1035}
1036
1037/**
1038 * It encodes a string by replacing all characters that are not in the unreserved set with
1039 * their percent-encoded equivalents
1040 *
1041 * @param {string} str - The string to encode.
1042 *
1043 * @returns {string} The encoded string.
1044 */
1045function encode$1(str) {
1046 const charMap = {
1047 '!': '%21',
1048 "'": '%27',
1049 '(': '%28',
1050 ')': '%29',
1051 '~': '%7E',
1052 '%20': '+',
1053 '%00': '\x00'
1054 };
1055 return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1056 return charMap[match];
1057 });
1058}
1059
1060/**
1061 * It takes a params object and converts it to a FormData object
1062 *
1063 * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1064 * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1065 *
1066 * @returns {void}
1067 */
1068function AxiosURLSearchParams(params, options) {
1069 this._pairs = [];
1070
1071 params && toFormData$1(params, this, options);
1072}
1073
1074const prototype = AxiosURLSearchParams.prototype;
1075
1076prototype.append = function append(name, value) {
1077 this._pairs.push([name, value]);
1078};
1079
1080prototype.toString = function toString(encoder) {
1081 const _encode = encoder ? function(value) {
1082 return encoder.call(this, value, encode$1);
1083 } : encode$1;
1084
1085 return this._pairs.map(function each(pair) {
1086 return _encode(pair[0]) + '=' + _encode(pair[1]);
1087 }, '').join('&');
1088};
1089
1090/**
1091 * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1092 * URI encoded counterparts
1093 *
1094 * @param {string} val The value to be encoded.
1095 *
1096 * @returns {string} The encoded value.
1097 */
1098function encode(val) {
1099 return encodeURIComponent(val).
1100 replace(/%3A/gi, ':').
1101 replace(/%24/g, '$').
1102 replace(/%2C/gi, ',').
1103 replace(/%20/g, '+').
1104 replace(/%5B/gi, '[').
1105 replace(/%5D/gi, ']');
1106}
1107
1108/**
1109 * Build a URL by appending params to the end
1110 *
1111 * @param {string} url The base of the url (e.g., http://www.google.com)
1112 * @param {object} [params] The params to be appended
1113 * @param {?object} options
1114 *
1115 * @returns {string} The formatted url
1116 */
1117function buildURL(url, params, options) {
1118 /*eslint no-param-reassign:0*/
1119 if (!params) {
1120 return url;
1121 }
1122
1123 const _encode = options && options.encode || encode;
1124
1125 const serializeFn = options && options.serialize;
1126
1127 let serializedParams;
1128
1129 if (serializeFn) {
1130 serializedParams = serializeFn(params, options);
1131 } else {
1132 serializedParams = utils$1.isURLSearchParams(params) ?
1133 params.toString() :
1134 new AxiosURLSearchParams(params, options).toString(_encode);
1135 }
1136
1137 if (serializedParams) {
1138 const hashmarkIndex = url.indexOf("#");
1139
1140 if (hashmarkIndex !== -1) {
1141 url = url.slice(0, hashmarkIndex);
1142 }
1143 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1144 }
1145
1146 return url;
1147}
1148
1149class InterceptorManager {
1150 constructor() {
1151 this.handlers = [];
1152 }
1153
1154 /**
1155 * Add a new interceptor to the stack
1156 *
1157 * @param {Function} fulfilled The function to handle `then` for a `Promise`
1158 * @param {Function} rejected The function to handle `reject` for a `Promise`
1159 *
1160 * @return {Number} An ID used to remove interceptor later
1161 */
1162 use(fulfilled, rejected, options) {
1163 this.handlers.push({
1164 fulfilled,
1165 rejected,
1166 synchronous: options ? options.synchronous : false,
1167 runWhen: options ? options.runWhen : null
1168 });
1169 return this.handlers.length - 1;
1170 }
1171
1172 /**
1173 * Remove an interceptor from the stack
1174 *
1175 * @param {Number} id The ID that was returned by `use`
1176 *
1177 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1178 */
1179 eject(id) {
1180 if (this.handlers[id]) {
1181 this.handlers[id] = null;
1182 }
1183 }
1184
1185 /**
1186 * Clear all interceptors from the stack
1187 *
1188 * @returns {void}
1189 */
1190 clear() {
1191 if (this.handlers) {
1192 this.handlers = [];
1193 }
1194 }
1195
1196 /**
1197 * Iterate over all the registered interceptors
1198 *
1199 * This method is particularly useful for skipping over any
1200 * interceptors that may have become `null` calling `eject`.
1201 *
1202 * @param {Function} fn The function to call for each interceptor
1203 *
1204 * @returns {void}
1205 */
1206 forEach(fn) {
1207 utils$1.forEach(this.handlers, function forEachHandler(h) {
1208 if (h !== null) {
1209 fn(h);
1210 }
1211 });
1212 }
1213}
1214
1215const InterceptorManager$1 = InterceptorManager;
1216
1217const transitionalDefaults = {
1218 silentJSONParsing: true,
1219 forcedJSONParsing: true,
1220 clarifyTimeoutError: false
1221};
1222
1223const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1224
1225const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1226
1227const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1228
1229const platform$1 = {
1230 isBrowser: true,
1231 classes: {
1232 URLSearchParams: URLSearchParams$1,
1233 FormData: FormData$1,
1234 Blob: Blob$1
1235 },
1236 protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1237};
1238
1239const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1240
1241/**
1242 * Determine if we're running in a standard browser environment
1243 *
1244 * This allows axios to run in a web worker, and react-native.
1245 * Both environments support XMLHttpRequest, but not fully standard globals.
1246 *
1247 * web workers:
1248 * typeof window -> undefined
1249 * typeof document -> undefined
1250 *
1251 * react-native:
1252 * navigator.product -> 'ReactNative'
1253 * nativescript
1254 * navigator.product -> 'NativeScript' or 'NS'
1255 *
1256 * @returns {boolean}
1257 */
1258const hasStandardBrowserEnv = (
1259 (product) => {
1260 return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1261 })(typeof navigator !== 'undefined' && navigator.product);
1262
1263/**
1264 * Determine if we're running in a standard browser webWorker environment
1265 *
1266 * Although the `isStandardBrowserEnv` method indicates that
1267 * `allows axios to run in a web worker`, the WebWorker will still be
1268 * filtered out due to its judgment standard
1269 * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1270 * This leads to a problem when axios post `FormData` in webWorker
1271 */
1272const hasStandardBrowserWebWorkerEnv = (() => {
1273 return (
1274 typeof WorkerGlobalScope !== 'undefined' &&
1275 // eslint-disable-next-line no-undef
1276 self instanceof WorkerGlobalScope &&
1277 typeof self.importScripts === 'function'
1278 );
1279})();
1280
1281const utils = /*#__PURE__*/Object.freeze({
1282 __proto__: null,
1283 hasBrowserEnv: hasBrowserEnv,
1284 hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1285 hasStandardBrowserEnv: hasStandardBrowserEnv
1286});
1287
1288const platform = {
1289 ...utils,
1290 ...platform$1
1291};
1292
1293function toURLEncodedForm(data, options) {
1294 return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
1295 visitor: function(value, key, path, helpers) {
1296 if (platform.isNode && utils$1.isBuffer(value)) {
1297 this.append(key, value.toString('base64'));
1298 return false;
1299 }
1300
1301 return helpers.defaultVisitor.apply(this, arguments);
1302 }
1303 }, options));
1304}
1305
1306/**
1307 * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1308 *
1309 * @param {string} name - The name of the property to get.
1310 *
1311 * @returns An array of strings.
1312 */
1313function parsePropPath(name) {
1314 // foo[x][y][z]
1315 // foo.x.y.z
1316 // foo-x-y-z
1317 // foo x y z
1318 return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1319 return match[0] === '[]' ? '' : match[1] || match[0];
1320 });
1321}
1322
1323/**
1324 * Convert an array to an object.
1325 *
1326 * @param {Array<any>} arr - The array to convert to an object.
1327 *
1328 * @returns An object with the same keys and values as the array.
1329 */
1330function arrayToObject(arr) {
1331 const obj = {};
1332 const keys = Object.keys(arr);
1333 let i;
1334 const len = keys.length;
1335 let key;
1336 for (i = 0; i < len; i++) {
1337 key = keys[i];
1338 obj[key] = arr[key];
1339 }
1340 return obj;
1341}
1342
1343/**
1344 * It takes a FormData object and returns a JavaScript object
1345 *
1346 * @param {string} formData The FormData object to convert to JSON.
1347 *
1348 * @returns {Object<string, any> | null} The converted object.
1349 */
1350function formDataToJSON(formData) {
1351 function buildPath(path, value, target, index) {
1352 let name = path[index++];
1353
1354 if (name === '__proto__') return true;
1355
1356 const isNumericKey = Number.isFinite(+name);
1357 const isLast = index >= path.length;
1358 name = !name && utils$1.isArray(target) ? target.length : name;
1359
1360 if (isLast) {
1361 if (utils$1.hasOwnProp(target, name)) {
1362 target[name] = [target[name], value];
1363 } else {
1364 target[name] = value;
1365 }
1366
1367 return !isNumericKey;
1368 }
1369
1370 if (!target[name] || !utils$1.isObject(target[name])) {
1371 target[name] = [];
1372 }
1373
1374 const result = buildPath(path, value, target[name], index);
1375
1376 if (result && utils$1.isArray(target[name])) {
1377 target[name] = arrayToObject(target[name]);
1378 }
1379
1380 return !isNumericKey;
1381 }
1382
1383 if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1384 const obj = {};
1385
1386 utils$1.forEachEntry(formData, (name, value) => {
1387 buildPath(parsePropPath(name), value, obj, 0);
1388 });
1389
1390 return obj;
1391 }
1392
1393 return null;
1394}
1395
1396/**
1397 * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1398 * of the input
1399 *
1400 * @param {any} rawValue - The value to be stringified.
1401 * @param {Function} parser - A function that parses a string into a JavaScript object.
1402 * @param {Function} encoder - A function that takes a value and returns a string.
1403 *
1404 * @returns {string} A stringified version of the rawValue.
1405 */
1406function stringifySafely(rawValue, parser, encoder) {
1407 if (utils$1.isString(rawValue)) {
1408 try {
1409 (parser || JSON.parse)(rawValue);
1410 return utils$1.trim(rawValue);
1411 } catch (e) {
1412 if (e.name !== 'SyntaxError') {
1413 throw e;
1414 }
1415 }
1416 }
1417
1418 return (encoder || JSON.stringify)(rawValue);
1419}
1420
1421const defaults = {
1422
1423 transitional: transitionalDefaults,
1424
1425 adapter: ['xhr', 'http'],
1426
1427 transformRequest: [function transformRequest(data, headers) {
1428 const contentType = headers.getContentType() || '';
1429 const hasJSONContentType = contentType.indexOf('application/json') > -1;
1430 const isObjectPayload = utils$1.isObject(data);
1431
1432 if (isObjectPayload && utils$1.isHTMLForm(data)) {
1433 data = new FormData(data);
1434 }
1435
1436 const isFormData = utils$1.isFormData(data);
1437
1438 if (isFormData) {
1439 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1440 }
1441
1442 if (utils$1.isArrayBuffer(data) ||
1443 utils$1.isBuffer(data) ||
1444 utils$1.isStream(data) ||
1445 utils$1.isFile(data) ||
1446 utils$1.isBlob(data)
1447 ) {
1448 return data;
1449 }
1450 if (utils$1.isArrayBufferView(data)) {
1451 return data.buffer;
1452 }
1453 if (utils$1.isURLSearchParams(data)) {
1454 headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1455 return data.toString();
1456 }
1457
1458 let isFileList;
1459
1460 if (isObjectPayload) {
1461 if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1462 return toURLEncodedForm(data, this.formSerializer).toString();
1463 }
1464
1465 if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1466 const _FormData = this.env && this.env.FormData;
1467
1468 return toFormData$1(
1469 isFileList ? {'files[]': data} : data,
1470 _FormData && new _FormData(),
1471 this.formSerializer
1472 );
1473 }
1474 }
1475
1476 if (isObjectPayload || hasJSONContentType ) {
1477 headers.setContentType('application/json', false);
1478 return stringifySafely(data);
1479 }
1480
1481 return data;
1482 }],
1483
1484 transformResponse: [function transformResponse(data) {
1485 const transitional = this.transitional || defaults.transitional;
1486 const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1487 const JSONRequested = this.responseType === 'json';
1488
1489 if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1490 const silentJSONParsing = transitional && transitional.silentJSONParsing;
1491 const strictJSONParsing = !silentJSONParsing && JSONRequested;
1492
1493 try {
1494 return JSON.parse(data);
1495 } catch (e) {
1496 if (strictJSONParsing) {
1497 if (e.name === 'SyntaxError') {
1498 throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1499 }
1500 throw e;
1501 }
1502 }
1503 }
1504
1505 return data;
1506 }],
1507
1508 /**
1509 * A timeout in milliseconds to abort a request. If set to 0 (default) a
1510 * timeout is not created.
1511 */
1512 timeout: 0,
1513
1514 xsrfCookieName: 'XSRF-TOKEN',
1515 xsrfHeaderName: 'X-XSRF-TOKEN',
1516
1517 maxContentLength: -1,
1518 maxBodyLength: -1,
1519
1520 env: {
1521 FormData: platform.classes.FormData,
1522 Blob: platform.classes.Blob
1523 },
1524
1525 validateStatus: function validateStatus(status) {
1526 return status >= 200 && status < 300;
1527 },
1528
1529 headers: {
1530 common: {
1531 'Accept': 'application/json, text/plain, */*',
1532 'Content-Type': undefined
1533 }
1534 }
1535};
1536
1537utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1538 defaults.headers[method] = {};
1539});
1540
1541const defaults$1 = defaults;
1542
1543// RawAxiosHeaders whose duplicates are ignored by node
1544// c.f. https://nodejs.org/api/http.html#http_message_headers
1545const ignoreDuplicateOf = utils$1.toObjectSet([
1546 'age', 'authorization', 'content-length', 'content-type', 'etag',
1547 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1548 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1549 'referer', 'retry-after', 'user-agent'
1550]);
1551
1552/**
1553 * Parse headers into an object
1554 *
1555 * ```
1556 * Date: Wed, 27 Aug 2014 08:58:49 GMT
1557 * Content-Type: application/json
1558 * Connection: keep-alive
1559 * Transfer-Encoding: chunked
1560 * ```
1561 *
1562 * @param {String} rawHeaders Headers needing to be parsed
1563 *
1564 * @returns {Object} Headers parsed into an object
1565 */
1566const parseHeaders = rawHeaders => {
1567 const parsed = {};
1568 let key;
1569 let val;
1570 let i;
1571
1572 rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1573 i = line.indexOf(':');
1574 key = line.substring(0, i).trim().toLowerCase();
1575 val = line.substring(i + 1).trim();
1576
1577 if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1578 return;
1579 }
1580
1581 if (key === 'set-cookie') {
1582 if (parsed[key]) {
1583 parsed[key].push(val);
1584 } else {
1585 parsed[key] = [val];
1586 }
1587 } else {
1588 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1589 }
1590 });
1591
1592 return parsed;
1593};
1594
1595const $internals = Symbol('internals');
1596
1597function normalizeHeader(header) {
1598 return header && String(header).trim().toLowerCase();
1599}
1600
1601function normalizeValue(value) {
1602 if (value === false || value == null) {
1603 return value;
1604 }
1605
1606 return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1607}
1608
1609function parseTokens(str) {
1610 const tokens = Object.create(null);
1611 const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1612 let match;
1613
1614 while ((match = tokensRE.exec(str))) {
1615 tokens[match[1]] = match[2];
1616 }
1617
1618 return tokens;
1619}
1620
1621const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1622
1623function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1624 if (utils$1.isFunction(filter)) {
1625 return filter.call(this, value, header);
1626 }
1627
1628 if (isHeaderNameFilter) {
1629 value = header;
1630 }
1631
1632 if (!utils$1.isString(value)) return;
1633
1634 if (utils$1.isString(filter)) {
1635 return value.indexOf(filter) !== -1;
1636 }
1637
1638 if (utils$1.isRegExp(filter)) {
1639 return filter.test(value);
1640 }
1641}
1642
1643function formatHeader(header) {
1644 return header.trim()
1645 .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1646 return char.toUpperCase() + str;
1647 });
1648}
1649
1650function buildAccessors(obj, header) {
1651 const accessorName = utils$1.toCamelCase(' ' + header);
1652
1653 ['get', 'set', 'has'].forEach(methodName => {
1654 Object.defineProperty(obj, methodName + accessorName, {
1655 value: function(arg1, arg2, arg3) {
1656 return this[methodName].call(this, header, arg1, arg2, arg3);
1657 },
1658 configurable: true
1659 });
1660 });
1661}
1662
1663class AxiosHeaders$1 {
1664 constructor(headers) {
1665 headers && this.set(headers);
1666 }
1667
1668 set(header, valueOrRewrite, rewrite) {
1669 const self = this;
1670
1671 function setHeader(_value, _header, _rewrite) {
1672 const lHeader = normalizeHeader(_header);
1673
1674 if (!lHeader) {
1675 throw new Error('header name must be a non-empty string');
1676 }
1677
1678 const key = utils$1.findKey(self, lHeader);
1679
1680 if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1681 self[key || _header] = normalizeValue(_value);
1682 }
1683 }
1684
1685 const setHeaders = (headers, _rewrite) =>
1686 utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1687
1688 if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1689 setHeaders(header, valueOrRewrite);
1690 } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1691 setHeaders(parseHeaders(header), valueOrRewrite);
1692 } else {
1693 header != null && setHeader(valueOrRewrite, header, rewrite);
1694 }
1695
1696 return this;
1697 }
1698
1699 get(header, parser) {
1700 header = normalizeHeader(header);
1701
1702 if (header) {
1703 const key = utils$1.findKey(this, header);
1704
1705 if (key) {
1706 const value = this[key];
1707
1708 if (!parser) {
1709 return value;
1710 }
1711
1712 if (parser === true) {
1713 return parseTokens(value);
1714 }
1715
1716 if (utils$1.isFunction(parser)) {
1717 return parser.call(this, value, key);
1718 }
1719
1720 if (utils$1.isRegExp(parser)) {
1721 return parser.exec(value);
1722 }
1723
1724 throw new TypeError('parser must be boolean|regexp|function');
1725 }
1726 }
1727 }
1728
1729 has(header, matcher) {
1730 header = normalizeHeader(header);
1731
1732 if (header) {
1733 const key = utils$1.findKey(this, header);
1734
1735 return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1736 }
1737
1738 return false;
1739 }
1740
1741 delete(header, matcher) {
1742 const self = this;
1743 let deleted = false;
1744
1745 function deleteHeader(_header) {
1746 _header = normalizeHeader(_header);
1747
1748 if (_header) {
1749 const key = utils$1.findKey(self, _header);
1750
1751 if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1752 delete self[key];
1753
1754 deleted = true;
1755 }
1756 }
1757 }
1758
1759 if (utils$1.isArray(header)) {
1760 header.forEach(deleteHeader);
1761 } else {
1762 deleteHeader(header);
1763 }
1764
1765 return deleted;
1766 }
1767
1768 clear(matcher) {
1769 const keys = Object.keys(this);
1770 let i = keys.length;
1771 let deleted = false;
1772
1773 while (i--) {
1774 const key = keys[i];
1775 if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1776 delete this[key];
1777 deleted = true;
1778 }
1779 }
1780
1781 return deleted;
1782 }
1783
1784 normalize(format) {
1785 const self = this;
1786 const headers = {};
1787
1788 utils$1.forEach(this, (value, header) => {
1789 const key = utils$1.findKey(headers, header);
1790
1791 if (key) {
1792 self[key] = normalizeValue(value);
1793 delete self[header];
1794 return;
1795 }
1796
1797 const normalized = format ? formatHeader(header) : String(header).trim();
1798
1799 if (normalized !== header) {
1800 delete self[header];
1801 }
1802
1803 self[normalized] = normalizeValue(value);
1804
1805 headers[normalized] = true;
1806 });
1807
1808 return this;
1809 }
1810
1811 concat(...targets) {
1812 return this.constructor.concat(this, ...targets);
1813 }
1814
1815 toJSON(asStrings) {
1816 const obj = Object.create(null);
1817
1818 utils$1.forEach(this, (value, header) => {
1819 value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1820 });
1821
1822 return obj;
1823 }
1824
1825 [Symbol.iterator]() {
1826 return Object.entries(this.toJSON())[Symbol.iterator]();
1827 }
1828
1829 toString() {
1830 return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1831 }
1832
1833 get [Symbol.toStringTag]() {
1834 return 'AxiosHeaders';
1835 }
1836
1837 static from(thing) {
1838 return thing instanceof this ? thing : new this(thing);
1839 }
1840
1841 static concat(first, ...targets) {
1842 const computed = new this(first);
1843
1844 targets.forEach((target) => computed.set(target));
1845
1846 return computed;
1847 }
1848
1849 static accessor(header) {
1850 const internals = this[$internals] = (this[$internals] = {
1851 accessors: {}
1852 });
1853
1854 const accessors = internals.accessors;
1855 const prototype = this.prototype;
1856
1857 function defineAccessor(_header) {
1858 const lHeader = normalizeHeader(_header);
1859
1860 if (!accessors[lHeader]) {
1861 buildAccessors(prototype, _header);
1862 accessors[lHeader] = true;
1863 }
1864 }
1865
1866 utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1867
1868 return this;
1869 }
1870}
1871
1872AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1873
1874// reserved names hotfix
1875utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
1876 let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1877 return {
1878 get: () => value,
1879 set(headerValue) {
1880 this[mapped] = headerValue;
1881 }
1882 }
1883});
1884
1885utils$1.freezeMethods(AxiosHeaders$1);
1886
1887const AxiosHeaders$2 = AxiosHeaders$1;
1888
1889/**
1890 * Transform the data for a request or a response
1891 *
1892 * @param {Array|Function} fns A single function or Array of functions
1893 * @param {?Object} response The response object
1894 *
1895 * @returns {*} The resulting transformed data
1896 */
1897function transformData(fns, response) {
1898 const config = this || defaults$1;
1899 const context = response || config;
1900 const headers = AxiosHeaders$2.from(context.headers);
1901 let data = context.data;
1902
1903 utils$1.forEach(fns, function transform(fn) {
1904 data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1905 });
1906
1907 headers.normalize();
1908
1909 return data;
1910}
1911
1912function isCancel$1(value) {
1913 return !!(value && value.__CANCEL__);
1914}
1915
1916/**
1917 * A `CanceledError` is an object that is thrown when an operation is canceled.
1918 *
1919 * @param {string=} message The message.
1920 * @param {Object=} config The config.
1921 * @param {Object=} request The request.
1922 *
1923 * @returns {CanceledError} The created error.
1924 */
1925function CanceledError$1(message, config, request) {
1926 // eslint-disable-next-line no-eq-null,eqeqeq
1927 AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
1928 this.name = 'CanceledError';
1929}
1930
1931utils$1.inherits(CanceledError$1, AxiosError$1, {
1932 __CANCEL__: true
1933});
1934
1935/**
1936 * Resolve or reject a Promise based on response status.
1937 *
1938 * @param {Function} resolve A function that resolves the promise.
1939 * @param {Function} reject A function that rejects the promise.
1940 * @param {object} response The response.
1941 *
1942 * @returns {object} The response.
1943 */
1944function settle(resolve, reject, response) {
1945 const validateStatus = response.config.validateStatus;
1946 if (!response.status || !validateStatus || validateStatus(response.status)) {
1947 resolve(response);
1948 } else {
1949 reject(new AxiosError$1(
1950 'Request failed with status code ' + response.status,
1951 [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1952 response.config,
1953 response.request,
1954 response
1955 ));
1956 }
1957}
1958
1959const cookies = platform.hasStandardBrowserEnv ?
1960
1961 // Standard browser envs support document.cookie
1962 {
1963 write(name, value, expires, path, domain, secure) {
1964 const cookie = [name + '=' + encodeURIComponent(value)];
1965
1966 utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
1967
1968 utils$1.isString(path) && cookie.push('path=' + path);
1969
1970 utils$1.isString(domain) && cookie.push('domain=' + domain);
1971
1972 secure === true && cookie.push('secure');
1973
1974 document.cookie = cookie.join('; ');
1975 },
1976
1977 read(name) {
1978 const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1979 return (match ? decodeURIComponent(match[3]) : null);
1980 },
1981
1982 remove(name) {
1983 this.write(name, '', Date.now() - 86400000);
1984 }
1985 }
1986
1987 :
1988
1989 // Non-standard browser env (web workers, react-native) lack needed support.
1990 {
1991 write() {},
1992 read() {
1993 return null;
1994 },
1995 remove() {}
1996 };
1997
1998/**
1999 * Determines whether the specified URL is absolute
2000 *
2001 * @param {string} url The URL to test
2002 *
2003 * @returns {boolean} True if the specified URL is absolute, otherwise false
2004 */
2005function isAbsoluteURL(url) {
2006 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2007 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2008 // by any combination of letters, digits, plus, period, or hyphen.
2009 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2010}
2011
2012/**
2013 * Creates a new URL by combining the specified URLs
2014 *
2015 * @param {string} baseURL The base URL
2016 * @param {string} relativeURL The relative URL
2017 *
2018 * @returns {string} The combined URL
2019 */
2020function combineURLs(baseURL, relativeURL) {
2021 return relativeURL
2022 ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2023 : baseURL;
2024}
2025
2026/**
2027 * Creates a new URL by combining the baseURL with the requestedURL,
2028 * only when the requestedURL is not already an absolute URL.
2029 * If the requestURL is absolute, this function returns the requestedURL untouched.
2030 *
2031 * @param {string} baseURL The base URL
2032 * @param {string} requestedURL Absolute or relative URL to combine
2033 *
2034 * @returns {string} The combined full path
2035 */
2036function buildFullPath(baseURL, requestedURL) {
2037 if (baseURL && !isAbsoluteURL(requestedURL)) {
2038 return combineURLs(baseURL, requestedURL);
2039 }
2040 return requestedURL;
2041}
2042
2043const isURLSameOrigin = platform.hasStandardBrowserEnv ?
2044
2045// Standard browser envs have full support of the APIs needed to test
2046// whether the request URL is of the same origin as current location.
2047 (function standardBrowserEnv() {
2048 const msie = /(msie|trident)/i.test(navigator.userAgent);
2049 const urlParsingNode = document.createElement('a');
2050 let originURL;
2051
2052 /**
2053 * Parse a URL to discover its components
2054 *
2055 * @param {String} url The URL to be parsed
2056 * @returns {Object}
2057 */
2058 function resolveURL(url) {
2059 let href = url;
2060
2061 if (msie) {
2062 // IE needs attribute set twice to normalize properties
2063 urlParsingNode.setAttribute('href', href);
2064 href = urlParsingNode.href;
2065 }
2066
2067 urlParsingNode.setAttribute('href', href);
2068
2069 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2070 return {
2071 href: urlParsingNode.href,
2072 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2073 host: urlParsingNode.host,
2074 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2075 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2076 hostname: urlParsingNode.hostname,
2077 port: urlParsingNode.port,
2078 pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2079 urlParsingNode.pathname :
2080 '/' + urlParsingNode.pathname
2081 };
2082 }
2083
2084 originURL = resolveURL(window.location.href);
2085
2086 /**
2087 * Determine if a URL shares the same origin as the current location
2088 *
2089 * @param {String} requestURL The URL to test
2090 * @returns {boolean} True if URL shares the same origin, otherwise false
2091 */
2092 return function isURLSameOrigin(requestURL) {
2093 const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2094 return (parsed.protocol === originURL.protocol &&
2095 parsed.host === originURL.host);
2096 };
2097 })() :
2098
2099 // Non standard browser envs (web workers, react-native) lack needed support.
2100 (function nonStandardBrowserEnv() {
2101 return function isURLSameOrigin() {
2102 return true;
2103 };
2104 })();
2105
2106function parseProtocol(url) {
2107 const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2108 return match && match[1] || '';
2109}
2110
2111/**
2112 * Calculate data maxRate
2113 * @param {Number} [samplesCount= 10]
2114 * @param {Number} [min= 1000]
2115 * @returns {Function}
2116 */
2117function speedometer(samplesCount, min) {
2118 samplesCount = samplesCount || 10;
2119 const bytes = new Array(samplesCount);
2120 const timestamps = new Array(samplesCount);
2121 let head = 0;
2122 let tail = 0;
2123 let firstSampleTS;
2124
2125 min = min !== undefined ? min : 1000;
2126
2127 return function push(chunkLength) {
2128 const now = Date.now();
2129
2130 const startedAt = timestamps[tail];
2131
2132 if (!firstSampleTS) {
2133 firstSampleTS = now;
2134 }
2135
2136 bytes[head] = chunkLength;
2137 timestamps[head] = now;
2138
2139 let i = tail;
2140 let bytesCount = 0;
2141
2142 while (i !== head) {
2143 bytesCount += bytes[i++];
2144 i = i % samplesCount;
2145 }
2146
2147 head = (head + 1) % samplesCount;
2148
2149 if (head === tail) {
2150 tail = (tail + 1) % samplesCount;
2151 }
2152
2153 if (now - firstSampleTS < min) {
2154 return;
2155 }
2156
2157 const passed = startedAt && now - startedAt;
2158
2159 return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2160 };
2161}
2162
2163function progressEventReducer(listener, isDownloadStream) {
2164 let bytesNotified = 0;
2165 const _speedometer = speedometer(50, 250);
2166
2167 return e => {
2168 const loaded = e.loaded;
2169 const total = e.lengthComputable ? e.total : undefined;
2170 const progressBytes = loaded - bytesNotified;
2171 const rate = _speedometer(progressBytes);
2172 const inRange = loaded <= total;
2173
2174 bytesNotified = loaded;
2175
2176 const data = {
2177 loaded,
2178 total,
2179 progress: total ? (loaded / total) : undefined,
2180 bytes: progressBytes,
2181 rate: rate ? rate : undefined,
2182 estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2183 event: e
2184 };
2185
2186 data[isDownloadStream ? 'download' : 'upload'] = true;
2187
2188 listener(data);
2189 };
2190}
2191
2192const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2193
2194const xhrAdapter = isXHRAdapterSupported && function (config) {
2195 return new Promise(function dispatchXhrRequest(resolve, reject) {
2196 let requestData = config.data;
2197 const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
2198 let {responseType, withXSRFToken} = config;
2199 let onCanceled;
2200 function done() {
2201 if (config.cancelToken) {
2202 config.cancelToken.unsubscribe(onCanceled);
2203 }
2204
2205 if (config.signal) {
2206 config.signal.removeEventListener('abort', onCanceled);
2207 }
2208 }
2209
2210 let contentType;
2211
2212 if (utils$1.isFormData(requestData)) {
2213 if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2214 requestHeaders.setContentType(false); // Let the browser set it
2215 } else if ((contentType = requestHeaders.getContentType()) !== false) {
2216 // fix semicolon duplication issue for ReactNative FormData implementation
2217 const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2218 requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2219 }
2220 }
2221
2222 let request = new XMLHttpRequest();
2223
2224 // HTTP basic authentication
2225 if (config.auth) {
2226 const username = config.auth.username || '';
2227 const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2228 requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2229 }
2230
2231 const fullPath = buildFullPath(config.baseURL, config.url);
2232
2233 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2234
2235 // Set the request timeout in MS
2236 request.timeout = config.timeout;
2237
2238 function onloadend() {
2239 if (!request) {
2240 return;
2241 }
2242 // Prepare the response
2243 const responseHeaders = AxiosHeaders$2.from(
2244 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2245 );
2246 const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2247 request.responseText : request.response;
2248 const response = {
2249 data: responseData,
2250 status: request.status,
2251 statusText: request.statusText,
2252 headers: responseHeaders,
2253 config,
2254 request
2255 };
2256
2257 settle(function _resolve(value) {
2258 resolve(value);
2259 done();
2260 }, function _reject(err) {
2261 reject(err);
2262 done();
2263 }, response);
2264
2265 // Clean up request
2266 request = null;
2267 }
2268
2269 if ('onloadend' in request) {
2270 // Use onloadend if available
2271 request.onloadend = onloadend;
2272 } else {
2273 // Listen for ready state to emulate onloadend
2274 request.onreadystatechange = function handleLoad() {
2275 if (!request || request.readyState !== 4) {
2276 return;
2277 }
2278
2279 // The request errored out and we didn't get a response, this will be
2280 // handled by onerror instead
2281 // With one exception: request that using file: protocol, most browsers
2282 // will return status as 0 even though it's a successful request
2283 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2284 return;
2285 }
2286 // readystate handler is calling before onerror or ontimeout handlers,
2287 // so we should call onloadend on the next 'tick'
2288 setTimeout(onloadend);
2289 };
2290 }
2291
2292 // Handle browser request cancellation (as opposed to a manual cancellation)
2293 request.onabort = function handleAbort() {
2294 if (!request) {
2295 return;
2296 }
2297
2298 reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
2299
2300 // Clean up request
2301 request = null;
2302 };
2303
2304 // Handle low level network errors
2305 request.onerror = function handleError() {
2306 // Real errors are hidden from us by the browser
2307 // onerror should only fire if it's a network error
2308 reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
2309
2310 // Clean up request
2311 request = null;
2312 };
2313
2314 // Handle timeout
2315 request.ontimeout = function handleTimeout() {
2316 let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2317 const transitional = config.transitional || transitionalDefaults;
2318 if (config.timeoutErrorMessage) {
2319 timeoutErrorMessage = config.timeoutErrorMessage;
2320 }
2321 reject(new AxiosError$1(
2322 timeoutErrorMessage,
2323 transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2324 config,
2325 request));
2326
2327 // Clean up request
2328 request = null;
2329 };
2330
2331 // Add xsrf header
2332 // This is only done if running in a standard browser environment.
2333 // Specifically not if we're in a web worker, or react-native.
2334 if(platform.hasStandardBrowserEnv) {
2335 withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2336
2337 if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
2338 // Add xsrf header
2339 const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2340
2341 if (xsrfValue) {
2342 requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2343 }
2344 }
2345 }
2346
2347 // Remove Content-Type if data is undefined
2348 requestData === undefined && requestHeaders.setContentType(null);
2349
2350 // Add headers to the request
2351 if ('setRequestHeader' in request) {
2352 utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2353 request.setRequestHeader(key, val);
2354 });
2355 }
2356
2357 // Add withCredentials to request if needed
2358 if (!utils$1.isUndefined(config.withCredentials)) {
2359 request.withCredentials = !!config.withCredentials;
2360 }
2361
2362 // Add responseType to request if needed
2363 if (responseType && responseType !== 'json') {
2364 request.responseType = config.responseType;
2365 }
2366
2367 // Handle progress if needed
2368 if (typeof config.onDownloadProgress === 'function') {
2369 request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2370 }
2371
2372 // Not all browsers support upload events
2373 if (typeof config.onUploadProgress === 'function' && request.upload) {
2374 request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2375 }
2376
2377 if (config.cancelToken || config.signal) {
2378 // Handle cancellation
2379 // eslint-disable-next-line func-names
2380 onCanceled = cancel => {
2381 if (!request) {
2382 return;
2383 }
2384 reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2385 request.abort();
2386 request = null;
2387 };
2388
2389 config.cancelToken && config.cancelToken.subscribe(onCanceled);
2390 if (config.signal) {
2391 config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2392 }
2393 }
2394
2395 const protocol = parseProtocol(fullPath);
2396
2397 if (protocol && platform.protocols.indexOf(protocol) === -1) {
2398 reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
2399 return;
2400 }
2401
2402
2403 // Send the request
2404 request.send(requestData || null);
2405 });
2406};
2407
2408const knownAdapters = {
2409 http: httpAdapter,
2410 xhr: xhrAdapter
2411};
2412
2413utils$1.forEach(knownAdapters, (fn, value) => {
2414 if (fn) {
2415 try {
2416 Object.defineProperty(fn, 'name', {value});
2417 } catch (e) {
2418 // eslint-disable-next-line no-empty
2419 }
2420 Object.defineProperty(fn, 'adapterName', {value});
2421 }
2422});
2423
2424const renderReason = (reason) => `- ${reason}`;
2425
2426const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2427
2428const adapters = {
2429 getAdapter: (adapters) => {
2430 adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2431
2432 const {length} = adapters;
2433 let nameOrAdapter;
2434 let adapter;
2435
2436 const rejectedReasons = {};
2437
2438 for (let i = 0; i < length; i++) {
2439 nameOrAdapter = adapters[i];
2440 let id;
2441
2442 adapter = nameOrAdapter;
2443
2444 if (!isResolvedHandle(nameOrAdapter)) {
2445 adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2446
2447 if (adapter === undefined) {
2448 throw new AxiosError$1(`Unknown adapter '${id}'`);
2449 }
2450 }
2451
2452 if (adapter) {
2453 break;
2454 }
2455
2456 rejectedReasons[id || '#' + i] = adapter;
2457 }
2458
2459 if (!adapter) {
2460
2461 const reasons = Object.entries(rejectedReasons)
2462 .map(([id, state]) => `adapter ${id} ` +
2463 (state === false ? 'is not supported by the environment' : 'is not available in the build')
2464 );
2465
2466 let s = length ?
2467 (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
2468 'as no adapter specified';
2469
2470 throw new AxiosError$1(
2471 `There is no suitable adapter to dispatch the request ` + s,
2472 'ERR_NOT_SUPPORT'
2473 );
2474 }
2475
2476 return adapter;
2477 },
2478 adapters: knownAdapters
2479};
2480
2481/**
2482 * Throws a `CanceledError` if cancellation has been requested.
2483 *
2484 * @param {Object} config The config that is to be used for the request
2485 *
2486 * @returns {void}
2487 */
2488function throwIfCancellationRequested(config) {
2489 if (config.cancelToken) {
2490 config.cancelToken.throwIfRequested();
2491 }
2492
2493 if (config.signal && config.signal.aborted) {
2494 throw new CanceledError$1(null, config);
2495 }
2496}
2497
2498/**
2499 * Dispatch a request to the server using the configured adapter.
2500 *
2501 * @param {object} config The config that is to be used for the request
2502 *
2503 * @returns {Promise} The Promise to be fulfilled
2504 */
2505function dispatchRequest(config) {
2506 throwIfCancellationRequested(config);
2507
2508 config.headers = AxiosHeaders$2.from(config.headers);
2509
2510 // Transform request data
2511 config.data = transformData.call(
2512 config,
2513 config.transformRequest
2514 );
2515
2516 if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2517 config.headers.setContentType('application/x-www-form-urlencoded', false);
2518 }
2519
2520 const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
2521
2522 return adapter(config).then(function onAdapterResolution(response) {
2523 throwIfCancellationRequested(config);
2524
2525 // Transform response data
2526 response.data = transformData.call(
2527 config,
2528 config.transformResponse,
2529 response
2530 );
2531
2532 response.headers = AxiosHeaders$2.from(response.headers);
2533
2534 return response;
2535 }, function onAdapterRejection(reason) {
2536 if (!isCancel$1(reason)) {
2537 throwIfCancellationRequested(config);
2538
2539 // Transform response data
2540 if (reason && reason.response) {
2541 reason.response.data = transformData.call(
2542 config,
2543 config.transformResponse,
2544 reason.response
2545 );
2546 reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
2547 }
2548 }
2549
2550 return Promise.reject(reason);
2551 });
2552}
2553
2554const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? thing.toJSON() : thing;
2555
2556/**
2557 * Config-specific merge-function which creates a new config-object
2558 * by merging two configuration objects together.
2559 *
2560 * @param {Object} config1
2561 * @param {Object} config2
2562 *
2563 * @returns {Object} New object resulting from merging config2 to config1
2564 */
2565function mergeConfig$1(config1, config2) {
2566 // eslint-disable-next-line no-param-reassign
2567 config2 = config2 || {};
2568 const config = {};
2569
2570 function getMergedValue(target, source, caseless) {
2571 if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2572 return utils$1.merge.call({caseless}, target, source);
2573 } else if (utils$1.isPlainObject(source)) {
2574 return utils$1.merge({}, source);
2575 } else if (utils$1.isArray(source)) {
2576 return source.slice();
2577 }
2578 return source;
2579 }
2580
2581 // eslint-disable-next-line consistent-return
2582 function mergeDeepProperties(a, b, caseless) {
2583 if (!utils$1.isUndefined(b)) {
2584 return getMergedValue(a, b, caseless);
2585 } else if (!utils$1.isUndefined(a)) {
2586 return getMergedValue(undefined, a, caseless);
2587 }
2588 }
2589
2590 // eslint-disable-next-line consistent-return
2591 function valueFromConfig2(a, b) {
2592 if (!utils$1.isUndefined(b)) {
2593 return getMergedValue(undefined, b);
2594 }
2595 }
2596
2597 // eslint-disable-next-line consistent-return
2598 function defaultToConfig2(a, b) {
2599 if (!utils$1.isUndefined(b)) {
2600 return getMergedValue(undefined, b);
2601 } else if (!utils$1.isUndefined(a)) {
2602 return getMergedValue(undefined, a);
2603 }
2604 }
2605
2606 // eslint-disable-next-line consistent-return
2607 function mergeDirectKeys(a, b, prop) {
2608 if (prop in config2) {
2609 return getMergedValue(a, b);
2610 } else if (prop in config1) {
2611 return getMergedValue(undefined, a);
2612 }
2613 }
2614
2615 const mergeMap = {
2616 url: valueFromConfig2,
2617 method: valueFromConfig2,
2618 data: valueFromConfig2,
2619 baseURL: defaultToConfig2,
2620 transformRequest: defaultToConfig2,
2621 transformResponse: defaultToConfig2,
2622 paramsSerializer: defaultToConfig2,
2623 timeout: defaultToConfig2,
2624 timeoutMessage: defaultToConfig2,
2625 withCredentials: defaultToConfig2,
2626 withXSRFToken: defaultToConfig2,
2627 adapter: defaultToConfig2,
2628 responseType: defaultToConfig2,
2629 xsrfCookieName: defaultToConfig2,
2630 xsrfHeaderName: defaultToConfig2,
2631 onUploadProgress: defaultToConfig2,
2632 onDownloadProgress: defaultToConfig2,
2633 decompress: defaultToConfig2,
2634 maxContentLength: defaultToConfig2,
2635 maxBodyLength: defaultToConfig2,
2636 beforeRedirect: defaultToConfig2,
2637 transport: defaultToConfig2,
2638 httpAgent: defaultToConfig2,
2639 httpsAgent: defaultToConfig2,
2640 cancelToken: defaultToConfig2,
2641 socketPath: defaultToConfig2,
2642 responseEncoding: defaultToConfig2,
2643 validateStatus: mergeDirectKeys,
2644 headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2645 };
2646
2647 utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2648 const merge = mergeMap[prop] || mergeDeepProperties;
2649 const configValue = merge(config1[prop], config2[prop], prop);
2650 (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2651 });
2652
2653 return config;
2654}
2655
2656const VERSION$1 = "1.6.7";
2657
2658const validators$1 = {};
2659
2660// eslint-disable-next-line func-names
2661['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
2662 validators$1[type] = function validator(thing) {
2663 return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2664 };
2665});
2666
2667const deprecatedWarnings = {};
2668
2669/**
2670 * Transitional option validator
2671 *
2672 * @param {function|boolean?} validator - set to false if the transitional option has been removed
2673 * @param {string?} version - deprecated version / removed since version
2674 * @param {string?} message - some message with additional info
2675 *
2676 * @returns {function}
2677 */
2678validators$1.transitional = function transitional(validator, version, message) {
2679 function formatMessage(opt, desc) {
2680 return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2681 }
2682
2683 // eslint-disable-next-line func-names
2684 return (value, opt, opts) => {
2685 if (validator === false) {
2686 throw new AxiosError$1(
2687 formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2688 AxiosError$1.ERR_DEPRECATED
2689 );
2690 }
2691
2692 if (version && !deprecatedWarnings[opt]) {
2693 deprecatedWarnings[opt] = true;
2694 // eslint-disable-next-line no-console
2695 console.warn(
2696 formatMessage(
2697 opt,
2698 ' has been deprecated since v' + version + ' and will be removed in the near future'
2699 )
2700 );
2701 }
2702
2703 return validator ? validator(value, opt, opts) : true;
2704 };
2705};
2706
2707/**
2708 * Assert object's properties type
2709 *
2710 * @param {object} options
2711 * @param {object} schema
2712 * @param {boolean?} allowUnknown
2713 *
2714 * @returns {object}
2715 */
2716
2717function assertOptions(options, schema, allowUnknown) {
2718 if (typeof options !== 'object') {
2719 throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
2720 }
2721 const keys = Object.keys(options);
2722 let i = keys.length;
2723 while (i-- > 0) {
2724 const opt = keys[i];
2725 const validator = schema[opt];
2726 if (validator) {
2727 const value = options[opt];
2728 const result = value === undefined || validator(value, opt, options);
2729 if (result !== true) {
2730 throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
2731 }
2732 continue;
2733 }
2734 if (allowUnknown !== true) {
2735 throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
2736 }
2737 }
2738}
2739
2740const validator = {
2741 assertOptions,
2742 validators: validators$1
2743};
2744
2745const validators = validator.validators;
2746
2747/**
2748 * Create a new instance of Axios
2749 *
2750 * @param {Object} instanceConfig The default config for the instance
2751 *
2752 * @return {Axios} A new instance of Axios
2753 */
2754class Axios$1 {
2755 constructor(instanceConfig) {
2756 this.defaults = instanceConfig;
2757 this.interceptors = {
2758 request: new InterceptorManager$1(),
2759 response: new InterceptorManager$1()
2760 };
2761 }
2762
2763 /**
2764 * Dispatch a request
2765 *
2766 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2767 * @param {?Object} config
2768 *
2769 * @returns {Promise} The Promise to be fulfilled
2770 */
2771 async request(configOrUrl, config) {
2772 try {
2773 return await this._request(configOrUrl, config);
2774 } catch (err) {
2775 if (err instanceof Error) {
2776 let dummy;
2777
2778 Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
2779
2780 // slice off the Error: ... line
2781 const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2782
2783 if (!err.stack) {
2784 err.stack = stack;
2785 // match without the 2 top stack lines
2786 } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2787 err.stack += '\n' + stack;
2788 }
2789 }
2790
2791 throw err;
2792 }
2793 }
2794
2795 _request(configOrUrl, config) {
2796 /*eslint no-param-reassign:0*/
2797 // Allow for axios('example/url'[, config]) a la fetch API
2798 if (typeof configOrUrl === 'string') {
2799 config = config || {};
2800 config.url = configOrUrl;
2801 } else {
2802 config = configOrUrl || {};
2803 }
2804
2805 config = mergeConfig$1(this.defaults, config);
2806
2807 const {transitional, paramsSerializer, headers} = config;
2808
2809 if (transitional !== undefined) {
2810 validator.assertOptions(transitional, {
2811 silentJSONParsing: validators.transitional(validators.boolean),
2812 forcedJSONParsing: validators.transitional(validators.boolean),
2813 clarifyTimeoutError: validators.transitional(validators.boolean)
2814 }, false);
2815 }
2816
2817 if (paramsSerializer != null) {
2818 if (utils$1.isFunction(paramsSerializer)) {
2819 config.paramsSerializer = {
2820 serialize: paramsSerializer
2821 };
2822 } else {
2823 validator.assertOptions(paramsSerializer, {
2824 encode: validators.function,
2825 serialize: validators.function
2826 }, true);
2827 }
2828 }
2829
2830 // Set config.method
2831 config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2832
2833 // Flatten headers
2834 let contextHeaders = headers && utils$1.merge(
2835 headers.common,
2836 headers[config.method]
2837 );
2838
2839 headers && utils$1.forEach(
2840 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2841 (method) => {
2842 delete headers[method];
2843 }
2844 );
2845
2846 config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
2847
2848 // filter out skipped interceptors
2849 const requestInterceptorChain = [];
2850 let synchronousRequestInterceptors = true;
2851 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2852 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2853 return;
2854 }
2855
2856 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2857
2858 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2859 });
2860
2861 const responseInterceptorChain = [];
2862 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2863 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2864 });
2865
2866 let promise;
2867 let i = 0;
2868 let len;
2869
2870 if (!synchronousRequestInterceptors) {
2871 const chain = [dispatchRequest.bind(this), undefined];
2872 chain.unshift.apply(chain, requestInterceptorChain);
2873 chain.push.apply(chain, responseInterceptorChain);
2874 len = chain.length;
2875
2876 promise = Promise.resolve(config);
2877
2878 while (i < len) {
2879 promise = promise.then(chain[i++], chain[i++]);
2880 }
2881
2882 return promise;
2883 }
2884
2885 len = requestInterceptorChain.length;
2886
2887 let newConfig = config;
2888
2889 i = 0;
2890
2891 while (i < len) {
2892 const onFulfilled = requestInterceptorChain[i++];
2893 const onRejected = requestInterceptorChain[i++];
2894 try {
2895 newConfig = onFulfilled(newConfig);
2896 } catch (error) {
2897 onRejected.call(this, error);
2898 break;
2899 }
2900 }
2901
2902 try {
2903 promise = dispatchRequest.call(this, newConfig);
2904 } catch (error) {
2905 return Promise.reject(error);
2906 }
2907
2908 i = 0;
2909 len = responseInterceptorChain.length;
2910
2911 while (i < len) {
2912 promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2913 }
2914
2915 return promise;
2916 }
2917
2918 getUri(config) {
2919 config = mergeConfig$1(this.defaults, config);
2920 const fullPath = buildFullPath(config.baseURL, config.url);
2921 return buildURL(fullPath, config.params, config.paramsSerializer);
2922 }
2923}
2924
2925// Provide aliases for supported request methods
2926utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2927 /*eslint func-names:0*/
2928 Axios$1.prototype[method] = function(url, config) {
2929 return this.request(mergeConfig$1(config || {}, {
2930 method,
2931 url,
2932 data: (config || {}).data
2933 }));
2934 };
2935});
2936
2937utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2938 /*eslint func-names:0*/
2939
2940 function generateHTTPMethod(isForm) {
2941 return function httpMethod(url, data, config) {
2942 return this.request(mergeConfig$1(config || {}, {
2943 method,
2944 headers: isForm ? {
2945 'Content-Type': 'multipart/form-data'
2946 } : {},
2947 url,
2948 data
2949 }));
2950 };
2951 }
2952
2953 Axios$1.prototype[method] = generateHTTPMethod();
2954
2955 Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
2956});
2957
2958const Axios$2 = Axios$1;
2959
2960/**
2961 * A `CancelToken` is an object that can be used to request cancellation of an operation.
2962 *
2963 * @param {Function} executor The executor function.
2964 *
2965 * @returns {CancelToken}
2966 */
2967class CancelToken$1 {
2968 constructor(executor) {
2969 if (typeof executor !== 'function') {
2970 throw new TypeError('executor must be a function.');
2971 }
2972
2973 let resolvePromise;
2974
2975 this.promise = new Promise(function promiseExecutor(resolve) {
2976 resolvePromise = resolve;
2977 });
2978
2979 const token = this;
2980
2981 // eslint-disable-next-line func-names
2982 this.promise.then(cancel => {
2983 if (!token._listeners) return;
2984
2985 let i = token._listeners.length;
2986
2987 while (i-- > 0) {
2988 token._listeners[i](cancel);
2989 }
2990 token._listeners = null;
2991 });
2992
2993 // eslint-disable-next-line func-names
2994 this.promise.then = onfulfilled => {
2995 let _resolve;
2996 // eslint-disable-next-line func-names
2997 const promise = new Promise(resolve => {
2998 token.subscribe(resolve);
2999 _resolve = resolve;
3000 }).then(onfulfilled);
3001
3002 promise.cancel = function reject() {
3003 token.unsubscribe(_resolve);
3004 };
3005
3006 return promise;
3007 };
3008
3009 executor(function cancel(message, config, request) {
3010 if (token.reason) {
3011 // Cancellation has already been requested
3012 return;
3013 }
3014
3015 token.reason = new CanceledError$1(message, config, request);
3016 resolvePromise(token.reason);
3017 });
3018 }
3019
3020 /**
3021 * Throws a `CanceledError` if cancellation has been requested.
3022 */
3023 throwIfRequested() {
3024 if (this.reason) {
3025 throw this.reason;
3026 }
3027 }
3028
3029 /**
3030 * Subscribe to the cancel signal
3031 */
3032
3033 subscribe(listener) {
3034 if (this.reason) {
3035 listener(this.reason);
3036 return;
3037 }
3038
3039 if (this._listeners) {
3040 this._listeners.push(listener);
3041 } else {
3042 this._listeners = [listener];
3043 }
3044 }
3045
3046 /**
3047 * Unsubscribe from the cancel signal
3048 */
3049
3050 unsubscribe(listener) {
3051 if (!this._listeners) {
3052 return;
3053 }
3054 const index = this._listeners.indexOf(listener);
3055 if (index !== -1) {
3056 this._listeners.splice(index, 1);
3057 }
3058 }
3059
3060 /**
3061 * Returns an object that contains a new `CancelToken` and a function that, when called,
3062 * cancels the `CancelToken`.
3063 */
3064 static source() {
3065 let cancel;
3066 const token = new CancelToken$1(function executor(c) {
3067 cancel = c;
3068 });
3069 return {
3070 token,
3071 cancel
3072 };
3073 }
3074}
3075
3076const CancelToken$2 = CancelToken$1;
3077
3078/**
3079 * Syntactic sugar for invoking a function and expanding an array for arguments.
3080 *
3081 * Common use case would be to use `Function.prototype.apply`.
3082 *
3083 * ```js
3084 * function f(x, y, z) {}
3085 * var args = [1, 2, 3];
3086 * f.apply(null, args);
3087 * ```
3088 *
3089 * With `spread` this example can be re-written.
3090 *
3091 * ```js
3092 * spread(function(x, y, z) {})([1, 2, 3]);
3093 * ```
3094 *
3095 * @param {Function} callback
3096 *
3097 * @returns {Function}
3098 */
3099function spread$1(callback) {
3100 return function wrap(arr) {
3101 return callback.apply(null, arr);
3102 };
3103}
3104
3105/**
3106 * Determines whether the payload is an error thrown by Axios
3107 *
3108 * @param {*} payload The value to test
3109 *
3110 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3111 */
3112function isAxiosError$1(payload) {
3113 return utils$1.isObject(payload) && (payload.isAxiosError === true);
3114}
3115
3116const HttpStatusCode$1 = {
3117 Continue: 100,
3118 SwitchingProtocols: 101,
3119 Processing: 102,
3120 EarlyHints: 103,
3121 Ok: 200,
3122 Created: 201,
3123 Accepted: 202,
3124 NonAuthoritativeInformation: 203,
3125 NoContent: 204,
3126 ResetContent: 205,
3127 PartialContent: 206,
3128 MultiStatus: 207,
3129 AlreadyReported: 208,
3130 ImUsed: 226,
3131 MultipleChoices: 300,
3132 MovedPermanently: 301,
3133 Found: 302,
3134 SeeOther: 303,
3135 NotModified: 304,
3136 UseProxy: 305,
3137 Unused: 306,
3138 TemporaryRedirect: 307,
3139 PermanentRedirect: 308,
3140 BadRequest: 400,
3141 Unauthorized: 401,
3142 PaymentRequired: 402,
3143 Forbidden: 403,
3144 NotFound: 404,
3145 MethodNotAllowed: 405,
3146 NotAcceptable: 406,
3147 ProxyAuthenticationRequired: 407,
3148 RequestTimeout: 408,
3149 Conflict: 409,
3150 Gone: 410,
3151 LengthRequired: 411,
3152 PreconditionFailed: 412,
3153 PayloadTooLarge: 413,
3154 UriTooLong: 414,
3155 UnsupportedMediaType: 415,
3156 RangeNotSatisfiable: 416,
3157 ExpectationFailed: 417,
3158 ImATeapot: 418,
3159 MisdirectedRequest: 421,
3160 UnprocessableEntity: 422,
3161 Locked: 423,
3162 FailedDependency: 424,
3163 TooEarly: 425,
3164 UpgradeRequired: 426,
3165 PreconditionRequired: 428,
3166 TooManyRequests: 429,
3167 RequestHeaderFieldsTooLarge: 431,
3168 UnavailableForLegalReasons: 451,
3169 InternalServerError: 500,
3170 NotImplemented: 501,
3171 BadGateway: 502,
3172 ServiceUnavailable: 503,
3173 GatewayTimeout: 504,
3174 HttpVersionNotSupported: 505,
3175 VariantAlsoNegotiates: 506,
3176 InsufficientStorage: 507,
3177 LoopDetected: 508,
3178 NotExtended: 510,
3179 NetworkAuthenticationRequired: 511,
3180};
3181
3182Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
3183 HttpStatusCode$1[value] = key;
3184});
3185
3186const HttpStatusCode$2 = HttpStatusCode$1;
3187
3188/**
3189 * Create an instance of Axios
3190 *
3191 * @param {Object} defaultConfig The default config for the instance
3192 *
3193 * @returns {Axios} A new instance of Axios
3194 */
3195function createInstance(defaultConfig) {
3196 const context = new Axios$2(defaultConfig);
3197 const instance = bind(Axios$2.prototype.request, context);
3198
3199 // Copy axios.prototype to instance
3200 utils$1.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
3201
3202 // Copy context to instance
3203 utils$1.extend(instance, context, null, {allOwnKeys: true});
3204
3205 // Factory for creating new instances
3206 instance.create = function create(instanceConfig) {
3207 return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
3208 };
3209
3210 return instance;
3211}
3212
3213// Create the default instance to be exported
3214const axios = createInstance(defaults$1);
3215
3216// Expose Axios class to allow class inheritance
3217axios.Axios = Axios$2;
3218
3219// Expose Cancel & CancelToken
3220axios.CanceledError = CanceledError$1;
3221axios.CancelToken = CancelToken$2;
3222axios.isCancel = isCancel$1;
3223axios.VERSION = VERSION$1;
3224axios.toFormData = toFormData$1;
3225
3226// Expose AxiosError class
3227axios.AxiosError = AxiosError$1;
3228
3229// alias for CanceledError for backward compatibility
3230axios.Cancel = axios.CanceledError;
3231
3232// Expose all/spread
3233axios.all = function all(promises) {
3234 return Promise.all(promises);
3235};
3236
3237axios.spread = spread$1;
3238
3239// Expose isAxiosError
3240axios.isAxiosError = isAxiosError$1;
3241
3242// Expose mergeConfig
3243axios.mergeConfig = mergeConfig$1;
3244
3245axios.AxiosHeaders = AxiosHeaders$2;
3246
3247axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3248
3249axios.getAdapter = adapters.getAdapter;
3250
3251axios.HttpStatusCode = HttpStatusCode$2;
3252
3253axios.default = axios;
3254
3255// this module should only have a default export
3256const axios$1 = axios;
3257
3258// This module is intended to unwrap Axios default export as named.
3259// Keep top-level export same with static properties
3260// so that it can keep same with es module or cjs
3261const {
3262 Axios,
3263 AxiosError,
3264 CanceledError,
3265 isCancel,
3266 CancelToken,
3267 VERSION,
3268 all,
3269 Cancel,
3270 isAxiosError,
3271 spread,
3272 toFormData,
3273 AxiosHeaders,
3274 HttpStatusCode,
3275 formToJSON,
3276 getAdapter,
3277 mergeConfig
3278} = axios$1;
3279
3280export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, axios$1 as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
3281//# sourceMappingURL=axios.js.map
Note: See TracBrowser for help on using the repository browser.