@acrool/react-fetcher 0.0.5 → 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 -1725
- 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,107 +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
|
-
|
|
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;
|
|
103
129
|
};
|
|
104
|
-
|
|
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 = {};
|
|
105
158
|
/**
|
|
106
159
|
* @license React
|
|
107
160
|
* react-jsx-runtime.production.js
|
|
@@ -111,29 +164,35 @@ var ce = { exports: {} }, Z = {};
|
|
|
111
164
|
* This source code is licensed under the MIT license found in the
|
|
112
165
|
* LICENSE file in the root directory of this source tree.
|
|
113
166
|
*/
|
|
114
|
-
var
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
var
|
|
119
|
-
function
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
|
132
188
|
};
|
|
133
189
|
}
|
|
134
|
-
|
|
190
|
+
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
191
|
+
reactJsxRuntime_production.jsx = jsxProd;
|
|
192
|
+
reactJsxRuntime_production.jsxs = jsxProd;
|
|
193
|
+
return reactJsxRuntime_production;
|
|
135
194
|
}
|
|
136
|
-
var
|
|
195
|
+
var reactJsxRuntime_development = {};
|
|
137
196
|
/**
|
|
138
197
|
* @license React
|
|
139
198
|
* react-jsx-runtime.development.js
|
|
@@ -143,435 +202,445 @@ var Q = {};
|
|
|
143
202
|
* This source code is licensed under the MIT license found in the
|
|
144
203
|
* LICENSE file in the root directory of this source tree.
|
|
145
204
|
*/
|
|
146
|
-
var
|
|
147
|
-
function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
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:
|
|
156
217
|
return "Fragment";
|
|
157
|
-
case
|
|
218
|
+
case REACT_PROFILER_TYPE:
|
|
158
219
|
return "Profiler";
|
|
159
|
-
case
|
|
220
|
+
case REACT_STRICT_MODE_TYPE:
|
|
160
221
|
return "StrictMode";
|
|
161
|
-
case
|
|
222
|
+
case REACT_SUSPENSE_TYPE:
|
|
162
223
|
return "Suspense";
|
|
163
|
-
case
|
|
224
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
164
225
|
return "SuspenseList";
|
|
165
|
-
case
|
|
226
|
+
case REACT_ACTIVITY_TYPE:
|
|
166
227
|
return "Activity";
|
|
167
228
|
}
|
|
168
|
-
if (
|
|
169
|
-
switch (typeof
|
|
229
|
+
if ("object" === typeof type)
|
|
230
|
+
switch ("number" === typeof type.tag && console.error(
|
|
170
231
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
171
|
-
),
|
|
172
|
-
case
|
|
232
|
+
), type.$$typeof) {
|
|
233
|
+
case REACT_PORTAL_TYPE:
|
|
173
234
|
return "Portal";
|
|
174
|
-
case
|
|
175
|
-
return (
|
|
176
|
-
case
|
|
177
|
-
return (
|
|
178
|
-
case
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return
|
|
183
|
-
case
|
|
184
|
-
|
|
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;
|
|
185
249
|
try {
|
|
186
|
-
return
|
|
187
|
-
} catch {
|
|
250
|
+
return getComponentNameFromType(type(innerType));
|
|
251
|
+
} catch (x) {
|
|
188
252
|
}
|
|
189
253
|
}
|
|
190
254
|
return null;
|
|
191
255
|
}
|
|
192
|
-
function
|
|
193
|
-
return "" +
|
|
256
|
+
function testStringCoercion(value) {
|
|
257
|
+
return "" + value;
|
|
194
258
|
}
|
|
195
|
-
function
|
|
259
|
+
function checkKeyStringCoercion(value) {
|
|
196
260
|
try {
|
|
197
|
-
|
|
198
|
-
var
|
|
199
|
-
} catch {
|
|
200
|
-
|
|
261
|
+
testStringCoercion(value);
|
|
262
|
+
var JSCompiler_inline_result = false;
|
|
263
|
+
} catch (e2) {
|
|
264
|
+
JSCompiler_inline_result = true;
|
|
201
265
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
|
|
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,
|
|
207
272
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
208
|
-
|
|
209
|
-
)
|
|
273
|
+
JSCompiler_inline_result$jscomp$0
|
|
274
|
+
);
|
|
275
|
+
return testStringCoercion(value);
|
|
210
276
|
}
|
|
211
277
|
}
|
|
212
|
-
function
|
|
213
|
-
if (
|
|
214
|
-
if (
|
|
278
|
+
function getTaskName(type) {
|
|
279
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
280
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
215
281
|
return "<...>";
|
|
216
282
|
try {
|
|
217
|
-
var
|
|
218
|
-
return
|
|
219
|
-
} catch {
|
|
283
|
+
var name = getComponentNameFromType(type);
|
|
284
|
+
return name ? "<" + name + ">" : "<...>";
|
|
285
|
+
} catch (x) {
|
|
220
286
|
return "<...>";
|
|
221
287
|
}
|
|
222
288
|
}
|
|
223
|
-
function
|
|
224
|
-
var
|
|
225
|
-
return
|
|
289
|
+
function getOwner() {
|
|
290
|
+
var dispatcher = ReactSharedInternals.A;
|
|
291
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
226
292
|
}
|
|
227
|
-
function
|
|
293
|
+
function UnknownOwner() {
|
|
228
294
|
return Error("react-stack-top-frame");
|
|
229
295
|
}
|
|
230
|
-
function
|
|
231
|
-
if (
|
|
232
|
-
var
|
|
233
|
-
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;
|
|
234
300
|
}
|
|
235
|
-
return
|
|
301
|
+
return void 0 !== config.key;
|
|
236
302
|
}
|
|
237
|
-
function
|
|
238
|
-
function
|
|
239
|
-
|
|
303
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
304
|
+
function warnAboutAccessingKey() {
|
|
305
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
|
|
240
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)",
|
|
241
|
-
|
|
307
|
+
displayName
|
|
242
308
|
));
|
|
243
309
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
310
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
311
|
+
Object.defineProperty(props, "key", {
|
|
312
|
+
get: warnAboutAccessingKey,
|
|
313
|
+
configurable: true
|
|
247
314
|
});
|
|
248
315
|
}
|
|
249
|
-
function
|
|
250
|
-
var
|
|
251
|
-
|
|
316
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
317
|
+
var componentName = getComponentNameFromType(this.type);
|
|
318
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
|
|
252
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."
|
|
253
|
-
))
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
enumerable:
|
|
268
|
-
|
|
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,
|
|
269
342
|
value: 0
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
345
|
+
configurable: false,
|
|
346
|
+
enumerable: false,
|
|
347
|
+
writable: true,
|
|
274
348
|
value: null
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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);
|
|
295
373
|
} else
|
|
296
374
|
console.error(
|
|
297
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."
|
|
298
376
|
);
|
|
299
|
-
else
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
var
|
|
303
|
-
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;
|
|
304
382
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
let props = %s
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
k,
|
|
314
|
-
Y,
|
|
315
|
-
k
|
|
316
|
-
), 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);
|
|
317
391
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
|
335
413
|
);
|
|
336
414
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
415
|
+
function validateChildKeys(node) {
|
|
416
|
+
"object" === typeof node && null !== node && node.$$typeof === REACT_ELEMENT_TYPE && node._store && (node._store.validated = 1);
|
|
339
417
|
}
|
|
340
|
-
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() {
|
|
341
420
|
return null;
|
|
342
421
|
};
|
|
343
|
-
|
|
344
|
-
"react-stack-bottom-frame": function(
|
|
345
|
-
return
|
|
422
|
+
React = {
|
|
423
|
+
"react-stack-bottom-frame": function(callStackForError) {
|
|
424
|
+
return callStackForError();
|
|
346
425
|
}
|
|
347
426
|
};
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
|
363
447
|
);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
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
|
|
375
460
|
);
|
|
376
461
|
};
|
|
377
|
-
}()
|
|
462
|
+
}();
|
|
463
|
+
return reactJsxRuntime_development;
|
|
378
464
|
}
|
|
379
|
-
var
|
|
380
|
-
function
|
|
381
|
-
|
|
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;
|
|
382
475
|
}
|
|
383
|
-
var
|
|
384
|
-
const
|
|
476
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
477
|
+
const s = [
|
|
385
478
|
"color: #fff",
|
|
386
479
|
"display: inline-block",
|
|
387
480
|
"font-size: 11px",
|
|
388
481
|
"line-height: 20px",
|
|
389
482
|
"padding-right: 8px",
|
|
390
483
|
"border-radius: 4px"
|
|
391
|
-
],
|
|
484
|
+
], t = {
|
|
392
485
|
primary: "#0055a9",
|
|
393
486
|
success: "#009422",
|
|
394
487
|
info: "#17a2b8",
|
|
395
488
|
warning: "#d7a000",
|
|
396
489
|
danger: "#ec2127"
|
|
397
490
|
};
|
|
398
|
-
function
|
|
399
|
-
console.log(`%c ${
|
|
491
|
+
function a(n, o, ...c) {
|
|
492
|
+
console.log(`%c ${n}`, o, ...c);
|
|
400
493
|
}
|
|
401
|
-
function
|
|
402
|
-
const
|
|
403
|
-
`background-color: ${
|
|
494
|
+
function i(n, ...o) {
|
|
495
|
+
const c = s.concat([
|
|
496
|
+
`background-color: ${t.primary}`
|
|
404
497
|
]).join(";");
|
|
405
|
-
|
|
498
|
+
a(n, c, ...o);
|
|
406
499
|
}
|
|
407
|
-
function
|
|
408
|
-
const
|
|
409
|
-
`background-color: ${
|
|
500
|
+
function r(n, ...o) {
|
|
501
|
+
const c = s.concat([
|
|
502
|
+
`background-color: ${t.success}`
|
|
410
503
|
]).join(";");
|
|
411
|
-
|
|
504
|
+
a(n, c, ...o);
|
|
412
505
|
}
|
|
413
|
-
function
|
|
414
|
-
const
|
|
415
|
-
`background-color: ${
|
|
506
|
+
function e(n, ...o) {
|
|
507
|
+
const c = s.concat([
|
|
508
|
+
`background-color: ${t.info}`
|
|
416
509
|
]).join(";");
|
|
417
|
-
|
|
510
|
+
a(n, c, ...o);
|
|
418
511
|
}
|
|
419
|
-
function
|
|
420
|
-
const
|
|
421
|
-
`background-color: ${
|
|
512
|
+
function l(n, ...o) {
|
|
513
|
+
const c = s.concat([
|
|
514
|
+
`background-color: ${t.warning}`
|
|
422
515
|
]).join(";");
|
|
423
|
-
|
|
516
|
+
a(n, c, ...o);
|
|
424
517
|
}
|
|
425
|
-
function
|
|
426
|
-
const
|
|
427
|
-
`background-color: ${
|
|
518
|
+
function g(n, ...o) {
|
|
519
|
+
const c = s.concat([
|
|
520
|
+
`background-color: ${t.danger}`
|
|
428
521
|
]).join(";");
|
|
429
|
-
|
|
522
|
+
a(n, c, ...o);
|
|
430
523
|
}
|
|
431
|
-
const
|
|
432
|
-
primary:
|
|
433
|
-
success:
|
|
434
|
-
info:
|
|
435
|
-
warning:
|
|
436
|
-
danger:
|
|
524
|
+
const u = {
|
|
525
|
+
primary: i,
|
|
526
|
+
success: r,
|
|
527
|
+
info: e,
|
|
528
|
+
warning: l,
|
|
529
|
+
danger: g
|
|
437
530
|
};
|
|
438
|
-
function
|
|
439
|
-
const
|
|
440
|
-
isZero: (
|
|
441
|
-
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
|
|
442
535
|
};
|
|
443
|
-
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;
|
|
444
537
|
}
|
|
445
|
-
function
|
|
446
|
-
|
|
447
|
-
isZero:
|
|
448
|
-
isFalse:
|
|
449
|
-
}
|
|
538
|
+
function D(e2, t2) {
|
|
539
|
+
const r2 = {
|
|
540
|
+
isZero: true,
|
|
541
|
+
isFalse: true
|
|
542
|
+
};
|
|
543
|
+
return !w(e2, r2);
|
|
450
544
|
}
|
|
451
|
-
class
|
|
452
|
-
constructor(
|
|
453
|
-
super(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
this.
|
|
459
|
-
|
|
460
|
-
|
|
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;
|
|
461
555
|
this.name = this.constructor.name;
|
|
462
|
-
|
|
463
|
-
getInfo() {
|
|
464
|
-
return {
|
|
465
|
-
message: this.response.message,
|
|
466
|
-
code: this.response.code,
|
|
467
|
-
args: this.response.args,
|
|
468
|
-
path: this.response.path
|
|
469
|
-
};
|
|
556
|
+
Object.setPrototypeOf(this, FetcherException.prototype);
|
|
470
557
|
}
|
|
471
558
|
}
|
|
472
|
-
const
|
|
559
|
+
const AuthStateContext = createContext({
|
|
473
560
|
lastUpdateTimestamp: 0,
|
|
474
|
-
isAuth:
|
|
475
|
-
getTokens: () =>
|
|
476
|
-
|
|
477
|
-
|
|
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"),
|
|
478
568
|
refreshTokens: async () => {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
|
488
581
|
}) => {
|
|
489
|
-
const [
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
+
}
|
|
499
610
|
try {
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
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);
|
|
504
617
|
return;
|
|
505
|
-
} catch {
|
|
506
|
-
|
|
618
|
+
} catch (err) {
|
|
619
|
+
handleOnForceLogout();
|
|
620
|
+
throw new FetcherException({ message: "refresh token fail", code: "REFRESH_TOKEN_CATCH" });
|
|
507
621
|
}
|
|
508
622
|
};
|
|
509
|
-
return /* @__PURE__ */
|
|
510
|
-
lastUpdateTimestamp
|
|
511
|
-
isAuth
|
|
512
|
-
getTokens:
|
|
513
|
-
updateTokens
|
|
514
|
-
refreshTokens:
|
|
515
|
-
forceLogout:
|
|
516
|
-
}, children
|
|
517
|
-
}, Ge = {
|
|
518
|
-
"en-US": {
|
|
519
|
-
400: "The requested parameter is wrong",
|
|
520
|
-
401: "Please login before continuing",
|
|
521
|
-
404: "Request Not Found/Route",
|
|
522
|
-
413: "The request/file sent exceeds the server limit size",
|
|
523
|
-
500: "Internal Server Error",
|
|
524
|
-
503: "System under maintenance",
|
|
525
|
-
504: "Please check your network and try again",
|
|
526
|
-
511: "Area not available",
|
|
527
|
-
CANCEL_ERROR: "Request has been cancelled. Only possible if `cancelToken` is provided in config, see axios `Cancellation`",
|
|
528
|
-
CLIENT_ERROR: "Any non-specific 400 series error",
|
|
529
|
-
CONNECTION_ERROR: "Server not available, bad dns",
|
|
530
|
-
NETWORK_ERROR: "Your mobile network connection is unstable. Please check your network connection status and try again.",
|
|
531
|
-
SERVER_ERROR: "Any 500 series error",
|
|
532
|
-
TIMEOUT_ERROR: "The server has not responded for more than {sec} seconds. Please confirm your network connection status or contact customer service"
|
|
533
|
-
},
|
|
534
|
-
"zh-TW": {
|
|
535
|
-
400: "請求的參數錯誤",
|
|
536
|
-
401: "請先登入再繼續",
|
|
537
|
-
404: "請求未找到/路由錯誤",
|
|
538
|
-
413: "請求/發送的檔案超出伺服器限制大小",
|
|
539
|
-
500: "內部伺服器錯誤",
|
|
540
|
-
503: "系統維護",
|
|
541
|
-
504: "請檢查網路後重試",
|
|
542
|
-
511: "區域不可用",
|
|
543
|
-
CANCEL_ERROR: "請求已取消。僅在配置中提供 `cancelToken` 時可能發生,請參閱 axios 的 `Cancellation`",
|
|
544
|
-
CLIENT_ERROR: "任意非特定的400系列錯誤",
|
|
545
|
-
CONNECTION_ERROR: "伺服器不可用,DNS錯誤",
|
|
546
|
-
NETWORK_ERROR: "您的行動網路連線不穩定。請檢查網路連線後重試。 ",
|
|
547
|
-
SERVER_ERROR: "任意500系列錯誤",
|
|
548
|
-
TIMEOUT_ERROR: "伺服器已超過 {sec} 秒未回應。請確認您的網路連線狀態或聯絡客服"
|
|
549
|
-
},
|
|
550
|
-
"zh-CN": {
|
|
551
|
-
400: "请求的参数错误",
|
|
552
|
-
401: "请先登录再继续",
|
|
553
|
-
404: "请求未找到/路由错误",
|
|
554
|
-
413: "请求/发送的文件超出服务器限制大小",
|
|
555
|
-
500: "内部服务器错误",
|
|
556
|
-
503: "系统维护中",
|
|
557
|
-
504: "请检查网络后重试",
|
|
558
|
-
511: "区域不可用",
|
|
559
|
-
CANCEL_ERROR: "请求已取消。仅当配置中提供 `cancelToken` 时可能发生,请参阅 axios 的 `Cancellation`",
|
|
560
|
-
CLIENT_ERROR: "任意非特定的400系列错误",
|
|
561
|
-
CONNECTION_ERROR: "服务器不可用,DNS错误",
|
|
562
|
-
NETWORK_ERROR: "您的移动网络连接不稳定。请检查网络连接后重试。",
|
|
563
|
-
SERVER_ERROR: "任意500系列错误",
|
|
564
|
-
TIMEOUT_ERROR: "服务器已超过 {sec} 秒未响应。请确认您的网络连接状态或联系客服"
|
|
565
|
-
}
|
|
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 });
|
|
566
631
|
};
|
|
567
|
-
class
|
|
568
|
-
constructor(
|
|
569
|
-
super(
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
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();
|
|
575
644
|
}
|
|
576
645
|
initName() {
|
|
577
646
|
this.name = this.constructor.name;
|
|
@@ -585,320 +654,550 @@ class fn extends Error {
|
|
|
585
654
|
};
|
|
586
655
|
}
|
|
587
656
|
}
|
|
588
|
-
const
|
|
589
|
-
var
|
|
590
|
-
|
|
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 {
|
|
591
670
|
message: "Axios error",
|
|
592
671
|
code: "ERR_SYS_BAD_RESPONSE"
|
|
593
672
|
};
|
|
594
|
-
}, dn = (e) => e != null && e.data ? e == null ? void 0 : e.data : {
|
|
595
|
-
message: "Axios error",
|
|
596
|
-
code: "ERR_SYS_BAD_RESPONSE"
|
|
597
673
|
};
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
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
|
|
609
703
|
}) => {
|
|
610
704
|
const {
|
|
611
|
-
getTokens
|
|
612
|
-
updateTokens
|
|
613
|
-
refreshTokens
|
|
614
|
-
forceLogout
|
|
615
|
-
} =
|
|
616
|
-
|
|
617
|
-
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);
|
|
618
713
|
return () => {
|
|
619
|
-
|
|
714
|
+
axiosInstance.interceptors.request.eject(interceptorReq);
|
|
715
|
+
axiosInstance.interceptors.response.eject(interceptorRes);
|
|
620
716
|
};
|
|
621
|
-
}, [
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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);
|
|
634
762
|
});
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
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);
|
|
645
776
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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
|
+
}
|
|
663
803
|
}
|
|
664
|
-
return Promise.reject(new
|
|
804
|
+
return Promise.reject(new FetcherException(responseFirstError));
|
|
665
805
|
};
|
|
666
|
-
return /* @__PURE__ */
|
|
667
|
-
|
|
806
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
807
|
+
AxiosClientContext.Provider,
|
|
668
808
|
{
|
|
669
|
-
value:
|
|
670
|
-
children
|
|
809
|
+
value: axiosInstance,
|
|
810
|
+
children
|
|
671
811
|
}
|
|
672
812
|
);
|
|
673
813
|
};
|
|
674
|
-
function
|
|
675
|
-
return function() {
|
|
676
|
-
return
|
|
814
|
+
function bind(fn, thisArg) {
|
|
815
|
+
return function wrap() {
|
|
816
|
+
return fn.apply(thisArg, arguments);
|
|
677
817
|
};
|
|
678
818
|
}
|
|
679
|
-
const { toString
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
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);
|
|
685
835
|
}
|
|
686
|
-
const
|
|
687
|
-
function
|
|
688
|
-
let
|
|
689
|
-
|
|
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;
|
|
690
845
|
}
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
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") {
|
|
703
873
|
return;
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
for (
|
|
712
|
-
|
|
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
|
+
}
|
|
713
892
|
}
|
|
714
893
|
}
|
|
715
|
-
function
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
let
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
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
|
+
}
|
|
722
905
|
return null;
|
|
723
906
|
}
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
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
|
+
}
|
|
729
926
|
};
|
|
730
|
-
for (let
|
|
731
|
-
arguments[
|
|
732
|
-
|
|
927
|
+
for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
|
928
|
+
arguments[i2] && forEach(arguments[i2], assignValue);
|
|
929
|
+
}
|
|
930
|
+
return result;
|
|
733
931
|
}
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
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;
|
|
744
963
|
do {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const r = e.indexOf(t, n);
|
|
753
|
-
return r !== -1 && r === n;
|
|
754
|
-
}, Un = (e) => {
|
|
755
|
-
if (!e) return null;
|
|
756
|
-
if (X(e)) return e;
|
|
757
|
-
let t = e.length;
|
|
758
|
-
if (!wt(t)) return null;
|
|
759
|
-
const n = new Array(t);
|
|
760
|
-
for (; t-- > 0; )
|
|
761
|
-
n[t] = e[t];
|
|
762
|
-
return n;
|
|
763
|
-
}, Dn = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && De(Uint8Array)), Bn = (e, t) => {
|
|
764
|
-
const r = (e && e[me]).call(e);
|
|
765
|
-
let s;
|
|
766
|
-
for (; (s = r.next()) && !s.done; ) {
|
|
767
|
-
const o = s.value;
|
|
768
|
-
t.call(e, o[0], o[1]);
|
|
769
|
-
}
|
|
770
|
-
}, qn = (e, t) => {
|
|
771
|
-
let n;
|
|
772
|
-
const r = [];
|
|
773
|
-
for (; (n = e.exec(t)) !== null; )
|
|
774
|
-
r.push(n);
|
|
775
|
-
return r;
|
|
776
|
-
}, In = D("HTMLFormElement"), $n = (e) => e.toLowerCase().replace(
|
|
777
|
-
/[-_\s]([a-z\d])(\w*)/g,
|
|
778
|
-
function(n, r, s) {
|
|
779
|
-
return r.toUpperCase() + s;
|
|
780
|
-
}
|
|
781
|
-
), Ze = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Mn = D("RegExp"), St = (e, t) => {
|
|
782
|
-
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
783
|
-
ie(n, (s, o) => {
|
|
784
|
-
let i;
|
|
785
|
-
(i = t(s, o, e)) !== !1 && (r[o] = i || s);
|
|
786
|
-
}), Object.defineProperties(e, r);
|
|
787
|
-
}, Hn = (e) => {
|
|
788
|
-
St(e, (t, n) => {
|
|
789
|
-
if (L(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
790
|
-
return !1;
|
|
791
|
-
const r = e[n];
|
|
792
|
-
if (L(r)) {
|
|
793
|
-
if (t.enumerable = !1, "writable" in t) {
|
|
794
|
-
t.writable = !1;
|
|
795
|
-
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;
|
|
796
971
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
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
|
+
};
|
|
800
1057
|
}
|
|
801
1058
|
});
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
1059
|
+
};
|
|
1060
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1061
|
+
const obj = {};
|
|
1062
|
+
const define = (arr) => {
|
|
1063
|
+
arr.forEach((value) => {
|
|
1064
|
+
obj[value] = true;
|
|
806
1065
|
});
|
|
807
1066
|
};
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
|
|
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]);
|
|
813
1077
|
}
|
|
814
|
-
const
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
|
|
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) {
|
|
818
1083
|
return;
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
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;
|
|
826
1094
|
}
|
|
827
1095
|
}
|
|
828
|
-
return
|
|
1096
|
+
return source;
|
|
829
1097
|
};
|
|
830
|
-
return
|
|
831
|
-
}
|
|
832
|
-
|
|
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
|
-
|
|
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,
|
|
879
1164
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
880
|
-
reduceDescriptors
|
|
881
|
-
freezeMethods
|
|
882
|
-
toObjectSet
|
|
883
|
-
toCamelCase
|
|
884
|
-
noop
|
|
885
|
-
toFiniteNumber
|
|
886
|
-
findKey
|
|
887
|
-
global:
|
|
888
|
-
isContextDefined
|
|
889
|
-
isSpecCompliantForm
|
|
890
|
-
toJSONObject
|
|
891
|
-
isAsyncFn
|
|
892
|
-
isThenable
|
|
893
|
-
setImmediate:
|
|
894
|
-
asap
|
|
895
|
-
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
|
|
896
1181
|
};
|
|
897
|
-
function
|
|
898
|
-
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
|
+
}
|
|
899
1198
|
}
|
|
900
|
-
|
|
901
|
-
toJSON: function() {
|
|
1199
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
1200
|
+
toJSON: function toJSON() {
|
|
902
1201
|
return {
|
|
903
1202
|
// Standard
|
|
904
1203
|
message: this.message,
|
|
@@ -912,13 +1211,14 @@ a.inherits(b, Error, {
|
|
|
912
1211
|
columnNumber: this.columnNumber,
|
|
913
1212
|
stack: this.stack,
|
|
914
1213
|
// Axios
|
|
915
|
-
config:
|
|
1214
|
+
config: utils$1.toJSONObject(this.config),
|
|
916
1215
|
code: this.code,
|
|
917
1216
|
status: this.status
|
|
918
1217
|
};
|
|
919
1218
|
}
|
|
920
1219
|
});
|
|
921
|
-
const
|
|
1220
|
+
const prototype$1 = AxiosError$1.prototype;
|
|
1221
|
+
const descriptors = {};
|
|
922
1222
|
[
|
|
923
1223
|
"ERR_BAD_OPTION_VALUE",
|
|
924
1224
|
"ERR_BAD_OPTION",
|
|
@@ -933,98 +1233,136 @@ const At = b.prototype, _t = {};
|
|
|
933
1233
|
"ERR_NOT_SUPPORT",
|
|
934
1234
|
"ERR_INVALID_URL"
|
|
935
1235
|
// eslint-disable-next-line func-names
|
|
936
|
-
].forEach((
|
|
937
|
-
|
|
1236
|
+
].forEach((code) => {
|
|
1237
|
+
descriptors[code] = { value: code };
|
|
938
1238
|
});
|
|
939
|
-
Object.defineProperties(
|
|
940
|
-
Object.defineProperty(
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
return
|
|
945
|
-
}, (
|
|
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;
|
|
946
1253
|
};
|
|
947
|
-
const
|
|
948
|
-
function
|
|
949
|
-
return
|
|
1254
|
+
const httpAdapter = null;
|
|
1255
|
+
function isVisitable(thing) {
|
|
1256
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
950
1257
|
}
|
|
951
|
-
function
|
|
952
|
-
return
|
|
1258
|
+
function removeBrackets(key) {
|
|
1259
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
953
1260
|
}
|
|
954
|
-
function
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
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 ? "." : "");
|
|
958
1267
|
}
|
|
959
|
-
function
|
|
960
|
-
return
|
|
1268
|
+
function isFlatArray(arr) {
|
|
1269
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
961
1270
|
}
|
|
962
|
-
const
|
|
963
|
-
return /^is[A-Z]/.test(
|
|
1271
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1272
|
+
return /^is[A-Z]/.test(prop);
|
|
964
1273
|
});
|
|
965
|
-
function
|
|
966
|
-
if (!
|
|
1274
|
+
function toFormData$1(obj, formData, options) {
|
|
1275
|
+
if (!utils$1.isObject(obj)) {
|
|
967
1276
|
throw new TypeError("target must be an object");
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
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]);
|
|
974
1285
|
});
|
|
975
|
-
const
|
|
976
|
-
|
|
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)) {
|
|
977
1293
|
throw new TypeError("visitor must be a function");
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
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(
|
|
994
1318
|
// eslint-disable-next-line no-nested-ternary
|
|
995
|
-
|
|
996
|
-
|
|
1319
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
1320
|
+
convertValue(el)
|
|
997
1321
|
);
|
|
998
|
-
})
|
|
1322
|
+
});
|
|
1323
|
+
return false;
|
|
1324
|
+
}
|
|
999
1325
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
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
|
|
1006
1337
|
});
|
|
1007
|
-
function
|
|
1008
|
-
if (
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
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)) {
|
|
1023
1359
|
throw new TypeError("data must be an object");
|
|
1024
|
-
|
|
1360
|
+
}
|
|
1361
|
+
build(obj);
|
|
1362
|
+
return formData;
|
|
1025
1363
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const
|
|
1364
|
+
function encode$1(str) {
|
|
1365
|
+
const charMap = {
|
|
1028
1366
|
"!": "%21",
|
|
1029
1367
|
"'": "%27",
|
|
1030
1368
|
"(": "%28",
|
|
@@ -1033,44 +1371,56 @@ function et(e) {
|
|
|
1033
1371
|
"%20": "+",
|
|
1034
1372
|
"%00": "\0"
|
|
1035
1373
|
};
|
|
1036
|
-
return encodeURIComponent(
|
|
1037
|
-
return
|
|
1374
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1375
|
+
return charMap[match];
|
|
1038
1376
|
});
|
|
1039
1377
|
}
|
|
1040
|
-
function
|
|
1041
|
-
this._pairs = []
|
|
1378
|
+
function AxiosURLSearchParams(params, options) {
|
|
1379
|
+
this._pairs = [];
|
|
1380
|
+
params && toFormData$1(params, this, options);
|
|
1042
1381
|
}
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
this._pairs.push([
|
|
1382
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
1383
|
+
prototype.append = function append(name, value) {
|
|
1384
|
+
this._pairs.push([name, value]);
|
|
1046
1385
|
};
|
|
1047
|
-
|
|
1048
|
-
const
|
|
1049
|
-
return
|
|
1050
|
-
} :
|
|
1051
|
-
return this._pairs.map(function(
|
|
1052
|
-
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]);
|
|
1053
1392
|
}, "").join("&");
|
|
1054
1393
|
};
|
|
1055
|
-
function
|
|
1056
|
-
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, "]");
|
|
1057
1396
|
}
|
|
1058
|
-
function
|
|
1059
|
-
if (!
|
|
1060
|
-
return
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new Be(t, n).toString(r), o) {
|
|
1068
|
-
const i = e.indexOf("#");
|
|
1069
|
-
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
|
+
};
|
|
1070
1406
|
}
|
|
1071
|
-
|
|
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;
|
|
1072
1422
|
}
|
|
1073
|
-
class
|
|
1423
|
+
class InterceptorManager {
|
|
1074
1424
|
constructor() {
|
|
1075
1425
|
this.handlers = [];
|
|
1076
1426
|
}
|
|
@@ -1082,13 +1432,14 @@ class tt {
|
|
|
1082
1432
|
*
|
|
1083
1433
|
* @return {Number} An ID used to remove interceptor later
|
|
1084
1434
|
*/
|
|
1085
|
-
use(
|
|
1086
|
-
|
|
1087
|
-
fulfilled
|
|
1088
|
-
rejected
|
|
1089
|
-
synchronous:
|
|
1090
|
-
runWhen:
|
|
1091
|
-
})
|
|
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;
|
|
1092
1443
|
}
|
|
1093
1444
|
/**
|
|
1094
1445
|
* Remove an interceptor from the stack
|
|
@@ -1097,8 +1448,10 @@ class tt {
|
|
|
1097
1448
|
*
|
|
1098
1449
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1099
1450
|
*/
|
|
1100
|
-
eject(
|
|
1101
|
-
|
|
1451
|
+
eject(id) {
|
|
1452
|
+
if (this.handlers[id]) {
|
|
1453
|
+
this.handlers[id] = null;
|
|
1454
|
+
}
|
|
1102
1455
|
}
|
|
1103
1456
|
/**
|
|
1104
1457
|
* Clear all interceptors from the stack
|
|
@@ -1106,7 +1459,9 @@ class tt {
|
|
|
1106
1459
|
* @returns {void}
|
|
1107
1460
|
*/
|
|
1108
1461
|
clear() {
|
|
1109
|
-
|
|
1462
|
+
if (this.handlers) {
|
|
1463
|
+
this.handlers = [];
|
|
1464
|
+
}
|
|
1110
1465
|
}
|
|
1111
1466
|
/**
|
|
1112
1467
|
* Iterate over all the registered interceptors
|
|
@@ -1118,122 +1473,191 @@ class tt {
|
|
|
1118
1473
|
*
|
|
1119
1474
|
* @returns {void}
|
|
1120
1475
|
*/
|
|
1121
|
-
forEach(
|
|
1122
|
-
|
|
1123
|
-
|
|
1476
|
+
forEach(fn) {
|
|
1477
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1478
|
+
if (h !== null) {
|
|
1479
|
+
fn(h);
|
|
1480
|
+
}
|
|
1124
1481
|
});
|
|
1125
1482
|
}
|
|
1126
1483
|
}
|
|
1127
|
-
const
|
|
1128
|
-
silentJSONParsing:
|
|
1129
|
-
forcedJSONParsing:
|
|
1130
|
-
clarifyTimeoutError:
|
|
1131
|
-
}
|
|
1132
|
-
|
|
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,
|
|
1133
1494
|
classes: {
|
|
1134
|
-
URLSearchParams:
|
|
1135
|
-
FormData:
|
|
1136
|
-
Blob:
|
|
1495
|
+
URLSearchParams: URLSearchParams$1,
|
|
1496
|
+
FormData: FormData$1,
|
|
1497
|
+
Blob: Blob$1
|
|
1137
1498
|
},
|
|
1138
1499
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
1139
|
-
}
|
|
1140
|
-
|
|
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({
|
|
1141
1510
|
__proto__: null,
|
|
1142
|
-
hasBrowserEnv
|
|
1143
|
-
hasStandardBrowserEnv
|
|
1144
|
-
hasStandardBrowserWebWorkerEnv
|
|
1145
|
-
navigator:
|
|
1146
|
-
origin
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
...
|
|
1511
|
+
hasBrowserEnv,
|
|
1512
|
+
hasStandardBrowserEnv,
|
|
1513
|
+
hasStandardBrowserWebWorkerEnv,
|
|
1514
|
+
navigator: _navigator,
|
|
1515
|
+
origin
|
|
1516
|
+
});
|
|
1517
|
+
const platform = {
|
|
1518
|
+
...utils,
|
|
1519
|
+
...platform$1
|
|
1150
1520
|
};
|
|
1151
|
-
function
|
|
1152
|
-
return
|
|
1153
|
-
visitor: function(
|
|
1154
|
-
|
|
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);
|
|
1155
1529
|
}
|
|
1156
|
-
},
|
|
1530
|
+
}, options));
|
|
1157
1531
|
}
|
|
1158
|
-
function
|
|
1159
|
-
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
|
+
});
|
|
1160
1536
|
}
|
|
1161
|
-
function
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
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;
|
|
1169
1548
|
}
|
|
1170
|
-
function
|
|
1171
|
-
function
|
|
1172
|
-
let
|
|
1173
|
-
if (
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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;
|
|
1182
1579
|
}
|
|
1183
1580
|
return null;
|
|
1184
1581
|
}
|
|
1185
|
-
function
|
|
1186
|
-
if (
|
|
1582
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
1583
|
+
if (utils$1.isString(rawValue)) {
|
|
1187
1584
|
try {
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1585
|
+
(parser || JSON.parse)(rawValue);
|
|
1586
|
+
return utils$1.trim(rawValue);
|
|
1587
|
+
} catch (e2) {
|
|
1588
|
+
if (e2.name !== "SyntaxError") {
|
|
1589
|
+
throw e2;
|
|
1590
|
+
}
|
|
1192
1591
|
}
|
|
1193
|
-
|
|
1592
|
+
}
|
|
1593
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
1194
1594
|
}
|
|
1195
|
-
const
|
|
1196
|
-
transitional:
|
|
1595
|
+
const defaults = {
|
|
1596
|
+
transitional: transitionalDefaults,
|
|
1197
1597
|
adapter: ["xhr", "http", "fetch"],
|
|
1198
|
-
transformRequest: [function(
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
if (
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
if (
|
|
1207
|
-
return
|
|
1208
|
-
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
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(),
|
|
1217
1629
|
this.formSerializer
|
|
1218
1630
|
);
|
|
1219
1631
|
}
|
|
1220
1632
|
}
|
|
1221
|
-
|
|
1633
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
1634
|
+
headers.setContentType("application/json", false);
|
|
1635
|
+
return stringifySafely(data);
|
|
1636
|
+
}
|
|
1637
|
+
return data;
|
|
1222
1638
|
}],
|
|
1223
|
-
transformResponse: [function(
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
if (
|
|
1228
|
-
|
|
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;
|
|
1229
1649
|
try {
|
|
1230
|
-
return JSON.parse(
|
|
1231
|
-
} catch (
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
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
|
+
}
|
|
1234
1658
|
}
|
|
1235
1659
|
}
|
|
1236
|
-
return
|
|
1660
|
+
return data;
|
|
1237
1661
|
}],
|
|
1238
1662
|
/**
|
|
1239
1663
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1245,23 +1669,23 @@ const ae = {
|
|
|
1245
1669
|
maxContentLength: -1,
|
|
1246
1670
|
maxBodyLength: -1,
|
|
1247
1671
|
env: {
|
|
1248
|
-
FormData:
|
|
1249
|
-
Blob:
|
|
1672
|
+
FormData: platform.classes.FormData,
|
|
1673
|
+
Blob: platform.classes.Blob
|
|
1250
1674
|
},
|
|
1251
|
-
validateStatus: function(
|
|
1252
|
-
return
|
|
1675
|
+
validateStatus: function validateStatus(status) {
|
|
1676
|
+
return status >= 200 && status < 300;
|
|
1253
1677
|
},
|
|
1254
1678
|
headers: {
|
|
1255
1679
|
common: {
|
|
1256
|
-
Accept: "application/json, text/plain, */*",
|
|
1680
|
+
"Accept": "application/json, text/plain, */*",
|
|
1257
1681
|
"Content-Type": void 0
|
|
1258
1682
|
}
|
|
1259
1683
|
}
|
|
1260
1684
|
};
|
|
1261
|
-
|
|
1262
|
-
|
|
1685
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
1686
|
+
defaults.headers[method] = {};
|
|
1263
1687
|
});
|
|
1264
|
-
const
|
|
1688
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1265
1689
|
"age",
|
|
1266
1690
|
"authorization",
|
|
1267
1691
|
"content-length",
|
|
@@ -1279,153 +1703,214 @@ const mr = a.toObjectSet([
|
|
|
1279
1703
|
"referer",
|
|
1280
1704
|
"retry-after",
|
|
1281
1705
|
"user-agent"
|
|
1282
|
-
])
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
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();
|
|
1292
1734
|
}
|
|
1293
|
-
function
|
|
1294
|
-
|
|
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);
|
|
1295
1740
|
}
|
|
1296
|
-
function
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
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;
|
|
1302
1749
|
}
|
|
1303
|
-
const
|
|
1304
|
-
function
|
|
1305
|
-
if (
|
|
1306
|
-
return
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
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);
|
|
1312
1764
|
}
|
|
1313
1765
|
}
|
|
1314
|
-
function
|
|
1315
|
-
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
|
+
});
|
|
1316
1770
|
}
|
|
1317
|
-
function
|
|
1318
|
-
const
|
|
1319
|
-
["get", "set", "has"].forEach((
|
|
1320
|
-
Object.defineProperty(
|
|
1321
|
-
value: function(
|
|
1322
|
-
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);
|
|
1323
1777
|
},
|
|
1324
|
-
configurable:
|
|
1778
|
+
configurable: true
|
|
1325
1779
|
});
|
|
1326
1780
|
});
|
|
1327
1781
|
}
|
|
1328
|
-
let
|
|
1329
|
-
constructor(
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1332
|
-
set(
|
|
1333
|
-
const
|
|
1334
|
-
function
|
|
1335
|
-
const
|
|
1336
|
-
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) {
|
|
1337
1791
|
throw new Error("header name must be a non-empty string");
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
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)) {
|
|
1350
1807
|
throw TypeError("Object iterator must return a key-value pair");
|
|
1351
|
-
|
|
1808
|
+
}
|
|
1809
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
1352
1810
|
}
|
|
1353
|
-
|
|
1354
|
-
} else
|
|
1355
|
-
|
|
1811
|
+
setHeaders(obj, valueOrRewrite);
|
|
1812
|
+
} else {
|
|
1813
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1814
|
+
}
|
|
1356
1815
|
return this;
|
|
1357
1816
|
}
|
|
1358
|
-
get(
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
if (
|
|
1368
|
-
return
|
|
1369
|
-
|
|
1370
|
-
|
|
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
|
+
}
|
|
1371
1835
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
1372
1836
|
}
|
|
1373
1837
|
}
|
|
1374
1838
|
}
|
|
1375
|
-
has(
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
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)));
|
|
1379
1844
|
}
|
|
1380
|
-
return
|
|
1381
|
-
}
|
|
1382
|
-
delete(
|
|
1383
|
-
const
|
|
1384
|
-
let
|
|
1385
|
-
function
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
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
|
+
}
|
|
1389
1858
|
}
|
|
1390
1859
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
let r = n.length, s = !1;
|
|
1396
|
-
for (; r--; ) {
|
|
1397
|
-
const o = n[r];
|
|
1398
|
-
(!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);
|
|
1399
1864
|
}
|
|
1400
|
-
return
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
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];
|
|
1408
1888
|
return;
|
|
1409
1889
|
}
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
|
|
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;
|
|
1413
1898
|
}
|
|
1414
|
-
concat(...
|
|
1415
|
-
return this.constructor.concat(this, ...
|
|
1899
|
+
concat(...targets) {
|
|
1900
|
+
return this.constructor.concat(this, ...targets);
|
|
1416
1901
|
}
|
|
1417
|
-
toJSON(
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
})
|
|
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;
|
|
1422
1908
|
}
|
|
1423
1909
|
[Symbol.iterator]() {
|
|
1424
1910
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1425
1911
|
}
|
|
1426
1912
|
toString() {
|
|
1427
|
-
return Object.entries(this.toJSON()).map(([
|
|
1428
|
-
`);
|
|
1913
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
1429
1914
|
}
|
|
1430
1915
|
getSetCookie() {
|
|
1431
1916
|
return this.get("set-cookie") || [];
|
|
@@ -1433,135 +1918,203 @@ let U = class {
|
|
|
1433
1918
|
get [Symbol.toStringTag]() {
|
|
1434
1919
|
return "AxiosHeaders";
|
|
1435
1920
|
}
|
|
1436
|
-
static from(
|
|
1437
|
-
return
|
|
1921
|
+
static from(thing) {
|
|
1922
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1438
1923
|
}
|
|
1439
|
-
static concat(
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1924
|
+
static concat(first, ...targets) {
|
|
1925
|
+
const computed = new this(first);
|
|
1926
|
+
targets.forEach((target) => computed.set(target));
|
|
1927
|
+
return computed;
|
|
1442
1928
|
}
|
|
1443
|
-
static accessor(
|
|
1444
|
-
const
|
|
1929
|
+
static accessor(header) {
|
|
1930
|
+
const internals = this[$internals] = this[$internals] = {
|
|
1445
1931
|
accessors: {}
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
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
|
+
}
|
|
1450
1941
|
}
|
|
1451
|
-
|
|
1942
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1943
|
+
return this;
|
|
1452
1944
|
}
|
|
1453
1945
|
};
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
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);
|
|
1457
1949
|
return {
|
|
1458
|
-
get: () =>
|
|
1459
|
-
set(
|
|
1460
|
-
this[
|
|
1950
|
+
get: () => value,
|
|
1951
|
+
set(headerValue) {
|
|
1952
|
+
this[mapped] = headerValue;
|
|
1461
1953
|
}
|
|
1462
1954
|
};
|
|
1463
1955
|
});
|
|
1464
|
-
|
|
1465
|
-
function
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
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;
|
|
1471
1967
|
}
|
|
1472
|
-
function
|
|
1473
|
-
return !!(
|
|
1968
|
+
function isCancel$1(value) {
|
|
1969
|
+
return !!(value && value.__CANCEL__);
|
|
1474
1970
|
}
|
|
1475
|
-
function
|
|
1476
|
-
|
|
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";
|
|
1477
1974
|
}
|
|
1478
|
-
|
|
1479
|
-
__CANCEL__:
|
|
1975
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1976
|
+
__CANCEL__: true
|
|
1480
1977
|
});
|
|
1481
|
-
function
|
|
1482
|
-
const
|
|
1483
|
-
!
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
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
|
+
}
|
|
1490
1991
|
}
|
|
1491
|
-
function
|
|
1492
|
-
const
|
|
1493
|
-
return
|
|
1992
|
+
function parseProtocol(url) {
|
|
1993
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1994
|
+
return match && match[1] || "";
|
|
1494
1995
|
}
|
|
1495
|
-
function
|
|
1496
|
-
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
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) {
|
|
1506
2023
|
return;
|
|
1507
|
-
|
|
1508
|
-
|
|
2024
|
+
}
|
|
2025
|
+
const passed = startedAt && now - startedAt;
|
|
2026
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1509
2027
|
};
|
|
1510
2028
|
}
|
|
1511
|
-
function
|
|
1512
|
-
let
|
|
1513
|
-
|
|
1514
|
-
|
|
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
|
+
}
|
|
1515
2057
|
};
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
p >= r ? i(l, u) : (s = l, o || (o = setTimeout(() => {
|
|
1519
|
-
o = null, i(s);
|
|
1520
|
-
}, r - p)));
|
|
1521
|
-
}, () => s && i(s)];
|
|
2058
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
2059
|
+
return [throttled, flush];
|
|
1522
2060
|
}
|
|
1523
|
-
const
|
|
1524
|
-
let
|
|
1525
|
-
const
|
|
1526
|
-
return
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
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
|
|
1539
2081
|
};
|
|
1540
|
-
|
|
1541
|
-
},
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
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 ? (
|
|
1553
2102
|
// Standard browser envs support document.cookie
|
|
1554
2103
|
{
|
|
1555
|
-
write(
|
|
1556
|
-
const
|
|
1557
|
-
|
|
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("; ");
|
|
1558
2111
|
},
|
|
1559
|
-
read(
|
|
1560
|
-
const
|
|
1561
|
-
return
|
|
2112
|
+
read(name) {
|
|
2113
|
+
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
2114
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
1562
2115
|
},
|
|
1563
|
-
remove(
|
|
1564
|
-
this.write(
|
|
2116
|
+
remove(name) {
|
|
2117
|
+
this.write(name, "", Date.now() - 864e5);
|
|
1565
2118
|
}
|
|
1566
2119
|
}
|
|
1567
2120
|
) : (
|
|
@@ -1576,488 +2129,688 @@ const pe = (e, t, n = 3) => {
|
|
|
1576
2129
|
}
|
|
1577
2130
|
}
|
|
1578
2131
|
);
|
|
1579
|
-
function
|
|
1580
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
2132
|
+
function isAbsoluteURL(url) {
|
|
2133
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1581
2134
|
}
|
|
1582
|
-
function
|
|
1583
|
-
return
|
|
2135
|
+
function combineURLs(baseURL, relativeURL) {
|
|
2136
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
1584
2137
|
}
|
|
1585
|
-
function
|
|
1586
|
-
let
|
|
1587
|
-
|
|
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;
|
|
1588
2144
|
}
|
|
1589
|
-
const
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1592
|
-
const
|
|
1593
|
-
function
|
|
1594
|
-
|
|
1595
|
-
|
|
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
|
-
|
|
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)
|
|
1648
2215
|
};
|
|
1649
|
-
|
|
1650
|
-
const
|
|
1651
|
-
|
|
1652
|
-
|
|
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;
|
|
1653
2222
|
}
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
let { data
|
|
1657
|
-
|
|
1658
|
-
|
|
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
|
-
|
|
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) {
|
|
1688
2275
|
return;
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
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);
|
|
1698
2309
|
};
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
let
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
if (
|
|
1727
|
-
|
|
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));
|
|
1728
2374
|
return;
|
|
1729
2375
|
}
|
|
1730
|
-
|
|
2376
|
+
request.send(requestData || null);
|
|
1731
2377
|
});
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
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));
|
|
1741
2390
|
}
|
|
1742
2391
|
};
|
|
1743
|
-
let
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
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
|
+
}
|
|
1750
2405
|
};
|
|
1751
|
-
|
|
1752
|
-
const { signal
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
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;
|
|
1759
2416
|
return;
|
|
1760
2417
|
}
|
|
1761
|
-
let
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
|
|
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;
|
|
1770
2434
|
return;
|
|
1771
2435
|
}
|
|
1772
|
-
const
|
|
2436
|
+
const reader = stream.getReader();
|
|
1773
2437
|
try {
|
|
1774
2438
|
for (; ; ) {
|
|
1775
|
-
const { done
|
|
1776
|
-
if (
|
|
2439
|
+
const { done, value } = await reader.read();
|
|
2440
|
+
if (done) {
|
|
1777
2441
|
break;
|
|
1778
|
-
|
|
2442
|
+
}
|
|
2443
|
+
yield value;
|
|
1779
2444
|
}
|
|
1780
2445
|
} finally {
|
|
1781
|
-
await
|
|
2446
|
+
await reader.cancel();
|
|
1782
2447
|
}
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
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
|
+
}
|
|
1787
2458
|
};
|
|
1788
2459
|
return new ReadableStream({
|
|
1789
|
-
async pull(
|
|
2460
|
+
async pull(controller) {
|
|
1790
2461
|
try {
|
|
1791
|
-
const { done:
|
|
1792
|
-
if (
|
|
1793
|
-
|
|
2462
|
+
const { done: done2, value } = await iterator2.next();
|
|
2463
|
+
if (done2) {
|
|
2464
|
+
_onFinish();
|
|
2465
|
+
controller.close();
|
|
1794
2466
|
return;
|
|
1795
2467
|
}
|
|
1796
|
-
let
|
|
1797
|
-
if (
|
|
1798
|
-
let
|
|
1799
|
-
|
|
2468
|
+
let len = value.byteLength;
|
|
2469
|
+
if (onProgress) {
|
|
2470
|
+
let loadedBytes = bytes += len;
|
|
2471
|
+
onProgress(loadedBytes);
|
|
1800
2472
|
}
|
|
1801
|
-
|
|
1802
|
-
} catch (
|
|
1803
|
-
|
|
2473
|
+
controller.enqueue(new Uint8Array(value));
|
|
2474
|
+
} catch (err) {
|
|
2475
|
+
_onFinish(err);
|
|
2476
|
+
throw err;
|
|
1804
2477
|
}
|
|
1805
2478
|
},
|
|
1806
|
-
cancel(
|
|
1807
|
-
|
|
2479
|
+
cancel(reason) {
|
|
2480
|
+
_onFinish(reason);
|
|
2481
|
+
return iterator2.return();
|
|
1808
2482
|
}
|
|
1809
2483
|
}, {
|
|
1810
2484
|
highWaterMark: 2
|
|
1811
2485
|
});
|
|
1812
|
-
}
|
|
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) => {
|
|
1813
2491
|
try {
|
|
1814
|
-
return !!
|
|
1815
|
-
} catch {
|
|
1816
|
-
return
|
|
2492
|
+
return !!fn(...args);
|
|
2493
|
+
} catch (e2) {
|
|
2494
|
+
return false;
|
|
1817
2495
|
}
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
|
|
2496
|
+
};
|
|
2497
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
2498
|
+
let duplexAccessed = false;
|
|
2499
|
+
const hasContentType = new Request(platform.origin, {
|
|
1821
2500
|
body: new ReadableStream(),
|
|
1822
2501
|
method: "POST",
|
|
1823
2502
|
get duplex() {
|
|
1824
|
-
|
|
2503
|
+
duplexAccessed = true;
|
|
2504
|
+
return "half";
|
|
1825
2505
|
}
|
|
1826
2506
|
}).headers.has("Content-Type");
|
|
1827
|
-
return
|
|
1828
|
-
})
|
|
1829
|
-
|
|
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)
|
|
1830
2513
|
};
|
|
1831
|
-
|
|
1832
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((
|
|
1833
|
-
!
|
|
1834
|
-
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);
|
|
1835
2518
|
});
|
|
1836
2519
|
});
|
|
1837
2520
|
})(new Response());
|
|
1838
|
-
const
|
|
1839
|
-
if (
|
|
2521
|
+
const getBodyLength = async (body) => {
|
|
2522
|
+
if (body == null) {
|
|
1840
2523
|
return 0;
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
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, {
|
|
1845
2530
|
method: "POST",
|
|
1846
|
-
body
|
|
1847
|
-
})
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
if (
|
|
1851
|
-
return
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}
|
|
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) => {
|
|
1856
2550
|
let {
|
|
1857
|
-
url
|
|
1858
|
-
method
|
|
1859
|
-
data
|
|
1860
|
-
signal
|
|
1861
|
-
cancelToken
|
|
1862
|
-
timeout
|
|
1863
|
-
onDownloadProgress
|
|
1864
|
-
onUploadProgress
|
|
1865
|
-
responseType
|
|
1866
|
-
headers
|
|
1867
|
-
withCredentials
|
|
1868
|
-
fetchOptions
|
|
1869
|
-
} =
|
|
1870
|
-
|
|
1871
|
-
let
|
|
1872
|
-
|
|
1873
|
-
|
|
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();
|
|
1874
2569
|
});
|
|
1875
|
-
let
|
|
2570
|
+
let requestContentLength;
|
|
1876
2571
|
try {
|
|
1877
|
-
if (
|
|
1878
|
-
let
|
|
2572
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
2573
|
+
let _request = new Request(url, {
|
|
1879
2574
|
method: "POST",
|
|
1880
|
-
body:
|
|
2575
|
+
body: data,
|
|
1881
2576
|
duplex: "half"
|
|
1882
|
-
})
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
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))
|
|
1887
2586
|
);
|
|
1888
|
-
|
|
2587
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
1889
2588
|
}
|
|
1890
2589
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
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,
|
|
1899
2600
|
duplex: "half",
|
|
1900
|
-
credentials:
|
|
2601
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1901
2602
|
});
|
|
1902
|
-
let
|
|
1903
|
-
const
|
|
1904
|
-
if (
|
|
1905
|
-
const
|
|
1906
|
-
["status", "statusText", "headers"].forEach((
|
|
1907
|
-
|
|
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];
|
|
1908
2609
|
});
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
|
|
2610
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
2611
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2612
|
+
responseContentLength,
|
|
2613
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
1912
2614
|
) || [];
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2615
|
+
response = new Response(
|
|
2616
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2617
|
+
flush && flush();
|
|
2618
|
+
unsubscribe && unsubscribe();
|
|
1916
2619
|
}),
|
|
1917
|
-
|
|
2620
|
+
options
|
|
1918
2621
|
);
|
|
1919
2622
|
}
|
|
1920
|
-
|
|
1921
|
-
let
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
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
|
|
1930
2634
|
});
|
|
1931
2635
|
});
|
|
1932
|
-
} catch (
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
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);
|
|
1939
2647
|
}
|
|
1940
|
-
})
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2648
|
+
});
|
|
2649
|
+
const knownAdapters = {
|
|
2650
|
+
http: httpAdapter,
|
|
2651
|
+
xhr: xhrAdapter,
|
|
2652
|
+
fetch: fetchAdapter
|
|
1944
2653
|
};
|
|
1945
|
-
|
|
1946
|
-
if (
|
|
2654
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
2655
|
+
if (fn) {
|
|
1947
2656
|
try {
|
|
1948
|
-
Object.defineProperty(
|
|
1949
|
-
} catch {
|
|
2657
|
+
Object.defineProperty(fn, "name", { value });
|
|
2658
|
+
} catch (e2) {
|
|
1950
2659
|
}
|
|
1951
|
-
Object.defineProperty(
|
|
2660
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
1952
2661
|
}
|
|
1953
2662
|
});
|
|
1954
|
-
const
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
const
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
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) {
|
|
1966
2683
|
break;
|
|
1967
|
-
|
|
2684
|
+
}
|
|
2685
|
+
rejectedReasons[id || "#" + i2] = adapter;
|
|
1968
2686
|
}
|
|
1969
|
-
if (!
|
|
1970
|
-
const
|
|
1971
|
-
([
|
|
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")
|
|
1972
2690
|
);
|
|
1973
|
-
let
|
|
1974
|
-
|
|
1975
|
-
`
|
|
1976
|
-
throw new b(
|
|
1977
|
-
"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,
|
|
1978
2694
|
"ERR_NOT_SUPPORT"
|
|
1979
2695
|
);
|
|
1980
2696
|
}
|
|
1981
|
-
return
|
|
2697
|
+
return adapter;
|
|
1982
2698
|
},
|
|
1983
|
-
adapters:
|
|
2699
|
+
adapters: knownAdapters
|
|
1984
2700
|
};
|
|
1985
|
-
function
|
|
1986
|
-
if (
|
|
1987
|
-
|
|
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
|
+
}
|
|
1988
2708
|
}
|
|
1989
|
-
function
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
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);
|
|
2005
2742
|
});
|
|
2006
2743
|
}
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
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;
|
|
2011
2749
|
};
|
|
2012
2750
|
});
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
function
|
|
2016
|
-
return "[Axios v" +
|
|
2017
|
-
}
|
|
2018
|
-
return (
|
|
2019
|
-
if (
|
|
2020
|
-
throw new
|
|
2021
|
-
|
|
2022
|
-
|
|
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
|
|
2023
2761
|
);
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
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;
|
|
2030
2773
|
};
|
|
2031
2774
|
};
|
|
2032
|
-
|
|
2033
|
-
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
|
+
};
|
|
2034
2780
|
};
|
|
2035
|
-
function
|
|
2036
|
-
if (typeof
|
|
2037
|
-
throw new
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
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
|
+
}
|
|
2046
2796
|
continue;
|
|
2047
2797
|
}
|
|
2048
|
-
if (
|
|
2049
|
-
throw new
|
|
2798
|
+
if (allowUnknown !== true) {
|
|
2799
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
2800
|
+
}
|
|
2050
2801
|
}
|
|
2051
2802
|
}
|
|
2052
|
-
const
|
|
2053
|
-
assertOptions
|
|
2054
|
-
validators:
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
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()
|
|
2061
2814
|
};
|
|
2062
2815
|
}
|
|
2063
2816
|
/**
|
|
@@ -2068,197 +2821,263 @@ let J = class {
|
|
|
2068
2821
|
*
|
|
2069
2822
|
* @returns {Promise} The Promise to be fulfilled
|
|
2070
2823
|
*/
|
|
2071
|
-
async request(
|
|
2824
|
+
async request(configOrUrl, config) {
|
|
2072
2825
|
try {
|
|
2073
|
-
return await this._request(
|
|
2074
|
-
} catch (
|
|
2075
|
-
if (
|
|
2076
|
-
let
|
|
2077
|
-
Error.captureStackTrace ? Error.captureStackTrace(
|
|
2078
|
-
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/, "") : "";
|
|
2079
2832
|
try {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
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) {
|
|
2083
2839
|
}
|
|
2084
2840
|
}
|
|
2085
|
-
throw
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
_request(
|
|
2089
|
-
typeof
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
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]
|
|
2107
2886
|
);
|
|
2108
|
-
|
|
2887
|
+
headers && utils$1.forEach(
|
|
2109
2888
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
2110
|
-
(
|
|
2111
|
-
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;
|
|
2112
2899
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
let d = !0;
|
|
2116
|
-
this.interceptors.request.forEach(function(R) {
|
|
2117
|
-
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);
|
|
2118
2902
|
});
|
|
2119
|
-
const
|
|
2120
|
-
this.interceptors.response.forEach(function(
|
|
2121
|
-
|
|
2903
|
+
const responseInterceptorChain = [];
|
|
2904
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2905
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2122
2906
|
});
|
|
2123
|
-
let
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
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++];
|
|
2134
2927
|
try {
|
|
2135
|
-
|
|
2136
|
-
} catch (
|
|
2137
|
-
|
|
2928
|
+
newConfig = onFulfilled(newConfig);
|
|
2929
|
+
} catch (error) {
|
|
2930
|
+
onRejected.call(this, error);
|
|
2138
2931
|
break;
|
|
2139
2932
|
}
|
|
2140
2933
|
}
|
|
2141
2934
|
try {
|
|
2142
|
-
|
|
2143
|
-
} catch (
|
|
2144
|
-
return Promise.reject(
|
|
2935
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
2936
|
+
} catch (error) {
|
|
2937
|
+
return Promise.reject(error);
|
|
2145
2938
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2939
|
+
i2 = 0;
|
|
2940
|
+
len = responseInterceptorChain.length;
|
|
2941
|
+
while (i2 < len) {
|
|
2942
|
+
promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
|
|
2943
|
+
}
|
|
2944
|
+
return promise;
|
|
2149
2945
|
}
|
|
2150
|
-
getUri(
|
|
2151
|
-
|
|
2152
|
-
const
|
|
2153
|
-
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);
|
|
2154
2950
|
}
|
|
2155
2951
|
};
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
return this.request(
|
|
2159
|
-
method
|
|
2160
|
-
url
|
|
2161
|
-
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
|
|
2162
2958
|
}));
|
|
2163
2959
|
};
|
|
2164
2960
|
});
|
|
2165
|
-
|
|
2166
|
-
function
|
|
2167
|
-
return function(
|
|
2168
|
-
return this.request(
|
|
2169
|
-
method
|
|
2170
|
-
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 ? {
|
|
2171
2967
|
"Content-Type": "multipart/form-data"
|
|
2172
2968
|
} : {},
|
|
2173
|
-
url
|
|
2174
|
-
data
|
|
2969
|
+
url,
|
|
2970
|
+
data
|
|
2175
2971
|
}));
|
|
2176
2972
|
};
|
|
2177
2973
|
}
|
|
2178
|
-
|
|
2974
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
2975
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
2179
2976
|
});
|
|
2180
|
-
let $
|
|
2181
|
-
constructor(
|
|
2182
|
-
if (typeof
|
|
2977
|
+
let CancelToken$1 = class CancelToken {
|
|
2978
|
+
constructor(executor) {
|
|
2979
|
+
if (typeof executor !== "function") {
|
|
2183
2980
|
throw new TypeError("executor must be a function.");
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2981
|
+
}
|
|
2982
|
+
let resolvePromise;
|
|
2983
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2984
|
+
resolvePromise = resolve;
|
|
2187
2985
|
});
|
|
2188
|
-
const
|
|
2189
|
-
this.promise.then((
|
|
2190
|
-
if (!
|
|
2191
|
-
let
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
|
|
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);
|
|
2205
3012
|
});
|
|
2206
3013
|
}
|
|
2207
3014
|
/**
|
|
2208
3015
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
2209
3016
|
*/
|
|
2210
3017
|
throwIfRequested() {
|
|
2211
|
-
if (this.reason)
|
|
3018
|
+
if (this.reason) {
|
|
2212
3019
|
throw this.reason;
|
|
3020
|
+
}
|
|
2213
3021
|
}
|
|
2214
3022
|
/**
|
|
2215
3023
|
* Subscribe to the cancel signal
|
|
2216
3024
|
*/
|
|
2217
|
-
subscribe(
|
|
3025
|
+
subscribe(listener) {
|
|
2218
3026
|
if (this.reason) {
|
|
2219
|
-
|
|
3027
|
+
listener(this.reason);
|
|
2220
3028
|
return;
|
|
2221
3029
|
}
|
|
2222
|
-
|
|
3030
|
+
if (this._listeners) {
|
|
3031
|
+
this._listeners.push(listener);
|
|
3032
|
+
} else {
|
|
3033
|
+
this._listeners = [listener];
|
|
3034
|
+
}
|
|
2223
3035
|
}
|
|
2224
3036
|
/**
|
|
2225
3037
|
* Unsubscribe from the cancel signal
|
|
2226
3038
|
*/
|
|
2227
|
-
unsubscribe(
|
|
2228
|
-
if (!this._listeners)
|
|
3039
|
+
unsubscribe(listener) {
|
|
3040
|
+
if (!this._listeners) {
|
|
2229
3041
|
return;
|
|
2230
|
-
|
|
2231
|
-
|
|
3042
|
+
}
|
|
3043
|
+
const index = this._listeners.indexOf(listener);
|
|
3044
|
+
if (index !== -1) {
|
|
3045
|
+
this._listeners.splice(index, 1);
|
|
3046
|
+
}
|
|
2232
3047
|
}
|
|
2233
3048
|
toAbortSignal() {
|
|
2234
|
-
const
|
|
2235
|
-
|
|
3049
|
+
const controller = new AbortController();
|
|
3050
|
+
const abort = (err) => {
|
|
3051
|
+
controller.abort(err);
|
|
2236
3052
|
};
|
|
2237
|
-
|
|
3053
|
+
this.subscribe(abort);
|
|
3054
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3055
|
+
return controller.signal;
|
|
2238
3056
|
}
|
|
2239
3057
|
/**
|
|
2240
3058
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2241
3059
|
* cancels the `CancelToken`.
|
|
2242
3060
|
*/
|
|
2243
3061
|
static source() {
|
|
2244
|
-
let
|
|
3062
|
+
let cancel;
|
|
3063
|
+
const token = new CancelToken(function executor(c) {
|
|
3064
|
+
cancel = c;
|
|
3065
|
+
});
|
|
2245
3066
|
return {
|
|
2246
|
-
token
|
|
2247
|
-
|
|
2248
|
-
}),
|
|
2249
|
-
cancel: t
|
|
3067
|
+
token,
|
|
3068
|
+
cancel
|
|
2250
3069
|
};
|
|
2251
3070
|
}
|
|
2252
3071
|
};
|
|
2253
|
-
function
|
|
2254
|
-
return function(
|
|
2255
|
-
return
|
|
3072
|
+
function spread$1(callback) {
|
|
3073
|
+
return function wrap(arr) {
|
|
3074
|
+
return callback.apply(null, arr);
|
|
2256
3075
|
};
|
|
2257
3076
|
}
|
|
2258
|
-
function
|
|
2259
|
-
return
|
|
3077
|
+
function isAxiosError$1(payload) {
|
|
3078
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
2260
3079
|
}
|
|
2261
|
-
const
|
|
3080
|
+
const HttpStatusCode$1 = {
|
|
2262
3081
|
Continue: 100,
|
|
2263
3082
|
SwitchingProtocols: 101,
|
|
2264
3083
|
Processing: 102,
|
|
@@ -2323,65 +3142,74 @@ const Le = {
|
|
|
2323
3142
|
NotExtended: 510,
|
|
2324
3143
|
NetworkAuthenticationRequired: 511
|
|
2325
3144
|
};
|
|
2326
|
-
Object.entries(
|
|
2327
|
-
|
|
3145
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
3146
|
+
HttpStatusCode$1[value] = key;
|
|
2328
3147
|
});
|
|
2329
|
-
function
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
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;
|
|
2334
3157
|
}
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
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);
|
|
2346
3169
|
};
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
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;
|
|
2355
3178
|
const {
|
|
2356
|
-
Axios:
|
|
2357
|
-
AxiosError
|
|
2358
|
-
CanceledError
|
|
2359
|
-
isCancel
|
|
2360
|
-
CancelToken:
|
|
2361
|
-
VERSION
|
|
2362
|
-
all:
|
|
2363
|
-
Cancel
|
|
2364
|
-
isAxiosError
|
|
2365
|
-
spread
|
|
2366
|
-
toFormData
|
|
2367
|
-
AxiosHeaders:
|
|
2368
|
-
HttpStatusCode
|
|
2369
|
-
formToJSON
|
|
2370
|
-
getAdapter
|
|
2371
|
-
mergeConfig
|
|
2372
|
-
} =
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
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
|
+
};
|
|
2376
3202
|
export {
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
3203
|
+
AuthStateProvider,
|
|
3204
|
+
ERequestContentType,
|
|
3205
|
+
ERequestMethod,
|
|
3206
|
+
FetcherException,
|
|
3207
|
+
FetcherProvider,
|
|
3208
|
+
createAxiosInstance,
|
|
3209
|
+
createGraphQLFetcher,
|
|
3210
|
+
createRestFulFetcher,
|
|
3211
|
+
getGraphQLResponseFormatError,
|
|
3212
|
+
getRestFulResponseFormatError,
|
|
3213
|
+
useAuthState
|
|
2387
3214
|
};
|
|
3215
|
+
//# sourceMappingURL=acrool-react-fetcher.es.js.map
|