yxuse 3.0.39 → 3.0.40
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/lib/api.cjs.js +1 -1
- package/lib/api.es.js +9 -9
- package/lib/components.cjs.js +1 -1
- package/lib/components.es.js +11 -11
- package/lib/directives.cjs.js +1 -1
- package/lib/directives.es.js +2 -2
- package/lib/hooks.cjs.js +1 -1
- package/lib/hooks.es.js +2 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs10.js +1 -1
- package/lib/index.cjs11.js +1 -3
- package/lib/index.cjs11.js.gz +0 -0
- package/lib/index.cjs12.js +1 -1
- package/lib/index.cjs13.js +1 -1
- package/lib/index.cjs2.js +1 -1
- package/lib/index.cjs3.js +1 -1
- package/lib/index.cjs4.js +1 -1
- package/lib/index.cjs5.js +8 -28
- package/lib/index.cjs5.js.gz +0 -0
- package/lib/index.cjs6.js +1 -1
- package/lib/index.cjs6.js.gz +0 -0
- package/lib/index.cjs7.js +1 -1
- package/lib/index.cjs9.js +1 -1
- package/lib/index.es.js +43 -39
- package/lib/index.es10.js +245 -241
- package/lib/index.es10.js.gz +0 -0
- package/lib/index.es11.js +1854 -1146
- package/lib/index.es11.js.gz +0 -0
- package/lib/index.es12.js +181 -103
- package/lib/index.es13.js +15 -12
- package/lib/index.es2.js +13 -13
- package/lib/index.es3.js +58 -40
- package/lib/index.es4.js +47 -37
- package/lib/index.es5.js +9697 -5929
- package/lib/index.es5.js.gz +0 -0
- package/lib/index.es6.js +821 -615
- package/lib/index.es6.js.gz +0 -0
- package/lib/index.es7.js +21 -17
- package/lib/index.es8.js +4 -4
- package/lib/index.es9.js +9 -7
- package/lib/theme.cjs.js +1 -1
- package/lib/theme.es.js +11 -11
- package/lib/translate.cjs.js +1 -1
- package/lib/translate.es.js +6 -6
- package/lib/utils.cjs.js +1 -1
- package/lib/utils.es.js +11 -11
- package/lib/yxIcon.cjs.js +1 -1
- package/lib/yxIcon.es.js +2 -2
- package/package.json +2 -1
package/lib/index.es11.js
CHANGED
|
@@ -1,258 +1,416 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var i = (l) => {
|
|
15
|
-
try {
|
|
16
|
-
c(n.next(l));
|
|
17
|
-
} catch (u) {
|
|
18
|
-
s(u);
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __publicField = (obj, key, value) => {
|
|
18
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
var __async = (__this, __arguments, generator) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
var fulfilled = (value) => {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var rejected = (value) => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.throw(value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
import { ElMessage, ElLoading, ElNotification } from "element-plus";
|
|
42
|
+
function bind(fn, thisArg) {
|
|
43
|
+
return function wrap() {
|
|
44
|
+
return fn.apply(thisArg, arguments);
|
|
33
45
|
};
|
|
34
46
|
}
|
|
35
|
-
const { toString
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
const { toString } = Object.prototype;
|
|
48
|
+
const { getPrototypeOf } = Object;
|
|
49
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
50
|
+
const str = toString.call(thing);
|
|
51
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
52
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
53
|
+
const kindOfTest = (type) => {
|
|
54
|
+
type = type.toLowerCase();
|
|
55
|
+
return (thing) => kindOf(thing) === type;
|
|
56
|
+
};
|
|
57
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
58
|
+
const { isArray } = Array;
|
|
59
|
+
const isUndefined = typeOfTest("undefined");
|
|
60
|
+
function isBuffer(val) {
|
|
61
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
41
62
|
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
|
|
63
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
64
|
+
function isArrayBufferView(val) {
|
|
65
|
+
let result;
|
|
66
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
67
|
+
result = ArrayBuffer.isView(val);
|
|
68
|
+
} else {
|
|
69
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
46
72
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
const isString = typeOfTest("string");
|
|
74
|
+
const isFunction = typeOfTest("function");
|
|
75
|
+
const isNumber = typeOfTest("number");
|
|
76
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
77
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
78
|
+
const isPlainObject = (val) => {
|
|
79
|
+
if (kindOf(val) !== "object") {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const prototype2 = getPrototypeOf(val);
|
|
83
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
84
|
+
};
|
|
85
|
+
const isDate = kindOfTest("Date");
|
|
86
|
+
const isFile = kindOfTest("File");
|
|
87
|
+
const isBlob = kindOfTest("Blob");
|
|
88
|
+
const isFileList = kindOfTest("FileList");
|
|
89
|
+
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
90
|
+
const isFormData = (thing) => {
|
|
91
|
+
const pattern = "[object FormData]";
|
|
92
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
|
|
93
|
+
};
|
|
94
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
95
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
96
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
97
|
+
if (obj === null || typeof obj === "undefined") {
|
|
58
98
|
return;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (
|
|
67
|
-
|
|
99
|
+
}
|
|
100
|
+
let i;
|
|
101
|
+
let l;
|
|
102
|
+
if (typeof obj !== "object") {
|
|
103
|
+
obj = [obj];
|
|
104
|
+
}
|
|
105
|
+
if (isArray(obj)) {
|
|
106
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
107
|
+
fn.call(null, obj[i], i, obj);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
111
|
+
const len = keys.length;
|
|
112
|
+
let key;
|
|
113
|
+
for (i = 0; i < len; i++) {
|
|
114
|
+
key = keys[i];
|
|
115
|
+
fn.call(null, obj[key], key, obj);
|
|
116
|
+
}
|
|
68
117
|
}
|
|
69
118
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
119
|
+
function findKey(obj, key) {
|
|
120
|
+
key = key.toLowerCase();
|
|
121
|
+
const keys = Object.keys(obj);
|
|
122
|
+
let i = keys.length;
|
|
123
|
+
let _key;
|
|
124
|
+
while (i-- > 0) {
|
|
125
|
+
_key = keys[i];
|
|
126
|
+
if (key === _key.toLowerCase()) {
|
|
127
|
+
return _key;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
77
130
|
return null;
|
|
78
131
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
132
|
+
const _global = (() => {
|
|
133
|
+
if (typeof globalThis !== "undefined")
|
|
134
|
+
return globalThis;
|
|
135
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
136
|
+
})();
|
|
137
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
138
|
+
function merge() {
|
|
139
|
+
const { caseless } = isContextDefined(this) && this || {};
|
|
140
|
+
const result = {};
|
|
141
|
+
const assignValue = (val, key) => {
|
|
142
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
143
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
144
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
145
|
+
} else if (isPlainObject(val)) {
|
|
146
|
+
result[targetKey] = merge({}, val);
|
|
147
|
+
} else if (isArray(val)) {
|
|
148
|
+
result[targetKey] = val.slice();
|
|
149
|
+
} else {
|
|
150
|
+
result[targetKey] = val;
|
|
151
|
+
}
|
|
84
152
|
};
|
|
85
|
-
for (let
|
|
86
|
-
arguments[
|
|
87
|
-
|
|
153
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
154
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
88
157
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
158
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
159
|
+
forEach(b, (val, key) => {
|
|
160
|
+
if (thisArg && isFunction(val)) {
|
|
161
|
+
a[key] = bind(val, thisArg);
|
|
162
|
+
} else {
|
|
163
|
+
a[key] = val;
|
|
164
|
+
}
|
|
165
|
+
}, { allOwnKeys });
|
|
166
|
+
return a;
|
|
167
|
+
};
|
|
168
|
+
const stripBOM = (content) => {
|
|
169
|
+
if (content.charCodeAt(0) === 65279) {
|
|
170
|
+
content = content.slice(1);
|
|
171
|
+
}
|
|
172
|
+
return content;
|
|
173
|
+
};
|
|
174
|
+
const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
175
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
176
|
+
constructor.prototype.constructor = constructor;
|
|
177
|
+
Object.defineProperty(constructor, "super", {
|
|
178
|
+
value: superConstructor.prototype
|
|
179
|
+
});
|
|
180
|
+
props && Object.assign(constructor.prototype, props);
|
|
181
|
+
};
|
|
182
|
+
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
183
|
+
let props;
|
|
184
|
+
let i;
|
|
185
|
+
let prop;
|
|
186
|
+
const merged = {};
|
|
187
|
+
destObj = destObj || {};
|
|
188
|
+
if (sourceObj == null)
|
|
189
|
+
return destObj;
|
|
100
190
|
do {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
191
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
192
|
+
i = props.length;
|
|
193
|
+
while (i-- > 0) {
|
|
194
|
+
prop = props[i];
|
|
195
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
196
|
+
destObj[prop] = sourceObj[prop];
|
|
197
|
+
merged[prop] = true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
201
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
202
|
+
return destObj;
|
|
203
|
+
};
|
|
204
|
+
const endsWith = (str, searchString, position) => {
|
|
205
|
+
str = String(str);
|
|
206
|
+
if (position === void 0 || position > str.length) {
|
|
207
|
+
position = str.length;
|
|
208
|
+
}
|
|
209
|
+
position -= searchString.length;
|
|
210
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
211
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
212
|
+
};
|
|
213
|
+
const toArray = (thing) => {
|
|
214
|
+
if (!thing)
|
|
112
215
|
return null;
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
let
|
|
116
|
-
if (!
|
|
216
|
+
if (isArray(thing))
|
|
217
|
+
return thing;
|
|
218
|
+
let i = thing.length;
|
|
219
|
+
if (!isNumber(i))
|
|
117
220
|
return null;
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
221
|
+
const arr = new Array(i);
|
|
222
|
+
while (i-- > 0) {
|
|
223
|
+
arr[i] = thing[i];
|
|
224
|
+
}
|
|
225
|
+
return arr;
|
|
226
|
+
};
|
|
227
|
+
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
228
|
+
return (thing) => {
|
|
229
|
+
return TypedArray && thing instanceof TypedArray;
|
|
230
|
+
};
|
|
231
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
232
|
+
const forEachEntry = (obj, fn) => {
|
|
233
|
+
const generator = obj && obj[Symbol.iterator];
|
|
234
|
+
const iterator = generator.call(obj);
|
|
235
|
+
let result;
|
|
236
|
+
while ((result = iterator.next()) && !result.done) {
|
|
237
|
+
const pair = result.value;
|
|
238
|
+
fn.call(obj, pair[0], pair[1]);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const matchAll = (regExp, str) => {
|
|
242
|
+
let matches;
|
|
243
|
+
const arr = [];
|
|
244
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
245
|
+
arr.push(matches);
|
|
246
|
+
}
|
|
247
|
+
return arr;
|
|
248
|
+
};
|
|
249
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
250
|
+
const toCamelCase = (str) => {
|
|
251
|
+
return str.toLowerCase().replace(
|
|
252
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
253
|
+
function replacer(m, p1, p2) {
|
|
254
|
+
return p1.toUpperCase() + p2;
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
259
|
+
const isRegExp = kindOfTest("RegExp");
|
|
260
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
261
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
262
|
+
const reducedDescriptors = {};
|
|
263
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
264
|
+
if (reducer(descriptor, name, obj) !== false) {
|
|
265
|
+
reducedDescriptors[name] = descriptor;
|
|
158
266
|
}
|
|
159
267
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
268
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
269
|
+
};
|
|
270
|
+
const freezeMethods = (obj) => {
|
|
271
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
272
|
+
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
const value = obj[name];
|
|
276
|
+
if (!isFunction(value))
|
|
277
|
+
return;
|
|
278
|
+
descriptor.enumerable = false;
|
|
279
|
+
if ("writable" in descriptor) {
|
|
280
|
+
descriptor.writable = false;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (!descriptor.set) {
|
|
284
|
+
descriptor.set = () => {
|
|
285
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
291
|
+
const obj = {};
|
|
292
|
+
const define = (arr) => {
|
|
293
|
+
arr.forEach((value) => {
|
|
294
|
+
obj[value] = true;
|
|
164
295
|
});
|
|
165
296
|
};
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const { length: r } = t;
|
|
175
|
-
for (; e--; )
|
|
176
|
-
n += t[Math.random() * r | 0];
|
|
177
|
-
return n;
|
|
297
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
298
|
+
return obj;
|
|
299
|
+
};
|
|
300
|
+
const noop = () => {
|
|
301
|
+
};
|
|
302
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
303
|
+
value = +value;
|
|
304
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
178
305
|
};
|
|
179
|
-
|
|
180
|
-
|
|
306
|
+
const ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
|
307
|
+
const DIGIT = "0123456789";
|
|
308
|
+
const ALPHABET = {
|
|
309
|
+
DIGIT,
|
|
310
|
+
ALPHA,
|
|
311
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
312
|
+
};
|
|
313
|
+
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
314
|
+
let str = "";
|
|
315
|
+
const { length } = alphabet;
|
|
316
|
+
while (size--) {
|
|
317
|
+
str += alphabet[Math.random() * length | 0];
|
|
318
|
+
}
|
|
319
|
+
return str;
|
|
320
|
+
};
|
|
321
|
+
function isSpecCompliantForm(thing) {
|
|
322
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
|
|
181
323
|
}
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
324
|
+
const toJSONObject = (obj) => {
|
|
325
|
+
const stack = new Array(10);
|
|
326
|
+
const visit = (source, i) => {
|
|
327
|
+
if (isObject(source)) {
|
|
328
|
+
if (stack.indexOf(source) >= 0) {
|
|
186
329
|
return;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
330
|
+
}
|
|
331
|
+
if (!("toJSON" in source)) {
|
|
332
|
+
stack[i] = source;
|
|
333
|
+
const target = isArray(source) ? [] : {};
|
|
334
|
+
forEach(source, (value, key) => {
|
|
335
|
+
const reducedValue = visit(value, i + 1);
|
|
336
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
337
|
+
});
|
|
338
|
+
stack[i] = void 0;
|
|
339
|
+
return target;
|
|
194
340
|
}
|
|
195
341
|
}
|
|
196
|
-
return
|
|
342
|
+
return source;
|
|
197
343
|
};
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
344
|
+
return visit(obj, 0);
|
|
345
|
+
};
|
|
346
|
+
const utils = {
|
|
347
|
+
isArray,
|
|
348
|
+
isArrayBuffer,
|
|
349
|
+
isBuffer,
|
|
350
|
+
isFormData,
|
|
351
|
+
isArrayBufferView,
|
|
352
|
+
isString,
|
|
353
|
+
isNumber,
|
|
354
|
+
isBoolean,
|
|
355
|
+
isObject,
|
|
356
|
+
isPlainObject,
|
|
357
|
+
isUndefined,
|
|
358
|
+
isDate,
|
|
359
|
+
isFile,
|
|
360
|
+
isBlob,
|
|
361
|
+
isRegExp,
|
|
362
|
+
isFunction,
|
|
363
|
+
isStream,
|
|
364
|
+
isURLSearchParams,
|
|
365
|
+
isTypedArray,
|
|
366
|
+
isFileList,
|
|
367
|
+
forEach,
|
|
368
|
+
merge,
|
|
369
|
+
extend,
|
|
370
|
+
trim,
|
|
371
|
+
stripBOM,
|
|
372
|
+
inherits,
|
|
373
|
+
toFlatObject,
|
|
374
|
+
kindOf,
|
|
375
|
+
kindOfTest,
|
|
376
|
+
endsWith,
|
|
377
|
+
toArray,
|
|
378
|
+
forEachEntry,
|
|
379
|
+
matchAll,
|
|
380
|
+
isHTMLForm,
|
|
381
|
+
hasOwnProperty,
|
|
382
|
+
hasOwnProp: hasOwnProperty,
|
|
236
383
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
237
|
-
reduceDescriptors
|
|
238
|
-
freezeMethods
|
|
239
|
-
toObjectSet
|
|
240
|
-
toCamelCase
|
|
241
|
-
noop
|
|
242
|
-
toFiniteNumber
|
|
243
|
-
findKey
|
|
244
|
-
global:
|
|
245
|
-
isContextDefined
|
|
246
|
-
ALPHABET
|
|
247
|
-
generateString
|
|
248
|
-
isSpecCompliantForm
|
|
249
|
-
toJSONObject
|
|
384
|
+
reduceDescriptors,
|
|
385
|
+
freezeMethods,
|
|
386
|
+
toObjectSet,
|
|
387
|
+
toCamelCase,
|
|
388
|
+
noop,
|
|
389
|
+
toFiniteNumber,
|
|
390
|
+
findKey,
|
|
391
|
+
global: _global,
|
|
392
|
+
isContextDefined,
|
|
393
|
+
ALPHABET,
|
|
394
|
+
generateString,
|
|
395
|
+
isSpecCompliantForm,
|
|
396
|
+
toJSONObject
|
|
250
397
|
};
|
|
251
|
-
function
|
|
252
|
-
Error.call(this)
|
|
398
|
+
function AxiosError(message, code, config2, request, response) {
|
|
399
|
+
Error.call(this);
|
|
400
|
+
if (Error.captureStackTrace) {
|
|
401
|
+
Error.captureStackTrace(this, this.constructor);
|
|
402
|
+
} else {
|
|
403
|
+
this.stack = new Error().stack;
|
|
404
|
+
}
|
|
405
|
+
this.message = message;
|
|
406
|
+
this.name = "AxiosError";
|
|
407
|
+
code && (this.code = code);
|
|
408
|
+
config2 && (this.config = config2);
|
|
409
|
+
request && (this.request = request);
|
|
410
|
+
response && (this.response = response);
|
|
253
411
|
}
|
|
254
|
-
|
|
255
|
-
toJSON: function() {
|
|
412
|
+
utils.inherits(AxiosError, Error, {
|
|
413
|
+
toJSON: function toJSON() {
|
|
256
414
|
return {
|
|
257
415
|
// Standard
|
|
258
416
|
message: this.message,
|
|
@@ -266,13 +424,14 @@ a.inherits(m, Error, {
|
|
|
266
424
|
columnNumber: this.columnNumber,
|
|
267
425
|
stack: this.stack,
|
|
268
426
|
// Axios
|
|
269
|
-
config:
|
|
427
|
+
config: utils.toJSONObject(this.config),
|
|
270
428
|
code: this.code,
|
|
271
429
|
status: this.response && this.response.status ? this.response.status : null
|
|
272
430
|
};
|
|
273
431
|
}
|
|
274
432
|
});
|
|
275
|
-
const
|
|
433
|
+
const prototype$1 = AxiosError.prototype;
|
|
434
|
+
const descriptors = {};
|
|
276
435
|
[
|
|
277
436
|
"ERR_BAD_OPTION_VALUE",
|
|
278
437
|
"ERR_BAD_OPTION",
|
|
@@ -287,99 +446,139 @@ const He = m.prototype, qe = {};
|
|
|
287
446
|
"ERR_NOT_SUPPORT",
|
|
288
447
|
"ERR_INVALID_URL"
|
|
289
448
|
// eslint-disable-next-line func-names
|
|
290
|
-
].forEach((
|
|
291
|
-
|
|
449
|
+
].forEach((code) => {
|
|
450
|
+
descriptors[code] = { value: code };
|
|
292
451
|
});
|
|
293
|
-
Object.defineProperties(
|
|
294
|
-
Object.defineProperty(
|
|
295
|
-
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
return
|
|
299
|
-
}, (
|
|
452
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
453
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
454
|
+
AxiosError.from = (error, code, config2, request, response, customProps) => {
|
|
455
|
+
const axiosError = Object.create(prototype$1);
|
|
456
|
+
utils.toFlatObject(error, axiosError, function filter2(obj) {
|
|
457
|
+
return obj !== Error.prototype;
|
|
458
|
+
}, (prop) => {
|
|
459
|
+
return prop !== "isAxiosError";
|
|
460
|
+
});
|
|
461
|
+
AxiosError.call(axiosError, error.message, code, config2, request, response);
|
|
462
|
+
axiosError.cause = error;
|
|
463
|
+
axiosError.name = error.name;
|
|
464
|
+
customProps && Object.assign(axiosError, customProps);
|
|
465
|
+
return axiosError;
|
|
300
466
|
};
|
|
301
|
-
const
|
|
302
|
-
function
|
|
303
|
-
return
|
|
467
|
+
const httpAdapter = null;
|
|
468
|
+
function isVisitable(thing) {
|
|
469
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
304
470
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
471
|
+
function removeBrackets(key) {
|
|
472
|
+
return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
307
473
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
310
|
-
return
|
|
311
|
-
|
|
474
|
+
function renderKey(path, key, dots) {
|
|
475
|
+
if (!path)
|
|
476
|
+
return key;
|
|
477
|
+
return path.concat(key).map(function each(token, i) {
|
|
478
|
+
token = removeBrackets(token);
|
|
479
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
480
|
+
}).join(dots ? "." : "");
|
|
312
481
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
482
|
+
function isFlatArray(arr) {
|
|
483
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
315
484
|
}
|
|
316
|
-
const
|
|
317
|
-
return /^is[A-Z]/.test(
|
|
485
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
486
|
+
return /^is[A-Z]/.test(prop);
|
|
318
487
|
});
|
|
319
|
-
function
|
|
320
|
-
if (!
|
|
488
|
+
function toFormData(obj, formData, options) {
|
|
489
|
+
if (!utils.isObject(obj)) {
|
|
321
490
|
throw new TypeError("target must be an object");
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
491
|
+
}
|
|
492
|
+
formData = formData || new FormData();
|
|
493
|
+
options = utils.toFlatObject(options, {
|
|
494
|
+
metaTokens: true,
|
|
495
|
+
dots: false,
|
|
496
|
+
indexes: false
|
|
497
|
+
}, false, function defined(option, source) {
|
|
498
|
+
return !utils.isUndefined(source[option]);
|
|
328
499
|
});
|
|
329
|
-
const
|
|
330
|
-
|
|
500
|
+
const metaTokens = options.metaTokens;
|
|
501
|
+
const visitor = options.visitor || defaultVisitor;
|
|
502
|
+
const dots = options.dots;
|
|
503
|
+
const indexes = options.indexes;
|
|
504
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
505
|
+
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
506
|
+
if (!utils.isFunction(visitor)) {
|
|
331
507
|
throw new TypeError("visitor must be a function");
|
|
332
|
-
|
|
333
|
-
|
|
508
|
+
}
|
|
509
|
+
function convertValue(value) {
|
|
510
|
+
if (value === null)
|
|
334
511
|
return "";
|
|
335
|
-
if (
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
512
|
+
if (utils.isDate(value)) {
|
|
513
|
+
return value.toISOString();
|
|
514
|
+
}
|
|
515
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
516
|
+
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
517
|
+
}
|
|
518
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
519
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
520
|
+
}
|
|
521
|
+
return value;
|
|
522
|
+
}
|
|
523
|
+
function defaultVisitor(value, key, path) {
|
|
524
|
+
let arr = value;
|
|
525
|
+
if (value && !path && typeof value === "object") {
|
|
526
|
+
if (utils.endsWith(key, "{}")) {
|
|
527
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
528
|
+
value = JSON.stringify(value);
|
|
529
|
+
} else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value))) {
|
|
530
|
+
key = removeBrackets(key);
|
|
531
|
+
arr.forEach(function each(el, index2) {
|
|
532
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
349
533
|
// eslint-disable-next-line no-nested-ternary
|
|
350
|
-
|
|
351
|
-
|
|
534
|
+
indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
|
|
535
|
+
convertValue(el)
|
|
352
536
|
);
|
|
353
|
-
})
|
|
537
|
+
});
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (isVisitable(value)) {
|
|
542
|
+
return true;
|
|
354
543
|
}
|
|
355
|
-
|
|
544
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
545
|
+
return false;
|
|
356
546
|
}
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
547
|
+
const stack = [];
|
|
548
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
549
|
+
defaultVisitor,
|
|
550
|
+
convertValue,
|
|
551
|
+
isVisitable
|
|
361
552
|
});
|
|
362
|
-
function
|
|
363
|
-
if (
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
)
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
553
|
+
function build(value, path) {
|
|
554
|
+
if (utils.isUndefined(value))
|
|
555
|
+
return;
|
|
556
|
+
if (stack.indexOf(value) !== -1) {
|
|
557
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
558
|
+
}
|
|
559
|
+
stack.push(value);
|
|
560
|
+
utils.forEach(value, function each(el, key) {
|
|
561
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
562
|
+
formData,
|
|
563
|
+
el,
|
|
564
|
+
utils.isString(key) ? key.trim() : key,
|
|
565
|
+
path,
|
|
566
|
+
exposedHelpers
|
|
567
|
+
);
|
|
568
|
+
if (result === true) {
|
|
569
|
+
build(el, path ? path.concat(key) : [key]);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
stack.pop();
|
|
573
|
+
}
|
|
574
|
+
if (!utils.isObject(obj)) {
|
|
378
575
|
throw new TypeError("data must be an object");
|
|
379
|
-
|
|
576
|
+
}
|
|
577
|
+
build(obj);
|
|
578
|
+
return formData;
|
|
380
579
|
}
|
|
381
|
-
function
|
|
382
|
-
const
|
|
580
|
+
function encode$1(str) {
|
|
581
|
+
const charMap = {
|
|
383
582
|
"!": "%21",
|
|
384
583
|
"'": "%27",
|
|
385
584
|
"(": "%28",
|
|
@@ -388,40 +587,51 @@ function ge(e) {
|
|
|
388
587
|
"%20": "+",
|
|
389
588
|
"%00": "\0"
|
|
390
589
|
};
|
|
391
|
-
return encodeURIComponent(
|
|
392
|
-
return
|
|
590
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
591
|
+
return charMap[match];
|
|
393
592
|
});
|
|
394
593
|
}
|
|
395
|
-
function
|
|
396
|
-
this._pairs = []
|
|
594
|
+
function AxiosURLSearchParams(params, options) {
|
|
595
|
+
this._pairs = [];
|
|
596
|
+
params && toFormData(params, this, options);
|
|
397
597
|
}
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
this._pairs.push([
|
|
598
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
599
|
+
prototype.append = function append(name, value) {
|
|
600
|
+
this._pairs.push([name, value]);
|
|
401
601
|
};
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
return
|
|
405
|
-
} :
|
|
406
|
-
return this._pairs.map(function(
|
|
407
|
-
return
|
|
602
|
+
prototype.toString = function toString2(encoder) {
|
|
603
|
+
const _encode = encoder ? function(value) {
|
|
604
|
+
return encoder.call(this, value, encode$1);
|
|
605
|
+
} : encode$1;
|
|
606
|
+
return this._pairs.map(function each(pair) {
|
|
607
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
408
608
|
}, "").join("&");
|
|
409
609
|
};
|
|
410
|
-
function
|
|
411
|
-
return encodeURIComponent(
|
|
610
|
+
function encode(val) {
|
|
611
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
412
612
|
}
|
|
413
|
-
function
|
|
414
|
-
if (!
|
|
415
|
-
return
|
|
416
|
-
const r = n && n.encode || qt, s = n && n.serialize;
|
|
417
|
-
let i;
|
|
418
|
-
if (s ? i = s(t, n) : i = a.isURLSearchParams(t) ? t.toString() : new fe(t, n).toString(r), i) {
|
|
419
|
-
const o = e.indexOf("#");
|
|
420
|
-
o !== -1 && (e = e.slice(0, o)), e += (e.indexOf("?") === -1 ? "?" : "&") + i;
|
|
613
|
+
function buildURL(url, params, options) {
|
|
614
|
+
if (!params) {
|
|
615
|
+
return url;
|
|
421
616
|
}
|
|
422
|
-
|
|
617
|
+
const _encode = options && options.encode || encode;
|
|
618
|
+
const serializeFn = options && options.serialize;
|
|
619
|
+
let serializedParams;
|
|
620
|
+
if (serializeFn) {
|
|
621
|
+
serializedParams = serializeFn(params, options);
|
|
622
|
+
} else {
|
|
623
|
+
serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
624
|
+
}
|
|
625
|
+
if (serializedParams) {
|
|
626
|
+
const hashmarkIndex = url.indexOf("#");
|
|
627
|
+
if (hashmarkIndex !== -1) {
|
|
628
|
+
url = url.slice(0, hashmarkIndex);
|
|
629
|
+
}
|
|
630
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
631
|
+
}
|
|
632
|
+
return url;
|
|
423
633
|
}
|
|
424
|
-
class
|
|
634
|
+
class InterceptorManager {
|
|
425
635
|
constructor() {
|
|
426
636
|
this.handlers = [];
|
|
427
637
|
}
|
|
@@ -433,13 +643,14 @@ class Ae {
|
|
|
433
643
|
*
|
|
434
644
|
* @return {Number} An ID used to remove interceptor later
|
|
435
645
|
*/
|
|
436
|
-
use(
|
|
437
|
-
|
|
438
|
-
fulfilled
|
|
439
|
-
rejected
|
|
440
|
-
synchronous:
|
|
441
|
-
runWhen:
|
|
442
|
-
})
|
|
646
|
+
use(fulfilled, rejected, options) {
|
|
647
|
+
this.handlers.push({
|
|
648
|
+
fulfilled,
|
|
649
|
+
rejected,
|
|
650
|
+
synchronous: options ? options.synchronous : false,
|
|
651
|
+
runWhen: options ? options.runWhen : null
|
|
652
|
+
});
|
|
653
|
+
return this.handlers.length - 1;
|
|
443
654
|
}
|
|
444
655
|
/**
|
|
445
656
|
* Remove an interceptor from the stack
|
|
@@ -448,8 +659,10 @@ class Ae {
|
|
|
448
659
|
*
|
|
449
660
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
450
661
|
*/
|
|
451
|
-
eject(
|
|
452
|
-
|
|
662
|
+
eject(id) {
|
|
663
|
+
if (this.handlers[id]) {
|
|
664
|
+
this.handlers[id] = null;
|
|
665
|
+
}
|
|
453
666
|
}
|
|
454
667
|
/**
|
|
455
668
|
* Clear all interceptors from the stack
|
|
@@ -457,7 +670,9 @@ class Ae {
|
|
|
457
670
|
* @returns {void}
|
|
458
671
|
*/
|
|
459
672
|
clear() {
|
|
460
|
-
|
|
673
|
+
if (this.handlers) {
|
|
674
|
+
this.handlers = [];
|
|
675
|
+
}
|
|
461
676
|
}
|
|
462
677
|
/**
|
|
463
678
|
* Iterate over all the registered interceptors
|
|
@@ -469,117 +684,185 @@ class Ae {
|
|
|
469
684
|
*
|
|
470
685
|
* @returns {void}
|
|
471
686
|
*/
|
|
472
|
-
forEach(
|
|
473
|
-
|
|
474
|
-
|
|
687
|
+
forEach(fn) {
|
|
688
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
689
|
+
if (h !== null) {
|
|
690
|
+
fn(h);
|
|
691
|
+
}
|
|
475
692
|
});
|
|
476
693
|
}
|
|
477
694
|
}
|
|
478
|
-
const
|
|
479
|
-
silentJSONParsing:
|
|
480
|
-
forcedJSONParsing:
|
|
481
|
-
clarifyTimeoutError:
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
695
|
+
const transitionalDefaults = {
|
|
696
|
+
silentJSONParsing: true,
|
|
697
|
+
forcedJSONParsing: true,
|
|
698
|
+
clarifyTimeoutError: false
|
|
699
|
+
};
|
|
700
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
701
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
702
|
+
const isStandardBrowserEnv = (() => {
|
|
703
|
+
let product;
|
|
704
|
+
if (typeof navigator !== "undefined" && ((product = navigator.product) === "ReactNative" || product === "NativeScript" || product === "NS")) {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
708
|
+
})();
|
|
709
|
+
const isStandardBrowserWebWorkerEnv = (() => {
|
|
710
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
711
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
712
|
+
})();
|
|
713
|
+
const platform = {
|
|
714
|
+
isBrowser: true,
|
|
488
715
|
classes: {
|
|
489
|
-
URLSearchParams:
|
|
490
|
-
FormData:
|
|
716
|
+
URLSearchParams: URLSearchParams$1,
|
|
717
|
+
FormData: FormData$1,
|
|
491
718
|
Blob
|
|
492
719
|
},
|
|
493
|
-
isStandardBrowserEnv
|
|
494
|
-
isStandardBrowserWebWorkerEnv
|
|
720
|
+
isStandardBrowserEnv,
|
|
721
|
+
isStandardBrowserWebWorkerEnv,
|
|
495
722
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
496
723
|
};
|
|
497
|
-
function
|
|
498
|
-
return
|
|
499
|
-
visitor: function(
|
|
500
|
-
|
|
724
|
+
function toURLEncodedForm(data, options) {
|
|
725
|
+
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
726
|
+
visitor: function(value, key, path, helpers) {
|
|
727
|
+
if (platform.isNode && utils.isBuffer(value)) {
|
|
728
|
+
this.append(key, value.toString("base64"));
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
501
732
|
}
|
|
502
|
-
},
|
|
733
|
+
}, options));
|
|
503
734
|
}
|
|
504
|
-
function
|
|
505
|
-
return
|
|
735
|
+
function parsePropPath(name) {
|
|
736
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
737
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
738
|
+
});
|
|
506
739
|
}
|
|
507
|
-
function
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
const s = n.length;
|
|
740
|
+
function arrayToObject(arr) {
|
|
741
|
+
const obj = {};
|
|
742
|
+
const keys = Object.keys(arr);
|
|
511
743
|
let i;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
744
|
+
const len = keys.length;
|
|
745
|
+
let key;
|
|
746
|
+
for (i = 0; i < len; i++) {
|
|
747
|
+
key = keys[i];
|
|
748
|
+
obj[key] = arr[key];
|
|
749
|
+
}
|
|
750
|
+
return obj;
|
|
515
751
|
}
|
|
516
|
-
function
|
|
517
|
-
function
|
|
518
|
-
let
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
752
|
+
function formDataToJSON(formData) {
|
|
753
|
+
function buildPath(path, value, target, index2) {
|
|
754
|
+
let name = path[index2++];
|
|
755
|
+
const isNumericKey = Number.isFinite(+name);
|
|
756
|
+
const isLast = index2 >= path.length;
|
|
757
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
758
|
+
if (isLast) {
|
|
759
|
+
if (utils.hasOwnProp(target, name)) {
|
|
760
|
+
target[name] = [target[name], value];
|
|
761
|
+
} else {
|
|
762
|
+
target[name] = value;
|
|
763
|
+
}
|
|
764
|
+
return !isNumericKey;
|
|
765
|
+
}
|
|
766
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
767
|
+
target[name] = [];
|
|
768
|
+
}
|
|
769
|
+
const result = buildPath(path, value, target[name], index2);
|
|
770
|
+
if (result && utils.isArray(target[name])) {
|
|
771
|
+
target[name] = arrayToObject(target[name]);
|
|
772
|
+
}
|
|
773
|
+
return !isNumericKey;
|
|
774
|
+
}
|
|
775
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
776
|
+
const obj = {};
|
|
777
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
778
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
779
|
+
});
|
|
780
|
+
return obj;
|
|
527
781
|
}
|
|
528
782
|
return null;
|
|
529
783
|
}
|
|
530
|
-
const
|
|
784
|
+
const DEFAULT_CONTENT_TYPE = {
|
|
531
785
|
"Content-Type": void 0
|
|
532
786
|
};
|
|
533
|
-
function
|
|
534
|
-
if (
|
|
787
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
788
|
+
if (utils.isString(rawValue)) {
|
|
535
789
|
try {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
790
|
+
(parser || JSON.parse)(rawValue);
|
|
791
|
+
return utils.trim(rawValue);
|
|
792
|
+
} catch (e) {
|
|
793
|
+
if (e.name !== "SyntaxError") {
|
|
794
|
+
throw e;
|
|
795
|
+
}
|
|
540
796
|
}
|
|
541
|
-
|
|
797
|
+
}
|
|
798
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
542
799
|
}
|
|
543
|
-
const
|
|
544
|
-
transitional:
|
|
800
|
+
const defaults = {
|
|
801
|
+
transitional: transitionalDefaults,
|
|
545
802
|
adapter: ["xhr", "http"],
|
|
546
|
-
transformRequest: [function(
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
803
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
804
|
+
const contentType = headers.getContentType() || "";
|
|
805
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
806
|
+
const isObjectPayload = utils.isObject(data);
|
|
807
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
808
|
+
data = new FormData(data);
|
|
809
|
+
}
|
|
810
|
+
const isFormData2 = utils.isFormData(data);
|
|
811
|
+
if (isFormData2) {
|
|
812
|
+
if (!hasJSONContentType) {
|
|
813
|
+
return data;
|
|
814
|
+
}
|
|
815
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
816
|
+
}
|
|
817
|
+
if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
|
|
818
|
+
return data;
|
|
819
|
+
}
|
|
820
|
+
if (utils.isArrayBufferView(data)) {
|
|
821
|
+
return data.buffer;
|
|
822
|
+
}
|
|
823
|
+
if (utils.isURLSearchParams(data)) {
|
|
824
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
825
|
+
return data.toString();
|
|
826
|
+
}
|
|
827
|
+
let isFileList2;
|
|
828
|
+
if (isObjectPayload) {
|
|
829
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
830
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
831
|
+
}
|
|
832
|
+
if ((isFileList2 = utils.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
833
|
+
const _FormData = this.env && this.env.FormData;
|
|
834
|
+
return toFormData(
|
|
835
|
+
isFileList2 ? { "files[]": data } : data,
|
|
836
|
+
_FormData && new _FormData(),
|
|
565
837
|
this.formSerializer
|
|
566
838
|
);
|
|
567
839
|
}
|
|
568
840
|
}
|
|
569
|
-
|
|
841
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
842
|
+
headers.setContentType("application/json", false);
|
|
843
|
+
return stringifySafely(data);
|
|
844
|
+
}
|
|
845
|
+
return data;
|
|
570
846
|
}],
|
|
571
|
-
transformResponse: [function(
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
847
|
+
transformResponse: [function transformResponse(data) {
|
|
848
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
849
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
850
|
+
const JSONRequested = this.responseType === "json";
|
|
851
|
+
if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
852
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
853
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
575
854
|
try {
|
|
576
|
-
return JSON.parse(
|
|
577
|
-
} catch (
|
|
578
|
-
if (
|
|
579
|
-
|
|
855
|
+
return JSON.parse(data);
|
|
856
|
+
} catch (e) {
|
|
857
|
+
if (strictJSONParsing) {
|
|
858
|
+
if (e.name === "SyntaxError") {
|
|
859
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
860
|
+
}
|
|
861
|
+
throw e;
|
|
862
|
+
}
|
|
580
863
|
}
|
|
581
864
|
}
|
|
582
|
-
return
|
|
865
|
+
return data;
|
|
583
866
|
}],
|
|
584
867
|
/**
|
|
585
868
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -591,25 +874,26 @@ const v = {
|
|
|
591
874
|
maxContentLength: -1,
|
|
592
875
|
maxBodyLength: -1,
|
|
593
876
|
env: {
|
|
594
|
-
FormData:
|
|
595
|
-
Blob:
|
|
877
|
+
FormData: platform.classes.FormData,
|
|
878
|
+
Blob: platform.classes.Blob
|
|
596
879
|
},
|
|
597
|
-
validateStatus: function(
|
|
598
|
-
return
|
|
880
|
+
validateStatus: function validateStatus(status) {
|
|
881
|
+
return status >= 200 && status < 300;
|
|
599
882
|
},
|
|
600
883
|
headers: {
|
|
601
884
|
common: {
|
|
602
|
-
Accept: "application/json, text/plain, */*"
|
|
885
|
+
"Accept": "application/json, text/plain, */*"
|
|
603
886
|
}
|
|
604
887
|
}
|
|
605
888
|
};
|
|
606
|
-
|
|
607
|
-
|
|
889
|
+
utils.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
|
|
890
|
+
defaults.headers[method] = {};
|
|
608
891
|
});
|
|
609
|
-
|
|
610
|
-
|
|
892
|
+
utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
893
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
611
894
|
});
|
|
612
|
-
const
|
|
895
|
+
const defaults$1 = defaults;
|
|
896
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
613
897
|
"age",
|
|
614
898
|
"authorization",
|
|
615
899
|
"content-length",
|
|
@@ -627,541 +911,794 @@ const de = v, Qt = a.toObjectSet([
|
|
|
627
911
|
"referer",
|
|
628
912
|
"retry-after",
|
|
629
913
|
"user-agent"
|
|
630
|
-
])
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
914
|
+
]);
|
|
915
|
+
const parseHeaders = (rawHeaders) => {
|
|
916
|
+
const parsed = {};
|
|
917
|
+
let key;
|
|
918
|
+
let val;
|
|
919
|
+
let i;
|
|
920
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
921
|
+
i = line.indexOf(":");
|
|
922
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
923
|
+
val = line.substring(i + 1).trim();
|
|
924
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
if (key === "set-cookie") {
|
|
928
|
+
if (parsed[key]) {
|
|
929
|
+
parsed[key].push(val);
|
|
930
|
+
} else {
|
|
931
|
+
parsed[key] = [val];
|
|
932
|
+
}
|
|
933
|
+
} else {
|
|
934
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
return parsed;
|
|
938
|
+
};
|
|
939
|
+
const $internals = Symbol("internals");
|
|
940
|
+
function normalizeHeader(header) {
|
|
941
|
+
return header && String(header).trim().toLowerCase();
|
|
640
942
|
}
|
|
641
|
-
function
|
|
642
|
-
|
|
943
|
+
function normalizeValue(value) {
|
|
944
|
+
if (value === false || value == null) {
|
|
945
|
+
return value;
|
|
946
|
+
}
|
|
947
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
643
948
|
}
|
|
644
|
-
function
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
949
|
+
function parseTokens(str) {
|
|
950
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
951
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
952
|
+
let match;
|
|
953
|
+
while (match = tokensRE.exec(str)) {
|
|
954
|
+
tokens[match[1]] = match[2];
|
|
955
|
+
}
|
|
956
|
+
return tokens;
|
|
650
957
|
}
|
|
651
|
-
function
|
|
652
|
-
return /^[-_a-zA-Z]+$/.test(
|
|
958
|
+
function isValidHeaderName(str) {
|
|
959
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
653
960
|
}
|
|
654
|
-
function
|
|
655
|
-
if (
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
961
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
962
|
+
if (utils.isFunction(filter2)) {
|
|
963
|
+
return filter2.call(this, value, header);
|
|
964
|
+
}
|
|
965
|
+
if (isHeaderNameFilter) {
|
|
966
|
+
value = header;
|
|
967
|
+
}
|
|
968
|
+
if (!utils.isString(value))
|
|
969
|
+
return;
|
|
970
|
+
if (utils.isString(filter2)) {
|
|
971
|
+
return value.indexOf(filter2) !== -1;
|
|
972
|
+
}
|
|
973
|
+
if (utils.isRegExp(filter2)) {
|
|
974
|
+
return filter2.test(value);
|
|
662
975
|
}
|
|
663
976
|
}
|
|
664
|
-
function
|
|
665
|
-
return
|
|
977
|
+
function formatHeader(header) {
|
|
978
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
979
|
+
return char.toUpperCase() + str;
|
|
980
|
+
});
|
|
666
981
|
}
|
|
667
|
-
function
|
|
668
|
-
const
|
|
669
|
-
["get", "set", "has"].forEach((
|
|
670
|
-
Object.defineProperty(
|
|
671
|
-
value: function(
|
|
672
|
-
return this[
|
|
982
|
+
function buildAccessors(obj, header) {
|
|
983
|
+
const accessorName = utils.toCamelCase(" " + header);
|
|
984
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
985
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
986
|
+
value: function(arg1, arg2, arg3) {
|
|
987
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
673
988
|
},
|
|
674
|
-
configurable:
|
|
989
|
+
configurable: true
|
|
675
990
|
});
|
|
676
991
|
});
|
|
677
992
|
}
|
|
678
|
-
class
|
|
679
|
-
constructor(
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
set(
|
|
683
|
-
const
|
|
684
|
-
function
|
|
685
|
-
const
|
|
686
|
-
if (!
|
|
993
|
+
class AxiosHeaders {
|
|
994
|
+
constructor(headers) {
|
|
995
|
+
headers && this.set(headers);
|
|
996
|
+
}
|
|
997
|
+
set(header, valueOrRewrite, rewrite) {
|
|
998
|
+
const self2 = this;
|
|
999
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1000
|
+
const lHeader = normalizeHeader(_header);
|
|
1001
|
+
if (!lHeader) {
|
|
687
1002
|
throw new Error("header name must be a non-empty string");
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
if (
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1003
|
+
}
|
|
1004
|
+
const key = utils.findKey(self2, lHeader);
|
|
1005
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
1006
|
+
self2[key || _header] = normalizeValue(_value);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1010
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
1011
|
+
setHeaders(header, valueOrRewrite);
|
|
1012
|
+
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1013
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1014
|
+
} else {
|
|
1015
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1016
|
+
}
|
|
1017
|
+
return this;
|
|
1018
|
+
}
|
|
1019
|
+
get(header, parser) {
|
|
1020
|
+
header = normalizeHeader(header);
|
|
1021
|
+
if (header) {
|
|
1022
|
+
const key = utils.findKey(this, header);
|
|
1023
|
+
if (key) {
|
|
1024
|
+
const value = this[key];
|
|
1025
|
+
if (!parser) {
|
|
1026
|
+
return value;
|
|
1027
|
+
}
|
|
1028
|
+
if (parser === true) {
|
|
1029
|
+
return parseTokens(value);
|
|
1030
|
+
}
|
|
1031
|
+
if (utils.isFunction(parser)) {
|
|
1032
|
+
return parser.call(this, value, key);
|
|
1033
|
+
}
|
|
1034
|
+
if (utils.isRegExp(parser)) {
|
|
1035
|
+
return parser.exec(value);
|
|
1036
|
+
}
|
|
707
1037
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
708
1038
|
}
|
|
709
1039
|
}
|
|
710
1040
|
}
|
|
711
|
-
has(
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
1041
|
+
has(header, matcher) {
|
|
1042
|
+
header = normalizeHeader(header);
|
|
1043
|
+
if (header) {
|
|
1044
|
+
const key = utils.findKey(this, header);
|
|
1045
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
715
1046
|
}
|
|
716
|
-
return
|
|
1047
|
+
return false;
|
|
717
1048
|
}
|
|
718
|
-
delete(
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
1049
|
+
delete(header, matcher) {
|
|
1050
|
+
const self2 = this;
|
|
1051
|
+
let deleted = false;
|
|
1052
|
+
function deleteHeader(_header) {
|
|
1053
|
+
_header = normalizeHeader(_header);
|
|
1054
|
+
if (_header) {
|
|
1055
|
+
const key = utils.findKey(self2, _header);
|
|
1056
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
1057
|
+
delete self2[key];
|
|
1058
|
+
deleted = true;
|
|
1059
|
+
}
|
|
725
1060
|
}
|
|
726
1061
|
}
|
|
727
|
-
|
|
1062
|
+
if (utils.isArray(header)) {
|
|
1063
|
+
header.forEach(deleteHeader);
|
|
1064
|
+
} else {
|
|
1065
|
+
deleteHeader(header);
|
|
1066
|
+
}
|
|
1067
|
+
return deleted;
|
|
728
1068
|
}
|
|
729
|
-
clear(
|
|
730
|
-
const
|
|
731
|
-
let
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1069
|
+
clear(matcher) {
|
|
1070
|
+
const keys = Object.keys(this);
|
|
1071
|
+
let i = keys.length;
|
|
1072
|
+
let deleted = false;
|
|
1073
|
+
while (i--) {
|
|
1074
|
+
const key = keys[i];
|
|
1075
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1076
|
+
delete this[key];
|
|
1077
|
+
deleted = true;
|
|
1078
|
+
}
|
|
735
1079
|
}
|
|
736
|
-
return
|
|
1080
|
+
return deleted;
|
|
737
1081
|
}
|
|
738
|
-
normalize(
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1082
|
+
normalize(format) {
|
|
1083
|
+
const self2 = this;
|
|
1084
|
+
const headers = {};
|
|
1085
|
+
utils.forEach(this, (value, header) => {
|
|
1086
|
+
const key = utils.findKey(headers, header);
|
|
1087
|
+
if (key) {
|
|
1088
|
+
self2[key] = normalizeValue(value);
|
|
1089
|
+
delete self2[header];
|
|
744
1090
|
return;
|
|
745
1091
|
}
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
1092
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1093
|
+
if (normalized !== header) {
|
|
1094
|
+
delete self2[header];
|
|
1095
|
+
}
|
|
1096
|
+
self2[normalized] = normalizeValue(value);
|
|
1097
|
+
headers[normalized] = true;
|
|
1098
|
+
});
|
|
1099
|
+
return this;
|
|
749
1100
|
}
|
|
750
|
-
concat(...
|
|
751
|
-
return this.constructor.concat(this, ...
|
|
1101
|
+
concat(...targets) {
|
|
1102
|
+
return this.constructor.concat(this, ...targets);
|
|
752
1103
|
}
|
|
753
|
-
toJSON(
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
})
|
|
1104
|
+
toJSON(asStrings) {
|
|
1105
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1106
|
+
utils.forEach(this, (value, header) => {
|
|
1107
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
|
|
1108
|
+
});
|
|
1109
|
+
return obj;
|
|
758
1110
|
}
|
|
759
1111
|
[Symbol.iterator]() {
|
|
760
1112
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
761
1113
|
}
|
|
762
1114
|
toString() {
|
|
763
|
-
return Object.entries(this.toJSON()).map(([
|
|
764
|
-
`);
|
|
1115
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
765
1116
|
}
|
|
766
1117
|
get [Symbol.toStringTag]() {
|
|
767
1118
|
return "AxiosHeaders";
|
|
768
1119
|
}
|
|
769
|
-
static from(
|
|
770
|
-
return
|
|
1120
|
+
static from(thing) {
|
|
1121
|
+
return thing instanceof this ? thing : new this(thing);
|
|
771
1122
|
}
|
|
772
|
-
static concat(
|
|
773
|
-
const
|
|
774
|
-
|
|
1123
|
+
static concat(first, ...targets) {
|
|
1124
|
+
const computed = new this(first);
|
|
1125
|
+
targets.forEach((target) => computed.set(target));
|
|
1126
|
+
return computed;
|
|
775
1127
|
}
|
|
776
|
-
static accessor(
|
|
777
|
-
const
|
|
1128
|
+
static accessor(header) {
|
|
1129
|
+
const internals = this[$internals] = this[$internals] = {
|
|
778
1130
|
accessors: {}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1131
|
+
};
|
|
1132
|
+
const accessors = internals.accessors;
|
|
1133
|
+
const prototype2 = this.prototype;
|
|
1134
|
+
function defineAccessor(_header) {
|
|
1135
|
+
const lHeader = normalizeHeader(_header);
|
|
1136
|
+
if (!accessors[lHeader]) {
|
|
1137
|
+
buildAccessors(prototype2, _header);
|
|
1138
|
+
accessors[lHeader] = true;
|
|
1139
|
+
}
|
|
783
1140
|
}
|
|
784
|
-
|
|
1141
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1142
|
+
return this;
|
|
785
1143
|
}
|
|
786
1144
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
function
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1145
|
+
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1146
|
+
utils.freezeMethods(AxiosHeaders.prototype);
|
|
1147
|
+
utils.freezeMethods(AxiosHeaders);
|
|
1148
|
+
const AxiosHeaders$1 = AxiosHeaders;
|
|
1149
|
+
function transformData(fns, response) {
|
|
1150
|
+
const config2 = this || defaults$1;
|
|
1151
|
+
const context = response || config2;
|
|
1152
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
1153
|
+
let data = context.data;
|
|
1154
|
+
utils.forEach(fns, function transform(fn) {
|
|
1155
|
+
data = fn.call(config2, data, headers.normalize(), response ? response.status : void 0);
|
|
1156
|
+
});
|
|
1157
|
+
headers.normalize();
|
|
1158
|
+
return data;
|
|
797
1159
|
}
|
|
798
|
-
function
|
|
799
|
-
return !!(
|
|
1160
|
+
function isCancel(value) {
|
|
1161
|
+
return !!(value && value.__CANCEL__);
|
|
800
1162
|
}
|
|
801
|
-
function
|
|
802
|
-
|
|
1163
|
+
function CanceledError(message, config2, request) {
|
|
1164
|
+
AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config2, request);
|
|
1165
|
+
this.name = "CanceledError";
|
|
803
1166
|
}
|
|
804
|
-
|
|
805
|
-
__CANCEL__:
|
|
1167
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
1168
|
+
__CANCEL__: true
|
|
806
1169
|
});
|
|
807
|
-
function
|
|
808
|
-
const
|
|
809
|
-
!
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
1170
|
+
function settle(resolve, reject, response) {
|
|
1171
|
+
const validateStatus2 = response.config.validateStatus;
|
|
1172
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
1173
|
+
resolve(response);
|
|
1174
|
+
} else {
|
|
1175
|
+
reject(new AxiosError(
|
|
1176
|
+
"Request failed with status code " + response.status,
|
|
1177
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1178
|
+
response.config,
|
|
1179
|
+
response.request,
|
|
1180
|
+
response
|
|
1181
|
+
));
|
|
1182
|
+
}
|
|
816
1183
|
}
|
|
817
|
-
const
|
|
1184
|
+
const cookies = platform.isStandardBrowserEnv ? (
|
|
818
1185
|
// Standard browser envs support document.cookie
|
|
819
|
-
/* @__PURE__ */ function() {
|
|
1186
|
+
/* @__PURE__ */ function standardBrowserEnv() {
|
|
820
1187
|
return {
|
|
821
|
-
write: function(
|
|
822
|
-
const
|
|
823
|
-
|
|
1188
|
+
write: function write(name, value, expires, path, domain, secure) {
|
|
1189
|
+
const cookie = [];
|
|
1190
|
+
cookie.push(name + "=" + encodeURIComponent(value));
|
|
1191
|
+
if (utils.isNumber(expires)) {
|
|
1192
|
+
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
1193
|
+
}
|
|
1194
|
+
if (utils.isString(path)) {
|
|
1195
|
+
cookie.push("path=" + path);
|
|
1196
|
+
}
|
|
1197
|
+
if (utils.isString(domain)) {
|
|
1198
|
+
cookie.push("domain=" + domain);
|
|
1199
|
+
}
|
|
1200
|
+
if (secure === true) {
|
|
1201
|
+
cookie.push("secure");
|
|
1202
|
+
}
|
|
1203
|
+
document.cookie = cookie.join("; ");
|
|
824
1204
|
},
|
|
825
|
-
read: function(
|
|
826
|
-
const
|
|
827
|
-
return
|
|
1205
|
+
read: function read(name) {
|
|
1206
|
+
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
1207
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
828
1208
|
},
|
|
829
|
-
remove: function(
|
|
830
|
-
this.write(
|
|
1209
|
+
remove: function remove(name) {
|
|
1210
|
+
this.write(name, "", Date.now() - 864e5);
|
|
831
1211
|
}
|
|
832
1212
|
};
|
|
833
1213
|
}()
|
|
834
1214
|
) : (
|
|
835
1215
|
// Non standard browser env (web workers, react-native) lack needed support.
|
|
836
|
-
/* @__PURE__ */ function() {
|
|
1216
|
+
/* @__PURE__ */ function nonStandardBrowserEnv() {
|
|
837
1217
|
return {
|
|
838
|
-
write: function() {
|
|
1218
|
+
write: function write() {
|
|
839
1219
|
},
|
|
840
|
-
read: function() {
|
|
1220
|
+
read: function read() {
|
|
841
1221
|
return null;
|
|
842
1222
|
},
|
|
843
|
-
remove: function() {
|
|
1223
|
+
remove: function remove() {
|
|
844
1224
|
}
|
|
845
1225
|
};
|
|
846
1226
|
}()
|
|
847
1227
|
);
|
|
848
|
-
function
|
|
849
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
1228
|
+
function isAbsoluteURL(url) {
|
|
1229
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
850
1230
|
}
|
|
851
|
-
function
|
|
852
|
-
return
|
|
1231
|
+
function combineURLs(baseURL, relativeURL) {
|
|
1232
|
+
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
853
1233
|
}
|
|
854
|
-
function
|
|
855
|
-
|
|
1234
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
1235
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
1236
|
+
return combineURLs(baseURL, requestedURL);
|
|
1237
|
+
}
|
|
1238
|
+
return requestedURL;
|
|
856
1239
|
}
|
|
857
|
-
const
|
|
1240
|
+
const isURLSameOrigin = platform.isStandardBrowserEnv ? (
|
|
858
1241
|
// Standard browser envs have full support of the APIs needed to test
|
|
859
1242
|
// whether the request URL is of the same origin as current location.
|
|
860
|
-
function() {
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1243
|
+
function standardBrowserEnv2() {
|
|
1244
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
1245
|
+
const urlParsingNode = document.createElement("a");
|
|
1246
|
+
let originURL;
|
|
1247
|
+
function resolveURL(url) {
|
|
1248
|
+
let href = url;
|
|
1249
|
+
if (msie) {
|
|
1250
|
+
urlParsingNode.setAttribute("href", href);
|
|
1251
|
+
href = urlParsingNode.href;
|
|
1252
|
+
}
|
|
1253
|
+
urlParsingNode.setAttribute("href", href);
|
|
1254
|
+
return {
|
|
1255
|
+
href: urlParsingNode.href,
|
|
1256
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
1257
|
+
host: urlParsingNode.host,
|
|
1258
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
1259
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
1260
|
+
hostname: urlParsingNode.hostname,
|
|
1261
|
+
port: urlParsingNode.port,
|
|
1262
|
+
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
874
1263
|
};
|
|
875
1264
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1265
|
+
originURL = resolveURL(window.location.href);
|
|
1266
|
+
return function isURLSameOrigin2(requestURL) {
|
|
1267
|
+
const parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
1268
|
+
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
879
1269
|
};
|
|
880
1270
|
}()
|
|
881
1271
|
) : (
|
|
882
1272
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
883
|
-
/* @__PURE__ */ function() {
|
|
884
|
-
return function() {
|
|
885
|
-
return
|
|
1273
|
+
/* @__PURE__ */ function nonStandardBrowserEnv2() {
|
|
1274
|
+
return function isURLSameOrigin2() {
|
|
1275
|
+
return true;
|
|
886
1276
|
};
|
|
887
1277
|
}()
|
|
888
1278
|
);
|
|
889
|
-
function
|
|
890
|
-
const
|
|
891
|
-
return
|
|
1279
|
+
function parseProtocol(url) {
|
|
1280
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1281
|
+
return match && match[1] || "";
|
|
892
1282
|
}
|
|
893
|
-
function
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1283
|
+
function speedometer(samplesCount, min) {
|
|
1284
|
+
samplesCount = samplesCount || 10;
|
|
1285
|
+
const bytes = new Array(samplesCount);
|
|
1286
|
+
const timestamps = new Array(samplesCount);
|
|
1287
|
+
let head = 0;
|
|
1288
|
+
let tail = 0;
|
|
1289
|
+
let firstSampleTS;
|
|
1290
|
+
min = min !== void 0 ? min : 1e3;
|
|
1291
|
+
return function push(chunkLength) {
|
|
1292
|
+
const now = Date.now();
|
|
1293
|
+
const startedAt = timestamps[tail];
|
|
1294
|
+
if (!firstSampleTS) {
|
|
1295
|
+
firstSampleTS = now;
|
|
1296
|
+
}
|
|
1297
|
+
bytes[head] = chunkLength;
|
|
1298
|
+
timestamps[head] = now;
|
|
1299
|
+
let i = tail;
|
|
1300
|
+
let bytesCount = 0;
|
|
1301
|
+
while (i !== head) {
|
|
1302
|
+
bytesCount += bytes[i++];
|
|
1303
|
+
i = i % samplesCount;
|
|
1304
|
+
}
|
|
1305
|
+
head = (head + 1) % samplesCount;
|
|
1306
|
+
if (head === tail) {
|
|
1307
|
+
tail = (tail + 1) % samplesCount;
|
|
1308
|
+
}
|
|
1309
|
+
if (now - firstSampleTS < min) {
|
|
904
1310
|
return;
|
|
905
|
-
|
|
906
|
-
|
|
1311
|
+
}
|
|
1312
|
+
const passed = startedAt && now - startedAt;
|
|
1313
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
907
1314
|
};
|
|
908
1315
|
}
|
|
909
|
-
function
|
|
910
|
-
let
|
|
911
|
-
const
|
|
912
|
-
return (
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1316
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
1317
|
+
let bytesNotified = 0;
|
|
1318
|
+
const _speedometer = speedometer(50, 250);
|
|
1319
|
+
return (e) => {
|
|
1320
|
+
const loaded = e.loaded;
|
|
1321
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
1322
|
+
const progressBytes = loaded - bytesNotified;
|
|
1323
|
+
const rate = _speedometer(progressBytes);
|
|
1324
|
+
const inRange = loaded <= total;
|
|
1325
|
+
bytesNotified = loaded;
|
|
1326
|
+
const data = {
|
|
1327
|
+
loaded,
|
|
1328
|
+
total,
|
|
1329
|
+
progress: total ? loaded / total : void 0,
|
|
1330
|
+
bytes: progressBytes,
|
|
1331
|
+
rate: rate ? rate : void 0,
|
|
1332
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
1333
|
+
event: e
|
|
923
1334
|
};
|
|
924
|
-
|
|
1335
|
+
data[isDownloadStream ? "download" : "upload"] = true;
|
|
1336
|
+
listener(data);
|
|
925
1337
|
};
|
|
926
1338
|
}
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1339
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
1340
|
+
const xhrAdapter = isXHRAdapterSupported && function(config2) {
|
|
1341
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1342
|
+
let requestData = config2.data;
|
|
1343
|
+
const requestHeaders = AxiosHeaders$1.from(config2.headers).normalize();
|
|
1344
|
+
const responseType = config2.responseType;
|
|
1345
|
+
let onCanceled;
|
|
1346
|
+
function done() {
|
|
1347
|
+
if (config2.cancelToken) {
|
|
1348
|
+
config2.cancelToken.unsubscribe(onCanceled);
|
|
1349
|
+
}
|
|
1350
|
+
if (config2.signal) {
|
|
1351
|
+
config2.signal.removeEventListener("abort", onCanceled);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
|
|
1355
|
+
requestHeaders.setContentType(false);
|
|
1356
|
+
}
|
|
1357
|
+
let request = new XMLHttpRequest();
|
|
1358
|
+
if (config2.auth) {
|
|
1359
|
+
const username = config2.auth.username || "";
|
|
1360
|
+
const password = config2.auth.password ? unescape(encodeURIComponent(config2.auth.password)) : "";
|
|
1361
|
+
requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
|
|
1362
|
+
}
|
|
1363
|
+
const fullPath = buildFullPath(config2.baseURL, config2.url);
|
|
1364
|
+
request.open(config2.method.toUpperCase(), buildURL(fullPath, config2.params, config2.paramsSerializer), true);
|
|
1365
|
+
request.timeout = config2.timeout;
|
|
1366
|
+
function onloadend() {
|
|
1367
|
+
if (!request) {
|
|
945
1368
|
return;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1369
|
+
}
|
|
1370
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
1371
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
1372
|
+
);
|
|
1373
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
1374
|
+
const response = {
|
|
1375
|
+
data: responseData,
|
|
1376
|
+
status: request.status,
|
|
1377
|
+
statusText: request.statusText,
|
|
1378
|
+
headers: responseHeaders,
|
|
1379
|
+
config: config2,
|
|
1380
|
+
request
|
|
1381
|
+
};
|
|
1382
|
+
settle(function _resolve(value) {
|
|
1383
|
+
resolve(value);
|
|
1384
|
+
done();
|
|
1385
|
+
}, function _reject(err) {
|
|
1386
|
+
reject(err);
|
|
1387
|
+
done();
|
|
1388
|
+
}, response);
|
|
1389
|
+
request = null;
|
|
1390
|
+
}
|
|
1391
|
+
if ("onloadend" in request) {
|
|
1392
|
+
request.onloadend = onloadend;
|
|
1393
|
+
} else {
|
|
1394
|
+
request.onreadystatechange = function handleLoad() {
|
|
1395
|
+
if (!request || request.readyState !== 4) {
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
setTimeout(onloadend);
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
request.onabort = function handleAbort() {
|
|
1405
|
+
if (!request) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config2, request));
|
|
1409
|
+
request = null;
|
|
1410
|
+
};
|
|
1411
|
+
request.onerror = function handleError() {
|
|
1412
|
+
reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config2, request));
|
|
1413
|
+
request = null;
|
|
1414
|
+
};
|
|
1415
|
+
request.ontimeout = function handleTimeout() {
|
|
1416
|
+
let timeoutErrorMessage = config2.timeout ? "timeout of " + config2.timeout + "ms exceeded" : "timeout exceeded";
|
|
1417
|
+
const transitional2 = config2.transitional || transitionalDefaults;
|
|
1418
|
+
if (config2.timeoutErrorMessage) {
|
|
1419
|
+
timeoutErrorMessage = config2.timeoutErrorMessage;
|
|
1420
|
+
}
|
|
1421
|
+
reject(new AxiosError(
|
|
1422
|
+
timeoutErrorMessage,
|
|
1423
|
+
transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1424
|
+
config2,
|
|
1425
|
+
request
|
|
1426
|
+
));
|
|
1427
|
+
request = null;
|
|
1428
|
+
};
|
|
1429
|
+
if (platform.isStandardBrowserEnv) {
|
|
1430
|
+
const xsrfValue = (config2.withCredentials || isURLSameOrigin(fullPath)) && config2.xsrfCookieName && cookies.read(config2.xsrfCookieName);
|
|
1431
|
+
if (xsrfValue) {
|
|
1432
|
+
requestHeaders.set(config2.xsrfHeaderName, xsrfValue);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
1436
|
+
if ("setRequestHeader" in request) {
|
|
1437
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
1438
|
+
request.setRequestHeader(key, val);
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
if (!utils.isUndefined(config2.withCredentials)) {
|
|
1442
|
+
request.withCredentials = !!config2.withCredentials;
|
|
1443
|
+
}
|
|
1444
|
+
if (responseType && responseType !== "json") {
|
|
1445
|
+
request.responseType = config2.responseType;
|
|
1446
|
+
}
|
|
1447
|
+
if (typeof config2.onDownloadProgress === "function") {
|
|
1448
|
+
request.addEventListener("progress", progressEventReducer(config2.onDownloadProgress, true));
|
|
1449
|
+
}
|
|
1450
|
+
if (typeof config2.onUploadProgress === "function" && request.upload) {
|
|
1451
|
+
request.upload.addEventListener("progress", progressEventReducer(config2.onUploadProgress));
|
|
1452
|
+
}
|
|
1453
|
+
if (config2.cancelToken || config2.signal) {
|
|
1454
|
+
onCanceled = (cancel) => {
|
|
1455
|
+
if (!request) {
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config2, request) : cancel);
|
|
1459
|
+
request.abort();
|
|
1460
|
+
request = null;
|
|
955
1461
|
};
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
if (
|
|
963
|
-
|
|
964
|
-
}, u.onabort = function() {
|
|
965
|
-
u && (r(new m("Request aborted", m.ECONNABORTED, e, u)), u = null);
|
|
966
|
-
}, u.onerror = function() {
|
|
967
|
-
r(new m("Network Error", m.ERR_NETWORK, e, u)), u = null;
|
|
968
|
-
}, u.ontimeout = function() {
|
|
969
|
-
let d = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
|
|
970
|
-
const h = e.transitional || Ge;
|
|
971
|
-
e.timeoutErrorMessage && (d = e.timeoutErrorMessage), r(new m(
|
|
972
|
-
d,
|
|
973
|
-
h.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
|
|
974
|
-
e,
|
|
975
|
-
u
|
|
976
|
-
)), u = null;
|
|
977
|
-
}, R.isStandardBrowserEnv) {
|
|
978
|
-
const y = (e.withCredentials || cn(f)) && e.xsrfCookieName && sn.read(e.xsrfCookieName);
|
|
979
|
-
y && i.set(e.xsrfHeaderName, y);
|
|
980
|
-
}
|
|
981
|
-
s === void 0 && i.setContentType(null), "setRequestHeader" in u && a.forEach(i.toJSON(), function(d, h) {
|
|
982
|
-
u.setRequestHeader(h, d);
|
|
983
|
-
}), a.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), o && o !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", Ne(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", Ne(e.onUploadProgress)), (e.cancelToken || e.signal) && (c = (y) => {
|
|
984
|
-
u && (r(!y || y.type ? new k(null, e, u) : y), u.abort(), u = null);
|
|
985
|
-
}, e.cancelToken && e.cancelToken.subscribe(c), e.signal && (e.signal.aborted ? c() : e.signal.addEventListener("abort", c)));
|
|
986
|
-
const w = un(f);
|
|
987
|
-
if (w && R.protocols.indexOf(w) === -1) {
|
|
988
|
-
r(new m("Unsupported protocol " + w + ":", m.ERR_BAD_REQUEST, e));
|
|
1462
|
+
config2.cancelToken && config2.cancelToken.subscribe(onCanceled);
|
|
1463
|
+
if (config2.signal) {
|
|
1464
|
+
config2.signal.aborted ? onCanceled() : config2.signal.addEventListener("abort", onCanceled);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
const protocol = parseProtocol(fullPath);
|
|
1468
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
1469
|
+
reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config2));
|
|
989
1470
|
return;
|
|
990
1471
|
}
|
|
991
|
-
|
|
1472
|
+
request.send(requestData || null);
|
|
992
1473
|
});
|
|
993
|
-
}, J = {
|
|
994
|
-
http: jt,
|
|
995
|
-
xhr: dn
|
|
996
1474
|
};
|
|
997
|
-
|
|
998
|
-
|
|
1475
|
+
const knownAdapters = {
|
|
1476
|
+
http: httpAdapter,
|
|
1477
|
+
xhr: xhrAdapter
|
|
1478
|
+
};
|
|
1479
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
1480
|
+
if (fn) {
|
|
999
1481
|
try {
|
|
1000
|
-
Object.defineProperty(
|
|
1001
|
-
} catch (
|
|
1482
|
+
Object.defineProperty(fn, "name", { value });
|
|
1483
|
+
} catch (e) {
|
|
1002
1484
|
}
|
|
1003
|
-
Object.defineProperty(
|
|
1485
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
1004
1486
|
}
|
|
1005
1487
|
});
|
|
1006
|
-
const
|
|
1007
|
-
getAdapter: (
|
|
1008
|
-
|
|
1009
|
-
const { length
|
|
1010
|
-
let
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1488
|
+
const adapters = {
|
|
1489
|
+
getAdapter: (adapters2) => {
|
|
1490
|
+
adapters2 = utils.isArray(adapters2) ? adapters2 : [adapters2];
|
|
1491
|
+
const { length } = adapters2;
|
|
1492
|
+
let nameOrAdapter;
|
|
1493
|
+
let adapter;
|
|
1494
|
+
for (let i = 0; i < length; i++) {
|
|
1495
|
+
nameOrAdapter = adapters2[i];
|
|
1496
|
+
if (adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
if (!adapter) {
|
|
1501
|
+
if (adapter === false) {
|
|
1502
|
+
throw new AxiosError(
|
|
1503
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
1504
|
+
"ERR_NOT_SUPPORT"
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
throw new Error(
|
|
1508
|
+
utils.hasOwnProp(knownAdapters, nameOrAdapter) ? `Adapter '${nameOrAdapter}' is not available in the build` : `Unknown adapter '${nameOrAdapter}'`
|
|
1019
1509
|
);
|
|
1020
|
-
|
|
1510
|
+
}
|
|
1511
|
+
if (!utils.isFunction(adapter)) {
|
|
1021
1512
|
throw new TypeError("adapter is not a function");
|
|
1022
|
-
|
|
1513
|
+
}
|
|
1514
|
+
return adapter;
|
|
1023
1515
|
},
|
|
1024
|
-
adapters:
|
|
1516
|
+
adapters: knownAdapters
|
|
1025
1517
|
};
|
|
1026
|
-
function
|
|
1027
|
-
if (
|
|
1028
|
-
|
|
1518
|
+
function throwIfCancellationRequested(config2) {
|
|
1519
|
+
if (config2.cancelToken) {
|
|
1520
|
+
config2.cancelToken.throwIfRequested();
|
|
1521
|
+
}
|
|
1522
|
+
if (config2.signal && config2.signal.aborted) {
|
|
1523
|
+
throw new CanceledError(null, config2);
|
|
1524
|
+
}
|
|
1029
1525
|
}
|
|
1030
|
-
function
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1526
|
+
function dispatchRequest(config2) {
|
|
1527
|
+
throwIfCancellationRequested(config2);
|
|
1528
|
+
config2.headers = AxiosHeaders$1.from(config2.headers);
|
|
1529
|
+
config2.data = transformData.call(
|
|
1530
|
+
config2,
|
|
1531
|
+
config2.transformRequest
|
|
1532
|
+
);
|
|
1533
|
+
if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
|
|
1534
|
+
config2.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
1535
|
+
}
|
|
1536
|
+
const adapter = adapters.getAdapter(config2.adapter || defaults$1.adapter);
|
|
1537
|
+
return adapter(config2).then(function onAdapterResolution(response) {
|
|
1538
|
+
throwIfCancellationRequested(config2);
|
|
1539
|
+
response.data = transformData.call(
|
|
1540
|
+
config2,
|
|
1541
|
+
config2.transformResponse,
|
|
1542
|
+
response
|
|
1543
|
+
);
|
|
1544
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
1545
|
+
return response;
|
|
1546
|
+
}, function onAdapterRejection(reason) {
|
|
1547
|
+
if (!isCancel(reason)) {
|
|
1548
|
+
throwIfCancellationRequested(config2);
|
|
1549
|
+
if (reason && reason.response) {
|
|
1550
|
+
reason.response.data = transformData.call(
|
|
1551
|
+
config2,
|
|
1552
|
+
config2.transformResponse,
|
|
1553
|
+
reason.response
|
|
1554
|
+
);
|
|
1555
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
return Promise.reject(reason);
|
|
1046
1559
|
});
|
|
1047
1560
|
}
|
|
1048
|
-
const
|
|
1049
|
-
function
|
|
1050
|
-
|
|
1051
|
-
const
|
|
1052
|
-
function
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
function
|
|
1063
|
-
if (!
|
|
1064
|
-
return
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
return
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1561
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
|
1562
|
+
function mergeConfig(config1, config2) {
|
|
1563
|
+
config2 = config2 || {};
|
|
1564
|
+
const config3 = {};
|
|
1565
|
+
function getMergedValue(target, source, caseless) {
|
|
1566
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
1567
|
+
return utils.merge.call({ caseless }, target, source);
|
|
1568
|
+
} else if (utils.isPlainObject(source)) {
|
|
1569
|
+
return utils.merge({}, source);
|
|
1570
|
+
} else if (utils.isArray(source)) {
|
|
1571
|
+
return source.slice();
|
|
1572
|
+
}
|
|
1573
|
+
return source;
|
|
1574
|
+
}
|
|
1575
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
1576
|
+
if (!utils.isUndefined(b)) {
|
|
1577
|
+
return getMergedValue(a, b, caseless);
|
|
1578
|
+
} else if (!utils.isUndefined(a)) {
|
|
1579
|
+
return getMergedValue(void 0, a, caseless);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
function valueFromConfig2(a, b) {
|
|
1583
|
+
if (!utils.isUndefined(b)) {
|
|
1584
|
+
return getMergedValue(void 0, b);
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function defaultToConfig2(a, b) {
|
|
1588
|
+
if (!utils.isUndefined(b)) {
|
|
1589
|
+
return getMergedValue(void 0, b);
|
|
1590
|
+
} else if (!utils.isUndefined(a)) {
|
|
1591
|
+
return getMergedValue(void 0, a);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1595
|
+
if (prop in config2) {
|
|
1596
|
+
return getMergedValue(a, b);
|
|
1597
|
+
} else if (prop in config1) {
|
|
1598
|
+
return getMergedValue(void 0, a);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
const mergeMap = {
|
|
1602
|
+
url: valueFromConfig2,
|
|
1603
|
+
method: valueFromConfig2,
|
|
1604
|
+
data: valueFromConfig2,
|
|
1605
|
+
baseURL: defaultToConfig2,
|
|
1606
|
+
transformRequest: defaultToConfig2,
|
|
1607
|
+
transformResponse: defaultToConfig2,
|
|
1608
|
+
paramsSerializer: defaultToConfig2,
|
|
1609
|
+
timeout: defaultToConfig2,
|
|
1610
|
+
timeoutMessage: defaultToConfig2,
|
|
1611
|
+
withCredentials: defaultToConfig2,
|
|
1612
|
+
adapter: defaultToConfig2,
|
|
1613
|
+
responseType: defaultToConfig2,
|
|
1614
|
+
xsrfCookieName: defaultToConfig2,
|
|
1615
|
+
xsrfHeaderName: defaultToConfig2,
|
|
1616
|
+
onUploadProgress: defaultToConfig2,
|
|
1617
|
+
onDownloadProgress: defaultToConfig2,
|
|
1618
|
+
decompress: defaultToConfig2,
|
|
1619
|
+
maxContentLength: defaultToConfig2,
|
|
1620
|
+
maxBodyLength: defaultToConfig2,
|
|
1621
|
+
beforeRedirect: defaultToConfig2,
|
|
1622
|
+
transport: defaultToConfig2,
|
|
1623
|
+
httpAgent: defaultToConfig2,
|
|
1624
|
+
httpsAgent: defaultToConfig2,
|
|
1625
|
+
cancelToken: defaultToConfig2,
|
|
1626
|
+
socketPath: defaultToConfig2,
|
|
1627
|
+
responseEncoding: defaultToConfig2,
|
|
1628
|
+
validateStatus: mergeDirectKeys,
|
|
1629
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
1108
1630
|
};
|
|
1109
|
-
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1631
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
1632
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
1633
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
1634
|
+
utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
|
|
1635
|
+
});
|
|
1636
|
+
return config3;
|
|
1113
1637
|
}
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1638
|
+
const VERSION = "1.3.3";
|
|
1639
|
+
const validators$1 = {};
|
|
1640
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
1641
|
+
validators$1[type] = function validator2(thing) {
|
|
1642
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
1118
1643
|
};
|
|
1119
1644
|
});
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
function
|
|
1123
|
-
return "[Axios v" +
|
|
1124
|
-
}
|
|
1125
|
-
return (
|
|
1126
|
-
if (
|
|
1127
|
-
throw new
|
|
1128
|
-
|
|
1129
|
-
|
|
1645
|
+
const deprecatedWarnings = {};
|
|
1646
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
1647
|
+
function formatMessage(opt, desc) {
|
|
1648
|
+
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
1649
|
+
}
|
|
1650
|
+
return (value, opt, opts) => {
|
|
1651
|
+
if (validator2 === false) {
|
|
1652
|
+
throw new AxiosError(
|
|
1653
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
1654
|
+
AxiosError.ERR_DEPRECATED
|
|
1130
1655
|
);
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1656
|
+
}
|
|
1657
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
1658
|
+
deprecatedWarnings[opt] = true;
|
|
1659
|
+
console.warn(
|
|
1660
|
+
formatMessage(
|
|
1661
|
+
opt,
|
|
1662
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
1663
|
+
)
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
1137
1667
|
};
|
|
1138
1668
|
};
|
|
1139
|
-
function
|
|
1140
|
-
if (typeof
|
|
1141
|
-
throw new
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1669
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
1670
|
+
if (typeof options !== "object") {
|
|
1671
|
+
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1672
|
+
}
|
|
1673
|
+
const keys = Object.keys(options);
|
|
1674
|
+
let i = keys.length;
|
|
1675
|
+
while (i-- > 0) {
|
|
1676
|
+
const opt = keys[i];
|
|
1677
|
+
const validator2 = schema[opt];
|
|
1678
|
+
if (validator2) {
|
|
1679
|
+
const value = options[opt];
|
|
1680
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
1681
|
+
if (result !== true) {
|
|
1682
|
+
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1683
|
+
}
|
|
1150
1684
|
continue;
|
|
1151
1685
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
throw new
|
|
1686
|
+
if (allowUnknown !== true) {
|
|
1687
|
+
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
1688
|
+
}
|
|
1154
1689
|
}
|
|
1155
1690
|
}
|
|
1156
|
-
const
|
|
1157
|
-
assertOptions
|
|
1158
|
-
validators:
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1691
|
+
const validator = {
|
|
1692
|
+
assertOptions,
|
|
1693
|
+
validators: validators$1
|
|
1694
|
+
};
|
|
1695
|
+
const validators = validator.validators;
|
|
1696
|
+
class Axios {
|
|
1697
|
+
constructor(instanceConfig) {
|
|
1698
|
+
this.defaults = instanceConfig;
|
|
1699
|
+
this.interceptors = {
|
|
1700
|
+
request: new InterceptorManager(),
|
|
1701
|
+
response: new InterceptorManager()
|
|
1165
1702
|
};
|
|
1166
1703
|
}
|
|
1167
1704
|
/**
|
|
@@ -1172,172 +1709,222 @@ class V {
|
|
|
1172
1709
|
*
|
|
1173
1710
|
* @returns {Promise} The Promise to be fulfilled
|
|
1174
1711
|
*/
|
|
1175
|
-
request(
|
|
1176
|
-
typeof
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1712
|
+
request(configOrUrl, config2) {
|
|
1713
|
+
if (typeof configOrUrl === "string") {
|
|
1714
|
+
config2 = config2 || {};
|
|
1715
|
+
config2.url = configOrUrl;
|
|
1716
|
+
} else {
|
|
1717
|
+
config2 = configOrUrl || {};
|
|
1718
|
+
}
|
|
1719
|
+
config2 = mergeConfig(this.defaults, config2);
|
|
1720
|
+
const { transitional: transitional2, paramsSerializer, headers } = config2;
|
|
1721
|
+
if (transitional2 !== void 0) {
|
|
1722
|
+
validator.assertOptions(transitional2, {
|
|
1723
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1724
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1725
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
1726
|
+
}, false);
|
|
1727
|
+
}
|
|
1728
|
+
if (paramsSerializer !== void 0) {
|
|
1729
|
+
validator.assertOptions(paramsSerializer, {
|
|
1730
|
+
encode: validators.function,
|
|
1731
|
+
serialize: validators.function
|
|
1732
|
+
}, true);
|
|
1733
|
+
}
|
|
1734
|
+
config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
|
|
1735
|
+
let contextHeaders;
|
|
1736
|
+
contextHeaders = headers && utils.merge(
|
|
1737
|
+
headers.common,
|
|
1738
|
+
headers[config2.method]
|
|
1739
|
+
);
|
|
1740
|
+
contextHeaders && utils.forEach(
|
|
1191
1741
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1192
|
-
(
|
|
1193
|
-
delete
|
|
1742
|
+
(method) => {
|
|
1743
|
+
delete headers[method];
|
|
1744
|
+
}
|
|
1745
|
+
);
|
|
1746
|
+
config2.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
1747
|
+
const requestInterceptorChain = [];
|
|
1748
|
+
let synchronousRequestInterceptors = true;
|
|
1749
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
1750
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
|
|
1751
|
+
return;
|
|
1194
1752
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
let l = !0;
|
|
1198
|
-
this.interceptors.request.forEach(function(h) {
|
|
1199
|
-
typeof h.runWhen == "function" && h.runWhen(n) === !1 || (l = l && h.synchronous, c.unshift(h.fulfilled, h.rejected));
|
|
1753
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
1754
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
1200
1755
|
});
|
|
1201
|
-
const
|
|
1202
|
-
this.interceptors.response.forEach(function(
|
|
1203
|
-
|
|
1756
|
+
const responseInterceptorChain = [];
|
|
1757
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
1758
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
1204
1759
|
});
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1760
|
+
let promise;
|
|
1761
|
+
let i = 0;
|
|
1762
|
+
let len;
|
|
1763
|
+
if (!synchronousRequestInterceptors) {
|
|
1764
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
1765
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
1766
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
1767
|
+
len = chain.length;
|
|
1768
|
+
promise = Promise.resolve(config2);
|
|
1769
|
+
while (i < len) {
|
|
1770
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
1771
|
+
}
|
|
1772
|
+
return promise;
|
|
1773
|
+
}
|
|
1774
|
+
len = requestInterceptorChain.length;
|
|
1775
|
+
let newConfig = config2;
|
|
1776
|
+
i = 0;
|
|
1777
|
+
while (i < len) {
|
|
1778
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
1779
|
+
const onRejected = requestInterceptorChain[i++];
|
|
1216
1780
|
try {
|
|
1217
|
-
|
|
1218
|
-
} catch (
|
|
1219
|
-
|
|
1781
|
+
newConfig = onFulfilled(newConfig);
|
|
1782
|
+
} catch (error) {
|
|
1783
|
+
onRejected.call(this, error);
|
|
1220
1784
|
break;
|
|
1221
1785
|
}
|
|
1222
1786
|
}
|
|
1223
1787
|
try {
|
|
1224
|
-
|
|
1225
|
-
} catch (
|
|
1226
|
-
return Promise.reject(
|
|
1788
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
1789
|
+
} catch (error) {
|
|
1790
|
+
return Promise.reject(error);
|
|
1227
1791
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1792
|
+
i = 0;
|
|
1793
|
+
len = responseInterceptorChain.length;
|
|
1794
|
+
while (i < len) {
|
|
1795
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
1796
|
+
}
|
|
1797
|
+
return promise;
|
|
1231
1798
|
}
|
|
1232
|
-
getUri(
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1235
|
-
return
|
|
1799
|
+
getUri(config2) {
|
|
1800
|
+
config2 = mergeConfig(this.defaults, config2);
|
|
1801
|
+
const fullPath = buildFullPath(config2.baseURL, config2.url);
|
|
1802
|
+
return buildURL(fullPath, config2.params, config2.paramsSerializer);
|
|
1236
1803
|
}
|
|
1237
1804
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
return this.request(
|
|
1241
|
-
method
|
|
1242
|
-
url
|
|
1243
|
-
data: (
|
|
1805
|
+
utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
1806
|
+
Axios.prototype[method] = function(url, config2) {
|
|
1807
|
+
return this.request(mergeConfig(config2 || {}, {
|
|
1808
|
+
method,
|
|
1809
|
+
url,
|
|
1810
|
+
data: (config2 || {}).data
|
|
1244
1811
|
}));
|
|
1245
1812
|
};
|
|
1246
1813
|
});
|
|
1247
|
-
|
|
1248
|
-
function
|
|
1249
|
-
return function(
|
|
1250
|
-
return this.request(
|
|
1251
|
-
method
|
|
1252
|
-
headers:
|
|
1814
|
+
utils.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
1815
|
+
function generateHTTPMethod(isForm) {
|
|
1816
|
+
return function httpMethod(url, data, config2) {
|
|
1817
|
+
return this.request(mergeConfig(config2 || {}, {
|
|
1818
|
+
method,
|
|
1819
|
+
headers: isForm ? {
|
|
1253
1820
|
"Content-Type": "multipart/form-data"
|
|
1254
1821
|
} : {},
|
|
1255
|
-
url
|
|
1256
|
-
data
|
|
1822
|
+
url,
|
|
1823
|
+
data
|
|
1257
1824
|
}));
|
|
1258
1825
|
};
|
|
1259
1826
|
}
|
|
1260
|
-
|
|
1827
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
1828
|
+
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
1261
1829
|
});
|
|
1262
|
-
const
|
|
1263
|
-
class
|
|
1264
|
-
constructor(
|
|
1265
|
-
if (typeof
|
|
1830
|
+
const Axios$1 = Axios;
|
|
1831
|
+
class CancelToken {
|
|
1832
|
+
constructor(executor) {
|
|
1833
|
+
if (typeof executor !== "function") {
|
|
1266
1834
|
throw new TypeError("executor must be a function.");
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1835
|
+
}
|
|
1836
|
+
let resolvePromise;
|
|
1837
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
1838
|
+
resolvePromise = resolve;
|
|
1270
1839
|
});
|
|
1271
|
-
const
|
|
1272
|
-
this.promise.then((
|
|
1273
|
-
if (!
|
|
1840
|
+
const token = this;
|
|
1841
|
+
this.promise.then((cancel) => {
|
|
1842
|
+
if (!token._listeners)
|
|
1274
1843
|
return;
|
|
1275
|
-
let i =
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1844
|
+
let i = token._listeners.length;
|
|
1845
|
+
while (i-- > 0) {
|
|
1846
|
+
token._listeners[i](cancel);
|
|
1847
|
+
}
|
|
1848
|
+
token._listeners = null;
|
|
1849
|
+
});
|
|
1850
|
+
this.promise.then = (onfulfilled) => {
|
|
1851
|
+
let _resolve;
|
|
1852
|
+
const promise = new Promise((resolve) => {
|
|
1853
|
+
token.subscribe(resolve);
|
|
1854
|
+
_resolve = resolve;
|
|
1855
|
+
}).then(onfulfilled);
|
|
1856
|
+
promise.cancel = function reject() {
|
|
1857
|
+
token.unsubscribe(_resolve);
|
|
1858
|
+
};
|
|
1859
|
+
return promise;
|
|
1860
|
+
};
|
|
1861
|
+
executor(function cancel(message, config2, request) {
|
|
1862
|
+
if (token.reason) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
token.reason = new CanceledError(message, config2, request);
|
|
1866
|
+
resolvePromise(token.reason);
|
|
1289
1867
|
});
|
|
1290
1868
|
}
|
|
1291
1869
|
/**
|
|
1292
1870
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
1293
1871
|
*/
|
|
1294
1872
|
throwIfRequested() {
|
|
1295
|
-
if (this.reason)
|
|
1873
|
+
if (this.reason) {
|
|
1296
1874
|
throw this.reason;
|
|
1875
|
+
}
|
|
1297
1876
|
}
|
|
1298
1877
|
/**
|
|
1299
1878
|
* Subscribe to the cancel signal
|
|
1300
1879
|
*/
|
|
1301
|
-
subscribe(
|
|
1880
|
+
subscribe(listener) {
|
|
1302
1881
|
if (this.reason) {
|
|
1303
|
-
|
|
1882
|
+
listener(this.reason);
|
|
1304
1883
|
return;
|
|
1305
1884
|
}
|
|
1306
|
-
|
|
1885
|
+
if (this._listeners) {
|
|
1886
|
+
this._listeners.push(listener);
|
|
1887
|
+
} else {
|
|
1888
|
+
this._listeners = [listener];
|
|
1889
|
+
}
|
|
1307
1890
|
}
|
|
1308
1891
|
/**
|
|
1309
1892
|
* Unsubscribe from the cancel signal
|
|
1310
1893
|
*/
|
|
1311
|
-
unsubscribe(
|
|
1312
|
-
if (!this._listeners)
|
|
1894
|
+
unsubscribe(listener) {
|
|
1895
|
+
if (!this._listeners) {
|
|
1313
1896
|
return;
|
|
1314
|
-
|
|
1315
|
-
|
|
1897
|
+
}
|
|
1898
|
+
const index2 = this._listeners.indexOf(listener);
|
|
1899
|
+
if (index2 !== -1) {
|
|
1900
|
+
this._listeners.splice(index2, 1);
|
|
1901
|
+
}
|
|
1316
1902
|
}
|
|
1317
1903
|
/**
|
|
1318
1904
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1319
1905
|
* cancels the `CancelToken`.
|
|
1320
1906
|
*/
|
|
1321
1907
|
static source() {
|
|
1322
|
-
let
|
|
1908
|
+
let cancel;
|
|
1909
|
+
const token = new CancelToken(function executor(c) {
|
|
1910
|
+
cancel = c;
|
|
1911
|
+
});
|
|
1323
1912
|
return {
|
|
1324
|
-
token
|
|
1325
|
-
|
|
1326
|
-
}),
|
|
1327
|
-
cancel: t
|
|
1913
|
+
token,
|
|
1914
|
+
cancel
|
|
1328
1915
|
};
|
|
1329
1916
|
}
|
|
1330
1917
|
}
|
|
1331
|
-
const
|
|
1332
|
-
function
|
|
1333
|
-
return function(
|
|
1334
|
-
return
|
|
1918
|
+
const CancelToken$1 = CancelToken;
|
|
1919
|
+
function spread(callback) {
|
|
1920
|
+
return function wrap(arr) {
|
|
1921
|
+
return callback.apply(null, arr);
|
|
1335
1922
|
};
|
|
1336
1923
|
}
|
|
1337
|
-
function
|
|
1338
|
-
return
|
|
1924
|
+
function isAxiosError(payload) {
|
|
1925
|
+
return utils.isObject(payload) && payload.isAxiosError === true;
|
|
1339
1926
|
}
|
|
1340
|
-
const
|
|
1927
|
+
const HttpStatusCode = {
|
|
1341
1928
|
Continue: 100,
|
|
1342
1929
|
SwitchingProtocols: 101,
|
|
1343
1930
|
Processing: 102,
|
|
@@ -1402,233 +1989,354 @@ const ie = {
|
|
|
1402
1989
|
NotExtended: 510,
|
|
1403
1990
|
NetworkAuthenticationRequired: 511
|
|
1404
1991
|
};
|
|
1405
|
-
Object.entries(
|
|
1406
|
-
|
|
1992
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
1993
|
+
HttpStatusCode[value] = key;
|
|
1407
1994
|
});
|
|
1408
|
-
const
|
|
1409
|
-
function
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1995
|
+
const HttpStatusCode$1 = HttpStatusCode;
|
|
1996
|
+
function createInstance(defaultConfig) {
|
|
1997
|
+
const context = new Axios$1(defaultConfig);
|
|
1998
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
1999
|
+
utils.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
2000
|
+
utils.extend(instance, context, null, { allOwnKeys: true });
|
|
2001
|
+
instance.create = function create(instanceConfig) {
|
|
2002
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
2003
|
+
};
|
|
2004
|
+
return instance;
|
|
1414
2005
|
}
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
return Promise.all(
|
|
2006
|
+
const axios = createInstance(defaults$1);
|
|
2007
|
+
axios.Axios = Axios$1;
|
|
2008
|
+
axios.CanceledError = CanceledError;
|
|
2009
|
+
axios.CancelToken = CancelToken$1;
|
|
2010
|
+
axios.isCancel = isCancel;
|
|
2011
|
+
axios.VERSION = VERSION;
|
|
2012
|
+
axios.toFormData = toFormData;
|
|
2013
|
+
axios.AxiosError = AxiosError;
|
|
2014
|
+
axios.Cancel = axios.CanceledError;
|
|
2015
|
+
axios.all = function all(promises) {
|
|
2016
|
+
return Promise.all(promises);
|
|
1426
2017
|
};
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
const
|
|
2018
|
+
axios.spread = spread;
|
|
2019
|
+
axios.isAxiosError = isAxiosError;
|
|
2020
|
+
axios.mergeConfig = mergeConfig;
|
|
2021
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
2022
|
+
axios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
2023
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
2024
|
+
axios.default = axios;
|
|
2025
|
+
const ttc = {
|
|
1435
2026
|
LOGIN_URL: `${window.location.origin}/ttc/cloud/#/login`,
|
|
1436
2027
|
HOME_URL: `${window.location.origin}/ttc/cloud/#/cloud`,
|
|
1437
|
-
INTEGRATED_BASE_URL:
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
return
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
2028
|
+
INTEGRATED_BASE_URL: `/gateway/integrated-management/api/v1`
|
|
2029
|
+
};
|
|
2030
|
+
const URL = {
|
|
2031
|
+
ttc
|
|
2032
|
+
};
|
|
2033
|
+
const BC_THEME_NAME = "THEME";
|
|
2034
|
+
const BC_LANG_NAME = "LANG";
|
|
2035
|
+
const getAuthRouteList = (systemName = "ttc") => {
|
|
2036
|
+
return http.get(`${URL[systemName].INTEGRATED_BASE_URL}/account/auth/route/list`);
|
|
2037
|
+
};
|
|
2038
|
+
const getHomeMenuList = (systemName = "ttc") => {
|
|
2039
|
+
return http.get(`${URL[systemName].INTEGRATED_BASE_URL}/account/home/menu`);
|
|
2040
|
+
};
|
|
2041
|
+
const removeToken = (systemName = "ttc") => {
|
|
2042
|
+
setSystemConfig({ token: "" });
|
|
2043
|
+
};
|
|
2044
|
+
const getToken = (systemName = "ttc") => {
|
|
2045
|
+
var _a;
|
|
2046
|
+
const GlobalStateKey = `${systemName}GlobalState`;
|
|
2047
|
+
const GlobalState = (_a = localStorage.getItem(GlobalStateKey)) != null ? _a : "{}";
|
|
2048
|
+
const token = JSON.parse(GlobalState) ? JSON.parse(GlobalState).token : null;
|
|
2049
|
+
return token;
|
|
2050
|
+
};
|
|
2051
|
+
const autoLogin = (_0, ..._1) => __async(void 0, [_0, ..._1], function* ({ userName, password }, systemName = "ttc") {
|
|
2052
|
+
const loginApiUrl = getSystemConfig("loginApiUrl");
|
|
2053
|
+
const { data } = yield http.post(loginApiUrl, { userName, password });
|
|
2054
|
+
if (data.tokenValue) {
|
|
2055
|
+
ElMessage.success("登录成功");
|
|
2056
|
+
}
|
|
2057
|
+
setSystemConfig({ token: data.tokenValue, userInfo: data });
|
|
2058
|
+
});
|
|
2059
|
+
const getUserInfo = (systemName = "ttc") => {
|
|
2060
|
+
var _a;
|
|
2061
|
+
const GlobalStateKey = `${systemName}GlobalState`;
|
|
2062
|
+
const GlobalState = (_a = localStorage.getItem(GlobalStateKey)) != null ? _a : "{}";
|
|
2063
|
+
const userInfo = JSON.parse(GlobalState) ? JSON.parse(GlobalState).userInfo : null;
|
|
2064
|
+
return userInfo;
|
|
2065
|
+
};
|
|
2066
|
+
const getUserRouteList = () => __async(void 0, null, function* () {
|
|
2067
|
+
if (!getToken())
|
|
2068
|
+
return [];
|
|
2069
|
+
const data = yield getHomeMenuList();
|
|
2070
|
+
return data;
|
|
2071
|
+
});
|
|
2072
|
+
const jumpToLogin = () => {
|
|
2073
|
+
if (isProduction()) {
|
|
2074
|
+
removeToken();
|
|
2075
|
+
const curRoute = location.pathname;
|
|
2076
|
+
console.log("跳转至登录页", curRoute, curRoute.includes(getLoginUrl()));
|
|
2077
|
+
if (curRoute.includes(getLoginUrl())) {
|
|
1460
2078
|
return;
|
|
1461
|
-
|
|
2079
|
+
} else {
|
|
2080
|
+
console.log("跳转至登录页", getLoginUrl());
|
|
2081
|
+
location.replace(getLoginUrl());
|
|
2082
|
+
}
|
|
1462
2083
|
} else {
|
|
1463
2084
|
console.log("开发环境!!!");
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1466
|
-
const
|
|
1467
|
-
(
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
2085
|
+
const userName = window.prompt("当前系统处于开发环境,当前登录过期,请输入登录账号", "");
|
|
2086
|
+
if (userName !== null) {
|
|
2087
|
+
const password = window.prompt("请输入登录密码", "");
|
|
2088
|
+
if (password === null || password == "")
|
|
2089
|
+
window.prompt("请输入登录密码", "");
|
|
2090
|
+
autoLogin({ userName, password });
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
const jumpToHome = () => {
|
|
2095
|
+
window.location.replace(getHomeUrl());
|
|
2096
|
+
};
|
|
2097
|
+
const getLoginUrl = () => {
|
|
2098
|
+
return getSystemConfig("loginUrl");
|
|
2099
|
+
};
|
|
2100
|
+
const getHomeUrl = () => {
|
|
2101
|
+
return getSystemConfig("homeUrl");
|
|
2102
|
+
};
|
|
2103
|
+
const setSystemConfig = (config2) => {
|
|
2104
|
+
var _a;
|
|
2105
|
+
const GlobalState = (_a = localStorage.getItem("ttcGlobalState")) != null ? _a : "{}";
|
|
2106
|
+
const newGlobalState = __spreadValues(__spreadValues({}, JSON.parse(GlobalState)), config2);
|
|
2107
|
+
localStorage.setItem("ttcGlobalState", JSON.stringify(newGlobalState));
|
|
2108
|
+
};
|
|
2109
|
+
const getSystemConfig = (key) => {
|
|
2110
|
+
var _a, _b;
|
|
2111
|
+
const GlobalState = JSON.parse((_a = localStorage.getItem("ttcGlobalState")) != null ? _a : "{}");
|
|
2112
|
+
return (_b = GlobalState[key]) != null ? _b : "";
|
|
2113
|
+
};
|
|
2114
|
+
const isProduction = () => {
|
|
2115
|
+
return getSystemConfig("environment") === "production";
|
|
2116
|
+
};
|
|
2117
|
+
const getUserPermissions = (systemName, isJumpLogin = true, serverName) => __async(void 0, null, function* () {
|
|
2118
|
+
if (!getToken() && isJumpLogin)
|
|
2119
|
+
return jumpToLogin();
|
|
1482
2120
|
try {
|
|
1483
|
-
const { data
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
2121
|
+
const { data } = yield getAuthRouteList(serverName);
|
|
2122
|
+
const systemPermissionList = data.filter((route) => route.routeTag.includes(systemName));
|
|
2123
|
+
const userMenuList = systemPermissionList.filter((item) => item.routeType === "VIEW");
|
|
2124
|
+
const userBtnList = systemPermissionList.filter((item) => item.routeType === "BTN");
|
|
2125
|
+
sessionStorage.setItem("ttcUserBtnList", JSON.stringify(userBtnList.map((item) => item.routeTag)));
|
|
2126
|
+
return {
|
|
2127
|
+
userMenuList,
|
|
2128
|
+
userBtnList
|
|
1487
2129
|
};
|
|
1488
|
-
} catch (
|
|
1489
|
-
}
|
|
1490
|
-
})
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
2130
|
+
} catch (err) {
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
const getUserRouter = (userMenuList, viewModules, viewConfig) => {
|
|
2134
|
+
let menuList = [];
|
|
2135
|
+
userMenuList.forEach((item) => {
|
|
2136
|
+
const configKey = `/src/views${item.routeView}/config.ts`;
|
|
2137
|
+
const viewKey = `/src/views${item.routeView}/index.vue`;
|
|
2138
|
+
if (viewModules[viewKey] && viewConfig[configKey]) {
|
|
2139
|
+
const pageConfig = viewConfig[configKey];
|
|
2140
|
+
const routerObject = {
|
|
2141
|
+
path: item.routeView,
|
|
2142
|
+
name: item.routeView.split("/")[1],
|
|
1498
2143
|
meta: {
|
|
1499
|
-
title:
|
|
1500
|
-
icon:
|
|
2144
|
+
title: pageConfig.title,
|
|
2145
|
+
icon: pageConfig.icon
|
|
1501
2146
|
},
|
|
1502
|
-
component:
|
|
2147
|
+
component: viewModules[viewKey]
|
|
1503
2148
|
};
|
|
1504
|
-
|
|
1505
|
-
}
|
|
1506
|
-
})
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2149
|
+
menuList.push(routerObject);
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
return menuList;
|
|
2153
|
+
};
|
|
2154
|
+
const getUserIsHaveBtnPower = (routeTag) => {
|
|
2155
|
+
var _a;
|
|
2156
|
+
if (!routeTag)
|
|
2157
|
+
return false;
|
|
2158
|
+
const authButtonListGet = (_a = sessionStorage.getItem("ttcUserBtnList")) != null ? _a : "[]";
|
|
2159
|
+
return JSON.parse(authButtonListGet).includes(routeTag);
|
|
2160
|
+
};
|
|
2161
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1514
2162
|
__proto__: null,
|
|
1515
|
-
autoLogin
|
|
1516
|
-
getHomeUrl
|
|
1517
|
-
getLoginUrl
|
|
1518
|
-
getSystemConfig
|
|
1519
|
-
getToken
|
|
1520
|
-
getUserInfo
|
|
1521
|
-
getUserIsHaveBtnPower
|
|
1522
|
-
getUserPermissions
|
|
1523
|
-
getUserRouteList
|
|
1524
|
-
getUserRouter
|
|
1525
|
-
isProduction
|
|
1526
|
-
jumpToHome
|
|
1527
|
-
jumpToLogin
|
|
1528
|
-
removeToken
|
|
1529
|
-
setSystemConfig
|
|
2163
|
+
autoLogin,
|
|
2164
|
+
getHomeUrl,
|
|
2165
|
+
getLoginUrl,
|
|
2166
|
+
getSystemConfig,
|
|
2167
|
+
getToken,
|
|
2168
|
+
getUserInfo,
|
|
2169
|
+
getUserIsHaveBtnPower,
|
|
2170
|
+
getUserPermissions,
|
|
2171
|
+
getUserRouteList,
|
|
2172
|
+
getUserRouter,
|
|
2173
|
+
isProduction,
|
|
2174
|
+
jumpToHome,
|
|
2175
|
+
jumpToLogin,
|
|
2176
|
+
removeToken,
|
|
2177
|
+
setSystemConfig
|
|
1530
2178
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1531
|
-
let
|
|
1532
|
-
const
|
|
1533
|
-
lock:
|
|
2179
|
+
let loadingInstance;
|
|
2180
|
+
const loadingOptions = {
|
|
2181
|
+
lock: true,
|
|
1534
2182
|
text: "加载中...",
|
|
1535
|
-
fullscreen:
|
|
2183
|
+
fullscreen: true,
|
|
1536
2184
|
background: "rgba(0, 0, 0, 0.6)"
|
|
1537
|
-
}, Cn = () => {
|
|
1538
|
-
tt = it.service(xn);
|
|
1539
|
-
}, Ln = () => {
|
|
1540
|
-
tt.close();
|
|
1541
2185
|
};
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
2186
|
+
const startLoading = () => {
|
|
2187
|
+
loadingInstance = ElLoading.service(loadingOptions);
|
|
2188
|
+
};
|
|
2189
|
+
const endLoading = () => {
|
|
2190
|
+
loadingInstance.close();
|
|
2191
|
+
};
|
|
2192
|
+
let needLoadingRequestCount = 0;
|
|
2193
|
+
const showFullScreenLoading = () => {
|
|
2194
|
+
if (needLoadingRequestCount === 0) {
|
|
2195
|
+
startLoading();
|
|
2196
|
+
}
|
|
2197
|
+
needLoadingRequestCount++;
|
|
1547
2198
|
};
|
|
1548
|
-
|
|
1549
|
-
|
|
2199
|
+
const hideFullScreenLoading = () => {
|
|
2200
|
+
if (needLoadingRequestCount <= 0)
|
|
2201
|
+
return;
|
|
2202
|
+
needLoadingRequestCount--;
|
|
2203
|
+
if (needLoadingRequestCount === 0) {
|
|
2204
|
+
endLoading();
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
var ResultEnum = /* @__PURE__ */ ((ResultEnum2) => {
|
|
2208
|
+
ResultEnum2[ResultEnum2["SUCCESS"] = 200] = "SUCCESS";
|
|
2209
|
+
ResultEnum2[ResultEnum2["ERROR"] = 500] = "ERROR";
|
|
2210
|
+
ResultEnum2[ResultEnum2["OVERDUE"] = 401] = "OVERDUE";
|
|
2211
|
+
ResultEnum2[ResultEnum2["TIMEOUT"] = 3e4] = "TIMEOUT";
|
|
2212
|
+
return ResultEnum2;
|
|
2213
|
+
})(ResultEnum || {});
|
|
2214
|
+
const config = {
|
|
1550
2215
|
// 默认地址请求地址,可在 .env.*** 文件中修改
|
|
1551
2216
|
// 设置超时时间(30s)
|
|
1552
2217
|
timeout: 3e4,
|
|
1553
2218
|
// 跨域时候允许携带凭证
|
|
1554
|
-
withCredentials:
|
|
1555
|
-
}
|
|
1556
|
-
|
|
2219
|
+
withCredentials: true
|
|
2220
|
+
};
|
|
2221
|
+
const checkStatus = (status, msg) => {
|
|
2222
|
+
switch (status) {
|
|
1557
2223
|
case 400:
|
|
1558
|
-
|
|
2224
|
+
ElMessage.error(msg || "请求失败!请您稍后重试");
|
|
1559
2225
|
break;
|
|
1560
2226
|
case 401:
|
|
1561
|
-
location.href.includes(
|
|
2227
|
+
if (!location.href.includes(getLoginUrl())) {
|
|
2228
|
+
ElMessage.error(msg || "登录失效!请您重新登录");
|
|
2229
|
+
jumpToLogin();
|
|
2230
|
+
}
|
|
1562
2231
|
break;
|
|
1563
2232
|
case 403:
|
|
1564
|
-
|
|
2233
|
+
ElMessage.error(msg || "当前账号无权限访问!");
|
|
1565
2234
|
break;
|
|
1566
2235
|
case 404:
|
|
1567
|
-
|
|
2236
|
+
ElMessage.error("你所访问的资源不存在!");
|
|
1568
2237
|
break;
|
|
1569
2238
|
case 405:
|
|
1570
|
-
|
|
2239
|
+
ElMessage.error(msg || "请求方式错误!请您稍后重试");
|
|
1571
2240
|
break;
|
|
1572
2241
|
case 408:
|
|
1573
|
-
|
|
2242
|
+
ElMessage.error(msg || "请求超时!请您稍后重试");
|
|
1574
2243
|
break;
|
|
1575
2244
|
case 500:
|
|
1576
|
-
|
|
2245
|
+
ElMessage.error(msg || "服务异常!");
|
|
1577
2246
|
break;
|
|
1578
2247
|
case 502:
|
|
1579
|
-
|
|
2248
|
+
ElMessage.error("网关错误!");
|
|
1580
2249
|
break;
|
|
1581
2250
|
case 503:
|
|
1582
|
-
|
|
2251
|
+
ElMessage.error("服务不可用!");
|
|
1583
2252
|
break;
|
|
1584
2253
|
case 504:
|
|
1585
|
-
|
|
2254
|
+
ElMessage.error("网关超时!");
|
|
1586
2255
|
break;
|
|
1587
2256
|
default:
|
|
1588
|
-
|
|
2257
|
+
ElMessage.error("请求失败!");
|
|
1589
2258
|
}
|
|
1590
2259
|
};
|
|
1591
|
-
class
|
|
1592
|
-
constructor(
|
|
1593
|
-
|
|
2260
|
+
class YxHttp {
|
|
2261
|
+
constructor(config2) {
|
|
2262
|
+
__publicField(this, "service");
|
|
1594
2263
|
/** 自定义响应处理map */
|
|
1595
|
-
|
|
1596
|
-
this.service =
|
|
2264
|
+
__publicField(this, "customResMap");
|
|
2265
|
+
this.service = axios.create(config2);
|
|
2266
|
+
this.setupInterceptors();
|
|
2267
|
+
this.customResMap = {};
|
|
1597
2268
|
}
|
|
1598
2269
|
setupInterceptors() {
|
|
1599
2270
|
this.service.interceptors.request.use(
|
|
1600
|
-
(
|
|
1601
|
-
var
|
|
1602
|
-
|
|
2271
|
+
(config2) => {
|
|
2272
|
+
var _a;
|
|
2273
|
+
if (!((_a = config2.headers) == null ? void 0 : _a.noLoading)) {
|
|
2274
|
+
showFullScreenLoading();
|
|
2275
|
+
}
|
|
2276
|
+
config2.headers.token = getToken();
|
|
2277
|
+
if ((config2 == null ? void 0 : config2.customResHandler) && (config2 == null ? void 0 : config2.url)) {
|
|
2278
|
+
this.customResMap[config2 == null ? void 0 : config2.url] = config2.customResHandler;
|
|
2279
|
+
}
|
|
2280
|
+
return config2;
|
|
1603
2281
|
},
|
|
1604
|
-
(
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
2282
|
+
(error) => {
|
|
2283
|
+
return Promise.reject(error);
|
|
2284
|
+
}
|
|
2285
|
+
);
|
|
2286
|
+
this.service.interceptors.response.use(
|
|
2287
|
+
(response) => {
|
|
2288
|
+
const { data, config: config2 } = response;
|
|
2289
|
+
hideFullScreenLoading();
|
|
2290
|
+
if (config2.url && this.customResMap[config2.url]) {
|
|
2291
|
+
return this.customResMap[config2.url](data);
|
|
2292
|
+
}
|
|
2293
|
+
if (data.code == ResultEnum.OVERDUE) {
|
|
2294
|
+
this.handleOverdueResponse(data);
|
|
2295
|
+
} else if (data.code !== ResultEnum.SUCCESS) {
|
|
2296
|
+
this.handleErrorResponse(data);
|
|
2297
|
+
}
|
|
2298
|
+
return data;
|
|
1609
2299
|
},
|
|
1610
|
-
(
|
|
1611
|
-
|
|
1612
|
-
const { config:
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
}
|
|
2300
|
+
(error) => {
|
|
2301
|
+
hideFullScreenLoading();
|
|
2302
|
+
const { config: config2 } = error;
|
|
2303
|
+
if ((config2 == null ? void 0 : config2.url) && this.customResMap[config2.url]) {
|
|
2304
|
+
this.customResMap[config2.url](error.response);
|
|
2305
|
+
}
|
|
2306
|
+
if (error.message.includes("timeout")) {
|
|
2307
|
+
ElMessage.error("请求超时!请稍后重试");
|
|
2308
|
+
} else if (error.message.includes("Network Error")) {
|
|
2309
|
+
ElMessage.error("网络错误!请稍后重试");
|
|
2310
|
+
}
|
|
2311
|
+
if (error.response) {
|
|
2312
|
+
checkStatus(error.response.status);
|
|
2313
|
+
}
|
|
2314
|
+
if (!window.navigator.onLine) {
|
|
2315
|
+
ElNotification({
|
|
2316
|
+
title: "提示",
|
|
2317
|
+
message: "当前网络似乎开小差了",
|
|
2318
|
+
type: "warning",
|
|
2319
|
+
duration: 5e3
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
return Promise.reject(error);
|
|
1619
2323
|
}
|
|
1620
2324
|
);
|
|
1621
2325
|
}
|
|
1622
|
-
handleOverdueResponse(
|
|
1623
|
-
|
|
2326
|
+
handleOverdueResponse(data) {
|
|
2327
|
+
removeToken();
|
|
2328
|
+
jumpToLogin();
|
|
2329
|
+
ElNotification({
|
|
1624
2330
|
title: "登录过期提醒",
|
|
1625
|
-
message:
|
|
2331
|
+
message: data.resultMsg || "当前登录失效",
|
|
1626
2332
|
type: "warning",
|
|
1627
2333
|
duration: 5e3
|
|
1628
|
-
})
|
|
2334
|
+
});
|
|
2335
|
+
return Promise.reject(data);
|
|
1629
2336
|
}
|
|
1630
|
-
handleErrorResponse(
|
|
1631
|
-
|
|
2337
|
+
handleErrorResponse(data) {
|
|
2338
|
+
ElMessage.error(data.resultMsg);
|
|
2339
|
+
return Promise.reject(data);
|
|
1632
2340
|
}
|
|
1633
2341
|
/**
|
|
1634
2342
|
*
|
|
@@ -1637,8 +2345,8 @@ class Fn {
|
|
|
1637
2345
|
* @param options : AxiosRequestConfig
|
|
1638
2346
|
* @description get 请求
|
|
1639
2347
|
*/
|
|
1640
|
-
get(
|
|
1641
|
-
return this.service.get(
|
|
2348
|
+
get(url, params, options = {}) {
|
|
2349
|
+
return this.service.get(url, __spreadValues({ params }, options));
|
|
1642
2350
|
}
|
|
1643
2351
|
/**
|
|
1644
2352
|
*
|
|
@@ -1647,8 +2355,8 @@ class Fn {
|
|
|
1647
2355
|
* @param options : AxiosRequestConfig
|
|
1648
2356
|
* @description post 请求
|
|
1649
2357
|
*/
|
|
1650
|
-
post(
|
|
1651
|
-
return this.service.post(
|
|
2358
|
+
post(url, params, options = {}) {
|
|
2359
|
+
return this.service.post(url, params, options);
|
|
1652
2360
|
}
|
|
1653
2361
|
/**
|
|
1654
2362
|
*
|
|
@@ -1656,8 +2364,8 @@ class Fn {
|
|
|
1656
2364
|
* @param params
|
|
1657
2365
|
* @param options : AxiosRequestConfig
|
|
1658
2366
|
*/
|
|
1659
|
-
put(
|
|
1660
|
-
return this.service.put(
|
|
2367
|
+
put(url, params, options = {}) {
|
|
2368
|
+
return this.service.put(url, params, options);
|
|
1661
2369
|
}
|
|
1662
2370
|
/**
|
|
1663
2371
|
*
|
|
@@ -1665,18 +2373,18 @@ class Fn {
|
|
|
1665
2373
|
* @param params
|
|
1666
2374
|
* @param options : AxiosRequestConfig
|
|
1667
2375
|
*/
|
|
1668
|
-
delete(
|
|
1669
|
-
return this.service.delete(
|
|
2376
|
+
delete(url, params, options = {}) {
|
|
2377
|
+
return this.service.delete(url, __spreadValues({ params }, options));
|
|
1670
2378
|
}
|
|
1671
2379
|
}
|
|
1672
|
-
const
|
|
2380
|
+
const http = new YxHttp(config);
|
|
1673
2381
|
export {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
2382
|
+
BC_LANG_NAME as B,
|
|
2383
|
+
URL as U,
|
|
2384
|
+
getSystemConfig as a,
|
|
2385
|
+
BC_THEME_NAME as b,
|
|
2386
|
+
getUserIsHaveBtnPower as g,
|
|
2387
|
+
http as h,
|
|
2388
|
+
index as i,
|
|
2389
|
+
setSystemConfig as s
|
|
1682
2390
|
};
|