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