@fox-js/fox 3.0.2 → 3.1.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.
@@ -0,0 +1,5081 @@
1
+ import { ref as gr, getCurrentInstance as Mt, onUnmounted as ot, shallowRef as Gr, defineComponent as wr, inject as G, provide as se, h as he } from "vue";
2
+ /*!
3
+ * fox v3.1.0 Sun Mar 10 2024 23:48:35 GMT+0800 (中国标准时间)
4
+ */
5
+ const Ce = typeof window < "u", $ = function() {
6
+ return window;
7
+ }, De = function() {
8
+ return window.document;
9
+ };
10
+ function Qr(s) {
11
+ let e = s, t = e.lastIndexOf("/");
12
+ return t > 0 && t < e.length - 1 ? e = e.substring(0, t + 1) : t === 0 && e.indexOf(".") !== -1 ? e = "/" : t === -1 && (e.indexOf(".") == -1 ? e = `/${e}/` : e = "/"), e.indexOf("/") !== 0 && (e = `/${e}`), e;
13
+ }
14
+ function ct() {
15
+ if (!Ce)
16
+ return "/";
17
+ let s = $().location, e = `${s.protocol}//${s.host}`;
18
+ return e += Qr(s.pathname), e;
19
+ }
20
+ function Tt(s, e, t) {
21
+ s.addEventListener ? s.addEventListener(e, t, !1) : s.attachEvent ? s.attachEvent(`on${e}`, t) : s[`on${e}`] = t;
22
+ }
23
+ function qt(s, e, t) {
24
+ s.removeEventListener ? s.removeEventListener(e, t) : s.detachEvent ? s.detachEvent(`on${e}`, t) : s[`on${e}`] = null;
25
+ }
26
+ const un = Array.isArray, fn = (s) => It(s) === "[object Map]", cn = (s) => It(s) === "[object Set]", hn = (s) => s instanceof Date, x = (s) => typeof s == "function", yn = (s) => typeof s == "string", dn = (s) => typeof s == "symbol", Xr = (s) => s !== null && typeof s == "object", pn = (s) => Xr(s) && x(s.then) && x(s.catch), Yr = (s) => s == null, Zr = Object.prototype.toString, It = (s) => Zr.call(s), es = (s) => It(s) === "[object Object]", ts = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol";
27
+ function br(s) {
28
+ return s.__esModule || ts && s[Symbol.toStringTag] === "Module";
29
+ }
30
+ const rs = typeof Promise < "u" && Promise.toString().indexOf("[native code]") !== -1;
31
+ function T(...s) {
32
+ let e = s[0] !== void 0 && s[0] !== null ? s[0] : {}, t = 1, r = s.length, n = !1;
33
+ for (typeof e == "boolean" && (n = e, e = s[t] ?? {}, t++), typeof e != "object" && (e = {}); t < r; t++)
34
+ if (s[t] !== null && s[t] !== void 0) {
35
+ let i = s[t];
36
+ for (let o in i) {
37
+ let a = e[o], l = i[o];
38
+ if (a !== l)
39
+ if (n === !0 && l && typeof l == "object") {
40
+ let u;
41
+ Array.isArray(l) ? u = a && Array.isArray(a) ? a : [] : u = a && typeof a == "object" ? a : {}, e[o] = T(n, u, l);
42
+ } else
43
+ l !== void 0 && (e[o] = l);
44
+ }
45
+ }
46
+ return e;
47
+ }
48
+ function Nt(s, e, t = !1) {
49
+ if (!t)
50
+ T(!0, s, e);
51
+ else {
52
+ if (typeof e != "object")
53
+ return {};
54
+ typeof s != "object" && (s = {});
55
+ for (let r of Reflect.ownKeys(e)) {
56
+ let n = s[r], i = e[r];
57
+ if (n !== i)
58
+ if (typeof i == "object") {
59
+ if (!Array.isArray(i) && !es(i))
60
+ continue;
61
+ n = Nt(n, i, t), s[r] = n;
62
+ } else {
63
+ if (typeof i == "function")
64
+ continue;
65
+ s[r] = i;
66
+ }
67
+ }
68
+ }
69
+ return s;
70
+ }
71
+ class le {
72
+ /**
73
+ * 初始ID
74
+ */
75
+ static seed = (/* @__PURE__ */ new Date()).getTime();
76
+ /**
77
+ * 获取唯一ID
78
+ */
79
+ static get() {
80
+ let e = ++le.seed;
81
+ return e >= Number.MAX_VALUE && (le.seed = 0), e;
82
+ }
83
+ }
84
+ const ht = rs ? Promise.resolve() : null;
85
+ function Ne(s, ...e) {
86
+ ht !== null ? e && e.length > 0 ? ht.then(() => {
87
+ s(e);
88
+ }) : ht.then(s) : e && e.length > 0 ? setTimeout(() => {
89
+ s(e);
90
+ }) : setTimeout(s);
91
+ }
92
+ function xr(s) {
93
+ return s == null ? !1 : typeof s == "boolean" ? s : typeof s == "string" ? s.toLocaleLowerCase() === "true" : !!s;
94
+ }
95
+ function mn(s) {
96
+ return typeof s == "number" ? s : Number(s);
97
+ }
98
+ const ss = {
99
+ "[object Boolean]": "boolean",
100
+ "[object Number]": "number",
101
+ "[object String]": "string",
102
+ "[object Function]": "function",
103
+ "[object Array]": "array",
104
+ "[object Date]": "date",
105
+ "[object RegExp]": "regExp",
106
+ "[object Object]": "object"
107
+ };
108
+ function Wt(s) {
109
+ let t = Object.prototype.toString.call(s);
110
+ return s == null ? String(s) : ss[t] || "object";
111
+ }
112
+ function zt(s, e) {
113
+ if (s == e)
114
+ return !0;
115
+ if (s === void 0 || e === void 0)
116
+ return !1;
117
+ let t = Wt(s), r = Wt(e);
118
+ if (t !== r)
119
+ return !1;
120
+ if (t === "object") {
121
+ let n = Object.keys(s), i = Object.keys(e);
122
+ if (n.length !== i.length)
123
+ return !1;
124
+ for (let o = 0; o < n.length; o++) {
125
+ let a = n[o], l = s[a], u = e[a];
126
+ if (!zt(l, u))
127
+ return !1;
128
+ }
129
+ return !0;
130
+ } else if (t === "array") {
131
+ if (s.length !== e.length)
132
+ return !1;
133
+ for (let n = 0; n < s.length; n++) {
134
+ let i = s[n], o = e[n];
135
+ if (!zt(i, o))
136
+ return !1;
137
+ }
138
+ return !0;
139
+ }
140
+ return !1;
141
+ }
142
+ const Rr = (s) => {
143
+ const e = {};
144
+ for (let t of Reflect.ownKeys(s)) {
145
+ let r = s[t];
146
+ r && !Array.isArray(r) && typeof r == "object" && (r = Rr(r)), typeof t == "symbol" ? e[String(t)] = r : e[t] = r;
147
+ }
148
+ return e;
149
+ }, ns = /^Symbol\((.*)\)$/, Sr = (s) => {
150
+ const e = {};
151
+ for (let t of Reflect.ownKeys(s)) {
152
+ let r = s[t];
153
+ r && !Array.isArray(r) && typeof r == "object" && (r = Sr(r));
154
+ const n = ns.exec(t);
155
+ if (n && n[1]) {
156
+ const i = Symbol.for(n[1]);
157
+ e[i] = r;
158
+ } else
159
+ e[t] = r;
160
+ }
161
+ return e;
162
+ }, Jt = Symbol("idKey"), pe = Symbol("valueKey"), R = Symbol("childrenKey"), Q = Symbol("growKey");
163
+ class Pr {
164
+ /**
165
+ * 自动创建解决策略
166
+ */
167
+ [Q] = !0;
168
+ /**
169
+ * id
170
+ */
171
+ [Jt];
172
+ /**
173
+ * value
174
+ */
175
+ [pe] = gr();
176
+ /**
177
+ * children
178
+ */
179
+ [R] = /* @__PURE__ */ new Map();
180
+ /**
181
+ * 构造函数
182
+ * @param id
183
+ */
184
+ constructor(e) {
185
+ this[Jt] = e;
186
+ }
187
+ }
188
+ class is {
189
+ /**
190
+ * 拦截get操作
191
+ * @param target
192
+ * @param propName
193
+ */
194
+ get(e, t) {
195
+ if (t == "value")
196
+ return e[pe].value;
197
+ if (t === "grow")
198
+ return e[Q];
199
+ let r = e[R].get(t);
200
+ if (r)
201
+ return He(r);
202
+ if (e[Q])
203
+ return r = Dt(t), r[Q] = e[Q], e[R].set(t, r), He(r);
204
+ }
205
+ /**
206
+ * 拦截set操作
207
+ * @param target
208
+ * @param propName
209
+ * @param value
210
+ * @returns
211
+ */
212
+ set(e, t, r) {
213
+ return t == "value" ? (e[pe].value = r, !0) : t === "grow" ? (e[Q] = xr(r), !0) : r == null ? (e[R].delete(t), !0) : (console.error(`illegal property:${t}`), !1);
214
+ }
215
+ /**
216
+ * 拦截删除property属性
217
+ * @param target
218
+ * @param key
219
+ * @returns
220
+ */
221
+ deleteProperty(e, t) {
222
+ return t === "value" || t == "grow" ? (console.error(`can not delete property:${String(t)}`), !1) : (e[R].delete(t), !0);
223
+ }
224
+ }
225
+ const Ht = "__proxy__";
226
+ function Dt(s) {
227
+ const e = new Pr(s);
228
+ return Reflect.set(e, Ht, new Proxy(e, new is())), e;
229
+ }
230
+ function He(s) {
231
+ return Reflect.get(s, Ht);
232
+ }
233
+ class os {
234
+ /**
235
+ * 名称
236
+ */
237
+ name = "";
238
+ /**
239
+ * 持久化策略
240
+ */
241
+ persistPolicy = "momery";
242
+ /**
243
+ * storage
244
+ */
245
+ storage;
246
+ /**
247
+ * 标志初始化是否完
248
+ */
249
+ initFlag = !1;
250
+ /**
251
+ * state
252
+ */
253
+ state = {};
254
+ /**
255
+ * 构造函数
256
+ * @param tree
257
+ * @param options
258
+ */
259
+ constructor(e = {}) {
260
+ if (e.persistPolicy && e.persistPolicy !== "momery" && Yr(e.name))
261
+ throw new Error("name can not be empty, where persistPolicy is not momery.");
262
+ this.name = e.name ?? "", this.persistPolicy = e.persistPolicy ?? "momery", this.storage = e.storage;
263
+ }
264
+ /**
265
+ * 初始化
266
+ * @param tree
267
+ */
268
+ init(e) {
269
+ this.restore(e), this.initFlag = !0;
270
+ }
271
+ /**
272
+ * 获取storage
273
+ * @returns
274
+ */
275
+ getStorage() {
276
+ if (!this.persistPolicy)
277
+ return null;
278
+ let e = null;
279
+ if (this.persistPolicy === "custom")
280
+ e = this.storage;
281
+ else if (Ce) {
282
+ const t = $();
283
+ e = this.persistPolicy === "session" ? t.sessionStorage : t.localStorage;
284
+ }
285
+ return e;
286
+ }
287
+ /**
288
+ * 保存state
289
+ */
290
+ saveState() {
291
+ if (!this.persistPolicy || this.persistPolicy === "momery")
292
+ return;
293
+ let e = this.getStorage();
294
+ if (e === null || !this.state)
295
+ return;
296
+ const t = `_bus_${this.name}`, r = JSON.stringify(this.state ?? {});
297
+ e.setItem(t, r);
298
+ }
299
+ /**
300
+ * 移除state
301
+ */
302
+ removeState() {
303
+ if (!this.persistPolicy || this.persistPolicy === "momery")
304
+ return;
305
+ let e = this.getStorage();
306
+ if (e === null || !this.state)
307
+ return;
308
+ const t = `_bus_${this.name}`;
309
+ e.removeItem(t);
310
+ }
311
+ /**
312
+ * 恢复数据
313
+ */
314
+ restore(e) {
315
+ if (!this.persistPolicy || this.persistPolicy === "momery")
316
+ return;
317
+ let t = this.getStorage();
318
+ if (t === null)
319
+ return;
320
+ const r = `_bus_${this.name}`, n = t.getItem(r);
321
+ n && (this.state = JSON.parse(n), Reflect.ownKeys(this.state).forEach((o) => {
322
+ if (typeof o != "string")
323
+ return;
324
+ const a = this.state[o], l = o.split(/\//g);
325
+ l.push(a), Reflect.apply(e.put, e, l);
326
+ }));
327
+ }
328
+ /**
329
+ * 保存数据
330
+ * @param args
331
+ */
332
+ put(e) {
333
+ if (this.initFlag && this.persistPolicy !== "momery")
334
+ try {
335
+ const t = e.length, r = e.slice(0, t - 1).join("/"), n = e[t - 1];
336
+ this.state[r] = n, this.saveState();
337
+ } catch (t) {
338
+ console.error(t);
339
+ }
340
+ }
341
+ /**
342
+ * 移除数据
343
+ * @param args
344
+ */
345
+ remove(e) {
346
+ if (this.initFlag && this.persistPolicy !== "momery")
347
+ try {
348
+ const t = e.length, r = e.slice(0, t - 1).join("/"), n = {};
349
+ Reflect.ownKeys(this.state).forEach((o) => {
350
+ typeof o == "string" && (o === r || o.startsWith(r) || (n[o] = this.state[o]));
351
+ }), this.state = n, this.saveState();
352
+ } catch (t) {
353
+ console.error(t);
354
+ }
355
+ }
356
+ /**
357
+ * 清理数据
358
+ */
359
+ clear() {
360
+ if (this.initFlag)
361
+ try {
362
+ this.state = {}, this.removeState();
363
+ } catch (e) {
364
+ console.error(e);
365
+ }
366
+ }
367
+ }
368
+ class Cr extends Pr {
369
+ /**
370
+ * 持久化处理器
371
+ */
372
+ _persistHandler;
373
+ /**
374
+ * 默认构造函数
375
+ */
376
+ constructor(e = {}) {
377
+ super("__root__"), this._persistHandler = new os(e), this._persistHandler.init(this);
378
+ }
379
+ /**
380
+ * 加入数据
381
+ * @param args
382
+ * @returns {boolean}
383
+ */
384
+ put(...e) {
385
+ let t = e.length;
386
+ if (t < 2)
387
+ return console.error("参数至少包括一个(key, value)"), !1;
388
+ let r = this;
389
+ for (let n = 0; n < t - 1; n++) {
390
+ let i = e[n], o;
391
+ r[R].has(i) ? o = r[R].get(i) : (o = Dt(i), r[R].set(i, o)), r = o;
392
+ }
393
+ return r[pe].value = e[t - 1], this._persistHandler.put(e), !0;
394
+ }
395
+ /**
396
+ * 获取内容
397
+ * @param args
398
+ * @returns {any}
399
+ */
400
+ get(...e) {
401
+ let t = e.length;
402
+ if (t === 0)
403
+ return;
404
+ let r = this;
405
+ for (let n = 0; n < t; n++) {
406
+ let i = e[n];
407
+ if (r[R].has(i))
408
+ r = r[R].get(i);
409
+ else
410
+ return;
411
+ }
412
+ return r[pe].value;
413
+ }
414
+ /**
415
+ * 移除数据
416
+ * @param args
417
+ * @returns {boolean}
418
+ */
419
+ remove(...e) {
420
+ let t = e.length;
421
+ if (t == 0)
422
+ return !1;
423
+ let r = this;
424
+ for (let i = 0; i < t - 1; i++) {
425
+ const o = e[i];
426
+ if (r[R].has(o))
427
+ r = r[R].get(o);
428
+ else
429
+ return !1;
430
+ }
431
+ const n = e[t - 1];
432
+ return r[R].has(n) ? (r[R].delete(n), this._persistHandler.remove(e), !0) : !1;
433
+ }
434
+ /**
435
+ * 判断是否包含数据
436
+ * @param args
437
+ * @returns {boolean}
438
+ */
439
+ contains(...e) {
440
+ const t = e.length;
441
+ if (t == 0)
442
+ return !1;
443
+ let r = this;
444
+ for (let i = 0; i < t - 1; i++) {
445
+ let o = e[i];
446
+ if (r[R].has(o))
447
+ r = r[R].get(o);
448
+ else
449
+ return !1;
450
+ }
451
+ const n = e[t - 1];
452
+ return r[R].has(n);
453
+ }
454
+ /**
455
+ * 清空所以数据
456
+ */
457
+ clear() {
458
+ this[R].clear(), this._persistHandler.clear();
459
+ }
460
+ }
461
+ const ls = ["put", "get", "contains", "remove", "clear", "_persistHandler"];
462
+ function Gt(s) {
463
+ return ls.includes(s);
464
+ }
465
+ class as {
466
+ /**
467
+ * 拦截get操作
468
+ * @param target
469
+ * @param propName
470
+ */
471
+ get(e, t) {
472
+ if (t == "value")
473
+ return e[pe].value;
474
+ if (t === "grow")
475
+ return e[Q];
476
+ if (t === R)
477
+ return e[R];
478
+ if (typeof t == "string" && Gt(t))
479
+ return e[t];
480
+ let r = String(t), n = e[R].get(r);
481
+ if (n)
482
+ return He(n);
483
+ if (e[Q])
484
+ return n = Dt(r), n[Q] = e[Q], e[R].set(r, n), He(n);
485
+ }
486
+ /**
487
+ * 拦截set操作
488
+ * @param target
489
+ * @param propName
490
+ * @param value
491
+ * @returns
492
+ */
493
+ set(e, t, r) {
494
+ return t == "value" ? (e[pe].value = r, !0) : t === "grow" ? (e[Q] = xr(r), !0) : Gt(t) ? !1 : r == null ? (e[R].delete(t), !0) : (console.error(`illegal property:${t}`), !1);
495
+ }
496
+ /**
497
+ * 拦截删除property属性
498
+ * @param target
499
+ * @param key
500
+ * @returns
501
+ */
502
+ deleteProperty(e, t) {
503
+ return t === "value" || t == "grow" ? (console.error(`can not delete property:${String(t)}`), !1) : (e[R].delete(t), !0);
504
+ }
505
+ }
506
+ function us(s) {
507
+ const e = new Cr(s), t = new as(), r = new Proxy(e, t);
508
+ return Reflect.set(e, Ht, r), e;
509
+ }
510
+ const Qt = new Proxy(Cr, {
511
+ /**
512
+ * 拦截构造函数
513
+ * @param target
514
+ * @param args
515
+ * @returns
516
+ */
517
+ construct(s, e) {
518
+ const t = us(e[0] ?? {});
519
+ return He(t);
520
+ }
521
+ }), te = "default", Ar = Symbol("sync"), H = Symbol("resolveRoute");
522
+ function Xt(s) {
523
+ let e = !1;
524
+ return function(...t) {
525
+ if (!e)
526
+ return e = !0, Reflect.apply(s, {}, t);
527
+ };
528
+ }
529
+ function fs(s) {
530
+ let e = s.src;
531
+ return new Promise((t, r) => {
532
+ const n = Xt((a) => {
533
+ br(a) && (a = a.default), s.component = a, console.debug("success load async module"), t();
534
+ }), i = Xt((a) => {
535
+ console.debug("reject load async module"), r(a);
536
+ });
537
+ let o;
538
+ try {
539
+ o = e(n, i);
540
+ } catch (a) {
541
+ i(a);
542
+ }
543
+ if (o)
544
+ if (typeof o.then == "function")
545
+ o.then(n, i);
546
+ else {
547
+ const a = o.component;
548
+ a && typeof a.then == "function" && a.then(n, i);
549
+ }
550
+ });
551
+ }
552
+ class cs {
553
+ /**
554
+ * 插槽名称
555
+ */
556
+ name;
557
+ /**
558
+ * 层次
559
+ */
560
+ level;
561
+ /**
562
+ * root插槽节点名称
563
+ */
564
+ rootName;
565
+ /**
566
+ * root插槽节点index
567
+ */
568
+ rootIndex = 0;
569
+ /**
570
+ * 构造函数
571
+ * @param name
572
+ * @param level
573
+ * @param rootName
574
+ */
575
+ constructor(e, t, r, n) {
576
+ this.name = e, this.level = t, this.rootName = r, this.rootIndex = n;
577
+ }
578
+ }
579
+ class rt {
580
+ /**
581
+ * 目标路由
582
+ */
583
+ to;
584
+ /**
585
+ * 目标路由
586
+ */
587
+ routeModel;
588
+ /**
589
+ * 来源路由
590
+ */
591
+ from;
592
+ /**
593
+ * 流程数据
594
+ */
595
+ data = {};
596
+ /**
597
+ * 构造函数
598
+ * @param to
599
+ * @param from
600
+ */
601
+ constructor(e, t) {
602
+ this.to = e, this.from = t;
603
+ }
604
+ /**
605
+ * 转换为session
606
+ * @param src
607
+ * @returns
608
+ */
609
+ static from(e) {
610
+ let t = new rt(e.to, e.from), r = e.data ?? {};
611
+ return T(!0, t.data, r), t;
612
+ }
613
+ }
614
+ class S {
615
+ /**
616
+ * 路径
617
+ */
618
+ path;
619
+ /**
620
+ * 返回full path
621
+ */
622
+ get fullPath() {
623
+ const e = this.path ?? `/${this.name}`;
624
+ return `${this.root ?? te}!${e}`;
625
+ }
626
+ /**
627
+ * 别名路径(设置了该属性后,url的route mark优先使用别名显示)
628
+ */
629
+ alias;
630
+ /**
631
+ * 名称
632
+ */
633
+ name;
634
+ /**
635
+ * 嵌入root节点
636
+ */
637
+ root;
638
+ /**
639
+ * 参数
640
+ */
641
+ params;
642
+ /**
643
+ * 查询
644
+ */
645
+ query;
646
+ /**
647
+ * 无痕迹模式
648
+ */
649
+ traceless;
650
+ /**
651
+ * 模版path(设置了该属性后,设置了template属性后,会使用template指向的ruteModel作为模版创建新的ruote页面)
652
+ */
653
+ template;
654
+ /**
655
+ * 获取匹配的元数组列表
656
+ */
657
+ matched;
658
+ /**
659
+ * route本身的元数据
660
+ */
661
+ meta;
662
+ /**
663
+ * 成功回调函数
664
+ */
665
+ success;
666
+ /**
667
+ * 失败回调函数
668
+ */
669
+ error;
670
+ /**
671
+ * 页面销毁回答函数
672
+ */
673
+ destroy;
674
+ /**
675
+ * 操作类型(Push, Replace, Put, Append)
676
+ */
677
+ opsType;
678
+ /**
679
+ * 更新类型(All,Part)
680
+ */
681
+ updateType;
682
+ /**
683
+ * 历史更新策略
684
+ */
685
+ historyUpdatePolicy;
686
+ /**
687
+ * view属性集合(用于multi view的tab view属性)
688
+ */
689
+ viewTagAttrs;
690
+ /**
691
+ * 索引(用于opsType为Append的情况下,可以精确卸载的需求)
692
+ */
693
+ index;
694
+ /**
695
+ * 是否激活状态(用于多视图,Open操作的情况下,标志view是否为激活状态)
696
+ */
697
+ active;
698
+ /**
699
+ * 插槽(用于历史还原)
700
+ */
701
+ slot;
702
+ /**
703
+ * session(router执行链路session)
704
+ */
705
+ session;
706
+ /**
707
+ * 克隆
708
+ * @param target
709
+ * @param plain 是否只克隆plain对象
710
+ */
711
+ static clone(e, t) {
712
+ let r = new S();
713
+ return Nt(r, e, t), r;
714
+ }
715
+ /**
716
+ * 判断路由是否相同
717
+ * @param x
718
+ * @param y
719
+ * @returns
720
+ */
721
+ static isSame(e, t) {
722
+ return e === t ? !0 : !(e == null || t == null || e.path && e.path !== t.path || e.name && e.name !== t.name || e.root !== t.root || e.index !== t.index);
723
+ }
724
+ /**
725
+ * 判断路由对应的route model是否一致
726
+ * @param x
727
+ * @param y
728
+ * @returns
729
+ */
730
+ static isSameForRouteModel(e, t) {
731
+ return e === t ? !0 : !(e == null || t == null || e.path && e.path != t.path || e.name && e.name != t.name);
732
+ }
733
+ /**
734
+ * 由对象生成路由
735
+ * @param obj
736
+ * @returns
737
+ */
738
+ static from(e) {
739
+ let t = new S();
740
+ if (e == null)
741
+ return t;
742
+ let r = t;
743
+ for (let i in e) {
744
+ let o = e[i];
745
+ r[i] = o;
746
+ }
747
+ const n = Object.getOwnPropertySymbols(e);
748
+ if (Array.isArray(n) && n.length > 0)
749
+ for (let i of n)
750
+ r[i] = e[i];
751
+ return t;
752
+ }
753
+ }
754
+ class hs {
755
+ /**
756
+ * 唯一ID(用于区分model)
757
+ */
758
+ id;
759
+ /**
760
+ * 名称
761
+ */
762
+ name;
763
+ /**
764
+ * 属性
765
+ */
766
+ props;
767
+ /**
768
+ * 元数据
769
+ */
770
+ meta;
771
+ /**
772
+ * 原始组件数据
773
+ */
774
+ src;
775
+ /**
776
+ * 组件(解析后组件)
777
+ */
778
+ component;
779
+ /**
780
+ * 构造函数
781
+ *
782
+ * @param name
783
+ * @param src
784
+ * @param props
785
+ * @param meta
786
+ */
787
+ constructor(e, t, r, n) {
788
+ this.id = le.get(), this.name = e, this.src = t, typeof t != "function" && (this.component = t), this.props = r, this.meta = n;
789
+ }
790
+ /**
791
+ * 是否已经解析完成
792
+ */
793
+ get isResolved() {
794
+ return this.component !== void 0;
795
+ }
796
+ /**
797
+ * 解析组件
798
+ */
799
+ resolve() {
800
+ return fs(this);
801
+ }
802
+ }
803
+ class Yt {
804
+ /**
805
+ * 节点
806
+ */
807
+ models = [];
808
+ }
809
+ class yt {
810
+ /**
811
+ * 路径
812
+ */
813
+ path;
814
+ /**
815
+ * 路径match
816
+ */
817
+ match;
818
+ /**
819
+ * 转发路径
820
+ */
821
+ redirect;
822
+ /**
823
+ * 名称
824
+ */
825
+ name;
826
+ /**
827
+ * layer集合
828
+ */
829
+ layers = [];
830
+ }
831
+ var q = /* @__PURE__ */ ((s) => (s[s.Push = 0] = "Push", s[s.Replace = 1] = "Replace", s[s.Put = 2] = "Put", s[s.Append = 3] = "Append", s[s.Open = 4] = "Open", s))(q || {});
832
+ const D = Symbol("chainKey"), N = Symbol("cursorKey"), dt = Symbol("$persistentModeKey"), F = Symbol("statusKey"), Z = Symbol("argsKey"), Ue = Symbol("exArgsKey"), me = Symbol("successFnsKey"), Fe = Symbol("errorFnsKey"), ae = Symbol("sessionKey"), ee = Symbol("_go");
833
+ class st {
834
+ /**
835
+ * 事件链路
836
+ */
837
+ [D] = [];
838
+ /**
839
+ * 游标
840
+ */
841
+ [N] = 0;
842
+ /**
843
+ * 是否持久模式(该状态为true的情况,已经执行的任务会继续保存在队列中)
844
+ */
845
+ [dt] = !1;
846
+ /**
847
+ * 状态
848
+ */
849
+ [F] = "Free";
850
+ /**
851
+ * 参数
852
+ */
853
+ [Z] = [];
854
+ /**
855
+ * 异常参数
856
+ */
857
+ [Ue] = [];
858
+ /**
859
+ * 移除函数
860
+ */
861
+ [me] = [];
862
+ /**
863
+ * 错误函数
864
+ */
865
+ [Fe] = [];
866
+ /**
867
+ * 链路session
868
+ */
869
+ [ae];
870
+ /**
871
+ * 获取session
872
+ */
873
+ get session() {
874
+ return this[ae];
875
+ }
876
+ /**
877
+ * 构造函数
878
+ *
879
+ * @param session
880
+ * @param persistentMode
881
+ */
882
+ constructor(e, t = !1) {
883
+ this[ae] = e, this[dt] = t;
884
+ }
885
+ /**
886
+ * 触发链路的下一个任务
887
+ * @param step
888
+ * @param params
889
+ */
890
+ [ee](e, ...t) {
891
+ let r = this[F];
892
+ if (this[F] = "Busy", this[N] += e, this[N] < 0 && (this[N] = 0), this[Z] = t, r === "Exception" || r === "Reject") {
893
+ let a = [{
894
+ session: this[ae]
895
+ }, ...this[Ue]];
896
+ for (; this[Fe].length > 0; )
897
+ try {
898
+ let l = this[Fe].shift();
899
+ typeof l == "function" && Ne(() => {
900
+ Reflect.apply(l, {}, a);
901
+ });
902
+ } catch (l) {
903
+ console.error(l.message, l);
904
+ }
905
+ return this[F] = r, this[D] = [], this[N] = 0, this;
906
+ } else if (r === "Finished" || this[N] >= this[D].length) {
907
+ let a = [{
908
+ session: this[ae]
909
+ }, ...this[Z]];
910
+ for (; this[me].length > 0; ) {
911
+ let l = this[me].shift();
912
+ typeof l == "function" && Ne(() => {
913
+ Reflect.apply(l, {}, a);
914
+ });
915
+ }
916
+ return this[F] = "Free", this;
917
+ }
918
+ if (this[N] >= this[D].length)
919
+ return this[F] = "Free", this;
920
+ let n = this[D][this[N]];
921
+ this[dt] || (this[D].splice(0, this[N] + 1), this[N] = -1);
922
+ let i = this[N] + 1;
923
+ try {
924
+ let o = !1, a = {
925
+ //go
926
+ go: (l, ...u) => {
927
+ o || (o = !0, Reflect.apply(this[ee], this, [l, ...u]));
928
+ },
929
+ //resolve
930
+ resolve: (...l) => {
931
+ o || (o = !0, Reflect.apply(this[ee], this, [1, ...l]));
932
+ },
933
+ //reject
934
+ reject: (...l) => {
935
+ o || (o = !0, Reflect.apply(this.reject, this, [...l]));
936
+ },
937
+ //insert
938
+ insert: (l) => {
939
+ o || (this[D].splice(i, 0, l), i++);
940
+ },
941
+ //session
942
+ session: this[ae]
943
+ };
944
+ Ne(() => {
945
+ Reflect.apply(n, {}, [a, ...this[Z]]);
946
+ });
947
+ } catch (o) {
948
+ this.throw(o);
949
+ }
950
+ return this;
951
+ }
952
+ /**
953
+ * 跳转
954
+ * @param step
955
+ * @param params
956
+ */
957
+ go(e, ...t) {
958
+ return Reflect.apply(this[ee], this, [e, ...t]);
959
+ }
960
+ /**
961
+ * 结束事件链调用,直接触发wait函数(success方法)
962
+ * @param params
963
+ */
964
+ finish(...e) {
965
+ return this[F] = "Finished", this[Z] = e, Reflect.apply(this[ee], this, [0]);
966
+ }
967
+ /**
968
+ * 结束事件链调用,直接触发wait函数(error方法)
969
+ * @param params
970
+ */
971
+ reject(...e) {
972
+ return this[F] = "Reject", this[Ue] = e, Reflect.apply(this[ee], this, [0]);
973
+ }
974
+ /**
975
+ * 结束事件链调用,直接触发error函数
976
+ * @param params
977
+ */
978
+ throw(...e) {
979
+ return this[F] = "Exception", this[Ue] = e, Reflect.apply(this[ee], this, [0]);
980
+ }
981
+ /**
982
+ * 重置事件链,直接触发wait函数
983
+ * @param params
984
+ */
985
+ reset(...e) {
986
+ this[F] = "Busy", this[Z] = e, this[D] = [], this[N] = 0;
987
+ let r = [{
988
+ session: this[ae]
989
+ }, ...this[Z]];
990
+ for (; this[me].length > 0; ) {
991
+ let n = this[me].shift();
992
+ Ne(() => {
993
+ Reflect.apply(n, this, r);
994
+ });
995
+ }
996
+ return this[F] = "Free", this;
997
+ }
998
+ /**
999
+ * 加入任务
1000
+ * @param task
1001
+ * @returns {EventChain}
1002
+ */
1003
+ post(e) {
1004
+ return this[F] === "Reject" || this[F] === "Exception" ? this : (Array.isArray(e) ? this[D] = [...this[D], ...e] : this[D].push(e), this[F] === "Busy" ? this : (Reflect.apply(this[ee], this, [0, ...this[Z]]), this));
1005
+ }
1006
+ /**
1007
+ * 加入等待任务
1008
+ * @param successFn
1009
+ * @param errorFn
1010
+ * @returns
1011
+ */
1012
+ wait(e, t) {
1013
+ return e && typeof e == "function" && this[me].push(e), t && typeof t == "function" && this[Fe].push(t), this[F] === "Busy" ? this : (Reflect.apply(this[ee], this, [0, ...this[Z]]), this);
1014
+ }
1015
+ /**
1016
+ * 加入异常处理任务
1017
+ * @param errorFn
1018
+ * @returns
1019
+ */
1020
+ exception(e) {
1021
+ return e && typeof e == "function" && this[Fe].push(e), this[F] === "Busy" ? this : Reflect.apply(this[ee], this, [0, ...this[Z]]);
1022
+ }
1023
+ /**
1024
+ * 判断事件链是否已经执行完成
1025
+ * @returns {boolean}
1026
+ */
1027
+ isFinish() {
1028
+ return this[F] == "Reject" || this[F] == "Free" && this[N] >= this[D].length;
1029
+ }
1030
+ }
1031
+ const ve = Symbol("registerKey");
1032
+ class ys {
1033
+ /**
1034
+ * 事件策略
1035
+ */
1036
+ policy;
1037
+ /**
1038
+ * 回调函数
1039
+ */
1040
+ callback;
1041
+ /**
1042
+ * 构造函数
1043
+ * @param callback
1044
+ * @param policy
1045
+ */
1046
+ constructor(e, t) {
1047
+ this.callback = e, this.policy = t;
1048
+ }
1049
+ }
1050
+ class Zt {
1051
+ /**
1052
+ * 注册表
1053
+ */
1054
+ [ve] = /* @__PURE__ */ new Map();
1055
+ /**
1056
+ * 构造函数
1057
+ */
1058
+ constructor() {
1059
+ }
1060
+ /**
1061
+ * 绑定事件
1062
+ * @param key
1063
+ * @param callback
1064
+ * @param once
1065
+ * @returns
1066
+ */
1067
+ on(e, t, r = !1) {
1068
+ let n = this[ve].get(e);
1069
+ n || (n = new Array(), this[ve].set(e, n));
1070
+ let i = r === !0 ? 1 : 0, o = new ys(t, i);
1071
+ return n.push(o), this;
1072
+ }
1073
+ /**
1074
+ * 解除绑定
1075
+ * @param key
1076
+ * @param callback
1077
+ * @returns
1078
+ */
1079
+ off(e, t) {
1080
+ if (!t)
1081
+ return this[ve].delete(e), this;
1082
+ let r = this[ve].get(e);
1083
+ if (r) {
1084
+ for (let n = 0; n < r.length; n++)
1085
+ if (r[n].callback === t) {
1086
+ r.splice(n, 1);
1087
+ break;
1088
+ }
1089
+ }
1090
+ return this;
1091
+ }
1092
+ /**
1093
+ * 绑定事件
1094
+ * @param key
1095
+ * @param callback
1096
+ * @param once
1097
+ * @returns
1098
+ */
1099
+ bind(e, t, r = !1) {
1100
+ return this.on(e, t, r);
1101
+ }
1102
+ /**
1103
+ * 解除绑定
1104
+ * @param key
1105
+ * @param callback
1106
+ * @returns
1107
+ */
1108
+ unbind(e, t) {
1109
+ return this.off(e, t);
1110
+ }
1111
+ /**
1112
+ * 绑定一次性触发函数
1113
+ * @param key
1114
+ * @param callback
1115
+ * @returns
1116
+ */
1117
+ once(e, t) {
1118
+ return this.on(e, t, !0);
1119
+ }
1120
+ /**
1121
+ * 绑定多条件触发函数
1122
+ * @param args
1123
+ */
1124
+ all(...e) {
1125
+ let t = e.length;
1126
+ if (t < 1)
1127
+ return this;
1128
+ let r = e[t - 1];
1129
+ if (typeof r != "function")
1130
+ return console.error("callback can not benn empty"), this;
1131
+ let n = t - 1, i = new Array(n), o = [].splice.call(e, 0, n);
1132
+ for (let a = 0; a < o.length; a++)
1133
+ this.once(o[a], (l) => {
1134
+ i[a] = l, n -= 1, n == 0 && Reflect.apply(r, {}, i);
1135
+ });
1136
+ return this;
1137
+ }
1138
+ /**
1139
+ * 触发函数
1140
+ * @param key
1141
+ * @param value
1142
+ */
1143
+ emit(e, ...t) {
1144
+ let r = this[ve].get(e);
1145
+ if (!r)
1146
+ return this;
1147
+ for (let n = 0; n < r.length; ) {
1148
+ let i = r[n];
1149
+ if (i.policy == 1 ? r.splice(n, 1) : n++, typeof i.callback == "function")
1150
+ try {
1151
+ Ne(() => {
1152
+ Reflect.apply(i.callback, {}, t);
1153
+ });
1154
+ } catch (o) {
1155
+ console.error(o.message, o);
1156
+ }
1157
+ }
1158
+ return this;
1159
+ }
1160
+ /**
1161
+ * 触发函数
1162
+ * @param key
1163
+ * @param value
1164
+ * @returns
1165
+ */
1166
+ trigger(e, ...t) {
1167
+ return Reflect.apply(this.emit, this, [e, ...t]);
1168
+ }
1169
+ }
1170
+ const _e = Symbol("registerKey");
1171
+ class ds {
1172
+ /**
1173
+ * 数据列表
1174
+ */
1175
+ [_e] = /* @__PURE__ */ new Map();
1176
+ /**
1177
+ * 构造函数
1178
+ */
1179
+ constructor() {
1180
+ }
1181
+ /**
1182
+ * 设置value
1183
+ * @param key
1184
+ * @param value
1185
+ */
1186
+ set(e, t) {
1187
+ this[_e].set(e, t);
1188
+ }
1189
+ /**
1190
+ * 获取数据
1191
+ * @param key
1192
+ * @returns
1193
+ */
1194
+ get(e) {
1195
+ return this[_e].get(e);
1196
+ }
1197
+ /**
1198
+ * 是否有对应的数据
1199
+ * @param key
1200
+ * @returns
1201
+ */
1202
+ has(e) {
1203
+ return this[_e].has(e);
1204
+ }
1205
+ /**
1206
+ * 删除数据
1207
+ * @param key
1208
+ * @returns
1209
+ */
1210
+ delete(e) {
1211
+ return this[_e].delete(e);
1212
+ }
1213
+ }
1214
+ const de = Symbol("lc");
1215
+ function nt(s, e = !1) {
1216
+ let t = s;
1217
+ if (Reflect.has(t, de))
1218
+ return t[de];
1219
+ if (e) {
1220
+ const r = new ds();
1221
+ return t[de] = r, r;
1222
+ }
1223
+ return null;
1224
+ }
1225
+ function Er(s, e = !1) {
1226
+ let t = null, r = s;
1227
+ for (; r && !(Reflect.has(r, de) && (t = r[de], t)); )
1228
+ r = r.$parent;
1229
+ if (!t && e) {
1230
+ const n = s;
1231
+ n && n.$parent && (t = nt(n.$parent, e));
1232
+ }
1233
+ return t;
1234
+ }
1235
+ function Fr(s, e) {
1236
+ let t = s;
1237
+ for (; t; ) {
1238
+ if (Reflect.has(t, de)) {
1239
+ const r = t[de];
1240
+ if (r.has(e))
1241
+ return r.get(e);
1242
+ }
1243
+ t = t.$parent;
1244
+ }
1245
+ return null;
1246
+ }
1247
+ function vn(s, e, t) {
1248
+ Er(s, !0)?.set(e, t);
1249
+ }
1250
+ function gn(s, e) {
1251
+ Er(s, !0)?.delete(e);
1252
+ }
1253
+ function er(s) {
1254
+ if (Array.isArray(s.children) && s.children.length > 0) {
1255
+ let e = s.children[0];
1256
+ if (e != null && e.component != null && e.component.proxy != null)
1257
+ return nt(e.component.proxy, !1);
1258
+ }
1259
+ return null;
1260
+ }
1261
+ const it = Symbol("hooksKey");
1262
+ function ps(s) {
1263
+ let e = s.get(it);
1264
+ e || (e = [], s.set(it, e));
1265
+ }
1266
+ function tr(s, e) {
1267
+ let t = s.get(it);
1268
+ if (t != null)
1269
+ for (let r = t.length - 1; r >= 0; r--) {
1270
+ let n = t[r];
1271
+ if (n.type === e)
1272
+ try {
1273
+ Reflect.apply(n.hook, n.target, []);
1274
+ } catch (i) {
1275
+ console.error(i.message, i);
1276
+ }
1277
+ }
1278
+ }
1279
+ var jt = /* @__PURE__ */ ((s) => (s.DEACTIVATED = "da", s.ACTIVATED = "a", s))(jt || {});
1280
+ class ms {
1281
+ /**
1282
+ * 类型
1283
+ */
1284
+ type;
1285
+ /**
1286
+ * hook函数
1287
+ */
1288
+ hook;
1289
+ /**
1290
+ * 调用目标
1291
+ */
1292
+ target;
1293
+ /**
1294
+ * 构造函数
1295
+ * @param type
1296
+ * @param hook
1297
+ * @param target
1298
+ */
1299
+ constructor(e, t, r) {
1300
+ this.target = r, this.hook = t, this.type = e;
1301
+ }
1302
+ }
1303
+ function vs(s, e, t, r) {
1304
+ let n = new ms(e, t, r);
1305
+ return s.push(n), !0;
1306
+ }
1307
+ function gs(s, e, t, r) {
1308
+ let n = -1;
1309
+ for (let i = 0; i < s.length; i++) {
1310
+ let o = s[i];
1311
+ if (o.type === e && o.hook === t && o.target === r) {
1312
+ n = i;
1313
+ break;
1314
+ }
1315
+ }
1316
+ return n != -1 ? (s.splice(n, 1), !0) : !1;
1317
+ }
1318
+ function _r(s) {
1319
+ return (e, t) => {
1320
+ let r;
1321
+ if (t)
1322
+ r = t;
1323
+ else {
1324
+ const i = Mt();
1325
+ if (i == null || i.proxy == null) {
1326
+ console.error("can not get current instance or proxy");
1327
+ return;
1328
+ }
1329
+ r = i.proxy;
1330
+ }
1331
+ const n = Fr(r, it);
1332
+ if (n == null) {
1333
+ console.warn("hooks context not found");
1334
+ return;
1335
+ }
1336
+ ot(() => {
1337
+ gs(n, s, e, r);
1338
+ }), vs(n, s, e, r);
1339
+ };
1340
+ }
1341
+ const wn = _r(
1342
+ "a"
1343
+ /* ACTIVATED */
1344
+ ), bn = _r(
1345
+ "da"
1346
+ /* DEACTIVATED */
1347
+ ), Kr = Symbol("routeKey");
1348
+ function rr(s, e) {
1349
+ s.set(Kr, e);
1350
+ }
1351
+ function Ut(s) {
1352
+ let e = Fr(s, Kr);
1353
+ return typeof e == "function" ? e() : e ?? null;
1354
+ }
1355
+ const lt = Symbol("rk"), pt = Symbol("vd"), sr = Symbol("rv"), mt = Symbol("rvi"), nr = Symbol("pv"), vt = Symbol("pvi");
1356
+ function ws(s) {
1357
+ for (var e = [], t = 0; t < s.length; ) {
1358
+ var r = s[t];
1359
+ if (r === "*" || r === "+" || r === "?") {
1360
+ e.push({ type: "MODIFIER", index: t, value: s[t++] });
1361
+ continue;
1362
+ }
1363
+ if (r === "\\") {
1364
+ e.push({ type: "ESCAPED_CHAR", index: t++, value: s[t++] });
1365
+ continue;
1366
+ }
1367
+ if (r === "{") {
1368
+ e.push({ type: "OPEN", index: t, value: s[t++] });
1369
+ continue;
1370
+ }
1371
+ if (r === "}") {
1372
+ e.push({ type: "CLOSE", index: t, value: s[t++] });
1373
+ continue;
1374
+ }
1375
+ if (r === ":") {
1376
+ for (var n = "", i = t + 1; i < s.length; ) {
1377
+ var o = s.charCodeAt(i);
1378
+ if (
1379
+ // `0-9`
1380
+ o >= 48 && o <= 57 || // `A-Z`
1381
+ o >= 65 && o <= 90 || // `a-z`
1382
+ o >= 97 && o <= 122 || // `_`
1383
+ o === 95
1384
+ ) {
1385
+ n += s[i++];
1386
+ continue;
1387
+ }
1388
+ break;
1389
+ }
1390
+ if (!n)
1391
+ throw new TypeError("Missing parameter name at ".concat(t));
1392
+ e.push({ type: "NAME", index: t, value: n }), t = i;
1393
+ continue;
1394
+ }
1395
+ if (r === "(") {
1396
+ var a = 1, l = "", i = t + 1;
1397
+ if (s[i] === "?")
1398
+ throw new TypeError('Pattern cannot start with "?" at '.concat(i));
1399
+ for (; i < s.length; ) {
1400
+ if (s[i] === "\\") {
1401
+ l += s[i++] + s[i++];
1402
+ continue;
1403
+ }
1404
+ if (s[i] === ")") {
1405
+ if (a--, a === 0) {
1406
+ i++;
1407
+ break;
1408
+ }
1409
+ } else if (s[i] === "(" && (a++, s[i + 1] !== "?"))
1410
+ throw new TypeError("Capturing groups are not allowed at ".concat(i));
1411
+ l += s[i++];
1412
+ }
1413
+ if (a)
1414
+ throw new TypeError("Unbalanced pattern at ".concat(t));
1415
+ if (!l)
1416
+ throw new TypeError("Missing pattern at ".concat(t));
1417
+ e.push({ type: "PATTERN", index: t, value: l }), t = i;
1418
+ continue;
1419
+ }
1420
+ e.push({ type: "CHAR", index: t, value: s[t++] });
1421
+ }
1422
+ return e.push({ type: "END", index: t, value: "" }), e;
1423
+ }
1424
+ function $r(s, e) {
1425
+ e === void 0 && (e = {});
1426
+ for (var t = ws(s), r = e.prefixes, n = r === void 0 ? "./" : r, i = "[^".concat(Re(e.delimiter || "/#?"), "]+?"), o = [], a = 0, l = 0, u = "", f = function(E) {
1427
+ if (l < t.length && t[l].type === E)
1428
+ return t[l++].value;
1429
+ }, c = function(E) {
1430
+ var P = f(E);
1431
+ if (P !== void 0)
1432
+ return P;
1433
+ var C = t[l], k = C.type, M = C.index;
1434
+ throw new TypeError("Unexpected ".concat(k, " at ").concat(M, ", expected ").concat(E));
1435
+ }, h = function() {
1436
+ for (var E = "", P; P = f("CHAR") || f("ESCAPED_CHAR"); )
1437
+ E += P;
1438
+ return E;
1439
+ }; l < t.length; ) {
1440
+ var y = f("CHAR"), d = f("NAME"), m = f("PATTERN");
1441
+ if (d || m) {
1442
+ var p = y || "";
1443
+ n.indexOf(p) === -1 && (u += p, p = ""), u && (o.push(u), u = ""), o.push({
1444
+ name: d || a++,
1445
+ prefix: p,
1446
+ suffix: "",
1447
+ pattern: m || i,
1448
+ modifier: f("MODIFIER") || ""
1449
+ });
1450
+ continue;
1451
+ }
1452
+ var v = y || f("ESCAPED_CHAR");
1453
+ if (v) {
1454
+ u += v;
1455
+ continue;
1456
+ }
1457
+ u && (o.push(u), u = "");
1458
+ var g = f("OPEN");
1459
+ if (g) {
1460
+ var p = h(), _ = f("NAME") || "", b = f("PATTERN") || "", K = h();
1461
+ c("CLOSE"), o.push({
1462
+ name: _ || (b ? a++ : ""),
1463
+ pattern: _ && !b ? i : b,
1464
+ prefix: p,
1465
+ suffix: K,
1466
+ modifier: f("MODIFIER") || ""
1467
+ });
1468
+ continue;
1469
+ }
1470
+ c("END");
1471
+ }
1472
+ return o;
1473
+ }
1474
+ function bs(s, e) {
1475
+ return xs($r(s, e), e);
1476
+ }
1477
+ function xs(s, e) {
1478
+ e === void 0 && (e = {});
1479
+ var t = Vt(e), r = e.encode, n = r === void 0 ? function(l) {
1480
+ return l;
1481
+ } : r, i = e.validate, o = i === void 0 ? !0 : i, a = s.map(function(l) {
1482
+ if (typeof l == "object")
1483
+ return new RegExp("^(?:".concat(l.pattern, ")$"), t);
1484
+ });
1485
+ return function(l) {
1486
+ for (var u = "", f = 0; f < s.length; f++) {
1487
+ var c = s[f];
1488
+ if (typeof c == "string") {
1489
+ u += c;
1490
+ continue;
1491
+ }
1492
+ var h = l ? l[c.name] : void 0, y = c.modifier === "?" || c.modifier === "*", d = c.modifier === "*" || c.modifier === "+";
1493
+ if (Array.isArray(h)) {
1494
+ if (!d)
1495
+ throw new TypeError('Expected "'.concat(c.name, '" to not repeat, but got an array'));
1496
+ if (h.length === 0) {
1497
+ if (y)
1498
+ continue;
1499
+ throw new TypeError('Expected "'.concat(c.name, '" to not be empty'));
1500
+ }
1501
+ for (var m = 0; m < h.length; m++) {
1502
+ var p = n(h[m], c);
1503
+ if (o && !a[f].test(p))
1504
+ throw new TypeError('Expected all "'.concat(c.name, '" to match "').concat(c.pattern, '", but got "').concat(p, '"'));
1505
+ u += c.prefix + p + c.suffix;
1506
+ }
1507
+ continue;
1508
+ }
1509
+ if (typeof h == "string" || typeof h == "number") {
1510
+ var p = n(String(h), c);
1511
+ if (o && !a[f].test(p))
1512
+ throw new TypeError('Expected "'.concat(c.name, '" to match "').concat(c.pattern, '", but got "').concat(p, '"'));
1513
+ u += c.prefix + p + c.suffix;
1514
+ continue;
1515
+ }
1516
+ if (!y) {
1517
+ var v = d ? "an array" : "a string";
1518
+ throw new TypeError('Expected "'.concat(c.name, '" to be ').concat(v));
1519
+ }
1520
+ }
1521
+ return u;
1522
+ };
1523
+ }
1524
+ function Rs(s, e) {
1525
+ var t = [], r = Tr(s, t, e);
1526
+ return Ss(r, t, e);
1527
+ }
1528
+ function Ss(s, e, t) {
1529
+ t === void 0 && (t = {});
1530
+ var r = t.decode, n = r === void 0 ? function(i) {
1531
+ return i;
1532
+ } : r;
1533
+ return function(i) {
1534
+ var o = s.exec(i);
1535
+ if (!o)
1536
+ return !1;
1537
+ for (var a = o[0], l = o.index, u = /* @__PURE__ */ Object.create(null), f = function(h) {
1538
+ if (o[h] === void 0)
1539
+ return "continue";
1540
+ var y = e[h - 1];
1541
+ y.modifier === "*" || y.modifier === "+" ? u[y.name] = o[h].split(y.prefix + y.suffix).map(function(d) {
1542
+ return n(d, y);
1543
+ }) : u[y.name] = n(o[h], y);
1544
+ }, c = 1; c < o.length; c++)
1545
+ f(c);
1546
+ return { path: a, index: l, params: u };
1547
+ };
1548
+ }
1549
+ function Re(s) {
1550
+ return s.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
1551
+ }
1552
+ function Vt(s) {
1553
+ return s && s.sensitive ? "" : "i";
1554
+ }
1555
+ function Ps(s, e) {
1556
+ if (!e)
1557
+ return s;
1558
+ for (var t = /\((?:\?<(.*?)>)?(?!\?)/g, r = 0, n = t.exec(s.source); n; )
1559
+ e.push({
1560
+ // Use parenthesized substring match if available, index otherwise
1561
+ name: n[1] || r++,
1562
+ prefix: "",
1563
+ suffix: "",
1564
+ modifier: "",
1565
+ pattern: ""
1566
+ }), n = t.exec(s.source);
1567
+ return s;
1568
+ }
1569
+ function Cs(s, e, t) {
1570
+ var r = s.map(function(n) {
1571
+ return Tr(n, e, t).source;
1572
+ });
1573
+ return new RegExp("(?:".concat(r.join("|"), ")"), Vt(t));
1574
+ }
1575
+ function As(s, e, t) {
1576
+ return Es($r(s, t), e, t);
1577
+ }
1578
+ function Es(s, e, t) {
1579
+ t === void 0 && (t = {});
1580
+ for (var r = t.strict, n = r === void 0 ? !1 : r, i = t.start, o = i === void 0 ? !0 : i, a = t.end, l = a === void 0 ? !0 : a, u = t.encode, f = u === void 0 ? function(M) {
1581
+ return M;
1582
+ } : u, c = t.delimiter, h = c === void 0 ? "/#?" : c, y = t.endsWith, d = y === void 0 ? "" : y, m = "[".concat(Re(d), "]|$"), p = "[".concat(Re(h), "]"), v = o ? "^" : "", g = 0, _ = s; g < _.length; g++) {
1583
+ var b = _[g];
1584
+ if (typeof b == "string")
1585
+ v += Re(f(b));
1586
+ else {
1587
+ var K = Re(f(b.prefix)), E = Re(f(b.suffix));
1588
+ if (b.pattern)
1589
+ if (e && e.push(b), K || E)
1590
+ if (b.modifier === "+" || b.modifier === "*") {
1591
+ var P = b.modifier === "*" ? "?" : "";
1592
+ v += "(?:".concat(K, "((?:").concat(b.pattern, ")(?:").concat(E).concat(K, "(?:").concat(b.pattern, "))*)").concat(E, ")").concat(P);
1593
+ } else
1594
+ v += "(?:".concat(K, "(").concat(b.pattern, ")").concat(E, ")").concat(b.modifier);
1595
+ else
1596
+ b.modifier === "+" || b.modifier === "*" ? v += "((?:".concat(b.pattern, ")").concat(b.modifier, ")") : v += "(".concat(b.pattern, ")").concat(b.modifier);
1597
+ else
1598
+ v += "(?:".concat(K).concat(E, ")").concat(b.modifier);
1599
+ }
1600
+ }
1601
+ if (l)
1602
+ n || (v += "".concat(p, "?")), v += t.endsWith ? "(?=".concat(m, ")") : "$";
1603
+ else {
1604
+ var C = s[s.length - 1], k = typeof C == "string" ? p.indexOf(C[C.length - 1]) > -1 : C === void 0;
1605
+ n || (v += "(?:".concat(p, "(?=").concat(m, "))?")), k || (v += "(?=".concat(p, "|").concat(m, ")"));
1606
+ }
1607
+ return new RegExp(v, Vt(t));
1608
+ }
1609
+ function Tr(s, e, t) {
1610
+ return s instanceof RegExp ? Ps(s, e) : Array.isArray(s) ? Cs(s, e, t) : As(s, e, t);
1611
+ }
1612
+ var Ze = /* @__PURE__ */ ((s) => (s[s.Part = 0] = "Part", s[s.All = 1] = "All", s))(Ze || {});
1613
+ const J = Symbol("rootKey"), z = Symbol("rootNodeKey"), ye = Symbol("parentNodeKey"), et = Symbol("nameKey");
1614
+ class ne {
1615
+ /**
1616
+ * 实例
1617
+ */
1618
+ instance = null;
1619
+ /**
1620
+ * model
1621
+ */
1622
+ model;
1623
+ /**
1624
+ * route
1625
+ */
1626
+ route;
1627
+ /**
1628
+ * 是否激活状态
1629
+ */
1630
+ active = !0;
1631
+ /**
1632
+ * 索引
1633
+ */
1634
+ index = 0;
1635
+ /**
1636
+ * 构造函数
1637
+ * @param route
1638
+ * @param model
1639
+ * @param index
1640
+ * @param active
1641
+ */
1642
+ constructor(e, t, r = 0, n = !0) {
1643
+ this.route = e, this.model = t, this.index = r, this.active = n;
1644
+ }
1645
+ }
1646
+ class Ke {
1647
+ /**
1648
+ * model slots列表
1649
+ */
1650
+ _slots;
1651
+ /**
1652
+ * getter for models
1653
+ */
1654
+ get slots() {
1655
+ return this._slots == null && (this._slots = Gr([])), this._slots;
1656
+ }
1657
+ /**
1658
+ * 是否为空视图
1659
+ */
1660
+ get empty() {
1661
+ return this._slots == null || this._slots.value.length == 0;
1662
+ }
1663
+ /**
1664
+ * name
1665
+ */
1666
+ [et];
1667
+ /**
1668
+ * 是否分支根节点标志(true/false)
1669
+ */
1670
+ [J];
1671
+ /**
1672
+ * view的所在的root(最近一个)
1673
+ */
1674
+ [z] = null;
1675
+ /**
1676
+ * view的父亲记得引用(会在router的[sync]方法中建立关系)
1677
+ */
1678
+ [ye] = null;
1679
+ /**
1680
+ * 名称
1681
+ */
1682
+ get name() {
1683
+ return this[et];
1684
+ }
1685
+ /**
1686
+ * 构造函数
1687
+ * @param name
1688
+ * @param isRoot
1689
+ * @param rootNodeRef
1690
+ */
1691
+ constructor(e, t, r) {
1692
+ this[et] = e, this[J] = t, r && (this[z] = r);
1693
+ }
1694
+ }
1695
+ class U {
1696
+ /**
1697
+ * view
1698
+ */
1699
+ view;
1700
+ /**
1701
+ * 索引
1702
+ */
1703
+ index;
1704
+ /**
1705
+ * 层次
1706
+ */
1707
+ level;
1708
+ /**
1709
+ * 构造函数
1710
+ * @param view
1711
+ * @param index
1712
+ * @param level
1713
+ */
1714
+ constructor(e, t, r) {
1715
+ this.view = e, this.index = t, this.level = r;
1716
+ }
1717
+ /**
1718
+ * 判断是否在队列中
1719
+ * @param list
1720
+ * @param view
1721
+ */
1722
+ static include(e, t) {
1723
+ for (let r = 0; r < e.length; r++) {
1724
+ let n = e[r];
1725
+ if (n.view === t.view && (t.index == -1 || n.index === t.index) && n.level === t.level)
1726
+ return !0;
1727
+ }
1728
+ return !1;
1729
+ }
1730
+ }
1731
+ class gt {
1732
+ /**
1733
+ * 节点(view集合)
1734
+ */
1735
+ views = [];
1736
+ }
1737
+ class Fs {
1738
+ /**
1739
+ * 层
1740
+ */
1741
+ layers = [];
1742
+ }
1743
+ class _s {
1744
+ /**
1745
+ * time
1746
+ */
1747
+ time;
1748
+ /**
1749
+ * route
1750
+ */
1751
+ route;
1752
+ }
1753
+ class Ks {
1754
+ /**
1755
+ * 禁止重复提交时间间隔
1756
+ */
1757
+ forbidTime = 300;
1758
+ /**
1759
+ * 提交路由记录
1760
+ */
1761
+ submitRecorder = new _s();
1762
+ /**
1763
+ * 判断是否为同一个路由(只判断name、path和root是否一致)
1764
+ * @param x
1765
+ * @param y
1766
+ */
1767
+ isSameRoute(e, t) {
1768
+ return e == null || t == null ? !1 : e.name === t.name && e.path === t.path && e.root === t.root;
1769
+ }
1770
+ /**
1771
+ * 获取执行令牌
1772
+ * @param route
1773
+ * @returns
1774
+ */
1775
+ acquire(e) {
1776
+ let t = (/* @__PURE__ */ new Date()).getTime();
1777
+ if (this.isSameRoute(e, this.submitRecorder.route) && this.submitRecorder.time && t - this.submitRecorder.time <= this.forbidTime) {
1778
+ this.submitRecorder.time = t;
1779
+ return;
1780
+ }
1781
+ return this.submitRecorder.route = e, this.submitRecorder.time = t, t;
1782
+ }
1783
+ /**
1784
+ * 释放
1785
+ * @param time
1786
+ */
1787
+ release(e) {
1788
+ this.submitRecorder.time === e && (this.submitRecorder.route = void 0);
1789
+ }
1790
+ }
1791
+ const Se = Symbol("_notifyChange");
1792
+ class ir {
1793
+ //当前路由
1794
+ currentRoute;
1795
+ //当前页面的路由集合
1796
+ routes;
1797
+ /**
1798
+ * 构造函数
1799
+ * @param currentRoute
1800
+ * @param routes
1801
+ */
1802
+ constructor(e, t) {
1803
+ this.currentRoute = e, this.routes = t;
1804
+ }
1805
+ }
1806
+ const ue = Symbol("historyChangeConsumerKey"), or = Symbol("_navigateFirstRoute"), Ve = Symbol("_getRouteMark"), wt = Symbol("_getUrlSearch"), bt = Symbol("_generateLocation"), Be = Symbol("_setRouteMarkRecorder"), $e = Symbol("beforeRestoreFiltersKey"), lr = Symbol("_beforeRestore"), ar = "Symbol(_fox_restore_point)";
1807
+ function Te(s, ...e) {
1808
+ return typeof s == "function" ? Reflect.apply(s, null, [...e]) : s;
1809
+ }
1810
+ function ur(s) {
1811
+ if (!Array.isArray(s))
1812
+ return !1;
1813
+ if (s.length === 0)
1814
+ return !0;
1815
+ const e = s[0];
1816
+ return !!(Reflect.has(e, "path") && Reflect.has(e, "root"));
1817
+ }
1818
+ class qr {
1819
+ /**
1820
+ * 基础路径
1821
+ */
1822
+ base;
1823
+ /**
1824
+ * storage
1825
+ */
1826
+ storage;
1827
+ /**
1828
+ * 路由模式
1829
+ */
1830
+ mode;
1831
+ /**
1832
+ * 基础查询
1833
+ */
1834
+ query;
1835
+ /**
1836
+ * 初始导航
1837
+ */
1838
+ firstNavigate = !0;
1839
+ /**
1840
+ * monitor(是否检测history的变化)
1841
+ */
1842
+ historyMonitor;
1843
+ /**
1844
+ * 无痕迹模式
1845
+ */
1846
+ traceless = !1;
1847
+ /**
1848
+ * change handle
1849
+ */
1850
+ changeHandler;
1851
+ /**
1852
+ * 历史改变监听器
1853
+ */
1854
+ historyChange;
1855
+ /**
1856
+ * history change消费者标志
1857
+ */
1858
+ [ue] = !1;
1859
+ /**
1860
+ * before restore 过滤器队列(用于刷新还原)
1861
+ */
1862
+ [$e] = new Array();
1863
+ /**
1864
+ * 回退timeout
1865
+ */
1866
+ backTimeout = 320;
1867
+ /**
1868
+ * 构造函数
1869
+ * @param mode
1870
+ * @param base
1871
+ * @param query
1872
+ * @param firstNavigate
1873
+ * @param historyMonitor
1874
+ * @param traceless
1875
+ * @param storage
1876
+ * @param backTimeout
1877
+ */
1878
+ constructor(e = "hash", t = "", r = "", n = !0, i = !0, o = !1, a, l) {
1879
+ this.mode = e, this.base = t, this.query = r, this.firstNavigate = n, this.historyMonitor = i, this.traceless = o, this.storage = a ?? $().sessionStorage, this.backTimeout = l ?? 320;
1880
+ }
1881
+ /**
1882
+ * 初始化
1883
+ * @param firstNavigate
1884
+ * @returns
1885
+ */
1886
+ init(e = !0) {
1887
+ const t = $();
1888
+ return typeof this.historyChange != "function" && (this.historyChange = () => {
1889
+ if (typeof this[ue] == "function") {
1890
+ const r = this[ue]();
1891
+ if (this[ue] = !1, r)
1892
+ return;
1893
+ } else if (this[ue] === !0) {
1894
+ this[ue] = !1;
1895
+ return;
1896
+ }
1897
+ if (Te(this.historyMonitor)) {
1898
+ const r = t.history.state;
1899
+ this[Se](r);
1900
+ try {
1901
+ let n = [];
1902
+ if (typeof r == "string" ? n = JSON.parse(r) : n = r, Array.isArray(n) && n.length > 0) {
1903
+ const i = this[Ve]() ?? "/";
1904
+ this[Be](i, n);
1905
+ }
1906
+ } catch {
1907
+ }
1908
+ }
1909
+ }), Tt(t, "popstate", this.historyChange), this.firstNavigate && e && this[or](), Promise.resolve();
1910
+ }
1911
+ /**
1912
+ * 销毁
1913
+ */
1914
+ destroy() {
1915
+ if (this.historyChange) {
1916
+ const e = $();
1917
+ qt(e, "popstate", this.historyChange);
1918
+ }
1919
+ }
1920
+ /**
1921
+ * 执行before restore事件
1922
+ * @param route
1923
+ * @param index
1924
+ * @param mark
1925
+ * @param routes
1926
+ */
1927
+ [lr](e, t, r, n) {
1928
+ for (let i of this[$e])
1929
+ try {
1930
+ const o = Reflect.apply(i, {}, [e, t, r, n]);
1931
+ if (o === !1)
1932
+ return o;
1933
+ } catch (o) {
1934
+ console.error(o.message, o);
1935
+ }
1936
+ return !0;
1937
+ }
1938
+ /**
1939
+ * 添加before restore filter
1940
+ * @param filter
1941
+ */
1942
+ beforeRestoreEach(e) {
1943
+ this[$e].push(e);
1944
+ }
1945
+ /**
1946
+ * 移除before restore filter
1947
+ * @param filter
1948
+ * @returns
1949
+ */
1950
+ removeBeforeRestoreEach(e) {
1951
+ const t = this[$e].indexOf(e);
1952
+ return t !== -1 ? (this[$e].splice(t, 1), !0) : !1;
1953
+ }
1954
+ /**
1955
+ * 导航到第一个route
1956
+ */
1957
+ [or]() {
1958
+ const e = this[Ve]() ?? "/", t = this.storage.getItem(ar);
1959
+ if (t)
1960
+ try {
1961
+ const o = JSON.parse(t);
1962
+ if (o.mark === e && Array.isArray(o.routes) && o.routes.length > 0) {
1963
+ const a = o.routes.filter((l, u) => (l.params = l.params ? Sr(l.params) : {}, this[lr](l, u, e, o.routes)));
1964
+ if (a.length > 0) {
1965
+ const l = this[wt](), u = a.length - 1;
1966
+ a[u].query = l || a[u].query, this[Se](a);
1967
+ return;
1968
+ }
1969
+ }
1970
+ } catch {
1971
+ }
1972
+ const r = e.indexOf("!");
1973
+ let n;
1974
+ r != -1 ? n = e.substring(r + 1) : n = e;
1975
+ const i = new S();
1976
+ i.path = n, i.query = this[wt](), this[Se]([i]);
1977
+ }
1978
+ /**
1979
+ * 设置当前route mark的记录
1980
+ * @param mark
1981
+ * @param routes
1982
+ */
1983
+ [Be](e, t) {
1984
+ try {
1985
+ t.forEach((i) => {
1986
+ i.params = i.params ? Rr(i.params) : {};
1987
+ });
1988
+ const n = JSON.stringify({
1989
+ mark: e,
1990
+ routes: t
1991
+ });
1992
+ this.storage.setItem(ar, n);
1993
+ } catch (r) {
1994
+ console.error(r.message, r);
1995
+ }
1996
+ }
1997
+ /**
1998
+ * 设置还原点
1999
+ *
2000
+ * @param routes 路由记录
2001
+ */
2002
+ setRestorePoint(e) {
2003
+ const t = this[Ve]() ?? "/";
2004
+ this[Be](t, e);
2005
+ }
2006
+ /**
2007
+ * 通知修改
2008
+ */
2009
+ [Se](e) {
2010
+ typeof this.changeHandler == "function" && this.changeHandler(e);
2011
+ }
2012
+ /**
2013
+ * 获取当前标志
2014
+ */
2015
+ [Ve]() {
2016
+ const e = $();
2017
+ if (this.mode === "path") {
2018
+ let t = e.location.pathname;
2019
+ return this.base && t.indexOf(this.base) === 0 && (t = t.substring(this.base.length)), t;
2020
+ } else {
2021
+ const t = e.location.hash, r = t.indexOf("#");
2022
+ if (r != -1)
2023
+ return t.substring(r + 1);
2024
+ }
2025
+ return null;
2026
+ }
2027
+ /**
2028
+ * 获取当前search
2029
+ */
2030
+ [wt]() {
2031
+ let t = $().location.search;
2032
+ return t.length > 0 && t.indexOf("?") === 0 && (t = t.substring(1)), t;
2033
+ }
2034
+ /**
2035
+ * 监听历史记录改变
2036
+ * @param handler
2037
+ */
2038
+ listen(e) {
2039
+ this.changeHandler = e;
2040
+ }
2041
+ /**
2042
+ * 跳转
2043
+ * @param delta
2044
+ * @param consume
2045
+ */
2046
+ go(e, t = !1) {
2047
+ const r = $();
2048
+ this[ue] = t, r.history.go(e);
2049
+ }
2050
+ /**
2051
+ * 回退到指定路由
2052
+ * @param target
2053
+ * @param trigger
2054
+ */
2055
+ goBack(e, t) {
2056
+ const r = $(), n = r.history.state;
2057
+ if (ur(n) && n.length > 0) {
2058
+ let i = !1;
2059
+ for (let f = n.length - 1; f >= 0; f--) {
2060
+ const c = S.from(n[f]);
2061
+ if (!(c.historyUpdatePolicy === "traceless" || Te(this.traceless, c)) && S.isSame(c, e)) {
2062
+ i = !0;
2063
+ break;
2064
+ }
2065
+ }
2066
+ if (!i) {
2067
+ t();
2068
+ return;
2069
+ }
2070
+ const o = this.backTimeout;
2071
+ let a = null;
2072
+ const l = () => {
2073
+ r.history.go(-1), a = setTimeout(l, o);
2074
+ }, u = () => {
2075
+ clearTimeout(a);
2076
+ const c = $().history.state;
2077
+ if (ur(c) && c.length > 0) {
2078
+ let h = c.length;
2079
+ const y = c[h - 1], d = S.from(y);
2080
+ if (S.isSame(d, e))
2081
+ return t(), !0;
2082
+ if (h > 0) {
2083
+ let m = !1;
2084
+ for (let p = h - 1; p >= 0; p--) {
2085
+ const v = S.from(c[p]);
2086
+ if (!(v.traceless === !0 || Te(this.traceless, v)) && S.isSame(v, e)) {
2087
+ m = !0;
2088
+ break;
2089
+ }
2090
+ }
2091
+ return m ? (setTimeout(() => {
2092
+ a = setTimeout(l, o), this.go(-1, u);
2093
+ }, 0), !0) : (t(), !0);
2094
+ }
2095
+ }
2096
+ return t(), !0;
2097
+ };
2098
+ a = setTimeout(l, o), this.go(-1, u);
2099
+ } else
2100
+ t();
2101
+ }
2102
+ /**
2103
+ * 改变route标识
2104
+ * @param record
2105
+ */
2106
+ setRouteMark(e) {
2107
+ const t = e.currentRoute.fullPath;
2108
+ this[Be](t, e.routes);
2109
+ }
2110
+ /**
2111
+ * 加入记录
2112
+ * @param record
2113
+ */
2114
+ push(e) {
2115
+ const t = this[bt](e.currentRoute);
2116
+ e.currentRoute.historyUpdatePolicy !== "traceless" && !Te(this.traceless, e.currentRoute) && $().history.pushState(e.routes, "", t), this.setRouteMark(e);
2117
+ }
2118
+ /**
2119
+ * 替换当前记录
2120
+ * @param record
2121
+ */
2122
+ replace(e) {
2123
+ const t = this[bt](e.currentRoute);
2124
+ (e.currentRoute.historyUpdatePolicy !== "traceless" || !Te(this.traceless, e.currentRoute)) && $().history.replaceState(e.routes, "", t), this.setRouteMark(e);
2125
+ }
2126
+ /**
2127
+ * 生成Location
2128
+ * @param route
2129
+ */
2130
+ [bt](e) {
2131
+ const t = $();
2132
+ let r = "";
2133
+ if (e.query) {
2134
+ let a = "";
2135
+ if (typeof e.query == "object")
2136
+ for (let l of Reflect.ownKeys(e.query)) {
2137
+ let u = encodeURIComponent(e.query[l]), f = `${encodeURIComponent(String(l))}=${u}`;
2138
+ a.length > 0 && (a += "&"), a += f;
2139
+ }
2140
+ else
2141
+ a = e.query;
2142
+ this.query ? (r = a.length > 0 ? `${this.query}&${a}` : this.query, r.length > 0 && r.charAt(0) !== "?" && (r = `?${r}`)) : a.length > 0 && (r = `?${a}`);
2143
+ }
2144
+ const n = t.location;
2145
+ let i = e.alias ?? e.fullPath;
2146
+ i.startsWith(te) && (i = i.substring(te.length + 1));
2147
+ let o;
2148
+ return r ? this.mode == "path" ? i.indexOf("/") === 0 ? o = `${this.base}${i}${r}` : o = `${this.base}/${i}${r}` : o = `${n.pathname}${r}#${i}` : this.mode == "path" ? i.indexOf("/") === 0 ? o = `${this.base}${i}` : o = `${this.base}/${i}` : o = `${n.pathname}#${i}`, `${n.origin}${o}`;
2149
+ }
2150
+ }
2151
+ function xn(s = !0, e = null, t = "", r = !0, n = !1, i) {
2152
+ return e !== null && (e = $().location.pathname), e && e.endsWith("/") && (e = e.substring(0, e.length - 1)), new qr("path", e ?? "", t, s, r, n, i);
2153
+ }
2154
+ function $s(s = !0, e = "", t = !0, r = !1, n) {
2155
+ return new qr("hash", "", e, s, t, r, n);
2156
+ }
2157
+ class Ts {
2158
+ /**
2159
+ * 历史最大记录
2160
+ */
2161
+ maxSize = 50;
2162
+ /**
2163
+ * 历史记录游标
2164
+ */
2165
+ cursor = -1;
2166
+ /**
2167
+ * 历史记录
2168
+ */
2169
+ queue = [];
2170
+ /**
2171
+ * change handler
2172
+ */
2173
+ changeHandler;
2174
+ /**
2175
+ * 基础路径
2176
+ */
2177
+ base;
2178
+ /**
2179
+ * 是否监听history change
2180
+ */
2181
+ historyMonitor = !1;
2182
+ /**
2183
+ * 是否支持无痕模式
2184
+ */
2185
+ traceless = !1;
2186
+ /**
2187
+ * 构造函数
2188
+ * @param base
2189
+ * @param maxSize
2190
+ */
2191
+ constructor(e, t = 50) {
2192
+ this.base = e, this.maxSize = t;
2193
+ }
2194
+ /**
2195
+ * 初始化
2196
+ * @param firstNavigate
2197
+ * @returns
2198
+ */
2199
+ init(e = !0) {
2200
+ return Promise.resolve();
2201
+ }
2202
+ /**
2203
+ * 销毁
2204
+ */
2205
+ destroy() {
2206
+ this.queue = [];
2207
+ }
2208
+ /**
2209
+ * 添加before restore filter
2210
+ * @param filter
2211
+ */
2212
+ beforeRestoreEach(e) {
2213
+ }
2214
+ /**
2215
+ * 移除before restore filter
2216
+ * @param filter
2217
+ * @returns
2218
+ */
2219
+ removeBeforeRestoreEach(e) {
2220
+ return !1;
2221
+ }
2222
+ /**
2223
+ * 监听历史记录改变
2224
+ * @param handler
2225
+ */
2226
+ listen(e) {
2227
+ this.changeHandler = e;
2228
+ }
2229
+ /**
2230
+ * 通知修改
2231
+ */
2232
+ [Se](e) {
2233
+ typeof this.changeHandler == "function" && this.changeHandler(e);
2234
+ }
2235
+ /**
2236
+ * 跳转
2237
+ * @param delta
2238
+ * @param consume 是否消费事件
2239
+ */
2240
+ go(e, t = !1) {
2241
+ if (this.queue.length == 0 || this.cursor <= 0)
2242
+ return;
2243
+ let r = this.cursor + e;
2244
+ if (r < 0 ? r = 0 : r > this.queue.length - 1 && (r = this.queue.length - 1), r != this.cursor) {
2245
+ this.cursor = r;
2246
+ let n = !1;
2247
+ if (typeof t == "function" ? n = t() : n = t, !n) {
2248
+ const i = this.queue[r];
2249
+ this[Se](i.routes);
2250
+ }
2251
+ }
2252
+ }
2253
+ /**
2254
+ * 回退到指定路由
2255
+ * @param target
2256
+ * @param trigger
2257
+ */
2258
+ goBack(e, t) {
2259
+ if (this.queue.length == 0 || this.cursor <= 0)
2260
+ return;
2261
+ let r = 0;
2262
+ if (e === null)
2263
+ r = this.cursor + 1;
2264
+ else
2265
+ for (let n = this.cursor; n >= 0; n--) {
2266
+ const i = this.queue[n];
2267
+ if (S.isSame(i.currentRoute, e))
2268
+ break;
2269
+ r++;
2270
+ }
2271
+ if (r === 0) {
2272
+ t();
2273
+ return;
2274
+ }
2275
+ this.go(-r, () => (t(), !0));
2276
+ }
2277
+ /**
2278
+ * 改变route标识
2279
+ * @param record
2280
+ */
2281
+ setRouteMark(e) {
2282
+ }
2283
+ /**
2284
+ * 加入记录
2285
+ * @param record
2286
+ */
2287
+ push(e) {
2288
+ this.queue.length >= this.maxSize && this.queue.splice(0, 1), this.queue.push(e), this.cursor = this.queue.length - 1;
2289
+ }
2290
+ /**
2291
+ * 替换当前记录
2292
+ * @param record
2293
+ */
2294
+ replace(e) {
2295
+ let t = this.queue.length - this.cursor;
2296
+ this.queue.splice(this.cursor, t), this.queue[this.cursor] = e;
2297
+ }
2298
+ /**
2299
+ * 设置还原点
2300
+ *
2301
+ * @param routes 路由记录
2302
+ */
2303
+ setRestorePoint(e) {
2304
+ }
2305
+ }
2306
+ function qs(s = "", e = 50) {
2307
+ return new Ts(s, e);
2308
+ }
2309
+ const ke = Symbol("_constructRouteModel"), We = Symbol("_findRouteModel"), xt = Symbol("_findRootView"), fr = Symbol("_getFirstView"), fe = Symbol("_removeView"), cr = Symbol("_buildPage"), hr = Symbol("_resolveComponent"), yr = Symbol("_update"), ie = Symbol("_merge"), Rt = Symbol("_handleHistoryChange"), ze = Symbol("_handleRouteUpdated"), Je = Symbol("routeUpdatedCallback"), w = Symbol("currentRoutes"), ge = Symbol("current"), dr = Symbol("_addRouteRecorder"), qe = Symbol("_removeRouteRecorder"), Ge = Symbol("_cloneRouteRecorder"), j = Symbol("_handleError"), Qe = Symbol("errorCallback"), V = Symbol("registerKey"), Xe = Symbol("notFoundKey"), St = Symbol("notFoundPathKey"), B = Symbol("forestKey"), A = Symbol("historyKey"), je = Symbol("beforeFiltersKey"), Le = Symbol("afterFiltersKey"), Oe = Symbol("destroyFiltersKey"), Pt = Symbol("propsFilterKey"), we = Symbol("mainDispatcherKey"), Ct = Symbol("initKey"), ce = Symbol("readyKey"), At = Symbol("readyHandlersKey"), Ye = Symbol("_markReady"), pr = Symbol("_createNextFn"), Et = Symbol("_start"), Ft = Symbol("_before"), _t = Symbol("_after"), mr = Symbol("_destroy"), Kt = Symbol("_load"), Me = Symbol("_unload"), Ie = Symbol("routerGuardKey");
2310
+ function js(s) {
2311
+ return s.layers.length == 0 || s.layers[0].views.length == 0;
2312
+ }
2313
+ function Ls(s) {
2314
+ let e = [];
2315
+ return s.layers.forEach((t) => {
2316
+ t.models == null || t.models == null || t.models.forEach((r) => {
2317
+ if (!(r == null || r == null))
2318
+ if (typeof r.meta == "object") {
2319
+ let n = T(!0, {}, r.meta);
2320
+ e.push(n);
2321
+ } else
2322
+ r.meta && e.push(r.meta);
2323
+ });
2324
+ }), e;
2325
+ }
2326
+ class Os {
2327
+ /**
2328
+ * 注册表
2329
+ */
2330
+ [V] = new Array();
2331
+ /**
2332
+ * not found route
2333
+ */
2334
+ [Xe];
2335
+ /**
2336
+ * not found route path
2337
+ */
2338
+ [St] = "*";
2339
+ /**
2340
+ * ready
2341
+ */
2342
+ [ce] = !1;
2343
+ /**
2344
+ * ready handlers
2345
+ */
2346
+ [At] = [];
2347
+ /**
2348
+ * 页面根节点
2349
+ */
2350
+ [B] = new Fs();
2351
+ /**
2352
+ * 历史记录控制器
2353
+ */
2354
+ [A];
2355
+ /**
2356
+ * 当前路由集合
2357
+ */
2358
+ [w] = new Array();
2359
+ /**
2360
+ * 错误回调
2361
+ */
2362
+ [Qe] = null;
2363
+ /**
2364
+ * 全局route更新监听器
2365
+ */
2366
+ [Je] = null;
2367
+ /**
2368
+ * before过滤器队列
2369
+ */
2370
+ [je] = new Array();
2371
+ /**
2372
+ * after过滤器队列
2373
+ */
2374
+ [Le] = new Array();
2375
+ /**
2376
+ * destroy过滤器队列
2377
+ */
2378
+ [Oe] = new Array();
2379
+ /**
2380
+ * 属性传递过滤器
2381
+ */
2382
+ [Pt] = null;
2383
+ /**
2384
+ * 主任务分发器
2385
+ */
2386
+ [we] = new st();
2387
+ /**
2388
+ * 路由守护者
2389
+ */
2390
+ [Ie] = new Ks();
2391
+ /**
2392
+ * 是否初始化
2393
+ */
2394
+ [Ct] = !1;
2395
+ /**
2396
+ * 当前最新路由
2397
+ */
2398
+ [ge] = gr(null);
2399
+ /**
2400
+ * 获取当前最新route
2401
+ */
2402
+ get current() {
2403
+ return this[ge].value;
2404
+ }
2405
+ //属性
2406
+ options;
2407
+ /**
2408
+ * 构造函数
2409
+ * @param options
2410
+ */
2411
+ constructor(e) {
2412
+ this.options = e ?? {}, this.options.notFoundPath && this.setNotFoundPath(this.options.notFoundPath);
2413
+ let t = this.options.routes || [];
2414
+ this.addRoutes(t), this.options.notFound && this.setNotFoundRoute(this.options.notFound), e.history ? this[A] = e.history : this[A] = Ce ? $s() : qs(), this[A]?.listen(async (r) => {
2415
+ let n = !0;
2416
+ try {
2417
+ if (typeof r == "string") {
2418
+ const i = this[H](r);
2419
+ i && await this[Rt]([i]);
2420
+ } else
2421
+ await this[Rt](r);
2422
+ } catch (i) {
2423
+ console.error(i.message, i), n = !1;
2424
+ }
2425
+ this[ce] === !1 && this[Ye](n);
2426
+ });
2427
+ }
2428
+ /**
2429
+ * 记录错误日志
2430
+ * @param error
2431
+ * @param route
2432
+ */
2433
+ [j](e = "error", t) {
2434
+ if (t && typeof t.error == "function")
2435
+ try {
2436
+ t.error(e);
2437
+ } catch {
2438
+ }
2439
+ if (typeof this[Qe] == "function")
2440
+ try {
2441
+ this[Qe](e, t);
2442
+ } catch {
2443
+ }
2444
+ console.error(e);
2445
+ }
2446
+ /**
2447
+ * 初始化
2448
+ */
2449
+ init() {
2450
+ this[Ct] !== !0 && (this[A]?.init(!this[ce]), this[Ct] = !0);
2451
+ }
2452
+ /**
2453
+ * 第一次导航是否完成
2454
+ */
2455
+ isReady() {
2456
+ return this[ce] ? Promise.resolve() : new Promise((e, t) => {
2457
+ this[At].push([e, t]);
2458
+ });
2459
+ }
2460
+ /**
2461
+ * 设置第一导航完成
2462
+ */
2463
+ [Ye](e) {
2464
+ this[ce] = !0, this[At].forEach(([t, r]) => {
2465
+ try {
2466
+ e ? t() : r();
2467
+ } catch (n) {
2468
+ console.error(n.message, n);
2469
+ }
2470
+ });
2471
+ }
2472
+ /**
2473
+ * 处理历史记录
2474
+ * @param record
2475
+ */
2476
+ [Rt](e) {
2477
+ try {
2478
+ if (!e) {
2479
+ let o = [...this[w]].reverse();
2480
+ return this[Me](o), Ce && $().location.reload(), Promise.resolve();
2481
+ }
2482
+ let t = null, r = [], n = [], i = 0;
2483
+ for (; i < e.length && i < this[w].length && S.isSame(e[i], this[w][i]); i++)
2484
+ e[i].active === !0 && e[i].active !== this[w][i].active && (t = e[i]);
2485
+ if (i < e.length && (r = e.slice(i)), i < this[w].length && (n = this[w].slice(i).reverse()), n.length === 0 && r.length === 0) {
2486
+ if (t !== null)
2487
+ return this.restore([t]);
2488
+ } else if (n.length > 0) {
2489
+ if (this[Me](n)) {
2490
+ if (r.length > 0)
2491
+ return this.restore(r);
2492
+ if (t !== null)
2493
+ return this.restore([t]);
2494
+ }
2495
+ } else
2496
+ return this.restore(r);
2497
+ } catch (t) {
2498
+ this[j](t);
2499
+ }
2500
+ return Promise.resolve();
2501
+ }
2502
+ /**
2503
+ * 处理route updated事件
2504
+ * @param route
2505
+ */
2506
+ [ze](e) {
2507
+ if (e)
2508
+ this[ge].value = e;
2509
+ else {
2510
+ let t = this[w].length;
2511
+ t > 0 ? this[ge].value = this[w][t - 1] : this[ge].value = null;
2512
+ }
2513
+ if (typeof this[Je] == "function")
2514
+ try {
2515
+ this[Je](this[ge].value);
2516
+ } catch {
2517
+ }
2518
+ }
2519
+ /**
2520
+ * 加入路由记录
2521
+ * @param route
2522
+ */
2523
+ [dr](e) {
2524
+ if (e.opsType === q.Open) {
2525
+ let t = !1;
2526
+ const r = this[w].length - 1;
2527
+ for (let n = r; n >= 0; n--) {
2528
+ const i = this[w][n];
2529
+ if (e.root == i.root) {
2530
+ if (e.path === i.path) {
2531
+ this[w].splice(n, 1, e), t = !0;
2532
+ continue;
2533
+ }
2534
+ e.active && (i.active = !1);
2535
+ }
2536
+ }
2537
+ t || this[w].push(e);
2538
+ } else
2539
+ this[w].push(e);
2540
+ }
2541
+ /**
2542
+ * 克隆路由记录
2543
+ * @returns
2544
+ */
2545
+ [Ge]() {
2546
+ let e = [];
2547
+ for (let t of this[w]) {
2548
+ let r = S.clone(t, !0);
2549
+ e.push(r);
2550
+ }
2551
+ return e;
2552
+ }
2553
+ /**
2554
+ * 移除路由记录
2555
+ *
2556
+ * @param route
2557
+ */
2558
+ [qe](e) {
2559
+ if (!this[w])
2560
+ return;
2561
+ let t = -1;
2562
+ for (let r = 0; r < this[w].length; r++)
2563
+ if (S.isSame(this[w][r], e)) {
2564
+ t = r;
2565
+ break;
2566
+ }
2567
+ if (t != -1) {
2568
+ let r = this[w][t];
2569
+ this[w].splice(t, 1), this[mr](r, r.session);
2570
+ }
2571
+ }
2572
+ /**
2573
+ * 设置history monitor是否启动
2574
+ */
2575
+ set historyMonitor(e) {
2576
+ this[A] && (this[A].historyMonitor = e);
2577
+ }
2578
+ /**
2579
+ * 获取history monitor
2580
+ */
2581
+ get historyMonitor() {
2582
+ return this[A] ? this[A].historyMonitor : !1;
2583
+ }
2584
+ /**
2585
+ * 设置无痕模式,不改变历史记录
2586
+ */
2587
+ set traceless(e) {
2588
+ this[A] && (this[A].traceless = e);
2589
+ }
2590
+ /**
2591
+ * 获取无痕模式(不改变历史记录)
2592
+ */
2593
+ get traceless() {
2594
+ return this[A] ? this[A].traceless : !1;
2595
+ }
2596
+ /**
2597
+ * 设置属性传递过滤器
2598
+ */
2599
+ set propsFilter(e) {
2600
+ this[Pt] = e;
2601
+ }
2602
+ /**
2603
+ * 获取属性传递过滤器
2604
+ */
2605
+ get propsFilter() {
2606
+ return this[Pt];
2607
+ }
2608
+ /**
2609
+ * 设置还原点
2610
+ *
2611
+ */
2612
+ setRestorePoint() {
2613
+ const e = this[Ge]();
2614
+ this[A]?.setRestorePoint(e);
2615
+ }
2616
+ /**
2617
+ * 注册route updated处理函数
2618
+ * @param callback
2619
+ */
2620
+ onRouteUpdated(e) {
2621
+ this[Je] = e;
2622
+ }
2623
+ /**
2624
+ * 注册全局异常处理函数
2625
+ * @param callback
2626
+ */
2627
+ onError(e) {
2628
+ this[Qe] = e;
2629
+ }
2630
+ /**
2631
+ * 添加before filter
2632
+ * @param filter
2633
+ */
2634
+ beforeEach(e) {
2635
+ this[je].push(e);
2636
+ }
2637
+ /**
2638
+ * 移除before filter
2639
+ * @param filter
2640
+ */
2641
+ removeBeforeEach(e) {
2642
+ const t = this[je].indexOf(e);
2643
+ return t !== -1 ? (this[je].splice(t, 1), !0) : !1;
2644
+ }
2645
+ /**
2646
+ * 添加after filter
2647
+ * @param filter
2648
+ */
2649
+ afterEach(e) {
2650
+ this[Le].push(e);
2651
+ }
2652
+ /**
2653
+ * 移除after filter
2654
+ * @param filter
2655
+ * @returns
2656
+ */
2657
+ removeAfterEach(e) {
2658
+ const t = this[Le].indexOf(e);
2659
+ return t !== -1 ? (this[Le].splice(t, 1), !0) : !1;
2660
+ }
2661
+ /**
2662
+ * 添加destroy filter
2663
+ * @param filter
2664
+ */
2665
+ destroyEach(e) {
2666
+ this[Oe].push(e);
2667
+ }
2668
+ /**
2669
+ * 移除after filter
2670
+ * @param filter
2671
+ * @returns
2672
+ */
2673
+ removeDestroyEach(e) {
2674
+ const t = this[Oe].indexOf(e);
2675
+ return t !== -1 ? (this[Oe].splice(t, 1), !0) : !1;
2676
+ }
2677
+ /**
2678
+ * 添加before restore filter
2679
+ * @param filter
2680
+ */
2681
+ beforeRestoreEach(e) {
2682
+ this[A]?.beforeRestoreEach(e);
2683
+ }
2684
+ /**
2685
+ * 移除before restore filter
2686
+ * @param filter
2687
+ * @returns
2688
+ */
2689
+ removeBeforeRestoreEach(e) {
2690
+ return this[A]?.removeBeforeRestoreEach(e) ?? !1;
2691
+ }
2692
+ /**
2693
+ * 加入路由配置列表
2694
+ * @param routeConfigs
2695
+ */
2696
+ addRoutes(e) {
2697
+ for (let t of e)
2698
+ this.addRoute(t);
2699
+ }
2700
+ /**
2701
+ * 加入路由配置
2702
+ * @param routeConfig
2703
+ * @param index
2704
+ */
2705
+ addRoute(e, t = -1) {
2706
+ if (e.path === this[St]) {
2707
+ this.setNotFoundRoute(e);
2708
+ return;
2709
+ }
2710
+ const r = this[ke](e);
2711
+ if (t == -1)
2712
+ this[V] = [...this[V], ...r];
2713
+ else
2714
+ for (let n = r.length - 1; n >= 0; n--)
2715
+ this[V].splice(t, 0, r[n]);
2716
+ }
2717
+ /**
2718
+ * 移除路由
2719
+ *
2720
+ * @param route
2721
+ */
2722
+ removeRoute(e) {
2723
+ const t = this[H](e);
2724
+ if (t === null)
2725
+ return console.warn("route格式错误", e), !1;
2726
+ for (let r = 0; r < this[V].length; r++) {
2727
+ const n = this[V][r];
2728
+ if (t?.path && n.path === t.path)
2729
+ return this[V].splice(r, 1), !0;
2730
+ if (t?.name && n.name === t.name)
2731
+ return this[V].splice(r, 1), !0;
2732
+ }
2733
+ return !1;
2734
+ }
2735
+ /**
2736
+ * 判断路由是否存在
2737
+ *
2738
+ * @param route
2739
+ */
2740
+ hasRoute(e) {
2741
+ const t = this[H](e);
2742
+ return t === null ? (console.warn("route格式错误", e), !1) : this[V].findIndex((n) => {
2743
+ if (t?.path && n.path === t.path || t?.name && n.name === t.name)
2744
+ return !0;
2745
+ }) !== -1;
2746
+ }
2747
+ /**
2748
+ * 配置not found路由路径
2749
+ * @param path
2750
+ */
2751
+ setNotFoundPath(e) {
2752
+ this[St] = e;
2753
+ }
2754
+ /**
2755
+ * 配置not found路由配置
2756
+ * @param routeConfig
2757
+ */
2758
+ setNotFoundRoute(e) {
2759
+ const t = this[ke](e);
2760
+ this[Xe] = t[0];
2761
+ }
2762
+ /**
2763
+ * 返回目前加载的routes
2764
+ */
2765
+ getRoutes() {
2766
+ return [...this[V]];
2767
+ }
2768
+ /**
2769
+ * 根据路由构建route model
2770
+ *
2771
+ * @param routeConfig
2772
+ */
2773
+ [ke](e) {
2774
+ let t = e.path ?? "";
2775
+ t.length > 0 && t.charAt(0) !== "/" && (t = `/${t}`);
2776
+ let r = e.components ?? (e.component && { "": e.component });
2777
+ if (r == null) {
2778
+ const a = new yt();
2779
+ return a.path = t, a.redirect = e.redirect, [a];
2780
+ }
2781
+ let n = [];
2782
+ for (let a in r) {
2783
+ let l = r[a];
2784
+ a.length === 0 && (a = te);
2785
+ let u = new hs(a, l, e.props, e.meta);
2786
+ n.push(u);
2787
+ }
2788
+ let i = !1, o = [];
2789
+ if (e.children)
2790
+ for (let a of e.children) {
2791
+ let l = this[ke](a);
2792
+ for (let u of l) {
2793
+ let f = new yt();
2794
+ f.name = u.name, u.path && u.path.length > 0 ? t !== "/" ? f.path = `${t}${u.path}` : f.path = u.path : (i = !0, f.path = t);
2795
+ let c = new Yt();
2796
+ c.models = [...n], f.layers = [c, ...u.layers], o.push(f);
2797
+ }
2798
+ }
2799
+ if (!i) {
2800
+ const a = new Yt();
2801
+ a.models = n;
2802
+ const l = new yt();
2803
+ l.name = e.name, l.path = t, l.layers = [a], o.splice(0, 0, l);
2804
+ }
2805
+ return o;
2806
+ }
2807
+ /**
2808
+ * 查找route model
2809
+ * @param cite
2810
+ */
2811
+ [We](e) {
2812
+ const t = e.route;
2813
+ try {
2814
+ for (let r of this[V]) {
2815
+ const n = t.template ?? t.path, i = t.template ?? t.name;
2816
+ if (n && r.path) {
2817
+ let o = r.match;
2818
+ o || (o = r.match = Rs(r.path));
2819
+ const a = o(n);
2820
+ if (!a)
2821
+ continue;
2822
+ if (r.redirect) {
2823
+ const l = new S();
2824
+ T(!0, l, t), l.path = r.redirect;
2825
+ const u = {
2826
+ route: l,
2827
+ find: void 0
2828
+ };
2829
+ return this[We](u) ? (e.route = u.route, e.find = u.find, t.template && e.find && (e.find = { ...e.find }, e.find.path = t.path), !0) : !1;
2830
+ }
2831
+ if (t.params = t.params ?? {}, T(!0, t.params, a.params), t.query) {
2832
+ const l = t.query;
2833
+ if (typeof l == "string") {
2834
+ const u = {}, f = l.split("&");
2835
+ for (let c of f) {
2836
+ const h = c.split("=");
2837
+ if (h.length !== 2)
2838
+ continue;
2839
+ const y = decodeURIComponent(h[0].trim()), d = decodeURIComponent(h[1].trim());
2840
+ u[y] = d;
2841
+ }
2842
+ T(!0, t.params, u);
2843
+ } else
2844
+ typeof l == "object" && T(!0, t.params, l);
2845
+ }
2846
+ return e.find = r, t.template && e.find && (e.find = { ...e.find }, e.find.path = t.path), !0;
2847
+ } else if (i === r.name) {
2848
+ t.params = t.params ?? {};
2849
+ const o = bs(r.path);
2850
+ return t.path = o(t.params), e.find = r, t.template && e.find && (e.find = { ...e.find }, e.find.name = t.name), !0;
2851
+ }
2852
+ }
2853
+ } catch (r) {
2854
+ console.error(r.message, r), typeof t.error == "function" && t.error(r.message);
2855
+ }
2856
+ return !1;
2857
+ }
2858
+ /**
2859
+ * 解释路由
2860
+ * @param args
2861
+ * @returns
2862
+ */
2863
+ [H](e) {
2864
+ let t = null;
2865
+ if (Array.isArray(e))
2866
+ if (t = new S(), typeof e[0] == "object")
2867
+ t = S.from(e[0]);
2868
+ else
2869
+ for (let r = 0; r < e.length; r++)
2870
+ r === 0 ? e[r].charAt(0) === "/" ? t.path = e[r] : t.name = e[r] : r === 1 ? t.params = e[r] : r === 2 ? t.root = e[r] : r === 3 && T(!1, t, e[r]);
2871
+ else
2872
+ typeof e == "object" ? t = S.from(e) : typeof e == "string" && (t = new S(), e.charAt(0) == "/" ? t.path = e : t.name = e);
2873
+ if (t) {
2874
+ if (t.path) {
2875
+ let r = t.path.indexOf("?");
2876
+ r !== -1 && r < t.path.length - 1 && (t.query = t.path.substring(r + 1), t.path = t.path.substring(0, r));
2877
+ }
2878
+ t.root = t.root ?? te, t.opsType = t.opsType ?? this.options.defaultOperationType ?? q.Push, t.traceless && !t.historyUpdatePolicy && (t.historyUpdatePolicy = "traceless");
2879
+ }
2880
+ return t;
2881
+ }
2882
+ /**
2883
+ * 路由跳转(operation类型为Push)
2884
+ * @param args
2885
+ */
2886
+ push(...e) {
2887
+ const t = this[H](e);
2888
+ return t ? (t.opsType = q.Push, t.historyUpdatePolicy = t.historyUpdatePolicy ?? "push", this.to(t)) : (this[j]("resolve route fail", t), this);
2889
+ }
2890
+ /**
2891
+ * 路由跳转(operation类型为Put)
2892
+ * @param args
2893
+ */
2894
+ put(...e) {
2895
+ const t = this[H](e);
2896
+ return t ? (t.opsType = q.Put, t.historyUpdatePolicy = t.historyUpdatePolicy ?? "traceless", this.to(t)) : (this[j]("resolve route fail", t), this);
2897
+ }
2898
+ /**
2899
+ * 路由跳转(operation类型为Replace)
2900
+ * @param args
2901
+ */
2902
+ replace(...e) {
2903
+ const t = this[H](e);
2904
+ return t ? (t.opsType = q.Replace, t.historyUpdatePolicy = t.historyUpdatePolicy ?? "replace", this.to(t)) : (this[j]("resolve route fail", t), this);
2905
+ }
2906
+ /**
2907
+ * 路由跳转(operation类型为Append)
2908
+ * @param args
2909
+ */
2910
+ append(...e) {
2911
+ const t = this[H](e);
2912
+ return t ? (t.opsType = q.Append, t.historyUpdatePolicy = t.historyUpdatePolicy ?? "push", this.to(t)) : (this[j]("resolve route fail", t), this);
2913
+ }
2914
+ /**
2915
+ * 移除
2916
+ * @param term
2917
+ * @param changeHistory
2918
+ */
2919
+ remove(e, t) {
2920
+ return new Promise((r) => {
2921
+ this[we].post((n) => {
2922
+ try {
2923
+ if (this[w].length === 0) {
2924
+ n.resolve(), r(!1);
2925
+ return;
2926
+ }
2927
+ let i = -1, o, a = [];
2928
+ if (e) {
2929
+ if (e.root ? o = e.root : o = this[w][0].root ?? te, e.all)
2930
+ for (let u = this[w].length - 1; u > 0; u--) {
2931
+ let f = this[w][u];
2932
+ f.opsType === q.Append && f.root === o && (a.splice(0, 0, f), i = u - 1);
2933
+ }
2934
+ else if (e.until)
2935
+ for (let u = this[w].length - 1; u > 0; u--) {
2936
+ let f = this[w][u];
2937
+ if (f.opsType === q.Append && f.root === o) {
2938
+ if (e.until.charAt(0) === "/" && e.until === f.path) {
2939
+ i = u;
2940
+ break;
2941
+ } else if (e.until === f.name) {
2942
+ i = u;
2943
+ break;
2944
+ }
2945
+ a.splice(0, 0, f);
2946
+ }
2947
+ }
2948
+ } else {
2949
+ o = te;
2950
+ let u = this[fr](this[B]);
2951
+ u && (o = u.name);
2952
+ for (let f = this[w].length - 1; f > 0; f--) {
2953
+ let c = this[w][f];
2954
+ if (c.opsType === q.Append && c.root === o) {
2955
+ a.push(c), i = f - 1;
2956
+ break;
2957
+ }
2958
+ }
2959
+ }
2960
+ if (a.length === 0) {
2961
+ let u = "can not find route";
2962
+ console.warn(u), n.resolve(u), r(!1);
2963
+ return;
2964
+ }
2965
+ let l = null;
2966
+ if (i !== -1 && (l = this[w][i]), this[Me](a)) {
2967
+ if (t === !1)
2968
+ return n.resolve(), r(!0), !0;
2969
+ const u = () => (n.resolve(), r(!0), !0), f = this[w].length;
2970
+ if (l && S.isSame(l, this[w][f - 1])) {
2971
+ this[A]?.goBack(l, u);
2972
+ return;
2973
+ }
2974
+ u();
2975
+ }
2976
+ } catch (i) {
2977
+ this[j](i), n.resolve(), r(!1);
2978
+ }
2979
+ });
2980
+ });
2981
+ }
2982
+ /**
2983
+ * 路由跳转(operation类型为Open)
2984
+ * @param args
2985
+ */
2986
+ open(...e) {
2987
+ let t = this[H](e);
2988
+ return t ? (t.opsType = q.Open, t.historyUpdatePolicy = t.historyUpdatePolicy ?? "push", this.to(t)) : (this[j]("resolve route fail", t), this);
2989
+ }
2990
+ /**
2991
+ * 关闭路由跳转的页面
2992
+ * @param args
2993
+ */
2994
+ close(e) {
2995
+ return this[we].post((t) => {
2996
+ try {
2997
+ let r = this[H](e);
2998
+ if (!r) {
2999
+ t.reject("resolve route fail");
3000
+ return;
3001
+ }
3002
+ let n = [];
3003
+ for (let i = 0; i < this[w].length; i++) {
3004
+ let o = this[w][i];
3005
+ if (o.root === r.root) {
3006
+ if (!r.path && !r.name) {
3007
+ n.push(o);
3008
+ continue;
3009
+ }
3010
+ if (r.path && r.path === o.path) {
3011
+ n.push(o);
3012
+ break;
3013
+ } else if (r.name && r.name === o.name) {
3014
+ n.push(o);
3015
+ break;
3016
+ }
3017
+ }
3018
+ }
3019
+ if (n.length === 0) {
3020
+ t.resolve();
3021
+ return;
3022
+ }
3023
+ this[Me](n) && this[ze](), t.resolve();
3024
+ } catch (r) {
3025
+ this[j](r), t.resolve();
3026
+ }
3027
+ }), this;
3028
+ }
3029
+ /**
3030
+ * 路由跳转
3031
+ * @param args
3032
+ */
3033
+ to(...e) {
3034
+ let t = this[H](e);
3035
+ if (!t)
3036
+ return this[j]("resolve route fail", t), this;
3037
+ let r = this[Ie].acquire(t);
3038
+ return r == null ? (this[j]("route forbid", t), this) : (this[we].post((n) => {
3039
+ try {
3040
+ let i = this[Et](t);
3041
+ this[Ft](i), this[Kt](i), this[_t](i), i.wait(
3042
+ (o, a) => {
3043
+ const l = o.session.to;
3044
+ if (o.session.updateResult && o.session.updateResult.status === "success")
3045
+ try {
3046
+ let u = S.clone(l, !0);
3047
+ const f = new ir(u, this[Ge]());
3048
+ l.historyUpdatePolicy === "replace" ? this[A]?.replace(f) : l.historyUpdatePolicy === "traceless" ? this[A]?.setRouteMark(f) : this[A]?.push(f);
3049
+ } catch (u) {
3050
+ console.error(u.message, u);
3051
+ }
3052
+ if (this[Ie].release(r), this[ze](l), typeof t.success == "function")
3053
+ try {
3054
+ Reflect.apply(t.success, {}, []);
3055
+ } catch (u) {
3056
+ console.error(u.message, u);
3057
+ }
3058
+ this[ce] === !1 && this[Ye](!0), n.resolve();
3059
+ },
3060
+ (o, a) => {
3061
+ this[Ie].release(r), a !== null && this[j](a, t), this[ce] === !1 && this[Ye](!1), n.resolve();
3062
+ }
3063
+ );
3064
+ } catch (i) {
3065
+ this[Ie].release(r), this[j](i, t), n.resolve();
3066
+ }
3067
+ }), this);
3068
+ }
3069
+ /**
3070
+ * 历史回退
3071
+ * @param delta
3072
+ */
3073
+ back(e = 1) {
3074
+ this[A]?.go(-e, !1);
3075
+ }
3076
+ /**
3077
+ * 创建next函数
3078
+ */
3079
+ [pr](e) {
3080
+ return (t, r) => {
3081
+ if (typeof t == "boolean")
3082
+ e.session.redirect = !1, t ? e.resolve() : e.reject(r ?? null);
3083
+ else if (t) {
3084
+ const n = this[H](t);
3085
+ if (n) {
3086
+ const i = e.session.to;
3087
+ n.success = i.success, n.error = i.error, e.session.to = n, e.session.redirect = !0, e.session.routeModel = null, e.resolve();
3088
+ } else
3089
+ e.session.redirect = !1, e.reject("route resolve fail");
3090
+ } else
3091
+ e.session.redirect = !1, e.resolve();
3092
+ };
3093
+ }
3094
+ /**
3095
+ * 开始链路
3096
+ * @param route
3097
+ * @returns {EventChain}
3098
+ */
3099
+ [Et](e) {
3100
+ let t = this[w].length > 0 ? this[w][0] : void 0, r = new rt(e, t), n = {
3101
+ //路由
3102
+ route: e,
3103
+ //查找结果
3104
+ find: null
3105
+ };
3106
+ return this[We](n), n.find && (r.routeModel = n.find, e.matched = Ls(n.find), Array.isArray(e.matched) && e.matched.length > 0 && (e.meta = n.find.layers[0].models[0].meta)), new st(r);
3107
+ }
3108
+ /**
3109
+ * 执行before事件
3110
+ * @param chain
3111
+ */
3112
+ [Ft](e) {
3113
+ for (let t of this[je])
3114
+ e.post((r) => {
3115
+ const n = this[pr](r);
3116
+ Reflect.apply(t, {}, [r.session.to, r.session.from, n, r.session]);
3117
+ });
3118
+ }
3119
+ /**
3120
+ * 执行after事件
3121
+ * @param chain
3122
+ */
3123
+ [_t](e) {
3124
+ e.post((t) => {
3125
+ for (let r of this[Le])
3126
+ try {
3127
+ Reflect.apply(r, {}, [t.session.to, t.session.from, t.session]);
3128
+ } catch (n) {
3129
+ console.error(n.message, n);
3130
+ }
3131
+ t.resolve();
3132
+ });
3133
+ }
3134
+ /**
3135
+ * 执行销毁事件
3136
+ * @param route
3137
+ * @param session
3138
+ */
3139
+ [mr](e, t) {
3140
+ for (let r of this[Oe])
3141
+ try {
3142
+ Reflect.apply(r, {}, [e, t]);
3143
+ } catch (n) {
3144
+ console.error(n.message, n);
3145
+ }
3146
+ typeof e.destroy == "function" && Reflect.apply(e.destroy, e, []);
3147
+ }
3148
+ /**
3149
+ * 加载路由
3150
+ * @param chain
3151
+ */
3152
+ [Kt](e) {
3153
+ e.post((t) => {
3154
+ let r = t.session.to, n = t.session.routeModel;
3155
+ if (n == null) {
3156
+ let o = {
3157
+ //路由
3158
+ route: r,
3159
+ //查找结果
3160
+ find: null
3161
+ };
3162
+ if (this[We](o))
3163
+ n = o.find, t.session.routeModel = n;
3164
+ else if (this[Xe])
3165
+ n = this[Xe];
3166
+ else {
3167
+ t.reject(`not find route model, path:${r.path ?? r.name}`);
3168
+ return;
3169
+ }
3170
+ }
3171
+ let i = rt.from(t.session);
3172
+ this[cr](r, n, i).then(
3173
+ (o) => {
3174
+ this[B], t.session.updateResult = o ?? {
3175
+ status: "success",
3176
+ message: ""
3177
+ }, t.resolve();
3178
+ },
3179
+ (o) => {
3180
+ t.reject(o);
3181
+ }
3182
+ );
3183
+ });
3184
+ }
3185
+ /**
3186
+ * 卸载(只能用于卸载多视图上的view)
3187
+ *
3188
+ * @param routes
3189
+ */
3190
+ [Me](e) {
3191
+ if (e.length == 0)
3192
+ return !0;
3193
+ let t = this[B], r = [];
3194
+ for (let n of e) {
3195
+ let i = this[xt](t, n);
3196
+ i != null && r.push({
3197
+ ...i,
3198
+ route: n
3199
+ });
3200
+ }
3201
+ if (r.length == 0) {
3202
+ let n = "can not find view index";
3203
+ return this[j](n), !1;
3204
+ }
3205
+ for (let n of r.reverse())
3206
+ this[fe](t, { x: n.x, y: n.y }, [n.route.index ?? 0], !0);
3207
+ return !0;
3208
+ }
3209
+ /**
3210
+ * 查找root view索引
3211
+ * @param page
3212
+ * @param route
3213
+ */
3214
+ [xt](e, t) {
3215
+ const r = t.root ?? te;
3216
+ let n;
3217
+ for (let i = 0; i < e.layers.length; i++) {
3218
+ const o = e.layers[i];
3219
+ for (let a = o.views.length - 1; a >= 0; a--) {
3220
+ const l = o.views[a];
3221
+ if (l[J] && l[et] === r)
3222
+ return n = { x: a, y: i }, n;
3223
+ }
3224
+ }
3225
+ return null;
3226
+ }
3227
+ /**
3228
+ * 查找first view
3229
+ * @param page
3230
+ */
3231
+ [fr](e) {
3232
+ return e.layers.length > 0 && e.layers[0].views.length > 0 ? e.layers[0].views[0] : null;
3233
+ }
3234
+ /**
3235
+ * 移除view
3236
+ * @param page
3237
+ * @param pos
3238
+ * @param indexList
3239
+ * @param retainRoot
3240
+ */
3241
+ [fe](e, t, r = null, n = !0) {
3242
+ if (t.y >= e.layers.length || t.x >= e.layers[t.y].views.length)
3243
+ return;
3244
+ let i = e.layers[t.y].views[t.x], o = !1, a = [], l = !1, u = [...i.slots.value];
3245
+ for (let c = u.length - 1; c >= 0; c--) {
3246
+ let h = u[c];
3247
+ (!r || r.indexOf(h.index) != -1) && (h.route && i[J] && (this[qe](h.route), h.active === !0 && h.route.opsType == q.Append && (l = !0)), a.push(new U(i, h.index, t.y)), u.splice(c, 1));
3248
+ }
3249
+ if (u.length == 0)
3250
+ n ? i.slots.value = u : e.layers[t.y].views.splice(t.x, 1);
3251
+ else {
3252
+ if (l) {
3253
+ let c = u.length - 1, h = u[c];
3254
+ h.active = !0, h.route && (h.route.active = h.active);
3255
+ }
3256
+ i.slots.value = u;
3257
+ }
3258
+ e.layers[t.y].views.length == 0 && (o = !0);
3259
+ let f = t.y + 1;
3260
+ for (; f < e.layers.length; f++) {
3261
+ let c = e.layers[f].views, h = [];
3262
+ for (let y = c.length - 1; (o || a.length > 0) && y >= 0; y--) {
3263
+ let d = c[y];
3264
+ if (d[ye] && (o || U.include(a, d[ye]))) {
3265
+ let m = d.slots.value;
3266
+ for (let p = m.length - 1; p >= 0; p--) {
3267
+ let v = m[p];
3268
+ v.route && d[J] && this[qe](v.route), h.push(new U(d, v.index, f)), m.splice(p, 1);
3269
+ }
3270
+ e.layers[f].views.splice(y, 1);
3271
+ }
3272
+ }
3273
+ a = h, e.layers[f].views.length == 0 && (o = !0);
3274
+ }
3275
+ }
3276
+ /**
3277
+ * 恢复
3278
+ * @param routes
3279
+ *
3280
+ * @returns
3281
+ */
3282
+ restore(e) {
3283
+ if (!e || this[V].length == 0) {
3284
+ let t = this[B];
3285
+ if (t.layers.length > 0) {
3286
+ let r = t.layers[0].views;
3287
+ r.length > 0 && (r[0].slots.value = []);
3288
+ }
3289
+ return this[w] = [], this[ze](), Promise.resolve();
3290
+ } else
3291
+ return new Promise((r, n) => {
3292
+ let i = null, o = !1;
3293
+ for (let a = 0; a < e.length; a++) {
3294
+ const l = e[a];
3295
+ this[we].post((u) => {
3296
+ const f = this[Et](l);
3297
+ this[Ft](f), this[Kt](f), this[_t](f), f.wait(
3298
+ (c, h) => {
3299
+ i = c.session.to, o = c.session.redirect, u.resolve();
3300
+ },
3301
+ (c, h) => {
3302
+ i = null, h !== null && this[j](h), u.resolve();
3303
+ }
3304
+ );
3305
+ });
3306
+ }
3307
+ this[we].post((a) => {
3308
+ if (i && o === !0) {
3309
+ const l = S.clone(i, !0), u = new ir(l, this[Ge]());
3310
+ this[A]?.replace(u);
3311
+ }
3312
+ a.resolve(), r();
3313
+ });
3314
+ });
3315
+ }
3316
+ /**
3317
+ * build page
3318
+ * @param route
3319
+ * @param routeModel
3320
+ * @returns
3321
+ */
3322
+ [cr](e, t, r) {
3323
+ const n = e.updateType ?? Ze.Part;
3324
+ return this[hr](t).then(() => {
3325
+ const o = this[yr](t, e, r, n);
3326
+ if (o.status === "error")
3327
+ throw Error(o.message);
3328
+ return o;
3329
+ });
3330
+ }
3331
+ /**
3332
+ * 解析组件
3333
+ */
3334
+ [hr](e) {
3335
+ let t = [];
3336
+ for (let r = 0; r < e.layers.length; r++) {
3337
+ let n = e.layers[r];
3338
+ for (let i = 0; i < n.models.length; i++) {
3339
+ let o = n.models[i];
3340
+ o.isResolved || t.push(o.resolve());
3341
+ }
3342
+ }
3343
+ return t.length > 0 ? Promise.all(t) : Promise.resolve();
3344
+ }
3345
+ /**
3346
+ * 更新页面
3347
+ * @param routeModel
3348
+ * @param route
3349
+ * @param session
3350
+ * @param updateType
3351
+ * @returns
3352
+ */
3353
+ [yr](e, t, r, n) {
3354
+ if (e.layers[0].models.length !== 1)
3355
+ return {
3356
+ status: "error",
3357
+ message: "illegal route structure(multi root node)"
3358
+ };
3359
+ const i = e.layers[0].models[0];
3360
+ let o = this[B], a = js(o), l = t.root ?? te, u;
3361
+ !a && n == Ze.Part && (u = this[xt](o, t));
3362
+ let f, c = 0;
3363
+ if (u == null || u == null)
3364
+ if (a || n === Ze.All) {
3365
+ if (o.layers.length == 0 && (o.layers[0] = new gt()), o.layers[0].views.length == 0) {
3366
+ let h = t.root ?? te;
3367
+ f = new Ke(h, !0, null), o.layers[0].views = [f];
3368
+ } else
3369
+ f = o.layers[0].views[0];
3370
+ u = { x: 0, y: 0 };
3371
+ } else {
3372
+ let h = t.slot;
3373
+ if (!h)
3374
+ return {
3375
+ status: "error",
3376
+ message: "can not rebuild view(because not route slot)"
3377
+ };
3378
+ let y = h.level;
3379
+ if (y > o.layers.length)
3380
+ return {
3381
+ status: "error",
3382
+ message: "can not insert view(override level)"
3383
+ };
3384
+ let d;
3385
+ if (h.rootName) {
3386
+ let m = o.layers[y - 1];
3387
+ for (let p of m.views) {
3388
+ if (p[J] && p.name === h.rootName) {
3389
+ d = new U(p, h.rootIndex ?? 0, y - 1);
3390
+ break;
3391
+ }
3392
+ if (p[z] && p[z].view.name === h.rootName && p[z].index === h.rootIndex) {
3393
+ d = p[z];
3394
+ break;
3395
+ }
3396
+ }
3397
+ }
3398
+ if (!d)
3399
+ return {
3400
+ status: "error",
3401
+ message: "can not insert view(not find root node ref)"
3402
+ };
3403
+ f = new Ke(l, !0, d), o.layers[y].views.push(f), u = { x: o.layers[y].views.length - 1, y };
3404
+ }
3405
+ else
3406
+ f = o.layers[u.y].views[u.x];
3407
+ if (c = u.y, f[J] = !0, t.opsType === q.Append) {
3408
+ t.index = t.index ?? le.get(), t.active = !0;
3409
+ let h = f.slots.value;
3410
+ if (h.length > 0) {
3411
+ let v = h[h.length - 1];
3412
+ v.active = !1, v.route && (v.route.active = v.active);
3413
+ }
3414
+ let y = new ne(t, i, t.index, !0);
3415
+ f.slots.value = [...h, y];
3416
+ let d = c + 1, m = 1, p = new U(f, t.index, c);
3417
+ this[ie](o, d, e, m, p);
3418
+ } else if (t.opsType === q.Open) {
3419
+ let h = f.slots.value;
3420
+ const y = t.active ?? !0;
3421
+ let d = !1;
3422
+ for (let m of h) {
3423
+ if (m.route !== null && S.isSameForRouteModel(m.route, t)) {
3424
+ if (m.active === y)
3425
+ return t.index = m.index, t.active = y, m.route = t, {
3426
+ status: "no-change",
3427
+ message: ""
3428
+ };
3429
+ m.active = y, d = !0, t.index = m.index, t.active = y, m.route = t;
3430
+ } else
3431
+ y && (m.active = !1);
3432
+ m.route && (m.route.active = m.active);
3433
+ }
3434
+ if (!d) {
3435
+ t.index = t.index ?? le.get(), t.active = y;
3436
+ let m = new ne(t, i, t.index, y);
3437
+ h.push(m);
3438
+ let p = c + 1, v = 1, g = new U(f, t.index, c);
3439
+ this[ie](o, p, e, v, g);
3440
+ }
3441
+ f.slots.value = [...h];
3442
+ } else {
3443
+ let h = f.slots.value;
3444
+ if (h.length == 0) {
3445
+ t.index = t.index ?? le.get(), t.active = !0, f.slots.value = [new ne(t, i, t.index)];
3446
+ let y = c + 1, d = 1, m = new U(f, t.index, c);
3447
+ this[ie](o, y, e, d, m);
3448
+ } else {
3449
+ let y = h[0];
3450
+ if (y.model !== i) {
3451
+ this[fe](o, u, null, !0), t.index = t.index ?? le.get(), t.active = !0, f.slots.value = [new ne(t, i, t.index)];
3452
+ let d = c + 1, m = 1, p = new U(f, t.index, c);
3453
+ this[ie](o, d, e, m, p);
3454
+ } else {
3455
+ y.route !== null && this[qe](y.route);
3456
+ let d = !1;
3457
+ const m = t.active ?? !0;
3458
+ y.active !== m && (y.active = m, d = !0), t.active = m, t.index = y.index, y.route = t;
3459
+ let p = [];
3460
+ for (let K = 1; K < h.length; K++)
3461
+ p.push(h[K].index);
3462
+ p.length > 0 ? this[fe](o, u, p, !0) : d && (f.slots.value = [...h]);
3463
+ let v = [new U(f, t.index, c)], g = c + 1, _ = 1, b = new U(f, t.index, c);
3464
+ for (; v.length > 0 && g < o.layers.length && _ < e.layers.length; g++, _++) {
3465
+ let K = [];
3466
+ for (let P = 0; P < o.layers[g].views.length; P++) {
3467
+ let C = o.layers[g].views[P];
3468
+ C[ye] && U.include(v, C[ye]) && K.unshift(P);
3469
+ }
3470
+ let E = [];
3471
+ for (let P of K) {
3472
+ let C = o.layers[g].views[P], k = e.layers[_].models, M;
3473
+ for (let I = 0; I < k.length; I++)
3474
+ if (C.name === k[I].name) {
3475
+ M = k[I];
3476
+ break;
3477
+ }
3478
+ if (!M)
3479
+ this[fe](o, { x: P, y: g }, null, !1);
3480
+ else {
3481
+ let I = C.slots.value;
3482
+ if (I.length == 0) {
3483
+ let X = 0;
3484
+ C.slots.value = [new ne(null, M, X)];
3485
+ let W = g + 1, re = _ + 1;
3486
+ this[ie](o, W, e, re, b);
3487
+ } else {
3488
+ let X = I[0];
3489
+ if (X.model !== M) {
3490
+ this[fe](o, { x: P, y: g }, null, !0), C.slots.value = [new ne(null, M, 0)];
3491
+ let W = g + 1, re = _ + 1;
3492
+ this[ie](o, W, e, re, b);
3493
+ } else {
3494
+ C[J] && X.route !== null && this[qe](X.route);
3495
+ let W = [];
3496
+ for (let re = 1; re < I.length; re++)
3497
+ W.push(I[re].index);
3498
+ W.length > 0 && this[fe](o, { x: P, y: g }, W, !0), E.push(new U(C, X.index, g));
3499
+ }
3500
+ }
3501
+ C[J] = !1;
3502
+ }
3503
+ }
3504
+ v = E;
3505
+ }
3506
+ this[ie](o, g, e, _, b);
3507
+ }
3508
+ }
3509
+ }
3510
+ if (f && f[z]) {
3511
+ let h = f[z];
3512
+ h && (t.slot = new cs(l, c, h?.view.name, h?.index ?? 0));
3513
+ }
3514
+ return r.to = void 0, r.routeModel = void 0, t.session = r, this[dr](t), {
3515
+ status: "success",
3516
+ message: ""
3517
+ };
3518
+ }
3519
+ /**
3520
+ * 合并view
3521
+ * @param page
3522
+ * @param startViewLevel
3523
+ * @param routeModel
3524
+ * @param startModelLevel
3525
+ * @param rootNodeRef
3526
+ */
3527
+ [ie](e, t, r, n, i) {
3528
+ let o = n, a = t;
3529
+ for (; a < e.layers.length && o < r.layers.length; a++, o++) {
3530
+ let l = e.layers[a].views;
3531
+ for (let u of r.layers[o].models) {
3532
+ let f = new Ke(u.name, !1, i), c = new ne(null, u);
3533
+ f.slots.value = [c], l.push(f);
3534
+ }
3535
+ }
3536
+ for (; o < r.layers.length; o++) {
3537
+ let l = new gt();
3538
+ l.views = [];
3539
+ for (let u of r.layers[o].models) {
3540
+ let f = new Ke(u.name, !1, i), c = new ne(null, u);
3541
+ f.slots.value = [c], l.views.push(f);
3542
+ }
3543
+ e.layers.push(l);
3544
+ }
3545
+ }
3546
+ /**
3547
+ * router view与view同步数据
3548
+ * @param name
3549
+ * @param level
3550
+ * @param rootView
3551
+ * @param rootViewIndex
3552
+ * @param parentView
3553
+ * @param parentViewIndex
3554
+ * @returns
3555
+ */
3556
+ [Ar](e, t, r, n, i, o) {
3557
+ if (t < 0 || t > this[B].layers.length)
3558
+ return null;
3559
+ if (t < this[B].layers.length) {
3560
+ let f = this[B].layers[t], c = null;
3561
+ for (let h of f.views) {
3562
+ let y = !1;
3563
+ if (r !== null ? (y = h.name === e && h[z]?.view === r, y && n !== -1 && (y = h[z]?.index === n)) : y = h.name === e, !!y) {
3564
+ i !== null && (h[ye] = {
3565
+ view: i,
3566
+ index: o,
3567
+ level: t - 1
3568
+ }), c = h;
3569
+ break;
3570
+ }
3571
+ }
3572
+ if (c !== null)
3573
+ return c;
3574
+ }
3575
+ let a = null, l = null;
3576
+ i !== null && (i[J] ? a = {
3577
+ view: i,
3578
+ index: o,
3579
+ level: t - 1
3580
+ } : a = i[z], l = {
3581
+ view: i,
3582
+ index: o,
3583
+ level: t - 1
3584
+ });
3585
+ let u = new Ke(e, !0, a);
3586
+ if (u[ye] = l, t == this[B].layers.length) {
3587
+ let f = new gt();
3588
+ f.views = [u], this[B].layers.push(f);
3589
+ } else
3590
+ this[B].layers[t].views.push(u);
3591
+ return u;
3592
+ }
3593
+ }
3594
+ const Ms = "fox-router-view", Is = "fox-router-link";
3595
+ function jr(s, e = !1) {
3596
+ let t = null;
3597
+ return e ? t = s.showFromClass ?? s.enterFromClass : t = s.enterFromClass, t || (t = s.transitionName, t ? e ? `${t}-show-from` : `${t}-enter-from` : null);
3598
+ }
3599
+ function Lr(s, e = !1) {
3600
+ let t = null;
3601
+ return e ? t = s.showActiveClass ?? s.enterActiveClass : t = s.enterActiveClass, t || (t = s.transitionName, t ? e ? `${t}-show-active` : `${t}-enter-active` : null);
3602
+ }
3603
+ function Ns(s, e = !1) {
3604
+ let t = null;
3605
+ return e ? t = s.showToClass ?? s.enterToClass : t = s.enterToClass, t || (t = s.transitionName, t ? e ? `${t}-show-to` : `${t}-enter-to` : null);
3606
+ }
3607
+ function Or(s, e = !1) {
3608
+ let t = null;
3609
+ return e ? t = s.hideFromClass ?? s.leaveFromClass : t = s.leaveFromClass, t || (t = s.transitionName, t ? e ? `${t}-hide-from` : `${t}-leave-from` : null);
3610
+ }
3611
+ function Mr(s, e = !1) {
3612
+ let t = null;
3613
+ return e ? t = s.hideActiveClass ?? s.leaveActiveClass : t = s.leaveActiveClass, t || (t = s.transitionName, t ? e ? `${t}-hide-active` : `${t}-leave-active` : null);
3614
+ }
3615
+ function Hs(s, e = !1) {
3616
+ let t = null;
3617
+ return e ? t = s.hideToClass ?? s.leaveToClass : t = s.leaveToClass, t || (t = s.transitionName, t ? e ? `${t}-hide-to` : `${t}-leave-to` : null);
3618
+ }
3619
+ function Ds(s, e = !1) {
3620
+ let t = null;
3621
+ return e ? t = s.beforeShow ?? s.beforeEnter : t = s.beforeEnter, t;
3622
+ }
3623
+ function Us(s, e = !1) {
3624
+ let t = null;
3625
+ return e ? t = s.show ?? s.enter : t = s.enter, t;
3626
+ }
3627
+ function Vs(s, e = !1) {
3628
+ let t = null;
3629
+ return e ? t = s.afterShow ?? s.afterEnter : t = s.afterEnter, t;
3630
+ }
3631
+ function Bs(s, e = !1) {
3632
+ let t = null;
3633
+ return e ? t = s.showCancelled ?? s.enterCancelled : t = s.enterCancelled, t;
3634
+ }
3635
+ function ks(s, e = !1) {
3636
+ let t = null;
3637
+ return e ? t = s.beforeHide ?? s.beforeLeave : t = s.beforeLeave, t;
3638
+ }
3639
+ function Ws(s, e = !1) {
3640
+ let t = null;
3641
+ return e ? t = s.hide ?? s.leave : t = s.leave, t;
3642
+ }
3643
+ function zs(s, e = !1) {
3644
+ let t = null;
3645
+ return e ? t = s.afterHide ?? s.afterLeave : t = s.afterLeave, t;
3646
+ }
3647
+ function Js(s, e = !1) {
3648
+ let t = null;
3649
+ return e ? t = s.hideCancelled ?? s.leaveCancelled : t = s.leaveCancelled, t;
3650
+ }
3651
+ function Bt(s) {
3652
+ let e, t = s.duration;
3653
+ return typeof t == "object" ? e = {
3654
+ enter: t.enter ?? -1,
3655
+ leave: t.leave ?? -1,
3656
+ show: t.show ?? -1,
3657
+ hide: t.hide ?? -1
3658
+ } : (typeof t == "string" && (t = t.length == 0 ? -1 : Number(t)), e = {
3659
+ enter: t,
3660
+ leave: t,
3661
+ show: t,
3662
+ hide: t
3663
+ }), e;
3664
+ }
3665
+ function Ae(s, e) {
3666
+ s.classList.contains(e) || s.classList.add(e);
3667
+ }
3668
+ function Pe(s, e) {
3669
+ s.classList.remove(e);
3670
+ }
3671
+ const Gs = Ce && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout;
3672
+ function kt(s) {
3673
+ Gs(s);
3674
+ }
3675
+ function O(s, e, t) {
3676
+ x(e) && (s == null && (s = {}), Reflect.apply(e, s, t));
3677
+ }
3678
+ function Ir(s, e, t, r = -1, n, i, o, a) {
3679
+ if (x(i)) {
3680
+ if (n !== void 0 && n >= 0) {
3681
+ setTimeout(() => {
3682
+ Reflect.apply(i, s, [e, t, r]), x(a) && Reflect.apply(a, s, []);
3683
+ }, n);
3684
+ return;
3685
+ }
3686
+ const l = ["animationend", "transitionend"], u = (f) => {
3687
+ l.forEach((c) => {
3688
+ qt(e, c, u);
3689
+ }), Reflect.apply(i, s, [e, t, r]), a && Reflect.apply(a, s, []);
3690
+ };
3691
+ l.forEach((f) => {
3692
+ Tt(e, f, u);
3693
+ });
3694
+ }
3695
+ if (x(o)) {
3696
+ const l = "animationcancel", u = (f) => {
3697
+ Reflect.apply(o, s, [e, t, r]), qt(e, l, u);
3698
+ };
3699
+ Tt(e, l, u);
3700
+ }
3701
+ }
3702
+ function at(s) {
3703
+ return !Ce || s === null ? !1 : s.opsType === q.Append || s.opsType === q.Open;
3704
+ }
3705
+ function Nr(s, e, t, r = {}, n, i = -1) {
3706
+ if (e || at(n)) {
3707
+ const o = jr(r, e);
3708
+ o && Ae(t, o);
3709
+ const a = Lr(r, e);
3710
+ a && Ae(t, a);
3711
+ const l = Ds(r, e);
3712
+ O(s, l, [t, e, n, i]);
3713
+ }
3714
+ }
3715
+ function Hr(s, e, t, r = {}, n, i, o, a) {
3716
+ if (!at(i) && !e) {
3717
+ x(a) && a(s, a, [t]);
3718
+ return;
3719
+ }
3720
+ const l = jr(r, e), u = Lr(r, e), f = Ns(r, e), c = Us(r, e), h = Vs(r, e), y = Bs(r, e);
3721
+ if (!l && !u && !f && !c) {
3722
+ x(a) && a(s, a, [t]);
3723
+ return;
3724
+ }
3725
+ kt(() => {
3726
+ Ir(s, t, i, o, n, () => {
3727
+ u && Pe(t, u), f && Pe(t, f), x(h) && O(s, h, [t, e, i, o]), x(a) && a(s, a, [t]);
3728
+ }, () => {
3729
+ x(y) && O(s, y, [t, e, i, o]);
3730
+ }), l && Pe(t, l), f && Ae(t, f), x(c) && O(s, c, [t, e, i, o]);
3731
+ });
3732
+ }
3733
+ function Dr(s, e, t, r = {}, n, i = -1) {
3734
+ if (e || at(n)) {
3735
+ const o = Or(r, e);
3736
+ o && Ae(t, o);
3737
+ const a = Mr(r, e);
3738
+ a && Ae(t, a);
3739
+ const l = ks(r, e);
3740
+ O(s, l, [t, e, n, i]);
3741
+ }
3742
+ }
3743
+ function Ur(s, e, t, r = {}, n, i, o, a, l) {
3744
+ if (!at(o) && !e) {
3745
+ !e && x(i) && i();
3746
+ return;
3747
+ }
3748
+ const u = Or(r, e), f = Mr(r, e), c = Hs(r, e), h = Ws(r, e), y = zs(r, e), d = Js(r, e);
3749
+ if (!u && !f && !c && !h) {
3750
+ !e && x(i) && i();
3751
+ return;
3752
+ }
3753
+ x(h) && O(s, h, [t, e, o, a]), kt(() => {
3754
+ Ir(s, t, o, a, n, () => {
3755
+ f && Pe(t, f), c && Pe(t, c), x(y) && O(s, y, [t, e, o, a]), x(l) && O(s, l, [t]), !e && x(i) && i();
3756
+ }, () => {
3757
+ x(d) && O(s, d, [t, e, o, a]), x(l) && O(s, l, [t]), !e && x(i) && i();
3758
+ }), u && Pe(t, u), c && Ae(t, c);
3759
+ });
3760
+ }
3761
+ function Lt(s, e = {}, t, r = -1) {
3762
+ const n = e.mode ?? "default", i = Bt(e);
3763
+ return {
3764
+ //mode
3765
+ mode: n,
3766
+ //如果是 true,表示这是一个不真实插入/删除元素的转换,而是切换显示/隐藏状态
3767
+ persisted: !1,
3768
+ //before enter
3769
+ beforeEnter: (a) => {
3770
+ Nr(s, !1, a, e, t, r);
3771
+ },
3772
+ //enter
3773
+ enter: (a) => {
3774
+ Hr(s, !1, a, e, i.enter, t, r);
3775
+ },
3776
+ //leave
3777
+ leave: (a, l) => {
3778
+ Dr(s, !1, a, e, t, r), Ur(s, !1, a, e, i.leave, l, t, r);
3779
+ },
3780
+ //clone
3781
+ clone: (a) => Lt(s, e, t, r)
3782
+ };
3783
+ }
3784
+ function Vr(s) {
3785
+ return s.el;
3786
+ }
3787
+ function Qs(s, e, t = {}, r, n, i, o) {
3788
+ if (i) {
3789
+ const a = Vr(e);
3790
+ if (a == null)
3791
+ return;
3792
+ const l = Bt(t);
3793
+ Nr(s, !0, a, t, r, n), Hr(s, !0, a, t, l.show, r, n, (u) => {
3794
+ x(o) && O(s, o, [u]);
3795
+ });
3796
+ } else
3797
+ x(o) && O(s, o, []);
3798
+ }
3799
+ function Xs(s, e, t = {}, r, n, i, o) {
3800
+ if (i) {
3801
+ const a = Vr(e);
3802
+ if (a == null)
3803
+ return;
3804
+ const l = Bt(t);
3805
+ Dr(s, !0, a, t, r, n), Ur(s, !0, a, t, l.hide, null, r, n, (u) => {
3806
+ x(o) && O(s, o, [u]);
3807
+ });
3808
+ } else
3809
+ x(o) && O(s, o, []);
3810
+ }
3811
+ function Ys(s, e = {}) {
3812
+ kt(() => {
3813
+ for (let t = 0; t < s.length; t++)
3814
+ Reflect.apply(s[t], e, []);
3815
+ });
3816
+ }
3817
+ function oe(s, e, t) {
3818
+ return typeof s == "function" ? Reflect.apply(s, {}, [e, t]) : s;
3819
+ }
3820
+ function $t(s, e) {
3821
+ if (!s)
3822
+ return null;
3823
+ const t = s(e);
3824
+ return t.length === 1 ? t[0] : t;
3825
+ }
3826
+ function be(s, e) {
3827
+ return typeof e == "function" ? e(s) : s;
3828
+ }
3829
+ class Zs {
3830
+ /**
3831
+ * vue node
3832
+ */
3833
+ node;
3834
+ /**
3835
+ * 状态
3836
+ */
3837
+ state;
3838
+ /**
3839
+ * 构造函数
3840
+ */
3841
+ constructor(e, t) {
3842
+ this.node = e, this.state = t;
3843
+ }
3844
+ }
3845
+ const Ot = wr({
3846
+ //名称
3847
+ name: "RouterView",
3848
+ //继承特性
3849
+ inheritAttrs: !1,
3850
+ //属性
3851
+ props: {
3852
+ //名称
3853
+ name: {
3854
+ type: String,
3855
+ required: !1,
3856
+ default: "default"
3857
+ },
3858
+ // view slot
3859
+ modelSlot: {
3860
+ type: [Object],
3861
+ required: !1
3862
+ },
3863
+ //是否多视图
3864
+ multi: {
3865
+ type: Boolean,
3866
+ required: !1,
3867
+ default: !1
3868
+ },
3869
+ //root组件标签(multi为true启用)
3870
+ tag: {
3871
+ type: [String, Object, Function],
3872
+ required: !1,
3873
+ default: "div"
3874
+ },
3875
+ //view页面tag(multi为true启用)
3876
+ viewTag: {
3877
+ type: [String, Object, Function],
3878
+ required: !1,
3879
+ default: "div"
3880
+ },
3881
+ //view页面tag的Props参数(multi为true启用)
3882
+ viewTagProps: {
3883
+ type: [Object, Function],
3884
+ required: !1,
3885
+ default() {
3886
+ return {};
3887
+ }
3888
+ },
3889
+ //view页面class(multi为true启用)
3890
+ viewClass: {
3891
+ type: [String, Function],
3892
+ required: !1
3893
+ },
3894
+ //view页面激活class(multi为true启用)
3895
+ viewActiveClass: {
3896
+ type: [String, Function],
3897
+ required: !1
3898
+ },
3899
+ //view页面失活class(multi为true启用)
3900
+ viewInactiveClass: {
3901
+ type: [String, Function],
3902
+ required: !1
3903
+ },
3904
+ // 是否开启过渡
3905
+ transition: {
3906
+ type: [Boolean, String, Function],
3907
+ required: !1,
3908
+ default: !1
3909
+ },
3910
+ //过渡类名
3911
+ transitionName: {
3912
+ type: String,
3913
+ required: !1
3914
+ },
3915
+ //enter from class
3916
+ enterFromClass: {
3917
+ type: String,
3918
+ required: !1
3919
+ },
3920
+ //enter active class
3921
+ enterActiveClass: {
3922
+ type: String,
3923
+ required: !1
3924
+ },
3925
+ //enter to class
3926
+ enterToClass: {
3927
+ type: String,
3928
+ required: !1
3929
+ },
3930
+ //leave from class
3931
+ leaveFromClass: {
3932
+ type: String,
3933
+ required: !1
3934
+ },
3935
+ //leave active class
3936
+ leaveActiveClass: {
3937
+ type: String,
3938
+ required: !1
3939
+ },
3940
+ //leave to class
3941
+ leaveToClass: {
3942
+ type: String,
3943
+ required: !1
3944
+ },
3945
+ //show from class
3946
+ showFromClass: {
3947
+ type: String,
3948
+ required: !1
3949
+ },
3950
+ //show active class
3951
+ showActiveClass: {
3952
+ type: String,
3953
+ required: !1
3954
+ },
3955
+ //show to class
3956
+ showToClass: {
3957
+ type: String,
3958
+ required: !1
3959
+ },
3960
+ //hide from class
3961
+ hideFromClass: {
3962
+ type: String,
3963
+ required: !1
3964
+ },
3965
+ //hide active class
3966
+ hideActiveClass: {
3967
+ type: String,
3968
+ required: !1
3969
+ },
3970
+ //hide to class
3971
+ hideToClass: {
3972
+ type: String,
3973
+ required: !1
3974
+ },
3975
+ //before enter
3976
+ beforeEnter: {
3977
+ type: Function,
3978
+ required: !1
3979
+ },
3980
+ //enter
3981
+ enter: {
3982
+ type: Function,
3983
+ required: !1
3984
+ },
3985
+ //after enter
3986
+ afterEnter: {
3987
+ type: Function,
3988
+ required: !1
3989
+ },
3990
+ // enter cancelled
3991
+ enterCancelled: {
3992
+ type: Function,
3993
+ required: !1
3994
+ },
3995
+ //before leave
3996
+ beforeLeave: {
3997
+ type: Function,
3998
+ required: !1
3999
+ },
4000
+ //leave
4001
+ leave: {
4002
+ type: Function,
4003
+ required: !1
4004
+ },
4005
+ //after leave
4006
+ afterLeave: {
4007
+ type: Function,
4008
+ required: !1
4009
+ },
4010
+ // leave cancelled
4011
+ leaveCancelled: {
4012
+ type: Function,
4013
+ required: !1
4014
+ },
4015
+ //before show
4016
+ beforeShow: {
4017
+ type: Function,
4018
+ required: !1
4019
+ },
4020
+ //show
4021
+ show: {
4022
+ type: Function,
4023
+ required: !1
4024
+ },
4025
+ //after show
4026
+ afterShow: {
4027
+ type: Function,
4028
+ required: !1
4029
+ },
4030
+ // show cancelled
4031
+ showCancelled: {
4032
+ type: Function,
4033
+ required: !1
4034
+ },
4035
+ //before hide
4036
+ beforeHide: {
4037
+ type: Function,
4038
+ required: !1
4039
+ },
4040
+ //hide
4041
+ hide: {
4042
+ type: Function,
4043
+ required: !1
4044
+ },
4045
+ //after hide
4046
+ afterHide: {
4047
+ type: Function,
4048
+ required: !1
4049
+ },
4050
+ // hide cancelled
4051
+ hideCancelled: {
4052
+ type: Function,
4053
+ required: !1
4054
+ }
4055
+ },
4056
+ //setup
4057
+ setup(s, e) {
4058
+ const t = Mt();
4059
+ if (t === null || t.proxy === null) {
4060
+ console.error("instance or instance.proxy not exist");
4061
+ return;
4062
+ }
4063
+ const r = s.multi === !0, n = G(lt, null), i = G(pt, 0), o = G(sr, null), a = G(mt, -1);
4064
+ let l = null;
4065
+ const u = s.modelSlot;
4066
+ if (u) {
4067
+ if (se(pt, i + 1), se(mt, u.index), se(vt, u.index), !u.route) {
4068
+ console.warn("child view render error, route not exist");
4069
+ return;
4070
+ }
4071
+ const h = nt(t.proxy, !0);
4072
+ ps(h), rr(h, () => u.route ?? null);
4073
+ } else {
4074
+ if (n == null) {
4075
+ console.error("router is not been injected");
4076
+ return;
4077
+ }
4078
+ const c = s.name, h = G(nr, null), y = G(vt, 0);
4079
+ if (l = n[Ar](c, i, o, a, h, y), l === null)
4080
+ return;
4081
+ se(nr, l);
4082
+ const d = l[J] === !0;
4083
+ if (d && se(sr, l), !r && (se(mt, -1), se(pt, i + 1), se(vt, -1), d)) {
4084
+ const m = nt(t.proxy, !0);
4085
+ rr(m, () => {
4086
+ const p = l.slots.value;
4087
+ return p.length > 0 ? p[0].route : null;
4088
+ });
4089
+ }
4090
+ }
4091
+ const f = { value: /* @__PURE__ */ new Map() };
4092
+ return ot(() => {
4093
+ f.value && f.value.clear();
4094
+ }), () => {
4095
+ if (r) {
4096
+ const c = /* @__PURE__ */ new Map(), h = [], y = l?.slots.value, d = [];
4097
+ for (let v = 0; v < y.length; v++) {
4098
+ const g = y[v], _ = `${s.name}_${g.index}`, b = oe(s.transition, g.route, v) ?? !0, K = { modelSlot: g };
4099
+ let E;
4100
+ e.slots.default ? E = he(Ot, K, { default: e.slots.default }) : E = he(Ot, K);
4101
+ const P = {}, C = oe(s.viewClass, g.route, v);
4102
+ typeof C == "string" && C.length > 0 && (P[C] = !0);
4103
+ const k = oe(s.viewActiveClass, g.route, v), M = oe(s.viewInactiveClass, g.route, v), I = f.value.get(_);
4104
+ if (typeof k == "string" && k.length > 0 && (P[k] = g.active), typeof M == "string" && M.length > 0 && (P[M] = !g.active), I && g.active !== I.state) {
4105
+ const Y = I.node;
4106
+ g.active ? d.unshift(() => {
4107
+ const ft = () => {
4108
+ let Ee = er(Y);
4109
+ Ee != null && tr(Ee, jt.ACTIVATED);
4110
+ };
4111
+ Qs(t, Y, s, g.route, v, b, ft);
4112
+ }) : d.push(() => {
4113
+ const ft = () => {
4114
+ const Ee = er(Y);
4115
+ Ee != null && tr(Ee, jt.DEACTIVATED);
4116
+ };
4117
+ Xs(t, Y, s, g.route, v, b, ft);
4118
+ });
4119
+ }
4120
+ const X = {
4121
+ class: P,
4122
+ key: _
4123
+ }, W = oe(s.viewTagProps, g.route, v);
4124
+ if (W !== null && typeof W == "object") {
4125
+ const Y = be(W, n?.propsFilter);
4126
+ T(!0, X, Y);
4127
+ }
4128
+ if (g.route?.viewTagAttrs && typeof g.route?.viewTagAttrs == "object") {
4129
+ const Y = be(g.route.viewTagAttrs, n?.propsFilter);
4130
+ T(!0, X, Y);
4131
+ }
4132
+ const re = oe(s.viewTag, g.route, v), ut = he(re, X, { default: () => [E] });
4133
+ if (c.set(_, new Zs(ut, g.active)), f.value.delete(_), b) {
4134
+ const Y = Lt(t, s, g.route, v);
4135
+ ut.transition = Y;
4136
+ }
4137
+ h.push(ut);
4138
+ }
4139
+ f.value = c, Ys(d, t);
4140
+ const m = oe(s.tag, null, -1), p = {};
4141
+ return Object.assign(p, e.attrs), he(m, p, { default: () => h });
4142
+ } else if (u != null) {
4143
+ const c = u.model, h = {};
4144
+ if (c.props) {
4145
+ if (typeof c.props == "object") {
4146
+ const d = be(c.props, n?.propsFilter);
4147
+ T(!1, h, d);
4148
+ } else if (c.props === !0 && typeof u.route?.params == "object") {
4149
+ const d = be(u.route.params, n?.propsFilter);
4150
+ T(!1, h, d);
4151
+ }
4152
+ }
4153
+ const y = he(c.component, h);
4154
+ return $t(e.slots.default, { Component: y, route: u.route }) ?? y;
4155
+ } else {
4156
+ const c = l.slots.value;
4157
+ if (c.length > 0) {
4158
+ const h = c[0], y = h.route ?? (t.proxy && Ut(t.proxy)) ?? null, d = h.model, m = {};
4159
+ if (d.props) {
4160
+ if (typeof d.props == "object") {
4161
+ const g = be(d.props, n?.propsFilter);
4162
+ T(!1, m, g);
4163
+ } else if (d.props === !0 && typeof y?.params == "object") {
4164
+ const g = be(y.params, n?.propsFilter);
4165
+ T(!1, m, g);
4166
+ }
4167
+ }
4168
+ const p = he(d.component, m);
4169
+ if (oe(s.transition, y, -1) ?? !0) {
4170
+ const g = Lt(t, s, y, -1);
4171
+ p.transition = g;
4172
+ }
4173
+ return $t(e.slots.default, { Component: p, route: y }) ?? p;
4174
+ } else
4175
+ return $t(e.slots.fallback, {});
4176
+ }
4177
+ };
4178
+ }
4179
+ });
4180
+ function en(s) {
4181
+ if (!(s.metaKey || s.altKey || s.ctrlKey || s.shiftKey) && !s.defaultPrevented && !(s.button != null && s.button !== 0)) {
4182
+ if (s.currentTarget && s.currentTarget.getAttribute) {
4183
+ const e = s.currentTarget.getAttribute("target");
4184
+ if (/\b_blank\b/i.test(e))
4185
+ return;
4186
+ }
4187
+ return s.preventDefault && s.preventDefault(), !0;
4188
+ }
4189
+ }
4190
+ function tn(s, e) {
4191
+ return s == null || e == null ? !1 : !!(s === e || s.path && s.path === e.path || s.name && s.name === e.name);
4192
+ }
4193
+ function rn(s, e) {
4194
+ return s == null || e == null ? !1 : !!(s.path && e.path && e.path.startsWith(s.path) || s.name && s.name == e.name);
4195
+ }
4196
+ function xe(s, e) {
4197
+ return typeof s == "function" ? Reflect.apply(s, {}, [e]) : s;
4198
+ }
4199
+ let sn = wr({
4200
+ //名称
4201
+ name: "RouterLink",
4202
+ //继承特性
4203
+ inheritAttrs: !1,
4204
+ //属性
4205
+ props: {
4206
+ //link标签
4207
+ tag: {
4208
+ type: [String, Object, Function],
4209
+ required: !1,
4210
+ default: "a"
4211
+ },
4212
+ //route
4213
+ to: {
4214
+ type: [String, Object, Function],
4215
+ required: !0
4216
+ },
4217
+ // root
4218
+ root: {
4219
+ type: String
4220
+ },
4221
+ //激活class
4222
+ activeClass: {
4223
+ type: [String, Function],
4224
+ required: !1,
4225
+ default: "fox-router-link-active"
4226
+ },
4227
+ //是否精确匹配
4228
+ exact: {
4229
+ type: [String, Boolean, Function],
4230
+ required: !1
4231
+ },
4232
+ //精确激活class
4233
+ exactActiveClass: {
4234
+ type: [String, Function],
4235
+ required: !1,
4236
+ default: "fox-router-link-exact-active"
4237
+ },
4238
+ //监听事件
4239
+ event: {
4240
+ type: [String, Function],
4241
+ required: !1,
4242
+ default: "onClick"
4243
+ }
4244
+ },
4245
+ //setup
4246
+ setup(s, e) {
4247
+ const t = G(lt, null);
4248
+ return () => {
4249
+ let r = xe(s.to, null), n = xe(s.tag, r);
4250
+ if (n == null) {
4251
+ console.warn("can not resolve link tag");
4252
+ return;
4253
+ }
4254
+ let i = null, o = null;
4255
+ t !== null && (i = t[H](r), s.root && (i.root = s.root), o = t.current);
4256
+ let a = {}, l = xe(s.activeClass, i);
4257
+ if (typeof l == "string" && l.length > 0 && (a[l] = rn(i, o)), xe(s.exact, i) === !0) {
4258
+ let h = xe(s.exactActiveClass, i);
4259
+ typeof h == "string" && h.length > 0 && (a[h] = tn(i, o));
4260
+ }
4261
+ let f = {
4262
+ class: a
4263
+ };
4264
+ (n === "a" || n === "A") && (f.href = i?.path ?? i?.name ?? "#"), T(!0, f, e.attrs);
4265
+ let c = xe(s.event, i);
4266
+ if (typeof c == "string") {
4267
+ const h = (y) => {
4268
+ if (t == null) {
4269
+ console.warn("router is not been injected");
4270
+ return;
4271
+ }
4272
+ if (i == null) {
4273
+ console.warn("route is not been resolved");
4274
+ return;
4275
+ }
4276
+ en(y) && t.to(i);
4277
+ };
4278
+ f[c] = h;
4279
+ }
4280
+ return he(n, f, e.slots);
4281
+ };
4282
+ }
4283
+ });
4284
+ var L = /* @__PURE__ */ ((s) => (s[s.Loading = 0] = "Loading", s[s.Loaded = 1] = "Loaded", s[s.Defining = 2] = "Defining", s[s.Defined = 3] = "Defined", s))(L || {}), tt = /* @__PURE__ */ ((s) => (s[s.normal = 0] = "normal", s[s.factory = 1] = "factory", s))(tt || {});
4285
+ class nn {
4286
+ /**
4287
+ * 注册表
4288
+ */
4289
+ register = /* @__PURE__ */ new Map();
4290
+ /**
4291
+ * 构造函数
4292
+ */
4293
+ constructor() {
4294
+ }
4295
+ /**
4296
+ * 获取模块
4297
+ * @param path
4298
+ * @returns
4299
+ */
4300
+ get(e) {
4301
+ return this.register.get(e) ?? null;
4302
+ }
4303
+ /**
4304
+ * 加入模块
4305
+ * @param path
4306
+ * @param module
4307
+ */
4308
+ set(e, t) {
4309
+ this.register.set(e, t);
4310
+ }
4311
+ /**
4312
+ * 移除模块
4313
+ * @param path
4314
+ * @returns
4315
+ */
4316
+ remove(e) {
4317
+ let t = this.register.get(e);
4318
+ return this.register.delete(e), t ?? null;
4319
+ }
4320
+ /**
4321
+ * 判断模块是否存在
4322
+ * @param path
4323
+ */
4324
+ has(e) {
4325
+ return this.register.has(e);
4326
+ }
4327
+ /**
4328
+ * 清空模块
4329
+ */
4330
+ clear() {
4331
+ this.register.clear();
4332
+ }
4333
+ }
4334
+ class vr {
4335
+ /**
4336
+ * module manager
4337
+ */
4338
+ moduleManager = new nn();
4339
+ /**
4340
+ * 参数配置
4341
+ */
4342
+ options = {
4343
+ paths: {},
4344
+ alias: {},
4345
+ nature: [],
4346
+ timeout: 3e3
4347
+ };
4348
+ /**
4349
+ * 设置路径映射
4350
+ */
4351
+ set paths(e) {
4352
+ this.options.paths = e;
4353
+ }
4354
+ /**
4355
+ * 获取路径映射
4356
+ */
4357
+ get paths() {
4358
+ return this.options.paths;
4359
+ }
4360
+ /**
4361
+ * 设置路径别名
4362
+ */
4363
+ set alias(e) {
4364
+ this.options.alias = e;
4365
+ }
4366
+ /**
4367
+ * 获取路径别名
4368
+ */
4369
+ get alias() {
4370
+ return this.options.alias;
4371
+ }
4372
+ /**
4373
+ * 设置不需要解析路径或判断函数
4374
+ */
4375
+ set naturePaths(e) {
4376
+ this.options.nature = e;
4377
+ }
4378
+ /**
4379
+ * 获取不需要解析路径或判断函数
4380
+ */
4381
+ get naturePaths() {
4382
+ return this.options.nature;
4383
+ }
4384
+ /**
4385
+ * 设置超时时间
4386
+ */
4387
+ set timeout(e) {
4388
+ this.options.timeout = e;
4389
+ }
4390
+ /**
4391
+ * 获取超时时间
4392
+ */
4393
+ get timeout() {
4394
+ return this.options.timeout;
4395
+ }
4396
+ /**
4397
+ * 设置query
4398
+ */
4399
+ _query;
4400
+ // query setter
4401
+ set query(e) {
4402
+ this._query = e;
4403
+ }
4404
+ // query getter
4405
+ get query() {
4406
+ return this._query;
4407
+ }
4408
+ /**
4409
+ * 获取document head
4410
+ */
4411
+ get head() {
4412
+ return De().head;
4413
+ }
4414
+ /**
4415
+ * 构造函数
4416
+ */
4417
+ constructor() {
4418
+ }
4419
+ /**
4420
+ * 安装module
4421
+ */
4422
+ setModule(e, t) {
4423
+ const r = {
4424
+ id: e,
4425
+ src: "",
4426
+ status: L.Defined
4427
+ };
4428
+ typeof t == "function" ? (r.exports = t, r.type = tt.factory) : r.exports = t, this.moduleManager.set(e, r);
4429
+ }
4430
+ /**
4431
+ * 移除module
4432
+ */
4433
+ removeModule(e) {
4434
+ this.moduleManager.remove(e);
4435
+ }
4436
+ /**
4437
+ * 加载
4438
+ * @params args
4439
+ */
4440
+ ensure(...e) {
4441
+ const t = [];
4442
+ let r = e.length - 1;
4443
+ const n = {};
4444
+ typeof e[r] == "object" && (Object.assign(n, e[r]), r--);
4445
+ let i = null;
4446
+ typeof e[r] == "function" && (i = e[r], r--);
4447
+ for (let l = 0; l <= r; l++)
4448
+ if (Array.isArray(e[l])) {
4449
+ let u = e[l];
4450
+ for (let f = 0; f < u.length; f++)
4451
+ u[f] && t.push(this.resolvePath(u[f]));
4452
+ } else if (typeof e[l] == "string") {
4453
+ let u = e[l].split(",");
4454
+ for (let f = 0; f < u.length; f++)
4455
+ u[f] && t.push(this.resolvePath(u[f]));
4456
+ }
4457
+ const o = new on(t.length, (l, u) => {
4458
+ if (o.isOK())
4459
+ try {
4460
+ typeof i == "function" && Reflect.apply(i, {}, u);
4461
+ } catch (f) {
4462
+ console.error(f.message, f);
4463
+ }
4464
+ else
4465
+ try {
4466
+ console.error(l), typeof i == "function" && Reflect.apply(i, {}, []);
4467
+ } catch (f) {
4468
+ console.error(f.message, f);
4469
+ }
4470
+ }), a = new st();
4471
+ for (let l = 0; l < t.length; l++) {
4472
+ const u = new ln(l, t[l], n, o);
4473
+ this.mount(a, u);
4474
+ }
4475
+ return this;
4476
+ }
4477
+ /**
4478
+ * 卸载
4479
+ */
4480
+ remove(...e) {
4481
+ let t = [], r = e.length - 1, n = {};
4482
+ typeof e[r] == "object" && (Object.assign(n, e[r]), r--);
4483
+ let i = null;
4484
+ typeof e[r] == "function" && (i = e[r], r--);
4485
+ for (let o = 0; o <= r; o++)
4486
+ if (Array.isArray(e[o])) {
4487
+ let a = e[o];
4488
+ for (let l = 0; l < a.length; l++)
4489
+ a[l] && t.push(this.resolvePath(a[l]));
4490
+ } else {
4491
+ let a = e[o].split(",");
4492
+ for (let l = 0; l < a.length; l++)
4493
+ a[l] && t.push(this.resolvePath(a[l]));
4494
+ }
4495
+ return t.forEach((o) => {
4496
+ this.unmount(o, n);
4497
+ }), typeof i == "function" && Reflect.apply(i, {}, []), this;
4498
+ }
4499
+ /**
4500
+ * 加载
4501
+ *
4502
+ * @param chain
4503
+ * @param taskNode
4504
+ */
4505
+ mount(e, t) {
4506
+ if (t.src === "exports") {
4507
+ e.post((n) => {
4508
+ t.progress.work(!0, t.index, "exports"), n.resolve();
4509
+ });
4510
+ return;
4511
+ } else if (t.src === "module") {
4512
+ e.post((n) => {
4513
+ t.progress.work(!0, t.index, "module"), n.resolve();
4514
+ });
4515
+ return;
4516
+ }
4517
+ if (this.isNaturePath(t.src)) {
4518
+ let n = t.params.jsPoint;
4519
+ n || (n = this.head), this.mountJS(e, t, n);
4520
+ return;
4521
+ } else if (this.isNaturePath(t.src)) {
4522
+ let n = t.params.cssPoint;
4523
+ n || (n = this.head), this.mountCSS(e, t, n);
4524
+ return;
4525
+ }
4526
+ let r = this.getFileNamePostfix(t.src);
4527
+ if (r === "js" || r.length === 0) {
4528
+ let n = t.params.jsPoint;
4529
+ n || (n = this.head), this.mountJS(e, t, n);
4530
+ return;
4531
+ } else if (r === "css") {
4532
+ let n = t.params.cssPoint;
4533
+ n || (n = this.head), this.mountCSS(e, t, n);
4534
+ return;
4535
+ }
4536
+ }
4537
+ /**
4538
+ * 加载css
4539
+ * @param chain
4540
+ * @param task
4541
+ * @param point
4542
+ */
4543
+ mountCSS(e, t, r) {
4544
+ e.post((n) => {
4545
+ const i = t.src, o = this.moduleManager.get(i);
4546
+ if (o && (o.status == L.Defined || o.status == L.Loaded) && o.exports) {
4547
+ o.type === tt.factory && typeof o.exports == "function" ? t.progress.work(!0, t.index, o.exports()) : t.progress.work(!0, t.index, o.exports), n.resolve();
4548
+ return;
4549
+ }
4550
+ const a = De(), l = a.createElement("link");
4551
+ if (Reflect.has(l, "onload"))
4552
+ l.onload = () => {
4553
+ l.onload = null, l.onerror = null, t.progress.work(!0, t.index, t.src), n.resolve();
4554
+ }, l.onerror = () => {
4555
+ try {
4556
+ r.removeChild(l);
4557
+ } catch (c) {
4558
+ console.error(c.message, c);
4559
+ }
4560
+ l.onload = null, l.onerror = null, t.progress.work(!1, t.index, null), n.reject();
4561
+ };
4562
+ else {
4563
+ const c = {
4564
+ //定义超时
4565
+ timeout: this.options.timeout ?? 3e3,
4566
+ //当前消耗时间
4567
+ time: 0,
4568
+ //定义成功回调函数
4569
+ success: () => {
4570
+ t.progress.work(!0, t.index, t.src), n.resolve();
4571
+ },
4572
+ //定义错误回调函数
4573
+ error: () => {
4574
+ try {
4575
+ r.removeChild(l);
4576
+ } catch (h) {
4577
+ console.error(h.message, h);
4578
+ }
4579
+ t.progress.work(!1, t.index, null), n.resolve();
4580
+ }
4581
+ };
4582
+ setTimeout(() => {
4583
+ Br(l, c);
4584
+ }, 1);
4585
+ }
4586
+ let f = a.getElementById(i);
4587
+ f && f.parentNode && f.parentNode.removeChild(f), l.rel = "stylesheet", l.type = "text/css", l.id = i, l.href = i, r.appendChild(l);
4588
+ });
4589
+ }
4590
+ /**
4591
+ * 加载js
4592
+ *
4593
+ * @param chain
4594
+ * @param task
4595
+ * @param point
4596
+ */
4597
+ mountJS(e, t, r) {
4598
+ e.post((n) => {
4599
+ const i = t.src;
4600
+ let o = this.moduleManager.get(i);
4601
+ if (o && (o.status == L.Defined || o.status == L.Loaded)) {
4602
+ if (o.exports) {
4603
+ o.type === tt.factory && typeof o.exports == "function" ? t.progress.work(!0, t.index, o.exports()) : t.progress.work(!0, t.index, o.exports), n.resolve();
4604
+ return;
4605
+ }
4606
+ if (document.querySelector(`script[src='${i}`)) {
4607
+ t.progress.work(!0, t.index, o.exports), n.resolve();
4608
+ return;
4609
+ }
4610
+ }
4611
+ o = {
4612
+ id: i,
4613
+ // ID
4614
+ src: i,
4615
+ // resource path
4616
+ status: L.Loading
4617
+ // 状态
4618
+ }, this.moduleManager.set(i, o);
4619
+ const l = De().createElement("script");
4620
+ if ("onload" in l)
4621
+ l.onload = () => {
4622
+ l.onload = null, l.onerror = null, o.status === L.Loading && (o.status = L.Loaded, t.progress.work(!0, t.index, i)), n.resolve();
4623
+ }, l.onerror = () => {
4624
+ try {
4625
+ r.removeChild(l);
4626
+ } catch (c) {
4627
+ console.error(c.message, c);
4628
+ }
4629
+ l.onload = null, l.onerror = null, this.moduleManager.remove(i), t.progress.work(!1, t.index, null), n.resolve();
4630
+ };
4631
+ else {
4632
+ const c = l;
4633
+ c.onreadystatechange = () => {
4634
+ /loaded|complete/.test(c.readyState) && (c.onreadystatechange = null, o.status == L.Loading && (o.status = L.Loaded, t.progress.work(!0, t.index, i)), n.resolve());
4635
+ };
4636
+ }
4637
+ l.defer = !0, l.src = i;
4638
+ const f = $();
4639
+ f.define = this.createDefine(o, t), r.appendChild(l);
4640
+ });
4641
+ }
4642
+ /**
4643
+ * 卸载资源
4644
+ */
4645
+ unmount(e, t = {}) {
4646
+ const r = De(), n = this.getFileNamePostfix(e);
4647
+ if (n === "js" || n.length === 0) {
4648
+ const i = r.querySelector(`script[src="${e}"]`);
4649
+ i && i.parentNode && i.parentNode.removeChild(i), this.moduleManager.remove(e);
4650
+ return;
4651
+ } else if (n === "css") {
4652
+ const i = r.querySelector(`style[href="${e}"]`);
4653
+ i && i.parentNode && i.parentNode.removeChild(i);
4654
+ return;
4655
+ }
4656
+ }
4657
+ /**
4658
+ * 去掉空元素
4659
+ */
4660
+ trimEmptyElement(e) {
4661
+ let t = [];
4662
+ for (let r = 0; r < e.length; r++) {
4663
+ if (e[r] === void 0 || e[r] === null)
4664
+ continue;
4665
+ const n = e[r].trim();
4666
+ n.length !== 0 && t.push(n);
4667
+ }
4668
+ return t;
4669
+ }
4670
+ /**
4671
+ * 创建define函数
4672
+ * @param module
4673
+ * @param task
4674
+ * @returns
4675
+ */
4676
+ createDefine(e, t) {
4677
+ const r = this, n = function(...i) {
4678
+ e.status = L.Defining;
4679
+ let o, a, l, u = i.length;
4680
+ u === 1 ? (l = i[0], o = void 0) : u === 2 ? (l = i[1], Array.isArray(i[0]) ? (a = r.trimEmptyElement(i[0]), o = void 0) : a = void 0) : (o = i[0], a = r.trimEmptyElement(i[1]), l = i[2]), o && (e.id = o, r.options.alias[o] = e.src), a && a.length > 0 ? r.ensure(a, (...f) => {
4681
+ const c = f.map((h) => h === "exports" ? ((!e.exports || typeof e.exports != "object") && (e.exports = {}), e.exports) : h === "module" ? e : h);
4682
+ if (typeof l == "function") {
4683
+ const h = Reflect.apply(l, e, c);
4684
+ h && typeof h == "object" && (e.exports = h);
4685
+ } else
4686
+ e.exports = l;
4687
+ e.status = L.Defined, t.progress.work(!0, t.index, e.exports);
4688
+ }) : (typeof l == "function" ? e.exports = Reflect.apply(l, e, []) : e.exports = l, e.status = L.Defined, t.progress.work(!0, t.index, e.exports));
4689
+ };
4690
+ return n.amd = !0, n;
4691
+ }
4692
+ /**
4693
+ * 解析路径
4694
+ * @param uri
4695
+ * @returns
4696
+ */
4697
+ resolvePath(e) {
4698
+ try {
4699
+ if (e === "exports" || e === "module" || this.isNaturePath(e))
4700
+ return e;
4701
+ e = this.parserPath(e, !0);
4702
+ let t = this.getFileNamePostfix(e);
4703
+ t = t.toLowerCase();
4704
+ let r = this.createSearch(this.query);
4705
+ return e.indexOf("?") == -1 ? (t !== "js" && t !== "css" && (e += ".js"), r.length > 0 && (e += `?${r}`)) : r.length > 0 && (e += `&${r}`), e;
4706
+ } catch (t) {
4707
+ throw console.error(`resolve path[${e}] fail`, t), t;
4708
+ }
4709
+ }
4710
+ /**
4711
+ * 创建search字符串
4712
+ */
4713
+ createSearch(e) {
4714
+ let t = "";
4715
+ if (e) {
4716
+ for (let r in e) {
4717
+ let n = `${e[r]}`;
4718
+ t += `${encodeURIComponent(r)}=${encodeURIComponent(n)}&`;
4719
+ }
4720
+ t.length > 0 && (t = t.substring(0, t.length - 1));
4721
+ }
4722
+ return t;
4723
+ }
4724
+ /**
4725
+ * 获取文件名后缀
4726
+ * @param name
4727
+ * @returns {string}
4728
+ */
4729
+ getFileNamePostfix(e) {
4730
+ let t = e.lastIndexOf("?");
4731
+ t == -1 && (t = e.length);
4732
+ let r = e.lastIndexOf(".", t);
4733
+ return r == -1 ? "" : e.substring(r + 1, t);
4734
+ }
4735
+ /**
4736
+ * 是否为不处理的路径
4737
+ * @param uri
4738
+ * @return
4739
+ */
4740
+ isNaturePath(e) {
4741
+ if (!this.options.nature)
4742
+ return !1;
4743
+ if (typeof this.options.nature == "function")
4744
+ return this.options.nature(e);
4745
+ const t = this.options.nature;
4746
+ if (t && Array.isArray(t))
4747
+ for (let r = 0; r < t.length; r++) {
4748
+ const n = t[r];
4749
+ if (e.indexOf(n) === 0)
4750
+ return !0;
4751
+ }
4752
+ return !1;
4753
+ }
4754
+ /**
4755
+ * 解析路径
4756
+ * @param uri
4757
+ * @param replace
4758
+ */
4759
+ parserPath(e, t) {
4760
+ if (e.indexOf("http://") == 0 || e.indexOf("https://") == 0 || e.indexOf("file:///") == 0)
4761
+ return e;
4762
+ if (e.indexOf("/") == 0)
4763
+ return `${ct()}${e.slice(1)}`;
4764
+ if (e.indexOf("./") == 0)
4765
+ return `${ct()}${e.slice(2)}`;
4766
+ if (e.indexOf("//") == 0)
4767
+ return `${$().location.protocol}${e}`;
4768
+ if (t) {
4769
+ let n = this.options.alias[e];
4770
+ if (!n) {
4771
+ let i = e.indexOf("/");
4772
+ if (i == -1)
4773
+ n = e;
4774
+ else {
4775
+ let o = e.slice(0, i), a = this.options.paths[o];
4776
+ a ? n = a + e.slice(i) : n = e;
4777
+ }
4778
+ }
4779
+ return this.parserPath(n, !1);
4780
+ }
4781
+ return `${ct()}${e}`;
4782
+ }
4783
+ }
4784
+ function Br(s, e) {
4785
+ let t = s.sheet, r = !1;
4786
+ if (e.isOldWebKit)
4787
+ t && (r = !0);
4788
+ else if (t)
4789
+ try {
4790
+ t.cssRules && (r = !0);
4791
+ } catch (n) {
4792
+ n.name === "NS_ERROR_DOM_SECURITY_ERR" && (r = !0);
4793
+ }
4794
+ setTimeout(() => {
4795
+ e.time += 20, r ? e.success() : e.timeout > e.timeout ? e.error() : Br(s, e);
4796
+ }, 20);
4797
+ }
4798
+ class on {
4799
+ /**
4800
+ * 回调函数
4801
+ */
4802
+ callback;
4803
+ /**
4804
+ * values
4805
+ */
4806
+ values;
4807
+ /**
4808
+ * 状态
4809
+ */
4810
+ status;
4811
+ /**
4812
+ * 工作量
4813
+ */
4814
+ size;
4815
+ /**
4816
+ * 最新的index
4817
+ */
4818
+ lastIndex;
4819
+ /**
4820
+ * 构造函数
4821
+ */
4822
+ constructor(e, t) {
4823
+ this.size = e, this.callback = t, this.status = !0, this.values = [], this.lastIndex = -1;
4824
+ }
4825
+ /**
4826
+ * work
4827
+ * @param status 工作状态(true/false)
4828
+ * @param index
4829
+ * @param value
4830
+ */
4831
+ work(e, t, r) {
4832
+ if (this.status = e, this.status === !0 && (this.lastIndex !== t && this.size--, this.lastIndex = t, this.values.push(r)), this.size === 0 || this.status === !1)
4833
+ try {
4834
+ Reflect.apply(this.callback, this, [this.status, this.values]);
4835
+ } catch (n) {
4836
+ console.error(n.message, n);
4837
+ }
4838
+ }
4839
+ /**
4840
+ * 判断进程是否为正常状态
4841
+ */
4842
+ isOK() {
4843
+ return this.status;
4844
+ }
4845
+ }
4846
+ class ln {
4847
+ /**
4848
+ * 索引
4849
+ */
4850
+ index;
4851
+ /**
4852
+ * 来源
4853
+ */
4854
+ src;
4855
+ /**
4856
+ * 参数
4857
+ */
4858
+ params;
4859
+ /**
4860
+ * 进程
4861
+ */
4862
+ progress;
4863
+ /**
4864
+ * 构造函数
4865
+ * @param index
4866
+ * @param src
4867
+ * @param params
4868
+ * @param progress
4869
+ */
4870
+ constructor(e, t, r, n) {
4871
+ this.index = e, this.src = t, this.params = r, this.progress = n;
4872
+ }
4873
+ }
4874
+ const kr = Symbol("fk"), Wr = Symbol("fbk"), zr = Symbol("fepk");
4875
+ function Rn(s = {}) {
4876
+ const e = new Os(s), t = new Qt(), r = new Zt(), n = new vr(), i = {
4877
+ /**
4878
+ * 返回router
4879
+ */
4880
+ get router() {
4881
+ return e;
4882
+ },
4883
+ /**
4884
+ * 返回全局Bus
4885
+ */
4886
+ get bus() {
4887
+ return t;
4888
+ },
4889
+ /**
4890
+ * 返回Bus类型
4891
+ */
4892
+ get Bus() {
4893
+ return Qt;
4894
+ },
4895
+ /**
4896
+ * 返回全局event proxy
4897
+ */
4898
+ get EventProxy() {
4899
+ return Zt;
4900
+ },
4901
+ /**
4902
+ * 返回event proxy类型
4903
+ */
4904
+ get eventproxy() {
4905
+ return r;
4906
+ },
4907
+ /**
4908
+ * 返回event chain类型
4909
+ */
4910
+ get EventChain() {
4911
+ return st;
4912
+ },
4913
+ /**
4914
+ * 返回Require构造函数
4915
+ */
4916
+ get Require() {
4917
+ return vr;
4918
+ },
4919
+ /**
4920
+ * 返回require
4921
+ */
4922
+ get require() {
4923
+ return n;
4924
+ },
4925
+ /**
4926
+ * 返回extend
4927
+ */
4928
+ get extend() {
4929
+ return T;
4930
+ },
4931
+ /**
4932
+ * 返回clone
4933
+ */
4934
+ get clone() {
4935
+ return Nt;
4936
+ },
4937
+ /**
4938
+ * 判断是否为es模块
4939
+ */
4940
+ get isESModule() {
4941
+ return br;
4942
+ },
4943
+ /**
4944
+ * 安装
4945
+ */
4946
+ install(o) {
4947
+ o.provide(lt, e), o.provide(kr, i), o.provide(Wr, t), o.provide(zr, r), o.component(Ms, Ot), o.component(Is, sn), Reflect.defineProperty(o.config.globalProperties, "$fox", {
4948
+ get() {
4949
+ return i;
4950
+ }
4951
+ }), Reflect.defineProperty(o.config.globalProperties, "$router", {
4952
+ get() {
4953
+ return e;
4954
+ }
4955
+ }), Reflect.defineProperty(o.config.globalProperties, "$bus", {
4956
+ get() {
4957
+ return t;
4958
+ }
4959
+ }), Reflect.defineProperty(o.config.globalProperties, "$bus", {
4960
+ get() {
4961
+ return t;
4962
+ }
4963
+ }), Reflect.defineProperty(o.config.globalProperties, "$eventProxy", {
4964
+ get() {
4965
+ return r;
4966
+ }
4967
+ }), o.config.globalProperties.$fox_on = function(a, l, u = !1) {
4968
+ r.on(a, l, u);
4969
+ }, o.config.globalProperties.$fox_off = function(a, l) {
4970
+ r.off(a, l);
4971
+ }, o.config.globalProperties.$fox_once = function(a, l) {
4972
+ r.once(a, l);
4973
+ }, o.config.globalProperties.$fox_all = function(...a) {
4974
+ let l = r;
4975
+ Reflect.apply(l.all, l, a);
4976
+ }, o.config.globalProperties.$fox_trigger = function(a, ...l) {
4977
+ let u = r;
4978
+ Reflect.apply(u.trigger, u, [a, ...l]);
4979
+ }, o.config.globalProperties.$fox_emit = function(a, ...l) {
4980
+ let u = r;
4981
+ Reflect.apply(u.trigger, u, [a, ...l]);
4982
+ }, o.mixin({
4983
+ //计算属性
4984
+ computed: {
4985
+ //获取当前route
4986
+ $route() {
4987
+ return Ut(this);
4988
+ }
4989
+ }
4990
+ }), e.init();
4991
+ }
4992
+ };
4993
+ return i;
4994
+ }
4995
+ function Jr(s) {
4996
+ return s ? s.$router : G(lt);
4997
+ }
4998
+ function Sn(s) {
4999
+ return s || (s = Mt()?.proxy ?? void 0), s ? Ut(s) : null;
5000
+ }
5001
+ function Pn(s) {
5002
+ return s ? s.$fox : G(kr);
5003
+ }
5004
+ function Cn(s) {
5005
+ return s ? s.$bus : G(Wr);
5006
+ }
5007
+ function An(s) {
5008
+ return s ? s.$eventProxy : G(zr);
5009
+ }
5010
+ function En(s) {
5011
+ const e = Jr(), t = (r, n, i) => {
5012
+ try {
5013
+ Reflect.apply(s, {}, [r, n]);
5014
+ } catch (o) {
5015
+ console.error(o);
5016
+ }
5017
+ i();
5018
+ };
5019
+ e.beforeEach(t), ot(() => {
5020
+ e.removeBeforeEach(t);
5021
+ });
5022
+ }
5023
+ function Fn(s) {
5024
+ const e = Jr(), t = (r, n, i) => {
5025
+ try {
5026
+ Reflect.apply(s, {}, [r, n]);
5027
+ } catch (o) {
5028
+ console.error(o);
5029
+ }
5030
+ i();
5031
+ };
5032
+ e.afterEach(t), ot(() => {
5033
+ e.removeAfterEach(t);
5034
+ });
5035
+ }
5036
+ export {
5037
+ Qt as Bus,
5038
+ st as EventChain,
5039
+ Zt as EventProxy,
5040
+ q as OperationType,
5041
+ S as Route,
5042
+ Nt as clone,
5043
+ Rn as createFox,
5044
+ qs as createMemoryHistory,
5045
+ $s as createWebHashHistory,
5046
+ xn as createWebHistory,
5047
+ gn as deleteContextValue,
5048
+ T as extend,
5049
+ Wr as foxBusKey,
5050
+ zr as foxEventProxyKey,
5051
+ kr as foxKey,
5052
+ Fr as injectContextValue,
5053
+ un as isArray,
5054
+ hn as isDate,
5055
+ br as isESModule,
5056
+ zt as isEqual,
5057
+ x as isFunction,
5058
+ fn as isMap,
5059
+ Yr as isNil,
5060
+ Xr as isObject,
5061
+ es as isPlainObject,
5062
+ pn as isPromise,
5063
+ cn as isSet,
5064
+ yn as isString,
5065
+ dn as isSymbol,
5066
+ Fn as onAfterRouteUpdate,
5067
+ En as onBeforeRouteUpdate,
5068
+ wn as onFoxActivated,
5069
+ bn as onFoxInactivated,
5070
+ vn as provideContextValue,
5071
+ ae as sessionKey,
5072
+ xr as toBoolean,
5073
+ mn as toNumber,
5074
+ It as toTypeString,
5075
+ Wt as typeOf,
5076
+ Cn as useBus,
5077
+ An as useEventProxy,
5078
+ Pn as useFox,
5079
+ Sn as useRoute,
5080
+ Jr as useRouter
5081
+ };