yxuse 3.0.41 → 3.0.42

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.
Files changed (160) hide show
  1. package/lib/_commonjsHelpers.cjs.js +2 -0
  2. package/lib/_commonjsHelpers.cjs.js.map +1 -0
  3. package/lib/_commonjsHelpers.es.js +34 -0
  4. package/lib/_commonjsHelpers.es.js.map +1 -0
  5. package/lib/api.cjs.js +2 -1
  6. package/lib/api.cjs.js.map +1 -0
  7. package/lib/api.es.js +3 -2
  8. package/lib/api.es.js.map +1 -0
  9. package/lib/app.cjs.js +2 -1
  10. package/lib/app.cjs.js.map +1 -0
  11. package/lib/app.es.js +2 -1
  12. package/lib/app.es.js.map +1 -0
  13. package/lib/components.cjs.js +2 -1
  14. package/lib/components.cjs.js.map +1 -0
  15. package/lib/components.es.js +7 -6
  16. package/lib/components.es.js.map +1 -0
  17. package/lib/dayjs.min.cjs.js +2 -0
  18. package/lib/dayjs.min.cjs.js.map +1 -0
  19. package/lib/dayjs.min.es.js +283 -0
  20. package/lib/dayjs.min.es.js.gz +0 -0
  21. package/lib/dayjs.min.es.js.map +1 -0
  22. package/lib/directives.cjs.js +2 -1
  23. package/lib/directives.cjs.js.map +1 -0
  24. package/lib/directives.es.js +2 -1
  25. package/lib/directives.es.js.map +1 -0
  26. package/lib/hooks.cjs.js +2 -1
  27. package/lib/hooks.cjs.js.map +1 -0
  28. package/lib/hooks.es.js +2 -1
  29. package/lib/hooks.es.js.map +1 -0
  30. package/lib/index.cjs.js +2 -1
  31. package/lib/index.cjs.js.map +1 -0
  32. package/lib/index.cjs10.js +2 -1
  33. package/lib/index.cjs10.js.map +1 -0
  34. package/lib/index.cjs11.js +2 -1
  35. package/lib/index.cjs11.js.map +1 -0
  36. package/lib/index.cjs12.js +8 -1
  37. package/lib/index.cjs12.js.gz +0 -0
  38. package/lib/index.cjs12.js.map +1 -0
  39. package/lib/index.cjs13.js +2 -1
  40. package/lib/index.cjs13.js.map +1 -0
  41. package/lib/index.cjs14.js +2 -0
  42. package/lib/index.cjs14.js.map +1 -0
  43. package/lib/index.cjs2.js +2 -1
  44. package/lib/index.cjs2.js.map +1 -0
  45. package/lib/index.cjs3.js +2 -1
  46. package/lib/index.cjs3.js.map +1 -0
  47. package/lib/index.cjs4.js +2 -1
  48. package/lib/index.cjs4.js.map +1 -0
  49. package/lib/index.cjs5.js +6 -10
  50. package/lib/index.cjs5.js.gz +0 -0
  51. package/lib/index.cjs5.js.map +1 -0
  52. package/lib/index.cjs6.js +5 -1
  53. package/lib/index.cjs6.js.gz +0 -0
  54. package/lib/index.cjs6.js.map +1 -0
  55. package/lib/index.cjs7.js +17 -1
  56. package/lib/index.cjs7.js.gz +0 -0
  57. package/lib/index.cjs7.js.map +1 -0
  58. package/lib/index.cjs8.js +2 -1
  59. package/lib/index.cjs8.js.map +1 -0
  60. package/lib/index.cjs9.js +2 -1
  61. package/lib/index.cjs9.js.map +1 -0
  62. package/lib/index.es.js +8 -17
  63. package/lib/index.es.js.map +1 -0
  64. package/lib/index.es10.js +11 -298
  65. package/lib/index.es10.js.map +1 -0
  66. package/lib/index.es11.js +16 -2363
  67. package/lib/index.es11.js.map +1 -0
  68. package/lib/index.es12.js +5022 -152
  69. package/lib/index.es12.js.gz +0 -0
  70. package/lib/index.es12.js.map +1 -0
  71. package/lib/index.es13.js +231 -20
  72. package/lib/index.es13.js.map +1 -0
  73. package/lib/index.es14.js +23 -0
  74. package/lib/index.es14.js.map +1 -0
  75. package/lib/index.es2.js +6 -2
  76. package/lib/index.es2.js.map +1 -0
  77. package/lib/index.es3.js +3 -2
  78. package/lib/index.es3.js.map +1 -0
  79. package/lib/index.es4.js +3 -2
  80. package/lib/index.es4.js.map +1 -0
  81. package/lib/index.es5.js +16556 -4257
  82. package/lib/index.es5.js.gz +0 -0
  83. package/lib/index.es5.js.map +1 -0
  84. package/lib/index.es6.js +20610 -581
  85. package/lib/index.es6.js.gz +0 -0
  86. package/lib/index.es6.js.map +1 -0
  87. package/lib/index.es7.js +5386 -17
  88. package/lib/index.es7.js.gz +0 -0
  89. package/lib/index.es7.js.map +1 -0
  90. package/lib/index.es8.js +25 -4
  91. package/lib/index.es8.js.map +1 -0
  92. package/lib/index.es9.js +5 -9
  93. package/lib/index.es9.js.map +1 -0
  94. package/lib/style.css +1 -1
  95. package/lib/style.css.gz +0 -0
  96. package/lib/theme.cjs.js +2 -1
  97. package/lib/theme.cjs.js.map +1 -0
  98. package/lib/theme.es.js +10 -8
  99. package/lib/theme.es.js.map +1 -0
  100. package/lib/translate.cjs.js +2 -1
  101. package/lib/translate.cjs.js.map +1 -0
  102. package/lib/translate.es.js +12 -6
  103. package/lib/translate.es.js.map +1 -0
  104. package/lib/utils.cjs.js +2 -1
  105. package/lib/utils.cjs.js.map +1 -0
  106. package/lib/utils.es.js +9 -5
  107. package/lib/utils.es.js.map +1 -0
  108. package/lib/yxIcon.cjs.js +2 -1
  109. package/lib/yxIcon.cjs.js.map +1 -0
  110. package/lib/yxIcon.es.js +3 -2
  111. package/lib/yxIcon.es.js.map +1 -0
  112. package/lib/yxi18n.cjs.js +2 -0
  113. package/lib/yxi18n.cjs.js.map +1 -0
  114. package/lib/yxi18n.es.js +6 -0
  115. package/lib/yxi18n.es.js.map +1 -0
  116. package/package.json +11 -4
  117. package/types/api/auth/index.d.ts +2 -0
  118. package/types/components/Common/DynamicComponent/index.vue.d.ts +5 -4
  119. package/types/components/Toolbar/index.d.ts +1 -0
  120. package/types/components/Toolbar/src/index.vue.d.ts +1 -1
  121. package/types/components/Update/index.d.ts +1 -1
  122. package/types/components/Update/index.vue.d.ts +1 -1
  123. package/types/components/YxDialog/index.d.ts +3 -3
  124. package/types/components/YxDialog/index.vue.d.ts +4 -3
  125. package/types/components/YxDrawer/index.d.ts +3 -0
  126. package/types/components/YxDrawer/index.vue.d.ts +14 -0
  127. package/types/components/YxDrawer/type.d.ts +18 -0
  128. package/types/components/YxForm/index.d.ts +3 -3
  129. package/types/components/YxForm/index.vue.d.ts +43 -0
  130. package/types/components/YxForm/type.d.ts +66 -0
  131. package/types/components/YxIcon/index.d.ts +3 -3
  132. package/types/components/YxSearchForm/index.d.ts +3 -3
  133. package/types/components/YxSearchForm/index.vue.d.ts +8 -7
  134. package/types/components/YxTable/index.d.ts +3 -3
  135. package/types/components/YxTable/index.vue.d.ts +12 -8
  136. package/types/components/YxTable/type.d.ts +13 -3
  137. package/types/components/YxUpload/index.d.ts +3 -3
  138. package/types/components/YxUpload/index.vue.d.ts +7 -4
  139. package/types/components/YxUpload/type.d.ts +7 -1
  140. package/types/components/index.d.ts +9 -9
  141. package/types/components/type.d.ts +5 -5
  142. package/types/directives/index.d.ts +2 -1
  143. package/types/directives/modules/auth.d.ts +2 -1
  144. package/types/hooks/index.d.ts +1 -1
  145. package/types/hooks/useTime/index.d.ts +1 -1
  146. package/types/index.d.ts +12 -12
  147. package/types/theme/config.d.ts +2 -0
  148. package/types/theme/index.d.ts +2 -1
  149. package/types/translate/index.d.ts +3 -1
  150. package/types/utils/common/index.d.ts +19 -0
  151. package/types/utils/common/util.d.ts +2 -1
  152. package/types/utils/excel/index.d.ts +35 -0
  153. package/types/utils/http/config.d.ts +1 -0
  154. package/types/utils/http/index.d.ts +2 -1
  155. package/types/utils/index.d.ts +3 -3
  156. package/types/yxIcon/index.d.ts +2 -1
  157. package/types/yxi18n/index.d.ts +2 -4
  158. package/lib/index.cjs11.js.gz +0 -0
  159. package/lib/index.es10.js.gz +0 -0
  160. package/lib/index.es11.js.gz +0 -0
package/lib/index.es11.js CHANGED
@@ -1,2366 +1,19 @@
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]);
14
- }
15
- return a;
1
+ import { ref } from "vue";
2
+ import { d as dayjs } from "./dayjs.min.es.js";
3
+ const time = ref("");
4
+ let _timer;
5
+ const useTime = () => {
6
+ const timedExecution = () => {
7
+ _timer = setTimeout(() => {
8
+ time.value = dayjs().format("YYYY-MM-DD HH:mm:ss");
9
+ _timer && clearTimeout(_timer);
10
+ timedExecution();
11
+ }, 1e3);
12
+ };
13
+ timedExecution();
14
+ return { time };
16
15
  };
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);
42
- };
43
- }
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);
59
- }
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;
69
- }
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") {
95
- return;
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
- }
114
- }
115
- }
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
- }
127
- return null;
128
- }
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
- }
148
- };
149
- for (let i = 0, l = arguments.length; i < l; i++) {
150
- arguments[i] && forEach(arguments[i], assignValue);
151
- }
152
- return result;
153
- }
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;
185
- do {
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;
193
- }
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;
258
- }
259
- });
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;
286
- });
287
- };
288
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
289
- return obj;
290
- };
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]);
314
- }
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) {
320
- return;
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;
331
- }
332
- }
333
- return source;
334
- };
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,
374
- // an alias to avoid ESLint no-prototype-builtins detection
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
388
- };
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);
402
- }
403
- utils.inherits(AxiosError, Error, {
404
- toJSON: function toJSON() {
405
- return {
406
- // Standard
407
- message: this.message,
408
- name: this.name,
409
- // Microsoft
410
- description: this.description,
411
- number: this.number,
412
- // Mozilla
413
- fileName: this.fileName,
414
- lineNumber: this.lineNumber,
415
- columnNumber: this.columnNumber,
416
- stack: this.stack,
417
- // Axios
418
- config: utils.toJSONObject(this.config),
419
- code: this.code,
420
- status: this.response && this.response.status ? this.response.status : null
421
- };
422
- }
423
- });
424
- const prototype$1 = AxiosError.prototype;
425
- const descriptors = {};
426
- [
427
- "ERR_BAD_OPTION_VALUE",
428
- "ERR_BAD_OPTION",
429
- "ECONNABORTED",
430
- "ETIMEDOUT",
431
- "ERR_NETWORK",
432
- "ERR_FR_TOO_MANY_REDIRECTS",
433
- "ERR_DEPRECATED",
434
- "ERR_BAD_RESPONSE",
435
- "ERR_BAD_REQUEST",
436
- "ERR_CANCELED",
437
- "ERR_NOT_SUPPORT",
438
- "ERR_INVALID_URL"
439
- // eslint-disable-next-line func-names
440
- ].forEach((code) => {
441
- descriptors[code] = { value: code };
442
- });
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;
457
- };
458
- const httpAdapter = null;
459
- function isVisitable(thing) {
460
- return utils.isPlainObject(thing) || utils.isArray(thing);
461
- }
462
- function removeBrackets(key) {
463
- return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
464
- }
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 ? "." : "");
471
- }
472
- function isFlatArray(arr) {
473
- return utils.isArray(arr) && !arr.some(isVisitable);
474
- }
475
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
476
- return /^is[A-Z]/.test(prop);
477
- });
478
- function toFormData(obj, formData, options) {
479
- if (!utils.isObject(obj)) {
480
- throw new TypeError("target must be an object");
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]);
489
- });
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)) {
497
- throw new TypeError("visitor must be a function");
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(
522
- // eslint-disable-next-line no-nested-ternary
523
- indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
524
- convertValue(el)
525
- );
526
- });
527
- return false;
528
- }
529
- }
530
- if (isVisitable(value)) {
531
- return true;
532
- }
533
- formData.append(renderKey(path, key, dots), convertValue(value));
534
- return false;
535
- }
536
- const stack = [];
537
- const exposedHelpers = Object.assign(predicates, {
538
- defaultVisitor,
539
- convertValue,
540
- isVisitable
541
- });
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)) {
563
- throw new TypeError("data must be an object");
564
- }
565
- build(obj);
566
- return formData;
567
- }
568
- function encode$1(str) {
569
- const charMap = {
570
- "!": "%21",
571
- "'": "%27",
572
- "(": "%28",
573
- ")": "%29",
574
- "~": "%7E",
575
- "%20": "+",
576
- "%00": "\0"
577
- };
578
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
579
- return charMap[match];
580
- });
581
- }
582
- function AxiosURLSearchParams(params, options) {
583
- this._pairs = [];
584
- params && toFormData(params, this, options);
585
- }
586
- const prototype = AxiosURLSearchParams.prototype;
587
- prototype.append = function append(name, value) {
588
- this._pairs.push([name, value]);
589
- };
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]);
596
- }, "").join("&");
597
- };
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, "]");
600
- }
601
- function buildURL(url, params, options) {
602
- if (!params) {
603
- return url;
604
- }
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;
621
- }
622
- class InterceptorManager {
623
- constructor() {
624
- this.handlers = [];
625
- }
626
- /**
627
- * Add a new interceptor to the stack
628
- *
629
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
630
- * @param {Function} rejected The function to handle `reject` for a `Promise`
631
- *
632
- * @return {Number} An ID used to remove interceptor later
633
- */
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;
642
- }
643
- /**
644
- * Remove an interceptor from the stack
645
- *
646
- * @param {Number} id The ID that was returned by `use`
647
- *
648
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
649
- */
650
- eject(id) {
651
- if (this.handlers[id]) {
652
- this.handlers[id] = null;
653
- }
654
- }
655
- /**
656
- * Clear all interceptors from the stack
657
- *
658
- * @returns {void}
659
- */
660
- clear() {
661
- if (this.handlers) {
662
- this.handlers = [];
663
- }
664
- }
665
- /**
666
- * Iterate over all the registered interceptors
667
- *
668
- * This method is particularly useful for skipping over any
669
- * interceptors that may have become `null` calling `eject`.
670
- *
671
- * @param {Function} fn The function to call for each interceptor
672
- *
673
- * @returns {void}
674
- */
675
- forEach(fn) {
676
- utils.forEach(this.handlers, function forEachHandler(h) {
677
- if (h !== null) {
678
- fn(h);
679
- }
680
- });
681
- }
682
- }
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,
703
- classes: {
704
- URLSearchParams: URLSearchParams$1,
705
- FormData: FormData$1,
706
- Blob
707
- },
708
- isStandardBrowserEnv,
709
- isStandardBrowserWebWorkerEnv,
710
- protocols: ["http", "https", "file", "blob", "url", "data"]
711
- };
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);
720
- }
721
- }, options));
722
- }
723
- function parsePropPath(name) {
724
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
725
- return match[0] === "[]" ? "" : match[1] || match[0];
726
- });
727
- }
728
- function arrayToObject(arr) {
729
- const obj = {};
730
- const keys = Object.keys(arr);
731
- let i;
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;
739
- }
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;
769
- }
770
- return null;
771
- }
772
- const DEFAULT_CONTENT_TYPE = {
773
- "Content-Type": void 0
774
- };
775
- function stringifySafely(rawValue, parser, encoder) {
776
- if (utils.isString(rawValue)) {
777
- try {
778
- (parser || JSON.parse)(rawValue);
779
- return utils.trim(rawValue);
780
- } catch (e) {
781
- if (e.name !== "SyntaxError") {
782
- throw e;
783
- }
784
- }
785
- }
786
- return (encoder || JSON.stringify)(rawValue);
787
- }
788
- const defaults = {
789
- transitional: transitionalDefaults,
790
- adapter: ["xhr", "http"],
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(),
825
- this.formSerializer
826
- );
827
- }
828
- }
829
- if (isObjectPayload || hasJSONContentType) {
830
- headers.setContentType("application/json", false);
831
- return stringifySafely(data);
832
- }
833
- return data;
834
- }],
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;
842
- try {
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
- }
851
- }
852
- }
853
- return data;
854
- }],
855
- /**
856
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
857
- * timeout is not created.
858
- */
859
- timeout: 0,
860
- xsrfCookieName: "XSRF-TOKEN",
861
- xsrfHeaderName: "X-XSRF-TOKEN",
862
- maxContentLength: -1,
863
- maxBodyLength: -1,
864
- env: {
865
- FormData: platform.classes.FormData,
866
- Blob: platform.classes.Blob
867
- },
868
- validateStatus: function validateStatus(status) {
869
- return status >= 200 && status < 300;
870
- },
871
- headers: {
872
- common: {
873
- "Accept": "application/json, text/plain, */*"
874
- }
875
- }
876
- };
877
- utils.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
878
- defaults.headers[method] = {};
879
- });
880
- utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
881
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
882
- });
883
- const ignoreDuplicateOf = utils.toObjectSet([
884
- "age",
885
- "authorization",
886
- "content-length",
887
- "content-type",
888
- "etag",
889
- "expires",
890
- "from",
891
- "host",
892
- "if-modified-since",
893
- "if-unmodified-since",
894
- "last-modified",
895
- "location",
896
- "max-forwards",
897
- "proxy-authorization",
898
- "referer",
899
- "retry-after",
900
- "user-agent"
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();
929
- }
930
- function normalizeValue(value) {
931
- if (value === false || value == null) {
932
- return value;
933
- }
934
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
935
- }
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;
944
- }
945
- function isValidHeaderName(str) {
946
- return /^[-_a-zA-Z]+$/.test(str.trim());
947
- }
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);
961
- }
962
- }
963
- function formatHeader(header) {
964
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
965
- return char.toUpperCase() + str;
966
- });
967
- }
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);
974
- },
975
- configurable: true
976
- });
977
- });
978
- }
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) {
988
- throw new Error("header name must be a non-empty string");
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
- }
1023
- throw new TypeError("parser must be boolean|regexp|function");
1024
- }
1025
- }
1026
- }
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)));
1032
- }
1033
- return false;
1034
- }
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
- }
1046
- }
1047
- }
1048
- if (utils.isArray(header)) {
1049
- header.forEach(deleteHeader);
1050
- } else {
1051
- deleteHeader(header);
1052
- }
1053
- return deleted;
1054
- }
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
- }
1065
- }
1066
- return deleted;
1067
- }
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];
1076
- return;
1077
- }
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;
1086
- }
1087
- concat(...targets) {
1088
- return this.constructor.concat(this, ...targets);
1089
- }
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;
1096
- }
1097
- [Symbol.iterator]() {
1098
- return Object.entries(this.toJSON())[Symbol.iterator]();
1099
- }
1100
- toString() {
1101
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1102
- }
1103
- get [Symbol.toStringTag]() {
1104
- return "AxiosHeaders";
1105
- }
1106
- static from(thing) {
1107
- return thing instanceof this ? thing : new this(thing);
1108
- }
1109
- static concat(first, ...targets) {
1110
- const computed = new this(first);
1111
- targets.forEach((target) => computed.set(target));
1112
- return computed;
1113
- }
1114
- static accessor(header) {
1115
- const internals = this[$internals] = this[$internals] = {
1116
- accessors: {}
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
- }
1126
- }
1127
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1128
- return this;
1129
- }
1130
- }
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;
1144
- }
1145
- function isCancel(value) {
1146
- return !!(value && value.__CANCEL__);
1147
- }
1148
- function CanceledError(message, config2, request) {
1149
- AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config2, request);
1150
- this.name = "CanceledError";
1151
- }
1152
- utils.inherits(CanceledError, AxiosError, {
1153
- __CANCEL__: true
1154
- });
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
- }
1168
- }
1169
- const cookies = platform.isStandardBrowserEnv ? (
1170
- // Standard browser envs support document.cookie
1171
- /* @__PURE__ */ function standardBrowserEnv() {
1172
- return {
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("; ");
1189
- },
1190
- read: function read(name) {
1191
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1192
- return match ? decodeURIComponent(match[3]) : null;
1193
- },
1194
- remove: function remove(name) {
1195
- this.write(name, "", Date.now() - 864e5);
1196
- }
1197
- };
1198
- }()
1199
- ) : (
1200
- // Non standard browser env (web workers, react-native) lack needed support.
1201
- /* @__PURE__ */ function nonStandardBrowserEnv() {
1202
- return {
1203
- write: function write() {
1204
- },
1205
- read: function read() {
1206
- return null;
1207
- },
1208
- remove: function remove() {
1209
- }
1210
- };
1211
- }()
1212
- );
1213
- function isAbsoluteURL(url) {
1214
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1215
- }
1216
- function combineURLs(baseURL, relativeURL) {
1217
- return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1218
- }
1219
- function buildFullPath(baseURL, requestedURL) {
1220
- if (baseURL && !isAbsoluteURL(requestedURL)) {
1221
- return combineURLs(baseURL, requestedURL);
1222
- }
1223
- return requestedURL;
1224
- }
1225
- const isURLSameOrigin = platform.isStandardBrowserEnv ? (
1226
- // Standard browser envs have full support of the APIs needed to test
1227
- // whether the request URL is of the same origin as current location.
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
1248
- };
1249
- }
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;
1254
- };
1255
- }()
1256
- ) : (
1257
- // Non standard browser envs (web workers, react-native) lack needed support.
1258
- /* @__PURE__ */ function nonStandardBrowserEnv2() {
1259
- return function isURLSameOrigin2() {
1260
- return true;
1261
- };
1262
- }()
1263
- );
1264
- function parseProtocol(url) {
1265
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1266
- return match && match[1] || "";
1267
- }
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) {
1295
- return;
1296
- }
1297
- const passed = startedAt && now - startedAt;
1298
- return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1299
- };
1300
- }
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
1319
- };
1320
- data[isDownloadStream ? "download" : "upload"] = true;
1321
- listener(data);
1322
- };
1323
- }
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) {
1391
- return;
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;
1446
- };
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));
1455
- return;
1456
- }
1457
- request.send(requestData || null);
1458
- });
1459
- };
1460
- const knownAdapters = {
1461
- http: httpAdapter,
1462
- xhr: xhrAdapter
1463
- };
1464
- utils.forEach(knownAdapters, (fn, value) => {
1465
- if (fn) {
1466
- try {
1467
- Object.defineProperty(fn, "name", { value });
1468
- } catch (e) {
1469
- }
1470
- Object.defineProperty(fn, "adapterName", { value });
1471
- }
1472
- });
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}'`
1494
- );
1495
- }
1496
- if (!utils.isFunction(adapter)) {
1497
- throw new TypeError("adapter is not a function");
1498
- }
1499
- return adapter;
1500
- },
1501
- adapters: knownAdapters
1502
- };
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
- }
1510
- }
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);
1544
- });
1545
- }
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)
1615
- };
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;
1622
- }
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;
1628
- };
1629
- });
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
1640
- );
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;
1652
- };
1653
- };
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
- }
1669
- continue;
1670
- }
1671
- if (allowUnknown !== true) {
1672
- throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
1673
- }
1674
- }
1675
- }
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()
1687
- };
1688
- }
1689
- /**
1690
- * Dispatch a request
1691
- *
1692
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1693
- * @param {?Object} config
1694
- *
1695
- * @returns {Promise} The Promise to be fulfilled
1696
- */
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(
1726
- ["delete", "get", "head", "post", "put", "patch", "common"],
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;
1737
- }
1738
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1739
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1740
- });
1741
- const responseInterceptorChain = [];
1742
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1743
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1744
- });
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++];
1765
- try {
1766
- newConfig = onFulfilled(newConfig);
1767
- } catch (error) {
1768
- onRejected.call(this, error);
1769
- break;
1770
- }
1771
- }
1772
- try {
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++]);
1781
- }
1782
- return promise;
1783
- }
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);
1788
- }
1789
- }
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
1796
- }));
1797
- };
1798
- });
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 ? {
1805
- "Content-Type": "multipart/form-data"
1806
- } : {},
1807
- url,
1808
- data
1809
- }));
1810
- };
1811
- }
1812
- Axios.prototype[method] = generateHTTPMethod();
1813
- Axios.prototype[method + "Form"] = generateHTTPMethod(true);
1814
- });
1815
- class CancelToken {
1816
- constructor(executor) {
1817
- if (typeof executor !== "function") {
1818
- throw new TypeError("executor must be a function.");
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;
1832
- });
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) {
1846
- return;
1847
- }
1848
- token.reason = new CanceledError(message, config2, request);
1849
- resolvePromise(token.reason);
1850
- });
1851
- }
1852
- /**
1853
- * Throws a `CanceledError` if cancellation has been requested.
1854
- */
1855
- throwIfRequested() {
1856
- if (this.reason) {
1857
- throw this.reason;
1858
- }
1859
- }
1860
- /**
1861
- * Subscribe to the cancel signal
1862
- */
1863
- subscribe(listener) {
1864
- if (this.reason) {
1865
- listener(this.reason);
1866
- return;
1867
- }
1868
- if (this._listeners) {
1869
- this._listeners.push(listener);
1870
- } else {
1871
- this._listeners = [listener];
1872
- }
1873
- }
1874
- /**
1875
- * Unsubscribe from the cancel signal
1876
- */
1877
- unsubscribe(listener) {
1878
- if (!this._listeners) {
1879
- return;
1880
- }
1881
- const index2 = this._listeners.indexOf(listener);
1882
- if (index2 !== -1) {
1883
- this._listeners.splice(index2, 1);
1884
- }
1885
- }
1886
- /**
1887
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1888
- * cancels the `CancelToken`.
1889
- */
1890
- static source() {
1891
- let cancel;
1892
- const token = new CancelToken(function executor(c) {
1893
- cancel = c;
1894
- });
1895
- return {
1896
- token,
1897
- cancel
1898
- };
1899
- }
1900
- }
1901
- function spread(callback) {
1902
- return function wrap(arr) {
1903
- return callback.apply(null, arr);
1904
- };
1905
- }
1906
- function isAxiosError(payload) {
1907
- return utils.isObject(payload) && payload.isAxiosError === true;
1908
- }
1909
- const HttpStatusCode = {
1910
- Continue: 100,
1911
- SwitchingProtocols: 101,
1912
- Processing: 102,
1913
- EarlyHints: 103,
1914
- Ok: 200,
1915
- Created: 201,
1916
- Accepted: 202,
1917
- NonAuthoritativeInformation: 203,
1918
- NoContent: 204,
1919
- ResetContent: 205,
1920
- PartialContent: 206,
1921
- MultiStatus: 207,
1922
- AlreadyReported: 208,
1923
- ImUsed: 226,
1924
- MultipleChoices: 300,
1925
- MovedPermanently: 301,
1926
- Found: 302,
1927
- SeeOther: 303,
1928
- NotModified: 304,
1929
- UseProxy: 305,
1930
- Unused: 306,
1931
- TemporaryRedirect: 307,
1932
- PermanentRedirect: 308,
1933
- BadRequest: 400,
1934
- Unauthorized: 401,
1935
- PaymentRequired: 402,
1936
- Forbidden: 403,
1937
- NotFound: 404,
1938
- MethodNotAllowed: 405,
1939
- NotAcceptable: 406,
1940
- ProxyAuthenticationRequired: 407,
1941
- RequestTimeout: 408,
1942
- Conflict: 409,
1943
- Gone: 410,
1944
- LengthRequired: 411,
1945
- PreconditionFailed: 412,
1946
- PayloadTooLarge: 413,
1947
- UriTooLong: 414,
1948
- UnsupportedMediaType: 415,
1949
- RangeNotSatisfiable: 416,
1950
- ExpectationFailed: 417,
1951
- ImATeapot: 418,
1952
- MisdirectedRequest: 421,
1953
- UnprocessableEntity: 422,
1954
- Locked: 423,
1955
- FailedDependency: 424,
1956
- TooEarly: 425,
1957
- UpgradeRequired: 426,
1958
- PreconditionRequired: 428,
1959
- TooManyRequests: 429,
1960
- RequestHeaderFieldsTooLarge: 431,
1961
- UnavailableForLegalReasons: 451,
1962
- InternalServerError: 500,
1963
- NotImplemented: 501,
1964
- BadGateway: 502,
1965
- ServiceUnavailable: 503,
1966
- GatewayTimeout: 504,
1967
- HttpVersionNotSupported: 505,
1968
- VariantAlsoNegotiates: 506,
1969
- InsufficientStorage: 507,
1970
- LoopDetected: 508,
1971
- NotExtended: 510,
1972
- NetworkAuthenticationRequired: 511
1973
- };
1974
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
1975
- HttpStatusCode[value] = key;
1976
- });
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;
1986
- }
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);
1998
- };
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 = {
2007
- LOGIN_URL: `${window.location.origin}/ttc/cloud/#/login`,
2008
- HOME_URL: `${window.location.origin}/ttc/cloud/#/cloud`,
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())) {
2058
- return;
2059
- } else {
2060
- console.log("跳转至登录页", getLoginUrl());
2061
- location.replace(getLoginUrl());
2062
- }
2063
- } else {
2064
- console.log("开发环境!!!");
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();
2098
- try {
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
2107
- };
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],
2121
- meta: {
2122
- title: pageConfig.title,
2123
- icon: pageConfig.icon
2124
- },
2125
- component: viewModules[viewKey]
2126
- };
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({
2139
- __proto__: null,
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
2155
- }, Symbol.toStringTag, { value: "Module" }));
2156
- let loadingInstance;
2157
- const loadingOptions = {
2158
- lock: true,
2159
- text: "加载中...",
2160
- fullscreen: true,
2161
- background: "rgba(0, 0, 0, 0.6)"
2162
- };
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
- }
2182
- };
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 = {
2191
- // 默认地址请求地址,可在 .env.*** 文件中修改
2192
- // 设置超时时间(30s)
2193
- timeout: 3e4,
2194
- // 跨域时候允许携带凭证
2195
- withCredentials: true
2196
- };
2197
- const checkStatus = (status, msg) => {
2198
- switch (status) {
2199
- case 400:
2200
- ElMessage.error("请求失败!请您稍后重试");
2201
- break;
2202
- case 401:
2203
- if (!location.href.includes(getLoginUrl())) {
2204
- ElMessage.error("登录失效!请您重新登录");
2205
- jumpToLogin();
2206
- }
2207
- break;
2208
- case 403:
2209
- ElMessage.error("当前账号无权限访问!");
2210
- break;
2211
- case 404:
2212
- ElMessage.error("你所访问的资源不存在!");
2213
- break;
2214
- case 405:
2215
- ElMessage.error("请求方式错误!请您稍后重试");
2216
- break;
2217
- case 408:
2218
- ElMessage.error("请求超时!请您稍后重试");
2219
- break;
2220
- case 500:
2221
- ElMessage.error("服务异常!");
2222
- break;
2223
- case 502:
2224
- ElMessage.error("网关错误!");
2225
- break;
2226
- case 503:
2227
- ElMessage.error("服务不可用!");
2228
- break;
2229
- case 504:
2230
- ElMessage.error("网关超时!");
2231
- break;
2232
- default:
2233
- ElMessage.error("请求失败!");
2234
- }
2235
- };
2236
- class YxHttp {
2237
- constructor(config2) {
2238
- __publicField(this, "service");
2239
- /** 自定义响应处理map */
2240
- __publicField(this, "customResMap");
2241
- this.service = axios.create(config2);
2242
- this.setupInterceptors();
2243
- this.customResMap = {};
2244
- }
2245
- setupInterceptors() {
2246
- this.service.interceptors.request.use(
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;
2257
- },
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;
2275
- },
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);
2299
- }
2300
- );
2301
- }
2302
- handleOverdueResponse(data) {
2303
- removeToken();
2304
- jumpToLogin();
2305
- ElNotification({
2306
- title: "登录过期提醒",
2307
- message: data.resultMsg || "当前登录失效",
2308
- type: "warning",
2309
- duration: 5e3
2310
- });
2311
- return Promise.reject(data);
2312
- }
2313
- handleErrorResponse(data) {
2314
- ElMessage.error(data.resultMsg);
2315
- return Promise.reject(data);
2316
- }
2317
- /**
2318
- *
2319
- * @param url
2320
- * @param params
2321
- * @param options : AxiosRequestConfig
2322
- * @description get 请求
2323
- */
2324
- get(url, params, options = {}) {
2325
- return this.service.get(url, __spreadValues({ params }, options));
2326
- }
2327
- /**
2328
- *
2329
- * @param url
2330
- * @param params
2331
- * @param options : AxiosRequestConfig
2332
- * @description post 请求
2333
- */
2334
- post(url, params, options = {}) {
2335
- return this.service.post(url, params, options);
2336
- }
2337
- /**
2338
- *
2339
- * @param url
2340
- * @param params
2341
- * @param options : AxiosRequestConfig
2342
- */
2343
- put(url, params, options = {}) {
2344
- return this.service.put(url, params, options);
2345
- }
2346
- /**
2347
- *
2348
- * @param url
2349
- * @param params
2350
- * @param options : AxiosRequestConfig
2351
- */
2352
- delete(url, params, options = {}) {
2353
- return this.service.delete(url, __spreadValues({ params }, options));
2354
- }
2355
- }
2356
- const http = new YxHttp(config);
2357
16
  export {
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
17
+ useTime as u
2366
18
  };
19
+ //# sourceMappingURL=index.es11.js.map