@allkit/http-client 0.0.1
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 +1 -0
- package/dist/README.md +1 -0
- package/dist/adapter/base.d.ts +2 -0
- package/dist/adapter/taro.d.ts +2 -0
- package/dist/constants.d.ts +13 -0
- package/dist/core/Http.d.ts +26 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/interceptor.d.ts +17 -0
- package/dist/core/request.d.ts +73 -0
- package/dist/http-client.es.js +1864 -0
- package/dist/http-client.umd.js +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/package.json +22 -0
- package/dist/types.d.ts +69 -0
- package/dist/utils/index.d.ts +15 -0
- package/package.json +33 -0
- package/scripts/build.mjs +94 -0
- package/skill/SKILL.md +37 -0
- package/skill/examples/api.ts +50 -0
- package/skill/references/delete.md +17 -0
- package/skill/references/get.md +28 -0
- package/skill/references/patch.md +18 -0
- package/skill/references/post.md +27 -0
- package/skill/references/put.md +18 -0
- package/src/adapter/base.ts +1 -0
- package/src/adapter/taro.ts +35 -0
- package/src/constants.ts +20 -0
- package/src/core/Http.ts +82 -0
- package/src/core/config.ts +51 -0
- package/src/core/index.ts +6 -0
- package/src/core/interceptor.ts +98 -0
- package/src/core/request.ts +75 -0
- package/src/index.ts +18 -0
- package/src/types.ts +82 -0
- package/src/utils/index.ts +36 -0
- package/tsconfig.json +26 -0
- package/types/global.d.ts +16 -0
|
@@ -0,0 +1,1864 @@
|
|
|
1
|
+
var _ = Object.defineProperty, H = Object.defineProperties;
|
|
2
|
+
var g = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var w = Object.getOwnPropertySymbols;
|
|
4
|
+
var k = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var $ = (e, t, s) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, A = (e, t) => {
|
|
6
|
+
for (var s in t || (t = {}))
|
|
7
|
+
k.call(t, s) && $(e, s, t[s]);
|
|
8
|
+
if (w)
|
|
9
|
+
for (var s of w(t))
|
|
10
|
+
N.call(t, s) && $(e, s, t[s]);
|
|
11
|
+
return e;
|
|
12
|
+
}, O = (e, t) => H(e, g(t));
|
|
13
|
+
var S = (e, t, s) => $(e, typeof t != "symbol" ? t + "" : t, s);
|
|
14
|
+
var F = (e, t, s) => new Promise((r, i) => {
|
|
15
|
+
var n = (c) => {
|
|
16
|
+
try {
|
|
17
|
+
a(s.next(c));
|
|
18
|
+
} catch (f) {
|
|
19
|
+
i(f);
|
|
20
|
+
}
|
|
21
|
+
}, o = (c) => {
|
|
22
|
+
try {
|
|
23
|
+
a(s.throw(c));
|
|
24
|
+
} catch (f) {
|
|
25
|
+
i(f);
|
|
26
|
+
}
|
|
27
|
+
}, a = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(n, o);
|
|
28
|
+
a((s = s.apply(e, t)).next());
|
|
29
|
+
});
|
|
30
|
+
const EnumMethod = {
|
|
31
|
+
POST: "post"
|
|
32
|
+
};
|
|
33
|
+
var EnumContentType = /* @__PURE__ */ ((e) => (e.URL_ENCODED = "application/x-www-form-urlencoded", e.JSON = "application/json", e.FORM = "multipart/form-data", e.TEXT = "text/html", e))(EnumContentType || {});
|
|
34
|
+
function bind(e, t) {
|
|
35
|
+
return function() {
|
|
36
|
+
return e.apply(t, arguments);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const { toString: toString$1 } = Object.prototype, { getPrototypeOf } = Object, kindOf = /* @__PURE__ */ ((e) => (t) => {
|
|
40
|
+
const s = toString$1.call(t);
|
|
41
|
+
return e[s] || (e[s] = s.slice(8, -1).toLowerCase());
|
|
42
|
+
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (e) => (e = e.toLowerCase(), (t) => kindOf(t) === e), typeOfTest = (e) => (t) => typeof t === e, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
43
|
+
function isBuffer(e) {
|
|
44
|
+
return e !== null && !isUndefined(e) && e.constructor !== null && !isUndefined(e.constructor) && isFunction$1(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
45
|
+
}
|
|
46
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
47
|
+
function isArrayBufferView(e) {
|
|
48
|
+
let t;
|
|
49
|
+
return typeof ArrayBuffer != "undefined" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && isArrayBuffer(e.buffer), t;
|
|
50
|
+
}
|
|
51
|
+
const isString = typeOfTest("string"), isFunction$1 = typeOfTest("function"), isNumber = typeOfTest("number"), isObject$1 = (e) => e !== null && typeof e == "object", isBoolean = (e) => e === !0 || e === !1, isPlainObject = (e) => {
|
|
52
|
+
if (kindOf(e) !== "object")
|
|
53
|
+
return !1;
|
|
54
|
+
const t = getPrototypeOf(e);
|
|
55
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
|
|
56
|
+
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (e) => isObject$1(e) && isFunction$1(e.pipe), isFormData = (e) => {
|
|
57
|
+
let t;
|
|
58
|
+
return e && (typeof FormData == "function" && e instanceof FormData || isFunction$1(e.append) && ((t = kindOf(e)) === "formdata" || // detect form-data instance
|
|
59
|
+
t === "object" && isFunction$1(e.toString) && e.toString() === "[object FormData]"));
|
|
60
|
+
}, isURLSearchParams = kindOfTest("URLSearchParams"), trim = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
61
|
+
function forEach(e, t, { allOwnKeys: s = !1 } = {}) {
|
|
62
|
+
if (e === null || typeof e == "undefined")
|
|
63
|
+
return;
|
|
64
|
+
let r, i;
|
|
65
|
+
if (typeof e != "object" && (e = [e]), isArray(e))
|
|
66
|
+
for (r = 0, i = e.length; r < i; r++)
|
|
67
|
+
t.call(null, e[r], r, e);
|
|
68
|
+
else {
|
|
69
|
+
const n = s ? Object.getOwnPropertyNames(e) : Object.keys(e), o = n.length;
|
|
70
|
+
let a;
|
|
71
|
+
for (r = 0; r < o; r++)
|
|
72
|
+
a = n[r], t.call(null, e[a], a, e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function findKey(e, t) {
|
|
76
|
+
t = t.toLowerCase();
|
|
77
|
+
const s = Object.keys(e);
|
|
78
|
+
let r = s.length, i;
|
|
79
|
+
for (; r-- > 0; )
|
|
80
|
+
if (i = s[r], t === i.toLowerCase())
|
|
81
|
+
return i;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const _global = typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : global, isContextDefined = (e) => !isUndefined(e) && e !== _global;
|
|
85
|
+
function merge() {
|
|
86
|
+
const { caseless: e } = isContextDefined(this) && this || {}, t = {}, s = (r, i) => {
|
|
87
|
+
const n = e && findKey(t, i) || i;
|
|
88
|
+
isPlainObject(t[n]) && isPlainObject(r) ? t[n] = merge(t[n], r) : isPlainObject(r) ? t[n] = merge({}, r) : isArray(r) ? t[n] = r.slice() : t[n] = r;
|
|
89
|
+
};
|
|
90
|
+
for (let r = 0, i = arguments.length; r < i; r++)
|
|
91
|
+
arguments[r] && forEach(arguments[r], s);
|
|
92
|
+
return t;
|
|
93
|
+
}
|
|
94
|
+
const extend = (e, t, s, { allOwnKeys: r } = {}) => (forEach(t, (i, n) => {
|
|
95
|
+
s && isFunction$1(i) ? e[n] = bind(i, s) : e[n] = i;
|
|
96
|
+
}, { allOwnKeys: r }), e), stripBOM = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), inherits = (e, t, s, r) => {
|
|
97
|
+
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
98
|
+
value: t.prototype
|
|
99
|
+
}), s && Object.assign(e.prototype, s);
|
|
100
|
+
}, toFlatObject = (e, t, s, r) => {
|
|
101
|
+
let i, n, o;
|
|
102
|
+
const a = {};
|
|
103
|
+
if (t = t || {}, e == null) return t;
|
|
104
|
+
do {
|
|
105
|
+
for (i = Object.getOwnPropertyNames(e), n = i.length; n-- > 0; )
|
|
106
|
+
o = i[n], (!r || r(o, e, t)) && !a[o] && (t[o] = e[o], a[o] = !0);
|
|
107
|
+
e = s !== !1 && getPrototypeOf(e);
|
|
108
|
+
} while (e && (!s || s(e, t)) && e !== Object.prototype);
|
|
109
|
+
return t;
|
|
110
|
+
}, endsWith = (e, t, s) => {
|
|
111
|
+
e = String(e), (s === void 0 || s > e.length) && (s = e.length), s -= t.length;
|
|
112
|
+
const r = e.indexOf(t, s);
|
|
113
|
+
return r !== -1 && r === s;
|
|
114
|
+
}, toArray = (e) => {
|
|
115
|
+
if (!e) return null;
|
|
116
|
+
if (isArray(e)) return e;
|
|
117
|
+
let t = e.length;
|
|
118
|
+
if (!isNumber(t)) return null;
|
|
119
|
+
const s = new Array(t);
|
|
120
|
+
for (; t-- > 0; )
|
|
121
|
+
s[t] = e[t];
|
|
122
|
+
return s;
|
|
123
|
+
}, isTypedArray = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array != "undefined" && getPrototypeOf(Uint8Array)), forEachEntry = (e, t) => {
|
|
124
|
+
const r = (e && e[Symbol.iterator]).call(e);
|
|
125
|
+
let i;
|
|
126
|
+
for (; (i = r.next()) && !i.done; ) {
|
|
127
|
+
const n = i.value;
|
|
128
|
+
t.call(e, n[0], n[1]);
|
|
129
|
+
}
|
|
130
|
+
}, matchAll = (e, t) => {
|
|
131
|
+
let s;
|
|
132
|
+
const r = [];
|
|
133
|
+
for (; (s = e.exec(t)) !== null; )
|
|
134
|
+
r.push(s);
|
|
135
|
+
return r;
|
|
136
|
+
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (e) => e.toLowerCase().replace(
|
|
137
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
138
|
+
function(s, r, i) {
|
|
139
|
+
return r.toUpperCase() + i;
|
|
140
|
+
}
|
|
141
|
+
), hasOwnProperty = (({ hasOwnProperty: e }) => (t, s) => e.call(t, s))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (e, t) => {
|
|
142
|
+
const s = Object.getOwnPropertyDescriptors(e), r = {};
|
|
143
|
+
forEach(s, (i, n) => {
|
|
144
|
+
let o;
|
|
145
|
+
(o = t(i, n, e)) !== !1 && (r[n] = o || i);
|
|
146
|
+
}), Object.defineProperties(e, r);
|
|
147
|
+
}, freezeMethods = (e) => {
|
|
148
|
+
reduceDescriptors(e, (t, s) => {
|
|
149
|
+
if (isFunction$1(e) && ["arguments", "caller", "callee"].indexOf(s) !== -1)
|
|
150
|
+
return !1;
|
|
151
|
+
const r = e[s];
|
|
152
|
+
if (isFunction$1(r)) {
|
|
153
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
154
|
+
t.writable = !1;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
t.set || (t.set = () => {
|
|
158
|
+
throw Error("Can not rewrite read-only method '" + s + "'");
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}, toObjectSet = (e, t) => {
|
|
163
|
+
const s = {}, r = (i) => {
|
|
164
|
+
i.forEach((n) => {
|
|
165
|
+
s[n] = !0;
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
return isArray(e) ? r(e) : r(String(e).split(t)), s;
|
|
169
|
+
}, noop = () => {
|
|
170
|
+
}, toFiniteNumber = (e, t) => (e = +e, Number.isFinite(e) ? e : t), ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
|
|
171
|
+
DIGIT,
|
|
172
|
+
ALPHA,
|
|
173
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
174
|
+
}, generateString = (e = 16, t = ALPHABET.ALPHA_DIGIT) => {
|
|
175
|
+
let s = "";
|
|
176
|
+
const { length: r } = t;
|
|
177
|
+
for (; e--; )
|
|
178
|
+
s += t[Math.random() * r | 0];
|
|
179
|
+
return s;
|
|
180
|
+
};
|
|
181
|
+
function isSpecCompliantForm(e) {
|
|
182
|
+
return !!(e && isFunction$1(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
|
|
183
|
+
}
|
|
184
|
+
const toJSONObject = (e) => {
|
|
185
|
+
const t = new Array(10), s = (r, i) => {
|
|
186
|
+
if (isObject$1(r)) {
|
|
187
|
+
if (t.indexOf(r) >= 0)
|
|
188
|
+
return;
|
|
189
|
+
if (!("toJSON" in r)) {
|
|
190
|
+
t[i] = r;
|
|
191
|
+
const n = isArray(r) ? [] : {};
|
|
192
|
+
return forEach(r, (o, a) => {
|
|
193
|
+
const c = s(o, i + 1);
|
|
194
|
+
!isUndefined(c) && (n[a] = c);
|
|
195
|
+
}), t[i] = void 0, n;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return r;
|
|
199
|
+
};
|
|
200
|
+
return s(e, 0);
|
|
201
|
+
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (e) => e && (isObject$1(e) || isFunction$1(e)) && isFunction$1(e.then) && isFunction$1(e.catch), utils$1 = {
|
|
202
|
+
isArray,
|
|
203
|
+
isArrayBuffer,
|
|
204
|
+
isBuffer,
|
|
205
|
+
isFormData,
|
|
206
|
+
isArrayBufferView,
|
|
207
|
+
isString,
|
|
208
|
+
isNumber,
|
|
209
|
+
isBoolean,
|
|
210
|
+
isObject: isObject$1,
|
|
211
|
+
isPlainObject,
|
|
212
|
+
isUndefined,
|
|
213
|
+
isDate,
|
|
214
|
+
isFile,
|
|
215
|
+
isBlob,
|
|
216
|
+
isRegExp,
|
|
217
|
+
isFunction: isFunction$1,
|
|
218
|
+
isStream,
|
|
219
|
+
isURLSearchParams,
|
|
220
|
+
isTypedArray,
|
|
221
|
+
isFileList,
|
|
222
|
+
forEach,
|
|
223
|
+
merge,
|
|
224
|
+
extend,
|
|
225
|
+
trim,
|
|
226
|
+
stripBOM,
|
|
227
|
+
inherits,
|
|
228
|
+
toFlatObject,
|
|
229
|
+
kindOf,
|
|
230
|
+
kindOfTest,
|
|
231
|
+
endsWith,
|
|
232
|
+
toArray,
|
|
233
|
+
forEachEntry,
|
|
234
|
+
matchAll,
|
|
235
|
+
isHTMLForm,
|
|
236
|
+
hasOwnProperty,
|
|
237
|
+
hasOwnProp: hasOwnProperty,
|
|
238
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
239
|
+
reduceDescriptors,
|
|
240
|
+
freezeMethods,
|
|
241
|
+
toObjectSet,
|
|
242
|
+
toCamelCase,
|
|
243
|
+
noop,
|
|
244
|
+
toFiniteNumber,
|
|
245
|
+
findKey,
|
|
246
|
+
global: _global,
|
|
247
|
+
isContextDefined,
|
|
248
|
+
ALPHABET,
|
|
249
|
+
generateString,
|
|
250
|
+
isSpecCompliantForm,
|
|
251
|
+
toJSONObject,
|
|
252
|
+
isAsyncFn,
|
|
253
|
+
isThenable
|
|
254
|
+
};
|
|
255
|
+
function AxiosError$1(e, t, s, r, i) {
|
|
256
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), s && (this.config = s), r && (this.request = r), i && (this.response = i);
|
|
257
|
+
}
|
|
258
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
259
|
+
toJSON: function() {
|
|
260
|
+
return {
|
|
261
|
+
// Standard
|
|
262
|
+
message: this.message,
|
|
263
|
+
name: this.name,
|
|
264
|
+
// Microsoft
|
|
265
|
+
description: this.description,
|
|
266
|
+
number: this.number,
|
|
267
|
+
// Mozilla
|
|
268
|
+
fileName: this.fileName,
|
|
269
|
+
lineNumber: this.lineNumber,
|
|
270
|
+
columnNumber: this.columnNumber,
|
|
271
|
+
stack: this.stack,
|
|
272
|
+
// Axios
|
|
273
|
+
config: utils$1.toJSONObject(this.config),
|
|
274
|
+
code: this.code,
|
|
275
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
const prototype$1 = AxiosError$1.prototype, descriptors = {};
|
|
280
|
+
[
|
|
281
|
+
"ERR_BAD_OPTION_VALUE",
|
|
282
|
+
"ERR_BAD_OPTION",
|
|
283
|
+
"ECONNABORTED",
|
|
284
|
+
"ETIMEDOUT",
|
|
285
|
+
"ERR_NETWORK",
|
|
286
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
287
|
+
"ERR_DEPRECATED",
|
|
288
|
+
"ERR_BAD_RESPONSE",
|
|
289
|
+
"ERR_BAD_REQUEST",
|
|
290
|
+
"ERR_CANCELED",
|
|
291
|
+
"ERR_NOT_SUPPORT",
|
|
292
|
+
"ERR_INVALID_URL"
|
|
293
|
+
// eslint-disable-next-line func-names
|
|
294
|
+
].forEach((e) => {
|
|
295
|
+
descriptors[e] = { value: e };
|
|
296
|
+
});
|
|
297
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
298
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
299
|
+
AxiosError$1.from = (e, t, s, r, i, n) => {
|
|
300
|
+
const o = Object.create(prototype$1);
|
|
301
|
+
return utils$1.toFlatObject(e, o, function(c) {
|
|
302
|
+
return c !== Error.prototype;
|
|
303
|
+
}, (a) => a !== "isAxiosError"), AxiosError$1.call(o, e.message, t, s, r, i), o.cause = e, o.name = e.name, n && Object.assign(o, n), o;
|
|
304
|
+
};
|
|
305
|
+
const httpAdapter = null;
|
|
306
|
+
function isVisitable(e) {
|
|
307
|
+
return utils$1.isPlainObject(e) || utils$1.isArray(e);
|
|
308
|
+
}
|
|
309
|
+
function removeBrackets(e) {
|
|
310
|
+
return utils$1.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
311
|
+
}
|
|
312
|
+
function renderKey(e, t, s) {
|
|
313
|
+
return e ? e.concat(t).map(function(i, n) {
|
|
314
|
+
return i = removeBrackets(i), !s && n ? "[" + i + "]" : i;
|
|
315
|
+
}).join(s ? "." : "") : t;
|
|
316
|
+
}
|
|
317
|
+
function isFlatArray(e) {
|
|
318
|
+
return utils$1.isArray(e) && !e.some(isVisitable);
|
|
319
|
+
}
|
|
320
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function(t) {
|
|
321
|
+
return /^is[A-Z]/.test(t);
|
|
322
|
+
});
|
|
323
|
+
function toFormData$1(e, t, s) {
|
|
324
|
+
if (!utils$1.isObject(e))
|
|
325
|
+
throw new TypeError("target must be an object");
|
|
326
|
+
t = t || new FormData(), s = utils$1.toFlatObject(s, {
|
|
327
|
+
metaTokens: !0,
|
|
328
|
+
dots: !1,
|
|
329
|
+
indexes: !1
|
|
330
|
+
}, !1, function(p, m) {
|
|
331
|
+
return !utils$1.isUndefined(m[p]);
|
|
332
|
+
});
|
|
333
|
+
const r = s.metaTokens, i = s.visitor || l, n = s.dots, o = s.indexes, c = (s.Blob || typeof Blob != "undefined" && Blob) && utils$1.isSpecCompliantForm(t);
|
|
334
|
+
if (!utils$1.isFunction(i))
|
|
335
|
+
throw new TypeError("visitor must be a function");
|
|
336
|
+
function f(d) {
|
|
337
|
+
if (d === null) return "";
|
|
338
|
+
if (utils$1.isDate(d))
|
|
339
|
+
return d.toISOString();
|
|
340
|
+
if (!c && utils$1.isBlob(d))
|
|
341
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
342
|
+
return utils$1.isArrayBuffer(d) || utils$1.isTypedArray(d) ? c && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
|
|
343
|
+
}
|
|
344
|
+
function l(d, p, m) {
|
|
345
|
+
let E = d;
|
|
346
|
+
if (d && !m && typeof d == "object") {
|
|
347
|
+
if (utils$1.endsWith(p, "{}"))
|
|
348
|
+
p = r ? p : p.slice(0, -2), d = JSON.stringify(d);
|
|
349
|
+
else if (utils$1.isArray(d) && isFlatArray(d) || (utils$1.isFileList(d) || utils$1.endsWith(p, "[]")) && (E = utils$1.toArray(d)))
|
|
350
|
+
return p = removeBrackets(p), E.forEach(function(R, T) {
|
|
351
|
+
!(utils$1.isUndefined(R) || R === null) && t.append(
|
|
352
|
+
// eslint-disable-next-line no-nested-ternary
|
|
353
|
+
o === !0 ? renderKey([p], T, n) : o === null ? p : p + "[]",
|
|
354
|
+
f(R)
|
|
355
|
+
);
|
|
356
|
+
}), !1;
|
|
357
|
+
}
|
|
358
|
+
return isVisitable(d) ? !0 : (t.append(renderKey(m, p, n), f(d)), !1);
|
|
359
|
+
}
|
|
360
|
+
const u = [], h = Object.assign(predicates, {
|
|
361
|
+
defaultVisitor: l,
|
|
362
|
+
convertValue: f,
|
|
363
|
+
isVisitable
|
|
364
|
+
});
|
|
365
|
+
function y(d, p) {
|
|
366
|
+
if (!utils$1.isUndefined(d)) {
|
|
367
|
+
if (u.indexOf(d) !== -1)
|
|
368
|
+
throw Error("Circular reference detected in " + p.join("."));
|
|
369
|
+
u.push(d), utils$1.forEach(d, function(E, x) {
|
|
370
|
+
(!(utils$1.isUndefined(E) || E === null) && i.call(
|
|
371
|
+
t,
|
|
372
|
+
E,
|
|
373
|
+
utils$1.isString(x) ? x.trim() : x,
|
|
374
|
+
p,
|
|
375
|
+
h
|
|
376
|
+
)) === !0 && y(E, p ? p.concat(x) : [x]);
|
|
377
|
+
}), u.pop();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (!utils$1.isObject(e))
|
|
381
|
+
throw new TypeError("data must be an object");
|
|
382
|
+
return y(e), t;
|
|
383
|
+
}
|
|
384
|
+
function encode$1(e) {
|
|
385
|
+
const t = {
|
|
386
|
+
"!": "%21",
|
|
387
|
+
"'": "%27",
|
|
388
|
+
"(": "%28",
|
|
389
|
+
")": "%29",
|
|
390
|
+
"~": "%7E",
|
|
391
|
+
"%20": "+",
|
|
392
|
+
"%00": "\0"
|
|
393
|
+
};
|
|
394
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
395
|
+
return t[r];
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function AxiosURLSearchParams(e, t) {
|
|
399
|
+
this._pairs = [], e && toFormData$1(e, this, t);
|
|
400
|
+
}
|
|
401
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
402
|
+
prototype.append = function(t, s) {
|
|
403
|
+
this._pairs.push([t, s]);
|
|
404
|
+
};
|
|
405
|
+
prototype.toString = function(t) {
|
|
406
|
+
const s = t ? function(r) {
|
|
407
|
+
return t.call(this, r, encode$1);
|
|
408
|
+
} : encode$1;
|
|
409
|
+
return this._pairs.map(function(i) {
|
|
410
|
+
return s(i[0]) + "=" + s(i[1]);
|
|
411
|
+
}, "").join("&");
|
|
412
|
+
};
|
|
413
|
+
function encode(e) {
|
|
414
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
415
|
+
}
|
|
416
|
+
function buildURL(e, t, s) {
|
|
417
|
+
if (!t)
|
|
418
|
+
return e;
|
|
419
|
+
const r = s && s.encode || encode, i = s && s.serialize;
|
|
420
|
+
let n;
|
|
421
|
+
if (i ? n = i(t, s) : n = utils$1.isURLSearchParams(t) ? t.toString() : new AxiosURLSearchParams(t, s).toString(r), n) {
|
|
422
|
+
const o = e.indexOf("#");
|
|
423
|
+
o !== -1 && (e = e.slice(0, o)), e += (e.indexOf("?") === -1 ? "?" : "&") + n;
|
|
424
|
+
}
|
|
425
|
+
return e;
|
|
426
|
+
}
|
|
427
|
+
class InterceptorManager {
|
|
428
|
+
constructor() {
|
|
429
|
+
this.handlers = [];
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Add a new interceptor to the stack
|
|
433
|
+
*
|
|
434
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
435
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
436
|
+
*
|
|
437
|
+
* @return {Number} An ID used to remove interceptor later
|
|
438
|
+
*/
|
|
439
|
+
use(t, s, r) {
|
|
440
|
+
return this.handlers.push({
|
|
441
|
+
fulfilled: t,
|
|
442
|
+
rejected: s,
|
|
443
|
+
synchronous: r ? r.synchronous : !1,
|
|
444
|
+
runWhen: r ? r.runWhen : null
|
|
445
|
+
}), this.handlers.length - 1;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Remove an interceptor from the stack
|
|
449
|
+
*
|
|
450
|
+
* @param {Number} id The ID that was returned by `use`
|
|
451
|
+
*
|
|
452
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
453
|
+
*/
|
|
454
|
+
eject(t) {
|
|
455
|
+
this.handlers[t] && (this.handlers[t] = null);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Clear all interceptors from the stack
|
|
459
|
+
*
|
|
460
|
+
* @returns {void}
|
|
461
|
+
*/
|
|
462
|
+
clear() {
|
|
463
|
+
this.handlers && (this.handlers = []);
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Iterate over all the registered interceptors
|
|
467
|
+
*
|
|
468
|
+
* This method is particularly useful for skipping over any
|
|
469
|
+
* interceptors that may have become `null` calling `eject`.
|
|
470
|
+
*
|
|
471
|
+
* @param {Function} fn The function to call for each interceptor
|
|
472
|
+
*
|
|
473
|
+
* @returns {void}
|
|
474
|
+
*/
|
|
475
|
+
forEach(t) {
|
|
476
|
+
utils$1.forEach(this.handlers, function(r) {
|
|
477
|
+
r !== null && t(r);
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
const transitionalDefaults = {
|
|
482
|
+
silentJSONParsing: !0,
|
|
483
|
+
forcedJSONParsing: !0,
|
|
484
|
+
clarifyTimeoutError: !1
|
|
485
|
+
}, URLSearchParams$1 = typeof URLSearchParams != "undefined" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData != "undefined" ? FormData : null, Blob$1 = typeof Blob != "undefined" ? Blob : null, platform$1 = {
|
|
486
|
+
isBrowser: !0,
|
|
487
|
+
classes: {
|
|
488
|
+
URLSearchParams: URLSearchParams$1,
|
|
489
|
+
FormData: FormData$1,
|
|
490
|
+
Blob: Blob$1
|
|
491
|
+
},
|
|
492
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
493
|
+
}, hasBrowserEnv = typeof window != "undefined" && typeof document != "undefined", hasStandardBrowserEnv = ((e) => hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(e) < 0)(typeof navigator != "undefined" && navigator.product), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope != "undefined" && // eslint-disable-next-line no-undef
|
|
494
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
495
|
+
__proto__: null,
|
|
496
|
+
hasBrowserEnv,
|
|
497
|
+
hasStandardBrowserEnv,
|
|
498
|
+
hasStandardBrowserWebWorkerEnv
|
|
499
|
+
}, Symbol.toStringTag, { value: "Module" })), platform = A(A({}, utils), platform$1);
|
|
500
|
+
function toURLEncodedForm(e, t) {
|
|
501
|
+
return toFormData$1(e, new platform.classes.URLSearchParams(), Object.assign({
|
|
502
|
+
visitor: function(s, r, i, n) {
|
|
503
|
+
return platform.isNode && utils$1.isBuffer(s) ? (this.append(r, s.toString("base64")), !1) : n.defaultVisitor.apply(this, arguments);
|
|
504
|
+
}
|
|
505
|
+
}, t));
|
|
506
|
+
}
|
|
507
|
+
function parsePropPath(e) {
|
|
508
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
509
|
+
}
|
|
510
|
+
function arrayToObject(e) {
|
|
511
|
+
const t = {}, s = Object.keys(e);
|
|
512
|
+
let r;
|
|
513
|
+
const i = s.length;
|
|
514
|
+
let n;
|
|
515
|
+
for (r = 0; r < i; r++)
|
|
516
|
+
n = s[r], t[n] = e[n];
|
|
517
|
+
return t;
|
|
518
|
+
}
|
|
519
|
+
function formDataToJSON(e) {
|
|
520
|
+
function t(s, r, i, n) {
|
|
521
|
+
let o = s[n++];
|
|
522
|
+
if (o === "__proto__") return !0;
|
|
523
|
+
const a = Number.isFinite(+o), c = n >= s.length;
|
|
524
|
+
return o = !o && utils$1.isArray(i) ? i.length : o, c ? (utils$1.hasOwnProp(i, o) ? i[o] = [i[o], r] : i[o] = r, !a) : ((!i[o] || !utils$1.isObject(i[o])) && (i[o] = []), t(s, r, i[o], n) && utils$1.isArray(i[o]) && (i[o] = arrayToObject(i[o])), !a);
|
|
525
|
+
}
|
|
526
|
+
if (utils$1.isFormData(e) && utils$1.isFunction(e.entries)) {
|
|
527
|
+
const s = {};
|
|
528
|
+
return utils$1.forEachEntry(e, (r, i) => {
|
|
529
|
+
t(parsePropPath(r), i, s, 0);
|
|
530
|
+
}), s;
|
|
531
|
+
}
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
function stringifySafely(e, t, s) {
|
|
535
|
+
if (utils$1.isString(e))
|
|
536
|
+
try {
|
|
537
|
+
return (t || JSON.parse)(e), utils$1.trim(e);
|
|
538
|
+
} catch (r) {
|
|
539
|
+
if (r.name !== "SyntaxError")
|
|
540
|
+
throw r;
|
|
541
|
+
}
|
|
542
|
+
return (s || JSON.stringify)(e);
|
|
543
|
+
}
|
|
544
|
+
const defaults = {
|
|
545
|
+
transitional: transitionalDefaults,
|
|
546
|
+
adapter: ["xhr", "http"],
|
|
547
|
+
transformRequest: [function(t, s) {
|
|
548
|
+
const r = s.getContentType() || "", i = r.indexOf("application/json") > -1, n = utils$1.isObject(t);
|
|
549
|
+
if (n && utils$1.isHTMLForm(t) && (t = new FormData(t)), utils$1.isFormData(t))
|
|
550
|
+
return i ? JSON.stringify(formDataToJSON(t)) : t;
|
|
551
|
+
if (utils$1.isArrayBuffer(t) || utils$1.isBuffer(t) || utils$1.isStream(t) || utils$1.isFile(t) || utils$1.isBlob(t))
|
|
552
|
+
return t;
|
|
553
|
+
if (utils$1.isArrayBufferView(t))
|
|
554
|
+
return t.buffer;
|
|
555
|
+
if (utils$1.isURLSearchParams(t))
|
|
556
|
+
return s.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
|
|
557
|
+
let a;
|
|
558
|
+
if (n) {
|
|
559
|
+
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
560
|
+
return toURLEncodedForm(t, this.formSerializer).toString();
|
|
561
|
+
if ((a = utils$1.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
|
|
562
|
+
const c = this.env && this.env.FormData;
|
|
563
|
+
return toFormData$1(
|
|
564
|
+
a ? { "files[]": t } : t,
|
|
565
|
+
c && new c(),
|
|
566
|
+
this.formSerializer
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return n || i ? (s.setContentType("application/json", !1), stringifySafely(t)) : t;
|
|
571
|
+
}],
|
|
572
|
+
transformResponse: [function(t) {
|
|
573
|
+
const s = this.transitional || defaults.transitional, r = s && s.forcedJSONParsing, i = this.responseType === "json";
|
|
574
|
+
if (t && utils$1.isString(t) && (r && !this.responseType || i)) {
|
|
575
|
+
const o = !(s && s.silentJSONParsing) && i;
|
|
576
|
+
try {
|
|
577
|
+
return JSON.parse(t);
|
|
578
|
+
} catch (a) {
|
|
579
|
+
if (o)
|
|
580
|
+
throw a.name === "SyntaxError" ? AxiosError$1.from(a, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response) : a;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return t;
|
|
584
|
+
}],
|
|
585
|
+
/**
|
|
586
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
587
|
+
* timeout is not created.
|
|
588
|
+
*/
|
|
589
|
+
timeout: 0,
|
|
590
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
591
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
592
|
+
maxContentLength: -1,
|
|
593
|
+
maxBodyLength: -1,
|
|
594
|
+
env: {
|
|
595
|
+
FormData: platform.classes.FormData,
|
|
596
|
+
Blob: platform.classes.Blob
|
|
597
|
+
},
|
|
598
|
+
validateStatus: function(t) {
|
|
599
|
+
return t >= 200 && t < 300;
|
|
600
|
+
},
|
|
601
|
+
headers: {
|
|
602
|
+
common: {
|
|
603
|
+
Accept: "application/json, text/plain, */*",
|
|
604
|
+
"Content-Type": void 0
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
609
|
+
defaults.headers[e] = {};
|
|
610
|
+
});
|
|
611
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
612
|
+
"age",
|
|
613
|
+
"authorization",
|
|
614
|
+
"content-length",
|
|
615
|
+
"content-type",
|
|
616
|
+
"etag",
|
|
617
|
+
"expires",
|
|
618
|
+
"from",
|
|
619
|
+
"host",
|
|
620
|
+
"if-modified-since",
|
|
621
|
+
"if-unmodified-since",
|
|
622
|
+
"last-modified",
|
|
623
|
+
"location",
|
|
624
|
+
"max-forwards",
|
|
625
|
+
"proxy-authorization",
|
|
626
|
+
"referer",
|
|
627
|
+
"retry-after",
|
|
628
|
+
"user-agent"
|
|
629
|
+
]), parseHeaders$1 = (e) => {
|
|
630
|
+
const t = {};
|
|
631
|
+
let s, r, i;
|
|
632
|
+
return e && e.split(`
|
|
633
|
+
`).forEach(function(o) {
|
|
634
|
+
i = o.indexOf(":"), s = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!s || t[s] && ignoreDuplicateOf[s]) && (s === "set-cookie" ? t[s] ? t[s].push(r) : t[s] = [r] : t[s] = t[s] ? t[s] + ", " + r : r);
|
|
635
|
+
}), t;
|
|
636
|
+
}, $internals = /* @__PURE__ */ Symbol("internals");
|
|
637
|
+
function normalizeHeader(e) {
|
|
638
|
+
return e && String(e).trim().toLowerCase();
|
|
639
|
+
}
|
|
640
|
+
function normalizeValue(e) {
|
|
641
|
+
return e === !1 || e == null ? e : utils$1.isArray(e) ? e.map(normalizeValue) : String(e);
|
|
642
|
+
}
|
|
643
|
+
function parseTokens(e) {
|
|
644
|
+
const t = /* @__PURE__ */ Object.create(null), s = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
645
|
+
let r;
|
|
646
|
+
for (; r = s.exec(e); )
|
|
647
|
+
t[r[1]] = r[2];
|
|
648
|
+
return t;
|
|
649
|
+
}
|
|
650
|
+
const isValidHeaderName = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
651
|
+
function matchHeaderValue(e, t, s, r, i) {
|
|
652
|
+
if (utils$1.isFunction(r))
|
|
653
|
+
return r.call(this, t, s);
|
|
654
|
+
if (i && (t = s), !!utils$1.isString(t)) {
|
|
655
|
+
if (utils$1.isString(r))
|
|
656
|
+
return t.indexOf(r) !== -1;
|
|
657
|
+
if (utils$1.isRegExp(r))
|
|
658
|
+
return r.test(t);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
function formatHeader(e) {
|
|
662
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, s, r) => s.toUpperCase() + r);
|
|
663
|
+
}
|
|
664
|
+
function buildAccessors(e, t) {
|
|
665
|
+
const s = utils$1.toCamelCase(" " + t);
|
|
666
|
+
["get", "set", "has"].forEach((r) => {
|
|
667
|
+
Object.defineProperty(e, r + s, {
|
|
668
|
+
value: function(i, n, o) {
|
|
669
|
+
return this[r].call(this, t, i, n, o);
|
|
670
|
+
},
|
|
671
|
+
configurable: !0
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
let AxiosHeaders$1 = class {
|
|
676
|
+
constructor(t) {
|
|
677
|
+
t && this.set(t);
|
|
678
|
+
}
|
|
679
|
+
set(t, s, r) {
|
|
680
|
+
const i = this;
|
|
681
|
+
function n(a, c, f) {
|
|
682
|
+
const l = normalizeHeader(c);
|
|
683
|
+
if (!l)
|
|
684
|
+
throw new Error("header name must be a non-empty string");
|
|
685
|
+
const u = utils$1.findKey(i, l);
|
|
686
|
+
(!u || i[u] === void 0 || f === !0 || f === void 0 && i[u] !== !1) && (i[u || c] = normalizeValue(a));
|
|
687
|
+
}
|
|
688
|
+
const o = (a, c) => utils$1.forEach(a, (f, l) => n(f, l, c));
|
|
689
|
+
return utils$1.isPlainObject(t) || t instanceof this.constructor ? o(t, s) : utils$1.isString(t) && (t = t.trim()) && !isValidHeaderName(t) ? o(parseHeaders$1(t), s) : t != null && n(s, t, r), this;
|
|
690
|
+
}
|
|
691
|
+
get(t, s) {
|
|
692
|
+
if (t = normalizeHeader(t), t) {
|
|
693
|
+
const r = utils$1.findKey(this, t);
|
|
694
|
+
if (r) {
|
|
695
|
+
const i = this[r];
|
|
696
|
+
if (!s)
|
|
697
|
+
return i;
|
|
698
|
+
if (s === !0)
|
|
699
|
+
return parseTokens(i);
|
|
700
|
+
if (utils$1.isFunction(s))
|
|
701
|
+
return s.call(this, i, r);
|
|
702
|
+
if (utils$1.isRegExp(s))
|
|
703
|
+
return s.exec(i);
|
|
704
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
has(t, s) {
|
|
709
|
+
if (t = normalizeHeader(t), t) {
|
|
710
|
+
const r = utils$1.findKey(this, t);
|
|
711
|
+
return !!(r && this[r] !== void 0 && (!s || matchHeaderValue(this, this[r], r, s)));
|
|
712
|
+
}
|
|
713
|
+
return !1;
|
|
714
|
+
}
|
|
715
|
+
delete(t, s) {
|
|
716
|
+
const r = this;
|
|
717
|
+
let i = !1;
|
|
718
|
+
function n(o) {
|
|
719
|
+
if (o = normalizeHeader(o), o) {
|
|
720
|
+
const a = utils$1.findKey(r, o);
|
|
721
|
+
a && (!s || matchHeaderValue(r, r[a], a, s)) && (delete r[a], i = !0);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return utils$1.isArray(t) ? t.forEach(n) : n(t), i;
|
|
725
|
+
}
|
|
726
|
+
clear(t) {
|
|
727
|
+
const s = Object.keys(this);
|
|
728
|
+
let r = s.length, i = !1;
|
|
729
|
+
for (; r--; ) {
|
|
730
|
+
const n = s[r];
|
|
731
|
+
(!t || matchHeaderValue(this, this[n], n, t, !0)) && (delete this[n], i = !0);
|
|
732
|
+
}
|
|
733
|
+
return i;
|
|
734
|
+
}
|
|
735
|
+
normalize(t) {
|
|
736
|
+
const s = this, r = {};
|
|
737
|
+
return utils$1.forEach(this, (i, n) => {
|
|
738
|
+
const o = utils$1.findKey(r, n);
|
|
739
|
+
if (o) {
|
|
740
|
+
s[o] = normalizeValue(i), delete s[n];
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
const a = t ? formatHeader(n) : String(n).trim();
|
|
744
|
+
a !== n && delete s[n], s[a] = normalizeValue(i), r[a] = !0;
|
|
745
|
+
}), this;
|
|
746
|
+
}
|
|
747
|
+
concat(...t) {
|
|
748
|
+
return this.constructor.concat(this, ...t);
|
|
749
|
+
}
|
|
750
|
+
toJSON(t) {
|
|
751
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
752
|
+
return utils$1.forEach(this, (r, i) => {
|
|
753
|
+
r != null && r !== !1 && (s[i] = t && utils$1.isArray(r) ? r.join(", ") : r);
|
|
754
|
+
}), s;
|
|
755
|
+
}
|
|
756
|
+
[Symbol.iterator]() {
|
|
757
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
758
|
+
}
|
|
759
|
+
toString() {
|
|
760
|
+
return Object.entries(this.toJSON()).map(([t, s]) => t + ": " + s).join(`
|
|
761
|
+
`);
|
|
762
|
+
}
|
|
763
|
+
get [Symbol.toStringTag]() {
|
|
764
|
+
return "AxiosHeaders";
|
|
765
|
+
}
|
|
766
|
+
static from(t) {
|
|
767
|
+
return t instanceof this ? t : new this(t);
|
|
768
|
+
}
|
|
769
|
+
static concat(t, ...s) {
|
|
770
|
+
const r = new this(t);
|
|
771
|
+
return s.forEach((i) => r.set(i)), r;
|
|
772
|
+
}
|
|
773
|
+
static accessor(t) {
|
|
774
|
+
const r = (this[$internals] = this[$internals] = {
|
|
775
|
+
accessors: {}
|
|
776
|
+
}).accessors, i = this.prototype;
|
|
777
|
+
function n(o) {
|
|
778
|
+
const a = normalizeHeader(o);
|
|
779
|
+
r[a] || (buildAccessors(i, o), r[a] = !0);
|
|
780
|
+
}
|
|
781
|
+
return utils$1.isArray(t) ? t.forEach(n) : n(t), this;
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
785
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: e }, t) => {
|
|
786
|
+
let s = t[0].toUpperCase() + t.slice(1);
|
|
787
|
+
return {
|
|
788
|
+
get: () => e,
|
|
789
|
+
set(r) {
|
|
790
|
+
this[s] = r;
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
});
|
|
794
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
795
|
+
function transformData(e, t) {
|
|
796
|
+
const s = this || defaults, r = t || s, i = AxiosHeaders$1.from(r.headers);
|
|
797
|
+
let n = r.data;
|
|
798
|
+
return utils$1.forEach(e, function(a) {
|
|
799
|
+
n = a.call(s, n, i.normalize(), t ? t.status : void 0);
|
|
800
|
+
}), i.normalize(), n;
|
|
801
|
+
}
|
|
802
|
+
function isCancel$1(e) {
|
|
803
|
+
return !!(e && e.__CANCEL__);
|
|
804
|
+
}
|
|
805
|
+
function CanceledError$1(e, t, s) {
|
|
806
|
+
AxiosError$1.call(this, e == null ? "canceled" : e, AxiosError$1.ERR_CANCELED, t, s), this.name = "CanceledError";
|
|
807
|
+
}
|
|
808
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
809
|
+
__CANCEL__: !0
|
|
810
|
+
});
|
|
811
|
+
function settle(e, t, s) {
|
|
812
|
+
const r = s.config.validateStatus;
|
|
813
|
+
!s.status || !r || r(s.status) ? e(s) : t(new AxiosError$1(
|
|
814
|
+
"Request failed with status code " + s.status,
|
|
815
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(s.status / 100) - 4],
|
|
816
|
+
s.config,
|
|
817
|
+
s.request,
|
|
818
|
+
s
|
|
819
|
+
));
|
|
820
|
+
}
|
|
821
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
822
|
+
// Standard browser envs support document.cookie
|
|
823
|
+
{
|
|
824
|
+
write(e, t, s, r, i, n) {
|
|
825
|
+
const o = [e + "=" + encodeURIComponent(t)];
|
|
826
|
+
utils$1.isNumber(s) && o.push("expires=" + new Date(s).toGMTString()), utils$1.isString(r) && o.push("path=" + r), utils$1.isString(i) && o.push("domain=" + i), n === !0 && o.push("secure"), document.cookie = o.join("; ");
|
|
827
|
+
},
|
|
828
|
+
read(e) {
|
|
829
|
+
const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
|
|
830
|
+
return t ? decodeURIComponent(t[3]) : null;
|
|
831
|
+
},
|
|
832
|
+
remove(e) {
|
|
833
|
+
this.write(e, "", Date.now() - 864e5);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
) : (
|
|
837
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
838
|
+
{
|
|
839
|
+
write() {
|
|
840
|
+
},
|
|
841
|
+
read() {
|
|
842
|
+
return null;
|
|
843
|
+
},
|
|
844
|
+
remove() {
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
);
|
|
848
|
+
function isAbsoluteURL(e) {
|
|
849
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
850
|
+
}
|
|
851
|
+
function combineURLs(e, t) {
|
|
852
|
+
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
853
|
+
}
|
|
854
|
+
function buildFullPath(e, t) {
|
|
855
|
+
return e && !isAbsoluteURL(t) ? combineURLs(e, t) : t;
|
|
856
|
+
}
|
|
857
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
|
|
858
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
859
|
+
// whether the request URL is of the same origin as current location.
|
|
860
|
+
(function() {
|
|
861
|
+
const t = /(msie|trident)/i.test(navigator.userAgent), s = document.createElement("a");
|
|
862
|
+
let r;
|
|
863
|
+
function i(n) {
|
|
864
|
+
let o = n;
|
|
865
|
+
return t && (s.setAttribute("href", o), o = s.href), s.setAttribute("href", o), {
|
|
866
|
+
href: s.href,
|
|
867
|
+
protocol: s.protocol ? s.protocol.replace(/:$/, "") : "",
|
|
868
|
+
host: s.host,
|
|
869
|
+
search: s.search ? s.search.replace(/^\?/, "") : "",
|
|
870
|
+
hash: s.hash ? s.hash.replace(/^#/, "") : "",
|
|
871
|
+
hostname: s.hostname,
|
|
872
|
+
port: s.port,
|
|
873
|
+
pathname: s.pathname.charAt(0) === "/" ? s.pathname : "/" + s.pathname
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
return r = i(window.location.href), function(o) {
|
|
877
|
+
const a = utils$1.isString(o) ? i(o) : o;
|
|
878
|
+
return a.protocol === r.protocol && a.host === r.host;
|
|
879
|
+
};
|
|
880
|
+
})()
|
|
881
|
+
) : (
|
|
882
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
883
|
+
/* @__PURE__ */ (function() {
|
|
884
|
+
return function() {
|
|
885
|
+
return !0;
|
|
886
|
+
};
|
|
887
|
+
})()
|
|
888
|
+
);
|
|
889
|
+
function parseProtocol(e) {
|
|
890
|
+
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
891
|
+
return t && t[1] || "";
|
|
892
|
+
}
|
|
893
|
+
function speedometer(e, t) {
|
|
894
|
+
e = e || 10;
|
|
895
|
+
const s = new Array(e), r = new Array(e);
|
|
896
|
+
let i = 0, n = 0, o;
|
|
897
|
+
return t = t !== void 0 ? t : 1e3, function(c) {
|
|
898
|
+
const f = Date.now(), l = r[n];
|
|
899
|
+
o || (o = f), s[i] = c, r[i] = f;
|
|
900
|
+
let u = n, h = 0;
|
|
901
|
+
for (; u !== i; )
|
|
902
|
+
h += s[u++], u = u % e;
|
|
903
|
+
if (i = (i + 1) % e, i === n && (n = (n + 1) % e), f - o < t)
|
|
904
|
+
return;
|
|
905
|
+
const y = l && f - l;
|
|
906
|
+
return y ? Math.round(h * 1e3 / y) : void 0;
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
function progressEventReducer(e, t) {
|
|
910
|
+
let s = 0;
|
|
911
|
+
const r = speedometer(50, 250);
|
|
912
|
+
return (i) => {
|
|
913
|
+
const n = i.loaded, o = i.lengthComputable ? i.total : void 0, a = n - s, c = r(a), f = n <= o;
|
|
914
|
+
s = n;
|
|
915
|
+
const l = {
|
|
916
|
+
loaded: n,
|
|
917
|
+
total: o,
|
|
918
|
+
progress: o ? n / o : void 0,
|
|
919
|
+
bytes: a,
|
|
920
|
+
rate: c || void 0,
|
|
921
|
+
estimated: c && o && f ? (o - n) / c : void 0,
|
|
922
|
+
event: i
|
|
923
|
+
};
|
|
924
|
+
l[t ? "download" : "upload"] = !0, e(l);
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest != "undefined", xhrAdapter = isXHRAdapterSupported && function(e) {
|
|
928
|
+
return new Promise(function(s, r) {
|
|
929
|
+
let i = e.data;
|
|
930
|
+
const n = AxiosHeaders$1.from(e.headers).normalize();
|
|
931
|
+
let { responseType: o, withXSRFToken: a } = e, c;
|
|
932
|
+
function f() {
|
|
933
|
+
e.cancelToken && e.cancelToken.unsubscribe(c), e.signal && e.signal.removeEventListener("abort", c);
|
|
934
|
+
}
|
|
935
|
+
let l;
|
|
936
|
+
if (utils$1.isFormData(i)) {
|
|
937
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
|
|
938
|
+
n.setContentType(!1);
|
|
939
|
+
else if ((l = n.getContentType()) !== !1) {
|
|
940
|
+
const [p, ...m] = l ? l.split(";").map((E) => E.trim()).filter(Boolean) : [];
|
|
941
|
+
n.setContentType([p || "multipart/form-data", ...m].join("; "));
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
let u = new XMLHttpRequest();
|
|
945
|
+
if (e.auth) {
|
|
946
|
+
const p = e.auth.username || "", m = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
|
|
947
|
+
n.set("Authorization", "Basic " + btoa(p + ":" + m));
|
|
948
|
+
}
|
|
949
|
+
const h = buildFullPath(e.baseURL, e.url);
|
|
950
|
+
u.open(e.method.toUpperCase(), buildURL(h, e.params, e.paramsSerializer), !0), u.timeout = e.timeout;
|
|
951
|
+
function y() {
|
|
952
|
+
if (!u)
|
|
953
|
+
return;
|
|
954
|
+
const p = AxiosHeaders$1.from(
|
|
955
|
+
"getAllResponseHeaders" in u && u.getAllResponseHeaders()
|
|
956
|
+
), E = {
|
|
957
|
+
data: !o || o === "text" || o === "json" ? u.responseText : u.response,
|
|
958
|
+
status: u.status,
|
|
959
|
+
statusText: u.statusText,
|
|
960
|
+
headers: p,
|
|
961
|
+
config: e,
|
|
962
|
+
request: u
|
|
963
|
+
};
|
|
964
|
+
settle(function(R) {
|
|
965
|
+
s(R), f();
|
|
966
|
+
}, function(R) {
|
|
967
|
+
r(R), f();
|
|
968
|
+
}, E), u = null;
|
|
969
|
+
}
|
|
970
|
+
if ("onloadend" in u ? u.onloadend = y : u.onreadystatechange = function() {
|
|
971
|
+
!u || u.readyState !== 4 || u.status === 0 && !(u.responseURL && u.responseURL.indexOf("file:") === 0) || setTimeout(y);
|
|
972
|
+
}, u.onabort = function() {
|
|
973
|
+
u && (r(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, e, u)), u = null);
|
|
974
|
+
}, u.onerror = function() {
|
|
975
|
+
r(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, e, u)), u = null;
|
|
976
|
+
}, u.ontimeout = function() {
|
|
977
|
+
let m = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
|
|
978
|
+
const E = e.transitional || transitionalDefaults;
|
|
979
|
+
e.timeoutErrorMessage && (m = e.timeoutErrorMessage), r(new AxiosError$1(
|
|
980
|
+
m,
|
|
981
|
+
E.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
982
|
+
e,
|
|
983
|
+
u
|
|
984
|
+
)), u = null;
|
|
985
|
+
}, platform.hasStandardBrowserEnv && (a && utils$1.isFunction(a) && (a = a(e)), a || a !== !1 && isURLSameOrigin(h))) {
|
|
986
|
+
const p = e.xsrfHeaderName && e.xsrfCookieName && cookies.read(e.xsrfCookieName);
|
|
987
|
+
p && n.set(e.xsrfHeaderName, p);
|
|
988
|
+
}
|
|
989
|
+
i === void 0 && n.setContentType(null), "setRequestHeader" in u && utils$1.forEach(n.toJSON(), function(m, E) {
|
|
990
|
+
u.setRequestHeader(E, m);
|
|
991
|
+
}), utils$1.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), o && o !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", progressEventReducer(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", progressEventReducer(e.onUploadProgress)), (e.cancelToken || e.signal) && (c = (p) => {
|
|
992
|
+
u && (r(!p || p.type ? new CanceledError$1(null, e, u) : p), u.abort(), u = null);
|
|
993
|
+
}, e.cancelToken && e.cancelToken.subscribe(c), e.signal && (e.signal.aborted ? c() : e.signal.addEventListener("abort", c)));
|
|
994
|
+
const d = parseProtocol(h);
|
|
995
|
+
if (d && platform.protocols.indexOf(d) === -1) {
|
|
996
|
+
r(new AxiosError$1("Unsupported protocol " + d + ":", AxiosError$1.ERR_BAD_REQUEST, e));
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
u.send(i || null);
|
|
1000
|
+
});
|
|
1001
|
+
}, knownAdapters = {
|
|
1002
|
+
http: httpAdapter,
|
|
1003
|
+
xhr: xhrAdapter
|
|
1004
|
+
};
|
|
1005
|
+
utils$1.forEach(knownAdapters, (e, t) => {
|
|
1006
|
+
if (e) {
|
|
1007
|
+
try {
|
|
1008
|
+
Object.defineProperty(e, "name", { value: t });
|
|
1009
|
+
} catch (s) {
|
|
1010
|
+
}
|
|
1011
|
+
Object.defineProperty(e, "adapterName", { value: t });
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
const renderReason = (e) => `- ${e}`, isResolvedHandle = (e) => utils$1.isFunction(e) || e === null || e === !1, adapters = {
|
|
1015
|
+
getAdapter: (e) => {
|
|
1016
|
+
e = utils$1.isArray(e) ? e : [e];
|
|
1017
|
+
const { length: t } = e;
|
|
1018
|
+
let s, r;
|
|
1019
|
+
const i = {};
|
|
1020
|
+
for (let n = 0; n < t; n++) {
|
|
1021
|
+
s = e[n];
|
|
1022
|
+
let o;
|
|
1023
|
+
if (r = s, !isResolvedHandle(s) && (r = knownAdapters[(o = String(s)).toLowerCase()], r === void 0))
|
|
1024
|
+
throw new AxiosError$1(`Unknown adapter '${o}'`);
|
|
1025
|
+
if (r)
|
|
1026
|
+
break;
|
|
1027
|
+
i[o || "#" + n] = r;
|
|
1028
|
+
}
|
|
1029
|
+
if (!r) {
|
|
1030
|
+
const n = Object.entries(i).map(
|
|
1031
|
+
([a, c]) => `adapter ${a} ` + (c === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1032
|
+
);
|
|
1033
|
+
let o = t ? n.length > 1 ? `since :
|
|
1034
|
+
` + n.map(renderReason).join(`
|
|
1035
|
+
`) : " " + renderReason(n[0]) : "as no adapter specified";
|
|
1036
|
+
throw new AxiosError$1(
|
|
1037
|
+
"There is no suitable adapter to dispatch the request " + o,
|
|
1038
|
+
"ERR_NOT_SUPPORT"
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
return r;
|
|
1042
|
+
},
|
|
1043
|
+
adapters: knownAdapters
|
|
1044
|
+
};
|
|
1045
|
+
function throwIfCancellationRequested(e) {
|
|
1046
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1047
|
+
throw new CanceledError$1(null, e);
|
|
1048
|
+
}
|
|
1049
|
+
function dispatchRequest(e) {
|
|
1050
|
+
return throwIfCancellationRequested(e), e.headers = AxiosHeaders$1.from(e.headers), e.data = transformData.call(
|
|
1051
|
+
e,
|
|
1052
|
+
e.transformRequest
|
|
1053
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(e.adapter || defaults.adapter)(e).then(function(r) {
|
|
1054
|
+
return throwIfCancellationRequested(e), r.data = transformData.call(
|
|
1055
|
+
e,
|
|
1056
|
+
e.transformResponse,
|
|
1057
|
+
r
|
|
1058
|
+
), r.headers = AxiosHeaders$1.from(r.headers), r;
|
|
1059
|
+
}, function(r) {
|
|
1060
|
+
return isCancel$1(r) || (throwIfCancellationRequested(e), r && r.response && (r.response.data = transformData.call(
|
|
1061
|
+
e,
|
|
1062
|
+
e.transformResponse,
|
|
1063
|
+
r.response
|
|
1064
|
+
), r.response.headers = AxiosHeaders$1.from(r.response.headers))), Promise.reject(r);
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
const headersToObject = (e) => e instanceof AxiosHeaders$1 ? A({}, e) : e;
|
|
1068
|
+
function mergeConfig$1(e, t) {
|
|
1069
|
+
t = t || {};
|
|
1070
|
+
const s = {};
|
|
1071
|
+
function r(f, l, u) {
|
|
1072
|
+
return utils$1.isPlainObject(f) && utils$1.isPlainObject(l) ? utils$1.merge.call({ caseless: u }, f, l) : utils$1.isPlainObject(l) ? utils$1.merge({}, l) : utils$1.isArray(l) ? l.slice() : l;
|
|
1073
|
+
}
|
|
1074
|
+
function i(f, l, u) {
|
|
1075
|
+
if (utils$1.isUndefined(l)) {
|
|
1076
|
+
if (!utils$1.isUndefined(f))
|
|
1077
|
+
return r(void 0, f, u);
|
|
1078
|
+
} else return r(f, l, u);
|
|
1079
|
+
}
|
|
1080
|
+
function n(f, l) {
|
|
1081
|
+
if (!utils$1.isUndefined(l))
|
|
1082
|
+
return r(void 0, l);
|
|
1083
|
+
}
|
|
1084
|
+
function o(f, l) {
|
|
1085
|
+
if (utils$1.isUndefined(l)) {
|
|
1086
|
+
if (!utils$1.isUndefined(f))
|
|
1087
|
+
return r(void 0, f);
|
|
1088
|
+
} else return r(void 0, l);
|
|
1089
|
+
}
|
|
1090
|
+
function a(f, l, u) {
|
|
1091
|
+
if (u in t)
|
|
1092
|
+
return r(f, l);
|
|
1093
|
+
if (u in e)
|
|
1094
|
+
return r(void 0, f);
|
|
1095
|
+
}
|
|
1096
|
+
const c = {
|
|
1097
|
+
url: n,
|
|
1098
|
+
method: n,
|
|
1099
|
+
data: n,
|
|
1100
|
+
baseURL: o,
|
|
1101
|
+
transformRequest: o,
|
|
1102
|
+
transformResponse: o,
|
|
1103
|
+
paramsSerializer: o,
|
|
1104
|
+
timeout: o,
|
|
1105
|
+
timeoutMessage: o,
|
|
1106
|
+
withCredentials: o,
|
|
1107
|
+
withXSRFToken: o,
|
|
1108
|
+
adapter: o,
|
|
1109
|
+
responseType: o,
|
|
1110
|
+
xsrfCookieName: o,
|
|
1111
|
+
xsrfHeaderName: o,
|
|
1112
|
+
onUploadProgress: o,
|
|
1113
|
+
onDownloadProgress: o,
|
|
1114
|
+
decompress: o,
|
|
1115
|
+
maxContentLength: o,
|
|
1116
|
+
maxBodyLength: o,
|
|
1117
|
+
beforeRedirect: o,
|
|
1118
|
+
transport: o,
|
|
1119
|
+
httpAgent: o,
|
|
1120
|
+
httpsAgent: o,
|
|
1121
|
+
cancelToken: o,
|
|
1122
|
+
socketPath: o,
|
|
1123
|
+
responseEncoding: o,
|
|
1124
|
+
validateStatus: a,
|
|
1125
|
+
headers: (f, l) => i(headersToObject(f), headersToObject(l), !0)
|
|
1126
|
+
};
|
|
1127
|
+
return utils$1.forEach(Object.keys(Object.assign({}, e, t)), function(l) {
|
|
1128
|
+
const u = c[l] || i, h = u(e[l], t[l], l);
|
|
1129
|
+
utils$1.isUndefined(h) && u !== a || (s[l] = h);
|
|
1130
|
+
}), s;
|
|
1131
|
+
}
|
|
1132
|
+
const VERSION$1 = "1.6.8", validators$1 = {};
|
|
1133
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1134
|
+
validators$1[e] = function(r) {
|
|
1135
|
+
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1136
|
+
};
|
|
1137
|
+
});
|
|
1138
|
+
const deprecatedWarnings = {};
|
|
1139
|
+
validators$1.transitional = function(t, s, r) {
|
|
1140
|
+
function i(n, o) {
|
|
1141
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + n + "'" + o + (r ? ". " + r : "");
|
|
1142
|
+
}
|
|
1143
|
+
return (n, o, a) => {
|
|
1144
|
+
if (t === !1)
|
|
1145
|
+
throw new AxiosError$1(
|
|
1146
|
+
i(o, " has been removed" + (s ? " in " + s : "")),
|
|
1147
|
+
AxiosError$1.ERR_DEPRECATED
|
|
1148
|
+
);
|
|
1149
|
+
return s && !deprecatedWarnings[o] && (deprecatedWarnings[o] = !0, console.warn(
|
|
1150
|
+
i(
|
|
1151
|
+
o,
|
|
1152
|
+
" has been deprecated since v" + s + " and will be removed in the near future"
|
|
1153
|
+
)
|
|
1154
|
+
)), t ? t(n, o, a) : !0;
|
|
1155
|
+
};
|
|
1156
|
+
};
|
|
1157
|
+
function assertOptions(e, t, s) {
|
|
1158
|
+
if (typeof e != "object")
|
|
1159
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
1160
|
+
const r = Object.keys(e);
|
|
1161
|
+
let i = r.length;
|
|
1162
|
+
for (; i-- > 0; ) {
|
|
1163
|
+
const n = r[i], o = t[n];
|
|
1164
|
+
if (o) {
|
|
1165
|
+
const a = e[n], c = a === void 0 || o(a, n, e);
|
|
1166
|
+
if (c !== !0)
|
|
1167
|
+
throw new AxiosError$1("option " + n + " must be " + c, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
1168
|
+
continue;
|
|
1169
|
+
}
|
|
1170
|
+
if (s !== !0)
|
|
1171
|
+
throw new AxiosError$1("Unknown option " + n, AxiosError$1.ERR_BAD_OPTION);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
const validator = {
|
|
1175
|
+
assertOptions,
|
|
1176
|
+
validators: validators$1
|
|
1177
|
+
}, validators = validator.validators;
|
|
1178
|
+
let Axios$1 = class {
|
|
1179
|
+
constructor(t) {
|
|
1180
|
+
this.defaults = t, this.interceptors = {
|
|
1181
|
+
request: new InterceptorManager(),
|
|
1182
|
+
response: new InterceptorManager()
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Dispatch a request
|
|
1187
|
+
*
|
|
1188
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1189
|
+
* @param {?Object} config
|
|
1190
|
+
*
|
|
1191
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1192
|
+
*/
|
|
1193
|
+
request(t, s) {
|
|
1194
|
+
return F(this, null, function* () {
|
|
1195
|
+
try {
|
|
1196
|
+
return yield this._request(t, s);
|
|
1197
|
+
} catch (r) {
|
|
1198
|
+
if (r instanceof Error) {
|
|
1199
|
+
let i;
|
|
1200
|
+
Error.captureStackTrace ? Error.captureStackTrace(i = {}) : i = new Error();
|
|
1201
|
+
const n = i.stack ? i.stack.replace(/^.+\n/, "") : "";
|
|
1202
|
+
r.stack ? n && !String(r.stack).endsWith(n.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
1203
|
+
` + n) : r.stack = n;
|
|
1204
|
+
}
|
|
1205
|
+
throw r;
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
_request(t, s) {
|
|
1210
|
+
typeof t == "string" ? (s = s || {}, s.url = t) : s = t || {}, s = mergeConfig$1(this.defaults, s);
|
|
1211
|
+
const { transitional: r, paramsSerializer: i, headers: n } = s;
|
|
1212
|
+
r !== void 0 && validator.assertOptions(r, {
|
|
1213
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1214
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1215
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
1216
|
+
}, !1), i != null && (utils$1.isFunction(i) ? s.paramsSerializer = {
|
|
1217
|
+
serialize: i
|
|
1218
|
+
} : validator.assertOptions(i, {
|
|
1219
|
+
encode: validators.function,
|
|
1220
|
+
serialize: validators.function
|
|
1221
|
+
}, !0)), s.method = (s.method || this.defaults.method || "get").toLowerCase();
|
|
1222
|
+
let o = n && utils$1.merge(
|
|
1223
|
+
n.common,
|
|
1224
|
+
n[s.method]
|
|
1225
|
+
);
|
|
1226
|
+
n && utils$1.forEach(
|
|
1227
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1228
|
+
(d) => {
|
|
1229
|
+
delete n[d];
|
|
1230
|
+
}
|
|
1231
|
+
), s.headers = AxiosHeaders$1.concat(o, n);
|
|
1232
|
+
const a = [];
|
|
1233
|
+
let c = !0;
|
|
1234
|
+
this.interceptors.request.forEach(function(p) {
|
|
1235
|
+
typeof p.runWhen == "function" && p.runWhen(s) === !1 || (c = c && p.synchronous, a.unshift(p.fulfilled, p.rejected));
|
|
1236
|
+
});
|
|
1237
|
+
const f = [];
|
|
1238
|
+
this.interceptors.response.forEach(function(p) {
|
|
1239
|
+
f.push(p.fulfilled, p.rejected);
|
|
1240
|
+
});
|
|
1241
|
+
let l, u = 0, h;
|
|
1242
|
+
if (!c) {
|
|
1243
|
+
const d = [dispatchRequest.bind(this), void 0];
|
|
1244
|
+
for (d.unshift.apply(d, a), d.push.apply(d, f), h = d.length, l = Promise.resolve(s); u < h; )
|
|
1245
|
+
l = l.then(d[u++], d[u++]);
|
|
1246
|
+
return l;
|
|
1247
|
+
}
|
|
1248
|
+
h = a.length;
|
|
1249
|
+
let y = s;
|
|
1250
|
+
for (u = 0; u < h; ) {
|
|
1251
|
+
const d = a[u++], p = a[u++];
|
|
1252
|
+
try {
|
|
1253
|
+
y = d(y);
|
|
1254
|
+
} catch (m) {
|
|
1255
|
+
p.call(this, m);
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
try {
|
|
1260
|
+
l = dispatchRequest.call(this, y);
|
|
1261
|
+
} catch (d) {
|
|
1262
|
+
return Promise.reject(d);
|
|
1263
|
+
}
|
|
1264
|
+
for (u = 0, h = f.length; u < h; )
|
|
1265
|
+
l = l.then(f[u++], f[u++]);
|
|
1266
|
+
return l;
|
|
1267
|
+
}
|
|
1268
|
+
getUri(t) {
|
|
1269
|
+
t = mergeConfig$1(this.defaults, t);
|
|
1270
|
+
const s = buildFullPath(t.baseURL, t.url);
|
|
1271
|
+
return buildURL(s, t.params, t.paramsSerializer);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
utils$1.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1275
|
+
Axios$1.prototype[t] = function(s, r) {
|
|
1276
|
+
return this.request(mergeConfig$1(r || {}, {
|
|
1277
|
+
method: t,
|
|
1278
|
+
url: s,
|
|
1279
|
+
data: (r || {}).data
|
|
1280
|
+
}));
|
|
1281
|
+
};
|
|
1282
|
+
});
|
|
1283
|
+
utils$1.forEach(["post", "put", "patch"], function(t) {
|
|
1284
|
+
function s(r) {
|
|
1285
|
+
return function(n, o, a) {
|
|
1286
|
+
return this.request(mergeConfig$1(a || {}, {
|
|
1287
|
+
method: t,
|
|
1288
|
+
headers: r ? {
|
|
1289
|
+
"Content-Type": "multipart/form-data"
|
|
1290
|
+
} : {},
|
|
1291
|
+
url: n,
|
|
1292
|
+
data: o
|
|
1293
|
+
}));
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
Axios$1.prototype[t] = s(), Axios$1.prototype[t + "Form"] = s(!0);
|
|
1297
|
+
});
|
|
1298
|
+
let CancelToken$1 = class C {
|
|
1299
|
+
constructor(t) {
|
|
1300
|
+
if (typeof t != "function")
|
|
1301
|
+
throw new TypeError("executor must be a function.");
|
|
1302
|
+
let s;
|
|
1303
|
+
this.promise = new Promise(function(n) {
|
|
1304
|
+
s = n;
|
|
1305
|
+
});
|
|
1306
|
+
const r = this;
|
|
1307
|
+
this.promise.then((i) => {
|
|
1308
|
+
if (!r._listeners) return;
|
|
1309
|
+
let n = r._listeners.length;
|
|
1310
|
+
for (; n-- > 0; )
|
|
1311
|
+
r._listeners[n](i);
|
|
1312
|
+
r._listeners = null;
|
|
1313
|
+
}), this.promise.then = (i) => {
|
|
1314
|
+
let n;
|
|
1315
|
+
const o = new Promise((a) => {
|
|
1316
|
+
r.subscribe(a), n = a;
|
|
1317
|
+
}).then(i);
|
|
1318
|
+
return o.cancel = function() {
|
|
1319
|
+
r.unsubscribe(n);
|
|
1320
|
+
}, o;
|
|
1321
|
+
}, t(function(n, o, a) {
|
|
1322
|
+
r.reason || (r.reason = new CanceledError$1(n, o, a), s(r.reason));
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
1327
|
+
*/
|
|
1328
|
+
throwIfRequested() {
|
|
1329
|
+
if (this.reason)
|
|
1330
|
+
throw this.reason;
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Subscribe to the cancel signal
|
|
1334
|
+
*/
|
|
1335
|
+
subscribe(t) {
|
|
1336
|
+
if (this.reason) {
|
|
1337
|
+
t(this.reason);
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
this._listeners ? this._listeners.push(t) : this._listeners = [t];
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Unsubscribe from the cancel signal
|
|
1344
|
+
*/
|
|
1345
|
+
unsubscribe(t) {
|
|
1346
|
+
if (!this._listeners)
|
|
1347
|
+
return;
|
|
1348
|
+
const s = this._listeners.indexOf(t);
|
|
1349
|
+
s !== -1 && this._listeners.splice(s, 1);
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1353
|
+
* cancels the `CancelToken`.
|
|
1354
|
+
*/
|
|
1355
|
+
static source() {
|
|
1356
|
+
let t;
|
|
1357
|
+
return {
|
|
1358
|
+
token: new C(function(i) {
|
|
1359
|
+
t = i;
|
|
1360
|
+
}),
|
|
1361
|
+
cancel: t
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
function spread$1(e) {
|
|
1366
|
+
return function(s) {
|
|
1367
|
+
return e.apply(null, s);
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
function isAxiosError$1(e) {
|
|
1371
|
+
return utils$1.isObject(e) && e.isAxiosError === !0;
|
|
1372
|
+
}
|
|
1373
|
+
const HttpStatusCode$1 = {
|
|
1374
|
+
Continue: 100,
|
|
1375
|
+
SwitchingProtocols: 101,
|
|
1376
|
+
Processing: 102,
|
|
1377
|
+
EarlyHints: 103,
|
|
1378
|
+
Ok: 200,
|
|
1379
|
+
Created: 201,
|
|
1380
|
+
Accepted: 202,
|
|
1381
|
+
NonAuthoritativeInformation: 203,
|
|
1382
|
+
NoContent: 204,
|
|
1383
|
+
ResetContent: 205,
|
|
1384
|
+
PartialContent: 206,
|
|
1385
|
+
MultiStatus: 207,
|
|
1386
|
+
AlreadyReported: 208,
|
|
1387
|
+
ImUsed: 226,
|
|
1388
|
+
MultipleChoices: 300,
|
|
1389
|
+
MovedPermanently: 301,
|
|
1390
|
+
Found: 302,
|
|
1391
|
+
SeeOther: 303,
|
|
1392
|
+
NotModified: 304,
|
|
1393
|
+
UseProxy: 305,
|
|
1394
|
+
Unused: 306,
|
|
1395
|
+
TemporaryRedirect: 307,
|
|
1396
|
+
PermanentRedirect: 308,
|
|
1397
|
+
BadRequest: 400,
|
|
1398
|
+
Unauthorized: 401,
|
|
1399
|
+
PaymentRequired: 402,
|
|
1400
|
+
Forbidden: 403,
|
|
1401
|
+
NotFound: 404,
|
|
1402
|
+
MethodNotAllowed: 405,
|
|
1403
|
+
NotAcceptable: 406,
|
|
1404
|
+
ProxyAuthenticationRequired: 407,
|
|
1405
|
+
RequestTimeout: 408,
|
|
1406
|
+
Conflict: 409,
|
|
1407
|
+
Gone: 410,
|
|
1408
|
+
LengthRequired: 411,
|
|
1409
|
+
PreconditionFailed: 412,
|
|
1410
|
+
PayloadTooLarge: 413,
|
|
1411
|
+
UriTooLong: 414,
|
|
1412
|
+
UnsupportedMediaType: 415,
|
|
1413
|
+
RangeNotSatisfiable: 416,
|
|
1414
|
+
ExpectationFailed: 417,
|
|
1415
|
+
ImATeapot: 418,
|
|
1416
|
+
MisdirectedRequest: 421,
|
|
1417
|
+
UnprocessableEntity: 422,
|
|
1418
|
+
Locked: 423,
|
|
1419
|
+
FailedDependency: 424,
|
|
1420
|
+
TooEarly: 425,
|
|
1421
|
+
UpgradeRequired: 426,
|
|
1422
|
+
PreconditionRequired: 428,
|
|
1423
|
+
TooManyRequests: 429,
|
|
1424
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
1425
|
+
UnavailableForLegalReasons: 451,
|
|
1426
|
+
InternalServerError: 500,
|
|
1427
|
+
NotImplemented: 501,
|
|
1428
|
+
BadGateway: 502,
|
|
1429
|
+
ServiceUnavailable: 503,
|
|
1430
|
+
GatewayTimeout: 504,
|
|
1431
|
+
HttpVersionNotSupported: 505,
|
|
1432
|
+
VariantAlsoNegotiates: 506,
|
|
1433
|
+
InsufficientStorage: 507,
|
|
1434
|
+
LoopDetected: 508,
|
|
1435
|
+
NotExtended: 510,
|
|
1436
|
+
NetworkAuthenticationRequired: 511
|
|
1437
|
+
};
|
|
1438
|
+
Object.entries(HttpStatusCode$1).forEach(([e, t]) => {
|
|
1439
|
+
HttpStatusCode$1[t] = e;
|
|
1440
|
+
});
|
|
1441
|
+
function createInstance(e) {
|
|
1442
|
+
const t = new Axios$1(e), s = bind(Axios$1.prototype.request, t);
|
|
1443
|
+
return utils$1.extend(s, Axios$1.prototype, t, { allOwnKeys: !0 }), utils$1.extend(s, t, null, { allOwnKeys: !0 }), s.create = function(i) {
|
|
1444
|
+
return createInstance(mergeConfig$1(e, i));
|
|
1445
|
+
}, s;
|
|
1446
|
+
}
|
|
1447
|
+
const axios = createInstance(defaults);
|
|
1448
|
+
axios.Axios = Axios$1;
|
|
1449
|
+
axios.CanceledError = CanceledError$1;
|
|
1450
|
+
axios.CancelToken = CancelToken$1;
|
|
1451
|
+
axios.isCancel = isCancel$1;
|
|
1452
|
+
axios.VERSION = VERSION$1;
|
|
1453
|
+
axios.toFormData = toFormData$1;
|
|
1454
|
+
axios.AxiosError = AxiosError$1;
|
|
1455
|
+
axios.Cancel = axios.CanceledError;
|
|
1456
|
+
axios.all = function(t) {
|
|
1457
|
+
return Promise.all(t);
|
|
1458
|
+
};
|
|
1459
|
+
axios.spread = spread$1;
|
|
1460
|
+
axios.isAxiosError = isAxiosError$1;
|
|
1461
|
+
axios.mergeConfig = mergeConfig$1;
|
|
1462
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
1463
|
+
axios.formToJSON = (e) => formDataToJSON(utils$1.isHTMLForm(e) ? new FormData(e) : e);
|
|
1464
|
+
axios.getAdapter = adapters.getAdapter;
|
|
1465
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
1466
|
+
axios.default = axios;
|
|
1467
|
+
const {
|
|
1468
|
+
Axios,
|
|
1469
|
+
AxiosError,
|
|
1470
|
+
CanceledError,
|
|
1471
|
+
isCancel,
|
|
1472
|
+
CancelToken,
|
|
1473
|
+
VERSION,
|
|
1474
|
+
all,
|
|
1475
|
+
Cancel,
|
|
1476
|
+
isAxiosError,
|
|
1477
|
+
spread,
|
|
1478
|
+
toFormData,
|
|
1479
|
+
AxiosHeaders,
|
|
1480
|
+
HttpStatusCode,
|
|
1481
|
+
formToJSON,
|
|
1482
|
+
getAdapter,
|
|
1483
|
+
mergeConfig
|
|
1484
|
+
} = axios, toString = Object.prototype.toString;
|
|
1485
|
+
function is(e, t) {
|
|
1486
|
+
return toString.call(e) === `[object ${t}]`;
|
|
1487
|
+
}
|
|
1488
|
+
function isObject(e) {
|
|
1489
|
+
return e !== null && is(e, "Object");
|
|
1490
|
+
}
|
|
1491
|
+
function isFunction(e) {
|
|
1492
|
+
return typeof e == "function";
|
|
1493
|
+
}
|
|
1494
|
+
const isEmptyObject = (e) => isObject(e) && Object.keys(e).length === 0;
|
|
1495
|
+
navigator.userAgent.toLowerCase().indexOf("kuasheng-2.0") >= 0;
|
|
1496
|
+
function mergeInterceptor(e) {
|
|
1497
|
+
const t = {
|
|
1498
|
+
request: [],
|
|
1499
|
+
response: [],
|
|
1500
|
+
rejectRequest: [],
|
|
1501
|
+
rejectResponse: []
|
|
1502
|
+
};
|
|
1503
|
+
if (e && !isEmptyObject(e))
|
|
1504
|
+
for (const r in t) {
|
|
1505
|
+
const i = t[r], n = e[r] || [];
|
|
1506
|
+
t[r] = i.concat(n);
|
|
1507
|
+
}
|
|
1508
|
+
return [
|
|
1509
|
+
...t.request.map((r) => ({
|
|
1510
|
+
callback: r,
|
|
1511
|
+
type: "request"
|
|
1512
|
+
})),
|
|
1513
|
+
...t.response.map((r) => ({
|
|
1514
|
+
callback: r,
|
|
1515
|
+
type: "response"
|
|
1516
|
+
})),
|
|
1517
|
+
...t.rejectRequest.map((r) => ({
|
|
1518
|
+
callback: r,
|
|
1519
|
+
type: "rejectRequest"
|
|
1520
|
+
})),
|
|
1521
|
+
...t.rejectResponse.map((r) => ({
|
|
1522
|
+
callback: r,
|
|
1523
|
+
type: "rejectResponse"
|
|
1524
|
+
}))
|
|
1525
|
+
].filter(Boolean);
|
|
1526
|
+
}
|
|
1527
|
+
function handleInterceptor(e, t) {
|
|
1528
|
+
mergeInterceptor(t.interceptors).forEach((r) => {
|
|
1529
|
+
var o, a, c, f, l, u, h, y;
|
|
1530
|
+
const { type: i, callback: n } = r;
|
|
1531
|
+
i === "request" && ((a = (o = e.interceptors) == null ? void 0 : o.request) == null || a.use(n)), i === "response" && ((f = (c = e.interceptors) == null ? void 0 : c.response) == null || f.use(n)), i === "rejectRequest" && ((u = (l = e.interceptors) == null ? void 0 : l.request) == null || u.use(void 0, n)), i === "rejectResponse" && ((y = (h = e.interceptors) == null ? void 0 : h.response) == null || y.use(void 0, n));
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
function commonResponseErrorMsg(e) {
|
|
1535
|
+
var r;
|
|
1536
|
+
const t = ((r = e.data) == null ? void 0 : r.message) || e.msg;
|
|
1537
|
+
let s = "";
|
|
1538
|
+
switch (e.status) {
|
|
1539
|
+
case 401:
|
|
1540
|
+
s = "401:" + t;
|
|
1541
|
+
break;
|
|
1542
|
+
case 403:
|
|
1543
|
+
s = t;
|
|
1544
|
+
break;
|
|
1545
|
+
case 404:
|
|
1546
|
+
s = "404: " + t;
|
|
1547
|
+
break;
|
|
1548
|
+
case 422:
|
|
1549
|
+
s = "请求参数错误" + t;
|
|
1550
|
+
break;
|
|
1551
|
+
case 426:
|
|
1552
|
+
s = "426: " + t;
|
|
1553
|
+
break;
|
|
1554
|
+
case 428:
|
|
1555
|
+
s = "428: " + t;
|
|
1556
|
+
break;
|
|
1557
|
+
case 500: {
|
|
1558
|
+
s = "服务器错误: " + t;
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1561
|
+
default:
|
|
1562
|
+
s = "未知的情况";
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
return s;
|
|
1566
|
+
}
|
|
1567
|
+
function createWXAdapter(e) {
|
|
1568
|
+
return new Promise(function(t, s) {
|
|
1569
|
+
const r = A({}, e.headers);
|
|
1570
|
+
wx.request({
|
|
1571
|
+
method: e.method,
|
|
1572
|
+
url: e.baseURL + e.url,
|
|
1573
|
+
data: e.data,
|
|
1574
|
+
header: r,
|
|
1575
|
+
enableHttp2: !0,
|
|
1576
|
+
success(i) {
|
|
1577
|
+
const o = {
|
|
1578
|
+
data: i.data,
|
|
1579
|
+
status: i.statusCode,
|
|
1580
|
+
statusText: "OK",
|
|
1581
|
+
headers: r,
|
|
1582
|
+
config: e,
|
|
1583
|
+
request: e
|
|
1584
|
+
};
|
|
1585
|
+
t(o);
|
|
1586
|
+
},
|
|
1587
|
+
fail(i) {
|
|
1588
|
+
var o;
|
|
1589
|
+
const n = commonResponseErrorMsg(i);
|
|
1590
|
+
!e.ignoreToast && ((o = e.showErrorMsg) == null || o.call(e, n)), i._config = e, s(i);
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
const defaultInterceptors = () => ({
|
|
1596
|
+
response: (e) => new Promise((t, s) => {
|
|
1597
|
+
const { showErrorMsg: r, ignoreToast: i } = e.config;
|
|
1598
|
+
if (e.status === 200)
|
|
1599
|
+
return e.data.code === 0 ? t(e.data.data) : ((Array.isArray(i) && !i.includes(e.data.code) || !i) && (r == null || r(e.data.msg || e.message || "接口错误")), s(e));
|
|
1600
|
+
const n = commonResponseErrorMsg(e);
|
|
1601
|
+
return r == null || r(n), s(e);
|
|
1602
|
+
}),
|
|
1603
|
+
rejectResponse: (e) => {
|
|
1604
|
+
var r, i;
|
|
1605
|
+
const { showErrorMsg: t, ignoreToast: s } = e.config;
|
|
1606
|
+
if (Array.isArray(s) && !s.includes(e.data.code) || !s) {
|
|
1607
|
+
const n = ((i = (r = e.response) == null ? void 0 : r.data) == null ? void 0 : i.message) || e.message || "接口错误";
|
|
1608
|
+
t == null || t(n);
|
|
1609
|
+
}
|
|
1610
|
+
return Promise.reject(e.response);
|
|
1611
|
+
}
|
|
1612
|
+
}), defaultConfig = {
|
|
1613
|
+
baseURL: "",
|
|
1614
|
+
headers: {
|
|
1615
|
+
method: EnumMethod.POST,
|
|
1616
|
+
"Content-Type": EnumContentType.JSON
|
|
1617
|
+
},
|
|
1618
|
+
timeout: 1e4,
|
|
1619
|
+
loading: !1,
|
|
1620
|
+
method: "POST",
|
|
1621
|
+
interceptors: defaultInterceptors()
|
|
1622
|
+
};
|
|
1623
|
+
var commonjsGlobal = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
1624
|
+
function getDefaultExportFromCjs(e) {
|
|
1625
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1626
|
+
}
|
|
1627
|
+
var md5$1 = { exports: {} };
|
|
1628
|
+
var hasRequiredMd5;
|
|
1629
|
+
function requireMd5() {
|
|
1630
|
+
return hasRequiredMd5 || (hasRequiredMd5 = 1, (function(module) {
|
|
1631
|
+
(function() {
|
|
1632
|
+
var ERROR = "input is invalid type", WINDOW = typeof window == "object", root = WINDOW ? window : {};
|
|
1633
|
+
root.JS_MD5_NO_WINDOW && (WINDOW = !1);
|
|
1634
|
+
var WEB_WORKER = !WINDOW && typeof self == "object", NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node;
|
|
1635
|
+
NODE_JS ? root = commonjsGlobal : WEB_WORKER && (root = self);
|
|
1636
|
+
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && !0 && module.exports, ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer != "undefined", HEX_CHARS = "0123456789abcdef".split(""), EXTRA = [128, 32768, 8388608, -2147483648], SHIFT = [0, 8, 16, 24], OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"], BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), blocks = [], buffer8;
|
|
1637
|
+
if (ARRAY_BUFFER) {
|
|
1638
|
+
var buffer = new ArrayBuffer(68);
|
|
1639
|
+
buffer8 = new Uint8Array(buffer), blocks = new Uint32Array(buffer);
|
|
1640
|
+
}
|
|
1641
|
+
(root.JS_MD5_NO_NODE_JS || !Array.isArray) && (Array.isArray = function(e) {
|
|
1642
|
+
return Object.prototype.toString.call(e) === "[object Array]";
|
|
1643
|
+
}), ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) && (ArrayBuffer.isView = function(e) {
|
|
1644
|
+
return typeof e == "object" && e.buffer && e.buffer.constructor === ArrayBuffer;
|
|
1645
|
+
});
|
|
1646
|
+
var createOutputMethod = function(e) {
|
|
1647
|
+
return function(t) {
|
|
1648
|
+
return new Md5(!0).update(t)[e]();
|
|
1649
|
+
};
|
|
1650
|
+
}, createMethod = function() {
|
|
1651
|
+
var e = createOutputMethod("hex");
|
|
1652
|
+
NODE_JS && (e = nodeWrap(e)), e.create = function() {
|
|
1653
|
+
return new Md5();
|
|
1654
|
+
}, e.update = function(r) {
|
|
1655
|
+
return e.create().update(r);
|
|
1656
|
+
};
|
|
1657
|
+
for (var t = 0; t < OUTPUT_TYPES.length; ++t) {
|
|
1658
|
+
var s = OUTPUT_TYPES[t];
|
|
1659
|
+
e[s] = createOutputMethod(s);
|
|
1660
|
+
}
|
|
1661
|
+
return e;
|
|
1662
|
+
}, nodeWrap = function(method) {
|
|
1663
|
+
var crypto = eval("require('crypto')"), Buffer = eval("require('buffer').Buffer"), nodeMethod = function(e) {
|
|
1664
|
+
if (typeof e == "string")
|
|
1665
|
+
return crypto.createHash("md5").update(e, "utf8").digest("hex");
|
|
1666
|
+
if (e == null)
|
|
1667
|
+
throw ERROR;
|
|
1668
|
+
return e.constructor === ArrayBuffer && (e = new Uint8Array(e)), Array.isArray(e) || ArrayBuffer.isView(e) || e.constructor === Buffer ? crypto.createHash("md5").update(new Buffer(e)).digest("hex") : method(e);
|
|
1669
|
+
};
|
|
1670
|
+
return nodeMethod;
|
|
1671
|
+
};
|
|
1672
|
+
function Md5(e) {
|
|
1673
|
+
if (e)
|
|
1674
|
+
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0, this.blocks = blocks, this.buffer8 = buffer8;
|
|
1675
|
+
else if (ARRAY_BUFFER) {
|
|
1676
|
+
var t = new ArrayBuffer(68);
|
|
1677
|
+
this.buffer8 = new Uint8Array(t), this.blocks = new Uint32Array(t);
|
|
1678
|
+
} else
|
|
1679
|
+
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
1680
|
+
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0;
|
|
1681
|
+
}
|
|
1682
|
+
Md5.prototype.update = function(e) {
|
|
1683
|
+
if (!this.finalized) {
|
|
1684
|
+
var t, s = typeof e;
|
|
1685
|
+
if (s !== "string") {
|
|
1686
|
+
if (s === "object") {
|
|
1687
|
+
if (e === null)
|
|
1688
|
+
throw ERROR;
|
|
1689
|
+
if (ARRAY_BUFFER && e.constructor === ArrayBuffer)
|
|
1690
|
+
e = new Uint8Array(e);
|
|
1691
|
+
else if (!Array.isArray(e) && (!ARRAY_BUFFER || !ArrayBuffer.isView(e)))
|
|
1692
|
+
throw ERROR;
|
|
1693
|
+
} else
|
|
1694
|
+
throw ERROR;
|
|
1695
|
+
t = !0;
|
|
1696
|
+
}
|
|
1697
|
+
for (var r, i = 0, n, o = e.length, a = this.blocks, c = this.buffer8; i < o; ) {
|
|
1698
|
+
if (this.hashed && (this.hashed = !1, a[0] = a[16], a[16] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = a[10] = a[11] = a[12] = a[13] = a[14] = a[15] = 0), t)
|
|
1699
|
+
if (ARRAY_BUFFER)
|
|
1700
|
+
for (n = this.start; i < o && n < 64; ++i)
|
|
1701
|
+
c[n++] = e[i];
|
|
1702
|
+
else
|
|
1703
|
+
for (n = this.start; i < o && n < 64; ++i)
|
|
1704
|
+
a[n >> 2] |= e[i] << SHIFT[n++ & 3];
|
|
1705
|
+
else if (ARRAY_BUFFER)
|
|
1706
|
+
for (n = this.start; i < o && n < 64; ++i)
|
|
1707
|
+
r = e.charCodeAt(i), r < 128 ? c[n++] = r : r < 2048 ? (c[n++] = 192 | r >> 6, c[n++] = 128 | r & 63) : r < 55296 || r >= 57344 ? (c[n++] = 224 | r >> 12, c[n++] = 128 | r >> 6 & 63, c[n++] = 128 | r & 63) : (r = 65536 + ((r & 1023) << 10 | e.charCodeAt(++i) & 1023), c[n++] = 240 | r >> 18, c[n++] = 128 | r >> 12 & 63, c[n++] = 128 | r >> 6 & 63, c[n++] = 128 | r & 63);
|
|
1708
|
+
else
|
|
1709
|
+
for (n = this.start; i < o && n < 64; ++i)
|
|
1710
|
+
r = e.charCodeAt(i), r < 128 ? a[n >> 2] |= r << SHIFT[n++ & 3] : r < 2048 ? (a[n >> 2] |= (192 | r >> 6) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r & 63) << SHIFT[n++ & 3]) : r < 55296 || r >= 57344 ? (a[n >> 2] |= (224 | r >> 12) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r >> 6 & 63) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r & 63) << SHIFT[n++ & 3]) : (r = 65536 + ((r & 1023) << 10 | e.charCodeAt(++i) & 1023), a[n >> 2] |= (240 | r >> 18) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r >> 12 & 63) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r >> 6 & 63) << SHIFT[n++ & 3], a[n >> 2] |= (128 | r & 63) << SHIFT[n++ & 3]);
|
|
1711
|
+
this.lastByteIndex = n, this.bytes += n - this.start, n >= 64 ? (this.start = n - 64, this.hash(), this.hashed = !0) : this.start = n;
|
|
1712
|
+
}
|
|
1713
|
+
return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this;
|
|
1714
|
+
}
|
|
1715
|
+
}, Md5.prototype.finalize = function() {
|
|
1716
|
+
if (!this.finalized) {
|
|
1717
|
+
this.finalized = !0;
|
|
1718
|
+
var e = this.blocks, t = this.lastByteIndex;
|
|
1719
|
+
e[t >> 2] |= EXTRA[t & 3], t >= 56 && (this.hashed || this.hash(), e[0] = e[16], e[16] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = e[9] = e[10] = e[11] = e[12] = e[13] = e[14] = e[15] = 0), e[14] = this.bytes << 3, e[15] = this.hBytes << 3 | this.bytes >>> 29, this.hash();
|
|
1720
|
+
}
|
|
1721
|
+
}, Md5.prototype.hash = function() {
|
|
1722
|
+
var e, t, s, r, i, n, o = this.blocks;
|
|
1723
|
+
this.first ? (e = o[0] - 680876937, e = (e << 7 | e >>> 25) - 271733879 << 0, r = (-1732584194 ^ e & 2004318071) + o[1] - 117830708, r = (r << 12 | r >>> 20) + e << 0, s = (-271733879 ^ r & (e ^ -271733879)) + o[2] - 1126478375, s = (s << 17 | s >>> 15) + r << 0, t = (e ^ s & (r ^ e)) + o[3] - 1316259209, t = (t << 22 | t >>> 10) + s << 0) : (e = this.h0, t = this.h1, s = this.h2, r = this.h3, e += (r ^ t & (s ^ r)) + o[0] - 680876936, e = (e << 7 | e >>> 25) + t << 0, r += (s ^ e & (t ^ s)) + o[1] - 389564586, r = (r << 12 | r >>> 20) + e << 0, s += (t ^ r & (e ^ t)) + o[2] + 606105819, s = (s << 17 | s >>> 15) + r << 0, t += (e ^ s & (r ^ e)) + o[3] - 1044525330, t = (t << 22 | t >>> 10) + s << 0), e += (r ^ t & (s ^ r)) + o[4] - 176418897, e = (e << 7 | e >>> 25) + t << 0, r += (s ^ e & (t ^ s)) + o[5] + 1200080426, r = (r << 12 | r >>> 20) + e << 0, s += (t ^ r & (e ^ t)) + o[6] - 1473231341, s = (s << 17 | s >>> 15) + r << 0, t += (e ^ s & (r ^ e)) + o[7] - 45705983, t = (t << 22 | t >>> 10) + s << 0, e += (r ^ t & (s ^ r)) + o[8] + 1770035416, e = (e << 7 | e >>> 25) + t << 0, r += (s ^ e & (t ^ s)) + o[9] - 1958414417, r = (r << 12 | r >>> 20) + e << 0, s += (t ^ r & (e ^ t)) + o[10] - 42063, s = (s << 17 | s >>> 15) + r << 0, t += (e ^ s & (r ^ e)) + o[11] - 1990404162, t = (t << 22 | t >>> 10) + s << 0, e += (r ^ t & (s ^ r)) + o[12] + 1804603682, e = (e << 7 | e >>> 25) + t << 0, r += (s ^ e & (t ^ s)) + o[13] - 40341101, r = (r << 12 | r >>> 20) + e << 0, s += (t ^ r & (e ^ t)) + o[14] - 1502002290, s = (s << 17 | s >>> 15) + r << 0, t += (e ^ s & (r ^ e)) + o[15] + 1236535329, t = (t << 22 | t >>> 10) + s << 0, e += (s ^ r & (t ^ s)) + o[1] - 165796510, e = (e << 5 | e >>> 27) + t << 0, r += (t ^ s & (e ^ t)) + o[6] - 1069501632, r = (r << 9 | r >>> 23) + e << 0, s += (e ^ t & (r ^ e)) + o[11] + 643717713, s = (s << 14 | s >>> 18) + r << 0, t += (r ^ e & (s ^ r)) + o[0] - 373897302, t = (t << 20 | t >>> 12) + s << 0, e += (s ^ r & (t ^ s)) + o[5] - 701558691, e = (e << 5 | e >>> 27) + t << 0, r += (t ^ s & (e ^ t)) + o[10] + 38016083, r = (r << 9 | r >>> 23) + e << 0, s += (e ^ t & (r ^ e)) + o[15] - 660478335, s = (s << 14 | s >>> 18) + r << 0, t += (r ^ e & (s ^ r)) + o[4] - 405537848, t = (t << 20 | t >>> 12) + s << 0, e += (s ^ r & (t ^ s)) + o[9] + 568446438, e = (e << 5 | e >>> 27) + t << 0, r += (t ^ s & (e ^ t)) + o[14] - 1019803690, r = (r << 9 | r >>> 23) + e << 0, s += (e ^ t & (r ^ e)) + o[3] - 187363961, s = (s << 14 | s >>> 18) + r << 0, t += (r ^ e & (s ^ r)) + o[8] + 1163531501, t = (t << 20 | t >>> 12) + s << 0, e += (s ^ r & (t ^ s)) + o[13] - 1444681467, e = (e << 5 | e >>> 27) + t << 0, r += (t ^ s & (e ^ t)) + o[2] - 51403784, r = (r << 9 | r >>> 23) + e << 0, s += (e ^ t & (r ^ e)) + o[7] + 1735328473, s = (s << 14 | s >>> 18) + r << 0, t += (r ^ e & (s ^ r)) + o[12] - 1926607734, t = (t << 20 | t >>> 12) + s << 0, i = t ^ s, e += (i ^ r) + o[5] - 378558, e = (e << 4 | e >>> 28) + t << 0, r += (i ^ e) + o[8] - 2022574463, r = (r << 11 | r >>> 21) + e << 0, n = r ^ e, s += (n ^ t) + o[11] + 1839030562, s = (s << 16 | s >>> 16) + r << 0, t += (n ^ s) + o[14] - 35309556, t = (t << 23 | t >>> 9) + s << 0, i = t ^ s, e += (i ^ r) + o[1] - 1530992060, e = (e << 4 | e >>> 28) + t << 0, r += (i ^ e) + o[4] + 1272893353, r = (r << 11 | r >>> 21) + e << 0, n = r ^ e, s += (n ^ t) + o[7] - 155497632, s = (s << 16 | s >>> 16) + r << 0, t += (n ^ s) + o[10] - 1094730640, t = (t << 23 | t >>> 9) + s << 0, i = t ^ s, e += (i ^ r) + o[13] + 681279174, e = (e << 4 | e >>> 28) + t << 0, r += (i ^ e) + o[0] - 358537222, r = (r << 11 | r >>> 21) + e << 0, n = r ^ e, s += (n ^ t) + o[3] - 722521979, s = (s << 16 | s >>> 16) + r << 0, t += (n ^ s) + o[6] + 76029189, t = (t << 23 | t >>> 9) + s << 0, i = t ^ s, e += (i ^ r) + o[9] - 640364487, e = (e << 4 | e >>> 28) + t << 0, r += (i ^ e) + o[12] - 421815835, r = (r << 11 | r >>> 21) + e << 0, n = r ^ e, s += (n ^ t) + o[15] + 530742520, s = (s << 16 | s >>> 16) + r << 0, t += (n ^ s) + o[2] - 995338651, t = (t << 23 | t >>> 9) + s << 0, e += (s ^ (t | ~r)) + o[0] - 198630844, e = (e << 6 | e >>> 26) + t << 0, r += (t ^ (e | ~s)) + o[7] + 1126891415, r = (r << 10 | r >>> 22) + e << 0, s += (e ^ (r | ~t)) + o[14] - 1416354905, s = (s << 15 | s >>> 17) + r << 0, t += (r ^ (s | ~e)) + o[5] - 57434055, t = (t << 21 | t >>> 11) + s << 0, e += (s ^ (t | ~r)) + o[12] + 1700485571, e = (e << 6 | e >>> 26) + t << 0, r += (t ^ (e | ~s)) + o[3] - 1894986606, r = (r << 10 | r >>> 22) + e << 0, s += (e ^ (r | ~t)) + o[10] - 1051523, s = (s << 15 | s >>> 17) + r << 0, t += (r ^ (s | ~e)) + o[1] - 2054922799, t = (t << 21 | t >>> 11) + s << 0, e += (s ^ (t | ~r)) + o[8] + 1873313359, e = (e << 6 | e >>> 26) + t << 0, r += (t ^ (e | ~s)) + o[15] - 30611744, r = (r << 10 | r >>> 22) + e << 0, s += (e ^ (r | ~t)) + o[6] - 1560198380, s = (s << 15 | s >>> 17) + r << 0, t += (r ^ (s | ~e)) + o[13] + 1309151649, t = (t << 21 | t >>> 11) + s << 0, e += (s ^ (t | ~r)) + o[4] - 145523070, e = (e << 6 | e >>> 26) + t << 0, r += (t ^ (e | ~s)) + o[11] - 1120210379, r = (r << 10 | r >>> 22) + e << 0, s += (e ^ (r | ~t)) + o[2] + 718787259, s = (s << 15 | s >>> 17) + r << 0, t += (r ^ (s | ~e)) + o[9] - 343485551, t = (t << 21 | t >>> 11) + s << 0, this.first ? (this.h0 = e + 1732584193 << 0, this.h1 = t - 271733879 << 0, this.h2 = s - 1732584194 << 0, this.h3 = r + 271733878 << 0, this.first = !1) : (this.h0 = this.h0 + e << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + s << 0, this.h3 = this.h3 + r << 0);
|
|
1724
|
+
}, Md5.prototype.hex = function() {
|
|
1725
|
+
this.finalize();
|
|
1726
|
+
var e = this.h0, t = this.h1, s = this.h2, r = this.h3;
|
|
1727
|
+
return HEX_CHARS[e >> 4 & 15] + HEX_CHARS[e & 15] + HEX_CHARS[e >> 12 & 15] + HEX_CHARS[e >> 8 & 15] + HEX_CHARS[e >> 20 & 15] + HEX_CHARS[e >> 16 & 15] + HEX_CHARS[e >> 28 & 15] + HEX_CHARS[e >> 24 & 15] + HEX_CHARS[t >> 4 & 15] + HEX_CHARS[t & 15] + HEX_CHARS[t >> 12 & 15] + HEX_CHARS[t >> 8 & 15] + HEX_CHARS[t >> 20 & 15] + HEX_CHARS[t >> 16 & 15] + HEX_CHARS[t >> 28 & 15] + HEX_CHARS[t >> 24 & 15] + HEX_CHARS[s >> 4 & 15] + HEX_CHARS[s & 15] + HEX_CHARS[s >> 12 & 15] + HEX_CHARS[s >> 8 & 15] + HEX_CHARS[s >> 20 & 15] + HEX_CHARS[s >> 16 & 15] + HEX_CHARS[s >> 28 & 15] + HEX_CHARS[s >> 24 & 15] + HEX_CHARS[r >> 4 & 15] + HEX_CHARS[r & 15] + HEX_CHARS[r >> 12 & 15] + HEX_CHARS[r >> 8 & 15] + HEX_CHARS[r >> 20 & 15] + HEX_CHARS[r >> 16 & 15] + HEX_CHARS[r >> 28 & 15] + HEX_CHARS[r >> 24 & 15];
|
|
1728
|
+
}, Md5.prototype.toString = Md5.prototype.hex, Md5.prototype.digest = function() {
|
|
1729
|
+
this.finalize();
|
|
1730
|
+
var e = this.h0, t = this.h1, s = this.h2, r = this.h3;
|
|
1731
|
+
return [
|
|
1732
|
+
e & 255,
|
|
1733
|
+
e >> 8 & 255,
|
|
1734
|
+
e >> 16 & 255,
|
|
1735
|
+
e >> 24 & 255,
|
|
1736
|
+
t & 255,
|
|
1737
|
+
t >> 8 & 255,
|
|
1738
|
+
t >> 16 & 255,
|
|
1739
|
+
t >> 24 & 255,
|
|
1740
|
+
s & 255,
|
|
1741
|
+
s >> 8 & 255,
|
|
1742
|
+
s >> 16 & 255,
|
|
1743
|
+
s >> 24 & 255,
|
|
1744
|
+
r & 255,
|
|
1745
|
+
r >> 8 & 255,
|
|
1746
|
+
r >> 16 & 255,
|
|
1747
|
+
r >> 24 & 255
|
|
1748
|
+
];
|
|
1749
|
+
}, Md5.prototype.array = Md5.prototype.digest, Md5.prototype.arrayBuffer = function() {
|
|
1750
|
+
this.finalize();
|
|
1751
|
+
var e = new ArrayBuffer(16), t = new Uint32Array(e);
|
|
1752
|
+
return t[0] = this.h0, t[1] = this.h1, t[2] = this.h2, t[3] = this.h3, e;
|
|
1753
|
+
}, Md5.prototype.buffer = Md5.prototype.arrayBuffer, Md5.prototype.base64 = function() {
|
|
1754
|
+
for (var e, t, s, r = "", i = this.array(), n = 0; n < 15; )
|
|
1755
|
+
e = i[n++], t = i[n++], s = i[n++], r += BASE64_ENCODE_CHAR[e >>> 2] + BASE64_ENCODE_CHAR[(e << 4 | t >>> 4) & 63] + BASE64_ENCODE_CHAR[(t << 2 | s >>> 6) & 63] + BASE64_ENCODE_CHAR[s & 63];
|
|
1756
|
+
return e = i[n], r += BASE64_ENCODE_CHAR[e >>> 2] + BASE64_ENCODE_CHAR[e << 4 & 63] + "==", r;
|
|
1757
|
+
};
|
|
1758
|
+
var exports$1 = createMethod();
|
|
1759
|
+
COMMON_JS ? module.exports = exports$1 : root.md5 = exports$1;
|
|
1760
|
+
})();
|
|
1761
|
+
})(md5$1)), md5$1.exports;
|
|
1762
|
+
}
|
|
1763
|
+
var md5Exports = requireMd5();
|
|
1764
|
+
const md5 = /* @__PURE__ */ getDefaultExportFromCjs(md5Exports);
|
|
1765
|
+
function parseHeaders(e) {
|
|
1766
|
+
const { url: t, data: s } = e, r = isFunction(e.token) ? e.token() || "" : e.token || "", i = () => md5(md5(r).toUpperCase() + JSON.stringify(s || {})).toUpperCase(), n = O(A({}, e.headers), {
|
|
1767
|
+
method: t,
|
|
1768
|
+
sign: i()
|
|
1769
|
+
});
|
|
1770
|
+
return r && (n.Authorization = "Bearer " + r), n;
|
|
1771
|
+
}
|
|
1772
|
+
function parseBody(e) {
|
|
1773
|
+
var i, n;
|
|
1774
|
+
const { data: t = {} } = e, s = ((i = e.headers) == null ? void 0 : i["Content-Type"]) || ((n = e.headers) == null ? void 0 : n["content-type"]), r = { data: {} };
|
|
1775
|
+
switch (s) {
|
|
1776
|
+
case EnumContentType.URL_ENCODED: {
|
|
1777
|
+
const o = new window.URLSearchParams();
|
|
1778
|
+
for (const [a, c] of Object.entries(t))
|
|
1779
|
+
o.append(a, c);
|
|
1780
|
+
r.data = o;
|
|
1781
|
+
break;
|
|
1782
|
+
}
|
|
1783
|
+
case EnumContentType.FORM: {
|
|
1784
|
+
const o = new FormData();
|
|
1785
|
+
for (const [a, c] of Object.entries(t))
|
|
1786
|
+
o.append(a, c);
|
|
1787
|
+
r.data = o;
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
default:
|
|
1791
|
+
r.data = t;
|
|
1792
|
+
break;
|
|
1793
|
+
}
|
|
1794
|
+
return r;
|
|
1795
|
+
}
|
|
1796
|
+
function parseRequest(e) {
|
|
1797
|
+
const t = parseBody(e), s = parseHeaders(e);
|
|
1798
|
+
return A(O(A({}, e), {
|
|
1799
|
+
headers: s
|
|
1800
|
+
}), t);
|
|
1801
|
+
}
|
|
1802
|
+
const b = class b {
|
|
1803
|
+
constructor(t) {
|
|
1804
|
+
S(this, "_client", null);
|
|
1805
|
+
S(this, "defaultReqConfig");
|
|
1806
|
+
this.defaultReqConfig = t, this.createHttp();
|
|
1807
|
+
}
|
|
1808
|
+
static get instance() {
|
|
1809
|
+
return b._instance;
|
|
1810
|
+
}
|
|
1811
|
+
/** 初始化配置 */
|
|
1812
|
+
static init(t) {
|
|
1813
|
+
if (!b._instance) {
|
|
1814
|
+
const s = Object.assign({}, defaultConfig, t);
|
|
1815
|
+
b._instance = new b(s);
|
|
1816
|
+
}
|
|
1817
|
+
return b._instance;
|
|
1818
|
+
}
|
|
1819
|
+
createHttp() {
|
|
1820
|
+
const t = axios.create(defaultConfig);
|
|
1821
|
+
handleInterceptor(t, this.defaultReqConfig), this._client = t;
|
|
1822
|
+
}
|
|
1823
|
+
/** 设置baseUrl */
|
|
1824
|
+
setBaseURL(t) {
|
|
1825
|
+
this.defaultReqConfig.baseURL = t;
|
|
1826
|
+
}
|
|
1827
|
+
setAdapter(t) {
|
|
1828
|
+
typeof wx == "object" && wx && (t.adapter = createWXAdapter);
|
|
1829
|
+
}
|
|
1830
|
+
get client() {
|
|
1831
|
+
return this._client;
|
|
1832
|
+
}
|
|
1833
|
+
/** 通用请求 */
|
|
1834
|
+
request(t) {
|
|
1835
|
+
const s = Object.assign({}, this.defaultReqConfig, t), r = parseRequest(s);
|
|
1836
|
+
return this.setAdapter(r), this.client.request(r);
|
|
1837
|
+
}
|
|
1838
|
+
/** get请求 */
|
|
1839
|
+
static get(t) {
|
|
1840
|
+
return b.init().request(A({ method: "get" }, t));
|
|
1841
|
+
}
|
|
1842
|
+
/** post请求 */
|
|
1843
|
+
static post(t) {
|
|
1844
|
+
return b.init().request(A({ method: "post" }, t));
|
|
1845
|
+
}
|
|
1846
|
+
/** put 请求 */
|
|
1847
|
+
static put(t) {
|
|
1848
|
+
return b.init().request(A({ method: "put" }, t));
|
|
1849
|
+
}
|
|
1850
|
+
/** delete 请求 */
|
|
1851
|
+
static delete(t) {
|
|
1852
|
+
return b.init().request(A({ method: "delete" }, t));
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
S(b, "_instance", null);
|
|
1856
|
+
let Http = b;
|
|
1857
|
+
const useHttp = (e) => (e.method = e.method || EnumMethod.POST, Http.init().request(e));
|
|
1858
|
+
export {
|
|
1859
|
+
Http,
|
|
1860
|
+
Http as default,
|
|
1861
|
+
defaultConfig,
|
|
1862
|
+
defaultInterceptors,
|
|
1863
|
+
useHttp
|
|
1864
|
+
};
|