seatable-html-page-sdk 0.0.11 → 0.0.12
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/index.js +1077 -758
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/iframe-adapter.js +7 -0
- package/es/iframe-adapter.js.map +1 -1
- package/lib/iframe-adapter.js +7 -0
- package/lib/iframe-adapter.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
*
|
|
52
52
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
53
53
|
*/
|
|
54
|
-
const isUndefined = typeOfTest(
|
|
54
|
+
const isUndefined = typeOfTest('undefined');
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Determine if a value is a Buffer
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
*
|
|
79
79
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
80
80
|
*/
|
|
81
|
-
const isArrayBuffer = kindOfTest(
|
|
81
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
*/
|
|
90
90
|
function isArrayBufferView(val) {
|
|
91
91
|
let result;
|
|
92
|
-
if (typeof ArrayBuffer !==
|
|
92
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
93
93
|
result = ArrayBuffer.isView(val);
|
|
94
94
|
} else {
|
|
95
95
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
*
|
|
105
105
|
* @returns {boolean} True if value is a String, otherwise false
|
|
106
106
|
*/
|
|
107
|
-
const isString = typeOfTest(
|
|
107
|
+
const isString = typeOfTest('string');
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Determine if a value is a Function
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
* @param {*} val The value to test
|
|
113
113
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
114
114
|
*/
|
|
115
|
-
const isFunction$1 = typeOfTest(
|
|
115
|
+
const isFunction$1 = typeOfTest('function');
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Determine if a value is a Number
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
*
|
|
122
122
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
123
123
|
*/
|
|
124
|
-
const isNumber = typeOfTest(
|
|
124
|
+
const isNumber = typeOfTest('number');
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* Determine if a value is an Object
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
*
|
|
131
131
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
132
132
|
*/
|
|
133
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
133
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* Determine if a value is a Boolean
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
149
149
|
*/
|
|
150
150
|
const isPlainObject = (val) => {
|
|
151
|
-
if (kindOf(val) !==
|
|
151
|
+
if (kindOf(val) !== 'object') {
|
|
152
152
|
return false;
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -176,10 +176,7 @@
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
try {
|
|
179
|
-
return (
|
|
180
|
-
Object.keys(val).length === 0 &&
|
|
181
|
-
Object.getPrototypeOf(val) === Object.prototype
|
|
182
|
-
);
|
|
179
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
183
180
|
} catch (e) {
|
|
184
181
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
185
182
|
return false;
|
|
@@ -193,7 +190,7 @@
|
|
|
193
190
|
*
|
|
194
191
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
195
192
|
*/
|
|
196
|
-
const isDate = kindOfTest(
|
|
193
|
+
const isDate = kindOfTest('Date');
|
|
197
194
|
|
|
198
195
|
/**
|
|
199
196
|
* Determine if a value is a File
|
|
@@ -202,7 +199,32 @@
|
|
|
202
199
|
*
|
|
203
200
|
* @returns {boolean} True if value is a File, otherwise false
|
|
204
201
|
*/
|
|
205
|
-
const isFile = kindOfTest(
|
|
202
|
+
const isFile = kindOfTest('File');
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Determine if a value is a React Native Blob
|
|
206
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
207
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
208
|
+
*
|
|
209
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
210
|
+
*
|
|
211
|
+
* @param {*} value The value to test
|
|
212
|
+
*
|
|
213
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
214
|
+
*/
|
|
215
|
+
const isReactNativeBlob = (value) => {
|
|
216
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Determine if environment is React Native
|
|
221
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
222
|
+
*
|
|
223
|
+
* @param {*} formData The formData to test
|
|
224
|
+
*
|
|
225
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
226
|
+
*/
|
|
227
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
206
228
|
|
|
207
229
|
/**
|
|
208
230
|
* Determine if a value is a Blob
|
|
@@ -211,7 +233,7 @@
|
|
|
211
233
|
*
|
|
212
234
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
213
235
|
*/
|
|
214
|
-
const isBlob = kindOfTest(
|
|
236
|
+
const isBlob = kindOfTest('Blob');
|
|
215
237
|
|
|
216
238
|
/**
|
|
217
239
|
* Determine if a value is a FileList
|
|
@@ -220,7 +242,7 @@
|
|
|
220
242
|
*
|
|
221
243
|
* @returns {boolean} True if value is a File, otherwise false
|
|
222
244
|
*/
|
|
223
|
-
const isFileList = kindOfTest(
|
|
245
|
+
const isFileList = kindOfTest('FileList');
|
|
224
246
|
|
|
225
247
|
/**
|
|
226
248
|
* Determine if a value is a Stream
|
|
@@ -238,17 +260,27 @@
|
|
|
238
260
|
*
|
|
239
261
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
240
262
|
*/
|
|
263
|
+
function getGlobal() {
|
|
264
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
265
|
+
if (typeof self !== 'undefined') return self;
|
|
266
|
+
if (typeof window !== 'undefined') return window;
|
|
267
|
+
if (typeof global !== 'undefined') return global;
|
|
268
|
+
return {};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const G = getGlobal();
|
|
272
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
273
|
+
|
|
241
274
|
const isFormData = (thing) => {
|
|
242
275
|
let kind;
|
|
243
|
-
return (
|
|
244
|
-
thing
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
thing.toString() === "[object FormData]"))))
|
|
276
|
+
return thing && (
|
|
277
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
278
|
+
isFunction$1(thing.append) && (
|
|
279
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
280
|
+
// detect form-data instance
|
|
281
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
282
|
+
)
|
|
283
|
+
)
|
|
252
284
|
);
|
|
253
285
|
};
|
|
254
286
|
|
|
@@ -259,13 +291,13 @@
|
|
|
259
291
|
*
|
|
260
292
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
261
293
|
*/
|
|
262
|
-
const isURLSearchParams = kindOfTest(
|
|
294
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
263
295
|
|
|
264
296
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
297
|
+
'ReadableStream',
|
|
298
|
+
'Request',
|
|
299
|
+
'Response',
|
|
300
|
+
'Headers',
|
|
269
301
|
].map(kindOfTest);
|
|
270
302
|
|
|
271
303
|
/**
|
|
@@ -275,9 +307,9 @@
|
|
|
275
307
|
*
|
|
276
308
|
* @returns {String} The String freed of excess whitespace
|
|
277
309
|
*/
|
|
278
|
-
const trim = (str) =>
|
|
279
|
-
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
280
|
-
|
|
310
|
+
const trim = (str) => {
|
|
311
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
312
|
+
};
|
|
281
313
|
/**
|
|
282
314
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
283
315
|
*
|
|
@@ -296,7 +328,7 @@
|
|
|
296
328
|
*/
|
|
297
329
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
298
330
|
// Don't bother if no value provided
|
|
299
|
-
if (obj === null || typeof obj ===
|
|
331
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
300
332
|
return;
|
|
301
333
|
}
|
|
302
334
|
|
|
@@ -304,7 +336,7 @@
|
|
|
304
336
|
let l;
|
|
305
337
|
|
|
306
338
|
// Force an array if not already something iterable
|
|
307
|
-
if (typeof obj !==
|
|
339
|
+
if (typeof obj !== 'object') {
|
|
308
340
|
/*eslint no-param-reassign:0*/
|
|
309
341
|
obj = [obj];
|
|
310
342
|
}
|
|
@@ -321,9 +353,7 @@
|
|
|
321
353
|
}
|
|
322
354
|
|
|
323
355
|
// Iterate over object keys
|
|
324
|
-
const keys = allOwnKeys
|
|
325
|
-
? Object.getOwnPropertyNames(obj)
|
|
326
|
-
: Object.keys(obj);
|
|
356
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
327
357
|
const len = keys.length;
|
|
328
358
|
let key;
|
|
329
359
|
|
|
@@ -334,6 +364,14 @@
|
|
|
334
364
|
}
|
|
335
365
|
}
|
|
336
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
369
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
370
|
+
*
|
|
371
|
+
* @param {Object} obj - The object to search.
|
|
372
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
373
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
374
|
+
*/
|
|
337
375
|
function findKey(obj, key) {
|
|
338
376
|
if (isBuffer(obj)) {
|
|
339
377
|
return null;
|
|
@@ -354,16 +392,11 @@
|
|
|
354
392
|
|
|
355
393
|
const _global = (() => {
|
|
356
394
|
/*eslint no-undef:0*/
|
|
357
|
-
if (typeof globalThis !==
|
|
358
|
-
return typeof self !==
|
|
359
|
-
? self
|
|
360
|
-
: typeof window !== "undefined"
|
|
361
|
-
? window
|
|
362
|
-
: global;
|
|
395
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
396
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
|
363
397
|
})();
|
|
364
398
|
|
|
365
|
-
const isContextDefined = (context) =>
|
|
366
|
-
!isUndefined(context) && context !== _global;
|
|
399
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
367
400
|
|
|
368
401
|
/**
|
|
369
402
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -388,7 +421,7 @@
|
|
|
388
421
|
const result = {};
|
|
389
422
|
const assignValue = (val, key) => {
|
|
390
423
|
// Skip dangerous property names to prevent prototype pollution
|
|
391
|
-
if (key ===
|
|
424
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
392
425
|
return;
|
|
393
426
|
}
|
|
394
427
|
|
|
@@ -441,7 +474,7 @@
|
|
|
441
474
|
});
|
|
442
475
|
}
|
|
443
476
|
},
|
|
444
|
-
{ allOwnKeys }
|
|
477
|
+
{ allOwnKeys }
|
|
445
478
|
);
|
|
446
479
|
return a;
|
|
447
480
|
};
|
|
@@ -470,17 +503,14 @@
|
|
|
470
503
|
* @returns {void}
|
|
471
504
|
*/
|
|
472
505
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
473
|
-
constructor.prototype = Object.create(
|
|
474
|
-
|
|
475
|
-
descriptors,
|
|
476
|
-
);
|
|
477
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
506
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
507
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
478
508
|
value: constructor,
|
|
479
509
|
writable: true,
|
|
480
510
|
enumerable: false,
|
|
481
511
|
configurable: true,
|
|
482
512
|
});
|
|
483
|
-
Object.defineProperty(constructor,
|
|
513
|
+
Object.defineProperty(constructor, 'super', {
|
|
484
514
|
value: superConstructor.prototype,
|
|
485
515
|
});
|
|
486
516
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -510,20 +540,13 @@
|
|
|
510
540
|
i = props.length;
|
|
511
541
|
while (i-- > 0) {
|
|
512
542
|
prop = props[i];
|
|
513
|
-
if (
|
|
514
|
-
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
515
|
-
!merged[prop]
|
|
516
|
-
) {
|
|
543
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
517
544
|
destObj[prop] = sourceObj[prop];
|
|
518
545
|
merged[prop] = true;
|
|
519
546
|
}
|
|
520
547
|
}
|
|
521
548
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
522
|
-
} while (
|
|
523
|
-
sourceObj &&
|
|
524
|
-
(!filter || filter(sourceObj, destObj)) &&
|
|
525
|
-
sourceObj !== Object.prototype
|
|
526
|
-
);
|
|
549
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
527
550
|
|
|
528
551
|
return destObj;
|
|
529
552
|
};
|
|
@@ -580,7 +603,7 @@
|
|
|
580
603
|
return (thing) => {
|
|
581
604
|
return TypedArray && thing instanceof TypedArray;
|
|
582
605
|
};
|
|
583
|
-
})(typeof Uint8Array !==
|
|
606
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
584
607
|
|
|
585
608
|
/**
|
|
586
609
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -623,14 +646,12 @@
|
|
|
623
646
|
};
|
|
624
647
|
|
|
625
648
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
626
|
-
const isHTMLForm = kindOfTest(
|
|
649
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
627
650
|
|
|
628
651
|
const toCamelCase = (str) => {
|
|
629
|
-
return str
|
|
630
|
-
.
|
|
631
|
-
|
|
632
|
-
return p1.toUpperCase() + p2;
|
|
633
|
-
});
|
|
652
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
653
|
+
return p1.toUpperCase() + p2;
|
|
654
|
+
});
|
|
634
655
|
};
|
|
635
656
|
|
|
636
657
|
/* Creating a function that will check if an object has a property. */
|
|
@@ -647,7 +668,7 @@
|
|
|
647
668
|
*
|
|
648
669
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
649
670
|
*/
|
|
650
|
-
const isRegExp = kindOfTest(
|
|
671
|
+
const isRegExp = kindOfTest('RegExp');
|
|
651
672
|
|
|
652
673
|
const reduceDescriptors = (obj, reducer) => {
|
|
653
674
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -671,10 +692,7 @@
|
|
|
671
692
|
const freezeMethods = (obj) => {
|
|
672
693
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
673
694
|
// skip restricted props in strict mode
|
|
674
|
-
if (
|
|
675
|
-
isFunction$1(obj) &&
|
|
676
|
-
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
677
|
-
) {
|
|
695
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
678
696
|
return false;
|
|
679
697
|
}
|
|
680
698
|
|
|
@@ -684,7 +702,7 @@
|
|
|
684
702
|
|
|
685
703
|
descriptor.enumerable = false;
|
|
686
704
|
|
|
687
|
-
if (
|
|
705
|
+
if ('writable' in descriptor) {
|
|
688
706
|
descriptor.writable = false;
|
|
689
707
|
return;
|
|
690
708
|
}
|
|
@@ -697,6 +715,14 @@
|
|
|
697
715
|
});
|
|
698
716
|
};
|
|
699
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
720
|
+
* Useful for fast membership checks.
|
|
721
|
+
*
|
|
722
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
723
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
724
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
725
|
+
*/
|
|
700
726
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
701
727
|
const obj = {};
|
|
702
728
|
|
|
@@ -706,9 +732,7 @@
|
|
|
706
732
|
});
|
|
707
733
|
};
|
|
708
734
|
|
|
709
|
-
isArray(arrayOrString)
|
|
710
|
-
? define(arrayOrString)
|
|
711
|
-
: define(String(arrayOrString).split(delimiter));
|
|
735
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
712
736
|
|
|
713
737
|
return obj;
|
|
714
738
|
};
|
|
@@ -716,9 +740,7 @@
|
|
|
716
740
|
const noop = () => {};
|
|
717
741
|
|
|
718
742
|
const toFiniteNumber = (value, defaultValue) => {
|
|
719
|
-
return value != null && Number.isFinite((value = +value))
|
|
720
|
-
? value
|
|
721
|
-
: defaultValue;
|
|
743
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
722
744
|
};
|
|
723
745
|
|
|
724
746
|
/**
|
|
@@ -732,11 +754,17 @@
|
|
|
732
754
|
return !!(
|
|
733
755
|
thing &&
|
|
734
756
|
isFunction$1(thing.append) &&
|
|
735
|
-
thing[toStringTag] ===
|
|
757
|
+
thing[toStringTag] === 'FormData' &&
|
|
736
758
|
thing[iterator]
|
|
737
759
|
);
|
|
738
760
|
}
|
|
739
761
|
|
|
762
|
+
/**
|
|
763
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
764
|
+
*
|
|
765
|
+
* @param {Object} obj - The object to convert.
|
|
766
|
+
* @returns {Object} The JSON-compatible object.
|
|
767
|
+
*/
|
|
740
768
|
const toJSONObject = (obj) => {
|
|
741
769
|
const stack = new Array(10);
|
|
742
770
|
|
|
@@ -751,7 +779,7 @@
|
|
|
751
779
|
return source;
|
|
752
780
|
}
|
|
753
781
|
|
|
754
|
-
if (!(
|
|
782
|
+
if (!('toJSON' in source)) {
|
|
755
783
|
stack[i] = source;
|
|
756
784
|
const target = isArray(source) ? [] : {};
|
|
757
785
|
|
|
@@ -772,8 +800,20 @@
|
|
|
772
800
|
return visit(obj, 0);
|
|
773
801
|
};
|
|
774
802
|
|
|
775
|
-
|
|
803
|
+
/**
|
|
804
|
+
* Determines if a value is an async function.
|
|
805
|
+
*
|
|
806
|
+
* @param {*} thing - The value to test.
|
|
807
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
808
|
+
*/
|
|
809
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
776
810
|
|
|
811
|
+
/**
|
|
812
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
813
|
+
*
|
|
814
|
+
* @param {*} thing - The value to test.
|
|
815
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
816
|
+
*/
|
|
777
817
|
const isThenable = (thing) =>
|
|
778
818
|
thing &&
|
|
779
819
|
(isObject(thing) || isFunction$1(thing)) &&
|
|
@@ -783,6 +823,14 @@
|
|
|
783
823
|
// original code
|
|
784
824
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
785
825
|
|
|
826
|
+
/**
|
|
827
|
+
* Provides a cross-platform setImmediate implementation.
|
|
828
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
829
|
+
*
|
|
830
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
831
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
832
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
833
|
+
*/
|
|
786
834
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
787
835
|
if (setImmediateSupported) {
|
|
788
836
|
return setImmediate;
|
|
@@ -791,27 +839,33 @@
|
|
|
791
839
|
return postMessageSupported
|
|
792
840
|
? ((token, callbacks) => {
|
|
793
841
|
_global.addEventListener(
|
|
794
|
-
|
|
842
|
+
'message',
|
|
795
843
|
({ source, data }) => {
|
|
796
844
|
if (source === _global && data === token) {
|
|
797
845
|
callbacks.length && callbacks.shift()();
|
|
798
846
|
}
|
|
799
847
|
},
|
|
800
|
-
false
|
|
848
|
+
false
|
|
801
849
|
);
|
|
802
850
|
|
|
803
851
|
return (cb) => {
|
|
804
852
|
callbacks.push(cb);
|
|
805
|
-
_global.postMessage(token,
|
|
853
|
+
_global.postMessage(token, '*');
|
|
806
854
|
};
|
|
807
855
|
})(`axios@${Math.random()}`, [])
|
|
808
856
|
: (cb) => setTimeout(cb);
|
|
809
|
-
})(typeof setImmediate ===
|
|
857
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
810
858
|
|
|
859
|
+
/**
|
|
860
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
861
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
862
|
+
*
|
|
863
|
+
* @type {Function}
|
|
864
|
+
*/
|
|
811
865
|
const asap =
|
|
812
|
-
typeof queueMicrotask !==
|
|
866
|
+
typeof queueMicrotask !== 'undefined'
|
|
813
867
|
? queueMicrotask.bind(_global)
|
|
814
|
-
: (typeof process !==
|
|
868
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
815
869
|
|
|
816
870
|
// *********************
|
|
817
871
|
|
|
@@ -836,6 +890,8 @@
|
|
|
836
890
|
isUndefined,
|
|
837
891
|
isDate,
|
|
838
892
|
isFile,
|
|
893
|
+
isReactNativeBlob,
|
|
894
|
+
isReactNative,
|
|
839
895
|
isBlob,
|
|
840
896
|
isRegExp,
|
|
841
897
|
isFunction: isFunction$1,
|
|
@@ -878,14 +934,20 @@
|
|
|
878
934
|
};
|
|
879
935
|
|
|
880
936
|
class AxiosError extends Error {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
937
|
+
static from(error, code, config, request, response, customProps) {
|
|
938
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
939
|
+
axiosError.cause = error;
|
|
940
|
+
axiosError.name = error.name;
|
|
941
|
+
|
|
942
|
+
// Preserve status from the original error if not already set from response
|
|
943
|
+
if (error.status != null && axiosError.status == null) {
|
|
944
|
+
axiosError.status = error.status;
|
|
887
945
|
}
|
|
888
946
|
|
|
947
|
+
customProps && Object.assign(axiosError, customProps);
|
|
948
|
+
return axiosError;
|
|
949
|
+
}
|
|
950
|
+
|
|
889
951
|
/**
|
|
890
952
|
* Create an Error with the specified message, config, error code, request and response.
|
|
891
953
|
*
|
|
@@ -898,37 +960,48 @@
|
|
|
898
960
|
* @returns {Error} The created error.
|
|
899
961
|
*/
|
|
900
962
|
constructor(message, code, config, request, response) {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
963
|
+
super(message);
|
|
964
|
+
|
|
965
|
+
// Make message enumerable to maintain backward compatibility
|
|
966
|
+
// The native Error constructor sets message as non-enumerable,
|
|
967
|
+
// but axios < v1.13.3 had it as enumerable
|
|
968
|
+
Object.defineProperty(this, 'message', {
|
|
969
|
+
value: message,
|
|
970
|
+
enumerable: true,
|
|
971
|
+
writable: true,
|
|
972
|
+
configurable: true
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
this.name = 'AxiosError';
|
|
976
|
+
this.isAxiosError = true;
|
|
977
|
+
code && (this.code = code);
|
|
978
|
+
config && (this.config = config);
|
|
979
|
+
request && (this.request = request);
|
|
980
|
+
if (response) {
|
|
981
|
+
this.response = response;
|
|
982
|
+
this.status = response.status;
|
|
983
|
+
}
|
|
911
984
|
}
|
|
912
985
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
986
|
+
toJSON() {
|
|
987
|
+
return {
|
|
988
|
+
// Standard
|
|
989
|
+
message: this.message,
|
|
990
|
+
name: this.name,
|
|
991
|
+
// Microsoft
|
|
992
|
+
description: this.description,
|
|
993
|
+
number: this.number,
|
|
994
|
+
// Mozilla
|
|
995
|
+
fileName: this.fileName,
|
|
996
|
+
lineNumber: this.lineNumber,
|
|
997
|
+
columnNumber: this.columnNumber,
|
|
998
|
+
stack: this.stack,
|
|
999
|
+
// Axios
|
|
1000
|
+
config: utils$1.toJSONObject(this.config),
|
|
1001
|
+
code: this.code,
|
|
1002
|
+
status: this.status,
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
932
1005
|
}
|
|
933
1006
|
|
|
934
1007
|
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
@@ -983,11 +1056,14 @@
|
|
|
983
1056
|
*/
|
|
984
1057
|
function renderKey(path, key, dots) {
|
|
985
1058
|
if (!path) return key;
|
|
986
|
-
return path
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1059
|
+
return path
|
|
1060
|
+
.concat(key)
|
|
1061
|
+
.map(function each(token, i) {
|
|
1062
|
+
// eslint-disable-next-line no-param-reassign
|
|
1063
|
+
token = removeBrackets(token);
|
|
1064
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1065
|
+
})
|
|
1066
|
+
.join(dots ? '.' : '');
|
|
991
1067
|
}
|
|
992
1068
|
|
|
993
1069
|
/**
|
|
@@ -1037,21 +1113,26 @@
|
|
|
1037
1113
|
formData = formData || new (FormData)();
|
|
1038
1114
|
|
|
1039
1115
|
// eslint-disable-next-line no-param-reassign
|
|
1040
|
-
options = utils$1.toFlatObject(
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1116
|
+
options = utils$1.toFlatObject(
|
|
1117
|
+
options,
|
|
1118
|
+
{
|
|
1119
|
+
metaTokens: true,
|
|
1120
|
+
dots: false,
|
|
1121
|
+
indexes: false,
|
|
1122
|
+
},
|
|
1123
|
+
false,
|
|
1124
|
+
function defined(option, source) {
|
|
1125
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1126
|
+
return !utils$1.isUndefined(source[option]);
|
|
1127
|
+
}
|
|
1128
|
+
);
|
|
1048
1129
|
|
|
1049
1130
|
const metaTokens = options.metaTokens;
|
|
1050
1131
|
// eslint-disable-next-line no-use-before-define
|
|
1051
1132
|
const visitor = options.visitor || defaultVisitor;
|
|
1052
1133
|
const dots = options.dots;
|
|
1053
1134
|
const indexes = options.indexes;
|
|
1054
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
1135
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1055
1136
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1056
1137
|
|
|
1057
1138
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1093,6 +1174,11 @@
|
|
|
1093
1174
|
function defaultVisitor(value, key, path) {
|
|
1094
1175
|
let arr = value;
|
|
1095
1176
|
|
|
1177
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1178
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1096
1182
|
if (value && !path && typeof value === 'object') {
|
|
1097
1183
|
if (utils$1.endsWith(key, '{}')) {
|
|
1098
1184
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1101,17 +1187,22 @@
|
|
|
1101
1187
|
value = JSON.stringify(value);
|
|
1102
1188
|
} else if (
|
|
1103
1189
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1104
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1105
|
-
|
|
1190
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1191
|
+
) {
|
|
1106
1192
|
// eslint-disable-next-line no-param-reassign
|
|
1107
1193
|
key = removeBrackets(key);
|
|
1108
1194
|
|
|
1109
1195
|
arr.forEach(function each(el, index) {
|
|
1110
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1196
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1197
|
+
formData.append(
|
|
1198
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1199
|
+
indexes === true
|
|
1200
|
+
? renderKey([key], index, dots)
|
|
1201
|
+
: indexes === null
|
|
1202
|
+
? key
|
|
1203
|
+
: key + '[]',
|
|
1204
|
+
convertValue(el)
|
|
1205
|
+
);
|
|
1115
1206
|
});
|
|
1116
1207
|
return false;
|
|
1117
1208
|
}
|
|
@@ -1131,7 +1222,7 @@
|
|
|
1131
1222
|
const exposedHelpers = Object.assign(predicates, {
|
|
1132
1223
|
defaultVisitor,
|
|
1133
1224
|
convertValue,
|
|
1134
|
-
isVisitable
|
|
1225
|
+
isVisitable,
|
|
1135
1226
|
});
|
|
1136
1227
|
|
|
1137
1228
|
function build(value, path) {
|
|
@@ -1144,9 +1235,9 @@
|
|
|
1144
1235
|
stack.push(value);
|
|
1145
1236
|
|
|
1146
1237
|
utils$1.forEach(value, function each(el, key) {
|
|
1147
|
-
const result =
|
|
1148
|
-
|
|
1149
|
-
|
|
1238
|
+
const result =
|
|
1239
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1240
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1150
1241
|
|
|
1151
1242
|
if (result === true) {
|
|
1152
1243
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -1181,7 +1272,7 @@
|
|
|
1181
1272
|
')': '%29',
|
|
1182
1273
|
'~': '%7E',
|
|
1183
1274
|
'%20': '+',
|
|
1184
|
-
'%00': '\x00'
|
|
1275
|
+
'%00': '\x00',
|
|
1185
1276
|
};
|
|
1186
1277
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1187
1278
|
return charMap[match];
|
|
@@ -1209,29 +1300,33 @@
|
|
|
1209
1300
|
};
|
|
1210
1301
|
|
|
1211
1302
|
prototype.toString = function toString(encoder) {
|
|
1212
|
-
const _encode = encoder
|
|
1213
|
-
|
|
1214
|
-
|
|
1303
|
+
const _encode = encoder
|
|
1304
|
+
? function (value) {
|
|
1305
|
+
return encoder.call(this, value, encode$1);
|
|
1306
|
+
}
|
|
1307
|
+
: encode$1;
|
|
1215
1308
|
|
|
1216
|
-
return this._pairs
|
|
1217
|
-
|
|
1218
|
-
|
|
1309
|
+
return this._pairs
|
|
1310
|
+
.map(function each(pair) {
|
|
1311
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1312
|
+
}, '')
|
|
1313
|
+
.join('&');
|
|
1219
1314
|
};
|
|
1220
1315
|
|
|
1221
1316
|
/**
|
|
1222
|
-
* It replaces
|
|
1223
|
-
*
|
|
1317
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1318
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1224
1319
|
*
|
|
1225
1320
|
* @param {string} val The value to be encoded.
|
|
1226
1321
|
*
|
|
1227
1322
|
* @returns {string} The encoded value.
|
|
1228
1323
|
*/
|
|
1229
1324
|
function encode(val) {
|
|
1230
|
-
return encodeURIComponent(val)
|
|
1231
|
-
replace(/%3A/gi, ':')
|
|
1232
|
-
replace(/%24/g, '$')
|
|
1233
|
-
replace(/%2C/gi, ',')
|
|
1234
|
-
replace(/%20/g, '+');
|
|
1325
|
+
return encodeURIComponent(val)
|
|
1326
|
+
.replace(/%3A/gi, ':')
|
|
1327
|
+
.replace(/%24/g, '$')
|
|
1328
|
+
.replace(/%2C/gi, ',')
|
|
1329
|
+
.replace(/%20/g, '+');
|
|
1235
1330
|
}
|
|
1236
1331
|
|
|
1237
1332
|
/**
|
|
@@ -1248,11 +1343,13 @@
|
|
|
1248
1343
|
return url;
|
|
1249
1344
|
}
|
|
1250
1345
|
|
|
1251
|
-
const _encode = options && options.encode || encode;
|
|
1346
|
+
const _encode = (options && options.encode) || encode;
|
|
1252
1347
|
|
|
1253
|
-
const _options = utils$1.isFunction(options)
|
|
1254
|
-
|
|
1255
|
-
|
|
1348
|
+
const _options = utils$1.isFunction(options)
|
|
1349
|
+
? {
|
|
1350
|
+
serialize: options,
|
|
1351
|
+
}
|
|
1352
|
+
: options;
|
|
1256
1353
|
|
|
1257
1354
|
const serializeFn = _options && _options.serialize;
|
|
1258
1355
|
|
|
@@ -1261,13 +1358,13 @@
|
|
|
1261
1358
|
if (serializeFn) {
|
|
1262
1359
|
serializedParams = serializeFn(params, _options);
|
|
1263
1360
|
} else {
|
|
1264
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
1265
|
-
params.toString()
|
|
1266
|
-
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1361
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
1362
|
+
? params.toString()
|
|
1363
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1267
1364
|
}
|
|
1268
1365
|
|
|
1269
1366
|
if (serializedParams) {
|
|
1270
|
-
const hashmarkIndex = url.indexOf(
|
|
1367
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1271
1368
|
|
|
1272
1369
|
if (hashmarkIndex !== -1) {
|
|
1273
1370
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -1297,7 +1394,7 @@
|
|
|
1297
1394
|
fulfilled,
|
|
1298
1395
|
rejected,
|
|
1299
1396
|
synchronous: options ? options.synchronous : false,
|
|
1300
|
-
runWhen: options ? options.runWhen : null
|
|
1397
|
+
runWhen: options ? options.runWhen : null,
|
|
1301
1398
|
});
|
|
1302
1399
|
return this.handlers.length - 1;
|
|
1303
1400
|
}
|
|
@@ -1351,7 +1448,7 @@
|
|
|
1351
1448
|
silentJSONParsing: true,
|
|
1352
1449
|
forcedJSONParsing: true,
|
|
1353
1450
|
clarifyTimeoutError: false,
|
|
1354
|
-
legacyInterceptorReqResOrdering: true
|
|
1451
|
+
legacyInterceptorReqResOrdering: true,
|
|
1355
1452
|
};
|
|
1356
1453
|
|
|
1357
1454
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -1365,14 +1462,14 @@
|
|
|
1365
1462
|
classes: {
|
|
1366
1463
|
URLSearchParams: URLSearchParams$1,
|
|
1367
1464
|
FormData: FormData$1,
|
|
1368
|
-
Blob: Blob$1
|
|
1465
|
+
Blob: Blob$1,
|
|
1369
1466
|
},
|
|
1370
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1467
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1371
1468
|
};
|
|
1372
1469
|
|
|
1373
1470
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1374
1471
|
|
|
1375
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
1472
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
1376
1473
|
|
|
1377
1474
|
/**
|
|
1378
1475
|
* Determine if we're running in a standard browser environment
|
|
@@ -1391,7 +1488,8 @@
|
|
|
1391
1488
|
*
|
|
1392
1489
|
* @returns {boolean}
|
|
1393
1490
|
*/
|
|
1394
|
-
const hasStandardBrowserEnv =
|
|
1491
|
+
const hasStandardBrowserEnv =
|
|
1492
|
+
hasBrowserEnv &&
|
|
1395
1493
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1396
1494
|
|
|
1397
1495
|
/**
|
|
@@ -1412,7 +1510,7 @@
|
|
|
1412
1510
|
);
|
|
1413
1511
|
})();
|
|
1414
1512
|
|
|
1415
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1513
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
1416
1514
|
|
|
1417
1515
|
var utils = /*#__PURE__*/Object.freeze({
|
|
1418
1516
|
__proto__: null,
|
|
@@ -1425,12 +1523,12 @@
|
|
|
1425
1523
|
|
|
1426
1524
|
var platform = {
|
|
1427
1525
|
...utils,
|
|
1428
|
-
...platform$1
|
|
1526
|
+
...platform$1,
|
|
1429
1527
|
};
|
|
1430
1528
|
|
|
1431
1529
|
function toURLEncodedForm(data, options) {
|
|
1432
1530
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1433
|
-
visitor: function(value, key, path, helpers) {
|
|
1531
|
+
visitor: function (value, key, path, helpers) {
|
|
1434
1532
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1435
1533
|
this.append(key, value.toString('base64'));
|
|
1436
1534
|
return false;
|
|
@@ -1438,7 +1536,7 @@
|
|
|
1438
1536
|
|
|
1439
1537
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1440
1538
|
},
|
|
1441
|
-
...options
|
|
1539
|
+
...options,
|
|
1442
1540
|
});
|
|
1443
1541
|
}
|
|
1444
1542
|
|
|
@@ -1454,7 +1552,7 @@
|
|
|
1454
1552
|
// foo.x.y.z
|
|
1455
1553
|
// foo-x-y-z
|
|
1456
1554
|
// foo x y z
|
|
1457
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1555
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1458
1556
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1459
1557
|
});
|
|
1460
1558
|
}
|
|
@@ -1558,96 +1656,107 @@
|
|
|
1558
1656
|
}
|
|
1559
1657
|
|
|
1560
1658
|
const defaults = {
|
|
1561
|
-
|
|
1562
1659
|
transitional: transitionalDefaults,
|
|
1563
1660
|
|
|
1564
1661
|
adapter: ['xhr', 'http', 'fetch'],
|
|
1565
1662
|
|
|
1566
|
-
transformRequest: [
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1663
|
+
transformRequest: [
|
|
1664
|
+
function transformRequest(data, headers) {
|
|
1665
|
+
const contentType = headers.getContentType() || '';
|
|
1666
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1667
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1570
1668
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1669
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1670
|
+
data = new FormData(data);
|
|
1671
|
+
}
|
|
1574
1672
|
|
|
1575
|
-
|
|
1673
|
+
const isFormData = utils$1.isFormData(data);
|
|
1576
1674
|
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1675
|
+
if (isFormData) {
|
|
1676
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1677
|
+
}
|
|
1580
1678
|
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1679
|
+
if (
|
|
1680
|
+
utils$1.isArrayBuffer(data) ||
|
|
1681
|
+
utils$1.isBuffer(data) ||
|
|
1682
|
+
utils$1.isStream(data) ||
|
|
1683
|
+
utils$1.isFile(data) ||
|
|
1684
|
+
utils$1.isBlob(data) ||
|
|
1685
|
+
utils$1.isReadableStream(data)
|
|
1686
|
+
) {
|
|
1687
|
+
return data;
|
|
1688
|
+
}
|
|
1689
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1690
|
+
return data.buffer;
|
|
1691
|
+
}
|
|
1692
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1693
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1694
|
+
return data.toString();
|
|
1695
|
+
}
|
|
1597
1696
|
|
|
1598
|
-
|
|
1697
|
+
let isFileList;
|
|
1599
1698
|
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1699
|
+
if (isObjectPayload) {
|
|
1700
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
1701
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1702
|
+
}
|
|
1604
1703
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1704
|
+
if (
|
|
1705
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
1706
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
1707
|
+
) {
|
|
1708
|
+
const _FormData = this.env && this.env.FormData;
|
|
1607
1709
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1710
|
+
return toFormData(
|
|
1711
|
+
isFileList ? { 'files[]': data } : data,
|
|
1712
|
+
_FormData && new _FormData(),
|
|
1713
|
+
this.formSerializer
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1613
1716
|
}
|
|
1614
|
-
}
|
|
1615
1717
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1718
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
1719
|
+
headers.setContentType('application/json', false);
|
|
1720
|
+
return stringifySafely(data);
|
|
1721
|
+
}
|
|
1620
1722
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1723
|
+
return data;
|
|
1724
|
+
},
|
|
1725
|
+
],
|
|
1623
1726
|
|
|
1624
|
-
transformResponse: [
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1727
|
+
transformResponse: [
|
|
1728
|
+
function transformResponse(data) {
|
|
1729
|
+
const transitional = this.transitional || defaults.transitional;
|
|
1730
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1731
|
+
const JSONRequested = this.responseType === 'json';
|
|
1628
1732
|
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1733
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
1734
|
+
return data;
|
|
1735
|
+
}
|
|
1632
1736
|
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1737
|
+
if (
|
|
1738
|
+
data &&
|
|
1739
|
+
utils$1.isString(data) &&
|
|
1740
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
1741
|
+
) {
|
|
1742
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1743
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1636
1744
|
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1745
|
+
try {
|
|
1746
|
+
return JSON.parse(data, this.parseReviver);
|
|
1747
|
+
} catch (e) {
|
|
1748
|
+
if (strictJSONParsing) {
|
|
1749
|
+
if (e.name === 'SyntaxError') {
|
|
1750
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1751
|
+
}
|
|
1752
|
+
throw e;
|
|
1643
1753
|
}
|
|
1644
|
-
throw e;
|
|
1645
1754
|
}
|
|
1646
1755
|
}
|
|
1647
|
-
}
|
|
1648
1756
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1757
|
+
return data;
|
|
1758
|
+
},
|
|
1759
|
+
],
|
|
1651
1760
|
|
|
1652
1761
|
/**
|
|
1653
1762
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1663,7 +1772,7 @@
|
|
|
1663
1772
|
|
|
1664
1773
|
env: {
|
|
1665
1774
|
FormData: platform.classes.FormData,
|
|
1666
|
-
Blob: platform.classes.Blob
|
|
1775
|
+
Blob: platform.classes.Blob,
|
|
1667
1776
|
},
|
|
1668
1777
|
|
|
1669
1778
|
validateStatus: function validateStatus(status) {
|
|
@@ -1672,10 +1781,10 @@
|
|
|
1672
1781
|
|
|
1673
1782
|
headers: {
|
|
1674
1783
|
common: {
|
|
1675
|
-
|
|
1676
|
-
'Content-Type': undefined
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1784
|
+
Accept: 'application/json, text/plain, */*',
|
|
1785
|
+
'Content-Type': undefined,
|
|
1786
|
+
},
|
|
1787
|
+
},
|
|
1679
1788
|
};
|
|
1680
1789
|
|
|
1681
1790
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -1687,10 +1796,23 @@
|
|
|
1687
1796
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1688
1797
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1689
1798
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1690
|
-
'age',
|
|
1691
|
-
'
|
|
1692
|
-
'
|
|
1693
|
-
'
|
|
1799
|
+
'age',
|
|
1800
|
+
'authorization',
|
|
1801
|
+
'content-length',
|
|
1802
|
+
'content-type',
|
|
1803
|
+
'etag',
|
|
1804
|
+
'expires',
|
|
1805
|
+
'from',
|
|
1806
|
+
'host',
|
|
1807
|
+
'if-modified-since',
|
|
1808
|
+
'if-unmodified-since',
|
|
1809
|
+
'last-modified',
|
|
1810
|
+
'location',
|
|
1811
|
+
'max-forwards',
|
|
1812
|
+
'proxy-authorization',
|
|
1813
|
+
'referer',
|
|
1814
|
+
'retry-after',
|
|
1815
|
+
'user-agent',
|
|
1694
1816
|
]);
|
|
1695
1817
|
|
|
1696
1818
|
/**
|
|
@@ -1707,47 +1829,81 @@
|
|
|
1707
1829
|
*
|
|
1708
1830
|
* @returns {Object} Headers parsed into an object
|
|
1709
1831
|
*/
|
|
1710
|
-
var parseHeaders = rawHeaders => {
|
|
1832
|
+
var parseHeaders = (rawHeaders) => {
|
|
1711
1833
|
const parsed = {};
|
|
1712
1834
|
let key;
|
|
1713
1835
|
let val;
|
|
1714
1836
|
let i;
|
|
1715
1837
|
|
|
1716
|
-
rawHeaders &&
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1838
|
+
rawHeaders &&
|
|
1839
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
1840
|
+
i = line.indexOf(':');
|
|
1841
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
1842
|
+
val = line.substring(i + 1).trim();
|
|
1720
1843
|
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1844
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
1845
|
+
return;
|
|
1846
|
+
}
|
|
1724
1847
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1848
|
+
if (key === 'set-cookie') {
|
|
1849
|
+
if (parsed[key]) {
|
|
1850
|
+
parsed[key].push(val);
|
|
1851
|
+
} else {
|
|
1852
|
+
parsed[key] = [val];
|
|
1853
|
+
}
|
|
1728
1854
|
} else {
|
|
1729
|
-
parsed[key] = [val
|
|
1855
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1730
1856
|
}
|
|
1731
|
-
}
|
|
1732
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1733
|
-
}
|
|
1734
|
-
});
|
|
1857
|
+
});
|
|
1735
1858
|
|
|
1736
1859
|
return parsed;
|
|
1737
1860
|
};
|
|
1738
1861
|
|
|
1739
1862
|
const $internals = Symbol('internals');
|
|
1740
1863
|
|
|
1864
|
+
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
1865
|
+
|
|
1866
|
+
function assertValidHeaderValue(value, header) {
|
|
1867
|
+
if (value === false || value == null) {
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
if (utils$1.isArray(value)) {
|
|
1872
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
if (!isValidHeaderValue(String(value))) {
|
|
1877
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1741
1881
|
function normalizeHeader(header) {
|
|
1742
1882
|
return header && String(header).trim().toLowerCase();
|
|
1743
1883
|
}
|
|
1744
1884
|
|
|
1885
|
+
function stripTrailingCRLF(str) {
|
|
1886
|
+
let end = str.length;
|
|
1887
|
+
|
|
1888
|
+
while (end > 0) {
|
|
1889
|
+
const charCode = str.charCodeAt(end - 1);
|
|
1890
|
+
|
|
1891
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
1892
|
+
break;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
end -= 1;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
return end === str.length ? str : str.slice(0, end);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1745
1901
|
function normalizeValue(value) {
|
|
1746
1902
|
if (value === false || value == null) {
|
|
1747
1903
|
return value;
|
|
1748
1904
|
}
|
|
1749
1905
|
|
|
1750
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1906
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
1751
1907
|
}
|
|
1752
1908
|
|
|
1753
1909
|
function parseTokens(str) {
|
|
@@ -1785,8 +1941,10 @@
|
|
|
1785
1941
|
}
|
|
1786
1942
|
|
|
1787
1943
|
function formatHeader(header) {
|
|
1788
|
-
return header
|
|
1789
|
-
.
|
|
1944
|
+
return header
|
|
1945
|
+
.trim()
|
|
1946
|
+
.toLowerCase()
|
|
1947
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1790
1948
|
return char.toUpperCase() + str;
|
|
1791
1949
|
});
|
|
1792
1950
|
}
|
|
@@ -1794,12 +1952,12 @@
|
|
|
1794
1952
|
function buildAccessors(obj, header) {
|
|
1795
1953
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1796
1954
|
|
|
1797
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
1955
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
1798
1956
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
1799
|
-
value: function(arg1, arg2, arg3) {
|
|
1957
|
+
value: function (arg1, arg2, arg3) {
|
|
1800
1958
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1801
1959
|
},
|
|
1802
|
-
configurable: true
|
|
1960
|
+
configurable: true,
|
|
1803
1961
|
});
|
|
1804
1962
|
});
|
|
1805
1963
|
}
|
|
@@ -1821,7 +1979,13 @@
|
|
|
1821
1979
|
|
|
1822
1980
|
const key = utils$1.findKey(self, lHeader);
|
|
1823
1981
|
|
|
1824
|
-
if
|
|
1982
|
+
if (
|
|
1983
|
+
!key ||
|
|
1984
|
+
self[key] === undefined ||
|
|
1985
|
+
_rewrite === true ||
|
|
1986
|
+
(_rewrite === undefined && self[key] !== false)
|
|
1987
|
+
) {
|
|
1988
|
+
assertValidHeaderValue(_value, _header);
|
|
1825
1989
|
self[key || _header] = normalizeValue(_value);
|
|
1826
1990
|
}
|
|
1827
1991
|
}
|
|
@@ -1831,17 +1995,22 @@
|
|
|
1831
1995
|
|
|
1832
1996
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1833
1997
|
setHeaders(header, valueOrRewrite);
|
|
1834
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1998
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1835
1999
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1836
2000
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1837
|
-
let obj = {},
|
|
2001
|
+
let obj = {},
|
|
2002
|
+
dest,
|
|
2003
|
+
key;
|
|
1838
2004
|
for (const entry of header) {
|
|
1839
2005
|
if (!utils$1.isArray(entry)) {
|
|
1840
2006
|
throw TypeError('Object iterator must return a key-value pair');
|
|
1841
2007
|
}
|
|
1842
2008
|
|
|
1843
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
1844
|
-
|
|
2009
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
2010
|
+
? utils$1.isArray(dest)
|
|
2011
|
+
? [...dest, entry[1]]
|
|
2012
|
+
: [dest, entry[1]]
|
|
2013
|
+
: entry[1];
|
|
1845
2014
|
}
|
|
1846
2015
|
|
|
1847
2016
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -1888,7 +2057,11 @@
|
|
|
1888
2057
|
if (header) {
|
|
1889
2058
|
const key = utils$1.findKey(this, header);
|
|
1890
2059
|
|
|
1891
|
-
return !!(
|
|
2060
|
+
return !!(
|
|
2061
|
+
key &&
|
|
2062
|
+
this[key] !== undefined &&
|
|
2063
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2064
|
+
);
|
|
1892
2065
|
}
|
|
1893
2066
|
|
|
1894
2067
|
return false;
|
|
@@ -1928,7 +2101,7 @@
|
|
|
1928
2101
|
|
|
1929
2102
|
while (i--) {
|
|
1930
2103
|
const key = keys[i];
|
|
1931
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2104
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1932
2105
|
delete this[key];
|
|
1933
2106
|
deleted = true;
|
|
1934
2107
|
}
|
|
@@ -1972,7 +2145,9 @@
|
|
|
1972
2145
|
const obj = Object.create(null);
|
|
1973
2146
|
|
|
1974
2147
|
utils$1.forEach(this, (value, header) => {
|
|
1975
|
-
value != null &&
|
|
2148
|
+
value != null &&
|
|
2149
|
+
value !== false &&
|
|
2150
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1976
2151
|
});
|
|
1977
2152
|
|
|
1978
2153
|
return obj;
|
|
@@ -1983,11 +2158,13 @@
|
|
|
1983
2158
|
}
|
|
1984
2159
|
|
|
1985
2160
|
toString() {
|
|
1986
|
-
return Object.entries(this.toJSON())
|
|
2161
|
+
return Object.entries(this.toJSON())
|
|
2162
|
+
.map(([header, value]) => header + ': ' + value)
|
|
2163
|
+
.join('\n');
|
|
1987
2164
|
}
|
|
1988
2165
|
|
|
1989
2166
|
getSetCookie() {
|
|
1990
|
-
return this.get(
|
|
2167
|
+
return this.get('set-cookie') || [];
|
|
1991
2168
|
}
|
|
1992
2169
|
|
|
1993
2170
|
get [Symbol.toStringTag]() {
|
|
@@ -2007,9 +2184,12 @@
|
|
|
2007
2184
|
}
|
|
2008
2185
|
|
|
2009
2186
|
static accessor(header) {
|
|
2010
|
-
const internals =
|
|
2011
|
-
|
|
2012
|
-
|
|
2187
|
+
const internals =
|
|
2188
|
+
(this[$internals] =
|
|
2189
|
+
this[$internals] =
|
|
2190
|
+
{
|
|
2191
|
+
accessors: {},
|
|
2192
|
+
});
|
|
2013
2193
|
|
|
2014
2194
|
const accessors = internals.accessors;
|
|
2015
2195
|
const prototype = this.prototype;
|
|
@@ -2029,17 +2209,24 @@
|
|
|
2029
2209
|
}
|
|
2030
2210
|
}
|
|
2031
2211
|
|
|
2032
|
-
AxiosHeaders.accessor([
|
|
2212
|
+
AxiosHeaders.accessor([
|
|
2213
|
+
'Content-Type',
|
|
2214
|
+
'Content-Length',
|
|
2215
|
+
'Accept',
|
|
2216
|
+
'Accept-Encoding',
|
|
2217
|
+
'User-Agent',
|
|
2218
|
+
'Authorization',
|
|
2219
|
+
]);
|
|
2033
2220
|
|
|
2034
2221
|
// reserved names hotfix
|
|
2035
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
2222
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
2036
2223
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2037
2224
|
return {
|
|
2038
2225
|
get: () => value,
|
|
2039
2226
|
set(headerValue) {
|
|
2040
2227
|
this[mapped] = headerValue;
|
|
2041
|
-
}
|
|
2042
|
-
}
|
|
2228
|
+
},
|
|
2229
|
+
};
|
|
2043
2230
|
});
|
|
2044
2231
|
|
|
2045
2232
|
utils$1.freezeMethods(AxiosHeaders);
|
|
@@ -2106,19 +2293,23 @@
|
|
|
2106
2293
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2107
2294
|
resolve(response);
|
|
2108
2295
|
} else {
|
|
2109
|
-
reject(
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2296
|
+
reject(
|
|
2297
|
+
new AxiosError$1(
|
|
2298
|
+
'Request failed with status code ' + response.status,
|
|
2299
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
2300
|
+
Math.floor(response.status / 100) - 4
|
|
2301
|
+
],
|
|
2302
|
+
response.config,
|
|
2303
|
+
response.request,
|
|
2304
|
+
response
|
|
2305
|
+
)
|
|
2306
|
+
);
|
|
2116
2307
|
}
|
|
2117
2308
|
}
|
|
2118
2309
|
|
|
2119
2310
|
function parseProtocol(url) {
|
|
2120
2311
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2121
|
-
return match && match[1] || '';
|
|
2312
|
+
return (match && match[1]) || '';
|
|
2122
2313
|
}
|
|
2123
2314
|
|
|
2124
2315
|
/**
|
|
@@ -2169,7 +2360,7 @@
|
|
|
2169
2360
|
|
|
2170
2361
|
const passed = startedAt && now - startedAt;
|
|
2171
2362
|
|
|
2172
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2363
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
2173
2364
|
};
|
|
2174
2365
|
}
|
|
2175
2366
|
|
|
@@ -2198,7 +2389,7 @@
|
|
|
2198
2389
|
const throttled = (...args) => {
|
|
2199
2390
|
const now = Date.now();
|
|
2200
2391
|
const passed = now - timestamp;
|
|
2201
|
-
if (
|
|
2392
|
+
if (passed >= threshold) {
|
|
2202
2393
|
invoke(args, now);
|
|
2203
2394
|
} else {
|
|
2204
2395
|
lastArgs = args;
|
|
@@ -2220,7 +2411,7 @@
|
|
|
2220
2411
|
let bytesNotified = 0;
|
|
2221
2412
|
const _speedometer = speedometer(50, 250);
|
|
2222
2413
|
|
|
2223
|
-
return throttle(e => {
|
|
2414
|
+
return throttle((e) => {
|
|
2224
2415
|
const loaded = e.loaded;
|
|
2225
2416
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2226
2417
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -2232,13 +2423,13 @@
|
|
|
2232
2423
|
const data = {
|
|
2233
2424
|
loaded,
|
|
2234
2425
|
total,
|
|
2235
|
-
progress: total ?
|
|
2426
|
+
progress: total ? loaded / total : undefined,
|
|
2236
2427
|
bytes: progressBytes,
|
|
2237
2428
|
rate: rate ? rate : undefined,
|
|
2238
2429
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2239
2430
|
event: e,
|
|
2240
2431
|
lengthComputable: total != null,
|
|
2241
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
2432
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
2242
2433
|
};
|
|
2243
2434
|
|
|
2244
2435
|
listener(data);
|
|
@@ -2248,77 +2439,82 @@
|
|
|
2248
2439
|
const progressEventDecorator = (total, throttled) => {
|
|
2249
2440
|
const lengthComputable = total != null;
|
|
2250
2441
|
|
|
2251
|
-
return [
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2442
|
+
return [
|
|
2443
|
+
(loaded) =>
|
|
2444
|
+
throttled[0]({
|
|
2445
|
+
lengthComputable,
|
|
2446
|
+
total,
|
|
2447
|
+
loaded,
|
|
2448
|
+
}),
|
|
2449
|
+
throttled[1],
|
|
2450
|
+
];
|
|
2256
2451
|
};
|
|
2257
2452
|
|
|
2258
|
-
const asyncDecorator =
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
return (
|
|
2264
|
-
origin.protocol === url.protocol &&
|
|
2265
|
-
origin.host === url.host &&
|
|
2266
|
-
(isMSIE || origin.port === url.port)
|
|
2267
|
-
);
|
|
2268
|
-
})(
|
|
2269
|
-
new URL(platform.origin),
|
|
2270
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2271
|
-
) : () => true;
|
|
2272
|
-
|
|
2273
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
2274
|
-
|
|
2275
|
-
// Standard browser envs support document.cookie
|
|
2276
|
-
{
|
|
2277
|
-
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2278
|
-
if (typeof document === 'undefined') return;
|
|
2453
|
+
const asyncDecorator =
|
|
2454
|
+
(fn) =>
|
|
2455
|
+
(...args) =>
|
|
2456
|
+
utils$1.asap(() => fn(...args));
|
|
2279
2457
|
|
|
2280
|
-
|
|
2458
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
2459
|
+
? ((origin, isMSIE) => (url) => {
|
|
2460
|
+
url = new URL(url, platform.origin);
|
|
2281
2461
|
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2462
|
+
return (
|
|
2463
|
+
origin.protocol === url.protocol &&
|
|
2464
|
+
origin.host === url.host &&
|
|
2465
|
+
(isMSIE || origin.port === url.port)
|
|
2466
|
+
);
|
|
2467
|
+
})(
|
|
2468
|
+
new URL(platform.origin),
|
|
2469
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2470
|
+
)
|
|
2471
|
+
: () => true;
|
|
2472
|
+
|
|
2473
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
2474
|
+
? // Standard browser envs support document.cookie
|
|
2475
|
+
{
|
|
2476
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2477
|
+
if (typeof document === 'undefined') return;
|
|
2478
|
+
|
|
2479
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2480
|
+
|
|
2481
|
+
if (utils$1.isNumber(expires)) {
|
|
2482
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2483
|
+
}
|
|
2484
|
+
if (utils$1.isString(path)) {
|
|
2485
|
+
cookie.push(`path=${path}`);
|
|
2486
|
+
}
|
|
2487
|
+
if (utils$1.isString(domain)) {
|
|
2488
|
+
cookie.push(`domain=${domain}`);
|
|
2489
|
+
}
|
|
2490
|
+
if (secure === true) {
|
|
2491
|
+
cookie.push('secure');
|
|
2492
|
+
}
|
|
2493
|
+
if (utils$1.isString(sameSite)) {
|
|
2494
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2495
|
+
}
|
|
2297
2496
|
|
|
2298
|
-
|
|
2299
|
-
|
|
2497
|
+
document.cookie = cookie.join('; ');
|
|
2498
|
+
},
|
|
2300
2499
|
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2500
|
+
read(name) {
|
|
2501
|
+
if (typeof document === 'undefined') return null;
|
|
2502
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
2503
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2504
|
+
},
|
|
2306
2505
|
|
|
2307
|
-
|
|
2308
|
-
|
|
2506
|
+
remove(name) {
|
|
2507
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
2508
|
+
},
|
|
2309
2509
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
return null;
|
|
2319
|
-
},
|
|
2320
|
-
remove() {}
|
|
2321
|
-
};
|
|
2510
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
2511
|
+
{
|
|
2512
|
+
write() {},
|
|
2513
|
+
read() {
|
|
2514
|
+
return null;
|
|
2515
|
+
},
|
|
2516
|
+
remove() {},
|
|
2517
|
+
};
|
|
2322
2518
|
|
|
2323
2519
|
/**
|
|
2324
2520
|
* Determines whether the specified URL is absolute
|
|
@@ -2370,8 +2566,7 @@
|
|
|
2370
2566
|
return requestedURL;
|
|
2371
2567
|
}
|
|
2372
2568
|
|
|
2373
|
-
const headersToObject = (thing) =>
|
|
2374
|
-
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2569
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
2375
2570
|
|
|
2376
2571
|
/**
|
|
2377
2572
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2464,23 +2659,12 @@
|
|
|
2464
2659
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2465
2660
|
};
|
|
2466
2661
|
|
|
2467
|
-
utils$1.forEach(
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
prop === "prototype"
|
|
2474
|
-
)
|
|
2475
|
-
return;
|
|
2476
|
-
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2477
|
-
? mergeMap[prop]
|
|
2478
|
-
: mergeDeepProperties;
|
|
2479
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2480
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2481
|
-
(config[prop] = configValue);
|
|
2482
|
-
},
|
|
2483
|
-
);
|
|
2662
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2663
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
2664
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2665
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2666
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2667
|
+
});
|
|
2484
2668
|
|
|
2485
2669
|
return config;
|
|
2486
2670
|
}
|
|
@@ -2492,12 +2676,22 @@
|
|
|
2492
2676
|
|
|
2493
2677
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2494
2678
|
|
|
2495
|
-
newConfig.url = buildURL(
|
|
2679
|
+
newConfig.url = buildURL(
|
|
2680
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
2681
|
+
config.params,
|
|
2682
|
+
config.paramsSerializer
|
|
2683
|
+
);
|
|
2496
2684
|
|
|
2497
2685
|
// HTTP basic authentication
|
|
2498
2686
|
if (auth) {
|
|
2499
|
-
headers.set(
|
|
2500
|
-
|
|
2687
|
+
headers.set(
|
|
2688
|
+
'Authorization',
|
|
2689
|
+
'Basic ' +
|
|
2690
|
+
btoa(
|
|
2691
|
+
(auth.username || '') +
|
|
2692
|
+
':' +
|
|
2693
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
2694
|
+
)
|
|
2501
2695
|
);
|
|
2502
2696
|
}
|
|
2503
2697
|
|
|
@@ -2515,7 +2709,7 @@
|
|
|
2515
2709
|
}
|
|
2516
2710
|
});
|
|
2517
2711
|
}
|
|
2518
|
-
}
|
|
2712
|
+
}
|
|
2519
2713
|
|
|
2520
2714
|
// Add xsrf header
|
|
2521
2715
|
// This is only done if running in a standard browser environment.
|
|
@@ -2539,196 +2733,218 @@
|
|
|
2539
2733
|
|
|
2540
2734
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2541
2735
|
|
|
2542
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2736
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
2737
|
+
function (config) {
|
|
2738
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2739
|
+
const _config = resolveConfig(config);
|
|
2740
|
+
let requestData = _config.data;
|
|
2741
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2742
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
2743
|
+
let onCanceled;
|
|
2744
|
+
let uploadThrottled, downloadThrottled;
|
|
2745
|
+
let flushUpload, flushDownload;
|
|
2551
2746
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2747
|
+
function done() {
|
|
2748
|
+
flushUpload && flushUpload(); // flush events
|
|
2749
|
+
flushDownload && flushDownload(); // flush events
|
|
2555
2750
|
|
|
2556
|
-
|
|
2751
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2557
2752
|
|
|
2558
|
-
|
|
2559
|
-
|
|
2753
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
2754
|
+
}
|
|
2560
2755
|
|
|
2561
|
-
|
|
2756
|
+
let request = new XMLHttpRequest();
|
|
2562
2757
|
|
|
2563
|
-
|
|
2758
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2564
2759
|
|
|
2565
|
-
|
|
2566
|
-
|
|
2760
|
+
// Set the request timeout in MS
|
|
2761
|
+
request.timeout = _config.timeout;
|
|
2567
2762
|
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2763
|
+
function onloadend() {
|
|
2764
|
+
if (!request) {
|
|
2765
|
+
return;
|
|
2766
|
+
}
|
|
2767
|
+
// Prepare the response
|
|
2768
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
2769
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2770
|
+
);
|
|
2771
|
+
const responseData =
|
|
2772
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
2773
|
+
? request.responseText
|
|
2774
|
+
: request.response;
|
|
2775
|
+
const response = {
|
|
2776
|
+
data: responseData,
|
|
2777
|
+
status: request.status,
|
|
2778
|
+
statusText: request.statusText,
|
|
2779
|
+
headers: responseHeaders,
|
|
2780
|
+
config,
|
|
2781
|
+
request,
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
settle(
|
|
2785
|
+
function _resolve(value) {
|
|
2786
|
+
resolve(value);
|
|
2787
|
+
done();
|
|
2788
|
+
},
|
|
2789
|
+
function _reject(err) {
|
|
2790
|
+
reject(err);
|
|
2791
|
+
done();
|
|
2792
|
+
},
|
|
2793
|
+
response
|
|
2794
|
+
);
|
|
2795
|
+
|
|
2796
|
+
// Clean up request
|
|
2797
|
+
request = null;
|
|
2571
2798
|
}
|
|
2572
|
-
// Prepare the response
|
|
2573
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
2574
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2575
|
-
);
|
|
2576
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
2577
|
-
request.responseText : request.response;
|
|
2578
|
-
const response = {
|
|
2579
|
-
data: responseData,
|
|
2580
|
-
status: request.status,
|
|
2581
|
-
statusText: request.statusText,
|
|
2582
|
-
headers: responseHeaders,
|
|
2583
|
-
config,
|
|
2584
|
-
request
|
|
2585
|
-
};
|
|
2586
2799
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2800
|
+
if ('onloadend' in request) {
|
|
2801
|
+
// Use onloadend if available
|
|
2802
|
+
request.onloadend = onloadend;
|
|
2803
|
+
} else {
|
|
2804
|
+
// Listen for ready state to emulate onloadend
|
|
2805
|
+
request.onreadystatechange = function handleLoad() {
|
|
2806
|
+
if (!request || request.readyState !== 4) {
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2594
2809
|
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2810
|
+
// The request errored out and we didn't get a response, this will be
|
|
2811
|
+
// handled by onerror instead
|
|
2812
|
+
// With one exception: request that using file: protocol, most browsers
|
|
2813
|
+
// will return status as 0 even though it's a successful request
|
|
2814
|
+
if (
|
|
2815
|
+
request.status === 0 &&
|
|
2816
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
2817
|
+
) {
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2821
|
+
// so we should call onloadend on the next 'tick'
|
|
2822
|
+
setTimeout(onloadend);
|
|
2823
|
+
};
|
|
2824
|
+
}
|
|
2598
2825
|
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
} else {
|
|
2603
|
-
// Listen for ready state to emulate onloadend
|
|
2604
|
-
request.onreadystatechange = function handleLoad() {
|
|
2605
|
-
if (!request || request.readyState !== 4) {
|
|
2826
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
2827
|
+
request.onabort = function handleAbort() {
|
|
2828
|
+
if (!request) {
|
|
2606
2829
|
return;
|
|
2607
2830
|
}
|
|
2608
2831
|
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
//
|
|
2612
|
-
|
|
2613
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2616
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2617
|
-
// so we should call onloadend on the next 'tick'
|
|
2618
|
-
setTimeout(onloadend);
|
|
2832
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
2833
|
+
|
|
2834
|
+
// Clean up request
|
|
2835
|
+
request = null;
|
|
2619
2836
|
};
|
|
2620
|
-
}
|
|
2621
2837
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2838
|
+
// Handle low level network errors
|
|
2839
|
+
request.onerror = function handleError(event) {
|
|
2840
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2841
|
+
// (message may be empty; when present, surface it)
|
|
2842
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2843
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
2844
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2845
|
+
// attach the underlying event for consumers who want details
|
|
2846
|
+
err.event = event || null;
|
|
2847
|
+
reject(err);
|
|
2848
|
+
request = null;
|
|
2849
|
+
};
|
|
2850
|
+
|
|
2851
|
+
// Handle timeout
|
|
2852
|
+
request.ontimeout = function handleTimeout() {
|
|
2853
|
+
let timeoutErrorMessage = _config.timeout
|
|
2854
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
2855
|
+
: 'timeout exceeded';
|
|
2856
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
2857
|
+
if (_config.timeoutErrorMessage) {
|
|
2858
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2859
|
+
}
|
|
2860
|
+
reject(
|
|
2861
|
+
new AxiosError$1(
|
|
2862
|
+
timeoutErrorMessage,
|
|
2863
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2864
|
+
config,
|
|
2865
|
+
request
|
|
2866
|
+
)
|
|
2867
|
+
);
|
|
2627
2868
|
|
|
2628
|
-
|
|
2869
|
+
// Clean up request
|
|
2870
|
+
request = null;
|
|
2871
|
+
};
|
|
2629
2872
|
|
|
2630
|
-
//
|
|
2631
|
-
|
|
2632
|
-
};
|
|
2873
|
+
// Remove Content-Type if data is undefined
|
|
2874
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
2633
2875
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
2640
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2641
|
-
// attach the underlying event for consumers who want details
|
|
2642
|
-
err.event = event || null;
|
|
2643
|
-
reject(err);
|
|
2644
|
-
request = null;
|
|
2645
|
-
};
|
|
2646
|
-
|
|
2647
|
-
// Handle timeout
|
|
2648
|
-
request.ontimeout = function handleTimeout() {
|
|
2649
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2650
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
2651
|
-
if (_config.timeoutErrorMessage) {
|
|
2652
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2876
|
+
// Add headers to the request
|
|
2877
|
+
if ('setRequestHeader' in request) {
|
|
2878
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2879
|
+
request.setRequestHeader(key, val);
|
|
2880
|
+
});
|
|
2653
2881
|
}
|
|
2654
|
-
reject(new AxiosError$1(
|
|
2655
|
-
timeoutErrorMessage,
|
|
2656
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2657
|
-
config,
|
|
2658
|
-
request));
|
|
2659
|
-
|
|
2660
|
-
// Clean up request
|
|
2661
|
-
request = null;
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
// Remove Content-Type if data is undefined
|
|
2665
|
-
requestData === undefined && requestHeaders.setContentType(null);
|
|
2666
2882
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
});
|
|
2672
|
-
}
|
|
2883
|
+
// Add withCredentials to request if needed
|
|
2884
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
2885
|
+
request.withCredentials = !!_config.withCredentials;
|
|
2886
|
+
}
|
|
2673
2887
|
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2888
|
+
// Add responseType to request if needed
|
|
2889
|
+
if (responseType && responseType !== 'json') {
|
|
2890
|
+
request.responseType = _config.responseType;
|
|
2891
|
+
}
|
|
2678
2892
|
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2893
|
+
// Handle progress if needed
|
|
2894
|
+
if (onDownloadProgress) {
|
|
2895
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
2896
|
+
request.addEventListener('progress', downloadThrottled);
|
|
2897
|
+
}
|
|
2683
2898
|
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
request.addEventListener('progress', downloadThrottled);
|
|
2688
|
-
}
|
|
2899
|
+
// Not all browsers support upload events
|
|
2900
|
+
if (onUploadProgress && request.upload) {
|
|
2901
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2689
2902
|
|
|
2690
|
-
|
|
2691
|
-
if (onUploadProgress && request.upload) {
|
|
2692
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
2903
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
2693
2904
|
|
|
2694
|
-
|
|
2905
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
2906
|
+
}
|
|
2695
2907
|
|
|
2696
|
-
|
|
2697
|
-
|
|
2908
|
+
if (_config.cancelToken || _config.signal) {
|
|
2909
|
+
// Handle cancellation
|
|
2910
|
+
// eslint-disable-next-line func-names
|
|
2911
|
+
onCanceled = (cancel) => {
|
|
2912
|
+
if (!request) {
|
|
2913
|
+
return;
|
|
2914
|
+
}
|
|
2915
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2916
|
+
request.abort();
|
|
2917
|
+
request = null;
|
|
2918
|
+
};
|
|
2698
2919
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
return;
|
|
2920
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2921
|
+
if (_config.signal) {
|
|
2922
|
+
_config.signal.aborted
|
|
2923
|
+
? onCanceled()
|
|
2924
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
2705
2925
|
}
|
|
2706
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2707
|
-
request.abort();
|
|
2708
|
-
request = null;
|
|
2709
|
-
};
|
|
2710
|
-
|
|
2711
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2712
|
-
if (_config.signal) {
|
|
2713
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
2714
2926
|
}
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
|
-
const protocol = parseProtocol(_config.url);
|
|
2718
2927
|
|
|
2719
|
-
|
|
2720
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
2721
|
-
return;
|
|
2722
|
-
}
|
|
2928
|
+
const protocol = parseProtocol(_config.url);
|
|
2723
2929
|
|
|
2930
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2931
|
+
reject(
|
|
2932
|
+
new AxiosError$1(
|
|
2933
|
+
'Unsupported protocol ' + protocol + ':',
|
|
2934
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
2935
|
+
config
|
|
2936
|
+
)
|
|
2937
|
+
);
|
|
2938
|
+
return;
|
|
2939
|
+
}
|
|
2724
2940
|
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2941
|
+
// Send the request
|
|
2942
|
+
request.send(requestData || null);
|
|
2943
|
+
});
|
|
2944
|
+
};
|
|
2729
2945
|
|
|
2730
2946
|
const composeSignals = (signals, timeout) => {
|
|
2731
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
2947
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
2732
2948
|
|
|
2733
2949
|
if (timeout || length) {
|
|
2734
2950
|
let controller = new AbortController();
|
|
@@ -2740,21 +2956,29 @@
|
|
|
2740
2956
|
aborted = true;
|
|
2741
2957
|
unsubscribe();
|
|
2742
2958
|
const err = reason instanceof Error ? reason : this.reason;
|
|
2743
|
-
controller.abort(
|
|
2959
|
+
controller.abort(
|
|
2960
|
+
err instanceof AxiosError$1
|
|
2961
|
+
? err
|
|
2962
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
2963
|
+
);
|
|
2744
2964
|
}
|
|
2745
2965
|
};
|
|
2746
2966
|
|
|
2747
|
-
let timer =
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2967
|
+
let timer =
|
|
2968
|
+
timeout &&
|
|
2969
|
+
setTimeout(() => {
|
|
2970
|
+
timer = null;
|
|
2971
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
2972
|
+
}, timeout);
|
|
2751
2973
|
|
|
2752
2974
|
const unsubscribe = () => {
|
|
2753
2975
|
if (signals) {
|
|
2754
2976
|
timer && clearTimeout(timer);
|
|
2755
2977
|
timer = null;
|
|
2756
|
-
signals.forEach(signal => {
|
|
2757
|
-
signal.unsubscribe
|
|
2978
|
+
signals.forEach((signal) => {
|
|
2979
|
+
signal.unsubscribe
|
|
2980
|
+
? signal.unsubscribe(onabort)
|
|
2981
|
+
: signal.removeEventListener('abort', onabort);
|
|
2758
2982
|
});
|
|
2759
2983
|
signals = null;
|
|
2760
2984
|
}
|
|
@@ -2762,7 +2986,7 @@
|
|
|
2762
2986
|
|
|
2763
2987
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
2764
2988
|
|
|
2765
|
-
const {signal} = controller;
|
|
2989
|
+
const { signal } = controller;
|
|
2766
2990
|
|
|
2767
2991
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2768
2992
|
|
|
@@ -2805,7 +3029,7 @@
|
|
|
2805
3029
|
const reader = stream.getReader();
|
|
2806
3030
|
try {
|
|
2807
3031
|
for (;;) {
|
|
2808
|
-
const {done, value} = await reader.read();
|
|
3032
|
+
const { done, value } = await reader.read();
|
|
2809
3033
|
if (done) {
|
|
2810
3034
|
break;
|
|
2811
3035
|
}
|
|
@@ -2828,64 +3052,69 @@
|
|
|
2828
3052
|
}
|
|
2829
3053
|
};
|
|
2830
3054
|
|
|
2831
|
-
return new ReadableStream(
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
3055
|
+
return new ReadableStream(
|
|
3056
|
+
{
|
|
3057
|
+
async pull(controller) {
|
|
3058
|
+
try {
|
|
3059
|
+
const { done, value } = await iterator.next();
|
|
2835
3060
|
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
3061
|
+
if (done) {
|
|
3062
|
+
_onFinish();
|
|
3063
|
+
controller.close();
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
2841
3066
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
3067
|
+
let len = value.byteLength;
|
|
3068
|
+
if (onProgress) {
|
|
3069
|
+
let loadedBytes = (bytes += len);
|
|
3070
|
+
onProgress(loadedBytes);
|
|
3071
|
+
}
|
|
3072
|
+
controller.enqueue(new Uint8Array(value));
|
|
3073
|
+
} catch (err) {
|
|
3074
|
+
_onFinish(err);
|
|
3075
|
+
throw err;
|
|
2846
3076
|
}
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
_onFinish(
|
|
2850
|
-
|
|
2851
|
-
}
|
|
3077
|
+
},
|
|
3078
|
+
cancel(reason) {
|
|
3079
|
+
_onFinish(reason);
|
|
3080
|
+
return iterator.return();
|
|
3081
|
+
},
|
|
2852
3082
|
},
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
return iterator.return();
|
|
3083
|
+
{
|
|
3084
|
+
highWaterMark: 2,
|
|
2856
3085
|
}
|
|
2857
|
-
|
|
2858
|
-
highWaterMark: 2
|
|
2859
|
-
})
|
|
3086
|
+
);
|
|
2860
3087
|
};
|
|
2861
3088
|
|
|
2862
3089
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2863
3090
|
|
|
2864
|
-
const {isFunction} = utils$1;
|
|
3091
|
+
const { isFunction } = utils$1;
|
|
2865
3092
|
|
|
2866
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
2867
|
-
Request,
|
|
3093
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3094
|
+
Request,
|
|
3095
|
+
Response,
|
|
2868
3096
|
}))(utils$1.global);
|
|
2869
3097
|
|
|
2870
|
-
const {
|
|
2871
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
2872
|
-
} = utils$1.global;
|
|
2873
|
-
|
|
3098
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
2874
3099
|
|
|
2875
3100
|
const test = (fn, ...args) => {
|
|
2876
3101
|
try {
|
|
2877
3102
|
return !!fn(...args);
|
|
2878
3103
|
} catch (e) {
|
|
2879
|
-
return false
|
|
3104
|
+
return false;
|
|
2880
3105
|
}
|
|
2881
3106
|
};
|
|
2882
3107
|
|
|
2883
3108
|
const factory = (env) => {
|
|
2884
|
-
env = utils$1.merge.call(
|
|
2885
|
-
|
|
2886
|
-
|
|
3109
|
+
env = utils$1.merge.call(
|
|
3110
|
+
{
|
|
3111
|
+
skipUndefined: true,
|
|
3112
|
+
},
|
|
3113
|
+
globalFetchAPI,
|
|
3114
|
+
env
|
|
3115
|
+
);
|
|
2887
3116
|
|
|
2888
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
3117
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
2889
3118
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
2890
3119
|
const isRequestSupported = isFunction(Request);
|
|
2891
3120
|
const isResponseSupported = isFunction(Response);
|
|
@@ -2896,46 +3125,65 @@
|
|
|
2896
3125
|
|
|
2897
3126
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
2898
3127
|
|
|
2899
|
-
const encodeText =
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
3128
|
+
const encodeText =
|
|
3129
|
+
isFetchSupported &&
|
|
3130
|
+
(typeof TextEncoder === 'function'
|
|
3131
|
+
? (
|
|
3132
|
+
(encoder) => (str) =>
|
|
3133
|
+
encoder.encode(str)
|
|
3134
|
+
)(new TextEncoder())
|
|
3135
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
2903
3136
|
|
|
2904
|
-
const supportsRequestStream =
|
|
2905
|
-
|
|
3137
|
+
const supportsRequestStream =
|
|
3138
|
+
isRequestSupported &&
|
|
3139
|
+
isReadableStreamSupported &&
|
|
3140
|
+
test(() => {
|
|
3141
|
+
let duplexAccessed = false;
|
|
2906
3142
|
|
|
2907
|
-
|
|
2908
|
-
body: new ReadableStream$1(),
|
|
2909
|
-
method: 'POST',
|
|
2910
|
-
get duplex() {
|
|
2911
|
-
duplexAccessed = true;
|
|
2912
|
-
return 'half';
|
|
2913
|
-
},
|
|
2914
|
-
}).headers.has('Content-Type');
|
|
3143
|
+
const body = new ReadableStream$1();
|
|
2915
3144
|
|
|
2916
|
-
|
|
2917
|
-
|
|
3145
|
+
const hasContentType = new Request(platform.origin, {
|
|
3146
|
+
body,
|
|
3147
|
+
method: 'POST',
|
|
3148
|
+
get duplex() {
|
|
3149
|
+
duplexAccessed = true;
|
|
3150
|
+
return 'half';
|
|
3151
|
+
},
|
|
3152
|
+
}).headers.has('Content-Type');
|
|
3153
|
+
|
|
3154
|
+
body.cancel();
|
|
3155
|
+
|
|
3156
|
+
return duplexAccessed && !hasContentType;
|
|
3157
|
+
});
|
|
2918
3158
|
|
|
2919
|
-
const supportsResponseStream =
|
|
3159
|
+
const supportsResponseStream =
|
|
3160
|
+
isResponseSupported &&
|
|
3161
|
+
isReadableStreamSupported &&
|
|
2920
3162
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2921
3163
|
|
|
2922
3164
|
const resolvers = {
|
|
2923
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
3165
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
2924
3166
|
};
|
|
2925
3167
|
|
|
2926
|
-
isFetchSupported &&
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3168
|
+
isFetchSupported &&
|
|
3169
|
+
(() => {
|
|
3170
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
3171
|
+
!resolvers[type] &&
|
|
3172
|
+
(resolvers[type] = (res, config) => {
|
|
3173
|
+
let method = res && res[type];
|
|
2930
3174
|
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
3175
|
+
if (method) {
|
|
3176
|
+
return method.call(res);
|
|
3177
|
+
}
|
|
2934
3178
|
|
|
2935
|
-
|
|
3179
|
+
throw new AxiosError$1(
|
|
3180
|
+
`Response type '${type}' is not supported`,
|
|
3181
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
3182
|
+
config
|
|
3183
|
+
);
|
|
3184
|
+
});
|
|
2936
3185
|
});
|
|
2937
|
-
});
|
|
2938
|
-
})());
|
|
3186
|
+
})();
|
|
2939
3187
|
|
|
2940
3188
|
const getBodyLength = async (body) => {
|
|
2941
3189
|
if (body == null) {
|
|
@@ -2986,32 +3234,41 @@
|
|
|
2986
3234
|
responseType,
|
|
2987
3235
|
headers,
|
|
2988
3236
|
withCredentials = 'same-origin',
|
|
2989
|
-
fetchOptions
|
|
3237
|
+
fetchOptions,
|
|
2990
3238
|
} = resolveConfig(config);
|
|
2991
3239
|
|
|
2992
3240
|
let _fetch = envFetch || fetch;
|
|
2993
3241
|
|
|
2994
3242
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2995
3243
|
|
|
2996
|
-
let composedSignal = composeSignals$1(
|
|
3244
|
+
let composedSignal = composeSignals$1(
|
|
3245
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
3246
|
+
timeout
|
|
3247
|
+
);
|
|
2997
3248
|
|
|
2998
3249
|
let request = null;
|
|
2999
3250
|
|
|
3000
|
-
const unsubscribe =
|
|
3001
|
-
composedSignal
|
|
3002
|
-
|
|
3251
|
+
const unsubscribe =
|
|
3252
|
+
composedSignal &&
|
|
3253
|
+
composedSignal.unsubscribe &&
|
|
3254
|
+
(() => {
|
|
3255
|
+
composedSignal.unsubscribe();
|
|
3256
|
+
});
|
|
3003
3257
|
|
|
3004
3258
|
let requestContentLength;
|
|
3005
3259
|
|
|
3006
3260
|
try {
|
|
3007
3261
|
if (
|
|
3008
|
-
onUploadProgress &&
|
|
3262
|
+
onUploadProgress &&
|
|
3263
|
+
supportsRequestStream &&
|
|
3264
|
+
method !== 'get' &&
|
|
3265
|
+
method !== 'head' &&
|
|
3009
3266
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3010
3267
|
) {
|
|
3011
3268
|
let _request = new Request(url, {
|
|
3012
3269
|
method: 'POST',
|
|
3013
3270
|
body: data,
|
|
3014
|
-
duplex:
|
|
3271
|
+
duplex: 'half',
|
|
3015
3272
|
});
|
|
3016
3273
|
|
|
3017
3274
|
let contentTypeHeader;
|
|
@@ -3036,7 +3293,7 @@
|
|
|
3036
3293
|
|
|
3037
3294
|
// Cloudflare Workers throws when credentials are defined
|
|
3038
3295
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3039
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
3296
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3040
3297
|
|
|
3041
3298
|
const resolvedOptions = {
|
|
3042
3299
|
...fetchOptions,
|
|
@@ -3044,29 +3301,35 @@
|
|
|
3044
3301
|
method: method.toUpperCase(),
|
|
3045
3302
|
headers: headers.normalize().toJSON(),
|
|
3046
3303
|
body: data,
|
|
3047
|
-
duplex:
|
|
3048
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3304
|
+
duplex: 'half',
|
|
3305
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3049
3306
|
};
|
|
3050
3307
|
|
|
3051
3308
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3052
3309
|
|
|
3053
|
-
let response = await (isRequestSupported
|
|
3310
|
+
let response = await (isRequestSupported
|
|
3311
|
+
? _fetch(request, fetchOptions)
|
|
3312
|
+
: _fetch(url, resolvedOptions));
|
|
3054
3313
|
|
|
3055
|
-
const isStreamResponse =
|
|
3314
|
+
const isStreamResponse =
|
|
3315
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3056
3316
|
|
|
3057
3317
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3058
3318
|
const options = {};
|
|
3059
3319
|
|
|
3060
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
3320
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3061
3321
|
options[prop] = response[prop];
|
|
3062
3322
|
});
|
|
3063
3323
|
|
|
3064
3324
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3065
3325
|
|
|
3066
|
-
const [onProgress, flush] =
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3326
|
+
const [onProgress, flush] =
|
|
3327
|
+
(onDownloadProgress &&
|
|
3328
|
+
progressEventDecorator(
|
|
3329
|
+
responseContentLength,
|
|
3330
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3331
|
+
)) ||
|
|
3332
|
+
[];
|
|
3070
3333
|
|
|
3071
3334
|
response = new Response(
|
|
3072
3335
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3079,7 +3342,10 @@
|
|
|
3079
3342
|
|
|
3080
3343
|
responseType = responseType || 'text';
|
|
3081
3344
|
|
|
3082
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3345
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3346
|
+
response,
|
|
3347
|
+
config
|
|
3348
|
+
);
|
|
3083
3349
|
|
|
3084
3350
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3085
3351
|
|
|
@@ -3090,43 +3356,50 @@
|
|
|
3090
3356
|
status: response.status,
|
|
3091
3357
|
statusText: response.statusText,
|
|
3092
3358
|
config,
|
|
3093
|
-
request
|
|
3359
|
+
request,
|
|
3094
3360
|
});
|
|
3095
|
-
})
|
|
3361
|
+
});
|
|
3096
3362
|
} catch (err) {
|
|
3097
3363
|
unsubscribe && unsubscribe();
|
|
3098
3364
|
|
|
3099
3365
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3100
3366
|
throw Object.assign(
|
|
3101
|
-
new AxiosError$1(
|
|
3367
|
+
new AxiosError$1(
|
|
3368
|
+
'Network Error',
|
|
3369
|
+
AxiosError$1.ERR_NETWORK,
|
|
3370
|
+
config,
|
|
3371
|
+
request,
|
|
3372
|
+
err && err.response
|
|
3373
|
+
),
|
|
3102
3374
|
{
|
|
3103
|
-
cause: err.cause || err
|
|
3375
|
+
cause: err.cause || err,
|
|
3104
3376
|
}
|
|
3105
|
-
)
|
|
3377
|
+
);
|
|
3106
3378
|
}
|
|
3107
3379
|
|
|
3108
3380
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3109
3381
|
}
|
|
3110
|
-
}
|
|
3382
|
+
};
|
|
3111
3383
|
};
|
|
3112
3384
|
|
|
3113
3385
|
const seedCache = new Map();
|
|
3114
3386
|
|
|
3115
3387
|
const getFetch = (config) => {
|
|
3116
3388
|
let env = (config && config.env) || {};
|
|
3117
|
-
const {fetch, Request, Response} = env;
|
|
3118
|
-
const seeds = [
|
|
3119
|
-
Request, Response, fetch
|
|
3120
|
-
];
|
|
3389
|
+
const { fetch, Request, Response } = env;
|
|
3390
|
+
const seeds = [Request, Response, fetch];
|
|
3121
3391
|
|
|
3122
|
-
let len = seeds.length,
|
|
3123
|
-
|
|
3392
|
+
let len = seeds.length,
|
|
3393
|
+
i = len,
|
|
3394
|
+
seed,
|
|
3395
|
+
target,
|
|
3396
|
+
map = seedCache;
|
|
3124
3397
|
|
|
3125
3398
|
while (i--) {
|
|
3126
3399
|
seed = seeds[i];
|
|
3127
3400
|
target = map.get(seed);
|
|
3128
3401
|
|
|
3129
|
-
target === undefined && map.set(seed, target =
|
|
3402
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
3130
3403
|
|
|
3131
3404
|
map = target;
|
|
3132
3405
|
}
|
|
@@ -3142,7 +3415,7 @@
|
|
|
3142
3415
|
* - `http` for Node.js
|
|
3143
3416
|
* - `xhr` for browsers
|
|
3144
3417
|
* - `fetch` for fetch API-based requests
|
|
3145
|
-
*
|
|
3418
|
+
*
|
|
3146
3419
|
* @type {Object<string, Function|Object>}
|
|
3147
3420
|
*/
|
|
3148
3421
|
const knownAdapters = {
|
|
@@ -3150,7 +3423,7 @@
|
|
|
3150
3423
|
xhr: xhrAdapter,
|
|
3151
3424
|
fetch: {
|
|
3152
3425
|
get: getFetch,
|
|
3153
|
-
}
|
|
3426
|
+
},
|
|
3154
3427
|
};
|
|
3155
3428
|
|
|
3156
3429
|
// Assign adapter names for easier debugging and identification
|
|
@@ -3167,7 +3440,7 @@
|
|
|
3167
3440
|
|
|
3168
3441
|
/**
|
|
3169
3442
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
3170
|
-
*
|
|
3443
|
+
*
|
|
3171
3444
|
* @param {string} reason
|
|
3172
3445
|
* @returns {string}
|
|
3173
3446
|
*/
|
|
@@ -3175,17 +3448,18 @@
|
|
|
3175
3448
|
|
|
3176
3449
|
/**
|
|
3177
3450
|
* Check if the adapter is resolved (function, null, or false)
|
|
3178
|
-
*
|
|
3451
|
+
*
|
|
3179
3452
|
* @param {Function|null|false} adapter
|
|
3180
3453
|
* @returns {boolean}
|
|
3181
3454
|
*/
|
|
3182
|
-
const isResolvedHandle = (adapter) =>
|
|
3455
|
+
const isResolvedHandle = (adapter) =>
|
|
3456
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3183
3457
|
|
|
3184
3458
|
/**
|
|
3185
3459
|
* Get the first suitable adapter from the provided list.
|
|
3186
3460
|
* Tries each adapter in order until a supported one is found.
|
|
3187
3461
|
* Throws an AxiosError if no adapter is suitable.
|
|
3188
|
-
*
|
|
3462
|
+
*
|
|
3189
3463
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3190
3464
|
* @param {Object} config - Axios request configuration
|
|
3191
3465
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -3222,14 +3496,17 @@
|
|
|
3222
3496
|
}
|
|
3223
3497
|
|
|
3224
3498
|
if (!adapter) {
|
|
3225
|
-
const reasons = Object.entries(rejectedReasons)
|
|
3226
|
-
|
|
3499
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
3500
|
+
([id, state]) =>
|
|
3501
|
+
`adapter ${id} ` +
|
|
3227
3502
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3228
|
-
|
|
3503
|
+
);
|
|
3229
3504
|
|
|
3230
|
-
let s = length
|
|
3231
|
-
|
|
3232
|
-
|
|
3505
|
+
let s = length
|
|
3506
|
+
? reasons.length > 1
|
|
3507
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
3508
|
+
: ' ' + renderReason(reasons[0])
|
|
3509
|
+
: 'as no adapter specified';
|
|
3233
3510
|
|
|
3234
3511
|
throw new AxiosError$1(
|
|
3235
3512
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
@@ -3254,7 +3531,7 @@
|
|
|
3254
3531
|
* Exposes all known adapters
|
|
3255
3532
|
* @type {Object<string, Function|Object>}
|
|
3256
3533
|
*/
|
|
3257
|
-
adapters: knownAdapters
|
|
3534
|
+
adapters: knownAdapters,
|
|
3258
3535
|
};
|
|
3259
3536
|
|
|
3260
3537
|
/**
|
|
@@ -3287,10 +3564,7 @@
|
|
|
3287
3564
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
3288
3565
|
|
|
3289
3566
|
// Transform request data
|
|
3290
|
-
config.data = transformData.call(
|
|
3291
|
-
config,
|
|
3292
|
-
config.transformRequest
|
|
3293
|
-
);
|
|
3567
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
3294
3568
|
|
|
3295
3569
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3296
3570
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
@@ -3298,39 +3572,38 @@
|
|
|
3298
3572
|
|
|
3299
3573
|
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3300
3574
|
|
|
3301
|
-
return adapter(config).then(
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
// Transform response data
|
|
3305
|
-
response.data = transformData.call(
|
|
3306
|
-
config,
|
|
3307
|
-
config.transformResponse,
|
|
3308
|
-
response
|
|
3309
|
-
);
|
|
3310
|
-
|
|
3311
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3312
|
-
|
|
3313
|
-
return response;
|
|
3314
|
-
}, function onAdapterRejection(reason) {
|
|
3315
|
-
if (!isCancel(reason)) {
|
|
3575
|
+
return adapter(config).then(
|
|
3576
|
+
function onAdapterResolution(response) {
|
|
3316
3577
|
throwIfCancellationRequested(config);
|
|
3317
3578
|
|
|
3318
3579
|
// Transform response data
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3580
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
3581
|
+
|
|
3582
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3583
|
+
|
|
3584
|
+
return response;
|
|
3585
|
+
},
|
|
3586
|
+
function onAdapterRejection(reason) {
|
|
3587
|
+
if (!isCancel(reason)) {
|
|
3588
|
+
throwIfCancellationRequested(config);
|
|
3589
|
+
|
|
3590
|
+
// Transform response data
|
|
3591
|
+
if (reason && reason.response) {
|
|
3592
|
+
reason.response.data = transformData.call(
|
|
3593
|
+
config,
|
|
3594
|
+
config.transformResponse,
|
|
3595
|
+
reason.response
|
|
3596
|
+
);
|
|
3597
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3598
|
+
}
|
|
3326
3599
|
}
|
|
3327
|
-
}
|
|
3328
3600
|
|
|
3329
|
-
|
|
3330
|
-
|
|
3601
|
+
return Promise.reject(reason);
|
|
3602
|
+
}
|
|
3603
|
+
);
|
|
3331
3604
|
}
|
|
3332
3605
|
|
|
3333
|
-
const VERSION = "1.
|
|
3606
|
+
const VERSION = "1.15.0";
|
|
3334
3607
|
|
|
3335
3608
|
const validators$1 = {};
|
|
3336
3609
|
|
|
@@ -3354,7 +3627,15 @@
|
|
|
3354
3627
|
*/
|
|
3355
3628
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
3356
3629
|
function formatMessage(opt, desc) {
|
|
3357
|
-
return
|
|
3630
|
+
return (
|
|
3631
|
+
'[Axios v' +
|
|
3632
|
+
VERSION +
|
|
3633
|
+
"] Transitional option '" +
|
|
3634
|
+
opt +
|
|
3635
|
+
"'" +
|
|
3636
|
+
desc +
|
|
3637
|
+
(message ? '. ' + message : '')
|
|
3638
|
+
);
|
|
3358
3639
|
}
|
|
3359
3640
|
|
|
3360
3641
|
// eslint-disable-next-line func-names
|
|
@@ -3386,7 +3667,7 @@
|
|
|
3386
3667
|
// eslint-disable-next-line no-console
|
|
3387
3668
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3388
3669
|
return true;
|
|
3389
|
-
}
|
|
3670
|
+
};
|
|
3390
3671
|
};
|
|
3391
3672
|
|
|
3392
3673
|
/**
|
|
@@ -3412,7 +3693,10 @@
|
|
|
3412
3693
|
const value = options[opt];
|
|
3413
3694
|
const result = value === undefined || validator(value, opt, options);
|
|
3414
3695
|
if (result !== true) {
|
|
3415
|
-
throw new AxiosError$1(
|
|
3696
|
+
throw new AxiosError$1(
|
|
3697
|
+
'option ' + opt + ' must be ' + result,
|
|
3698
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
3699
|
+
);
|
|
3416
3700
|
}
|
|
3417
3701
|
continue;
|
|
3418
3702
|
}
|
|
@@ -3424,7 +3708,7 @@
|
|
|
3424
3708
|
|
|
3425
3709
|
var validator = {
|
|
3426
3710
|
assertOptions,
|
|
3427
|
-
validators: validators$1
|
|
3711
|
+
validators: validators$1,
|
|
3428
3712
|
};
|
|
3429
3713
|
|
|
3430
3714
|
const validators = validator.validators;
|
|
@@ -3441,7 +3725,7 @@
|
|
|
3441
3725
|
this.defaults = instanceConfig || {};
|
|
3442
3726
|
this.interceptors = {
|
|
3443
3727
|
request: new InterceptorManager$1(),
|
|
3444
|
-
response: new InterceptorManager$1()
|
|
3728
|
+
response: new InterceptorManager$1(),
|
|
3445
3729
|
};
|
|
3446
3730
|
}
|
|
3447
3731
|
|
|
@@ -3463,13 +3747,29 @@
|
|
|
3463
3747
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
3464
3748
|
|
|
3465
3749
|
// slice off the Error: ... line
|
|
3466
|
-
const stack =
|
|
3750
|
+
const stack = (() => {
|
|
3751
|
+
if (!dummy.stack) {
|
|
3752
|
+
return '';
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
3756
|
+
|
|
3757
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
3758
|
+
})();
|
|
3467
3759
|
try {
|
|
3468
3760
|
if (!err.stack) {
|
|
3469
3761
|
err.stack = stack;
|
|
3470
3762
|
// match without the 2 top stack lines
|
|
3471
|
-
} else if (stack
|
|
3472
|
-
|
|
3763
|
+
} else if (stack) {
|
|
3764
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
3765
|
+
const secondNewlineIndex =
|
|
3766
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
3767
|
+
const stackWithoutTwoTopLines =
|
|
3768
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
3769
|
+
|
|
3770
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
3771
|
+
err.stack += '\n' + stack;
|
|
3772
|
+
}
|
|
3473
3773
|
}
|
|
3474
3774
|
} catch (e) {
|
|
3475
3775
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -3492,27 +3792,35 @@
|
|
|
3492
3792
|
|
|
3493
3793
|
config = mergeConfig(this.defaults, config);
|
|
3494
3794
|
|
|
3495
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
3795
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3496
3796
|
|
|
3497
3797
|
if (transitional !== undefined) {
|
|
3498
|
-
validator.assertOptions(
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3798
|
+
validator.assertOptions(
|
|
3799
|
+
transitional,
|
|
3800
|
+
{
|
|
3801
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3802
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3803
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3804
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
3805
|
+
},
|
|
3806
|
+
false
|
|
3807
|
+
);
|
|
3504
3808
|
}
|
|
3505
3809
|
|
|
3506
3810
|
if (paramsSerializer != null) {
|
|
3507
3811
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
3508
3812
|
config.paramsSerializer = {
|
|
3509
|
-
serialize: paramsSerializer
|
|
3813
|
+
serialize: paramsSerializer,
|
|
3510
3814
|
};
|
|
3511
3815
|
} else {
|
|
3512
|
-
validator.assertOptions(
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3816
|
+
validator.assertOptions(
|
|
3817
|
+
paramsSerializer,
|
|
3818
|
+
{
|
|
3819
|
+
encode: validators.function,
|
|
3820
|
+
serialize: validators.function,
|
|
3821
|
+
},
|
|
3822
|
+
true
|
|
3823
|
+
);
|
|
3516
3824
|
}
|
|
3517
3825
|
}
|
|
3518
3826
|
|
|
@@ -3523,26 +3831,25 @@
|
|
|
3523
3831
|
config.allowAbsoluteUrls = true;
|
|
3524
3832
|
}
|
|
3525
3833
|
|
|
3526
|
-
validator.assertOptions(
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3834
|
+
validator.assertOptions(
|
|
3835
|
+
config,
|
|
3836
|
+
{
|
|
3837
|
+
baseUrl: validators.spelling('baseURL'),
|
|
3838
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
3839
|
+
},
|
|
3840
|
+
true
|
|
3841
|
+
);
|
|
3530
3842
|
|
|
3531
3843
|
// Set config.method
|
|
3532
3844
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3533
3845
|
|
|
3534
3846
|
// Flatten headers
|
|
3535
|
-
let contextHeaders = headers && utils$1.merge(
|
|
3536
|
-
headers.common,
|
|
3537
|
-
headers[config.method]
|
|
3538
|
-
);
|
|
3847
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3539
3848
|
|
|
3540
|
-
headers &&
|
|
3541
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
3542
|
-
(method) => {
|
|
3849
|
+
headers &&
|
|
3850
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
3543
3851
|
delete headers[method];
|
|
3544
|
-
}
|
|
3545
|
-
);
|
|
3852
|
+
});
|
|
3546
3853
|
|
|
3547
3854
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3548
3855
|
|
|
@@ -3557,7 +3864,8 @@
|
|
|
3557
3864
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3558
3865
|
|
|
3559
3866
|
const transitional = config.transitional || transitionalDefaults;
|
|
3560
|
-
const legacyInterceptorReqResOrdering =
|
|
3867
|
+
const legacyInterceptorReqResOrdering =
|
|
3868
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3561
3869
|
|
|
3562
3870
|
if (legacyInterceptorReqResOrdering) {
|
|
3563
3871
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
@@ -3631,28 +3939,32 @@
|
|
|
3631
3939
|
// Provide aliases for supported request methods
|
|
3632
3940
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
3633
3941
|
/*eslint func-names:0*/
|
|
3634
|
-
Axios.prototype[method] = function(url, config) {
|
|
3635
|
-
return this.request(
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3942
|
+
Axios.prototype[method] = function (url, config) {
|
|
3943
|
+
return this.request(
|
|
3944
|
+
mergeConfig(config || {}, {
|
|
3945
|
+
method,
|
|
3946
|
+
url,
|
|
3947
|
+
data: (config || {}).data,
|
|
3948
|
+
})
|
|
3949
|
+
);
|
|
3640
3950
|
};
|
|
3641
3951
|
});
|
|
3642
3952
|
|
|
3643
3953
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3644
|
-
/*eslint func-names:0*/
|
|
3645
|
-
|
|
3646
3954
|
function generateHTTPMethod(isForm) {
|
|
3647
3955
|
return function httpMethod(url, data, config) {
|
|
3648
|
-
return this.request(
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3956
|
+
return this.request(
|
|
3957
|
+
mergeConfig(config || {}, {
|
|
3958
|
+
method,
|
|
3959
|
+
headers: isForm
|
|
3960
|
+
? {
|
|
3961
|
+
'Content-Type': 'multipart/form-data',
|
|
3962
|
+
}
|
|
3963
|
+
: {},
|
|
3964
|
+
url,
|
|
3965
|
+
data,
|
|
3966
|
+
})
|
|
3967
|
+
);
|
|
3656
3968
|
};
|
|
3657
3969
|
}
|
|
3658
3970
|
|
|
@@ -3685,7 +3997,7 @@
|
|
|
3685
3997
|
const token = this;
|
|
3686
3998
|
|
|
3687
3999
|
// eslint-disable-next-line func-names
|
|
3688
|
-
this.promise.then(cancel => {
|
|
4000
|
+
this.promise.then((cancel) => {
|
|
3689
4001
|
if (!token._listeners) return;
|
|
3690
4002
|
|
|
3691
4003
|
let i = token._listeners.length;
|
|
@@ -3697,10 +4009,10 @@
|
|
|
3697
4009
|
});
|
|
3698
4010
|
|
|
3699
4011
|
// eslint-disable-next-line func-names
|
|
3700
|
-
this.promise.then = onfulfilled => {
|
|
4012
|
+
this.promise.then = (onfulfilled) => {
|
|
3701
4013
|
let _resolve;
|
|
3702
4014
|
// eslint-disable-next-line func-names
|
|
3703
|
-
const promise = new Promise(resolve => {
|
|
4015
|
+
const promise = new Promise((resolve) => {
|
|
3704
4016
|
token.subscribe(resolve);
|
|
3705
4017
|
_resolve = resolve;
|
|
3706
4018
|
}).then(onfulfilled);
|
|
@@ -3788,7 +4100,7 @@
|
|
|
3788
4100
|
});
|
|
3789
4101
|
return {
|
|
3790
4102
|
token,
|
|
3791
|
-
cancel
|
|
4103
|
+
cancel,
|
|
3792
4104
|
};
|
|
3793
4105
|
}
|
|
3794
4106
|
}
|
|
@@ -3830,7 +4142,7 @@
|
|
|
3830
4142
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3831
4143
|
*/
|
|
3832
4144
|
function isAxiosError(payload) {
|
|
3833
|
-
return utils$1.isObject(payload) &&
|
|
4145
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
3834
4146
|
}
|
|
3835
4147
|
|
|
3836
4148
|
const HttpStatusCode = {
|
|
@@ -3923,10 +4235,10 @@
|
|
|
3923
4235
|
const instance = bind(Axios$1.prototype.request, context);
|
|
3924
4236
|
|
|
3925
4237
|
// Copy axios.prototype to instance
|
|
3926
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
4238
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
3927
4239
|
|
|
3928
4240
|
// Copy context to instance
|
|
3929
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
4241
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
3930
4242
|
|
|
3931
4243
|
// Factory for creating new instances
|
|
3932
4244
|
instance.create = function create(instanceConfig) {
|
|
@@ -3970,7 +4282,7 @@
|
|
|
3970
4282
|
|
|
3971
4283
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3972
4284
|
|
|
3973
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4285
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3974
4286
|
|
|
3975
4287
|
axios.getAdapter = adapters.getAdapter;
|
|
3976
4288
|
|
|
@@ -4182,6 +4494,7 @@
|
|
|
4182
4494
|
const SUPPORT_WINDOW_KEYBOARD_EVENT_TYPES = ['keydown', 'keyup', 'keypress'];
|
|
4183
4495
|
const SUPPORT_WINDOW_DRAG_EVENT_TYPES = ['dragstart', 'dragover', 'drag', 'dragend', 'dragenter', 'dragleave', 'drop'];
|
|
4184
4496
|
const HIGH_FREQUENCY_WINDOW_EVENT_TYPES = ['mousemove', 'dragover'];
|
|
4497
|
+
const INTERACTIVE_TAGS = ['SELECT', 'INPUT', 'TEXTAREA', 'BUTTON'];
|
|
4185
4498
|
const hasOwnProperty = (obj, key) => {
|
|
4186
4499
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
4187
4500
|
};
|
|
@@ -4275,6 +4588,12 @@
|
|
|
4275
4588
|
[...SUPPORT_WINDOW_MOUSE_EVENT_TYPES, ...SUPPORT_WINDOW_KEYBOARD_EVENT_TYPES, ...SUPPORT_WINDOW_DRAG_EVENT_TYPES].forEach(eventType => {
|
|
4276
4589
|
window.addEventListener(eventType, event => {
|
|
4277
4590
|
if (event.source === WINDOW_EVENT_SOURCE_TYPE.APP) return;
|
|
4591
|
+
const target = event.target;
|
|
4592
|
+
if (target && INTERACTIVE_TAGS.includes(target.tagName)) return;
|
|
4593
|
+
if (SUPPORT_WINDOW_KEYBOARD_EVENT_TYPES.includes(eventType)) {
|
|
4594
|
+
const active = document.activeElement;
|
|
4595
|
+
if (active && INTERACTIVE_TAGS.includes(active.tagName)) return;
|
|
4596
|
+
}
|
|
4278
4597
|
if (HIGH_FREQUENCY_WINDOW_EVENT_TYPES.includes(eventType)) {
|
|
4279
4598
|
// High-frequency events that need throttling (use RAF to limit to 60fps)
|
|
4280
4599
|
// Use requestAnimationFrame for throttling high-frequency events
|