create-done-coding 0.11.26 → 0.11.27-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4384 +0,0 @@
1
- #!/usr/bin/env node
2
- import { readCliModuleAssetsConfig as $o, outputConsole as _, chalk as ut, HooksNameEnum as T, execSyncHijack as F, createSubcommand as At, getRootScriptName as Wn, xPrompts as K, getConfigFileCommonOptions as Nt, addHuskyHooks as Po, initHandlerCommon as Io, readConfigFile as ye, lookForParentTarget as zn, decryptAES as Mo, encryptAES as jo, getCurrentBranchName as Uo, getCommitByHookName as Lo, resolveMergeInfoByGitReflogAction as Bo, checkCurrentIsRebasing as xo, resolveMergeInfoByCommitMsg as Do, getCurrentBranchLastCommitList as Fo, getLastReflogList as ko, generateGetAnswerSwiftFn as Ho, getSafePath as Go, rmGitCtrlAsync as cn, isHttpGitUrl as qo, http2sshGitUrl as Ko, createMainCommand as Jo } from "@done-coding/cli-utils";
3
- import Et, { existsSync as un, rmSync as lt } from "node:fs";
4
- import Be, { resolve as Wo } from "node:path";
5
- import { getConfigPath as zo, batchCompileHandler as Vo, MODULE_DEFAULT_CONFIG_RELATIVE_PATH as Xo } from "@done-coding/cli-template";
6
- import { getTargetRepoUrl as Qo } from "@done-coding/cli-git";
7
- const ie = {
8
- name: "create-done-coding",
9
- version: "0.11.26",
10
- description: "项目创建命令行工具",
11
- bin: {
12
- "create-done-coding": "es/cli.mjs"
13
- },
14
- cliConfig: {
15
- namespaceDir: ".done-coding",
16
- moduleName: "create"
17
- }
18
- }, Vn = "自定义模版路径", Xn = "某个git平台用户仓库";
19
- var O = /* @__PURE__ */ ((e) => (e.PROJECT_NAME = "projectName", e.TEMPLATE = "template", e.IS_SAVE_GIT_HISTORY = "saveGitHistory", e.IS_TRANS_HTTP_URL_TO_SSH_URL = "isTransToSshUrl", e.IS_REMOVE_SAME_NAME_DIR = "isRemove", e.IS_CHANGE_BRANCH_NAME = "isChangeBranchName", e.LOCAL_BRANCH_NAME = "localBranchName", e.IS_SHALLOW_CLONE = "shallowClone", e.CUSTOM_GIT_URL_INPUT = "customUrl", e.GIT_COMMIT_MESSAGE = "gitCommitMessage", e.TEMPLATE_GIT_PATH = "templateGitPath", e.TEMPLATE_GIT_BRANCH = "templateGitBranch", e))(O || {}), Qn = /* @__PURE__ */ ((e) => (e.CREATE = "create", e))(Qn || {}), Ie = /* @__PURE__ */ ((e) => (e.ORIGIN = "origin", e.UPSTREAM = "upstream", e))(Ie || {});
20
- let ft;
21
- const Yo = async () => (ft || (ft = (await $o({
22
- moduleName: ie.cliConfig.moduleName,
23
- onSuccess({ config: t, moduleEntryFileRelativePath: n, repoUrl: r }) {
24
- if (!Array.isArray(t.templateList)) {
25
- const o = `配置文件出错, templateList 不是数组, 请检查 ${r} ${n}`;
26
- throw new Error(o);
27
- }
28
- _.success("模板列表拉取成功!");
29
- }
30
- })).templateList), ft), Yn = async () => [
31
- ...await Yo(),
32
- { name: Vn },
33
- { name: Xn }
34
- ], Zo = {
35
- type: "text",
36
- name: O.PROJECT_NAME,
37
- message: "请输入项目名称",
38
- format: (e) => e.trim(),
39
- validate: (e) => e.length > 0 || "项目名称不能为空"
40
- }, es = ({
41
- name: e,
42
- branch: t
43
- }) => typeof t === "string" ? `${e}(${ut.white(t)})` : `${e}(${Array.isArray(t) && t.length ? ut.greenBright(`${t.length}个细分分支`) : ut.white("默认分支")})`, ts = async () => {
44
- const e = await Yn();
45
- return {
46
- type: "select",
47
- name: O.TEMPLATE,
48
- message: "请选择模板",
49
- choices: e.map((t) => {
50
- var n;
51
- return {
52
- title: es(t),
53
- value: t.name,
54
- description: `${t.description || ""}${(n = t.instances) != null && n.length ? `, 已应用于: ${[""].concat(t.instances).join(`
55
- - `)}` : ""}` || void 0
56
- };
57
- }),
58
- validate: (t) => t.trim().length > 0 || "模板不能为空"
59
- };
60
- }, ns = {
61
- type: "confirm",
62
- name: O.IS_SAVE_GIT_HISTORY,
63
- message: "是否保存模板仓库git历史记录",
64
- initial: !1
65
- }, rs = ({
66
- httpUrl: e,
67
- sshUrl: t
68
- }) => ({
69
- type: "confirm",
70
- name: O.IS_TRANS_HTTP_URL_TO_SSH_URL,
71
- message: `是否将模板仓库地址由http形式(${e})转换为ssh形式(${t})`,
72
- initial: !1
73
- }), os = (e = "项目已存在,是否删除") => ({
74
- type: "confirm",
75
- name: O.IS_REMOVE_SAME_NAME_DIR,
76
- message: e
77
- }), ss = {
78
- type: "text",
79
- name: O.CUSTOM_GIT_URL_INPUT,
80
- message: "请输入自定义模板路径",
81
- validate: (e) => e.trim().length > 0 || "路径不能为空"
82
- }, is = (e) => ({
83
- type: "text",
84
- name: O.GIT_COMMIT_MESSAGE,
85
- message: "请输入git提交信息",
86
- initial: `feat: 初始化项目${e}`,
87
- validate: (t) => t.trim().length > 0 || "提交信息不能为空"
88
- }), as = (e) => ({
89
- type: "confirm",
90
- name: O.IS_CHANGE_BRANCH_NAME,
91
- message: `是否要重命名指定克隆分支名(${e})在本地的分支名`,
92
- initial: !0
93
- }), cs = {
94
- type: "text",
95
- name: O.LOCAL_BRANCH_NAME,
96
- message: "请输入克隆到本地后的分支名",
97
- initial: "master",
98
- validate: (e) => (e == null ? void 0 : e.trim().length) > 0 || "分支名不能为空"
99
- // ✅ 添加验证
100
- }, us = (e) => ({
101
- type: "select",
102
- name: O.TEMPLATE_GIT_BRANCH,
103
- message: "请选择模板分支",
104
- choices: e.map((t) => ({
105
- title: t.name,
106
- value: t.name,
107
- description: t.description
108
- }))
109
- });
110
- var ls = Object.defineProperty, fs = (e, t, n) => t in e ? ls(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, te = (e, t, n) => (fs(e, typeof t != "symbol" ? t + "" : t, n), n), k = /* @__PURE__ */ ((e) => (e.REQUEST_ERROR = "REQUEST_ERROR", e.NO_RESPONSE = "NO_RESPONSE", e.NO_RESPONSE_TIMEOUT = "NO_RESPONSE_TIMEOUT", e.NO_RESPONSE_OFFLINE = "NO_RESPONSE_OFFLINE", e.DISPATCH_RESPONSE = "DISPATCH_RESPONSE", e.DEAL_ERROR = "DEAL_ERROR", e.NO_BUSINESS_CODE = "NO_BUSINESS_CODE", e.NO_NETWORK_CODE = "NO_NETWORK_CODE", e.ABORT = "ABORT", e))(k || {});
111
- class oe extends Error {
112
- constructor({ message: t, code: n, isBusinessError: r }) {
113
- super(t), te(this, "code"), te(this, "isBusinessError"), te(this, "message"), this.message = t, this.code = n, this.isBusinessError = r, this.name = "DC Request ERROR";
114
- }
115
- }
116
- class be extends oe {
117
- /**
118
- * @param cause 错误原因
119
- */
120
- constructor({
121
- message: t,
122
- code: n,
123
- cause: r
124
- }) {
125
- super({ message: t, code: n, isBusinessError: !1 }), te(this, "cause"), this.cause = r;
126
- }
127
- }
128
- class Zn extends oe {
129
- constructor({ message: t, code: n }) {
130
- super({ message: t, code: n, isBusinessError: !0 });
131
- }
132
- }
133
- var H = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
134
- function $t(e) {
135
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
136
- }
137
- var ps = 200, Pt = "__lodash_hash_undefined__", hs = 1 / 0, er = 9007199254740991, ds = "[object Arguments]", ms = "[object Function]", gs = "[object GeneratorFunction]", ys = "[object Symbol]", _s = /[\\^$.*+?()[\]{}|]/g, Es = /^\[object .+?Constructor\]$/, Rs = /^(?:0|[1-9]\d*)$/, bs = typeof H == "object" && H && H.Object === Object && H, Os = typeof self == "object" && self && self.Object === Object && self, It = bs || Os || Function("return this")();
138
- function Ss(e, t, n) {
139
- switch (n.length) {
140
- case 0:
141
- return e.call(t);
142
- case 1:
143
- return e.call(t, n[0]);
144
- case 2:
145
- return e.call(t, n[0], n[1]);
146
- case 3:
147
- return e.call(t, n[0], n[1], n[2]);
148
- }
149
- return e.apply(t, n);
150
- }
151
- function ws(e, t) {
152
- var n = e ? e.length : 0;
153
- return !!n && Cs(e, t, 0) > -1;
154
- }
155
- function Ts(e, t, n) {
156
- for (var r = -1, o = e ? e.length : 0; ++r < o; )
157
- if (n(t, e[r]))
158
- return !0;
159
- return !1;
160
- }
161
- function tr(e, t) {
162
- for (var n = -1, r = e ? e.length : 0, o = Array(r); ++n < r; )
163
- o[n] = t(e[n], n, e);
164
- return o;
165
- }
166
- function Mt(e, t) {
167
- for (var n = -1, r = t.length, o = e.length; ++n < r; )
168
- e[o + n] = t[n];
169
- return e;
170
- }
171
- function vs(e, t, n, r) {
172
- for (var o = e.length, s = n + (r ? 1 : -1); r ? s-- : ++s < o; )
173
- if (t(e[s], s, e))
174
- return s;
175
- return -1;
176
- }
177
- function Cs(e, t, n) {
178
- if (t !== t)
179
- return vs(e, As, n);
180
- for (var r = n - 1, o = e.length; ++r < o; )
181
- if (e[r] === t)
182
- return r;
183
- return -1;
184
- }
185
- function As(e) {
186
- return e !== e;
187
- }
188
- function Ns(e, t) {
189
- for (var n = -1, r = Array(e); ++n < e; )
190
- r[n] = t(n);
191
- return r;
192
- }
193
- function $s(e) {
194
- return function(t) {
195
- return e(t);
196
- };
197
- }
198
- function Ps(e, t) {
199
- return e.has(t);
200
- }
201
- function Is(e, t) {
202
- return e == null ? void 0 : e[t];
203
- }
204
- function Ms(e) {
205
- var t = !1;
206
- if (e != null && typeof e.toString != "function")
207
- try {
208
- t = !!(e + "");
209
- } catch {
210
- }
211
- return t;
212
- }
213
- function nr(e, t) {
214
- return function(n) {
215
- return e(t(n));
216
- };
217
- }
218
- var js = Array.prototype, Us = Function.prototype, qe = Object.prototype, pt = It["__core-js_shared__"], ln = function() {
219
- var e = /[^.]+$/.exec(pt && pt.keys && pt.keys.IE_PROTO || "");
220
- return e ? "Symbol(src)_1." + e : "";
221
- }(), rr = Us.toString, ae = qe.hasOwnProperty, jt = qe.toString, Ls = RegExp(
222
- "^" + rr.call(ae).replace(_s, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
223
- ), fn = It.Symbol, Bs = nr(Object.getPrototypeOf, Object), xs = qe.propertyIsEnumerable, Ds = js.splice, pn = fn ? fn.isConcatSpreadable : void 0, Rt = Object.getOwnPropertySymbols, hn = Math.max, Fs = sr(It, "Map"), Oe = sr(Object, "create");
224
- function z(e) {
225
- var t = -1, n = e ? e.length : 0;
226
- for (this.clear(); ++t < n; ) {
227
- var r = e[t];
228
- this.set(r[0], r[1]);
229
- }
230
- }
231
- function ks() {
232
- this.__data__ = Oe ? Oe(null) : {};
233
- }
234
- function Hs(e) {
235
- return this.has(e) && delete this.__data__[e];
236
- }
237
- function Gs(e) {
238
- var t = this.__data__;
239
- if (Oe) {
240
- var n = t[e];
241
- return n === Pt ? void 0 : n;
242
- }
243
- return ae.call(t, e) ? t[e] : void 0;
244
- }
245
- function qs(e) {
246
- var t = this.__data__;
247
- return Oe ? t[e] !== void 0 : ae.call(t, e);
248
- }
249
- function Ks(e, t) {
250
- var n = this.__data__;
251
- return n[e] = Oe && t === void 0 ? Pt : t, this;
252
- }
253
- z.prototype.clear = ks;
254
- z.prototype.delete = Hs;
255
- z.prototype.get = Gs;
256
- z.prototype.has = qs;
257
- z.prototype.set = Ks;
258
- function ce(e) {
259
- var t = -1, n = e ? e.length : 0;
260
- for (this.clear(); ++t < n; ) {
261
- var r = e[t];
262
- this.set(r[0], r[1]);
263
- }
264
- }
265
- function Js() {
266
- this.__data__ = [];
267
- }
268
- function Ws(e) {
269
- var t = this.__data__, n = Ke(t, e);
270
- if (n < 0)
271
- return !1;
272
- var r = t.length - 1;
273
- return n == r ? t.pop() : Ds.call(t, n, 1), !0;
274
- }
275
- function zs(e) {
276
- var t = this.__data__, n = Ke(t, e);
277
- return n < 0 ? void 0 : t[n][1];
278
- }
279
- function Vs(e) {
280
- return Ke(this.__data__, e) > -1;
281
- }
282
- function Xs(e, t) {
283
- var n = this.__data__, r = Ke(n, e);
284
- return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
285
- }
286
- ce.prototype.clear = Js;
287
- ce.prototype.delete = Ws;
288
- ce.prototype.get = zs;
289
- ce.prototype.has = Vs;
290
- ce.prototype.set = Xs;
291
- function ue(e) {
292
- var t = -1, n = e ? e.length : 0;
293
- for (this.clear(); ++t < n; ) {
294
- var r = e[t];
295
- this.set(r[0], r[1]);
296
- }
297
- }
298
- function Qs() {
299
- this.__data__ = {
300
- hash: new z(),
301
- map: new (Fs || ce)(),
302
- string: new z()
303
- };
304
- }
305
- function Ys(e) {
306
- return Je(this, e).delete(e);
307
- }
308
- function Zs(e) {
309
- return Je(this, e).get(e);
310
- }
311
- function ei(e) {
312
- return Je(this, e).has(e);
313
- }
314
- function ti(e, t) {
315
- return Je(this, e).set(e, t), this;
316
- }
317
- ue.prototype.clear = Qs;
318
- ue.prototype.delete = Ys;
319
- ue.prototype.get = Zs;
320
- ue.prototype.has = ei;
321
- ue.prototype.set = ti;
322
- function xe(e) {
323
- var t = -1, n = e ? e.length : 0;
324
- for (this.__data__ = new ue(); ++t < n; )
325
- this.add(e[t]);
326
- }
327
- function ni(e) {
328
- return this.__data__.set(e, Pt), this;
329
- }
330
- function ri(e) {
331
- return this.__data__.has(e);
332
- }
333
- xe.prototype.add = xe.prototype.push = ni;
334
- xe.prototype.has = ri;
335
- function oi(e, t) {
336
- var n = Ut(e) || ir(e) ? Ns(e.length, String) : [], r = n.length, o = !!r;
337
- for (var s in e)
338
- (t || ae.call(e, s)) && !(o && (s == "length" || gi(s, r))) && n.push(s);
339
- return n;
340
- }
341
- function Ke(e, t) {
342
- for (var n = e.length; n--; )
343
- if (Si(e[n][0], t))
344
- return n;
345
- return -1;
346
- }
347
- function si(e, t, n, r) {
348
- var o = -1, s = ws, i = !0, a = e.length, c = [], f = t.length;
349
- if (!a)
350
- return c;
351
- n && (t = tr(t, $s(n))), r ? (s = Ts, i = !1) : t.length >= ps && (s = Ps, i = !1, t = new xe(t));
352
- e:
353
- for (; ++o < a; ) {
354
- var u = e[o], p = n ? n(u) : u;
355
- if (u = r || u !== 0 ? u : 0, i && p === p) {
356
- for (var g = f; g--; )
357
- if (t[g] === p)
358
- continue e;
359
- c.push(u);
360
- } else
361
- s(t, p, r) || c.push(u);
362
- }
363
- return c;
364
- }
365
- function or(e, t, n, r, o) {
366
- var s = -1, i = e.length;
367
- for (n || (n = mi), o || (o = []); ++s < i; ) {
368
- var a = e[s];
369
- t > 0 && n(a) ? t > 1 ? or(a, t - 1, n, r, o) : Mt(o, a) : r || (o[o.length] = a);
370
- }
371
- return o;
372
- }
373
- function ii(e, t, n) {
374
- var r = t(e);
375
- return Ut(e) ? r : Mt(r, n(e));
376
- }
377
- function ai(e) {
378
- if (!Lt(e) || _i(e))
379
- return !1;
380
- var t = cr(e) || Ms(e) ? Ls : Es;
381
- return t.test(Oi(e));
382
- }
383
- function ci(e) {
384
- if (!Lt(e))
385
- return Ri(e);
386
- var t = Ei(e), n = [];
387
- for (var r in e)
388
- r == "constructor" && (t || !ae.call(e, r)) || n.push(r);
389
- return n;
390
- }
391
- function ui(e, t) {
392
- return e = Object(e), li(e, t, function(n, r) {
393
- return r in e;
394
- });
395
- }
396
- function li(e, t, n) {
397
- for (var r = -1, o = t.length, s = {}; ++r < o; ) {
398
- var i = t[r], a = e[i];
399
- n(a, i) && (s[i] = a);
400
- }
401
- return s;
402
- }
403
- function fi(e, t) {
404
- return t = hn(t === void 0 ? e.length - 1 : t, 0), function() {
405
- for (var n = arguments, r = -1, o = hn(n.length - t, 0), s = Array(o); ++r < o; )
406
- s[r] = n[t + r];
407
- r = -1;
408
- for (var i = Array(t + 1); ++r < t; )
409
- i[r] = n[r];
410
- return i[t] = s, Ss(e, this, i);
411
- };
412
- }
413
- function pi(e) {
414
- return ii(e, Ci, di);
415
- }
416
- function Je(e, t) {
417
- var n = e.__data__;
418
- return yi(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
419
- }
420
- function sr(e, t) {
421
- var n = Is(e, t);
422
- return ai(n) ? n : void 0;
423
- }
424
- var hi = Rt ? nr(Rt, Object) : lr, di = Rt ? function(e) {
425
- for (var t = []; e; )
426
- Mt(t, hi(e)), e = Bs(e);
427
- return t;
428
- } : lr;
429
- function mi(e) {
430
- return Ut(e) || ir(e) || !!(pn && e && e[pn]);
431
- }
432
- function gi(e, t) {
433
- return t = t ?? er, !!t && (typeof e == "number" || Rs.test(e)) && e > -1 && e % 1 == 0 && e < t;
434
- }
435
- function yi(e) {
436
- var t = typeof e;
437
- return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
438
- }
439
- function _i(e) {
440
- return !!ln && ln in e;
441
- }
442
- function Ei(e) {
443
- var t = e && e.constructor, n = typeof t == "function" && t.prototype || qe;
444
- return e === n;
445
- }
446
- function Ri(e) {
447
- var t = [];
448
- if (e != null)
449
- for (var n in Object(e))
450
- t.push(n);
451
- return t;
452
- }
453
- function bi(e) {
454
- if (typeof e == "string" || vi(e))
455
- return e;
456
- var t = e + "";
457
- return t == "0" && 1 / e == -hs ? "-0" : t;
458
- }
459
- function Oi(e) {
460
- if (e != null) {
461
- try {
462
- return rr.call(e);
463
- } catch {
464
- }
465
- try {
466
- return e + "";
467
- } catch {
468
- }
469
- }
470
- return "";
471
- }
472
- function Si(e, t) {
473
- return e === t || e !== e && t !== t;
474
- }
475
- function ir(e) {
476
- return wi(e) && ae.call(e, "callee") && (!xs.call(e, "callee") || jt.call(e) == ds);
477
- }
478
- var Ut = Array.isArray;
479
- function ar(e) {
480
- return e != null && Ti(e.length) && !cr(e);
481
- }
482
- function wi(e) {
483
- return ur(e) && ar(e);
484
- }
485
- function cr(e) {
486
- var t = Lt(e) ? jt.call(e) : "";
487
- return t == ms || t == gs;
488
- }
489
- function Ti(e) {
490
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= er;
491
- }
492
- function Lt(e) {
493
- var t = typeof e;
494
- return !!e && (t == "object" || t == "function");
495
- }
496
- function ur(e) {
497
- return !!e && typeof e == "object";
498
- }
499
- function vi(e) {
500
- return typeof e == "symbol" || ur(e) && jt.call(e) == ys;
501
- }
502
- function Ci(e) {
503
- return ar(e) ? oi(e, !0) : ci(e);
504
- }
505
- var Ai = fi(function(e, t) {
506
- return e == null ? {} : (t = tr(or(t, 1), bi), ui(e, si(pi(e), t)));
507
- });
508
- function lr() {
509
- return [];
510
- }
511
- var Ni = Ai;
512
- const $i = /* @__PURE__ */ $t(Ni);
513
- var G = /* @__PURE__ */ ((e) => (e.LOG = "log", e.WARN = "warn", e.ERROR = "error", e))(G || {}), $ = /* @__PURE__ */ ((e) => (e.BEFORE = "1 发起请求前阶段", e.BEFORE_ERROR = "1.1 发起请求前阶段出错", e.BEFORE_ERROR_ORIGIN = "1.1.1 发起请求前阶段-原始错误", e.BEFORE_ERROR_PACK = "1.1.2 发起请求前阶段-包装后错误", e.NETWORK = "2 网络阶段", e.NETWORK_SUCCESS = "2.1 网络成功阶段", e.NETWORK_SUCCESS_BUSINESS_SUCCESS = "2.1.1 网路成功且业务成功", e.NETWORK_SUCCESS_BUSINESS_FAIL = "2.1.2 网络成功但业务失败", e.NETWORK_SUCCESS_DISPATCH_ERROR = "2.1.3 网络成功但分发业务结果出错", e.NETWORK_ERROR = "2.2 网络出错阶段", e.NETWORK_ERROR_ORIGIN = "2.2.1 网络出错阶段-原始错误", e.NETWORK_ERROR_PACK = "2.2.2 网络出错阶段-包装后错误", e.DEAL_ERROR = "3 处理错误阶段", e.DEAL_ERROR_ERROR = "3.1 处理错误阶段出错", e.DEAL_ERROR_RESULT = "3.2 处理错误结果", e.DEAL_ERROR_RESULT_RELOAD = "3.2.1 处理错误结果-重新请求", e.DEAL_ERROR_RESULT_CONTINUE = "3.2.2 处理错误结果-正常抛错", e))($ || {});
514
- const P = ({
515
- stage: e,
516
- data: t
517
- }, n = "log") => {
518
- console[n](
519
- e,
520
- t instanceof oe ? $i({ ...t }, "cause") : t
521
- );
522
- }, Ee = (e) => e instanceof Error ? e.message : "未知错误", Pi = async (e, {
523
- getBusinessCode: t,
524
- getBusinessMsg: n,
525
- getBusinessData: r,
526
- businessSuccessCodeList: o = [200],
527
- isSuccessBusinessCode: s
528
- }, i) => {
529
- i && P(
530
- { stage: $.NETWORK_SUCCESS, data: e },
531
- G.LOG
532
- );
533
- try {
534
- const a = t(e), c = n(e);
535
- if (s ? s(a, e) : o.includes(a)) {
536
- const f = {
537
- code: a,
538
- data: r(e),
539
- message: c,
540
- _raw: e
541
- };
542
- return i && P(
543
- {
544
- stage: $.NETWORK_SUCCESS_BUSINESS_SUCCESS,
545
- data: f
546
- },
547
- G.LOG
548
- ), f;
549
- } else {
550
- if (a === void 0)
551
- throw new Error("业务code未定义");
552
- const f = new Zn({
553
- code: a,
554
- message: c ?? "未知错误"
555
- });
556
- return i && P(
557
- {
558
- stage: $.NETWORK_SUCCESS_BUSINESS_FAIL,
559
- data: f
560
- },
561
- G.ERROR
562
- ), Promise.reject(f);
563
- }
564
- } catch (a) {
565
- i && P(
566
- {
567
- stage: $.NETWORK_SUCCESS_DISPATCH_ERROR,
568
- data: a
569
- },
570
- G.ERROR
571
- );
572
- const c = new be({
573
- code: k.DISPATCH_RESPONSE,
574
- message: Ee(a) ?? "分发响应结果执行出错",
575
- cause: a
576
- });
577
- return Promise.reject(c);
578
- }
579
- }, Ii = (e, t) => (...n) => {
580
- try {
581
- return e(...n);
582
- } catch (r) {
583
- return console.error(e.name, r, e), t;
584
- }
585
- }, dn = (e, t) => (...n) => e(...n).catch((r) => (console.error(e.name, r, e), t));
586
- var fr = 9007199254740991, Mi = "[object Arguments]", ji = "[object Function]", Ui = "[object GeneratorFunction]", Li = /^(?:0|[1-9]\d*)$/;
587
- function Bi(e, t, n) {
588
- switch (n.length) {
589
- case 0:
590
- return e.call(t);
591
- case 1:
592
- return e.call(t, n[0]);
593
- case 2:
594
- return e.call(t, n[0], n[1]);
595
- case 3:
596
- return e.call(t, n[0], n[1], n[2]);
597
- }
598
- return e.apply(t, n);
599
- }
600
- function xi(e, t) {
601
- for (var n = -1, r = Array(e); ++n < e; )
602
- r[n] = t(n);
603
- return r;
604
- }
605
- function Di(e, t) {
606
- return function(n) {
607
- return e(t(n));
608
- };
609
- }
610
- var We = Object.prototype, Ae = We.hasOwnProperty, pr = We.toString, hr = We.propertyIsEnumerable, Fi = Di(Object.keys, Object), mn = Math.max, ki = !hr.call({ valueOf: 1 }, "valueOf");
611
- function Hi(e, t) {
612
- var n = Vi(e) || zi(e) ? xi(e.length, String) : [], r = n.length, o = !!r;
613
- for (var s in e)
614
- (t || Ae.call(e, s)) && !(o && (s == "length" || mr(s, r))) && n.push(s);
615
- return n;
616
- }
617
- function dr(e, t, n) {
618
- var r = e[t];
619
- (!(Ae.call(e, t) && yr(r, n)) || n === void 0 && !(t in e)) && (e[t] = n);
620
- }
621
- function Gi(e) {
622
- if (!gr(e))
623
- return Fi(e);
624
- var t = [];
625
- for (var n in Object(e))
626
- Ae.call(e, n) && n != "constructor" && t.push(n);
627
- return t;
628
- }
629
- function qi(e, t) {
630
- return t = mn(t === void 0 ? e.length - 1 : t, 0), function() {
631
- for (var n = arguments, r = -1, o = mn(n.length - t, 0), s = Array(o); ++r < o; )
632
- s[r] = n[t + r];
633
- r = -1;
634
- for (var i = Array(t + 1); ++r < t; )
635
- i[r] = n[r];
636
- return i[t] = s, Bi(e, this, i);
637
- };
638
- }
639
- function Ki(e, t, n, r) {
640
- n || (n = {});
641
- for (var o = -1, s = t.length; ++o < s; ) {
642
- var i = t[o], a = r ? r(n[i], e[i], i, n, e) : void 0;
643
- dr(n, i, a === void 0 ? e[i] : a);
644
- }
645
- return n;
646
- }
647
- function Ji(e) {
648
- return qi(function(t, n) {
649
- var r = -1, o = n.length, s = o > 1 ? n[o - 1] : void 0, i = o > 2 ? n[2] : void 0;
650
- for (s = e.length > 3 && typeof s == "function" ? (o--, s) : void 0, i && Wi(n[0], n[1], i) && (s = o < 3 ? void 0 : s, o = 1), t = Object(t); ++r < o; ) {
651
- var a = n[r];
652
- a && e(t, a, r, s);
653
- }
654
- return t;
655
- });
656
- }
657
- function mr(e, t) {
658
- return t = t ?? fr, !!t && (typeof e == "number" || Li.test(e)) && e > -1 && e % 1 == 0 && e < t;
659
- }
660
- function Wi(e, t, n) {
661
- if (!_r(n))
662
- return !1;
663
- var r = typeof t;
664
- return (r == "number" ? ze(n) && mr(t, n.length) : r == "string" && t in n) ? yr(n[t], e) : !1;
665
- }
666
- function gr(e) {
667
- var t = e && e.constructor, n = typeof t == "function" && t.prototype || We;
668
- return e === n;
669
- }
670
- function yr(e, t) {
671
- return e === t || e !== e && t !== t;
672
- }
673
- function zi(e) {
674
- return Xi(e) && Ae.call(e, "callee") && (!hr.call(e, "callee") || pr.call(e) == Mi);
675
- }
676
- var Vi = Array.isArray;
677
- function ze(e) {
678
- return e != null && Yi(e.length) && !Qi(e);
679
- }
680
- function Xi(e) {
681
- return Zi(e) && ze(e);
682
- }
683
- function Qi(e) {
684
- var t = _r(e) ? pr.call(e) : "";
685
- return t == ji || t == Ui;
686
- }
687
- function Yi(e) {
688
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= fr;
689
- }
690
- function _r(e) {
691
- var t = typeof e;
692
- return !!e && (t == "object" || t == "function");
693
- }
694
- function Zi(e) {
695
- return !!e && typeof e == "object";
696
- }
697
- var ea = Ji(function(e, t) {
698
- if (ki || gr(t) || ze(t)) {
699
- Ki(t, ta(t), e);
700
- return;
701
- }
702
- for (var n in t)
703
- Ae.call(t, n) && dr(e, n, t[n]);
704
- });
705
- function ta(e) {
706
- return ze(e) ? Hi(e) : Gi(e);
707
- }
708
- var na = ea;
709
- const gn = /* @__PURE__ */ $t(na);
710
- var ra = "Expected a function", yn = "__lodash_placeholder__", V = 1, Ve = 2, oa = 4, W = 8, Re = 16, ne = 32, Se = 64, Er = 128, sa = 256, Rr = 512, _n = 1 / 0, ia = 9007199254740991, aa = 17976931348623157e292, En = NaN, ca = [
711
- ["ary", Er],
712
- ["bind", V],
713
- ["bindKey", Ve],
714
- ["curry", W],
715
- ["curryRight", Re],
716
- ["flip", Rr],
717
- ["partial", ne],
718
- ["partialRight", Se],
719
- ["rearg", sa]
720
- ], ua = "[object Function]", la = "[object GeneratorFunction]", fa = "[object Symbol]", pa = /[\\^$.*+?()[\]{}|]/g, ha = /^\s+|\s+$/g, da = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, ma = /\{\n\/\* \[wrapped with (.+)\] \*/, ga = /,? & /, ya = /^[-+]0x[0-9a-f]+$/i, _a = /^0b[01]+$/i, Ea = /^\[object .+?Constructor\]$/, Ra = /^0o[0-7]+$/i, ba = /^(?:0|[1-9]\d*)$/, Oa = parseInt, Sa = typeof H == "object" && H && H.Object === Object && H, wa = typeof self == "object" && self && self.Object === Object && self, Ne = Sa || wa || Function("return this")();
721
- function br(e, t, n) {
722
- switch (n.length) {
723
- case 0:
724
- return e.call(t);
725
- case 1:
726
- return e.call(t, n[0]);
727
- case 2:
728
- return e.call(t, n[0], n[1]);
729
- case 3:
730
- return e.call(t, n[0], n[1], n[2]);
731
- }
732
- return e.apply(t, n);
733
- }
734
- function Ta(e, t) {
735
- for (var n = -1, r = e ? e.length : 0; ++n < r && t(e[n], n, e) !== !1; )
736
- ;
737
- return e;
738
- }
739
- function va(e, t) {
740
- var n = e ? e.length : 0;
741
- return !!n && Aa(e, t, 0) > -1;
742
- }
743
- function Ca(e, t, n, r) {
744
- for (var o = e.length, s = n + (r ? 1 : -1); r ? s-- : ++s < o; )
745
- if (t(e[s], s, e))
746
- return s;
747
- return -1;
748
- }
749
- function Aa(e, t, n) {
750
- if (t !== t)
751
- return Ca(e, Na, n);
752
- for (var r = n - 1, o = e.length; ++r < o; )
753
- if (e[r] === t)
754
- return r;
755
- return -1;
756
- }
757
- function Na(e) {
758
- return e !== e;
759
- }
760
- function $a(e, t) {
761
- for (var n = e.length, r = 0; n--; )
762
- e[n] === t && r++;
763
- return r;
764
- }
765
- function Pa(e, t) {
766
- return e == null ? void 0 : e[t];
767
- }
768
- function Ia(e) {
769
- var t = !1;
770
- if (e != null && typeof e.toString != "function")
771
- try {
772
- t = !!(e + "");
773
- } catch {
774
- }
775
- return t;
776
- }
777
- function Or(e, t) {
778
- for (var n = -1, r = e.length, o = 0, s = []; ++n < r; ) {
779
- var i = e[n];
780
- (i === t || i === yn) && (e[n] = yn, s[o++] = n);
781
- }
782
- return s;
783
- }
784
- var Ma = Function.prototype, Sr = Object.prototype, ht = Ne["__core-js_shared__"], Rn = function() {
785
- var e = /[^.]+$/.exec(ht && ht.keys && ht.keys.IE_PROTO || "");
786
- return e ? "Symbol(src)_1." + e : "";
787
- }(), wr = Ma.toString, ja = Sr.hasOwnProperty, Tr = Sr.toString, Ua = RegExp(
788
- "^" + wr.call(ja).replace(pa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
789
- ), La = Object.create, De = Math.max, Ba = Math.min, bn = function() {
790
- var e = On(Object, "defineProperty"), t = On.name;
791
- return t && t.length > 2 ? e : void 0;
792
- }();
793
- function xa(e) {
794
- return se(e) ? La(e) : {};
795
- }
796
- function Da(e) {
797
- if (!se(e) || Xa(e))
798
- return !1;
799
- var t = ec(e) || Ia(e) ? Ua : Ea;
800
- return t.test(Ya(e));
801
- }
802
- function Fa(e, t, n, r) {
803
- for (var o = -1, s = e.length, i = n.length, a = -1, c = t.length, f = De(s - i, 0), u = Array(c + f), p = !r; ++a < c; )
804
- u[a] = t[a];
805
- for (; ++o < i; )
806
- (p || o < s) && (u[n[o]] = e[o]);
807
- for (; f--; )
808
- u[a++] = e[o++];
809
- return u;
810
- }
811
- function ka(e, t, n, r) {
812
- for (var o = -1, s = e.length, i = -1, a = n.length, c = -1, f = t.length, u = De(s - a, 0), p = Array(u + f), g = !r; ++o < u; )
813
- p[o] = e[o];
814
- for (var y = o; ++c < f; )
815
- p[y + c] = t[c];
816
- for (; ++i < a; )
817
- (g || o < s) && (p[y + n[i]] = e[o++]);
818
- return p;
819
- }
820
- function Ha(e, t) {
821
- var n = -1, r = e.length;
822
- for (t || (t = Array(r)); ++n < r; )
823
- t[n] = e[n];
824
- return t;
825
- }
826
- function Ga(e, t, n) {
827
- var r = t & V, o = we(e);
828
- function s() {
829
- var i = this && this !== Ne && this instanceof s ? o : e;
830
- return i.apply(r ? n : this, arguments);
831
- }
832
- return s;
833
- }
834
- function we(e) {
835
- return function() {
836
- var t = arguments;
837
- switch (t.length) {
838
- case 0:
839
- return new e();
840
- case 1:
841
- return new e(t[0]);
842
- case 2:
843
- return new e(t[0], t[1]);
844
- case 3:
845
- return new e(t[0], t[1], t[2]);
846
- case 4:
847
- return new e(t[0], t[1], t[2], t[3]);
848
- case 5:
849
- return new e(t[0], t[1], t[2], t[3], t[4]);
850
- case 6:
851
- return new e(t[0], t[1], t[2], t[3], t[4], t[5]);
852
- case 7:
853
- return new e(t[0], t[1], t[2], t[3], t[4], t[5], t[6]);
854
- }
855
- var n = xa(e.prototype), r = e.apply(n, t);
856
- return se(r) ? r : n;
857
- };
858
- }
859
- function qa(e, t, n) {
860
- var r = we(e);
861
- function o() {
862
- for (var s = arguments.length, i = Array(s), a = s, c = Cr(o); a--; )
863
- i[a] = arguments[a];
864
- var f = s < 3 && i[0] !== c && i[s - 1] !== c ? [] : Or(i, c);
865
- if (s -= f.length, s < n)
866
- return vr(
867
- e,
868
- t,
869
- Bt,
870
- o.placeholder,
871
- void 0,
872
- i,
873
- f,
874
- void 0,
875
- void 0,
876
- n - s
877
- );
878
- var u = this && this !== Ne && this instanceof o ? r : e;
879
- return br(u, this, i);
880
- }
881
- return o;
882
- }
883
- function Bt(e, t, n, r, o, s, i, a, c, f) {
884
- var u = t & Er, p = t & V, g = t & Ve, y = t & (W | Re), h = t & Rr, m = g ? void 0 : we(e);
885
- function d() {
886
- for (var b = arguments.length, E = Array(b), S = b; S--; )
887
- E[S] = arguments[S];
888
- if (y)
889
- var N = Cr(d), v = $a(E, N);
890
- if (r && (E = Fa(E, r, o, y)), s && (E = ka(E, s, i, y)), b -= v, y && b < f) {
891
- var j = Or(E, N);
892
- return vr(
893
- e,
894
- t,
895
- Bt,
896
- d.placeholder,
897
- n,
898
- E,
899
- j,
900
- a,
901
- c,
902
- f - b
903
- );
904
- }
905
- var U = p ? n : this, D = g ? U[e] : e;
906
- return b = E.length, a ? E = Qa(E, a) : h && b > 1 && E.reverse(), u && c < b && (E.length = c), this && this !== Ne && this instanceof d && (D = m || we(D)), D.apply(U, E);
907
- }
908
- return d;
909
- }
910
- function Ka(e, t, n, r) {
911
- var o = t & V, s = we(e);
912
- function i() {
913
- for (var a = -1, c = arguments.length, f = -1, u = r.length, p = Array(u + c), g = this && this !== Ne && this instanceof i ? s : e; ++f < u; )
914
- p[f] = r[f];
915
- for (; c--; )
916
- p[f++] = arguments[++a];
917
- return br(g, o ? n : this, p);
918
- }
919
- return i;
920
- }
921
- function vr(e, t, n, r, o, s, i, a, c, f) {
922
- var u = t & W, p = u ? i : void 0, g = u ? void 0 : i, y = u ? s : void 0, h = u ? void 0 : s;
923
- t |= u ? ne : Se, t &= ~(u ? Se : ne), t & oa || (t &= ~(V | Ve));
924
- var m = n(e, t, o, y, p, h, g, a, c, f);
925
- return m.placeholder = r, Ar(m, e, t);
926
- }
927
- function Ja(e, t, n, r, o, s, i, a) {
928
- var c = t & Ve;
929
- if (!c && typeof e != "function")
930
- throw new TypeError(ra);
931
- var f = r ? r.length : 0;
932
- if (f || (t &= ~(ne | Se), r = o = void 0), i = i === void 0 ? i : De(Sn(i), 0), a = a === void 0 ? a : Sn(a), f -= o ? o.length : 0, t & Se) {
933
- var u = r, p = o;
934
- r = o = void 0;
935
- }
936
- var g = [
937
- e,
938
- t,
939
- n,
940
- r,
941
- o,
942
- u,
943
- p,
944
- s,
945
- i,
946
- a
947
- ];
948
- if (e = g[0], t = g[1], n = g[2], r = g[3], o = g[4], a = g[9] = g[9] == null ? c ? 0 : e.length : De(g[9] - f, 0), !a && t & (W | Re) && (t &= ~(W | Re)), !t || t == V)
949
- var y = Ga(e, t, n);
950
- else
951
- t == W || t == Re ? y = qa(e, t, a) : (t == ne || t == (V | ne)) && !o.length ? y = Ka(e, t, n, r) : y = Bt.apply(void 0, g);
952
- return Ar(y, e, t);
953
- }
954
- function Cr(e) {
955
- var t = e;
956
- return t.placeholder;
957
- }
958
- function On(e, t) {
959
- var n = Pa(e, t);
960
- return Da(n) ? n : void 0;
961
- }
962
- function Wa(e) {
963
- var t = e.match(ma);
964
- return t ? t[1].split(ga) : [];
965
- }
966
- function za(e, t) {
967
- var n = t.length, r = n - 1;
968
- return t[r] = (n > 1 ? "& " : "") + t[r], t = t.join(n > 2 ? ", " : " "), e.replace(da, `{
969
- /* [wrapped with ` + t + `] */
970
- `);
971
- }
972
- function Va(e, t) {
973
- return t = t ?? ia, !!t && (typeof e == "number" || ba.test(e)) && e > -1 && e % 1 == 0 && e < t;
974
- }
975
- function Xa(e) {
976
- return !!Rn && Rn in e;
977
- }
978
- function Qa(e, t) {
979
- for (var n = e.length, r = Ba(t.length, n), o = Ha(e); r--; ) {
980
- var s = t[r];
981
- e[r] = Va(s, n) ? o[s] : void 0;
982
- }
983
- return e;
984
- }
985
- var Ar = bn ? function(e, t, n) {
986
- var r = t + "";
987
- return bn(e, "toString", {
988
- configurable: !0,
989
- enumerable: !1,
990
- value: sc(za(r, Za(Wa(r), n)))
991
- });
992
- } : ic;
993
- function Ya(e) {
994
- if (e != null) {
995
- try {
996
- return wr.call(e);
997
- } catch {
998
- }
999
- try {
1000
- return e + "";
1001
- } catch {
1002
- }
1003
- }
1004
- return "";
1005
- }
1006
- function Za(e, t) {
1007
- return Ta(ca, function(n) {
1008
- var r = "_." + n[0];
1009
- t & n[1] && !va(e, r) && e.push(r);
1010
- }), e.sort();
1011
- }
1012
- function xt(e, t, n) {
1013
- t = n ? void 0 : t;
1014
- var r = Ja(e, W, void 0, void 0, void 0, void 0, void 0, t);
1015
- return r.placeholder = xt.placeholder, r;
1016
- }
1017
- function ec(e) {
1018
- var t = se(e) ? Tr.call(e) : "";
1019
- return t == ua || t == la;
1020
- }
1021
- function se(e) {
1022
- var t = typeof e;
1023
- return !!e && (t == "object" || t == "function");
1024
- }
1025
- function tc(e) {
1026
- return !!e && typeof e == "object";
1027
- }
1028
- function nc(e) {
1029
- return typeof e == "symbol" || tc(e) && Tr.call(e) == fa;
1030
- }
1031
- function rc(e) {
1032
- if (!e)
1033
- return e === 0 ? e : 0;
1034
- if (e = oc(e), e === _n || e === -_n) {
1035
- var t = e < 0 ? -1 : 1;
1036
- return t * aa;
1037
- }
1038
- return e === e ? e : 0;
1039
- }
1040
- function Sn(e) {
1041
- var t = rc(e), n = t % 1;
1042
- return t === t ? n ? t - n : t : 0;
1043
- }
1044
- function oc(e) {
1045
- if (typeof e == "number")
1046
- return e;
1047
- if (nc(e))
1048
- return En;
1049
- if (se(e)) {
1050
- var t = typeof e.valueOf == "function" ? e.valueOf() : e;
1051
- e = se(t) ? t + "" : t;
1052
- }
1053
- if (typeof e != "string")
1054
- return e === 0 ? e : +e;
1055
- e = e.replace(ha, "");
1056
- var n = _a.test(e);
1057
- return n || Ra.test(e) ? Oa(e.slice(2), n ? 2 : 8) : ya.test(e) ? En : +e;
1058
- }
1059
- function sc(e) {
1060
- return function() {
1061
- return e;
1062
- };
1063
- }
1064
- function ic(e) {
1065
- return e;
1066
- }
1067
- xt.placeholder = {};
1068
- var ac = xt;
1069
- const cc = /* @__PURE__ */ $t(ac), uc = async ({
1070
- cacheOptions: e,
1071
- cacheConfig: t,
1072
- apiConfig: n
1073
- }) => {
1074
- const r = t.useCache && !!e;
1075
- let o = "";
1076
- r && (o = Ii(e.getKey, "")(n));
1077
- const s = r ? await dn(
1078
- e.getCache,
1079
- Promise.resolve(void 0)
1080
- )(o) : void 0, i = r ? dn(
1081
- cc(e.setCache)(o),
1082
- Promise.resolve()
1083
- ) : void 0;
1084
- return {
1085
- cacheEnabled: r,
1086
- cacheKey: o,
1087
- cacheResult: s,
1088
- setCache: i
1089
- };
1090
- }, lc = (e, t) => {
1091
- try {
1092
- return e();
1093
- } catch (n) {
1094
- return t && P(
1095
- {
1096
- stage: $.DEAL_ERROR_ERROR,
1097
- data: n
1098
- },
1099
- G.ERROR
1100
- ), {
1101
- canShowErrorToast: !0,
1102
- newError: new be({
1103
- code: k.DEAL_ERROR,
1104
- message: Ee(n) ?? "处理RequestFailResult错误时出错",
1105
- cause: n
1106
- }),
1107
- reload: !1
1108
- };
1109
- }
1110
- };
1111
- class fc {
1112
- constructor(t) {
1113
- te(this, "options"), te(this, "request", async (n, r = !1) => {
1114
- var o;
1115
- r && P({
1116
- stage: $.BEFORE,
1117
- data: n
1118
- });
1119
- const { uiConfig: s = {}, cacheConfig: i = {}, ...a } = n, c = gn({}, this.uiConfig, s), f = gn({}, this.cacheConfig, i), { cacheResult: u, setCache: p } = await uc({
1120
- cacheOptions: this.cacheFn,
1121
- cacheConfig: f,
1122
- apiConfig: n
1123
- });
1124
- if (u)
1125
- return u;
1126
- const g = {
1127
- uiConfig: c,
1128
- cacheConfig: f
1129
- }, y = {
1130
- ...a,
1131
- BASE_PATH: this.basePath,
1132
- TIMEOUT: this.timeout,
1133
- debug: r
1134
- };
1135
- try {
1136
- const h = await this.issue(y, g);
1137
- return p == null || p(h, f), h;
1138
- } catch (h) {
1139
- const m = await lc(() => {
1140
- var d;
1141
- return r && P({
1142
- stage: $.DEAL_ERROR,
1143
- data: h
1144
- }), ((d = this.beforeError) == null ? void 0 : d.call(this, h, {
1145
- apiConfig: n,
1146
- extendConfig: g
1147
- })) || {
1148
- canShowErrorToast: !0,
1149
- newError: h
1150
- };
1151
- }, r);
1152
- if (m.reload)
1153
- return r && P({
1154
- stage: $.DEAL_ERROR_RESULT_RELOAD
1155
- }), this.request(n, r);
1156
- {
1157
- const { newError: d, canShowErrorToast: b = !0 } = m;
1158
- b && (c.errorToast ?? !0) && ((o = this.showToast) == null || o.call(this, d.message));
1159
- let E;
1160
- return d instanceof oe ? E = d : d.isBusinessError ? E = new Zn(d) : E = new be(d), r && P({
1161
- stage: $.DEAL_ERROR_RESULT_CONTINUE,
1162
- data: E
1163
- }), Promise.reject(E);
1164
- }
1165
- }
1166
- }), this.options = t;
1167
- }
1168
- get basePath() {
1169
- return this.options.basePath;
1170
- }
1171
- get timeout() {
1172
- return this.options.timeout;
1173
- }
1174
- get uiConfig() {
1175
- return this.options.uiConfig || {};
1176
- }
1177
- get cacheConfig() {
1178
- return this.options.cacheConfig || {};
1179
- }
1180
- /** 缓存相关方法 */
1181
- get cacheFn() {
1182
- return this.options.cache;
1183
- }
1184
- get issue() {
1185
- return this.options.issue;
1186
- }
1187
- get beforeError() {
1188
- return this.options.beforeError;
1189
- }
1190
- get showToast() {
1191
- return this.options.showToast;
1192
- }
1193
- }
1194
- const pc = (e) => new fc(e);
1195
- var q = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1196
- function Nr(e) {
1197
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1198
- }
1199
- var hc = 200, Dt = "__lodash_hash_undefined__", dc = 1 / 0, $r = 9007199254740991, mc = "[object Arguments]", gc = "[object Function]", yc = "[object GeneratorFunction]", _c = "[object Symbol]", Ec = /[\\^$.*+?()[\]{}|]/g, Rc = /^\[object .+?Constructor\]$/, bc = /^(?:0|[1-9]\d*)$/, Oc = typeof q == "object" && q && q.Object === Object && q, Sc = typeof self == "object" && self && self.Object === Object && self, Ft = Oc || Sc || Function("return this")();
1200
- function wc(e, t, n) {
1201
- switch (n.length) {
1202
- case 0:
1203
- return e.call(t);
1204
- case 1:
1205
- return e.call(t, n[0]);
1206
- case 2:
1207
- return e.call(t, n[0], n[1]);
1208
- case 3:
1209
- return e.call(t, n[0], n[1], n[2]);
1210
- }
1211
- return e.apply(t, n);
1212
- }
1213
- function Tc(e, t) {
1214
- var n = e ? e.length : 0;
1215
- return !!n && Ac(e, t, 0) > -1;
1216
- }
1217
- function vc(e, t, n) {
1218
- for (var r = -1, o = e ? e.length : 0; ++r < o; )
1219
- if (n(t, e[r]))
1220
- return !0;
1221
- return !1;
1222
- }
1223
- function Pr(e, t) {
1224
- for (var n = -1, r = e ? e.length : 0, o = Array(r); ++n < r; )
1225
- o[n] = t(e[n], n, e);
1226
- return o;
1227
- }
1228
- function kt(e, t) {
1229
- for (var n = -1, r = t.length, o = e.length; ++n < r; )
1230
- e[o + n] = t[n];
1231
- return e;
1232
- }
1233
- function Cc(e, t, n, r) {
1234
- for (var o = e.length, s = n + (r ? 1 : -1); r ? s-- : ++s < o; )
1235
- if (t(e[s], s, e))
1236
- return s;
1237
- return -1;
1238
- }
1239
- function Ac(e, t, n) {
1240
- if (t !== t)
1241
- return Cc(e, Nc, n);
1242
- for (var r = n - 1, o = e.length; ++r < o; )
1243
- if (e[r] === t)
1244
- return r;
1245
- return -1;
1246
- }
1247
- function Nc(e) {
1248
- return e !== e;
1249
- }
1250
- function $c(e, t) {
1251
- for (var n = -1, r = Array(e); ++n < e; )
1252
- r[n] = t(n);
1253
- return r;
1254
- }
1255
- function Pc(e) {
1256
- return function(t) {
1257
- return e(t);
1258
- };
1259
- }
1260
- function Ic(e, t) {
1261
- return e.has(t);
1262
- }
1263
- function Mc(e, t) {
1264
- return e == null ? void 0 : e[t];
1265
- }
1266
- function jc(e) {
1267
- var t = !1;
1268
- if (e != null && typeof e.toString != "function")
1269
- try {
1270
- t = !!(e + "");
1271
- } catch {
1272
- }
1273
- return t;
1274
- }
1275
- function Ir(e, t) {
1276
- return function(n) {
1277
- return e(t(n));
1278
- };
1279
- }
1280
- var Uc = Array.prototype, Lc = Function.prototype, Xe = Object.prototype, dt = Ft["__core-js_shared__"], wn = function() {
1281
- var e = /[^.]+$/.exec(dt && dt.keys && dt.keys.IE_PROTO || "");
1282
- return e ? "Symbol(src)_1." + e : "";
1283
- }(), Mr = Lc.toString, le = Xe.hasOwnProperty, Ht = Xe.toString, Bc = RegExp(
1284
- "^" + Mr.call(le).replace(Ec, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1285
- ), Tn = Ft.Symbol, xc = Ir(Object.getPrototypeOf, Object), Dc = Xe.propertyIsEnumerable, Fc = Uc.splice, vn = Tn ? Tn.isConcatSpreadable : void 0, bt = Object.getOwnPropertySymbols, Cn = Math.max, kc = Ur(Ft, "Map"), Te = Ur(Object, "create");
1286
- function X(e) {
1287
- var t = -1, n = e ? e.length : 0;
1288
- for (this.clear(); ++t < n; ) {
1289
- var r = e[t];
1290
- this.set(r[0], r[1]);
1291
- }
1292
- }
1293
- function Hc() {
1294
- this.__data__ = Te ? Te(null) : {};
1295
- }
1296
- function Gc(e) {
1297
- return this.has(e) && delete this.__data__[e];
1298
- }
1299
- function qc(e) {
1300
- var t = this.__data__;
1301
- if (Te) {
1302
- var n = t[e];
1303
- return n === Dt ? void 0 : n;
1304
- }
1305
- return le.call(t, e) ? t[e] : void 0;
1306
- }
1307
- function Kc(e) {
1308
- var t = this.__data__;
1309
- return Te ? t[e] !== void 0 : le.call(t, e);
1310
- }
1311
- function Jc(e, t) {
1312
- var n = this.__data__;
1313
- return n[e] = Te && t === void 0 ? Dt : t, this;
1314
- }
1315
- X.prototype.clear = Hc;
1316
- X.prototype.delete = Gc;
1317
- X.prototype.get = qc;
1318
- X.prototype.has = Kc;
1319
- X.prototype.set = Jc;
1320
- function fe(e) {
1321
- var t = -1, n = e ? e.length : 0;
1322
- for (this.clear(); ++t < n; ) {
1323
- var r = e[t];
1324
- this.set(r[0], r[1]);
1325
- }
1326
- }
1327
- function Wc() {
1328
- this.__data__ = [];
1329
- }
1330
- function zc(e) {
1331
- var t = this.__data__, n = Qe(t, e);
1332
- if (n < 0)
1333
- return !1;
1334
- var r = t.length - 1;
1335
- return n == r ? t.pop() : Fc.call(t, n, 1), !0;
1336
- }
1337
- function Vc(e) {
1338
- var t = this.__data__, n = Qe(t, e);
1339
- return n < 0 ? void 0 : t[n][1];
1340
- }
1341
- function Xc(e) {
1342
- return Qe(this.__data__, e) > -1;
1343
- }
1344
- function Qc(e, t) {
1345
- var n = this.__data__, r = Qe(n, e);
1346
- return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
1347
- }
1348
- fe.prototype.clear = Wc;
1349
- fe.prototype.delete = zc;
1350
- fe.prototype.get = Vc;
1351
- fe.prototype.has = Xc;
1352
- fe.prototype.set = Qc;
1353
- function pe(e) {
1354
- var t = -1, n = e ? e.length : 0;
1355
- for (this.clear(); ++t < n; ) {
1356
- var r = e[t];
1357
- this.set(r[0], r[1]);
1358
- }
1359
- }
1360
- function Yc() {
1361
- this.__data__ = {
1362
- hash: new X(),
1363
- map: new (kc || fe)(),
1364
- string: new X()
1365
- };
1366
- }
1367
- function Zc(e) {
1368
- return Ye(this, e).delete(e);
1369
- }
1370
- function eu(e) {
1371
- return Ye(this, e).get(e);
1372
- }
1373
- function tu(e) {
1374
- return Ye(this, e).has(e);
1375
- }
1376
- function nu(e, t) {
1377
- return Ye(this, e).set(e, t), this;
1378
- }
1379
- pe.prototype.clear = Yc;
1380
- pe.prototype.delete = Zc;
1381
- pe.prototype.get = eu;
1382
- pe.prototype.has = tu;
1383
- pe.prototype.set = nu;
1384
- function Fe(e) {
1385
- var t = -1, n = e ? e.length : 0;
1386
- for (this.__data__ = new pe(); ++t < n; )
1387
- this.add(e[t]);
1388
- }
1389
- function ru(e) {
1390
- return this.__data__.set(e, Dt), this;
1391
- }
1392
- function ou(e) {
1393
- return this.__data__.has(e);
1394
- }
1395
- Fe.prototype.add = Fe.prototype.push = ru;
1396
- Fe.prototype.has = ou;
1397
- function su(e, t) {
1398
- var n = Gt(e) || Lr(e) ? $c(e.length, String) : [], r = n.length, o = !!r;
1399
- for (var s in e)
1400
- (t || le.call(e, s)) && !(o && (s == "length" || yu(s, r))) && n.push(s);
1401
- return n;
1402
- }
1403
- function Qe(e, t) {
1404
- for (var n = e.length; n--; )
1405
- if (wu(e[n][0], t))
1406
- return n;
1407
- return -1;
1408
- }
1409
- function iu(e, t, n, r) {
1410
- var o = -1, s = Tc, i = !0, a = e.length, c = [], f = t.length;
1411
- if (!a)
1412
- return c;
1413
- n && (t = Pr(t, Pc(n))), r ? (s = vc, i = !1) : t.length >= hc && (s = Ic, i = !1, t = new Fe(t));
1414
- e:
1415
- for (; ++o < a; ) {
1416
- var u = e[o], p = n ? n(u) : u;
1417
- if (u = r || u !== 0 ? u : 0, i && p === p) {
1418
- for (var g = f; g--; )
1419
- if (t[g] === p)
1420
- continue e;
1421
- c.push(u);
1422
- } else
1423
- s(t, p, r) || c.push(u);
1424
- }
1425
- return c;
1426
- }
1427
- function jr(e, t, n, r, o) {
1428
- var s = -1, i = e.length;
1429
- for (n || (n = gu), o || (o = []); ++s < i; ) {
1430
- var a = e[s];
1431
- t > 0 && n(a) ? t > 1 ? jr(a, t - 1, n, r, o) : kt(o, a) : r || (o[o.length] = a);
1432
- }
1433
- return o;
1434
- }
1435
- function au(e, t, n) {
1436
- var r = t(e);
1437
- return Gt(e) ? r : kt(r, n(e));
1438
- }
1439
- function cu(e) {
1440
- if (!qt(e) || Eu(e))
1441
- return !1;
1442
- var t = xr(e) || jc(e) ? Bc : Rc;
1443
- return t.test(Su(e));
1444
- }
1445
- function uu(e) {
1446
- if (!qt(e))
1447
- return bu(e);
1448
- var t = Ru(e), n = [];
1449
- for (var r in e)
1450
- r == "constructor" && (t || !le.call(e, r)) || n.push(r);
1451
- return n;
1452
- }
1453
- function lu(e, t) {
1454
- return e = Object(e), fu(e, t, function(n, r) {
1455
- return r in e;
1456
- });
1457
- }
1458
- function fu(e, t, n) {
1459
- for (var r = -1, o = t.length, s = {}; ++r < o; ) {
1460
- var i = t[r], a = e[i];
1461
- n(a, i) && (s[i] = a);
1462
- }
1463
- return s;
1464
- }
1465
- function pu(e, t) {
1466
- return t = Cn(t === void 0 ? e.length - 1 : t, 0), function() {
1467
- for (var n = arguments, r = -1, o = Cn(n.length - t, 0), s = Array(o); ++r < o; )
1468
- s[r] = n[t + r];
1469
- r = -1;
1470
- for (var i = Array(t + 1); ++r < t; )
1471
- i[r] = n[r];
1472
- return i[t] = s, wc(e, this, i);
1473
- };
1474
- }
1475
- function hu(e) {
1476
- return au(e, Au, mu);
1477
- }
1478
- function Ye(e, t) {
1479
- var n = e.__data__;
1480
- return _u(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1481
- }
1482
- function Ur(e, t) {
1483
- var n = Mc(e, t);
1484
- return cu(n) ? n : void 0;
1485
- }
1486
- var du = bt ? Ir(bt, Object) : Fr, mu = bt ? function(e) {
1487
- for (var t = []; e; )
1488
- kt(t, du(e)), e = xc(e);
1489
- return t;
1490
- } : Fr;
1491
- function gu(e) {
1492
- return Gt(e) || Lr(e) || !!(vn && e && e[vn]);
1493
- }
1494
- function yu(e, t) {
1495
- return t = t ?? $r, !!t && (typeof e == "number" || bc.test(e)) && e > -1 && e % 1 == 0 && e < t;
1496
- }
1497
- function _u(e) {
1498
- var t = typeof e;
1499
- return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
1500
- }
1501
- function Eu(e) {
1502
- return !!wn && wn in e;
1503
- }
1504
- function Ru(e) {
1505
- var t = e && e.constructor, n = typeof t == "function" && t.prototype || Xe;
1506
- return e === n;
1507
- }
1508
- function bu(e) {
1509
- var t = [];
1510
- if (e != null)
1511
- for (var n in Object(e))
1512
- t.push(n);
1513
- return t;
1514
- }
1515
- function Ou(e) {
1516
- if (typeof e == "string" || Cu(e))
1517
- return e;
1518
- var t = e + "";
1519
- return t == "0" && 1 / e == -dc ? "-0" : t;
1520
- }
1521
- function Su(e) {
1522
- if (e != null) {
1523
- try {
1524
- return Mr.call(e);
1525
- } catch {
1526
- }
1527
- try {
1528
- return e + "";
1529
- } catch {
1530
- }
1531
- }
1532
- return "";
1533
- }
1534
- function wu(e, t) {
1535
- return e === t || e !== e && t !== t;
1536
- }
1537
- function Lr(e) {
1538
- return Tu(e) && le.call(e, "callee") && (!Dc.call(e, "callee") || Ht.call(e) == mc);
1539
- }
1540
- var Gt = Array.isArray;
1541
- function Br(e) {
1542
- return e != null && vu(e.length) && !xr(e);
1543
- }
1544
- function Tu(e) {
1545
- return Dr(e) && Br(e);
1546
- }
1547
- function xr(e) {
1548
- var t = qt(e) ? Ht.call(e) : "";
1549
- return t == gc || t == yc;
1550
- }
1551
- function vu(e) {
1552
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= $r;
1553
- }
1554
- function qt(e) {
1555
- var t = typeof e;
1556
- return !!e && (t == "object" || t == "function");
1557
- }
1558
- function Dr(e) {
1559
- return !!e && typeof e == "object";
1560
- }
1561
- function Cu(e) {
1562
- return typeof e == "symbol" || Dr(e) && Ht.call(e) == _c;
1563
- }
1564
- function Au(e) {
1565
- return Br(e) ? su(e, !0) : uu(e);
1566
- }
1567
- var Nu = pu(function(e, t) {
1568
- return e == null ? {} : (t = Pr(jr(t, 1), Ou), lu(e, iu(hu(e), t)));
1569
- });
1570
- function Fr() {
1571
- return [];
1572
- }
1573
- var $u = Nu;
1574
- const Pu = /* @__PURE__ */ Nr($u);
1575
- var Iu = "Expected a function", kr = "__lodash_hash_undefined__", Hr = 1 / 0, Mu = "[object Function]", ju = "[object GeneratorFunction]", Uu = "[object Symbol]", Lu = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Bu = /^\w*$/, xu = /^\./, Du = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Fu = /[\\^$.*+?()[\]{}|]/g, ku = /\\(\\)?/g, Hu = /^\[object .+?Constructor\]$/, Gu = typeof q == "object" && q && q.Object === Object && q, qu = typeof self == "object" && self && self.Object === Object && self, Kt = Gu || qu || Function("return this")();
1576
- function Ku(e, t) {
1577
- return e == null ? void 0 : e[t];
1578
- }
1579
- function Ju(e) {
1580
- var t = !1;
1581
- if (e != null && typeof e.toString != "function")
1582
- try {
1583
- t = !!(e + "");
1584
- } catch {
1585
- }
1586
- return t;
1587
- }
1588
- var Wu = Array.prototype, zu = Function.prototype, Gr = Object.prototype, mt = Kt["__core-js_shared__"], An = function() {
1589
- var e = /[^.]+$/.exec(mt && mt.keys && mt.keys.IE_PROTO || "");
1590
- return e ? "Symbol(src)_1." + e : "";
1591
- }(), qr = zu.toString, Jt = Gr.hasOwnProperty, Kr = Gr.toString, Vu = RegExp(
1592
- "^" + qr.call(Jt).replace(Fu, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1593
- ), Nn = Kt.Symbol, Xu = Wu.splice, Qu = Jr(Kt, "Map"), ve = Jr(Object, "create"), $n = Nn ? Nn.prototype : void 0, Pn = $n ? $n.toString : void 0;
1594
- function Q(e) {
1595
- var t = -1, n = e ? e.length : 0;
1596
- for (this.clear(); ++t < n; ) {
1597
- var r = e[t];
1598
- this.set(r[0], r[1]);
1599
- }
1600
- }
1601
- function Yu() {
1602
- this.__data__ = ve ? ve(null) : {};
1603
- }
1604
- function Zu(e) {
1605
- return this.has(e) && delete this.__data__[e];
1606
- }
1607
- function el(e) {
1608
- var t = this.__data__;
1609
- if (ve) {
1610
- var n = t[e];
1611
- return n === kr ? void 0 : n;
1612
- }
1613
- return Jt.call(t, e) ? t[e] : void 0;
1614
- }
1615
- function tl(e) {
1616
- var t = this.__data__;
1617
- return ve ? t[e] !== void 0 : Jt.call(t, e);
1618
- }
1619
- function nl(e, t) {
1620
- var n = this.__data__;
1621
- return n[e] = ve && t === void 0 ? kr : t, this;
1622
- }
1623
- Q.prototype.clear = Yu;
1624
- Q.prototype.delete = Zu;
1625
- Q.prototype.get = el;
1626
- Q.prototype.has = tl;
1627
- Q.prototype.set = nl;
1628
- function he(e) {
1629
- var t = -1, n = e ? e.length : 0;
1630
- for (this.clear(); ++t < n; ) {
1631
- var r = e[t];
1632
- this.set(r[0], r[1]);
1633
- }
1634
- }
1635
- function rl() {
1636
- this.__data__ = [];
1637
- }
1638
- function ol(e) {
1639
- var t = this.__data__, n = Ze(t, e);
1640
- if (n < 0)
1641
- return !1;
1642
- var r = t.length - 1;
1643
- return n == r ? t.pop() : Xu.call(t, n, 1), !0;
1644
- }
1645
- function sl(e) {
1646
- var t = this.__data__, n = Ze(t, e);
1647
- return n < 0 ? void 0 : t[n][1];
1648
- }
1649
- function il(e) {
1650
- return Ze(this.__data__, e) > -1;
1651
- }
1652
- function al(e, t) {
1653
- var n = this.__data__, r = Ze(n, e);
1654
- return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
1655
- }
1656
- he.prototype.clear = rl;
1657
- he.prototype.delete = ol;
1658
- he.prototype.get = sl;
1659
- he.prototype.has = il;
1660
- he.prototype.set = al;
1661
- function Z(e) {
1662
- var t = -1, n = e ? e.length : 0;
1663
- for (this.clear(); ++t < n; ) {
1664
- var r = e[t];
1665
- this.set(r[0], r[1]);
1666
- }
1667
- }
1668
- function cl() {
1669
- this.__data__ = {
1670
- hash: new Q(),
1671
- map: new (Qu || he)(),
1672
- string: new Q()
1673
- };
1674
- }
1675
- function ul(e) {
1676
- return et(this, e).delete(e);
1677
- }
1678
- function ll(e) {
1679
- return et(this, e).get(e);
1680
- }
1681
- function fl(e) {
1682
- return et(this, e).has(e);
1683
- }
1684
- function pl(e, t) {
1685
- return et(this, e).set(e, t), this;
1686
- }
1687
- Z.prototype.clear = cl;
1688
- Z.prototype.delete = ul;
1689
- Z.prototype.get = ll;
1690
- Z.prototype.has = fl;
1691
- Z.prototype.set = pl;
1692
- function Ze(e, t) {
1693
- for (var n = e.length; n--; )
1694
- if (Sl(e[n][0], t))
1695
- return n;
1696
- return -1;
1697
- }
1698
- function hl(e, t) {
1699
- t = yl(t, e) ? [t] : gl(t);
1700
- for (var n = 0, r = t.length; e != null && n < r; )
1701
- e = e[bl(t[n++])];
1702
- return n && n == r ? e : void 0;
1703
- }
1704
- function dl(e) {
1705
- if (!zr(e) || El(e))
1706
- return !1;
1707
- var t = wl(e) || Ju(e) ? Vu : Hu;
1708
- return t.test(Ol(e));
1709
- }
1710
- function ml(e) {
1711
- if (typeof e == "string")
1712
- return e;
1713
- if (zt(e))
1714
- return Pn ? Pn.call(e) : "";
1715
- var t = e + "";
1716
- return t == "0" && 1 / e == -Hr ? "-0" : t;
1717
- }
1718
- function gl(e) {
1719
- return Wr(e) ? e : Rl(e);
1720
- }
1721
- function et(e, t) {
1722
- var n = e.__data__;
1723
- return _l(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1724
- }
1725
- function Jr(e, t) {
1726
- var n = Ku(e, t);
1727
- return dl(n) ? n : void 0;
1728
- }
1729
- function yl(e, t) {
1730
- if (Wr(e))
1731
- return !1;
1732
- var n = typeof e;
1733
- return n == "number" || n == "symbol" || n == "boolean" || e == null || zt(e) ? !0 : Bu.test(e) || !Lu.test(e) || t != null && e in Object(t);
1734
- }
1735
- function _l(e) {
1736
- var t = typeof e;
1737
- return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
1738
- }
1739
- function El(e) {
1740
- return !!An && An in e;
1741
- }
1742
- var Rl = Wt(function(e) {
1743
- e = vl(e);
1744
- var t = [];
1745
- return xu.test(e) && t.push(""), e.replace(Du, function(n, r, o, s) {
1746
- t.push(o ? s.replace(ku, "$1") : r || n);
1747
- }), t;
1748
- });
1749
- function bl(e) {
1750
- if (typeof e == "string" || zt(e))
1751
- return e;
1752
- var t = e + "";
1753
- return t == "0" && 1 / e == -Hr ? "-0" : t;
1754
- }
1755
- function Ol(e) {
1756
- if (e != null) {
1757
- try {
1758
- return qr.call(e);
1759
- } catch {
1760
- }
1761
- try {
1762
- return e + "";
1763
- } catch {
1764
- }
1765
- }
1766
- return "";
1767
- }
1768
- function Wt(e, t) {
1769
- if (typeof e != "function" || t && typeof t != "function")
1770
- throw new TypeError(Iu);
1771
- var n = function() {
1772
- var r = arguments, o = t ? t.apply(this, r) : r[0], s = n.cache;
1773
- if (s.has(o))
1774
- return s.get(o);
1775
- var i = e.apply(this, r);
1776
- return n.cache = s.set(o, i), i;
1777
- };
1778
- return n.cache = new (Wt.Cache || Z)(), n;
1779
- }
1780
- Wt.Cache = Z;
1781
- function Sl(e, t) {
1782
- return e === t || e !== e && t !== t;
1783
- }
1784
- var Wr = Array.isArray;
1785
- function wl(e) {
1786
- var t = zr(e) ? Kr.call(e) : "";
1787
- return t == Mu || t == ju;
1788
- }
1789
- function zr(e) {
1790
- var t = typeof e;
1791
- return !!e && (t == "object" || t == "function");
1792
- }
1793
- function Tl(e) {
1794
- return !!e && typeof e == "object";
1795
- }
1796
- function zt(e) {
1797
- return typeof e == "symbol" || Tl(e) && Kr.call(e) == Uu;
1798
- }
1799
- function vl(e) {
1800
- return e == null ? "" : ml(e);
1801
- }
1802
- function Cl(e, t, n) {
1803
- var r = e == null ? void 0 : hl(e, t);
1804
- return r === void 0 ? n : r;
1805
- }
1806
- var Al = Cl;
1807
- const Nl = /* @__PURE__ */ Nr(Al), Vr = ({
1808
- basePath: e,
1809
- timeout: t,
1810
- beforeRequest: n = (c) => c,
1811
- networkSuccessCodeList: r,
1812
- isSuccessNetworkCode: o = (c) => Array.isArray(r) ? r.includes(c) : c >= 200 && c < 300,
1813
- instanceCreateConfig: s = {},
1814
- axios: i,
1815
- ...a
1816
- }) => {
1817
- const c = i.create({
1818
- baseURL: e,
1819
- timeout: t,
1820
- ...s,
1821
- validateStatus: o
1822
- });
1823
- c.interceptors.request.use(n, (u) => {
1824
- if (u instanceof oe)
1825
- return Promise.reject(u);
1826
- const p = new be({
1827
- code: k.REQUEST_ERROR,
1828
- message: Ee(u) ?? "发起请求出错",
1829
- cause: u
1830
- });
1831
- return Promise.reject(p);
1832
- });
1833
- const { request: f } = pc({
1834
- ...a,
1835
- basePath: e,
1836
- timeout: t,
1837
- issue: ({ TIMEOUT: u, DEBUG: p, ...g }) => c({
1838
- timeout: u,
1839
- ...Pu(g, ["BASE_PATH"])
1840
- }).then((y) => Pi(y, a, p)).catch((y) => {
1841
- if (y instanceof oe)
1842
- return p && P(
1843
- {
1844
- stage: $.NETWORK_ERROR_ORIGIN,
1845
- data: y
1846
- },
1847
- G.ERROR
1848
- ), Promise.reject(y);
1849
- const { response: h, request: m } = y;
1850
- let d, b;
1851
- h ? (d = h.status, b = h.statusText) : m ? (d = k.NO_RESPONSE, i.isAxiosError(y) ? y.message.includes("timeout of") ? (d = k.NO_RESPONSE_TIMEOUT, b = "请求超时") : Nl(globalThis, "navigator.onLine") === !1 ? (d = k.NO_RESPONSE_OFFLINE, b = "网络未连接") : b = y.message : b = Ee(y) ?? "未响应") : (d = k.REQUEST_ERROR, b = Ee(y) ?? "发起请求出错");
1852
- const E = new be({
1853
- code: d,
1854
- message: b,
1855
- cause: y
1856
- });
1857
- return p && P(
1858
- {
1859
- stage: $.NETWORK_ERROR_PACK,
1860
- data: E
1861
- },
1862
- G.ERROR
1863
- ), Promise.reject(E);
1864
- })
1865
- });
1866
- return f;
1867
- };
1868
- function Xr(e, t) {
1869
- return function() {
1870
- return e.apply(t, arguments);
1871
- };
1872
- }
1873
- const { toString: $l } = Object.prototype, { getPrototypeOf: Vt } = Object, tt = ((e) => (t) => {
1874
- const n = $l.call(t);
1875
- return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
1876
- })(/* @__PURE__ */ Object.create(null)), M = (e) => (e = e.toLowerCase(), (t) => tt(t) === e), nt = (e) => (t) => typeof t === e, { isArray: de } = Array, Ce = nt("undefined");
1877
- function Pl(e) {
1878
- return e !== null && !Ce(e) && e.constructor !== null && !Ce(e.constructor) && A(e.constructor.isBuffer) && e.constructor.isBuffer(e);
1879
- }
1880
- const Qr = M("ArrayBuffer");
1881
- function Il(e) {
1882
- let t;
1883
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Qr(e.buffer), t;
1884
- }
1885
- const Ml = nt("string"), A = nt("function"), Yr = nt("number"), rt = (e) => e !== null && typeof e == "object", jl = (e) => e === !0 || e === !1, Me = (e) => {
1886
- if (tt(e) !== "object")
1887
- return !1;
1888
- const t = Vt(e);
1889
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
1890
- }, Ul = M("Date"), Ll = M("File"), Bl = M("Blob"), xl = M("FileList"), Dl = (e) => rt(e) && A(e.pipe), Fl = (e) => {
1891
- let t;
1892
- return e && (typeof FormData == "function" && e instanceof FormData || A(e.append) && ((t = tt(e)) === "formdata" || // detect form-data instance
1893
- t === "object" && A(e.toString) && e.toString() === "[object FormData]"));
1894
- }, kl = M("URLSearchParams"), [Hl, Gl, ql, Kl] = ["ReadableStream", "Request", "Response", "Headers"].map(M), Jl = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
1895
- function $e(e, t, { allOwnKeys: n = !1 } = {}) {
1896
- if (e === null || typeof e > "u")
1897
- return;
1898
- let r, o;
1899
- if (typeof e != "object" && (e = [e]), de(e))
1900
- for (r = 0, o = e.length; r < o; r++)
1901
- t.call(null, e[r], r, e);
1902
- else {
1903
- const s = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = s.length;
1904
- let a;
1905
- for (r = 0; r < i; r++)
1906
- a = s[r], t.call(null, e[a], a, e);
1907
- }
1908
- }
1909
- function Zr(e, t) {
1910
- t = t.toLowerCase();
1911
- const n = Object.keys(e);
1912
- let r = n.length, o;
1913
- for (; r-- > 0; )
1914
- if (o = n[r], t === o.toLowerCase())
1915
- return o;
1916
- return null;
1917
- }
1918
- const J = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), eo = (e) => !Ce(e) && e !== J;
1919
- function Ot() {
1920
- const { caseless: e } = eo(this) && this || {}, t = {}, n = (r, o) => {
1921
- const s = e && Zr(t, o) || o;
1922
- Me(t[s]) && Me(r) ? t[s] = Ot(t[s], r) : Me(r) ? t[s] = Ot({}, r) : de(r) ? t[s] = r.slice() : t[s] = r;
1923
- };
1924
- for (let r = 0, o = arguments.length; r < o; r++)
1925
- arguments[r] && $e(arguments[r], n);
1926
- return t;
1927
- }
1928
- const Wl = (e, t, n, { allOwnKeys: r } = {}) => ($e(t, (o, s) => {
1929
- n && A(o) ? e[s] = Xr(o, n) : e[s] = o;
1930
- }, { allOwnKeys: r }), e), zl = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Vl = (e, t, n, r) => {
1931
- e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
1932
- value: t.prototype
1933
- }), n && Object.assign(e.prototype, n);
1934
- }, Xl = (e, t, n, r) => {
1935
- let o, s, i;
1936
- const a = {};
1937
- if (t = t || {}, e == null)
1938
- return t;
1939
- do {
1940
- for (o = Object.getOwnPropertyNames(e), s = o.length; s-- > 0; )
1941
- i = o[s], (!r || r(i, e, t)) && !a[i] && (t[i] = e[i], a[i] = !0);
1942
- e = n !== !1 && Vt(e);
1943
- } while (e && (!n || n(e, t)) && e !== Object.prototype);
1944
- return t;
1945
- }, Ql = (e, t, n) => {
1946
- e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
1947
- const r = e.indexOf(t, n);
1948
- return r !== -1 && r === n;
1949
- }, Yl = (e) => {
1950
- if (!e)
1951
- return null;
1952
- if (de(e))
1953
- return e;
1954
- let t = e.length;
1955
- if (!Yr(t))
1956
- return null;
1957
- const n = new Array(t);
1958
- for (; t-- > 0; )
1959
- n[t] = e[t];
1960
- return n;
1961
- }, Zl = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Vt(Uint8Array)), ef = (e, t) => {
1962
- const r = (e && e[Symbol.iterator]).call(e);
1963
- let o;
1964
- for (; (o = r.next()) && !o.done; ) {
1965
- const s = o.value;
1966
- t.call(e, s[0], s[1]);
1967
- }
1968
- }, tf = (e, t) => {
1969
- let n;
1970
- const r = [];
1971
- for (; (n = e.exec(t)) !== null; )
1972
- r.push(n);
1973
- return r;
1974
- }, nf = M("HTMLFormElement"), rf = (e) => e.toLowerCase().replace(
1975
- /[-_\s]([a-z\d])(\w*)/g,
1976
- function(n, r, o) {
1977
- return r.toUpperCase() + o;
1978
- }
1979
- ), In = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), of = M("RegExp"), to = (e, t) => {
1980
- const n = Object.getOwnPropertyDescriptors(e), r = {};
1981
- $e(n, (o, s) => {
1982
- let i;
1983
- (i = t(o, s, e)) !== !1 && (r[s] = i || o);
1984
- }), Object.defineProperties(e, r);
1985
- }, sf = (e) => {
1986
- to(e, (t, n) => {
1987
- if (A(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
1988
- return !1;
1989
- const r = e[n];
1990
- if (A(r)) {
1991
- if (t.enumerable = !1, "writable" in t) {
1992
- t.writable = !1;
1993
- return;
1994
- }
1995
- t.set || (t.set = () => {
1996
- throw Error("Can not rewrite read-only method '" + n + "'");
1997
- });
1998
- }
1999
- });
2000
- }, af = (e, t) => {
2001
- const n = {}, r = (o) => {
2002
- o.forEach((s) => {
2003
- n[s] = !0;
2004
- });
2005
- };
2006
- return de(e) ? r(e) : r(String(e).split(t)), n;
2007
- }, cf = () => {
2008
- }, uf = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
2009
- function lf(e) {
2010
- return !!(e && A(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
2011
- }
2012
- const ff = (e) => {
2013
- const t = new Array(10), n = (r, o) => {
2014
- if (rt(r)) {
2015
- if (t.indexOf(r) >= 0)
2016
- return;
2017
- if (!("toJSON" in r)) {
2018
- t[o] = r;
2019
- const s = de(r) ? [] : {};
2020
- return $e(r, (i, a) => {
2021
- const c = n(i, o + 1);
2022
- !Ce(c) && (s[a] = c);
2023
- }), t[o] = void 0, s;
2024
- }
2025
- }
2026
- return r;
2027
- };
2028
- return n(e, 0);
2029
- }, pf = M("AsyncFunction"), hf = (e) => e && (rt(e) || A(e)) && A(e.then) && A(e.catch), no = ((e, t) => e ? setImmediate : t ? ((n, r) => (J.addEventListener("message", ({ source: o, data: s }) => {
2030
- o === J && s === n && r.length && r.shift()();
2031
- }, !1), (o) => {
2032
- r.push(o), J.postMessage(n, "*");
2033
- }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
2034
- typeof setImmediate == "function",
2035
- A(J.postMessage)
2036
- ), df = typeof queueMicrotask < "u" ? queueMicrotask.bind(J) : typeof process < "u" && process.nextTick || no, l = {
2037
- isArray: de,
2038
- isArrayBuffer: Qr,
2039
- isBuffer: Pl,
2040
- isFormData: Fl,
2041
- isArrayBufferView: Il,
2042
- isString: Ml,
2043
- isNumber: Yr,
2044
- isBoolean: jl,
2045
- isObject: rt,
2046
- isPlainObject: Me,
2047
- isReadableStream: Hl,
2048
- isRequest: Gl,
2049
- isResponse: ql,
2050
- isHeaders: Kl,
2051
- isUndefined: Ce,
2052
- isDate: Ul,
2053
- isFile: Ll,
2054
- isBlob: Bl,
2055
- isRegExp: of,
2056
- isFunction: A,
2057
- isStream: Dl,
2058
- isURLSearchParams: kl,
2059
- isTypedArray: Zl,
2060
- isFileList: xl,
2061
- forEach: $e,
2062
- merge: Ot,
2063
- extend: Wl,
2064
- trim: Jl,
2065
- stripBOM: zl,
2066
- inherits: Vl,
2067
- toFlatObject: Xl,
2068
- kindOf: tt,
2069
- kindOfTest: M,
2070
- endsWith: Ql,
2071
- toArray: Yl,
2072
- forEachEntry: ef,
2073
- matchAll: tf,
2074
- isHTMLForm: nf,
2075
- hasOwnProperty: In,
2076
- hasOwnProp: In,
2077
- // an alias to avoid ESLint no-prototype-builtins detection
2078
- reduceDescriptors: to,
2079
- freezeMethods: sf,
2080
- toObjectSet: af,
2081
- toCamelCase: rf,
2082
- noop: cf,
2083
- toFiniteNumber: uf,
2084
- findKey: Zr,
2085
- global: J,
2086
- isContextDefined: eo,
2087
- isSpecCompliantForm: lf,
2088
- toJSONObject: ff,
2089
- isAsyncFn: pf,
2090
- isThenable: hf,
2091
- setImmediate: no,
2092
- asap: df
2093
- };
2094
- function R(e, t, n, r, o) {
2095
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
2096
- }
2097
- l.inherits(R, Error, {
2098
- toJSON: function() {
2099
- return {
2100
- // Standard
2101
- message: this.message,
2102
- name: this.name,
2103
- // Microsoft
2104
- description: this.description,
2105
- number: this.number,
2106
- // Mozilla
2107
- fileName: this.fileName,
2108
- lineNumber: this.lineNumber,
2109
- columnNumber: this.columnNumber,
2110
- stack: this.stack,
2111
- // Axios
2112
- config: l.toJSONObject(this.config),
2113
- code: this.code,
2114
- status: this.status
2115
- };
2116
- }
2117
- });
2118
- const ro = R.prototype, oo = {};
2119
- [
2120
- "ERR_BAD_OPTION_VALUE",
2121
- "ERR_BAD_OPTION",
2122
- "ECONNABORTED",
2123
- "ETIMEDOUT",
2124
- "ERR_NETWORK",
2125
- "ERR_FR_TOO_MANY_REDIRECTS",
2126
- "ERR_DEPRECATED",
2127
- "ERR_BAD_RESPONSE",
2128
- "ERR_BAD_REQUEST",
2129
- "ERR_CANCELED",
2130
- "ERR_NOT_SUPPORT",
2131
- "ERR_INVALID_URL"
2132
- // eslint-disable-next-line func-names
2133
- ].forEach((e) => {
2134
- oo[e] = { value: e };
2135
- });
2136
- Object.defineProperties(R, oo);
2137
- Object.defineProperty(ro, "isAxiosError", { value: !0 });
2138
- R.from = (e, t, n, r, o, s) => {
2139
- const i = Object.create(ro);
2140
- return l.toFlatObject(e, i, function(c) {
2141
- return c !== Error.prototype;
2142
- }, (a) => a !== "isAxiosError"), R.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
2143
- };
2144
- const mf = null;
2145
- function St(e) {
2146
- return l.isPlainObject(e) || l.isArray(e);
2147
- }
2148
- function so(e) {
2149
- return l.endsWith(e, "[]") ? e.slice(0, -2) : e;
2150
- }
2151
- function Mn(e, t, n) {
2152
- return e ? e.concat(t).map(function(o, s) {
2153
- return o = so(o), !n && s ? "[" + o + "]" : o;
2154
- }).join(n ? "." : "") : t;
2155
- }
2156
- function gf(e) {
2157
- return l.isArray(e) && !e.some(St);
2158
- }
2159
- const yf = l.toFlatObject(l, {}, null, function(t) {
2160
- return /^is[A-Z]/.test(t);
2161
- });
2162
- function ot(e, t, n) {
2163
- if (!l.isObject(e))
2164
- throw new TypeError("target must be an object");
2165
- t = t || new FormData(), n = l.toFlatObject(n, {
2166
- metaTokens: !0,
2167
- dots: !1,
2168
- indexes: !1
2169
- }, !1, function(m, d) {
2170
- return !l.isUndefined(d[m]);
2171
- });
2172
- const r = n.metaTokens, o = n.visitor || u, s = n.dots, i = n.indexes, c = (n.Blob || typeof Blob < "u" && Blob) && l.isSpecCompliantForm(t);
2173
- if (!l.isFunction(o))
2174
- throw new TypeError("visitor must be a function");
2175
- function f(h) {
2176
- if (h === null)
2177
- return "";
2178
- if (l.isDate(h))
2179
- return h.toISOString();
2180
- if (!c && l.isBlob(h))
2181
- throw new R("Blob is not supported. Use a Buffer instead.");
2182
- return l.isArrayBuffer(h) || l.isTypedArray(h) ? c && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
2183
- }
2184
- function u(h, m, d) {
2185
- let b = h;
2186
- if (h && !d && typeof h == "object") {
2187
- if (l.endsWith(m, "{}"))
2188
- m = r ? m : m.slice(0, -2), h = JSON.stringify(h);
2189
- else if (l.isArray(h) && gf(h) || (l.isFileList(h) || l.endsWith(m, "[]")) && (b = l.toArray(h)))
2190
- return m = so(m), b.forEach(function(S, N) {
2191
- !(l.isUndefined(S) || S === null) && t.append(
2192
- // eslint-disable-next-line no-nested-ternary
2193
- i === !0 ? Mn([m], N, s) : i === null ? m : m + "[]",
2194
- f(S)
2195
- );
2196
- }), !1;
2197
- }
2198
- return St(h) ? !0 : (t.append(Mn(d, m, s), f(h)), !1);
2199
- }
2200
- const p = [], g = Object.assign(yf, {
2201
- defaultVisitor: u,
2202
- convertValue: f,
2203
- isVisitable: St
2204
- });
2205
- function y(h, m) {
2206
- if (!l.isUndefined(h)) {
2207
- if (p.indexOf(h) !== -1)
2208
- throw Error("Circular reference detected in " + m.join("."));
2209
- p.push(h), l.forEach(h, function(b, E) {
2210
- (!(l.isUndefined(b) || b === null) && o.call(
2211
- t,
2212
- b,
2213
- l.isString(E) ? E.trim() : E,
2214
- m,
2215
- g
2216
- )) === !0 && y(b, m ? m.concat(E) : [E]);
2217
- }), p.pop();
2218
- }
2219
- }
2220
- if (!l.isObject(e))
2221
- throw new TypeError("data must be an object");
2222
- return y(e), t;
2223
- }
2224
- function jn(e) {
2225
- const t = {
2226
- "!": "%21",
2227
- "'": "%27",
2228
- "(": "%28",
2229
- ")": "%29",
2230
- "~": "%7E",
2231
- "%20": "+",
2232
- "%00": "\0"
2233
- };
2234
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
2235
- return t[r];
2236
- });
2237
- }
2238
- function Xt(e, t) {
2239
- this._pairs = [], e && ot(e, this, t);
2240
- }
2241
- const io = Xt.prototype;
2242
- io.append = function(t, n) {
2243
- this._pairs.push([t, n]);
2244
- };
2245
- io.toString = function(t) {
2246
- const n = t ? function(r) {
2247
- return t.call(this, r, jn);
2248
- } : jn;
2249
- return this._pairs.map(function(o) {
2250
- return n(o[0]) + "=" + n(o[1]);
2251
- }, "").join("&");
2252
- };
2253
- function _f(e) {
2254
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
2255
- }
2256
- function ao(e, t, n) {
2257
- if (!t)
2258
- return e;
2259
- const r = n && n.encode || _f;
2260
- l.isFunction(n) && (n = {
2261
- serialize: n
2262
- });
2263
- const o = n && n.serialize;
2264
- let s;
2265
- if (o ? s = o(t, n) : s = l.isURLSearchParams(t) ? t.toString() : new Xt(t, n).toString(r), s) {
2266
- const i = e.indexOf("#");
2267
- i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
2268
- }
2269
- return e;
2270
- }
2271
- class Ef {
2272
- constructor() {
2273
- this.handlers = [];
2274
- }
2275
- /**
2276
- * Add a new interceptor to the stack
2277
- *
2278
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
2279
- * @param {Function} rejected The function to handle `reject` for a `Promise`
2280
- *
2281
- * @return {Number} An ID used to remove interceptor later
2282
- */
2283
- use(t, n, r) {
2284
- return this.handlers.push({
2285
- fulfilled: t,
2286
- rejected: n,
2287
- synchronous: r ? r.synchronous : !1,
2288
- runWhen: r ? r.runWhen : null
2289
- }), this.handlers.length - 1;
2290
- }
2291
- /**
2292
- * Remove an interceptor from the stack
2293
- *
2294
- * @param {Number} id The ID that was returned by `use`
2295
- *
2296
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2297
- */
2298
- eject(t) {
2299
- this.handlers[t] && (this.handlers[t] = null);
2300
- }
2301
- /**
2302
- * Clear all interceptors from the stack
2303
- *
2304
- * @returns {void}
2305
- */
2306
- clear() {
2307
- this.handlers && (this.handlers = []);
2308
- }
2309
- /**
2310
- * Iterate over all the registered interceptors
2311
- *
2312
- * This method is particularly useful for skipping over any
2313
- * interceptors that may have become `null` calling `eject`.
2314
- *
2315
- * @param {Function} fn The function to call for each interceptor
2316
- *
2317
- * @returns {void}
2318
- */
2319
- forEach(t) {
2320
- l.forEach(this.handlers, function(r) {
2321
- r !== null && t(r);
2322
- });
2323
- }
2324
- }
2325
- const Un = Ef, co = {
2326
- silentJSONParsing: !0,
2327
- forcedJSONParsing: !0,
2328
- clarifyTimeoutError: !1
2329
- }, Rf = typeof URLSearchParams < "u" ? URLSearchParams : Xt, bf = typeof FormData < "u" ? FormData : null, Of = typeof Blob < "u" ? Blob : null, Sf = {
2330
- isBrowser: !0,
2331
- classes: {
2332
- URLSearchParams: Rf,
2333
- FormData: bf,
2334
- Blob: Of
2335
- },
2336
- protocols: ["http", "https", "file", "blob", "url", "data"]
2337
- }, Qt = typeof window < "u" && typeof document < "u", wt = typeof navigator == "object" && navigator || void 0, wf = Qt && (!wt || ["ReactNative", "NativeScript", "NS"].indexOf(wt.product) < 0), Tf = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
2338
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), vf = Qt && window.location.href || "http://localhost", Cf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2339
- __proto__: null,
2340
- hasBrowserEnv: Qt,
2341
- hasStandardBrowserEnv: wf,
2342
- hasStandardBrowserWebWorkerEnv: Tf,
2343
- navigator: wt,
2344
- origin: vf
2345
- }, Symbol.toStringTag, { value: "Module" })), C = {
2346
- ...Cf,
2347
- ...Sf
2348
- };
2349
- function Af(e, t) {
2350
- return ot(e, new C.classes.URLSearchParams(), Object.assign({
2351
- visitor: function(n, r, o, s) {
2352
- return C.isNode && l.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
2353
- }
2354
- }, t));
2355
- }
2356
- function Nf(e) {
2357
- return l.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
2358
- }
2359
- function $f(e) {
2360
- const t = {}, n = Object.keys(e);
2361
- let r;
2362
- const o = n.length;
2363
- let s;
2364
- for (r = 0; r < o; r++)
2365
- s = n[r], t[s] = e[s];
2366
- return t;
2367
- }
2368
- function uo(e) {
2369
- function t(n, r, o, s) {
2370
- let i = n[s++];
2371
- if (i === "__proto__")
2372
- return !0;
2373
- const a = Number.isFinite(+i), c = s >= n.length;
2374
- return i = !i && l.isArray(o) ? o.length : i, c ? (l.hasOwnProp(o, i) ? o[i] = [o[i], r] : o[i] = r, !a) : ((!o[i] || !l.isObject(o[i])) && (o[i] = []), t(n, r, o[i], s) && l.isArray(o[i]) && (o[i] = $f(o[i])), !a);
2375
- }
2376
- if (l.isFormData(e) && l.isFunction(e.entries)) {
2377
- const n = {};
2378
- return l.forEachEntry(e, (r, o) => {
2379
- t(Nf(r), o, n, 0);
2380
- }), n;
2381
- }
2382
- return null;
2383
- }
2384
- function Pf(e, t, n) {
2385
- if (l.isString(e))
2386
- try {
2387
- return (t || JSON.parse)(e), l.trim(e);
2388
- } catch (r) {
2389
- if (r.name !== "SyntaxError")
2390
- throw r;
2391
- }
2392
- return (n || JSON.stringify)(e);
2393
- }
2394
- const Yt = {
2395
- transitional: co,
2396
- adapter: ["xhr", "http", "fetch"],
2397
- transformRequest: [function(t, n) {
2398
- const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, s = l.isObject(t);
2399
- if (s && l.isHTMLForm(t) && (t = new FormData(t)), l.isFormData(t))
2400
- return o ? JSON.stringify(uo(t)) : t;
2401
- if (l.isArrayBuffer(t) || l.isBuffer(t) || l.isStream(t) || l.isFile(t) || l.isBlob(t) || l.isReadableStream(t))
2402
- return t;
2403
- if (l.isArrayBufferView(t))
2404
- return t.buffer;
2405
- if (l.isURLSearchParams(t))
2406
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
2407
- let a;
2408
- if (s) {
2409
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
2410
- return Af(t, this.formSerializer).toString();
2411
- if ((a = l.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
2412
- const c = this.env && this.env.FormData;
2413
- return ot(
2414
- a ? { "files[]": t } : t,
2415
- c && new c(),
2416
- this.formSerializer
2417
- );
2418
- }
2419
- }
2420
- return s || o ? (n.setContentType("application/json", !1), Pf(t)) : t;
2421
- }],
2422
- transformResponse: [function(t) {
2423
- const n = this.transitional || Yt.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
2424
- if (l.isResponse(t) || l.isReadableStream(t))
2425
- return t;
2426
- if (t && l.isString(t) && (r && !this.responseType || o)) {
2427
- const i = !(n && n.silentJSONParsing) && o;
2428
- try {
2429
- return JSON.parse(t);
2430
- } catch (a) {
2431
- if (i)
2432
- throw a.name === "SyntaxError" ? R.from(a, R.ERR_BAD_RESPONSE, this, null, this.response) : a;
2433
- }
2434
- }
2435
- return t;
2436
- }],
2437
- /**
2438
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2439
- * timeout is not created.
2440
- */
2441
- timeout: 0,
2442
- xsrfCookieName: "XSRF-TOKEN",
2443
- xsrfHeaderName: "X-XSRF-TOKEN",
2444
- maxContentLength: -1,
2445
- maxBodyLength: -1,
2446
- env: {
2447
- FormData: C.classes.FormData,
2448
- Blob: C.classes.Blob
2449
- },
2450
- validateStatus: function(t) {
2451
- return t >= 200 && t < 300;
2452
- },
2453
- headers: {
2454
- common: {
2455
- Accept: "application/json, text/plain, */*",
2456
- "Content-Type": void 0
2457
- }
2458
- }
2459
- };
2460
- l.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
2461
- Yt.headers[e] = {};
2462
- });
2463
- const Zt = Yt, If = l.toObjectSet([
2464
- "age",
2465
- "authorization",
2466
- "content-length",
2467
- "content-type",
2468
- "etag",
2469
- "expires",
2470
- "from",
2471
- "host",
2472
- "if-modified-since",
2473
- "if-unmodified-since",
2474
- "last-modified",
2475
- "location",
2476
- "max-forwards",
2477
- "proxy-authorization",
2478
- "referer",
2479
- "retry-after",
2480
- "user-agent"
2481
- ]), Mf = (e) => {
2482
- const t = {};
2483
- let n, r, o;
2484
- return e && e.split(`
2485
- `).forEach(function(i) {
2486
- o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || t[n] && If[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
2487
- }), t;
2488
- }, Ln = Symbol("internals");
2489
- function ge(e) {
2490
- return e && String(e).trim().toLowerCase();
2491
- }
2492
- function je(e) {
2493
- return e === !1 || e == null ? e : l.isArray(e) ? e.map(je) : String(e);
2494
- }
2495
- function jf(e) {
2496
- const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2497
- let r;
2498
- for (; r = n.exec(e); )
2499
- t[r[1]] = r[2];
2500
- return t;
2501
- }
2502
- const Uf = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
2503
- function gt(e, t, n, r, o) {
2504
- if (l.isFunction(r))
2505
- return r.call(this, t, n);
2506
- if (o && (t = n), !!l.isString(t)) {
2507
- if (l.isString(r))
2508
- return t.indexOf(r) !== -1;
2509
- if (l.isRegExp(r))
2510
- return r.test(t);
2511
- }
2512
- }
2513
- function Lf(e) {
2514
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
2515
- }
2516
- function Bf(e, t) {
2517
- const n = l.toCamelCase(" " + t);
2518
- ["get", "set", "has"].forEach((r) => {
2519
- Object.defineProperty(e, r + n, {
2520
- value: function(o, s, i) {
2521
- return this[r].call(this, t, o, s, i);
2522
- },
2523
- configurable: !0
2524
- });
2525
- });
2526
- }
2527
- class st {
2528
- constructor(t) {
2529
- t && this.set(t);
2530
- }
2531
- set(t, n, r) {
2532
- const o = this;
2533
- function s(a, c, f) {
2534
- const u = ge(c);
2535
- if (!u)
2536
- throw new Error("header name must be a non-empty string");
2537
- const p = l.findKey(o, u);
2538
- (!p || o[p] === void 0 || f === !0 || f === void 0 && o[p] !== !1) && (o[p || c] = je(a));
2539
- }
2540
- const i = (a, c) => l.forEach(a, (f, u) => s(f, u, c));
2541
- if (l.isPlainObject(t) || t instanceof this.constructor)
2542
- i(t, n);
2543
- else if (l.isString(t) && (t = t.trim()) && !Uf(t))
2544
- i(Mf(t), n);
2545
- else if (l.isHeaders(t))
2546
- for (const [a, c] of t.entries())
2547
- s(c, a, r);
2548
- else
2549
- t != null && s(n, t, r);
2550
- return this;
2551
- }
2552
- get(t, n) {
2553
- if (t = ge(t), t) {
2554
- const r = l.findKey(this, t);
2555
- if (r) {
2556
- const o = this[r];
2557
- if (!n)
2558
- return o;
2559
- if (n === !0)
2560
- return jf(o);
2561
- if (l.isFunction(n))
2562
- return n.call(this, o, r);
2563
- if (l.isRegExp(n))
2564
- return n.exec(o);
2565
- throw new TypeError("parser must be boolean|regexp|function");
2566
- }
2567
- }
2568
- }
2569
- has(t, n) {
2570
- if (t = ge(t), t) {
2571
- const r = l.findKey(this, t);
2572
- return !!(r && this[r] !== void 0 && (!n || gt(this, this[r], r, n)));
2573
- }
2574
- return !1;
2575
- }
2576
- delete(t, n) {
2577
- const r = this;
2578
- let o = !1;
2579
- function s(i) {
2580
- if (i = ge(i), i) {
2581
- const a = l.findKey(r, i);
2582
- a && (!n || gt(r, r[a], a, n)) && (delete r[a], o = !0);
2583
- }
2584
- }
2585
- return l.isArray(t) ? t.forEach(s) : s(t), o;
2586
- }
2587
- clear(t) {
2588
- const n = Object.keys(this);
2589
- let r = n.length, o = !1;
2590
- for (; r--; ) {
2591
- const s = n[r];
2592
- (!t || gt(this, this[s], s, t, !0)) && (delete this[s], o = !0);
2593
- }
2594
- return o;
2595
- }
2596
- normalize(t) {
2597
- const n = this, r = {};
2598
- return l.forEach(this, (o, s) => {
2599
- const i = l.findKey(r, s);
2600
- if (i) {
2601
- n[i] = je(o), delete n[s];
2602
- return;
2603
- }
2604
- const a = t ? Lf(s) : String(s).trim();
2605
- a !== s && delete n[s], n[a] = je(o), r[a] = !0;
2606
- }), this;
2607
- }
2608
- concat(...t) {
2609
- return this.constructor.concat(this, ...t);
2610
- }
2611
- toJSON(t) {
2612
- const n = /* @__PURE__ */ Object.create(null);
2613
- return l.forEach(this, (r, o) => {
2614
- r != null && r !== !1 && (n[o] = t && l.isArray(r) ? r.join(", ") : r);
2615
- }), n;
2616
- }
2617
- [Symbol.iterator]() {
2618
- return Object.entries(this.toJSON())[Symbol.iterator]();
2619
- }
2620
- toString() {
2621
- return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
2622
- `);
2623
- }
2624
- get [Symbol.toStringTag]() {
2625
- return "AxiosHeaders";
2626
- }
2627
- static from(t) {
2628
- return t instanceof this ? t : new this(t);
2629
- }
2630
- static concat(t, ...n) {
2631
- const r = new this(t);
2632
- return n.forEach((o) => r.set(o)), r;
2633
- }
2634
- static accessor(t) {
2635
- const r = (this[Ln] = this[Ln] = {
2636
- accessors: {}
2637
- }).accessors, o = this.prototype;
2638
- function s(i) {
2639
- const a = ge(i);
2640
- r[a] || (Bf(o, i), r[a] = !0);
2641
- }
2642
- return l.isArray(t) ? t.forEach(s) : s(t), this;
2643
- }
2644
- }
2645
- st.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
2646
- l.reduceDescriptors(st.prototype, ({ value: e }, t) => {
2647
- let n = t[0].toUpperCase() + t.slice(1);
2648
- return {
2649
- get: () => e,
2650
- set(r) {
2651
- this[n] = r;
2652
- }
2653
- };
2654
- });
2655
- l.freezeMethods(st);
2656
- const I = st;
2657
- function yt(e, t) {
2658
- const n = this || Zt, r = t || n, o = I.from(r.headers);
2659
- let s = r.data;
2660
- return l.forEach(e, function(a) {
2661
- s = a.call(n, s, o.normalize(), t ? t.status : void 0);
2662
- }), o.normalize(), s;
2663
- }
2664
- function lo(e) {
2665
- return !!(e && e.__CANCEL__);
2666
- }
2667
- function me(e, t, n) {
2668
- R.call(this, e ?? "canceled", R.ERR_CANCELED, t, n), this.name = "CanceledError";
2669
- }
2670
- l.inherits(me, R, {
2671
- __CANCEL__: !0
2672
- });
2673
- function fo(e, t, n) {
2674
- const r = n.config.validateStatus;
2675
- !n.status || !r || r(n.status) ? e(n) : t(new R(
2676
- "Request failed with status code " + n.status,
2677
- [R.ERR_BAD_REQUEST, R.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
2678
- n.config,
2679
- n.request,
2680
- n
2681
- ));
2682
- }
2683
- function xf(e) {
2684
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
2685
- return t && t[1] || "";
2686
- }
2687
- function Df(e, t) {
2688
- e = e || 10;
2689
- const n = new Array(e), r = new Array(e);
2690
- let o = 0, s = 0, i;
2691
- return t = t !== void 0 ? t : 1e3, function(c) {
2692
- const f = Date.now(), u = r[s];
2693
- i || (i = f), n[o] = c, r[o] = f;
2694
- let p = s, g = 0;
2695
- for (; p !== o; )
2696
- g += n[p++], p = p % e;
2697
- if (o = (o + 1) % e, o === s && (s = (s + 1) % e), f - i < t)
2698
- return;
2699
- const y = u && f - u;
2700
- return y ? Math.round(g * 1e3 / y) : void 0;
2701
- };
2702
- }
2703
- function Ff(e, t) {
2704
- let n = 0, r = 1e3 / t, o, s;
2705
- const i = (f, u = Date.now()) => {
2706
- n = u, o = null, s && (clearTimeout(s), s = null), e.apply(null, f);
2707
- };
2708
- return [(...f) => {
2709
- const u = Date.now(), p = u - n;
2710
- p >= r ? i(f, u) : (o = f, s || (s = setTimeout(() => {
2711
- s = null, i(o);
2712
- }, r - p)));
2713
- }, () => o && i(o)];
2714
- }
2715
- const ke = (e, t, n = 3) => {
2716
- let r = 0;
2717
- const o = Df(50, 250);
2718
- return Ff((s) => {
2719
- const i = s.loaded, a = s.lengthComputable ? s.total : void 0, c = i - r, f = o(c), u = i <= a;
2720
- r = i;
2721
- const p = {
2722
- loaded: i,
2723
- total: a,
2724
- progress: a ? i / a : void 0,
2725
- bytes: c,
2726
- rate: f || void 0,
2727
- estimated: f && a && u ? (a - i) / f : void 0,
2728
- event: s,
2729
- lengthComputable: a != null,
2730
- [t ? "download" : "upload"]: !0
2731
- };
2732
- e(p);
2733
- }, n);
2734
- }, Bn = (e, t) => {
2735
- const n = e != null;
2736
- return [(r) => t[0]({
2737
- lengthComputable: n,
2738
- total: e,
2739
- loaded: r
2740
- }), t[1]];
2741
- }, xn = (e) => (...t) => l.asap(() => e(...t)), kf = C.hasStandardBrowserEnv ? ((e, t) => (n) => (n = new URL(n, C.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
2742
- new URL(C.origin),
2743
- C.navigator && /(msie|trident)/i.test(C.navigator.userAgent)
2744
- ) : () => !0, Hf = C.hasStandardBrowserEnv ? (
2745
- // Standard browser envs support document.cookie
2746
- {
2747
- write(e, t, n, r, o, s) {
2748
- const i = [e + "=" + encodeURIComponent(t)];
2749
- l.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), l.isString(r) && i.push("path=" + r), l.isString(o) && i.push("domain=" + o), s === !0 && i.push("secure"), document.cookie = i.join("; ");
2750
- },
2751
- read(e) {
2752
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
2753
- return t ? decodeURIComponent(t[3]) : null;
2754
- },
2755
- remove(e) {
2756
- this.write(e, "", Date.now() - 864e5);
2757
- }
2758
- }
2759
- ) : (
2760
- // Non-standard browser env (web workers, react-native) lack needed support.
2761
- {
2762
- write() {
2763
- },
2764
- read() {
2765
- return null;
2766
- },
2767
- remove() {
2768
- }
2769
- }
2770
- );
2771
- function Gf(e) {
2772
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
2773
- }
2774
- function qf(e, t) {
2775
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
2776
- }
2777
- function po(e, t, n) {
2778
- let r = !Gf(t);
2779
- return e && (r || n == !1) ? qf(e, t) : t;
2780
- }
2781
- const Dn = (e) => e instanceof I ? { ...e } : e;
2782
- function Y(e, t) {
2783
- t = t || {};
2784
- const n = {};
2785
- function r(f, u, p, g) {
2786
- return l.isPlainObject(f) && l.isPlainObject(u) ? l.merge.call({ caseless: g }, f, u) : l.isPlainObject(u) ? l.merge({}, u) : l.isArray(u) ? u.slice() : u;
2787
- }
2788
- function o(f, u, p, g) {
2789
- if (l.isUndefined(u)) {
2790
- if (!l.isUndefined(f))
2791
- return r(void 0, f, p, g);
2792
- } else
2793
- return r(f, u, p, g);
2794
- }
2795
- function s(f, u) {
2796
- if (!l.isUndefined(u))
2797
- return r(void 0, u);
2798
- }
2799
- function i(f, u) {
2800
- if (l.isUndefined(u)) {
2801
- if (!l.isUndefined(f))
2802
- return r(void 0, f);
2803
- } else
2804
- return r(void 0, u);
2805
- }
2806
- function a(f, u, p) {
2807
- if (p in t)
2808
- return r(f, u);
2809
- if (p in e)
2810
- return r(void 0, f);
2811
- }
2812
- const c = {
2813
- url: s,
2814
- method: s,
2815
- data: s,
2816
- baseURL: i,
2817
- transformRequest: i,
2818
- transformResponse: i,
2819
- paramsSerializer: i,
2820
- timeout: i,
2821
- timeoutMessage: i,
2822
- withCredentials: i,
2823
- withXSRFToken: i,
2824
- adapter: i,
2825
- responseType: i,
2826
- xsrfCookieName: i,
2827
- xsrfHeaderName: i,
2828
- onUploadProgress: i,
2829
- onDownloadProgress: i,
2830
- decompress: i,
2831
- maxContentLength: i,
2832
- maxBodyLength: i,
2833
- beforeRedirect: i,
2834
- transport: i,
2835
- httpAgent: i,
2836
- httpsAgent: i,
2837
- cancelToken: i,
2838
- socketPath: i,
2839
- responseEncoding: i,
2840
- validateStatus: a,
2841
- headers: (f, u, p) => o(Dn(f), Dn(u), p, !0)
2842
- };
2843
- return l.forEach(Object.keys(Object.assign({}, e, t)), function(u) {
2844
- const p = c[u] || o, g = p(e[u], t[u], u);
2845
- l.isUndefined(g) && p !== a || (n[u] = g);
2846
- }), n;
2847
- }
2848
- const ho = (e) => {
2849
- const t = Y({}, e);
2850
- let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: a } = t;
2851
- t.headers = i = I.from(i), t.url = ao(po(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), a && i.set(
2852
- "Authorization",
2853
- "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
2854
- );
2855
- let c;
2856
- if (l.isFormData(n)) {
2857
- if (C.hasStandardBrowserEnv || C.hasStandardBrowserWebWorkerEnv)
2858
- i.setContentType(void 0);
2859
- else if ((c = i.getContentType()) !== !1) {
2860
- const [f, ...u] = c ? c.split(";").map((p) => p.trim()).filter(Boolean) : [];
2861
- i.setContentType([f || "multipart/form-data", ...u].join("; "));
2862
- }
2863
- }
2864
- if (C.hasStandardBrowserEnv && (r && l.isFunction(r) && (r = r(t)), r || r !== !1 && kf(t.url))) {
2865
- const f = o && s && Hf.read(s);
2866
- f && i.set(o, f);
2867
- }
2868
- return t;
2869
- }, Kf = typeof XMLHttpRequest < "u", Jf = Kf && function(e) {
2870
- return new Promise(function(n, r) {
2871
- const o = ho(e);
2872
- let s = o.data;
2873
- const i = I.from(o.headers).normalize();
2874
- let { responseType: a, onUploadProgress: c, onDownloadProgress: f } = o, u, p, g, y, h;
2875
- function m() {
2876
- y && y(), h && h(), o.cancelToken && o.cancelToken.unsubscribe(u), o.signal && o.signal.removeEventListener("abort", u);
2877
- }
2878
- let d = new XMLHttpRequest();
2879
- d.open(o.method.toUpperCase(), o.url, !0), d.timeout = o.timeout;
2880
- function b() {
2881
- if (!d)
2882
- return;
2883
- const S = I.from(
2884
- "getAllResponseHeaders" in d && d.getAllResponseHeaders()
2885
- ), v = {
2886
- data: !a || a === "text" || a === "json" ? d.responseText : d.response,
2887
- status: d.status,
2888
- statusText: d.statusText,
2889
- headers: S,
2890
- config: e,
2891
- request: d
2892
- };
2893
- fo(function(U) {
2894
- n(U), m();
2895
- }, function(U) {
2896
- r(U), m();
2897
- }, v), d = null;
2898
- }
2899
- "onloadend" in d ? d.onloadend = b : d.onreadystatechange = function() {
2900
- !d || d.readyState !== 4 || d.status === 0 && !(d.responseURL && d.responseURL.indexOf("file:") === 0) || setTimeout(b);
2901
- }, d.onabort = function() {
2902
- d && (r(new R("Request aborted", R.ECONNABORTED, e, d)), d = null);
2903
- }, d.onerror = function() {
2904
- r(new R("Network Error", R.ERR_NETWORK, e, d)), d = null;
2905
- }, d.ontimeout = function() {
2906
- let N = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
2907
- const v = o.transitional || co;
2908
- o.timeoutErrorMessage && (N = o.timeoutErrorMessage), r(new R(
2909
- N,
2910
- v.clarifyTimeoutError ? R.ETIMEDOUT : R.ECONNABORTED,
2911
- e,
2912
- d
2913
- )), d = null;
2914
- }, s === void 0 && i.setContentType(null), "setRequestHeader" in d && l.forEach(i.toJSON(), function(N, v) {
2915
- d.setRequestHeader(v, N);
2916
- }), l.isUndefined(o.withCredentials) || (d.withCredentials = !!o.withCredentials), a && a !== "json" && (d.responseType = o.responseType), f && ([g, h] = ke(f, !0), d.addEventListener("progress", g)), c && d.upload && ([p, y] = ke(c), d.upload.addEventListener("progress", p), d.upload.addEventListener("loadend", y)), (o.cancelToken || o.signal) && (u = (S) => {
2917
- d && (r(!S || S.type ? new me(null, e, d) : S), d.abort(), d = null);
2918
- }, o.cancelToken && o.cancelToken.subscribe(u), o.signal && (o.signal.aborted ? u() : o.signal.addEventListener("abort", u)));
2919
- const E = xf(o.url);
2920
- if (E && C.protocols.indexOf(E) === -1) {
2921
- r(new R("Unsupported protocol " + E + ":", R.ERR_BAD_REQUEST, e));
2922
- return;
2923
- }
2924
- d.send(s || null);
2925
- });
2926
- }, Wf = (e, t) => {
2927
- const { length: n } = e = e ? e.filter(Boolean) : [];
2928
- if (t || n) {
2929
- let r = new AbortController(), o;
2930
- const s = function(f) {
2931
- if (!o) {
2932
- o = !0, a();
2933
- const u = f instanceof Error ? f : this.reason;
2934
- r.abort(u instanceof R ? u : new me(u instanceof Error ? u.message : u));
2935
- }
2936
- };
2937
- let i = t && setTimeout(() => {
2938
- i = null, s(new R(`timeout ${t} of ms exceeded`, R.ETIMEDOUT));
2939
- }, t);
2940
- const a = () => {
2941
- e && (i && clearTimeout(i), i = null, e.forEach((f) => {
2942
- f.unsubscribe ? f.unsubscribe(s) : f.removeEventListener("abort", s);
2943
- }), e = null);
2944
- };
2945
- e.forEach((f) => f.addEventListener("abort", s));
2946
- const { signal: c } = r;
2947
- return c.unsubscribe = () => l.asap(a), c;
2948
- }
2949
- }, zf = Wf, Vf = function* (e, t) {
2950
- let n = e.byteLength;
2951
- if (!t || n < t) {
2952
- yield e;
2953
- return;
2954
- }
2955
- let r = 0, o;
2956
- for (; r < n; )
2957
- o = r + t, yield e.slice(r, o), r = o;
2958
- }, Xf = async function* (e, t) {
2959
- for await (const n of Qf(e))
2960
- yield* Vf(n, t);
2961
- }, Qf = async function* (e) {
2962
- if (e[Symbol.asyncIterator]) {
2963
- yield* e;
2964
- return;
2965
- }
2966
- const t = e.getReader();
2967
- try {
2968
- for (; ; ) {
2969
- const { done: n, value: r } = await t.read();
2970
- if (n)
2971
- break;
2972
- yield r;
2973
- }
2974
- } finally {
2975
- await t.cancel();
2976
- }
2977
- }, Fn = (e, t, n, r) => {
2978
- const o = Xf(e, t);
2979
- let s = 0, i, a = (c) => {
2980
- i || (i = !0, r && r(c));
2981
- };
2982
- return new ReadableStream({
2983
- async pull(c) {
2984
- try {
2985
- const { done: f, value: u } = await o.next();
2986
- if (f) {
2987
- a(), c.close();
2988
- return;
2989
- }
2990
- let p = u.byteLength;
2991
- if (n) {
2992
- let g = s += p;
2993
- n(g);
2994
- }
2995
- c.enqueue(new Uint8Array(u));
2996
- } catch (f) {
2997
- throw a(f), f;
2998
- }
2999
- },
3000
- cancel(c) {
3001
- return a(c), o.return();
3002
- }
3003
- }, {
3004
- highWaterMark: 2
3005
- });
3006
- }, it = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", mo = it && typeof ReadableStream == "function", Yf = it && (typeof TextEncoder == "function" ? ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), go = (e, ...t) => {
3007
- try {
3008
- return !!e(...t);
3009
- } catch {
3010
- return !1;
3011
- }
3012
- }, Zf = mo && go(() => {
3013
- let e = !1;
3014
- const t = new Request(C.origin, {
3015
- body: new ReadableStream(),
3016
- method: "POST",
3017
- get duplex() {
3018
- return e = !0, "half";
3019
- }
3020
- }).headers.has("Content-Type");
3021
- return e && !t;
3022
- }), kn = 64 * 1024, Tt = mo && go(() => l.isReadableStream(new Response("").body)), He = {
3023
- stream: Tt && ((e) => e.body)
3024
- };
3025
- it && ((e) => {
3026
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
3027
- !He[t] && (He[t] = l.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
3028
- throw new R(`Response type '${t}' is not supported`, R.ERR_NOT_SUPPORT, r);
3029
- });
3030
- });
3031
- })(new Response());
3032
- const ep = async (e) => {
3033
- if (e == null)
3034
- return 0;
3035
- if (l.isBlob(e))
3036
- return e.size;
3037
- if (l.isSpecCompliantForm(e))
3038
- return (await new Request(C.origin, {
3039
- method: "POST",
3040
- body: e
3041
- }).arrayBuffer()).byteLength;
3042
- if (l.isArrayBufferView(e) || l.isArrayBuffer(e))
3043
- return e.byteLength;
3044
- if (l.isURLSearchParams(e) && (e = e + ""), l.isString(e))
3045
- return (await Yf(e)).byteLength;
3046
- }, tp = async (e, t) => {
3047
- const n = l.toFiniteNumber(e.getContentLength());
3048
- return n ?? ep(t);
3049
- }, np = it && (async (e) => {
3050
- let {
3051
- url: t,
3052
- method: n,
3053
- data: r,
3054
- signal: o,
3055
- cancelToken: s,
3056
- timeout: i,
3057
- onDownloadProgress: a,
3058
- onUploadProgress: c,
3059
- responseType: f,
3060
- headers: u,
3061
- withCredentials: p = "same-origin",
3062
- fetchOptions: g
3063
- } = ho(e);
3064
- f = f ? (f + "").toLowerCase() : "text";
3065
- let y = zf([o, s && s.toAbortSignal()], i), h;
3066
- const m = y && y.unsubscribe && (() => {
3067
- y.unsubscribe();
3068
- });
3069
- let d;
3070
- try {
3071
- if (c && Zf && n !== "get" && n !== "head" && (d = await tp(u, r)) !== 0) {
3072
- let v = new Request(t, {
3073
- method: "POST",
3074
- body: r,
3075
- duplex: "half"
3076
- }), j;
3077
- if (l.isFormData(r) && (j = v.headers.get("content-type")) && u.setContentType(j), v.body) {
3078
- const [U, D] = Bn(
3079
- d,
3080
- ke(xn(c))
3081
- );
3082
- r = Fn(v.body, kn, U, D);
3083
- }
3084
- }
3085
- l.isString(p) || (p = p ? "include" : "omit");
3086
- const b = "credentials" in Request.prototype;
3087
- h = new Request(t, {
3088
- ...g,
3089
- signal: y,
3090
- method: n.toUpperCase(),
3091
- headers: u.normalize().toJSON(),
3092
- body: r,
3093
- duplex: "half",
3094
- credentials: b ? p : void 0
3095
- });
3096
- let E = await fetch(h);
3097
- const S = Tt && (f === "stream" || f === "response");
3098
- if (Tt && (a || S && m)) {
3099
- const v = {};
3100
- ["status", "statusText", "headers"].forEach((an) => {
3101
- v[an] = E[an];
3102
- });
3103
- const j = l.toFiniteNumber(E.headers.get("content-length")), [U, D] = a && Bn(
3104
- j,
3105
- ke(xn(a), !0)
3106
- ) || [];
3107
- E = new Response(
3108
- Fn(E.body, kn, U, () => {
3109
- D && D(), m && m();
3110
- }),
3111
- v
3112
- );
3113
- }
3114
- f = f || "text";
3115
- let N = await He[l.findKey(He, f) || "text"](E, e);
3116
- return !S && m && m(), await new Promise((v, j) => {
3117
- fo(v, j, {
3118
- data: N,
3119
- headers: I.from(E.headers),
3120
- status: E.status,
3121
- statusText: E.statusText,
3122
- config: e,
3123
- request: h
3124
- });
3125
- });
3126
- } catch (b) {
3127
- throw m && m(), b && b.name === "TypeError" && /fetch/i.test(b.message) ? Object.assign(
3128
- new R("Network Error", R.ERR_NETWORK, e, h),
3129
- {
3130
- cause: b.cause || b
3131
- }
3132
- ) : R.from(b, b && b.code, e, h);
3133
- }
3134
- }), vt = {
3135
- http: mf,
3136
- xhr: Jf,
3137
- fetch: np
3138
- };
3139
- l.forEach(vt, (e, t) => {
3140
- if (e) {
3141
- try {
3142
- Object.defineProperty(e, "name", { value: t });
3143
- } catch {
3144
- }
3145
- Object.defineProperty(e, "adapterName", { value: t });
3146
- }
3147
- });
3148
- const Hn = (e) => `- ${e}`, rp = (e) => l.isFunction(e) || e === null || e === !1, yo = {
3149
- getAdapter: (e) => {
3150
- e = l.isArray(e) ? e : [e];
3151
- const { length: t } = e;
3152
- let n, r;
3153
- const o = {};
3154
- for (let s = 0; s < t; s++) {
3155
- n = e[s];
3156
- let i;
3157
- if (r = n, !rp(n) && (r = vt[(i = String(n)).toLowerCase()], r === void 0))
3158
- throw new R(`Unknown adapter '${i}'`);
3159
- if (r)
3160
- break;
3161
- o[i || "#" + s] = r;
3162
- }
3163
- if (!r) {
3164
- const s = Object.entries(o).map(
3165
- ([a, c]) => `adapter ${a} ` + (c === !1 ? "is not supported by the environment" : "is not available in the build")
3166
- );
3167
- let i = t ? s.length > 1 ? `since :
3168
- ` + s.map(Hn).join(`
3169
- `) : " " + Hn(s[0]) : "as no adapter specified";
3170
- throw new R(
3171
- "There is no suitable adapter to dispatch the request " + i,
3172
- "ERR_NOT_SUPPORT"
3173
- );
3174
- }
3175
- return r;
3176
- },
3177
- adapters: vt
3178
- };
3179
- function _t(e) {
3180
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
3181
- throw new me(null, e);
3182
- }
3183
- function Gn(e) {
3184
- return _t(e), e.headers = I.from(e.headers), e.data = yt.call(
3185
- e,
3186
- e.transformRequest
3187
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), yo.getAdapter(e.adapter || Zt.adapter)(e).then(function(r) {
3188
- return _t(e), r.data = yt.call(
3189
- e,
3190
- e.transformResponse,
3191
- r
3192
- ), r.headers = I.from(r.headers), r;
3193
- }, function(r) {
3194
- return lo(r) || (_t(e), r && r.response && (r.response.data = yt.call(
3195
- e,
3196
- e.transformResponse,
3197
- r.response
3198
- ), r.response.headers = I.from(r.response.headers))), Promise.reject(r);
3199
- });
3200
- }
3201
- const _o = "1.8.4", at = {};
3202
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
3203
- at[e] = function(r) {
3204
- return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
3205
- };
3206
- });
3207
- const qn = {};
3208
- at.transitional = function(t, n, r) {
3209
- function o(s, i) {
3210
- return "[Axios v" + _o + "] Transitional option '" + s + "'" + i + (r ? ". " + r : "");
3211
- }
3212
- return (s, i, a) => {
3213
- if (t === !1)
3214
- throw new R(
3215
- o(i, " has been removed" + (n ? " in " + n : "")),
3216
- R.ERR_DEPRECATED
3217
- );
3218
- return n && !qn[i] && (qn[i] = !0, console.warn(
3219
- o(
3220
- i,
3221
- " has been deprecated since v" + n + " and will be removed in the near future"
3222
- )
3223
- )), t ? t(s, i, a) : !0;
3224
- };
3225
- };
3226
- at.spelling = function(t) {
3227
- return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
3228
- };
3229
- function op(e, t, n) {
3230
- if (typeof e != "object")
3231
- throw new R("options must be an object", R.ERR_BAD_OPTION_VALUE);
3232
- const r = Object.keys(e);
3233
- let o = r.length;
3234
- for (; o-- > 0; ) {
3235
- const s = r[o], i = t[s];
3236
- if (i) {
3237
- const a = e[s], c = a === void 0 || i(a, s, e);
3238
- if (c !== !0)
3239
- throw new R("option " + s + " must be " + c, R.ERR_BAD_OPTION_VALUE);
3240
- continue;
3241
- }
3242
- if (n !== !0)
3243
- throw new R("Unknown option " + s, R.ERR_BAD_OPTION);
3244
- }
3245
- }
3246
- const Ue = {
3247
- assertOptions: op,
3248
- validators: at
3249
- }, L = Ue.validators;
3250
- class Ge {
3251
- constructor(t) {
3252
- this.defaults = t, this.interceptors = {
3253
- request: new Un(),
3254
- response: new Un()
3255
- };
3256
- }
3257
- /**
3258
- * Dispatch a request
3259
- *
3260
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3261
- * @param {?Object} config
3262
- *
3263
- * @returns {Promise} The Promise to be fulfilled
3264
- */
3265
- async request(t, n) {
3266
- try {
3267
- return await this._request(t, n);
3268
- } catch (r) {
3269
- if (r instanceof Error) {
3270
- let o = {};
3271
- Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
3272
- const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
3273
- try {
3274
- r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += `
3275
- ` + s) : r.stack = s;
3276
- } catch {
3277
- }
3278
- }
3279
- throw r;
3280
- }
3281
- }
3282
- _request(t, n) {
3283
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = Y(this.defaults, n);
3284
- const { transitional: r, paramsSerializer: o, headers: s } = n;
3285
- r !== void 0 && Ue.assertOptions(r, {
3286
- silentJSONParsing: L.transitional(L.boolean),
3287
- forcedJSONParsing: L.transitional(L.boolean),
3288
- clarifyTimeoutError: L.transitional(L.boolean)
3289
- }, !1), o != null && (l.isFunction(o) ? n.paramsSerializer = {
3290
- serialize: o
3291
- } : Ue.assertOptions(o, {
3292
- encode: L.function,
3293
- serialize: L.function
3294
- }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), Ue.assertOptions(n, {
3295
- baseUrl: L.spelling("baseURL"),
3296
- withXsrfToken: L.spelling("withXSRFToken")
3297
- }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
3298
- let i = s && l.merge(
3299
- s.common,
3300
- s[n.method]
3301
- );
3302
- s && l.forEach(
3303
- ["delete", "get", "head", "post", "put", "patch", "common"],
3304
- (h) => {
3305
- delete s[h];
3306
- }
3307
- ), n.headers = I.concat(i, s);
3308
- const a = [];
3309
- let c = !0;
3310
- this.interceptors.request.forEach(function(m) {
3311
- typeof m.runWhen == "function" && m.runWhen(n) === !1 || (c = c && m.synchronous, a.unshift(m.fulfilled, m.rejected));
3312
- });
3313
- const f = [];
3314
- this.interceptors.response.forEach(function(m) {
3315
- f.push(m.fulfilled, m.rejected);
3316
- });
3317
- let u, p = 0, g;
3318
- if (!c) {
3319
- const h = [Gn.bind(this), void 0];
3320
- for (h.unshift.apply(h, a), h.push.apply(h, f), g = h.length, u = Promise.resolve(n); p < g; )
3321
- u = u.then(h[p++], h[p++]);
3322
- return u;
3323
- }
3324
- g = a.length;
3325
- let y = n;
3326
- for (p = 0; p < g; ) {
3327
- const h = a[p++], m = a[p++];
3328
- try {
3329
- y = h(y);
3330
- } catch (d) {
3331
- m.call(this, d);
3332
- break;
3333
- }
3334
- }
3335
- try {
3336
- u = Gn.call(this, y);
3337
- } catch (h) {
3338
- return Promise.reject(h);
3339
- }
3340
- for (p = 0, g = f.length; p < g; )
3341
- u = u.then(f[p++], f[p++]);
3342
- return u;
3343
- }
3344
- getUri(t) {
3345
- t = Y(this.defaults, t);
3346
- const n = po(t.baseURL, t.url, t.allowAbsoluteUrls);
3347
- return ao(n, t.params, t.paramsSerializer);
3348
- }
3349
- }
3350
- l.forEach(["delete", "get", "head", "options"], function(t) {
3351
- Ge.prototype[t] = function(n, r) {
3352
- return this.request(Y(r || {}, {
3353
- method: t,
3354
- url: n,
3355
- data: (r || {}).data
3356
- }));
3357
- };
3358
- });
3359
- l.forEach(["post", "put", "patch"], function(t) {
3360
- function n(r) {
3361
- return function(s, i, a) {
3362
- return this.request(Y(a || {}, {
3363
- method: t,
3364
- headers: r ? {
3365
- "Content-Type": "multipart/form-data"
3366
- } : {},
3367
- url: s,
3368
- data: i
3369
- }));
3370
- };
3371
- }
3372
- Ge.prototype[t] = n(), Ge.prototype[t + "Form"] = n(!0);
3373
- });
3374
- const Le = Ge;
3375
- class en {
3376
- constructor(t) {
3377
- if (typeof t != "function")
3378
- throw new TypeError("executor must be a function.");
3379
- let n;
3380
- this.promise = new Promise(function(s) {
3381
- n = s;
3382
- });
3383
- const r = this;
3384
- this.promise.then((o) => {
3385
- if (!r._listeners)
3386
- return;
3387
- let s = r._listeners.length;
3388
- for (; s-- > 0; )
3389
- r._listeners[s](o);
3390
- r._listeners = null;
3391
- }), this.promise.then = (o) => {
3392
- let s;
3393
- const i = new Promise((a) => {
3394
- r.subscribe(a), s = a;
3395
- }).then(o);
3396
- return i.cancel = function() {
3397
- r.unsubscribe(s);
3398
- }, i;
3399
- }, t(function(s, i, a) {
3400
- r.reason || (r.reason = new me(s, i, a), n(r.reason));
3401
- });
3402
- }
3403
- /**
3404
- * Throws a `CanceledError` if cancellation has been requested.
3405
- */
3406
- throwIfRequested() {
3407
- if (this.reason)
3408
- throw this.reason;
3409
- }
3410
- /**
3411
- * Subscribe to the cancel signal
3412
- */
3413
- subscribe(t) {
3414
- if (this.reason) {
3415
- t(this.reason);
3416
- return;
3417
- }
3418
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
3419
- }
3420
- /**
3421
- * Unsubscribe from the cancel signal
3422
- */
3423
- unsubscribe(t) {
3424
- if (!this._listeners)
3425
- return;
3426
- const n = this._listeners.indexOf(t);
3427
- n !== -1 && this._listeners.splice(n, 1);
3428
- }
3429
- toAbortSignal() {
3430
- const t = new AbortController(), n = (r) => {
3431
- t.abort(r);
3432
- };
3433
- return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
3434
- }
3435
- /**
3436
- * Returns an object that contains a new `CancelToken` and a function that, when called,
3437
- * cancels the `CancelToken`.
3438
- */
3439
- static source() {
3440
- let t;
3441
- return {
3442
- token: new en(function(o) {
3443
- t = o;
3444
- }),
3445
- cancel: t
3446
- };
3447
- }
3448
- }
3449
- const sp = en;
3450
- function ip(e) {
3451
- return function(n) {
3452
- return e.apply(null, n);
3453
- };
3454
- }
3455
- function ap(e) {
3456
- return l.isObject(e) && e.isAxiosError === !0;
3457
- }
3458
- const Ct = {
3459
- Continue: 100,
3460
- SwitchingProtocols: 101,
3461
- Processing: 102,
3462
- EarlyHints: 103,
3463
- Ok: 200,
3464
- Created: 201,
3465
- Accepted: 202,
3466
- NonAuthoritativeInformation: 203,
3467
- NoContent: 204,
3468
- ResetContent: 205,
3469
- PartialContent: 206,
3470
- MultiStatus: 207,
3471
- AlreadyReported: 208,
3472
- ImUsed: 226,
3473
- MultipleChoices: 300,
3474
- MovedPermanently: 301,
3475
- Found: 302,
3476
- SeeOther: 303,
3477
- NotModified: 304,
3478
- UseProxy: 305,
3479
- Unused: 306,
3480
- TemporaryRedirect: 307,
3481
- PermanentRedirect: 308,
3482
- BadRequest: 400,
3483
- Unauthorized: 401,
3484
- PaymentRequired: 402,
3485
- Forbidden: 403,
3486
- NotFound: 404,
3487
- MethodNotAllowed: 405,
3488
- NotAcceptable: 406,
3489
- ProxyAuthenticationRequired: 407,
3490
- RequestTimeout: 408,
3491
- Conflict: 409,
3492
- Gone: 410,
3493
- LengthRequired: 411,
3494
- PreconditionFailed: 412,
3495
- PayloadTooLarge: 413,
3496
- UriTooLong: 414,
3497
- UnsupportedMediaType: 415,
3498
- RangeNotSatisfiable: 416,
3499
- ExpectationFailed: 417,
3500
- ImATeapot: 418,
3501
- MisdirectedRequest: 421,
3502
- UnprocessableEntity: 422,
3503
- Locked: 423,
3504
- FailedDependency: 424,
3505
- TooEarly: 425,
3506
- UpgradeRequired: 426,
3507
- PreconditionRequired: 428,
3508
- TooManyRequests: 429,
3509
- RequestHeaderFieldsTooLarge: 431,
3510
- UnavailableForLegalReasons: 451,
3511
- InternalServerError: 500,
3512
- NotImplemented: 501,
3513
- BadGateway: 502,
3514
- ServiceUnavailable: 503,
3515
- GatewayTimeout: 504,
3516
- HttpVersionNotSupported: 505,
3517
- VariantAlsoNegotiates: 506,
3518
- InsufficientStorage: 507,
3519
- LoopDetected: 508,
3520
- NotExtended: 510,
3521
- NetworkAuthenticationRequired: 511
3522
- };
3523
- Object.entries(Ct).forEach(([e, t]) => {
3524
- Ct[t] = e;
3525
- });
3526
- const cp = Ct;
3527
- function Eo(e) {
3528
- const t = new Le(e), n = Xr(Le.prototype.request, t);
3529
- return l.extend(n, Le.prototype, t, { allOwnKeys: !0 }), l.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
3530
- return Eo(Y(e, o));
3531
- }, n;
3532
- }
3533
- const w = Eo(Zt);
3534
- w.Axios = Le;
3535
- w.CanceledError = me;
3536
- w.CancelToken = sp;
3537
- w.isCancel = lo;
3538
- w.VERSION = _o;
3539
- w.toFormData = ot;
3540
- w.AxiosError = R;
3541
- w.Cancel = w.CanceledError;
3542
- w.all = function(t) {
3543
- return Promise.all(t);
3544
- };
3545
- w.spread = ip;
3546
- w.isAxiosError = ap;
3547
- w.mergeConfig = Y;
3548
- w.AxiosHeaders = I;
3549
- w.formToJSON = (e) => uo(l.isHTMLForm(e) ? new FormData(e) : e);
3550
- w.getAdapter = yo.getAdapter;
3551
- w.HttpStatusCode = cp;
3552
- w.default = w;
3553
- const up = w;
3554
- var ee = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(ee || {}), re = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(re || {}), x = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(x || {}), Pe = /* @__PURE__ */ ((e) => (e.REVERSE_MERGE = "reverseMerge", e))(Pe || {}), B = /* @__PURE__ */ ((e) => (e.REFLOG_ACTION = "reflog-action", e.COMMIT_MSG = "commit-msg", e.COMMIT_RECORD = "commit-record", e.PRE_REBASE = "pre-rebase", e))(B || {});
3555
- const lp = 3e4, Kn = Math.random(), Ro = {
3556
- timeout: lp,
3557
- getBusinessCode() {
3558
- return Kn;
3559
- },
3560
- getBusinessMsg(e) {
3561
- return e.statusText;
3562
- },
3563
- getBusinessData(e) {
3564
- return e.data;
3565
- },
3566
- businessSuccessCodeList: [Kn],
3567
- axios: up
3568
- }, bo = Vr({
3569
- basePath: " https://gitee.com",
3570
- ...Ro
3571
- }), Oo = Vr({
3572
- basePath: "https://api.github.com",
3573
- ...Ro
3574
- }), fp = ({
3575
- username: e
3576
- }) => bo({
3577
- url: `/api/v5/users/${e}/repos`,
3578
- method: "GET"
3579
- }), pp = ({
3580
- accessToken: e
3581
- }) => bo({
3582
- url: "/api/v5/user/repos",
3583
- method: "GET",
3584
- params: {
3585
- access_token: e,
3586
- per_page: 100,
3587
- page: 1,
3588
- sort: "updated"
3589
- }
3590
- }), hp = ({
3591
- username: e
3592
- }) => Oo({
3593
- url: `/users/${e}/repos`,
3594
- method: "GET"
3595
- }), dp = ({
3596
- accessToken: e
3597
- }) => Oo({
3598
- url: "/user/repos",
3599
- method: "GET",
3600
- headers: {
3601
- Authorization: `Bearer ${e}`
3602
- },
3603
- params: {
3604
- per_page: 100,
3605
- page: 1,
3606
- sort: "updated"
3607
- }
3608
- }), tn = {
3609
- name: "@done-coding/cli-git",
3610
- version: "0.6.15",
3611
- description: "git跨平台操作命令行工具",
3612
- bin: {
3613
- "dc-git": "es/cli.mjs"
3614
- },
3615
- cliConfig: {
3616
- namespaceDir: ".done-coding",
3617
- moduleName: "git"
3618
- }
3619
- }, {
3620
- cliConfig: { namespaceDir: mp, moduleName: gp }
3621
- } = tn, So = `./${mp}/${gp}`, nn = `${So}.json`, wo = (e) => `${So}/.${e}`, To = ({ platform: e, username: t }) => `${e}/${t}`, yp = (e) => {
3622
- const { platform: t } = e, n = wo(t), r = zn(n, {
3623
- isFindFarthest: !1
3624
- });
3625
- if (!r) {
3626
- _.warn("配置文件不存在");
3627
- return;
3628
- }
3629
- const o = `${r}/${n}`, s = Et.readFileSync(o, "utf-8"), i = To(e), a = Mo({ encryptedText: s, secretKey: i });
3630
- if (!a) {
3631
- _.warn("配置文件解密失败");
3632
- return;
3633
- }
3634
- return JSON.parse(a);
3635
- }, _p = ({
3636
- rootDir: e,
3637
- username: t,
3638
- platform: n,
3639
- accessToken: r
3640
- }) => {
3641
- const o = wo(n), s = JSON.stringify({
3642
- accessToken: r
3643
- }), i = To({ platform: n, username: t }), a = jo({ text: s, secretKey: i }), c = Be.join(e, o);
3644
- Et.mkdirSync(Be.dirname(c), {
3645
- recursive: !0
3646
- }), Et.writeFileSync(c, a, "utf-8"), _.success(`配置信息保存成功 ${c}`);
3647
- }, Jn = [
3648
- { title: "GitHub", value: x.GITHUB },
3649
- { title: "Gitee", value: x.GITEE }
3650
- ], rn = (e) => {
3651
- let t = 0;
3652
- if (e) {
3653
- const n = Jn.findIndex(
3654
- (r) => r.value === e
3655
- );
3656
- n >= 0 && (t = n);
3657
- }
3658
- return {
3659
- type: "select",
3660
- name: "platform",
3661
- message: "选择git平台",
3662
- choices: Jn,
3663
- initial: t
3664
- };
3665
- }, on = (e) => ({
3666
- type: "text",
3667
- name: "username",
3668
- message: "请输入用户名",
3669
- format: (t) => t.trim(),
3670
- validate: (t) => t.length > 0 || "用户名不能为空",
3671
- initial: e
3672
- }), Ep = {
3673
- type: "password",
3674
- name: "accessToken",
3675
- message: "请输入git access token",
3676
- format: (e) => e.trim(),
3677
- validate: (e) => e.length > 0 || "access token不能为空"
3678
- }, Rp = async ({
3679
- platform: e,
3680
- username: t
3681
- } = {}) => {
3682
- const n = {
3683
- platform: e,
3684
- username: t
3685
- };
3686
- e || (n.platform = (await K(rn())).platform), t || (n.username = (await K(on())).username);
3687
- const { platform: r, username: o } = n;
3688
- let s = [];
3689
- const i = yp({
3690
- username: o,
3691
- platform: r
3692
- });
3693
- let a = i == null ? void 0 : i.accessToken;
3694
- _.stage(`正在获取${o}的${r}仓库列表...`);
3695
- const c = {
3696
- username: o,
3697
- accessToken: a
3698
- };
3699
- switch (n.platform) {
3700
- case x.GITHUB: {
3701
- s = (await (c.accessToken ? dp : hp)(c)).data.map((u) => ({
3702
- name: u.name,
3703
- httpUrl: u.clone_url,
3704
- sshUrl: u.ssh_url,
3705
- description: u.description || ""
3706
- }));
3707
- break;
3708
- }
3709
- case x.GITEE: {
3710
- s = (await (c.accessToken ? pp : fp)(c)).data.map((u) => ({
3711
- name: u.name,
3712
- httpUrl: u.html_url,
3713
- sshUrl: u.ssh_url,
3714
- description: u.description || ""
3715
- }));
3716
- break;
3717
- }
3718
- default:
3719
- return _.error(`未知平台${r}`), process.exit(1);
3720
- }
3721
- if (_.success(`获取${o}的${r}仓库列表成功`), s.length === 0) {
3722
- _.warn(`${o} 可获取${r}仓库列表为空`);
3723
- return;
3724
- } else
3725
- _.stage(`共${s.length}个仓库`);
3726
- const { repoUrl: f } = await K({
3727
- name: "repoUrl",
3728
- type: "select",
3729
- message: "选择仓库",
3730
- choices: s.map((u) => ({
3731
- title: `${u.name} ${u.description}`,
3732
- value: u.sshUrl
3733
- }))
3734
- });
3735
- return f;
3736
- }, bp = [
3737
- T.PRE_COMMIT,
3738
- T.PRE_MERGE_COMMIT,
3739
- T.PREPARE_COMMIT_MSG,
3740
- T.COMMIT_MSG,
3741
- T.PRE_REBASE,
3742
- T.POST_COMMIT,
3743
- T.POST_MERGE,
3744
- T.PRE_PUSH
3745
- ], Op = [
3746
- T.PRE_MERGE_COMMIT,
3747
- T.PREPARE_COMMIT_MSG,
3748
- T.POST_MERGE,
3749
- T.PRE_PUSH,
3750
- T.PRE_REBASE
3751
- ], ct = (e) => {
3752
- const {
3753
- [ee.CHECK]: { [Pe.REVERSE_MERGE]: t }
3754
- } = e;
3755
- return t;
3756
- }, Sp = (e) => Math.max(
3757
- 0,
3758
- ...Object.values(e).map(({ logCount: t }) => t)
3759
- ), wp = (e, t) => Object.entries(e).reduce(
3760
- (n, [r, { afterHash: o, logCount: s }]) => {
3761
- let i = s - 1;
3762
- if (o) {
3763
- const a = t.findIndex((c) => c.hash === o);
3764
- a !== -1 && (_.info(
3765
- `${r} 设置 只检测 ${o} 之后的日志 即 下标 [0 - ${a})`
3766
- ), i = Math.min(i, a - 1));
3767
- }
3768
- return _.info(`${r} 最多检查${i + 1}条`), n[r] = i, n;
3769
- },
3770
- {}
3771
- ), sn = ({
3772
- mergeInfo: e,
3773
- configMap: t,
3774
- currentBranch: n
3775
- }) => {
3776
- if (!e)
3777
- return;
3778
- const { fromBranch: r, toBranch: o = n } = e;
3779
- if (r === n) {
3780
- _.skip(`跳过: 允许远程${r} => 本地${o}`);
3781
- return;
3782
- }
3783
- const s = !!Object.keys(t).map(
3784
- (i) => new RegExp(i)
3785
- ).find(
3786
- (i) => i.test(r)
3787
- );
3788
- return s || _.skip(`跳过: 允许${r} => ${o}`), s;
3789
- }, Tp = {
3790
- [ee.CHECK]: {
3791
- [Pe.REVERSE_MERGE]: {
3792
- [/^test$/.source]: {
3793
- includeRebase: !0,
3794
- logCount: 10,
3795
- afterHash: ""
3796
- }
3797
- }
3798
- }
3799
- }, vp = () => ({
3800
- ...Nt({
3801
- configPathDefault: nn
3802
- }),
3803
- type: {
3804
- alias: "t",
3805
- describe: "初始化类型",
3806
- choices: [re.DEFAULT, re.CLONE_CONFIG],
3807
- default: re.DEFAULT
3808
- }
3809
- }), Cp = (e) => {
3810
- F(`npm pkg set scripts.postprepare="${e} init"`);
3811
- }, Ap = async (e) => {
3812
- const { type: t } = e;
3813
- switch (t) {
3814
- case re.DEFAULT: {
3815
- const { rootDir: n, isSubCommand: r, _: o } = e, s = `${e.$0}${r ? ` ${o[0]}` : ""}`;
3816
- return await Po({
3817
- hookNames: Op,
3818
- rootDir: n,
3819
- getCode: (i) => `npx ${s} hooks ${i} "$@"`
3820
- }), await Cp(s), Io(Tp, e, {
3821
- onFileGenerated: (i) => {
3822
- _.info(`文件生成成功: ${i}`);
3823
- }
3824
- });
3825
- }
3826
- case re.CLONE_CONFIG: {
3827
- const { rootDir: n } = e, { platform: r } = await K(rn()), { username: o } = await K(on()), { accessToken: s } = await K(Ep);
3828
- return _p({
3829
- rootDir: n,
3830
- platform: r,
3831
- username: o,
3832
- accessToken: s
3833
- });
3834
- }
3835
- default:
3836
- throw new Error(`未知的初始化类型: ${t}`);
3837
- }
3838
- }, Np = {
3839
- command: ee.INIT,
3840
- describe: "初始化配置文件",
3841
- options: vp(),
3842
- handler: Ap
3843
- }, $p = () => ({
3844
- projectName: {
3845
- type: "string",
3846
- alias: "p",
3847
- describe: "项目名称"
3848
- }
3849
- }), Pp = () => ({
3850
- platform: {
3851
- describe: "选择git平台",
3852
- type: "string",
3853
- choices: [x.GITHUB, x.GITEE]
3854
- },
3855
- username: {
3856
- describe: "git平台用户名",
3857
- type: "string"
3858
- }
3859
- }), vo = async (e) => {
3860
- const t = await Rp(e), { projectName: n } = e;
3861
- F(
3862
- `git clone ${t} ${n ? `${n} ` : ""}--depth=1`,
3863
- { stdio: "inherit" }
3864
- ), _.success(`克隆${t}成功`);
3865
- }, Ip = {
3866
- command: `${ee.CLONE} <platform> <username>`,
3867
- describe: "从选择的git平台克隆代码",
3868
- options: $p(),
3869
- positionals: Pp(),
3870
- handler: vo
3871
- }, Mp = () => Nt({
3872
- configPathDefault: nn
3873
- }), jp = () => ({
3874
- type: {
3875
- describe: "检测类型",
3876
- type: "string",
3877
- choices: [Pe.REVERSE_MERGE]
3878
- }
3879
- }), Up = ({
3880
- config: e,
3881
- currentBranch: t
3882
- }) => {
3883
- const n = Bo();
3884
- if (!n)
3885
- return;
3886
- const r = ct(e), o = sn({
3887
- mergeInfo: n,
3888
- configMap: r,
3889
- currentBranch: t
3890
- }), { fromBranch: s } = n;
3891
- if (o) {
3892
- const i = `发现当前执行 git ${process.env.GIT_REFLOG_ACTION}
3893
- 意欲反向合并${s}
3894
- 拦截 !!!
3895
-
3896
- --------- 建议 ---------
3897
- 可以通过
3898
- 1.查看当前已提交记录的最新版本号
3899
- git log
3900
- 2. 回退到当前已提交记录的最新版本
3901
- git reset --hard <当前已提交记录的最新版本号>
3902
- `;
3903
- return _.error(i), process.exit(1);
3904
- }
3905
- }, Lp = ({
3906
- config: e,
3907
- currentBranch: t,
3908
- commitMsg: n,
3909
- rootDir: r
3910
- }) => {
3911
- if (xo(r))
3912
- return _.skip("当前在变基中, 不通过提交信息检测合并");
3913
- const o = Do(n), s = ct(e);
3914
- if (sn({
3915
- mergeInfo: o,
3916
- configMap: s,
3917
- currentBranch: t
3918
- })) {
3919
- const { fromBranch: i, toBranch: a = t } = o, c = `禁止${i}被合并: ${i} => ${a}
3920
-
3921
- --------- 建议 ---------
3922
- 可以通过
3923
- 1.查看当前已提交记录的最新版本号
3924
- git log
3925
- 2. 回退到当前已提交记录的最新版本
3926
- git reset --hard <当前已提交记录的最新版本号>
3927
- `;
3928
- return _.error(c), process.exit(1);
3929
- }
3930
- }, Bp = ({
3931
- config: e,
3932
- currentBranch: t
3933
- }) => {
3934
- const n = ct(e), r = Sp(n);
3935
- if (!r)
3936
- return;
3937
- const o = Fo({ count: r }), s = wp(n, o), i = o.map((c) => c.hash), a = ko({
3938
- /** 考虑reflog存在往复切换 */
3939
- count: r + 30,
3940
- filterItem: (c) => i.includes(c.hash)
3941
- }).reduce(
3942
- (c, f) => (f.mergeInfo && (c[f.hash] = f), c),
3943
- {}
3944
- );
3945
- o.forEach((c, f) => {
3946
- var u;
3947
- const p = c.mergeInfo || ((u = a[c.hash]) == null ? void 0 : u.mergeInfo);
3948
- p && Object.entries(n).forEach(([g]) => {
3949
- const y = s[g];
3950
- if (f > y) {
3951
- _.skip(
3952
- `${g} 只检测${y + 1}条, 超出不再检测`
3953
- );
3954
- return;
3955
- }
3956
- const h = sn({
3957
- mergeInfo: p,
3958
- configMap: n,
3959
- currentBranch: t
3960
- }), { fromBranch: m } = p;
3961
- if (h) {
3962
- const d = `发现${m}被合并
3963
- 本次提交版本 ${c.hash}
3964
- 提交注释 ${c.message}
3965
- 提交人: ${c.committer}
3966
- 提交时间: ${c.commitTime}
3967
-
3968
- --------- 建议 ---------
3969
- 可以通过
3970
- 1.查看操作日志版本号为${c.hash}的前一次操作的版本号
3971
- git reflog
3972
- 3. 回退到前一次操作的版本号
3973
- git reset --hard <当前已提交记录的最新版本号>
3974
- `;
3975
- return _.error(d), process.exit(1);
3976
- }
3977
- });
3978
- });
3979
- }, xp = ({
3980
- config: e,
3981
- rebaseInfo: t
3982
- }) => {
3983
- const n = ct(e), r = Object.entries(n), { targetBranch: o, originBranch: s } = t;
3984
- for (let [i, a] of r)
3985
- if (a.includeRebase) {
3986
- if (new RegExp(i).test(o)) {
3987
- const c = `禁止变基到${o}的基线
3988
- 即 禁止${s}分子包含${o}分支(可能)存在的其他需求的代码`;
3989
- return _.error(c), process.exit(1);
3990
- }
3991
- } else
3992
- _.skip(`不检测是否变基到${o}的基线`);
3993
- _.success(`允许变基到${o}`);
3994
- }, _e = async (e) => {
3995
- const { config: t, way: n } = e, r = Uo();
3996
- switch (n) {
3997
- case B.REFLOG_ACTION: {
3998
- Up({ config: t, currentBranch: r });
3999
- break;
4000
- }
4001
- case B.COMMIT_MSG: {
4002
- const { hookName: o, rootDir: s } = e, i = Lo({
4003
- hookName: o,
4004
- rootDir: s
4005
- });
4006
- Lp({
4007
- config: t,
4008
- currentBranch: r,
4009
- commitMsg: i,
4010
- rootDir: s
4011
- });
4012
- break;
4013
- }
4014
- case B.COMMIT_RECORD: {
4015
- Bp({ config: t, currentBranch: r });
4016
- break;
4017
- }
4018
- case B.PRE_REBASE: {
4019
- const { args: o } = e, [
4020
- s,
4021
- /** 能进入 rebase 说明originBranch有值 或者 当前在某个分支上 */
4022
- i = r
4023
- ] = o;
4024
- xp({
4025
- config: t,
4026
- rebaseInfo: {
4027
- targetBranch: s,
4028
- originBranch: i
4029
- }
4030
- });
4031
- break;
4032
- }
4033
- default:
4034
- throw new Error(`不支持的检测方式${n}`);
4035
- }
4036
- }, Dp = async (e) => {
4037
- const t = await ye(e), { type: n } = e;
4038
- switch (n) {
4039
- case Pe.REVERSE_MERGE: {
4040
- await _e({
4041
- rootDir: e.rootDir,
4042
- config: t,
4043
- way: B.COMMIT_RECORD
4044
- });
4045
- break;
4046
- }
4047
- default:
4048
- throw new Error(`不支持的检测类型${n}`);
4049
- }
4050
- }, Fp = {
4051
- command: `${ee.CHECK} <type>`,
4052
- describe: "检查git操作",
4053
- options: Mp(),
4054
- positionals: jp(),
4055
- handler: Dp
4056
- }, kp = () => Nt({
4057
- configPathDefault: nn
4058
- }), Hp = () => ({
4059
- name: {
4060
- describe: "钩子名称",
4061
- type: "string",
4062
- choices: bp
4063
- }
4064
- }), Gp = async (e) => {
4065
- const { name: t, rootDir: n, args: r } = e;
4066
- switch (t) {
4067
- case T.PRE_MERGE_COMMIT: {
4068
- const o = await ye(e);
4069
- _e({
4070
- config: o,
4071
- way: B.REFLOG_ACTION,
4072
- rootDir: n
4073
- });
4074
- break;
4075
- }
4076
- case T.PREPARE_COMMIT_MSG: {
4077
- const o = await ye(e);
4078
- _e({
4079
- config: o,
4080
- way: B.COMMIT_MSG,
4081
- hookName: t,
4082
- rootDir: n
4083
- });
4084
- break;
4085
- }
4086
- case T.POST_MERGE:
4087
- case T.PRE_PUSH: {
4088
- const o = await ye(e);
4089
- _e({
4090
- config: o,
4091
- way: B.COMMIT_RECORD,
4092
- rootDir: n
4093
- });
4094
- break;
4095
- }
4096
- case T.PRE_REBASE: {
4097
- const o = await ye(e);
4098
- _e({
4099
- config: o,
4100
- way: B.PRE_REBASE,
4101
- args: r
4102
- });
4103
- break;
4104
- }
4105
- default:
4106
- _.error(`${t} 当前未支持处理`);
4107
- }
4108
- }, qp = {
4109
- command: `${ee.HOOKS} <name> [args...]`,
4110
- describe: "git钩子回调",
4111
- options: kp(),
4112
- positionals: Hp(),
4113
- handler: Gp
4114
- }, { version: Kp, description: Jp } = tn;
4115
- [
4116
- Np,
4117
- Ip,
4118
- qp,
4119
- Fp
4120
- ].map(At), Wn({ packageJson: tn });
4121
- const Wp = async (e) => {
4122
- _.info("克隆done-coding系列项目"), _.stage("选择平台:");
4123
- const { platform: t } = await K(rn(x.GITEE));
4124
- _.stage("选择用户名:");
4125
- const { username: n } = await K(
4126
- on(
4127
- {
4128
- [x.GITHUB]: "done-coding",
4129
- [x.GITEE]: "justsosu"
4130
- }[t]
4131
- )
4132
- );
4133
- _.info("platform:", t), _.info("username:", n), await vo({
4134
- platform: t,
4135
- username: n,
4136
- projectName: e
4137
- });
4138
- }, zp = () => ({
4139
- [O.PROJECT_NAME]: {
4140
- alias: "n",
4141
- type: "string",
4142
- describe: "项目名称"
4143
- },
4144
- justCloneFromDoneCoding: {
4145
- alias: "clone",
4146
- type: "boolean",
4147
- describe: "是否仅仅(从done-coding系列项目列表中)克隆远程仓库",
4148
- default: !1,
4149
- hidden: !0
4150
- },
4151
- [O.TEMPLATE_GIT_PATH]: {
4152
- alias: "p",
4153
- type: "string",
4154
- describe: "模板仓库地址"
4155
- },
4156
- [O.TEMPLATE_GIT_BRANCH]: {
4157
- alias: "b",
4158
- type: "string",
4159
- describe: "模板仓库分支"
4160
- },
4161
- skipTemplateCompile: {
4162
- type: "boolean",
4163
- describe: "是否跳过模板编译",
4164
- default: !1,
4165
- hidden: !0
4166
- },
4167
- openGitDetailOptimize: {
4168
- type: "boolean",
4169
- describe: "开启git细节优化",
4170
- default: !0
4171
- },
4172
- [O.IS_CHANGE_BRANCH_NAME]: {
4173
- type: "boolean",
4174
- describe: "git细节优化:是否更改分支名",
4175
- default: !1
4176
- },
4177
- [O.LOCAL_BRANCH_NAME]: {
4178
- type: "string",
4179
- describe: "git细节优化:需要更改本地分支名时的更改值"
4180
- },
4181
- [O.IS_SAVE_GIT_HISTORY]: {
4182
- type: "boolean",
4183
- describe: "git细节优化:是否保存模板仓库git历史记录",
4184
- default: !1
4185
- },
4186
- [O.IS_TRANS_HTTP_URL_TO_SSH_URL]: {
4187
- type: "boolean",
4188
- describe: "git细节优化:是否将http url转换为ssh url"
4189
- },
4190
- [O.GIT_COMMIT_MESSAGE]: {
4191
- alias: "m",
4192
- type: "string",
4193
- describe: "git细节优化:git提交信息"
4194
- }
4195
- }), Co = async (e) => {
4196
- _.info(`版本: ${ie.version}`);
4197
- const {
4198
- [O.PROJECT_NAME]: t,
4199
- justCloneFromDoneCoding: n
4200
- } = e;
4201
- if (n) {
4202
- _.info("仅仅(从done-coding系列项目列表中)克隆远程仓库"), await Wp(t);
4203
- return;
4204
- }
4205
- const r = Ho({
4206
- presetAnswer: e
4207
- }), o = await r(
4208
- O.PROJECT_NAME,
4209
- Zo,
4210
- t
4211
- );
4212
- let s = o == null ? void 0 : o.trim();
4213
- if (!s)
4214
- return _.error("项目名称不能为空"), process.exit(1);
4215
- const i = Go(s);
4216
- i !== s && (_.warn(
4217
- `项目名称\`${s}\`包含非法字符,已自动转换为\`${i}\``
4218
- ), s = i);
4219
- const a = Wo(process.cwd(), s);
4220
- if (un(a))
4221
- if (await r(
4222
- O.IS_REMOVE_SAME_NAME_DIR,
4223
- os()
4224
- ) === !0)
4225
- lt(a, { recursive: !0, force: !0 });
4226
- else
4227
- return _.error(`项目${s}已存在`), process.exit(1);
4228
- let c = await r(
4229
- O.TEMPLATE_GIT_PATH
4230
- ), f = await r(
4231
- O.TEMPLATE_GIT_BRANCH
4232
- );
4233
- if (!c) {
4234
- const h = await r(
4235
- O.TEMPLATE,
4236
- await ts()
4237
- );
4238
- if (h === Vn)
4239
- c = await r(
4240
- O.CUSTOM_GIT_URL_INPUT,
4241
- ss
4242
- );
4243
- else if (h === Xn)
4244
- c = await Qo();
4245
- else {
4246
- const m = (await Yn()).find(
4247
- (d) => d.name === h
4248
- );
4249
- if (!m)
4250
- return _.error(`模板${h}不存在`), process.exit(1);
4251
- if (!m.url)
4252
- return _.error(`模板${h}仓库地址不存在`), process.exit(1);
4253
- c = m.url, typeof m.branch == "string" ? f = m.branch : Array.isArray(m.branch) && m.branch.length > 0 && (f = await r(
4254
- O.TEMPLATE_GIT_BRANCH,
4255
- us(m.branch)
4256
- ));
4257
- }
4258
- }
4259
- if (!c)
4260
- return _.error("模板仓库地址不存在"), process.exit(1);
4261
- const u = zn(".git");
4262
- if (_.stage("正在初始化项目,请稍等..."), F(
4263
- `git clone${f ? ` -b ${f}` : ""} ${c} ${s} --depth=1`,
4264
- { stdio: "inherit" }
4265
- ), e.openGitDetailOptimize && !u && f && await r(
4266
- O.IS_CHANGE_BRANCH_NAME,
4267
- as(f)
4268
- )) {
4269
- const m = await r(
4270
- O.LOCAL_BRANCH_NAME,
4271
- cs
4272
- );
4273
- F(`git branch -m ${m}`, {
4274
- cwd: a,
4275
- stdio: "inherit"
4276
- });
4277
- }
4278
- const p = Xo, g = zo({
4279
- rootDir: a,
4280
- configPath: p
4281
- });
4282
- if (g && (_.stage("当前模板项目配置了预设问题"), e.skipTemplateCompile ? _.stage("用户设置:跳过模板编译") : (_.stage("开始进行模板编译"), await Vo({
4283
- rootDir: a,
4284
- configPath: p,
4285
- extraEnvData: {
4286
- $projectName: s
4287
- }
4288
- }), lt(g, { force: !0 }), _.stage("模板项目配置编译成功, 编译配置文件已删除"))), !e.openGitDetailOptimize)
4289
- return _.stage("移除克隆仓库的git控制"), await cn(a), _.success("项目创建成功,移除克隆仓库的git控制成功"), process.exit(0);
4290
- if (_.stage("项目初始化完成"), u) {
4291
- const h = Be.resolve(a), m = Be.resolve(h, ".git");
4292
- if (!un(m))
4293
- throw new Error("git目录不存在");
4294
- lt(m, { recursive: !0, force: !0 }), _.stage(
4295
- `项目创建在父级git仓库${u}中,已删除${s}目录下的.git(${m})`
4296
- );
4297
- } else if (await r(
4298
- O.IS_SAVE_GIT_HISTORY,
4299
- ns
4300
- )) {
4301
- if (F(
4302
- `git remote rename ${Ie.ORIGIN} ${Ie.UPSTREAM} && git fetch --unshallow`,
4303
- {
4304
- cwd: a,
4305
- stdio: "inherit"
4306
- }
4307
- ), _.stage(
4308
- "已经将origin重命名为upstream,后续可以与模板git仓库有完整的交互"
4309
- ), _.success("已保存git历史记录"), qo(c)) {
4310
- const m = Ko(c);
4311
- await r(
4312
- O.IS_TRANS_HTTP_URL_TO_SSH_URL,
4313
- rs({
4314
- httpUrl: c,
4315
- sshUrl: m
4316
- })
4317
- ) && F(
4318
- `git remote set-url ${Ie.UPSTREAM} ${m}`,
4319
- {
4320
- cwd: a,
4321
- stdio: "inherit"
4322
- }
4323
- ), _.success(`已将模板远程仓库地址更换为${m}`);
4324
- }
4325
- } else
4326
- await cn(a), F("git init", {
4327
- cwd: a,
4328
- stdio: "inherit"
4329
- });
4330
- const y = await r(
4331
- O.GIT_COMMIT_MESSAGE,
4332
- is(s)
4333
- );
4334
- F(`git add . && git commit -m '${y}'`, {
4335
- cwd: a,
4336
- stdio: "inherit"
4337
- }), _.success(`项目${s}初始化完成`), _.info(`
4338
- 使用步骤:
4339
- 1. cd ${s}
4340
- 2. pnpm install
4341
- 3. pnpm run dev
4342
- `);
4343
- }, Vp = {
4344
- command: "$0",
4345
- describe: ie.description,
4346
- options: zp(),
4347
- // positionals: getPositionals(),
4348
- handler: Co
4349
- }, oh = async (e, t) => {
4350
- switch (e) {
4351
- case Qn.CREATE:
4352
- default:
4353
- return Co(t);
4354
- }
4355
- }, { version: Xp, description: Qp } = ie, Ao = {
4356
- describe: Qp,
4357
- version: Xp,
4358
- subcommands: [Vp].map(At),
4359
- demandCommandCount: 1,
4360
- rootScriptName: Wn({ packageJson: ie })
4361
- }, {
4362
- cliConfig: { moduleName: Yp }
4363
- } = ie, No = (e = !1) => {
4364
- const t = `${e ? `${Yp} ` : ""}[projectName]`, n = `$0 ${t.trim()}`;
4365
- return { command: t, usage: n };
4366
- }, sh = async () => Jo({
4367
- ...Ao,
4368
- ...No()
4369
- }), ih = () => At({
4370
- ...Ao,
4371
- ...No(!0)
4372
- });
4373
- export {
4374
- O as F,
4375
- Ie as G,
4376
- Qn as S,
4377
- ih as a,
4378
- Vp as b,
4379
- sh as c,
4380
- oh as d,
4381
- Ao as e,
4382
- Co as h,
4383
- ie as i
4384
- };