@done-coding/request-ofetch 0.0.1-alpha.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +1389 -0
- package/lib/index.cjs +1 -0
- package/package.json +34 -20
- package/types/index.d.ts +0 -0
- package/types/main.d.ts +0 -0
- package/types/types.d.ts +0 -0
- package/es/index.js +0 -1958
- package/lib/index.js +0 -1
package/es/index.mjs
ADDED
|
@@ -0,0 +1,1389 @@
|
|
|
1
|
+
var $e = Object.defineProperty, Ne = (t, e, n) => e in t ? $e(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, w = (t, e, n) => (Ne(t, typeof e != "symbol" ? e + "" : e, n), n), y = /* @__PURE__ */ ((t) => (t.REQUEST_ERROR = "REQUEST_ERROR", t.NO_RESPONSE = "NO_RESPONSE", t.NO_RESPONSE_TIMEOUT = "NO_RESPONSE_TIMEOUT", t.NO_RESPONSE_OFFLINE = "NO_RESPONSE_OFFLINE", t.DISPATCH_RESPONSE = "DISPATCH_RESPONSE", t.DEAL_ERROR = "DEAL_ERROR", t.NO_BUSINESS_CODE = "NO_BUSINESS_CODE", t.NO_NETWORK_CODE = "NO_NETWORK_CODE", t.ABORT = "ABORT", t))(y || {});
|
|
2
|
+
class T extends Error {
|
|
3
|
+
constructor({ message: e, code: n, isBusinessError: r }) {
|
|
4
|
+
super(e), w(this, "code"), w(this, "isBusinessError"), w(this, "message"), this.message = e, this.code = n, this.isBusinessError = r, this.name = "DC Request ERROR";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class x extends T {
|
|
8
|
+
/**
|
|
9
|
+
* @param cause 错误原因
|
|
10
|
+
*/
|
|
11
|
+
constructor({
|
|
12
|
+
message: e,
|
|
13
|
+
code: n,
|
|
14
|
+
cause: r
|
|
15
|
+
}) {
|
|
16
|
+
super({ message: e, code: n, isBusinessError: !1 }), w(this, "cause"), this.cause = r;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class Ut extends T {
|
|
20
|
+
constructor({ message: e, code: n }) {
|
|
21
|
+
super({ message: e, code: n, isBusinessError: !0 });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var H = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
25
|
+
function Bt(t) {
|
|
26
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
27
|
+
}
|
|
28
|
+
var Ae = 200, st = "__lodash_hash_undefined__", Ie = 1 / 0, Kt = 9007199254740991, Pe = "[object Arguments]", je = "[object Function]", De = "[object GeneratorFunction]", Fe = "[object Symbol]", xe = /[\\^$.*+?()[\]{}|]/g, Le = /^\[object .+?Constructor\]$/, Ue = /^(?:0|[1-9]\d*)$/, Be = typeof H == "object" && H && H.Object === Object && H, Ke = typeof self == "object" && self && self.Object === Object && self, ut = Be || Ke || Function("return this")();
|
|
29
|
+
function Ge(t, e, n) {
|
|
30
|
+
switch (n.length) {
|
|
31
|
+
case 0:
|
|
32
|
+
return t.call(e);
|
|
33
|
+
case 1:
|
|
34
|
+
return t.call(e, n[0]);
|
|
35
|
+
case 2:
|
|
36
|
+
return t.call(e, n[0], n[1]);
|
|
37
|
+
case 3:
|
|
38
|
+
return t.call(e, n[0], n[1], n[2]);
|
|
39
|
+
}
|
|
40
|
+
return t.apply(e, n);
|
|
41
|
+
}
|
|
42
|
+
function He(t, e) {
|
|
43
|
+
var n = t ? t.length : 0;
|
|
44
|
+
return !!n && We(t, e, 0) > -1;
|
|
45
|
+
}
|
|
46
|
+
function Me(t, e, n) {
|
|
47
|
+
for (var r = -1, o = t ? t.length : 0; ++r < o; )
|
|
48
|
+
if (n(e, t[r]))
|
|
49
|
+
return !0;
|
|
50
|
+
return !1;
|
|
51
|
+
}
|
|
52
|
+
function Gt(t, e) {
|
|
53
|
+
for (var n = -1, r = t ? t.length : 0, o = Array(r); ++n < r; )
|
|
54
|
+
o[n] = e(t[n], n, t);
|
|
55
|
+
return o;
|
|
56
|
+
}
|
|
57
|
+
function ct(t, e) {
|
|
58
|
+
for (var n = -1, r = e.length, o = t.length; ++n < r; )
|
|
59
|
+
t[o + n] = e[n];
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
function qe(t, e, n, r) {
|
|
63
|
+
for (var o = t.length, a = n + (r ? 1 : -1); r ? a-- : ++a < o; )
|
|
64
|
+
if (e(t[a], a, t))
|
|
65
|
+
return a;
|
|
66
|
+
return -1;
|
|
67
|
+
}
|
|
68
|
+
function We(t, e, n) {
|
|
69
|
+
if (e !== e)
|
|
70
|
+
return qe(t, Qe, n);
|
|
71
|
+
for (var r = n - 1, o = t.length; ++r < o; )
|
|
72
|
+
if (t[r] === e)
|
|
73
|
+
return r;
|
|
74
|
+
return -1;
|
|
75
|
+
}
|
|
76
|
+
function Qe(t) {
|
|
77
|
+
return t !== t;
|
|
78
|
+
}
|
|
79
|
+
function Ye(t, e) {
|
|
80
|
+
for (var n = -1, r = Array(t); ++n < t; )
|
|
81
|
+
r[n] = e(n);
|
|
82
|
+
return r;
|
|
83
|
+
}
|
|
84
|
+
function ze(t) {
|
|
85
|
+
return function(e) {
|
|
86
|
+
return t(e);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function Je(t, e) {
|
|
90
|
+
return t.has(e);
|
|
91
|
+
}
|
|
92
|
+
function Ve(t, e) {
|
|
93
|
+
return t == null ? void 0 : t[e];
|
|
94
|
+
}
|
|
95
|
+
function Xe(t) {
|
|
96
|
+
var e = !1;
|
|
97
|
+
if (t != null && typeof t.toString != "function")
|
|
98
|
+
try {
|
|
99
|
+
e = !!(t + "");
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
return e;
|
|
103
|
+
}
|
|
104
|
+
function Ht(t, e) {
|
|
105
|
+
return function(n) {
|
|
106
|
+
return t(e(n));
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
var Ze = Array.prototype, ke = Function.prototype, W = Object.prototype, nt = ut["__core-js_shared__"], mt = function() {
|
|
110
|
+
var t = /[^.]+$/.exec(nt && nt.keys && nt.keys.IE_PROTO || "");
|
|
111
|
+
return t ? "Symbol(src)_1." + t : "";
|
|
112
|
+
}(), Mt = ke.toString, $ = W.hasOwnProperty, ft = W.toString, tn = RegExp(
|
|
113
|
+
"^" + Mt.call($).replace(xe, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
114
|
+
), Ct = ut.Symbol, en = Ht(Object.getPrototypeOf, Object), nn = W.propertyIsEnumerable, rn = Ze.splice, wt = Ct ? Ct.isConcatSpreadable : void 0, at = Object.getOwnPropertySymbols, Tt = Math.max, on = Wt(ut, "Map"), L = Wt(Object, "create");
|
|
115
|
+
function v(t) {
|
|
116
|
+
var e = -1, n = t ? t.length : 0;
|
|
117
|
+
for (this.clear(); ++e < n; ) {
|
|
118
|
+
var r = t[e];
|
|
119
|
+
this.set(r[0], r[1]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function an() {
|
|
123
|
+
this.__data__ = L ? L(null) : {};
|
|
124
|
+
}
|
|
125
|
+
function sn(t) {
|
|
126
|
+
return this.has(t) && delete this.__data__[t];
|
|
127
|
+
}
|
|
128
|
+
function un(t) {
|
|
129
|
+
var e = this.__data__;
|
|
130
|
+
if (L) {
|
|
131
|
+
var n = e[t];
|
|
132
|
+
return n === st ? void 0 : n;
|
|
133
|
+
}
|
|
134
|
+
return $.call(e, t) ? e[t] : void 0;
|
|
135
|
+
}
|
|
136
|
+
function cn(t) {
|
|
137
|
+
var e = this.__data__;
|
|
138
|
+
return L ? e[t] !== void 0 : $.call(e, t);
|
|
139
|
+
}
|
|
140
|
+
function fn(t, e) {
|
|
141
|
+
var n = this.__data__;
|
|
142
|
+
return n[t] = L && e === void 0 ? st : e, this;
|
|
143
|
+
}
|
|
144
|
+
v.prototype.clear = an;
|
|
145
|
+
v.prototype.delete = sn;
|
|
146
|
+
v.prototype.get = un;
|
|
147
|
+
v.prototype.has = cn;
|
|
148
|
+
v.prototype.set = fn;
|
|
149
|
+
function N(t) {
|
|
150
|
+
var e = -1, n = t ? t.length : 0;
|
|
151
|
+
for (this.clear(); ++e < n; ) {
|
|
152
|
+
var r = t[e];
|
|
153
|
+
this.set(r[0], r[1]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function ln() {
|
|
157
|
+
this.__data__ = [];
|
|
158
|
+
}
|
|
159
|
+
function hn(t) {
|
|
160
|
+
var e = this.__data__, n = Q(e, t);
|
|
161
|
+
if (n < 0)
|
|
162
|
+
return !1;
|
|
163
|
+
var r = e.length - 1;
|
|
164
|
+
return n == r ? e.pop() : rn.call(e, n, 1), !0;
|
|
165
|
+
}
|
|
166
|
+
function _n(t) {
|
|
167
|
+
var e = this.__data__, n = Q(e, t);
|
|
168
|
+
return n < 0 ? void 0 : e[n][1];
|
|
169
|
+
}
|
|
170
|
+
function pn(t) {
|
|
171
|
+
return Q(this.__data__, t) > -1;
|
|
172
|
+
}
|
|
173
|
+
function dn(t, e) {
|
|
174
|
+
var n = this.__data__, r = Q(n, t);
|
|
175
|
+
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
176
|
+
}
|
|
177
|
+
N.prototype.clear = ln;
|
|
178
|
+
N.prototype.delete = hn;
|
|
179
|
+
N.prototype.get = _n;
|
|
180
|
+
N.prototype.has = pn;
|
|
181
|
+
N.prototype.set = dn;
|
|
182
|
+
function A(t) {
|
|
183
|
+
var e = -1, n = t ? t.length : 0;
|
|
184
|
+
for (this.clear(); ++e < n; ) {
|
|
185
|
+
var r = t[e];
|
|
186
|
+
this.set(r[0], r[1]);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function gn() {
|
|
190
|
+
this.__data__ = {
|
|
191
|
+
hash: new v(),
|
|
192
|
+
map: new (on || N)(),
|
|
193
|
+
string: new v()
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function yn(t) {
|
|
197
|
+
return Y(this, t).delete(t);
|
|
198
|
+
}
|
|
199
|
+
function En(t) {
|
|
200
|
+
return Y(this, t).get(t);
|
|
201
|
+
}
|
|
202
|
+
function Rn(t) {
|
|
203
|
+
return Y(this, t).has(t);
|
|
204
|
+
}
|
|
205
|
+
function On(t, e) {
|
|
206
|
+
return Y(this, t).set(t, e), this;
|
|
207
|
+
}
|
|
208
|
+
A.prototype.clear = gn;
|
|
209
|
+
A.prototype.delete = yn;
|
|
210
|
+
A.prototype.get = En;
|
|
211
|
+
A.prototype.has = Rn;
|
|
212
|
+
A.prototype.set = On;
|
|
213
|
+
function M(t) {
|
|
214
|
+
var e = -1, n = t ? t.length : 0;
|
|
215
|
+
for (this.__data__ = new A(); ++e < n; )
|
|
216
|
+
this.add(t[e]);
|
|
217
|
+
}
|
|
218
|
+
function bn(t) {
|
|
219
|
+
return this.__data__.set(t, st), this;
|
|
220
|
+
}
|
|
221
|
+
function vn(t) {
|
|
222
|
+
return this.__data__.has(t);
|
|
223
|
+
}
|
|
224
|
+
M.prototype.add = M.prototype.push = bn;
|
|
225
|
+
M.prototype.has = vn;
|
|
226
|
+
function Sn(t, e) {
|
|
227
|
+
var n = lt(t) || Qt(t) ? Ye(t.length, String) : [], r = n.length, o = !!r;
|
|
228
|
+
for (var a in t)
|
|
229
|
+
(e || $.call(t, a)) && !(o && (a == "length" || Fn(a, r))) && n.push(a);
|
|
230
|
+
return n;
|
|
231
|
+
}
|
|
232
|
+
function Q(t, e) {
|
|
233
|
+
for (var n = t.length; n--; )
|
|
234
|
+
if (Hn(t[n][0], e))
|
|
235
|
+
return n;
|
|
236
|
+
return -1;
|
|
237
|
+
}
|
|
238
|
+
function mn(t, e, n, r) {
|
|
239
|
+
var o = -1, a = He, i = !0, s = t.length, c = [], h = e.length;
|
|
240
|
+
if (!s)
|
|
241
|
+
return c;
|
|
242
|
+
n && (e = Gt(e, ze(n))), r ? (a = Me, i = !1) : e.length >= Ae && (a = Je, i = !1, e = new M(e));
|
|
243
|
+
t:
|
|
244
|
+
for (; ++o < s; ) {
|
|
245
|
+
var u = t[o], f = n ? n(u) : u;
|
|
246
|
+
if (u = r || u !== 0 ? u : 0, i && f === f) {
|
|
247
|
+
for (var l = h; l--; )
|
|
248
|
+
if (e[l] === f)
|
|
249
|
+
continue t;
|
|
250
|
+
c.push(u);
|
|
251
|
+
} else
|
|
252
|
+
a(e, f, r) || c.push(u);
|
|
253
|
+
}
|
|
254
|
+
return c;
|
|
255
|
+
}
|
|
256
|
+
function qt(t, e, n, r, o) {
|
|
257
|
+
var a = -1, i = t.length;
|
|
258
|
+
for (n || (n = Dn), o || (o = []); ++a < i; ) {
|
|
259
|
+
var s = t[a];
|
|
260
|
+
e > 0 && n(s) ? e > 1 ? qt(s, e - 1, n, r, o) : ct(o, s) : r || (o[o.length] = s);
|
|
261
|
+
}
|
|
262
|
+
return o;
|
|
263
|
+
}
|
|
264
|
+
function Cn(t, e, n) {
|
|
265
|
+
var r = e(t);
|
|
266
|
+
return lt(t) ? r : ct(r, n(t));
|
|
267
|
+
}
|
|
268
|
+
function wn(t) {
|
|
269
|
+
if (!ht(t) || Ln(t))
|
|
270
|
+
return !1;
|
|
271
|
+
var e = zt(t) || Xe(t) ? tn : Le;
|
|
272
|
+
return e.test(Gn(t));
|
|
273
|
+
}
|
|
274
|
+
function Tn(t) {
|
|
275
|
+
if (!ht(t))
|
|
276
|
+
return Bn(t);
|
|
277
|
+
var e = Un(t), n = [];
|
|
278
|
+
for (var r in t)
|
|
279
|
+
r == "constructor" && (e || !$.call(t, r)) || n.push(r);
|
|
280
|
+
return n;
|
|
281
|
+
}
|
|
282
|
+
function $n(t, e) {
|
|
283
|
+
return t = Object(t), Nn(t, e, function(n, r) {
|
|
284
|
+
return r in t;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function Nn(t, e, n) {
|
|
288
|
+
for (var r = -1, o = e.length, a = {}; ++r < o; ) {
|
|
289
|
+
var i = e[r], s = t[i];
|
|
290
|
+
n(s, i) && (a[i] = s);
|
|
291
|
+
}
|
|
292
|
+
return a;
|
|
293
|
+
}
|
|
294
|
+
function An(t, e) {
|
|
295
|
+
return e = Tt(e === void 0 ? t.length - 1 : e, 0), function() {
|
|
296
|
+
for (var n = arguments, r = -1, o = Tt(n.length - e, 0), a = Array(o); ++r < o; )
|
|
297
|
+
a[r] = n[e + r];
|
|
298
|
+
r = -1;
|
|
299
|
+
for (var i = Array(e + 1); ++r < e; )
|
|
300
|
+
i[r] = n[r];
|
|
301
|
+
return i[e] = a, Ge(t, this, i);
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function In(t) {
|
|
305
|
+
return Cn(t, Qn, jn);
|
|
306
|
+
}
|
|
307
|
+
function Y(t, e) {
|
|
308
|
+
var n = t.__data__;
|
|
309
|
+
return xn(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
310
|
+
}
|
|
311
|
+
function Wt(t, e) {
|
|
312
|
+
var n = Ve(t, e);
|
|
313
|
+
return wn(n) ? n : void 0;
|
|
314
|
+
}
|
|
315
|
+
var Pn = at ? Ht(at, Object) : Vt, jn = at ? function(t) {
|
|
316
|
+
for (var e = []; t; )
|
|
317
|
+
ct(e, Pn(t)), t = en(t);
|
|
318
|
+
return e;
|
|
319
|
+
} : Vt;
|
|
320
|
+
function Dn(t) {
|
|
321
|
+
return lt(t) || Qt(t) || !!(wt && t && t[wt]);
|
|
322
|
+
}
|
|
323
|
+
function Fn(t, e) {
|
|
324
|
+
return e = e ?? Kt, !!e && (typeof t == "number" || Ue.test(t)) && t > -1 && t % 1 == 0 && t < e;
|
|
325
|
+
}
|
|
326
|
+
function xn(t) {
|
|
327
|
+
var e = typeof t;
|
|
328
|
+
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
329
|
+
}
|
|
330
|
+
function Ln(t) {
|
|
331
|
+
return !!mt && mt in t;
|
|
332
|
+
}
|
|
333
|
+
function Un(t) {
|
|
334
|
+
var e = t && t.constructor, n = typeof e == "function" && e.prototype || W;
|
|
335
|
+
return t === n;
|
|
336
|
+
}
|
|
337
|
+
function Bn(t) {
|
|
338
|
+
var e = [];
|
|
339
|
+
if (t != null)
|
|
340
|
+
for (var n in Object(t))
|
|
341
|
+
e.push(n);
|
|
342
|
+
return e;
|
|
343
|
+
}
|
|
344
|
+
function Kn(t) {
|
|
345
|
+
if (typeof t == "string" || Wn(t))
|
|
346
|
+
return t;
|
|
347
|
+
var e = t + "";
|
|
348
|
+
return e == "0" && 1 / t == -Ie ? "-0" : e;
|
|
349
|
+
}
|
|
350
|
+
function Gn(t) {
|
|
351
|
+
if (t != null) {
|
|
352
|
+
try {
|
|
353
|
+
return Mt.call(t);
|
|
354
|
+
} catch {
|
|
355
|
+
}
|
|
356
|
+
try {
|
|
357
|
+
return t + "";
|
|
358
|
+
} catch {
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return "";
|
|
362
|
+
}
|
|
363
|
+
function Hn(t, e) {
|
|
364
|
+
return t === e || t !== t && e !== e;
|
|
365
|
+
}
|
|
366
|
+
function Qt(t) {
|
|
367
|
+
return Mn(t) && $.call(t, "callee") && (!nn.call(t, "callee") || ft.call(t) == Pe);
|
|
368
|
+
}
|
|
369
|
+
var lt = Array.isArray;
|
|
370
|
+
function Yt(t) {
|
|
371
|
+
return t != null && qn(t.length) && !zt(t);
|
|
372
|
+
}
|
|
373
|
+
function Mn(t) {
|
|
374
|
+
return Jt(t) && Yt(t);
|
|
375
|
+
}
|
|
376
|
+
function zt(t) {
|
|
377
|
+
var e = ht(t) ? ft.call(t) : "";
|
|
378
|
+
return e == je || e == De;
|
|
379
|
+
}
|
|
380
|
+
function qn(t) {
|
|
381
|
+
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Kt;
|
|
382
|
+
}
|
|
383
|
+
function ht(t) {
|
|
384
|
+
var e = typeof t;
|
|
385
|
+
return !!t && (e == "object" || e == "function");
|
|
386
|
+
}
|
|
387
|
+
function Jt(t) {
|
|
388
|
+
return !!t && typeof t == "object";
|
|
389
|
+
}
|
|
390
|
+
function Wn(t) {
|
|
391
|
+
return typeof t == "symbol" || Jt(t) && ft.call(t) == Fe;
|
|
392
|
+
}
|
|
393
|
+
function Qn(t) {
|
|
394
|
+
return Yt(t) ? Sn(t, !0) : Tn(t);
|
|
395
|
+
}
|
|
396
|
+
var Yn = An(function(t, e) {
|
|
397
|
+
return t == null ? {} : (e = Gt(qt(e, 1), Kn), $n(t, mn(In(t), e)));
|
|
398
|
+
});
|
|
399
|
+
function Vt() {
|
|
400
|
+
return [];
|
|
401
|
+
}
|
|
402
|
+
var zn = Yn;
|
|
403
|
+
const Jn = /* @__PURE__ */ Bt(zn);
|
|
404
|
+
var E = /* @__PURE__ */ ((t) => (t.LOG = "log", t.WARN = "warn", t.ERROR = "error", t))(E || {}), _ = /* @__PURE__ */ ((t) => (t.BEFORE = "1 发起请求前阶段", t.BEFORE_ERROR = "1.1 发起请求前阶段出错", t.BEFORE_ERROR_ORIGIN = "1.1.1 发起请求前阶段-原始错误", t.BEFORE_ERROR_PACK = "1.1.2 发起请求前阶段-包装后错误", t.NETWORK = "2 网络阶段", t.NETWORK_SUCCESS = "2.1 网络成功阶段", t.NETWORK_SUCCESS_BUSINESS_SUCCESS = "2.1.1 网路成功且业务成功", t.NETWORK_SUCCESS_BUSINESS_FAIL = "2.1.2 网络成功但业务失败", t.NETWORK_SUCCESS_DISPATCH_ERROR = "2.1.3 网络成功但分发业务结果出错", t.NETWORK_ERROR = "2.2 网络出错阶段", t.NETWORK_ERROR_ORIGIN = "2.2.1 网络出错阶段-原始错误", t.NETWORK_ERROR_PACK = "2.2.2 网络出错阶段-包装后错误", t.DEAL_ERROR = "3 处理错误阶段", t.DEAL_ERROR_ERROR = "3.1 处理错误阶段出错", t.DEAL_ERROR_RESULT = "3.2 处理错误结果", t.DEAL_ERROR_RESULT_RELOAD = "3.2.1 处理错误结果-重新请求", t.DEAL_ERROR_RESULT_CONTINUE = "3.2.2 处理错误结果-正常抛错", t))(_ || {});
|
|
405
|
+
const g = ({
|
|
406
|
+
stage: t,
|
|
407
|
+
data: e
|
|
408
|
+
}, n = "log") => {
|
|
409
|
+
console[n](
|
|
410
|
+
t,
|
|
411
|
+
e instanceof T ? Jn({ ...e }, "cause") : e
|
|
412
|
+
);
|
|
413
|
+
}, F = (t) => t instanceof Error ? t.message : "未知错误", Vn = (t, {
|
|
414
|
+
getBusinessCode: e,
|
|
415
|
+
getBusinessMsg: n,
|
|
416
|
+
getBusinessData: r,
|
|
417
|
+
businessSuccessCodeList: o = [200],
|
|
418
|
+
isSuccessBusinessCode: a
|
|
419
|
+
}, i) => {
|
|
420
|
+
i && g(
|
|
421
|
+
{ stage: _.NETWORK_SUCCESS, data: t },
|
|
422
|
+
E.LOG
|
|
423
|
+
);
|
|
424
|
+
try {
|
|
425
|
+
const s = e(t), c = n(t);
|
|
426
|
+
if (a ? a(s) : o.includes(s)) {
|
|
427
|
+
const h = {
|
|
428
|
+
code: s,
|
|
429
|
+
data: r(t),
|
|
430
|
+
message: c
|
|
431
|
+
};
|
|
432
|
+
return i && g(
|
|
433
|
+
{
|
|
434
|
+
stage: _.NETWORK_SUCCESS_BUSINESS_SUCCESS,
|
|
435
|
+
data: h
|
|
436
|
+
},
|
|
437
|
+
E.LOG
|
|
438
|
+
), h;
|
|
439
|
+
} else {
|
|
440
|
+
if (s === void 0)
|
|
441
|
+
throw new Error("业务code未定义");
|
|
442
|
+
const h = new Ut({
|
|
443
|
+
code: s,
|
|
444
|
+
message: c ?? "未知错误"
|
|
445
|
+
});
|
|
446
|
+
return i && g(
|
|
447
|
+
{
|
|
448
|
+
stage: _.NETWORK_SUCCESS_BUSINESS_FAIL,
|
|
449
|
+
data: h
|
|
450
|
+
},
|
|
451
|
+
E.ERROR
|
|
452
|
+
), Promise.reject(h);
|
|
453
|
+
}
|
|
454
|
+
} catch (s) {
|
|
455
|
+
i && g(
|
|
456
|
+
{
|
|
457
|
+
stage: _.NETWORK_SUCCESS_DISPATCH_ERROR,
|
|
458
|
+
data: s
|
|
459
|
+
},
|
|
460
|
+
E.ERROR
|
|
461
|
+
);
|
|
462
|
+
const c = new x({
|
|
463
|
+
code: y.DISPATCH_RESPONSE,
|
|
464
|
+
message: F(s) ?? "分发响应结果执行出错",
|
|
465
|
+
cause: s
|
|
466
|
+
});
|
|
467
|
+
return Promise.reject(c);
|
|
468
|
+
}
|
|
469
|
+
}, Ma = (t) => new Promise((e, n) => {
|
|
470
|
+
t({
|
|
471
|
+
success: (r) => e(r),
|
|
472
|
+
fail: (r) => n(r)
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
var Xt = 9007199254740991, Xn = "[object Arguments]", Zn = "[object Function]", kn = "[object GeneratorFunction]", tr = /^(?:0|[1-9]\d*)$/;
|
|
476
|
+
function er(t, e, n) {
|
|
477
|
+
switch (n.length) {
|
|
478
|
+
case 0:
|
|
479
|
+
return t.call(e);
|
|
480
|
+
case 1:
|
|
481
|
+
return t.call(e, n[0]);
|
|
482
|
+
case 2:
|
|
483
|
+
return t.call(e, n[0], n[1]);
|
|
484
|
+
case 3:
|
|
485
|
+
return t.call(e, n[0], n[1], n[2]);
|
|
486
|
+
}
|
|
487
|
+
return t.apply(e, n);
|
|
488
|
+
}
|
|
489
|
+
function nr(t, e) {
|
|
490
|
+
for (var n = -1, r = Array(t); ++n < t; )
|
|
491
|
+
r[n] = e(n);
|
|
492
|
+
return r;
|
|
493
|
+
}
|
|
494
|
+
function rr(t, e) {
|
|
495
|
+
return function(n) {
|
|
496
|
+
return t(e(n));
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
var z = Object.prototype, K = z.hasOwnProperty, Zt = z.toString, kt = z.propertyIsEnumerable, or = rr(Object.keys, Object), $t = Math.max, ar = !kt.call({ valueOf: 1 }, "valueOf");
|
|
500
|
+
function ir(t, e) {
|
|
501
|
+
var n = _r(t) || hr(t) ? nr(t.length, String) : [], r = n.length, o = !!r;
|
|
502
|
+
for (var a in t)
|
|
503
|
+
(e || K.call(t, a)) && !(o && (a == "length" || ee(a, r))) && n.push(a);
|
|
504
|
+
return n;
|
|
505
|
+
}
|
|
506
|
+
function te(t, e, n) {
|
|
507
|
+
var r = t[e];
|
|
508
|
+
(!(K.call(t, e) && re(r, n)) || n === void 0 && !(e in t)) && (t[e] = n);
|
|
509
|
+
}
|
|
510
|
+
function sr(t) {
|
|
511
|
+
if (!ne(t))
|
|
512
|
+
return or(t);
|
|
513
|
+
var e = [];
|
|
514
|
+
for (var n in Object(t))
|
|
515
|
+
K.call(t, n) && n != "constructor" && e.push(n);
|
|
516
|
+
return e;
|
|
517
|
+
}
|
|
518
|
+
function ur(t, e) {
|
|
519
|
+
return e = $t(e === void 0 ? t.length - 1 : e, 0), function() {
|
|
520
|
+
for (var n = arguments, r = -1, o = $t(n.length - e, 0), a = Array(o); ++r < o; )
|
|
521
|
+
a[r] = n[e + r];
|
|
522
|
+
r = -1;
|
|
523
|
+
for (var i = Array(e + 1); ++r < e; )
|
|
524
|
+
i[r] = n[r];
|
|
525
|
+
return i[e] = a, er(t, this, i);
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function cr(t, e, n, r) {
|
|
529
|
+
n || (n = {});
|
|
530
|
+
for (var o = -1, a = e.length; ++o < a; ) {
|
|
531
|
+
var i = e[o], s = r ? r(n[i], t[i], i, n, t) : void 0;
|
|
532
|
+
te(n, i, s === void 0 ? t[i] : s);
|
|
533
|
+
}
|
|
534
|
+
return n;
|
|
535
|
+
}
|
|
536
|
+
function fr(t) {
|
|
537
|
+
return ur(function(e, n) {
|
|
538
|
+
var r = -1, o = n.length, a = o > 1 ? n[o - 1] : void 0, i = o > 2 ? n[2] : void 0;
|
|
539
|
+
for (a = t.length > 3 && typeof a == "function" ? (o--, a) : void 0, i && lr(n[0], n[1], i) && (a = o < 3 ? void 0 : a, o = 1), e = Object(e); ++r < o; ) {
|
|
540
|
+
var s = n[r];
|
|
541
|
+
s && t(e, s, r, a);
|
|
542
|
+
}
|
|
543
|
+
return e;
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
function ee(t, e) {
|
|
547
|
+
return e = e ?? Xt, !!e && (typeof t == "number" || tr.test(t)) && t > -1 && t % 1 == 0 && t < e;
|
|
548
|
+
}
|
|
549
|
+
function lr(t, e, n) {
|
|
550
|
+
if (!oe(n))
|
|
551
|
+
return !1;
|
|
552
|
+
var r = typeof e;
|
|
553
|
+
return (r == "number" ? J(n) && ee(e, n.length) : r == "string" && e in n) ? re(n[e], t) : !1;
|
|
554
|
+
}
|
|
555
|
+
function ne(t) {
|
|
556
|
+
var e = t && t.constructor, n = typeof e == "function" && e.prototype || z;
|
|
557
|
+
return t === n;
|
|
558
|
+
}
|
|
559
|
+
function re(t, e) {
|
|
560
|
+
return t === e || t !== t && e !== e;
|
|
561
|
+
}
|
|
562
|
+
function hr(t) {
|
|
563
|
+
return pr(t) && K.call(t, "callee") && (!kt.call(t, "callee") || Zt.call(t) == Xn);
|
|
564
|
+
}
|
|
565
|
+
var _r = Array.isArray;
|
|
566
|
+
function J(t) {
|
|
567
|
+
return t != null && gr(t.length) && !dr(t);
|
|
568
|
+
}
|
|
569
|
+
function pr(t) {
|
|
570
|
+
return yr(t) && J(t);
|
|
571
|
+
}
|
|
572
|
+
function dr(t) {
|
|
573
|
+
var e = oe(t) ? Zt.call(t) : "";
|
|
574
|
+
return e == Zn || e == kn;
|
|
575
|
+
}
|
|
576
|
+
function gr(t) {
|
|
577
|
+
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Xt;
|
|
578
|
+
}
|
|
579
|
+
function oe(t) {
|
|
580
|
+
var e = typeof t;
|
|
581
|
+
return !!t && (e == "object" || e == "function");
|
|
582
|
+
}
|
|
583
|
+
function yr(t) {
|
|
584
|
+
return !!t && typeof t == "object";
|
|
585
|
+
}
|
|
586
|
+
var Er = fr(function(t, e) {
|
|
587
|
+
if (ar || ne(e) || J(e)) {
|
|
588
|
+
cr(e, Rr(e), t);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
for (var n in e)
|
|
592
|
+
K.call(e, n) && te(t, n, e[n]);
|
|
593
|
+
});
|
|
594
|
+
function Rr(t) {
|
|
595
|
+
return J(t) ? ir(t) : sr(t);
|
|
596
|
+
}
|
|
597
|
+
var Or = Er;
|
|
598
|
+
const br = /* @__PURE__ */ Bt(Or), vr = (t, e) => {
|
|
599
|
+
try {
|
|
600
|
+
return t();
|
|
601
|
+
} catch (n) {
|
|
602
|
+
return e && g(
|
|
603
|
+
{
|
|
604
|
+
stage: _.DEAL_ERROR_ERROR,
|
|
605
|
+
data: n
|
|
606
|
+
},
|
|
607
|
+
E.ERROR
|
|
608
|
+
), {
|
|
609
|
+
canShowErrorToast: !0,
|
|
610
|
+
newError: new x({
|
|
611
|
+
code: y.DEAL_ERROR,
|
|
612
|
+
message: F(n) ?? "处理RequestFailResult错误时出错",
|
|
613
|
+
cause: n
|
|
614
|
+
}),
|
|
615
|
+
reload: !1
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
class Sr {
|
|
620
|
+
constructor(e) {
|
|
621
|
+
w(this, "options"), w(this, "request", async (n, r = !1) => {
|
|
622
|
+
var o;
|
|
623
|
+
r && g({
|
|
624
|
+
stage: _.BEFORE,
|
|
625
|
+
data: n
|
|
626
|
+
});
|
|
627
|
+
const { uiConfig: a = {}, ...i } = n, s = br({}, this.uiConfig, a), c = {
|
|
628
|
+
uiConfig: s
|
|
629
|
+
}, h = {
|
|
630
|
+
...i,
|
|
631
|
+
BASE_PATH: this.basePath,
|
|
632
|
+
TIMEOUT: this.timeout,
|
|
633
|
+
debug: r
|
|
634
|
+
};
|
|
635
|
+
try {
|
|
636
|
+
return await this.issue(h, c);
|
|
637
|
+
} catch (u) {
|
|
638
|
+
const f = await vr(() => {
|
|
639
|
+
var l;
|
|
640
|
+
return r && g({
|
|
641
|
+
stage: _.DEAL_ERROR,
|
|
642
|
+
data: u
|
|
643
|
+
}), ((l = this.beforeError) == null ? void 0 : l.call(this, u, {
|
|
644
|
+
apiConfig: n,
|
|
645
|
+
extendConfig: c
|
|
646
|
+
})) || {
|
|
647
|
+
canShowErrorToast: !0,
|
|
648
|
+
newError: u
|
|
649
|
+
};
|
|
650
|
+
}, r);
|
|
651
|
+
if (f.reload)
|
|
652
|
+
return r && g({
|
|
653
|
+
stage: _.DEAL_ERROR_RESULT_RELOAD
|
|
654
|
+
}), this.request(n);
|
|
655
|
+
{
|
|
656
|
+
const { newError: l, canShowErrorToast: G = !0 } = f;
|
|
657
|
+
G && (s.errorToast ?? !0) && ((o = this.showToast) == null || o.call(this, l.message));
|
|
658
|
+
let p;
|
|
659
|
+
return l instanceof T ? p = l : l.isBusinessError ? p = new Ut(l) : p = new x(l), r && g({
|
|
660
|
+
stage: _.DEAL_ERROR_RESULT_CONTINUE,
|
|
661
|
+
data: p
|
|
662
|
+
}), Promise.reject(p);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}), this.options = e;
|
|
666
|
+
}
|
|
667
|
+
get basePath() {
|
|
668
|
+
return this.options.basePath;
|
|
669
|
+
}
|
|
670
|
+
get timeout() {
|
|
671
|
+
return this.options.timeout;
|
|
672
|
+
}
|
|
673
|
+
get uiConfig() {
|
|
674
|
+
return this.options.uiConfig || {};
|
|
675
|
+
}
|
|
676
|
+
get issue() {
|
|
677
|
+
return this.options.issue;
|
|
678
|
+
}
|
|
679
|
+
get beforeError() {
|
|
680
|
+
return this.options.beforeError;
|
|
681
|
+
}
|
|
682
|
+
get showToast() {
|
|
683
|
+
return this.options.showToast;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const mr = (t) => new Sr(t);
|
|
687
|
+
var R = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
688
|
+
function ae(t) {
|
|
689
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
690
|
+
}
|
|
691
|
+
var Cr = 200, _t = "__lodash_hash_undefined__", wr = 1 / 0, ie = 9007199254740991, Tr = "[object Arguments]", $r = "[object Function]", Nr = "[object GeneratorFunction]", Ar = "[object Symbol]", Ir = /[\\^$.*+?()[\]{}|]/g, Pr = /^\[object .+?Constructor\]$/, jr = /^(?:0|[1-9]\d*)$/, Dr = typeof R == "object" && R && R.Object === Object && R, Fr = typeof self == "object" && self && self.Object === Object && self, pt = Dr || Fr || Function("return this")();
|
|
692
|
+
function xr(t, e, n) {
|
|
693
|
+
switch (n.length) {
|
|
694
|
+
case 0:
|
|
695
|
+
return t.call(e);
|
|
696
|
+
case 1:
|
|
697
|
+
return t.call(e, n[0]);
|
|
698
|
+
case 2:
|
|
699
|
+
return t.call(e, n[0], n[1]);
|
|
700
|
+
case 3:
|
|
701
|
+
return t.call(e, n[0], n[1], n[2]);
|
|
702
|
+
}
|
|
703
|
+
return t.apply(e, n);
|
|
704
|
+
}
|
|
705
|
+
function Lr(t, e) {
|
|
706
|
+
var n = t ? t.length : 0;
|
|
707
|
+
return !!n && Kr(t, e, 0) > -1;
|
|
708
|
+
}
|
|
709
|
+
function Ur(t, e, n) {
|
|
710
|
+
for (var r = -1, o = t ? t.length : 0; ++r < o; )
|
|
711
|
+
if (n(e, t[r]))
|
|
712
|
+
return !0;
|
|
713
|
+
return !1;
|
|
714
|
+
}
|
|
715
|
+
function se(t, e) {
|
|
716
|
+
for (var n = -1, r = t ? t.length : 0, o = Array(r); ++n < r; )
|
|
717
|
+
o[n] = e(t[n], n, t);
|
|
718
|
+
return o;
|
|
719
|
+
}
|
|
720
|
+
function dt(t, e) {
|
|
721
|
+
for (var n = -1, r = e.length, o = t.length; ++n < r; )
|
|
722
|
+
t[o + n] = e[n];
|
|
723
|
+
return t;
|
|
724
|
+
}
|
|
725
|
+
function Br(t, e, n, r) {
|
|
726
|
+
for (var o = t.length, a = n + (r ? 1 : -1); r ? a-- : ++a < o; )
|
|
727
|
+
if (e(t[a], a, t))
|
|
728
|
+
return a;
|
|
729
|
+
return -1;
|
|
730
|
+
}
|
|
731
|
+
function Kr(t, e, n) {
|
|
732
|
+
if (e !== e)
|
|
733
|
+
return Br(t, Gr, n);
|
|
734
|
+
for (var r = n - 1, o = t.length; ++r < o; )
|
|
735
|
+
if (t[r] === e)
|
|
736
|
+
return r;
|
|
737
|
+
return -1;
|
|
738
|
+
}
|
|
739
|
+
function Gr(t) {
|
|
740
|
+
return t !== t;
|
|
741
|
+
}
|
|
742
|
+
function Hr(t, e) {
|
|
743
|
+
for (var n = -1, r = Array(t); ++n < t; )
|
|
744
|
+
r[n] = e(n);
|
|
745
|
+
return r;
|
|
746
|
+
}
|
|
747
|
+
function Mr(t) {
|
|
748
|
+
return function(e) {
|
|
749
|
+
return t(e);
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function qr(t, e) {
|
|
753
|
+
return t.has(e);
|
|
754
|
+
}
|
|
755
|
+
function Wr(t, e) {
|
|
756
|
+
return t == null ? void 0 : t[e];
|
|
757
|
+
}
|
|
758
|
+
function Qr(t) {
|
|
759
|
+
var e = !1;
|
|
760
|
+
if (t != null && typeof t.toString != "function")
|
|
761
|
+
try {
|
|
762
|
+
e = !!(t + "");
|
|
763
|
+
} catch {
|
|
764
|
+
}
|
|
765
|
+
return e;
|
|
766
|
+
}
|
|
767
|
+
function ue(t, e) {
|
|
768
|
+
return function(n) {
|
|
769
|
+
return t(e(n));
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
var Yr = Array.prototype, zr = Function.prototype, V = Object.prototype, rt = pt["__core-js_shared__"], Nt = function() {
|
|
773
|
+
var t = /[^.]+$/.exec(rt && rt.keys && rt.keys.IE_PROTO || "");
|
|
774
|
+
return t ? "Symbol(src)_1." + t : "";
|
|
775
|
+
}(), ce = zr.toString, I = V.hasOwnProperty, gt = V.toString, Jr = RegExp(
|
|
776
|
+
"^" + ce.call(I).replace(Ir, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
777
|
+
), At = pt.Symbol, Vr = ue(Object.getPrototypeOf, Object), Xr = V.propertyIsEnumerable, Zr = Yr.splice, It = At ? At.isConcatSpreadable : void 0, it = Object.getOwnPropertySymbols, Pt = Math.max, kr = le(pt, "Map"), U = le(Object, "create");
|
|
778
|
+
function S(t) {
|
|
779
|
+
var e = -1, n = t ? t.length : 0;
|
|
780
|
+
for (this.clear(); ++e < n; ) {
|
|
781
|
+
var r = t[e];
|
|
782
|
+
this.set(r[0], r[1]);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function to() {
|
|
786
|
+
this.__data__ = U ? U(null) : {};
|
|
787
|
+
}
|
|
788
|
+
function eo(t) {
|
|
789
|
+
return this.has(t) && delete this.__data__[t];
|
|
790
|
+
}
|
|
791
|
+
function no(t) {
|
|
792
|
+
var e = this.__data__;
|
|
793
|
+
if (U) {
|
|
794
|
+
var n = e[t];
|
|
795
|
+
return n === _t ? void 0 : n;
|
|
796
|
+
}
|
|
797
|
+
return I.call(e, t) ? e[t] : void 0;
|
|
798
|
+
}
|
|
799
|
+
function ro(t) {
|
|
800
|
+
var e = this.__data__;
|
|
801
|
+
return U ? e[t] !== void 0 : I.call(e, t);
|
|
802
|
+
}
|
|
803
|
+
function oo(t, e) {
|
|
804
|
+
var n = this.__data__;
|
|
805
|
+
return n[t] = U && e === void 0 ? _t : e, this;
|
|
806
|
+
}
|
|
807
|
+
S.prototype.clear = to;
|
|
808
|
+
S.prototype.delete = eo;
|
|
809
|
+
S.prototype.get = no;
|
|
810
|
+
S.prototype.has = ro;
|
|
811
|
+
S.prototype.set = oo;
|
|
812
|
+
function P(t) {
|
|
813
|
+
var e = -1, n = t ? t.length : 0;
|
|
814
|
+
for (this.clear(); ++e < n; ) {
|
|
815
|
+
var r = t[e];
|
|
816
|
+
this.set(r[0], r[1]);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
function ao() {
|
|
820
|
+
this.__data__ = [];
|
|
821
|
+
}
|
|
822
|
+
function io(t) {
|
|
823
|
+
var e = this.__data__, n = X(e, t);
|
|
824
|
+
if (n < 0)
|
|
825
|
+
return !1;
|
|
826
|
+
var r = e.length - 1;
|
|
827
|
+
return n == r ? e.pop() : Zr.call(e, n, 1), !0;
|
|
828
|
+
}
|
|
829
|
+
function so(t) {
|
|
830
|
+
var e = this.__data__, n = X(e, t);
|
|
831
|
+
return n < 0 ? void 0 : e[n][1];
|
|
832
|
+
}
|
|
833
|
+
function uo(t) {
|
|
834
|
+
return X(this.__data__, t) > -1;
|
|
835
|
+
}
|
|
836
|
+
function co(t, e) {
|
|
837
|
+
var n = this.__data__, r = X(n, t);
|
|
838
|
+
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
839
|
+
}
|
|
840
|
+
P.prototype.clear = ao;
|
|
841
|
+
P.prototype.delete = io;
|
|
842
|
+
P.prototype.get = so;
|
|
843
|
+
P.prototype.has = uo;
|
|
844
|
+
P.prototype.set = co;
|
|
845
|
+
function j(t) {
|
|
846
|
+
var e = -1, n = t ? t.length : 0;
|
|
847
|
+
for (this.clear(); ++e < n; ) {
|
|
848
|
+
var r = t[e];
|
|
849
|
+
this.set(r[0], r[1]);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function fo() {
|
|
853
|
+
this.__data__ = {
|
|
854
|
+
hash: new S(),
|
|
855
|
+
map: new (kr || P)(),
|
|
856
|
+
string: new S()
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
function lo(t) {
|
|
860
|
+
return Z(this, t).delete(t);
|
|
861
|
+
}
|
|
862
|
+
function ho(t) {
|
|
863
|
+
return Z(this, t).get(t);
|
|
864
|
+
}
|
|
865
|
+
function _o(t) {
|
|
866
|
+
return Z(this, t).has(t);
|
|
867
|
+
}
|
|
868
|
+
function po(t, e) {
|
|
869
|
+
return Z(this, t).set(t, e), this;
|
|
870
|
+
}
|
|
871
|
+
j.prototype.clear = fo;
|
|
872
|
+
j.prototype.delete = lo;
|
|
873
|
+
j.prototype.get = ho;
|
|
874
|
+
j.prototype.has = _o;
|
|
875
|
+
j.prototype.set = po;
|
|
876
|
+
function q(t) {
|
|
877
|
+
var e = -1, n = t ? t.length : 0;
|
|
878
|
+
for (this.__data__ = new j(); ++e < n; )
|
|
879
|
+
this.add(t[e]);
|
|
880
|
+
}
|
|
881
|
+
function go(t) {
|
|
882
|
+
return this.__data__.set(t, _t), this;
|
|
883
|
+
}
|
|
884
|
+
function yo(t) {
|
|
885
|
+
return this.__data__.has(t);
|
|
886
|
+
}
|
|
887
|
+
q.prototype.add = q.prototype.push = go;
|
|
888
|
+
q.prototype.has = yo;
|
|
889
|
+
function Eo(t, e) {
|
|
890
|
+
var n = yt(t) || he(t) ? Hr(t.length, String) : [], r = n.length, o = !!r;
|
|
891
|
+
for (var a in t)
|
|
892
|
+
(e || I.call(t, a)) && !(o && (a == "length" || Ao(a, r))) && n.push(a);
|
|
893
|
+
return n;
|
|
894
|
+
}
|
|
895
|
+
function X(t, e) {
|
|
896
|
+
for (var n = t.length; n--; )
|
|
897
|
+
if (Lo(t[n][0], e))
|
|
898
|
+
return n;
|
|
899
|
+
return -1;
|
|
900
|
+
}
|
|
901
|
+
function Ro(t, e, n, r) {
|
|
902
|
+
var o = -1, a = Lr, i = !0, s = t.length, c = [], h = e.length;
|
|
903
|
+
if (!s)
|
|
904
|
+
return c;
|
|
905
|
+
n && (e = se(e, Mr(n))), r ? (a = Ur, i = !1) : e.length >= Cr && (a = qr, i = !1, e = new q(e));
|
|
906
|
+
t:
|
|
907
|
+
for (; ++o < s; ) {
|
|
908
|
+
var u = t[o], f = n ? n(u) : u;
|
|
909
|
+
if (u = r || u !== 0 ? u : 0, i && f === f) {
|
|
910
|
+
for (var l = h; l--; )
|
|
911
|
+
if (e[l] === f)
|
|
912
|
+
continue t;
|
|
913
|
+
c.push(u);
|
|
914
|
+
} else
|
|
915
|
+
a(e, f, r) || c.push(u);
|
|
916
|
+
}
|
|
917
|
+
return c;
|
|
918
|
+
}
|
|
919
|
+
function fe(t, e, n, r, o) {
|
|
920
|
+
var a = -1, i = t.length;
|
|
921
|
+
for (n || (n = No), o || (o = []); ++a < i; ) {
|
|
922
|
+
var s = t[a];
|
|
923
|
+
e > 0 && n(s) ? e > 1 ? fe(s, e - 1, n, r, o) : dt(o, s) : r || (o[o.length] = s);
|
|
924
|
+
}
|
|
925
|
+
return o;
|
|
926
|
+
}
|
|
927
|
+
function Oo(t, e, n) {
|
|
928
|
+
var r = e(t);
|
|
929
|
+
return yt(t) ? r : dt(r, n(t));
|
|
930
|
+
}
|
|
931
|
+
function bo(t) {
|
|
932
|
+
if (!Et(t) || Po(t))
|
|
933
|
+
return !1;
|
|
934
|
+
var e = pe(t) || Qr(t) ? Jr : Pr;
|
|
935
|
+
return e.test(xo(t));
|
|
936
|
+
}
|
|
937
|
+
function vo(t) {
|
|
938
|
+
if (!Et(t))
|
|
939
|
+
return Do(t);
|
|
940
|
+
var e = jo(t), n = [];
|
|
941
|
+
for (var r in t)
|
|
942
|
+
r == "constructor" && (e || !I.call(t, r)) || n.push(r);
|
|
943
|
+
return n;
|
|
944
|
+
}
|
|
945
|
+
function So(t, e) {
|
|
946
|
+
return t = Object(t), mo(t, e, function(n, r) {
|
|
947
|
+
return r in t;
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
function mo(t, e, n) {
|
|
951
|
+
for (var r = -1, o = e.length, a = {}; ++r < o; ) {
|
|
952
|
+
var i = e[r], s = t[i];
|
|
953
|
+
n(s, i) && (a[i] = s);
|
|
954
|
+
}
|
|
955
|
+
return a;
|
|
956
|
+
}
|
|
957
|
+
function Co(t, e) {
|
|
958
|
+
return e = Pt(e === void 0 ? t.length - 1 : e, 0), function() {
|
|
959
|
+
for (var n = arguments, r = -1, o = Pt(n.length - e, 0), a = Array(o); ++r < o; )
|
|
960
|
+
a[r] = n[e + r];
|
|
961
|
+
r = -1;
|
|
962
|
+
for (var i = Array(e + 1); ++r < e; )
|
|
963
|
+
i[r] = n[r];
|
|
964
|
+
return i[e] = a, xr(t, this, i);
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
function wo(t) {
|
|
968
|
+
return Oo(t, Go, $o);
|
|
969
|
+
}
|
|
970
|
+
function Z(t, e) {
|
|
971
|
+
var n = t.__data__;
|
|
972
|
+
return Io(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
973
|
+
}
|
|
974
|
+
function le(t, e) {
|
|
975
|
+
var n = Wr(t, e);
|
|
976
|
+
return bo(n) ? n : void 0;
|
|
977
|
+
}
|
|
978
|
+
var To = it ? ue(it, Object) : ge, $o = it ? function(t) {
|
|
979
|
+
for (var e = []; t; )
|
|
980
|
+
dt(e, To(t)), t = Vr(t);
|
|
981
|
+
return e;
|
|
982
|
+
} : ge;
|
|
983
|
+
function No(t) {
|
|
984
|
+
return yt(t) || he(t) || !!(It && t && t[It]);
|
|
985
|
+
}
|
|
986
|
+
function Ao(t, e) {
|
|
987
|
+
return e = e ?? ie, !!e && (typeof t == "number" || jr.test(t)) && t > -1 && t % 1 == 0 && t < e;
|
|
988
|
+
}
|
|
989
|
+
function Io(t) {
|
|
990
|
+
var e = typeof t;
|
|
991
|
+
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
992
|
+
}
|
|
993
|
+
function Po(t) {
|
|
994
|
+
return !!Nt && Nt in t;
|
|
995
|
+
}
|
|
996
|
+
function jo(t) {
|
|
997
|
+
var e = t && t.constructor, n = typeof e == "function" && e.prototype || V;
|
|
998
|
+
return t === n;
|
|
999
|
+
}
|
|
1000
|
+
function Do(t) {
|
|
1001
|
+
var e = [];
|
|
1002
|
+
if (t != null)
|
|
1003
|
+
for (var n in Object(t))
|
|
1004
|
+
e.push(n);
|
|
1005
|
+
return e;
|
|
1006
|
+
}
|
|
1007
|
+
function Fo(t) {
|
|
1008
|
+
if (typeof t == "string" || Ko(t))
|
|
1009
|
+
return t;
|
|
1010
|
+
var e = t + "";
|
|
1011
|
+
return e == "0" && 1 / t == -wr ? "-0" : e;
|
|
1012
|
+
}
|
|
1013
|
+
function xo(t) {
|
|
1014
|
+
if (t != null) {
|
|
1015
|
+
try {
|
|
1016
|
+
return ce.call(t);
|
|
1017
|
+
} catch {
|
|
1018
|
+
}
|
|
1019
|
+
try {
|
|
1020
|
+
return t + "";
|
|
1021
|
+
} catch {
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return "";
|
|
1025
|
+
}
|
|
1026
|
+
function Lo(t, e) {
|
|
1027
|
+
return t === e || t !== t && e !== e;
|
|
1028
|
+
}
|
|
1029
|
+
function he(t) {
|
|
1030
|
+
return Uo(t) && I.call(t, "callee") && (!Xr.call(t, "callee") || gt.call(t) == Tr);
|
|
1031
|
+
}
|
|
1032
|
+
var yt = Array.isArray;
|
|
1033
|
+
function _e(t) {
|
|
1034
|
+
return t != null && Bo(t.length) && !pe(t);
|
|
1035
|
+
}
|
|
1036
|
+
function Uo(t) {
|
|
1037
|
+
return de(t) && _e(t);
|
|
1038
|
+
}
|
|
1039
|
+
function pe(t) {
|
|
1040
|
+
var e = Et(t) ? gt.call(t) : "";
|
|
1041
|
+
return e == $r || e == Nr;
|
|
1042
|
+
}
|
|
1043
|
+
function Bo(t) {
|
|
1044
|
+
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= ie;
|
|
1045
|
+
}
|
|
1046
|
+
function Et(t) {
|
|
1047
|
+
var e = typeof t;
|
|
1048
|
+
return !!t && (e == "object" || e == "function");
|
|
1049
|
+
}
|
|
1050
|
+
function de(t) {
|
|
1051
|
+
return !!t && typeof t == "object";
|
|
1052
|
+
}
|
|
1053
|
+
function Ko(t) {
|
|
1054
|
+
return typeof t == "symbol" || de(t) && gt.call(t) == Ar;
|
|
1055
|
+
}
|
|
1056
|
+
function Go(t) {
|
|
1057
|
+
return _e(t) ? Eo(t, !0) : vo(t);
|
|
1058
|
+
}
|
|
1059
|
+
var Ho = Co(function(t, e) {
|
|
1060
|
+
return t == null ? {} : (e = se(fe(e, 1), Fo), So(t, Ro(wo(t), e)));
|
|
1061
|
+
});
|
|
1062
|
+
function ge() {
|
|
1063
|
+
return [];
|
|
1064
|
+
}
|
|
1065
|
+
var Mo = Ho;
|
|
1066
|
+
const jt = /* @__PURE__ */ ae(Mo);
|
|
1067
|
+
var qo = "Expected a function", ye = "__lodash_hash_undefined__", Ee = 1 / 0, Wo = "[object Function]", Qo = "[object GeneratorFunction]", Yo = "[object Symbol]", zo = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Jo = /^\w*$/, Vo = /^\./, Xo = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Zo = /[\\^$.*+?()[\]{}|]/g, ko = /\\(\\)?/g, ta = /^\[object .+?Constructor\]$/, ea = typeof R == "object" && R && R.Object === Object && R, na = typeof self == "object" && self && self.Object === Object && self, Rt = ea || na || Function("return this")();
|
|
1068
|
+
function ra(t, e) {
|
|
1069
|
+
return t == null ? void 0 : t[e];
|
|
1070
|
+
}
|
|
1071
|
+
function oa(t) {
|
|
1072
|
+
var e = !1;
|
|
1073
|
+
if (t != null && typeof t.toString != "function")
|
|
1074
|
+
try {
|
|
1075
|
+
e = !!(t + "");
|
|
1076
|
+
} catch {
|
|
1077
|
+
}
|
|
1078
|
+
return e;
|
|
1079
|
+
}
|
|
1080
|
+
var aa = Array.prototype, ia = Function.prototype, Re = Object.prototype, ot = Rt["__core-js_shared__"], Dt = function() {
|
|
1081
|
+
var t = /[^.]+$/.exec(ot && ot.keys && ot.keys.IE_PROTO || "");
|
|
1082
|
+
return t ? "Symbol(src)_1." + t : "";
|
|
1083
|
+
}(), Oe = ia.toString, Ot = Re.hasOwnProperty, be = Re.toString, sa = RegExp(
|
|
1084
|
+
"^" + Oe.call(Ot).replace(Zo, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1085
|
+
), Ft = Rt.Symbol, ua = aa.splice, ca = ve(Rt, "Map"), B = ve(Object, "create"), xt = Ft ? Ft.prototype : void 0, Lt = xt ? xt.toString : void 0;
|
|
1086
|
+
function m(t) {
|
|
1087
|
+
var e = -1, n = t ? t.length : 0;
|
|
1088
|
+
for (this.clear(); ++e < n; ) {
|
|
1089
|
+
var r = t[e];
|
|
1090
|
+
this.set(r[0], r[1]);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function fa() {
|
|
1094
|
+
this.__data__ = B ? B(null) : {};
|
|
1095
|
+
}
|
|
1096
|
+
function la(t) {
|
|
1097
|
+
return this.has(t) && delete this.__data__[t];
|
|
1098
|
+
}
|
|
1099
|
+
function ha(t) {
|
|
1100
|
+
var e = this.__data__;
|
|
1101
|
+
if (B) {
|
|
1102
|
+
var n = e[t];
|
|
1103
|
+
return n === ye ? void 0 : n;
|
|
1104
|
+
}
|
|
1105
|
+
return Ot.call(e, t) ? e[t] : void 0;
|
|
1106
|
+
}
|
|
1107
|
+
function _a(t) {
|
|
1108
|
+
var e = this.__data__;
|
|
1109
|
+
return B ? e[t] !== void 0 : Ot.call(e, t);
|
|
1110
|
+
}
|
|
1111
|
+
function pa(t, e) {
|
|
1112
|
+
var n = this.__data__;
|
|
1113
|
+
return n[t] = B && e === void 0 ? ye : e, this;
|
|
1114
|
+
}
|
|
1115
|
+
m.prototype.clear = fa;
|
|
1116
|
+
m.prototype.delete = la;
|
|
1117
|
+
m.prototype.get = ha;
|
|
1118
|
+
m.prototype.has = _a;
|
|
1119
|
+
m.prototype.set = pa;
|
|
1120
|
+
function D(t) {
|
|
1121
|
+
var e = -1, n = t ? t.length : 0;
|
|
1122
|
+
for (this.clear(); ++e < n; ) {
|
|
1123
|
+
var r = t[e];
|
|
1124
|
+
this.set(r[0], r[1]);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
function da() {
|
|
1128
|
+
this.__data__ = [];
|
|
1129
|
+
}
|
|
1130
|
+
function ga(t) {
|
|
1131
|
+
var e = this.__data__, n = k(e, t);
|
|
1132
|
+
if (n < 0)
|
|
1133
|
+
return !1;
|
|
1134
|
+
var r = e.length - 1;
|
|
1135
|
+
return n == r ? e.pop() : ua.call(e, n, 1), !0;
|
|
1136
|
+
}
|
|
1137
|
+
function ya(t) {
|
|
1138
|
+
var e = this.__data__, n = k(e, t);
|
|
1139
|
+
return n < 0 ? void 0 : e[n][1];
|
|
1140
|
+
}
|
|
1141
|
+
function Ea(t) {
|
|
1142
|
+
return k(this.__data__, t) > -1;
|
|
1143
|
+
}
|
|
1144
|
+
function Ra(t, e) {
|
|
1145
|
+
var n = this.__data__, r = k(n, t);
|
|
1146
|
+
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
1147
|
+
}
|
|
1148
|
+
D.prototype.clear = da;
|
|
1149
|
+
D.prototype.delete = ga;
|
|
1150
|
+
D.prototype.get = ya;
|
|
1151
|
+
D.prototype.has = Ea;
|
|
1152
|
+
D.prototype.set = Ra;
|
|
1153
|
+
function C(t) {
|
|
1154
|
+
var e = -1, n = t ? t.length : 0;
|
|
1155
|
+
for (this.clear(); ++e < n; ) {
|
|
1156
|
+
var r = t[e];
|
|
1157
|
+
this.set(r[0], r[1]);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
function Oa() {
|
|
1161
|
+
this.__data__ = {
|
|
1162
|
+
hash: new m(),
|
|
1163
|
+
map: new (ca || D)(),
|
|
1164
|
+
string: new m()
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
function ba(t) {
|
|
1168
|
+
return tt(this, t).delete(t);
|
|
1169
|
+
}
|
|
1170
|
+
function va(t) {
|
|
1171
|
+
return tt(this, t).get(t);
|
|
1172
|
+
}
|
|
1173
|
+
function Sa(t) {
|
|
1174
|
+
return tt(this, t).has(t);
|
|
1175
|
+
}
|
|
1176
|
+
function ma(t, e) {
|
|
1177
|
+
return tt(this, t).set(t, e), this;
|
|
1178
|
+
}
|
|
1179
|
+
C.prototype.clear = Oa;
|
|
1180
|
+
C.prototype.delete = ba;
|
|
1181
|
+
C.prototype.get = va;
|
|
1182
|
+
C.prototype.has = Sa;
|
|
1183
|
+
C.prototype.set = ma;
|
|
1184
|
+
function k(t, e) {
|
|
1185
|
+
for (var n = t.length; n--; )
|
|
1186
|
+
if (Fa(t[n][0], e))
|
|
1187
|
+
return n;
|
|
1188
|
+
return -1;
|
|
1189
|
+
}
|
|
1190
|
+
function Ca(t, e) {
|
|
1191
|
+
e = Na(e, t) ? [e] : $a(e);
|
|
1192
|
+
for (var n = 0, r = e.length; t != null && n < r; )
|
|
1193
|
+
t = t[ja(e[n++])];
|
|
1194
|
+
return n && n == r ? t : void 0;
|
|
1195
|
+
}
|
|
1196
|
+
function wa(t) {
|
|
1197
|
+
if (!me(t) || Ia(t))
|
|
1198
|
+
return !1;
|
|
1199
|
+
var e = xa(t) || oa(t) ? sa : ta;
|
|
1200
|
+
return e.test(Da(t));
|
|
1201
|
+
}
|
|
1202
|
+
function Ta(t) {
|
|
1203
|
+
if (typeof t == "string")
|
|
1204
|
+
return t;
|
|
1205
|
+
if (vt(t))
|
|
1206
|
+
return Lt ? Lt.call(t) : "";
|
|
1207
|
+
var e = t + "";
|
|
1208
|
+
return e == "0" && 1 / t == -Ee ? "-0" : e;
|
|
1209
|
+
}
|
|
1210
|
+
function $a(t) {
|
|
1211
|
+
return Se(t) ? t : Pa(t);
|
|
1212
|
+
}
|
|
1213
|
+
function tt(t, e) {
|
|
1214
|
+
var n = t.__data__;
|
|
1215
|
+
return Aa(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
1216
|
+
}
|
|
1217
|
+
function ve(t, e) {
|
|
1218
|
+
var n = ra(t, e);
|
|
1219
|
+
return wa(n) ? n : void 0;
|
|
1220
|
+
}
|
|
1221
|
+
function Na(t, e) {
|
|
1222
|
+
if (Se(t))
|
|
1223
|
+
return !1;
|
|
1224
|
+
var n = typeof t;
|
|
1225
|
+
return n == "number" || n == "symbol" || n == "boolean" || t == null || vt(t) ? !0 : Jo.test(t) || !zo.test(t) || e != null && t in Object(e);
|
|
1226
|
+
}
|
|
1227
|
+
function Aa(t) {
|
|
1228
|
+
var e = typeof t;
|
|
1229
|
+
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
1230
|
+
}
|
|
1231
|
+
function Ia(t) {
|
|
1232
|
+
return !!Dt && Dt in t;
|
|
1233
|
+
}
|
|
1234
|
+
var Pa = bt(function(t) {
|
|
1235
|
+
t = Ua(t);
|
|
1236
|
+
var e = [];
|
|
1237
|
+
return Vo.test(t) && e.push(""), t.replace(Xo, function(n, r, o, a) {
|
|
1238
|
+
e.push(o ? a.replace(ko, "$1") : r || n);
|
|
1239
|
+
}), e;
|
|
1240
|
+
});
|
|
1241
|
+
function ja(t) {
|
|
1242
|
+
if (typeof t == "string" || vt(t))
|
|
1243
|
+
return t;
|
|
1244
|
+
var e = t + "";
|
|
1245
|
+
return e == "0" && 1 / t == -Ee ? "-0" : e;
|
|
1246
|
+
}
|
|
1247
|
+
function Da(t) {
|
|
1248
|
+
if (t != null) {
|
|
1249
|
+
try {
|
|
1250
|
+
return Oe.call(t);
|
|
1251
|
+
} catch {
|
|
1252
|
+
}
|
|
1253
|
+
try {
|
|
1254
|
+
return t + "";
|
|
1255
|
+
} catch {
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return "";
|
|
1259
|
+
}
|
|
1260
|
+
function bt(t, e) {
|
|
1261
|
+
if (typeof t != "function" || e && typeof e != "function")
|
|
1262
|
+
throw new TypeError(qo);
|
|
1263
|
+
var n = function() {
|
|
1264
|
+
var r = arguments, o = e ? e.apply(this, r) : r[0], a = n.cache;
|
|
1265
|
+
if (a.has(o))
|
|
1266
|
+
return a.get(o);
|
|
1267
|
+
var i = t.apply(this, r);
|
|
1268
|
+
return n.cache = a.set(o, i), i;
|
|
1269
|
+
};
|
|
1270
|
+
return n.cache = new (bt.Cache || C)(), n;
|
|
1271
|
+
}
|
|
1272
|
+
bt.Cache = C;
|
|
1273
|
+
function Fa(t, e) {
|
|
1274
|
+
return t === e || t !== t && e !== e;
|
|
1275
|
+
}
|
|
1276
|
+
var Se = Array.isArray;
|
|
1277
|
+
function xa(t) {
|
|
1278
|
+
var e = me(t) ? be.call(t) : "";
|
|
1279
|
+
return e == Wo || e == Qo;
|
|
1280
|
+
}
|
|
1281
|
+
function me(t) {
|
|
1282
|
+
var e = typeof t;
|
|
1283
|
+
return !!t && (e == "object" || e == "function");
|
|
1284
|
+
}
|
|
1285
|
+
function La(t) {
|
|
1286
|
+
return !!t && typeof t == "object";
|
|
1287
|
+
}
|
|
1288
|
+
function vt(t) {
|
|
1289
|
+
return typeof t == "symbol" || La(t) && be.call(t) == Yo;
|
|
1290
|
+
}
|
|
1291
|
+
function Ua(t) {
|
|
1292
|
+
return t == null ? "" : Ta(t);
|
|
1293
|
+
}
|
|
1294
|
+
function Ba(t, e, n) {
|
|
1295
|
+
var r = t == null ? void 0 : Ca(t, e);
|
|
1296
|
+
return r === void 0 ? n : r;
|
|
1297
|
+
}
|
|
1298
|
+
var Ka = Ba;
|
|
1299
|
+
const Ga = /* @__PURE__ */ ae(Ka), qa = ({
|
|
1300
|
+
basePath: t,
|
|
1301
|
+
timeout: e,
|
|
1302
|
+
beforeRequest: n = (c) => c,
|
|
1303
|
+
networkSuccessCodeList: r,
|
|
1304
|
+
isSuccessNetworkCode: o = (c) => Array.isArray(r) ? r.includes(c) : c >= 200 && c < 300,
|
|
1305
|
+
Fetch: a,
|
|
1306
|
+
instanceCreateConfig: i = {},
|
|
1307
|
+
...s
|
|
1308
|
+
}) => {
|
|
1309
|
+
const c = a.create({
|
|
1310
|
+
baseURL: t,
|
|
1311
|
+
timeout: e,
|
|
1312
|
+
...i,
|
|
1313
|
+
onRequest: async (u) => {
|
|
1314
|
+
const { options: f, request: l } = u, p = await n({
|
|
1315
|
+
...f,
|
|
1316
|
+
url: l
|
|
1317
|
+
});
|
|
1318
|
+
u.request = p.url, u.options = jt(p, "url");
|
|
1319
|
+
},
|
|
1320
|
+
onResponseError: async (u) => {
|
|
1321
|
+
if (u instanceof T)
|
|
1322
|
+
return Promise.reject(u);
|
|
1323
|
+
const f = new x({
|
|
1324
|
+
code: y.REQUEST_ERROR,
|
|
1325
|
+
message: F(u) ?? "发起请求出错",
|
|
1326
|
+
cause: u
|
|
1327
|
+
});
|
|
1328
|
+
return Promise.reject(f);
|
|
1329
|
+
},
|
|
1330
|
+
onResponse: async (u) => {
|
|
1331
|
+
const { response: f } = u, l = f.status;
|
|
1332
|
+
if (!o(l))
|
|
1333
|
+
throw u;
|
|
1334
|
+
}
|
|
1335
|
+
// onRequestError: async (context) => {},
|
|
1336
|
+
}), { request: h } = mr({
|
|
1337
|
+
...s,
|
|
1338
|
+
basePath: t,
|
|
1339
|
+
timeout: e,
|
|
1340
|
+
issue: ({ TIMEOUT: u, DEBUG: f, url: l, ...G }) => {
|
|
1341
|
+
const p = {
|
|
1342
|
+
timeout: u,
|
|
1343
|
+
...jt(G, ["BASE_PATH"])
|
|
1344
|
+
}, Ce = Date.now();
|
|
1345
|
+
return c(l, p).then((d) => Vn(d, s, f)).catch((d) => {
|
|
1346
|
+
if (d instanceof T)
|
|
1347
|
+
return f && g(
|
|
1348
|
+
{
|
|
1349
|
+
stage: _.NETWORK_ERROR_ORIGIN,
|
|
1350
|
+
data: d
|
|
1351
|
+
},
|
|
1352
|
+
E.ERROR
|
|
1353
|
+
), Promise.reject(d);
|
|
1354
|
+
const { response: et, request: we } = d;
|
|
1355
|
+
let O, b;
|
|
1356
|
+
const Te = Date.now() - Ce;
|
|
1357
|
+
(d.message || "").toLowerCase().includes("timeout") || ["FetchError", "AbortError"].includes(d.name) && Te > (p.timeout || u) ? (O = y.NO_RESPONSE_TIMEOUT, b = "请求超时") : Ga(globalThis, "navigator.onLine") === !1 ? (O = y.NO_RESPONSE_OFFLINE, b = "网络未连接") : et ? (O = et.status, b = et.statusText) : we ? (O = y.NO_RESPONSE, b = F(d) ?? "未响应") : (O = y.REQUEST_ERROR, b = F(d) ?? "发起请求出错");
|
|
1358
|
+
const St = new x({
|
|
1359
|
+
code: O,
|
|
1360
|
+
message: b,
|
|
1361
|
+
cause: d
|
|
1362
|
+
});
|
|
1363
|
+
return f && g(
|
|
1364
|
+
{
|
|
1365
|
+
stage: _.NETWORK_ERROR_PACK,
|
|
1366
|
+
data: St
|
|
1367
|
+
},
|
|
1368
|
+
E.ERROR
|
|
1369
|
+
), Promise.reject(St);
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
return h;
|
|
1374
|
+
};
|
|
1375
|
+
export {
|
|
1376
|
+
E as DebugLevelEnum,
|
|
1377
|
+
_ as DebugStageEnum,
|
|
1378
|
+
y as InnerErrorCode,
|
|
1379
|
+
Sr as Request,
|
|
1380
|
+
T as RequestFailResultBase,
|
|
1381
|
+
Ut as RequestFailResultBusiness,
|
|
1382
|
+
x as RequestFailResultNetwork,
|
|
1383
|
+
Ma as callback2Promise,
|
|
1384
|
+
vr as catchBeforeError,
|
|
1385
|
+
g as createDebugInfo,
|
|
1386
|
+
qa as createRequest,
|
|
1387
|
+
Vn as dispatchBusinessResult,
|
|
1388
|
+
F as resolveErrorMsg
|
|
1389
|
+
};
|