@acrool/react-fetcher 0.0.4 → 0.0.6-alpha.0
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 -1
- package/dist/FetcherProvider/FetcherProvider.d.ts +1 -2
- package/dist/FetcherProvider/index.d.ts +1 -1
- package/dist/FetcherProvider/types.d.ts +2 -2
- package/dist/FetcherProvider/utils.d.ts +2 -2
- package/dist/acrool-react-fetcher.es.js +2553 -1727
- package/dist/acrool-react-fetcher.es.js.map +1 -0
- package/dist/exception/FetcherException.d.ts +14 -0
- package/dist/exception/index.d.ts +1 -1
- package/dist/fetchers/createRestFulFetcher/createRestFulFetcher.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/exception/SystemException.d.ts +0 -17
|
@@ -1,109 +1,160 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
return new Promise((
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import require$$0, { createContext, useContext, useState, useLayoutEffect } from "react";
|
|
5
|
+
function r$1(e2) {
|
|
6
|
+
return new Promise((t2) => {
|
|
7
7
|
setTimeout(() => {
|
|
8
|
-
|
|
9
|
-
},
|
|
8
|
+
t2(true);
|
|
9
|
+
}, e2);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const fetcherLeastTime = 400;
|
|
13
|
+
const isFile$1 = (input) => "File" in window && input instanceof File;
|
|
14
|
+
const isBlob$1 = (input) => "Blob" in window && input instanceof Blob;
|
|
15
|
+
const getVariablesFileMap = (originVariables, parentKey = ["variables"]) => {
|
|
16
|
+
return originVariables && Object.keys(originVariables).reduce((curr, key) => {
|
|
17
|
+
const row = originVariables[key];
|
|
18
|
+
if (isFile$1(row) || isBlob$1(row)) {
|
|
19
|
+
return {
|
|
20
|
+
variables: { ...curr.variables, [key]: null },
|
|
21
|
+
map: [...curr.map, parentKey.concat(key).join(".")],
|
|
22
|
+
values: [...curr.values, row]
|
|
23
|
+
};
|
|
24
|
+
} else if (row && typeof row === "object") {
|
|
25
|
+
const children = getVariablesFileMap(row, parentKey.concat(key));
|
|
26
|
+
return {
|
|
27
|
+
variables: { ...curr.variables, [key]: children.variables },
|
|
28
|
+
map: [...curr.map, ...children.map],
|
|
29
|
+
values: [...curr.values, ...children.values]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
15
32
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
values:
|
|
33
|
+
...curr,
|
|
34
|
+
variables: { ...curr.variables, [key]: row },
|
|
35
|
+
values: curr.values
|
|
19
36
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
}, { variables: {}, map: [], values: [] });
|
|
38
|
+
};
|
|
39
|
+
const createGraphQLFetcher = (axiosInstance, query) => {
|
|
40
|
+
return async (args) => {
|
|
41
|
+
let data = void 0;
|
|
42
|
+
let contentType = void 0;
|
|
43
|
+
const options = args == null ? void 0 : args.fetchOptions;
|
|
44
|
+
const variables = args == null ? void 0 : args.variables;
|
|
45
|
+
let isMultipartFormData = false;
|
|
46
|
+
if (variables) {
|
|
47
|
+
const varOptions = getVariablesFileMap(variables);
|
|
48
|
+
isMultipartFormData = varOptions.values.length > 0;
|
|
49
|
+
if (isMultipartFormData) {
|
|
50
|
+
contentType = "multipart/form-data";
|
|
51
|
+
const operations = JSON.stringify({
|
|
52
|
+
query,
|
|
53
|
+
variables: varOptions.variables
|
|
54
|
+
});
|
|
55
|
+
const fileMapObj = varOptions.map.reduce((acc, val, index) => {
|
|
56
|
+
acc[index] = [val];
|
|
57
|
+
return acc;
|
|
58
|
+
}, {});
|
|
59
|
+
const graphqlFormOptions = [
|
|
60
|
+
{ name: "operations", value: operations },
|
|
61
|
+
{ name: "map", value: JSON.stringify(fileMapObj) },
|
|
62
|
+
...varOptions.values.map((row, index) => {
|
|
63
|
+
return { name: index, value: row };
|
|
64
|
+
})
|
|
65
|
+
];
|
|
66
|
+
data = new FormData();
|
|
67
|
+
graphqlFormOptions.forEach((row) => {
|
|
68
|
+
data.append(row.name.toString(), row.value);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!isMultipartFormData) {
|
|
73
|
+
contentType = "application/json";
|
|
74
|
+
data = JSON.stringify({ query, variables });
|
|
75
|
+
}
|
|
76
|
+
const endpoint = "";
|
|
77
|
+
const headers = {
|
|
78
|
+
"Content-Type": contentType,
|
|
79
|
+
"Apollo-Require-Preflight": "true",
|
|
80
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
81
|
+
...options == null ? void 0 : options.headers
|
|
26
82
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
83
|
+
const [res] = await Promise.all([
|
|
84
|
+
axiosInstance.post(endpoint, data, {
|
|
85
|
+
...options,
|
|
86
|
+
headers
|
|
87
|
+
}),
|
|
88
|
+
r$1((options == null ? void 0 : options.leastTime) ?? fetcherLeastTime)
|
|
89
|
+
]);
|
|
90
|
+
return res.data.data;
|
|
32
91
|
};
|
|
33
|
-
}, { variables: {}, map: [], values: [] }), Wr = (e, t) => async (n) => {
|
|
34
|
-
let r, s;
|
|
35
|
-
const o = n == null ? void 0 : n.fetchOptions, i = n == null ? void 0 : n.variables;
|
|
36
|
-
let c = !1;
|
|
37
|
-
if (i) {
|
|
38
|
-
const p = ht(i);
|
|
39
|
-
if (c = p.values.length > 0, c) {
|
|
40
|
-
s = "multipart/form-data";
|
|
41
|
-
const y = JSON.stringify({
|
|
42
|
-
query: t,
|
|
43
|
-
variables: p.variables
|
|
44
|
-
}), T = p.map.reduce((R, m, S) => (R[S] = [m], R), {}), h = [
|
|
45
|
-
{ name: "operations", value: y },
|
|
46
|
-
{ name: "map", value: JSON.stringify(T) },
|
|
47
|
-
...p.values.map((R, m) => ({ name: m, value: R }))
|
|
48
|
-
];
|
|
49
|
-
r = new FormData(), h.forEach((R) => {
|
|
50
|
-
r.append(R.name.toString(), R.value);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
c || (s = "application/json", r = JSON.stringify({ query: t, variables: i }));
|
|
55
|
-
const d = "", l = {
|
|
56
|
-
"Content-Type": s,
|
|
57
|
-
"Apollo-Require-Preflight": "true",
|
|
58
|
-
"X-Requested-With": "XMLHttpRequest",
|
|
59
|
-
...o == null ? void 0 : o.headers
|
|
60
|
-
}, [u] = await Promise.all([
|
|
61
|
-
e.post(d, r, {
|
|
62
|
-
...o,
|
|
63
|
-
headers: l
|
|
64
|
-
}),
|
|
65
|
-
dt((o == null ? void 0 : o.leastTime) ?? pt)
|
|
66
|
-
]);
|
|
67
|
-
return u.data.data;
|
|
68
92
|
};
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
for (const [
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
else if (
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
} else Array.isArray(
|
|
79
|
-
typeof
|
|
80
|
-
}) : typeof
|
|
93
|
+
function $(t2) {
|
|
94
|
+
const n = new FormData(), e2 = (s2, r2 = "") => {
|
|
95
|
+
for (const [a2, o] of Object.entries(s2)) {
|
|
96
|
+
const i2 = r2 ? `${r2}[${a2}]` : a2;
|
|
97
|
+
if (o instanceof File)
|
|
98
|
+
n.append(i2, o);
|
|
99
|
+
else if (o instanceof Blob) {
|
|
100
|
+
const l2 = o.type.split("/")[1] || "bin", u2 = `${a2}.${l2}`;
|
|
101
|
+
n.append(i2, o, u2);
|
|
102
|
+
} else Array.isArray(o) ? o.forEach((c, l2) => {
|
|
103
|
+
typeof c == "object" && c !== null ? e2(c, `${i2}[${l2}]`) : n.append(`${i2}[${l2}]`, c);
|
|
104
|
+
}) : typeof o == "object" && o !== null ? e2(o, i2) : o != null && n.append(i2, o);
|
|
81
105
|
}
|
|
82
106
|
};
|
|
83
|
-
return
|
|
107
|
+
return e2(t2), n;
|
|
84
108
|
}
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
109
|
+
var ERequestContentType = /* @__PURE__ */ ((ERequestContentType2) => {
|
|
110
|
+
ERequestContentType2["formData"] = "multipart/form-data";
|
|
111
|
+
ERequestContentType2["formUrlDecode"] = "application/x-www-form-urlencoded";
|
|
112
|
+
ERequestContentType2["json"] = "application/json";
|
|
113
|
+
return ERequestContentType2;
|
|
114
|
+
})(ERequestContentType || {});
|
|
115
|
+
var ERequestMethod = /* @__PURE__ */ ((ERequestMethod2) => {
|
|
116
|
+
ERequestMethod2["GET"] = "GET";
|
|
117
|
+
ERequestMethod2["POST"] = "POST";
|
|
118
|
+
ERequestMethod2["PUT"] = "PUT";
|
|
119
|
+
ERequestMethod2["DELETE"] = "DELETE";
|
|
120
|
+
ERequestMethod2["PATCH"] = "PATCH";
|
|
121
|
+
return ERequestMethod2;
|
|
122
|
+
})(ERequestMethod || {});
|
|
123
|
+
const getDataWithContentType = (contentType, data = {}) => {
|
|
124
|
+
if ([ERequestContentType.formData, ERequestContentType.formUrlDecode].includes(contentType)) return $(data);
|
|
125
|
+
return JSON.stringify(data);
|
|
126
|
+
};
|
|
127
|
+
const getContentTypeWithMethod = (method) => {
|
|
128
|
+
return ERequestContentType.json;
|
|
105
129
|
};
|
|
106
|
-
|
|
130
|
+
const createRestFulFetcher = (axiosInstance, document2, contentTypeResolver = getContentTypeWithMethod) => {
|
|
131
|
+
return async (args) => {
|
|
132
|
+
var _a;
|
|
133
|
+
const method = (document2 == null ? void 0 : document2.method) || "";
|
|
134
|
+
const options = args == null ? void 0 : args.fetchOptions;
|
|
135
|
+
const body = typeof args === "object" && args !== null && "body" in args ? args.body : void 0;
|
|
136
|
+
const params = typeof args === "object" && args !== null && "params" in args ? args.params : void 0;
|
|
137
|
+
const contentType = ((_a = options == null ? void 0 : options.headers) == null ? void 0 : _a.contentType) ?? contentTypeResolver(method.toUpperCase());
|
|
138
|
+
const config = {
|
|
139
|
+
url: document2.url,
|
|
140
|
+
method,
|
|
141
|
+
params,
|
|
142
|
+
data: getDataWithContentType(contentType, body),
|
|
143
|
+
...options,
|
|
144
|
+
headers: {
|
|
145
|
+
...options == null ? void 0 : options.headers,
|
|
146
|
+
"Content-Type": contentType
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const [res] = await Promise.all([
|
|
150
|
+
axiosInstance(config),
|
|
151
|
+
r$1((options == null ? void 0 : options.leastTime) ?? fetcherLeastTime)
|
|
152
|
+
]);
|
|
153
|
+
return res.data;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
var jsxRuntime = { exports: {} };
|
|
157
|
+
var reactJsxRuntime_production = {};
|
|
107
158
|
/**
|
|
108
159
|
* @license React
|
|
109
160
|
* react-jsx-runtime.production.js
|
|
@@ -113,29 +164,35 @@ var ce = { exports: {} }, Z = {};
|
|
|
113
164
|
* This source code is licensed under the MIT license found in the
|
|
114
165
|
* LICENSE file in the root directory of this source tree.
|
|
115
166
|
*/
|
|
116
|
-
var
|
|
117
|
-
function
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
var
|
|
121
|
-
function
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
167
|
+
var hasRequiredReactJsxRuntime_production;
|
|
168
|
+
function requireReactJsxRuntime_production() {
|
|
169
|
+
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
170
|
+
hasRequiredReactJsxRuntime_production = 1;
|
|
171
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
172
|
+
function jsxProd(type, config, maybeKey) {
|
|
173
|
+
var key = null;
|
|
174
|
+
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
175
|
+
void 0 !== config.key && (key = "" + config.key);
|
|
176
|
+
if ("key" in config) {
|
|
177
|
+
maybeKey = {};
|
|
178
|
+
for (var propName in config)
|
|
179
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
180
|
+
} else maybeKey = config;
|
|
181
|
+
config = maybeKey.ref;
|
|
182
|
+
return {
|
|
183
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
184
|
+
type,
|
|
185
|
+
key,
|
|
186
|
+
ref: void 0 !== config ? config : null,
|
|
187
|
+
props: maybeKey
|
|
134
188
|
};
|
|
135
189
|
}
|
|
136
|
-
|
|
190
|
+
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
191
|
+
reactJsxRuntime_production.jsx = jsxProd;
|
|
192
|
+
reactJsxRuntime_production.jsxs = jsxProd;
|
|
193
|
+
return reactJsxRuntime_production;
|
|
137
194
|
}
|
|
138
|
-
var
|
|
195
|
+
var reactJsxRuntime_development = {};
|
|
139
196
|
/**
|
|
140
197
|
* @license React
|
|
141
198
|
* react-jsx-runtime.development.js
|
|
@@ -145,435 +202,445 @@ var Q = {};
|
|
|
145
202
|
* This source code is licensed under the MIT license found in the
|
|
146
203
|
* LICENSE file in the root directory of this source tree.
|
|
147
204
|
*/
|
|
148
|
-
var
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
205
|
+
var hasRequiredReactJsxRuntime_development;
|
|
206
|
+
function requireReactJsxRuntime_development() {
|
|
207
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
208
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
209
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
210
|
+
function getComponentNameFromType(type) {
|
|
211
|
+
if (null == type) return null;
|
|
212
|
+
if ("function" === typeof type)
|
|
213
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
214
|
+
if ("string" === typeof type) return type;
|
|
215
|
+
switch (type) {
|
|
216
|
+
case REACT_FRAGMENT_TYPE:
|
|
158
217
|
return "Fragment";
|
|
159
|
-
case
|
|
218
|
+
case REACT_PROFILER_TYPE:
|
|
160
219
|
return "Profiler";
|
|
161
|
-
case
|
|
220
|
+
case REACT_STRICT_MODE_TYPE:
|
|
162
221
|
return "StrictMode";
|
|
163
|
-
case
|
|
222
|
+
case REACT_SUSPENSE_TYPE:
|
|
164
223
|
return "Suspense";
|
|
165
|
-
case
|
|
224
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
166
225
|
return "SuspenseList";
|
|
167
|
-
case
|
|
226
|
+
case REACT_ACTIVITY_TYPE:
|
|
168
227
|
return "Activity";
|
|
169
228
|
}
|
|
170
|
-
if (
|
|
171
|
-
switch (typeof
|
|
229
|
+
if ("object" === typeof type)
|
|
230
|
+
switch ("number" === typeof type.tag && console.error(
|
|
172
231
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
173
|
-
),
|
|
174
|
-
case
|
|
232
|
+
), type.$$typeof) {
|
|
233
|
+
case REACT_PORTAL_TYPE:
|
|
175
234
|
return "Portal";
|
|
176
|
-
case
|
|
177
|
-
return (
|
|
178
|
-
case
|
|
179
|
-
return (
|
|
180
|
-
case
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return
|
|
185
|
-
case
|
|
186
|
-
|
|
235
|
+
case REACT_CONTEXT_TYPE:
|
|
236
|
+
return (type.displayName || "Context") + ".Provider";
|
|
237
|
+
case REACT_CONSUMER_TYPE:
|
|
238
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
239
|
+
case REACT_FORWARD_REF_TYPE:
|
|
240
|
+
var innerType = type.render;
|
|
241
|
+
type = type.displayName;
|
|
242
|
+
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
243
|
+
return type;
|
|
244
|
+
case REACT_MEMO_TYPE:
|
|
245
|
+
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
246
|
+
case REACT_LAZY_TYPE:
|
|
247
|
+
innerType = type._payload;
|
|
248
|
+
type = type._init;
|
|
187
249
|
try {
|
|
188
|
-
return
|
|
189
|
-
} catch {
|
|
250
|
+
return getComponentNameFromType(type(innerType));
|
|
251
|
+
} catch (x) {
|
|
190
252
|
}
|
|
191
253
|
}
|
|
192
254
|
return null;
|
|
193
255
|
}
|
|
194
|
-
function
|
|
195
|
-
return "" +
|
|
256
|
+
function testStringCoercion(value) {
|
|
257
|
+
return "" + value;
|
|
196
258
|
}
|
|
197
|
-
function
|
|
259
|
+
function checkKeyStringCoercion(value) {
|
|
198
260
|
try {
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
} catch {
|
|
202
|
-
|
|
261
|
+
testStringCoercion(value);
|
|
262
|
+
var JSCompiler_inline_result = false;
|
|
263
|
+
} catch (e2) {
|
|
264
|
+
JSCompiler_inline_result = true;
|
|
203
265
|
}
|
|
204
|
-
if (
|
|
205
|
-
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
266
|
+
if (JSCompiler_inline_result) {
|
|
267
|
+
JSCompiler_inline_result = console;
|
|
268
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
269
|
+
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
270
|
+
JSCompiler_temp_const.call(
|
|
271
|
+
JSCompiler_inline_result,
|
|
209
272
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
210
|
-
|
|
211
|
-
)
|
|
273
|
+
JSCompiler_inline_result$jscomp$0
|
|
274
|
+
);
|
|
275
|
+
return testStringCoercion(value);
|
|
212
276
|
}
|
|
213
277
|
}
|
|
214
|
-
function
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
278
|
+
function getTaskName(type) {
|
|
279
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
280
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
217
281
|
return "<...>";
|
|
218
282
|
try {
|
|
219
|
-
var
|
|
220
|
-
return
|
|
221
|
-
} catch {
|
|
283
|
+
var name = getComponentNameFromType(type);
|
|
284
|
+
return name ? "<" + name + ">" : "<...>";
|
|
285
|
+
} catch (x) {
|
|
222
286
|
return "<...>";
|
|
223
287
|
}
|
|
224
288
|
}
|
|
225
|
-
function
|
|
226
|
-
var
|
|
227
|
-
return
|
|
289
|
+
function getOwner() {
|
|
290
|
+
var dispatcher = ReactSharedInternals.A;
|
|
291
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
228
292
|
}
|
|
229
|
-
function
|
|
293
|
+
function UnknownOwner() {
|
|
230
294
|
return Error("react-stack-top-frame");
|
|
231
295
|
}
|
|
232
|
-
function
|
|
233
|
-
if (
|
|
234
|
-
var
|
|
235
|
-
if (
|
|
296
|
+
function hasValidKey(config) {
|
|
297
|
+
if (hasOwnProperty2.call(config, "key")) {
|
|
298
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
299
|
+
if (getter && getter.isReactWarning) return false;
|
|
236
300
|
}
|
|
237
|
-
return
|
|
301
|
+
return void 0 !== config.key;
|
|
238
302
|
}
|
|
239
|
-
function
|
|
240
|
-
function
|
|
241
|
-
|
|
303
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
304
|
+
function warnAboutAccessingKey() {
|
|
305
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
|
|
242
306
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
243
|
-
|
|
307
|
+
displayName
|
|
244
308
|
));
|
|
245
309
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
310
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
311
|
+
Object.defineProperty(props, "key", {
|
|
312
|
+
get: warnAboutAccessingKey,
|
|
313
|
+
configurable: true
|
|
249
314
|
});
|
|
250
315
|
}
|
|
251
|
-
function
|
|
252
|
-
var
|
|
253
|
-
|
|
316
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
317
|
+
var componentName = getComponentNameFromType(this.type);
|
|
318
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
|
|
254
319
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
255
|
-
))
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
enumerable:
|
|
270
|
-
|
|
320
|
+
));
|
|
321
|
+
componentName = this.props.ref;
|
|
322
|
+
return void 0 !== componentName ? componentName : null;
|
|
323
|
+
}
|
|
324
|
+
function ReactElement(type, key, self2, source, owner, props, debugStack, debugTask) {
|
|
325
|
+
self2 = props.ref;
|
|
326
|
+
type = {
|
|
327
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
328
|
+
type,
|
|
329
|
+
key,
|
|
330
|
+
props,
|
|
331
|
+
_owner: owner
|
|
332
|
+
};
|
|
333
|
+
null !== (void 0 !== self2 ? self2 : null) ? Object.defineProperty(type, "ref", {
|
|
334
|
+
enumerable: false,
|
|
335
|
+
get: elementRefGetterWithDeprecationWarning
|
|
336
|
+
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
337
|
+
type._store = {};
|
|
338
|
+
Object.defineProperty(type._store, "validated", {
|
|
339
|
+
configurable: false,
|
|
340
|
+
enumerable: false,
|
|
341
|
+
writable: true,
|
|
271
342
|
value: 0
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
345
|
+
configurable: false,
|
|
346
|
+
enumerable: false,
|
|
347
|
+
writable: true,
|
|
276
348
|
value: null
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
349
|
+
});
|
|
350
|
+
Object.defineProperty(type, "_debugStack", {
|
|
351
|
+
configurable: false,
|
|
352
|
+
enumerable: false,
|
|
353
|
+
writable: true,
|
|
354
|
+
value: debugStack
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(type, "_debugTask", {
|
|
357
|
+
configurable: false,
|
|
358
|
+
enumerable: false,
|
|
359
|
+
writable: true,
|
|
360
|
+
value: debugTask
|
|
361
|
+
});
|
|
362
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
363
|
+
return type;
|
|
364
|
+
}
|
|
365
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self2, debugStack, debugTask) {
|
|
366
|
+
var children = config.children;
|
|
367
|
+
if (void 0 !== children)
|
|
368
|
+
if (isStaticChildren)
|
|
369
|
+
if (isArrayImpl(children)) {
|
|
370
|
+
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
|
|
371
|
+
validateChildKeys(children[isStaticChildren]);
|
|
372
|
+
Object.freeze && Object.freeze(children);
|
|
297
373
|
} else
|
|
298
374
|
console.error(
|
|
299
375
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
300
376
|
);
|
|
301
|
-
else
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
var
|
|
305
|
-
return
|
|
377
|
+
else validateChildKeys(children);
|
|
378
|
+
if (hasOwnProperty2.call(config, "key")) {
|
|
379
|
+
children = getComponentNameFromType(type);
|
|
380
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
381
|
+
return "key" !== k;
|
|
306
382
|
});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
let props = %s
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
k,
|
|
316
|
-
Y,
|
|
317
|
-
k
|
|
318
|
-
), Je[k + C] = !0);
|
|
383
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
384
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
385
|
+
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
386
|
+
isStaticChildren,
|
|
387
|
+
children,
|
|
388
|
+
keys,
|
|
389
|
+
children
|
|
390
|
+
), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
319
391
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
392
|
+
children = null;
|
|
393
|
+
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
394
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
395
|
+
if ("key" in config) {
|
|
396
|
+
maybeKey = {};
|
|
397
|
+
for (var propName in config)
|
|
398
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
399
|
+
} else maybeKey = config;
|
|
400
|
+
children && defineKeyPropWarningGetter(
|
|
401
|
+
maybeKey,
|
|
402
|
+
"function" === typeof type ? type.displayName || type.name || "Unknown" : type
|
|
403
|
+
);
|
|
404
|
+
return ReactElement(
|
|
405
|
+
type,
|
|
406
|
+
children,
|
|
407
|
+
self2,
|
|
408
|
+
source,
|
|
409
|
+
getOwner(),
|
|
410
|
+
maybeKey,
|
|
411
|
+
debugStack,
|
|
412
|
+
debugTask
|
|
337
413
|
);
|
|
338
414
|
}
|
|
339
|
-
function
|
|
340
|
-
|
|
415
|
+
function validateChildKeys(node) {
|
|
416
|
+
"object" === typeof node && null !== node && node.$$typeof === REACT_ELEMENT_TYPE && node._store && (node._store.validated = 1);
|
|
341
417
|
}
|
|
342
|
-
var
|
|
418
|
+
var React = require$$0, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
419
|
+
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
343
420
|
return null;
|
|
344
421
|
};
|
|
345
|
-
|
|
346
|
-
"react-stack-bottom-frame": function(
|
|
347
|
-
return
|
|
422
|
+
React = {
|
|
423
|
+
"react-stack-bottom-frame": function(callStackForError) {
|
|
424
|
+
return callStackForError();
|
|
348
425
|
}
|
|
349
426
|
};
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
427
|
+
var specialPropKeyWarningShown;
|
|
428
|
+
var didWarnAboutElementRef = {};
|
|
429
|
+
var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
|
|
430
|
+
React,
|
|
431
|
+
UnknownOwner
|
|
432
|
+
)();
|
|
433
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
434
|
+
var didWarnAboutKeySpread = {};
|
|
435
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
436
|
+
reactJsxRuntime_development.jsx = function(type, config, maybeKey, source, self2) {
|
|
437
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
438
|
+
return jsxDEVImpl(
|
|
439
|
+
type,
|
|
440
|
+
config,
|
|
441
|
+
maybeKey,
|
|
442
|
+
false,
|
|
443
|
+
source,
|
|
444
|
+
self2,
|
|
445
|
+
trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
446
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
365
447
|
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
448
|
+
};
|
|
449
|
+
reactJsxRuntime_development.jsxs = function(type, config, maybeKey, source, self2) {
|
|
450
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
451
|
+
return jsxDEVImpl(
|
|
452
|
+
type,
|
|
453
|
+
config,
|
|
454
|
+
maybeKey,
|
|
455
|
+
true,
|
|
456
|
+
source,
|
|
457
|
+
self2,
|
|
458
|
+
trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
459
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
377
460
|
);
|
|
378
461
|
};
|
|
379
|
-
}()
|
|
462
|
+
}();
|
|
463
|
+
return reactJsxRuntime_development;
|
|
380
464
|
}
|
|
381
|
-
var
|
|
382
|
-
function
|
|
383
|
-
|
|
465
|
+
var hasRequiredJsxRuntime;
|
|
466
|
+
function requireJsxRuntime() {
|
|
467
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
468
|
+
hasRequiredJsxRuntime = 1;
|
|
469
|
+
if (process.env.NODE_ENV === "production") {
|
|
470
|
+
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
471
|
+
} else {
|
|
472
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
473
|
+
}
|
|
474
|
+
return jsxRuntime.exports;
|
|
384
475
|
}
|
|
385
|
-
var
|
|
386
|
-
const
|
|
476
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
477
|
+
const s = [
|
|
387
478
|
"color: #fff",
|
|
388
479
|
"display: inline-block",
|
|
389
480
|
"font-size: 11px",
|
|
390
481
|
"line-height: 20px",
|
|
391
482
|
"padding-right: 8px",
|
|
392
483
|
"border-radius: 4px"
|
|
393
|
-
],
|
|
484
|
+
], t = {
|
|
394
485
|
primary: "#0055a9",
|
|
395
486
|
success: "#009422",
|
|
396
487
|
info: "#17a2b8",
|
|
397
488
|
warning: "#d7a000",
|
|
398
489
|
danger: "#ec2127"
|
|
399
490
|
};
|
|
400
|
-
function
|
|
401
|
-
console.log(`%c ${
|
|
491
|
+
function a(n, o, ...c) {
|
|
492
|
+
console.log(`%c ${n}`, o, ...c);
|
|
402
493
|
}
|
|
403
|
-
function
|
|
404
|
-
const
|
|
405
|
-
`background-color: ${
|
|
494
|
+
function i(n, ...o) {
|
|
495
|
+
const c = s.concat([
|
|
496
|
+
`background-color: ${t.primary}`
|
|
406
497
|
]).join(";");
|
|
407
|
-
|
|
498
|
+
a(n, c, ...o);
|
|
408
499
|
}
|
|
409
|
-
function
|
|
410
|
-
const
|
|
411
|
-
`background-color: ${
|
|
500
|
+
function r(n, ...o) {
|
|
501
|
+
const c = s.concat([
|
|
502
|
+
`background-color: ${t.success}`
|
|
412
503
|
]).join(";");
|
|
413
|
-
|
|
504
|
+
a(n, c, ...o);
|
|
414
505
|
}
|
|
415
|
-
function
|
|
416
|
-
const
|
|
417
|
-
`background-color: ${
|
|
506
|
+
function e(n, ...o) {
|
|
507
|
+
const c = s.concat([
|
|
508
|
+
`background-color: ${t.info}`
|
|
418
509
|
]).join(";");
|
|
419
|
-
|
|
510
|
+
a(n, c, ...o);
|
|
420
511
|
}
|
|
421
|
-
function
|
|
422
|
-
const
|
|
423
|
-
`background-color: ${
|
|
512
|
+
function l(n, ...o) {
|
|
513
|
+
const c = s.concat([
|
|
514
|
+
`background-color: ${t.warning}`
|
|
424
515
|
]).join(";");
|
|
425
|
-
|
|
516
|
+
a(n, c, ...o);
|
|
426
517
|
}
|
|
427
|
-
function
|
|
428
|
-
const
|
|
429
|
-
`background-color: ${
|
|
518
|
+
function g(n, ...o) {
|
|
519
|
+
const c = s.concat([
|
|
520
|
+
`background-color: ${t.danger}`
|
|
430
521
|
]).join(";");
|
|
431
|
-
|
|
522
|
+
a(n, c, ...o);
|
|
432
523
|
}
|
|
433
|
-
const
|
|
434
|
-
primary:
|
|
435
|
-
success:
|
|
436
|
-
info:
|
|
437
|
-
warning:
|
|
438
|
-
danger:
|
|
524
|
+
const u = {
|
|
525
|
+
primary: i,
|
|
526
|
+
success: r,
|
|
527
|
+
info: e,
|
|
528
|
+
warning: l,
|
|
529
|
+
danger: g
|
|
439
530
|
};
|
|
440
|
-
function
|
|
441
|
-
const
|
|
442
|
-
isZero: (
|
|
443
|
-
isFalse: (
|
|
531
|
+
function w(e2, t2) {
|
|
532
|
+
const r2 = {
|
|
533
|
+
isZero: (t2 == null ? void 0 : t2.isZero) ?? true,
|
|
534
|
+
isFalse: (t2 == null ? void 0 : t2.isFalse) ?? true
|
|
444
535
|
};
|
|
445
|
-
return
|
|
536
|
+
return e2 == null || r2.isFalse && (e2 === false || e2 === "false") || r2.isZero && (e2 === 0 || e2 === "0") || !(e2 instanceof Date) && typeof e2 == "object" && Object.keys(e2).length === 0 || typeof e2 == "string" && e2.trim().length === 0;
|
|
446
537
|
}
|
|
447
|
-
function
|
|
448
|
-
|
|
449
|
-
isZero:
|
|
450
|
-
isFalse:
|
|
451
|
-
}
|
|
538
|
+
function D(e2, t2) {
|
|
539
|
+
const r2 = {
|
|
540
|
+
isZero: true,
|
|
541
|
+
isFalse: true
|
|
542
|
+
};
|
|
543
|
+
return !w(e2, r2);
|
|
452
544
|
}
|
|
453
|
-
class
|
|
454
|
-
constructor(
|
|
455
|
-
super(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
this.
|
|
461
|
-
|
|
462
|
-
|
|
545
|
+
class FetcherException extends Error {
|
|
546
|
+
constructor(response) {
|
|
547
|
+
super(response.message);
|
|
548
|
+
__publicField(this, "code");
|
|
549
|
+
__publicField(this, "args");
|
|
550
|
+
__publicField(this, "path");
|
|
551
|
+
this.response = response;
|
|
552
|
+
this.code = response.code;
|
|
553
|
+
this.args = response.args;
|
|
554
|
+
this.path = response.path;
|
|
463
555
|
this.name = this.constructor.name;
|
|
464
|
-
|
|
465
|
-
getInfo() {
|
|
466
|
-
return {
|
|
467
|
-
message: this.response.message,
|
|
468
|
-
code: this.response.code,
|
|
469
|
-
args: this.response.args,
|
|
470
|
-
path: this.response.path
|
|
471
|
-
};
|
|
556
|
+
Object.setPrototypeOf(this, FetcherException.prototype);
|
|
472
557
|
}
|
|
473
558
|
}
|
|
474
|
-
const
|
|
559
|
+
const AuthStateContext = createContext({
|
|
475
560
|
lastUpdateTimestamp: 0,
|
|
476
|
-
isAuth:
|
|
477
|
-
getTokens: () =>
|
|
478
|
-
|
|
479
|
-
|
|
561
|
+
isAuth: false,
|
|
562
|
+
getTokens: () => {
|
|
563
|
+
u.warning("AuthStateContext", "getTokens not yet ready");
|
|
564
|
+
return null;
|
|
565
|
+
},
|
|
566
|
+
updateTokens: () => u.warning("AuthStateContext", "updateTokens not yet ready"),
|
|
567
|
+
forceLogout: () => u.warning("AuthStateContext", "forceLogout not yet ready"),
|
|
480
568
|
refreshTokens: async () => {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
569
|
+
u.warning("AuthStateContext", "refreshToken not yet ready");
|
|
570
|
+
return void 0;
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
const useAuthState = () => useContext(AuthStateContext);
|
|
574
|
+
const AuthStateProvider = ({
|
|
575
|
+
children,
|
|
576
|
+
onGetTokens,
|
|
577
|
+
onSetTokens,
|
|
578
|
+
onRefreshTokens,
|
|
579
|
+
onForceLogout,
|
|
580
|
+
isDebug = false
|
|
490
581
|
}) => {
|
|
491
|
-
const [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
582
|
+
const [lastUpdateTimestamp, setLastUpdateTimestamp] = useState(0);
|
|
583
|
+
const [isAuth, setIsAuth] = useState(() => {
|
|
584
|
+
return D(onGetTokens());
|
|
585
|
+
});
|
|
586
|
+
const updateTokens = (tokensOrUpdater) => {
|
|
587
|
+
let nextTokens;
|
|
588
|
+
if (typeof tokensOrUpdater === "function") {
|
|
589
|
+
nextTokens = tokensOrUpdater(onGetTokens());
|
|
590
|
+
} else {
|
|
591
|
+
nextTokens = tokensOrUpdater;
|
|
592
|
+
}
|
|
593
|
+
onSetTokens(nextTokens);
|
|
594
|
+
setIsAuth(D(nextTokens));
|
|
595
|
+
setLastUpdateTimestamp(Date.now());
|
|
596
|
+
};
|
|
597
|
+
const handleOnForceLogout = () => {
|
|
598
|
+
updateTokens(null);
|
|
599
|
+
if (onForceLogout) {
|
|
600
|
+
onForceLogout();
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
const handleOnRefreshTokens = async () => {
|
|
604
|
+
var _a;
|
|
605
|
+
const refreshToken = (_a = onGetTokens()) == null ? void 0 : _a.refreshToken;
|
|
606
|
+
if (!refreshToken || !onRefreshTokens) {
|
|
607
|
+
if (isDebug) u.danger("[AuthStateProvider] handleOnRefreshTokens", "refreshToken|onRefreshTokens empty");
|
|
608
|
+
throw new FetcherException({ message: "refreshToken|onRefreshTokens empty", code: "REFRESH_TOKEN_EMPTY" });
|
|
609
|
+
}
|
|
501
610
|
try {
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
611
|
+
const authTokens = await onRefreshTokens(refreshToken);
|
|
612
|
+
if (w(authTokens)) {
|
|
613
|
+
if (isDebug) u.danger("[AuthStateProvider] handleOnRefreshTokens", "new refresh token fail");
|
|
614
|
+
throw new FetcherException({ message: "new refresh token fail", code: "NEW_REFRESH_TOKEN_EMPTY" });
|
|
615
|
+
}
|
|
616
|
+
updateTokens(authTokens);
|
|
506
617
|
return;
|
|
507
|
-
} catch {
|
|
508
|
-
|
|
618
|
+
} catch (err) {
|
|
619
|
+
handleOnForceLogout();
|
|
620
|
+
throw new FetcherException({ message: "refresh token fail", code: "REFRESH_TOKEN_CATCH" });
|
|
509
621
|
}
|
|
510
622
|
};
|
|
511
|
-
return /* @__PURE__ */
|
|
512
|
-
lastUpdateTimestamp
|
|
513
|
-
isAuth
|
|
514
|
-
getTokens:
|
|
515
|
-
updateTokens
|
|
516
|
-
refreshTokens:
|
|
517
|
-
forceLogout:
|
|
518
|
-
}, children
|
|
519
|
-
}, Ge = {
|
|
520
|
-
"en-US": {
|
|
521
|
-
400: "The requested parameter is wrong",
|
|
522
|
-
401: "Please login before continuing",
|
|
523
|
-
404: "Request Not Found/Route",
|
|
524
|
-
413: "The request/file sent exceeds the server limit size",
|
|
525
|
-
500: "Internal Server Error",
|
|
526
|
-
503: "System under maintenance",
|
|
527
|
-
504: "Please check your network and try again",
|
|
528
|
-
511: "Area not available",
|
|
529
|
-
CANCEL_ERROR: "Request has been cancelled. Only possible if `cancelToken` is provided in config, see axios `Cancellation`",
|
|
530
|
-
CLIENT_ERROR: "Any non-specific 400 series error",
|
|
531
|
-
CONNECTION_ERROR: "Server not available, bad dns",
|
|
532
|
-
NETWORK_ERROR: "Your mobile network connection is unstable. Please check your network connection status and try again.",
|
|
533
|
-
SERVER_ERROR: "Any 500 series error",
|
|
534
|
-
TIMEOUT_ERROR: "The server has not responded for more than {sec} seconds. Please confirm your network connection status or contact customer service"
|
|
535
|
-
},
|
|
536
|
-
"zh-TW": {
|
|
537
|
-
400: "請求的參數錯誤",
|
|
538
|
-
401: "請先登入再繼續",
|
|
539
|
-
404: "請求未找到/路由錯誤",
|
|
540
|
-
413: "請求/發送的檔案超出伺服器限制大小",
|
|
541
|
-
500: "內部伺服器錯誤",
|
|
542
|
-
503: "系統維護",
|
|
543
|
-
504: "請檢查網路後重試",
|
|
544
|
-
511: "區域不可用",
|
|
545
|
-
CANCEL_ERROR: "請求已取消。僅在配置中提供 `cancelToken` 時可能發生,請參閱 axios 的 `Cancellation`",
|
|
546
|
-
CLIENT_ERROR: "任意非特定的400系列錯誤",
|
|
547
|
-
CONNECTION_ERROR: "伺服器不可用,DNS錯誤",
|
|
548
|
-
NETWORK_ERROR: "您的行動網路連線不穩定。請檢查網路連線後重試。 ",
|
|
549
|
-
SERVER_ERROR: "任意500系列錯誤",
|
|
550
|
-
TIMEOUT_ERROR: "伺服器已超過 {sec} 秒未回應。請確認您的網路連線狀態或聯絡客服"
|
|
551
|
-
},
|
|
552
|
-
"zh-CN": {
|
|
553
|
-
400: "请求的参数错误",
|
|
554
|
-
401: "请先登录再继续",
|
|
555
|
-
404: "请求未找到/路由错误",
|
|
556
|
-
413: "请求/发送的文件超出服务器限制大小",
|
|
557
|
-
500: "内部服务器错误",
|
|
558
|
-
503: "系统维护中",
|
|
559
|
-
504: "请检查网络后重试",
|
|
560
|
-
511: "区域不可用",
|
|
561
|
-
CANCEL_ERROR: "请求已取消。仅当配置中提供 `cancelToken` 时可能发生,请参阅 axios 的 `Cancellation`",
|
|
562
|
-
CLIENT_ERROR: "任意非特定的400系列错误",
|
|
563
|
-
CONNECTION_ERROR: "服务器不可用,DNS错误",
|
|
564
|
-
NETWORK_ERROR: "您的移动网络连接不稳定。请检查网络连接后重试。",
|
|
565
|
-
SERVER_ERROR: "任意500系列错误",
|
|
566
|
-
TIMEOUT_ERROR: "服务器已超过 {sec} 秒未响应。请确认您的网络连接状态或联系客服"
|
|
567
|
-
}
|
|
623
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(AuthStateContext.Provider, { value: {
|
|
624
|
+
lastUpdateTimestamp,
|
|
625
|
+
isAuth,
|
|
626
|
+
getTokens: onGetTokens,
|
|
627
|
+
updateTokens,
|
|
628
|
+
refreshTokens: handleOnRefreshTokens,
|
|
629
|
+
forceLogout: handleOnForceLogout
|
|
630
|
+
}, children });
|
|
568
631
|
};
|
|
569
|
-
class
|
|
570
|
-
constructor(
|
|
571
|
-
super(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
this.response =
|
|
632
|
+
class AxiosCancelException extends Error {
|
|
633
|
+
constructor(response) {
|
|
634
|
+
super(response.message);
|
|
635
|
+
__publicField(this, "code");
|
|
636
|
+
__publicField(this, "devInfo");
|
|
637
|
+
__publicField(this, "args");
|
|
638
|
+
__publicField(this, "path");
|
|
639
|
+
this.response = response;
|
|
640
|
+
this.code = response.code;
|
|
641
|
+
this.args = response.args;
|
|
642
|
+
this.path = response.path;
|
|
643
|
+
this.initName();
|
|
577
644
|
}
|
|
578
645
|
initName() {
|
|
579
646
|
this.name = this.constructor.name;
|
|
@@ -587,320 +654,550 @@ class fn extends Error {
|
|
|
587
654
|
};
|
|
588
655
|
}
|
|
589
656
|
}
|
|
590
|
-
const
|
|
591
|
-
var
|
|
592
|
-
|
|
657
|
+
const getGraphQLResponseFormatError = (axiosError) => {
|
|
658
|
+
var _a, _b, _c;
|
|
659
|
+
const responseData = (_a = axiosError == null ? void 0 : axiosError.response) == null ? void 0 : _a.data;
|
|
660
|
+
if ((_b = responseData.errors) == null ? void 0 : _b[0]) {
|
|
661
|
+
return (_c = responseData.errors) == null ? void 0 : _c[0];
|
|
662
|
+
}
|
|
663
|
+
if (axiosError == null ? void 0 : axiosError.isAxiosError) {
|
|
664
|
+
return {
|
|
665
|
+
message: axiosError.message,
|
|
666
|
+
code: axiosError.code
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
return {
|
|
593
670
|
message: "Axios error",
|
|
594
671
|
code: "ERR_SYS_BAD_RESPONSE"
|
|
595
672
|
};
|
|
596
|
-
}, dn = (e) => e != null && e.data ? e == null ? void 0 : e.data : {
|
|
597
|
-
message: "Axios error",
|
|
598
|
-
code: "ERR_SYS_BAD_RESPONSE"
|
|
599
673
|
};
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
674
|
+
const getRestFulResponseFormatError = (axiosError) => {
|
|
675
|
+
var _a;
|
|
676
|
+
const responseData = (_a = axiosError == null ? void 0 : axiosError.response) == null ? void 0 : _a.data;
|
|
677
|
+
if (responseData) {
|
|
678
|
+
return responseData;
|
|
679
|
+
}
|
|
680
|
+
if (axiosError == null ? void 0 : axiosError.isAxiosError) {
|
|
681
|
+
return {
|
|
682
|
+
message: axiosError.message,
|
|
683
|
+
code: axiosError.code
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
return {
|
|
687
|
+
message: "Axios error",
|
|
688
|
+
code: "ERR_SYS_BAD_RESPONSE"
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
let isTokenRefreshing = false;
|
|
692
|
+
let pendingRequestQueues = [];
|
|
693
|
+
const AxiosClientContext = createContext(null);
|
|
694
|
+
const FetcherProvider = ({
|
|
695
|
+
children,
|
|
696
|
+
axiosInstance,
|
|
697
|
+
locale = "en-US",
|
|
698
|
+
getResponseFormatError = getRestFulResponseFormatError,
|
|
699
|
+
onError,
|
|
700
|
+
checkIsRefreshTokenRequest,
|
|
701
|
+
authorizationPrefix = "Bearer",
|
|
702
|
+
isDebug = false
|
|
611
703
|
}) => {
|
|
612
704
|
const {
|
|
613
|
-
getTokens
|
|
614
|
-
updateTokens
|
|
615
|
-
refreshTokens
|
|
616
|
-
forceLogout
|
|
617
|
-
} =
|
|
618
|
-
|
|
619
|
-
const
|
|
705
|
+
getTokens,
|
|
706
|
+
updateTokens,
|
|
707
|
+
refreshTokens,
|
|
708
|
+
forceLogout
|
|
709
|
+
} = useAuthState();
|
|
710
|
+
useLayoutEffect(() => {
|
|
711
|
+
const interceptorReq = axiosInstance.interceptors.request.use(interceptorsRequest);
|
|
712
|
+
const interceptorRes = axiosInstance.interceptors.response.use(interceptorsResponseSuccess, interceptorsResponseError);
|
|
620
713
|
return () => {
|
|
621
|
-
|
|
714
|
+
axiosInstance.interceptors.request.eject(interceptorReq);
|
|
715
|
+
axiosInstance.interceptors.response.eject(interceptorRes);
|
|
622
716
|
};
|
|
623
|
-
}, [
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
717
|
+
}, [getTokens, refreshTokens, updateTokens, forceLogout]);
|
|
718
|
+
const runPendingRequest = (isSuccess) => {
|
|
719
|
+
if (isDebug) u.warning("[FetcherProvider] runPendingRequest", { isSuccess });
|
|
720
|
+
isTokenRefreshing = false;
|
|
721
|
+
for (const cb of pendingRequestQueues) {
|
|
722
|
+
cb(isSuccess);
|
|
723
|
+
}
|
|
724
|
+
pendingRequestQueues = [];
|
|
725
|
+
};
|
|
726
|
+
const pushPendingRequestQueues = (resolve, reject) => {
|
|
727
|
+
return (originConfig) => {
|
|
728
|
+
if (isDebug) u.info("[FetcherProvider] Request add pending queue", { originConfig });
|
|
729
|
+
pendingRequestQueues.push((isTokenRefreshOK) => {
|
|
730
|
+
if (isTokenRefreshOK) {
|
|
731
|
+
originConfig.pendingRequest = true;
|
|
732
|
+
resolve(axiosInstance(originConfig));
|
|
733
|
+
} else {
|
|
734
|
+
reject(new FetcherException({
|
|
735
|
+
message: "Please login before continuing",
|
|
736
|
+
code: "UNAUTHORIZED",
|
|
737
|
+
path: "AxiosClientProvider.pushPendingRequestQueues"
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
const interceptorsRequest = (originConfig) => {
|
|
744
|
+
return new Promise((resolve, reject) => {
|
|
745
|
+
var _a, _b;
|
|
746
|
+
originConfig.headers["Accept-Language"] = locale;
|
|
747
|
+
const accessTokens = (_a = getTokens()) == null ? void 0 : _a.accessToken;
|
|
748
|
+
const forceGuest = (_b = originConfig.fetchOptions) == null ? void 0 : _b.forceGuest;
|
|
749
|
+
if (!forceGuest && accessTokens) {
|
|
750
|
+
originConfig.headers["Authorization"] = [authorizationPrefix, accessTokens].filter((str) => str).join(" ");
|
|
751
|
+
}
|
|
752
|
+
const isRefreshTokenAPI = originConfig && checkIsRefreshTokenRequest ? checkIsRefreshTokenRequest(originConfig) : false;
|
|
753
|
+
if (!isRefreshTokenAPI && isTokenRefreshing) {
|
|
754
|
+
pushPendingRequestQueues(resolve, reject)(originConfig);
|
|
755
|
+
reject(new AxiosCancelException({
|
|
756
|
+
message: "Token refreshing, so request save queues not send",
|
|
757
|
+
code: "REFRESHING_TOKEN"
|
|
758
|
+
}));
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
resolve(originConfig);
|
|
636
762
|
});
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
763
|
+
};
|
|
764
|
+
const interceptorsResponseSuccess = (response) => {
|
|
765
|
+
if (isDebug) u.info("[FetcherProvider] interceptorsResponseSuccess", { response });
|
|
766
|
+
return response;
|
|
767
|
+
};
|
|
768
|
+
const interceptorsResponseError = (axiosError) => {
|
|
769
|
+
const response = axiosError.response;
|
|
770
|
+
const originalConfig = axiosError.config;
|
|
771
|
+
const status = axiosError.status;
|
|
772
|
+
const responseFirstError = getResponseFormatError(axiosError);
|
|
773
|
+
if (isDebug) u.warning("[FetcherProvider] interceptorsResponseError", { status, responseFirstError });
|
|
774
|
+
if (onError) {
|
|
775
|
+
onError(responseFirstError);
|
|
647
776
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
777
|
+
const isRefresh = originalConfig && checkIsRefreshTokenRequest ? checkIsRefreshTokenRequest(originalConfig) : false;
|
|
778
|
+
if (response && originalConfig) {
|
|
779
|
+
if (status === 401 || responseFirstError.code === "UNAUTHENTICATED") {
|
|
780
|
+
const tokens = getTokens();
|
|
781
|
+
if (isDebug) u.warning("[FetcherProvider] enter refresh token flow", { refreshToken: tokens == null ? void 0 : tokens.refreshToken });
|
|
782
|
+
if (w(tokens == null ? void 0 : tokens.refreshToken) || isRefresh || originalConfig.pendingRequest) {
|
|
783
|
+
isTokenRefreshing = false;
|
|
784
|
+
if (isDebug) u.warning("[FetcherProvider] no refreshToken/refreshAPI|pendingRequest fail, force logout");
|
|
785
|
+
forceLogout();
|
|
786
|
+
return Promise.reject(new FetcherException(responseFirstError));
|
|
787
|
+
}
|
|
788
|
+
if (!isTokenRefreshing) {
|
|
789
|
+
isTokenRefreshing = true;
|
|
790
|
+
if (isDebug) u.warning("[FetcherProvider] refreshTokens");
|
|
791
|
+
refreshTokens().then(() => {
|
|
792
|
+
if (isDebug) u.info("[FetcherProvider] refreshTokens success");
|
|
793
|
+
runPendingRequest(true);
|
|
794
|
+
}).catch(() => {
|
|
795
|
+
if (isDebug) u.danger("[FetcherProvider] refreshTokens fail");
|
|
796
|
+
runPendingRequest(false);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
return new Promise((resolve, reject) => {
|
|
800
|
+
pushPendingRequestQueues(resolve, reject)(originalConfig);
|
|
801
|
+
});
|
|
802
|
+
}
|
|
665
803
|
}
|
|
666
|
-
return Promise.reject(new
|
|
804
|
+
return Promise.reject(new FetcherException(responseFirstError));
|
|
667
805
|
};
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
|
|
806
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
807
|
+
AxiosClientContext.Provider,
|
|
670
808
|
{
|
|
671
|
-
value:
|
|
672
|
-
children
|
|
809
|
+
value: axiosInstance,
|
|
810
|
+
children
|
|
673
811
|
}
|
|
674
812
|
);
|
|
675
813
|
};
|
|
676
|
-
function
|
|
677
|
-
return function() {
|
|
678
|
-
return
|
|
814
|
+
function bind(fn, thisArg) {
|
|
815
|
+
return function wrap() {
|
|
816
|
+
return fn.apply(thisArg, arguments);
|
|
679
817
|
};
|
|
680
818
|
}
|
|
681
|
-
const { toString
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return
|
|
819
|
+
const { toString } = Object.prototype;
|
|
820
|
+
const { getPrototypeOf } = Object;
|
|
821
|
+
const { iterator, toStringTag } = Symbol;
|
|
822
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
823
|
+
const str = toString.call(thing);
|
|
824
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
825
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
826
|
+
const kindOfTest = (type) => {
|
|
827
|
+
type = type.toLowerCase();
|
|
828
|
+
return (thing) => kindOf(thing) === type;
|
|
829
|
+
};
|
|
830
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
831
|
+
const { isArray } = Array;
|
|
832
|
+
const isUndefined = typeOfTest("undefined");
|
|
833
|
+
function isBuffer(val) {
|
|
834
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
687
835
|
}
|
|
688
|
-
const
|
|
689
|
-
function
|
|
690
|
-
let
|
|
691
|
-
|
|
836
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
837
|
+
function isArrayBufferView(val) {
|
|
838
|
+
let result;
|
|
839
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
840
|
+
result = ArrayBuffer.isView(val);
|
|
841
|
+
} else {
|
|
842
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
843
|
+
}
|
|
844
|
+
return result;
|
|
692
845
|
}
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
846
|
+
const isString = typeOfTest("string");
|
|
847
|
+
const isFunction = typeOfTest("function");
|
|
848
|
+
const isNumber = typeOfTest("number");
|
|
849
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
850
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
851
|
+
const isPlainObject = (val) => {
|
|
852
|
+
if (kindOf(val) !== "object") {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
const prototype2 = getPrototypeOf(val);
|
|
856
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
857
|
+
};
|
|
858
|
+
const isDate = kindOfTest("Date");
|
|
859
|
+
const isFile = kindOfTest("File");
|
|
860
|
+
const isBlob = kindOfTest("Blob");
|
|
861
|
+
const isFileList = kindOfTest("FileList");
|
|
862
|
+
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
863
|
+
const isFormData = (thing) => {
|
|
864
|
+
let kind;
|
|
865
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
866
|
+
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
867
|
+
};
|
|
868
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
869
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
870
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
871
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
872
|
+
if (obj === null || typeof obj === "undefined") {
|
|
705
873
|
return;
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
for (
|
|
714
|
-
|
|
874
|
+
}
|
|
875
|
+
let i2;
|
|
876
|
+
let l2;
|
|
877
|
+
if (typeof obj !== "object") {
|
|
878
|
+
obj = [obj];
|
|
879
|
+
}
|
|
880
|
+
if (isArray(obj)) {
|
|
881
|
+
for (i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
|
882
|
+
fn.call(null, obj[i2], i2, obj);
|
|
883
|
+
}
|
|
884
|
+
} else {
|
|
885
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
886
|
+
const len = keys.length;
|
|
887
|
+
let key;
|
|
888
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
889
|
+
key = keys[i2];
|
|
890
|
+
fn.call(null, obj[key], key, obj);
|
|
891
|
+
}
|
|
715
892
|
}
|
|
716
893
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
894
|
+
function findKey(obj, key) {
|
|
895
|
+
key = key.toLowerCase();
|
|
896
|
+
const keys = Object.keys(obj);
|
|
897
|
+
let i2 = keys.length;
|
|
898
|
+
let _key;
|
|
899
|
+
while (i2-- > 0) {
|
|
900
|
+
_key = keys[i2];
|
|
901
|
+
if (key === _key.toLowerCase()) {
|
|
902
|
+
return _key;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
724
905
|
return null;
|
|
725
906
|
}
|
|
726
|
-
const
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
907
|
+
const _global = (() => {
|
|
908
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
909
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
910
|
+
})();
|
|
911
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
912
|
+
function merge() {
|
|
913
|
+
const { caseless } = isContextDefined(this) && this || {};
|
|
914
|
+
const result = {};
|
|
915
|
+
const assignValue = (val, key) => {
|
|
916
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
917
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
918
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
919
|
+
} else if (isPlainObject(val)) {
|
|
920
|
+
result[targetKey] = merge({}, val);
|
|
921
|
+
} else if (isArray(val)) {
|
|
922
|
+
result[targetKey] = val.slice();
|
|
923
|
+
} else {
|
|
924
|
+
result[targetKey] = val;
|
|
925
|
+
}
|
|
731
926
|
};
|
|
732
|
-
for (let
|
|
733
|
-
arguments[
|
|
734
|
-
|
|
927
|
+
for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
|
928
|
+
arguments[i2] && forEach(arguments[i2], assignValue);
|
|
929
|
+
}
|
|
930
|
+
return result;
|
|
735
931
|
}
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
932
|
+
const extend = (a2, b, thisArg, { allOwnKeys } = {}) => {
|
|
933
|
+
forEach(b, (val, key) => {
|
|
934
|
+
if (thisArg && isFunction(val)) {
|
|
935
|
+
a2[key] = bind(val, thisArg);
|
|
936
|
+
} else {
|
|
937
|
+
a2[key] = val;
|
|
938
|
+
}
|
|
939
|
+
}, { allOwnKeys });
|
|
940
|
+
return a2;
|
|
941
|
+
};
|
|
942
|
+
const stripBOM = (content) => {
|
|
943
|
+
if (content.charCodeAt(0) === 65279) {
|
|
944
|
+
content = content.slice(1);
|
|
945
|
+
}
|
|
946
|
+
return content;
|
|
947
|
+
};
|
|
948
|
+
const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
949
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
950
|
+
constructor.prototype.constructor = constructor;
|
|
951
|
+
Object.defineProperty(constructor, "super", {
|
|
952
|
+
value: superConstructor.prototype
|
|
953
|
+
});
|
|
954
|
+
props && Object.assign(constructor.prototype, props);
|
|
955
|
+
};
|
|
956
|
+
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
957
|
+
let props;
|
|
958
|
+
let i2;
|
|
959
|
+
let prop;
|
|
960
|
+
const merged = {};
|
|
961
|
+
destObj = destObj || {};
|
|
962
|
+
if (sourceObj == null) return destObj;
|
|
746
963
|
do {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
const r = e.indexOf(t, n);
|
|
755
|
-
return r !== -1 && r === n;
|
|
756
|
-
}, Un = (e) => {
|
|
757
|
-
if (!e) return null;
|
|
758
|
-
if (X(e)) return e;
|
|
759
|
-
let t = e.length;
|
|
760
|
-
if (!wt(t)) return null;
|
|
761
|
-
const n = new Array(t);
|
|
762
|
-
for (; t-- > 0; )
|
|
763
|
-
n[t] = e[t];
|
|
764
|
-
return n;
|
|
765
|
-
}, Dn = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && De(Uint8Array)), Bn = (e, t) => {
|
|
766
|
-
const r = (e && e[me]).call(e);
|
|
767
|
-
let s;
|
|
768
|
-
for (; (s = r.next()) && !s.done; ) {
|
|
769
|
-
const o = s.value;
|
|
770
|
-
t.call(e, o[0], o[1]);
|
|
771
|
-
}
|
|
772
|
-
}, qn = (e, t) => {
|
|
773
|
-
let n;
|
|
774
|
-
const r = [];
|
|
775
|
-
for (; (n = e.exec(t)) !== null; )
|
|
776
|
-
r.push(n);
|
|
777
|
-
return r;
|
|
778
|
-
}, In = D("HTMLFormElement"), $n = (e) => e.toLowerCase().replace(
|
|
779
|
-
/[-_\s]([a-z\d])(\w*)/g,
|
|
780
|
-
function(n, r, s) {
|
|
781
|
-
return r.toUpperCase() + s;
|
|
782
|
-
}
|
|
783
|
-
), Ze = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Mn = D("RegExp"), St = (e, t) => {
|
|
784
|
-
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
785
|
-
ie(n, (s, o) => {
|
|
786
|
-
let i;
|
|
787
|
-
(i = t(s, o, e)) !== !1 && (r[o] = i || s);
|
|
788
|
-
}), Object.defineProperties(e, r);
|
|
789
|
-
}, Hn = (e) => {
|
|
790
|
-
St(e, (t, n) => {
|
|
791
|
-
if (L(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
792
|
-
return !1;
|
|
793
|
-
const r = e[n];
|
|
794
|
-
if (L(r)) {
|
|
795
|
-
if (t.enumerable = !1, "writable" in t) {
|
|
796
|
-
t.writable = !1;
|
|
797
|
-
return;
|
|
964
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
965
|
+
i2 = props.length;
|
|
966
|
+
while (i2-- > 0) {
|
|
967
|
+
prop = props[i2];
|
|
968
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
969
|
+
destObj[prop] = sourceObj[prop];
|
|
970
|
+
merged[prop] = true;
|
|
798
971
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
972
|
+
}
|
|
973
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
974
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
975
|
+
return destObj;
|
|
976
|
+
};
|
|
977
|
+
const endsWith = (str, searchString, position) => {
|
|
978
|
+
str = String(str);
|
|
979
|
+
if (position === void 0 || position > str.length) {
|
|
980
|
+
position = str.length;
|
|
981
|
+
}
|
|
982
|
+
position -= searchString.length;
|
|
983
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
984
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
985
|
+
};
|
|
986
|
+
const toArray = (thing) => {
|
|
987
|
+
if (!thing) return null;
|
|
988
|
+
if (isArray(thing)) return thing;
|
|
989
|
+
let i2 = thing.length;
|
|
990
|
+
if (!isNumber(i2)) return null;
|
|
991
|
+
const arr = new Array(i2);
|
|
992
|
+
while (i2-- > 0) {
|
|
993
|
+
arr[i2] = thing[i2];
|
|
994
|
+
}
|
|
995
|
+
return arr;
|
|
996
|
+
};
|
|
997
|
+
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
998
|
+
return (thing) => {
|
|
999
|
+
return TypedArray && thing instanceof TypedArray;
|
|
1000
|
+
};
|
|
1001
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
1002
|
+
const forEachEntry = (obj, fn) => {
|
|
1003
|
+
const generator = obj && obj[iterator];
|
|
1004
|
+
const _iterator = generator.call(obj);
|
|
1005
|
+
let result;
|
|
1006
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
1007
|
+
const pair = result.value;
|
|
1008
|
+
fn.call(obj, pair[0], pair[1]);
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
const matchAll = (regExp, str) => {
|
|
1012
|
+
let matches;
|
|
1013
|
+
const arr = [];
|
|
1014
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
1015
|
+
arr.push(matches);
|
|
1016
|
+
}
|
|
1017
|
+
return arr;
|
|
1018
|
+
};
|
|
1019
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
1020
|
+
const toCamelCase = (str) => {
|
|
1021
|
+
return str.toLowerCase().replace(
|
|
1022
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
1023
|
+
function replacer(m, p1, p2) {
|
|
1024
|
+
return p1.toUpperCase() + p2;
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1027
|
+
};
|
|
1028
|
+
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
1029
|
+
const isRegExp = kindOfTest("RegExp");
|
|
1030
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
1031
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
1032
|
+
const reducedDescriptors = {};
|
|
1033
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
1034
|
+
let ret;
|
|
1035
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
1036
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
1040
|
+
};
|
|
1041
|
+
const freezeMethods = (obj) => {
|
|
1042
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
1043
|
+
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
const value = obj[name];
|
|
1047
|
+
if (!isFunction(value)) return;
|
|
1048
|
+
descriptor.enumerable = false;
|
|
1049
|
+
if ("writable" in descriptor) {
|
|
1050
|
+
descriptor.writable = false;
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
if (!descriptor.set) {
|
|
1054
|
+
descriptor.set = () => {
|
|
1055
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
1056
|
+
};
|
|
802
1057
|
}
|
|
803
1058
|
});
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1059
|
+
};
|
|
1060
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1061
|
+
const obj = {};
|
|
1062
|
+
const define = (arr) => {
|
|
1063
|
+
arr.forEach((value) => {
|
|
1064
|
+
obj[value] = true;
|
|
808
1065
|
});
|
|
809
1066
|
};
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
|
|
1067
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
1068
|
+
return obj;
|
|
1069
|
+
};
|
|
1070
|
+
const noop = () => {
|
|
1071
|
+
};
|
|
1072
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
1073
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
1074
|
+
};
|
|
1075
|
+
function isSpecCompliantForm(thing) {
|
|
1076
|
+
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
815
1077
|
}
|
|
816
|
-
const
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
1078
|
+
const toJSONObject = (obj) => {
|
|
1079
|
+
const stack = new Array(10);
|
|
1080
|
+
const visit = (source, i2) => {
|
|
1081
|
+
if (isObject(source)) {
|
|
1082
|
+
if (stack.indexOf(source) >= 0) {
|
|
820
1083
|
return;
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1084
|
+
}
|
|
1085
|
+
if (!("toJSON" in source)) {
|
|
1086
|
+
stack[i2] = source;
|
|
1087
|
+
const target = isArray(source) ? [] : {};
|
|
1088
|
+
forEach(source, (value, key) => {
|
|
1089
|
+
const reducedValue = visit(value, i2 + 1);
|
|
1090
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
1091
|
+
});
|
|
1092
|
+
stack[i2] = void 0;
|
|
1093
|
+
return target;
|
|
828
1094
|
}
|
|
829
1095
|
}
|
|
830
|
-
return
|
|
1096
|
+
return source;
|
|
831
1097
|
};
|
|
832
|
-
return
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1098
|
+
return visit(obj, 0);
|
|
1099
|
+
};
|
|
1100
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
1101
|
+
const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
1102
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1103
|
+
if (setImmediateSupported) {
|
|
1104
|
+
return setImmediate;
|
|
1105
|
+
}
|
|
1106
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
1107
|
+
_global.addEventListener("message", ({ source, data }) => {
|
|
1108
|
+
if (source === _global && data === token) {
|
|
1109
|
+
callbacks.length && callbacks.shift()();
|
|
1110
|
+
}
|
|
1111
|
+
}, false);
|
|
1112
|
+
return (cb) => {
|
|
1113
|
+
callbacks.push(cb);
|
|
1114
|
+
_global.postMessage(token, "*");
|
|
1115
|
+
};
|
|
1116
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
1117
|
+
})(
|
|
1118
|
+
typeof setImmediate === "function",
|
|
1119
|
+
isFunction(_global.postMessage)
|
|
1120
|
+
);
|
|
1121
|
+
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
1122
|
+
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
1123
|
+
const utils$1 = {
|
|
1124
|
+
isArray,
|
|
1125
|
+
isArrayBuffer,
|
|
1126
|
+
isBuffer,
|
|
1127
|
+
isFormData,
|
|
1128
|
+
isArrayBufferView,
|
|
1129
|
+
isString,
|
|
1130
|
+
isNumber,
|
|
1131
|
+
isBoolean,
|
|
1132
|
+
isObject,
|
|
1133
|
+
isPlainObject,
|
|
1134
|
+
isReadableStream,
|
|
1135
|
+
isRequest,
|
|
1136
|
+
isResponse,
|
|
1137
|
+
isHeaders,
|
|
1138
|
+
isUndefined,
|
|
1139
|
+
isDate,
|
|
1140
|
+
isFile,
|
|
1141
|
+
isBlob,
|
|
1142
|
+
isRegExp,
|
|
1143
|
+
isFunction,
|
|
1144
|
+
isStream,
|
|
1145
|
+
isURLSearchParams,
|
|
1146
|
+
isTypedArray,
|
|
1147
|
+
isFileList,
|
|
1148
|
+
forEach,
|
|
1149
|
+
merge,
|
|
1150
|
+
extend,
|
|
1151
|
+
trim,
|
|
1152
|
+
stripBOM,
|
|
1153
|
+
inherits,
|
|
1154
|
+
toFlatObject,
|
|
1155
|
+
kindOf,
|
|
1156
|
+
kindOfTest,
|
|
1157
|
+
endsWith,
|
|
1158
|
+
toArray,
|
|
1159
|
+
forEachEntry,
|
|
1160
|
+
matchAll,
|
|
1161
|
+
isHTMLForm,
|
|
1162
|
+
hasOwnProperty,
|
|
1163
|
+
hasOwnProp: hasOwnProperty,
|
|
881
1164
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
882
|
-
reduceDescriptors
|
|
883
|
-
freezeMethods
|
|
884
|
-
toObjectSet
|
|
885
|
-
toCamelCase
|
|
886
|
-
noop
|
|
887
|
-
toFiniteNumber
|
|
888
|
-
findKey
|
|
889
|
-
global:
|
|
890
|
-
isContextDefined
|
|
891
|
-
isSpecCompliantForm
|
|
892
|
-
toJSONObject
|
|
893
|
-
isAsyncFn
|
|
894
|
-
isThenable
|
|
895
|
-
setImmediate:
|
|
896
|
-
asap
|
|
897
|
-
isIterable
|
|
1165
|
+
reduceDescriptors,
|
|
1166
|
+
freezeMethods,
|
|
1167
|
+
toObjectSet,
|
|
1168
|
+
toCamelCase,
|
|
1169
|
+
noop,
|
|
1170
|
+
toFiniteNumber,
|
|
1171
|
+
findKey,
|
|
1172
|
+
global: _global,
|
|
1173
|
+
isContextDefined,
|
|
1174
|
+
isSpecCompliantForm,
|
|
1175
|
+
toJSONObject,
|
|
1176
|
+
isAsyncFn,
|
|
1177
|
+
isThenable,
|
|
1178
|
+
setImmediate: _setImmediate,
|
|
1179
|
+
asap,
|
|
1180
|
+
isIterable
|
|
898
1181
|
};
|
|
899
|
-
function
|
|
900
|
-
Error.call(this)
|
|
1182
|
+
function AxiosError$1(message, code, config, request, response) {
|
|
1183
|
+
Error.call(this);
|
|
1184
|
+
if (Error.captureStackTrace) {
|
|
1185
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1186
|
+
} else {
|
|
1187
|
+
this.stack = new Error().stack;
|
|
1188
|
+
}
|
|
1189
|
+
this.message = message;
|
|
1190
|
+
this.name = "AxiosError";
|
|
1191
|
+
code && (this.code = code);
|
|
1192
|
+
config && (this.config = config);
|
|
1193
|
+
request && (this.request = request);
|
|
1194
|
+
if (response) {
|
|
1195
|
+
this.response = response;
|
|
1196
|
+
this.status = response.status ? response.status : null;
|
|
1197
|
+
}
|
|
901
1198
|
}
|
|
902
|
-
|
|
903
|
-
toJSON: function() {
|
|
1199
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
1200
|
+
toJSON: function toJSON() {
|
|
904
1201
|
return {
|
|
905
1202
|
// Standard
|
|
906
1203
|
message: this.message,
|
|
@@ -914,13 +1211,14 @@ a.inherits(b, Error, {
|
|
|
914
1211
|
columnNumber: this.columnNumber,
|
|
915
1212
|
stack: this.stack,
|
|
916
1213
|
// Axios
|
|
917
|
-
config:
|
|
1214
|
+
config: utils$1.toJSONObject(this.config),
|
|
918
1215
|
code: this.code,
|
|
919
1216
|
status: this.status
|
|
920
1217
|
};
|
|
921
1218
|
}
|
|
922
1219
|
});
|
|
923
|
-
const
|
|
1220
|
+
const prototype$1 = AxiosError$1.prototype;
|
|
1221
|
+
const descriptors = {};
|
|
924
1222
|
[
|
|
925
1223
|
"ERR_BAD_OPTION_VALUE",
|
|
926
1224
|
"ERR_BAD_OPTION",
|
|
@@ -935,98 +1233,136 @@ const At = b.prototype, _t = {};
|
|
|
935
1233
|
"ERR_NOT_SUPPORT",
|
|
936
1234
|
"ERR_INVALID_URL"
|
|
937
1235
|
// eslint-disable-next-line func-names
|
|
938
|
-
].forEach((
|
|
939
|
-
|
|
1236
|
+
].forEach((code) => {
|
|
1237
|
+
descriptors[code] = { value: code };
|
|
940
1238
|
});
|
|
941
|
-
Object.defineProperties(
|
|
942
|
-
Object.defineProperty(
|
|
943
|
-
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
return
|
|
947
|
-
}, (
|
|
1239
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
1240
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
1241
|
+
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
1242
|
+
const axiosError = Object.create(prototype$1);
|
|
1243
|
+
utils$1.toFlatObject(error, axiosError, function filter2(obj) {
|
|
1244
|
+
return obj !== Error.prototype;
|
|
1245
|
+
}, (prop) => {
|
|
1246
|
+
return prop !== "isAxiosError";
|
|
1247
|
+
});
|
|
1248
|
+
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
|
1249
|
+
axiosError.cause = error;
|
|
1250
|
+
axiosError.name = error.name;
|
|
1251
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1252
|
+
return axiosError;
|
|
948
1253
|
};
|
|
949
|
-
const
|
|
950
|
-
function
|
|
951
|
-
return
|
|
1254
|
+
const httpAdapter = null;
|
|
1255
|
+
function isVisitable(thing) {
|
|
1256
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
952
1257
|
}
|
|
953
|
-
function
|
|
954
|
-
return
|
|
1258
|
+
function removeBrackets(key) {
|
|
1259
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
955
1260
|
}
|
|
956
|
-
function
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1261
|
+
function renderKey(path, key, dots) {
|
|
1262
|
+
if (!path) return key;
|
|
1263
|
+
return path.concat(key).map(function each(token, i2) {
|
|
1264
|
+
token = removeBrackets(token);
|
|
1265
|
+
return !dots && i2 ? "[" + token + "]" : token;
|
|
1266
|
+
}).join(dots ? "." : "");
|
|
960
1267
|
}
|
|
961
|
-
function
|
|
962
|
-
return
|
|
1268
|
+
function isFlatArray(arr) {
|
|
1269
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
963
1270
|
}
|
|
964
|
-
const
|
|
965
|
-
return /^is[A-Z]/.test(
|
|
1271
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1272
|
+
return /^is[A-Z]/.test(prop);
|
|
966
1273
|
});
|
|
967
|
-
function
|
|
968
|
-
if (!
|
|
1274
|
+
function toFormData$1(obj, formData, options) {
|
|
1275
|
+
if (!utils$1.isObject(obj)) {
|
|
969
1276
|
throw new TypeError("target must be an object");
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1277
|
+
}
|
|
1278
|
+
formData = formData || new FormData();
|
|
1279
|
+
options = utils$1.toFlatObject(options, {
|
|
1280
|
+
metaTokens: true,
|
|
1281
|
+
dots: false,
|
|
1282
|
+
indexes: false
|
|
1283
|
+
}, false, function defined(option, source) {
|
|
1284
|
+
return !utils$1.isUndefined(source[option]);
|
|
976
1285
|
});
|
|
977
|
-
const
|
|
978
|
-
|
|
1286
|
+
const metaTokens = options.metaTokens;
|
|
1287
|
+
const visitor = options.visitor || defaultVisitor;
|
|
1288
|
+
const dots = options.dots;
|
|
1289
|
+
const indexes = options.indexes;
|
|
1290
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
1291
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1292
|
+
if (!utils$1.isFunction(visitor)) {
|
|
979
1293
|
throw new TypeError("visitor must be a function");
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
if (
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1294
|
+
}
|
|
1295
|
+
function convertValue(value) {
|
|
1296
|
+
if (value === null) return "";
|
|
1297
|
+
if (utils$1.isDate(value)) {
|
|
1298
|
+
return value.toISOString();
|
|
1299
|
+
}
|
|
1300
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
1301
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
1302
|
+
}
|
|
1303
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1304
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
1305
|
+
}
|
|
1306
|
+
return value;
|
|
1307
|
+
}
|
|
1308
|
+
function defaultVisitor(value, key, path) {
|
|
1309
|
+
let arr = value;
|
|
1310
|
+
if (value && !path && typeof value === "object") {
|
|
1311
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
1312
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1313
|
+
value = JSON.stringify(value);
|
|
1314
|
+
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
1315
|
+
key = removeBrackets(key);
|
|
1316
|
+
arr.forEach(function each(el, index) {
|
|
1317
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
996
1318
|
// eslint-disable-next-line no-nested-ternary
|
|
997
|
-
|
|
998
|
-
|
|
1319
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
1320
|
+
convertValue(el)
|
|
999
1321
|
);
|
|
1000
|
-
})
|
|
1322
|
+
});
|
|
1323
|
+
return false;
|
|
1324
|
+
}
|
|
1001
1325
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1326
|
+
if (isVisitable(value)) {
|
|
1327
|
+
return true;
|
|
1328
|
+
}
|
|
1329
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1330
|
+
return false;
|
|
1331
|
+
}
|
|
1332
|
+
const stack = [];
|
|
1333
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
1334
|
+
defaultVisitor,
|
|
1335
|
+
convertValue,
|
|
1336
|
+
isVisitable
|
|
1008
1337
|
});
|
|
1009
|
-
function
|
|
1010
|
-
if (
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1338
|
+
function build(value, path) {
|
|
1339
|
+
if (utils$1.isUndefined(value)) return;
|
|
1340
|
+
if (stack.indexOf(value) !== -1) {
|
|
1341
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
1342
|
+
}
|
|
1343
|
+
stack.push(value);
|
|
1344
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1345
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
1346
|
+
formData,
|
|
1347
|
+
el,
|
|
1348
|
+
utils$1.isString(key) ? key.trim() : key,
|
|
1349
|
+
path,
|
|
1350
|
+
exposedHelpers
|
|
1351
|
+
);
|
|
1352
|
+
if (result === true) {
|
|
1353
|
+
build(el, path ? path.concat(key) : [key]);
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
stack.pop();
|
|
1357
|
+
}
|
|
1358
|
+
if (!utils$1.isObject(obj)) {
|
|
1025
1359
|
throw new TypeError("data must be an object");
|
|
1026
|
-
|
|
1360
|
+
}
|
|
1361
|
+
build(obj);
|
|
1362
|
+
return formData;
|
|
1027
1363
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const
|
|
1364
|
+
function encode$1(str) {
|
|
1365
|
+
const charMap = {
|
|
1030
1366
|
"!": "%21",
|
|
1031
1367
|
"'": "%27",
|
|
1032
1368
|
"(": "%28",
|
|
@@ -1035,44 +1371,56 @@ function et(e) {
|
|
|
1035
1371
|
"%20": "+",
|
|
1036
1372
|
"%00": "\0"
|
|
1037
1373
|
};
|
|
1038
|
-
return encodeURIComponent(
|
|
1039
|
-
return
|
|
1374
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1375
|
+
return charMap[match];
|
|
1040
1376
|
});
|
|
1041
1377
|
}
|
|
1042
|
-
function
|
|
1043
|
-
this._pairs = []
|
|
1378
|
+
function AxiosURLSearchParams(params, options) {
|
|
1379
|
+
this._pairs = [];
|
|
1380
|
+
params && toFormData$1(params, this, options);
|
|
1044
1381
|
}
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
this._pairs.push([
|
|
1382
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
1383
|
+
prototype.append = function append(name, value) {
|
|
1384
|
+
this._pairs.push([name, value]);
|
|
1048
1385
|
};
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
return
|
|
1052
|
-
} :
|
|
1053
|
-
return this._pairs.map(function(
|
|
1054
|
-
return
|
|
1386
|
+
prototype.toString = function toString2(encoder) {
|
|
1387
|
+
const _encode = encoder ? function(value) {
|
|
1388
|
+
return encoder.call(this, value, encode$1);
|
|
1389
|
+
} : encode$1;
|
|
1390
|
+
return this._pairs.map(function each(pair) {
|
|
1391
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
1055
1392
|
}, "").join("&");
|
|
1056
1393
|
};
|
|
1057
|
-
function
|
|
1058
|
-
return encodeURIComponent(
|
|
1394
|
+
function encode(val) {
|
|
1395
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
1059
1396
|
}
|
|
1060
|
-
function
|
|
1061
|
-
if (!
|
|
1062
|
-
return
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new Be(t, n).toString(r), o) {
|
|
1070
|
-
const i = e.indexOf("#");
|
|
1071
|
-
i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
|
|
1397
|
+
function buildURL(url, params, options) {
|
|
1398
|
+
if (!params) {
|
|
1399
|
+
return url;
|
|
1400
|
+
}
|
|
1401
|
+
const _encode = options && options.encode || encode;
|
|
1402
|
+
if (utils$1.isFunction(options)) {
|
|
1403
|
+
options = {
|
|
1404
|
+
serialize: options
|
|
1405
|
+
};
|
|
1072
1406
|
}
|
|
1073
|
-
|
|
1407
|
+
const serializeFn = options && options.serialize;
|
|
1408
|
+
let serializedParams;
|
|
1409
|
+
if (serializeFn) {
|
|
1410
|
+
serializedParams = serializeFn(params, options);
|
|
1411
|
+
} else {
|
|
1412
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
1413
|
+
}
|
|
1414
|
+
if (serializedParams) {
|
|
1415
|
+
const hashmarkIndex = url.indexOf("#");
|
|
1416
|
+
if (hashmarkIndex !== -1) {
|
|
1417
|
+
url = url.slice(0, hashmarkIndex);
|
|
1418
|
+
}
|
|
1419
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
1420
|
+
}
|
|
1421
|
+
return url;
|
|
1074
1422
|
}
|
|
1075
|
-
class
|
|
1423
|
+
class InterceptorManager {
|
|
1076
1424
|
constructor() {
|
|
1077
1425
|
this.handlers = [];
|
|
1078
1426
|
}
|
|
@@ -1084,13 +1432,14 @@ class tt {
|
|
|
1084
1432
|
*
|
|
1085
1433
|
* @return {Number} An ID used to remove interceptor later
|
|
1086
1434
|
*/
|
|
1087
|
-
use(
|
|
1088
|
-
|
|
1089
|
-
fulfilled
|
|
1090
|
-
rejected
|
|
1091
|
-
synchronous:
|
|
1092
|
-
runWhen:
|
|
1093
|
-
})
|
|
1435
|
+
use(fulfilled, rejected, options) {
|
|
1436
|
+
this.handlers.push({
|
|
1437
|
+
fulfilled,
|
|
1438
|
+
rejected,
|
|
1439
|
+
synchronous: options ? options.synchronous : false,
|
|
1440
|
+
runWhen: options ? options.runWhen : null
|
|
1441
|
+
});
|
|
1442
|
+
return this.handlers.length - 1;
|
|
1094
1443
|
}
|
|
1095
1444
|
/**
|
|
1096
1445
|
* Remove an interceptor from the stack
|
|
@@ -1099,8 +1448,10 @@ class tt {
|
|
|
1099
1448
|
*
|
|
1100
1449
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1101
1450
|
*/
|
|
1102
|
-
eject(
|
|
1103
|
-
|
|
1451
|
+
eject(id) {
|
|
1452
|
+
if (this.handlers[id]) {
|
|
1453
|
+
this.handlers[id] = null;
|
|
1454
|
+
}
|
|
1104
1455
|
}
|
|
1105
1456
|
/**
|
|
1106
1457
|
* Clear all interceptors from the stack
|
|
@@ -1108,7 +1459,9 @@ class tt {
|
|
|
1108
1459
|
* @returns {void}
|
|
1109
1460
|
*/
|
|
1110
1461
|
clear() {
|
|
1111
|
-
|
|
1462
|
+
if (this.handlers) {
|
|
1463
|
+
this.handlers = [];
|
|
1464
|
+
}
|
|
1112
1465
|
}
|
|
1113
1466
|
/**
|
|
1114
1467
|
* Iterate over all the registered interceptors
|
|
@@ -1120,122 +1473,191 @@ class tt {
|
|
|
1120
1473
|
*
|
|
1121
1474
|
* @returns {void}
|
|
1122
1475
|
*/
|
|
1123
|
-
forEach(
|
|
1124
|
-
|
|
1125
|
-
|
|
1476
|
+
forEach(fn) {
|
|
1477
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1478
|
+
if (h !== null) {
|
|
1479
|
+
fn(h);
|
|
1480
|
+
}
|
|
1126
1481
|
});
|
|
1127
1482
|
}
|
|
1128
1483
|
}
|
|
1129
|
-
const
|
|
1130
|
-
silentJSONParsing:
|
|
1131
|
-
forcedJSONParsing:
|
|
1132
|
-
clarifyTimeoutError:
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1484
|
+
const transitionalDefaults = {
|
|
1485
|
+
silentJSONParsing: true,
|
|
1486
|
+
forcedJSONParsing: true,
|
|
1487
|
+
clarifyTimeoutError: false
|
|
1488
|
+
};
|
|
1489
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
1490
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
1491
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
1492
|
+
const platform$1 = {
|
|
1493
|
+
isBrowser: true,
|
|
1135
1494
|
classes: {
|
|
1136
|
-
URLSearchParams:
|
|
1137
|
-
FormData:
|
|
1138
|
-
Blob:
|
|
1495
|
+
URLSearchParams: URLSearchParams$1,
|
|
1496
|
+
FormData: FormData$1,
|
|
1497
|
+
Blob: Blob$1
|
|
1139
1498
|
},
|
|
1140
1499
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1500
|
+
};
|
|
1501
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
1502
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
1503
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
1504
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1505
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
1506
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
1507
|
+
})();
|
|
1508
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
1509
|
+
const utils = /* @__PURE__ */ Object.freeze({
|
|
1143
1510
|
__proto__: null,
|
|
1144
|
-
hasBrowserEnv
|
|
1145
|
-
hasStandardBrowserEnv
|
|
1146
|
-
hasStandardBrowserWebWorkerEnv
|
|
1147
|
-
navigator:
|
|
1148
|
-
origin
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
...
|
|
1511
|
+
hasBrowserEnv,
|
|
1512
|
+
hasStandardBrowserEnv,
|
|
1513
|
+
hasStandardBrowserWebWorkerEnv,
|
|
1514
|
+
navigator: _navigator,
|
|
1515
|
+
origin
|
|
1516
|
+
});
|
|
1517
|
+
const platform = {
|
|
1518
|
+
...utils,
|
|
1519
|
+
...platform$1
|
|
1152
1520
|
};
|
|
1153
|
-
function
|
|
1154
|
-
return
|
|
1155
|
-
visitor: function(
|
|
1156
|
-
|
|
1521
|
+
function toURLEncodedForm(data, options) {
|
|
1522
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
1523
|
+
visitor: function(value, key, path, helpers) {
|
|
1524
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1525
|
+
this.append(key, value.toString("base64"));
|
|
1526
|
+
return false;
|
|
1527
|
+
}
|
|
1528
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
1157
1529
|
}
|
|
1158
|
-
},
|
|
1530
|
+
}, options));
|
|
1159
1531
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1532
|
+
function parsePropPath(name) {
|
|
1533
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1534
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
1535
|
+
});
|
|
1162
1536
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1537
|
+
function arrayToObject(arr) {
|
|
1538
|
+
const obj = {};
|
|
1539
|
+
const keys = Object.keys(arr);
|
|
1540
|
+
let i2;
|
|
1541
|
+
const len = keys.length;
|
|
1542
|
+
let key;
|
|
1543
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
1544
|
+
key = keys[i2];
|
|
1545
|
+
obj[key] = arr[key];
|
|
1546
|
+
}
|
|
1547
|
+
return obj;
|
|
1171
1548
|
}
|
|
1172
|
-
function
|
|
1173
|
-
function
|
|
1174
|
-
let
|
|
1175
|
-
if (
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1549
|
+
function formDataToJSON(formData) {
|
|
1550
|
+
function buildPath(path, value, target, index) {
|
|
1551
|
+
let name = path[index++];
|
|
1552
|
+
if (name === "__proto__") return true;
|
|
1553
|
+
const isNumericKey = Number.isFinite(+name);
|
|
1554
|
+
const isLast = index >= path.length;
|
|
1555
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1556
|
+
if (isLast) {
|
|
1557
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
1558
|
+
target[name] = [target[name], value];
|
|
1559
|
+
} else {
|
|
1560
|
+
target[name] = value;
|
|
1561
|
+
}
|
|
1562
|
+
return !isNumericKey;
|
|
1563
|
+
}
|
|
1564
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1565
|
+
target[name] = [];
|
|
1566
|
+
}
|
|
1567
|
+
const result = buildPath(path, value, target[name], index);
|
|
1568
|
+
if (result && utils$1.isArray(target[name])) {
|
|
1569
|
+
target[name] = arrayToObject(target[name]);
|
|
1570
|
+
}
|
|
1571
|
+
return !isNumericKey;
|
|
1572
|
+
}
|
|
1573
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1574
|
+
const obj = {};
|
|
1575
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
1576
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
1577
|
+
});
|
|
1578
|
+
return obj;
|
|
1184
1579
|
}
|
|
1185
1580
|
return null;
|
|
1186
1581
|
}
|
|
1187
|
-
function
|
|
1188
|
-
if (
|
|
1582
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
1583
|
+
if (utils$1.isString(rawValue)) {
|
|
1189
1584
|
try {
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1585
|
+
(parser || JSON.parse)(rawValue);
|
|
1586
|
+
return utils$1.trim(rawValue);
|
|
1587
|
+
} catch (e2) {
|
|
1588
|
+
if (e2.name !== "SyntaxError") {
|
|
1589
|
+
throw e2;
|
|
1590
|
+
}
|
|
1194
1591
|
}
|
|
1195
|
-
|
|
1592
|
+
}
|
|
1593
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
1196
1594
|
}
|
|
1197
|
-
const
|
|
1198
|
-
transitional:
|
|
1595
|
+
const defaults = {
|
|
1596
|
+
transitional: transitionalDefaults,
|
|
1199
1597
|
adapter: ["xhr", "http", "fetch"],
|
|
1200
|
-
transformRequest: [function(
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
if (
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
if (
|
|
1209
|
-
return
|
|
1210
|
-
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1598
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
1599
|
+
const contentType = headers.getContentType() || "";
|
|
1600
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
1601
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1602
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1603
|
+
data = new FormData(data);
|
|
1604
|
+
}
|
|
1605
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
1606
|
+
if (isFormData2) {
|
|
1607
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1608
|
+
}
|
|
1609
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
1610
|
+
return data;
|
|
1611
|
+
}
|
|
1612
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1613
|
+
return data.buffer;
|
|
1614
|
+
}
|
|
1615
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1616
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
1617
|
+
return data.toString();
|
|
1618
|
+
}
|
|
1619
|
+
let isFileList2;
|
|
1620
|
+
if (isObjectPayload) {
|
|
1621
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
1622
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1623
|
+
}
|
|
1624
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
1625
|
+
const _FormData = this.env && this.env.FormData;
|
|
1626
|
+
return toFormData$1(
|
|
1627
|
+
isFileList2 ? { "files[]": data } : data,
|
|
1628
|
+
_FormData && new _FormData(),
|
|
1219
1629
|
this.formSerializer
|
|
1220
1630
|
);
|
|
1221
1631
|
}
|
|
1222
1632
|
}
|
|
1223
|
-
|
|
1633
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
1634
|
+
headers.setContentType("application/json", false);
|
|
1635
|
+
return stringifySafely(data);
|
|
1636
|
+
}
|
|
1637
|
+
return data;
|
|
1224
1638
|
}],
|
|
1225
|
-
transformResponse: [function(
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1639
|
+
transformResponse: [function transformResponse(data) {
|
|
1640
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
1641
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
1642
|
+
const JSONRequested = this.responseType === "json";
|
|
1643
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
1644
|
+
return data;
|
|
1645
|
+
}
|
|
1646
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
1647
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
1648
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1231
1649
|
try {
|
|
1232
|
-
return JSON.parse(
|
|
1233
|
-
} catch (
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1650
|
+
return JSON.parse(data);
|
|
1651
|
+
} catch (e2) {
|
|
1652
|
+
if (strictJSONParsing) {
|
|
1653
|
+
if (e2.name === "SyntaxError") {
|
|
1654
|
+
throw AxiosError$1.from(e2, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1655
|
+
}
|
|
1656
|
+
throw e2;
|
|
1657
|
+
}
|
|
1236
1658
|
}
|
|
1237
1659
|
}
|
|
1238
|
-
return
|
|
1660
|
+
return data;
|
|
1239
1661
|
}],
|
|
1240
1662
|
/**
|
|
1241
1663
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1247,23 +1669,23 @@ const ae = {
|
|
|
1247
1669
|
maxContentLength: -1,
|
|
1248
1670
|
maxBodyLength: -1,
|
|
1249
1671
|
env: {
|
|
1250
|
-
FormData:
|
|
1251
|
-
Blob:
|
|
1672
|
+
FormData: platform.classes.FormData,
|
|
1673
|
+
Blob: platform.classes.Blob
|
|
1252
1674
|
},
|
|
1253
|
-
validateStatus: function(
|
|
1254
|
-
return
|
|
1675
|
+
validateStatus: function validateStatus(status) {
|
|
1676
|
+
return status >= 200 && status < 300;
|
|
1255
1677
|
},
|
|
1256
1678
|
headers: {
|
|
1257
1679
|
common: {
|
|
1258
|
-
Accept: "application/json, text/plain, */*",
|
|
1680
|
+
"Accept": "application/json, text/plain, */*",
|
|
1259
1681
|
"Content-Type": void 0
|
|
1260
1682
|
}
|
|
1261
1683
|
}
|
|
1262
1684
|
};
|
|
1263
|
-
|
|
1264
|
-
|
|
1685
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
1686
|
+
defaults.headers[method] = {};
|
|
1265
1687
|
});
|
|
1266
|
-
const
|
|
1688
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1267
1689
|
"age",
|
|
1268
1690
|
"authorization",
|
|
1269
1691
|
"content-length",
|
|
@@ -1281,153 +1703,214 @@ const mr = a.toObjectSet([
|
|
|
1281
1703
|
"referer",
|
|
1282
1704
|
"retry-after",
|
|
1283
1705
|
"user-agent"
|
|
1284
|
-
])
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1706
|
+
]);
|
|
1707
|
+
const parseHeaders = (rawHeaders) => {
|
|
1708
|
+
const parsed = {};
|
|
1709
|
+
let key;
|
|
1710
|
+
let val;
|
|
1711
|
+
let i2;
|
|
1712
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
1713
|
+
i2 = line.indexOf(":");
|
|
1714
|
+
key = line.substring(0, i2).trim().toLowerCase();
|
|
1715
|
+
val = line.substring(i2 + 1).trim();
|
|
1716
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
if (key === "set-cookie") {
|
|
1720
|
+
if (parsed[key]) {
|
|
1721
|
+
parsed[key].push(val);
|
|
1722
|
+
} else {
|
|
1723
|
+
parsed[key] = [val];
|
|
1724
|
+
}
|
|
1725
|
+
} else {
|
|
1726
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
return parsed;
|
|
1730
|
+
};
|
|
1731
|
+
const $internals = Symbol("internals");
|
|
1732
|
+
function normalizeHeader(header) {
|
|
1733
|
+
return header && String(header).trim().toLowerCase();
|
|
1294
1734
|
}
|
|
1295
|
-
function
|
|
1296
|
-
|
|
1735
|
+
function normalizeValue(value) {
|
|
1736
|
+
if (value === false || value == null) {
|
|
1737
|
+
return value;
|
|
1738
|
+
}
|
|
1739
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1297
1740
|
}
|
|
1298
|
-
function
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1741
|
+
function parseTokens(str) {
|
|
1742
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
1743
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1744
|
+
let match;
|
|
1745
|
+
while (match = tokensRE.exec(str)) {
|
|
1746
|
+
tokens[match[1]] = match[2];
|
|
1747
|
+
}
|
|
1748
|
+
return tokens;
|
|
1304
1749
|
}
|
|
1305
|
-
const
|
|
1306
|
-
function
|
|
1307
|
-
if (
|
|
1308
|
-
return
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1750
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1751
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
1752
|
+
if (utils$1.isFunction(filter2)) {
|
|
1753
|
+
return filter2.call(this, value, header);
|
|
1754
|
+
}
|
|
1755
|
+
if (isHeaderNameFilter) {
|
|
1756
|
+
value = header;
|
|
1757
|
+
}
|
|
1758
|
+
if (!utils$1.isString(value)) return;
|
|
1759
|
+
if (utils$1.isString(filter2)) {
|
|
1760
|
+
return value.indexOf(filter2) !== -1;
|
|
1761
|
+
}
|
|
1762
|
+
if (utils$1.isRegExp(filter2)) {
|
|
1763
|
+
return filter2.test(value);
|
|
1314
1764
|
}
|
|
1315
1765
|
}
|
|
1316
|
-
function
|
|
1317
|
-
return
|
|
1766
|
+
function formatHeader(header) {
|
|
1767
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => {
|
|
1768
|
+
return char.toUpperCase() + str;
|
|
1769
|
+
});
|
|
1318
1770
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const
|
|
1321
|
-
["get", "set", "has"].forEach((
|
|
1322
|
-
Object.defineProperty(
|
|
1323
|
-
value: function(
|
|
1324
|
-
return this[
|
|
1771
|
+
function buildAccessors(obj, header) {
|
|
1772
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
1773
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
1774
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1775
|
+
value: function(arg1, arg2, arg3) {
|
|
1776
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1325
1777
|
},
|
|
1326
|
-
configurable:
|
|
1778
|
+
configurable: true
|
|
1327
1779
|
});
|
|
1328
1780
|
});
|
|
1329
1781
|
}
|
|
1330
|
-
let
|
|
1331
|
-
constructor(
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1334
|
-
set(
|
|
1335
|
-
const
|
|
1336
|
-
function
|
|
1337
|
-
const
|
|
1338
|
-
if (!
|
|
1782
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
1783
|
+
constructor(headers) {
|
|
1784
|
+
headers && this.set(headers);
|
|
1785
|
+
}
|
|
1786
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1787
|
+
const self2 = this;
|
|
1788
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1789
|
+
const lHeader = normalizeHeader(_header);
|
|
1790
|
+
if (!lHeader) {
|
|
1339
1791
|
throw new Error("header name must be a non-empty string");
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1792
|
+
}
|
|
1793
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
1794
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
1795
|
+
self2[key || _header] = normalizeValue(_value);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1799
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1800
|
+
setHeaders(header, valueOrRewrite);
|
|
1801
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1802
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1803
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1804
|
+
let obj = {}, dest, key;
|
|
1805
|
+
for (const entry of header) {
|
|
1806
|
+
if (!utils$1.isArray(entry)) {
|
|
1352
1807
|
throw TypeError("Object iterator must return a key-value pair");
|
|
1353
|
-
|
|
1808
|
+
}
|
|
1809
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
1354
1810
|
}
|
|
1355
|
-
|
|
1356
|
-
} else
|
|
1357
|
-
|
|
1811
|
+
setHeaders(obj, valueOrRewrite);
|
|
1812
|
+
} else {
|
|
1813
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1814
|
+
}
|
|
1358
1815
|
return this;
|
|
1359
1816
|
}
|
|
1360
|
-
get(
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
return
|
|
1371
|
-
|
|
1372
|
-
|
|
1817
|
+
get(header, parser) {
|
|
1818
|
+
header = normalizeHeader(header);
|
|
1819
|
+
if (header) {
|
|
1820
|
+
const key = utils$1.findKey(this, header);
|
|
1821
|
+
if (key) {
|
|
1822
|
+
const value = this[key];
|
|
1823
|
+
if (!parser) {
|
|
1824
|
+
return value;
|
|
1825
|
+
}
|
|
1826
|
+
if (parser === true) {
|
|
1827
|
+
return parseTokens(value);
|
|
1828
|
+
}
|
|
1829
|
+
if (utils$1.isFunction(parser)) {
|
|
1830
|
+
return parser.call(this, value, key);
|
|
1831
|
+
}
|
|
1832
|
+
if (utils$1.isRegExp(parser)) {
|
|
1833
|
+
return parser.exec(value);
|
|
1834
|
+
}
|
|
1373
1835
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
1374
1836
|
}
|
|
1375
1837
|
}
|
|
1376
1838
|
}
|
|
1377
|
-
has(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1839
|
+
has(header, matcher) {
|
|
1840
|
+
header = normalizeHeader(header);
|
|
1841
|
+
if (header) {
|
|
1842
|
+
const key = utils$1.findKey(this, header);
|
|
1843
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1381
1844
|
}
|
|
1382
|
-
return
|
|
1383
|
-
}
|
|
1384
|
-
delete(
|
|
1385
|
-
const
|
|
1386
|
-
let
|
|
1387
|
-
function
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1845
|
+
return false;
|
|
1846
|
+
}
|
|
1847
|
+
delete(header, matcher) {
|
|
1848
|
+
const self2 = this;
|
|
1849
|
+
let deleted = false;
|
|
1850
|
+
function deleteHeader(_header) {
|
|
1851
|
+
_header = normalizeHeader(_header);
|
|
1852
|
+
if (_header) {
|
|
1853
|
+
const key = utils$1.findKey(self2, _header);
|
|
1854
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
1855
|
+
delete self2[key];
|
|
1856
|
+
deleted = true;
|
|
1857
|
+
}
|
|
1391
1858
|
}
|
|
1392
1859
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
let r = n.length, s = !1;
|
|
1398
|
-
for (; r--; ) {
|
|
1399
|
-
const o = n[r];
|
|
1400
|
-
(!t || Pe(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
|
1860
|
+
if (utils$1.isArray(header)) {
|
|
1861
|
+
header.forEach(deleteHeader);
|
|
1862
|
+
} else {
|
|
1863
|
+
deleteHeader(header);
|
|
1401
1864
|
}
|
|
1402
|
-
return
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1865
|
+
return deleted;
|
|
1866
|
+
}
|
|
1867
|
+
clear(matcher) {
|
|
1868
|
+
const keys = Object.keys(this);
|
|
1869
|
+
let i2 = keys.length;
|
|
1870
|
+
let deleted = false;
|
|
1871
|
+
while (i2--) {
|
|
1872
|
+
const key = keys[i2];
|
|
1873
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1874
|
+
delete this[key];
|
|
1875
|
+
deleted = true;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
return deleted;
|
|
1879
|
+
}
|
|
1880
|
+
normalize(format) {
|
|
1881
|
+
const self2 = this;
|
|
1882
|
+
const headers = {};
|
|
1883
|
+
utils$1.forEach(this, (value, header) => {
|
|
1884
|
+
const key = utils$1.findKey(headers, header);
|
|
1885
|
+
if (key) {
|
|
1886
|
+
self2[key] = normalizeValue(value);
|
|
1887
|
+
delete self2[header];
|
|
1410
1888
|
return;
|
|
1411
1889
|
}
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
|
|
1890
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1891
|
+
if (normalized !== header) {
|
|
1892
|
+
delete self2[header];
|
|
1893
|
+
}
|
|
1894
|
+
self2[normalized] = normalizeValue(value);
|
|
1895
|
+
headers[normalized] = true;
|
|
1896
|
+
});
|
|
1897
|
+
return this;
|
|
1415
1898
|
}
|
|
1416
|
-
concat(...
|
|
1417
|
-
return this.constructor.concat(this, ...
|
|
1899
|
+
concat(...targets) {
|
|
1900
|
+
return this.constructor.concat(this, ...targets);
|
|
1418
1901
|
}
|
|
1419
|
-
toJSON(
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
})
|
|
1902
|
+
toJSON(asStrings) {
|
|
1903
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1904
|
+
utils$1.forEach(this, (value, header) => {
|
|
1905
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
1906
|
+
});
|
|
1907
|
+
return obj;
|
|
1424
1908
|
}
|
|
1425
1909
|
[Symbol.iterator]() {
|
|
1426
1910
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1427
1911
|
}
|
|
1428
1912
|
toString() {
|
|
1429
|
-
return Object.entries(this.toJSON()).map(([
|
|
1430
|
-
`);
|
|
1913
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
1431
1914
|
}
|
|
1432
1915
|
getSetCookie() {
|
|
1433
1916
|
return this.get("set-cookie") || [];
|
|
@@ -1435,135 +1918,203 @@ let U = class {
|
|
|
1435
1918
|
get [Symbol.toStringTag]() {
|
|
1436
1919
|
return "AxiosHeaders";
|
|
1437
1920
|
}
|
|
1438
|
-
static from(
|
|
1439
|
-
return
|
|
1921
|
+
static from(thing) {
|
|
1922
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1440
1923
|
}
|
|
1441
|
-
static concat(
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1924
|
+
static concat(first, ...targets) {
|
|
1925
|
+
const computed = new this(first);
|
|
1926
|
+
targets.forEach((target) => computed.set(target));
|
|
1927
|
+
return computed;
|
|
1444
1928
|
}
|
|
1445
|
-
static accessor(
|
|
1446
|
-
const
|
|
1929
|
+
static accessor(header) {
|
|
1930
|
+
const internals = this[$internals] = this[$internals] = {
|
|
1447
1931
|
accessors: {}
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1932
|
+
};
|
|
1933
|
+
const accessors = internals.accessors;
|
|
1934
|
+
const prototype2 = this.prototype;
|
|
1935
|
+
function defineAccessor(_header) {
|
|
1936
|
+
const lHeader = normalizeHeader(_header);
|
|
1937
|
+
if (!accessors[lHeader]) {
|
|
1938
|
+
buildAccessors(prototype2, _header);
|
|
1939
|
+
accessors[lHeader] = true;
|
|
1940
|
+
}
|
|
1452
1941
|
}
|
|
1453
|
-
|
|
1942
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1943
|
+
return this;
|
|
1454
1944
|
}
|
|
1455
1945
|
};
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
let
|
|
1946
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1947
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
1948
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
1459
1949
|
return {
|
|
1460
|
-
get: () =>
|
|
1461
|
-
set(
|
|
1462
|
-
this[
|
|
1950
|
+
get: () => value,
|
|
1951
|
+
set(headerValue) {
|
|
1952
|
+
this[mapped] = headerValue;
|
|
1463
1953
|
}
|
|
1464
1954
|
};
|
|
1465
1955
|
});
|
|
1466
|
-
|
|
1467
|
-
function
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1956
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1957
|
+
function transformData(fns, response) {
|
|
1958
|
+
const config = this || defaults;
|
|
1959
|
+
const context = response || config;
|
|
1960
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
1961
|
+
let data = context.data;
|
|
1962
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
1963
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
1964
|
+
});
|
|
1965
|
+
headers.normalize();
|
|
1966
|
+
return data;
|
|
1473
1967
|
}
|
|
1474
|
-
function
|
|
1475
|
-
return !!(
|
|
1968
|
+
function isCancel$1(value) {
|
|
1969
|
+
return !!(value && value.__CANCEL__);
|
|
1476
1970
|
}
|
|
1477
|
-
function
|
|
1478
|
-
|
|
1971
|
+
function CanceledError$1(message, config, request) {
|
|
1972
|
+
AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
1973
|
+
this.name = "CanceledError";
|
|
1479
1974
|
}
|
|
1480
|
-
|
|
1481
|
-
__CANCEL__:
|
|
1975
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1976
|
+
__CANCEL__: true
|
|
1482
1977
|
});
|
|
1483
|
-
function
|
|
1484
|
-
const
|
|
1485
|
-
!
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1978
|
+
function settle(resolve, reject, response) {
|
|
1979
|
+
const validateStatus2 = response.config.validateStatus;
|
|
1980
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
1981
|
+
resolve(response);
|
|
1982
|
+
} else {
|
|
1983
|
+
reject(new AxiosError$1(
|
|
1984
|
+
"Request failed with status code " + response.status,
|
|
1985
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1986
|
+
response.config,
|
|
1987
|
+
response.request,
|
|
1988
|
+
response
|
|
1989
|
+
));
|
|
1990
|
+
}
|
|
1492
1991
|
}
|
|
1493
|
-
function
|
|
1494
|
-
const
|
|
1495
|
-
return
|
|
1992
|
+
function parseProtocol(url) {
|
|
1993
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1994
|
+
return match && match[1] || "";
|
|
1496
1995
|
}
|
|
1497
|
-
function
|
|
1498
|
-
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1996
|
+
function speedometer(samplesCount, min) {
|
|
1997
|
+
samplesCount = samplesCount || 10;
|
|
1998
|
+
const bytes = new Array(samplesCount);
|
|
1999
|
+
const timestamps = new Array(samplesCount);
|
|
2000
|
+
let head = 0;
|
|
2001
|
+
let tail = 0;
|
|
2002
|
+
let firstSampleTS;
|
|
2003
|
+
min = min !== void 0 ? min : 1e3;
|
|
2004
|
+
return function push(chunkLength) {
|
|
2005
|
+
const now = Date.now();
|
|
2006
|
+
const startedAt = timestamps[tail];
|
|
2007
|
+
if (!firstSampleTS) {
|
|
2008
|
+
firstSampleTS = now;
|
|
2009
|
+
}
|
|
2010
|
+
bytes[head] = chunkLength;
|
|
2011
|
+
timestamps[head] = now;
|
|
2012
|
+
let i2 = tail;
|
|
2013
|
+
let bytesCount = 0;
|
|
2014
|
+
while (i2 !== head) {
|
|
2015
|
+
bytesCount += bytes[i2++];
|
|
2016
|
+
i2 = i2 % samplesCount;
|
|
2017
|
+
}
|
|
2018
|
+
head = (head + 1) % samplesCount;
|
|
2019
|
+
if (head === tail) {
|
|
2020
|
+
tail = (tail + 1) % samplesCount;
|
|
2021
|
+
}
|
|
2022
|
+
if (now - firstSampleTS < min) {
|
|
1508
2023
|
return;
|
|
1509
|
-
|
|
1510
|
-
|
|
2024
|
+
}
|
|
2025
|
+
const passed = startedAt && now - startedAt;
|
|
2026
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1511
2027
|
};
|
|
1512
2028
|
}
|
|
1513
|
-
function
|
|
1514
|
-
let
|
|
1515
|
-
|
|
1516
|
-
|
|
2029
|
+
function throttle(fn, freq) {
|
|
2030
|
+
let timestamp = 0;
|
|
2031
|
+
let threshold = 1e3 / freq;
|
|
2032
|
+
let lastArgs;
|
|
2033
|
+
let timer;
|
|
2034
|
+
const invoke = (args, now = Date.now()) => {
|
|
2035
|
+
timestamp = now;
|
|
2036
|
+
lastArgs = null;
|
|
2037
|
+
if (timer) {
|
|
2038
|
+
clearTimeout(timer);
|
|
2039
|
+
timer = null;
|
|
2040
|
+
}
|
|
2041
|
+
fn.apply(null, args);
|
|
2042
|
+
};
|
|
2043
|
+
const throttled = (...args) => {
|
|
2044
|
+
const now = Date.now();
|
|
2045
|
+
const passed = now - timestamp;
|
|
2046
|
+
if (passed >= threshold) {
|
|
2047
|
+
invoke(args, now);
|
|
2048
|
+
} else {
|
|
2049
|
+
lastArgs = args;
|
|
2050
|
+
if (!timer) {
|
|
2051
|
+
timer = setTimeout(() => {
|
|
2052
|
+
timer = null;
|
|
2053
|
+
invoke(lastArgs);
|
|
2054
|
+
}, threshold - passed);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
1517
2057
|
};
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
p >= r ? i(l, u) : (s = l, o || (o = setTimeout(() => {
|
|
1521
|
-
o = null, i(s);
|
|
1522
|
-
}, r - p)));
|
|
1523
|
-
}, () => s && i(s)];
|
|
2058
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
2059
|
+
return [throttled, flush];
|
|
1524
2060
|
}
|
|
1525
|
-
const
|
|
1526
|
-
let
|
|
1527
|
-
const
|
|
1528
|
-
return
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
2061
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
2062
|
+
let bytesNotified = 0;
|
|
2063
|
+
const _speedometer = speedometer(50, 250);
|
|
2064
|
+
return throttle((e2) => {
|
|
2065
|
+
const loaded = e2.loaded;
|
|
2066
|
+
const total = e2.lengthComputable ? e2.total : void 0;
|
|
2067
|
+
const progressBytes = loaded - bytesNotified;
|
|
2068
|
+
const rate = _speedometer(progressBytes);
|
|
2069
|
+
const inRange = loaded <= total;
|
|
2070
|
+
bytesNotified = loaded;
|
|
2071
|
+
const data = {
|
|
2072
|
+
loaded,
|
|
2073
|
+
total,
|
|
2074
|
+
progress: total ? loaded / total : void 0,
|
|
2075
|
+
bytes: progressBytes,
|
|
2076
|
+
rate: rate ? rate : void 0,
|
|
2077
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
2078
|
+
event: e2,
|
|
2079
|
+
lengthComputable: total != null,
|
|
2080
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
1541
2081
|
};
|
|
1542
|
-
|
|
1543
|
-
},
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
2082
|
+
listener(data);
|
|
2083
|
+
}, freq);
|
|
2084
|
+
};
|
|
2085
|
+
const progressEventDecorator = (total, throttled) => {
|
|
2086
|
+
const lengthComputable = total != null;
|
|
2087
|
+
return [(loaded) => throttled[0]({
|
|
2088
|
+
lengthComputable,
|
|
2089
|
+
total,
|
|
2090
|
+
loaded
|
|
2091
|
+
}), throttled[1]];
|
|
2092
|
+
};
|
|
2093
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
2094
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
2095
|
+
url = new URL(url, platform.origin);
|
|
2096
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
2097
|
+
})(
|
|
2098
|
+
new URL(platform.origin),
|
|
2099
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2100
|
+
) : () => true;
|
|
2101
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
1555
2102
|
// Standard browser envs support document.cookie
|
|
1556
2103
|
{
|
|
1557
|
-
write(
|
|
1558
|
-
const
|
|
1559
|
-
|
|
2104
|
+
write(name, value, expires, path, domain, secure) {
|
|
2105
|
+
const cookie = [name + "=" + encodeURIComponent(value)];
|
|
2106
|
+
utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
|
|
2107
|
+
utils$1.isString(path) && cookie.push("path=" + path);
|
|
2108
|
+
utils$1.isString(domain) && cookie.push("domain=" + domain);
|
|
2109
|
+
secure === true && cookie.push("secure");
|
|
2110
|
+
document.cookie = cookie.join("; ");
|
|
1560
2111
|
},
|
|
1561
|
-
read(
|
|
1562
|
-
const
|
|
1563
|
-
return
|
|
2112
|
+
read(name) {
|
|
2113
|
+
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
2114
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
1564
2115
|
},
|
|
1565
|
-
remove(
|
|
1566
|
-
this.write(
|
|
2116
|
+
remove(name) {
|
|
2117
|
+
this.write(name, "", Date.now() - 864e5);
|
|
1567
2118
|
}
|
|
1568
2119
|
}
|
|
1569
2120
|
) : (
|
|
@@ -1578,488 +2129,688 @@ const pe = (e, t, n = 3) => {
|
|
|
1578
2129
|
}
|
|
1579
2130
|
}
|
|
1580
2131
|
);
|
|
1581
|
-
function
|
|
1582
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
2132
|
+
function isAbsoluteURL(url) {
|
|
2133
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1583
2134
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return
|
|
2135
|
+
function combineURLs(baseURL, relativeURL) {
|
|
2136
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
1586
2137
|
}
|
|
1587
|
-
function
|
|
1588
|
-
let
|
|
1589
|
-
|
|
2138
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2139
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2140
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
2141
|
+
return combineURLs(baseURL, requestedURL);
|
|
2142
|
+
}
|
|
2143
|
+
return requestedURL;
|
|
1590
2144
|
}
|
|
1591
|
-
const
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
2145
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2146
|
+
function mergeConfig$1(config1, config2) {
|
|
2147
|
+
config2 = config2 || {};
|
|
2148
|
+
const config = {};
|
|
2149
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
2150
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2151
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
2152
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2153
|
+
return utils$1.merge({}, source);
|
|
2154
|
+
} else if (utils$1.isArray(source)) {
|
|
2155
|
+
return source.slice();
|
|
2156
|
+
}
|
|
2157
|
+
return source;
|
|
2158
|
+
}
|
|
2159
|
+
function mergeDeepProperties(a2, b, prop, caseless) {
|
|
2160
|
+
if (!utils$1.isUndefined(b)) {
|
|
2161
|
+
return getMergedValue(a2, b, prop, caseless);
|
|
2162
|
+
} else if (!utils$1.isUndefined(a2)) {
|
|
2163
|
+
return getMergedValue(void 0, a2, prop, caseless);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
function valueFromConfig2(a2, b) {
|
|
2167
|
+
if (!utils$1.isUndefined(b)) {
|
|
2168
|
+
return getMergedValue(void 0, b);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
function defaultToConfig2(a2, b) {
|
|
2172
|
+
if (!utils$1.isUndefined(b)) {
|
|
2173
|
+
return getMergedValue(void 0, b);
|
|
2174
|
+
} else if (!utils$1.isUndefined(a2)) {
|
|
2175
|
+
return getMergedValue(void 0, a2);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
function mergeDirectKeys(a2, b, prop) {
|
|
2179
|
+
if (prop in config2) {
|
|
2180
|
+
return getMergedValue(a2, b);
|
|
2181
|
+
} else if (prop in config1) {
|
|
2182
|
+
return getMergedValue(void 0, a2);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
const mergeMap = {
|
|
2186
|
+
url: valueFromConfig2,
|
|
2187
|
+
method: valueFromConfig2,
|
|
2188
|
+
data: valueFromConfig2,
|
|
2189
|
+
baseURL: defaultToConfig2,
|
|
2190
|
+
transformRequest: defaultToConfig2,
|
|
2191
|
+
transformResponse: defaultToConfig2,
|
|
2192
|
+
paramsSerializer: defaultToConfig2,
|
|
2193
|
+
timeout: defaultToConfig2,
|
|
2194
|
+
timeoutMessage: defaultToConfig2,
|
|
2195
|
+
withCredentials: defaultToConfig2,
|
|
2196
|
+
withXSRFToken: defaultToConfig2,
|
|
2197
|
+
adapter: defaultToConfig2,
|
|
2198
|
+
responseType: defaultToConfig2,
|
|
2199
|
+
xsrfCookieName: defaultToConfig2,
|
|
2200
|
+
xsrfHeaderName: defaultToConfig2,
|
|
2201
|
+
onUploadProgress: defaultToConfig2,
|
|
2202
|
+
onDownloadProgress: defaultToConfig2,
|
|
2203
|
+
decompress: defaultToConfig2,
|
|
2204
|
+
maxContentLength: defaultToConfig2,
|
|
2205
|
+
maxBodyLength: defaultToConfig2,
|
|
2206
|
+
beforeRedirect: defaultToConfig2,
|
|
2207
|
+
transport: defaultToConfig2,
|
|
2208
|
+
httpAgent: defaultToConfig2,
|
|
2209
|
+
httpsAgent: defaultToConfig2,
|
|
2210
|
+
cancelToken: defaultToConfig2,
|
|
2211
|
+
socketPath: defaultToConfig2,
|
|
2212
|
+
responseEncoding: defaultToConfig2,
|
|
2213
|
+
validateStatus: mergeDirectKeys,
|
|
2214
|
+
headers: (a2, b, prop) => mergeDeepProperties(headersToObject(a2), headersToObject(b), prop, true)
|
|
1650
2215
|
};
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
|
|
2216
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2217
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
2218
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
2219
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
2220
|
+
});
|
|
2221
|
+
return config;
|
|
1655
2222
|
}
|
|
1656
|
-
const
|
|
1657
|
-
const
|
|
1658
|
-
let { data
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
2223
|
+
const resolveConfig = (config) => {
|
|
2224
|
+
const newConfig = mergeConfig$1({}, config);
|
|
2225
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
2226
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2227
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
2228
|
+
if (auth) {
|
|
2229
|
+
headers.set(
|
|
2230
|
+
"Authorization",
|
|
2231
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
2232
|
+
);
|
|
2233
|
+
}
|
|
2234
|
+
let contentType;
|
|
2235
|
+
if (utils$1.isFormData(data)) {
|
|
2236
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2237
|
+
headers.setContentType(void 0);
|
|
2238
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
2239
|
+
const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
|
|
2240
|
+
headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
if (platform.hasStandardBrowserEnv) {
|
|
2244
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
2245
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
2246
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2247
|
+
if (xsrfValue) {
|
|
2248
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
return newConfig;
|
|
2253
|
+
};
|
|
2254
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
2255
|
+
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
2256
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2257
|
+
const _config = resolveConfig(config);
|
|
2258
|
+
let requestData = _config.data;
|
|
2259
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2260
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
2261
|
+
let onCanceled;
|
|
2262
|
+
let uploadThrottled, downloadThrottled;
|
|
2263
|
+
let flushUpload, flushDownload;
|
|
2264
|
+
function done() {
|
|
2265
|
+
flushUpload && flushUpload();
|
|
2266
|
+
flushDownload && flushDownload();
|
|
2267
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2268
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
2269
|
+
}
|
|
2270
|
+
let request = new XMLHttpRequest();
|
|
2271
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2272
|
+
request.timeout = _config.timeout;
|
|
2273
|
+
function onloadend() {
|
|
2274
|
+
if (!request) {
|
|
1690
2275
|
return;
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
2276
|
+
}
|
|
2277
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
2278
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
2279
|
+
);
|
|
2280
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
2281
|
+
const response = {
|
|
2282
|
+
data: responseData,
|
|
2283
|
+
status: request.status,
|
|
2284
|
+
statusText: request.statusText,
|
|
2285
|
+
headers: responseHeaders,
|
|
2286
|
+
config,
|
|
2287
|
+
request
|
|
2288
|
+
};
|
|
2289
|
+
settle(function _resolve(value) {
|
|
2290
|
+
resolve(value);
|
|
2291
|
+
done();
|
|
2292
|
+
}, function _reject(err) {
|
|
2293
|
+
reject(err);
|
|
2294
|
+
done();
|
|
2295
|
+
}, response);
|
|
2296
|
+
request = null;
|
|
2297
|
+
}
|
|
2298
|
+
if ("onloadend" in request) {
|
|
2299
|
+
request.onloadend = onloadend;
|
|
2300
|
+
} else {
|
|
2301
|
+
request.onreadystatechange = function handleLoad() {
|
|
2302
|
+
if (!request || request.readyState !== 4) {
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
setTimeout(onloadend);
|
|
1700
2309
|
};
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
let
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
if (
|
|
1729
|
-
|
|
2310
|
+
}
|
|
2311
|
+
request.onabort = function handleAbort() {
|
|
2312
|
+
if (!request) {
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
2316
|
+
request = null;
|
|
2317
|
+
};
|
|
2318
|
+
request.onerror = function handleError() {
|
|
2319
|
+
reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
|
|
2320
|
+
request = null;
|
|
2321
|
+
};
|
|
2322
|
+
request.ontimeout = function handleTimeout() {
|
|
2323
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
2324
|
+
const transitional2 = _config.transitional || transitionalDefaults;
|
|
2325
|
+
if (_config.timeoutErrorMessage) {
|
|
2326
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2327
|
+
}
|
|
2328
|
+
reject(new AxiosError$1(
|
|
2329
|
+
timeoutErrorMessage,
|
|
2330
|
+
transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2331
|
+
config,
|
|
2332
|
+
request
|
|
2333
|
+
));
|
|
2334
|
+
request = null;
|
|
2335
|
+
};
|
|
2336
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
2337
|
+
if ("setRequestHeader" in request) {
|
|
2338
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2339
|
+
request.setRequestHeader(key, val);
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
2343
|
+
request.withCredentials = !!_config.withCredentials;
|
|
2344
|
+
}
|
|
2345
|
+
if (responseType && responseType !== "json") {
|
|
2346
|
+
request.responseType = _config.responseType;
|
|
2347
|
+
}
|
|
2348
|
+
if (onDownloadProgress) {
|
|
2349
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
2350
|
+
request.addEventListener("progress", downloadThrottled);
|
|
2351
|
+
}
|
|
2352
|
+
if (onUploadProgress && request.upload) {
|
|
2353
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2354
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
2355
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
2356
|
+
}
|
|
2357
|
+
if (_config.cancelToken || _config.signal) {
|
|
2358
|
+
onCanceled = (cancel) => {
|
|
2359
|
+
if (!request) {
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2363
|
+
request.abort();
|
|
2364
|
+
request = null;
|
|
2365
|
+
};
|
|
2366
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2367
|
+
if (_config.signal) {
|
|
2368
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
const protocol = parseProtocol(_config.url);
|
|
2372
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2373
|
+
reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
|
|
1730
2374
|
return;
|
|
1731
2375
|
}
|
|
1732
|
-
|
|
2376
|
+
request.send(requestData || null);
|
|
1733
2377
|
});
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
2378
|
+
};
|
|
2379
|
+
const composeSignals = (signals, timeout) => {
|
|
2380
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
2381
|
+
if (timeout || length) {
|
|
2382
|
+
let controller = new AbortController();
|
|
2383
|
+
let aborted;
|
|
2384
|
+
const onabort = function(reason) {
|
|
2385
|
+
if (!aborted) {
|
|
2386
|
+
aborted = true;
|
|
2387
|
+
unsubscribe();
|
|
2388
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
2389
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
1743
2390
|
}
|
|
1744
2391
|
};
|
|
1745
|
-
let
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
2392
|
+
let timer = timeout && setTimeout(() => {
|
|
2393
|
+
timer = null;
|
|
2394
|
+
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
2395
|
+
}, timeout);
|
|
2396
|
+
const unsubscribe = () => {
|
|
2397
|
+
if (signals) {
|
|
2398
|
+
timer && clearTimeout(timer);
|
|
2399
|
+
timer = null;
|
|
2400
|
+
signals.forEach((signal2) => {
|
|
2401
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
2402
|
+
});
|
|
2403
|
+
signals = null;
|
|
2404
|
+
}
|
|
1752
2405
|
};
|
|
1753
|
-
|
|
1754
|
-
const { signal
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
2406
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
2407
|
+
const { signal } = controller;
|
|
2408
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2409
|
+
return signal;
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
2413
|
+
let len = chunk.byteLength;
|
|
2414
|
+
if (len < chunkSize) {
|
|
2415
|
+
yield chunk;
|
|
1761
2416
|
return;
|
|
1762
2417
|
}
|
|
1763
|
-
let
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
|
|
2418
|
+
let pos = 0;
|
|
2419
|
+
let end;
|
|
2420
|
+
while (pos < len) {
|
|
2421
|
+
end = pos + chunkSize;
|
|
2422
|
+
yield chunk.slice(pos, end);
|
|
2423
|
+
pos = end;
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
2427
|
+
for await (const chunk of readStream(iterable)) {
|
|
2428
|
+
yield* streamChunk(chunk, chunkSize);
|
|
2429
|
+
}
|
|
2430
|
+
};
|
|
2431
|
+
const readStream = async function* (stream) {
|
|
2432
|
+
if (stream[Symbol.asyncIterator]) {
|
|
2433
|
+
yield* stream;
|
|
1772
2434
|
return;
|
|
1773
2435
|
}
|
|
1774
|
-
const
|
|
2436
|
+
const reader = stream.getReader();
|
|
1775
2437
|
try {
|
|
1776
2438
|
for (; ; ) {
|
|
1777
|
-
const { done
|
|
1778
|
-
if (
|
|
2439
|
+
const { done, value } = await reader.read();
|
|
2440
|
+
if (done) {
|
|
1779
2441
|
break;
|
|
1780
|
-
|
|
2442
|
+
}
|
|
2443
|
+
yield value;
|
|
1781
2444
|
}
|
|
1782
2445
|
} finally {
|
|
1783
|
-
await
|
|
2446
|
+
await reader.cancel();
|
|
1784
2447
|
}
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
2448
|
+
};
|
|
2449
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
2450
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
2451
|
+
let bytes = 0;
|
|
2452
|
+
let done;
|
|
2453
|
+
let _onFinish = (e2) => {
|
|
2454
|
+
if (!done) {
|
|
2455
|
+
done = true;
|
|
2456
|
+
onFinish && onFinish(e2);
|
|
2457
|
+
}
|
|
1789
2458
|
};
|
|
1790
2459
|
return new ReadableStream({
|
|
1791
|
-
async pull(
|
|
2460
|
+
async pull(controller) {
|
|
1792
2461
|
try {
|
|
1793
|
-
const { done:
|
|
1794
|
-
if (
|
|
1795
|
-
|
|
2462
|
+
const { done: done2, value } = await iterator2.next();
|
|
2463
|
+
if (done2) {
|
|
2464
|
+
_onFinish();
|
|
2465
|
+
controller.close();
|
|
1796
2466
|
return;
|
|
1797
2467
|
}
|
|
1798
|
-
let
|
|
1799
|
-
if (
|
|
1800
|
-
let
|
|
1801
|
-
|
|
2468
|
+
let len = value.byteLength;
|
|
2469
|
+
if (onProgress) {
|
|
2470
|
+
let loadedBytes = bytes += len;
|
|
2471
|
+
onProgress(loadedBytes);
|
|
1802
2472
|
}
|
|
1803
|
-
|
|
1804
|
-
} catch (
|
|
1805
|
-
|
|
2473
|
+
controller.enqueue(new Uint8Array(value));
|
|
2474
|
+
} catch (err) {
|
|
2475
|
+
_onFinish(err);
|
|
2476
|
+
throw err;
|
|
1806
2477
|
}
|
|
1807
2478
|
},
|
|
1808
|
-
cancel(
|
|
1809
|
-
|
|
2479
|
+
cancel(reason) {
|
|
2480
|
+
_onFinish(reason);
|
|
2481
|
+
return iterator2.return();
|
|
1810
2482
|
}
|
|
1811
2483
|
}, {
|
|
1812
2484
|
highWaterMark: 2
|
|
1813
2485
|
});
|
|
1814
|
-
}
|
|
2486
|
+
};
|
|
2487
|
+
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
2488
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
2489
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
|
|
2490
|
+
const test = (fn, ...args) => {
|
|
1815
2491
|
try {
|
|
1816
|
-
return !!
|
|
1817
|
-
} catch {
|
|
1818
|
-
return
|
|
2492
|
+
return !!fn(...args);
|
|
2493
|
+
} catch (e2) {
|
|
2494
|
+
return false;
|
|
1819
2495
|
}
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
|
|
2496
|
+
};
|
|
2497
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
2498
|
+
let duplexAccessed = false;
|
|
2499
|
+
const hasContentType = new Request(platform.origin, {
|
|
1823
2500
|
body: new ReadableStream(),
|
|
1824
2501
|
method: "POST",
|
|
1825
2502
|
get duplex() {
|
|
1826
|
-
|
|
2503
|
+
duplexAccessed = true;
|
|
2504
|
+
return "half";
|
|
1827
2505
|
}
|
|
1828
2506
|
}).headers.has("Content-Type");
|
|
1829
|
-
return
|
|
1830
|
-
})
|
|
1831
|
-
|
|
2507
|
+
return duplexAccessed && !hasContentType;
|
|
2508
|
+
});
|
|
2509
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2510
|
+
const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
2511
|
+
const resolvers = {
|
|
2512
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
1832
2513
|
};
|
|
1833
|
-
|
|
1834
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((
|
|
1835
|
-
!
|
|
1836
|
-
throw new
|
|
2514
|
+
isFetchSupported && ((res) => {
|
|
2515
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
2516
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
|
|
2517
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
1837
2518
|
});
|
|
1838
2519
|
});
|
|
1839
2520
|
})(new Response());
|
|
1840
|
-
const
|
|
1841
|
-
if (
|
|
2521
|
+
const getBodyLength = async (body) => {
|
|
2522
|
+
if (body == null) {
|
|
1842
2523
|
return 0;
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
2524
|
+
}
|
|
2525
|
+
if (utils$1.isBlob(body)) {
|
|
2526
|
+
return body.size;
|
|
2527
|
+
}
|
|
2528
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
2529
|
+
const _request = new Request(platform.origin, {
|
|
1847
2530
|
method: "POST",
|
|
1848
|
-
body
|
|
1849
|
-
})
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
if (
|
|
1853
|
-
return
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
}
|
|
2531
|
+
body
|
|
2532
|
+
});
|
|
2533
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
2534
|
+
}
|
|
2535
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2536
|
+
return body.byteLength;
|
|
2537
|
+
}
|
|
2538
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
2539
|
+
body = body + "";
|
|
2540
|
+
}
|
|
2541
|
+
if (utils$1.isString(body)) {
|
|
2542
|
+
return (await encodeText(body)).byteLength;
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
const resolveBodyLength = async (headers, body) => {
|
|
2546
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2547
|
+
return length == null ? getBodyLength(body) : length;
|
|
2548
|
+
};
|
|
2549
|
+
const fetchAdapter = isFetchSupported && (async (config) => {
|
|
1858
2550
|
let {
|
|
1859
|
-
url
|
|
1860
|
-
method
|
|
1861
|
-
data
|
|
1862
|
-
signal
|
|
1863
|
-
cancelToken
|
|
1864
|
-
timeout
|
|
1865
|
-
onDownloadProgress
|
|
1866
|
-
onUploadProgress
|
|
1867
|
-
responseType
|
|
1868
|
-
headers
|
|
1869
|
-
withCredentials
|
|
1870
|
-
fetchOptions
|
|
1871
|
-
} =
|
|
1872
|
-
|
|
1873
|
-
let
|
|
1874
|
-
|
|
1875
|
-
|
|
2551
|
+
url,
|
|
2552
|
+
method,
|
|
2553
|
+
data,
|
|
2554
|
+
signal,
|
|
2555
|
+
cancelToken,
|
|
2556
|
+
timeout,
|
|
2557
|
+
onDownloadProgress,
|
|
2558
|
+
onUploadProgress,
|
|
2559
|
+
responseType,
|
|
2560
|
+
headers,
|
|
2561
|
+
withCredentials = "same-origin",
|
|
2562
|
+
fetchOptions
|
|
2563
|
+
} = resolveConfig(config);
|
|
2564
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
2565
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2566
|
+
let request;
|
|
2567
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2568
|
+
composedSignal.unsubscribe();
|
|
1876
2569
|
});
|
|
1877
|
-
let
|
|
2570
|
+
let requestContentLength;
|
|
1878
2571
|
try {
|
|
1879
|
-
if (
|
|
1880
|
-
let
|
|
2572
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
2573
|
+
let _request = new Request(url, {
|
|
1881
2574
|
method: "POST",
|
|
1882
|
-
body:
|
|
2575
|
+
body: data,
|
|
1883
2576
|
duplex: "half"
|
|
1884
|
-
})
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
2577
|
+
});
|
|
2578
|
+
let contentTypeHeader;
|
|
2579
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
2580
|
+
headers.setContentType(contentTypeHeader);
|
|
2581
|
+
}
|
|
2582
|
+
if (_request.body) {
|
|
2583
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2584
|
+
requestContentLength,
|
|
2585
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
1889
2586
|
);
|
|
1890
|
-
|
|
2587
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
1891
2588
|
}
|
|
1892
2589
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2590
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2591
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
2592
|
+
}
|
|
2593
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
2594
|
+
request = new Request(url, {
|
|
2595
|
+
...fetchOptions,
|
|
2596
|
+
signal: composedSignal,
|
|
2597
|
+
method: method.toUpperCase(),
|
|
2598
|
+
headers: headers.normalize().toJSON(),
|
|
2599
|
+
body: data,
|
|
1901
2600
|
duplex: "half",
|
|
1902
|
-
credentials:
|
|
2601
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1903
2602
|
});
|
|
1904
|
-
let
|
|
1905
|
-
const
|
|
1906
|
-
if (
|
|
1907
|
-
const
|
|
1908
|
-
["status", "statusText", "headers"].forEach((
|
|
1909
|
-
|
|
2603
|
+
let response = await fetch(request);
|
|
2604
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
2605
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
2606
|
+
const options = {};
|
|
2607
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
2608
|
+
options[prop] = response[prop];
|
|
1910
2609
|
});
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1913
|
-
|
|
2610
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
2611
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2612
|
+
responseContentLength,
|
|
2613
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
1914
2614
|
) || [];
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
2615
|
+
response = new Response(
|
|
2616
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2617
|
+
flush && flush();
|
|
2618
|
+
unsubscribe && unsubscribe();
|
|
1918
2619
|
}),
|
|
1919
|
-
|
|
2620
|
+
options
|
|
1920
2621
|
);
|
|
1921
2622
|
}
|
|
1922
|
-
|
|
1923
|
-
let
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
2623
|
+
responseType = responseType || "text";
|
|
2624
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
2625
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2626
|
+
return await new Promise((resolve, reject) => {
|
|
2627
|
+
settle(resolve, reject, {
|
|
2628
|
+
data: responseData,
|
|
2629
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
2630
|
+
status: response.status,
|
|
2631
|
+
statusText: response.statusText,
|
|
2632
|
+
config,
|
|
2633
|
+
request
|
|
1932
2634
|
});
|
|
1933
2635
|
});
|
|
1934
|
-
} catch (
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
2636
|
+
} catch (err) {
|
|
2637
|
+
unsubscribe && unsubscribe();
|
|
2638
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
2639
|
+
throw Object.assign(
|
|
2640
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
|
|
2641
|
+
{
|
|
2642
|
+
cause: err.cause || err
|
|
2643
|
+
}
|
|
2644
|
+
);
|
|
2645
|
+
}
|
|
2646
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
1941
2647
|
}
|
|
1942
|
-
})
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
2648
|
+
});
|
|
2649
|
+
const knownAdapters = {
|
|
2650
|
+
http: httpAdapter,
|
|
2651
|
+
xhr: xhrAdapter,
|
|
2652
|
+
fetch: fetchAdapter
|
|
1946
2653
|
};
|
|
1947
|
-
|
|
1948
|
-
if (
|
|
2654
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
2655
|
+
if (fn) {
|
|
1949
2656
|
try {
|
|
1950
|
-
Object.defineProperty(
|
|
1951
|
-
} catch {
|
|
2657
|
+
Object.defineProperty(fn, "name", { value });
|
|
2658
|
+
} catch (e2) {
|
|
1952
2659
|
}
|
|
1953
|
-
Object.defineProperty(
|
|
2660
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
1954
2661
|
}
|
|
1955
2662
|
});
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2663
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
2664
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2665
|
+
const adapters = {
|
|
2666
|
+
getAdapter: (adapters2) => {
|
|
2667
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
2668
|
+
const { length } = adapters2;
|
|
2669
|
+
let nameOrAdapter;
|
|
2670
|
+
let adapter;
|
|
2671
|
+
const rejectedReasons = {};
|
|
2672
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
2673
|
+
nameOrAdapter = adapters2[i2];
|
|
2674
|
+
let id;
|
|
2675
|
+
adapter = nameOrAdapter;
|
|
2676
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
2677
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
2678
|
+
if (adapter === void 0) {
|
|
2679
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
if (adapter) {
|
|
1968
2683
|
break;
|
|
1969
|
-
|
|
2684
|
+
}
|
|
2685
|
+
rejectedReasons[id || "#" + i2] = adapter;
|
|
1970
2686
|
}
|
|
1971
|
-
if (!
|
|
1972
|
-
const
|
|
1973
|
-
([
|
|
2687
|
+
if (!adapter) {
|
|
2688
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
2689
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
1974
2690
|
);
|
|
1975
|
-
let
|
|
1976
|
-
|
|
1977
|
-
`
|
|
1978
|
-
throw new b(
|
|
1979
|
-
"There is no suitable adapter to dispatch the request " + i,
|
|
2691
|
+
let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
2692
|
+
throw new AxiosError$1(
|
|
2693
|
+
`There is no suitable adapter to dispatch the request ` + s2,
|
|
1980
2694
|
"ERR_NOT_SUPPORT"
|
|
1981
2695
|
);
|
|
1982
2696
|
}
|
|
1983
|
-
return
|
|
2697
|
+
return adapter;
|
|
1984
2698
|
},
|
|
1985
|
-
adapters:
|
|
2699
|
+
adapters: knownAdapters
|
|
1986
2700
|
};
|
|
1987
|
-
function
|
|
1988
|
-
if (
|
|
1989
|
-
|
|
2701
|
+
function throwIfCancellationRequested(config) {
|
|
2702
|
+
if (config.cancelToken) {
|
|
2703
|
+
config.cancelToken.throwIfRequested();
|
|
2704
|
+
}
|
|
2705
|
+
if (config.signal && config.signal.aborted) {
|
|
2706
|
+
throw new CanceledError$1(null, config);
|
|
2707
|
+
}
|
|
1990
2708
|
}
|
|
1991
|
-
function
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2709
|
+
function dispatchRequest(config) {
|
|
2710
|
+
throwIfCancellationRequested(config);
|
|
2711
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
|
2712
|
+
config.data = transformData.call(
|
|
2713
|
+
config,
|
|
2714
|
+
config.transformRequest
|
|
2715
|
+
);
|
|
2716
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
2717
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
2718
|
+
}
|
|
2719
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
2720
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
2721
|
+
throwIfCancellationRequested(config);
|
|
2722
|
+
response.data = transformData.call(
|
|
2723
|
+
config,
|
|
2724
|
+
config.transformResponse,
|
|
2725
|
+
response
|
|
2726
|
+
);
|
|
2727
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
2728
|
+
return response;
|
|
2729
|
+
}, function onAdapterRejection(reason) {
|
|
2730
|
+
if (!isCancel$1(reason)) {
|
|
2731
|
+
throwIfCancellationRequested(config);
|
|
2732
|
+
if (reason && reason.response) {
|
|
2733
|
+
reason.response.data = transformData.call(
|
|
2734
|
+
config,
|
|
2735
|
+
config.transformResponse,
|
|
2736
|
+
reason.response
|
|
2737
|
+
);
|
|
2738
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
return Promise.reject(reason);
|
|
2007
2742
|
});
|
|
2008
2743
|
}
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2744
|
+
const VERSION$1 = "1.9.0";
|
|
2745
|
+
const validators$1 = {};
|
|
2746
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
|
|
2747
|
+
validators$1[type] = function validator2(thing) {
|
|
2748
|
+
return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
|
|
2013
2749
|
};
|
|
2014
2750
|
});
|
|
2015
|
-
const
|
|
2016
|
-
|
|
2017
|
-
function
|
|
2018
|
-
return "[Axios v" +
|
|
2019
|
-
}
|
|
2020
|
-
return (
|
|
2021
|
-
if (
|
|
2022
|
-
throw new
|
|
2023
|
-
|
|
2024
|
-
|
|
2751
|
+
const deprecatedWarnings = {};
|
|
2752
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
2753
|
+
function formatMessage(opt, desc) {
|
|
2754
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
2755
|
+
}
|
|
2756
|
+
return (value, opt, opts) => {
|
|
2757
|
+
if (validator2 === false) {
|
|
2758
|
+
throw new AxiosError$1(
|
|
2759
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
2760
|
+
AxiosError$1.ERR_DEPRECATED
|
|
2025
2761
|
);
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2762
|
+
}
|
|
2763
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
2764
|
+
deprecatedWarnings[opt] = true;
|
|
2765
|
+
console.warn(
|
|
2766
|
+
formatMessage(
|
|
2767
|
+
opt,
|
|
2768
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
2769
|
+
)
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
2032
2773
|
};
|
|
2033
2774
|
};
|
|
2034
|
-
|
|
2035
|
-
return (
|
|
2775
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
2776
|
+
return (value, opt) => {
|
|
2777
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2778
|
+
return true;
|
|
2779
|
+
};
|
|
2036
2780
|
};
|
|
2037
|
-
function
|
|
2038
|
-
if (typeof
|
|
2039
|
-
throw new
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2781
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
2782
|
+
if (typeof options !== "object") {
|
|
2783
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2784
|
+
}
|
|
2785
|
+
const keys = Object.keys(options);
|
|
2786
|
+
let i2 = keys.length;
|
|
2787
|
+
while (i2-- > 0) {
|
|
2788
|
+
const opt = keys[i2];
|
|
2789
|
+
const validator2 = schema[opt];
|
|
2790
|
+
if (validator2) {
|
|
2791
|
+
const value = options[opt];
|
|
2792
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
2793
|
+
if (result !== true) {
|
|
2794
|
+
throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2795
|
+
}
|
|
2048
2796
|
continue;
|
|
2049
2797
|
}
|
|
2050
|
-
if (
|
|
2051
|
-
throw new
|
|
2798
|
+
if (allowUnknown !== true) {
|
|
2799
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
2800
|
+
}
|
|
2052
2801
|
}
|
|
2053
2802
|
}
|
|
2054
|
-
const
|
|
2055
|
-
assertOptions
|
|
2056
|
-
validators:
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2803
|
+
const validator = {
|
|
2804
|
+
assertOptions,
|
|
2805
|
+
validators: validators$1
|
|
2806
|
+
};
|
|
2807
|
+
const validators = validator.validators;
|
|
2808
|
+
let Axios$1 = class Axios {
|
|
2809
|
+
constructor(instanceConfig) {
|
|
2810
|
+
this.defaults = instanceConfig || {};
|
|
2811
|
+
this.interceptors = {
|
|
2812
|
+
request: new InterceptorManager(),
|
|
2813
|
+
response: new InterceptorManager()
|
|
2063
2814
|
};
|
|
2064
2815
|
}
|
|
2065
2816
|
/**
|
|
@@ -2070,197 +2821,263 @@ let J = class {
|
|
|
2070
2821
|
*
|
|
2071
2822
|
* @returns {Promise} The Promise to be fulfilled
|
|
2072
2823
|
*/
|
|
2073
|
-
async request(
|
|
2824
|
+
async request(configOrUrl, config) {
|
|
2074
2825
|
try {
|
|
2075
|
-
return await this._request(
|
|
2076
|
-
} catch (
|
|
2077
|
-
if (
|
|
2078
|
-
let
|
|
2079
|
-
Error.captureStackTrace ? Error.captureStackTrace(
|
|
2080
|
-
const
|
|
2826
|
+
return await this._request(configOrUrl, config);
|
|
2827
|
+
} catch (err) {
|
|
2828
|
+
if (err instanceof Error) {
|
|
2829
|
+
let dummy = {};
|
|
2830
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
2831
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
2081
2832
|
try {
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2833
|
+
if (!err.stack) {
|
|
2834
|
+
err.stack = stack;
|
|
2835
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
2836
|
+
err.stack += "\n" + stack;
|
|
2837
|
+
}
|
|
2838
|
+
} catch (e2) {
|
|
2085
2839
|
}
|
|
2086
2840
|
}
|
|
2087
|
-
throw
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
_request(
|
|
2091
|
-
typeof
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2841
|
+
throw err;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
_request(configOrUrl, config) {
|
|
2845
|
+
if (typeof configOrUrl === "string") {
|
|
2846
|
+
config = config || {};
|
|
2847
|
+
config.url = configOrUrl;
|
|
2848
|
+
} else {
|
|
2849
|
+
config = configOrUrl || {};
|
|
2850
|
+
}
|
|
2851
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2852
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
2853
|
+
if (transitional2 !== void 0) {
|
|
2854
|
+
validator.assertOptions(transitional2, {
|
|
2855
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
2856
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
2857
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
2858
|
+
}, false);
|
|
2859
|
+
}
|
|
2860
|
+
if (paramsSerializer != null) {
|
|
2861
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
2862
|
+
config.paramsSerializer = {
|
|
2863
|
+
serialize: paramsSerializer
|
|
2864
|
+
};
|
|
2865
|
+
} else {
|
|
2866
|
+
validator.assertOptions(paramsSerializer, {
|
|
2867
|
+
encode: validators.function,
|
|
2868
|
+
serialize: validators.function
|
|
2869
|
+
}, true);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
2873
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
2874
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
2875
|
+
} else {
|
|
2876
|
+
config.allowAbsoluteUrls = true;
|
|
2877
|
+
}
|
|
2878
|
+
validator.assertOptions(config, {
|
|
2879
|
+
baseUrl: validators.spelling("baseURL"),
|
|
2880
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
2881
|
+
}, true);
|
|
2882
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
2883
|
+
let contextHeaders = headers && utils$1.merge(
|
|
2884
|
+
headers.common,
|
|
2885
|
+
headers[config.method]
|
|
2109
2886
|
);
|
|
2110
|
-
|
|
2887
|
+
headers && utils$1.forEach(
|
|
2111
2888
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
2112
|
-
(
|
|
2113
|
-
delete
|
|
2889
|
+
(method) => {
|
|
2890
|
+
delete headers[method];
|
|
2891
|
+
}
|
|
2892
|
+
);
|
|
2893
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
2894
|
+
const requestInterceptorChain = [];
|
|
2895
|
+
let synchronousRequestInterceptors = true;
|
|
2896
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2897
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
2898
|
+
return;
|
|
2114
2899
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
let d = !0;
|
|
2118
|
-
this.interceptors.request.forEach(function(R) {
|
|
2119
|
-
typeof R.runWhen == "function" && R.runWhen(n) === !1 || (d = d && R.synchronous, c.unshift(R.fulfilled, R.rejected));
|
|
2900
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2901
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2120
2902
|
});
|
|
2121
|
-
const
|
|
2122
|
-
this.interceptors.response.forEach(function(
|
|
2123
|
-
|
|
2903
|
+
const responseInterceptorChain = [];
|
|
2904
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2905
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2124
2906
|
});
|
|
2125
|
-
let
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2907
|
+
let promise;
|
|
2908
|
+
let i2 = 0;
|
|
2909
|
+
let len;
|
|
2910
|
+
if (!synchronousRequestInterceptors) {
|
|
2911
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
2912
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
2913
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
2914
|
+
len = chain.length;
|
|
2915
|
+
promise = Promise.resolve(config);
|
|
2916
|
+
while (i2 < len) {
|
|
2917
|
+
promise = promise.then(chain[i2++], chain[i2++]);
|
|
2918
|
+
}
|
|
2919
|
+
return promise;
|
|
2920
|
+
}
|
|
2921
|
+
len = requestInterceptorChain.length;
|
|
2922
|
+
let newConfig = config;
|
|
2923
|
+
i2 = 0;
|
|
2924
|
+
while (i2 < len) {
|
|
2925
|
+
const onFulfilled = requestInterceptorChain[i2++];
|
|
2926
|
+
const onRejected = requestInterceptorChain[i2++];
|
|
2136
2927
|
try {
|
|
2137
|
-
|
|
2138
|
-
} catch (
|
|
2139
|
-
|
|
2928
|
+
newConfig = onFulfilled(newConfig);
|
|
2929
|
+
} catch (error) {
|
|
2930
|
+
onRejected.call(this, error);
|
|
2140
2931
|
break;
|
|
2141
2932
|
}
|
|
2142
2933
|
}
|
|
2143
2934
|
try {
|
|
2144
|
-
|
|
2145
|
-
} catch (
|
|
2146
|
-
return Promise.reject(
|
|
2935
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
2936
|
+
} catch (error) {
|
|
2937
|
+
return Promise.reject(error);
|
|
2147
2938
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2939
|
+
i2 = 0;
|
|
2940
|
+
len = responseInterceptorChain.length;
|
|
2941
|
+
while (i2 < len) {
|
|
2942
|
+
promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
|
|
2943
|
+
}
|
|
2944
|
+
return promise;
|
|
2151
2945
|
}
|
|
2152
|
-
getUri(
|
|
2153
|
-
|
|
2154
|
-
const
|
|
2155
|
-
return
|
|
2946
|
+
getUri(config) {
|
|
2947
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2948
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
2949
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
2156
2950
|
}
|
|
2157
2951
|
};
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
return this.request(
|
|
2161
|
-
method
|
|
2162
|
-
url
|
|
2163
|
-
data: (
|
|
2952
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
2953
|
+
Axios$1.prototype[method] = function(url, config) {
|
|
2954
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2955
|
+
method,
|
|
2956
|
+
url,
|
|
2957
|
+
data: (config || {}).data
|
|
2164
2958
|
}));
|
|
2165
2959
|
};
|
|
2166
2960
|
});
|
|
2167
|
-
|
|
2168
|
-
function
|
|
2169
|
-
return function(
|
|
2170
|
-
return this.request(
|
|
2171
|
-
method
|
|
2172
|
-
headers:
|
|
2961
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
2962
|
+
function generateHTTPMethod(isForm) {
|
|
2963
|
+
return function httpMethod(url, data, config) {
|
|
2964
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2965
|
+
method,
|
|
2966
|
+
headers: isForm ? {
|
|
2173
2967
|
"Content-Type": "multipart/form-data"
|
|
2174
2968
|
} : {},
|
|
2175
|
-
url
|
|
2176
|
-
data
|
|
2969
|
+
url,
|
|
2970
|
+
data
|
|
2177
2971
|
}));
|
|
2178
2972
|
};
|
|
2179
2973
|
}
|
|
2180
|
-
|
|
2974
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
2975
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
2181
2976
|
});
|
|
2182
|
-
let $
|
|
2183
|
-
constructor(
|
|
2184
|
-
if (typeof
|
|
2977
|
+
let CancelToken$1 = class CancelToken {
|
|
2978
|
+
constructor(executor) {
|
|
2979
|
+
if (typeof executor !== "function") {
|
|
2185
2980
|
throw new TypeError("executor must be a function.");
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2981
|
+
}
|
|
2982
|
+
let resolvePromise;
|
|
2983
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2984
|
+
resolvePromise = resolve;
|
|
2189
2985
|
});
|
|
2190
|
-
const
|
|
2191
|
-
this.promise.then((
|
|
2192
|
-
if (!
|
|
2193
|
-
let
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2986
|
+
const token = this;
|
|
2987
|
+
this.promise.then((cancel) => {
|
|
2988
|
+
if (!token._listeners) return;
|
|
2989
|
+
let i2 = token._listeners.length;
|
|
2990
|
+
while (i2-- > 0) {
|
|
2991
|
+
token._listeners[i2](cancel);
|
|
2992
|
+
}
|
|
2993
|
+
token._listeners = null;
|
|
2994
|
+
});
|
|
2995
|
+
this.promise.then = (onfulfilled) => {
|
|
2996
|
+
let _resolve;
|
|
2997
|
+
const promise = new Promise((resolve) => {
|
|
2998
|
+
token.subscribe(resolve);
|
|
2999
|
+
_resolve = resolve;
|
|
3000
|
+
}).then(onfulfilled);
|
|
3001
|
+
promise.cancel = function reject() {
|
|
3002
|
+
token.unsubscribe(_resolve);
|
|
3003
|
+
};
|
|
3004
|
+
return promise;
|
|
3005
|
+
};
|
|
3006
|
+
executor(function cancel(message, config, request) {
|
|
3007
|
+
if (token.reason) {
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
3011
|
+
resolvePromise(token.reason);
|
|
2207
3012
|
});
|
|
2208
3013
|
}
|
|
2209
3014
|
/**
|
|
2210
3015
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
2211
3016
|
*/
|
|
2212
3017
|
throwIfRequested() {
|
|
2213
|
-
if (this.reason)
|
|
3018
|
+
if (this.reason) {
|
|
2214
3019
|
throw this.reason;
|
|
3020
|
+
}
|
|
2215
3021
|
}
|
|
2216
3022
|
/**
|
|
2217
3023
|
* Subscribe to the cancel signal
|
|
2218
3024
|
*/
|
|
2219
|
-
subscribe(
|
|
3025
|
+
subscribe(listener) {
|
|
2220
3026
|
if (this.reason) {
|
|
2221
|
-
|
|
3027
|
+
listener(this.reason);
|
|
2222
3028
|
return;
|
|
2223
3029
|
}
|
|
2224
|
-
|
|
3030
|
+
if (this._listeners) {
|
|
3031
|
+
this._listeners.push(listener);
|
|
3032
|
+
} else {
|
|
3033
|
+
this._listeners = [listener];
|
|
3034
|
+
}
|
|
2225
3035
|
}
|
|
2226
3036
|
/**
|
|
2227
3037
|
* Unsubscribe from the cancel signal
|
|
2228
3038
|
*/
|
|
2229
|
-
unsubscribe(
|
|
2230
|
-
if (!this._listeners)
|
|
3039
|
+
unsubscribe(listener) {
|
|
3040
|
+
if (!this._listeners) {
|
|
2231
3041
|
return;
|
|
2232
|
-
|
|
2233
|
-
|
|
3042
|
+
}
|
|
3043
|
+
const index = this._listeners.indexOf(listener);
|
|
3044
|
+
if (index !== -1) {
|
|
3045
|
+
this._listeners.splice(index, 1);
|
|
3046
|
+
}
|
|
2234
3047
|
}
|
|
2235
3048
|
toAbortSignal() {
|
|
2236
|
-
const
|
|
2237
|
-
|
|
3049
|
+
const controller = new AbortController();
|
|
3050
|
+
const abort = (err) => {
|
|
3051
|
+
controller.abort(err);
|
|
2238
3052
|
};
|
|
2239
|
-
|
|
3053
|
+
this.subscribe(abort);
|
|
3054
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3055
|
+
return controller.signal;
|
|
2240
3056
|
}
|
|
2241
3057
|
/**
|
|
2242
3058
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2243
3059
|
* cancels the `CancelToken`.
|
|
2244
3060
|
*/
|
|
2245
3061
|
static source() {
|
|
2246
|
-
let
|
|
3062
|
+
let cancel;
|
|
3063
|
+
const token = new CancelToken(function executor(c) {
|
|
3064
|
+
cancel = c;
|
|
3065
|
+
});
|
|
2247
3066
|
return {
|
|
2248
|
-
token
|
|
2249
|
-
|
|
2250
|
-
}),
|
|
2251
|
-
cancel: t
|
|
3067
|
+
token,
|
|
3068
|
+
cancel
|
|
2252
3069
|
};
|
|
2253
3070
|
}
|
|
2254
3071
|
};
|
|
2255
|
-
function
|
|
2256
|
-
return function(
|
|
2257
|
-
return
|
|
3072
|
+
function spread$1(callback) {
|
|
3073
|
+
return function wrap(arr) {
|
|
3074
|
+
return callback.apply(null, arr);
|
|
2258
3075
|
};
|
|
2259
3076
|
}
|
|
2260
|
-
function
|
|
2261
|
-
return
|
|
3077
|
+
function isAxiosError$1(payload) {
|
|
3078
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
2262
3079
|
}
|
|
2263
|
-
const
|
|
3080
|
+
const HttpStatusCode$1 = {
|
|
2264
3081
|
Continue: 100,
|
|
2265
3082
|
SwitchingProtocols: 101,
|
|
2266
3083
|
Processing: 102,
|
|
@@ -2325,65 +3142,74 @@ const Le = {
|
|
|
2325
3142
|
NotExtended: 510,
|
|
2326
3143
|
NetworkAuthenticationRequired: 511
|
|
2327
3144
|
};
|
|
2328
|
-
Object.entries(
|
|
2329
|
-
|
|
3145
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
3146
|
+
HttpStatusCode$1[value] = key;
|
|
2330
3147
|
});
|
|
2331
|
-
function
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
3148
|
+
function createInstance(defaultConfig) {
|
|
3149
|
+
const context = new Axios$1(defaultConfig);
|
|
3150
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
3151
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
3152
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
3153
|
+
instance.create = function create(instanceConfig) {
|
|
3154
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
3155
|
+
};
|
|
3156
|
+
return instance;
|
|
2336
3157
|
}
|
|
2337
|
-
const
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
return Promise.all(
|
|
3158
|
+
const axios = createInstance(defaults);
|
|
3159
|
+
axios.Axios = Axios$1;
|
|
3160
|
+
axios.CanceledError = CanceledError$1;
|
|
3161
|
+
axios.CancelToken = CancelToken$1;
|
|
3162
|
+
axios.isCancel = isCancel$1;
|
|
3163
|
+
axios.VERSION = VERSION$1;
|
|
3164
|
+
axios.toFormData = toFormData$1;
|
|
3165
|
+
axios.AxiosError = AxiosError$1;
|
|
3166
|
+
axios.Cancel = axios.CanceledError;
|
|
3167
|
+
axios.all = function all(promises) {
|
|
3168
|
+
return Promise.all(promises);
|
|
2348
3169
|
};
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
3170
|
+
axios.spread = spread$1;
|
|
3171
|
+
axios.isAxiosError = isAxiosError$1;
|
|
3172
|
+
axios.mergeConfig = mergeConfig$1;
|
|
3173
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3174
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3175
|
+
axios.getAdapter = adapters.getAdapter;
|
|
3176
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
3177
|
+
axios.default = axios;
|
|
2357
3178
|
const {
|
|
2358
|
-
Axios:
|
|
2359
|
-
AxiosError
|
|
2360
|
-
CanceledError
|
|
2361
|
-
isCancel
|
|
2362
|
-
CancelToken:
|
|
2363
|
-
VERSION
|
|
2364
|
-
all:
|
|
2365
|
-
Cancel
|
|
2366
|
-
isAxiosError
|
|
2367
|
-
spread
|
|
2368
|
-
toFormData
|
|
2369
|
-
AxiosHeaders:
|
|
2370
|
-
HttpStatusCode
|
|
2371
|
-
formToJSON
|
|
2372
|
-
getAdapter
|
|
2373
|
-
mergeConfig
|
|
2374
|
-
} =
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
3179
|
+
Axios: Axios2,
|
|
3180
|
+
AxiosError,
|
|
3181
|
+
CanceledError,
|
|
3182
|
+
isCancel,
|
|
3183
|
+
CancelToken: CancelToken2,
|
|
3184
|
+
VERSION,
|
|
3185
|
+
all: all2,
|
|
3186
|
+
Cancel,
|
|
3187
|
+
isAxiosError,
|
|
3188
|
+
spread,
|
|
3189
|
+
toFormData,
|
|
3190
|
+
AxiosHeaders: AxiosHeaders2,
|
|
3191
|
+
HttpStatusCode,
|
|
3192
|
+
formToJSON,
|
|
3193
|
+
getAdapter,
|
|
3194
|
+
mergeConfig
|
|
3195
|
+
} = axios;
|
|
3196
|
+
const createAxiosInstance = (config) => {
|
|
3197
|
+
return axios.create({
|
|
3198
|
+
timeout: 2 * 60 * 1e3,
|
|
3199
|
+
...config
|
|
3200
|
+
});
|
|
3201
|
+
};
|
|
2378
3202
|
export {
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
3203
|
+
AuthStateProvider,
|
|
3204
|
+
ERequestContentType,
|
|
3205
|
+
ERequestMethod,
|
|
3206
|
+
FetcherException,
|
|
3207
|
+
FetcherProvider,
|
|
3208
|
+
createAxiosInstance,
|
|
3209
|
+
createGraphQLFetcher,
|
|
3210
|
+
createRestFulFetcher,
|
|
3211
|
+
getGraphQLResponseFormatError,
|
|
3212
|
+
getRestFulResponseFormatError,
|
|
3213
|
+
useAuthState
|
|
2389
3214
|
};
|
|
3215
|
+
//# sourceMappingURL=acrool-react-fetcher.es.js.map
|