enhance-axios 1.0.2
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/README.md +395 -0
- package/dist/cjs/index.js +686 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/index.min.js +1 -0
- package/dist/esm/index.d.mts +363 -0
- package/dist/esm/index.min.mjs +1 -0
- package/dist/esm/index.mjs +645 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/umd/index.global.js +670 -0
- package/dist/umd/index.global.js.map +1 -0
- package/dist/umd/index.min.global.js +1 -0
- package/dist/umd.bundle/index.axios.global.js +3751 -0
- package/dist/umd.bundle/index.axios.global.js.map +1 -0
- package/dist/umd.bundle/index.axios.min.global.js +9 -0
- package/package.json +95 -0
|
@@ -0,0 +1,3751 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var EnhanceAxios = (() => {
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all3) => {
|
|
8
|
+
for (var name in all3)
|
|
9
|
+
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
createEnhanceInstance: () => createEnhanceInstance,
|
|
25
|
+
defaultRetryCondition: () => defaultRetryCondition,
|
|
26
|
+
getFormData: () => getFormData,
|
|
27
|
+
hash: () => hash,
|
|
28
|
+
version: () => version
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// node_modules/axios/lib/helpers/bind.js
|
|
32
|
+
function bind(fn, thisArg) {
|
|
33
|
+
return function wrap() {
|
|
34
|
+
return fn.apply(thisArg, arguments);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// node_modules/axios/lib/utils.js
|
|
39
|
+
var { toString } = Object.prototype;
|
|
40
|
+
var { getPrototypeOf } = Object;
|
|
41
|
+
var { iterator, toStringTag } = Symbol;
|
|
42
|
+
var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
43
|
+
const str = toString.call(thing);
|
|
44
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
45
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
46
|
+
var kindOfTest = (type) => {
|
|
47
|
+
type = type.toLowerCase();
|
|
48
|
+
return (thing) => kindOf(thing) === type;
|
|
49
|
+
};
|
|
50
|
+
var typeOfTest = (type) => (thing) => typeof thing === type;
|
|
51
|
+
var { isArray } = Array;
|
|
52
|
+
var isUndefined = typeOfTest("undefined");
|
|
53
|
+
function isBuffer(val) {
|
|
54
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
55
|
+
}
|
|
56
|
+
var isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
57
|
+
function isArrayBufferView(val) {
|
|
58
|
+
let result;
|
|
59
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
60
|
+
result = ArrayBuffer.isView(val);
|
|
61
|
+
} else {
|
|
62
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
var isString = typeOfTest("string");
|
|
67
|
+
var isFunction = typeOfTest("function");
|
|
68
|
+
var isNumber = typeOfTest("number");
|
|
69
|
+
var isObject = (thing) => thing !== null && typeof thing === "object";
|
|
70
|
+
var isBoolean = (thing) => thing === true || thing === false;
|
|
71
|
+
var isPlainObject = (val) => {
|
|
72
|
+
if (kindOf(val) !== "object") {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const prototype2 = getPrototypeOf(val);
|
|
76
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
77
|
+
};
|
|
78
|
+
var isEmptyObject = (val) => {
|
|
79
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var isDate = kindOfTest("Date");
|
|
89
|
+
var isFile = kindOfTest("File");
|
|
90
|
+
var isReactNativeBlob = (value) => {
|
|
91
|
+
return !!(value && typeof value.uri !== "undefined");
|
|
92
|
+
};
|
|
93
|
+
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
94
|
+
var isBlob = kindOfTest("Blob");
|
|
95
|
+
var isFileList = kindOfTest("FileList");
|
|
96
|
+
var isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
97
|
+
function getGlobal() {
|
|
98
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
99
|
+
if (typeof self !== "undefined") return self;
|
|
100
|
+
if (typeof window !== "undefined") return window;
|
|
101
|
+
if (typeof global !== "undefined") return global;
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
var G = getGlobal();
|
|
105
|
+
var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
|
|
106
|
+
var isFormData = (thing) => {
|
|
107
|
+
if (!thing) return false;
|
|
108
|
+
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
109
|
+
const proto = getPrototypeOf(thing);
|
|
110
|
+
if (!proto || proto === Object.prototype) return false;
|
|
111
|
+
if (!isFunction(thing.append)) return false;
|
|
112
|
+
const kind = kindOf(thing);
|
|
113
|
+
return kind === "formdata" || // detect form-data instance
|
|
114
|
+
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]";
|
|
115
|
+
};
|
|
116
|
+
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
117
|
+
var [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
118
|
+
"ReadableStream",
|
|
119
|
+
"Request",
|
|
120
|
+
"Response",
|
|
121
|
+
"Headers"
|
|
122
|
+
].map(kindOfTest);
|
|
123
|
+
var trim = (str) => {
|
|
124
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
125
|
+
};
|
|
126
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
127
|
+
if (obj === null || typeof obj === "undefined") {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
let i;
|
|
131
|
+
let l;
|
|
132
|
+
if (typeof obj !== "object") {
|
|
133
|
+
obj = [obj];
|
|
134
|
+
}
|
|
135
|
+
if (isArray(obj)) {
|
|
136
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
137
|
+
fn.call(null, obj[i], i, obj);
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
if (isBuffer(obj)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
144
|
+
const len = keys.length;
|
|
145
|
+
let key;
|
|
146
|
+
for (i = 0; i < len; i++) {
|
|
147
|
+
key = keys[i];
|
|
148
|
+
fn.call(null, obj[key], key, obj);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function findKey(obj, key) {
|
|
153
|
+
if (isBuffer(obj)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
key = key.toLowerCase();
|
|
157
|
+
const keys = Object.keys(obj);
|
|
158
|
+
let i = keys.length;
|
|
159
|
+
let _key;
|
|
160
|
+
while (i-- > 0) {
|
|
161
|
+
_key = keys[i];
|
|
162
|
+
if (key === _key.toLowerCase()) {
|
|
163
|
+
return _key;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
var _global = (() => {
|
|
169
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
170
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
171
|
+
})();
|
|
172
|
+
var isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
173
|
+
function merge(...objs) {
|
|
174
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
175
|
+
const result = {};
|
|
176
|
+
const assignValue = (val, key) => {
|
|
177
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
181
|
+
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
|
|
182
|
+
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
183
|
+
result[targetKey] = merge(existing, val);
|
|
184
|
+
} else if (isPlainObject(val)) {
|
|
185
|
+
result[targetKey] = merge({}, val);
|
|
186
|
+
} else if (isArray(val)) {
|
|
187
|
+
result[targetKey] = val.slice();
|
|
188
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
189
|
+
result[targetKey] = val;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
for (let i = 0, l = objs.length; i < l; i++) {
|
|
193
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
198
|
+
forEach(
|
|
199
|
+
b,
|
|
200
|
+
(val, key) => {
|
|
201
|
+
if (thisArg && isFunction(val)) {
|
|
202
|
+
Object.defineProperty(a, key, {
|
|
203
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
204
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
205
|
+
__proto__: null,
|
|
206
|
+
value: bind(val, thisArg),
|
|
207
|
+
writable: true,
|
|
208
|
+
enumerable: true,
|
|
209
|
+
configurable: true
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
Object.defineProperty(a, key, {
|
|
213
|
+
__proto__: null,
|
|
214
|
+
value: val,
|
|
215
|
+
writable: true,
|
|
216
|
+
enumerable: true,
|
|
217
|
+
configurable: true
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{ allOwnKeys }
|
|
222
|
+
);
|
|
223
|
+
return a;
|
|
224
|
+
};
|
|
225
|
+
var stripBOM = (content) => {
|
|
226
|
+
if (content.charCodeAt(0) === 65279) {
|
|
227
|
+
content = content.slice(1);
|
|
228
|
+
}
|
|
229
|
+
return content;
|
|
230
|
+
};
|
|
231
|
+
var inherits = (constructor, superConstructor, props, descriptors) => {
|
|
232
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
233
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
234
|
+
__proto__: null,
|
|
235
|
+
value: constructor,
|
|
236
|
+
writable: true,
|
|
237
|
+
enumerable: false,
|
|
238
|
+
configurable: true
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(constructor, "super", {
|
|
241
|
+
__proto__: null,
|
|
242
|
+
value: superConstructor.prototype
|
|
243
|
+
});
|
|
244
|
+
props && Object.assign(constructor.prototype, props);
|
|
245
|
+
};
|
|
246
|
+
var toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
247
|
+
let props;
|
|
248
|
+
let i;
|
|
249
|
+
let prop;
|
|
250
|
+
const merged = {};
|
|
251
|
+
destObj = destObj || {};
|
|
252
|
+
if (sourceObj == null) return destObj;
|
|
253
|
+
do {
|
|
254
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
255
|
+
i = props.length;
|
|
256
|
+
while (i-- > 0) {
|
|
257
|
+
prop = props[i];
|
|
258
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
259
|
+
destObj[prop] = sourceObj[prop];
|
|
260
|
+
merged[prop] = true;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
264
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
265
|
+
return destObj;
|
|
266
|
+
};
|
|
267
|
+
var endsWith = (str, searchString, position) => {
|
|
268
|
+
str = String(str);
|
|
269
|
+
if (position === void 0 || position > str.length) {
|
|
270
|
+
position = str.length;
|
|
271
|
+
}
|
|
272
|
+
position -= searchString.length;
|
|
273
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
274
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
275
|
+
};
|
|
276
|
+
var toArray = (thing) => {
|
|
277
|
+
if (!thing) return null;
|
|
278
|
+
if (isArray(thing)) return thing;
|
|
279
|
+
let i = thing.length;
|
|
280
|
+
if (!isNumber(i)) return null;
|
|
281
|
+
const arr = new Array(i);
|
|
282
|
+
while (i-- > 0) {
|
|
283
|
+
arr[i] = thing[i];
|
|
284
|
+
}
|
|
285
|
+
return arr;
|
|
286
|
+
};
|
|
287
|
+
var isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
288
|
+
return (thing) => {
|
|
289
|
+
return TypedArray && thing instanceof TypedArray;
|
|
290
|
+
};
|
|
291
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
292
|
+
var forEachEntry = (obj, fn) => {
|
|
293
|
+
const generator = obj && obj[iterator];
|
|
294
|
+
const _iterator = generator.call(obj);
|
|
295
|
+
let result;
|
|
296
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
297
|
+
const pair = result.value;
|
|
298
|
+
fn.call(obj, pair[0], pair[1]);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
var matchAll = (regExp, str) => {
|
|
302
|
+
let matches;
|
|
303
|
+
const arr = [];
|
|
304
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
305
|
+
arr.push(matches);
|
|
306
|
+
}
|
|
307
|
+
return arr;
|
|
308
|
+
};
|
|
309
|
+
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
310
|
+
var toCamelCase = (str) => {
|
|
311
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
312
|
+
return p1.toUpperCase() + p2;
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
316
|
+
var isRegExp = kindOfTest("RegExp");
|
|
317
|
+
var reduceDescriptors = (obj, reducer) => {
|
|
318
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
319
|
+
const reducedDescriptors = {};
|
|
320
|
+
forEach(descriptors, (descriptor, name) => {
|
|
321
|
+
let ret;
|
|
322
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
323
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
327
|
+
};
|
|
328
|
+
var freezeMethods = (obj) => {
|
|
329
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
330
|
+
if (isFunction(obj) && ["arguments", "caller", "callee"].includes(name)) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
const value = obj[name];
|
|
334
|
+
if (!isFunction(value)) return;
|
|
335
|
+
descriptor.enumerable = false;
|
|
336
|
+
if ("writable" in descriptor) {
|
|
337
|
+
descriptor.writable = false;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!descriptor.set) {
|
|
341
|
+
descriptor.set = () => {
|
|
342
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
var toObjectSet = (arrayOrString, delimiter) => {
|
|
348
|
+
const obj = {};
|
|
349
|
+
const define = (arr) => {
|
|
350
|
+
arr.forEach((value) => {
|
|
351
|
+
obj[value] = true;
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
355
|
+
return obj;
|
|
356
|
+
};
|
|
357
|
+
var noop = () => {
|
|
358
|
+
};
|
|
359
|
+
var toFiniteNumber = (value, defaultValue) => {
|
|
360
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
361
|
+
};
|
|
362
|
+
function isSpecCompliantForm(thing) {
|
|
363
|
+
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
364
|
+
}
|
|
365
|
+
var toJSONObject = (obj) => {
|
|
366
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
367
|
+
const visit = (source) => {
|
|
368
|
+
if (isObject(source)) {
|
|
369
|
+
if (visited.has(source)) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (isBuffer(source)) {
|
|
373
|
+
return source;
|
|
374
|
+
}
|
|
375
|
+
if (!("toJSON" in source)) {
|
|
376
|
+
visited.add(source);
|
|
377
|
+
const target = isArray(source) ? [] : {};
|
|
378
|
+
forEach(source, (value, key) => {
|
|
379
|
+
const reducedValue = visit(value);
|
|
380
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
381
|
+
});
|
|
382
|
+
visited.delete(source);
|
|
383
|
+
return target;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return source;
|
|
387
|
+
};
|
|
388
|
+
return visit(obj);
|
|
389
|
+
};
|
|
390
|
+
var isAsyncFn = kindOfTest("AsyncFunction");
|
|
391
|
+
var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
392
|
+
var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
393
|
+
if (setImmediateSupported) {
|
|
394
|
+
return setImmediate;
|
|
395
|
+
}
|
|
396
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
397
|
+
_global.addEventListener(
|
|
398
|
+
"message",
|
|
399
|
+
({ source, data }) => {
|
|
400
|
+
if (source === _global && data === token) {
|
|
401
|
+
callbacks.length && callbacks.shift()();
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
false
|
|
405
|
+
);
|
|
406
|
+
return (cb) => {
|
|
407
|
+
callbacks.push(cb);
|
|
408
|
+
_global.postMessage(token, "*");
|
|
409
|
+
};
|
|
410
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
411
|
+
})(typeof setImmediate === "function", isFunction(_global.postMessage));
|
|
412
|
+
var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
413
|
+
var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
414
|
+
var utils_default = {
|
|
415
|
+
isArray,
|
|
416
|
+
isArrayBuffer,
|
|
417
|
+
isBuffer,
|
|
418
|
+
isFormData,
|
|
419
|
+
isArrayBufferView,
|
|
420
|
+
isString,
|
|
421
|
+
isNumber,
|
|
422
|
+
isBoolean,
|
|
423
|
+
isObject,
|
|
424
|
+
isPlainObject,
|
|
425
|
+
isEmptyObject,
|
|
426
|
+
isReadableStream,
|
|
427
|
+
isRequest,
|
|
428
|
+
isResponse,
|
|
429
|
+
isHeaders,
|
|
430
|
+
isUndefined,
|
|
431
|
+
isDate,
|
|
432
|
+
isFile,
|
|
433
|
+
isReactNativeBlob,
|
|
434
|
+
isReactNative,
|
|
435
|
+
isBlob,
|
|
436
|
+
isRegExp,
|
|
437
|
+
isFunction,
|
|
438
|
+
isStream,
|
|
439
|
+
isURLSearchParams,
|
|
440
|
+
isTypedArray,
|
|
441
|
+
isFileList,
|
|
442
|
+
forEach,
|
|
443
|
+
merge,
|
|
444
|
+
extend,
|
|
445
|
+
trim,
|
|
446
|
+
stripBOM,
|
|
447
|
+
inherits,
|
|
448
|
+
toFlatObject,
|
|
449
|
+
kindOf,
|
|
450
|
+
kindOfTest,
|
|
451
|
+
endsWith,
|
|
452
|
+
toArray,
|
|
453
|
+
forEachEntry,
|
|
454
|
+
matchAll,
|
|
455
|
+
isHTMLForm,
|
|
456
|
+
hasOwnProperty,
|
|
457
|
+
hasOwnProp: hasOwnProperty,
|
|
458
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
459
|
+
reduceDescriptors,
|
|
460
|
+
freezeMethods,
|
|
461
|
+
toObjectSet,
|
|
462
|
+
toCamelCase,
|
|
463
|
+
noop,
|
|
464
|
+
toFiniteNumber,
|
|
465
|
+
findKey,
|
|
466
|
+
global: _global,
|
|
467
|
+
isContextDefined,
|
|
468
|
+
isSpecCompliantForm,
|
|
469
|
+
toJSONObject,
|
|
470
|
+
isAsyncFn,
|
|
471
|
+
isThenable,
|
|
472
|
+
setImmediate: _setImmediate,
|
|
473
|
+
asap,
|
|
474
|
+
isIterable
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// node_modules/axios/lib/helpers/parseHeaders.js
|
|
478
|
+
var ignoreDuplicateOf = utils_default.toObjectSet([
|
|
479
|
+
"age",
|
|
480
|
+
"authorization",
|
|
481
|
+
"content-length",
|
|
482
|
+
"content-type",
|
|
483
|
+
"etag",
|
|
484
|
+
"expires",
|
|
485
|
+
"from",
|
|
486
|
+
"host",
|
|
487
|
+
"if-modified-since",
|
|
488
|
+
"if-unmodified-since",
|
|
489
|
+
"last-modified",
|
|
490
|
+
"location",
|
|
491
|
+
"max-forwards",
|
|
492
|
+
"proxy-authorization",
|
|
493
|
+
"referer",
|
|
494
|
+
"retry-after",
|
|
495
|
+
"user-agent"
|
|
496
|
+
]);
|
|
497
|
+
var parseHeaders_default = (rawHeaders) => {
|
|
498
|
+
const parsed = {};
|
|
499
|
+
let key;
|
|
500
|
+
let val;
|
|
501
|
+
let i;
|
|
502
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
503
|
+
i = line.indexOf(":");
|
|
504
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
505
|
+
val = line.substring(i + 1).trim();
|
|
506
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (key === "set-cookie") {
|
|
510
|
+
if (parsed[key]) {
|
|
511
|
+
parsed[key].push(val);
|
|
512
|
+
} else {
|
|
513
|
+
parsed[key] = [val];
|
|
514
|
+
}
|
|
515
|
+
} else {
|
|
516
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
return parsed;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
// node_modules/axios/lib/helpers/sanitizeHeaderValue.js
|
|
523
|
+
function trimSPorHTAB(str) {
|
|
524
|
+
let start = 0;
|
|
525
|
+
let end = str.length;
|
|
526
|
+
while (start < end) {
|
|
527
|
+
const code = str.charCodeAt(start);
|
|
528
|
+
if (code !== 9 && code !== 32) {
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
start += 1;
|
|
532
|
+
}
|
|
533
|
+
while (end > start) {
|
|
534
|
+
const code = str.charCodeAt(end - 1);
|
|
535
|
+
if (code !== 9 && code !== 32) {
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
end -= 1;
|
|
539
|
+
}
|
|
540
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
541
|
+
}
|
|
542
|
+
var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
|
|
543
|
+
var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
|
|
544
|
+
function sanitizeValue(value, invalidChars) {
|
|
545
|
+
if (utils_default.isArray(value)) {
|
|
546
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
547
|
+
}
|
|
548
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ""));
|
|
549
|
+
}
|
|
550
|
+
var sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
551
|
+
var sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
552
|
+
function toByteStringHeaderObject(headers) {
|
|
553
|
+
const byteStringHeaders = /* @__PURE__ */ Object.create(null);
|
|
554
|
+
utils_default.forEach(headers.toJSON(), (value, header) => {
|
|
555
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
556
|
+
});
|
|
557
|
+
return byteStringHeaders;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// node_modules/axios/lib/core/AxiosHeaders.js
|
|
561
|
+
var $internals = /* @__PURE__ */ Symbol("internals");
|
|
562
|
+
function normalizeHeader(header) {
|
|
563
|
+
return header && String(header).trim().toLowerCase();
|
|
564
|
+
}
|
|
565
|
+
function normalizeValue(value) {
|
|
566
|
+
if (value === false || value == null) {
|
|
567
|
+
return value;
|
|
568
|
+
}
|
|
569
|
+
return utils_default.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
570
|
+
}
|
|
571
|
+
function parseTokens(str) {
|
|
572
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
573
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
574
|
+
let match;
|
|
575
|
+
while (match = tokensRE.exec(str)) {
|
|
576
|
+
tokens[match[1]] = match[2];
|
|
577
|
+
}
|
|
578
|
+
return tokens;
|
|
579
|
+
}
|
|
580
|
+
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
581
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
582
|
+
if (utils_default.isFunction(filter2)) {
|
|
583
|
+
return filter2.call(this, value, header);
|
|
584
|
+
}
|
|
585
|
+
if (isHeaderNameFilter) {
|
|
586
|
+
value = header;
|
|
587
|
+
}
|
|
588
|
+
if (!utils_default.isString(value)) return;
|
|
589
|
+
if (utils_default.isString(filter2)) {
|
|
590
|
+
return value.indexOf(filter2) !== -1;
|
|
591
|
+
}
|
|
592
|
+
if (utils_default.isRegExp(filter2)) {
|
|
593
|
+
return filter2.test(value);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
function formatHeader(header) {
|
|
597
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
598
|
+
return char.toUpperCase() + str;
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function buildAccessors(obj, header) {
|
|
602
|
+
const accessorName = utils_default.toCamelCase(" " + header);
|
|
603
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
604
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
605
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
606
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
607
|
+
__proto__: null,
|
|
608
|
+
value: function(arg1, arg2, arg3) {
|
|
609
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
610
|
+
},
|
|
611
|
+
configurable: true
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
var AxiosHeaders = class {
|
|
616
|
+
constructor(headers) {
|
|
617
|
+
headers && this.set(headers);
|
|
618
|
+
}
|
|
619
|
+
set(header, valueOrRewrite, rewrite) {
|
|
620
|
+
const self2 = this;
|
|
621
|
+
function setHeader(_value, _header, _rewrite) {
|
|
622
|
+
const lHeader = normalizeHeader(_header);
|
|
623
|
+
if (!lHeader) {
|
|
624
|
+
throw new Error("header name must be a non-empty string");
|
|
625
|
+
}
|
|
626
|
+
const key = utils_default.findKey(self2, lHeader);
|
|
627
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
628
|
+
self2[key || _header] = normalizeValue(_value);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
632
|
+
if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
|
|
633
|
+
setHeaders(header, valueOrRewrite);
|
|
634
|
+
} else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
635
|
+
setHeaders(parseHeaders_default(header), valueOrRewrite);
|
|
636
|
+
} else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
|
|
637
|
+
let obj = {}, dest, key;
|
|
638
|
+
for (const entry of header) {
|
|
639
|
+
if (!utils_default.isArray(entry)) {
|
|
640
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
641
|
+
}
|
|
642
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
643
|
+
}
|
|
644
|
+
setHeaders(obj, valueOrRewrite);
|
|
645
|
+
} else {
|
|
646
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
647
|
+
}
|
|
648
|
+
return this;
|
|
649
|
+
}
|
|
650
|
+
get(header, parser) {
|
|
651
|
+
header = normalizeHeader(header);
|
|
652
|
+
if (header) {
|
|
653
|
+
const key = utils_default.findKey(this, header);
|
|
654
|
+
if (key) {
|
|
655
|
+
const value = this[key];
|
|
656
|
+
if (!parser) {
|
|
657
|
+
return value;
|
|
658
|
+
}
|
|
659
|
+
if (parser === true) {
|
|
660
|
+
return parseTokens(value);
|
|
661
|
+
}
|
|
662
|
+
if (utils_default.isFunction(parser)) {
|
|
663
|
+
return parser.call(this, value, key);
|
|
664
|
+
}
|
|
665
|
+
if (utils_default.isRegExp(parser)) {
|
|
666
|
+
return parser.exec(value);
|
|
667
|
+
}
|
|
668
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
has(header, matcher) {
|
|
673
|
+
header = normalizeHeader(header);
|
|
674
|
+
if (header) {
|
|
675
|
+
const key = utils_default.findKey(this, header);
|
|
676
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
677
|
+
}
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
delete(header, matcher) {
|
|
681
|
+
const self2 = this;
|
|
682
|
+
let deleted = false;
|
|
683
|
+
function deleteHeader(_header) {
|
|
684
|
+
_header = normalizeHeader(_header);
|
|
685
|
+
if (_header) {
|
|
686
|
+
const key = utils_default.findKey(self2, _header);
|
|
687
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
688
|
+
delete self2[key];
|
|
689
|
+
deleted = true;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (utils_default.isArray(header)) {
|
|
694
|
+
header.forEach(deleteHeader);
|
|
695
|
+
} else {
|
|
696
|
+
deleteHeader(header);
|
|
697
|
+
}
|
|
698
|
+
return deleted;
|
|
699
|
+
}
|
|
700
|
+
clear(matcher) {
|
|
701
|
+
const keys = Object.keys(this);
|
|
702
|
+
let i = keys.length;
|
|
703
|
+
let deleted = false;
|
|
704
|
+
while (i--) {
|
|
705
|
+
const key = keys[i];
|
|
706
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
707
|
+
delete this[key];
|
|
708
|
+
deleted = true;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return deleted;
|
|
712
|
+
}
|
|
713
|
+
normalize(format) {
|
|
714
|
+
const self2 = this;
|
|
715
|
+
const headers = {};
|
|
716
|
+
utils_default.forEach(this, (value, header) => {
|
|
717
|
+
const key = utils_default.findKey(headers, header);
|
|
718
|
+
if (key) {
|
|
719
|
+
self2[key] = normalizeValue(value);
|
|
720
|
+
delete self2[header];
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
724
|
+
if (normalized !== header) {
|
|
725
|
+
delete self2[header];
|
|
726
|
+
}
|
|
727
|
+
self2[normalized] = normalizeValue(value);
|
|
728
|
+
headers[normalized] = true;
|
|
729
|
+
});
|
|
730
|
+
return this;
|
|
731
|
+
}
|
|
732
|
+
concat(...targets) {
|
|
733
|
+
return this.constructor.concat(this, ...targets);
|
|
734
|
+
}
|
|
735
|
+
toJSON(asStrings) {
|
|
736
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
737
|
+
utils_default.forEach(this, (value, header) => {
|
|
738
|
+
value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
|
|
739
|
+
});
|
|
740
|
+
return obj;
|
|
741
|
+
}
|
|
742
|
+
[Symbol.iterator]() {
|
|
743
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
744
|
+
}
|
|
745
|
+
toString() {
|
|
746
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
747
|
+
}
|
|
748
|
+
getSetCookie() {
|
|
749
|
+
return this.get("set-cookie") || [];
|
|
750
|
+
}
|
|
751
|
+
get [Symbol.toStringTag]() {
|
|
752
|
+
return "AxiosHeaders";
|
|
753
|
+
}
|
|
754
|
+
static from(thing) {
|
|
755
|
+
return thing instanceof this ? thing : new this(thing);
|
|
756
|
+
}
|
|
757
|
+
static concat(first, ...targets) {
|
|
758
|
+
const computed = new this(first);
|
|
759
|
+
targets.forEach((target) => computed.set(target));
|
|
760
|
+
return computed;
|
|
761
|
+
}
|
|
762
|
+
static accessor(header) {
|
|
763
|
+
const internals = this[$internals] = this[$internals] = {
|
|
764
|
+
accessors: {}
|
|
765
|
+
};
|
|
766
|
+
const accessors = internals.accessors;
|
|
767
|
+
const prototype2 = this.prototype;
|
|
768
|
+
function defineAccessor(_header) {
|
|
769
|
+
const lHeader = normalizeHeader(_header);
|
|
770
|
+
if (!accessors[lHeader]) {
|
|
771
|
+
buildAccessors(prototype2, _header);
|
|
772
|
+
accessors[lHeader] = true;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
776
|
+
return this;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
AxiosHeaders.accessor([
|
|
780
|
+
"Content-Type",
|
|
781
|
+
"Content-Length",
|
|
782
|
+
"Accept",
|
|
783
|
+
"Accept-Encoding",
|
|
784
|
+
"User-Agent",
|
|
785
|
+
"Authorization"
|
|
786
|
+
]);
|
|
787
|
+
utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
788
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
789
|
+
return {
|
|
790
|
+
get: () => value,
|
|
791
|
+
set(headerValue) {
|
|
792
|
+
this[mapped] = headerValue;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
});
|
|
796
|
+
utils_default.freezeMethods(AxiosHeaders);
|
|
797
|
+
var AxiosHeaders_default = AxiosHeaders;
|
|
798
|
+
|
|
799
|
+
// node_modules/axios/lib/core/AxiosError.js
|
|
800
|
+
var REDACTED = "[REDACTED ****]";
|
|
801
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
802
|
+
if (utils_default.hasOwnProp(source, "toJSON")) {
|
|
803
|
+
return true;
|
|
804
|
+
}
|
|
805
|
+
let prototype2 = Object.getPrototypeOf(source);
|
|
806
|
+
while (prototype2 && prototype2 !== Object.prototype) {
|
|
807
|
+
if (utils_default.hasOwnProp(prototype2, "toJSON")) {
|
|
808
|
+
return true;
|
|
809
|
+
}
|
|
810
|
+
prototype2 = Object.getPrototypeOf(prototype2);
|
|
811
|
+
}
|
|
812
|
+
return false;
|
|
813
|
+
}
|
|
814
|
+
function redactConfig(config, redactKeys) {
|
|
815
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
816
|
+
const seen = [];
|
|
817
|
+
const visit = (source) => {
|
|
818
|
+
if (source === null || typeof source !== "object") return source;
|
|
819
|
+
if (utils_default.isBuffer(source)) return source;
|
|
820
|
+
if (seen.indexOf(source) !== -1) return void 0;
|
|
821
|
+
if (source instanceof AxiosHeaders_default) {
|
|
822
|
+
source = source.toJSON();
|
|
823
|
+
}
|
|
824
|
+
seen.push(source);
|
|
825
|
+
let result;
|
|
826
|
+
if (utils_default.isArray(source)) {
|
|
827
|
+
result = [];
|
|
828
|
+
source.forEach((v, i) => {
|
|
829
|
+
const reducedValue = visit(v);
|
|
830
|
+
if (!utils_default.isUndefined(reducedValue)) {
|
|
831
|
+
result[i] = reducedValue;
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
} else {
|
|
835
|
+
if (!utils_default.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
836
|
+
seen.pop();
|
|
837
|
+
return source;
|
|
838
|
+
}
|
|
839
|
+
result = /* @__PURE__ */ Object.create(null);
|
|
840
|
+
for (const [key, value] of Object.entries(source)) {
|
|
841
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
842
|
+
if (!utils_default.isUndefined(reducedValue)) {
|
|
843
|
+
result[key] = reducedValue;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
seen.pop();
|
|
848
|
+
return result;
|
|
849
|
+
};
|
|
850
|
+
return visit(config);
|
|
851
|
+
}
|
|
852
|
+
var AxiosError = class _AxiosError extends Error {
|
|
853
|
+
static from(error, code, config, request, response, customProps) {
|
|
854
|
+
const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
|
|
855
|
+
axiosError.cause = error;
|
|
856
|
+
axiosError.name = error.name;
|
|
857
|
+
if (error.status != null && axiosError.status == null) {
|
|
858
|
+
axiosError.status = error.status;
|
|
859
|
+
}
|
|
860
|
+
customProps && Object.assign(axiosError, customProps);
|
|
861
|
+
return axiosError;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
865
|
+
*
|
|
866
|
+
* @param {string} message The error message.
|
|
867
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
868
|
+
* @param {Object} [config] The config.
|
|
869
|
+
* @param {Object} [request] The request.
|
|
870
|
+
* @param {Object} [response] The response.
|
|
871
|
+
*
|
|
872
|
+
* @returns {Error} The created error.
|
|
873
|
+
*/
|
|
874
|
+
constructor(message, code, config, request, response) {
|
|
875
|
+
super(message);
|
|
876
|
+
Object.defineProperty(this, "message", {
|
|
877
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
878
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
879
|
+
__proto__: null,
|
|
880
|
+
value: message,
|
|
881
|
+
enumerable: true,
|
|
882
|
+
writable: true,
|
|
883
|
+
configurable: true
|
|
884
|
+
});
|
|
885
|
+
this.name = "AxiosError";
|
|
886
|
+
this.isAxiosError = true;
|
|
887
|
+
code && (this.code = code);
|
|
888
|
+
config && (this.config = config);
|
|
889
|
+
request && (this.request = request);
|
|
890
|
+
if (response) {
|
|
891
|
+
this.response = response;
|
|
892
|
+
this.status = response.status;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
toJSON() {
|
|
896
|
+
const config = this.config;
|
|
897
|
+
const redactKeys = config && utils_default.hasOwnProp(config, "redact") ? config.redact : void 0;
|
|
898
|
+
const serializedConfig = utils_default.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils_default.toJSONObject(config);
|
|
899
|
+
return {
|
|
900
|
+
// Standard
|
|
901
|
+
message: this.message,
|
|
902
|
+
name: this.name,
|
|
903
|
+
// Microsoft
|
|
904
|
+
description: this.description,
|
|
905
|
+
number: this.number,
|
|
906
|
+
// Mozilla
|
|
907
|
+
fileName: this.fileName,
|
|
908
|
+
lineNumber: this.lineNumber,
|
|
909
|
+
columnNumber: this.columnNumber,
|
|
910
|
+
stack: this.stack,
|
|
911
|
+
// Axios
|
|
912
|
+
config: serializedConfig,
|
|
913
|
+
code: this.code,
|
|
914
|
+
status: this.status
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
|
919
|
+
AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
|
920
|
+
AxiosError.ECONNABORTED = "ECONNABORTED";
|
|
921
|
+
AxiosError.ETIMEDOUT = "ETIMEDOUT";
|
|
922
|
+
AxiosError.ECONNREFUSED = "ECONNREFUSED";
|
|
923
|
+
AxiosError.ERR_NETWORK = "ERR_NETWORK";
|
|
924
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
|
925
|
+
AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
|
|
926
|
+
AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
|
927
|
+
AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
928
|
+
AxiosError.ERR_CANCELED = "ERR_CANCELED";
|
|
929
|
+
AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
930
|
+
AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
931
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
|
|
932
|
+
var AxiosError_default = AxiosError;
|
|
933
|
+
|
|
934
|
+
// node_modules/axios/lib/helpers/null.js
|
|
935
|
+
var null_default = null;
|
|
936
|
+
|
|
937
|
+
// node_modules/axios/lib/helpers/toFormData.js
|
|
938
|
+
function isVisitable(thing) {
|
|
939
|
+
return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
|
|
940
|
+
}
|
|
941
|
+
function removeBrackets(key) {
|
|
942
|
+
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
943
|
+
}
|
|
944
|
+
function renderKey(path, key, dots) {
|
|
945
|
+
if (!path) return key;
|
|
946
|
+
return path.concat(key).map(function each(token, i) {
|
|
947
|
+
token = removeBrackets(token);
|
|
948
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
949
|
+
}).join(dots ? "." : "");
|
|
950
|
+
}
|
|
951
|
+
function isFlatArray(arr) {
|
|
952
|
+
return utils_default.isArray(arr) && !arr.some(isVisitable);
|
|
953
|
+
}
|
|
954
|
+
var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) {
|
|
955
|
+
return /^is[A-Z]/.test(prop);
|
|
956
|
+
});
|
|
957
|
+
function toFormData(obj, formData, options) {
|
|
958
|
+
if (!utils_default.isObject(obj)) {
|
|
959
|
+
throw new TypeError("target must be an object");
|
|
960
|
+
}
|
|
961
|
+
formData = formData || new (null_default || FormData)();
|
|
962
|
+
options = utils_default.toFlatObject(
|
|
963
|
+
options,
|
|
964
|
+
{
|
|
965
|
+
metaTokens: true,
|
|
966
|
+
dots: false,
|
|
967
|
+
indexes: false
|
|
968
|
+
},
|
|
969
|
+
false,
|
|
970
|
+
function defined(option, source) {
|
|
971
|
+
return !utils_default.isUndefined(source[option]);
|
|
972
|
+
}
|
|
973
|
+
);
|
|
974
|
+
const metaTokens = options.metaTokens;
|
|
975
|
+
const visitor = options.visitor || defaultVisitor;
|
|
976
|
+
const dots = options.dots;
|
|
977
|
+
const indexes = options.indexes;
|
|
978
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
979
|
+
const maxDepth = options.maxDepth === void 0 ? 100 : options.maxDepth;
|
|
980
|
+
const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
|
|
981
|
+
if (!utils_default.isFunction(visitor)) {
|
|
982
|
+
throw new TypeError("visitor must be a function");
|
|
983
|
+
}
|
|
984
|
+
function convertValue(value) {
|
|
985
|
+
if (value === null) return "";
|
|
986
|
+
if (utils_default.isDate(value)) {
|
|
987
|
+
return value.toISOString();
|
|
988
|
+
}
|
|
989
|
+
if (utils_default.isBoolean(value)) {
|
|
990
|
+
return value.toString();
|
|
991
|
+
}
|
|
992
|
+
if (!useBlob && utils_default.isBlob(value)) {
|
|
993
|
+
throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
|
|
994
|
+
}
|
|
995
|
+
if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
|
|
996
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
997
|
+
}
|
|
998
|
+
return value;
|
|
999
|
+
}
|
|
1000
|
+
function defaultVisitor(value, key, path) {
|
|
1001
|
+
let arr = value;
|
|
1002
|
+
if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
|
|
1003
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
if (value && !path && typeof value === "object") {
|
|
1007
|
+
if (utils_default.endsWith(key, "{}")) {
|
|
1008
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1009
|
+
value = JSON.stringify(value);
|
|
1010
|
+
} else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
|
|
1011
|
+
key = removeBrackets(key);
|
|
1012
|
+
arr.forEach(function each(el, index) {
|
|
1013
|
+
!(utils_default.isUndefined(el) || el === null) && formData.append(
|
|
1014
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1015
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
1016
|
+
convertValue(el)
|
|
1017
|
+
);
|
|
1018
|
+
});
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
if (isVisitable(value)) {
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
const stack = [];
|
|
1029
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
1030
|
+
defaultVisitor,
|
|
1031
|
+
convertValue,
|
|
1032
|
+
isVisitable
|
|
1033
|
+
});
|
|
1034
|
+
function build(value, path, depth = 0) {
|
|
1035
|
+
if (utils_default.isUndefined(value)) return;
|
|
1036
|
+
if (depth > maxDepth) {
|
|
1037
|
+
throw new AxiosError_default(
|
|
1038
|
+
"Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
|
|
1039
|
+
AxiosError_default.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
if (stack.indexOf(value) !== -1) {
|
|
1043
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
1044
|
+
}
|
|
1045
|
+
stack.push(value);
|
|
1046
|
+
utils_default.forEach(value, function each(el, key) {
|
|
1047
|
+
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1048
|
+
if (result === true) {
|
|
1049
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
stack.pop();
|
|
1053
|
+
}
|
|
1054
|
+
if (!utils_default.isObject(obj)) {
|
|
1055
|
+
throw new TypeError("data must be an object");
|
|
1056
|
+
}
|
|
1057
|
+
build(obj);
|
|
1058
|
+
return formData;
|
|
1059
|
+
}
|
|
1060
|
+
var toFormData_default = toFormData;
|
|
1061
|
+
|
|
1062
|
+
// node_modules/axios/lib/helpers/AxiosURLSearchParams.js
|
|
1063
|
+
function encode(str) {
|
|
1064
|
+
const charMap = {
|
|
1065
|
+
"!": "%21",
|
|
1066
|
+
"'": "%27",
|
|
1067
|
+
"(": "%28",
|
|
1068
|
+
")": "%29",
|
|
1069
|
+
"~": "%7E",
|
|
1070
|
+
"%20": "+"
|
|
1071
|
+
};
|
|
1072
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
1073
|
+
return charMap[match];
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
function AxiosURLSearchParams(params, options) {
|
|
1077
|
+
this._pairs = [];
|
|
1078
|
+
params && toFormData_default(params, this, options);
|
|
1079
|
+
}
|
|
1080
|
+
var prototype = AxiosURLSearchParams.prototype;
|
|
1081
|
+
prototype.append = function append(name, value) {
|
|
1082
|
+
this._pairs.push([name, value]);
|
|
1083
|
+
};
|
|
1084
|
+
prototype.toString = function toString2(encoder) {
|
|
1085
|
+
const _encode = encoder ? function(value) {
|
|
1086
|
+
return encoder.call(this, value, encode);
|
|
1087
|
+
} : encode;
|
|
1088
|
+
return this._pairs.map(function each(pair) {
|
|
1089
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
1090
|
+
}, "").join("&");
|
|
1091
|
+
};
|
|
1092
|
+
var AxiosURLSearchParams_default = AxiosURLSearchParams;
|
|
1093
|
+
|
|
1094
|
+
// node_modules/axios/lib/helpers/buildURL.js
|
|
1095
|
+
function encode2(val) {
|
|
1096
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
1097
|
+
}
|
|
1098
|
+
function buildURL(url, params, options) {
|
|
1099
|
+
if (!params) {
|
|
1100
|
+
return url;
|
|
1101
|
+
}
|
|
1102
|
+
const _encode = options && options.encode || encode2;
|
|
1103
|
+
const _options = utils_default.isFunction(options) ? {
|
|
1104
|
+
serialize: options
|
|
1105
|
+
} : options;
|
|
1106
|
+
const serializeFn = _options && _options.serialize;
|
|
1107
|
+
let serializedParams;
|
|
1108
|
+
if (serializeFn) {
|
|
1109
|
+
serializedParams = serializeFn(params, _options);
|
|
1110
|
+
} else {
|
|
1111
|
+
serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options).toString(_encode);
|
|
1112
|
+
}
|
|
1113
|
+
if (serializedParams) {
|
|
1114
|
+
const hashmarkIndex = url.indexOf("#");
|
|
1115
|
+
if (hashmarkIndex !== -1) {
|
|
1116
|
+
url = url.slice(0, hashmarkIndex);
|
|
1117
|
+
}
|
|
1118
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
1119
|
+
}
|
|
1120
|
+
return url;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// node_modules/axios/lib/core/InterceptorManager.js
|
|
1124
|
+
var InterceptorManager = class {
|
|
1125
|
+
constructor() {
|
|
1126
|
+
this.handlers = [];
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Add a new interceptor to the stack
|
|
1130
|
+
*
|
|
1131
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1132
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1133
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1134
|
+
*
|
|
1135
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1136
|
+
*/
|
|
1137
|
+
use(fulfilled, rejected, options) {
|
|
1138
|
+
this.handlers.push({
|
|
1139
|
+
fulfilled,
|
|
1140
|
+
rejected,
|
|
1141
|
+
synchronous: options ? options.synchronous : false,
|
|
1142
|
+
runWhen: options ? options.runWhen : null
|
|
1143
|
+
});
|
|
1144
|
+
return this.handlers.length - 1;
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Remove an interceptor from the stack
|
|
1148
|
+
*
|
|
1149
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1150
|
+
*
|
|
1151
|
+
* @returns {void}
|
|
1152
|
+
*/
|
|
1153
|
+
eject(id) {
|
|
1154
|
+
if (this.handlers[id]) {
|
|
1155
|
+
this.handlers[id] = null;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Clear all interceptors from the stack
|
|
1160
|
+
*
|
|
1161
|
+
* @returns {void}
|
|
1162
|
+
*/
|
|
1163
|
+
clear() {
|
|
1164
|
+
if (this.handlers) {
|
|
1165
|
+
this.handlers = [];
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Iterate over all the registered interceptors
|
|
1170
|
+
*
|
|
1171
|
+
* This method is particularly useful for skipping over any
|
|
1172
|
+
* interceptors that may have become `null` calling `eject`.
|
|
1173
|
+
*
|
|
1174
|
+
* @param {Function} fn The function to call for each interceptor
|
|
1175
|
+
*
|
|
1176
|
+
* @returns {void}
|
|
1177
|
+
*/
|
|
1178
|
+
forEach(fn) {
|
|
1179
|
+
utils_default.forEach(this.handlers, function forEachHandler(h) {
|
|
1180
|
+
if (h !== null) {
|
|
1181
|
+
fn(h);
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
var InterceptorManager_default = InterceptorManager;
|
|
1187
|
+
|
|
1188
|
+
// node_modules/axios/lib/defaults/transitional.js
|
|
1189
|
+
var transitional_default = {
|
|
1190
|
+
silentJSONParsing: true,
|
|
1191
|
+
forcedJSONParsing: true,
|
|
1192
|
+
clarifyTimeoutError: false,
|
|
1193
|
+
legacyInterceptorReqResOrdering: true
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
// node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
|
|
1197
|
+
var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default;
|
|
1198
|
+
|
|
1199
|
+
// node_modules/axios/lib/platform/browser/classes/FormData.js
|
|
1200
|
+
var FormData_default = typeof FormData !== "undefined" ? FormData : null;
|
|
1201
|
+
|
|
1202
|
+
// node_modules/axios/lib/platform/browser/classes/Blob.js
|
|
1203
|
+
var Blob_default = typeof Blob !== "undefined" ? Blob : null;
|
|
1204
|
+
|
|
1205
|
+
// node_modules/axios/lib/platform/browser/index.js
|
|
1206
|
+
var browser_default = {
|
|
1207
|
+
isBrowser: true,
|
|
1208
|
+
classes: {
|
|
1209
|
+
URLSearchParams: URLSearchParams_default,
|
|
1210
|
+
FormData: FormData_default,
|
|
1211
|
+
Blob: Blob_default
|
|
1212
|
+
},
|
|
1213
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
// node_modules/axios/lib/platform/common/utils.js
|
|
1217
|
+
var utils_exports = {};
|
|
1218
|
+
__export(utils_exports, {
|
|
1219
|
+
hasBrowserEnv: () => hasBrowserEnv,
|
|
1220
|
+
hasStandardBrowserEnv: () => hasStandardBrowserEnv,
|
|
1221
|
+
hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
|
|
1222
|
+
navigator: () => _navigator,
|
|
1223
|
+
origin: () => origin
|
|
1224
|
+
});
|
|
1225
|
+
var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
1226
|
+
var _navigator = typeof navigator === "object" && navigator || void 0;
|
|
1227
|
+
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
1228
|
+
var hasStandardBrowserWebWorkerEnv = (() => {
|
|
1229
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
1230
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
1231
|
+
})();
|
|
1232
|
+
var origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
1233
|
+
|
|
1234
|
+
// node_modules/axios/lib/platform/index.js
|
|
1235
|
+
var platform_default = {
|
|
1236
|
+
...utils_exports,
|
|
1237
|
+
...browser_default
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
// node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
1241
|
+
function toURLEncodedForm(data, options) {
|
|
1242
|
+
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
|
|
1243
|
+
visitor: function(value, key, path, helpers) {
|
|
1244
|
+
if (platform_default.isNode && utils_default.isBuffer(value)) {
|
|
1245
|
+
this.append(key, value.toString("base64"));
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
1249
|
+
},
|
|
1250
|
+
...options
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// node_modules/axios/lib/helpers/formDataToJSON.js
|
|
1255
|
+
function parsePropPath(name) {
|
|
1256
|
+
return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1257
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
function arrayToObject(arr) {
|
|
1261
|
+
const obj = {};
|
|
1262
|
+
const keys = Object.keys(arr);
|
|
1263
|
+
let i;
|
|
1264
|
+
const len = keys.length;
|
|
1265
|
+
let key;
|
|
1266
|
+
for (i = 0; i < len; i++) {
|
|
1267
|
+
key = keys[i];
|
|
1268
|
+
obj[key] = arr[key];
|
|
1269
|
+
}
|
|
1270
|
+
return obj;
|
|
1271
|
+
}
|
|
1272
|
+
function formDataToJSON(formData) {
|
|
1273
|
+
function buildPath(path, value, target, index) {
|
|
1274
|
+
let name = path[index++];
|
|
1275
|
+
if (name === "__proto__") return true;
|
|
1276
|
+
const isNumericKey = Number.isFinite(+name);
|
|
1277
|
+
const isLast = index >= path.length;
|
|
1278
|
+
name = !name && utils_default.isArray(target) ? target.length : name;
|
|
1279
|
+
if (isLast) {
|
|
1280
|
+
if (utils_default.hasOwnProp(target, name)) {
|
|
1281
|
+
target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
|
|
1282
|
+
} else {
|
|
1283
|
+
target[name] = value;
|
|
1284
|
+
}
|
|
1285
|
+
return !isNumericKey;
|
|
1286
|
+
}
|
|
1287
|
+
if (!utils_default.hasOwnProp(target, name) || !utils_default.isObject(target[name])) {
|
|
1288
|
+
target[name] = [];
|
|
1289
|
+
}
|
|
1290
|
+
const result = buildPath(path, value, target[name], index);
|
|
1291
|
+
if (result && utils_default.isArray(target[name])) {
|
|
1292
|
+
target[name] = arrayToObject(target[name]);
|
|
1293
|
+
}
|
|
1294
|
+
return !isNumericKey;
|
|
1295
|
+
}
|
|
1296
|
+
if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
|
|
1297
|
+
const obj = {};
|
|
1298
|
+
utils_default.forEachEntry(formData, (name, value) => {
|
|
1299
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
1300
|
+
});
|
|
1301
|
+
return obj;
|
|
1302
|
+
}
|
|
1303
|
+
return null;
|
|
1304
|
+
}
|
|
1305
|
+
var formDataToJSON_default = formDataToJSON;
|
|
1306
|
+
|
|
1307
|
+
// node_modules/axios/lib/defaults/index.js
|
|
1308
|
+
var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
|
|
1309
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
1310
|
+
if (utils_default.isString(rawValue)) {
|
|
1311
|
+
try {
|
|
1312
|
+
(parser || JSON.parse)(rawValue);
|
|
1313
|
+
return utils_default.trim(rawValue);
|
|
1314
|
+
} catch (e) {
|
|
1315
|
+
if (e.name !== "SyntaxError") {
|
|
1316
|
+
throw e;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
1321
|
+
}
|
|
1322
|
+
var defaults = {
|
|
1323
|
+
transitional: transitional_default,
|
|
1324
|
+
adapter: ["xhr", "http", "fetch"],
|
|
1325
|
+
transformRequest: [
|
|
1326
|
+
function transformRequest(data, headers) {
|
|
1327
|
+
const contentType = headers.getContentType() || "";
|
|
1328
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
1329
|
+
const isObjectPayload = utils_default.isObject(data);
|
|
1330
|
+
if (isObjectPayload && utils_default.isHTMLForm(data)) {
|
|
1331
|
+
data = new FormData(data);
|
|
1332
|
+
}
|
|
1333
|
+
const isFormData2 = utils_default.isFormData(data);
|
|
1334
|
+
if (isFormData2) {
|
|
1335
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
|
|
1336
|
+
}
|
|
1337
|
+
if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
|
|
1338
|
+
return data;
|
|
1339
|
+
}
|
|
1340
|
+
if (utils_default.isArrayBufferView(data)) {
|
|
1341
|
+
return data.buffer;
|
|
1342
|
+
}
|
|
1343
|
+
if (utils_default.isURLSearchParams(data)) {
|
|
1344
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
1345
|
+
return data.toString();
|
|
1346
|
+
}
|
|
1347
|
+
let isFileList2;
|
|
1348
|
+
if (isObjectPayload) {
|
|
1349
|
+
const formSerializer = own(this, "formSerializer");
|
|
1350
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
1351
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
1352
|
+
}
|
|
1353
|
+
if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
1354
|
+
const env = own(this, "env");
|
|
1355
|
+
const _FormData = env && env.FormData;
|
|
1356
|
+
return toFormData_default(
|
|
1357
|
+
isFileList2 ? { "files[]": data } : data,
|
|
1358
|
+
_FormData && new _FormData(),
|
|
1359
|
+
formSerializer
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
1364
|
+
headers.setContentType("application/json", false);
|
|
1365
|
+
return stringifySafely(data);
|
|
1366
|
+
}
|
|
1367
|
+
return data;
|
|
1368
|
+
}
|
|
1369
|
+
],
|
|
1370
|
+
transformResponse: [
|
|
1371
|
+
function transformResponse(data) {
|
|
1372
|
+
const transitional2 = own(this, "transitional") || defaults.transitional;
|
|
1373
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
1374
|
+
const responseType = own(this, "responseType");
|
|
1375
|
+
const JSONRequested = responseType === "json";
|
|
1376
|
+
if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
|
|
1377
|
+
return data;
|
|
1378
|
+
}
|
|
1379
|
+
if (data && utils_default.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
|
|
1380
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
1381
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1382
|
+
try {
|
|
1383
|
+
return JSON.parse(data, own(this, "parseReviver"));
|
|
1384
|
+
} catch (e) {
|
|
1385
|
+
if (strictJSONParsing) {
|
|
1386
|
+
if (e.name === "SyntaxError") {
|
|
1387
|
+
throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, own(this, "response"));
|
|
1388
|
+
}
|
|
1389
|
+
throw e;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return data;
|
|
1394
|
+
}
|
|
1395
|
+
],
|
|
1396
|
+
/**
|
|
1397
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1398
|
+
* timeout is not created.
|
|
1399
|
+
*/
|
|
1400
|
+
timeout: 0,
|
|
1401
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
1402
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
1403
|
+
maxContentLength: -1,
|
|
1404
|
+
maxBodyLength: -1,
|
|
1405
|
+
env: {
|
|
1406
|
+
FormData: platform_default.classes.FormData,
|
|
1407
|
+
Blob: platform_default.classes.Blob
|
|
1408
|
+
},
|
|
1409
|
+
validateStatus: function validateStatus(status) {
|
|
1410
|
+
return status >= 200 && status < 300;
|
|
1411
|
+
},
|
|
1412
|
+
headers: {
|
|
1413
|
+
common: {
|
|
1414
|
+
Accept: "application/json, text/plain, */*",
|
|
1415
|
+
"Content-Type": void 0
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
|
|
1420
|
+
defaults.headers[method] = {};
|
|
1421
|
+
});
|
|
1422
|
+
var defaults_default = defaults;
|
|
1423
|
+
|
|
1424
|
+
// node_modules/axios/lib/core/transformData.js
|
|
1425
|
+
function transformData(fns, response) {
|
|
1426
|
+
const config = this || defaults_default;
|
|
1427
|
+
const context = response || config;
|
|
1428
|
+
const headers = AxiosHeaders_default.from(context.headers);
|
|
1429
|
+
let data = context.data;
|
|
1430
|
+
utils_default.forEach(fns, function transform(fn) {
|
|
1431
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
1432
|
+
});
|
|
1433
|
+
headers.normalize();
|
|
1434
|
+
return data;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
// node_modules/axios/lib/cancel/isCancel.js
|
|
1438
|
+
function isCancel(value) {
|
|
1439
|
+
return !!(value && value.__CANCEL__);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// node_modules/axios/lib/cancel/CanceledError.js
|
|
1443
|
+
var CanceledError = class extends AxiosError_default {
|
|
1444
|
+
/**
|
|
1445
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
1446
|
+
*
|
|
1447
|
+
* @param {string=} message The message.
|
|
1448
|
+
* @param {Object=} config The config.
|
|
1449
|
+
* @param {Object=} request The request.
|
|
1450
|
+
*
|
|
1451
|
+
* @returns {CanceledError} The created error.
|
|
1452
|
+
*/
|
|
1453
|
+
constructor(message, config, request) {
|
|
1454
|
+
super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
|
|
1455
|
+
this.name = "CanceledError";
|
|
1456
|
+
this.__CANCEL__ = true;
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
var CanceledError_default = CanceledError;
|
|
1460
|
+
|
|
1461
|
+
// node_modules/axios/lib/core/settle.js
|
|
1462
|
+
function settle(resolve, reject, response) {
|
|
1463
|
+
const validateStatus2 = response.config.validateStatus;
|
|
1464
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
1465
|
+
resolve(response);
|
|
1466
|
+
} else {
|
|
1467
|
+
reject(new AxiosError_default(
|
|
1468
|
+
"Request failed with status code " + response.status,
|
|
1469
|
+
response.status >= 400 && response.status < 500 ? AxiosError_default.ERR_BAD_REQUEST : AxiosError_default.ERR_BAD_RESPONSE,
|
|
1470
|
+
response.config,
|
|
1471
|
+
response.request,
|
|
1472
|
+
response
|
|
1473
|
+
));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// node_modules/axios/lib/helpers/parseProtocol.js
|
|
1478
|
+
function parseProtocol(url) {
|
|
1479
|
+
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
1480
|
+
return match && match[1] || "";
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// node_modules/axios/lib/helpers/speedometer.js
|
|
1484
|
+
function speedometer(samplesCount, min) {
|
|
1485
|
+
samplesCount = samplesCount || 10;
|
|
1486
|
+
const bytes = new Array(samplesCount);
|
|
1487
|
+
const timestamps = new Array(samplesCount);
|
|
1488
|
+
let head = 0;
|
|
1489
|
+
let tail = 0;
|
|
1490
|
+
let firstSampleTS;
|
|
1491
|
+
min = min !== void 0 ? min : 1e3;
|
|
1492
|
+
return function push(chunkLength) {
|
|
1493
|
+
const now = Date.now();
|
|
1494
|
+
const startedAt = timestamps[tail];
|
|
1495
|
+
if (!firstSampleTS) {
|
|
1496
|
+
firstSampleTS = now;
|
|
1497
|
+
}
|
|
1498
|
+
bytes[head] = chunkLength;
|
|
1499
|
+
timestamps[head] = now;
|
|
1500
|
+
let i = tail;
|
|
1501
|
+
let bytesCount = 0;
|
|
1502
|
+
while (i !== head) {
|
|
1503
|
+
bytesCount += bytes[i++];
|
|
1504
|
+
i = i % samplesCount;
|
|
1505
|
+
}
|
|
1506
|
+
head = (head + 1) % samplesCount;
|
|
1507
|
+
if (head === tail) {
|
|
1508
|
+
tail = (tail + 1) % samplesCount;
|
|
1509
|
+
}
|
|
1510
|
+
if (now - firstSampleTS < min) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const passed = startedAt && now - startedAt;
|
|
1514
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
var speedometer_default = speedometer;
|
|
1518
|
+
|
|
1519
|
+
// node_modules/axios/lib/helpers/throttle.js
|
|
1520
|
+
function throttle(fn, freq) {
|
|
1521
|
+
let timestamp = 0;
|
|
1522
|
+
let threshold = 1e3 / freq;
|
|
1523
|
+
let lastArgs;
|
|
1524
|
+
let timer;
|
|
1525
|
+
const invoke = (args, now = Date.now()) => {
|
|
1526
|
+
timestamp = now;
|
|
1527
|
+
lastArgs = null;
|
|
1528
|
+
if (timer) {
|
|
1529
|
+
clearTimeout(timer);
|
|
1530
|
+
timer = null;
|
|
1531
|
+
}
|
|
1532
|
+
fn(...args);
|
|
1533
|
+
};
|
|
1534
|
+
const throttled = (...args) => {
|
|
1535
|
+
const now = Date.now();
|
|
1536
|
+
const passed = now - timestamp;
|
|
1537
|
+
if (passed >= threshold) {
|
|
1538
|
+
invoke(args, now);
|
|
1539
|
+
} else {
|
|
1540
|
+
lastArgs = args;
|
|
1541
|
+
if (!timer) {
|
|
1542
|
+
timer = setTimeout(() => {
|
|
1543
|
+
timer = null;
|
|
1544
|
+
invoke(lastArgs);
|
|
1545
|
+
}, threshold - passed);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
1550
|
+
return [throttled, flush];
|
|
1551
|
+
}
|
|
1552
|
+
var throttle_default = throttle;
|
|
1553
|
+
|
|
1554
|
+
// node_modules/axios/lib/helpers/progressEventReducer.js
|
|
1555
|
+
var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
1556
|
+
let bytesNotified = 0;
|
|
1557
|
+
const _speedometer = speedometer_default(50, 250);
|
|
1558
|
+
return throttle_default((e) => {
|
|
1559
|
+
if (!e || typeof e.loaded !== "number") {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
const rawLoaded = e.loaded;
|
|
1563
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
1564
|
+
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
1565
|
+
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
1566
|
+
const rate = _speedometer(progressBytes);
|
|
1567
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
1568
|
+
const data = {
|
|
1569
|
+
loaded,
|
|
1570
|
+
total,
|
|
1571
|
+
progress: total ? loaded / total : void 0,
|
|
1572
|
+
bytes: progressBytes,
|
|
1573
|
+
rate: rate ? rate : void 0,
|
|
1574
|
+
estimated: rate && total ? (total - loaded) / rate : void 0,
|
|
1575
|
+
event: e,
|
|
1576
|
+
lengthComputable: total != null,
|
|
1577
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
1578
|
+
};
|
|
1579
|
+
listener(data);
|
|
1580
|
+
}, freq);
|
|
1581
|
+
};
|
|
1582
|
+
var progressEventDecorator = (total, throttled) => {
|
|
1583
|
+
const lengthComputable = total != null;
|
|
1584
|
+
return [
|
|
1585
|
+
(loaded) => throttled[0]({
|
|
1586
|
+
lengthComputable,
|
|
1587
|
+
total,
|
|
1588
|
+
loaded
|
|
1589
|
+
}),
|
|
1590
|
+
throttled[1]
|
|
1591
|
+
];
|
|
1592
|
+
};
|
|
1593
|
+
var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
|
|
1594
|
+
|
|
1595
|
+
// node_modules/axios/lib/helpers/isURLSameOrigin.js
|
|
1596
|
+
var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
1597
|
+
url = new URL(url, platform_default.origin);
|
|
1598
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
1599
|
+
})(
|
|
1600
|
+
new URL(platform_default.origin),
|
|
1601
|
+
platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
|
|
1602
|
+
) : () => true;
|
|
1603
|
+
|
|
1604
|
+
// node_modules/axios/lib/helpers/cookies.js
|
|
1605
|
+
var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
1606
|
+
// Standard browser envs support document.cookie
|
|
1607
|
+
{
|
|
1608
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
1609
|
+
if (typeof document === "undefined") return;
|
|
1610
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
1611
|
+
if (utils_default.isNumber(expires)) {
|
|
1612
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
1613
|
+
}
|
|
1614
|
+
if (utils_default.isString(path)) {
|
|
1615
|
+
cookie.push(`path=${path}`);
|
|
1616
|
+
}
|
|
1617
|
+
if (utils_default.isString(domain)) {
|
|
1618
|
+
cookie.push(`domain=${domain}`);
|
|
1619
|
+
}
|
|
1620
|
+
if (secure === true) {
|
|
1621
|
+
cookie.push("secure");
|
|
1622
|
+
}
|
|
1623
|
+
if (utils_default.isString(sameSite)) {
|
|
1624
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
1625
|
+
}
|
|
1626
|
+
document.cookie = cookie.join("; ");
|
|
1627
|
+
},
|
|
1628
|
+
read(name) {
|
|
1629
|
+
if (typeof document === "undefined") return null;
|
|
1630
|
+
const cookies = document.cookie.split(";");
|
|
1631
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
1632
|
+
const cookie = cookies[i].replace(/^\s+/, "");
|
|
1633
|
+
const eq = cookie.indexOf("=");
|
|
1634
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
1635
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
return null;
|
|
1639
|
+
},
|
|
1640
|
+
remove(name) {
|
|
1641
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
) : (
|
|
1645
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1646
|
+
{
|
|
1647
|
+
write() {
|
|
1648
|
+
},
|
|
1649
|
+
read() {
|
|
1650
|
+
return null;
|
|
1651
|
+
},
|
|
1652
|
+
remove() {
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
);
|
|
1656
|
+
|
|
1657
|
+
// node_modules/axios/lib/helpers/isAbsoluteURL.js
|
|
1658
|
+
function isAbsoluteURL(url) {
|
|
1659
|
+
if (typeof url !== "string") {
|
|
1660
|
+
return false;
|
|
1661
|
+
}
|
|
1662
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
// node_modules/axios/lib/helpers/combineURLs.js
|
|
1666
|
+
function combineURLs(baseURL, relativeURL) {
|
|
1667
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
// node_modules/axios/lib/core/buildFullPath.js
|
|
1671
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
1672
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
1673
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
1674
|
+
return combineURLs(baseURL, requestedURL);
|
|
1675
|
+
}
|
|
1676
|
+
return requestedURL;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// node_modules/axios/lib/core/mergeConfig.js
|
|
1680
|
+
var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
|
|
1681
|
+
function mergeConfig(config1, config2) {
|
|
1682
|
+
config2 = config2 || {};
|
|
1683
|
+
const config = /* @__PURE__ */ Object.create(null);
|
|
1684
|
+
Object.defineProperty(config, "hasOwnProperty", {
|
|
1685
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1686
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1687
|
+
__proto__: null,
|
|
1688
|
+
value: Object.prototype.hasOwnProperty,
|
|
1689
|
+
enumerable: false,
|
|
1690
|
+
writable: true,
|
|
1691
|
+
configurable: true
|
|
1692
|
+
});
|
|
1693
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
1694
|
+
if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
|
|
1695
|
+
return utils_default.merge.call({ caseless }, target, source);
|
|
1696
|
+
} else if (utils_default.isPlainObject(source)) {
|
|
1697
|
+
return utils_default.merge({}, source);
|
|
1698
|
+
} else if (utils_default.isArray(source)) {
|
|
1699
|
+
return source.slice();
|
|
1700
|
+
}
|
|
1701
|
+
return source;
|
|
1702
|
+
}
|
|
1703
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
1704
|
+
if (!utils_default.isUndefined(b)) {
|
|
1705
|
+
return getMergedValue(a, b, prop, caseless);
|
|
1706
|
+
} else if (!utils_default.isUndefined(a)) {
|
|
1707
|
+
return getMergedValue(void 0, a, prop, caseless);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
function valueFromConfig2(a, b) {
|
|
1711
|
+
if (!utils_default.isUndefined(b)) {
|
|
1712
|
+
return getMergedValue(void 0, b);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
function defaultToConfig2(a, b) {
|
|
1716
|
+
if (!utils_default.isUndefined(b)) {
|
|
1717
|
+
return getMergedValue(void 0, b);
|
|
1718
|
+
} else if (!utils_default.isUndefined(a)) {
|
|
1719
|
+
return getMergedValue(void 0, a);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1723
|
+
if (utils_default.hasOwnProp(config2, prop)) {
|
|
1724
|
+
return getMergedValue(a, b);
|
|
1725
|
+
} else if (utils_default.hasOwnProp(config1, prop)) {
|
|
1726
|
+
return getMergedValue(void 0, a);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
const mergeMap = {
|
|
1730
|
+
url: valueFromConfig2,
|
|
1731
|
+
method: valueFromConfig2,
|
|
1732
|
+
data: valueFromConfig2,
|
|
1733
|
+
baseURL: defaultToConfig2,
|
|
1734
|
+
transformRequest: defaultToConfig2,
|
|
1735
|
+
transformResponse: defaultToConfig2,
|
|
1736
|
+
paramsSerializer: defaultToConfig2,
|
|
1737
|
+
timeout: defaultToConfig2,
|
|
1738
|
+
timeoutMessage: defaultToConfig2,
|
|
1739
|
+
withCredentials: defaultToConfig2,
|
|
1740
|
+
withXSRFToken: defaultToConfig2,
|
|
1741
|
+
adapter: defaultToConfig2,
|
|
1742
|
+
responseType: defaultToConfig2,
|
|
1743
|
+
xsrfCookieName: defaultToConfig2,
|
|
1744
|
+
xsrfHeaderName: defaultToConfig2,
|
|
1745
|
+
onUploadProgress: defaultToConfig2,
|
|
1746
|
+
onDownloadProgress: defaultToConfig2,
|
|
1747
|
+
decompress: defaultToConfig2,
|
|
1748
|
+
maxContentLength: defaultToConfig2,
|
|
1749
|
+
maxBodyLength: defaultToConfig2,
|
|
1750
|
+
beforeRedirect: defaultToConfig2,
|
|
1751
|
+
transport: defaultToConfig2,
|
|
1752
|
+
httpAgent: defaultToConfig2,
|
|
1753
|
+
httpsAgent: defaultToConfig2,
|
|
1754
|
+
cancelToken: defaultToConfig2,
|
|
1755
|
+
socketPath: defaultToConfig2,
|
|
1756
|
+
allowedSocketPaths: defaultToConfig2,
|
|
1757
|
+
responseEncoding: defaultToConfig2,
|
|
1758
|
+
validateStatus: mergeDirectKeys,
|
|
1759
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
1760
|
+
};
|
|
1761
|
+
utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
1762
|
+
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
1763
|
+
const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
1764
|
+
const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
|
|
1765
|
+
const b = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
|
|
1766
|
+
const configValue = merge2(a, b, prop);
|
|
1767
|
+
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
1768
|
+
});
|
|
1769
|
+
return config;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// node_modules/axios/lib/helpers/resolveConfig.js
|
|
1773
|
+
var FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
|
|
1774
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
1775
|
+
if (policy !== "content-only") {
|
|
1776
|
+
headers.set(formHeaders);
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
1780
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
1781
|
+
headers.set(key, val);
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
var encodeUTF8 = (str) => encodeURIComponent(str).replace(
|
|
1786
|
+
/%([0-9A-F]{2})/gi,
|
|
1787
|
+
(_, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
1788
|
+
);
|
|
1789
|
+
var resolveConfig_default = (config) => {
|
|
1790
|
+
const newConfig = mergeConfig({}, config);
|
|
1791
|
+
const own2 = (key) => utils_default.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
|
|
1792
|
+
const data = own2("data");
|
|
1793
|
+
let withXSRFToken = own2("withXSRFToken");
|
|
1794
|
+
const xsrfHeaderName = own2("xsrfHeaderName");
|
|
1795
|
+
const xsrfCookieName = own2("xsrfCookieName");
|
|
1796
|
+
let headers = own2("headers");
|
|
1797
|
+
const auth = own2("auth");
|
|
1798
|
+
const baseURL = own2("baseURL");
|
|
1799
|
+
const allowAbsoluteUrls = own2("allowAbsoluteUrls");
|
|
1800
|
+
const url = own2("url");
|
|
1801
|
+
newConfig.headers = headers = AxiosHeaders_default.from(headers);
|
|
1802
|
+
newConfig.url = buildURL(
|
|
1803
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
1804
|
+
config.params,
|
|
1805
|
+
config.paramsSerializer
|
|
1806
|
+
);
|
|
1807
|
+
if (auth) {
|
|
1808
|
+
headers.set(
|
|
1809
|
+
"Authorization",
|
|
1810
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? encodeUTF8(auth.password) : ""))
|
|
1811
|
+
);
|
|
1812
|
+
}
|
|
1813
|
+
if (utils_default.isFormData(data)) {
|
|
1814
|
+
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
|
|
1815
|
+
headers.setContentType(void 0);
|
|
1816
|
+
} else if (utils_default.isFunction(data.getHeaders)) {
|
|
1817
|
+
setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
if (platform_default.hasStandardBrowserEnv) {
|
|
1821
|
+
if (utils_default.isFunction(withXSRFToken)) {
|
|
1822
|
+
withXSRFToken = withXSRFToken(newConfig);
|
|
1823
|
+
}
|
|
1824
|
+
const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
|
|
1825
|
+
if (shouldSendXSRF) {
|
|
1826
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
|
|
1827
|
+
if (xsrfValue) {
|
|
1828
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
return newConfig;
|
|
1833
|
+
};
|
|
1834
|
+
|
|
1835
|
+
// node_modules/axios/lib/adapters/xhr.js
|
|
1836
|
+
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
1837
|
+
var xhr_default = isXHRAdapterSupported && function(config) {
|
|
1838
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1839
|
+
const _config = resolveConfig_default(config);
|
|
1840
|
+
let requestData = _config.data;
|
|
1841
|
+
const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
|
|
1842
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
1843
|
+
let onCanceled;
|
|
1844
|
+
let uploadThrottled, downloadThrottled;
|
|
1845
|
+
let flushUpload, flushDownload;
|
|
1846
|
+
function done() {
|
|
1847
|
+
flushUpload && flushUpload();
|
|
1848
|
+
flushDownload && flushDownload();
|
|
1849
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
1850
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
1851
|
+
}
|
|
1852
|
+
let request = new XMLHttpRequest();
|
|
1853
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
1854
|
+
request.timeout = _config.timeout;
|
|
1855
|
+
function onloadend() {
|
|
1856
|
+
if (!request) {
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
const responseHeaders = AxiosHeaders_default.from(
|
|
1860
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
1861
|
+
);
|
|
1862
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
1863
|
+
const response = {
|
|
1864
|
+
data: responseData,
|
|
1865
|
+
status: request.status,
|
|
1866
|
+
statusText: request.statusText,
|
|
1867
|
+
headers: responseHeaders,
|
|
1868
|
+
config,
|
|
1869
|
+
request
|
|
1870
|
+
};
|
|
1871
|
+
settle(
|
|
1872
|
+
function _resolve(value) {
|
|
1873
|
+
resolve(value);
|
|
1874
|
+
done();
|
|
1875
|
+
},
|
|
1876
|
+
function _reject(err) {
|
|
1877
|
+
reject(err);
|
|
1878
|
+
done();
|
|
1879
|
+
},
|
|
1880
|
+
response
|
|
1881
|
+
);
|
|
1882
|
+
request = null;
|
|
1883
|
+
}
|
|
1884
|
+
if ("onloadend" in request) {
|
|
1885
|
+
request.onloadend = onloadend;
|
|
1886
|
+
} else {
|
|
1887
|
+
request.onreadystatechange = function handleLoad() {
|
|
1888
|
+
if (!request || request.readyState !== 4) {
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith("file:"))) {
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
setTimeout(onloadend);
|
|
1895
|
+
};
|
|
1896
|
+
}
|
|
1897
|
+
request.onabort = function handleAbort() {
|
|
1898
|
+
if (!request) {
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
|
|
1902
|
+
done();
|
|
1903
|
+
request = null;
|
|
1904
|
+
};
|
|
1905
|
+
request.onerror = function handleError(event) {
|
|
1906
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
1907
|
+
const err = new AxiosError_default(msg, AxiosError_default.ERR_NETWORK, config, request);
|
|
1908
|
+
err.event = event || null;
|
|
1909
|
+
reject(err);
|
|
1910
|
+
done();
|
|
1911
|
+
request = null;
|
|
1912
|
+
};
|
|
1913
|
+
request.ontimeout = function handleTimeout() {
|
|
1914
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
1915
|
+
const transitional2 = _config.transitional || transitional_default;
|
|
1916
|
+
if (_config.timeoutErrorMessage) {
|
|
1917
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
1918
|
+
}
|
|
1919
|
+
reject(
|
|
1920
|
+
new AxiosError_default(
|
|
1921
|
+
timeoutErrorMessage,
|
|
1922
|
+
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
|
|
1923
|
+
config,
|
|
1924
|
+
request
|
|
1925
|
+
)
|
|
1926
|
+
);
|
|
1927
|
+
done();
|
|
1928
|
+
request = null;
|
|
1929
|
+
};
|
|
1930
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
1931
|
+
if ("setRequestHeader" in request) {
|
|
1932
|
+
utils_default.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
1933
|
+
request.setRequestHeader(key, val);
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
if (!utils_default.isUndefined(_config.withCredentials)) {
|
|
1937
|
+
request.withCredentials = !!_config.withCredentials;
|
|
1938
|
+
}
|
|
1939
|
+
if (responseType && responseType !== "json") {
|
|
1940
|
+
request.responseType = _config.responseType;
|
|
1941
|
+
}
|
|
1942
|
+
if (onDownloadProgress) {
|
|
1943
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
1944
|
+
request.addEventListener("progress", downloadThrottled);
|
|
1945
|
+
}
|
|
1946
|
+
if (onUploadProgress && request.upload) {
|
|
1947
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
1948
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
1949
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
1950
|
+
}
|
|
1951
|
+
if (_config.cancelToken || _config.signal) {
|
|
1952
|
+
onCanceled = (cancel) => {
|
|
1953
|
+
if (!request) {
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
|
|
1957
|
+
request.abort();
|
|
1958
|
+
done();
|
|
1959
|
+
request = null;
|
|
1960
|
+
};
|
|
1961
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
1962
|
+
if (_config.signal) {
|
|
1963
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
const protocol = parseProtocol(_config.url);
|
|
1967
|
+
if (protocol && !platform_default.protocols.includes(protocol)) {
|
|
1968
|
+
reject(
|
|
1969
|
+
new AxiosError_default(
|
|
1970
|
+
"Unsupported protocol " + protocol + ":",
|
|
1971
|
+
AxiosError_default.ERR_BAD_REQUEST,
|
|
1972
|
+
config
|
|
1973
|
+
)
|
|
1974
|
+
);
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1977
|
+
request.send(requestData || null);
|
|
1978
|
+
});
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
// node_modules/axios/lib/helpers/composeSignals.js
|
|
1982
|
+
var composeSignals = (signals, timeout) => {
|
|
1983
|
+
signals = signals ? signals.filter(Boolean) : [];
|
|
1984
|
+
if (!timeout && !signals.length) {
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
const controller = new AbortController();
|
|
1988
|
+
let aborted = false;
|
|
1989
|
+
const onabort = function(reason) {
|
|
1990
|
+
if (!aborted) {
|
|
1991
|
+
aborted = true;
|
|
1992
|
+
unsubscribe();
|
|
1993
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
1994
|
+
controller.abort(
|
|
1995
|
+
err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
|
|
1996
|
+
);
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
let timer = timeout && setTimeout(() => {
|
|
2000
|
+
timer = null;
|
|
2001
|
+
onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
|
|
2002
|
+
}, timeout);
|
|
2003
|
+
const unsubscribe = () => {
|
|
2004
|
+
if (!signals) {
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
timer && clearTimeout(timer);
|
|
2008
|
+
timer = null;
|
|
2009
|
+
signals.forEach((signal2) => {
|
|
2010
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
2011
|
+
});
|
|
2012
|
+
signals = null;
|
|
2013
|
+
};
|
|
2014
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
2015
|
+
const { signal } = controller;
|
|
2016
|
+
signal.unsubscribe = () => utils_default.asap(unsubscribe);
|
|
2017
|
+
return signal;
|
|
2018
|
+
};
|
|
2019
|
+
var composeSignals_default = composeSignals;
|
|
2020
|
+
|
|
2021
|
+
// node_modules/axios/lib/helpers/trackStream.js
|
|
2022
|
+
var streamChunk = function* (chunk, chunkSize) {
|
|
2023
|
+
let len = chunk.byteLength;
|
|
2024
|
+
if (!chunkSize || len < chunkSize) {
|
|
2025
|
+
yield chunk;
|
|
2026
|
+
return;
|
|
2027
|
+
}
|
|
2028
|
+
let pos = 0;
|
|
2029
|
+
let end;
|
|
2030
|
+
while (pos < len) {
|
|
2031
|
+
end = pos + chunkSize;
|
|
2032
|
+
yield chunk.slice(pos, end);
|
|
2033
|
+
pos = end;
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
var readBytes = async function* (iterable, chunkSize) {
|
|
2037
|
+
for await (const chunk of readStream(iterable)) {
|
|
2038
|
+
yield* streamChunk(chunk, chunkSize);
|
|
2039
|
+
}
|
|
2040
|
+
};
|
|
2041
|
+
var readStream = async function* (stream) {
|
|
2042
|
+
if (stream[Symbol.asyncIterator]) {
|
|
2043
|
+
yield* stream;
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
const reader = stream.getReader();
|
|
2047
|
+
try {
|
|
2048
|
+
for (; ; ) {
|
|
2049
|
+
const { done, value } = await reader.read();
|
|
2050
|
+
if (done) {
|
|
2051
|
+
break;
|
|
2052
|
+
}
|
|
2053
|
+
yield value;
|
|
2054
|
+
}
|
|
2055
|
+
} finally {
|
|
2056
|
+
await reader.cancel();
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
var trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
2060
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
2061
|
+
let bytes = 0;
|
|
2062
|
+
let done;
|
|
2063
|
+
let _onFinish = (e) => {
|
|
2064
|
+
if (!done) {
|
|
2065
|
+
done = true;
|
|
2066
|
+
onFinish && onFinish(e);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
return new ReadableStream(
|
|
2070
|
+
{
|
|
2071
|
+
async pull(controller) {
|
|
2072
|
+
try {
|
|
2073
|
+
const { done: done2, value } = await iterator2.next();
|
|
2074
|
+
if (done2) {
|
|
2075
|
+
_onFinish();
|
|
2076
|
+
controller.close();
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
let len = value.byteLength;
|
|
2080
|
+
if (onProgress) {
|
|
2081
|
+
let loadedBytes = bytes += len;
|
|
2082
|
+
onProgress(loadedBytes);
|
|
2083
|
+
}
|
|
2084
|
+
controller.enqueue(new Uint8Array(value));
|
|
2085
|
+
} catch (err) {
|
|
2086
|
+
_onFinish(err);
|
|
2087
|
+
throw err;
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
cancel(reason) {
|
|
2091
|
+
_onFinish(reason);
|
|
2092
|
+
return iterator2.return();
|
|
2093
|
+
}
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
highWaterMark: 2
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
};
|
|
2100
|
+
|
|
2101
|
+
// node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js
|
|
2102
|
+
function estimateDataURLDecodedBytes(url) {
|
|
2103
|
+
if (!url || typeof url !== "string") return 0;
|
|
2104
|
+
if (!url.startsWith("data:")) return 0;
|
|
2105
|
+
const comma = url.indexOf(",");
|
|
2106
|
+
if (comma < 0) return 0;
|
|
2107
|
+
const meta = url.slice(5, comma);
|
|
2108
|
+
const body = url.slice(comma + 1);
|
|
2109
|
+
const isBase64 = /;base64/i.test(meta);
|
|
2110
|
+
if (isBase64) {
|
|
2111
|
+
let effectiveLen = body.length;
|
|
2112
|
+
const len = body.length;
|
|
2113
|
+
for (let i = 0; i < len; i++) {
|
|
2114
|
+
if (body.charCodeAt(i) === 37 && i + 2 < len) {
|
|
2115
|
+
const a = body.charCodeAt(i + 1);
|
|
2116
|
+
const b = body.charCodeAt(i + 2);
|
|
2117
|
+
const isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
|
|
2118
|
+
if (isHex) {
|
|
2119
|
+
effectiveLen -= 2;
|
|
2120
|
+
i += 2;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
let pad = 0;
|
|
2125
|
+
let idx = len - 1;
|
|
2126
|
+
const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
|
|
2127
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
2128
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
|
|
2129
|
+
if (idx >= 0) {
|
|
2130
|
+
if (body.charCodeAt(idx) === 61) {
|
|
2131
|
+
pad++;
|
|
2132
|
+
idx--;
|
|
2133
|
+
} else if (tailIsPct3D(idx)) {
|
|
2134
|
+
pad++;
|
|
2135
|
+
idx -= 3;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
if (pad === 1 && idx >= 0) {
|
|
2139
|
+
if (body.charCodeAt(idx) === 61) {
|
|
2140
|
+
pad++;
|
|
2141
|
+
} else if (tailIsPct3D(idx)) {
|
|
2142
|
+
pad++;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
2146
|
+
const bytes2 = groups * 3 - (pad || 0);
|
|
2147
|
+
return bytes2 > 0 ? bytes2 : 0;
|
|
2148
|
+
}
|
|
2149
|
+
if (typeof Buffer !== "undefined" && typeof Buffer.byteLength === "function") {
|
|
2150
|
+
return Buffer.byteLength(body, "utf8");
|
|
2151
|
+
}
|
|
2152
|
+
let bytes = 0;
|
|
2153
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
2154
|
+
const c = body.charCodeAt(i);
|
|
2155
|
+
if (c < 128) {
|
|
2156
|
+
bytes += 1;
|
|
2157
|
+
} else if (c < 2048) {
|
|
2158
|
+
bytes += 2;
|
|
2159
|
+
} else if (c >= 55296 && c <= 56319 && i + 1 < len) {
|
|
2160
|
+
const next = body.charCodeAt(i + 1);
|
|
2161
|
+
if (next >= 56320 && next <= 57343) {
|
|
2162
|
+
bytes += 4;
|
|
2163
|
+
i++;
|
|
2164
|
+
} else {
|
|
2165
|
+
bytes += 3;
|
|
2166
|
+
}
|
|
2167
|
+
} else {
|
|
2168
|
+
bytes += 3;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
return bytes;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
// node_modules/axios/lib/env/data.js
|
|
2175
|
+
var VERSION = "1.16.1";
|
|
2176
|
+
|
|
2177
|
+
// node_modules/axios/lib/adapters/fetch.js
|
|
2178
|
+
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2179
|
+
var { isFunction: isFunction2 } = utils_default;
|
|
2180
|
+
var test = (fn, ...args) => {
|
|
2181
|
+
try {
|
|
2182
|
+
return !!fn(...args);
|
|
2183
|
+
} catch (e) {
|
|
2184
|
+
return false;
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
var factory = (env) => {
|
|
2188
|
+
const globalObject = utils_default.global !== void 0 && utils_default.global !== null ? utils_default.global : globalThis;
|
|
2189
|
+
const { ReadableStream: ReadableStream2, TextEncoder } = globalObject;
|
|
2190
|
+
env = utils_default.merge.call(
|
|
2191
|
+
{
|
|
2192
|
+
skipUndefined: true
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
Request: globalObject.Request,
|
|
2196
|
+
Response: globalObject.Response
|
|
2197
|
+
},
|
|
2198
|
+
env
|
|
2199
|
+
);
|
|
2200
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
2201
|
+
const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
|
|
2202
|
+
const isRequestSupported = isFunction2(Request);
|
|
2203
|
+
const isResponseSupported = isFunction2(Response);
|
|
2204
|
+
if (!isFetchSupported) {
|
|
2205
|
+
return false;
|
|
2206
|
+
}
|
|
2207
|
+
const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
|
|
2208
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
2209
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2210
|
+
let duplexAccessed = false;
|
|
2211
|
+
const request = new Request(platform_default.origin, {
|
|
2212
|
+
body: new ReadableStream2(),
|
|
2213
|
+
method: "POST",
|
|
2214
|
+
get duplex() {
|
|
2215
|
+
duplexAccessed = true;
|
|
2216
|
+
return "half";
|
|
2217
|
+
}
|
|
2218
|
+
});
|
|
2219
|
+
const hasContentType = request.headers.has("Content-Type");
|
|
2220
|
+
if (request.body != null) {
|
|
2221
|
+
request.body.cancel();
|
|
2222
|
+
}
|
|
2223
|
+
return duplexAccessed && !hasContentType;
|
|
2224
|
+
});
|
|
2225
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
|
|
2226
|
+
const resolvers = {
|
|
2227
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
2228
|
+
};
|
|
2229
|
+
isFetchSupported && (() => {
|
|
2230
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
2231
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
2232
|
+
let method = res && res[type];
|
|
2233
|
+
if (method) {
|
|
2234
|
+
return method.call(res);
|
|
2235
|
+
}
|
|
2236
|
+
throw new AxiosError_default(
|
|
2237
|
+
`Response type '${type}' is not supported`,
|
|
2238
|
+
AxiosError_default.ERR_NOT_SUPPORT,
|
|
2239
|
+
config
|
|
2240
|
+
);
|
|
2241
|
+
});
|
|
2242
|
+
});
|
|
2243
|
+
})();
|
|
2244
|
+
const getBodyLength = async (body) => {
|
|
2245
|
+
if (body == null) {
|
|
2246
|
+
return 0;
|
|
2247
|
+
}
|
|
2248
|
+
if (utils_default.isBlob(body)) {
|
|
2249
|
+
return body.size;
|
|
2250
|
+
}
|
|
2251
|
+
if (utils_default.isSpecCompliantForm(body)) {
|
|
2252
|
+
const _request = new Request(platform_default.origin, {
|
|
2253
|
+
method: "POST",
|
|
2254
|
+
body
|
|
2255
|
+
});
|
|
2256
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
2257
|
+
}
|
|
2258
|
+
if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
|
|
2259
|
+
return body.byteLength;
|
|
2260
|
+
}
|
|
2261
|
+
if (utils_default.isURLSearchParams(body)) {
|
|
2262
|
+
body = body + "";
|
|
2263
|
+
}
|
|
2264
|
+
if (utils_default.isString(body)) {
|
|
2265
|
+
return (await encodeText(body)).byteLength;
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
const resolveBodyLength = async (headers, body) => {
|
|
2269
|
+
const length = utils_default.toFiniteNumber(headers.getContentLength());
|
|
2270
|
+
return length == null ? getBodyLength(body) : length;
|
|
2271
|
+
};
|
|
2272
|
+
return async (config) => {
|
|
2273
|
+
let {
|
|
2274
|
+
url,
|
|
2275
|
+
method,
|
|
2276
|
+
data,
|
|
2277
|
+
signal,
|
|
2278
|
+
cancelToken,
|
|
2279
|
+
timeout,
|
|
2280
|
+
onDownloadProgress,
|
|
2281
|
+
onUploadProgress,
|
|
2282
|
+
responseType,
|
|
2283
|
+
headers,
|
|
2284
|
+
withCredentials = "same-origin",
|
|
2285
|
+
fetchOptions,
|
|
2286
|
+
maxContentLength,
|
|
2287
|
+
maxBodyLength
|
|
2288
|
+
} = resolveConfig_default(config);
|
|
2289
|
+
const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
|
|
2290
|
+
const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
2291
|
+
let _fetch = envFetch || fetch;
|
|
2292
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
2293
|
+
let composedSignal = composeSignals_default(
|
|
2294
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
2295
|
+
timeout
|
|
2296
|
+
);
|
|
2297
|
+
let request = null;
|
|
2298
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2299
|
+
composedSignal.unsubscribe();
|
|
2300
|
+
});
|
|
2301
|
+
let requestContentLength;
|
|
2302
|
+
try {
|
|
2303
|
+
if (hasMaxContentLength && typeof url === "string" && url.startsWith("data:")) {
|
|
2304
|
+
const estimated = estimateDataURLDecodedBytes(url);
|
|
2305
|
+
if (estimated > maxContentLength) {
|
|
2306
|
+
throw new AxiosError_default(
|
|
2307
|
+
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
2308
|
+
AxiosError_default.ERR_BAD_RESPONSE,
|
|
2309
|
+
config,
|
|
2310
|
+
request
|
|
2311
|
+
);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
if (hasMaxBodyLength && method !== "get" && method !== "head") {
|
|
2315
|
+
const outboundLength = await resolveBodyLength(headers, data);
|
|
2316
|
+
if (typeof outboundLength === "number" && isFinite(outboundLength) && outboundLength > maxBodyLength) {
|
|
2317
|
+
throw new AxiosError_default(
|
|
2318
|
+
"Request body larger than maxBodyLength limit",
|
|
2319
|
+
AxiosError_default.ERR_BAD_REQUEST,
|
|
2320
|
+
config,
|
|
2321
|
+
request
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
2326
|
+
let _request = new Request(url, {
|
|
2327
|
+
method: "POST",
|
|
2328
|
+
body: data,
|
|
2329
|
+
duplex: "half"
|
|
2330
|
+
});
|
|
2331
|
+
let contentTypeHeader;
|
|
2332
|
+
if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
2333
|
+
headers.setContentType(contentTypeHeader);
|
|
2334
|
+
}
|
|
2335
|
+
if (_request.body) {
|
|
2336
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2337
|
+
requestContentLength,
|
|
2338
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
2339
|
+
);
|
|
2340
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
if (!utils_default.isString(withCredentials)) {
|
|
2344
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
2345
|
+
}
|
|
2346
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2347
|
+
if (utils_default.isFormData(data)) {
|
|
2348
|
+
const contentType = headers.getContentType();
|
|
2349
|
+
if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
|
|
2350
|
+
headers.delete("content-type");
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
headers.set("User-Agent", "axios/" + VERSION, false);
|
|
2354
|
+
const resolvedOptions = {
|
|
2355
|
+
...fetchOptions,
|
|
2356
|
+
signal: composedSignal,
|
|
2357
|
+
method: method.toUpperCase(),
|
|
2358
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
2359
|
+
body: data,
|
|
2360
|
+
duplex: "half",
|
|
2361
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
2362
|
+
};
|
|
2363
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2364
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
2365
|
+
if (hasMaxContentLength) {
|
|
2366
|
+
const declaredLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
|
|
2367
|
+
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
2368
|
+
throw new AxiosError_default(
|
|
2369
|
+
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
2370
|
+
AxiosError_default.ERR_BAD_RESPONSE,
|
|
2371
|
+
config,
|
|
2372
|
+
request
|
|
2373
|
+
);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
2377
|
+
if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
|
|
2378
|
+
const options = {};
|
|
2379
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
2380
|
+
options[prop] = response[prop];
|
|
2381
|
+
});
|
|
2382
|
+
const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
|
|
2383
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2384
|
+
responseContentLength,
|
|
2385
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2386
|
+
) || [];
|
|
2387
|
+
let bytesRead = 0;
|
|
2388
|
+
const onChunkProgress = (loadedBytes) => {
|
|
2389
|
+
if (hasMaxContentLength) {
|
|
2390
|
+
bytesRead = loadedBytes;
|
|
2391
|
+
if (bytesRead > maxContentLength) {
|
|
2392
|
+
throw new AxiosError_default(
|
|
2393
|
+
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
2394
|
+
AxiosError_default.ERR_BAD_RESPONSE,
|
|
2395
|
+
config,
|
|
2396
|
+
request
|
|
2397
|
+
);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
onProgress && onProgress(loadedBytes);
|
|
2401
|
+
};
|
|
2402
|
+
response = new Response(
|
|
2403
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
2404
|
+
flush && flush();
|
|
2405
|
+
unsubscribe && unsubscribe();
|
|
2406
|
+
}),
|
|
2407
|
+
options
|
|
2408
|
+
);
|
|
2409
|
+
}
|
|
2410
|
+
responseType = responseType || "text";
|
|
2411
|
+
let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
|
|
2412
|
+
response,
|
|
2413
|
+
config
|
|
2414
|
+
);
|
|
2415
|
+
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
2416
|
+
let materializedSize;
|
|
2417
|
+
if (responseData != null) {
|
|
2418
|
+
if (typeof responseData.byteLength === "number") {
|
|
2419
|
+
materializedSize = responseData.byteLength;
|
|
2420
|
+
} else if (typeof responseData.size === "number") {
|
|
2421
|
+
materializedSize = responseData.size;
|
|
2422
|
+
} else if (typeof responseData === "string") {
|
|
2423
|
+
materializedSize = typeof TextEncoder === "function" ? new TextEncoder().encode(responseData).byteLength : responseData.length;
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
if (typeof materializedSize === "number" && materializedSize > maxContentLength) {
|
|
2427
|
+
throw new AxiosError_default(
|
|
2428
|
+
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
2429
|
+
AxiosError_default.ERR_BAD_RESPONSE,
|
|
2430
|
+
config,
|
|
2431
|
+
request
|
|
2432
|
+
);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2436
|
+
return await new Promise((resolve, reject) => {
|
|
2437
|
+
settle(resolve, reject, {
|
|
2438
|
+
data: responseData,
|
|
2439
|
+
headers: AxiosHeaders_default.from(response.headers),
|
|
2440
|
+
status: response.status,
|
|
2441
|
+
statusText: response.statusText,
|
|
2442
|
+
config,
|
|
2443
|
+
request
|
|
2444
|
+
});
|
|
2445
|
+
});
|
|
2446
|
+
} catch (err) {
|
|
2447
|
+
unsubscribe && unsubscribe();
|
|
2448
|
+
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError_default) {
|
|
2449
|
+
const canceledError = composedSignal.reason;
|
|
2450
|
+
canceledError.config = config;
|
|
2451
|
+
request && (canceledError.request = request);
|
|
2452
|
+
err !== canceledError && (canceledError.cause = err);
|
|
2453
|
+
throw canceledError;
|
|
2454
|
+
}
|
|
2455
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
2456
|
+
throw Object.assign(
|
|
2457
|
+
new AxiosError_default(
|
|
2458
|
+
"Network Error",
|
|
2459
|
+
AxiosError_default.ERR_NETWORK,
|
|
2460
|
+
config,
|
|
2461
|
+
request,
|
|
2462
|
+
err && err.response
|
|
2463
|
+
),
|
|
2464
|
+
{
|
|
2465
|
+
cause: err.cause || err
|
|
2466
|
+
}
|
|
2467
|
+
);
|
|
2468
|
+
}
|
|
2469
|
+
throw AxiosError_default.from(err, err && err.code, config, request, err && err.response);
|
|
2470
|
+
}
|
|
2471
|
+
};
|
|
2472
|
+
};
|
|
2473
|
+
var seedCache = /* @__PURE__ */ new Map();
|
|
2474
|
+
var getFetch = (config) => {
|
|
2475
|
+
let env = config && config.env || {};
|
|
2476
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
2477
|
+
const seeds = [Request, Response, fetch2];
|
|
2478
|
+
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
2479
|
+
while (i--) {
|
|
2480
|
+
seed = seeds[i];
|
|
2481
|
+
target = map.get(seed);
|
|
2482
|
+
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
2483
|
+
map = target;
|
|
2484
|
+
}
|
|
2485
|
+
return target;
|
|
2486
|
+
};
|
|
2487
|
+
var adapter = getFetch();
|
|
2488
|
+
|
|
2489
|
+
// node_modules/axios/lib/adapters/adapters.js
|
|
2490
|
+
var knownAdapters = {
|
|
2491
|
+
http: null_default,
|
|
2492
|
+
xhr: xhr_default,
|
|
2493
|
+
fetch: {
|
|
2494
|
+
get: getFetch
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
utils_default.forEach(knownAdapters, (fn, value) => {
|
|
2498
|
+
if (fn) {
|
|
2499
|
+
try {
|
|
2500
|
+
Object.defineProperty(fn, "name", { __proto__: null, value });
|
|
2501
|
+
} catch (e) {
|
|
2502
|
+
}
|
|
2503
|
+
Object.defineProperty(fn, "adapterName", { __proto__: null, value });
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2506
|
+
var renderReason = (reason) => `- ${reason}`;
|
|
2507
|
+
var isResolvedHandle = (adapter2) => utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
|
|
2508
|
+
function getAdapter(adapters, config) {
|
|
2509
|
+
adapters = utils_default.isArray(adapters) ? adapters : [adapters];
|
|
2510
|
+
const { length } = adapters;
|
|
2511
|
+
let nameOrAdapter;
|
|
2512
|
+
let adapter2;
|
|
2513
|
+
const rejectedReasons = {};
|
|
2514
|
+
for (let i = 0; i < length; i++) {
|
|
2515
|
+
nameOrAdapter = adapters[i];
|
|
2516
|
+
let id;
|
|
2517
|
+
adapter2 = nameOrAdapter;
|
|
2518
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
2519
|
+
adapter2 = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
2520
|
+
if (adapter2 === void 0) {
|
|
2521
|
+
throw new AxiosError_default(`Unknown adapter '${id}'`);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
|
|
2525
|
+
break;
|
|
2526
|
+
}
|
|
2527
|
+
rejectedReasons[id || "#" + i] = adapter2;
|
|
2528
|
+
}
|
|
2529
|
+
if (!adapter2) {
|
|
2530
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
2531
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
2532
|
+
);
|
|
2533
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
2534
|
+
throw new AxiosError_default(
|
|
2535
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
2536
|
+
"ERR_NOT_SUPPORT"
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
return adapter2;
|
|
2540
|
+
}
|
|
2541
|
+
var adapters_default = {
|
|
2542
|
+
/**
|
|
2543
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
2544
|
+
* @type {Function}
|
|
2545
|
+
*/
|
|
2546
|
+
getAdapter,
|
|
2547
|
+
/**
|
|
2548
|
+
* Exposes all known adapters
|
|
2549
|
+
* @type {Object<string, Function|Object>}
|
|
2550
|
+
*/
|
|
2551
|
+
adapters: knownAdapters
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2554
|
+
// node_modules/axios/lib/core/dispatchRequest.js
|
|
2555
|
+
function throwIfCancellationRequested(config) {
|
|
2556
|
+
if (config.cancelToken) {
|
|
2557
|
+
config.cancelToken.throwIfRequested();
|
|
2558
|
+
}
|
|
2559
|
+
if (config.signal && config.signal.aborted) {
|
|
2560
|
+
throw new CanceledError_default(null, config);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
function dispatchRequest(config) {
|
|
2564
|
+
throwIfCancellationRequested(config);
|
|
2565
|
+
config.headers = AxiosHeaders_default.from(config.headers);
|
|
2566
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
2567
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
2568
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
2569
|
+
}
|
|
2570
|
+
const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
|
|
2571
|
+
return adapter2(config).then(
|
|
2572
|
+
function onAdapterResolution(response) {
|
|
2573
|
+
throwIfCancellationRequested(config);
|
|
2574
|
+
config.response = response;
|
|
2575
|
+
try {
|
|
2576
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
2577
|
+
} finally {
|
|
2578
|
+
delete config.response;
|
|
2579
|
+
}
|
|
2580
|
+
response.headers = AxiosHeaders_default.from(response.headers);
|
|
2581
|
+
return response;
|
|
2582
|
+
},
|
|
2583
|
+
function onAdapterRejection(reason) {
|
|
2584
|
+
if (!isCancel(reason)) {
|
|
2585
|
+
throwIfCancellationRequested(config);
|
|
2586
|
+
if (reason && reason.response) {
|
|
2587
|
+
config.response = reason.response;
|
|
2588
|
+
try {
|
|
2589
|
+
reason.response.data = transformData.call(
|
|
2590
|
+
config,
|
|
2591
|
+
config.transformResponse,
|
|
2592
|
+
reason.response
|
|
2593
|
+
);
|
|
2594
|
+
} finally {
|
|
2595
|
+
delete config.response;
|
|
2596
|
+
}
|
|
2597
|
+
reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
return Promise.reject(reason);
|
|
2601
|
+
}
|
|
2602
|
+
);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// node_modules/axios/lib/helpers/validator.js
|
|
2606
|
+
var validators = {};
|
|
2607
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
2608
|
+
validators[type] = function validator(thing) {
|
|
2609
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
2610
|
+
};
|
|
2611
|
+
});
|
|
2612
|
+
var deprecatedWarnings = {};
|
|
2613
|
+
validators.transitional = function transitional(validator, version2, message) {
|
|
2614
|
+
function formatMessage(opt, desc) {
|
|
2615
|
+
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
2616
|
+
}
|
|
2617
|
+
return (value, opt, opts) => {
|
|
2618
|
+
if (validator === false) {
|
|
2619
|
+
throw new AxiosError_default(
|
|
2620
|
+
formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")),
|
|
2621
|
+
AxiosError_default.ERR_DEPRECATED
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
if (version2 && !deprecatedWarnings[opt]) {
|
|
2625
|
+
deprecatedWarnings[opt] = true;
|
|
2626
|
+
console.warn(
|
|
2627
|
+
formatMessage(
|
|
2628
|
+
opt,
|
|
2629
|
+
" has been deprecated since v" + version2 + " and will be removed in the near future"
|
|
2630
|
+
)
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2633
|
+
return validator ? validator(value, opt, opts) : true;
|
|
2634
|
+
};
|
|
2635
|
+
};
|
|
2636
|
+
validators.spelling = function spelling(correctSpelling) {
|
|
2637
|
+
return (value, opt) => {
|
|
2638
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2639
|
+
return true;
|
|
2640
|
+
};
|
|
2641
|
+
};
|
|
2642
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
2643
|
+
if (typeof options !== "object") {
|
|
2644
|
+
throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
|
|
2645
|
+
}
|
|
2646
|
+
const keys = Object.keys(options);
|
|
2647
|
+
let i = keys.length;
|
|
2648
|
+
while (i-- > 0) {
|
|
2649
|
+
const opt = keys[i];
|
|
2650
|
+
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
|
|
2651
|
+
if (validator) {
|
|
2652
|
+
const value = options[opt];
|
|
2653
|
+
const result = value === void 0 || validator(value, opt, options);
|
|
2654
|
+
if (result !== true) {
|
|
2655
|
+
throw new AxiosError_default(
|
|
2656
|
+
"option " + opt + " must be " + result,
|
|
2657
|
+
AxiosError_default.ERR_BAD_OPTION_VALUE
|
|
2658
|
+
);
|
|
2659
|
+
}
|
|
2660
|
+
continue;
|
|
2661
|
+
}
|
|
2662
|
+
if (allowUnknown !== true) {
|
|
2663
|
+
throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
var validator_default = {
|
|
2668
|
+
assertOptions,
|
|
2669
|
+
validators
|
|
2670
|
+
};
|
|
2671
|
+
|
|
2672
|
+
// node_modules/axios/lib/core/Axios.js
|
|
2673
|
+
var validators2 = validator_default.validators;
|
|
2674
|
+
var Axios = class {
|
|
2675
|
+
constructor(instanceConfig) {
|
|
2676
|
+
this.defaults = instanceConfig || {};
|
|
2677
|
+
this.interceptors = {
|
|
2678
|
+
request: new InterceptorManager_default(),
|
|
2679
|
+
response: new InterceptorManager_default()
|
|
2680
|
+
};
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Dispatch a request
|
|
2684
|
+
*
|
|
2685
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2686
|
+
* @param {?Object} config
|
|
2687
|
+
*
|
|
2688
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
2689
|
+
*/
|
|
2690
|
+
async request(configOrUrl, config) {
|
|
2691
|
+
try {
|
|
2692
|
+
return await this._request(configOrUrl, config);
|
|
2693
|
+
} catch (err) {
|
|
2694
|
+
if (err instanceof Error) {
|
|
2695
|
+
let dummy = {};
|
|
2696
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
2697
|
+
const stack = (() => {
|
|
2698
|
+
if (!dummy.stack) {
|
|
2699
|
+
return "";
|
|
2700
|
+
}
|
|
2701
|
+
const firstNewlineIndex = dummy.stack.indexOf("\n");
|
|
2702
|
+
return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
|
|
2703
|
+
})();
|
|
2704
|
+
try {
|
|
2705
|
+
if (!err.stack) {
|
|
2706
|
+
err.stack = stack;
|
|
2707
|
+
} else if (stack) {
|
|
2708
|
+
const firstNewlineIndex = stack.indexOf("\n");
|
|
2709
|
+
const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
|
|
2710
|
+
const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
|
|
2711
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
2712
|
+
err.stack += "\n" + stack;
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
} catch (e) {
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
throw err;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
_request(configOrUrl, config) {
|
|
2722
|
+
if (typeof configOrUrl === "string") {
|
|
2723
|
+
config = config || {};
|
|
2724
|
+
config.url = configOrUrl;
|
|
2725
|
+
} else {
|
|
2726
|
+
config = configOrUrl || {};
|
|
2727
|
+
}
|
|
2728
|
+
config = mergeConfig(this.defaults, config);
|
|
2729
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
2730
|
+
if (transitional2 !== void 0) {
|
|
2731
|
+
validator_default.assertOptions(
|
|
2732
|
+
transitional2,
|
|
2733
|
+
{
|
|
2734
|
+
silentJSONParsing: validators2.transitional(validators2.boolean),
|
|
2735
|
+
forcedJSONParsing: validators2.transitional(validators2.boolean),
|
|
2736
|
+
clarifyTimeoutError: validators2.transitional(validators2.boolean),
|
|
2737
|
+
legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
|
|
2738
|
+
},
|
|
2739
|
+
false
|
|
2740
|
+
);
|
|
2741
|
+
}
|
|
2742
|
+
if (paramsSerializer != null) {
|
|
2743
|
+
if (utils_default.isFunction(paramsSerializer)) {
|
|
2744
|
+
config.paramsSerializer = {
|
|
2745
|
+
serialize: paramsSerializer
|
|
2746
|
+
};
|
|
2747
|
+
} else {
|
|
2748
|
+
validator_default.assertOptions(
|
|
2749
|
+
paramsSerializer,
|
|
2750
|
+
{
|
|
2751
|
+
encode: validators2.function,
|
|
2752
|
+
serialize: validators2.function
|
|
2753
|
+
},
|
|
2754
|
+
true
|
|
2755
|
+
);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
if (config.allowAbsoluteUrls !== void 0) {
|
|
2759
|
+
} else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
2760
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
2761
|
+
} else {
|
|
2762
|
+
config.allowAbsoluteUrls = true;
|
|
2763
|
+
}
|
|
2764
|
+
validator_default.assertOptions(
|
|
2765
|
+
config,
|
|
2766
|
+
{
|
|
2767
|
+
baseUrl: validators2.spelling("baseURL"),
|
|
2768
|
+
withXsrfToken: validators2.spelling("withXSRFToken")
|
|
2769
|
+
},
|
|
2770
|
+
true
|
|
2771
|
+
);
|
|
2772
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
2773
|
+
let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
|
|
2774
|
+
headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
|
|
2775
|
+
delete headers[method];
|
|
2776
|
+
});
|
|
2777
|
+
config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
|
|
2778
|
+
const requestInterceptorChain = [];
|
|
2779
|
+
let synchronousRequestInterceptors = true;
|
|
2780
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2781
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2785
|
+
const transitional3 = config.transitional || transitional_default;
|
|
2786
|
+
const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
|
|
2787
|
+
if (legacyInterceptorReqResOrdering) {
|
|
2788
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2789
|
+
} else {
|
|
2790
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2793
|
+
const responseInterceptorChain = [];
|
|
2794
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2795
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2796
|
+
});
|
|
2797
|
+
let promise;
|
|
2798
|
+
let i = 0;
|
|
2799
|
+
let len;
|
|
2800
|
+
if (!synchronousRequestInterceptors) {
|
|
2801
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
2802
|
+
chain.unshift(...requestInterceptorChain);
|
|
2803
|
+
chain.push(...responseInterceptorChain);
|
|
2804
|
+
len = chain.length;
|
|
2805
|
+
promise = Promise.resolve(config);
|
|
2806
|
+
while (i < len) {
|
|
2807
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
2808
|
+
}
|
|
2809
|
+
return promise;
|
|
2810
|
+
}
|
|
2811
|
+
len = requestInterceptorChain.length;
|
|
2812
|
+
let newConfig = config;
|
|
2813
|
+
while (i < len) {
|
|
2814
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
2815
|
+
const onRejected = requestInterceptorChain[i++];
|
|
2816
|
+
try {
|
|
2817
|
+
newConfig = onFulfilled(newConfig);
|
|
2818
|
+
} catch (error) {
|
|
2819
|
+
onRejected.call(this, error);
|
|
2820
|
+
break;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
try {
|
|
2824
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
2825
|
+
} catch (error) {
|
|
2826
|
+
return Promise.reject(error);
|
|
2827
|
+
}
|
|
2828
|
+
i = 0;
|
|
2829
|
+
len = responseInterceptorChain.length;
|
|
2830
|
+
while (i < len) {
|
|
2831
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
2832
|
+
}
|
|
2833
|
+
return promise;
|
|
2834
|
+
}
|
|
2835
|
+
getUri(config) {
|
|
2836
|
+
config = mergeConfig(this.defaults, config);
|
|
2837
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
2838
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
2839
|
+
}
|
|
2840
|
+
};
|
|
2841
|
+
utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
2842
|
+
Axios.prototype[method] = function(url, config) {
|
|
2843
|
+
return this.request(
|
|
2844
|
+
mergeConfig(config || {}, {
|
|
2845
|
+
method,
|
|
2846
|
+
url,
|
|
2847
|
+
data: (config || {}).data
|
|
2848
|
+
})
|
|
2849
|
+
);
|
|
2850
|
+
};
|
|
2851
|
+
});
|
|
2852
|
+
utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
|
|
2853
|
+
function generateHTTPMethod(isForm) {
|
|
2854
|
+
return function httpMethod(url, data, config) {
|
|
2855
|
+
return this.request(
|
|
2856
|
+
mergeConfig(config || {}, {
|
|
2857
|
+
method,
|
|
2858
|
+
headers: isForm ? {
|
|
2859
|
+
"Content-Type": "multipart/form-data"
|
|
2860
|
+
} : {},
|
|
2861
|
+
url,
|
|
2862
|
+
data
|
|
2863
|
+
})
|
|
2864
|
+
);
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
2868
|
+
if (method !== "query") {
|
|
2869
|
+
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
var Axios_default = Axios;
|
|
2873
|
+
|
|
2874
|
+
// node_modules/axios/lib/cancel/CancelToken.js
|
|
2875
|
+
var CancelToken = class _CancelToken {
|
|
2876
|
+
constructor(executor) {
|
|
2877
|
+
if (typeof executor !== "function") {
|
|
2878
|
+
throw new TypeError("executor must be a function.");
|
|
2879
|
+
}
|
|
2880
|
+
let resolvePromise;
|
|
2881
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2882
|
+
resolvePromise = resolve;
|
|
2883
|
+
});
|
|
2884
|
+
const token = this;
|
|
2885
|
+
this.promise.then((cancel) => {
|
|
2886
|
+
if (!token._listeners) return;
|
|
2887
|
+
let i = token._listeners.length;
|
|
2888
|
+
while (i-- > 0) {
|
|
2889
|
+
token._listeners[i](cancel);
|
|
2890
|
+
}
|
|
2891
|
+
token._listeners = null;
|
|
2892
|
+
});
|
|
2893
|
+
this.promise.then = (onfulfilled) => {
|
|
2894
|
+
let _resolve;
|
|
2895
|
+
const promise = new Promise((resolve) => {
|
|
2896
|
+
token.subscribe(resolve);
|
|
2897
|
+
_resolve = resolve;
|
|
2898
|
+
}).then(onfulfilled);
|
|
2899
|
+
promise.cancel = function reject() {
|
|
2900
|
+
token.unsubscribe(_resolve);
|
|
2901
|
+
};
|
|
2902
|
+
return promise;
|
|
2903
|
+
};
|
|
2904
|
+
executor(function cancel(message, config, request) {
|
|
2905
|
+
if (token.reason) {
|
|
2906
|
+
return;
|
|
2907
|
+
}
|
|
2908
|
+
token.reason = new CanceledError_default(message, config, request);
|
|
2909
|
+
resolvePromise(token.reason);
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
2914
|
+
*/
|
|
2915
|
+
throwIfRequested() {
|
|
2916
|
+
if (this.reason) {
|
|
2917
|
+
throw this.reason;
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Subscribe to the cancel signal
|
|
2922
|
+
*/
|
|
2923
|
+
subscribe(listener) {
|
|
2924
|
+
if (this.reason) {
|
|
2925
|
+
listener(this.reason);
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
if (this._listeners) {
|
|
2929
|
+
this._listeners.push(listener);
|
|
2930
|
+
} else {
|
|
2931
|
+
this._listeners = [listener];
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
/**
|
|
2935
|
+
* Unsubscribe from the cancel signal
|
|
2936
|
+
*/
|
|
2937
|
+
unsubscribe(listener) {
|
|
2938
|
+
if (!this._listeners) {
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
const index = this._listeners.indexOf(listener);
|
|
2942
|
+
if (index !== -1) {
|
|
2943
|
+
this._listeners.splice(index, 1);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
toAbortSignal() {
|
|
2947
|
+
const controller = new AbortController();
|
|
2948
|
+
const abort = (err) => {
|
|
2949
|
+
controller.abort(err);
|
|
2950
|
+
};
|
|
2951
|
+
this.subscribe(abort);
|
|
2952
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
2953
|
+
return controller.signal;
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2957
|
+
* cancels the `CancelToken`.
|
|
2958
|
+
*/
|
|
2959
|
+
static source() {
|
|
2960
|
+
let cancel;
|
|
2961
|
+
const token = new _CancelToken(function executor(c) {
|
|
2962
|
+
cancel = c;
|
|
2963
|
+
});
|
|
2964
|
+
return {
|
|
2965
|
+
token,
|
|
2966
|
+
cancel
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
};
|
|
2970
|
+
var CancelToken_default = CancelToken;
|
|
2971
|
+
|
|
2972
|
+
// node_modules/axios/lib/helpers/spread.js
|
|
2973
|
+
function spread(callback) {
|
|
2974
|
+
return function wrap(arr) {
|
|
2975
|
+
return callback.apply(null, arr);
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
// node_modules/axios/lib/helpers/isAxiosError.js
|
|
2980
|
+
function isAxiosError(payload) {
|
|
2981
|
+
return utils_default.isObject(payload) && payload.isAxiosError === true;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
// node_modules/axios/lib/helpers/HttpStatusCode.js
|
|
2985
|
+
var HttpStatusCode = {
|
|
2986
|
+
Continue: 100,
|
|
2987
|
+
SwitchingProtocols: 101,
|
|
2988
|
+
Processing: 102,
|
|
2989
|
+
EarlyHints: 103,
|
|
2990
|
+
Ok: 200,
|
|
2991
|
+
Created: 201,
|
|
2992
|
+
Accepted: 202,
|
|
2993
|
+
NonAuthoritativeInformation: 203,
|
|
2994
|
+
NoContent: 204,
|
|
2995
|
+
ResetContent: 205,
|
|
2996
|
+
PartialContent: 206,
|
|
2997
|
+
MultiStatus: 207,
|
|
2998
|
+
AlreadyReported: 208,
|
|
2999
|
+
ImUsed: 226,
|
|
3000
|
+
MultipleChoices: 300,
|
|
3001
|
+
MovedPermanently: 301,
|
|
3002
|
+
Found: 302,
|
|
3003
|
+
SeeOther: 303,
|
|
3004
|
+
NotModified: 304,
|
|
3005
|
+
UseProxy: 305,
|
|
3006
|
+
Unused: 306,
|
|
3007
|
+
TemporaryRedirect: 307,
|
|
3008
|
+
PermanentRedirect: 308,
|
|
3009
|
+
BadRequest: 400,
|
|
3010
|
+
Unauthorized: 401,
|
|
3011
|
+
PaymentRequired: 402,
|
|
3012
|
+
Forbidden: 403,
|
|
3013
|
+
NotFound: 404,
|
|
3014
|
+
MethodNotAllowed: 405,
|
|
3015
|
+
NotAcceptable: 406,
|
|
3016
|
+
ProxyAuthenticationRequired: 407,
|
|
3017
|
+
RequestTimeout: 408,
|
|
3018
|
+
Conflict: 409,
|
|
3019
|
+
Gone: 410,
|
|
3020
|
+
LengthRequired: 411,
|
|
3021
|
+
PreconditionFailed: 412,
|
|
3022
|
+
PayloadTooLarge: 413,
|
|
3023
|
+
UriTooLong: 414,
|
|
3024
|
+
UnsupportedMediaType: 415,
|
|
3025
|
+
RangeNotSatisfiable: 416,
|
|
3026
|
+
ExpectationFailed: 417,
|
|
3027
|
+
ImATeapot: 418,
|
|
3028
|
+
MisdirectedRequest: 421,
|
|
3029
|
+
UnprocessableEntity: 422,
|
|
3030
|
+
Locked: 423,
|
|
3031
|
+
FailedDependency: 424,
|
|
3032
|
+
TooEarly: 425,
|
|
3033
|
+
UpgradeRequired: 426,
|
|
3034
|
+
PreconditionRequired: 428,
|
|
3035
|
+
TooManyRequests: 429,
|
|
3036
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
3037
|
+
UnavailableForLegalReasons: 451,
|
|
3038
|
+
InternalServerError: 500,
|
|
3039
|
+
NotImplemented: 501,
|
|
3040
|
+
BadGateway: 502,
|
|
3041
|
+
ServiceUnavailable: 503,
|
|
3042
|
+
GatewayTimeout: 504,
|
|
3043
|
+
HttpVersionNotSupported: 505,
|
|
3044
|
+
VariantAlsoNegotiates: 506,
|
|
3045
|
+
InsufficientStorage: 507,
|
|
3046
|
+
LoopDetected: 508,
|
|
3047
|
+
NotExtended: 510,
|
|
3048
|
+
NetworkAuthenticationRequired: 511,
|
|
3049
|
+
WebServerIsDown: 521,
|
|
3050
|
+
ConnectionTimedOut: 522,
|
|
3051
|
+
OriginIsUnreachable: 523,
|
|
3052
|
+
TimeoutOccurred: 524,
|
|
3053
|
+
SslHandshakeFailed: 525,
|
|
3054
|
+
InvalidSslCertificate: 526
|
|
3055
|
+
};
|
|
3056
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
3057
|
+
HttpStatusCode[value] = key;
|
|
3058
|
+
});
|
|
3059
|
+
var HttpStatusCode_default = HttpStatusCode;
|
|
3060
|
+
|
|
3061
|
+
// node_modules/axios/lib/axios.js
|
|
3062
|
+
function createInstance(defaultConfig) {
|
|
3063
|
+
const context = new Axios_default(defaultConfig);
|
|
3064
|
+
const instance = bind(Axios_default.prototype.request, context);
|
|
3065
|
+
utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
|
|
3066
|
+
utils_default.extend(instance, context, null, { allOwnKeys: true });
|
|
3067
|
+
instance.create = function create2(instanceConfig) {
|
|
3068
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
3069
|
+
};
|
|
3070
|
+
return instance;
|
|
3071
|
+
}
|
|
3072
|
+
var axios = createInstance(defaults_default);
|
|
3073
|
+
axios.Axios = Axios_default;
|
|
3074
|
+
axios.CanceledError = CanceledError_default;
|
|
3075
|
+
axios.CancelToken = CancelToken_default;
|
|
3076
|
+
axios.isCancel = isCancel;
|
|
3077
|
+
axios.VERSION = VERSION;
|
|
3078
|
+
axios.toFormData = toFormData_default;
|
|
3079
|
+
axios.AxiosError = AxiosError_default;
|
|
3080
|
+
axios.Cancel = axios.CanceledError;
|
|
3081
|
+
axios.all = function all(promises) {
|
|
3082
|
+
return Promise.all(promises);
|
|
3083
|
+
};
|
|
3084
|
+
axios.spread = spread;
|
|
3085
|
+
axios.isAxiosError = isAxiosError;
|
|
3086
|
+
axios.mergeConfig = mergeConfig;
|
|
3087
|
+
axios.AxiosHeaders = AxiosHeaders_default;
|
|
3088
|
+
axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3089
|
+
axios.getAdapter = adapters_default.getAdapter;
|
|
3090
|
+
axios.HttpStatusCode = HttpStatusCode_default;
|
|
3091
|
+
axios.default = axios;
|
|
3092
|
+
var axios_default = axios;
|
|
3093
|
+
|
|
3094
|
+
// node_modules/axios/index.js
|
|
3095
|
+
var {
|
|
3096
|
+
Axios: Axios2,
|
|
3097
|
+
AxiosError: AxiosError2,
|
|
3098
|
+
CanceledError: CanceledError2,
|
|
3099
|
+
isCancel: isCancel2,
|
|
3100
|
+
CancelToken: CancelToken2,
|
|
3101
|
+
VERSION: VERSION2,
|
|
3102
|
+
all: all2,
|
|
3103
|
+
Cancel,
|
|
3104
|
+
isAxiosError: isAxiosError2,
|
|
3105
|
+
spread: spread2,
|
|
3106
|
+
toFormData: toFormData2,
|
|
3107
|
+
AxiosHeaders: AxiosHeaders2,
|
|
3108
|
+
HttpStatusCode: HttpStatusCode2,
|
|
3109
|
+
formToJSON,
|
|
3110
|
+
getAdapter: getAdapter2,
|
|
3111
|
+
mergeConfig: mergeConfig2,
|
|
3112
|
+
create
|
|
3113
|
+
} = axios_default;
|
|
3114
|
+
|
|
3115
|
+
// src/core/requestManager.ts
|
|
3116
|
+
var RequestManager = class {
|
|
3117
|
+
constructor() {
|
|
3118
|
+
this.preventPending = /* @__PURE__ */ new Map();
|
|
3119
|
+
this.cancelPending = /* @__PURE__ */ new Map();
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* 注册一个新请求
|
|
3123
|
+
*/
|
|
3124
|
+
registerRequest(key, type, controller, promise, config) {
|
|
3125
|
+
const pending = {
|
|
3126
|
+
key,
|
|
3127
|
+
config: config || {},
|
|
3128
|
+
controller,
|
|
3129
|
+
promise,
|
|
3130
|
+
timestamp: Date.now()
|
|
3131
|
+
};
|
|
3132
|
+
(type === "prevent" ? this.preventPending : this.cancelPending).set(key, pending);
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* 移除请求记录
|
|
3136
|
+
*/
|
|
3137
|
+
unregisterRequest(key, type) {
|
|
3138
|
+
(type === "prevent" ? this.preventPending : this.cancelPending).delete(key);
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* 取消并移除请求,同时检查两个 Map
|
|
3142
|
+
*/
|
|
3143
|
+
cancelRequest(key) {
|
|
3144
|
+
let cancelled = false;
|
|
3145
|
+
const abort = (map) => {
|
|
3146
|
+
const req = map.get(key);
|
|
3147
|
+
if (req) {
|
|
3148
|
+
try {
|
|
3149
|
+
req.controller.abort("Cancelled by cancelRequest");
|
|
3150
|
+
} catch {
|
|
3151
|
+
}
|
|
3152
|
+
map.delete(key);
|
|
3153
|
+
cancelled = true;
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
abort(this.preventPending);
|
|
3157
|
+
abort(this.cancelPending);
|
|
3158
|
+
return cancelled;
|
|
3159
|
+
}
|
|
3160
|
+
/**
|
|
3161
|
+
* 获取请求状态(优先返回 preventPending)
|
|
3162
|
+
*/
|
|
3163
|
+
getRequestStatus(key) {
|
|
3164
|
+
return this.preventPending.get(key) ?? this.cancelPending.get(key);
|
|
3165
|
+
}
|
|
3166
|
+
getPreventPending(key) {
|
|
3167
|
+
return this.preventPending.get(key);
|
|
3168
|
+
}
|
|
3169
|
+
getCancelPending(key) {
|
|
3170
|
+
return this.cancelPending.get(key);
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* 清空所有 pending 请求
|
|
3174
|
+
*/
|
|
3175
|
+
clearAll() {
|
|
3176
|
+
const abortAll = (map, reason) => {
|
|
3177
|
+
for (const req of map.values()) {
|
|
3178
|
+
try {
|
|
3179
|
+
req.controller.abort(reason);
|
|
3180
|
+
} catch {
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
map.clear();
|
|
3184
|
+
};
|
|
3185
|
+
abortAll(this.preventPending, "Cleared by clearAll");
|
|
3186
|
+
abortAll(this.cancelPending, "Cleared by clearAll");
|
|
3187
|
+
}
|
|
3188
|
+
/**
|
|
3189
|
+
* 获取 pending 数量(注意两 Map 独立,合计可能重复计数)
|
|
3190
|
+
*/
|
|
3191
|
+
getPendingCount() {
|
|
3192
|
+
return {
|
|
3193
|
+
prevent: this.preventPending.size,
|
|
3194
|
+
cancel: this.cancelPending.size,
|
|
3195
|
+
total: this.preventPending.size + this.cancelPending.size
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* 获取所有 pending 的 key
|
|
3200
|
+
*/
|
|
3201
|
+
getPendingKeys() {
|
|
3202
|
+
return {
|
|
3203
|
+
prevent: Array.from(this.preventPending.keys()),
|
|
3204
|
+
cancel: Array.from(this.cancelPending.keys())
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
|
|
3209
|
+
// src/utils/common.ts
|
|
3210
|
+
function isPlainObject2(value) {
|
|
3211
|
+
if (typeof value !== "object" || value === null) return false;
|
|
3212
|
+
if (Array.isArray(value)) return false;
|
|
3213
|
+
if (value instanceof Blob) return false;
|
|
3214
|
+
if (value instanceof Date) return false;
|
|
3215
|
+
if (typeof FormData !== "undefined" && value instanceof FormData) return false;
|
|
3216
|
+
if (typeof Map !== "undefined" && value instanceof Map) return false;
|
|
3217
|
+
if (typeof Set !== "undefined" && value instanceof Set) return false;
|
|
3218
|
+
return true;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
// src/utils/keyGenerator.ts
|
|
3222
|
+
function toPlain(value) {
|
|
3223
|
+
if (value == null) return value;
|
|
3224
|
+
if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) {
|
|
3225
|
+
return Object.fromEntries(value);
|
|
3226
|
+
}
|
|
3227
|
+
return value;
|
|
3228
|
+
}
|
|
3229
|
+
function getNestedValue(obj, path) {
|
|
3230
|
+
if (!path) return obj;
|
|
3231
|
+
const normalized = path.replace(/\[(\d+)\]/g, ".$1");
|
|
3232
|
+
return normalized.split(".").reduce(
|
|
3233
|
+
(o, k) => o == null ? void 0 : o[k],
|
|
3234
|
+
obj
|
|
3235
|
+
);
|
|
3236
|
+
}
|
|
3237
|
+
function resolveTemplate(template, config) {
|
|
3238
|
+
const context = {
|
|
3239
|
+
method: config.method?.toUpperCase() || "GET",
|
|
3240
|
+
url: config.url || "",
|
|
3241
|
+
params: toPlain(config.params),
|
|
3242
|
+
data: toPlain(config.data)
|
|
3243
|
+
};
|
|
3244
|
+
return template.replace(/\$\{([^}]+)\}/g, (_match, path) => {
|
|
3245
|
+
const value = getNestedValue(context, path);
|
|
3246
|
+
if (value == null) return "";
|
|
3247
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
3248
|
+
return String(value);
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
function generateDefaultKey(config) {
|
|
3252
|
+
const parts = [
|
|
3253
|
+
config.method?.toUpperCase() || "GET",
|
|
3254
|
+
config.url || "",
|
|
3255
|
+
config.params != null ? JSON.stringify(sortObject(stripCacheParam(toPlain(config.params)))) : "",
|
|
3256
|
+
config.data != null ? JSON.stringify(sortObject(stripCacheParam(toPlain(config.data)))) : ""
|
|
3257
|
+
];
|
|
3258
|
+
return hash(parts.join("|"));
|
|
3259
|
+
}
|
|
3260
|
+
function hash(str) {
|
|
3261
|
+
let h = 2166136261;
|
|
3262
|
+
for (let i = 0; i < str.length; i++) {
|
|
3263
|
+
h ^= str.charCodeAt(i);
|
|
3264
|
+
h = h * 16777619 >>> 0;
|
|
3265
|
+
}
|
|
3266
|
+
return h.toString(16).padStart(8, "0");
|
|
3267
|
+
}
|
|
3268
|
+
function resolveRequestKey(config, keyTemplate) {
|
|
3269
|
+
if (!keyTemplate) return generateDefaultKey(config);
|
|
3270
|
+
if (typeof keyTemplate === "function") {
|
|
3271
|
+
return keyTemplate(config, hash);
|
|
3272
|
+
}
|
|
3273
|
+
if (typeof keyTemplate === "string" && keyTemplate.includes("${")) {
|
|
3274
|
+
return hash(resolveTemplate(keyTemplate, config));
|
|
3275
|
+
}
|
|
3276
|
+
return keyTemplate;
|
|
3277
|
+
}
|
|
3278
|
+
function stripCacheParam(obj) {
|
|
3279
|
+
if (obj == null || typeof obj !== "object") return obj;
|
|
3280
|
+
if (Array.isArray(obj)) return obj;
|
|
3281
|
+
if (!isPlainObject2(obj)) return obj;
|
|
3282
|
+
const { _, ...rest } = obj;
|
|
3283
|
+
return rest;
|
|
3284
|
+
}
|
|
3285
|
+
function sortObject(obj) {
|
|
3286
|
+
if (obj == null || typeof obj !== "object") return obj;
|
|
3287
|
+
if (Array.isArray(obj)) return obj.map(sortObject);
|
|
3288
|
+
if (!isPlainObject2(obj)) return obj;
|
|
3289
|
+
const sorted = {};
|
|
3290
|
+
const keys = Object.keys(obj).sort();
|
|
3291
|
+
for (const key of keys) {
|
|
3292
|
+
sorted[key] = sortObject(obj[key]);
|
|
3293
|
+
}
|
|
3294
|
+
return sorted;
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
// src/utils/formData.ts
|
|
3298
|
+
function appendValue(fd, key, value) {
|
|
3299
|
+
if (value == null) return;
|
|
3300
|
+
if (value instanceof File) {
|
|
3301
|
+
fd.append(key, value);
|
|
3302
|
+
} else if (value instanceof Blob) {
|
|
3303
|
+
fd.append(key, value);
|
|
3304
|
+
} else if (value instanceof Date) {
|
|
3305
|
+
fd.append(key, value.toISOString());
|
|
3306
|
+
} else if (Array.isArray(value)) {
|
|
3307
|
+
for (const item of value) {
|
|
3308
|
+
appendValue(fd, key, item);
|
|
3309
|
+
}
|
|
3310
|
+
} else if (isPlainObject2(value)) {
|
|
3311
|
+
for (const [subKey, subValue] of Object.entries(value)) {
|
|
3312
|
+
appendValue(fd, `${key}.${subKey}`, subValue);
|
|
3313
|
+
}
|
|
3314
|
+
} else {
|
|
3315
|
+
fd.append(key, String(value));
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
function getFormData(data, fieldName) {
|
|
3319
|
+
const fd = new FormData();
|
|
3320
|
+
if (data == null) return fd;
|
|
3321
|
+
if (typeof FileList !== "undefined" && data instanceof FileList) {
|
|
3322
|
+
const key = fieldName || "file";
|
|
3323
|
+
for (let i = 0; i < data.length; i++) fd.append(key, data[i]);
|
|
3324
|
+
return fd;
|
|
3325
|
+
}
|
|
3326
|
+
if (isPlainObject2(data)) {
|
|
3327
|
+
for (const [key, value] of Object.entries(data)) {
|
|
3328
|
+
appendValue(fd, key, value);
|
|
3329
|
+
}
|
|
3330
|
+
return fd;
|
|
3331
|
+
}
|
|
3332
|
+
appendValue(fd, fieldName || "file", data);
|
|
3333
|
+
return fd;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
// src/types/index.ts
|
|
3337
|
+
var CONTENT_TYPE_MAP = {
|
|
3338
|
+
json: "application/json;charset=UTF-8",
|
|
3339
|
+
form: "application/x-www-form-urlencoded"
|
|
3340
|
+
};
|
|
3341
|
+
|
|
3342
|
+
// src/core/index.ts
|
|
3343
|
+
var DEFAULT_PREVENT_CONFIG = {
|
|
3344
|
+
enabled: true,
|
|
3345
|
+
methods: ["POST", "PUT", "PATCH", "DELETE"],
|
|
3346
|
+
intervalMs: 1e3
|
|
3347
|
+
};
|
|
3348
|
+
var DEFAULT_CANCEL_CONFIG = {
|
|
3349
|
+
enabled: true,
|
|
3350
|
+
methods: ["GET"]
|
|
3351
|
+
};
|
|
3352
|
+
function defaultRetryCondition(error) {
|
|
3353
|
+
if (!error.response) {
|
|
3354
|
+
return true;
|
|
3355
|
+
}
|
|
3356
|
+
const status = error.response.status;
|
|
3357
|
+
if (status === 408 || status === 429) {
|
|
3358
|
+
return true;
|
|
3359
|
+
}
|
|
3360
|
+
if (status >= 500 && status < 600) {
|
|
3361
|
+
return true;
|
|
3362
|
+
}
|
|
3363
|
+
return false;
|
|
3364
|
+
}
|
|
3365
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
3366
|
+
enabled: true,
|
|
3367
|
+
retries: 3,
|
|
3368
|
+
retryDelay: 1e3,
|
|
3369
|
+
retryCondition: defaultRetryCondition,
|
|
3370
|
+
exponential: true,
|
|
3371
|
+
maxDelay: 3e4
|
|
3372
|
+
};
|
|
3373
|
+
function shouldApply(method, methods) {
|
|
3374
|
+
if (methods == null) return true;
|
|
3375
|
+
if (methods.length === 0) return false;
|
|
3376
|
+
return methods.includes(method?.toUpperCase() || "GET");
|
|
3377
|
+
}
|
|
3378
|
+
function calculateRetryDelay(retryConfig, retryCount) {
|
|
3379
|
+
let delay = retryConfig.retryDelay;
|
|
3380
|
+
if (retryConfig.exponential) {
|
|
3381
|
+
delay = Math.min(
|
|
3382
|
+
retryConfig.retryDelay * Math.pow(2, retryCount),
|
|
3383
|
+
retryConfig.maxDelay
|
|
3384
|
+
);
|
|
3385
|
+
}
|
|
3386
|
+
return delay;
|
|
3387
|
+
}
|
|
3388
|
+
function getDataFormat(config) {
|
|
3389
|
+
const headers = config.headers || {};
|
|
3390
|
+
const ctKey = Object.keys(headers).find((k) => k.toLowerCase() === "content-type");
|
|
3391
|
+
if (ctKey) {
|
|
3392
|
+
const ct = String(headers[ctKey]).toLowerCase();
|
|
3393
|
+
if (ct.includes("multipart/form-data")) return "file";
|
|
3394
|
+
if (ct.includes("application/x-www-form-urlencoded")) return "form";
|
|
3395
|
+
if (ct.includes("application/json") || ct.includes("+json")) return "json";
|
|
3396
|
+
}
|
|
3397
|
+
return config.contentType;
|
|
3398
|
+
}
|
|
3399
|
+
function injectDataTransform(config, format, instance) {
|
|
3400
|
+
if (config.__dataTransformInjected) return;
|
|
3401
|
+
config.__dataTransformInjected = true;
|
|
3402
|
+
const ourTransform = (data) => {
|
|
3403
|
+
if (data == null || data instanceof FormData || data instanceof URLSearchParams) return data;
|
|
3404
|
+
if (typeof data !== "object") return data;
|
|
3405
|
+
if (format === "file") return getFormData(data);
|
|
3406
|
+
return new URLSearchParams(data);
|
|
3407
|
+
};
|
|
3408
|
+
const existing = config.transformRequest;
|
|
3409
|
+
const defaults2 = instance.defaults.transformRequest;
|
|
3410
|
+
const source = existing != null ? existing : defaults2;
|
|
3411
|
+
let chain = [];
|
|
3412
|
+
if (source != null) {
|
|
3413
|
+
chain = Array.isArray(source) ? [...source] : [source];
|
|
3414
|
+
}
|
|
3415
|
+
config.transformRequest = [ourTransform, ...chain];
|
|
3416
|
+
}
|
|
3417
|
+
function isConfigSet(config) {
|
|
3418
|
+
return config != null;
|
|
3419
|
+
}
|
|
3420
|
+
function normalizePreventConfig(config, defaults2) {
|
|
3421
|
+
if (!isConfigSet(config)) {
|
|
3422
|
+
return defaults2;
|
|
3423
|
+
}
|
|
3424
|
+
if (typeof config === "boolean") {
|
|
3425
|
+
return { ...defaults2, enabled: config };
|
|
3426
|
+
}
|
|
3427
|
+
if (typeof config === "string") {
|
|
3428
|
+
return { ...defaults2, enabled: true, requestKey: config };
|
|
3429
|
+
}
|
|
3430
|
+
if (typeof config === "function") {
|
|
3431
|
+
return { ...defaults2, enabled: true, requestKey: config };
|
|
3432
|
+
}
|
|
3433
|
+
if (typeof config === "number") {
|
|
3434
|
+
return { ...defaults2, enabled: true, intervalMs: config };
|
|
3435
|
+
}
|
|
3436
|
+
if (Array.isArray(config)) {
|
|
3437
|
+
return { ...defaults2, enabled: true, methods: [...config] };
|
|
3438
|
+
}
|
|
3439
|
+
return {
|
|
3440
|
+
enabled: config.enabled ?? true,
|
|
3441
|
+
requestKey: config.requestKey ?? defaults2.requestKey,
|
|
3442
|
+
methods: config.methods != null ? config.methods : defaults2.methods,
|
|
3443
|
+
intervalMs: config.intervalMs ?? defaults2.intervalMs
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function normalizeCancelConfig(config, defaults2) {
|
|
3447
|
+
if (!isConfigSet(config)) {
|
|
3448
|
+
return defaults2;
|
|
3449
|
+
}
|
|
3450
|
+
if (typeof config === "boolean") {
|
|
3451
|
+
return { ...defaults2, enabled: config };
|
|
3452
|
+
}
|
|
3453
|
+
if (typeof config === "string") {
|
|
3454
|
+
return { ...defaults2, enabled: true, requestKey: config };
|
|
3455
|
+
}
|
|
3456
|
+
if (typeof config === "function") {
|
|
3457
|
+
return { ...defaults2, enabled: true, requestKey: config };
|
|
3458
|
+
}
|
|
3459
|
+
if (Array.isArray(config)) {
|
|
3460
|
+
return { ...defaults2, enabled: true, methods: [...config] };
|
|
3461
|
+
}
|
|
3462
|
+
return {
|
|
3463
|
+
enabled: config.enabled ?? true,
|
|
3464
|
+
requestKey: config.requestKey ?? defaults2.requestKey,
|
|
3465
|
+
methods: config.methods != null ? config.methods : defaults2.methods
|
|
3466
|
+
};
|
|
3467
|
+
}
|
|
3468
|
+
function normalizeRetryConfig(config, defaults2) {
|
|
3469
|
+
if (!isConfigSet(config)) {
|
|
3470
|
+
return defaults2;
|
|
3471
|
+
}
|
|
3472
|
+
if (typeof config === "boolean") {
|
|
3473
|
+
return { ...defaults2, enabled: config };
|
|
3474
|
+
}
|
|
3475
|
+
if (typeof config === "number") {
|
|
3476
|
+
return { ...defaults2, enabled: true, retries: config };
|
|
3477
|
+
}
|
|
3478
|
+
if (typeof config === "function") {
|
|
3479
|
+
return { ...defaults2, enabled: true, retryCondition: config };
|
|
3480
|
+
}
|
|
3481
|
+
if (Array.isArray(config)) {
|
|
3482
|
+
const codes = config;
|
|
3483
|
+
return {
|
|
3484
|
+
...defaults2,
|
|
3485
|
+
enabled: true,
|
|
3486
|
+
retryCondition: (error) => {
|
|
3487
|
+
if (!error.response) return true;
|
|
3488
|
+
return codes.includes(error.response.status);
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
}
|
|
3492
|
+
return {
|
|
3493
|
+
enabled: config.enabled ?? true,
|
|
3494
|
+
retries: config.retries ?? defaults2.retries,
|
|
3495
|
+
retryDelay: config.retryDelay ?? defaults2.retryDelay,
|
|
3496
|
+
retryCondition: config.retryCondition ?? defaults2.retryCondition,
|
|
3497
|
+
exponential: config.exponential ?? defaults2.exponential,
|
|
3498
|
+
maxDelay: config.maxDelay ?? defaults2.maxDelay,
|
|
3499
|
+
methods: config.methods != null ? config.methods : defaults2.methods
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
function getEffectiveConfig(config, instanceDefaults) {
|
|
3503
|
+
const prevent = isConfigSet(config.preventDuplicate) ? normalizePreventConfig(config.preventDuplicate, instanceDefaults.prevent) : { ...instanceDefaults.prevent };
|
|
3504
|
+
const cancel = isConfigSet(config.cancelRequest) ? normalizeCancelConfig(config.cancelRequest, instanceDefaults.cancel) : { ...instanceDefaults.cancel };
|
|
3505
|
+
return { prevent, cancel };
|
|
3506
|
+
}
|
|
3507
|
+
function getPendingKey(config) {
|
|
3508
|
+
return config.__pendingKey;
|
|
3509
|
+
}
|
|
3510
|
+
function getCancelKey(config) {
|
|
3511
|
+
return config.__cancelKey;
|
|
3512
|
+
}
|
|
3513
|
+
function cleanupRegistered(config, rm) {
|
|
3514
|
+
const pk = getPendingKey(config);
|
|
3515
|
+
const ck = getCancelKey(config);
|
|
3516
|
+
if (pk) rm.unregisterRequest(pk, "prevent");
|
|
3517
|
+
if (ck && ck !== pk) rm.unregisterRequest(ck, "cancel");
|
|
3518
|
+
}
|
|
3519
|
+
function rejectAndCleanup(config, rm, pr, reason) {
|
|
3520
|
+
const pk = getPendingKey(config);
|
|
3521
|
+
const ck = getCancelKey(config);
|
|
3522
|
+
if (pk) {
|
|
3523
|
+
const df = pr.get(pk);
|
|
3524
|
+
if (df) {
|
|
3525
|
+
df.reject(reason);
|
|
3526
|
+
pr.delete(pk);
|
|
3527
|
+
}
|
|
3528
|
+
rm.unregisterRequest(pk, "prevent");
|
|
3529
|
+
}
|
|
3530
|
+
if (ck && ck !== pk) rm.unregisterRequest(ck, "cancel");
|
|
3531
|
+
}
|
|
3532
|
+
function resolveAndCleanup(config, rm, pr, data) {
|
|
3533
|
+
const pk = getPendingKey(config);
|
|
3534
|
+
const ck = getCancelKey(config);
|
|
3535
|
+
if (pk) {
|
|
3536
|
+
const df = pr.get(pk);
|
|
3537
|
+
if (df) {
|
|
3538
|
+
df.resolve(data);
|
|
3539
|
+
pr.delete(pk);
|
|
3540
|
+
}
|
|
3541
|
+
rm.unregisterRequest(pk, "prevent");
|
|
3542
|
+
}
|
|
3543
|
+
if (ck && ck !== pk) rm.unregisterRequest(ck, "cancel");
|
|
3544
|
+
}
|
|
3545
|
+
function createEnhanceInstance(options = {}) {
|
|
3546
|
+
const instance = axios_default.create(options);
|
|
3547
|
+
const defaultPrevent = { ...DEFAULT_PREVENT_CONFIG };
|
|
3548
|
+
const defaultCancel = { ...DEFAULT_CANCEL_CONFIG };
|
|
3549
|
+
const defaultRetry = { ...DEFAULT_RETRY_CONFIG };
|
|
3550
|
+
if (isConfigSet(options.preventDuplicate)) {
|
|
3551
|
+
const normalized = normalizePreventConfig(options.preventDuplicate, DEFAULT_PREVENT_CONFIG);
|
|
3552
|
+
Object.assign(defaultPrevent, normalized);
|
|
3553
|
+
}
|
|
3554
|
+
if (isConfigSet(options.cancelRequest)) {
|
|
3555
|
+
const normalized = normalizeCancelConfig(options.cancelRequest, DEFAULT_CANCEL_CONFIG);
|
|
3556
|
+
Object.assign(defaultCancel, normalized);
|
|
3557
|
+
}
|
|
3558
|
+
if (isConfigSet(options.retry)) {
|
|
3559
|
+
const normalized = normalizeRetryConfig(options.retry, DEFAULT_RETRY_CONFIG);
|
|
3560
|
+
Object.assign(defaultRetry, normalized);
|
|
3561
|
+
}
|
|
3562
|
+
const needCacheBust = options.needCacheBust ?? true;
|
|
3563
|
+
const requestManager = new RequestManager();
|
|
3564
|
+
const pendingReturns = /* @__PURE__ */ new Map();
|
|
3565
|
+
const enhanceInstance = {
|
|
3566
|
+
requestManager,
|
|
3567
|
+
clearAll: () => {
|
|
3568
|
+
for (const [_key, deferred] of pendingReturns) {
|
|
3569
|
+
try {
|
|
3570
|
+
deferred.reject(new Error("All requests cleared"));
|
|
3571
|
+
} catch {
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
pendingReturns.clear();
|
|
3575
|
+
requestManager.clearAll();
|
|
3576
|
+
},
|
|
3577
|
+
cancelRequest: (key) => requestManager.cancelRequest(key),
|
|
3578
|
+
getRequestStatus: (key) => requestManager.getRequestStatus(key)
|
|
3579
|
+
};
|
|
3580
|
+
instance.interceptors.request.use(
|
|
3581
|
+
(config) => {
|
|
3582
|
+
const method = config.method?.toUpperCase() || "GET";
|
|
3583
|
+
const { prevent, cancel } = getEffectiveConfig(config, { prevent: defaultPrevent, cancel: defaultCancel });
|
|
3584
|
+
const headers = config.headers || {};
|
|
3585
|
+
const hasContentType = typeof headers === "object" && Object.keys(headers).some((k) => k.toLowerCase() === "content-type");
|
|
3586
|
+
if (!hasContentType) {
|
|
3587
|
+
const contentType = config.contentType;
|
|
3588
|
+
if (contentType !== "file") {
|
|
3589
|
+
config.headers = config.headers || {};
|
|
3590
|
+
const value = contentType != null ? CONTENT_TYPE_MAP[contentType] || contentType : CONTENT_TYPE_MAP.json;
|
|
3591
|
+
config.headers["Content-Type"] = value;
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
if (cancel.enabled && shouldApply(method, cancel.methods)) {
|
|
3595
|
+
const key = resolveRequestKey(config, cancel.requestKey);
|
|
3596
|
+
const existing = requestManager.getRequestStatus(key);
|
|
3597
|
+
if (existing?.config) {
|
|
3598
|
+
existing.config.__cancelKey = void 0;
|
|
3599
|
+
existing.config.__pendingKey = void 0;
|
|
3600
|
+
}
|
|
3601
|
+
requestManager.cancelRequest(key);
|
|
3602
|
+
}
|
|
3603
|
+
if (prevent.enabled && shouldApply(method, prevent.methods)) {
|
|
3604
|
+
const key = resolveRequestKey(config, prevent.requestKey);
|
|
3605
|
+
const existing = requestManager.getRequestStatus(key);
|
|
3606
|
+
if (existing) {
|
|
3607
|
+
const now = Date.now();
|
|
3608
|
+
if (now - existing.timestamp < prevent.intervalMs) {
|
|
3609
|
+
const deferred = pendingReturns.get(key);
|
|
3610
|
+
if (deferred) {
|
|
3611
|
+
const controller = new AbortController();
|
|
3612
|
+
config.signal = controller.signal;
|
|
3613
|
+
controller.abort("Request prevented by duplicate");
|
|
3614
|
+
config.__pendingKey = key;
|
|
3615
|
+
const error = new Error("Request prevented by duplicate");
|
|
3616
|
+
error.__preventReturn = true;
|
|
3617
|
+
error.__pendingPromise = deferred.promise;
|
|
3618
|
+
error.__pendingKey = key;
|
|
3619
|
+
error.config = config;
|
|
3620
|
+
return Promise.reject(error);
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
const needsPrevent = prevent.enabled && shouldApply(method, prevent.methods);
|
|
3626
|
+
const needsCancel = cancel.enabled && shouldApply(method, cancel.methods);
|
|
3627
|
+
if (needsPrevent || needsCancel) {
|
|
3628
|
+
const controller = new AbortController();
|
|
3629
|
+
config.signal = controller.signal;
|
|
3630
|
+
config.__controller = controller;
|
|
3631
|
+
if (needsCancel) {
|
|
3632
|
+
const cancelKey = resolveRequestKey(config, cancel.requestKey);
|
|
3633
|
+
config.__cancelKey = cancelKey;
|
|
3634
|
+
requestManager.registerRequest(cancelKey, "cancel", controller, Promise.resolve(), config);
|
|
3635
|
+
}
|
|
3636
|
+
if (needsPrevent) {
|
|
3637
|
+
const preventKey = resolveRequestKey(config, prevent.requestKey);
|
|
3638
|
+
config.__pendingKey = preventKey;
|
|
3639
|
+
let deferred = pendingReturns.get(preventKey);
|
|
3640
|
+
if (!deferred) {
|
|
3641
|
+
let resolveFn;
|
|
3642
|
+
let rejectFn;
|
|
3643
|
+
const promise = new Promise((resolve, reject) => {
|
|
3644
|
+
resolveFn = resolve;
|
|
3645
|
+
rejectFn = reject;
|
|
3646
|
+
});
|
|
3647
|
+
deferred = { resolve: resolveFn, reject: rejectFn, promise };
|
|
3648
|
+
pendingReturns.set(preventKey, deferred);
|
|
3649
|
+
}
|
|
3650
|
+
requestManager.registerRequest(preventKey, "prevent", controller, deferred.promise, config);
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
const format = getDataFormat(config);
|
|
3654
|
+
if (format === "file" || format === "form") {
|
|
3655
|
+
injectDataTransform(config, format, instance);
|
|
3656
|
+
}
|
|
3657
|
+
if ((config.needCacheBust ?? needCacheBust) !== false) {
|
|
3658
|
+
const stamp = Date.now().toString(36);
|
|
3659
|
+
if (config.params instanceof URLSearchParams) {
|
|
3660
|
+
config.params.append("_", stamp);
|
|
3661
|
+
} else if (typeof config.params === "object" && config.params !== null) {
|
|
3662
|
+
config.params = { ...config.params, _: stamp };
|
|
3663
|
+
} else {
|
|
3664
|
+
config.params = { _: stamp };
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
return config;
|
|
3668
|
+
},
|
|
3669
|
+
(error) => {
|
|
3670
|
+
if (error?.config) rejectAndCleanup(error.config, requestManager, pendingReturns, error);
|
|
3671
|
+
return Promise.reject(error);
|
|
3672
|
+
}
|
|
3673
|
+
);
|
|
3674
|
+
instance.interceptors.response.use(
|
|
3675
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
3676
|
+
// 成功响应处理 (2xx)
|
|
3677
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
3678
|
+
async (response) => {
|
|
3679
|
+
const config = response.config;
|
|
3680
|
+
const retryConfig = normalizeRetryConfig(config.retry, defaultRetry);
|
|
3681
|
+
if (retryConfig.enabled && shouldApply(config.method, retryConfig.methods)) {
|
|
3682
|
+
const syntheticError = new Error("Business logic error");
|
|
3683
|
+
syntheticError.config = config;
|
|
3684
|
+
syntheticError.response = response;
|
|
3685
|
+
syntheticError.isAxiosError = true;
|
|
3686
|
+
if (retryConfig.retryCondition(syntheticError)) {
|
|
3687
|
+
const retryCount = config.__retryCount || 0;
|
|
3688
|
+
if (retryCount < retryConfig.retries) {
|
|
3689
|
+
await new Promise((resolve) => setTimeout(resolve, calculateRetryDelay(retryConfig, retryCount)));
|
|
3690
|
+
cleanupRegistered(config, requestManager);
|
|
3691
|
+
config.__retryCount = retryCount + 1;
|
|
3692
|
+
return instance.request(config);
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
resolveAndCleanup(config, requestManager, pendingReturns, response);
|
|
3697
|
+
return response;
|
|
3698
|
+
},
|
|
3699
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
3700
|
+
// 错误响应处理 (非 2xx / 网络错误 / 取消 / 防重复拦截)
|
|
3701
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
3702
|
+
async (error) => {
|
|
3703
|
+
const config = error.config || error.config;
|
|
3704
|
+
if (!config) return Promise.reject(error);
|
|
3705
|
+
if (error?.__preventReturn && error?.__pendingPromise) {
|
|
3706
|
+
return error.__pendingPromise;
|
|
3707
|
+
}
|
|
3708
|
+
if (axios_default.isCancel(error)) {
|
|
3709
|
+
rejectAndCleanup(config, requestManager, pendingReturns, error);
|
|
3710
|
+
return Promise.reject(error);
|
|
3711
|
+
}
|
|
3712
|
+
const retryConfig = normalizeRetryConfig(config.retry, defaultRetry);
|
|
3713
|
+
if (retryConfig.enabled && shouldApply(config.method, retryConfig.methods)) {
|
|
3714
|
+
const retryCount = config.__retryCount || 0;
|
|
3715
|
+
const shouldRetry = retryCount < retryConfig.retries && retryConfig.retryCondition(error);
|
|
3716
|
+
if (shouldRetry) {
|
|
3717
|
+
await new Promise((resolve) => setTimeout(resolve, calculateRetryDelay(retryConfig, retryCount)));
|
|
3718
|
+
cleanupRegistered(config, requestManager);
|
|
3719
|
+
config.__retryCount = retryCount + 1;
|
|
3720
|
+
return instance.request(config);
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
rejectAndCleanup(config, requestManager, pendingReturns, error);
|
|
3724
|
+
return Promise.reject(error);
|
|
3725
|
+
}
|
|
3726
|
+
);
|
|
3727
|
+
const methods = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
|
|
3728
|
+
for (const method of methods) {
|
|
3729
|
+
instance[method.toLowerCase()] = (url, data, config) => {
|
|
3730
|
+
const finalConfig = {
|
|
3731
|
+
...config,
|
|
3732
|
+
url,
|
|
3733
|
+
method
|
|
3734
|
+
};
|
|
3735
|
+
if (["GET", "HEAD", "OPTIONS"].includes(method)) {
|
|
3736
|
+
if (data) finalConfig.params = data;
|
|
3737
|
+
} else {
|
|
3738
|
+
if (data !== void 0) finalConfig.data = data;
|
|
3739
|
+
}
|
|
3740
|
+
return instance.request(finalConfig);
|
|
3741
|
+
};
|
|
3742
|
+
}
|
|
3743
|
+
instance.enhance = enhanceInstance;
|
|
3744
|
+
return instance;
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
// src/version.ts
|
|
3748
|
+
var version = "1.0.2";
|
|
3749
|
+
return __toCommonJS(index_exports);
|
|
3750
|
+
})();
|
|
3751
|
+
//# sourceMappingURL=index.axios.global.js.map
|