@wiajs/req 1.7.12 → 1.7.13

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.
@@ -0,0 +1,4025 @@
1
+ /*!
2
+ * @wia/req v1.7.13
3
+ * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
4
+ * Released under the MIT License.
5
+ */
6
+ 'use strict';
7
+
8
+ function bind$1(fn, thisArg) {
9
+ return function wrap() {
10
+ return fn.apply(thisArg, arguments);
11
+ };
12
+ }
13
+
14
+ // utils is a library of generic helper functions non-specific to axios
15
+
16
+ const {toString: toString$1} = Object.prototype;
17
+ const {getPrototypeOf: getPrototypeOf$1} = Object;
18
+
19
+ const kindOf$1 = (cache => thing => {
20
+ const str = toString$1.call(thing);
21
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
22
+ })(Object.create(null));
23
+
24
+ const kindOfTest$1 = (type) => {
25
+ type = type.toLowerCase();
26
+ return (thing) => kindOf$1(thing) === type
27
+ };
28
+
29
+ const typeOfTest$1 = type => thing => typeof thing === type;
30
+
31
+ /**
32
+ * Determine if a value is an Array
33
+ *
34
+ * @param {Object} val The value to test
35
+ *
36
+ * @returns {boolean} True if value is an Array, otherwise false
37
+ */
38
+ const {isArray: isArray$1} = Array;
39
+
40
+ /**
41
+ * Determine if a value is undefined
42
+ *
43
+ * @param {*} val The value to test
44
+ *
45
+ * @returns {boolean} True if the value is undefined, otherwise false
46
+ */
47
+ const isUndefined$1 = typeOfTest$1('undefined');
48
+
49
+ /**
50
+ * Determine if a value is a Buffer
51
+ *
52
+ * @param {*} val The value to test
53
+ *
54
+ * @returns {boolean} True if value is a Buffer, otherwise false
55
+ */
56
+ function isBuffer$1(val) {
57
+ return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
58
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
59
+ }
60
+
61
+ /**
62
+ * Determine if a value is an ArrayBuffer
63
+ *
64
+ * @param {*} val The value to test
65
+ *
66
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
67
+ */
68
+ const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
69
+
70
+
71
+ /**
72
+ * Determine if a value is a view on an ArrayBuffer
73
+ *
74
+ * @param {*} val The value to test
75
+ *
76
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
77
+ */
78
+ function isArrayBufferView$1(val) {
79
+ let result;
80
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
81
+ result = ArrayBuffer.isView(val);
82
+ } else {
83
+ result = (val) && (val.buffer) && (isArrayBuffer$1(val.buffer));
84
+ }
85
+ return result;
86
+ }
87
+
88
+ /**
89
+ * Determine if a value is a String
90
+ *
91
+ * @param {*} val The value to test
92
+ *
93
+ * @returns {boolean} True if value is a String, otherwise false
94
+ */
95
+ const isString$1 = typeOfTest$1('string');
96
+
97
+ /**
98
+ * Determine if a value is a Function
99
+ *
100
+ * @param {*} val The value to test
101
+ * @returns {boolean} True if value is a Function, otherwise false
102
+ */
103
+ const isFunction$1 = typeOfTest$1('function');
104
+
105
+ /**
106
+ * Determine if a value is a Number
107
+ *
108
+ * @param {*} val The value to test
109
+ *
110
+ * @returns {boolean} True if value is a Number, otherwise false
111
+ */
112
+ const isNumber$1 = typeOfTest$1('number');
113
+
114
+ /**
115
+ * Determine if a value is an Object
116
+ *
117
+ * @param {*} thing The value to test
118
+ *
119
+ * @returns {boolean} True if value is an Object, otherwise false
120
+ */
121
+ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
122
+
123
+ /**
124
+ * Determine if a value is a Boolean
125
+ *
126
+ * @param {*} thing The value to test
127
+ * @returns {boolean} True if value is a Boolean, otherwise false
128
+ */
129
+ const isBoolean$1 = thing => thing === true || thing === false;
130
+
131
+ /**
132
+ * Determine if a value is a plain Object
133
+ *
134
+ * @param {*} val The value to test
135
+ *
136
+ * @returns {boolean} True if value is a plain Object, otherwise false
137
+ */
138
+ const isPlainObject$1 = (val) => {
139
+ if (kindOf$1(val) !== 'object') {
140
+ return false;
141
+ }
142
+
143
+ const prototype = getPrototypeOf$1(val);
144
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
145
+ };
146
+
147
+ /**
148
+ * Determine if a value is a Date
149
+ *
150
+ * @param {*} val The value to test
151
+ *
152
+ * @returns {boolean} True if value is a Date, otherwise false
153
+ */
154
+ const isDate$1 = kindOfTest$1('Date');
155
+
156
+ /**
157
+ * Determine if a value is a File
158
+ *
159
+ * @param {*} val The value to test
160
+ *
161
+ * @returns {boolean} True if value is a File, otherwise false
162
+ */
163
+ const isFile$1 = kindOfTest$1('File');
164
+
165
+ /**
166
+ * Determine if a value is a Blob
167
+ *
168
+ * @param {*} val The value to test
169
+ *
170
+ * @returns {boolean} True if value is a Blob, otherwise false
171
+ */
172
+ const isBlob$1 = kindOfTest$1('Blob');
173
+
174
+ /**
175
+ * Determine if a value is a FileList
176
+ *
177
+ * @param {*} val The value to test
178
+ *
179
+ * @returns {boolean} True if value is a File, otherwise false
180
+ */
181
+ const isFileList$1 = kindOfTest$1('FileList');
182
+
183
+ /**
184
+ * Determine if a value is a Stream
185
+ *
186
+ * @param {*} val The value to test
187
+ *
188
+ * @returns {boolean} True if value is a Stream, otherwise false
189
+ */
190
+ const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
191
+
192
+ /**
193
+ * Determine if a value is a FormData
194
+ *
195
+ * @param {*} thing The value to test
196
+ *
197
+ * @returns {boolean} True if value is an FormData, otherwise false
198
+ */
199
+ const isFormData$1 = (thing) => {
200
+ let kind;
201
+ return thing && (
202
+ (typeof FormData === 'function' && thing instanceof FormData) || (
203
+ isFunction$1(thing.append) && (
204
+ (kind = kindOf$1(thing)) === 'formdata' ||
205
+ // detect form-data instance
206
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
207
+ )
208
+ )
209
+ )
210
+ };
211
+
212
+ /**
213
+ * Determine if a value is a URLSearchParams object
214
+ *
215
+ * @param {*} val The value to test
216
+ *
217
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
218
+ */
219
+ const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
220
+
221
+ const [isReadableStream$1, isRequest$1, isResponse$1, isHeaders$1] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest$1);
222
+
223
+ /**
224
+ * Trim excess whitespace off the beginning and end of a string
225
+ *
226
+ * @param {String} str The String to trim
227
+ *
228
+ * @returns {String} The String freed of excess whitespace
229
+ */
230
+ const trim$1 = (str) => str.trim ?
231
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
232
+
233
+ /**
234
+ * Iterate over an Array or an Object invoking a function for each item.
235
+ *
236
+ * If `obj` is an Array callback will be called passing
237
+ * the value, index, and complete array for each item.
238
+ *
239
+ * If 'obj' is an Object callback will be called passing
240
+ * the value, key, and complete object for each property.
241
+ *
242
+ * @param {Object|Array} obj The object to iterate
243
+ * @param {Function} fn The callback to invoke for each item
244
+ *
245
+ * @param {Boolean} [allOwnKeys = false]
246
+ * @returns {any}
247
+ */
248
+ function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
249
+ // Don't bother if no value provided
250
+ if (obj === null || typeof obj === 'undefined') {
251
+ return;
252
+ }
253
+
254
+ let i;
255
+ let l;
256
+
257
+ // Force an array if not already something iterable
258
+ if (typeof obj !== 'object') {
259
+ /*eslint no-param-reassign:0*/
260
+ obj = [obj];
261
+ }
262
+
263
+ if (isArray$1(obj)) {
264
+ // Iterate over array values
265
+ for (i = 0, l = obj.length; i < l; i++) {
266
+ fn.call(null, obj[i], i, obj);
267
+ }
268
+ } else {
269
+ // Iterate over object keys
270
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
271
+ const len = keys.length;
272
+ let key;
273
+
274
+ for (i = 0; i < len; i++) {
275
+ key = keys[i];
276
+ fn.call(null, obj[key], key, obj);
277
+ }
278
+ }
279
+ }
280
+
281
+ function findKey$1(obj, key) {
282
+ key = key.toLowerCase();
283
+ const keys = Object.keys(obj);
284
+ let i = keys.length;
285
+ let _key;
286
+ while (i-- > 0) {
287
+ _key = keys[i];
288
+ if (key === _key.toLowerCase()) {
289
+ return _key;
290
+ }
291
+ }
292
+ return null;
293
+ }
294
+
295
+ const _global$1 = (() => {
296
+ /*eslint no-undef:0*/
297
+ if (typeof globalThis !== "undefined") return globalThis;
298
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
299
+ })();
300
+
301
+ const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
302
+
303
+ /**
304
+ * Accepts varargs expecting each argument to be an object, then
305
+ * immutably merges the properties of each object and returns result.
306
+ *
307
+ * When multiple objects contain the same key the later object in
308
+ * the arguments list will take precedence.
309
+ *
310
+ * Example:
311
+ *
312
+ * ```js
313
+ * var result = merge({foo: 123}, {foo: 456});
314
+ * console.log(result.foo); // outputs 456
315
+ * ```
316
+ *
317
+ * @param {Object} obj1 Object to merge
318
+ *
319
+ * @returns {Object} Result of all merge properties
320
+ */
321
+ function merge$1(/* obj1, obj2, obj3, ... */) {
322
+ const {caseless} = isContextDefined$1(this) && this || {};
323
+ const result = {};
324
+ const assignValue = (val, key) => {
325
+ const targetKey = caseless && findKey$1(result, key) || key;
326
+ if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
327
+ result[targetKey] = merge$1(result[targetKey], val);
328
+ } else if (isPlainObject$1(val)) {
329
+ result[targetKey] = merge$1({}, val);
330
+ } else if (isArray$1(val)) {
331
+ result[targetKey] = val.slice();
332
+ } else {
333
+ result[targetKey] = val;
334
+ }
335
+ };
336
+
337
+ for (let i = 0, l = arguments.length; i < l; i++) {
338
+ arguments[i] && forEach$1(arguments[i], assignValue);
339
+ }
340
+ return result;
341
+ }
342
+
343
+ /**
344
+ * Extends object a by mutably adding to it the properties of object b.
345
+ *
346
+ * @param {Object} a The object to be extended
347
+ * @param {Object} b The object to copy properties from
348
+ * @param {Object} thisArg The object to bind function to
349
+ *
350
+ * @param {Boolean} [allOwnKeys]
351
+ * @returns {Object} The resulting value of object a
352
+ */
353
+ const extend$1 = (a, b, thisArg, {allOwnKeys} = {}) => {
354
+ forEach$1(b, (val, key) => {
355
+ if (thisArg && isFunction$1(val)) {
356
+ a[key] = bind$1(val, thisArg);
357
+ } else {
358
+ a[key] = val;
359
+ }
360
+ }, {allOwnKeys});
361
+ return a;
362
+ };
363
+
364
+ /**
365
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
366
+ *
367
+ * @param {string} content with BOM
368
+ *
369
+ * @returns {string} content value without BOM
370
+ */
371
+ const stripBOM$1 = (content) => {
372
+ if (content.charCodeAt(0) === 0xFEFF) {
373
+ content = content.slice(1);
374
+ }
375
+ return content;
376
+ };
377
+
378
+ /**
379
+ * Inherit the prototype methods from one constructor into another
380
+ * @param {function} constructor
381
+ * @param {function} superConstructor
382
+ * @param {object} [props]
383
+ * @param {object} [descriptors]
384
+ *
385
+ * @returns {void}
386
+ */
387
+ const inherits$1 = (constructor, superConstructor, props, descriptors) => {
388
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
389
+ constructor.prototype.constructor = constructor;
390
+ Object.defineProperty(constructor, 'super', {
391
+ value: superConstructor.prototype
392
+ });
393
+ props && Object.assign(constructor.prototype, props);
394
+ };
395
+
396
+ /**
397
+ * Resolve object with deep prototype chain to a flat object
398
+ * @param {Object} sourceObj source object
399
+ * @param {Object} [destObj]
400
+ * @param {Function|Boolean} [filter]
401
+ * @param {Function} [propFilter]
402
+ *
403
+ * @returns {Object}
404
+ */
405
+ const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
406
+ let props;
407
+ let i;
408
+ let prop;
409
+ const merged = {};
410
+
411
+ destObj = destObj || {};
412
+ // eslint-disable-next-line no-eq-null,eqeqeq
413
+ if (sourceObj == null) return destObj;
414
+
415
+ do {
416
+ props = Object.getOwnPropertyNames(sourceObj);
417
+ i = props.length;
418
+ while (i-- > 0) {
419
+ prop = props[i];
420
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
421
+ destObj[prop] = sourceObj[prop];
422
+ merged[prop] = true;
423
+ }
424
+ }
425
+ sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
426
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
427
+
428
+ return destObj;
429
+ };
430
+
431
+ /**
432
+ * Determines whether a string ends with the characters of a specified string
433
+ *
434
+ * @param {String} str
435
+ * @param {String} searchString
436
+ * @param {Number} [position= 0]
437
+ *
438
+ * @returns {boolean}
439
+ */
440
+ const endsWith$1 = (str, searchString, position) => {
441
+ str = String(str);
442
+ if (position === undefined || position > str.length) {
443
+ position = str.length;
444
+ }
445
+ position -= searchString.length;
446
+ const lastIndex = str.indexOf(searchString, position);
447
+ return lastIndex !== -1 && lastIndex === position;
448
+ };
449
+
450
+
451
+ /**
452
+ * Returns new array from array like object or null if failed
453
+ *
454
+ * @param {*} [thing]
455
+ *
456
+ * @returns {?Array}
457
+ */
458
+ const toArray$1 = (thing) => {
459
+ if (!thing) return null;
460
+ if (isArray$1(thing)) return thing;
461
+ let i = thing.length;
462
+ if (!isNumber$1(i)) return null;
463
+ const arr = new Array(i);
464
+ while (i-- > 0) {
465
+ arr[i] = thing[i];
466
+ }
467
+ return arr;
468
+ };
469
+
470
+ /**
471
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
472
+ * thing passed in is an instance of Uint8Array
473
+ *
474
+ * @param {TypedArray}
475
+ *
476
+ * @returns {Array}
477
+ */
478
+ // eslint-disable-next-line func-names
479
+ const isTypedArray$1 = (TypedArray => {
480
+ // eslint-disable-next-line func-names
481
+ return thing => {
482
+ return TypedArray && thing instanceof TypedArray;
483
+ };
484
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
485
+
486
+ /**
487
+ * For each entry in the object, call the function with the key and value.
488
+ *
489
+ * @param {Object<any, any>} obj - The object to iterate over.
490
+ * @param {Function} fn - The function to call for each entry.
491
+ *
492
+ * @returns {void}
493
+ */
494
+ const forEachEntry$1 = (obj, fn) => {
495
+ const generator = obj && obj[Symbol.iterator];
496
+
497
+ const iterator = generator.call(obj);
498
+
499
+ let result;
500
+
501
+ while ((result = iterator.next()) && !result.done) {
502
+ const pair = result.value;
503
+ fn.call(obj, pair[0], pair[1]);
504
+ }
505
+ };
506
+
507
+ /**
508
+ * It takes a regular expression and a string, and returns an array of all the matches
509
+ *
510
+ * @param {string} regExp - The regular expression to match against.
511
+ * @param {string} str - The string to search.
512
+ *
513
+ * @returns {Array<boolean>}
514
+ */
515
+ const matchAll$1 = (regExp, str) => {
516
+ let matches;
517
+ const arr = [];
518
+
519
+ while ((matches = regExp.exec(str)) !== null) {
520
+ arr.push(matches);
521
+ }
522
+
523
+ return arr;
524
+ };
525
+
526
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
527
+ const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
528
+
529
+ const toCamelCase$1 = str => {
530
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
531
+ function replacer(m, p1, p2) {
532
+ return p1.toUpperCase() + p2;
533
+ }
534
+ );
535
+ };
536
+
537
+ /* Creating a function that will check if an object has a property. */
538
+ const hasOwnProperty$1 = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
539
+
540
+ /**
541
+ * Determine if a value is a RegExp object
542
+ *
543
+ * @param {*} val The value to test
544
+ *
545
+ * @returns {boolean} True if value is a RegExp object, otherwise false
546
+ */
547
+ const isRegExp$1 = kindOfTest$1('RegExp');
548
+
549
+ const reduceDescriptors$1 = (obj, reducer) => {
550
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
551
+ const reducedDescriptors = {};
552
+
553
+ forEach$1(descriptors, (descriptor, name) => {
554
+ let ret;
555
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
556
+ reducedDescriptors[name] = ret || descriptor;
557
+ }
558
+ });
559
+
560
+ Object.defineProperties(obj, reducedDescriptors);
561
+ };
562
+
563
+ /**
564
+ * Makes all methods read-only
565
+ * @param {Object} obj
566
+ */
567
+
568
+ const freezeMethods$1 = (obj) => {
569
+ reduceDescriptors$1(obj, (descriptor, name) => {
570
+ // skip restricted props in strict mode
571
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
572
+ return false;
573
+ }
574
+
575
+ const value = obj[name];
576
+
577
+ if (!isFunction$1(value)) return;
578
+
579
+ descriptor.enumerable = false;
580
+
581
+ if ('writable' in descriptor) {
582
+ descriptor.writable = false;
583
+ return;
584
+ }
585
+
586
+ if (!descriptor.set) {
587
+ descriptor.set = () => {
588
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
589
+ };
590
+ }
591
+ });
592
+ };
593
+
594
+ const toObjectSet$1 = (arrayOrString, delimiter) => {
595
+ const obj = {};
596
+
597
+ const define = (arr) => {
598
+ arr.forEach(value => {
599
+ obj[value] = true;
600
+ });
601
+ };
602
+
603
+ isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
604
+
605
+ return obj;
606
+ };
607
+
608
+ const noop$1 = () => {};
609
+
610
+ const toFiniteNumber$1 = (value, defaultValue) => {
611
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
612
+ };
613
+
614
+ const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
615
+
616
+ const DIGIT$1 = '0123456789';
617
+
618
+ const ALPHABET$1 = {
619
+ DIGIT: DIGIT$1,
620
+ ALPHA: ALPHA$1,
621
+ ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
622
+ };
623
+
624
+ const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT) => {
625
+ let str = '';
626
+ const {length} = alphabet;
627
+ while (size--) {
628
+ str += alphabet[Math.random() * length|0];
629
+ }
630
+
631
+ return str;
632
+ };
633
+
634
+ /**
635
+ * If the thing is a FormData object, return true, otherwise return false.
636
+ *
637
+ * @param {unknown} thing - The thing to check.
638
+ *
639
+ * @returns {boolean}
640
+ */
641
+ function isSpecCompliantForm$1(thing) {
642
+ return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
643
+ }
644
+
645
+ const toJSONObject$1 = (obj) => {
646
+ const stack = new Array(10);
647
+
648
+ const visit = (source, i) => {
649
+
650
+ if (isObject$1(source)) {
651
+ if (stack.indexOf(source) >= 0) {
652
+ return;
653
+ }
654
+
655
+ if (!('toJSON' in source)) {
656
+ stack[i] = source;
657
+ const target = isArray$1(source) ? [] : {};
658
+
659
+ forEach$1(source, (value, key) => {
660
+ const reducedValue = visit(value, i + 1);
661
+ !isUndefined$1(reducedValue) && (target[key] = reducedValue);
662
+ });
663
+
664
+ stack[i] = undefined;
665
+
666
+ return target;
667
+ }
668
+ }
669
+
670
+ return source;
671
+ };
672
+
673
+ return visit(obj, 0);
674
+ };
675
+
676
+ const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
677
+
678
+ const isThenable$1 = (thing) =>
679
+ thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
680
+
681
+ // original code
682
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
683
+
684
+ const _setImmediate$1 = ((setImmediateSupported, postMessageSupported) => {
685
+ if (setImmediateSupported) {
686
+ return setImmediate;
687
+ }
688
+
689
+ return postMessageSupported ? ((token, callbacks) => {
690
+ _global$1.addEventListener("message", ({source, data}) => {
691
+ if (source === _global$1 && data === token) {
692
+ callbacks.length && callbacks.shift()();
693
+ }
694
+ }, false);
695
+
696
+ return (cb) => {
697
+ callbacks.push(cb);
698
+ _global$1.postMessage(token, "*");
699
+ }
700
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
701
+ })(
702
+ typeof setImmediate === 'function',
703
+ isFunction$1(_global$1.postMessage)
704
+ );
705
+
706
+ const asap$1 = typeof queueMicrotask !== 'undefined' ?
707
+ queueMicrotask.bind(_global$1) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate$1);
708
+
709
+
710
+ function createErrorType$1(code, message, baseClass) {
711
+ // Create constructor
712
+ function CustomError(properties) {
713
+ Error.captureStackTrace(this, this.constructor);
714
+ Object.assign(this, properties || {});
715
+ this.code = code;
716
+ this.message = this.cause ? `${message}: ${this.cause.message}` : message;
717
+ }
718
+
719
+ // Attach constructor and set default properties
720
+ CustomError.prototype = new (baseClass || Error)();
721
+ CustomError.prototype.constructor = CustomError;
722
+ CustomError.prototype.name = `Error [${code}]`;
723
+ return CustomError;
724
+ }
725
+
726
+
727
+ // *********************
728
+
729
+ const utils$2 = {
730
+ isArray: isArray$1,
731
+ isArrayBuffer: isArrayBuffer$1,
732
+ isBuffer: isBuffer$1,
733
+ isFormData: isFormData$1,
734
+ isArrayBufferView: isArrayBufferView$1,
735
+ isString: isString$1,
736
+ isNumber: isNumber$1,
737
+ isBoolean: isBoolean$1,
738
+ isObject: isObject$1,
739
+ isPlainObject: isPlainObject$1,
740
+ isReadableStream: isReadableStream$1,
741
+ isRequest: isRequest$1,
742
+ isResponse: isResponse$1,
743
+ isHeaders: isHeaders$1,
744
+ isUndefined: isUndefined$1,
745
+ isDate: isDate$1,
746
+ isFile: isFile$1,
747
+ isBlob: isBlob$1,
748
+ isRegExp: isRegExp$1,
749
+ isFunction: isFunction$1,
750
+ isStream: isStream$1,
751
+ isURLSearchParams: isURLSearchParams$1,
752
+ isTypedArray: isTypedArray$1,
753
+ isFileList: isFileList$1,
754
+ forEach: forEach$1,
755
+ merge: merge$1,
756
+ extend: extend$1,
757
+ trim: trim$1,
758
+ stripBOM: stripBOM$1,
759
+ inherits: inherits$1,
760
+ toFlatObject: toFlatObject$1,
761
+ kindOf: kindOf$1,
762
+ kindOfTest: kindOfTest$1,
763
+ endsWith: endsWith$1,
764
+ toArray: toArray$1,
765
+ forEachEntry: forEachEntry$1,
766
+ matchAll: matchAll$1,
767
+ isHTMLForm: isHTMLForm$1,
768
+ hasOwnProperty: hasOwnProperty$1,
769
+ hasOwnProp: hasOwnProperty$1, // an alias to avoid ESLint no-prototype-builtins detection
770
+ reduceDescriptors: reduceDescriptors$1,
771
+ freezeMethods: freezeMethods$1,
772
+ toObjectSet: toObjectSet$1,
773
+ toCamelCase: toCamelCase$1,
774
+ noop: noop$1,
775
+ toFiniteNumber: toFiniteNumber$1,
776
+ findKey: findKey$1,
777
+ global: _global$1,
778
+ isContextDefined: isContextDefined$1,
779
+ ALPHABET: ALPHABET$1,
780
+ generateString: generateString$1,
781
+ isSpecCompliantForm: isSpecCompliantForm$1,
782
+ toJSONObject: toJSONObject$1,
783
+ isAsyncFn: isAsyncFn$1,
784
+ isThenable: isThenable$1,
785
+ setImmediate: _setImmediate$1,
786
+ asap: asap$1,
787
+ createErrorType: createErrorType$1
788
+ };
789
+
790
+ /**
791
+ * Create an Error with the specified message, config, error code, request and response.
792
+ *
793
+ * @param {string} message The error message.
794
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
795
+ * @param {Object} [config] The config.
796
+ * @param {Object} [request] The request.
797
+ * @param {Object} [response] The response.
798
+ *
799
+ * @returns {Error} The created error.
800
+ */
801
+ function AxiosError$1(message, code, config, request, response) {
802
+ Error.call(this);
803
+
804
+ if (Error.captureStackTrace) {
805
+ Error.captureStackTrace(this, this.constructor);
806
+ } else {
807
+ this.stack = (new Error()).stack;
808
+ }
809
+
810
+ this.message = message;
811
+ this.name = 'AxiosError';
812
+ code && (this.code = code);
813
+ config && (this.config = config);
814
+ request && (this.request = request);
815
+ if (response) {
816
+ this.response = response;
817
+ this.status = response.status ? response.status : null;
818
+ }
819
+ }
820
+
821
+ utils$2.inherits(AxiosError$1, Error, {
822
+ toJSON: function toJSON() {
823
+ return {
824
+ // Standard
825
+ message: this.message,
826
+ name: this.name,
827
+ // Microsoft
828
+ description: this.description,
829
+ number: this.number,
830
+ // Mozilla
831
+ fileName: this.fileName,
832
+ lineNumber: this.lineNumber,
833
+ columnNumber: this.columnNumber,
834
+ stack: this.stack,
835
+ // Axios
836
+ config: utils$2.toJSONObject(this.config),
837
+ code: this.code,
838
+ status: this.status
839
+ };
840
+ }
841
+ });
842
+
843
+ const prototype$3 = AxiosError$1.prototype;
844
+ const descriptors$1 = {};
845
+
846
+ [
847
+ 'ERR_BAD_OPTION_VALUE',
848
+ 'ERR_BAD_OPTION',
849
+ 'ECONNABORTED',
850
+ 'ETIMEDOUT',
851
+ 'ERR_NETWORK',
852
+ 'ERR_FR_TOO_MANY_REDIRECTS',
853
+ 'ERR_DEPRECATED',
854
+ 'ERR_BAD_RESPONSE',
855
+ 'ERR_BAD_REQUEST',
856
+ 'ERR_CANCELED',
857
+ 'ERR_NOT_SUPPORT',
858
+ 'ERR_INVALID_URL'
859
+ // eslint-disable-next-line func-names
860
+ ].forEach(code => {
861
+ descriptors$1[code] = {value: code};
862
+ });
863
+
864
+ Object.defineProperties(AxiosError$1, descriptors$1);
865
+ Object.defineProperty(prototype$3, 'isAxiosError', {value: true});
866
+
867
+ // eslint-disable-next-line func-names
868
+ AxiosError$1.from = (error, code, config, request, response, customProps) => {
869
+ const axiosError = Object.create(prototype$3);
870
+
871
+ utils$2.toFlatObject(error, axiosError, function filter(obj) {
872
+ return obj !== Error.prototype;
873
+ }, prop => {
874
+ return prop !== 'isAxiosError';
875
+ });
876
+
877
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
878
+
879
+ axiosError.cause = error;
880
+
881
+ axiosError.name = error.name;
882
+
883
+ customProps && Object.assign(axiosError, customProps);
884
+
885
+ return axiosError;
886
+ };
887
+
888
+ // eslint-disable-next-line strict
889
+ const HttpAdapter = null;
890
+
891
+ /**
892
+ * Determines if the given thing is a array or js object.
893
+ *
894
+ * @param {string} thing - The object or array to be visited.
895
+ *
896
+ * @returns {boolean}
897
+ */
898
+ function isVisitable$1(thing) {
899
+ return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
900
+ }
901
+
902
+ /**
903
+ * It removes the brackets from the end of a string
904
+ *
905
+ * @param {string} key - The key of the parameter.
906
+ *
907
+ * @returns {string} the key without the brackets.
908
+ */
909
+ function removeBrackets$1(key) {
910
+ return utils$2.endsWith(key, '[]') ? key.slice(0, -2) : key;
911
+ }
912
+
913
+ /**
914
+ * It takes a path, a key, and a boolean, and returns a string
915
+ *
916
+ * @param {string} path - The path to the current key.
917
+ * @param {string} key - The key of the current object being iterated over.
918
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
919
+ *
920
+ * @returns {string} The path to the current key.
921
+ */
922
+ function renderKey$1(path, key, dots) {
923
+ if (!path) return key;
924
+ return path.concat(key).map(function each(token, i) {
925
+ // eslint-disable-next-line no-param-reassign
926
+ token = removeBrackets$1(token);
927
+ return !dots && i ? '[' + token + ']' : token;
928
+ }).join(dots ? '.' : '');
929
+ }
930
+
931
+ /**
932
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
933
+ *
934
+ * @param {Array<any>} arr - The array to check
935
+ *
936
+ * @returns {boolean}
937
+ */
938
+ function isFlatArray$1(arr) {
939
+ return utils$2.isArray(arr) && !arr.some(isVisitable$1);
940
+ }
941
+
942
+ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(prop) {
943
+ return /^is[A-Z]/.test(prop);
944
+ });
945
+
946
+ /**
947
+ * Convert a data object to FormData
948
+ *
949
+ * @param {Object} obj
950
+ * @param {?Object} [formData]
951
+ * @param {?Object} [options]
952
+ * @param {Function} [options.visitor]
953
+ * @param {Boolean} [options.metaTokens = true]
954
+ * @param {Boolean} [options.dots = false]
955
+ * @param {?Boolean} [options.indexes = false]
956
+ *
957
+ * @returns {Object}
958
+ **/
959
+
960
+ /**
961
+ * It converts an object into a FormData object
962
+ *
963
+ * @param {Object<any, any>} obj - The object to convert to form data.
964
+ * @param {string} formData - The FormData object to append to.
965
+ * @param {Object<string, any>} options
966
+ *
967
+ * @returns
968
+ */
969
+ function toFormData$1(obj, formData, options) {
970
+ if (!utils$2.isObject(obj)) {
971
+ throw new TypeError('target must be an object');
972
+ }
973
+
974
+ // eslint-disable-next-line no-param-reassign
975
+ formData = formData || new (FormData)();
976
+
977
+ // eslint-disable-next-line no-param-reassign
978
+ options = utils$2.toFlatObject(options, {
979
+ metaTokens: true,
980
+ dots: false,
981
+ indexes: false
982
+ }, false, function defined(option, source) {
983
+ // eslint-disable-next-line no-eq-null,eqeqeq
984
+ return !utils$2.isUndefined(source[option]);
985
+ });
986
+
987
+ const metaTokens = options.metaTokens;
988
+ // eslint-disable-next-line no-use-before-define
989
+ const visitor = options.visitor || defaultVisitor;
990
+ const dots = options.dots;
991
+ const indexes = options.indexes;
992
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
993
+ const useBlob = _Blob && utils$2.isSpecCompliantForm(formData);
994
+
995
+ if (!utils$2.isFunction(visitor)) {
996
+ throw new TypeError('visitor must be a function');
997
+ }
998
+
999
+ function convertValue(value) {
1000
+ if (value === null) return '';
1001
+
1002
+ if (utils$2.isDate(value)) {
1003
+ return value.toISOString();
1004
+ }
1005
+
1006
+ if (!useBlob && utils$2.isBlob(value)) {
1007
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
1008
+ }
1009
+
1010
+ if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
1011
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1012
+ }
1013
+
1014
+ return value;
1015
+ }
1016
+
1017
+ /**
1018
+ * Default visitor.
1019
+ *
1020
+ * @param {*} value
1021
+ * @param {String|Number} key
1022
+ * @param {Array<String|Number>} path
1023
+ * @this {FormData}
1024
+ *
1025
+ * @returns {boolean} return true to visit the each prop of the value recursively
1026
+ */
1027
+ function defaultVisitor(value, key, path) {
1028
+ let arr = value;
1029
+
1030
+ if (value && !path && typeof value === 'object') {
1031
+ if (utils$2.endsWith(key, '{}')) {
1032
+ // eslint-disable-next-line no-param-reassign
1033
+ key = metaTokens ? key : key.slice(0, -2);
1034
+ // eslint-disable-next-line no-param-reassign
1035
+ value = JSON.stringify(value);
1036
+ } else if (
1037
+ (utils$2.isArray(value) && isFlatArray$1(value)) ||
1038
+ ((utils$2.isFileList(value) || utils$2.endsWith(key, '[]')) && (arr = utils$2.toArray(value))
1039
+ )) {
1040
+ // eslint-disable-next-line no-param-reassign
1041
+ key = removeBrackets$1(key);
1042
+
1043
+ arr.forEach(function each(el, index) {
1044
+ !(utils$2.isUndefined(el) || el === null) && formData.append(
1045
+ // eslint-disable-next-line no-nested-ternary
1046
+ indexes === true ? renderKey$1([key], index, dots) : (indexes === null ? key : key + '[]'),
1047
+ convertValue(el)
1048
+ );
1049
+ });
1050
+ return false;
1051
+ }
1052
+ }
1053
+
1054
+ if (isVisitable$1(value)) {
1055
+ return true;
1056
+ }
1057
+
1058
+ formData.append(renderKey$1(path, key, dots), convertValue(value));
1059
+
1060
+ return false;
1061
+ }
1062
+
1063
+ const stack = [];
1064
+
1065
+ const exposedHelpers = Object.assign(predicates$1, {
1066
+ defaultVisitor,
1067
+ convertValue,
1068
+ isVisitable: isVisitable$1
1069
+ });
1070
+
1071
+ function build(value, path) {
1072
+ if (utils$2.isUndefined(value)) return;
1073
+
1074
+ if (stack.indexOf(value) !== -1) {
1075
+ throw Error('Circular reference detected in ' + path.join('.'));
1076
+ }
1077
+
1078
+ stack.push(value);
1079
+
1080
+ utils$2.forEach(value, function each(el, key) {
1081
+ const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(
1082
+ formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers
1083
+ );
1084
+
1085
+ if (result === true) {
1086
+ build(el, path ? path.concat(key) : [key]);
1087
+ }
1088
+ });
1089
+
1090
+ stack.pop();
1091
+ }
1092
+
1093
+ if (!utils$2.isObject(obj)) {
1094
+ throw new TypeError('data must be an object');
1095
+ }
1096
+
1097
+ build(obj);
1098
+
1099
+ return formData;
1100
+ }
1101
+
1102
+ /**
1103
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1104
+ * their percent-encoded equivalents
1105
+ *
1106
+ * @param {string} str - The string to encode.
1107
+ *
1108
+ * @returns {string} The encoded string.
1109
+ */
1110
+ function encode$2(str) {
1111
+ const charMap = {
1112
+ '!': '%21',
1113
+ "'": '%27',
1114
+ '(': '%28',
1115
+ ')': '%29',
1116
+ '~': '%7E',
1117
+ '%20': '+',
1118
+ '%00': '\x00'
1119
+ };
1120
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1121
+ return charMap[match];
1122
+ });
1123
+ }
1124
+
1125
+ /**
1126
+ * It takes a params object and converts it to a FormData object
1127
+ *
1128
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1129
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1130
+ *
1131
+ * @returns {void}
1132
+ */
1133
+ function AxiosURLSearchParams$1(params, options) {
1134
+ this._pairs = [];
1135
+
1136
+ params && toFormData$1(params, this, options);
1137
+ }
1138
+
1139
+ const prototype$2 = AxiosURLSearchParams$1.prototype;
1140
+
1141
+ prototype$2.append = function append(name, value) {
1142
+ this._pairs.push([name, value]);
1143
+ };
1144
+
1145
+ prototype$2.toString = function toString(encoder) {
1146
+ const _encode = encoder ? function(value) {
1147
+ return encoder.call(this, value, encode$2);
1148
+ } : encode$2;
1149
+
1150
+ return this._pairs.map(function each(pair) {
1151
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1152
+ }, '').join('&');
1153
+ };
1154
+
1155
+ /**
1156
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1157
+ * URI encoded counterparts
1158
+ *
1159
+ * @param {string} val The value to be encoded.
1160
+ *
1161
+ * @returns {string} The encoded value.
1162
+ */
1163
+ function encode$1(val) {
1164
+ return encodeURIComponent(val).
1165
+ replace(/%3A/gi, ':').
1166
+ replace(/%24/g, '$').
1167
+ replace(/%2C/gi, ',').
1168
+ replace(/%20/g, '+').
1169
+ replace(/%5B/gi, '[').
1170
+ replace(/%5D/gi, ']');
1171
+ }
1172
+
1173
+ /**
1174
+ * Build a URL by appending params to the end
1175
+ *
1176
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1177
+ * @param {object} [params] The params to be appended
1178
+ * @param {?object} options
1179
+ *
1180
+ * @returns {string} The formatted url
1181
+ */
1182
+ function buildURL(url, params, options) {
1183
+ /*eslint no-param-reassign:0*/
1184
+ if (!params) {
1185
+ return url;
1186
+ }
1187
+
1188
+ const _encode = options && options.encode || encode$1;
1189
+
1190
+ const serializeFn = options && options.serialize;
1191
+
1192
+ let serializedParams;
1193
+
1194
+ if (serializeFn) {
1195
+ serializedParams = serializeFn(params, options);
1196
+ } else {
1197
+ serializedParams = utils$2.isURLSearchParams(params) ?
1198
+ params.toString() :
1199
+ new AxiosURLSearchParams$1(params, options).toString(_encode);
1200
+ }
1201
+
1202
+ if (serializedParams) {
1203
+ const hashmarkIndex = url.indexOf("#");
1204
+
1205
+ if (hashmarkIndex !== -1) {
1206
+ url = url.slice(0, hashmarkIndex);
1207
+ }
1208
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1209
+ }
1210
+
1211
+ return url;
1212
+ }
1213
+
1214
+ class InterceptorManager {
1215
+ constructor() {
1216
+ this.handlers = [];
1217
+ }
1218
+
1219
+ /**
1220
+ * Add a new interceptor to the stack
1221
+ *
1222
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1223
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1224
+ *
1225
+ * @return {Number} An ID used to remove interceptor later
1226
+ */
1227
+ use(fulfilled, rejected, options) {
1228
+ this.handlers.push({
1229
+ fulfilled,
1230
+ rejected,
1231
+ synchronous: options ? options.synchronous : false,
1232
+ runWhen: options ? options.runWhen : null
1233
+ });
1234
+ return this.handlers.length - 1;
1235
+ }
1236
+
1237
+ /**
1238
+ * Remove an interceptor from the stack
1239
+ *
1240
+ * @param {Number} id The ID that was returned by `use`
1241
+ *
1242
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1243
+ */
1244
+ eject(id) {
1245
+ if (this.handlers[id]) {
1246
+ this.handlers[id] = null;
1247
+ }
1248
+ }
1249
+
1250
+ /**
1251
+ * Clear all interceptors from the stack
1252
+ *
1253
+ * @returns {void}
1254
+ */
1255
+ clear() {
1256
+ if (this.handlers) {
1257
+ this.handlers = [];
1258
+ }
1259
+ }
1260
+
1261
+ /**
1262
+ * Iterate over all the registered interceptors
1263
+ *
1264
+ * This method is particularly useful for skipping over any
1265
+ * interceptors that may have become `null` calling `eject`.
1266
+ *
1267
+ * @param {Function} fn The function to call for each interceptor
1268
+ *
1269
+ * @returns {void}
1270
+ */
1271
+ forEach(fn) {
1272
+ utils$2.forEach(this.handlers, function forEachHandler(h) {
1273
+ if (h !== null) {
1274
+ fn(h);
1275
+ }
1276
+ });
1277
+ }
1278
+ }
1279
+
1280
+ const InterceptorManager$1 = InterceptorManager;
1281
+
1282
+ const transitionalDefaults = {
1283
+ silentJSONParsing: true,
1284
+ forcedJSONParsing: true,
1285
+ clarifyTimeoutError: false
1286
+ };
1287
+
1288
+ function bind(fn, thisArg) {
1289
+ return function wrap() {
1290
+ return fn.apply(thisArg, arguments);
1291
+ };
1292
+ }
1293
+
1294
+ // utils is a library of generic helper functions non-specific to axios
1295
+ const { toString } = Object.prototype;
1296
+ const { getPrototypeOf } = Object;
1297
+ const kindOf = ((cache)=>(thing)=>{
1298
+ const str = toString.call(thing);
1299
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
1300
+ })(Object.create(null));
1301
+ const kindOfTest = (type)=>{
1302
+ type = type.toLowerCase();
1303
+ return (thing)=>kindOf(thing) === type;
1304
+ };
1305
+ const typeOfTest = (type)=>(thing)=>typeof thing === type;
1306
+ /**
1307
+ * Determine if a value is an Array
1308
+ *
1309
+ * @param {Object} val The value to test
1310
+ *
1311
+ * @returns {boolean} True if value is an Array, otherwise false
1312
+ */ const { isArray } = Array;
1313
+ /**
1314
+ * Determine if a value is undefined
1315
+ *
1316
+ * @param {*} val The value to test
1317
+ *
1318
+ * @returns {boolean} True if the value is undefined, otherwise false
1319
+ */ const isUndefined = typeOfTest('undefined');
1320
+ /**
1321
+ * Determine if a value is a Buffer
1322
+ *
1323
+ * @param {*} val The value to test
1324
+ *
1325
+ * @returns {boolean} True if value is a Buffer, otherwise false
1326
+ */ function isBuffer(val) {
1327
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
1328
+ }
1329
+ /**
1330
+ * Determine if a value is an ArrayBuffer
1331
+ *
1332
+ * @param {*} val The value to test
1333
+ *
1334
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
1335
+ */ const isArrayBuffer = kindOfTest('ArrayBuffer');
1336
+ /**
1337
+ * Determine if a value is a view on an ArrayBuffer
1338
+ *
1339
+ * @param {*} val The value to test
1340
+ *
1341
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
1342
+ */ function isArrayBufferView(val) {
1343
+ let result;
1344
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
1345
+ result = ArrayBuffer.isView(val);
1346
+ } else {
1347
+ result = val && val.buffer && isArrayBuffer(val.buffer);
1348
+ }
1349
+ return result;
1350
+ }
1351
+ /**
1352
+ * Determine if a value is a String
1353
+ *
1354
+ * @param {*} val The value to test
1355
+ *
1356
+ * @returns {boolean} True if value is a String, otherwise false
1357
+ */ const isString = typeOfTest('string');
1358
+ /**
1359
+ * Determine if a value is a Function
1360
+ *
1361
+ * @param {*} val The value to test
1362
+ * @returns {boolean} True if value is a Function, otherwise false
1363
+ */ const isFunction = typeOfTest('function');
1364
+ /**
1365
+ * Determine if a value is a Number
1366
+ *
1367
+ * @param {*} val The value to test
1368
+ *
1369
+ * @returns {boolean} True if value is a Number, otherwise false
1370
+ */ const isNumber = typeOfTest('number');
1371
+ /**
1372
+ * Determine if a value is an Object
1373
+ *
1374
+ * @param {*} thing The value to test
1375
+ *
1376
+ * @returns {boolean} True if value is an Object, otherwise false
1377
+ */ const isObject = (thing)=>thing !== null && typeof thing === 'object';
1378
+ /**
1379
+ * Determine if a value is a Boolean
1380
+ *
1381
+ * @param {*} thing The value to test
1382
+ * @returns {boolean} True if value is a Boolean, otherwise false
1383
+ */ const isBoolean = (thing)=>thing === true || thing === false;
1384
+ /**
1385
+ * Determine if a value is a plain Object
1386
+ *
1387
+ * @param {*} val The value to test
1388
+ *
1389
+ * @returns {boolean} True if value is a plain Object, otherwise false
1390
+ */ const isPlainObject = (val)=>{
1391
+ if (kindOf(val) !== 'object') {
1392
+ return false;
1393
+ }
1394
+ const prototype = getPrototypeOf(val);
1395
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
1396
+ };
1397
+ /**
1398
+ * Determine if a value is a Date
1399
+ *
1400
+ * @param {*} val The value to test
1401
+ *
1402
+ * @returns {boolean} True if value is a Date, otherwise false
1403
+ */ const isDate = kindOfTest('Date');
1404
+ /**
1405
+ * Determine if a value is a File
1406
+ *
1407
+ * @param {*} val The value to test
1408
+ *
1409
+ * @returns {boolean} True if value is a File, otherwise false
1410
+ */ const isFile = kindOfTest('File');
1411
+ /**
1412
+ * Determine if a value is a Blob
1413
+ *
1414
+ * @param {*} val The value to test
1415
+ *
1416
+ * @returns {boolean} True if value is a Blob, otherwise false
1417
+ */ const isBlob = kindOfTest('Blob');
1418
+ /**
1419
+ * Determine if a value is a FileList
1420
+ *
1421
+ * @param {*} val The value to test
1422
+ *
1423
+ * @returns {boolean} True if value is a File, otherwise false
1424
+ */ const isFileList = kindOfTest('FileList');
1425
+ /**
1426
+ * Determine if a value is a Stream
1427
+ *
1428
+ * @param {*} val The value to test
1429
+ *
1430
+ * @returns {boolean} True if value is a Stream, otherwise false
1431
+ */ const isStream = (val)=>isObject(val) && isFunction(val.pipe);
1432
+ /**
1433
+ * Determine if a value is a FormData
1434
+ *
1435
+ * @param {*} thing The value to test
1436
+ *
1437
+ * @returns {boolean} True if value is an FormData, otherwise false
1438
+ */ const isFormData = (thing)=>{
1439
+ let kind;
1440
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' || // detect form-data instance
1441
+ kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
1442
+ };
1443
+ /**
1444
+ * Determine if a value is a URLSearchParams object
1445
+ *
1446
+ * @param {*} val The value to test
1447
+ *
1448
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
1449
+ */ const isURLSearchParams = kindOfTest('URLSearchParams');
1450
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
1451
+ 'ReadableStream',
1452
+ 'Request',
1453
+ 'Response',
1454
+ 'Headers'
1455
+ ].map(kindOfTest);
1456
+ /**
1457
+ * Trim excess whitespace off the beginning and end of a string
1458
+ *
1459
+ * @param {String} str The String to trim
1460
+ *
1461
+ * @returns {String} The String freed of excess whitespace
1462
+ */ const trim = (str)=>str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
1463
+ /**
1464
+ * Iterate over an Array or an Object invoking a function for each item.
1465
+ *
1466
+ * If `obj` is an Array callback will be called passing
1467
+ * the value, index, and complete array for each item.
1468
+ *
1469
+ * If 'obj' is an Object callback will be called passing
1470
+ * the value, key, and complete object for each property.
1471
+ *
1472
+ * @param {Object|Array} obj The object to iterate
1473
+ * @param {Function} fn The callback to invoke for each item
1474
+ *
1475
+ * @param {Boolean} [allOwnKeys = false]
1476
+ * @returns {any}
1477
+ */ function forEach(obj, fn, { allOwnKeys = false } = {}) {
1478
+ // Don't bother if no value provided
1479
+ if (obj === null || typeof obj === 'undefined') {
1480
+ return;
1481
+ }
1482
+ let i;
1483
+ let l;
1484
+ // Force an array if not already something iterable
1485
+ if (typeof obj !== 'object') {
1486
+ /*eslint no-param-reassign:0*/ obj = [
1487
+ obj
1488
+ ];
1489
+ }
1490
+ if (isArray(obj)) {
1491
+ // Iterate over array values
1492
+ for(i = 0, l = obj.length; i < l; i++){
1493
+ fn.call(null, obj[i], i, obj);
1494
+ }
1495
+ } else {
1496
+ // Iterate over object keys
1497
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1498
+ const len = keys.length;
1499
+ let key;
1500
+ for(i = 0; i < len; i++){
1501
+ key = keys[i];
1502
+ fn.call(null, obj[key], key, obj);
1503
+ }
1504
+ }
1505
+ }
1506
+ function findKey(obj, key) {
1507
+ key = key.toLowerCase();
1508
+ const keys = Object.keys(obj);
1509
+ let i = keys.length;
1510
+ let _key;
1511
+ while(i-- > 0){
1512
+ _key = keys[i];
1513
+ if (key === _key.toLowerCase()) {
1514
+ return _key;
1515
+ }
1516
+ }
1517
+ return null;
1518
+ }
1519
+ const _global = (()=>{
1520
+ /*eslint no-undef:0*/ if (typeof globalThis !== "undefined") return globalThis;
1521
+ return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
1522
+ })();
1523
+ const isContextDefined = (context)=>!isUndefined(context) && context !== _global;
1524
+ /**
1525
+ * Accepts varargs expecting each argument to be an object, then
1526
+ * immutably merges the properties of each object and returns result.
1527
+ *
1528
+ * When multiple objects contain the same key the later object in
1529
+ * the arguments list will take precedence.
1530
+ *
1531
+ * Example:
1532
+ *
1533
+ * ```js
1534
+ * var result = merge({foo: 123}, {foo: 456});
1535
+ * console.log(result.foo); // outputs 456
1536
+ * ```
1537
+ *
1538
+ * @param {Object} obj1 Object to merge
1539
+ *
1540
+ * @returns {Object} Result of all merge properties
1541
+ */ function merge() {
1542
+ const { caseless } = isContextDefined(this) && this || {};
1543
+ const result = {};
1544
+ const assignValue = (val, key)=>{
1545
+ const targetKey = caseless && findKey(result, key) || key;
1546
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1547
+ result[targetKey] = merge(result[targetKey], val);
1548
+ } else if (isPlainObject(val)) {
1549
+ result[targetKey] = merge({}, val);
1550
+ } else if (isArray(val)) {
1551
+ result[targetKey] = val.slice();
1552
+ } else {
1553
+ result[targetKey] = val;
1554
+ }
1555
+ };
1556
+ for(let i = 0, l = arguments.length; i < l; i++){
1557
+ arguments[i] && forEach(arguments[i], assignValue);
1558
+ }
1559
+ return result;
1560
+ }
1561
+ /**
1562
+ * Extends object a by mutably adding to it the properties of object b.
1563
+ *
1564
+ * @param {Object} a The object to be extended
1565
+ * @param {Object} b The object to copy properties from
1566
+ * @param {Object} thisArg The object to bind function to
1567
+ *
1568
+ * @param {Boolean} [allOwnKeys]
1569
+ * @returns {Object} The resulting value of object a
1570
+ */ const extend = (a, b, thisArg, { allOwnKeys } = {})=>{
1571
+ forEach(b, (val, key)=>{
1572
+ if (thisArg && isFunction(val)) {
1573
+ a[key] = bind(val, thisArg);
1574
+ } else {
1575
+ a[key] = val;
1576
+ }
1577
+ }, {
1578
+ allOwnKeys
1579
+ });
1580
+ return a;
1581
+ };
1582
+ /**
1583
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
1584
+ *
1585
+ * @param {string} content with BOM
1586
+ *
1587
+ * @returns {string} content value without BOM
1588
+ */ const stripBOM = (content)=>{
1589
+ if (content.charCodeAt(0) === 0xFEFF) {
1590
+ content = content.slice(1);
1591
+ }
1592
+ return content;
1593
+ };
1594
+ /**
1595
+ * Inherit the prototype methods from one constructor into another
1596
+ * @param {function} constructor
1597
+ * @param {function} superConstructor
1598
+ * @param {object} [props]
1599
+ * @param {object} [descriptors]
1600
+ *
1601
+ * @returns {void}
1602
+ */ const inherits = (constructor, superConstructor, props, descriptors)=>{
1603
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1604
+ constructor.prototype.constructor = constructor;
1605
+ Object.defineProperty(constructor, 'super', {
1606
+ value: superConstructor.prototype
1607
+ });
1608
+ props && Object.assign(constructor.prototype, props);
1609
+ };
1610
+ /**
1611
+ * Resolve object with deep prototype chain to a flat object
1612
+ * @param {Object} sourceObj source object
1613
+ * @param {Object} [destObj]
1614
+ * @param {Function|Boolean} [filter]
1615
+ * @param {Function} [propFilter]
1616
+ *
1617
+ * @returns {Object}
1618
+ */ const toFlatObject = (sourceObj, destObj, filter, propFilter)=>{
1619
+ let props;
1620
+ let i;
1621
+ let prop;
1622
+ const merged = {};
1623
+ destObj = destObj || {};
1624
+ // eslint-disable-next-line no-eq-null,eqeqeq
1625
+ if (sourceObj == null) return destObj;
1626
+ do {
1627
+ props = Object.getOwnPropertyNames(sourceObj);
1628
+ i = props.length;
1629
+ while(i-- > 0){
1630
+ prop = props[i];
1631
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
1632
+ destObj[prop] = sourceObj[prop];
1633
+ merged[prop] = true;
1634
+ }
1635
+ }
1636
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
1637
+ }while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype)
1638
+ return destObj;
1639
+ };
1640
+ /**
1641
+ * Determines whether a string ends with the characters of a specified string
1642
+ *
1643
+ * @param {String} str
1644
+ * @param {String} searchString
1645
+ * @param {Number} [position= 0]
1646
+ *
1647
+ * @returns {boolean}
1648
+ */ const endsWith = (str, searchString, position)=>{
1649
+ str = String(str);
1650
+ if (position === undefined || position > str.length) {
1651
+ position = str.length;
1652
+ }
1653
+ position -= searchString.length;
1654
+ const lastIndex = str.indexOf(searchString, position);
1655
+ return lastIndex !== -1 && lastIndex === position;
1656
+ };
1657
+ /**
1658
+ * Returns new array from array like object or null if failed
1659
+ *
1660
+ * @param {*} [thing]
1661
+ *
1662
+ * @returns {?Array}
1663
+ */ const toArray = (thing)=>{
1664
+ if (!thing) return null;
1665
+ if (isArray(thing)) return thing;
1666
+ let i = thing.length;
1667
+ if (!isNumber(i)) return null;
1668
+ const arr = new Array(i);
1669
+ while(i-- > 0){
1670
+ arr[i] = thing[i];
1671
+ }
1672
+ return arr;
1673
+ };
1674
+ /**
1675
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
1676
+ * thing passed in is an instance of Uint8Array
1677
+ *
1678
+ * @param {TypedArray}
1679
+ *
1680
+ * @returns {Array}
1681
+ */ // eslint-disable-next-line func-names
1682
+ const isTypedArray = ((TypedArray)=>{
1683
+ // eslint-disable-next-line func-names
1684
+ return (thing)=>{
1685
+ return TypedArray && thing instanceof TypedArray;
1686
+ };
1687
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
1688
+ /**
1689
+ * For each entry in the object, call the function with the key and value.
1690
+ *
1691
+ * @param {Object<any, any>} obj - The object to iterate over.
1692
+ * @param {Function} fn - The function to call for each entry.
1693
+ *
1694
+ * @returns {void}
1695
+ */ const forEachEntry = (obj, fn)=>{
1696
+ const generator = obj && obj[Symbol.iterator];
1697
+ const iterator = generator.call(obj);
1698
+ let result;
1699
+ while((result = iterator.next()) && !result.done){
1700
+ const pair = result.value;
1701
+ fn.call(obj, pair[0], pair[1]);
1702
+ }
1703
+ };
1704
+ /**
1705
+ * It takes a regular expression and a string, and returns an array of all the matches
1706
+ *
1707
+ * @param {string} regExp - The regular expression to match against.
1708
+ * @param {string} str - The string to search.
1709
+ *
1710
+ * @returns {Array<boolean>}
1711
+ */ const matchAll = (regExp, str)=>{
1712
+ let matches;
1713
+ const arr = [];
1714
+ while((matches = regExp.exec(str)) !== null){
1715
+ arr.push(matches);
1716
+ }
1717
+ return arr;
1718
+ };
1719
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ const isHTMLForm = kindOfTest('HTMLFormElement');
1720
+ const toCamelCase = (str)=>{
1721
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
1722
+ return p1.toUpperCase() + p2;
1723
+ });
1724
+ };
1725
+ /* Creating a function that will check if an object has a property. */ const hasOwnProperty = (({ hasOwnProperty })=>(obj, prop)=>hasOwnProperty.call(obj, prop))(Object.prototype);
1726
+ /**
1727
+ * Determine if a value is a RegExp object
1728
+ *
1729
+ * @param {*} val The value to test
1730
+ *
1731
+ * @returns {boolean} True if value is a RegExp object, otherwise false
1732
+ */ const isRegExp = kindOfTest('RegExp');
1733
+ const reduceDescriptors = (obj, reducer)=>{
1734
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
1735
+ const reducedDescriptors = {};
1736
+ forEach(descriptors, (descriptor, name)=>{
1737
+ let ret;
1738
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
1739
+ reducedDescriptors[name] = ret || descriptor;
1740
+ }
1741
+ });
1742
+ Object.defineProperties(obj, reducedDescriptors);
1743
+ };
1744
+ /**
1745
+ * Makes all methods read-only
1746
+ * @param {Object} obj
1747
+ */ const freezeMethods = (obj)=>{
1748
+ reduceDescriptors(obj, (descriptor, name)=>{
1749
+ // skip restricted props in strict mode
1750
+ if (isFunction(obj) && [
1751
+ 'arguments',
1752
+ 'caller',
1753
+ 'callee'
1754
+ ].indexOf(name) !== -1) {
1755
+ return false;
1756
+ }
1757
+ const value = obj[name];
1758
+ if (!isFunction(value)) return;
1759
+ descriptor.enumerable = false;
1760
+ if ('writable' in descriptor) {
1761
+ descriptor.writable = false;
1762
+ return;
1763
+ }
1764
+ if (!descriptor.set) {
1765
+ descriptor.set = ()=>{
1766
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
1767
+ };
1768
+ }
1769
+ });
1770
+ };
1771
+ const toObjectSet = (arrayOrString, delimiter)=>{
1772
+ const obj = {};
1773
+ const define = (arr)=>{
1774
+ arr.forEach((value)=>{
1775
+ obj[value] = true;
1776
+ });
1777
+ };
1778
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
1779
+ return obj;
1780
+ };
1781
+ const noop = ()=>{};
1782
+ const toFiniteNumber = (value, defaultValue)=>{
1783
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1784
+ };
1785
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
1786
+ const DIGIT = '0123456789';
1787
+ const ALPHABET = {
1788
+ DIGIT,
1789
+ ALPHA,
1790
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
1791
+ };
1792
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT)=>{
1793
+ let str = '';
1794
+ const { length } = alphabet;
1795
+ while(size--){
1796
+ str += alphabet[Math.random() * length | 0];
1797
+ }
1798
+ return str;
1799
+ };
1800
+ /**
1801
+ * If the thing is a FormData object, return true, otherwise return false.
1802
+ *
1803
+ * @param {unknown} thing - The thing to check.
1804
+ *
1805
+ * @returns {boolean}
1806
+ */ function isSpecCompliantForm(thing) {
1807
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
1808
+ }
1809
+ const toJSONObject = (obj)=>{
1810
+ const stack = new Array(10);
1811
+ const visit = (source, i)=>{
1812
+ if (isObject(source)) {
1813
+ if (stack.indexOf(source) >= 0) {
1814
+ return;
1815
+ }
1816
+ if (!('toJSON' in source)) {
1817
+ stack[i] = source;
1818
+ const target = isArray(source) ? [] : {};
1819
+ forEach(source, (value, key)=>{
1820
+ const reducedValue = visit(value, i + 1);
1821
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
1822
+ });
1823
+ stack[i] = undefined;
1824
+ return target;
1825
+ }
1826
+ }
1827
+ return source;
1828
+ };
1829
+ return visit(obj, 0);
1830
+ };
1831
+ const isAsyncFn = kindOfTest('AsyncFunction');
1832
+ const isThenable = (thing)=>thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
1833
+ // original code
1834
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
1835
+ const _setImmediate = ((setImmediateSupported, postMessageSupported)=>{
1836
+ if (setImmediateSupported) {
1837
+ return setImmediate;
1838
+ }
1839
+ return postMessageSupported ? ((token, callbacks)=>{
1840
+ _global.addEventListener("message", ({ source, data })=>{
1841
+ if (source === _global && data === token) {
1842
+ callbacks.length && callbacks.shift()();
1843
+ }
1844
+ }, false);
1845
+ return (cb)=>{
1846
+ callbacks.push(cb);
1847
+ _global.postMessage(token, "*");
1848
+ };
1849
+ })(`axios@${Math.random()}`, []) : (cb)=>setTimeout(cb);
1850
+ })(typeof setImmediate === 'function', isFunction(_global.postMessage));
1851
+ const asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
1852
+ function createErrorType(code, message, baseClass) {
1853
+ // Create constructor
1854
+ function CustomError(properties) {
1855
+ Error.captureStackTrace(this, this.constructor);
1856
+ Object.assign(this, properties || {});
1857
+ this.code = code;
1858
+ this.message = this.cause ? `${message}: ${this.cause.message}` : message;
1859
+ }
1860
+ // Attach constructor and set default properties
1861
+ CustomError.prototype = new (baseClass || Error)();
1862
+ CustomError.prototype.constructor = CustomError;
1863
+ CustomError.prototype.name = `Error [${code}]`;
1864
+ return CustomError;
1865
+ }
1866
+ // *********************
1867
+ const utils$1 = {
1868
+ isArray,
1869
+ isArrayBuffer,
1870
+ isBuffer,
1871
+ isFormData,
1872
+ isArrayBufferView,
1873
+ isString,
1874
+ isNumber,
1875
+ isBoolean,
1876
+ isObject,
1877
+ isPlainObject,
1878
+ isReadableStream,
1879
+ isRequest,
1880
+ isResponse,
1881
+ isHeaders,
1882
+ isUndefined,
1883
+ isDate,
1884
+ isFile,
1885
+ isBlob,
1886
+ isRegExp,
1887
+ isFunction,
1888
+ isStream,
1889
+ isURLSearchParams,
1890
+ isTypedArray,
1891
+ isFileList,
1892
+ forEach,
1893
+ merge,
1894
+ extend,
1895
+ trim,
1896
+ stripBOM,
1897
+ inherits,
1898
+ toFlatObject,
1899
+ kindOf,
1900
+ kindOfTest,
1901
+ endsWith,
1902
+ toArray,
1903
+ forEachEntry,
1904
+ matchAll,
1905
+ isHTMLForm,
1906
+ hasOwnProperty,
1907
+ hasOwnProp: hasOwnProperty,
1908
+ reduceDescriptors,
1909
+ freezeMethods,
1910
+ toObjectSet,
1911
+ toCamelCase,
1912
+ noop,
1913
+ toFiniteNumber,
1914
+ findKey,
1915
+ global: _global,
1916
+ isContextDefined,
1917
+ ALPHABET,
1918
+ generateString,
1919
+ isSpecCompliantForm,
1920
+ toJSONObject,
1921
+ isAsyncFn,
1922
+ isThenable,
1923
+ setImmediate: _setImmediate,
1924
+ asap,
1925
+ createErrorType
1926
+ };
1927
+
1928
+ /**
1929
+ * Create an Error with the specified message, config, error code, request and response.
1930
+ *
1931
+ * @param {string} message The error message.
1932
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1933
+ * @param {Object} [config] The config.
1934
+ * @param {Object} [request] The request.
1935
+ * @param {Object} [response] The response.
1936
+ *
1937
+ * @returns {Error} The created error.
1938
+ */ function AxiosError(message, code, config, request, response) {
1939
+ Error.call(this);
1940
+ if (Error.captureStackTrace) {
1941
+ Error.captureStackTrace(this, this.constructor);
1942
+ } else {
1943
+ this.stack = new Error().stack;
1944
+ }
1945
+ this.message = message;
1946
+ this.name = 'AxiosError';
1947
+ code && (this.code = code);
1948
+ config && (this.config = config);
1949
+ request && (this.request = request);
1950
+ if (response) {
1951
+ this.response = response;
1952
+ this.status = response.status ? response.status : null;
1953
+ }
1954
+ }
1955
+ utils$1.inherits(AxiosError, Error, {
1956
+ toJSON: function toJSON() {
1957
+ return {
1958
+ // Standard
1959
+ message: this.message,
1960
+ name: this.name,
1961
+ // Microsoft
1962
+ description: this.description,
1963
+ number: this.number,
1964
+ // Mozilla
1965
+ fileName: this.fileName,
1966
+ lineNumber: this.lineNumber,
1967
+ columnNumber: this.columnNumber,
1968
+ stack: this.stack,
1969
+ // Axios
1970
+ config: utils$1.toJSONObject(this.config),
1971
+ code: this.code,
1972
+ status: this.status
1973
+ };
1974
+ }
1975
+ });
1976
+ const prototype$1 = AxiosError.prototype;
1977
+ const descriptors = {};
1978
+ [
1979
+ 'ERR_BAD_OPTION_VALUE',
1980
+ 'ERR_BAD_OPTION',
1981
+ 'ECONNABORTED',
1982
+ 'ETIMEDOUT',
1983
+ 'ERR_NETWORK',
1984
+ 'ERR_FR_TOO_MANY_REDIRECTS',
1985
+ 'ERR_DEPRECATED',
1986
+ 'ERR_BAD_RESPONSE',
1987
+ 'ERR_BAD_REQUEST',
1988
+ 'ERR_CANCELED',
1989
+ 'ERR_NOT_SUPPORT',
1990
+ 'ERR_INVALID_URL'
1991
+ ].forEach((code)=>{
1992
+ descriptors[code] = {
1993
+ value: code
1994
+ };
1995
+ });
1996
+ Object.defineProperties(AxiosError, descriptors);
1997
+ Object.defineProperty(prototype$1, 'isAxiosError', {
1998
+ value: true
1999
+ });
2000
+ // eslint-disable-next-line func-names
2001
+ AxiosError.from = (error, code, config, request, response, customProps)=>{
2002
+ const axiosError = Object.create(prototype$1);
2003
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
2004
+ return obj !== Error.prototype;
2005
+ }, (prop)=>{
2006
+ return prop !== 'isAxiosError';
2007
+ });
2008
+ AxiosError.call(axiosError, error.message, code, config, request, response);
2009
+ axiosError.cause = error;
2010
+ axiosError.name = error.name;
2011
+ customProps && Object.assign(axiosError, customProps);
2012
+ return axiosError;
2013
+ };
2014
+
2015
+ function getDefaultExportFromCjs (x) {
2016
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
2017
+ }
2018
+
2019
+ /* eslint-env browser */
2020
+
2021
+ var browser = typeof self == 'object' ? self.FormData : window.FormData;
2022
+
2023
+ const FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(browser);
2024
+
2025
+ /**
2026
+ * Determines if the given thing is a array or js object.
2027
+ *
2028
+ * @param {string} thing - The object or array to be visited.
2029
+ *
2030
+ * @returns {boolean}
2031
+ */ function isVisitable(thing) {
2032
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
2033
+ }
2034
+ /**
2035
+ * It removes the brackets from the end of a string
2036
+ *
2037
+ * @param {string} key - The key of the parameter.
2038
+ *
2039
+ * @returns {string} the key without the brackets.
2040
+ */ function removeBrackets(key) {
2041
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
2042
+ }
2043
+ /**
2044
+ * It takes a path, a key, and a boolean, and returns a string
2045
+ *
2046
+ * @param {string} path - The path to the current key.
2047
+ * @param {string} key - The key of the current object being iterated over.
2048
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
2049
+ *
2050
+ * @returns {string} The path to the current key.
2051
+ */ function renderKey(path, key, dots) {
2052
+ if (!path) return key;
2053
+ return path.concat(key).map(function each(token, i) {
2054
+ // eslint-disable-next-line no-param-reassign
2055
+ token = removeBrackets(token);
2056
+ return !dots && i ? '[' + token + ']' : token;
2057
+ }).join(dots ? '.' : '');
2058
+ }
2059
+ /**
2060
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
2061
+ *
2062
+ * @param {Array<any>} arr - The array to check
2063
+ *
2064
+ * @returns {boolean}
2065
+ */ function isFlatArray(arr) {
2066
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
2067
+ }
2068
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2069
+ return /^is[A-Z]/.test(prop);
2070
+ });
2071
+ /**
2072
+ * Convert a data object to FormData
2073
+ *
2074
+ * @param {Object} obj
2075
+ * @param {?Object} [formData]
2076
+ * @param {?Object} [options]
2077
+ * @param {Function} [options.visitor]
2078
+ * @param {Boolean} [options.metaTokens = true]
2079
+ * @param {Boolean} [options.dots = false]
2080
+ * @param {?Boolean} [options.indexes = false]
2081
+ *
2082
+ * @returns {Object}
2083
+ **/ /**
2084
+ * It converts an object into a FormData object
2085
+ *
2086
+ * @param {Object<any, any>} obj - The object to convert to form data.
2087
+ * @param {string} formData - The FormData object to append to.
2088
+ * @param {Object<string, any>} options
2089
+ *
2090
+ * @returns
2091
+ */ function toFormData(obj, formData, options) {
2092
+ if (!utils$1.isObject(obj)) {
2093
+ throw new TypeError('target must be an object');
2094
+ }
2095
+ // eslint-disable-next-line no-param-reassign
2096
+ formData = formData || new (FormData$2 || FormData)();
2097
+ // eslint-disable-next-line no-param-reassign
2098
+ options = utils$1.toFlatObject(options, {
2099
+ metaTokens: true,
2100
+ dots: false,
2101
+ indexes: false
2102
+ }, false, function defined(option, source) {
2103
+ // eslint-disable-next-line no-eq-null,eqeqeq
2104
+ return !utils$1.isUndefined(source[option]);
2105
+ });
2106
+ const metaTokens = options.metaTokens;
2107
+ // eslint-disable-next-line no-use-before-define
2108
+ const visitor = options.visitor || defaultVisitor;
2109
+ const dots = options.dots;
2110
+ const indexes = options.indexes;
2111
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2112
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2113
+ if (!utils$1.isFunction(visitor)) {
2114
+ throw new TypeError('visitor must be a function');
2115
+ }
2116
+ function convertValue(value) {
2117
+ if (value === null) return '';
2118
+ if (utils$1.isDate(value)) {
2119
+ return value.toISOString();
2120
+ }
2121
+ if (!useBlob && utils$1.isBlob(value)) {
2122
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
2123
+ }
2124
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2125
+ return useBlob && typeof Blob === 'function' ? new Blob([
2126
+ value
2127
+ ]) : Buffer.from(value);
2128
+ }
2129
+ return value;
2130
+ }
2131
+ /**
2132
+ * Default visitor.
2133
+ *
2134
+ * @param {*} value
2135
+ * @param {String|Number} key
2136
+ * @param {Array<String|Number>} path
2137
+ * @this {FormData}
2138
+ *
2139
+ * @returns {boolean} return true to visit the each prop of the value recursively
2140
+ */ function defaultVisitor(value, key, path) {
2141
+ let arr = value;
2142
+ if (value && !path && typeof value === 'object') {
2143
+ if (utils$1.endsWith(key, '{}')) {
2144
+ // eslint-disable-next-line no-param-reassign
2145
+ key = metaTokens ? key : key.slice(0, -2);
2146
+ // eslint-disable-next-line no-param-reassign
2147
+ value = JSON.stringify(value);
2148
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2149
+ // eslint-disable-next-line no-param-reassign
2150
+ key = removeBrackets(key);
2151
+ arr.forEach(function each(el, index) {
2152
+ !(utils$1.isUndefined(el) || el === null) && formData.append(// eslint-disable-next-line no-nested-ternary
2153
+ indexes === true ? renderKey([
2154
+ key
2155
+ ], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2156
+ });
2157
+ return false;
2158
+ }
2159
+ }
2160
+ if (isVisitable(value)) {
2161
+ return true;
2162
+ }
2163
+ formData.append(renderKey(path, key, dots), convertValue(value));
2164
+ return false;
2165
+ }
2166
+ const stack = [];
2167
+ const exposedHelpers = Object.assign(predicates, {
2168
+ defaultVisitor,
2169
+ convertValue,
2170
+ isVisitable
2171
+ });
2172
+ function build(value, path) {
2173
+ if (utils$1.isUndefined(value)) return;
2174
+ if (stack.indexOf(value) !== -1) {
2175
+ throw Error('Circular reference detected in ' + path.join('.'));
2176
+ }
2177
+ stack.push(value);
2178
+ utils$1.forEach(value, function each(el, key) {
2179
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
2180
+ if (result === true) {
2181
+ build(el, path ? path.concat(key) : [
2182
+ key
2183
+ ]);
2184
+ }
2185
+ });
2186
+ stack.pop();
2187
+ }
2188
+ if (!utils$1.isObject(obj)) {
2189
+ throw new TypeError('data must be an object');
2190
+ }
2191
+ build(obj);
2192
+ return formData;
2193
+ }
2194
+
2195
+ /**
2196
+ * It encodes a string by replacing all characters that are not in the unreserved set with
2197
+ * their percent-encoded equivalents
2198
+ *
2199
+ * @param {string} str - The string to encode.
2200
+ *
2201
+ * @returns {string} The encoded string.
2202
+ */ function encode(str) {
2203
+ const charMap = {
2204
+ '!': '%21',
2205
+ "'": '%27',
2206
+ '(': '%28',
2207
+ ')': '%29',
2208
+ '~': '%7E',
2209
+ '%20': '+',
2210
+ '%00': '\x00'
2211
+ };
2212
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
2213
+ return charMap[match];
2214
+ });
2215
+ }
2216
+ /**
2217
+ * It takes a params object and converts it to a FormData object
2218
+ *
2219
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2220
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2221
+ *
2222
+ * @returns {void}
2223
+ */ function AxiosURLSearchParams(params, options) {
2224
+ this._pairs = [];
2225
+ params && toFormData(params, this, options);
2226
+ }
2227
+ const prototype = AxiosURLSearchParams.prototype;
2228
+ prototype.append = function append(name, value) {
2229
+ this._pairs.push([
2230
+ name,
2231
+ value
2232
+ ]);
2233
+ };
2234
+ prototype.toString = function toString(encoder) {
2235
+ const _encode = encoder ? function(value) {
2236
+ return encoder.call(this, value, encode);
2237
+ } : encode;
2238
+ return this._pairs.map(function each(pair) {
2239
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
2240
+ }, '').join('&');
2241
+ };
2242
+
2243
+ const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2244
+
2245
+ const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2246
+
2247
+ const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2248
+
2249
+ const platform$1 = {
2250
+ isBrowser: true,
2251
+ classes: {
2252
+ URLSearchParams: URLSearchParams$1,
2253
+ FormData: FormData$1,
2254
+ Blob: Blob$1
2255
+ },
2256
+ protocols: [
2257
+ 'http',
2258
+ 'https',
2259
+ 'file',
2260
+ 'blob',
2261
+ 'url',
2262
+ 'data'
2263
+ ]
2264
+ };
2265
+
2266
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2267
+
2268
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
2269
+
2270
+ /**
2271
+ * Determine if we're running in a standard browser environment
2272
+ *
2273
+ * This allows axios to run in a web worker, and react-native.
2274
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2275
+ *
2276
+ * web workers:
2277
+ * typeof window -> undefined
2278
+ * typeof document -> undefined
2279
+ *
2280
+ * react-native:
2281
+ * navigator.product -> 'ReactNative'
2282
+ * nativescript
2283
+ * navigator.product -> 'NativeScript' or 'NS'
2284
+ *
2285
+ * @returns {boolean}
2286
+ */
2287
+ const hasStandardBrowserEnv = hasBrowserEnv &&
2288
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2289
+
2290
+ /**
2291
+ * Determine if we're running in a standard browser webWorker environment
2292
+ *
2293
+ * Although the `isStandardBrowserEnv` method indicates that
2294
+ * `allows axios to run in a web worker`, the WebWorker will still be
2295
+ * filtered out due to its judgment standard
2296
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2297
+ * This leads to a problem when axios post `FormData` in webWorker
2298
+ */
2299
+ const hasStandardBrowserWebWorkerEnv = (() => {
2300
+ return (
2301
+ typeof WorkerGlobalScope !== 'undefined' &&
2302
+ // eslint-disable-next-line no-undef
2303
+ self instanceof WorkerGlobalScope &&
2304
+ typeof self.importScripts === 'function'
2305
+ );
2306
+ })();
2307
+
2308
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
2309
+
2310
+ const utils = /*#__PURE__*/Object.freeze({
2311
+ __proto__: null,
2312
+ hasBrowserEnv: hasBrowserEnv,
2313
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2314
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2315
+ navigator: _navigator,
2316
+ origin: origin
2317
+ });
2318
+
2319
+ const platform = {
2320
+ ...utils,
2321
+ ...platform$1
2322
+ };
2323
+
2324
+ function toURLEncodedForm(data, options) {
2325
+ return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
2326
+ visitor: function(value, key, path, helpers) {
2327
+ if (platform.isNode && utils$2.isBuffer(value)) {
2328
+ this.append(key, value.toString('base64'));
2329
+ return false;
2330
+ }
2331
+
2332
+ return helpers.defaultVisitor.apply(this, arguments);
2333
+ }
2334
+ }, options));
2335
+ }
2336
+
2337
+ /**
2338
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2339
+ *
2340
+ * @param {string} name - The name of the property to get.
2341
+ *
2342
+ * @returns An array of strings.
2343
+ */
2344
+ function parsePropPath(name) {
2345
+ // foo[x][y][z]
2346
+ // foo.x.y.z
2347
+ // foo-x-y-z
2348
+ // foo x y z
2349
+ return utils$2.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
2350
+ return match[0] === '[]' ? '' : match[1] || match[0];
2351
+ });
2352
+ }
2353
+
2354
+ /**
2355
+ * Convert an array to an object.
2356
+ *
2357
+ * @param {Array<any>} arr - The array to convert to an object.
2358
+ *
2359
+ * @returns An object with the same keys and values as the array.
2360
+ */
2361
+ function arrayToObject(arr) {
2362
+ const obj = {};
2363
+ const keys = Object.keys(arr);
2364
+ let i;
2365
+ const len = keys.length;
2366
+ let key;
2367
+ for (i = 0; i < len; i++) {
2368
+ key = keys[i];
2369
+ obj[key] = arr[key];
2370
+ }
2371
+ return obj;
2372
+ }
2373
+
2374
+ /**
2375
+ * It takes a FormData object and returns a JavaScript object
2376
+ *
2377
+ * @param {string} formData The FormData object to convert to JSON.
2378
+ *
2379
+ * @returns {Object<string, any> | null} The converted object.
2380
+ */
2381
+ function formDataToJSON(formData) {
2382
+ function buildPath(path, value, target, index) {
2383
+ let name = path[index++];
2384
+
2385
+ if (name === '__proto__') return true;
2386
+
2387
+ const isNumericKey = Number.isFinite(+name);
2388
+ const isLast = index >= path.length;
2389
+ name = !name && utils$2.isArray(target) ? target.length : name;
2390
+
2391
+ if (isLast) {
2392
+ if (utils$2.hasOwnProp(target, name)) {
2393
+ target[name] = [target[name], value];
2394
+ } else {
2395
+ target[name] = value;
2396
+ }
2397
+
2398
+ return !isNumericKey;
2399
+ }
2400
+
2401
+ if (!target[name] || !utils$2.isObject(target[name])) {
2402
+ target[name] = [];
2403
+ }
2404
+
2405
+ const result = buildPath(path, value, target[name], index);
2406
+
2407
+ if (result && utils$2.isArray(target[name])) {
2408
+ target[name] = arrayToObject(target[name]);
2409
+ }
2410
+
2411
+ return !isNumericKey;
2412
+ }
2413
+
2414
+ if (utils$2.isFormData(formData) && utils$2.isFunction(formData.entries)) {
2415
+ const obj = {};
2416
+
2417
+ utils$2.forEachEntry(formData, (name, value) => {
2418
+ buildPath(parsePropPath(name), value, obj, 0);
2419
+ });
2420
+
2421
+ return obj;
2422
+ }
2423
+
2424
+ return null;
2425
+ }
2426
+
2427
+ /**
2428
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2429
+ * of the input
2430
+ *
2431
+ * @param {any} rawValue - The value to be stringified.
2432
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
2433
+ * @param {Function} encoder - A function that takes a value and returns a string.
2434
+ *
2435
+ * @returns {string} A stringified version of the rawValue.
2436
+ */
2437
+ function stringifySafely(rawValue, parser, encoder) {
2438
+ if (utils$2.isString(rawValue)) {
2439
+ try {
2440
+ (parser || JSON.parse)(rawValue);
2441
+ return utils$2.trim(rawValue);
2442
+ } catch (e) {
2443
+ if (e.name !== 'SyntaxError') {
2444
+ throw e;
2445
+ }
2446
+ }
2447
+ }
2448
+
2449
+ return (encoder || JSON.stringify)(rawValue);
2450
+ }
2451
+
2452
+ const defaults = {
2453
+
2454
+ transitional: transitionalDefaults,
2455
+
2456
+ adapter: ['xhr', 'http', 'fetch'],
2457
+
2458
+ transformRequest: [function transformRequest(data, headers) {
2459
+ const contentType = headers.getContentType() || '';
2460
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
2461
+ const isObjectPayload = utils$2.isObject(data);
2462
+
2463
+ if (isObjectPayload && utils$2.isHTMLForm(data)) {
2464
+ data = new FormData(data);
2465
+ }
2466
+
2467
+ const isFormData = utils$2.isFormData(data);
2468
+
2469
+ if (isFormData) {
2470
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2471
+ }
2472
+
2473
+ if (utils$2.isArrayBuffer(data) ||
2474
+ utils$2.isBuffer(data) ||
2475
+ utils$2.isStream(data) ||
2476
+ utils$2.isFile(data) ||
2477
+ utils$2.isBlob(data) ||
2478
+ utils$2.isReadableStream(data)
2479
+ ) {
2480
+ return data;
2481
+ }
2482
+ if (utils$2.isArrayBufferView(data)) {
2483
+ return data.buffer;
2484
+ }
2485
+ if (utils$2.isURLSearchParams(data)) {
2486
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2487
+ return data.toString();
2488
+ }
2489
+
2490
+ let isFileList;
2491
+
2492
+ if (isObjectPayload) {
2493
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2494
+ return toURLEncodedForm(data, this.formSerializer).toString();
2495
+ }
2496
+
2497
+ if ((isFileList = utils$2.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2498
+ const _FormData = this.env && this.env.FormData;
2499
+
2500
+ return toFormData$1(
2501
+ isFileList ? {'files[]': data} : data,
2502
+ _FormData && new _FormData(),
2503
+ this.formSerializer
2504
+ );
2505
+ }
2506
+ }
2507
+
2508
+ if (isObjectPayload || hasJSONContentType) {
2509
+ headers.setContentType('application/json', false);
2510
+ return stringifySafely(data);
2511
+ }
2512
+
2513
+ return data;
2514
+ }],
2515
+
2516
+ transformResponse: [function transformResponse(data) {
2517
+ const transitional = this.transitional || defaults.transitional;
2518
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2519
+ const JSONRequested = this.responseType === 'json';
2520
+
2521
+ if (utils$2.isResponse(data) || utils$2.isReadableStream(data)) {
2522
+ return data;
2523
+ }
2524
+
2525
+ if (data && utils$2.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
2526
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
2527
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
2528
+
2529
+ try {
2530
+ return JSON.parse(data);
2531
+ } catch (e) {
2532
+ if (strictJSONParsing) {
2533
+ if (e.name === 'SyntaxError') {
2534
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2535
+ }
2536
+ throw e;
2537
+ }
2538
+ }
2539
+ }
2540
+
2541
+ return data;
2542
+ }],
2543
+
2544
+ /**
2545
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
2546
+ * timeout is not created.
2547
+ */
2548
+ timeout: 0,
2549
+
2550
+ xsrfCookieName: 'XSRF-TOKEN',
2551
+ xsrfHeaderName: 'X-XSRF-TOKEN',
2552
+
2553
+ maxContentLength: -1,
2554
+ maxBodyLength: -1,
2555
+
2556
+ env: {
2557
+ FormData: platform.classes.FormData,
2558
+ Blob: platform.classes.Blob
2559
+ },
2560
+
2561
+ validateStatus: function validateStatus(status) {
2562
+ return status >= 200 && status < 300;
2563
+ },
2564
+
2565
+ headers: {
2566
+ common: {
2567
+ 'Accept': 'application/json, text/plain, */*',
2568
+ 'Content-Type': undefined
2569
+ }
2570
+ }
2571
+ };
2572
+
2573
+ utils$2.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
2574
+ defaults.headers[method] = {};
2575
+ });
2576
+
2577
+ const defaults$1 = defaults;
2578
+
2579
+ // RawAxiosHeaders whose duplicates are ignored by node
2580
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
2581
+ const ignoreDuplicateOf = utils$2.toObjectSet([
2582
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
2583
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
2584
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
2585
+ 'referer', 'retry-after', 'user-agent'
2586
+ ]);
2587
+
2588
+ /**
2589
+ * Parse headers into an object
2590
+ *
2591
+ * ```
2592
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
2593
+ * Content-Type: application/json
2594
+ * Connection: keep-alive
2595
+ * Transfer-Encoding: chunked
2596
+ * ```
2597
+ *
2598
+ * @param {String} rawHeaders Headers needing to be parsed
2599
+ *
2600
+ * @returns {Object} Headers parsed into an object
2601
+ */
2602
+ const parseHeaders = rawHeaders => {
2603
+ const parsed = {};
2604
+ let key;
2605
+ let val;
2606
+ let i;
2607
+
2608
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2609
+ i = line.indexOf(':');
2610
+ key = line.substring(0, i).trim().toLowerCase();
2611
+ val = line.substring(i + 1).trim();
2612
+
2613
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
2614
+ return;
2615
+ }
2616
+
2617
+ if (key === 'set-cookie') {
2618
+ if (parsed[key]) {
2619
+ parsed[key].push(val);
2620
+ } else {
2621
+ parsed[key] = [val];
2622
+ }
2623
+ } else {
2624
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2625
+ }
2626
+ });
2627
+
2628
+ return parsed;
2629
+ };
2630
+
2631
+ const $internals = Symbol('internals');
2632
+
2633
+ function normalizeHeader(header) {
2634
+ return header && String(header).trim().toLowerCase();
2635
+ }
2636
+
2637
+ function normalizeValue(value) {
2638
+ if (value === false || value == null) {
2639
+ return value;
2640
+ }
2641
+
2642
+ return utils$2.isArray(value) ? value.map(normalizeValue) : String(value);
2643
+ }
2644
+
2645
+ function parseTokens(str) {
2646
+ const tokens = Object.create(null);
2647
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2648
+ let match;
2649
+
2650
+ while ((match = tokensRE.exec(str))) {
2651
+ tokens[match[1]] = match[2];
2652
+ }
2653
+
2654
+ return tokens;
2655
+ }
2656
+
2657
+ const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2658
+
2659
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2660
+ if (utils$2.isFunction(filter)) {
2661
+ return filter.call(this, value, header);
2662
+ }
2663
+
2664
+ if (isHeaderNameFilter) {
2665
+ value = header;
2666
+ }
2667
+
2668
+ if (!utils$2.isString(value)) return;
2669
+
2670
+ if (utils$2.isString(filter)) {
2671
+ return value.indexOf(filter) !== -1;
2672
+ }
2673
+
2674
+ if (utils$2.isRegExp(filter)) {
2675
+ return filter.test(value);
2676
+ }
2677
+ }
2678
+
2679
+ function formatHeader(header) {
2680
+ return header
2681
+ .trim()
2682
+ .toLowerCase()
2683
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2684
+ return char.toUpperCase() + str;
2685
+ });
2686
+ }
2687
+
2688
+ function buildAccessors(obj, header) {
2689
+ const accessorName = utils$2.toCamelCase(' ' + header);
2690
+ ['get', 'set', 'has'].forEach(methodName => {
2691
+ Object.defineProperty(obj, methodName + accessorName, {
2692
+ value: function (arg1, arg2, arg3) {
2693
+ return this[methodName].call(this, header, arg1, arg2, arg3);
2694
+ },
2695
+ configurable: true,
2696
+ });
2697
+ });
2698
+ }
2699
+
2700
+ class AxiosHeaders {
2701
+ constructor(headers) {
2702
+ headers && this.set(headers);
2703
+ }
2704
+
2705
+ /**
2706
+ *
2707
+ * @param {*} header
2708
+ * @param {*} valueOrRewrite
2709
+ * @param {*} rewrite true:无论源值是否存在均赋值,false:源值如存在不覆盖,
2710
+ * undefined:源值不为 false 直接赋值,false 不赋值
2711
+ * @returns
2712
+ */
2713
+ set(header, valueOrRewrite, rewrite) {
2714
+ const self = this;
2715
+
2716
+ function setHeader(_value, _header, _rewrite) {
2717
+ const lHeader = normalizeHeader(_header);
2718
+
2719
+ if (!lHeader) {
2720
+ throw new Error('header name must be a non-empty string');
2721
+ }
2722
+
2723
+ const key = utils$2.findKey(self, lHeader);
2724
+
2725
+ if (!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
2726
+ self[key || _header] = normalizeValue(_value);
2727
+ }
2728
+ }
2729
+
2730
+ const setHeaders = (headers, _rewrite) =>
2731
+ utils$2.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
2732
+
2733
+ if (utils$2.isPlainObject(header) || header instanceof this.constructor) {
2734
+ setHeaders(header, valueOrRewrite);
2735
+ } else if (utils$2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2736
+ setHeaders(parseHeaders(header), valueOrRewrite);
2737
+ } else if (utils$2.isHeaders(header)) {
2738
+ for (const [key, value] of header.entries()) {
2739
+ setHeader(value, key, rewrite);
2740
+ }
2741
+ } else {
2742
+ header != null && setHeader(valueOrRewrite, header, rewrite);
2743
+ }
2744
+
2745
+ return this;
2746
+ }
2747
+
2748
+ get(header, parser) {
2749
+ header = normalizeHeader(header);
2750
+
2751
+ if (header) {
2752
+ const key = utils$2.findKey(this, header);
2753
+
2754
+ if (key) {
2755
+ const value = this[key];
2756
+
2757
+ if (!parser) {
2758
+ return value;
2759
+ }
2760
+
2761
+ if (parser === true) {
2762
+ return parseTokens(value);
2763
+ }
2764
+
2765
+ if (utils$2.isFunction(parser)) {
2766
+ return parser.call(this, value, key);
2767
+ }
2768
+
2769
+ if (utils$2.isRegExp(parser)) {
2770
+ return parser.exec(value);
2771
+ }
2772
+
2773
+ throw new TypeError('parser must be boolean|regexp|function');
2774
+ }
2775
+ }
2776
+ }
2777
+
2778
+ has(header, matcher) {
2779
+ header = normalizeHeader(header);
2780
+
2781
+ if (header) {
2782
+ const key = utils$2.findKey(this, header);
2783
+
2784
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2785
+ }
2786
+
2787
+ return false;
2788
+ }
2789
+
2790
+ delete(header, matcher) {
2791
+ const self = this;
2792
+ let deleted = false;
2793
+
2794
+ function deleteHeader(_header) {
2795
+ _header = normalizeHeader(_header);
2796
+
2797
+ if (_header) {
2798
+ const key = utils$2.findKey(self, _header);
2799
+
2800
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2801
+ delete self[key];
2802
+
2803
+ deleted = true;
2804
+ }
2805
+ }
2806
+ }
2807
+
2808
+ if (utils$2.isArray(header)) {
2809
+ header.forEach(deleteHeader);
2810
+ } else {
2811
+ deleteHeader(header);
2812
+ }
2813
+
2814
+ return deleted;
2815
+ }
2816
+
2817
+ clear(matcher) {
2818
+ const keys = Object.keys(this);
2819
+ let i = keys.length;
2820
+ let deleted = false;
2821
+
2822
+ while (i--) {
2823
+ const key = keys[i];
2824
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2825
+ delete this[key];
2826
+ deleted = true;
2827
+ }
2828
+ }
2829
+
2830
+ return deleted;
2831
+ }
2832
+
2833
+ normalize(format) {
2834
+ const self = this;
2835
+ const headers = {};
2836
+
2837
+ utils$2.forEach(this, (value, header) => {
2838
+ const key = utils$2.findKey(headers, header);
2839
+
2840
+ if (key) {
2841
+ self[key] = normalizeValue(value);
2842
+ delete self[header];
2843
+ return;
2844
+ }
2845
+
2846
+ const normalized = format ? formatHeader(header) : String(header).trim();
2847
+
2848
+ if (normalized !== header) {
2849
+ delete self[header];
2850
+ }
2851
+
2852
+ self[normalized] = normalizeValue(value);
2853
+
2854
+ headers[normalized] = true;
2855
+ });
2856
+
2857
+ return this;
2858
+ }
2859
+
2860
+ concat(...targets) {
2861
+ return this.constructor.concat(this, ...targets);
2862
+ }
2863
+
2864
+ toJSON(asStrings) {
2865
+ const obj = Object.create(null);
2866
+
2867
+ utils$2.forEach(this, (value, header) => {
2868
+ value != null && value !== false && (obj[header] = asStrings && utils$2.isArray(value) ? value.join(', ') : value);
2869
+ });
2870
+
2871
+ return obj;
2872
+ }
2873
+
2874
+ [Symbol.iterator]() {
2875
+ return Object.entries(this.toJSON())[Symbol.iterator]();
2876
+ }
2877
+
2878
+ toString() {
2879
+ return Object.entries(this.toJSON())
2880
+ .map(([header, value]) => header + ': ' + value)
2881
+ .join('\n');
2882
+ }
2883
+
2884
+ get [Symbol.toStringTag]() {
2885
+ return 'AxiosHeaders';
2886
+ }
2887
+
2888
+ static from(thing) {
2889
+ return thing instanceof this ? thing : new this(thing);
2890
+ }
2891
+
2892
+ static concat(first, ...targets) {
2893
+ const computed = new this(first);
2894
+
2895
+ targets.forEach(target => computed.set(target));
2896
+
2897
+ return computed;
2898
+ }
2899
+
2900
+ static accessor(header) {
2901
+ const internals =
2902
+ (this[$internals] =
2903
+ this[$internals] =
2904
+ {
2905
+ accessors: {},
2906
+ });
2907
+
2908
+ const accessors = internals.accessors;
2909
+ const prototype = this.prototype;
2910
+
2911
+ function defineAccessor(_header) {
2912
+ const lHeader = normalizeHeader(_header);
2913
+
2914
+ if (!accessors[lHeader]) {
2915
+ buildAccessors(prototype, _header);
2916
+ accessors[lHeader] = true;
2917
+ }
2918
+ }
2919
+
2920
+ utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2921
+
2922
+ return this;
2923
+ }
2924
+ }
2925
+
2926
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2927
+
2928
+ // reserved names hotfix
2929
+ utils$2.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
2930
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2931
+ return {
2932
+ get: () => value,
2933
+ set(headerValue) {
2934
+ this[mapped] = headerValue;
2935
+ },
2936
+ };
2937
+ });
2938
+
2939
+ utils$2.freezeMethods(AxiosHeaders);
2940
+
2941
+ const AxiosHeaders$1 = AxiosHeaders;
2942
+
2943
+ /**
2944
+ * Transform the data for a request or a response
2945
+ *
2946
+ * @param {Array|Function} fns A single function or Array of functions
2947
+ * @param {?Object} response The response object
2948
+ *
2949
+ * @returns {*} The resulting transformed data
2950
+ */
2951
+ function transformData(fns, response) {
2952
+ const config = this || defaults$1;
2953
+ const context = response || config;
2954
+ const headers = AxiosHeaders$1.from(context.headers);
2955
+ let data = context.data;
2956
+
2957
+ utils$2.forEach(fns, function transform(fn) {
2958
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2959
+ });
2960
+
2961
+ headers.normalize();
2962
+
2963
+ return data;
2964
+ }
2965
+
2966
+ function isCancel(value) {
2967
+ return !!(value && value.__CANCEL__);
2968
+ }
2969
+
2970
+ /**
2971
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
2972
+ *
2973
+ * @param {string=} message The message.
2974
+ * @param {Object=} config The config.
2975
+ * @param {Object=} request The request.
2976
+ *
2977
+ * @returns {CanceledError} The created error.
2978
+ */
2979
+ function CanceledError(message, config, request) {
2980
+ // eslint-disable-next-line no-eq-null,eqeqeq
2981
+ AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
2982
+ this.name = 'CanceledError';
2983
+ }
2984
+
2985
+ utils$2.inherits(CanceledError, AxiosError$1, {
2986
+ __CANCEL__: true
2987
+ });
2988
+
2989
+ /**
2990
+ * Determines whether the specified URL is absolute
2991
+ *
2992
+ * @param {string} url The URL to test
2993
+ *
2994
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2995
+ */
2996
+ function isAbsoluteURL(url) {
2997
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2998
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2999
+ // by any combination of letters, digits, plus, period, or hyphen.
3000
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3001
+ }
3002
+
3003
+ /**
3004
+ * Creates a new URL by combining the specified URLs
3005
+ *
3006
+ * @param {string} baseURL The base URL
3007
+ * @param {string} relativeURL The relative URL
3008
+ *
3009
+ * @returns {string} The combined URL
3010
+ */
3011
+ function combineURLs(baseURL, relativeURL) {
3012
+ return relativeURL
3013
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3014
+ : baseURL;
3015
+ }
3016
+
3017
+ /**
3018
+ * Creates a new URL by combining the baseURL with the requestedURL,
3019
+ * only when the requestedURL is not already an absolute URL.
3020
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
3021
+ *
3022
+ * @param {string} baseURL The base URL
3023
+ * @param {string} requestedURL Absolute or relative URL to combine
3024
+ *
3025
+ * @returns {string} The combined full path
3026
+ */
3027
+ function buildFullPath(baseURL, requestedURL) {
3028
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
3029
+ return combineURLs(baseURL, requestedURL);
3030
+ }
3031
+ return requestedURL;
3032
+ }
3033
+
3034
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3035
+ class XhrAdapter {
3036
+ constructor(config) {
3037
+ this.init(config);
3038
+ }
3039
+
3040
+ init(config) {}
3041
+
3042
+ request() {}
3043
+
3044
+ stream() {}
3045
+ }
3046
+
3047
+ const XhrAdapter$1 = isXHRAdapterSupported && XhrAdapter;
3048
+
3049
+ const knownAdapters = {
3050
+ http: HttpAdapter, // browser mode: httpAdapter === null
3051
+ xhr: XhrAdapter$1, // node mode: xhrAdapter === null
3052
+ };
3053
+
3054
+ /**
3055
+ * define adapter's name and adapterName to http or xhr
3056
+ * browser: httpAdapter is null!
3057
+ */
3058
+ utils$2.forEach(knownAdapters, (val, key) => {
3059
+ if (val) {
3060
+ try {
3061
+ Object.defineProperty(val, 'name', {value: key});
3062
+ } catch (e) {
3063
+ // eslint-disable-next-line no-empty
3064
+ }
3065
+ Object.defineProperty(val, 'adapterName', {value: key});
3066
+ }
3067
+ });
3068
+
3069
+ const adapters = {
3070
+ /**
3071
+ * get http or xhr adapter
3072
+ * @param {*} adapters user pass or ['xhr', 'http']
3073
+ * @returns
3074
+ */
3075
+ getAdapter: adapters => {
3076
+ adapters = utils$2.isArray(adapters) ? adapters : [adapters];
3077
+
3078
+ const {length} = adapters;
3079
+ let nameOrAdapter;
3080
+ let adapter;
3081
+
3082
+ // find not null adapter
3083
+ for (let i = 0; i < length; i++) {
3084
+ nameOrAdapter = adapters[i];
3085
+ if (
3086
+ (adapter = utils$2.isString(nameOrAdapter)
3087
+ ? knownAdapters[nameOrAdapter.toLowerCase()]
3088
+ : nameOrAdapter)
3089
+ ) {
3090
+ break;
3091
+ }
3092
+ }
3093
+
3094
+ if (!adapter) {
3095
+ if (adapter === false) {
3096
+ throw new AxiosError$1(
3097
+ `Adapter ${nameOrAdapter} is not supported by the environment`,
3098
+ 'ERR_NOT_SUPPORT'
3099
+ );
3100
+ }
3101
+
3102
+ throw new Error(
3103
+ utils$2.hasOwnProp(knownAdapters, nameOrAdapter)
3104
+ ? `Adapter '${nameOrAdapter}' is not available in the build`
3105
+ : `Unknown adapter '${nameOrAdapter}'`
3106
+ );
3107
+ }
3108
+
3109
+ if (!utils$2.isFunction(adapter)) {
3110
+ throw new TypeError('adapter is not a function');
3111
+ }
3112
+
3113
+ return adapter;
3114
+ },
3115
+ adapters: knownAdapters,
3116
+ };
3117
+
3118
+ /**
3119
+ * Throws a `CanceledError` if cancellation has been requested.
3120
+ *
3121
+ * @param {Object} config The config that is to be used for the request
3122
+ *
3123
+ * @returns {void}
3124
+ */
3125
+ function throwIfCancellationRequested(config) {
3126
+ if (config.cancelToken) {
3127
+ config.cancelToken.throwIfRequested();
3128
+ }
3129
+
3130
+ if (config.signal && config.signal.aborted) {
3131
+ throw new CanceledError(null, config)
3132
+ }
3133
+ }
3134
+
3135
+ /**
3136
+ * Dispatch a request to the server using the configured adapter.
3137
+ * 请求如有异常,需向外抛出异常,不拦截
3138
+ * @param {object} config The config that is to be used for the request
3139
+ *
3140
+ * @returns {Promise<*>} The Promise to be fulfilled
3141
+ */
3142
+ function dispatchRequest(config) {
3143
+ let R;
3144
+ throwIfCancellationRequested(config);
3145
+
3146
+ config.headers = AxiosHeaders$1.from(config.headers);
3147
+
3148
+ // Transform request data
3149
+ config.data = transformData.call(config, config.transformRequest);
3150
+
3151
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3152
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
3153
+ }
3154
+
3155
+ const Adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3156
+ const adapter = new Adapter(config);
3157
+
3158
+ if (config.stream) R = adapter.request(this);
3159
+ else {
3160
+ R = adapter.request(this).then(
3161
+ response => {
3162
+ throwIfCancellationRequested(config);
3163
+
3164
+ // Transform response data
3165
+ response.data = transformData.call(config, config.transformResponse, response);
3166
+ // ! body === data
3167
+ Object.defineProperty(response, 'body', {
3168
+ get() {
3169
+ return response.data
3170
+ },
3171
+ });
3172
+ // if (response.data && !response.body) response.body = response.data
3173
+
3174
+ response.headers = AxiosHeaders$1.from(response.headers);
3175
+
3176
+ return response
3177
+ },
3178
+ reason => {
3179
+ if (!isCancel(reason)) {
3180
+ throwIfCancellationRequested(config);
3181
+
3182
+ // Transform response data
3183
+ if (reason && reason.response) {
3184
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
3185
+ // body === data
3186
+ if (reason.response.data && !reason.response.body) reason.response.body = reason.response.data;
3187
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3188
+ }
3189
+ }
3190
+
3191
+ return Promise.reject(reason)
3192
+ }
3193
+ );
3194
+ }
3195
+ return R
3196
+ }
3197
+
3198
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3199
+
3200
+ /**
3201
+ * Config-specific merge-function which creates a new config-object
3202
+ * by merging two configuration objects together.
3203
+ *
3204
+ * @param {Object} config1
3205
+ * @param {Object} config2
3206
+ *
3207
+ * @returns {Object} New object resulting from merging config2 to config1
3208
+ */
3209
+ function mergeConfig(config1, config2) {
3210
+ // eslint-disable-next-line no-param-reassign
3211
+ config2 = config2 || {};
3212
+ const config = {};
3213
+
3214
+ function getMergedValue(target, source, caseless) {
3215
+ if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
3216
+ return utils$2.merge.call({caseless}, target, source);
3217
+ } else if (utils$2.isPlainObject(source)) {
3218
+ return utils$2.merge({}, source);
3219
+ } else if (utils$2.isArray(source)) {
3220
+ return source.slice();
3221
+ }
3222
+ return source;
3223
+ }
3224
+
3225
+ // eslint-disable-next-line consistent-return
3226
+ function mergeDeepProperties(a, b, caseless) {
3227
+ if (!utils$2.isUndefined(b)) {
3228
+ return getMergedValue(a, b, caseless);
3229
+ } else if (!utils$2.isUndefined(a)) {
3230
+ return getMergedValue(undefined, a, caseless);
3231
+ }
3232
+ }
3233
+
3234
+ // eslint-disable-next-line consistent-return
3235
+ function valueFromConfig2(a, b) {
3236
+ if (!utils$2.isUndefined(b)) {
3237
+ return getMergedValue(undefined, b);
3238
+ }
3239
+ }
3240
+
3241
+ // eslint-disable-next-line consistent-return
3242
+ function defaultToConfig2(a, b) {
3243
+ if (!utils$2.isUndefined(b)) {
3244
+ return getMergedValue(undefined, b);
3245
+ } else if (!utils$2.isUndefined(a)) {
3246
+ return getMergedValue(undefined, a);
3247
+ }
3248
+ }
3249
+
3250
+ // eslint-disable-next-line consistent-return
3251
+ function mergeDirectKeys(a, b, prop) {
3252
+ if (prop in config2) {
3253
+ return getMergedValue(a, b);
3254
+ } else if (prop in config1) {
3255
+ return getMergedValue(undefined, a);
3256
+ }
3257
+ }
3258
+
3259
+ const mergeMap = {
3260
+ url: valueFromConfig2,
3261
+ method: valueFromConfig2,
3262
+ data: valueFromConfig2,
3263
+ baseURL: defaultToConfig2,
3264
+ transformRequest: defaultToConfig2,
3265
+ transformResponse: defaultToConfig2,
3266
+ paramsSerializer: defaultToConfig2,
3267
+ timeout: defaultToConfig2,
3268
+ timeoutMessage: defaultToConfig2,
3269
+ withCredentials: defaultToConfig2,
3270
+ withXSRFToken: defaultToConfig2,
3271
+ adapter: defaultToConfig2,
3272
+ responseType: defaultToConfig2,
3273
+ xsrfCookieName: defaultToConfig2,
3274
+ xsrfHeaderName: defaultToConfig2,
3275
+ onUploadProgress: defaultToConfig2,
3276
+ onDownloadProgress: defaultToConfig2,
3277
+ decompress: defaultToConfig2,
3278
+ maxContentLength: defaultToConfig2,
3279
+ maxBodyLength: defaultToConfig2,
3280
+ beforeRedirect: defaultToConfig2,
3281
+ transport: defaultToConfig2,
3282
+ httpAgent: defaultToConfig2,
3283
+ httpsAgent: defaultToConfig2,
3284
+ cancelToken: defaultToConfig2,
3285
+ socketPath: defaultToConfig2,
3286
+ responseEncoding: defaultToConfig2,
3287
+ validateStatus: mergeDirectKeys,
3288
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
3289
+ };
3290
+
3291
+ utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3292
+ const merge = mergeMap[prop] || mergeDeepProperties;
3293
+ const configValue = merge(config1[prop], config2[prop], prop);
3294
+ (utils$2.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3295
+ });
3296
+
3297
+ return config;
3298
+ }
3299
+
3300
+ const VERSION = "1.7.7";
3301
+
3302
+ const validators$1 = {};
3303
+
3304
+ // eslint-disable-next-line func-names
3305
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3306
+ validators$1[type] = function validator(thing) {
3307
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3308
+ };
3309
+ });
3310
+
3311
+ const deprecatedWarnings = {};
3312
+
3313
+ /**
3314
+ * Transitional option validator
3315
+ *
3316
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
3317
+ * @param {string?} version - deprecated version / removed since version
3318
+ * @param {string?} message - some message with additional info
3319
+ *
3320
+ * @returns {function}
3321
+ */
3322
+ validators$1.transitional = function transitional(validator, version, message) {
3323
+ function formatMessage(opt, desc) {
3324
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3325
+ }
3326
+
3327
+ // eslint-disable-next-line func-names
3328
+ return (value, opt, opts) => {
3329
+ if (validator === false) {
3330
+ throw new AxiosError$1(
3331
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3332
+ AxiosError$1.ERR_DEPRECATED
3333
+ );
3334
+ }
3335
+
3336
+ if (version && !deprecatedWarnings[opt]) {
3337
+ deprecatedWarnings[opt] = true;
3338
+ // eslint-disable-next-line no-console
3339
+ console.warn(
3340
+ formatMessage(
3341
+ opt,
3342
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
3343
+ )
3344
+ );
3345
+ }
3346
+
3347
+ return validator ? validator(value, opt, opts) : true;
3348
+ };
3349
+ };
3350
+
3351
+ validators$1.spelling = function spelling(correctSpelling) {
3352
+ return (value, opt) => {
3353
+ // eslint-disable-next-line no-console
3354
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
3355
+ return true;
3356
+ }
3357
+ };
3358
+
3359
+ /**
3360
+ * Assert object's properties type
3361
+ *
3362
+ * @param {object} options
3363
+ * @param {object} schema
3364
+ * @param {boolean?} allowUnknown
3365
+ *
3366
+ * @returns {object}
3367
+ */
3368
+
3369
+ function assertOptions(options, schema, allowUnknown) {
3370
+ if (typeof options !== 'object') {
3371
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
3372
+ }
3373
+ const keys = Object.keys(options);
3374
+ let i = keys.length;
3375
+ while (i-- > 0) {
3376
+ const opt = keys[i];
3377
+ const validator = schema[opt];
3378
+ if (validator) {
3379
+ const value = options[opt];
3380
+ const result = value === undefined || validator(value, opt, options);
3381
+ if (result !== true) {
3382
+ throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3383
+ }
3384
+ continue;
3385
+ }
3386
+ if (allowUnknown !== true) {
3387
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
3388
+ }
3389
+ }
3390
+ }
3391
+
3392
+ const validator = {
3393
+ assertOptions,
3394
+ validators: validators$1
3395
+ };
3396
+
3397
+ const {validators} = validator;
3398
+
3399
+ /**
3400
+ * Create a new instance of Axios
3401
+ *
3402
+ * @param {Object} instanceConfig The default config for the instance
3403
+ *
3404
+ * @return {Axios} A new instance of Axios
3405
+ */
3406
+ class Axios {
3407
+ constructor(instanceConfig) {
3408
+ this.defaults = instanceConfig;
3409
+ this.config = this.defaults; // !+++
3410
+ this.interceptors = {
3411
+ request: new InterceptorManager$1(),
3412
+ response: new InterceptorManager$1(),
3413
+ };
3414
+
3415
+ this.init(); // !+++
3416
+ }
3417
+
3418
+ /**
3419
+ * !+++
3420
+ * config 属性直接挂在到实例上,方便读取、设置、修改
3421
+ * 需注意,不要与其属性、方法冲突!!!
3422
+ request(config)
3423
+ get(url[, config])
3424
+ delete(url[, config])
3425
+ head(url[, config])
3426
+ options(url[, config])
3427
+ post(url[, data[, config]])
3428
+ put(url[, data[, config]])
3429
+ patch(url[, data[, config]])
3430
+ getUri([config])
3431
+ */
3432
+ init() {
3433
+ const m = this
3434
+ ;[
3435
+ 'url',
3436
+ 'method',
3437
+ 'baseURL',
3438
+ 'transformRequest', // [function],
3439
+ 'transformResponse',
3440
+ 'headers', // {'X-Requested-With': 'XMLHttpRequest'},
3441
+ 'params', // {ID: 12345},
3442
+ 'paramsSerializer',
3443
+ 'body',
3444
+ 'data', // {firstName: 'Fred'}, 'Country=Brasil&City=Belo',
3445
+ 'timeout', // default is `0` (no timeout)
3446
+ 'withCredentials', // default false
3447
+ 'adapter', // func
3448
+ 'auth', // {username: 'janedoe', password: 's00pers3cret'}
3449
+ 'responseType', // default 'json'
3450
+ 'responseEncoding', // default 'utf8'
3451
+ 'xsrfCookieName', // default 'XSRF-TOKEN'
3452
+ 'xsrfHeaderName', // default 'X-XSRF-TOKEN'
3453
+ 'onUploadProgress', // func
3454
+ 'onDownloadProgress', // func
3455
+ 'maxContentLength',
3456
+ 'maxBodyLength',
3457
+ 'validateStatus', // status => status >= 200 && status < 300;
3458
+ 'maxRedirects', // default 21
3459
+ 'beforeRedirect', // (options, { headers }) => {}
3460
+ 'socketPath', // default null
3461
+ 'httpAgent', // new http.Agent({ keepAlive: true }),
3462
+ 'httpsAgent', // new https.Agent({ keepAlive: true }),
3463
+ 'agent', // {},
3464
+ 'cancelToken', // new CancelToken(function (cancel) {}),
3465
+ 'signal', // new AbortController().signal,
3466
+ 'decompress', // default true
3467
+ 'insecureHTTPParser', // default undefined
3468
+ 'transitional',
3469
+ 'env', // {FormData: window?.FormData || global?.FormData},
3470
+ 'formSerializer',
3471
+ 'maxRate', // [100 * 1024, 100 * 1024] // upload, download limit
3472
+ ].forEach(p =>
3473
+ Object.defineProperty(m, p, {
3474
+ enumerable: true,
3475
+ get() {
3476
+ return m.config[p]
3477
+ },
3478
+
3479
+ set(value) {
3480
+ m.config[p] = value;
3481
+ },
3482
+ })
3483
+ );
3484
+ }
3485
+
3486
+ /**
3487
+ * Dispatch a request
3488
+ * 启动执行请求,返回 Promise 实例
3489
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3490
+ * @param {?Object} config
3491
+ * @returns {Promise} The Promise to be fulfilled
3492
+ */
3493
+ async request(configOrUrl, config) {
3494
+ try {
3495
+ return await this._request(configOrUrl, config)
3496
+ } catch (err) {
3497
+ if (err instanceof Error) {
3498
+ let dummy = {};
3499
+
3500
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
3501
+
3502
+ // slice off the Error: ... line
3503
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3504
+ try {
3505
+ if (!err.stack) {
3506
+ err.stack = stack;
3507
+ // match without the 2 top stack lines
3508
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3509
+ err.stack += '\n' + stack;
3510
+ }
3511
+ } catch (e) {
3512
+ // ignore the case where "stack" is an un-writable property
3513
+ }
3514
+ }
3515
+
3516
+ throw err // 抛出异常
3517
+ }
3518
+ }
3519
+
3520
+ /**
3521
+ * 执行请求
3522
+ * @param {*} configOrUrl
3523
+ * @param {*} config
3524
+ * @param {boolean} [stream = false] - 是否返回 stream
3525
+ * @returns
3526
+ */
3527
+ _request(configOrUrl, config, stream = false) {
3528
+ let R = null;
3529
+
3530
+ /* eslint no-param-reassign:0 */
3531
+ // Allow for axios('example/url'[, config]) a la fetch API
3532
+ if (typeof configOrUrl === 'string') {
3533
+ config = config || {};
3534
+ config.url = configOrUrl;
3535
+ } else {
3536
+ config = configOrUrl || {};
3537
+ }
3538
+
3539
+ // ! body as data alias, body ==> data,内部保持data不变
3540
+ if (!config.data && config.body) {
3541
+ config.data = config.body;
3542
+ // config.body = undefined;
3543
+ }
3544
+
3545
+ config = mergeConfig(this.defaults, config);
3546
+
3547
+ const {transitional, paramsSerializer, headers} = config;
3548
+
3549
+ if (transitional !== undefined) {
3550
+ validator.assertOptions(
3551
+ transitional,
3552
+ {
3553
+ silentJSONParsing: validators.transitional(validators.boolean),
3554
+ forcedJSONParsing: validators.transitional(validators.boolean),
3555
+ clarifyTimeoutError: validators.transitional(validators.boolean),
3556
+ },
3557
+ false
3558
+ );
3559
+ }
3560
+
3561
+ if (paramsSerializer) {
3562
+ if (utils$2.isFunction(paramsSerializer)) {
3563
+ config.paramsSerializer = {
3564
+ serialize: paramsSerializer,
3565
+ };
3566
+ } else {
3567
+ validator.assertOptions(
3568
+ paramsSerializer,
3569
+ {
3570
+ encode: validators.function,
3571
+ serialize: validators.function,
3572
+ },
3573
+ true
3574
+ );
3575
+ }
3576
+ }
3577
+
3578
+ validator.assertOptions(
3579
+ config,
3580
+ {
3581
+ baseUrl: validators.spelling('baseURL'),
3582
+ withXsrfToken: validators.spelling('withXSRFToken'),
3583
+ },
3584
+ true
3585
+ );
3586
+
3587
+ // Set config.method
3588
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3589
+
3590
+ // Flatten headers,方法头覆盖通用头
3591
+ const contextHeaders = headers && utils$2.merge(headers.common, headers[config.method]);
3592
+
3593
+ headers &&
3594
+ utils$2.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], method => {
3595
+ delete headers[method];
3596
+ });
3597
+
3598
+ // 源值存在,则不覆盖,contextHeaders 优先于 headers
3599
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3600
+
3601
+ // filter out skipped interceptors
3602
+ const requestInterceptorChain = []; // 请求拦截器,hook
3603
+ let synchronousRequestInterceptors = true;
3604
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3605
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3606
+ return
3607
+ }
3608
+
3609
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3610
+
3611
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3612
+ });
3613
+
3614
+ const responseInterceptorChain = []; // 响应拦截器,hook
3615
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3616
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3617
+ });
3618
+
3619
+ let promise;
3620
+ let i = 0;
3621
+ let len;
3622
+ debugger
3623
+ // 执行dispatchRequest
3624
+ // !+++ stream
3625
+ if (stream) {
3626
+ config.stream = true;
3627
+ R = dispatchRequest.call(this, config); // not promise
3628
+ } else if (!synchronousRequestInterceptors) {
3629
+ // 异步拦截器
3630
+ const chain = [dispatchRequest.bind(this), undefined]; // dispatchRequest 放入运行链
3631
+ chain.unshift(...requestInterceptorChain); // !*** 插入头
3632
+ chain.push(...responseInterceptorChain); // !*** 加入尾
3633
+ len = chain.length;
3634
+
3635
+ promise = Promise.resolve(config); // promise 对象
3636
+
3637
+ // 传入config配置,按顺序执行
3638
+ while (i < len) promise = promise.then(chain[i++], chain[i++]);
3639
+
3640
+ R = promise;
3641
+ } else {
3642
+ // 同步拦截器
3643
+ len = requestInterceptorChain.length;
3644
+ let newConfig = config;
3645
+ i = 0;
3646
+
3647
+ // 按加入顺序运行 request 拦截器
3648
+ while (i < len) {
3649
+ const onFulfilled = requestInterceptorChain[i++];
3650
+ const onRejected = requestInterceptorChain[i++];
3651
+ try {
3652
+ newConfig = onFulfilled(newConfig); // 执行
3653
+ } catch (error) {
3654
+ onRejected.call(this, error);
3655
+ break
3656
+ }
3657
+ }
3658
+
3659
+ try {
3660
+ promise = dispatchRequest.call(this, newConfig);
3661
+ i = 0;
3662
+ len = responseInterceptorChain.length;
3663
+
3664
+ // 按顺序执行响应 hook
3665
+ while (i < len) promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3666
+
3667
+ R = promise;
3668
+ } catch (error) {
3669
+ R = Promise.reject(error);
3670
+ }
3671
+ }
3672
+
3673
+ return R
3674
+ }
3675
+
3676
+ /**
3677
+ * !+++
3678
+ * 类似 request 库,返回 stream
3679
+ * stream 模式下,拦截器无效
3680
+ * 如需拦截器,请使用 responseType: 'stream',data 为 stream 传出
3681
+ * 或者 将 stream 作为 data 传入
3682
+ * @param {*} configOrUrl
3683
+ * @param {*} config
3684
+ * @returns
3685
+ */
3686
+ stream(configOrUrl, config) {
3687
+ return this._request(configOrUrl, config, true)
3688
+ }
3689
+
3690
+ /**
3691
+ *
3692
+ * @param {*} config
3693
+ * @returns
3694
+ */
3695
+ getUri(config) {
3696
+ config = mergeConfig(this.defaults, config);
3697
+ const fullPath = buildFullPath(config.baseURL, config.url);
3698
+ return buildURL(fullPath, config.params, config.paramsSerializer)
3699
+ }
3700
+ }
3701
+
3702
+ // Provide aliases for supported request methods
3703
+ utils$2.forEach(['head', 'options'], function forEachMethodNoData(method) {
3704
+ /* eslint func-names:0 */
3705
+ Axios.prototype[method] = function (url, config) {
3706
+ return this.request(
3707
+ mergeConfig(config || {}, {
3708
+ method,
3709
+ url,
3710
+ data: (config || {}).data,
3711
+ })
3712
+ )
3713
+ };
3714
+ });
3715
+
3716
+ // delete、get, 与 axios不同,第二个参数为 params,而不是 data
3717
+ utils$2.forEach(['delete', 'get'], function forEachMethodNoData(method) {
3718
+ Axios.prototype[method] = function (url, params, config) {
3719
+ return this.request(
3720
+ mergeConfig(config || {}, {
3721
+ method,
3722
+ url,
3723
+ params,
3724
+ })
3725
+ )
3726
+ };
3727
+ });
3728
+
3729
+ utils$2.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3730
+ function generateHTTPMethod(isForm) {
3731
+ return function httpMethod(url, data, config) {
3732
+ return this.request(
3733
+ mergeConfig(config || {}, {
3734
+ method,
3735
+ headers: isForm
3736
+ ? {
3737
+ 'Content-Type': 'multipart/form-data',
3738
+ }
3739
+ : {},
3740
+ url,
3741
+ data,
3742
+ })
3743
+ )
3744
+ }
3745
+ }
3746
+
3747
+ Axios.prototype[method] = generateHTTPMethod();
3748
+
3749
+ Axios.prototype[`${method}Form`] = generateHTTPMethod(true);
3750
+ });
3751
+
3752
+ // stream get, 与 axios不同,第二个参数为 params,而不是 data
3753
+ utils$2.forEach(['gets'], function forEachMethodNoData(method) {
3754
+ Axios.prototype[method] = function (url, params, config) {
3755
+ return this.stream(
3756
+ mergeConfig(config || {}, {
3757
+ method,
3758
+ url,
3759
+ params,
3760
+ data: (config || {}).data,
3761
+ })
3762
+ )
3763
+ };
3764
+ });
3765
+
3766
+ // stream post put patch
3767
+ utils$2.forEach(['posts', 'puts', 'patchs'], function forEachMethodWithData(method) {
3768
+ function generateStreamMethod(isForm) {
3769
+ return function httpMethod(url, data, config) {
3770
+ return this.stream(
3771
+ mergeConfig(config || {}, {
3772
+ method,
3773
+ headers: isForm
3774
+ ? {
3775
+ 'Content-Type': 'multipart/form-data',
3776
+ }
3777
+ : {},
3778
+ url,
3779
+ data,
3780
+ })
3781
+ )
3782
+ }
3783
+ }
3784
+
3785
+ Axios.prototype[method] = generateStreamMethod();
3786
+
3787
+ Axios.prototype[`${method}Forms`] = generateStreamMethod(true);
3788
+ });
3789
+
3790
+ const Axios$1 = Axios;
3791
+
3792
+ /**
3793
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
3794
+ *
3795
+ * @param {Function} executor The executor function.
3796
+ *
3797
+ * @returns {CancelToken}
3798
+ */
3799
+ class CancelToken {
3800
+ constructor(executor) {
3801
+ if (typeof executor !== 'function') {
3802
+ throw new TypeError('executor must be a function.');
3803
+ }
3804
+
3805
+ let resolvePromise;
3806
+
3807
+ this.promise = new Promise(function promiseExecutor(resolve) {
3808
+ resolvePromise = resolve;
3809
+ });
3810
+
3811
+ const token = this;
3812
+
3813
+ // eslint-disable-next-line func-names
3814
+ this.promise.then(cancel => {
3815
+ if (!token._listeners) return;
3816
+
3817
+ let i = token._listeners.length;
3818
+
3819
+ while (i-- > 0) {
3820
+ token._listeners[i](cancel);
3821
+ }
3822
+ token._listeners = null;
3823
+ });
3824
+
3825
+ // eslint-disable-next-line func-names
3826
+ this.promise.then = onfulfilled => {
3827
+ let _resolve;
3828
+ // eslint-disable-next-line func-names
3829
+ const promise = new Promise(resolve => {
3830
+ token.subscribe(resolve);
3831
+ _resolve = resolve;
3832
+ }).then(onfulfilled);
3833
+
3834
+ promise.cancel = function reject() {
3835
+ token.unsubscribe(_resolve);
3836
+ };
3837
+
3838
+ return promise;
3839
+ };
3840
+
3841
+ executor(function cancel(message, config, request) {
3842
+ if (token.reason) {
3843
+ // Cancellation has already been requested
3844
+ return;
3845
+ }
3846
+
3847
+ token.reason = new CanceledError(message, config, request);
3848
+ resolvePromise(token.reason);
3849
+ });
3850
+ }
3851
+
3852
+ /**
3853
+ * Throws a `CanceledError` if cancellation has been requested.
3854
+ */
3855
+ throwIfRequested() {
3856
+ if (this.reason) {
3857
+ throw this.reason;
3858
+ }
3859
+ }
3860
+
3861
+ /**
3862
+ * Subscribe to the cancel signal
3863
+ */
3864
+
3865
+ subscribe(listener) {
3866
+ if (this.reason) {
3867
+ listener(this.reason);
3868
+ return;
3869
+ }
3870
+
3871
+ if (this._listeners) {
3872
+ this._listeners.push(listener);
3873
+ } else {
3874
+ this._listeners = [listener];
3875
+ }
3876
+ }
3877
+
3878
+ /**
3879
+ * Unsubscribe from the cancel signal
3880
+ */
3881
+
3882
+ unsubscribe(listener) {
3883
+ if (!this._listeners) {
3884
+ return;
3885
+ }
3886
+ const index = this._listeners.indexOf(listener);
3887
+ if (index !== -1) {
3888
+ this._listeners.splice(index, 1);
3889
+ }
3890
+ }
3891
+
3892
+ toAbortSignal() {
3893
+ const controller = new AbortController();
3894
+
3895
+ const abort = (err) => {
3896
+ controller.abort(err);
3897
+ };
3898
+
3899
+ this.subscribe(abort);
3900
+
3901
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
3902
+
3903
+ return controller.signal;
3904
+ }
3905
+
3906
+ /**
3907
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3908
+ * cancels the `CancelToken`.
3909
+ */
3910
+ static source() {
3911
+ let cancel;
3912
+ const token = new CancelToken(function executor(c) {
3913
+ cancel = c;
3914
+ });
3915
+ return {
3916
+ token,
3917
+ cancel
3918
+ };
3919
+ }
3920
+ }
3921
+
3922
+ const CancelToken$1 = CancelToken;
3923
+
3924
+ /**
3925
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3926
+ *
3927
+ * Common use case would be to use `Function.prototype.apply`.
3928
+ *
3929
+ * ```js
3930
+ * function f(x, y, z) {}
3931
+ * var args = [1, 2, 3];
3932
+ * f.apply(null, args);
3933
+ * ```
3934
+ *
3935
+ * With `spread` this example can be re-written.
3936
+ *
3937
+ * ```js
3938
+ * spread(function(x, y, z) {})([1, 2, 3]);
3939
+ * ```
3940
+ *
3941
+ * @param {Function} callback
3942
+ *
3943
+ * @returns {Function}
3944
+ */
3945
+ function spread(callback) {
3946
+ return function wrap(arr) {
3947
+ return callback.apply(null, arr);
3948
+ };
3949
+ }
3950
+
3951
+ /**
3952
+ * Determines whether the payload is an error thrown by Axios
3953
+ *
3954
+ * @param {*} payload The value to test
3955
+ *
3956
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3957
+ */
3958
+ function isAxiosError(payload) {
3959
+ return utils$2.isObject(payload) && (payload.isAxiosError === true);
3960
+ }
3961
+
3962
+ /**
3963
+ * Create an instance of Axios
3964
+ *
3965
+ * @param {Object} defaultConfig The default config for the instance
3966
+ *
3967
+ * @returns {Axios} A new instance of Axios
3968
+ */
3969
+ function createInstance(defaultConfig) {
3970
+ const context = new Axios$1(defaultConfig);
3971
+ const instance = bind$1(Axios$1.prototype.request, context);
3972
+
3973
+ // Copy axios.prototype to instance
3974
+ utils$2.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
3975
+
3976
+ // Copy context to instance
3977
+ utils$2.extend(instance, context, null, {allOwnKeys: true});
3978
+
3979
+ // Factory for creating new instances
3980
+ instance.create = function create(instanceConfig) {
3981
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3982
+ };
3983
+
3984
+ return instance;
3985
+ }
3986
+
3987
+ // Create the default instance to be exported
3988
+ const req = createInstance(defaults$1);
3989
+
3990
+ // Expose Axios class to allow class inheritance
3991
+ req.Axios = Axios$1;
3992
+
3993
+ // Expose Cancel & CancelToken
3994
+ req.CanceledError = CanceledError;
3995
+ req.CancelToken = CancelToken$1;
3996
+ req.isCancel = isCancel;
3997
+ req.VERSION = VERSION;
3998
+ req.toFormData = toFormData$1;
3999
+
4000
+ // Expose AxiosError class
4001
+ req.AxiosError = AxiosError$1;
4002
+
4003
+ // alias for CanceledError for backward compatibility
4004
+ req.Cancel = req.CanceledError;
4005
+
4006
+ // Expose all/spread
4007
+ req.all = promises => Promise.all(promises);
4008
+
4009
+ req.spread = spread;
4010
+
4011
+ // Expose isAxiosError
4012
+ req.isAxiosError = isAxiosError;
4013
+
4014
+ // Expose mergeConfig
4015
+ req.mergeConfig = mergeConfig;
4016
+
4017
+ req.AxiosHeaders = AxiosHeaders$1;
4018
+
4019
+ req.formToJSON = thing => formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
4020
+
4021
+ req.getAdapter = adapters.getAdapter;
4022
+
4023
+ req.default = req;
4024
+
4025
+ module.exports = req;