@wiajs/req 1.7.28 → 1.7.30

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.
package/dist/web/req.cjs CHANGED
@@ -1,235 +1,185 @@
1
1
  /*!
2
- * @wia/req v1.7.28
3
- * (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
2
+ * @wia/req v1.7.30
3
+ * (c) 2024-2025 Sibyl Yu, Matt Zabriskie and contributors
4
4
  * Released under the MIT License.
5
5
  */
6
6
  'use strict';
7
7
 
8
- function bind$1(fn, thisArg) {
9
- return function wrap() {
10
- return fn.apply(thisArg, arguments);
11
- };
8
+ function bind$1(fn, thisArg) {
9
+ return function wrap() {
10
+ return fn.apply(thisArg, arguments);
11
+ };
12
12
  }
13
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
-
14
+ // utils is a library of generic helper functions non-specific to axios
15
+ const { toString: toString$1 } = Object.prototype;
16
+ const { getPrototypeOf: getPrototypeOf$1 } = Object;
17
+ const kindOf$1 = ((cache)=>(thing)=>{
18
+ const str = toString$1.call(thing);
19
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
20
+ })(Object.create(null));
21
+ const kindOfTest$1 = (type)=>{
22
+ type = type.toLowerCase();
23
+ return (thing)=>kindOf$1(thing) === type;
24
+ };
25
+ const typeOfTest$1 = (type)=>(thing)=>typeof thing === type;
31
26
  /**
32
27
  * Determine if a value is an Array
33
28
  *
34
29
  * @param {Object} val The value to test
35
30
  *
36
31
  * @returns {boolean} True if value is an Array, otherwise false
37
- */
38
- const {isArray: isArray$1} = Array;
39
-
32
+ */ const { isArray: isArray$1 } = Array;
40
33
  /**
41
34
  * Determine if a value is undefined
42
35
  *
43
36
  * @param {*} val The value to test
44
37
  *
45
38
  * @returns {boolean} True if the value is undefined, otherwise false
46
- */
47
- const isUndefined$1 = typeOfTest$1('undefined');
48
-
39
+ */ const isUndefined$1 = typeOfTest$1('undefined');
49
40
  /**
50
41
  * Determine if a value is a Buffer
51
42
  *
52
43
  * @param {*} val The value to test
53
44
  *
54
45
  * @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
-
46
+ */ function isBuffer$1(val) {
47
+ return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
48
+ }
61
49
  /**
62
50
  * Determine if a value is an ArrayBuffer
63
51
  *
64
52
  * @param {*} val The value to test
65
53
  *
66
54
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
67
- */
68
- const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
69
-
70
-
55
+ */ const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
71
56
  /**
72
57
  * Determine if a value is a view on an ArrayBuffer
73
58
  *
74
59
  * @param {*} val The value to test
75
60
  *
76
61
  * @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
-
62
+ */ function isArrayBufferView$1(val) {
63
+ let result;
64
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
65
+ result = ArrayBuffer.isView(val);
66
+ } else {
67
+ result = val && val.buffer && isArrayBuffer$1(val.buffer);
68
+ }
69
+ return result;
70
+ }
88
71
  /**
89
72
  * Determine if a value is a String
90
73
  *
91
74
  * @param {*} val The value to test
92
75
  *
93
76
  * @returns {boolean} True if value is a String, otherwise false
94
- */
95
- const isString$1 = typeOfTest$1('string');
96
-
77
+ */ const isString$1 = typeOfTest$1('string');
97
78
  /**
98
79
  * Determine if a value is a Function
99
80
  *
100
81
  * @param {*} val The value to test
101
82
  * @returns {boolean} True if value is a Function, otherwise false
102
- */
103
- const isFunction$1 = typeOfTest$1('function');
104
-
83
+ */ const isFunction$1 = typeOfTest$1('function');
105
84
  /**
106
85
  * Determine if a value is a Number
107
86
  *
108
87
  * @param {*} val The value to test
109
88
  *
110
89
  * @returns {boolean} True if value is a Number, otherwise false
111
- */
112
- const isNumber$1 = typeOfTest$1('number');
113
-
90
+ */ const isNumber$1 = typeOfTest$1('number');
114
91
  /**
115
92
  * Determine if a value is an Object
116
93
  *
117
94
  * @param {*} thing The value to test
118
95
  *
119
96
  * @returns {boolean} True if value is an Object, otherwise false
120
- */
121
- const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
122
-
97
+ */ const isObject$1 = (thing)=>thing !== null && typeof thing === 'object';
123
98
  /**
124
99
  * Determine if a value is a Boolean
125
100
  *
126
101
  * @param {*} thing The value to test
127
102
  * @returns {boolean} True if value is a Boolean, otherwise false
128
- */
129
- const isBoolean$1 = thing => thing === true || thing === false;
130
-
103
+ */ const isBoolean$1 = (thing)=>thing === true || thing === false;
131
104
  /**
132
105
  * Determine if a value is a plain Object
133
106
  *
134
107
  * @param {*} val The value to test
135
108
  *
136
109
  * @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
-
110
+ */ const isPlainObject$1 = (val)=>{
111
+ if (kindOf$1(val) !== 'object') {
112
+ return false;
113
+ }
114
+ const prototype = getPrototypeOf$1(val);
115
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
116
+ };
147
117
  /**
148
118
  * Determine if a value is a Date
149
119
  *
150
120
  * @param {*} val The value to test
151
121
  *
152
122
  * @returns {boolean} True if value is a Date, otherwise false
153
- */
154
- const isDate$1 = kindOfTest$1('Date');
155
-
123
+ */ const isDate$1 = kindOfTest$1('Date');
156
124
  /**
157
125
  * Determine if a value is a File
158
126
  *
159
127
  * @param {*} val The value to test
160
128
  *
161
129
  * @returns {boolean} True if value is a File, otherwise false
162
- */
163
- const isFile$1 = kindOfTest$1('File');
164
-
130
+ */ const isFile$1 = kindOfTest$1('File');
165
131
  /**
166
132
  * Determine if a value is a Blob
167
133
  *
168
134
  * @param {*} val The value to test
169
135
  *
170
136
  * @returns {boolean} True if value is a Blob, otherwise false
171
- */
172
- const isBlob$1 = kindOfTest$1('Blob');
173
-
137
+ */ const isBlob$1 = kindOfTest$1('Blob');
174
138
  /**
175
139
  * Determine if a value is a FileList
176
140
  *
177
141
  * @param {*} val The value to test
178
142
  *
179
143
  * @returns {boolean} True if value is a File, otherwise false
180
- */
181
- const isFileList$1 = kindOfTest$1('FileList');
182
-
144
+ */ const isFileList$1 = kindOfTest$1('FileList');
183
145
  /**
184
146
  * Determine if a value is a Stream
185
147
  *
186
148
  * @param {*} val The value to test
187
149
  *
188
150
  * @returns {boolean} True if value is a Stream, otherwise false
189
- */
190
- const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
191
-
151
+ */ const isStream$1 = (val)=>isObject$1(val) && isFunction$1(val.pipe);
192
152
  /**
193
153
  * Determine if a value is a FormData
194
154
  *
195
155
  * @param {*} thing The value to test
196
156
  *
197
157
  * @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
-
158
+ */ const isFormData$1 = (thing)=>{
159
+ let kind;
160
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf$1(thing)) === 'formdata' || // detect form-data instance
161
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
162
+ };
212
163
  /**
213
164
  * Determine if a value is a URLSearchParams object
214
165
  *
215
166
  * @param {*} val The value to test
216
167
  *
217
168
  * @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
-
169
+ */ const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
170
+ const [isReadableStream$1, isRequest$1, isResponse$1, isHeaders$1] = [
171
+ 'ReadableStream',
172
+ 'Request',
173
+ 'Response',
174
+ 'Headers'
175
+ ].map(kindOfTest$1);
223
176
  /**
224
177
  * Trim excess whitespace off the beginning and end of a string
225
178
  *
226
179
  * @param {String} str The String to trim
227
180
  *
228
181
  * @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
-
182
+ */ const trim$1 = (str)=>str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
233
183
  /**
234
184
  * Iterate over an Array or an Object invoking a function for each item.
235
185
  *
@@ -244,62 +194,53 @@ const trim$1 = (str) => str.trim ?
244
194
  *
245
195
  * @param {Boolean} [allOwnKeys = false]
246
196
  * @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
-
197
+ */ function forEach$1(obj, fn, { allOwnKeys = false } = {}) {
198
+ // Don't bother if no value provided
199
+ if (obj === null || typeof obj === 'undefined') {
200
+ return;
201
+ }
202
+ let i;
203
+ let l;
204
+ // Force an array if not already something iterable
205
+ if (typeof obj !== 'object') {
206
+ /*eslint no-param-reassign:0*/ obj = [
207
+ obj
208
+ ];
209
+ }
210
+ if (isArray$1(obj)) {
211
+ // Iterate over array values
212
+ for(i = 0, l = obj.length; i < l; i++){
213
+ fn.call(null, obj[i], i, obj);
214
+ }
215
+ } else {
216
+ // Iterate over object keys
217
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
218
+ const len = keys.length;
219
+ let key;
220
+ for(i = 0; i < len; i++){
221
+ key = keys[i];
222
+ fn.call(null, obj[key], key, obj);
223
+ }
224
+ }
225
+ }
226
+ function findKey$1(obj, key) {
227
+ key = key.toLowerCase();
228
+ const keys = Object.keys(obj);
229
+ let i = keys.length;
230
+ let _key;
231
+ while(i-- > 0){
232
+ _key = keys[i];
233
+ if (key === _key.toLowerCase()) {
234
+ return _key;
235
+ }
236
+ }
237
+ return null;
238
+ }
239
+ const _global$1 = (()=>{
240
+ /*eslint no-undef:0*/ if (typeof globalThis !== "undefined") return globalThis;
241
+ return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
242
+ })();
243
+ const isContextDefined$1 = (context)=>!isUndefined$1(context) && context !== _global$1;
303
244
  /**
304
245
  * Accepts varargs expecting each argument to be an object, then
305
246
  * immutably merges the properties of each object and returns result.
@@ -317,29 +258,26 @@ const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _
317
258
  * @param {Object} obj1 Object to merge
318
259
  *
319
260
  * @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
-
261
+ */ function merge$1() {
262
+ const { caseless } = isContextDefined$1(this) && this || {};
263
+ const result = {};
264
+ const assignValue = (val, key)=>{
265
+ const targetKey = caseless && findKey$1(result, key) || key;
266
+ if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
267
+ result[targetKey] = merge$1(result[targetKey], val);
268
+ } else if (isPlainObject$1(val)) {
269
+ result[targetKey] = merge$1({}, val);
270
+ } else if (isArray$1(val)) {
271
+ result[targetKey] = val.slice();
272
+ } else {
273
+ result[targetKey] = val;
274
+ }
275
+ };
276
+ for(let i = 0, l = arguments.length; i < l; i++){
277
+ arguments[i] && forEach$1(arguments[i], assignValue);
278
+ }
279
+ return result;
280
+ }
343
281
  /**
344
282
  * Extends object a by mutably adding to it the properties of object b.
345
283
  *
@@ -349,32 +287,30 @@ function merge$1(/* obj1, obj2, obj3, ... */) {
349
287
  *
350
288
  * @param {Boolean} [allOwnKeys]
351
289
  * @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
-
290
+ */ const extend$1 = (a, b, thisArg, { allOwnKeys } = {})=>{
291
+ forEach$1(b, (val, key)=>{
292
+ if (thisArg && isFunction$1(val)) {
293
+ a[key] = bind$1(val, thisArg);
294
+ } else {
295
+ a[key] = val;
296
+ }
297
+ }, {
298
+ allOwnKeys
299
+ });
300
+ return a;
301
+ };
364
302
  /**
365
303
  * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
366
304
  *
367
305
  * @param {string} content with BOM
368
306
  *
369
307
  * @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
-
308
+ */ const stripBOM$1 = (content)=>{
309
+ if (content.charCodeAt(0) === 0xFEFF) {
310
+ content = content.slice(1);
311
+ }
312
+ return content;
313
+ };
378
314
  /**
379
315
  * Inherit the prototype methods from one constructor into another
380
316
  * @param {function} constructor
@@ -383,16 +319,14 @@ const stripBOM$1 = (content) => {
383
319
  * @param {object} [descriptors]
384
320
  *
385
321
  * @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
-
322
+ */ const inherits$1 = (constructor, superConstructor, props, descriptors)=>{
323
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
324
+ constructor.prototype.constructor = constructor;
325
+ Object.defineProperty(constructor, 'super', {
326
+ value: superConstructor.prototype
327
+ });
328
+ props && Object.assign(constructor.prototype, props);
329
+ };
396
330
  /**
397
331
  * Resolve object with deep prototype chain to a flat object
398
332
  * @param {Object} sourceObj source object
@@ -401,33 +335,28 @@ const inherits$1 = (constructor, superConstructor, props, descriptors) => {
401
335
  * @param {Function} [propFilter]
402
336
  *
403
337
  * @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
-
338
+ */ const toFlatObject$1 = (sourceObj, destObj, filter, propFilter)=>{
339
+ let props;
340
+ let i;
341
+ let prop;
342
+ const merged = {};
343
+ destObj = destObj || {};
344
+ // eslint-disable-next-line no-eq-null,eqeqeq
345
+ if (sourceObj == null) return destObj;
346
+ do {
347
+ props = Object.getOwnPropertyNames(sourceObj);
348
+ i = props.length;
349
+ while(i-- > 0){
350
+ prop = props[i];
351
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
352
+ destObj[prop] = sourceObj[prop];
353
+ merged[prop] = true;
354
+ }
355
+ }
356
+ sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
357
+ }while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype)
358
+ return destObj;
359
+ };
431
360
  /**
432
361
  * Determines whether a string ends with the characters of a specified string
433
362
  *
@@ -436,37 +365,32 @@ const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
436
365
  * @param {Number} [position= 0]
437
366
  *
438
367
  * @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
-
368
+ */ const endsWith$1 = (str, searchString, position)=>{
369
+ str = String(str);
370
+ if (position === undefined || position > str.length) {
371
+ position = str.length;
372
+ }
373
+ position -= searchString.length;
374
+ const lastIndex = str.indexOf(searchString, position);
375
+ return lastIndex !== -1 && lastIndex === position;
376
+ };
451
377
  /**
452
378
  * Returns new array from array like object or null if failed
453
379
  *
454
380
  * @param {*} [thing]
455
381
  *
456
382
  * @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
-
383
+ */ const toArray$1 = (thing)=>{
384
+ if (!thing) return null;
385
+ if (isArray$1(thing)) return thing;
386
+ let i = thing.length;
387
+ if (!isNumber$1(i)) return null;
388
+ const arr = new Array(i);
389
+ while(i-- > 0){
390
+ arr[i] = thing[i];
391
+ }
392
+ return arr;
393
+ };
470
394
  /**
471
395
  * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
472
396
  * thing passed in is an instance of Uint8Array
@@ -474,15 +398,13 @@ const toArray$1 = (thing) => {
474
398
  * @param {TypedArray}
475
399
  *
476
400
  * @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
-
401
+ */ // eslint-disable-next-line func-names
402
+ const isTypedArray$1 = ((TypedArray)=>{
403
+ // eslint-disable-next-line func-names
404
+ return (thing)=>{
405
+ return TypedArray && thing instanceof TypedArray;
406
+ };
407
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
486
408
  /**
487
409
  * For each entry in the object, call the function with the key and value.
488
410
  *
@@ -490,20 +412,15 @@ const isTypedArray$1 = (TypedArray => {
490
412
  * @param {Function} fn - The function to call for each entry.
491
413
  *
492
414
  * @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
-
415
+ */ const forEachEntry$1 = (obj, fn)=>{
416
+ const generator = obj && obj[Symbol.iterator];
417
+ const iterator = generator.call(obj);
418
+ let result;
419
+ while((result = iterator.next()) && !result.done){
420
+ const pair = result.value;
421
+ fn.call(obj, pair[0], pair[1]);
422
+ }
423
+ };
507
424
  /**
508
425
  * It takes a regular expression and a string, and returns an array of all the matches
509
426
  *
@@ -511,280 +428,221 @@ const forEachEntry$1 = (obj, fn) => {
511
428
  * @param {string} str - The string to search.
512
429
  *
513
430
  * @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
-
431
+ */ const matchAll$1 = (regExp, str)=>{
432
+ let matches;
433
+ const arr = [];
434
+ while((matches = regExp.exec(str)) !== null){
435
+ arr.push(matches);
436
+ }
437
+ return arr;
438
+ };
439
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
440
+ const toCamelCase$1 = (str)=>{
441
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
442
+ return p1.toUpperCase() + p2;
443
+ });
444
+ };
445
+ /* Creating a function that will check if an object has a property. */ const hasOwnProperty$1 = (({ hasOwnProperty })=>(obj, prop)=>hasOwnProperty.call(obj, prop))(Object.prototype);
540
446
  /**
541
447
  * Determine if a value is a RegExp object
542
448
  *
543
449
  * @param {*} val The value to test
544
450
  *
545
451
  * @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
-
452
+ */ const isRegExp$1 = kindOfTest$1('RegExp');
453
+ const reduceDescriptors$1 = (obj, reducer)=>{
454
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
455
+ const reducedDescriptors = {};
456
+ forEach$1(descriptors, (descriptor, name)=>{
457
+ let ret;
458
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
459
+ reducedDescriptors[name] = ret || descriptor;
460
+ }
461
+ });
462
+ Object.defineProperties(obj, reducedDescriptors);
463
+ };
563
464
  /**
564
465
  * Makes all methods read-only
565
466
  * @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
-
467
+ */ const freezeMethods$1 = (obj)=>{
468
+ reduceDescriptors$1(obj, (descriptor, name)=>{
469
+ // skip restricted props in strict mode
470
+ if (isFunction$1(obj) && [
471
+ 'arguments',
472
+ 'caller',
473
+ 'callee'
474
+ ].indexOf(name) !== -1) {
475
+ return false;
476
+ }
477
+ const value = obj[name];
478
+ if (!isFunction$1(value)) return;
479
+ descriptor.enumerable = false;
480
+ if ('writable' in descriptor) {
481
+ descriptor.writable = false;
482
+ return;
483
+ }
484
+ if (!descriptor.set) {
485
+ descriptor.set = ()=>{
486
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
487
+ };
488
+ }
489
+ });
490
+ };
491
+ const toObjectSet$1 = (arrayOrString, delimiter)=>{
492
+ const obj = {};
493
+ const define = (arr)=>{
494
+ arr.forEach((value)=>{
495
+ obj[value] = true;
496
+ });
497
+ };
498
+ isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
499
+ return obj;
500
+ };
501
+ const noop$1 = ()=>{};
502
+ const toFiniteNumber$1 = (value, defaultValue)=>{
503
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
504
+ };
505
+ const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
506
+ const DIGIT$1 = '0123456789';
507
+ const ALPHABET$1 = {
508
+ DIGIT: DIGIT$1,
509
+ ALPHA: ALPHA$1,
510
+ ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
511
+ };
512
+ const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT)=>{
513
+ let str = '';
514
+ const { length } = alphabet;
515
+ while(size--){
516
+ str += alphabet[Math.random() * length | 0];
517
+ }
518
+ return str;
519
+ };
634
520
  /**
635
521
  * If the thing is a FormData object, return true, otherwise return false.
636
522
  *
637
523
  * @param {unknown} thing - The thing to check.
638
524
  *
639
525
  * @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
526
+ */ function isSpecCompliantForm$1(thing) {
527
+ return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
528
+ }
529
+ const toJSONObject$1 = (obj)=>{
530
+ const stack = new Array(10);
531
+ const visit = (source, i)=>{
532
+ if (isObject$1(source)) {
533
+ if (stack.indexOf(source) >= 0) {
534
+ return;
535
+ }
536
+ if (!('toJSON' in source)) {
537
+ stack[i] = source;
538
+ const target = isArray$1(source) ? [] : {};
539
+ forEach$1(source, (value, key)=>{
540
+ const reducedValue = visit(value, i + 1);
541
+ !isUndefined$1(reducedValue) && (target[key] = reducedValue);
542
+ });
543
+ stack[i] = undefined;
544
+ return target;
545
+ }
546
+ }
547
+ return source;
548
+ };
549
+ return visit(obj, 0);
550
+ };
551
+ const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
552
+ const isThenable$1 = (thing)=>thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
553
+ // original code
554
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
555
+ const _setImmediate$1 = ((setImmediateSupported, postMessageSupported)=>{
556
+ if (setImmediateSupported) {
557
+ return setImmediate;
558
+ }
559
+ return postMessageSupported ? ((token, callbacks)=>{
560
+ _global$1.addEventListener("message", ({ source, data })=>{
561
+ if (source === _global$1 && data === token) {
562
+ callbacks.length && callbacks.shift()();
563
+ }
564
+ }, false);
565
+ return (cb)=>{
566
+ callbacks.push(cb);
567
+ _global$1.postMessage(token, "*");
568
+ };
569
+ })(`axios@${Math.random()}`, []) : (cb)=>setTimeout(cb);
570
+ })(typeof setImmediate === 'function', isFunction$1(_global$1.postMessage));
571
+ const asap$1 = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global$1) : typeof process !== 'undefined' && process.nextTick || _setImmediate$1;
572
+ function createErrorType$1(code, message, baseClass) {
573
+ // Create constructor
574
+ function CustomError(properties) {
575
+ Error.captureStackTrace(this, this.constructor);
576
+ Object.assign(this, properties || {});
577
+ this.code = code;
578
+ this.message = this.cause ? `${message}: ${this.cause.message}` : message;
579
+ }
580
+ // Attach constructor and set default properties
581
+ CustomError.prototype = new (baseClass || Error)();
582
+ CustomError.prototype.constructor = CustomError;
583
+ CustomError.prototype.name = `Error [${code}]`;
584
+ return CustomError;
585
+ }
586
+ // *********************
587
+ const utils$2 = {
588
+ isArray: isArray$1,
589
+ isArrayBuffer: isArrayBuffer$1,
590
+ isBuffer: isBuffer$1,
591
+ isFormData: isFormData$1,
592
+ isArrayBufferView: isArrayBufferView$1,
593
+ isString: isString$1,
594
+ isNumber: isNumber$1,
595
+ isBoolean: isBoolean$1,
596
+ isObject: isObject$1,
597
+ isPlainObject: isPlainObject$1,
598
+ isReadableStream: isReadableStream$1,
599
+ isRequest: isRequest$1,
600
+ isResponse: isResponse$1,
601
+ isHeaders: isHeaders$1,
602
+ isUndefined: isUndefined$1,
603
+ isDate: isDate$1,
604
+ isFile: isFile$1,
605
+ isBlob: isBlob$1,
606
+ isRegExp: isRegExp$1,
607
+ isFunction: isFunction$1,
608
+ isStream: isStream$1,
609
+ isURLSearchParams: isURLSearchParams$1,
610
+ isTypedArray: isTypedArray$1,
611
+ isFileList: isFileList$1,
612
+ forEach: forEach$1,
613
+ merge: merge$1,
614
+ extend: extend$1,
615
+ trim: trim$1,
616
+ stripBOM: stripBOM$1,
617
+ inherits: inherits$1,
618
+ toFlatObject: toFlatObject$1,
619
+ kindOf: kindOf$1,
620
+ kindOfTest: kindOfTest$1,
621
+ endsWith: endsWith$1,
622
+ toArray: toArray$1,
623
+ forEachEntry: forEachEntry$1,
624
+ matchAll: matchAll$1,
625
+ isHTMLForm: isHTMLForm$1,
626
+ hasOwnProperty: hasOwnProperty$1,
627
+ hasOwnProp: hasOwnProperty$1,
628
+ reduceDescriptors: reduceDescriptors$1,
629
+ freezeMethods: freezeMethods$1,
630
+ toObjectSet: toObjectSet$1,
631
+ toCamelCase: toCamelCase$1,
632
+ noop: noop$1,
633
+ toFiniteNumber: toFiniteNumber$1,
634
+ findKey: findKey$1,
635
+ global: _global$1,
636
+ isContextDefined: isContextDefined$1,
637
+ ALPHABET: ALPHABET$1,
638
+ generateString: generateString$1,
639
+ isSpecCompliantForm: isSpecCompliantForm$1,
640
+ toJSONObject: toJSONObject$1,
641
+ isAsyncFn: isAsyncFn$1,
642
+ isThenable: isThenable$1,
643
+ setImmediate: _setImmediate$1,
644
+ asap: asap$1,
645
+ createErrorType: createErrorType$1
788
646
  };
789
647
 
790
648
  /**
@@ -797,92 +655,81 @@ const utils$2 = {
797
655
  * @param {Object} [response] The response.
798
656
  *
799
657
  * @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;
658
+ */ function AxiosError$1(message, code, config, request, response) {
659
+ Error.call(this);
660
+ if (Error.captureStackTrace) {
661
+ Error.captureStackTrace(this, this.constructor);
662
+ } else {
663
+ this.stack = new Error().stack;
664
+ }
665
+ this.message = message;
666
+ this.name = 'AxiosError';
667
+ code && (this.code = code);
668
+ config && (this.config = config);
669
+ request && (this.request = request);
670
+ if (response) {
671
+ this.response = response;
672
+ this.status = response.status ? response.status : null;
673
+ }
674
+ }
675
+ utils$2.inherits(AxiosError$1, Error, {
676
+ toJSON: function toJSON() {
677
+ return {
678
+ // Standard
679
+ message: this.message,
680
+ name: this.name,
681
+ // Microsoft
682
+ description: this.description,
683
+ number: this.number,
684
+ // Mozilla
685
+ fileName: this.fileName,
686
+ lineNumber: this.lineNumber,
687
+ columnNumber: this.columnNumber,
688
+ stack: this.stack,
689
+ // Axios
690
+ config: utils$2.toJSONObject(this.config),
691
+ code: this.code,
692
+ status: this.status
693
+ };
694
+ }
695
+ });
696
+ const prototype$3 = AxiosError$1.prototype;
697
+ const descriptors$1 = {};
698
+ [
699
+ 'ERR_BAD_OPTION_VALUE',
700
+ 'ERR_BAD_OPTION',
701
+ 'ECONNABORTED',
702
+ 'ETIMEDOUT',
703
+ 'ERR_NETWORK',
704
+ 'ERR_FR_TOO_MANY_REDIRECTS',
705
+ 'ERR_DEPRECATED',
706
+ 'ERR_BAD_RESPONSE',
707
+ 'ERR_BAD_REQUEST',
708
+ 'ERR_CANCELED',
709
+ 'ERR_NOT_SUPPORT',
710
+ 'ERR_INVALID_URL'
711
+ ].forEach((code)=>{
712
+ descriptors$1[code] = {
713
+ value: code
714
+ };
715
+ });
716
+ Object.defineProperties(AxiosError$1, descriptors$1);
717
+ Object.defineProperty(prototype$3, 'isAxiosError', {
718
+ value: true
719
+ });
720
+ // eslint-disable-next-line func-names
721
+ AxiosError$1.from = (error, code, config, request, response, customProps)=>{
722
+ const axiosError = Object.create(prototype$3);
723
+ utils$2.toFlatObject(error, axiosError, function filter(obj) {
724
+ return obj !== Error.prototype;
725
+ }, (prop)=>{
726
+ return prop !== 'isAxiosError';
727
+ });
728
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
729
+ axiosError.cause = error;
730
+ axiosError.name = error.name;
731
+ customProps && Object.assign(axiosError, customProps);
732
+ return axiosError;
886
733
  };
887
734
 
888
735
  // eslint-disable-next-line strict
@@ -894,22 +741,18 @@ const HttpAdapter = null;
894
741
  * @param {string} thing - The object or array to be visited.
895
742
  *
896
743
  * @returns {boolean}
897
- */
898
- function isVisitable$1(thing) {
899
- return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
900
- }
901
-
744
+ */ function isVisitable$1(thing) {
745
+ return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
746
+ }
902
747
  /**
903
748
  * It removes the brackets from the end of a string
904
749
  *
905
750
  * @param {string} key - The key of the parameter.
906
751
  *
907
752
  * @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
-
753
+ */ function removeBrackets$1(key) {
754
+ return utils$2.endsWith(key, '[]') ? key.slice(0, -2) : key;
755
+ }
913
756
  /**
914
757
  * It takes a path, a key, and a boolean, and returns a string
915
758
  *
@@ -918,31 +761,26 @@ function removeBrackets$1(key) {
918
761
  * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
919
762
  *
920
763
  * @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
-
764
+ */ function renderKey$1(path, key, dots) {
765
+ if (!path) return key;
766
+ return path.concat(key).map(function each(token, i) {
767
+ // eslint-disable-next-line no-param-reassign
768
+ token = removeBrackets$1(token);
769
+ return !dots && i ? '[' + token + ']' : token;
770
+ }).join(dots ? '.' : '');
771
+ }
931
772
  /**
932
773
  * If the array is an array and none of its elements are visitable, then it's a flat array.
933
774
  *
934
775
  * @param {Array<any>} arr - The array to check
935
776
  *
936
777
  * @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
-
778
+ */ function isFlatArray$1(arr) {
779
+ return utils$2.isArray(arr) && !arr.some(isVisitable$1);
780
+ }
781
+ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(prop) {
782
+ return /^is[A-Z]/.test(prop);
783
+ });
946
784
  /**
947
785
  * Convert a data object to FormData
948
786
  *
@@ -955,9 +793,7 @@ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(pro
955
793
  * @param {?Boolean} [options.indexes = false]
956
794
  *
957
795
  * @returns {Object}
958
- **/
959
-
960
- /**
796
+ **/ /**
961
797
  * It converts an object into a FormData object
962
798
  *
963
799
  * @param {Object<any, any>} obj - The object to convert to form data.
@@ -965,56 +801,47 @@ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(pro
965
801
  * @param {Object<string, any>} options
966
802
  *
967
803
  * @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
- /**
804
+ */ function toFormData$1(obj, formData, options) {
805
+ if (!utils$2.isObject(obj)) {
806
+ throw new TypeError('target must be an object');
807
+ }
808
+ // eslint-disable-next-line no-param-reassign
809
+ formData = formData || new (FormData)();
810
+ // eslint-disable-next-line no-param-reassign
811
+ options = utils$2.toFlatObject(options, {
812
+ metaTokens: true,
813
+ dots: false,
814
+ indexes: false
815
+ }, false, function defined(option, source) {
816
+ // eslint-disable-next-line no-eq-null,eqeqeq
817
+ return !utils$2.isUndefined(source[option]);
818
+ });
819
+ const metaTokens = options.metaTokens;
820
+ // eslint-disable-next-line no-use-before-define
821
+ const visitor = options.visitor || defaultVisitor;
822
+ const dots = options.dots;
823
+ const indexes = options.indexes;
824
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
825
+ const useBlob = _Blob && utils$2.isSpecCompliantForm(formData);
826
+ if (!utils$2.isFunction(visitor)) {
827
+ throw new TypeError('visitor must be a function');
828
+ }
829
+ function convertValue(value) {
830
+ if (value === null) return '';
831
+ if (utils$2.isDate(value)) {
832
+ return value.toISOString();
833
+ }
834
+ if (!useBlob && utils$2.isBlob(value)) {
835
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
836
+ }
837
+ if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
838
+ return useBlob && typeof Blob === 'function' ? new Blob([
839
+ value
840
+ ]) : Buffer.from(value);
841
+ }
842
+ return value;
843
+ }
844
+ /**
1018
845
  * Default visitor.
1019
846
  *
1020
847
  * @param {*} value
@@ -1023,80 +850,59 @@ function toFormData$1(obj, formData, options) {
1023
850
  * @this {FormData}
1024
851
  *
1025
852
  * @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;
853
+ */ function defaultVisitor(value, key, path) {
854
+ let arr = value;
855
+ if (value && !path && typeof value === 'object') {
856
+ if (utils$2.endsWith(key, '{}')) {
857
+ // eslint-disable-next-line no-param-reassign
858
+ key = metaTokens ? key : key.slice(0, -2);
859
+ // eslint-disable-next-line no-param-reassign
860
+ value = JSON.stringify(value);
861
+ } else if (utils$2.isArray(value) && isFlatArray$1(value) || (utils$2.isFileList(value) || utils$2.endsWith(key, '[]')) && (arr = utils$2.toArray(value))) {
862
+ // eslint-disable-next-line no-param-reassign
863
+ key = removeBrackets$1(key);
864
+ arr.forEach(function each(el, index) {
865
+ !(utils$2.isUndefined(el) || el === null) && formData.append(// eslint-disable-next-line no-nested-ternary
866
+ indexes === true ? renderKey$1([
867
+ key
868
+ ], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
869
+ });
870
+ return false;
871
+ }
872
+ }
873
+ if (isVisitable$1(value)) {
874
+ return true;
875
+ }
876
+ formData.append(renderKey$1(path, key, dots), convertValue(value));
877
+ return false;
878
+ }
879
+ const stack = [];
880
+ const exposedHelpers = Object.assign(predicates$1, {
881
+ defaultVisitor,
882
+ convertValue,
883
+ isVisitable: isVisitable$1
884
+ });
885
+ function build(value, path) {
886
+ if (utils$2.isUndefined(value)) return;
887
+ if (stack.indexOf(value) !== -1) {
888
+ throw Error('Circular reference detected in ' + path.join('.'));
889
+ }
890
+ stack.push(value);
891
+ utils$2.forEach(value, function each(el, key) {
892
+ const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers);
893
+ if (result === true) {
894
+ build(el, path ? path.concat(key) : [
895
+ key
896
+ ]);
897
+ }
898
+ });
899
+ stack.pop();
900
+ }
901
+ if (!utils$2.isObject(obj)) {
902
+ throw new TypeError('data must be an object');
903
+ }
904
+ build(obj);
905
+ return formData;
1100
906
  }
1101
907
 
1102
908
  /**
@@ -1106,22 +912,20 @@ function toFormData$1(obj, formData, options) {
1106
912
  * @param {string} str - The string to encode.
1107
913
  *
1108
914
  * @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
-
915
+ */ function encode$2(str) {
916
+ const charMap = {
917
+ '!': '%21',
918
+ "'": '%27',
919
+ '(': '%28',
920
+ ')': '%29',
921
+ '~': '%7E',
922
+ '%20': '+',
923
+ '%00': '\x00'
924
+ };
925
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
926
+ return charMap[match];
927
+ });
928
+ }
1125
929
  /**
1126
930
  * It takes a params object and converts it to a FormData object
1127
931
  *
@@ -1129,27 +933,24 @@ function encode$2(str) {
1129
933
  * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1130
934
  *
1131
935
  * @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('&');
936
+ */ function AxiosURLSearchParams$1(params, options) {
937
+ this._pairs = [];
938
+ params && toFormData$1(params, this, options);
939
+ }
940
+ const prototype$2 = AxiosURLSearchParams$1.prototype;
941
+ prototype$2.append = function append(name, value) {
942
+ this._pairs.push([
943
+ name,
944
+ value
945
+ ]);
946
+ };
947
+ prototype$2.toString = function toString(encoder) {
948
+ const _encode = encoder ? function(value) {
949
+ return encoder.call(this, value, encode$2);
950
+ } : encode$2;
951
+ return this._pairs.map(function each(pair) {
952
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
953
+ }, '').join('&');
1153
954
  };
1154
955
 
1155
956
  /**
@@ -1159,17 +960,9 @@ prototype$2.toString = function toString(encoder) {
1159
960
  * @param {string} val The value to be encoded.
1160
961
  *
1161
962
  * @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
-
963
+ */ function encode$1(val) {
964
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
965
+ }
1173
966
  /**
1174
967
  * Build a URL by appending params to the end
1175
968
  *
@@ -1178,87 +971,66 @@ function encode$1(val) {
1178
971
  * @param {?object} options
1179
972
  *
1180
973
  * @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;
974
+ */ function buildURL(url, params, options) {
975
+ /*eslint no-param-reassign:0*/ if (!params) {
976
+ return url;
977
+ }
978
+ const _encode = options && options.encode || encode$1;
979
+ const serializeFn = options && options.serialize;
980
+ let serializedParams;
981
+ if (serializeFn) {
982
+ serializedParams = serializeFn(params, options);
983
+ } else {
984
+ serializedParams = utils$2.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams$1(params, options).toString(_encode);
985
+ }
986
+ if (serializedParams) {
987
+ const hashmarkIndex = url.indexOf("#");
988
+ if (hashmarkIndex !== -1) {
989
+ url = url.slice(0, hashmarkIndex);
990
+ }
991
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
992
+ }
993
+ return url;
1212
994
  }
1213
995
 
1214
- class InterceptorManager {
1215
- constructor() {
1216
- this.handlers = [];
1217
- }
1218
-
1219
- /**
996
+ let InterceptorManager = class InterceptorManager {
997
+ /**
1220
998
  * Add a new interceptor to the stack
1221
999
  *
1222
1000
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
1223
1001
  * @param {Function} rejected The function to handle `reject` for a `Promise`
1224
1002
  *
1225
1003
  * @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
- /**
1004
+ */ use(fulfilled, rejected, options) {
1005
+ this.handlers.push({
1006
+ fulfilled,
1007
+ rejected,
1008
+ synchronous: options ? options.synchronous : false,
1009
+ runWhen: options ? options.runWhen : null
1010
+ });
1011
+ return this.handlers.length - 1;
1012
+ }
1013
+ /**
1238
1014
  * Remove an interceptor from the stack
1239
1015
  *
1240
1016
  * @param {Number} id The ID that was returned by `use`
1241
1017
  *
1242
1018
  * @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
- /**
1019
+ */ eject(id) {
1020
+ if (this.handlers[id]) {
1021
+ this.handlers[id] = null;
1022
+ }
1023
+ }
1024
+ /**
1251
1025
  * Clear all interceptors from the stack
1252
1026
  *
1253
1027
  * @returns {void}
1254
- */
1255
- clear() {
1256
- if (this.handlers) {
1257
- this.handlers = [];
1258
- }
1259
- }
1260
-
1261
- /**
1028
+ */ clear() {
1029
+ if (this.handlers) {
1030
+ this.handlers = [];
1031
+ }
1032
+ }
1033
+ /**
1262
1034
  * Iterate over all the registered interceptors
1263
1035
  *
1264
1036
  * This method is particularly useful for skipping over any
@@ -1267,22 +1039,23 @@ class InterceptorManager {
1267
1039
  * @param {Function} fn The function to call for each interceptor
1268
1040
  *
1269
1041
  * @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
-
1042
+ */ forEach(fn) {
1043
+ utils$2.forEach(this.handlers, function forEachHandler(h) {
1044
+ if (h !== null) {
1045
+ fn(h);
1046
+ }
1047
+ });
1048
+ }
1049
+ constructor(){
1050
+ this.handlers = [];
1051
+ }
1052
+ };
1280
1053
  const InterceptorManager$1 = InterceptorManager;
1281
1054
 
1282
- const transitionalDefaults = {
1283
- silentJSONParsing: true,
1284
- forcedJSONParsing: true,
1285
- clarifyTimeoutError: false
1055
+ const transitionalDefaults = {
1056
+ silentJSONParsing: true,
1057
+ forcedJSONParsing: true,
1058
+ clarifyTimeoutError: false
1286
1059
  };
1287
1060
 
1288
1061
  function bind(fn, thisArg) {
@@ -2149,8 +1922,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
2149
1922
  // eslint-disable-next-line no-param-reassign
2150
1923
  key = removeBrackets(key);
2151
1924
  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([
1925
+ !(utils$1.isUndefined(el) || el === null) && formData.append(indexes === true ? renderKey([
2154
1926
  key
2155
1927
  ], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2156
1928
  });
@@ -2263,10 +2035,8 @@ const platform$1 = {
2263
2035
  ]
2264
2036
  };
2265
2037
 
2266
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2267
-
2268
- const _navigator = typeof navigator === 'object' && navigator || undefined;
2269
-
2038
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2039
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
2270
2040
  /**
2271
2041
  * Determine if we're running in a standard browser environment
2272
2042
  *
@@ -2283,10 +2053,11 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
2283
2053
  * navigator.product -> 'NativeScript' or 'NS'
2284
2054
  *
2285
2055
  * @returns {boolean}
2286
- */
2287
- const hasStandardBrowserEnv = hasBrowserEnv &&
2288
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2289
-
2056
+ */ const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || [
2057
+ 'ReactNative',
2058
+ 'NativeScript',
2059
+ 'NS'
2060
+ ].indexOf(_navigator.product) < 0);
2290
2061
  /**
2291
2062
  * Determine if we're running in a standard browser webWorker environment
2292
2063
  *
@@ -2295,16 +2066,10 @@ const hasStandardBrowserEnv = hasBrowserEnv &&
2295
2066
  * filtered out due to its judgment standard
2296
2067
  * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2297
2068
  * 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
-
2069
+ */ const hasStandardBrowserWebWorkerEnv = (()=>{
2070
+ return typeof WorkerGlobalScope !== 'undefined' && // eslint-disable-next-line no-undef
2071
+ self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
2072
+ })();
2308
2073
  const origin = hasBrowserEnv && window.location.href || 'http://localhost';
2309
2074
 
2310
2075
  const utils = /*#__PURE__*/Object.freeze({
@@ -2316,22 +2081,21 @@ const utils = /*#__PURE__*/Object.freeze({
2316
2081
  origin: origin
2317
2082
  });
2318
2083
 
2319
- const platform = {
2320
- ...utils,
2321
- ...platform$1
2084
+ const platform = {
2085
+ ...utils,
2086
+ ...platform$1
2322
2087
  };
2323
2088
 
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));
2089
+ function toURLEncodedForm(data, options) {
2090
+ return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
2091
+ visitor: function(value, key, path, helpers) {
2092
+ if (platform.isNode && utils$2.isBuffer(value)) {
2093
+ this.append(key, value.toString('base64'));
2094
+ return false;
2095
+ }
2096
+ return helpers.defaultVisitor.apply(this, arguments);
2097
+ }
2098
+ }, options));
2335
2099
  }
2336
2100
 
2337
2101
  /**
@@ -2340,88 +2104,74 @@ function toURLEncodedForm(data, options) {
2340
2104
  * @param {string} name - The name of the property to get.
2341
2105
  *
2342
2106
  * @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
-
2107
+ */ function parsePropPath(name) {
2108
+ // foo[x][y][z]
2109
+ // foo.x.y.z
2110
+ // foo-x-y-z
2111
+ // foo x y z
2112
+ return utils$2.matchAll(/\w+|\[(\w*)]/g, name).map((match)=>{
2113
+ return match[0] === '[]' ? '' : match[1] || match[0];
2114
+ });
2115
+ }
2354
2116
  /**
2355
2117
  * Convert an array to an object.
2356
2118
  *
2357
2119
  * @param {Array<any>} arr - The array to convert to an object.
2358
2120
  *
2359
2121
  * @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
-
2122
+ */ function arrayToObject(arr) {
2123
+ const obj = {};
2124
+ const keys = Object.keys(arr);
2125
+ let i;
2126
+ const len = keys.length;
2127
+ let key;
2128
+ for(i = 0; i < len; i++){
2129
+ key = keys[i];
2130
+ obj[key] = arr[key];
2131
+ }
2132
+ return obj;
2133
+ }
2374
2134
  /**
2375
2135
  * It takes a FormData object and returns a JavaScript object
2376
2136
  *
2377
2137
  * @param {string} formData The FormData object to convert to JSON.
2378
2138
  *
2379
2139
  * @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;
2140
+ */ function formDataToJSON(formData) {
2141
+ function buildPath(path, value, target, index) {
2142
+ let name = path[index++];
2143
+ if (name === '__proto__') return true;
2144
+ const isNumericKey = Number.isFinite(+name);
2145
+ const isLast = index >= path.length;
2146
+ name = !name && utils$2.isArray(target) ? target.length : name;
2147
+ if (isLast) {
2148
+ if (utils$2.hasOwnProp(target, name)) {
2149
+ target[name] = [
2150
+ target[name],
2151
+ value
2152
+ ];
2153
+ } else {
2154
+ target[name] = value;
2155
+ }
2156
+ return !isNumericKey;
2157
+ }
2158
+ if (!target[name] || !utils$2.isObject(target[name])) {
2159
+ target[name] = [];
2160
+ }
2161
+ const result = buildPath(path, value, target[name], index);
2162
+ if (result && utils$2.isArray(target[name])) {
2163
+ target[name] = arrayToObject(target[name]);
2164
+ }
2165
+ return !isNumericKey;
2166
+ }
2167
+ if (utils$2.isFormData(formData) && utils$2.isFunction(formData.entries)) {
2168
+ const obj = {};
2169
+ utils$2.forEachEntry(formData, (name, value)=>{
2170
+ buildPath(parsePropPath(name), value, obj, 0);
2171
+ });
2172
+ return obj;
2173
+ }
2174
+ return null;
2425
2175
  }
2426
2176
 
2427
2177
  /**
@@ -2433,158 +2183,147 @@ function formDataToJSON(formData) {
2433
2183
  * @param {Function} encoder - A function that takes a value and returns a string.
2434
2184
  *
2435
2185
  * @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
- /**
2186
+ */ function stringifySafely(rawValue, parser, encoder) {
2187
+ if (utils$2.isString(rawValue)) {
2188
+ try {
2189
+ (parser || JSON.parse)(rawValue);
2190
+ return utils$2.trim(rawValue);
2191
+ } catch (e) {
2192
+ if (e.name !== 'SyntaxError') {
2193
+ throw e;
2194
+ }
2195
+ }
2196
+ }
2197
+ return (encoder || JSON.stringify)(rawValue);
2198
+ }
2199
+ const defaults = {
2200
+ transitional: transitionalDefaults,
2201
+ adapter: [
2202
+ 'xhr',
2203
+ 'http',
2204
+ 'fetch'
2205
+ ],
2206
+ transformRequest: [
2207
+ function transformRequest(data, headers) {
2208
+ const contentType = headers.getContentType() || '';
2209
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
2210
+ const isObjectPayload = utils$2.isObject(data);
2211
+ if (isObjectPayload && utils$2.isHTMLForm(data)) {
2212
+ data = new FormData(data);
2213
+ }
2214
+ const isFormData = utils$2.isFormData(data);
2215
+ if (isFormData) {
2216
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2217
+ }
2218
+ if (utils$2.isArrayBuffer(data) || utils$2.isBuffer(data) || utils$2.isStream(data) || utils$2.isFile(data) || utils$2.isBlob(data) || utils$2.isReadableStream(data)) {
2219
+ return data;
2220
+ }
2221
+ if (utils$2.isArrayBufferView(data)) {
2222
+ return data.buffer;
2223
+ }
2224
+ if (utils$2.isURLSearchParams(data)) {
2225
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2226
+ return data.toString();
2227
+ }
2228
+ let isFileList;
2229
+ if (isObjectPayload) {
2230
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2231
+ return toURLEncodedForm(data, this.formSerializer).toString();
2232
+ }
2233
+ if ((isFileList = utils$2.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2234
+ const _FormData = this.env && this.env.FormData;
2235
+ return toFormData$1(isFileList ? {
2236
+ 'files[]': data
2237
+ } : data, _FormData && new _FormData(), this.formSerializer);
2238
+ }
2239
+ }
2240
+ if (isObjectPayload || hasJSONContentType) {
2241
+ headers.setContentType('application/json', false);
2242
+ return stringifySafely(data);
2243
+ }
2244
+ return data;
2245
+ }
2246
+ ],
2247
+ transformResponse: [
2248
+ function transformResponse(data) {
2249
+ const transitional = this.transitional || defaults.transitional;
2250
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2251
+ const JSONRequested = this.responseType === 'json';
2252
+ if (utils$2.isResponse(data) || utils$2.isReadableStream(data)) {
2253
+ return data;
2254
+ }
2255
+ if (data && utils$2.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2256
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
2257
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
2258
+ try {
2259
+ return JSON.parse(data);
2260
+ } catch (e) {
2261
+ if (strictJSONParsing) {
2262
+ if (e.name === 'SyntaxError') {
2263
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2264
+ }
2265
+ throw e;
2266
+ }
2267
+ }
2268
+ }
2269
+ return data;
2270
+ }
2271
+ ],
2272
+ /**
2545
2273
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
2546
2274
  * 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
-
2275
+ */ timeout: 0,
2276
+ xsrfCookieName: 'XSRF-TOKEN',
2277
+ xsrfHeaderName: 'X-XSRF-TOKEN',
2278
+ maxContentLength: -1,
2279
+ maxBodyLength: -1,
2280
+ env: {
2281
+ FormData: platform.classes.FormData,
2282
+ Blob: platform.classes.Blob
2283
+ },
2284
+ validateStatus: function validateStatus(status) {
2285
+ return status >= 200 && status < 300;
2286
+ },
2287
+ headers: {
2288
+ common: {
2289
+ 'Accept': 'application/json, text/plain, */*',
2290
+ 'Content-Type': undefined
2291
+ }
2292
+ }
2293
+ };
2294
+ utils$2.forEach([
2295
+ 'delete',
2296
+ 'get',
2297
+ 'head',
2298
+ 'post',
2299
+ 'put',
2300
+ 'patch'
2301
+ ], (method)=>{
2302
+ defaults.headers[method] = {};
2303
+ });
2577
2304
  const defaults$1 = defaults;
2578
2305
 
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
-
2306
+ // RawAxiosHeaders whose duplicates are ignored by node
2307
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
2308
+ const ignoreDuplicateOf = utils$2.toObjectSet([
2309
+ 'age',
2310
+ 'authorization',
2311
+ 'content-length',
2312
+ 'content-type',
2313
+ 'etag',
2314
+ 'expires',
2315
+ 'from',
2316
+ 'host',
2317
+ 'if-modified-since',
2318
+ 'if-unmodified-since',
2319
+ 'last-modified',
2320
+ 'location',
2321
+ 'max-forwards',
2322
+ 'proxy-authorization',
2323
+ 'referer',
2324
+ 'retry-after',
2325
+ 'user-agent'
2326
+ ]);
2588
2327
  /**
2589
2328
  * Parse headers into an object
2590
2329
  *
@@ -2598,346 +2337,270 @@ const ignoreDuplicateOf = utils$2.toObjectSet([
2598
2337
  * @param {String} rawHeaders Headers needing to be parsed
2599
2338
  *
2600
2339
  * @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
- };
2340
+ */ const parseHeaders = ((rawHeaders)=>{
2341
+ const parsed = {};
2342
+ let key;
2343
+ let val;
2344
+ let i;
2345
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2346
+ i = line.indexOf(':');
2347
+ key = line.substring(0, i).trim().toLowerCase();
2348
+ val = line.substring(i + 1).trim();
2349
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2350
+ return;
2351
+ }
2352
+ if (key === 'set-cookie') {
2353
+ if (parsed[key]) {
2354
+ parsed[key].push(val);
2355
+ } else {
2356
+ parsed[key] = [
2357
+ val
2358
+ ];
2359
+ }
2360
+ } else {
2361
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2362
+ }
2363
+ });
2364
+ return parsed;
2365
+ });
2630
2366
 
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
- /**
2367
+ const $internals = Symbol('internals');
2368
+ function normalizeHeader(header) {
2369
+ return header && String(header).trim().toLowerCase();
2370
+ }
2371
+ function normalizeValue(value) {
2372
+ if (value === false || value == null) {
2373
+ return value;
2374
+ }
2375
+ return utils$2.isArray(value) ? value.map(normalizeValue) : String(value);
2376
+ }
2377
+ function parseTokens(str) {
2378
+ const tokens = Object.create(null);
2379
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2380
+ let match;
2381
+ while(match = tokensRE.exec(str)){
2382
+ tokens[match[1]] = match[2];
2383
+ }
2384
+ return tokens;
2385
+ }
2386
+ const isValidHeaderName = (str)=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2387
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2388
+ if (utils$2.isFunction(filter)) {
2389
+ return filter.call(this, value, header);
2390
+ }
2391
+ if (isHeaderNameFilter) {
2392
+ value = header;
2393
+ }
2394
+ if (!utils$2.isString(value)) return;
2395
+ if (utils$2.isString(filter)) {
2396
+ return value.indexOf(filter) !== -1;
2397
+ }
2398
+ if (utils$2.isRegExp(filter)) {
2399
+ return filter.test(value);
2400
+ }
2401
+ }
2402
+ function formatHeader(header) {
2403
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str)=>{
2404
+ return char.toUpperCase() + str;
2405
+ });
2406
+ }
2407
+ function buildAccessors(obj, header) {
2408
+ const accessorName = utils$2.toCamelCase(' ' + header);
2409
+ [
2410
+ 'get',
2411
+ 'set',
2412
+ 'has'
2413
+ ].forEach((methodName)=>{
2414
+ Object.defineProperty(obj, methodName + accessorName, {
2415
+ value: function(arg1, arg2, arg3) {
2416
+ return this[methodName].call(this, header, arg1, arg2, arg3);
2417
+ },
2418
+ configurable: true
2419
+ });
2420
+ });
2421
+ }
2422
+ let AxiosHeaders = class AxiosHeaders {
2423
+ /**
2706
2424
  *
2707
2425
  * @param {*} header
2708
2426
  * @param {*} valueOrRewrite
2709
2427
  * @param {*} rewrite true:无论源值是否存在均赋值,false:源值如存在不覆盖,
2710
2428
  * undefined:源值不为 false 直接赋值,false 不赋值
2711
2429
  * @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
-
2430
+ */ set(header, valueOrRewrite, rewrite) {
2431
+ const self = this;
2432
+ function setHeader(_value, _header, _rewrite) {
2433
+ const lHeader = normalizeHeader(_header);
2434
+ if (!lHeader) {
2435
+ throw new Error('header name must be a non-empty string');
2436
+ }
2437
+ const key = utils$2.findKey(self, lHeader);
2438
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2439
+ self[key || _header] = normalizeValue(_value);
2440
+ }
2441
+ }
2442
+ const setHeaders = (headers, _rewrite)=>utils$2.forEach(headers, (_value, _header)=>setHeader(_value, _header, _rewrite));
2443
+ if (utils$2.isPlainObject(header) || header instanceof this.constructor) {
2444
+ setHeaders(header, valueOrRewrite);
2445
+ } else if (utils$2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2446
+ setHeaders(parseHeaders(header), valueOrRewrite);
2447
+ } else if (utils$2.isHeaders(header)) {
2448
+ for (const [key, value] of header.entries()){
2449
+ setHeader(value, key, rewrite);
2450
+ }
2451
+ } else {
2452
+ header != null && setHeader(valueOrRewrite, header, rewrite);
2453
+ }
2454
+ return this;
2455
+ }
2456
+ get(header, parser) {
2457
+ header = normalizeHeader(header);
2458
+ if (header) {
2459
+ const key = utils$2.findKey(this, header);
2460
+ if (key) {
2461
+ const value = this[key];
2462
+ if (!parser) {
2463
+ return value;
2464
+ }
2465
+ if (parser === true) {
2466
+ return parseTokens(value);
2467
+ }
2468
+ if (utils$2.isFunction(parser)) {
2469
+ return parser.call(this, value, key);
2470
+ }
2471
+ if (utils$2.isRegExp(parser)) {
2472
+ return parser.exec(value);
2473
+ }
2474
+ throw new TypeError('parser must be boolean|regexp|function');
2475
+ }
2476
+ }
2477
+ }
2478
+ has(header, matcher) {
2479
+ header = normalizeHeader(header);
2480
+ if (header) {
2481
+ const key = utils$2.findKey(this, header);
2482
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2483
+ }
2484
+ return false;
2485
+ }
2486
+ delete(header, matcher) {
2487
+ const self = this;
2488
+ let deleted = false;
2489
+ function deleteHeader(_header) {
2490
+ _header = normalizeHeader(_header);
2491
+ if (_header) {
2492
+ const key = utils$2.findKey(self, _header);
2493
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2494
+ delete self[key];
2495
+ deleted = true;
2496
+ }
2497
+ }
2498
+ }
2499
+ if (utils$2.isArray(header)) {
2500
+ header.forEach(deleteHeader);
2501
+ } else {
2502
+ deleteHeader(header);
2503
+ }
2504
+ return deleted;
2505
+ }
2506
+ clear(matcher) {
2507
+ const keys = Object.keys(this);
2508
+ let i = keys.length;
2509
+ let deleted = false;
2510
+ while(i--){
2511
+ const key = keys[i];
2512
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2513
+ delete this[key];
2514
+ deleted = true;
2515
+ }
2516
+ }
2517
+ return deleted;
2518
+ }
2519
+ normalize(format) {
2520
+ const self = this;
2521
+ const headers = {};
2522
+ utils$2.forEach(this, (value, header)=>{
2523
+ const key = utils$2.findKey(headers, header);
2524
+ if (key) {
2525
+ self[key] = normalizeValue(value);
2526
+ delete self[header];
2527
+ return;
2528
+ }
2529
+ const normalized = format ? formatHeader(header) : String(header).trim();
2530
+ if (normalized !== header) {
2531
+ delete self[header];
2532
+ }
2533
+ self[normalized] = normalizeValue(value);
2534
+ headers[normalized] = true;
2535
+ });
2536
+ return this;
2537
+ }
2538
+ concat(...targets) {
2539
+ return this.constructor.concat(this, ...targets);
2540
+ }
2541
+ toJSON(asStrings) {
2542
+ const obj = Object.create(null);
2543
+ utils$2.forEach(this, (value, header)=>{
2544
+ value != null && value !== false && (obj[header] = asStrings && utils$2.isArray(value) ? value.join(', ') : value);
2545
+ });
2546
+ return obj;
2547
+ }
2548
+ [Symbol.iterator]() {
2549
+ return Object.entries(this.toJSON())[Symbol.iterator]();
2550
+ }
2551
+ toString() {
2552
+ return Object.entries(this.toJSON()).map(([header, value])=>header + ': ' + value).join('\n');
2553
+ }
2554
+ get [Symbol.toStringTag]() {
2555
+ return 'AxiosHeaders';
2556
+ }
2557
+ static from(thing) {
2558
+ return thing instanceof this ? thing : new this(thing);
2559
+ }
2560
+ static concat(first, ...targets) {
2561
+ const computed = new this(first);
2562
+ targets.forEach((target)=>computed.set(target));
2563
+ return computed;
2564
+ }
2565
+ static accessor(header) {
2566
+ const internals = this[$internals] = this[$internals] = {
2567
+ accessors: {}
2568
+ };
2569
+ const accessors = internals.accessors;
2570
+ const prototype = this.prototype;
2571
+ function defineAccessor(_header) {
2572
+ const lHeader = normalizeHeader(_header);
2573
+ if (!accessors[lHeader]) {
2574
+ buildAccessors(prototype, _header);
2575
+ accessors[lHeader] = true;
2576
+ }
2577
+ }
2578
+ utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2579
+ return this;
2580
+ }
2581
+ constructor(headers){
2582
+ headers && this.set(headers);
2583
+ }
2584
+ };
2585
+ AxiosHeaders.accessor([
2586
+ 'Content-Type',
2587
+ 'Content-Length',
2588
+ 'Accept',
2589
+ 'Accept-Encoding',
2590
+ 'User-Agent',
2591
+ 'Authorization'
2592
+ ]);
2593
+ // reserved names hotfix
2594
+ utils$2.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key)=>{
2595
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2596
+ return {
2597
+ get: ()=>value,
2598
+ set (headerValue) {
2599
+ this[mapped] = headerValue;
2600
+ }
2601
+ };
2602
+ });
2603
+ utils$2.freezeMethods(AxiosHeaders);
2941
2604
  const AxiosHeaders$1 = AxiosHeaders;
2942
2605
 
2943
2606
  /**
@@ -2947,24 +2610,20 @@ const AxiosHeaders$1 = AxiosHeaders;
2947
2610
  * @param {?Object} response The response object
2948
2611
  *
2949
2612
  * @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;
2613
+ */ function transformData(fns, response) {
2614
+ const config = this || defaults$1;
2615
+ const context = response || config;
2616
+ const headers = AxiosHeaders$1.from(context.headers);
2617
+ let data = context.data;
2618
+ utils$2.forEach(fns, function transform(fn) {
2619
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2620
+ });
2621
+ headers.normalize();
2622
+ return data;
2964
2623
  }
2965
2624
 
2966
- function isCancel(value) {
2967
- return !!(value && value.__CANCEL__);
2625
+ function isCancel(value) {
2626
+ return !!(value && value.__CANCEL__);
2968
2627
  }
2969
2628
 
2970
2629
  /**
@@ -2975,15 +2634,13 @@ function isCancel(value) {
2975
2634
  * @param {Object=} request The request.
2976
2635
  *
2977
2636
  * @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
2637
+ */ function CanceledError(message, config, request) {
2638
+ // eslint-disable-next-line no-eq-null,eqeqeq
2639
+ AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
2640
+ this.name = 'CanceledError';
2641
+ }
2642
+ utils$2.inherits(CanceledError, AxiosError$1, {
2643
+ __CANCEL__: true
2987
2644
  });
2988
2645
 
2989
2646
  /**
@@ -2992,12 +2649,11 @@ utils$2.inherits(CanceledError, AxiosError$1, {
2992
2649
  * @param {string} url The URL to test
2993
2650
  *
2994
2651
  * @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);
2652
+ */ function isAbsoluteURL(url) {
2653
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2654
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2655
+ // by any combination of letters, digits, plus, period, or hyphen.
2656
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3001
2657
  }
3002
2658
 
3003
2659
  /**
@@ -3007,11 +2663,8 @@ function isAbsoluteURL(url) {
3007
2663
  * @param {string} relativeURL The relative URL
3008
2664
  *
3009
2665
  * @returns {string} The combined URL
3010
- */
3011
- function combineURLs(baseURL, relativeURL) {
3012
- return relativeURL
3013
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3014
- : baseURL;
2666
+ */ function combineURLs(baseURL, relativeURL) {
2667
+ return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
3015
2668
  }
3016
2669
 
3017
2670
  /**
@@ -3023,96 +2676,76 @@ function combineURLs(baseURL, relativeURL) {
3023
2676
  * @param {string} requestedURL Absolute or relative URL to combine
3024
2677
  *
3025
2678
  * @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;
2679
+ */ function buildFullPath(baseURL, requestedURL) {
2680
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
2681
+ return combineURLs(baseURL, requestedURL);
2682
+ }
2683
+ return requestedURL;
3032
2684
  }
3033
2685
 
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
-
2686
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2687
+ let XhrAdapter = class XhrAdapter {
2688
+ init(config) {}
2689
+ request() {}
2690
+ stream() {}
2691
+ constructor(config){
2692
+ this.init(config);
2693
+ }
2694
+ };
3047
2695
  const XhrAdapter$1 = isXHRAdapterSupported && XhrAdapter;
3048
2696
 
3049
- const knownAdapters = {
3050
- http: HttpAdapter, // browser mode: httpAdapter === null
3051
- xhr: XhrAdapter$1, // node mode: xhrAdapter === null
3052
- };
3053
-
2697
+ const knownAdapters = {
2698
+ http: HttpAdapter,
2699
+ xhr: XhrAdapter$1
2700
+ };
3054
2701
  /**
3055
2702
  * define adapter's name and adapterName to http or xhr
3056
2703
  * 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
- /**
2704
+ */ utils$2.forEach(knownAdapters, (val, key)=>{
2705
+ if (val) {
2706
+ try {
2707
+ Object.defineProperty(val, 'name', {
2708
+ value: key
2709
+ });
2710
+ } catch (e) {
2711
+ // eslint-disable-next-line no-empty
2712
+ }
2713
+ Object.defineProperty(val, 'adapterName', {
2714
+ value: key
2715
+ });
2716
+ }
2717
+ });
2718
+ const adapters = {
2719
+ /**
3071
2720
  * get http or xhr adapter
3072
2721
  * @param {*} adapters user pass or ['xhr', 'http']
3073
2722
  * @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,
2723
+ */ getAdapter: (adapters)=>{
2724
+ adapters = utils$2.isArray(adapters) ? adapters : [
2725
+ adapters
2726
+ ];
2727
+ const { length } = adapters;
2728
+ let nameOrAdapter;
2729
+ let adapter;
2730
+ // find not null adapter
2731
+ for(let i = 0; i < length; i++){
2732
+ nameOrAdapter = adapters[i];
2733
+ if (adapter = utils$2.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
2734
+ break;
2735
+ }
2736
+ }
2737
+ if (!adapter) {
2738
+ if (adapter === false) {
2739
+ throw new AxiosError$1(`Adapter ${nameOrAdapter} is not supported by the environment`, 'ERR_NOT_SUPPORT');
2740
+ }
2741
+ throw new Error(utils$2.hasOwnProp(knownAdapters, nameOrAdapter) ? `Adapter '${nameOrAdapter}' is not available in the build` : `Unknown adapter '${nameOrAdapter}'`);
2742
+ }
2743
+ if (!utils$2.isFunction(adapter)) {
2744
+ throw new TypeError('adapter is not a function');
2745
+ }
2746
+ return adapter;
2747
+ },
2748
+ adapters: knownAdapters
3116
2749
  };
3117
2750
 
3118
2751
  /**
@@ -3121,82 +2754,70 @@ const adapters = {
3121
2754
  * @param {Object} config The config that is to be used for the request
3122
2755
  *
3123
2756
  * @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
-
2757
+ */ function throwIfCancellationRequested(config) {
2758
+ if (config.cancelToken) {
2759
+ config.cancelToken.throwIfRequested();
2760
+ }
2761
+ if (config.signal && config.signal.aborted) {
2762
+ throw new CanceledError(null, config);
2763
+ }
2764
+ }
3135
2765
  /**
3136
2766
  * Dispatch a request to the server using the configured adapter.
3137
2767
  * 请求如有异常,需向外抛出异常,不拦截
3138
2768
  * @param {object} config The config that is to be used for the request
3139
2769
  *
3140
2770
  * @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
2771
+ */ function dispatchRequest(config) {
2772
+ let R;
2773
+ throwIfCancellationRequested(config);
2774
+ config.headers = AxiosHeaders$1.from(config.headers);
2775
+ // Transform request data
2776
+ config.data = transformData.call(config, config.transformRequest);
2777
+ if ([
2778
+ 'post',
2779
+ 'put',
2780
+ 'patch'
2781
+ ].indexOf(config.method) !== -1) {
2782
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
2783
+ }
2784
+ const Adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
2785
+ const adapter = new Adapter(config);
2786
+ if (config.stream) R = adapter.request(this);
2787
+ else {
2788
+ R = adapter.request(this).then((response)=>{
2789
+ throwIfCancellationRequested(config);
2790
+ // Transform response data
2791
+ response.data = transformData.call(config, config.transformResponse, response);
2792
+ // ! body === data
2793
+ Object.defineProperty(response, 'body', {
2794
+ get () {
2795
+ return response.data;
2796
+ }
2797
+ });
2798
+ // if (response.data && !response.body) response.body = response.data
2799
+ response.headers = AxiosHeaders$1.from(response.headers);
2800
+ return response;
2801
+ }, (reason)=>{
2802
+ if (!isCancel(reason)) {
2803
+ throwIfCancellationRequested(config);
2804
+ // Transform response data
2805
+ if (reason && reason.response) {
2806
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
2807
+ // body === data
2808
+ if (reason.response.data && !reason.response.body) reason.response.body = reason.response.data;
2809
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2810
+ }
2811
+ }
2812
+ return Promise.reject(reason);
2813
+ });
2814
+ }
2815
+ return R;
3196
2816
  }
3197
2817
 
3198
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3199
-
2818
+ const headersToObject = (thing)=>thing instanceof AxiosHeaders$1 ? {
2819
+ ...thing
2820
+ } : thing;
3200
2821
  /**
3201
2822
  * Config-specific merge-function which creates a new config-object
3202
2823
  * by merging two configuration objects together.
@@ -3205,111 +2826,108 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing
3205
2826
  * @param {Object} config2
3206
2827
  *
3207
2828
  * @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;
2829
+ */ function mergeConfig(config1, config2) {
2830
+ // eslint-disable-next-line no-param-reassign
2831
+ config2 = config2 || {};
2832
+ const config = {};
2833
+ function getMergedValue(target, source, caseless) {
2834
+ if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
2835
+ return utils$2.merge.call({
2836
+ caseless
2837
+ }, target, source);
2838
+ } else if (utils$2.isPlainObject(source)) {
2839
+ return utils$2.merge({}, source);
2840
+ } else if (utils$2.isArray(source)) {
2841
+ return source.slice();
2842
+ }
2843
+ return source;
2844
+ }
2845
+ // eslint-disable-next-line consistent-return
2846
+ function mergeDeepProperties(a, b, caseless) {
2847
+ if (!utils$2.isUndefined(b)) {
2848
+ return getMergedValue(a, b, caseless);
2849
+ } else if (!utils$2.isUndefined(a)) {
2850
+ return getMergedValue(undefined, a, caseless);
2851
+ }
2852
+ }
2853
+ // eslint-disable-next-line consistent-return
2854
+ function valueFromConfig2(a, b) {
2855
+ if (!utils$2.isUndefined(b)) {
2856
+ return getMergedValue(undefined, b);
2857
+ }
2858
+ }
2859
+ // eslint-disable-next-line consistent-return
2860
+ function defaultToConfig2(a, b) {
2861
+ if (!utils$2.isUndefined(b)) {
2862
+ return getMergedValue(undefined, b);
2863
+ } else if (!utils$2.isUndefined(a)) {
2864
+ return getMergedValue(undefined, a);
2865
+ }
2866
+ }
2867
+ // eslint-disable-next-line consistent-return
2868
+ function mergeDirectKeys(a, b, prop) {
2869
+ if (prop in config2) {
2870
+ return getMergedValue(a, b);
2871
+ } else if (prop in config1) {
2872
+ return getMergedValue(undefined, a);
2873
+ }
2874
+ }
2875
+ const mergeMap = {
2876
+ url: valueFromConfig2,
2877
+ method: valueFromConfig2,
2878
+ data: valueFromConfig2,
2879
+ baseURL: defaultToConfig2,
2880
+ transformRequest: defaultToConfig2,
2881
+ transformResponse: defaultToConfig2,
2882
+ paramsSerializer: defaultToConfig2,
2883
+ timeout: defaultToConfig2,
2884
+ timeoutMessage: defaultToConfig2,
2885
+ withCredentials: defaultToConfig2,
2886
+ withXSRFToken: defaultToConfig2,
2887
+ adapter: defaultToConfig2,
2888
+ responseType: defaultToConfig2,
2889
+ xsrfCookieName: defaultToConfig2,
2890
+ xsrfHeaderName: defaultToConfig2,
2891
+ onUploadProgress: defaultToConfig2,
2892
+ onDownloadProgress: defaultToConfig2,
2893
+ decompress: defaultToConfig2,
2894
+ maxContentLength: defaultToConfig2,
2895
+ maxBodyLength: defaultToConfig2,
2896
+ beforeRedirect: defaultToConfig2,
2897
+ transport: defaultToConfig2,
2898
+ httpAgent: defaultToConfig2,
2899
+ httpsAgent: defaultToConfig2,
2900
+ cancelToken: defaultToConfig2,
2901
+ socketPath: defaultToConfig2,
2902
+ responseEncoding: defaultToConfig2,
2903
+ validateStatus: mergeDirectKeys,
2904
+ headers: (a, b)=>mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2905
+ };
2906
+ utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2907
+ const merge = mergeMap[prop] || mergeDeepProperties;
2908
+ const configValue = merge(config1[prop], config2[prop], prop);
2909
+ utils$2.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2910
+ });
2911
+ return config;
3298
2912
  }
3299
2913
 
3300
2914
  const VERSION = "1.7.7";
3301
2915
 
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
-
2916
+ const validators$1 = {};
2917
+ // eslint-disable-next-line func-names
2918
+ [
2919
+ 'object',
2920
+ 'boolean',
2921
+ 'number',
2922
+ 'function',
2923
+ 'string',
2924
+ 'symbol'
2925
+ ].forEach((type, i)=>{
2926
+ validators$1[type] = function validator(thing) {
2927
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2928
+ };
2929
+ });
2930
+ const deprecatedWarnings = {};
3313
2931
  /**
3314
2932
  * Transitional option validator
3315
2933
  *
@@ -3318,44 +2936,30 @@ const deprecatedWarnings = {};
3318
2936
  * @param {string?} message - some message with additional info
3319
2937
  *
3320
2938
  * @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
-
2939
+ */ validators$1.transitional = function transitional(validator, version, message) {
2940
+ function formatMessage(opt, desc) {
2941
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2942
+ }
2943
+ // eslint-disable-next-line func-names
2944
+ return (value, opt, opts)=>{
2945
+ if (validator === false) {
2946
+ throw new AxiosError$1(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError$1.ERR_DEPRECATED);
2947
+ }
2948
+ if (version && !deprecatedWarnings[opt]) {
2949
+ deprecatedWarnings[opt] = true;
2950
+ // eslint-disable-next-line no-console
2951
+ console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
2952
+ }
2953
+ return validator ? validator(value, opt, opts) : true;
2954
+ };
2955
+ };
2956
+ validators$1.spelling = function spelling(correctSpelling) {
2957
+ return (value, opt)=>{
2958
+ // eslint-disable-next-line no-console
2959
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
2960
+ return true;
2961
+ };
2962
+ };
3359
2963
  /**
3360
2964
  * Assert object's properties type
3361
2965
  *
@@ -3364,58 +2968,42 @@ validators$1.spelling = function spelling(correctSpelling) {
3364
2968
  * @param {boolean?} allowUnknown
3365
2969
  *
3366
2970
  * @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
2971
+ */ function assertOptions(options, schema, allowUnknown) {
2972
+ if (typeof options !== 'object') {
2973
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
2974
+ }
2975
+ const keys = Object.keys(options);
2976
+ let i = keys.length;
2977
+ while(i-- > 0){
2978
+ const opt = keys[i];
2979
+ const validator = schema[opt];
2980
+ if (validator) {
2981
+ const value = options[opt];
2982
+ const result = value === undefined || validator(value, opt, options);
2983
+ if (result !== true) {
2984
+ throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
2985
+ }
2986
+ continue;
2987
+ }
2988
+ if (allowUnknown !== true) {
2989
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
2990
+ }
2991
+ }
2992
+ }
2993
+ const validator = {
2994
+ assertOptions,
2995
+ validators: validators$1
3395
2996
  };
3396
2997
 
3397
- const {validators} = validator;
3398
-
2998
+ const { validators } = validator;
3399
2999
  /**
3400
3000
  * Create a new instance of Axios
3401
3001
  *
3402
3002
  * @param {Object} instanceConfig The default config for the instance
3403
3003
  *
3404
3004
  * @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
- /**
3005
+ */ let Axios = class Axios {
3006
+ /**
3419
3007
  * !+++
3420
3008
  * config 属性直接挂在到实例上,方便读取、设置、修改
3421
3009
  * 需注意,不要与其属性、方法冲突!!!
@@ -3428,252 +3016,222 @@ class Axios {
3428
3016
  put(url[, data[, config]])
3429
3017
  patch(url[, data[, config]])
3430
3018
  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
- /**
3019
+ */ init() {
3020
+ const m = this;
3021
+ [
3022
+ 'url',
3023
+ 'method',
3024
+ 'baseURL',
3025
+ 'transformRequest',
3026
+ 'transformResponse',
3027
+ 'headers',
3028
+ 'params',
3029
+ 'paramsSerializer',
3030
+ 'body',
3031
+ 'data',
3032
+ 'timeout',
3033
+ 'withCredentials',
3034
+ 'adapter',
3035
+ 'auth',
3036
+ 'responseType',
3037
+ 'responseEncoding',
3038
+ 'xsrfCookieName',
3039
+ 'xsrfHeaderName',
3040
+ 'onUploadProgress',
3041
+ 'onDownloadProgress',
3042
+ 'maxContentLength',
3043
+ 'maxBodyLength',
3044
+ 'validateStatus',
3045
+ 'maxRedirects',
3046
+ 'beforeRedirect',
3047
+ 'socketPath',
3048
+ 'httpAgent',
3049
+ 'httpsAgent',
3050
+ 'agent',
3051
+ 'cancelToken',
3052
+ 'signal',
3053
+ 'decompress',
3054
+ 'insecureHTTPParser',
3055
+ 'transitional',
3056
+ 'env',
3057
+ 'formSerializer',
3058
+ 'maxRate'
3059
+ ].forEach((p)=>Object.defineProperty(m, p, {
3060
+ enumerable: true,
3061
+ get () {
3062
+ return m.config[p];
3063
+ },
3064
+ set (value) {
3065
+ m.config[p] = value;
3066
+ }
3067
+ }));
3068
+ }
3069
+ /**
3487
3070
  * Dispatch a request
3488
3071
  * 启动执行请求,返回 Promise 实例
3489
3072
  * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3490
3073
  * @param {?Object} config
3491
3074
  * @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
- /**
3075
+ */ async request(configOrUrl, config) {
3076
+ try {
3077
+ return await this._request(configOrUrl, config);
3078
+ } catch (err) {
3079
+ if (err instanceof Error) {
3080
+ let dummy = {};
3081
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3082
+ // slice off the Error: ... line
3083
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3084
+ try {
3085
+ if (!err.stack) {
3086
+ err.stack = stack;
3087
+ // match without the 2 top stack lines
3088
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3089
+ err.stack += '\n' + stack;
3090
+ }
3091
+ } catch (e) {
3092
+ // ignore the case where "stack" is an un-writable property
3093
+ }
3094
+ }
3095
+ throw err // 抛出异常
3096
+ ;
3097
+ }
3098
+ }
3099
+ /**
3521
3100
  * 执行请求
3522
3101
  * @param {*} configOrUrl
3523
3102
  * @param {*} config
3524
3103
  * @param {boolean} [stream = false] - 是否返回 stream
3525
3104
  * @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
- /**
3105
+ */ _request(configOrUrl, config, stream = false) {
3106
+ let R = null;
3107
+ /* eslint no-param-reassign:0 */ // Allow for axios('example/url'[, config]) a la fetch API
3108
+ if (typeof configOrUrl === 'string') {
3109
+ config = config || {};
3110
+ config.url = configOrUrl;
3111
+ } else {
3112
+ config = configOrUrl || {};
3113
+ }
3114
+ // ! body as data alias, body ==> data,内部保持data不变
3115
+ if (!config.data && config.body) {
3116
+ config.data = config.body;
3117
+ // config.body = undefined;
3118
+ }
3119
+ config = mergeConfig(this.defaults, config);
3120
+ const { transitional, paramsSerializer, headers } = config;
3121
+ if (transitional !== undefined) {
3122
+ validator.assertOptions(transitional, {
3123
+ silentJSONParsing: validators.transitional(validators.boolean),
3124
+ forcedJSONParsing: validators.transitional(validators.boolean),
3125
+ clarifyTimeoutError: validators.transitional(validators.boolean)
3126
+ }, false);
3127
+ }
3128
+ if (paramsSerializer) {
3129
+ if (utils$2.isFunction(paramsSerializer)) {
3130
+ config.paramsSerializer = {
3131
+ serialize: paramsSerializer
3132
+ };
3133
+ } else {
3134
+ validator.assertOptions(paramsSerializer, {
3135
+ encode: validators.function,
3136
+ serialize: validators.function
3137
+ }, true);
3138
+ }
3139
+ }
3140
+ validator.assertOptions(config, {
3141
+ baseUrl: validators.spelling('baseURL'),
3142
+ withXsrfToken: validators.spelling('withXSRFToken')
3143
+ }, true);
3144
+ // Set config.method
3145
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3146
+ // Flatten headers,方法头覆盖通用头
3147
+ const contextHeaders = headers && utils$2.merge(headers.common, headers[config.method]);
3148
+ headers && utils$2.forEach([
3149
+ 'delete',
3150
+ 'get',
3151
+ 'head',
3152
+ 'post',
3153
+ 'put',
3154
+ 'patch',
3155
+ 'common'
3156
+ ], (method)=>{
3157
+ delete headers[method];
3158
+ });
3159
+ // 源值存在,则不覆盖,contextHeaders 优先于 headers
3160
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3161
+ // filter out skipped interceptors
3162
+ const requestInterceptorChain = [] // 请求拦截器,hook
3163
+ ;
3164
+ let synchronousRequestInterceptors = true;
3165
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3166
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3167
+ return;
3168
+ }
3169
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3170
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3171
+ });
3172
+ const responseInterceptorChain = [] // 响应拦截器,hook
3173
+ ;
3174
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3175
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3176
+ });
3177
+ let promise;
3178
+ let i = 0;
3179
+ let len;
3180
+ debugger;
3181
+ // 执行dispatchRequest
3182
+ // !+++ stream
3183
+ if (stream) {
3184
+ config.stream = true;
3185
+ R = dispatchRequest.call(this, config) // not promise
3186
+ ;
3187
+ } else if (!synchronousRequestInterceptors) {
3188
+ // 异步拦截器
3189
+ const chain = [
3190
+ dispatchRequest.bind(this),
3191
+ undefined
3192
+ ] // dispatchRequest 放入运行链
3193
+ ;
3194
+ chain.unshift(...requestInterceptorChain) // !*** 插入头
3195
+ ;
3196
+ chain.push(...responseInterceptorChain) // !*** 加入尾
3197
+ ;
3198
+ len = chain.length;
3199
+ promise = Promise.resolve(config) // promise 对象
3200
+ ;
3201
+ // 传入config配置,按顺序执行
3202
+ while(i < len)promise = promise.then(chain[i++], chain[i++]);
3203
+ R = promise;
3204
+ } else {
3205
+ // 同步拦截器
3206
+ len = requestInterceptorChain.length;
3207
+ let newConfig = config;
3208
+ i = 0;
3209
+ // 按加入顺序运行 request 拦截器
3210
+ while(i < len){
3211
+ const onFulfilled = requestInterceptorChain[i++];
3212
+ const onRejected = requestInterceptorChain[i++];
3213
+ try {
3214
+ newConfig = onFulfilled(newConfig) // 执行
3215
+ ;
3216
+ } catch (error) {
3217
+ onRejected.call(this, error);
3218
+ break;
3219
+ }
3220
+ }
3221
+ try {
3222
+ promise = dispatchRequest.call(this, newConfig);
3223
+ i = 0;
3224
+ len = responseInterceptorChain.length;
3225
+ // 按顺序执行响应 hook
3226
+ while(i < len)promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3227
+ R = promise;
3228
+ } catch (error) {
3229
+ R = Promise.reject(error);
3230
+ }
3231
+ }
3232
+ return R;
3233
+ }
3234
+ /**
3677
3235
  * !+++
3678
3236
  * 类似 request 库,返回 stream
3679
3237
  * stream 模式下,拦截器无效
@@ -3682,111 +3240,110 @@ class Axios {
3682
3240
  * @param {*} configOrUrl
3683
3241
  * @param {*} config
3684
3242
  * @returns
3685
- */
3686
- stream(configOrUrl, config) {
3687
- return this._request(configOrUrl, config, true)
3688
- }
3689
-
3690
- /**
3243
+ */ stream(configOrUrl, config) {
3244
+ return this._request(configOrUrl, config, true);
3245
+ }
3246
+ /**
3691
3247
  *
3692
3248
  * @param {*} config
3693
3249
  * @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
-
3250
+ */ getUri(config) {
3251
+ config = mergeConfig(this.defaults, config);
3252
+ const fullPath = buildFullPath(config.baseURL, config.url);
3253
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3254
+ }
3255
+ constructor(instanceConfig){
3256
+ this.defaults = instanceConfig;
3257
+ this.config = this.defaults // !+++
3258
+ ;
3259
+ this.interceptors = {
3260
+ request: new InterceptorManager$1(),
3261
+ response: new InterceptorManager$1()
3262
+ };
3263
+ this.init() // !+++
3264
+ ;
3265
+ }
3266
+ };
3267
+ // Provide aliases for supported request methods
3268
+ utils$2.forEach([
3269
+ 'head',
3270
+ 'options'
3271
+ ], function forEachMethodNoData(method) {
3272
+ /* eslint func-names:0 */ Axios.prototype[method] = function(url, config) {
3273
+ return this.request(mergeConfig(config || {}, {
3274
+ method,
3275
+ url,
3276
+ data: (config || {}).data
3277
+ }));
3278
+ };
3279
+ });
3280
+ // delete、get, 与 axios不同,第二个参数为 params,而不是 data
3281
+ utils$2.forEach([
3282
+ 'delete',
3283
+ 'get'
3284
+ ], function forEachMethodNoData(method) {
3285
+ Axios.prototype[method] = function(url, params, config) {
3286
+ return this.request(mergeConfig(config || {}, {
3287
+ method,
3288
+ url,
3289
+ params
3290
+ }));
3291
+ };
3292
+ });
3293
+ utils$2.forEach([
3294
+ 'post',
3295
+ 'put',
3296
+ 'patch'
3297
+ ], function forEachMethodWithData(method) {
3298
+ function generateHTTPMethod(isForm) {
3299
+ return function httpMethod(url, data, config) {
3300
+ return this.request(mergeConfig(config || {}, {
3301
+ method,
3302
+ headers: isForm ? {
3303
+ 'Content-Type': 'multipart/form-data'
3304
+ } : {},
3305
+ url,
3306
+ data
3307
+ }));
3308
+ };
3309
+ }
3310
+ Axios.prototype[method] = generateHTTPMethod();
3311
+ Axios.prototype[`${method}Form`] = generateHTTPMethod(true);
3312
+ });
3313
+ // stream get, 与 axios不同,第二个参数为 params,而不是 data
3314
+ utils$2.forEach([
3315
+ 'gets'
3316
+ ], function forEachMethodNoData(method) {
3317
+ Axios.prototype[method] = function(url, params, config) {
3318
+ return this.stream(mergeConfig(config || {}, {
3319
+ method,
3320
+ url,
3321
+ params,
3322
+ data: (config || {}).data
3323
+ }));
3324
+ };
3325
+ });
3326
+ // stream post put patch
3327
+ utils$2.forEach([
3328
+ 'posts',
3329
+ 'puts',
3330
+ 'patchs'
3331
+ ], function forEachMethodWithData(method) {
3332
+ function generateStreamMethod(isForm) {
3333
+ return function httpMethod(url, data, config) {
3334
+ return this.stream(mergeConfig(config || {}, {
3335
+ method,
3336
+ headers: isForm ? {
3337
+ 'Content-Type': 'multipart/form-data'
3338
+ } : {},
3339
+ url,
3340
+ data
3341
+ }));
3342
+ };
3343
+ }
3344
+ Axios.prototype[method] = generateStreamMethod();
3345
+ Axios.prototype[`${method}Forms`] = generateStreamMethod(true);
3346
+ });
3790
3347
  const Axios$1 = Axios;
3791
3348
 
3792
3349
  /**
@@ -3795,130 +3352,103 @@ const Axios$1 = Axios;
3795
3352
  * @param {Function} executor The executor function.
3796
3353
  *
3797
3354
  * @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
- /**
3355
+ */ let CancelToken = class CancelToken {
3356
+ /**
3853
3357
  * Throws a `CanceledError` if cancellation has been requested.
3854
- */
3855
- throwIfRequested() {
3856
- if (this.reason) {
3857
- throw this.reason;
3858
- }
3859
- }
3860
-
3861
- /**
3358
+ */ throwIfRequested() {
3359
+ if (this.reason) {
3360
+ throw this.reason;
3361
+ }
3362
+ }
3363
+ /**
3862
3364
  * 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
- /**
3365
+ */ subscribe(listener) {
3366
+ if (this.reason) {
3367
+ listener(this.reason);
3368
+ return;
3369
+ }
3370
+ if (this._listeners) {
3371
+ this._listeners.push(listener);
3372
+ } else {
3373
+ this._listeners = [
3374
+ listener
3375
+ ];
3376
+ }
3377
+ }
3378
+ /**
3879
3379
  * 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
- /**
3380
+ */ unsubscribe(listener) {
3381
+ if (!this._listeners) {
3382
+ return;
3383
+ }
3384
+ const index = this._listeners.indexOf(listener);
3385
+ if (index !== -1) {
3386
+ this._listeners.splice(index, 1);
3387
+ }
3388
+ }
3389
+ toAbortSignal() {
3390
+ const controller = new AbortController();
3391
+ const abort = (err)=>{
3392
+ controller.abort(err);
3393
+ };
3394
+ this.subscribe(abort);
3395
+ controller.signal.unsubscribe = ()=>this.unsubscribe(abort);
3396
+ return controller.signal;
3397
+ }
3398
+ /**
3907
3399
  * Returns an object that contains a new `CancelToken` and a function that, when called,
3908
3400
  * 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
-
3401
+ */ static source() {
3402
+ let cancel;
3403
+ const token = new CancelToken(function executor(c) {
3404
+ cancel = c;
3405
+ });
3406
+ return {
3407
+ token,
3408
+ cancel
3409
+ };
3410
+ }
3411
+ constructor(executor){
3412
+ if (typeof executor !== 'function') {
3413
+ throw new TypeError('executor must be a function.');
3414
+ }
3415
+ let resolvePromise;
3416
+ this.promise = new Promise(function promiseExecutor(resolve) {
3417
+ resolvePromise = resolve;
3418
+ });
3419
+ const token = this;
3420
+ // eslint-disable-next-line func-names
3421
+ this.promise.then((cancel)=>{
3422
+ if (!token._listeners) return;
3423
+ let i = token._listeners.length;
3424
+ while(i-- > 0){
3425
+ token._listeners[i](cancel);
3426
+ }
3427
+ token._listeners = null;
3428
+ });
3429
+ // eslint-disable-next-line func-names
3430
+ this.promise.then = (onfulfilled)=>{
3431
+ let _resolve;
3432
+ // eslint-disable-next-line func-names
3433
+ const promise = new Promise((resolve)=>{
3434
+ token.subscribe(resolve);
3435
+ _resolve = resolve;
3436
+ }).then(onfulfilled);
3437
+ promise.cancel = function reject() {
3438
+ token.unsubscribe(_resolve);
3439
+ };
3440
+ return promise;
3441
+ };
3442
+ executor(function cancel(message, config, request) {
3443
+ if (token.reason) {
3444
+ // Cancellation has already been requested
3445
+ return;
3446
+ }
3447
+ token.reason = new CanceledError(message, config, request);
3448
+ resolvePromise(token.reason);
3449
+ });
3450
+ }
3451
+ };
3922
3452
  const CancelToken$1 = CancelToken;
3923
3453
 
3924
3454
  /**
@@ -3941,11 +3471,10 @@ const CancelToken$1 = CancelToken;
3941
3471
  * @param {Function} callback
3942
3472
  *
3943
3473
  * @returns {Function}
3944
- */
3945
- function spread(callback) {
3946
- return function wrap(arr) {
3947
- return callback.apply(null, arr);
3948
- };
3474
+ */ function spread(callback) {
3475
+ return function wrap(arr) {
3476
+ return callback.apply(null, arr);
3477
+ };
3949
3478
  }
3950
3479
 
3951
3480
  /**
@@ -3954,9 +3483,8 @@ function spread(callback) {
3954
3483
  * @param {*} payload The value to test
3955
3484
  *
3956
3485
  * @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);
3486
+ */ function isAxiosError(payload) {
3487
+ return utils$2.isObject(payload) && payload.isAxiosError === true;
3960
3488
  }
3961
3489
 
3962
3490
  /**
@@ -3965,61 +3493,47 @@ function isAxiosError(payload) {
3965
3493
  * @param {Object} defaultConfig The default config for the instance
3966
3494
  *
3967
3495
  * @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
-
3496
+ */ function createInstance(defaultConfig) {
3497
+ const context = new Axios$1(defaultConfig);
3498
+ const instance = bind$1(Axios$1.prototype.request, context);
3499
+ // Copy axios.prototype to instance
3500
+ utils$2.extend(instance, Axios$1.prototype, context, {
3501
+ allOwnKeys: true
3502
+ });
3503
+ // Copy context to instance
3504
+ utils$2.extend(instance, context, null, {
3505
+ allOwnKeys: true
3506
+ });
3507
+ // Factory for creating new instances
3508
+ instance.create = function create(instanceConfig) {
3509
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3510
+ };
3511
+ return instance;
3512
+ }
3513
+ // Create the default instance to be exported
3514
+ const req = createInstance(defaults$1);
3515
+ // Expose Axios class to allow class inheritance
3516
+ req.Axios = Axios$1;
3517
+ // Expose Cancel & CancelToken
3518
+ req.CanceledError = CanceledError;
3519
+ req.CancelToken = CancelToken$1;
3520
+ req.isCancel = isCancel;
3521
+ req.VERSION = VERSION;
3522
+ req.toFormData = toFormData$1;
3523
+ // Expose AxiosError class
3524
+ req.AxiosError = AxiosError$1;
3525
+ // alias for CanceledError for backward compatibility
3526
+ req.Cancel = req.CanceledError;
3527
+ // Expose all/spread
3528
+ req.all = (promises)=>Promise.all(promises);
3529
+ req.spread = spread;
3530
+ // Expose isAxiosError
3531
+ req.isAxiosError = isAxiosError;
3532
+ // Expose mergeConfig
3533
+ req.mergeConfig = mergeConfig;
3534
+ req.AxiosHeaders = AxiosHeaders$1;
3535
+ req.formToJSON = (thing)=>formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
3536
+ req.getAdapter = adapters.getAdapter;
4023
3537
  req.default = req;
4024
3538
 
4025
3539
  module.exports = req;