axios 1.1.3 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

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