@airpower/web 1.8.3 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, createElementBlock, openBlock, createElementVNode, computed, createBlock, unref, mergeProps, toHandlers, withCtx, renderSlot, resolveComponent, normalizeClass, createVNode, createTextVNode, toDisplayString, ref, withModifiers, onMounted, watch, resolveDirective, Transition, normalizeStyle, withDirectives, createCommentVNode, nextTick, inject, shallowRef, shallowReactive, reactive, h, provide, getCurrentInstance, watchEffect, Fragment, renderList, vShow, useSlots, createSlots, createApp, onUpdated, mergeModels, useModel, withKeys } from "vue";
2
2
  import ElementPlus, { ElLink, ElButton, ElMessage, ElMessageBox, ElIcon, ElEmpty, ElFormItem, ElSubMenu, ElMenuItem, ElMenu, ElImage, ElUpload, ElPagination, ElPopover, ElRadioGroup, ElRadioButton, ElInput, ElProgress, ElTabPane, ElTabs, ElCheckTag, ElSelect, ElOption, ElTable, ElTableColumn, ElTree } from "element-plus";
3
3
  import axios from "axios";
4
- /*! Element Plus Icons Vue v2.3.1 */
5
- var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4
+ /*! Element Plus Icons Vue v2.3.2 */
5
+ var _sfc_main6 = /* @__PURE__ */ defineComponent({
6
6
  name: "ArrowDown",
7
7
  __name: "arrow-down",
8
8
  setup(__props) {
@@ -12,13 +12,12 @@ var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
12
12
  }, [
13
13
  createElementVNode("path", {
14
14
  fill: "currentColor",
15
- d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
15
+ d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"
16
16
  })
17
17
  ]));
18
18
  }
19
- });
20
- var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
21
- var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
19
+ }), arrow_down_default = _sfc_main6;
20
+ var _sfc_main10 = /* @__PURE__ */ defineComponent({
22
21
  name: "ArrowRight",
23
22
  __name: "arrow-right",
24
23
  setup(__props) {
@@ -28,13 +27,12 @@ var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
28
27
  }, [
29
28
  createElementVNode("path", {
30
29
  fill: "currentColor",
31
- d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
30
+ d: "M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
32
31
  })
33
32
  ]));
34
33
  }
35
- });
36
- var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
37
- var bottom_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
34
+ }), arrow_right_default = _sfc_main10;
35
+ var _sfc_main21 = /* @__PURE__ */ defineComponent({
38
36
  name: "BottomRight",
39
37
  __name: "bottom-right",
40
38
  setup(__props) {
@@ -52,9 +50,8 @@ var bottom_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
52
50
  })
53
51
  ]));
54
52
  }
55
- });
56
- var bottom_right_default = bottom_right_vue_vue_type_script_setup_true_lang_default;
57
- var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
53
+ }), bottom_right_default = _sfc_main21;
54
+ var _sfc_main49 = /* @__PURE__ */ defineComponent({
58
55
  name: "CircleCheck",
59
56
  __name: "circle-check",
60
57
  setup(__props) {
@@ -68,13 +65,12 @@ var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
68
65
  }),
69
66
  createElementVNode("path", {
70
67
  fill: "currentColor",
71
- d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
68
+ d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z"
72
69
  })
73
70
  ]));
74
71
  }
75
- });
76
- var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
77
- var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
72
+ }), circle_check_default = _sfc_main49;
73
+ var _sfc_main50 = /* @__PURE__ */ defineComponent({
78
74
  name: "CircleCloseFilled",
79
75
  __name: "circle-close-filled",
80
76
  setup(__props) {
@@ -88,9 +84,8 @@ var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE
88
84
  })
89
85
  ]));
90
86
  }
91
- });
92
- var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
93
- var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
87
+ }), circle_close_filled_default = _sfc_main50;
88
+ var _sfc_main51 = /* @__PURE__ */ defineComponent({
94
89
  name: "CircleClose",
95
90
  __name: "circle-close",
96
91
  setup(__props) {
@@ -108,9 +103,8 @@ var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
108
103
  })
109
104
  ]));
110
105
  }
111
- });
112
- var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
113
- var circle_plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
106
+ }), circle_close_default = _sfc_main51;
107
+ var _sfc_main53 = /* @__PURE__ */ defineComponent({
114
108
  name: "CirclePlus",
115
109
  __name: "circle-plus",
116
110
  setup(__props) {
@@ -132,9 +126,8 @@ var circle_plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
132
126
  })
133
127
  ]));
134
128
  }
135
- });
136
- var circle_plus_default = circle_plus_vue_vue_type_script_setup_true_lang_default;
137
- var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
129
+ }), circle_plus_default = _sfc_main53;
130
+ var _sfc_main54 = /* @__PURE__ */ defineComponent({
138
131
  name: "Clock",
139
132
  __name: "clock",
140
133
  setup(__props) {
@@ -156,9 +149,8 @@ var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
156
149
  })
157
150
  ]));
158
151
  }
159
- });
160
- var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
161
- var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
152
+ }), clock_default = _sfc_main54;
153
+ var _sfc_main56 = /* @__PURE__ */ defineComponent({
162
154
  name: "Close",
163
155
  __name: "close",
164
156
  setup(__props) {
@@ -172,9 +164,8 @@ var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
172
164
  })
173
165
  ]));
174
166
  }
175
- });
176
- var close_default = close_vue_vue_type_script_setup_true_lang_default;
177
- var document_copy_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
167
+ }), close_default = _sfc_main56;
168
+ var _sfc_main87 = /* @__PURE__ */ defineComponent({
178
169
  name: "DocumentCopy",
179
170
  __name: "document-copy",
180
171
  setup(__props) {
@@ -188,9 +179,8 @@ var document_copy_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
188
179
  })
189
180
  ]));
190
181
  }
191
- });
192
- var document_copy_default = document_copy_vue_vue_type_script_setup_true_lang_default;
193
- var edit_pen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
182
+ }), document_copy_default = _sfc_main87;
183
+ var _sfc_main93 = /* @__PURE__ */ defineComponent({
194
184
  name: "EditPen",
195
185
  __name: "edit-pen",
196
186
  setup(__props) {
@@ -200,13 +190,12 @@ var edit_pen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
200
190
  }, [
201
191
  createElementVNode("path", {
202
192
  fill: "currentColor",
203
- d: "m199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112-56.64 98.112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64h-448z"
193
+ d: "m199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64z"
204
194
  })
205
195
  ]));
206
196
  }
207
- });
208
- var edit_pen_default = edit_pen_vue_vue_type_script_setup_true_lang_default;
209
- var filter_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
197
+ }), edit_pen_default = _sfc_main93;
198
+ var _sfc_main103 = /* @__PURE__ */ defineComponent({
210
199
  name: "Filter",
211
200
  __name: "filter",
212
201
  setup(__props) {
@@ -220,9 +209,8 @@ var filter_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
220
209
  })
221
210
  ]));
222
211
  }
223
- });
224
- var filter_default = filter_vue_vue_type_script_setup_true_lang_default;
225
- var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
212
+ }), filter_default = _sfc_main103;
213
+ var _sfc_main118 = /* @__PURE__ */ defineComponent({
226
214
  name: "FullScreen",
227
215
  __name: "full-screen",
228
216
  setup(__props) {
@@ -232,13 +220,12 @@ var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
232
220
  }, [
233
221
  createElementVNode("path", {
234
222
  fill: "currentColor",
235
- d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
223
+ d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
236
224
  })
237
225
  ]));
238
226
  }
239
- });
240
- var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
241
- var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
227
+ }), full_screen_default = _sfc_main118;
228
+ var _sfc_main133 = /* @__PURE__ */ defineComponent({
242
229
  name: "Hide",
243
230
  __name: "hide",
244
231
  setup(__props) {
@@ -248,17 +235,16 @@ var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
248
235
  }, [
249
236
  createElementVNode("path", {
250
237
  fill: "currentColor",
251
- d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
238
+ d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176"
252
239
  }),
253
240
  createElementVNode("path", {
254
241
  fill: "currentColor",
255
- d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
242
+ d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48"
256
243
  })
257
244
  ]));
258
245
  }
259
- });
260
- var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
261
- var iphone_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
246
+ }), hide_default = _sfc_main133;
247
+ var _sfc_main144 = /* @__PURE__ */ defineComponent({
262
248
  name: "Iphone",
263
249
  __name: "iphone",
264
250
  setup(__props) {
@@ -272,9 +258,8 @@ var iphone_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
272
258
  })
273
259
  ]));
274
260
  }
275
- });
276
- var iphone_default = iphone_vue_vue_type_script_setup_true_lang_default;
277
- var remove_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
261
+ }), iphone_default = _sfc_main144;
262
+ var _sfc_main220 = /* @__PURE__ */ defineComponent({
278
263
  name: "Remove",
279
264
  __name: "remove",
280
265
  setup(__props) {
@@ -292,9 +277,8 @@ var remove_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
292
277
  })
293
278
  ]));
294
279
  }
295
- });
296
- var remove_default = remove_vue_vue_type_script_setup_true_lang_default;
297
- var set_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
280
+ }), remove_default = _sfc_main220;
281
+ var _sfc_main230 = /* @__PURE__ */ defineComponent({
298
282
  name: "SetUp",
299
283
  __name: "set-up",
300
284
  setup(__props) {
@@ -320,9 +304,8 @@ var set_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
320
304
  })
321
305
  ]));
322
306
  }
323
- });
324
- var set_up_default = set_up_vue_vue_type_script_setup_true_lang_default;
325
- var switch_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
307
+ }), set_up_default = _sfc_main230;
308
+ var _sfc_main256 = /* @__PURE__ */ defineComponent({
326
309
  name: "SwitchButton",
327
310
  __name: "switch-button",
328
311
  setup(__props) {
@@ -332,7 +315,7 @@ var switch_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
332
315
  }, [
333
316
  createElementVNode("path", {
334
317
  fill: "currentColor",
335
- d: "M352 159.872V230.4a352 352 0 1 0 320 0v-70.528A416.128 416.128 0 0 1 512 960a416 416 0 0 1-160-800.128z"
318
+ d: "M352 159.872V230.4a352 352 0 1 0 320 0v-70.528A416.128 416.128 0 0 1 512 960a416 416 0 0 1-160-800.128"
336
319
  }),
337
320
  createElementVNode("path", {
338
321
  fill: "currentColor",
@@ -340,9 +323,8 @@ var switch_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
340
323
  })
341
324
  ]));
342
325
  }
343
- });
344
- var switch_button_default = switch_button_vue_vue_type_script_setup_true_lang_default;
345
- var top_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
326
+ }), switch_button_default = _sfc_main256;
327
+ var _sfc_main266 = /* @__PURE__ */ defineComponent({
346
328
  name: "TopRight",
347
329
  __name: "top-right",
348
330
  setup(__props) {
@@ -356,13 +338,12 @@ var top_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
356
338
  }),
357
339
  createElementVNode("path", {
358
340
  fill: "currentColor",
359
- d: "M777.344 201.344a32 32 0 0 1 45.312 45.312l-544 544a32 32 0 0 1-45.312-45.312l544-544z"
341
+ d: "M777.344 201.344a32 32 0 0 1 45.312 45.312l-544 544a32 32 0 0 1-45.312-45.312z"
360
342
  })
361
343
  ]));
362
344
  }
363
- });
364
- var top_right_default = top_right_vue_vue_type_script_setup_true_lang_default;
365
- var upload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
345
+ }), top_right_default = _sfc_main266;
346
+ var _sfc_main275 = /* @__PURE__ */ defineComponent({
366
347
  name: "Upload",
367
348
  __name: "upload",
368
349
  setup(__props) {
@@ -376,9 +357,8 @@ var upload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
376
357
  })
377
358
  ]));
378
359
  }
379
- });
380
- var upload_default = upload_vue_vue_type_script_setup_true_lang_default;
381
- var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
360
+ }), upload_default = _sfc_main275;
361
+ var _sfc_main283 = /* @__PURE__ */ defineComponent({
382
362
  name: "View",
383
363
  __name: "view",
384
364
  setup(__props) {
@@ -388,13 +368,12 @@ var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
388
368
  }, [
389
369
  createElementVNode("path", {
390
370
  fill: "currentColor",
391
- d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
371
+ d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
392
372
  })
393
373
  ]));
394
374
  }
395
- });
396
- var view_default = view_vue_vue_type_script_setup_true_lang_default;
397
- var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
375
+ }), view_default = _sfc_main283;
376
+ var _sfc_main287 = /* @__PURE__ */ defineComponent({
398
377
  name: "WarningFilled",
399
378
  __name: "warning-filled",
400
379
  setup(__props) {
@@ -404,12 +383,11 @@ var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
404
383
  }, [
405
384
  createElementVNode("path", {
406
385
  fill: "currentColor",
407
- d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
386
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
408
387
  })
409
388
  ]));
410
389
  }
411
- });
412
- var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
390
+ }), warning_filled_default = _sfc_main287;
413
391
  var zhCn = {
414
392
  name: "zh-cn",
415
393
  el: {
@@ -421,7 +399,10 @@ var zhCn = {
421
399
  clear: "清空",
422
400
  defaultLabel: "颜色选择器",
423
401
  description: "当前颜色 {color},按 Enter 键选择新颜色",
424
- alphaLabel: "选择透明度的值"
402
+ alphaLabel: "选择透明度的值",
403
+ alphaDescription: "透明度 {alpha}, 当前颜色 {color}",
404
+ hueLabel: "选择色相值",
405
+ hueDescription: "色相 {hue}, 当前颜色 {color}"
425
406
  },
426
407
  datepicker: {
427
408
  now: "此刻",
@@ -499,12 +480,12 @@ var zhCn = {
499
480
  noData: "无数据",
500
481
  placeholder: "请选择"
501
482
  },
502
- dropdown: {
503
- toggleDropdown: "切换下拉选项"
504
- },
505
483
  mention: {
506
484
  loading: "加载中"
507
485
  },
486
+ dropdown: {
487
+ toggleDropdown: "切换下拉选项"
488
+ },
508
489
  cascader: {
509
490
  noMatch: "无匹配数据",
510
491
  loading: "加载中",
@@ -558,7 +539,8 @@ var zhCn = {
558
539
  tour: {
559
540
  next: "下一步",
560
541
  previous: "上一步",
561
- finish: "结束导览"
542
+ finish: "结束导览",
543
+ close: "关闭此对话框"
562
544
  },
563
545
  tree: {
564
546
  emptyText: "暂无数据"
@@ -2222,6 +2204,9 @@ class WebI18n extends I18n {
2222
2204
  Operation = "操作";
2223
2205
  }
2224
2206
  class FeedbackUtil {
2207
+ /**
2208
+ * ### 默认吐司时间
2209
+ */
2225
2210
  static defaultToastDuration = 3e3;
2226
2211
  /**
2227
2212
  * ### 警告吐司
@@ -10412,7 +10397,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10412
10397
  };
10413
10398
  }
10414
10399
  });
10415
- const ADialog = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-937b915a"]]);
10400
+ const ADialog = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-a273d305"]]);
10416
10401
  const _imports_0 = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20120%20120'%20height='120px'%20width='120px'%3e%3ctitle%3eError!%3c/title%3e%3cdefs%3e%3clinearGradient%20id='linearGradient-1'%20y2='100%25'%20x2='50%25'%20y1='0%25'%20x1='50%25'%3e%3cstop%20offset='0%25'%20stop-color='%23F0F0F0'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%23DBDBDB'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20id='linearGradient-2'%20y2='100%25'%20x2='50%25'%20y1='0%25'%20x1='50%25'%3e%3cstop%20offset='0%25'%20stop-color='%23F8F8F8'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%23E7E7E7'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20fill-rule='evenodd'%20fill='none'%20stroke-width='1'%20stroke='none'%20id='调整'%3e%3cg%20transform='translate(-1053.000000,%20-221.000000)'%20id='切图备份'%3e%3cg%20transform='translate(932.000000,%20160.000000)'%20id='编组-4备份'%3e%3crect%20height='242'%20width='362'%20y='0'%20x='0'%20id='矩形备份-12'%3e%3c/rect%3e%3cg%20transform='translate(136.000000,%2079.000000)'%20id='编组-3'%3e%3cpath%20transform='translate(46.359054,%2079.256608)%20rotate(5.000000)%20translate(-46.359054,%20-79.256608)'%20fill-rule='nonzero'%20fill='%23000000'%20fill-opacity='0.05'%20id='路径'%20d='M78.9503255,77.036952%20C80.7447866,78.31027%2081.9959007,76.7673533%2085.7661446,77.8817054%20C89.5363884,78.9960574%2091.4884881,82.6947131%2091.522496,85.1606995%20C91.5575653,87.7469779%2088.3737349,91.1798155%2084.3278614,92.4273981%20L83.6415666,92.6253395%20C83.4088898,92.6879452%2083.1723834,92.7471309%2082.9322942,92.8027612%20L82.5695042,92.8835232%20L81.8634446,93.0223861%20L81.139799,93.1407814%20C80.1637846,93.2846838%2079.1442979,93.3721281%2078.0950342,93.3956023%20C75.9965069,93.4425505%2068.8878619,94.2183775%2067.1245946,93.7983804%20L66.4740485,93.6313381%20C62.5295405,92.5430563%2060.3115963,89.2695424%2060.2769435,86.7350564%20C60.2529407,84.979509%2059.6273739,84.2172683%2058.6260269,83.6918887%20C57.9584622,83.3416357%2056.4347344,83.267836%2054.0548435,83.4704898%20L42.0469504,85.5974769%20L39.1325463,86.0909149%20L34.4293694,86.9428463%20L26.1062059,88.4836966%20L24.0212699,88.8536895%20L21.5060941,89.2776678%20L19.5716508,89.5798453%20L18.1687813,89.7815566%20L17.2573172,89.9029719%20L15.9270511,90.0639183%20L15.0655604,90.1561715%20L14.2249389,90.235648%20L13.4056894,90.3017124%20L12.6083146,90.3537293%20L11.8333172,90.3910635%20L11.0812002,90.4130796%20L10.3524662,90.4191421%20L9.99702488,90.4159922%20L9.6476179,90.4086158%20L8.9671582,90.3808652%20L8.31158981,90.3352552%20L7.68141548,90.2711501%20L7.37600821,90.2319635%20L7.07713799,90.1879148%20L6.4992601,90.0849139%20C3.48853739,89.4817378%201.62564866,88.0081194%201.25381316,85.2303229%20C0.801929733,81.8545285%203.00529064,79.5331796%207.03213462,77.7476042%20L7.38173895,77.5958549%20L8.03316219,77.3290875%20L8.36937183,77.1986717%20L9.0623629,76.9435113%20L9.41897462,76.818661%20L10.1520061,76.5741553%20L10.5282563,76.4543942%20L11.2998009,76.2195908%20L12.0961723,75.9907265%20L12.9166918,75.7673778%20L14.1912636,75.4417709%20L15.5163499,75.1261932%20L16.8896598,74.8192161%20L18.3089021,74.5194109%20L19.7717859,74.225349%20L21.7862243,73.8397311%20L24.9338368,73.2682784%20L35.7036078,71.3924087%20L38.0697485,70.961615%20L40.4001071,70.5174049%20L42.1202482,70.1794568%20L62.0307178,66.6498183%20L65.0900686,66.0533163%20L66.5625628,65.7806006%20L67.9943499,65.5286929%20L69.3834903,65.3004315%20L70.7280443,65.0986548%20L71.5986856,64.9802523%20L72.4480738,64.8757232%20L73.2756344,64.7859085%20L74.0807926,64.7116492%20L74.8629736,64.6537863%20L75.6216027,64.6131608%20L75.9919058,64.5995748%20L76.3561053,64.5906136%20C76.8892781,72.0392938%2077.7540182,76.1880733%2078.9503255,77.036952%20Z'%3e%3c/path%3e%3cg%20transform='translate(6.000000,%200.000000)'%20id='编组-10备份'%3e%3cpath%20fill='url(%23linearGradient-1)'%20id='矩形'%20d='M11.6746079,1.47362958%20L53.6746079,0.334338358%20C60.299588,0.154629272%2065.8158784,5.37955374%2065.9955875,12.0045338%20C65.998529,12.1129729%2066,12.2214469%2066,12.3299259%20L66,65.5263991%20C66,71.9413707%2060.954673,77.2218847%2054.5463537,77.513955%20L12.5463537,79.4281781%20C5.92580938,79.7299209%200.314186877,74.6075202%200.0124440516,67.9869759%20C0.00414909285,67.804976%203.57502537e-15,67.6228109%200,67.4406222%20L0,13.4692171%20C2.75660975e-15,6.96853523%205.17631638,1.64990212%2011.6746079,1.47362958%20Z'%3e%3c/path%3e%3cpath%20fill='url(%23linearGradient-2)'%20id='矩形'%20d='M12.7609095,5.467978%20L58.7609095,4.24552869%20C63.729718,4.11348268%2067.8647776,8.03445339%2067.9968236,13.0032619%20C67.9989411,13.0829411%2068,13.162645%2068,13.2423523%20L68,68.5352299%20C68,73.3496761%2064.2111128,77.3115159%2059.4014587,77.5262716%20L13.4014587,79.5802158%20C8.43584344,79.8019353%204.23067779,75.956248%204.00895829,70.9906328%20C4.00298684,70.8568965%204,70.7230436%204,70.5891741%20L4,14.4648017%20C4,9.58736567%207.88519495,5.59755004%2012.7609095,5.467978%20Z'%3e%3c/path%3e%3cpath%20fill='%23FFFFFF'%20id='矩形'%20d='M13.8370136,9.3631501%20L57.8370136,8.16747558%20C61.1494993,8.07746071%2063.907771,10.6897894%2063.9977859,14.0022751%20C63.9992619,14.0565914%2064,14.1109252%2064,14.1652615%20L64,67.7108429%20C64,70.9181402%2061.4776231,73.5583119%2058.2736637,73.7045987%20L14.2736637,75.7135563%20C10.9634038,75.8646965%208.1573845,73.3037241%208.00624423,69.9934642%20C8.00208195,69.9023023%208,69.8110573%208,69.7198005%20L8,15.360936%20C8,12.1107078%2010.5879849,9.45144057%2013.8370136,9.3631501%20Z'%3e%3c/path%3e%3cg%20fill-rule='nonzero'%20transform='translate(14.000000,%2015.785515)'%20id='编组-2'%3e%3cg%20transform='translate(0.771287,%200.305710)'%20id='编组-8'%3e%3cpath%20fill='%23EDEDED'%20id='路径'%20d='M40.4372184,4.26435671%20L19.0202079,5.5638691%20C18.7375688,5.56428852%2018.4762266,5.39967604%2018.3347903,5.13212095%20C18.1933541,4.86456586%2018.1933541,4.53479694%2018.3347903,4.26724186%20C18.4762266,3.99968677%2018.7375688,3.83507429%2019.0202079,3.83551562%20L40.4372184,2.53602162%20C40.7198575,2.53558381%2040.9811998,2.70019629%2041.122636,2.96775138%20C41.2640722,3.23530646%2041.2640722,3.56507538%2041.122636,3.83263047%20C40.9811998,4.10018556%2040.7198575,4.26479804%2040.4372184,4.26435671%20Z'%3e%3c/path%3e%3cpath%20fill='%23EDEDED'%20id='路径'%20d='M32.2585021,10.8846094%20L20.7676233,11.3933544%20C20.2903339,11.3933544%2019.9034143,11.0064348%2019.9034143,10.5291454%20C19.9034143,10.051856%2020.2903339,9.66493642%2020.7676233,9.66493642%20L32.2585021,9.1561915%20C32.7357915,9.1561915%2033.122711,9.54311103%2033.122711,10.0204005%20C33.122711,10.4976899%2032.7357915,10.8846094%2032.2585021,10.8846094%20Z'%3e%3c/path%3e%3cpath%20fill='%23EDEDED'%20id='路径'%20d='M1.04210395,27.3511696%20C0.592880621,27.3511696%200.228713161,26.964269%200.228713161,26.487003%20C0.228713161,26.0097369%200.592880621,25.6228363%201.04210395,25.6228363%20L40.4153224,23.6228363%20C40.8645457,23.6228363%2041.2287132,24.0097369%2041.2287132,24.487003%20C41.2287132,24.964269%2040.8645457,25.3511696%2040.4153224,25.3511696%20L1.04210395,27.3511696%20Z'%3e%3c/path%3e%3cpath%20fill='%23EDEDED'%20id='路径'%20d='M1.04214218,32.7659223%20C0.59289774,32.7659223%200.228713161,32.3790028%200.228713161,31.9017134%20C0.228713161,31.4244239%200.59289774,31.0375044%201.04214218,31.0375044%20L40.4152841,29.0375044%20C40.8645286,29.0375044%2041.2287132,29.4244239%2041.2287132,29.9017134%20C41.2287132,30.3790028%2040.8645286,30.7659223%2040.4152841,30.7659223%20L1.04214218,32.7659223%20Z'%3e%3c/path%3e%3cpath%20fill='%23F3F3F3'%20id='路径'%20d='M40.4153454,41.7493146%20L1.04208091,43.5172686%20C0.592870304,43.5172686%200.228713161,43.130368%200.228713161,42.6531019%20C0.228713161,42.1758359%200.592870304,41.7889353%201.04208091,41.7889353%20L40.4153454,40.0209813%20C40.864556,40.0209813%2041.2287132,40.4078819%2041.2287132,40.8851479%20C41.2287132,41.362414%2040.864556,41.7493146%2040.4153454,41.7493146%20Z'%3e%3c/path%3e%3cpath%20fill='%23F3F3F3'%20id='路径'%20d='M40.416976,47.0833184%20L1.04045036,48.9320266%20C0.592140282,48.9320266%200.228713161,48.5451071%200.228713161,48.0678176%20C0.228713161,47.5905282%200.592140282,47.2036087%201.04045036,47.2036087%20L40.416976,45.3549004%20C40.865286,45.3549004%2041.2287132,45.74182%2041.2287132,46.2191094%20C41.2287132,46.6963988%2040.865286,47.0833184%2040.416976,47.0833184%20Z'%3e%3c/path%3e%3cpath%20fill='%23F3F3F3'%20id='路径'%20d='M16.4327002,8.21559882%20C16.4350664,10.0714965%2015.8067728,11.8731271%2014.6508331,13.3250793%20C14.2769419,13.7976635%2013.8512753,14.2268655%2013.3817996,14.6046526%20C12.1006077,15.6439682%2010.5352339,16.2718379%208.8909558,16.4059251%20C8.66711861,16.4253126%208.44146781,16.4341252%208.21409857,16.4341252%20C7.76355055,16.4341252%207.31376488,16.39709%206.86933407,16.3230983%20C6.71253347,16.2984233%206.55917503,16.2684503%206.40581659,16.2332109%20C6.13890161,16.1738065%205.87533062,16.1002655%205.61621767,16.0128987%20C4.77590582,15.7332218%203.98659247,15.3189294%203.27910182,14.7862004%20C3.09054454,14.6452006%202.90904606,14.4953883%202.7327963,14.3367635%20C2.51723197,14.1455597%202.31300966,13.9419388%202.12117087,13.7269393%20C2.07005844,13.6705394%202.01893367,13.612377%201.96962075,13.5542146%20C-0.394225598,10.7875478%20-0.656607248,6.79555522%201.32477819,3.74328946%20C3.30616363,0.691023693%207.05925328,-0.694316331%2010.5485632,0.338606971%20C14.0378732,1.37153027%2016.4320793,4.57662407%2016.4327002,8.2156094%20L16.4327002,8.21559882%20Z'%3e%3c/path%3e%3ccircle%20r='3.36794077'%20cy='7.65245969'%20cx='7.92805755'%20fill='%23FFDCD5'%20id='椭圆形'%3e%3c/circle%3e%3cpath%20fill='%232F2E41'%20id='路径'%20d='M11.6774786,6.01071259%20C11.6927471,5.70976862%2011.6078236,5.4122525%2011.4359953,5.16471375%20L11.3143935,4.99198898%20C10.8754911,4.14599014%2010.1511275,3.38459119%209.620658,2.82764195%20C9.22228772,2.40993003%208.82400909,2.2090053%208.44147133,2.22839278%20C8.16311832,2.24826956%207.90395542,2.37753892%207.72063626,2.58794228%20C6.69132071,2.52507974%205.72254614,3.07797323%205.25313965,3.99617785%20C3.64047198,4.84745537%204.1216303,7.36078573%204.12688078,7.3872232%20L4.51647206,8.0411098%20L4.5605345,7.95827241%20C4.5605345,7.95650991%204.56578321,7.94945992%204.57284025,7.93535994%20C4.64865938,7.79964763%205.06105208,7.04529867%205.33954433,6.56766182%20C5.44119161,6.40474511%205.57637919,6.26535169%205.73610628,6.15876238%20C5.99694053,5.98054184%206.29673352,5.86751505%206.61030508,5.82917533%20L7.46685423,5.71813799%20L7.14258288,6.20458732%20L9.4760768,6.20458732%20L10.3731616,6.09883746%20C10.4630931,6.46719946%2011.1751491,7.896585%2011.2614604,8.06930976%20L11.2685104,8.08340974%20L11.3160978,8.18034711%20L11.582279,7.44891061%20C11.7376875,6.98577831%2011.7704858,6.49028842%2011.6774786,6.01071259%20Z'%3e%3c/path%3e%3cpath%20fill='%23ccc'%20id='路径'%20d='M3.30382437,14.8038077%20C3.44834917,14.613458%204.19741064,13.7251592%205.92113328,13.2545724%20L6.83410703,12.2376113%20L10.4948145,11.6542246%20L12.3577744,12.6835231%20L14.6507838,13.3250723%20C14.2769163,13.7976658%2013.8512602,14.226869%2013.3817855,14.6046455%20C12.1005888,15.6439531%2010.5352177,16.2718218%208.8909417,16.405918%20C8.66710451,16.4253055%208.44150482,16.4341182%208.21414263,16.4341182%20C7.7635871,16.4342197%207.31379401,16.3970808%206.86935698,16.3230806%20C6.71249469,16.2984057%206.5591574,16.2684432%206.40582011,16.2331933%20C6.13890189,16.1738018%205.87533023,16.1002606%205.6162212,16.0128811%20C4.7854108,15.7368485%204.00457837,15.3285779%203.30382437,14.8038077%20C3.29501188,14.7985202%203.28796189,14.7914702%203.2791494,14.7861828%20L3.30382437,14.8038077%20Z'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20transform='translate(50.000000,%2018.785515)'%20id='undraw_map_re_60yfw备份'%3e%3cpolygon%20points='25.5795757%2067.619667%2023.9776047%2067.619667%2023.2154672%2061.4404243%2025.5799463%2061.4404243'%20fill-rule='nonzero'%20fill='%23FFC5B9'%20id='路径'%3e%3c/polygon%3e%3cpolygon%20points='19.3714286%2066.6101128%2017.8087379%2066.9630183%2015.7041515%2061.1033298%2018.0105747%2060.5826799'%20fill-rule='nonzero'%20fill='%23FFC5B9'%20id='路径'%3e%3c/polygon%3e%3cpath%20fill-rule='nonzero'%20fill='%232F2E41'%20id='路径'%20d='M20.122884,67.9968106%20C18.6837616,68.990244%2015.4400225,69.564029%2014.6833839,69.2793135%20C13.9267454,68.994598%2014.6833839,66.9028893%2016.7641239,66.9028893%20L17.380146,65.9586334%20L18.941933,66.057946%20L19.3817863,65.9586334%20C20.219863,66.9399849%2020.4668955,67.6193773%2020.122884,67.9968106%20Z'%3e%3c/path%3e%3cpath%20transform='translate(26.194614,%2068.274285)%20scale(-1,%201)%20rotate(13.000000)%20translate(-26.194614,%20-68.274285)'%20fill-rule='nonzero'%20fill='%232F2E41'%20id='路径'%20d='M28.9826618,68.6156433%20C27.5435394,69.6090767%2024.2998002,70.1828617%2023.5431617,69.8981462%20C22.7865232,69.6134307%2023.5431617,67.521722%2025.6239017,67.521722%20L26.2399238,66.5774661%20L27.8017107,66.6767787%20L28.2415641,66.5774661%20C29.0796408,67.5588176%2029.3266733,68.23821%2028.9826618,68.6156433%20Z'%3e%3c/path%3e%3cpath%20fill-rule='nonzero'%20fill='%23ccc'%20id='路径'%20d='M27.6086476,29.8430095%20C30.2652054,33.0322683%2028.1148918,52.8401242%2027.1871185,54.7753754%20C25.9482091,57.3596267%2026.7308381,62.524081%2025.8550767,64.2385408%20L23.3148836,64.2385408%20L22.6906361,57.2584373%20L22.1408546,56.4713234%20L22.0571986,50.175528%20C21.8322828,49.643001%2021.8121485,48.4396781%2021.9967958,46.5655594%20L21.8992644,40.7363515%20C19.0291846,45.6936458%2017.3081306,48.3154159%2016.7361026,48.6016617%20C18.3836291,55.1746297%2019.2188117,59.30936%2019.2416503,61.0058525%20L19.9220155,64.0086297%20L16.795646,64.2881168%20L15.4159869,60.2159297%20C14.3997791,59.3000305%2013.3672124,57.2940863%2012.3182869,54.1980972%20C11.2693614,51.1021082%2010.8855789,48.9275824%2011.1669395,47.6745201%20L13.0483617,43.3078935%20L13.8173263,41.5231911%20L18.1116412,32.5564437%20L27.6086476,29.8430095%20Z'%3e%3c/path%3e%3cpath%20fill='%23FFDCD5'%20id='路径-4'%20d='M5.94827543,18.4333344%20L5.27009174,17.3895275%20C4.83443551,16.5719148%204.08928054,16.3675116%203.03462682,16.776318%20C1.45264626,17.3895275%201.3718101,16.3403398%200.554824829,16.184494%20C-0.262160437,16.0286483%200.529026031,17.9663925%201.68086243,18.1998634%20C2.83269882,18.4333344%204.11911201,18.1998634%205.27009174,19.3090823%20C6.03741155,20.0485615%206.26347278,19.7566455%205.94827543,18.4333344%20Z'%3e%3c/path%3e%3cpath%20transform='translate(41.831975,%2019.103608)%20scale(-1,%201)%20translate(-41.831975,%20-19.103608)'%20fill='%23FFDCD5'%20id='路径-4'%20d='M44.5385828,19.4333344%20L43.7300746,17.997982%20C43.3159141,17.6701867%2042.6818267,17.6038294%2041.8278125,17.7989101%20C40.5467912,18.091531%2040.3051416,17.6065553%2039.4729182,17.3139343%20C38.6406947,17.0213133%2039.4252116,19.0868139%2040.5384013,19.0868139%20C41.651591,19.0868139%2042.6754099,19.4333344%2043.5399119,20.5495911%20C44.1162465,21.2937622%2044.4491368,20.9216766%2044.5385828,19.4333344%20Z'%3e%3c/path%3e%3cpath%20fill='%23FFCBC1'%20id='路径-2'%20d='M19.2825127,10.1155281%20C19.2825127,10.1155281%2019.3838387,10.955527%2019.5864906,12.6355247%20L22.5,12.6355247%20L22.2617226,9.16346741%20C20.2755826,9.79817454%2019.2825127,10.1155281%2019.2825127,10.1155281%20Z'%3e%3c/path%3e%3cpath%20fill-rule='nonzero'%20fill='%23EAEAEA'%20id='路径'%20d='M22.7618588,12.0481651%20L23.217659,13.2043475%20L23.810398,13.4490624%20C28.3916817,9.58369474%2030.2942116,18.0321874%2031.3533173,19.8406667%20C32.3113271,21.1676098%2035.2260102,20.4648354%2040.0973663,17.7323436%20L41.9885406,20.4578209%20C36.6567935,22.8165181%2033.6097646,24.1255362%2032.8474541,24.3848752%20C31.7039883,24.7738836%2030.2647595,24.2290574%2029.6522484,23.9150352%20L26.7876968,19.9801339%20C26.6500441,21.6628262%2027.7234426,27.5335875%2028.3916817,28.9133343%20C28.8371744,29.8331655%2029.0033726,31.3220322%2028.8902764,33.3799345%20C27.6632753,33.2310478%2026.9624154,33.1566045%2026.7876968,33.1566045%20C26.4661312,33.1566045%2023.5209619,33.5854896%2017.952189,34.4432599%20L16.5058134,33.7116281%20L17.1320755,30.6999744%20L16.7170379,29.3535727%20C17.516183,23.0190354%2017.7710732,20.0537848%2017.4817086,20.4578209%20C17.0476616,21.063875%2016.5774018,22.6653382%2016.0709292,23.5085536%20C15.5747778,24.4274914%2014.6913021,24.8837487%2013.4205022,24.8773255%20C12.1497023,24.8709023%209.1739663,23.264995%204.49329433,20.0596037%20L5.55947876,17.2498894%20C10.1362178,20.4325701%2012.7565589,21.5018806%2013.4205022,20.4578209%20C13.8717384,19.70438%2013.7219021,16.6804605%2014.4258575,15.0668737%20C15.129813,13.4532868%2016.7915618,12.8414713%2018.5622148,13.8335736%20C18.6846341,13.8818589%2018.8005935,13.9320075%2018.9103258,13.9839054%20L19.1334645,13.6663177%20L19.1458168,12.1506893%20L22.7618588,12.0481651%20Z'%3e%3c/path%3e%3ccircle%20r='3.55660377'%20cy='7.19811321'%20cx='20.6886792'%20fill-rule='nonzero'%20fill='%23FFDCD5'%20id='椭圆形'%3e%3c/circle%3e%3cpath%20transform='translate(24.350000,%207.216267)%20scale(-1,%201)%20translate(-24.350000,%20-7.216267)'%20fill='%23FFDCD5'%20id='椭圆形备份'%20d='M24.5320755,8.13253403%20C24.946289,8.13253403%2025.1,7.46421356%2025.1,7.05%20C25.1,6.63578644%2024.7642136,6.3%2024.35,6.3%20C23.9357864,6.3%2023.6,6.63578644%2023.6,7.05%20C23.6,7.46421356%2024.1178619,8.13253403%2024.5320755,8.13253403%20Z'%3e%3c/path%3e%3cpath%20fill-rule='nonzero'%20fill='%232F2E41'%20id='路径'%20d='M18.5,5.47086143%20C18.5779152,5.47144038%2018.9810582,5.5295179%2019.709429,5.64509401%20C19.7992894,5.65935284%2019.9452178,5.6827102%2020.1472144,5.71516609%20C20.4515042,5.63427297%2020.6721794,5.57935034%2020.80924,5.55039821%20C21.0508897,5.49935306%2021.2701683,5.85082223%2021.4701385,5.83153725%20C22.0830859,5.77242504%2022.5017664,5.4758785%2022.7231172,5.71516609%20C22.9064071,5.91330849%2023.6428805,5.81226146%2024.0113525,6.3496666%20C24.1375066,6.53365842%2024.1766143,6.70299562%2024.1286755,6.85767819%20C24.2838567,6.85818284%2024.3864104,6.82843813%2024.4363365,6.76844406%20C24.5569917,6.24063419%2025.0012264,5.99214935%2025.1000131,4.98563576%20C25.1000131,3.88379478%2024.9158649,1.72039509%2022.1127586,1.35310078%20C22.0802726,1.34884409%2022.0802726,1.14637967%2022.1127586,0.745707512%20C21.7778009,1.05512633%2021.5586506,1.1936357%2021.4553078,1.16123562%20C21.3740815,1.1357695%2021.5331226,0.768175272%2021.4553078,0.745707512%20C21.2908482,0.698222464%2020.90243,1.00472189%2020.80924,1%20C20.109976,0.964568651%2019.2887667,1.40216236%2018.5,1.64474869%20C17.5060845,1.95042882%2017.2317941,2.39417405%2016.95,3.64150943%20C16.7997103,4.00268007%2016.7286186,4.58428618%2016.7367249,5.38632774%20L17.1231308,7.10649109%20L17.4998894,6.3%20L17.6937008,5.47086143%20L18.0248604,5.61205387%20C18.0992632,5.46006118%2018.1887684,5.38481914%2018.293376,5.38632774%20L18.5,5.47086143%20Z'%3e%3c/path%3e%3cpath%20fill='%23FFDCD5'%20id='椭圆形'%20d='M17.1320755,8.13253403%20C17.546289,8.13253403%2017.7,7.46421356%2017.7,7.05%20C17.7,6.63578644%2017.3642136,6.3%2016.95,6.3%20C16.5357864,6.3%2016.2,6.63578644%2016.2,7.05%20C16.2,7.46421356%2016.7178619,8.13253403%2017.1320755,8.13253403%20Z'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
10417
10402
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
10418
10403
  __name: "Empty",
@@ -10719,18 +10704,16 @@ function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
10719
10704
  }
10720
10705
  }
10721
10706
  /*!
10722
- * vue-router v4.5.1
10723
- * (c) 2025 Eduardo San Martin Morote
10724
- * @license MIT
10725
- */
10707
+ * vue-router v4.6.3
10708
+ * (c) 2025 Eduardo San Martin Morote
10709
+ * @license MIT
10710
+ */
10726
10711
  const isBrowser = typeof document !== "undefined";
10727
10712
  function isRouteComponent(component) {
10728
10713
  return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
10729
10714
  }
10730
10715
  function isESModule(obj) {
10731
- return obj.__esModule || obj[Symbol.toStringTag] === "Module" || // support CF with dynamic imports that do not
10732
- // add the Module string tag
10733
- obj.default && isRouteComponent(obj.default);
10716
+ return obj.__esModule || obj[Symbol.toStringTag] === "Module" || obj.default && isRouteComponent(obj.default);
10734
10717
  }
10735
10718
  const assign = Object.assign;
10736
10719
  function applyToParams(fn, params) {
@@ -10744,7 +10727,12 @@ function applyToParams(fn, params) {
10744
10727
  const noop = () => {
10745
10728
  };
10746
10729
  const isArray = Array.isArray;
10747
- function warn(msg) {
10730
+ function mergeOptions(defaults, partialOptions) {
10731
+ const options = {};
10732
+ for (const key in defaults) options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
10733
+ return options;
10734
+ }
10735
+ function warn$1(msg) {
10748
10736
  const args = Array.from(arguments).slice(1);
10749
10737
  console.warn.apply(console, ["[Vue Router warn]: " + msg].concat(args));
10750
10738
  }
@@ -10763,7 +10751,7 @@ const ENC_PIPE_RE = /%7C/g;
10763
10751
  const ENC_CURLY_CLOSE_RE = /%7D/g;
10764
10752
  const ENC_SPACE_RE = /%20/g;
10765
10753
  function commonEncode(text) {
10766
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
10754
+ return text == null ? "" : encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
10767
10755
  }
10768
10756
  function encodeHash(text) {
10769
10757
  return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
@@ -10778,66 +10766,60 @@ function encodePath(text) {
10778
10766
  return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
10779
10767
  }
10780
10768
  function encodeParam(text) {
10781
- return text == null ? "" : encodePath(text).replace(SLASH_RE, "%2F");
10769
+ return encodePath(text).replace(SLASH_RE, "%2F");
10782
10770
  }
10783
10771
  function decode(text) {
10772
+ if (text == null) return null;
10784
10773
  try {
10785
10774
  return decodeURIComponent("" + text);
10786
10775
  } catch (err) {
10787
- process.env.NODE_ENV !== "production" && warn(`Error decoding "${text}". Using original value`);
10776
+ process.env.NODE_ENV !== "production" && warn$1(`Error decoding "${text}". Using original value`);
10788
10777
  }
10789
10778
  return "" + text;
10790
10779
  }
10791
10780
  const TRAILING_SLASH_RE = /\/$/;
10792
10781
  const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, "");
10793
- function parseURL(parseQuery2, location2, currentLocation = "/") {
10782
+ function parseURL(parseQuery$1, location2, currentLocation = "/") {
10794
10783
  let path, query = {}, searchString = "", hash = "";
10795
10784
  const hashPos = location2.indexOf("#");
10796
10785
  let searchPos = location2.indexOf("?");
10797
- if (hashPos < searchPos && hashPos >= 0) {
10798
- searchPos = -1;
10799
- }
10800
- if (searchPos > -1) {
10786
+ searchPos = hashPos >= 0 && searchPos > hashPos ? -1 : searchPos;
10787
+ if (searchPos >= 0) {
10801
10788
  path = location2.slice(0, searchPos);
10802
- searchString = location2.slice(searchPos + 1, hashPos > -1 ? hashPos : location2.length);
10803
- query = parseQuery2(searchString);
10789
+ searchString = location2.slice(searchPos, hashPos > 0 ? hashPos : location2.length);
10790
+ query = parseQuery$1(searchString.slice(1));
10804
10791
  }
10805
- if (hashPos > -1) {
10792
+ if (hashPos >= 0) {
10806
10793
  path = path || location2.slice(0, hashPos);
10807
10794
  hash = location2.slice(hashPos, location2.length);
10808
10795
  }
10809
10796
  path = resolveRelativePath(path != null ? path : location2, currentLocation);
10810
10797
  return {
10811
- fullPath: path + (searchString && "?") + searchString + hash,
10798
+ fullPath: path + searchString + hash,
10812
10799
  path,
10813
10800
  query,
10814
10801
  hash: decode(hash)
10815
10802
  };
10816
10803
  }
10817
- function stringifyURL(stringifyQuery2, location2) {
10818
- const query = location2.query ? stringifyQuery2(location2.query) : "";
10804
+ function stringifyURL(stringifyQuery$1, location2) {
10805
+ const query = location2.query ? stringifyQuery$1(location2.query) : "";
10819
10806
  return location2.path + (query && "?") + query + (location2.hash || "");
10820
10807
  }
10821
10808
  function stripBase(pathname, base) {
10822
- if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase()))
10823
- return pathname;
10809
+ if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase())) return pathname;
10824
10810
  return pathname.slice(base.length) || "/";
10825
10811
  }
10826
- function isSameRouteLocation(stringifyQuery2, a, b) {
10812
+ function isSameRouteLocation(stringifyQuery$1, a, b) {
10827
10813
  const aLastIndex = a.matched.length - 1;
10828
10814
  const bLastIndex = b.matched.length - 1;
10829
- return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a.params, b.params) && stringifyQuery2(a.query) === stringifyQuery2(b.query) && a.hash === b.hash;
10815
+ return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a.params, b.params) && stringifyQuery$1(a.query) === stringifyQuery$1(b.query) && a.hash === b.hash;
10830
10816
  }
10831
10817
  function isSameRouteRecord(a, b) {
10832
10818
  return (a.aliasOf || a) === (b.aliasOf || b);
10833
10819
  }
10834
10820
  function isSameRouteLocationParams(a, b) {
10835
- if (Object.keys(a).length !== Object.keys(b).length)
10836
- return false;
10837
- for (const key in a) {
10838
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
10839
- return false;
10840
- }
10821
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
10822
+ for (const key in a) if (!isSameRouteLocationParamsValue(a[key], b[key])) return false;
10841
10823
  return true;
10842
10824
  }
10843
10825
  function isSameRouteLocationParamsValue(a, b) {
@@ -10847,38 +10829,30 @@ function isEquivalentArray(a, b) {
10847
10829
  return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
10848
10830
  }
10849
10831
  function resolveRelativePath(to, from) {
10850
- if (to.startsWith("/"))
10851
- return to;
10832
+ if (to.startsWith("/")) return to;
10852
10833
  if (process.env.NODE_ENV !== "production" && !from.startsWith("/")) {
10853
- warn(`Cannot resolve a relative location without an absolute path. Trying to resolve "${to}" from "${from}". It should look like "/${from}".`);
10834
+ warn$1(`Cannot resolve a relative location without an absolute path. Trying to resolve "${to}" from "${from}". It should look like "/${from}".`);
10854
10835
  return to;
10855
10836
  }
10856
- if (!to)
10857
- return from;
10837
+ if (!to) return from;
10858
10838
  const fromSegments = from.split("/");
10859
10839
  const toSegments = to.split("/");
10860
10840
  const lastToSegment = toSegments[toSegments.length - 1];
10861
- if (lastToSegment === ".." || lastToSegment === ".") {
10862
- toSegments.push("");
10863
- }
10841
+ if (lastToSegment === ".." || lastToSegment === ".") toSegments.push("");
10864
10842
  let position = fromSegments.length - 1;
10865
10843
  let toPosition;
10866
10844
  let segment;
10867
10845
  for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
10868
10846
  segment = toSegments[toPosition];
10869
- if (segment === ".")
10870
- continue;
10847
+ if (segment === ".") continue;
10871
10848
  if (segment === "..") {
10872
- if (position > 1)
10873
- position--;
10874
- } else
10875
- break;
10849
+ if (position > 1) position--;
10850
+ } else break;
10876
10851
  }
10877
10852
  return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/");
10878
10853
  }
10879
10854
  const START_LOCATION_NORMALIZED = {
10880
10855
  path: "/",
10881
- // TODO: could we use a symbol in the future?
10882
10856
  name: void 0,
10883
10857
  params: {},
10884
10858
  query: {},
@@ -10888,29 +10862,24 @@ const START_LOCATION_NORMALIZED = {
10888
10862
  meta: {},
10889
10863
  redirectedFrom: void 0
10890
10864
  };
10891
- var NavigationType;
10892
- (function(NavigationType2) {
10893
- NavigationType2["pop"] = "pop";
10894
- NavigationType2["push"] = "push";
10895
- })(NavigationType || (NavigationType = {}));
10896
- var NavigationDirection;
10897
- (function(NavigationDirection2) {
10898
- NavigationDirection2["back"] = "back";
10899
- NavigationDirection2["forward"] = "forward";
10900
- NavigationDirection2["unknown"] = "";
10901
- })(NavigationDirection || (NavigationDirection = {}));
10865
+ let NavigationType = /* @__PURE__ */ function(NavigationType$1) {
10866
+ NavigationType$1["pop"] = "pop";
10867
+ NavigationType$1["push"] = "push";
10868
+ return NavigationType$1;
10869
+ }({});
10870
+ let NavigationDirection = /* @__PURE__ */ function(NavigationDirection$1) {
10871
+ NavigationDirection$1["back"] = "back";
10872
+ NavigationDirection$1["forward"] = "forward";
10873
+ NavigationDirection$1["unknown"] = "";
10874
+ return NavigationDirection$1;
10875
+ }({});
10902
10876
  function normalizeBase(base) {
10903
- if (!base) {
10904
- if (isBrowser) {
10905
- const baseEl = document.querySelector("base");
10906
- base = baseEl && baseEl.getAttribute("href") || "/";
10907
- base = base.replace(/^\w+:\/\/[^\/]+/, "");
10908
- } else {
10909
- base = "/";
10910
- }
10911
- }
10912
- if (base[0] !== "/" && base[0] !== "#")
10913
- base = "/" + base;
10877
+ if (!base) if (isBrowser) {
10878
+ const baseEl = document.querySelector("base");
10879
+ base = baseEl && baseEl.getAttribute("href") || "/";
10880
+ base = base.replace(/^\w+:\/\/[^\/]+/, "");
10881
+ } else base = "/";
10882
+ if (base[0] !== "/" && base[0] !== "#") base = "/" + base;
10914
10883
  return removeTrailingSlash(base);
10915
10884
  }
10916
10885
  const BEFORE_HASH_RE = /^[^#]+#/;
@@ -10936,37 +10905,29 @@ function scrollToPosition(position) {
10936
10905
  const positionEl = position.el;
10937
10906
  const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#");
10938
10907
  if (process.env.NODE_ENV !== "production" && typeof position.el === "string") {
10939
- if (!isIdSelector || !document.getElementById(position.el.slice(1))) {
10940
- try {
10941
- const foundEl = document.querySelector(position.el);
10942
- if (isIdSelector && foundEl) {
10943
- warn(`The selector "${position.el}" should be passed as "el: document.querySelector('${position.el}')" because it starts with "#".`);
10944
- return;
10945
- }
10946
- } catch (err) {
10947
- warn(`The selector "${position.el}" is invalid. If you are using an id selector, make sure to escape it. You can find more information about escaping characters in selectors at https://mathiasbynens.be/notes/css-escapes or use CSS.escape (https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape).`);
10908
+ if (!isIdSelector || !document.getElementById(position.el.slice(1))) try {
10909
+ const foundEl = document.querySelector(position.el);
10910
+ if (isIdSelector && foundEl) {
10911
+ warn$1(`The selector "${position.el}" should be passed as "el: document.querySelector('${position.el}')" because it starts with "#".`);
10948
10912
  return;
10949
10913
  }
10914
+ } catch (err) {
10915
+ warn$1(`The selector "${position.el}" is invalid. If you are using an id selector, make sure to escape it. You can find more information about escaping characters in selectors at https://mathiasbynens.be/notes/css-escapes or use CSS.escape (https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape).`);
10916
+ return;
10950
10917
  }
10951
10918
  }
10952
10919
  const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl) : positionEl;
10953
10920
  if (!el) {
10954
- process.env.NODE_ENV !== "production" && warn(`Couldn't find element using selector "${position.el}" returned by scrollBehavior.`);
10921
+ process.env.NODE_ENV !== "production" && warn$1(`Couldn't find element using selector "${position.el}" returned by scrollBehavior.`);
10955
10922
  return;
10956
10923
  }
10957
10924
  scrollToOptions = getElementPosition(el, position);
10958
- } else {
10959
- scrollToOptions = position;
10960
- }
10961
- if ("scrollBehavior" in document.documentElement.style)
10962
- window.scrollTo(scrollToOptions);
10963
- else {
10964
- window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);
10965
- }
10925
+ } else scrollToOptions = position;
10926
+ if ("scrollBehavior" in document.documentElement.style) window.scrollTo(scrollToOptions);
10927
+ else window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);
10966
10928
  }
10967
10929
  function getScrollKey(path, delta) {
10968
- const position = history.state ? history.state.position - delta : -1;
10969
- return position + path;
10930
+ return (history.state ? history.state.position - delta : -1) + path;
10970
10931
  }
10971
10932
  const scrollPositions = /* @__PURE__ */ new Map();
10972
10933
  function saveScrollPosition(key, scrollPosition) {
@@ -10977,1805 +10938,1493 @@ function getSavedScrollPosition(key) {
10977
10938
  scrollPositions.delete(key);
10978
10939
  return scroll;
10979
10940
  }
10980
- let createBaseLocation = () => location.protocol + "//" + location.host;
10981
- function createCurrentLocation(base, location2) {
10982
- const { pathname, search, hash } = location2;
10983
- const hashPos = base.indexOf("#");
10984
- if (hashPos > -1) {
10985
- let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
10986
- let pathFromHash = hash.slice(slicePos);
10987
- if (pathFromHash[0] !== "/")
10988
- pathFromHash = "/" + pathFromHash;
10989
- return stripBase(pathFromHash, "");
10990
- }
10991
- const path = stripBase(pathname, base);
10992
- return path + search + hash;
10993
- }
10994
- function useHistoryListeners(base, historyState, currentLocation, replace) {
10995
- let listeners = [];
10996
- let teardowns = [];
10997
- let pauseState = null;
10998
- const popStateHandler = ({ state }) => {
10999
- const to = createCurrentLocation(base, location);
11000
- const from = currentLocation.value;
11001
- const fromState = historyState.value;
11002
- let delta = 0;
11003
- if (state) {
11004
- currentLocation.value = to;
11005
- historyState.value = state;
11006
- if (pauseState && pauseState === from) {
11007
- pauseState = null;
11008
- return;
11009
- }
11010
- delta = fromState ? state.position - fromState.position : 0;
11011
- } else {
11012
- replace(to);
11013
- }
11014
- listeners.forEach((listener) => {
11015
- listener(currentLocation.value, from, {
11016
- delta,
11017
- type: NavigationType.pop,
11018
- direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown
11019
- });
11020
- });
11021
- };
11022
- function pauseListeners() {
11023
- pauseState = currentLocation.value;
11024
- }
11025
- function listen(callback) {
11026
- listeners.push(callback);
11027
- const teardown = () => {
11028
- const index = listeners.indexOf(callback);
11029
- if (index > -1)
11030
- listeners.splice(index, 1);
11031
- };
11032
- teardowns.push(teardown);
11033
- return teardown;
11034
- }
11035
- function beforeUnloadListener() {
11036
- const { history: history2 } = window;
11037
- if (!history2.state)
11038
- return;
11039
- history2.replaceState(assign({}, history2.state, { scroll: computeScrollPosition() }), "");
11040
- }
11041
- function destroy() {
11042
- for (const teardown of teardowns)
11043
- teardown();
11044
- teardowns = [];
11045
- window.removeEventListener("popstate", popStateHandler);
11046
- window.removeEventListener("beforeunload", beforeUnloadListener);
11047
- }
11048
- window.addEventListener("popstate", popStateHandler);
11049
- window.addEventListener("beforeunload", beforeUnloadListener, {
11050
- passive: true
11051
- });
11052
- return {
11053
- pauseListeners,
11054
- listen,
11055
- destroy
11056
- };
11057
- }
11058
- function buildState(back, current, forward, replaced = false, computeScroll = false) {
11059
- return {
11060
- back,
11061
- current,
11062
- forward,
11063
- replaced,
11064
- position: window.history.length,
11065
- scroll: computeScroll ? computeScrollPosition() : null
11066
- };
11067
- }
11068
- function useHistoryStateNavigation(base) {
11069
- const { history: history2, location: location2 } = window;
11070
- const currentLocation = {
11071
- value: createCurrentLocation(base, location2)
11072
- };
11073
- const historyState = { value: history2.state };
11074
- if (!historyState.value) {
11075
- changeLocation(currentLocation.value, {
11076
- back: null,
11077
- current: currentLocation.value,
11078
- forward: null,
11079
- // the length is off by one, we need to decrease it
11080
- position: history2.length - 1,
11081
- replaced: true,
11082
- // don't add a scroll as the user may have an anchor, and we want
11083
- // scrollBehavior to be triggered without a saved position
11084
- scroll: null
11085
- }, true);
11086
- }
11087
- function changeLocation(to, state, replace2) {
11088
- const hashIndex = base.indexOf("#");
11089
- const url = hashIndex > -1 ? (location2.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to;
11090
- try {
11091
- history2[replace2 ? "replaceState" : "pushState"](state, "", url);
11092
- historyState.value = state;
11093
- } catch (err) {
11094
- if (process.env.NODE_ENV !== "production") {
11095
- warn("Error with push/replace State", err);
11096
- } else {
11097
- console.error(err);
11098
- }
11099
- location2[replace2 ? "replace" : "assign"](url);
11100
- }
11101
- }
11102
- function replace(to, data) {
11103
- const state = assign({}, history2.state, buildState(
11104
- historyState.value.back,
11105
- // keep back and forward entries but override current position
11106
- to,
11107
- historyState.value.forward,
11108
- true
11109
- ), data, { position: historyState.value.position });
11110
- changeLocation(to, state, true);
11111
- currentLocation.value = to;
11112
- }
11113
- function push(to, data) {
11114
- const currentState = assign(
11115
- {},
11116
- // use current history state to gracefully handle a wrong call to
11117
- // history.replaceState
11118
- // https://github.com/vuejs/router/issues/366
11119
- historyState.value,
11120
- history2.state,
11121
- {
11122
- forward: to,
11123
- scroll: computeScrollPosition()
11124
- }
11125
- );
11126
- if (process.env.NODE_ENV !== "production" && !history2.state) {
11127
- warn(`history.state seems to have been manually replaced without preserving the necessary values. Make sure to preserve existing history state if you are manually calling history.replaceState:
11128
-
11129
- history.replaceState(history.state, '', url)
11130
-
11131
- You can find more information at https://router.vuejs.org/guide/migration/#Usage-of-history-state`);
11132
- }
11133
- changeLocation(currentState.current, currentState, true);
11134
- const state = assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data);
11135
- changeLocation(to, state, false);
11136
- currentLocation.value = to;
11137
- }
11138
- return {
11139
- location: currentLocation,
11140
- state: historyState,
11141
- push,
11142
- replace
11143
- };
11144
- }
11145
- function createWebHistory(base) {
11146
- base = normalizeBase(base);
11147
- const historyNavigation = useHistoryStateNavigation(base);
11148
- const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
11149
- function go(delta, triggerListeners = true) {
11150
- if (!triggerListeners)
11151
- historyListeners.pauseListeners();
11152
- history.go(delta);
11153
- }
11154
- const routerHistory = assign({
11155
- // it's overridden right after
11156
- location: "",
11157
- base,
11158
- go,
11159
- createHref: createHref.bind(null, base)
11160
- }, historyNavigation, historyListeners);
11161
- Object.defineProperty(routerHistory, "location", {
11162
- enumerable: true,
11163
- get: () => historyNavigation.location.value
11164
- });
11165
- Object.defineProperty(routerHistory, "state", {
11166
- enumerable: true,
11167
- get: () => historyNavigation.state.value
11168
- });
11169
- return routerHistory;
11170
- }
11171
10941
  function isRouteLocation(route) {
11172
10942
  return typeof route === "string" || route && typeof route === "object";
11173
10943
  }
11174
10944
  function isRouteName(name) {
11175
10945
  return typeof name === "string" || typeof name === "symbol";
11176
10946
  }
10947
+ let ErrorTypes = /* @__PURE__ */ function(ErrorTypes$1) {
10948
+ ErrorTypes$1[ErrorTypes$1["MATCHER_NOT_FOUND"] = 1] = "MATCHER_NOT_FOUND";
10949
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_GUARD_REDIRECT"] = 2] = "NAVIGATION_GUARD_REDIRECT";
10950
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_ABORTED"] = 4] = "NAVIGATION_ABORTED";
10951
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_CANCELLED"] = 8] = "NAVIGATION_CANCELLED";
10952
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_DUPLICATED"] = 16] = "NAVIGATION_DUPLICATED";
10953
+ return ErrorTypes$1;
10954
+ }({});
11177
10955
  const NavigationFailureSymbol = Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
11178
- var NavigationFailureType;
11179
- (function(NavigationFailureType2) {
11180
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
11181
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
11182
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
11183
- })(NavigationFailureType || (NavigationFailureType = {}));
11184
10956
  const ErrorTypeMessages = {
11185
- [
11186
- 1
11187
- /* ErrorTypes.MATCHER_NOT_FOUND */
11188
- ]({ location: location2, currentLocation }) {
10957
+ [ErrorTypes.MATCHER_NOT_FOUND]({ location: location2, currentLocation }) {
11189
10958
  return `No match for
11190
10959
  ${JSON.stringify(location2)}${currentLocation ? "\nwhile being at\n" + JSON.stringify(currentLocation) : ""}`;
11191
10960
  },
11192
- [
11193
- 2
11194
- /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
11195
- ]({ from, to }) {
10961
+ [ErrorTypes.NAVIGATION_GUARD_REDIRECT]({ from, to }) {
11196
10962
  return `Redirected from "${from.fullPath}" to "${stringifyRoute(to)}" via a navigation guard.`;
11197
10963
  },
11198
- [
11199
- 4
11200
- /* ErrorTypes.NAVIGATION_ABORTED */
11201
- ]({ from, to }) {
10964
+ [ErrorTypes.NAVIGATION_ABORTED]({ from, to }) {
11202
10965
  return `Navigation aborted from "${from.fullPath}" to "${to.fullPath}" via a navigation guard.`;
11203
10966
  },
11204
- [
11205
- 8
11206
- /* ErrorTypes.NAVIGATION_CANCELLED */
11207
- ]({ from, to }) {
10967
+ [ErrorTypes.NAVIGATION_CANCELLED]({ from, to }) {
11208
10968
  return `Navigation cancelled from "${from.fullPath}" to "${to.fullPath}" with a new navigation.`;
11209
10969
  },
11210
- [
11211
- 16
11212
- /* ErrorTypes.NAVIGATION_DUPLICATED */
11213
- ]({ from, to }) {
10970
+ [ErrorTypes.NAVIGATION_DUPLICATED]({ from, to }) {
11214
10971
  return `Avoided redundant navigation to current location: "${from.fullPath}".`;
11215
10972
  }
11216
10973
  };
11217
10974
  function createRouterError(type, params) {
11218
- if (process.env.NODE_ENV !== "production" || false) {
11219
- return assign(new Error(ErrorTypeMessages[type](params)), {
11220
- type,
11221
- [NavigationFailureSymbol]: true
11222
- }, params);
11223
- } else {
11224
- return assign(new Error(), {
11225
- type,
11226
- [NavigationFailureSymbol]: true
11227
- }, params);
11228
- }
10975
+ if (process.env.NODE_ENV !== "production" || false) return assign(new Error(ErrorTypeMessages[type](params)), {
10976
+ type,
10977
+ [NavigationFailureSymbol]: true
10978
+ }, params);
10979
+ else return assign(/* @__PURE__ */ new Error(), {
10980
+ type,
10981
+ [NavigationFailureSymbol]: true
10982
+ }, params);
11229
10983
  }
11230
10984
  function isNavigationFailure(error, type) {
11231
10985
  return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
11232
10986
  }
11233
- const propertiesToLog = ["params", "query", "hash"];
10987
+ const propertiesToLog = [
10988
+ "params",
10989
+ "query",
10990
+ "hash"
10991
+ ];
11234
10992
  function stringifyRoute(to) {
11235
- if (typeof to === "string")
11236
- return to;
11237
- if (to.path != null)
11238
- return to.path;
10993
+ if (typeof to === "string") return to;
10994
+ if (to.path != null) return to.path;
11239
10995
  const location2 = {};
11240
- for (const key of propertiesToLog) {
11241
- if (key in to)
11242
- location2[key] = to[key];
11243
- }
10996
+ for (const key of propertiesToLog) if (key in to) location2[key] = to[key];
11244
10997
  return JSON.stringify(location2, null, 2);
11245
10998
  }
11246
- const BASE_PARAM_PATTERN = "[^/]+?";
11247
- const BASE_PATH_PARSER_OPTIONS = {
11248
- sensitive: false,
11249
- strict: false,
11250
- start: true,
11251
- end: true
11252
- };
11253
- const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
11254
- function tokensToParser(segments, extraOptions) {
11255
- const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
11256
- const score = [];
11257
- let pattern = options.start ? "^" : "";
11258
- const keys = [];
11259
- for (const segment of segments) {
11260
- const segmentScores = segment.length ? [] : [
11261
- 90
11262
- /* PathScore.Root */
11263
- ];
11264
- if (options.strict && !segment.length)
11265
- pattern += "/";
11266
- for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
11267
- const token = segment[tokenIndex];
11268
- let subSegmentScore = 40 + (options.sensitive ? 0.25 : 0);
11269
- if (token.type === 0) {
11270
- if (!tokenIndex)
11271
- pattern += "/";
11272
- pattern += token.value.replace(REGEX_CHARS_RE, "\\$&");
11273
- subSegmentScore += 40;
11274
- } else if (token.type === 1) {
11275
- const { value, repeatable, optional, regexp } = token;
11276
- keys.push({
11277
- name: value,
11278
- repeatable,
11279
- optional
11280
- });
11281
- const re2 = regexp ? regexp : BASE_PARAM_PATTERN;
11282
- if (re2 !== BASE_PARAM_PATTERN) {
11283
- subSegmentScore += 10;
11284
- try {
11285
- new RegExp(`(${re2})`);
11286
- } catch (err) {
11287
- throw new Error(`Invalid custom RegExp for param "${value}" (${re2}): ` + err.message);
11288
- }
11289
- }
11290
- let subPattern = repeatable ? `((?:${re2})(?:/(?:${re2}))*)` : `(${re2})`;
11291
- if (!tokenIndex)
11292
- subPattern = // avoid an optional / if there are more segments e.g. /:p?-static
11293
- // or /:p?-:p2
11294
- optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
11295
- if (optional)
11296
- subPattern += "?";
11297
- pattern += subPattern;
11298
- subSegmentScore += 20;
11299
- if (optional)
11300
- subSegmentScore += -8;
11301
- if (repeatable)
11302
- subSegmentScore += -20;
11303
- if (re2 === ".*")
11304
- subSegmentScore += -50;
11305
- }
11306
- segmentScores.push(subSegmentScore);
11307
- }
11308
- score.push(segmentScores);
10999
+ function parseQuery(search) {
11000
+ const query = {};
11001
+ if (search === "" || search === "?") return query;
11002
+ const searchParams = (search[0] === "?" ? search.slice(1) : search).split("&");
11003
+ for (let i = 0; i < searchParams.length; ++i) {
11004
+ const searchParam = searchParams[i].replace(PLUS_RE, " ");
11005
+ const eqPos = searchParam.indexOf("=");
11006
+ const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
11007
+ const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
11008
+ if (key in query) {
11009
+ let currentValue = query[key];
11010
+ if (!isArray(currentValue)) currentValue = query[key] = [currentValue];
11011
+ currentValue.push(value);
11012
+ } else query[key] = value;
11309
11013
  }
11310
- if (options.strict && options.end) {
11311
- const i = score.length - 1;
11312
- score[i][score[i].length - 1] += 0.7000000000000001;
11313
- }
11314
- if (!options.strict)
11315
- pattern += "/?";
11316
- if (options.end)
11317
- pattern += "$";
11318
- else if (options.strict && !pattern.endsWith("/"))
11319
- pattern += "(?:/|$)";
11320
- const re = new RegExp(pattern, options.sensitive ? "" : "i");
11321
- function parse(path) {
11322
- const match = path.match(re);
11323
- const params = {};
11324
- if (!match)
11325
- return null;
11326
- for (let i = 1; i < match.length; i++) {
11327
- const value = match[i] || "";
11328
- const key = keys[i - 1];
11329
- params[key.name] = value && key.repeatable ? value.split("/") : value;
11014
+ return query;
11015
+ }
11016
+ function stringifyQuery(query) {
11017
+ let search = "";
11018
+ for (let key in query) {
11019
+ const value = query[key];
11020
+ key = encodeQueryKey(key);
11021
+ if (value == null) {
11022
+ if (value !== void 0) search += (search.length ? "&" : "") + key;
11023
+ continue;
11330
11024
  }
11331
- return params;
11025
+ (isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)]).forEach((value$1) => {
11026
+ if (value$1 !== void 0) {
11027
+ search += (search.length ? "&" : "") + key;
11028
+ if (value$1 != null) search += "=" + value$1;
11029
+ }
11030
+ });
11332
11031
  }
11333
- function stringify(params) {
11334
- let path = "";
11335
- let avoidDuplicatedSlash = false;
11336
- for (const segment of segments) {
11337
- if (!avoidDuplicatedSlash || !path.endsWith("/"))
11338
- path += "/";
11339
- avoidDuplicatedSlash = false;
11340
- for (const token of segment) {
11341
- if (token.type === 0) {
11342
- path += token.value;
11343
- } else if (token.type === 1) {
11344
- const { value, repeatable, optional } = token;
11345
- const param = value in params ? params[value] : "";
11346
- if (isArray(param) && !repeatable) {
11347
- throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
11348
- }
11349
- const text = isArray(param) ? param.join("/") : param;
11350
- if (!text) {
11351
- if (optional) {
11352
- if (segment.length < 2) {
11353
- if (path.endsWith("/"))
11354
- path = path.slice(0, -1);
11355
- else
11356
- avoidDuplicatedSlash = true;
11357
- }
11358
- } else
11359
- throw new Error(`Missing required param "${value}"`);
11360
- }
11361
- path += text;
11362
- }
11363
- }
11364
- }
11365
- return path || "/";
11366
- }
11367
- return {
11368
- re,
11369
- score,
11370
- keys,
11371
- parse,
11372
- stringify
11373
- };
11032
+ return search;
11374
11033
  }
11375
- function compareScoreArray(a, b) {
11376
- let i = 0;
11377
- while (i < a.length && i < b.length) {
11378
- const diff = b[i] - a[i];
11379
- if (diff)
11380
- return diff;
11381
- i++;
11382
- }
11383
- if (a.length < b.length) {
11384
- return a.length === 1 && a[0] === 40 + 40 ? -1 : 1;
11385
- } else if (a.length > b.length) {
11386
- return b.length === 1 && b[0] === 40 + 40 ? 1 : -1;
11034
+ function normalizeQuery(query) {
11035
+ const normalizedQuery = {};
11036
+ for (const key in query) {
11037
+ const value = query[key];
11038
+ if (value !== void 0) normalizedQuery[key] = isArray(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
11387
11039
  }
11388
- return 0;
11040
+ return normalizedQuery;
11389
11041
  }
11390
- function comparePathParserScore(a, b) {
11391
- let i = 0;
11392
- const aScore = a.score;
11393
- const bScore = b.score;
11394
- while (i < aScore.length && i < bScore.length) {
11395
- const comp = compareScoreArray(aScore[i], bScore[i]);
11396
- if (comp)
11397
- return comp;
11398
- i++;
11042
+ const matchedRouteKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
11043
+ const viewDepthKey = Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
11044
+ const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
11045
+ const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
11046
+ const routerViewLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
11047
+ function useCallbacks() {
11048
+ let handlers = [];
11049
+ function add(handler) {
11050
+ handlers.push(handler);
11051
+ return () => {
11052
+ const i = handlers.indexOf(handler);
11053
+ if (i > -1) handlers.splice(i, 1);
11054
+ };
11399
11055
  }
11400
- if (Math.abs(bScore.length - aScore.length) === 1) {
11401
- if (isLastScoreNegative(aScore))
11402
- return 1;
11403
- if (isLastScoreNegative(bScore))
11404
- return -1;
11056
+ function reset() {
11057
+ handlers = [];
11405
11058
  }
11406
- return bScore.length - aScore.length;
11407
- }
11408
- function isLastScoreNegative(score) {
11409
- const last = score[score.length - 1];
11410
- return score.length > 0 && last[last.length - 1] < 0;
11059
+ return {
11060
+ add,
11061
+ list: () => handlers.slice(),
11062
+ reset
11063
+ };
11411
11064
  }
11412
- const ROOT_TOKEN = {
11413
- type: 0,
11414
- value: ""
11415
- };
11416
- const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
11417
- function tokenizePath(path) {
11418
- if (!path)
11419
- return [[]];
11420
- if (path === "/")
11421
- return [[ROOT_TOKEN]];
11422
- if (!path.startsWith("/")) {
11423
- throw new Error(process.env.NODE_ENV !== "production" ? `Route paths should start with a "/": "${path}" should be "/${path}".` : `Invalid path "${path}"`);
11424
- }
11425
- function crash(message) {
11426
- throw new Error(`ERR (${state})/"${buffer}": ${message}`);
11427
- }
11428
- let state = 0;
11429
- let previousState = state;
11430
- const tokens = [];
11431
- let segment;
11432
- function finalizeSegment() {
11433
- if (segment)
11434
- tokens.push(segment);
11435
- segment = [];
11436
- }
11437
- let i = 0;
11438
- let char;
11439
- let buffer = "";
11440
- let customRe = "";
11441
- function consumeBuffer() {
11442
- if (!buffer)
11443
- return;
11444
- if (state === 0) {
11445
- segment.push({
11446
- type: 0,
11447
- value: buffer
11448
- });
11449
- } else if (state === 1 || state === 2 || state === 3) {
11450
- if (segment.length > 1 && (char === "*" || char === "+"))
11451
- crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
11452
- segment.push({
11453
- type: 1,
11454
- value: buffer,
11455
- regexp: customRe,
11456
- repeatable: char === "*" || char === "+",
11457
- optional: char === "*" || char === "?"
11458
- });
11459
- } else {
11460
- crash("Invalid state to consume buffer");
11461
- }
11462
- buffer = "";
11463
- }
11464
- function addCharToBuffer() {
11465
- buffer += char;
11466
- }
11467
- while (i < path.length) {
11468
- char = path[i++];
11469
- if (char === "\\" && state !== 2) {
11470
- previousState = state;
11471
- state = 4;
11472
- continue;
11473
- }
11474
- switch (state) {
11475
- case 0:
11476
- if (char === "/") {
11477
- if (buffer) {
11478
- consumeBuffer();
11479
- }
11480
- finalizeSegment();
11481
- } else if (char === ":") {
11482
- consumeBuffer();
11483
- state = 1;
11484
- } else {
11485
- addCharToBuffer();
11486
- }
11487
- break;
11488
- case 4:
11489
- addCharToBuffer();
11490
- state = previousState;
11491
- break;
11492
- case 1:
11493
- if (char === "(") {
11494
- state = 2;
11495
- } else if (VALID_PARAM_RE.test(char)) {
11496
- addCharToBuffer();
11497
- } else {
11498
- consumeBuffer();
11499
- state = 0;
11500
- if (char !== "*" && char !== "?" && char !== "+")
11501
- i--;
11065
+ function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
11066
+ const enterCallbackArray = record && (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
11067
+ return () => new Promise((resolve, reject) => {
11068
+ const next = (valid) => {
11069
+ if (valid === false) reject(createRouterError(ErrorTypes.NAVIGATION_ABORTED, {
11070
+ from,
11071
+ to
11072
+ }));
11073
+ else if (valid instanceof Error) reject(valid);
11074
+ else if (isRouteLocation(valid)) reject(createRouterError(ErrorTypes.NAVIGATION_GUARD_REDIRECT, {
11075
+ from: to,
11076
+ to: valid
11077
+ }));
11078
+ else {
11079
+ if (enterCallbackArray && record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") enterCallbackArray.push(valid);
11080
+ resolve();
11081
+ }
11082
+ };
11083
+ const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, process.env.NODE_ENV !== "production" ? canOnlyBeCalledOnce(next, to, from) : next));
11084
+ let guardCall = Promise.resolve(guardReturn);
11085
+ if (guard.length < 3) guardCall = guardCall.then(next);
11086
+ if (process.env.NODE_ENV !== "production" && guard.length > 2) {
11087
+ const message = `The "next" callback was never called inside of ${guard.name ? '"' + guard.name + '"' : ""}:
11088
+ ${guard.toString()}
11089
+ . If you are returning a value instead of calling "next", make sure to remove the "next" parameter from your function.`;
11090
+ if (typeof guardReturn === "object" && "then" in guardReturn) guardCall = guardCall.then((resolvedValue) => {
11091
+ if (!next._called) {
11092
+ warn$1(message);
11093
+ return Promise.reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
11502
11094
  }
11503
- break;
11504
- case 2:
11505
- if (char === ")") {
11506
- if (customRe[customRe.length - 1] == "\\")
11507
- customRe = customRe.slice(0, -1) + char;
11508
- else
11509
- state = 3;
11510
- } else {
11511
- customRe += char;
11095
+ return resolvedValue;
11096
+ });
11097
+ else if (guardReturn !== void 0) {
11098
+ if (!next._called) {
11099
+ warn$1(message);
11100
+ reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
11101
+ return;
11512
11102
  }
11513
- break;
11514
- case 3:
11515
- consumeBuffer();
11516
- state = 0;
11517
- if (char !== "*" && char !== "?" && char !== "+")
11518
- i--;
11519
- customRe = "";
11520
- break;
11521
- default:
11522
- crash("Unknown state");
11523
- break;
11524
- }
11525
- }
11526
- if (state === 2)
11527
- crash(`Unfinished custom RegExp for param "${buffer}"`);
11528
- consumeBuffer();
11529
- finalizeSegment();
11530
- return tokens;
11531
- }
11532
- function createRouteRecordMatcher(record, parent, options) {
11533
- const parser = tokensToParser(tokenizePath(record.path), options);
11534
- if (process.env.NODE_ENV !== "production") {
11535
- const existingKeys = /* @__PURE__ */ new Set();
11536
- for (const key of parser.keys) {
11537
- if (existingKeys.has(key.name))
11538
- warn(`Found duplicated params with name "${key.name}" for path "${record.path}". Only the last one will be available on "$route.params".`);
11539
- existingKeys.add(key.name);
11103
+ }
11540
11104
  }
11541
- }
11542
- const matcher = assign(parser, {
11543
- record,
11544
- parent,
11545
- // these needs to be populated by the parent
11546
- children: [],
11547
- alias: []
11105
+ guardCall.catch((err) => reject(err));
11548
11106
  });
11549
- if (parent) {
11550
- if (!matcher.record.aliasOf === !parent.record.aliasOf)
11551
- parent.children.push(matcher);
11552
- }
11553
- return matcher;
11554
11107
  }
11555
- function createRouterMatcher(routes, globalOptions) {
11556
- const matchers = [];
11557
- const matcherMap = /* @__PURE__ */ new Map();
11558
- globalOptions = mergeOptions({ strict: false, end: true, sensitive: false }, globalOptions);
11559
- function getRecordMatcher(name) {
11560
- return matcherMap.get(name);
11561
- }
11562
- function addRoute(record, parent, originalRecord) {
11563
- const isRootAdd = !originalRecord;
11564
- const mainNormalizedRecord = normalizeRouteRecord(record);
11565
- if (process.env.NODE_ENV !== "production") {
11566
- checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent);
11567
- }
11568
- mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
11569
- const options = mergeOptions(globalOptions, record);
11570
- const normalizedRecords = [mainNormalizedRecord];
11571
- if ("alias" in record) {
11572
- const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
11573
- for (const alias of aliases) {
11574
- normalizedRecords.push(
11575
- // we need to normalize again to ensure the `mods` property
11576
- // being non enumerable
11577
- normalizeRouteRecord(assign({}, mainNormalizedRecord, {
11578
- // this allows us to hold a copy of the `components` option
11579
- // so that async components cache is hold on the original record
11580
- components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
11581
- path: alias,
11582
- // we might be the child of an alias
11583
- aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
11584
- // the aliases are always of the same kind as the original since they
11585
- // are defined on the same record
11586
- }))
11587
- );
11588
- }
11589
- }
11590
- let matcher;
11591
- let originalMatcher;
11592
- for (const normalizedRecord of normalizedRecords) {
11593
- const { path } = normalizedRecord;
11594
- if (parent && path[0] !== "/") {
11595
- const parentPath = parent.record.path;
11596
- const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
11597
- normalizedRecord.path = parent.record.path + (path && connectingSlash + path);
11598
- }
11599
- if (process.env.NODE_ENV !== "production" && normalizedRecord.path === "*") {
11600
- throw new Error('Catch all routes ("*") must now be defined using a param with a custom regexp.\nSee more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes.');
11601
- }
11602
- matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
11603
- if (process.env.NODE_ENV !== "production" && parent && path[0] === "/")
11604
- checkMissingParamsInAbsolutePath(matcher, parent);
11605
- if (originalRecord) {
11606
- originalRecord.alias.push(matcher);
11607
- if (process.env.NODE_ENV !== "production") {
11608
- checkSameParams(originalRecord, matcher);
11609
- }
11610
- } else {
11611
- originalMatcher = originalMatcher || matcher;
11612
- if (originalMatcher !== matcher)
11613
- originalMatcher.alias.push(matcher);
11614
- if (isRootAdd && record.name && !isAliasRecord(matcher)) {
11615
- if (process.env.NODE_ENV !== "production") {
11616
- checkSameNameAsAncestor(record, parent);
11617
- }
11618
- removeRoute(record.name);
11108
+ function canOnlyBeCalledOnce(next, to, from) {
11109
+ let called = 0;
11110
+ return function() {
11111
+ if (called++ === 1) warn$1(`The "next" callback was called more than once in one navigation guard when going from "${from.fullPath}" to "${to.fullPath}". It should be called exactly one time in each navigation guard. This will fail in production.`);
11112
+ next._called = true;
11113
+ if (called === 1) next.apply(null, arguments);
11114
+ };
11115
+ }
11116
+ function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
11117
+ const guards = [];
11118
+ for (const record of matched) {
11119
+ if (process.env.NODE_ENV !== "production" && !record.components && record.children && !record.children.length) warn$1(`Record with path "${record.path}" is either missing a "component(s)" or "children" property.`);
11120
+ for (const name in record.components) {
11121
+ let rawComponent = record.components[name];
11122
+ if (process.env.NODE_ENV !== "production") {
11123
+ if (!rawComponent || typeof rawComponent !== "object" && typeof rawComponent !== "function") {
11124
+ warn$1(`Component "${name}" in record with path "${record.path}" is not a valid component. Received "${String(rawComponent)}".`);
11125
+ throw new Error("Invalid route component");
11126
+ } else if ("then" in rawComponent) {
11127
+ warn$1(`Component "${name}" in record with path "${record.path}" is a Promise instead of a function that returns a Promise. Did you write "import('./MyPage.vue')" instead of "() => import('./MyPage.vue')" ? This will break in production if not fixed.`);
11128
+ const promise = rawComponent;
11129
+ rawComponent = () => promise;
11130
+ } else if (rawComponent.__asyncLoader && !rawComponent.__warnedDefineAsync) {
11131
+ rawComponent.__warnedDefineAsync = true;
11132
+ warn$1(`Component "${name}" in record with path "${record.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`);
11619
11133
  }
11620
11134
  }
11621
- if (isMatchable(matcher)) {
11622
- insertMatcher(matcher);
11623
- }
11624
- if (mainNormalizedRecord.children) {
11625
- const children = mainNormalizedRecord.children;
11626
- for (let i = 0; i < children.length; i++) {
11627
- addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
11135
+ if (guardType !== "beforeRouteEnter" && !record.instances[name]) continue;
11136
+ if (isRouteComponent(rawComponent)) {
11137
+ const guard = (rawComponent.__vccOpts || rawComponent)[guardType];
11138
+ guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
11139
+ } else {
11140
+ let componentPromise = rawComponent();
11141
+ if (process.env.NODE_ENV !== "production" && !("catch" in componentPromise)) {
11142
+ warn$1(`Component "${name}" in record with path "${record.path}" is a function that does not return a Promise. If you were passing a functional component, make sure to add a "displayName" to the component. This will break in production if not fixed.`);
11143
+ componentPromise = Promise.resolve(componentPromise);
11628
11144
  }
11145
+ guards.push(() => componentPromise.then((resolved) => {
11146
+ if (!resolved) throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
11147
+ const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
11148
+ record.mods[name] = resolved;
11149
+ record.components[name] = resolvedComponent;
11150
+ const guard = (resolvedComponent.__vccOpts || resolvedComponent)[guardType];
11151
+ return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
11152
+ }));
11629
11153
  }
11630
- originalRecord = originalRecord || matcher;
11631
11154
  }
11632
- return originalMatcher ? () => {
11633
- removeRoute(originalMatcher);
11634
- } : noop;
11635
11155
  }
11636
- function removeRoute(matcherRef) {
11637
- if (isRouteName(matcherRef)) {
11638
- const matcher = matcherMap.get(matcherRef);
11639
- if (matcher) {
11640
- matcherMap.delete(matcherRef);
11641
- matchers.splice(matchers.indexOf(matcher), 1);
11642
- matcher.children.forEach(removeRoute);
11643
- matcher.alias.forEach(removeRoute);
11644
- }
11645
- } else {
11646
- const index = matchers.indexOf(matcherRef);
11647
- if (index > -1) {
11648
- matchers.splice(index, 1);
11649
- if (matcherRef.record.name)
11650
- matcherMap.delete(matcherRef.record.name);
11651
- matcherRef.children.forEach(removeRoute);
11652
- matcherRef.alias.forEach(removeRoute);
11653
- }
11156
+ return guards;
11157
+ }
11158
+ function extractChangingRecords(to, from) {
11159
+ const leavingRecords = [];
11160
+ const updatingRecords = [];
11161
+ const enteringRecords = [];
11162
+ const len = Math.max(from.matched.length, to.matched.length);
11163
+ for (let i = 0; i < len; i++) {
11164
+ const recordFrom = from.matched[i];
11165
+ if (recordFrom) if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) updatingRecords.push(recordFrom);
11166
+ else leavingRecords.push(recordFrom);
11167
+ const recordTo = to.matched[i];
11168
+ if (recordTo) {
11169
+ if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) enteringRecords.push(recordTo);
11654
11170
  }
11655
11171
  }
11656
- function getRoutes() {
11657
- return matchers;
11658
- }
11659
- function insertMatcher(matcher) {
11660
- const index = findInsertionIndex(matcher, matchers);
11661
- matchers.splice(index, 0, matcher);
11662
- if (matcher.record.name && !isAliasRecord(matcher))
11663
- matcherMap.set(matcher.record.name, matcher);
11664
- }
11665
- function resolve(location2, currentLocation) {
11666
- let matcher;
11667
- let params = {};
11668
- let path;
11669
- let name;
11670
- if ("name" in location2 && location2.name) {
11671
- matcher = matcherMap.get(location2.name);
11672
- if (!matcher)
11673
- throw createRouterError(1, {
11674
- location: location2
11172
+ return [
11173
+ leavingRecords,
11174
+ updatingRecords,
11175
+ enteringRecords
11176
+ ];
11177
+ }
11178
+ function formatRouteLocation(routeLocation, tooltip) {
11179
+ const copy = assign({}, routeLocation, { matched: routeLocation.matched.map((matched) => omit(matched, [
11180
+ "instances",
11181
+ "children",
11182
+ "aliasOf"
11183
+ ])) });
11184
+ return { _custom: {
11185
+ type: null,
11186
+ readOnly: true,
11187
+ display: routeLocation.fullPath,
11188
+ tooltip,
11189
+ value: copy
11190
+ } };
11191
+ }
11192
+ function formatDisplay(display) {
11193
+ return { _custom: { display } };
11194
+ }
11195
+ let routerId = 0;
11196
+ function addDevtools(app, router, matcher) {
11197
+ if (router.__hasDevtools) return;
11198
+ router.__hasDevtools = true;
11199
+ const id = routerId++;
11200
+ setupDevtoolsPlugin({
11201
+ id: "org.vuejs.router" + (id ? "." + id : ""),
11202
+ label: "Vue Router",
11203
+ packageName: "vue-router",
11204
+ homepage: "https://router.vuejs.org",
11205
+ logo: "https://router.vuejs.org/logo.png",
11206
+ componentStateTypes: ["Routing"],
11207
+ app
11208
+ }, (api) => {
11209
+ if (typeof api.now !== "function") warn$1("[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
11210
+ api.on.inspectComponent((payload, ctx) => {
11211
+ if (payload.instanceData) payload.instanceData.state.push({
11212
+ type: "Routing",
11213
+ key: "$route",
11214
+ editable: false,
11215
+ value: formatRouteLocation(router.currentRoute.value, "Current Route")
11216
+ });
11217
+ });
11218
+ api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {
11219
+ if (componentInstance.__vrv_devtools) {
11220
+ const info = componentInstance.__vrv_devtools;
11221
+ node.tags.push({
11222
+ label: (info.name ? `${info.name.toString()}: ` : "") + info.path,
11223
+ textColor: 0,
11224
+ tooltip: "This component is rendered by &lt;router-view&gt;",
11225
+ backgroundColor: PINK_500
11675
11226
  });
11676
- if (process.env.NODE_ENV !== "production") {
11677
- const invalidParams = Object.keys(location2.params || {}).filter((paramName) => !matcher.keys.find((k) => k.name === paramName));
11678
- if (invalidParams.length) {
11679
- warn(`Discarded invalid param(s) "${invalidParams.join('", "')}" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`);
11680
- }
11681
- }
11682
- name = matcher.record.name;
11683
- params = assign(
11684
- // paramsFromLocation is a new object
11685
- paramsFromLocation(
11686
- currentLocation.params,
11687
- // only keep params that exist in the resolved location
11688
- // only keep optional params coming from a parent record
11689
- matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name)
11690
- ),
11691
- // discard any existing params in the current location that do not exist here
11692
- // #1497 this ensures better active/exact matching
11693
- location2.params && paramsFromLocation(location2.params, matcher.keys.map((k) => k.name))
11694
- );
11695
- path = matcher.stringify(params);
11696
- } else if (location2.path != null) {
11697
- path = location2.path;
11698
- if (process.env.NODE_ENV !== "production" && !path.startsWith("/")) {
11699
- warn(`The Matcher cannot resolve relative paths but received "${path}". Unless you directly called \`matcher.resolve("${path}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`);
11700
- }
11701
- matcher = matchers.find((m) => m.re.test(path));
11702
- if (matcher) {
11703
- params = matcher.parse(path);
11704
- name = matcher.record.name;
11705
11227
  }
11706
- } else {
11707
- matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path));
11708
- if (!matcher)
11709
- throw createRouterError(1, {
11710
- location: location2,
11711
- currentLocation
11228
+ if (isArray(componentInstance.__vrl_devtools)) {
11229
+ componentInstance.__devtoolsApi = api;
11230
+ componentInstance.__vrl_devtools.forEach((devtoolsData) => {
11231
+ let label = devtoolsData.route.path;
11232
+ let backgroundColor = ORANGE_400;
11233
+ let tooltip = "";
11234
+ let textColor = 0;
11235
+ if (devtoolsData.error) {
11236
+ label = devtoolsData.error;
11237
+ backgroundColor = RED_100;
11238
+ textColor = RED_700;
11239
+ } else if (devtoolsData.isExactActive) {
11240
+ backgroundColor = LIME_500;
11241
+ tooltip = "This is exactly active";
11242
+ } else if (devtoolsData.isActive) {
11243
+ backgroundColor = BLUE_600;
11244
+ tooltip = "This link is active";
11245
+ }
11246
+ node.tags.push({
11247
+ label,
11248
+ textColor,
11249
+ tooltip,
11250
+ backgroundColor
11251
+ });
11712
11252
  });
11713
- name = matcher.record.name;
11714
- params = assign({}, currentLocation.params, location2.params);
11715
- path = matcher.stringify(params);
11716
- }
11717
- const matched = [];
11718
- let parentMatcher = matcher;
11719
- while (parentMatcher) {
11720
- matched.unshift(parentMatcher.record);
11721
- parentMatcher = parentMatcher.parent;
11253
+ }
11254
+ });
11255
+ watch(router.currentRoute, () => {
11256
+ refreshRoutesView();
11257
+ api.notifyComponentUpdate();
11258
+ api.sendInspectorTree(routerInspectorId);
11259
+ api.sendInspectorState(routerInspectorId);
11260
+ });
11261
+ const navigationsLayerId = "router:navigations:" + id;
11262
+ api.addTimelineLayer({
11263
+ id: navigationsLayerId,
11264
+ label: `Router${id ? " " + id : ""} Navigations`,
11265
+ color: 4237508
11266
+ });
11267
+ router.onError((error, to) => {
11268
+ api.addTimelineEvent({
11269
+ layerId: navigationsLayerId,
11270
+ event: {
11271
+ title: "Error during Navigation",
11272
+ subtitle: to.fullPath,
11273
+ logType: "error",
11274
+ time: api.now(),
11275
+ data: { error },
11276
+ groupId: to.meta.__navigationId
11277
+ }
11278
+ });
11279
+ });
11280
+ let navigationId = 0;
11281
+ router.beforeEach((to, from) => {
11282
+ const data = {
11283
+ guard: formatDisplay("beforeEach"),
11284
+ from: formatRouteLocation(from, "Current Location during this navigation"),
11285
+ to: formatRouteLocation(to, "Target location")
11286
+ };
11287
+ Object.defineProperty(to.meta, "__navigationId", { value: navigationId++ });
11288
+ api.addTimelineEvent({
11289
+ layerId: navigationsLayerId,
11290
+ event: {
11291
+ time: api.now(),
11292
+ title: "Start of navigation",
11293
+ subtitle: to.fullPath,
11294
+ data,
11295
+ groupId: to.meta.__navigationId
11296
+ }
11297
+ });
11298
+ });
11299
+ router.afterEach((to, from, failure) => {
11300
+ const data = { guard: formatDisplay("afterEach") };
11301
+ if (failure) {
11302
+ data.failure = { _custom: {
11303
+ type: Error,
11304
+ readOnly: true,
11305
+ display: failure ? failure.message : "",
11306
+ tooltip: "Navigation Failure",
11307
+ value: failure
11308
+ } };
11309
+ data.status = formatDisplay("❌");
11310
+ } else data.status = formatDisplay("✅");
11311
+ data.from = formatRouteLocation(from, "Current Location during this navigation");
11312
+ data.to = formatRouteLocation(to, "Target location");
11313
+ api.addTimelineEvent({
11314
+ layerId: navigationsLayerId,
11315
+ event: {
11316
+ title: "End of navigation",
11317
+ subtitle: to.fullPath,
11318
+ time: api.now(),
11319
+ data,
11320
+ logType: failure ? "warning" : "default",
11321
+ groupId: to.meta.__navigationId
11322
+ }
11323
+ });
11324
+ });
11325
+ const routerInspectorId = "router-inspector:" + id;
11326
+ api.addInspector({
11327
+ id: routerInspectorId,
11328
+ label: "Routes" + (id ? " " + id : ""),
11329
+ icon: "book",
11330
+ treeFilterPlaceholder: "Search routes"
11331
+ });
11332
+ function refreshRoutesView() {
11333
+ if (!activeRoutesPayload) return;
11334
+ const payload = activeRoutesPayload;
11335
+ let routes = matcher.getRoutes().filter((route) => !route.parent || !route.parent.record.components);
11336
+ routes.forEach(resetMatchStateOnRouteRecord);
11337
+ if (payload.filter) routes = routes.filter((route) => isRouteMatching(route, payload.filter.toLowerCase()));
11338
+ routes.forEach((route) => markRouteRecordActive(route, router.currentRoute.value));
11339
+ payload.rootNodes = routes.map(formatRouteRecordForInspector);
11722
11340
  }
11723
- return {
11724
- name,
11725
- path,
11726
- params,
11727
- matched,
11728
- meta: mergeMetaFields(matched)
11729
- };
11730
- }
11731
- routes.forEach((route) => addRoute(route));
11732
- function clearRoutes() {
11733
- matchers.length = 0;
11734
- matcherMap.clear();
11735
- }
11736
- return {
11737
- addRoute,
11738
- resolve,
11739
- removeRoute,
11740
- clearRoutes,
11741
- getRoutes,
11742
- getRecordMatcher
11743
- };
11341
+ let activeRoutesPayload;
11342
+ api.on.getInspectorTree((payload) => {
11343
+ activeRoutesPayload = payload;
11344
+ if (payload.app === app && payload.inspectorId === routerInspectorId) refreshRoutesView();
11345
+ });
11346
+ api.on.getInspectorState((payload) => {
11347
+ if (payload.app === app && payload.inspectorId === routerInspectorId) {
11348
+ const route = matcher.getRoutes().find((route$1) => route$1.record.__vd_id === payload.nodeId);
11349
+ if (route) payload.state = { options: formatRouteRecordMatcherForStateInspector(route) };
11350
+ }
11351
+ });
11352
+ api.sendInspectorTree(routerInspectorId);
11353
+ api.sendInspectorState(routerInspectorId);
11354
+ });
11744
11355
  }
11745
- function paramsFromLocation(params, keys) {
11746
- const newParams = {};
11747
- for (const key of keys) {
11748
- if (key in params)
11749
- newParams[key] = params[key];
11750
- }
11751
- return newParams;
11356
+ function modifierForKey(key) {
11357
+ if (key.optional) return key.repeatable ? "*" : "?";
11358
+ else return key.repeatable ? "+" : "";
11752
11359
  }
11753
- function normalizeRouteRecord(record) {
11754
- const normalized = {
11755
- path: record.path,
11756
- redirect: record.redirect,
11757
- name: record.name,
11758
- meta: record.meta || {},
11759
- aliasOf: record.aliasOf,
11760
- beforeEnter: record.beforeEnter,
11761
- props: normalizeRecordProps(record),
11762
- children: record.children || [],
11763
- instances: {},
11764
- leaveGuards: /* @__PURE__ */ new Set(),
11765
- updateGuards: /* @__PURE__ */ new Set(),
11766
- enterCallbacks: {},
11767
- // must be declared afterwards
11768
- // mods: {},
11769
- components: "components" in record ? record.components || null : record.component && { default: record.component }
11770
- };
11771
- Object.defineProperty(normalized, "mods", {
11772
- value: {}
11360
+ function formatRouteRecordMatcherForStateInspector(route) {
11361
+ const { record } = route;
11362
+ const fields = [{
11363
+ editable: false,
11364
+ key: "path",
11365
+ value: record.path
11366
+ }];
11367
+ if (record.name != null) fields.push({
11368
+ editable: false,
11369
+ key: "name",
11370
+ value: record.name
11773
11371
  });
11774
- return normalized;
11372
+ fields.push({
11373
+ editable: false,
11374
+ key: "regexp",
11375
+ value: route.re
11376
+ });
11377
+ if (route.keys.length) fields.push({
11378
+ editable: false,
11379
+ key: "keys",
11380
+ value: { _custom: {
11381
+ type: null,
11382
+ readOnly: true,
11383
+ display: route.keys.map((key) => `${key.name}${modifierForKey(key)}`).join(" "),
11384
+ tooltip: "Param keys",
11385
+ value: route.keys
11386
+ } }
11387
+ });
11388
+ if (record.redirect != null) fields.push({
11389
+ editable: false,
11390
+ key: "redirect",
11391
+ value: record.redirect
11392
+ });
11393
+ if (route.alias.length) fields.push({
11394
+ editable: false,
11395
+ key: "aliases",
11396
+ value: route.alias.map((alias) => alias.record.path)
11397
+ });
11398
+ if (Object.keys(route.record.meta).length) fields.push({
11399
+ editable: false,
11400
+ key: "meta",
11401
+ value: route.record.meta
11402
+ });
11403
+ fields.push({
11404
+ key: "score",
11405
+ editable: false,
11406
+ value: { _custom: {
11407
+ type: null,
11408
+ readOnly: true,
11409
+ display: route.score.map((score) => score.join(", ")).join(" | "),
11410
+ tooltip: "Score used to sort routes",
11411
+ value: route.score
11412
+ } }
11413
+ });
11414
+ return fields;
11775
11415
  }
11776
- function normalizeRecordProps(record) {
11777
- const propsObject = {};
11778
- const props = record.props || false;
11779
- if ("component" in record) {
11780
- propsObject.default = props;
11781
- } else {
11782
- for (const name in record.components)
11783
- propsObject[name] = typeof props === "object" ? props[name] : props;
11784
- }
11785
- return propsObject;
11786
- }
11787
- function isAliasRecord(record) {
11788
- while (record) {
11789
- if (record.record.aliasOf)
11790
- return true;
11791
- record = record.parent;
11416
+ const PINK_500 = 15485081;
11417
+ const BLUE_600 = 2450411;
11418
+ const LIME_500 = 8702998;
11419
+ const CYAN_400 = 2282478;
11420
+ const ORANGE_400 = 16486972;
11421
+ const DARK = 6710886;
11422
+ const RED_100 = 16704226;
11423
+ const RED_700 = 12131356;
11424
+ function formatRouteRecordForInspector(route) {
11425
+ const tags = [];
11426
+ const { record } = route;
11427
+ if (record.name != null) tags.push({
11428
+ label: String(record.name),
11429
+ textColor: 0,
11430
+ backgroundColor: CYAN_400
11431
+ });
11432
+ if (record.aliasOf) tags.push({
11433
+ label: "alias",
11434
+ textColor: 0,
11435
+ backgroundColor: ORANGE_400
11436
+ });
11437
+ if (route.__vd_match) tags.push({
11438
+ label: "matches",
11439
+ textColor: 0,
11440
+ backgroundColor: PINK_500
11441
+ });
11442
+ if (route.__vd_exactActive) tags.push({
11443
+ label: "exact",
11444
+ textColor: 0,
11445
+ backgroundColor: LIME_500
11446
+ });
11447
+ if (route.__vd_active) tags.push({
11448
+ label: "active",
11449
+ textColor: 0,
11450
+ backgroundColor: BLUE_600
11451
+ });
11452
+ if (record.redirect) tags.push({
11453
+ label: typeof record.redirect === "string" ? `redirect: ${record.redirect}` : "redirects",
11454
+ textColor: 16777215,
11455
+ backgroundColor: DARK
11456
+ });
11457
+ let id = record.__vd_id;
11458
+ if (id == null) {
11459
+ id = String(routeRecordId++);
11460
+ record.__vd_id = id;
11792
11461
  }
11793
- return false;
11794
- }
11795
- function mergeMetaFields(matched) {
11796
- return matched.reduce((meta, record) => assign(meta, record.meta), {});
11462
+ return {
11463
+ id,
11464
+ label: record.path,
11465
+ tags,
11466
+ children: route.children.map(formatRouteRecordForInspector)
11467
+ };
11797
11468
  }
11798
- function mergeOptions(defaults, partialOptions) {
11799
- const options = {};
11800
- for (const key in defaults) {
11801
- options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
11802
- }
11803
- return options;
11469
+ let routeRecordId = 0;
11470
+ const EXTRACT_REGEXP_RE = /^\/(.*)\/([a-z]*)$/;
11471
+ function markRouteRecordActive(route, currentRoute) {
11472
+ const isExactActive = currentRoute.matched.length && isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);
11473
+ route.__vd_exactActive = route.__vd_active = isExactActive;
11474
+ if (!isExactActive) route.__vd_active = currentRoute.matched.some((match) => isSameRouteRecord(match, route.record));
11475
+ route.children.forEach((childRoute) => markRouteRecordActive(childRoute, currentRoute));
11804
11476
  }
11805
- function isSameParam(a, b) {
11806
- return a.name === b.name && a.optional === b.optional && a.repeatable === b.repeatable;
11477
+ function resetMatchStateOnRouteRecord(route) {
11478
+ route.__vd_match = false;
11479
+ route.children.forEach(resetMatchStateOnRouteRecord);
11807
11480
  }
11808
- function checkSameParams(a, b) {
11809
- for (const key of a.keys) {
11810
- if (!key.optional && !b.keys.find(isSameParam.bind(null, key)))
11811
- return warn(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`);
11812
- }
11813
- for (const key of b.keys) {
11814
- if (!key.optional && !a.keys.find(isSameParam.bind(null, key)))
11815
- return warn(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`);
11481
+ function isRouteMatching(route, filter) {
11482
+ const found = String(route.re).match(EXTRACT_REGEXP_RE);
11483
+ route.__vd_match = false;
11484
+ if (!found || found.length < 3) return false;
11485
+ if (new RegExp(found[1].replace(/\$$/, ""), found[2]).test(filter)) {
11486
+ route.children.forEach((child) => isRouteMatching(child, filter));
11487
+ if (route.record.path !== "/" || filter === "/") {
11488
+ route.__vd_match = route.re.test(filter);
11489
+ return true;
11490
+ }
11491
+ return false;
11816
11492
  }
11493
+ const path = route.record.path.toLowerCase();
11494
+ const decodedPath = decode(path);
11495
+ if (!filter.startsWith("/") && (decodedPath.includes(filter) || path.includes(filter))) return true;
11496
+ if (decodedPath.startsWith(filter) || path.startsWith(filter)) return true;
11497
+ if (route.record.name && String(route.record.name).includes(filter)) return true;
11498
+ return route.children.some((child) => isRouteMatching(child, filter));
11817
11499
  }
11818
- function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {
11819
- if (parent && parent.record.name && !mainNormalizedRecord.name && !mainNormalizedRecord.path) {
11820
- warn(`The route named "${String(parent.record.name)}" has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.`);
11821
- }
11500
+ function omit(obj, keys) {
11501
+ const ret = {};
11502
+ for (const key in obj) if (!keys.includes(key)) ret[key] = obj[key];
11503
+ return ret;
11822
11504
  }
11823
- function checkSameNameAsAncestor(record, parent) {
11824
- for (let ancestor = parent; ancestor; ancestor = ancestor.parent) {
11825
- if (ancestor.record.name === record.name) {
11826
- throw new Error(`A route named "${String(record.name)}" has been added as a ${parent === ancestor ? "child" : "descendant"} of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.`);
11827
- }
11505
+ /*!
11506
+ * vue-router v4.6.3
11507
+ * (c) 2025 Eduardo San Martin Morote
11508
+ * @license MIT
11509
+ */
11510
+ let createBaseLocation = () => location.protocol + "//" + location.host;
11511
+ function createCurrentLocation(base, location$1) {
11512
+ const { pathname, search, hash } = location$1;
11513
+ const hashPos = base.indexOf("#");
11514
+ if (hashPos > -1) {
11515
+ let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
11516
+ let pathFromHash = hash.slice(slicePos);
11517
+ if (pathFromHash[0] !== "/") pathFromHash = "/" + pathFromHash;
11518
+ return stripBase(pathFromHash, "");
11828
11519
  }
11520
+ return stripBase(pathname, base) + search + hash;
11829
11521
  }
11830
- function checkMissingParamsInAbsolutePath(record, parent) {
11831
- for (const key of parent.keys) {
11832
- if (!record.keys.find(isSameParam.bind(null, key)))
11833
- return warn(`Absolute path "${record.record.path}" must have the exact same param named "${key.name}" as its parent "${parent.record.path}".`);
11522
+ function useHistoryListeners(base, historyState, currentLocation, replace) {
11523
+ let listeners = [];
11524
+ let teardowns = [];
11525
+ let pauseState = null;
11526
+ const popStateHandler = ({ state }) => {
11527
+ const to = createCurrentLocation(base, location);
11528
+ const from = currentLocation.value;
11529
+ const fromState = historyState.value;
11530
+ let delta = 0;
11531
+ if (state) {
11532
+ currentLocation.value = to;
11533
+ historyState.value = state;
11534
+ if (pauseState && pauseState === from) {
11535
+ pauseState = null;
11536
+ return;
11537
+ }
11538
+ delta = fromState ? state.position - fromState.position : 0;
11539
+ } else replace(to);
11540
+ listeners.forEach((listener) => {
11541
+ listener(currentLocation.value, from, {
11542
+ delta,
11543
+ type: NavigationType.pop,
11544
+ direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown
11545
+ });
11546
+ });
11547
+ };
11548
+ function pauseListeners() {
11549
+ pauseState = currentLocation.value;
11834
11550
  }
11835
- }
11836
- function findInsertionIndex(matcher, matchers) {
11837
- let lower = 0;
11838
- let upper = matchers.length;
11839
- while (lower !== upper) {
11840
- const mid = lower + upper >> 1;
11841
- const sortOrder = comparePathParserScore(matcher, matchers[mid]);
11842
- if (sortOrder < 0) {
11843
- upper = mid;
11844
- } else {
11845
- lower = mid + 1;
11846
- }
11551
+ function listen(callback) {
11552
+ listeners.push(callback);
11553
+ const teardown = () => {
11554
+ const index = listeners.indexOf(callback);
11555
+ if (index > -1) listeners.splice(index, 1);
11556
+ };
11557
+ teardowns.push(teardown);
11558
+ return teardown;
11847
11559
  }
11848
- const insertionAncestor = getInsertionAncestor(matcher);
11849
- if (insertionAncestor) {
11850
- upper = matchers.lastIndexOf(insertionAncestor, upper - 1);
11851
- if (process.env.NODE_ENV !== "production" && upper < 0) {
11852
- warn(`Finding ancestor route "${insertionAncestor.record.path}" failed for "${matcher.record.path}"`);
11560
+ function beforeUnloadListener() {
11561
+ if (document.visibilityState === "hidden") {
11562
+ const { history: history$1 } = window;
11563
+ if (!history$1.state) return;
11564
+ history$1.replaceState(assign({}, history$1.state, { scroll: computeScrollPosition() }), "");
11853
11565
  }
11854
11566
  }
11855
- return upper;
11856
- }
11857
- function getInsertionAncestor(matcher) {
11858
- let ancestor = matcher;
11859
- while (ancestor = ancestor.parent) {
11860
- if (isMatchable(ancestor) && comparePathParserScore(matcher, ancestor) === 0) {
11861
- return ancestor;
11862
- }
11567
+ function destroy() {
11568
+ for (const teardown of teardowns) teardown();
11569
+ teardowns = [];
11570
+ window.removeEventListener("popstate", popStateHandler);
11571
+ window.removeEventListener("pagehide", beforeUnloadListener);
11572
+ document.removeEventListener("visibilitychange", beforeUnloadListener);
11863
11573
  }
11864
- return;
11574
+ window.addEventListener("popstate", popStateHandler);
11575
+ window.addEventListener("pagehide", beforeUnloadListener);
11576
+ document.addEventListener("visibilitychange", beforeUnloadListener);
11577
+ return {
11578
+ pauseListeners,
11579
+ listen,
11580
+ destroy
11581
+ };
11865
11582
  }
11866
- function isMatchable({ record }) {
11867
- return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
11583
+ function buildState(back, current, forward, replaced = false, computeScroll = false) {
11584
+ return {
11585
+ back,
11586
+ current,
11587
+ forward,
11588
+ replaced,
11589
+ position: window.history.length,
11590
+ scroll: computeScroll ? computeScrollPosition() : null
11591
+ };
11868
11592
  }
11869
- function parseQuery(search) {
11870
- const query = {};
11871
- if (search === "" || search === "?")
11872
- return query;
11873
- const hasLeadingIM = search[0] === "?";
11874
- const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&");
11875
- for (let i = 0; i < searchParams.length; ++i) {
11876
- const searchParam = searchParams[i].replace(PLUS_RE, " ");
11877
- const eqPos = searchParam.indexOf("=");
11878
- const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
11879
- const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
11880
- if (key in query) {
11881
- let currentValue = query[key];
11882
- if (!isArray(currentValue)) {
11883
- currentValue = query[key] = [currentValue];
11884
- }
11885
- currentValue.push(value);
11886
- } else {
11887
- query[key] = value;
11593
+ function useHistoryStateNavigation(base) {
11594
+ const { history: history$1, location: location$1 } = window;
11595
+ const currentLocation = { value: createCurrentLocation(base, location$1) };
11596
+ const historyState = { value: history$1.state };
11597
+ if (!historyState.value) changeLocation(currentLocation.value, {
11598
+ back: null,
11599
+ current: currentLocation.value,
11600
+ forward: null,
11601
+ position: history$1.length - 1,
11602
+ replaced: true,
11603
+ scroll: null
11604
+ }, true);
11605
+ function changeLocation(to, state, replace$1) {
11606
+ const hashIndex = base.indexOf("#");
11607
+ const url = hashIndex > -1 ? (location$1.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to;
11608
+ try {
11609
+ history$1[replace$1 ? "replaceState" : "pushState"](state, "", url);
11610
+ historyState.value = state;
11611
+ } catch (err) {
11612
+ if (process.env.NODE_ENV !== "production") warn$1("Error with push/replace State", err);
11613
+ else console.error(err);
11614
+ location$1[replace$1 ? "replace" : "assign"](url);
11888
11615
  }
11889
11616
  }
11890
- return query;
11891
- }
11892
- function stringifyQuery(query) {
11893
- let search = "";
11894
- for (let key in query) {
11895
- const value = query[key];
11896
- key = encodeQueryKey(key);
11897
- if (value == null) {
11898
- if (value !== void 0) {
11899
- search += (search.length ? "&" : "") + key;
11900
- }
11901
- continue;
11902
- }
11903
- const values = isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)];
11904
- values.forEach((value2) => {
11905
- if (value2 !== void 0) {
11906
- search += (search.length ? "&" : "") + key;
11907
- if (value2 != null)
11908
- search += "=" + value2;
11909
- }
11617
+ function replace(to, data) {
11618
+ changeLocation(to, assign({}, history$1.state, buildState(historyState.value.back, to, historyState.value.forward, true), data, { position: historyState.value.position }), true);
11619
+ currentLocation.value = to;
11620
+ }
11621
+ function push(to, data) {
11622
+ const currentState = assign({}, historyState.value, history$1.state, {
11623
+ forward: to,
11624
+ scroll: computeScrollPosition()
11910
11625
  });
11626
+ if (process.env.NODE_ENV !== "production" && !history$1.state) warn$1("history.state seems to have been manually replaced without preserving the necessary values. Make sure to preserve existing history state if you are manually calling history.replaceState:\n\nhistory.replaceState(history.state, '', url)\n\nYou can find more information at https://router.vuejs.org/guide/migration/#Usage-of-history-state");
11627
+ changeLocation(currentState.current, currentState, true);
11628
+ changeLocation(to, assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data), false);
11629
+ currentLocation.value = to;
11911
11630
  }
11912
- return search;
11631
+ return {
11632
+ location: currentLocation,
11633
+ state: historyState,
11634
+ push,
11635
+ replace
11636
+ };
11913
11637
  }
11914
- function normalizeQuery(query) {
11915
- const normalizedQuery = {};
11916
- for (const key in query) {
11917
- const value = query[key];
11918
- if (value !== void 0) {
11919
- normalizedQuery[key] = isArray(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
11920
- }
11638
+ function createWebHistory(base) {
11639
+ base = normalizeBase(base);
11640
+ const historyNavigation = useHistoryStateNavigation(base);
11641
+ const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
11642
+ function go(delta, triggerListeners = true) {
11643
+ if (!triggerListeners) historyListeners.pauseListeners();
11644
+ history.go(delta);
11921
11645
  }
11922
- return normalizedQuery;
11646
+ const routerHistory = assign({
11647
+ location: "",
11648
+ base,
11649
+ go,
11650
+ createHref: createHref.bind(null, base)
11651
+ }, historyNavigation, historyListeners);
11652
+ Object.defineProperty(routerHistory, "location", {
11653
+ enumerable: true,
11654
+ get: () => historyNavigation.location.value
11655
+ });
11656
+ Object.defineProperty(routerHistory, "state", {
11657
+ enumerable: true,
11658
+ get: () => historyNavigation.state.value
11659
+ });
11660
+ return routerHistory;
11923
11661
  }
11924
- const matchedRouteKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
11925
- const viewDepthKey = Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
11926
- const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
11927
- const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
11928
- const routerViewLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
11929
- function useCallbacks() {
11930
- let handlers = [];
11931
- function add(handler) {
11932
- handlers.push(handler);
11933
- return () => {
11934
- const i = handlers.indexOf(handler);
11935
- if (i > -1)
11936
- handlers.splice(i, 1);
11937
- };
11662
+ let TokenType = /* @__PURE__ */ function(TokenType$1) {
11663
+ TokenType$1[TokenType$1["Static"] = 0] = "Static";
11664
+ TokenType$1[TokenType$1["Param"] = 1] = "Param";
11665
+ TokenType$1[TokenType$1["Group"] = 2] = "Group";
11666
+ return TokenType$1;
11667
+ }({});
11668
+ var TokenizerState = /* @__PURE__ */ function(TokenizerState$1) {
11669
+ TokenizerState$1[TokenizerState$1["Static"] = 0] = "Static";
11670
+ TokenizerState$1[TokenizerState$1["Param"] = 1] = "Param";
11671
+ TokenizerState$1[TokenizerState$1["ParamRegExp"] = 2] = "ParamRegExp";
11672
+ TokenizerState$1[TokenizerState$1["ParamRegExpEnd"] = 3] = "ParamRegExpEnd";
11673
+ TokenizerState$1[TokenizerState$1["EscapeNext"] = 4] = "EscapeNext";
11674
+ return TokenizerState$1;
11675
+ }(TokenizerState || {});
11676
+ const ROOT_TOKEN = {
11677
+ type: TokenType.Static,
11678
+ value: ""
11679
+ };
11680
+ const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
11681
+ function tokenizePath(path) {
11682
+ if (!path) return [[]];
11683
+ if (path === "/") return [[ROOT_TOKEN]];
11684
+ if (!path.startsWith("/")) throw new Error(process.env.NODE_ENV !== "production" ? `Route paths should start with a "/": "${path}" should be "/${path}".` : `Invalid path "${path}"`);
11685
+ function crash(message) {
11686
+ throw new Error(`ERR (${state})/"${buffer}": ${message}`);
11938
11687
  }
11939
- function reset() {
11940
- handlers = [];
11688
+ let state = TokenizerState.Static;
11689
+ let previousState = state;
11690
+ const tokens = [];
11691
+ let segment;
11692
+ function finalizeSegment() {
11693
+ if (segment) tokens.push(segment);
11694
+ segment = [];
11941
11695
  }
11942
- return {
11943
- add,
11944
- list: () => handlers.slice(),
11945
- reset
11946
- };
11947
- }
11948
- function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
11949
- const enterCallbackArray = record && // name is defined if record is because of the function overload
11950
- (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
11951
- return () => new Promise((resolve, reject) => {
11952
- const next = (valid) => {
11953
- if (valid === false) {
11954
- reject(createRouterError(4, {
11955
- from,
11956
- to
11957
- }));
11958
- } else if (valid instanceof Error) {
11959
- reject(valid);
11960
- } else if (isRouteLocation(valid)) {
11961
- reject(createRouterError(2, {
11962
- from: to,
11963
- to: valid
11964
- }));
11965
- } else {
11966
- if (enterCallbackArray && // since enterCallbackArray is truthy, both record and name also are
11967
- record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") {
11968
- enterCallbackArray.push(valid);
11969
- }
11970
- resolve();
11971
- }
11972
- };
11973
- const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, process.env.NODE_ENV !== "production" ? canOnlyBeCalledOnce(next, to, from) : next));
11974
- let guardCall = Promise.resolve(guardReturn);
11975
- if (guard.length < 3)
11976
- guardCall = guardCall.then(next);
11977
- if (process.env.NODE_ENV !== "production" && guard.length > 2) {
11978
- const message = `The "next" callback was never called inside of ${guard.name ? '"' + guard.name + '"' : ""}:
11979
- ${guard.toString()}
11980
- . If you are returning a value instead of calling "next", make sure to remove the "next" parameter from your function.`;
11981
- if (typeof guardReturn === "object" && "then" in guardReturn) {
11982
- guardCall = guardCall.then((resolvedValue) => {
11983
- if (!next._called) {
11984
- warn(message);
11985
- return Promise.reject(new Error("Invalid navigation guard"));
11986
- }
11987
- return resolvedValue;
11988
- });
11989
- } else if (guardReturn !== void 0) {
11990
- if (!next._called) {
11991
- warn(message);
11992
- reject(new Error("Invalid navigation guard"));
11993
- return;
11994
- }
11995
- }
11996
- }
11997
- guardCall.catch((err) => reject(err));
11998
- });
11999
- }
12000
- function canOnlyBeCalledOnce(next, to, from) {
12001
- let called = 0;
12002
- return function() {
12003
- if (called++ === 1)
12004
- warn(`The "next" callback was called more than once in one navigation guard when going from "${from.fullPath}" to "${to.fullPath}". It should be called exactly one time in each navigation guard. This will fail in production.`);
12005
- next._called = true;
12006
- if (called === 1)
12007
- next.apply(null, arguments);
12008
- };
12009
- }
12010
- function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
12011
- const guards = [];
12012
- for (const record of matched) {
12013
- if (process.env.NODE_ENV !== "production" && !record.components && !record.children.length) {
12014
- warn(`Record with path "${record.path}" is either missing a "component(s)" or "children" property.`);
11696
+ let i = 0;
11697
+ let char;
11698
+ let buffer = "";
11699
+ let customRe = "";
11700
+ function consumeBuffer() {
11701
+ if (!buffer) return;
11702
+ if (state === TokenizerState.Static) segment.push({
11703
+ type: TokenType.Static,
11704
+ value: buffer
11705
+ });
11706
+ else if (state === TokenizerState.Param || state === TokenizerState.ParamRegExp || state === TokenizerState.ParamRegExpEnd) {
11707
+ if (segment.length > 1 && (char === "*" || char === "+")) crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
11708
+ segment.push({
11709
+ type: TokenType.Param,
11710
+ value: buffer,
11711
+ regexp: customRe,
11712
+ repeatable: char === "*" || char === "+",
11713
+ optional: char === "*" || char === "?"
11714
+ });
11715
+ } else crash("Invalid state to consume buffer");
11716
+ buffer = "";
11717
+ }
11718
+ function addCharToBuffer() {
11719
+ buffer += char;
11720
+ }
11721
+ while (i < path.length) {
11722
+ char = path[i++];
11723
+ if (char === "\\" && state !== TokenizerState.ParamRegExp) {
11724
+ previousState = state;
11725
+ state = TokenizerState.EscapeNext;
11726
+ continue;
12015
11727
  }
12016
- for (const name in record.components) {
12017
- let rawComponent = record.components[name];
12018
- if (process.env.NODE_ENV !== "production") {
12019
- if (!rawComponent || typeof rawComponent !== "object" && typeof rawComponent !== "function") {
12020
- warn(`Component "${name}" in record with path "${record.path}" is not a valid component. Received "${String(rawComponent)}".`);
12021
- throw new Error("Invalid route component");
12022
- } else if ("then" in rawComponent) {
12023
- warn(`Component "${name}" in record with path "${record.path}" is a Promise instead of a function that returns a Promise. Did you write "import('./MyPage.vue')" instead of "() => import('./MyPage.vue')" ? This will break in production if not fixed.`);
12024
- const promise = rawComponent;
12025
- rawComponent = () => promise;
12026
- } else if (rawComponent.__asyncLoader && // warn only once per component
12027
- !rawComponent.__warnedDefineAsync) {
12028
- rawComponent.__warnedDefineAsync = true;
12029
- warn(`Component "${name}" in record with path "${record.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`);
12030
- }
12031
- }
12032
- if (guardType !== "beforeRouteEnter" && !record.instances[name])
12033
- continue;
12034
- if (isRouteComponent(rawComponent)) {
12035
- const options = rawComponent.__vccOpts || rawComponent;
12036
- const guard = options[guardType];
12037
- guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
12038
- } else {
12039
- let componentPromise = rawComponent();
12040
- if (process.env.NODE_ENV !== "production" && !("catch" in componentPromise)) {
12041
- warn(`Component "${name}" in record with path "${record.path}" is a function that does not return a Promise. If you were passing a functional component, make sure to add a "displayName" to the component. This will break in production if not fixed.`);
12042
- componentPromise = Promise.resolve(componentPromise);
11728
+ switch (state) {
11729
+ case TokenizerState.Static:
11730
+ if (char === "/") {
11731
+ if (buffer) consumeBuffer();
11732
+ finalizeSegment();
11733
+ } else if (char === ":") {
11734
+ consumeBuffer();
11735
+ state = TokenizerState.Param;
11736
+ } else addCharToBuffer();
11737
+ break;
11738
+ case TokenizerState.EscapeNext:
11739
+ addCharToBuffer();
11740
+ state = previousState;
11741
+ break;
11742
+ case TokenizerState.Param:
11743
+ if (char === "(") state = TokenizerState.ParamRegExp;
11744
+ else if (VALID_PARAM_RE.test(char)) addCharToBuffer();
11745
+ else {
11746
+ consumeBuffer();
11747
+ state = TokenizerState.Static;
11748
+ if (char !== "*" && char !== "?" && char !== "+") i--;
12043
11749
  }
12044
- guards.push(() => componentPromise.then((resolved) => {
12045
- if (!resolved)
12046
- throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
12047
- const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
12048
- record.mods[name] = resolved;
12049
- record.components[name] = resolvedComponent;
12050
- const options = resolvedComponent.__vccOpts || resolvedComponent;
12051
- const guard = options[guardType];
12052
- return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
12053
- }));
12054
- }
11750
+ break;
11751
+ case TokenizerState.ParamRegExp:
11752
+ if (char === ")") if (customRe[customRe.length - 1] == "\\") customRe = customRe.slice(0, -1) + char;
11753
+ else state = TokenizerState.ParamRegExpEnd;
11754
+ else customRe += char;
11755
+ break;
11756
+ case TokenizerState.ParamRegExpEnd:
11757
+ consumeBuffer();
11758
+ state = TokenizerState.Static;
11759
+ if (char !== "*" && char !== "?" && char !== "+") i--;
11760
+ customRe = "";
11761
+ break;
11762
+ default:
11763
+ crash("Unknown state");
11764
+ break;
12055
11765
  }
12056
11766
  }
12057
- return guards;
11767
+ if (state === TokenizerState.ParamRegExp) crash(`Unfinished custom RegExp for param "${buffer}"`);
11768
+ consumeBuffer();
11769
+ finalizeSegment();
11770
+ return tokens;
12058
11771
  }
12059
- function useLink(props) {
12060
- const router = inject(routerKey);
12061
- const currentRoute = inject(routeLocationKey);
12062
- let hasPrevious = false;
12063
- let previousTo = null;
12064
- const route = computed(() => {
12065
- const to = unref(props.to);
12066
- if (process.env.NODE_ENV !== "production" && (!hasPrevious || to !== previousTo)) {
12067
- if (!isRouteLocation(to)) {
12068
- if (hasPrevious) {
12069
- warn(`Invalid value for prop "to" in useLink()
12070
- - to:`, to, `
12071
- - previous to:`, previousTo, `
12072
- - props:`, props);
12073
- } else {
12074
- warn(`Invalid value for prop "to" in useLink()
12075
- - to:`, to, `
12076
- - props:`, props);
11772
+ const BASE_PARAM_PATTERN = "[^/]+?";
11773
+ const BASE_PATH_PARSER_OPTIONS = {
11774
+ sensitive: false,
11775
+ strict: false,
11776
+ start: true,
11777
+ end: true
11778
+ };
11779
+ var PathScore = /* @__PURE__ */ function(PathScore$1) {
11780
+ PathScore$1[PathScore$1["_multiplier"] = 10] = "_multiplier";
11781
+ PathScore$1[PathScore$1["Root"] = 90] = "Root";
11782
+ PathScore$1[PathScore$1["Segment"] = 40] = "Segment";
11783
+ PathScore$1[PathScore$1["SubSegment"] = 30] = "SubSegment";
11784
+ PathScore$1[PathScore$1["Static"] = 40] = "Static";
11785
+ PathScore$1[PathScore$1["Dynamic"] = 20] = "Dynamic";
11786
+ PathScore$1[PathScore$1["BonusCustomRegExp"] = 10] = "BonusCustomRegExp";
11787
+ PathScore$1[PathScore$1["BonusWildcard"] = -50] = "BonusWildcard";
11788
+ PathScore$1[PathScore$1["BonusRepeatable"] = -20] = "BonusRepeatable";
11789
+ PathScore$1[PathScore$1["BonusOptional"] = -8] = "BonusOptional";
11790
+ PathScore$1[PathScore$1["BonusStrict"] = 0.7000000000000001] = "BonusStrict";
11791
+ PathScore$1[PathScore$1["BonusCaseSensitive"] = 0.25] = "BonusCaseSensitive";
11792
+ return PathScore$1;
11793
+ }(PathScore || {});
11794
+ const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
11795
+ function tokensToParser(segments, extraOptions) {
11796
+ const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
11797
+ const score = [];
11798
+ let pattern = options.start ? "^" : "";
11799
+ const keys = [];
11800
+ for (const segment of segments) {
11801
+ const segmentScores = segment.length ? [] : [PathScore.Root];
11802
+ if (options.strict && !segment.length) pattern += "/";
11803
+ for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
11804
+ const token = segment[tokenIndex];
11805
+ let subSegmentScore = PathScore.Segment + (options.sensitive ? PathScore.BonusCaseSensitive : 0);
11806
+ if (token.type === TokenType.Static) {
11807
+ if (!tokenIndex) pattern += "/";
11808
+ pattern += token.value.replace(REGEX_CHARS_RE, "\\$&");
11809
+ subSegmentScore += PathScore.Static;
11810
+ } else if (token.type === TokenType.Param) {
11811
+ const { value, repeatable, optional, regexp } = token;
11812
+ keys.push({
11813
+ name: value,
11814
+ repeatable,
11815
+ optional
11816
+ });
11817
+ const re$1 = regexp ? regexp : BASE_PARAM_PATTERN;
11818
+ if (re$1 !== BASE_PARAM_PATTERN) {
11819
+ subSegmentScore += PathScore.BonusCustomRegExp;
11820
+ try {
11821
+ `${re$1}`;
11822
+ } catch (err) {
11823
+ throw new Error(`Invalid custom RegExp for param "${value}" (${re$1}): ` + err.message);
11824
+ }
12077
11825
  }
11826
+ let subPattern = repeatable ? `((?:${re$1})(?:/(?:${re$1}))*)` : `(${re$1})`;
11827
+ if (!tokenIndex) subPattern = optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
11828
+ if (optional) subPattern += "?";
11829
+ pattern += subPattern;
11830
+ subSegmentScore += PathScore.Dynamic;
11831
+ if (optional) subSegmentScore += PathScore.BonusOptional;
11832
+ if (repeatable) subSegmentScore += PathScore.BonusRepeatable;
11833
+ if (re$1 === ".*") subSegmentScore += PathScore.BonusWildcard;
12078
11834
  }
12079
- previousTo = to;
12080
- hasPrevious = true;
11835
+ segmentScores.push(subSegmentScore);
12081
11836
  }
12082
- return router.resolve(to);
12083
- });
12084
- const activeRecordIndex = computed(() => {
12085
- const { matched } = route.value;
12086
- const { length } = matched;
12087
- const routeMatched = matched[length - 1];
12088
- const currentMatched = currentRoute.matched;
12089
- if (!routeMatched || !currentMatched.length)
12090
- return -1;
12091
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
12092
- if (index > -1)
12093
- return index;
12094
- const parentRecordPath = getOriginalPath(matched[length - 2]);
12095
- return (
12096
- // we are dealing with nested routes
12097
- length > 1 && // if the parent and matched route have the same path, this link is
12098
- // referring to the empty child. Or we currently are on a different
12099
- // child of the same parent
12100
- getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
12101
- currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
12102
- );
12103
- });
12104
- const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
12105
- const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
12106
- function navigate(e = {}) {
12107
- if (guardEvent(e)) {
12108
- const p = router[unref(props.replace) ? "replace" : "push"](
12109
- unref(props.to)
12110
- // avoid uncaught errors are they are logged anyway
12111
- ).catch(noop);
12112
- if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) {
12113
- document.startViewTransition(() => p);
12114
- }
12115
- return p;
11837
+ score.push(segmentScores);
11838
+ }
11839
+ if (options.strict && options.end) {
11840
+ const i = score.length - 1;
11841
+ score[i][score[i].length - 1] += PathScore.BonusStrict;
11842
+ }
11843
+ if (!options.strict) pattern += "/?";
11844
+ if (options.end) pattern += "$";
11845
+ else if (options.strict && !pattern.endsWith("/")) pattern += "(?:/|$)";
11846
+ const re = new RegExp(pattern, options.sensitive ? "" : "i");
11847
+ function parse(path) {
11848
+ const match = path.match(re);
11849
+ const params = {};
11850
+ if (!match) return null;
11851
+ for (let i = 1; i < match.length; i++) {
11852
+ const value = match[i] || "";
11853
+ const key = keys[i - 1];
11854
+ params[key.name] = value && key.repeatable ? value.split("/") : value;
12116
11855
  }
12117
- return Promise.resolve();
11856
+ return params;
12118
11857
  }
12119
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
12120
- const instance = getCurrentInstance();
12121
- if (instance) {
12122
- const linkContextDevtools = {
12123
- route: route.value,
12124
- isActive: isActive.value,
12125
- isExactActive: isExactActive.value,
12126
- error: null
12127
- };
12128
- instance.__vrl_devtools = instance.__vrl_devtools || [];
12129
- instance.__vrl_devtools.push(linkContextDevtools);
12130
- watchEffect(() => {
12131
- linkContextDevtools.route = route.value;
12132
- linkContextDevtools.isActive = isActive.value;
12133
- linkContextDevtools.isExactActive = isExactActive.value;
12134
- linkContextDevtools.error = isRouteLocation(unref(props.to)) ? null : 'Invalid "to" value';
12135
- }, { flush: "post" });
11858
+ function stringify(params) {
11859
+ let path = "";
11860
+ let avoidDuplicatedSlash = false;
11861
+ for (const segment of segments) {
11862
+ if (!avoidDuplicatedSlash || !path.endsWith("/")) path += "/";
11863
+ avoidDuplicatedSlash = false;
11864
+ for (const token of segment) if (token.type === TokenType.Static) path += token.value;
11865
+ else if (token.type === TokenType.Param) {
11866
+ const { value, repeatable, optional } = token;
11867
+ const param = value in params ? params[value] : "";
11868
+ if (isArray(param) && !repeatable) throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
11869
+ const text = isArray(param) ? param.join("/") : param;
11870
+ if (!text) if (optional) {
11871
+ if (segment.length < 2) if (path.endsWith("/")) path = path.slice(0, -1);
11872
+ else avoidDuplicatedSlash = true;
11873
+ } else throw new Error(`Missing required param "${value}"`);
11874
+ path += text;
11875
+ }
12136
11876
  }
11877
+ return path || "/";
12137
11878
  }
12138
11879
  return {
12139
- route,
12140
- href: computed(() => route.value.href),
12141
- isActive,
12142
- isExactActive,
12143
- navigate
11880
+ re,
11881
+ score,
11882
+ keys,
11883
+ parse,
11884
+ stringify
12144
11885
  };
12145
11886
  }
12146
- function preferSingleVNode(vnodes) {
12147
- return vnodes.length === 1 ? vnodes[0] : vnodes;
11887
+ function compareScoreArray(a, b) {
11888
+ let i = 0;
11889
+ while (i < a.length && i < b.length) {
11890
+ const diff = b[i] - a[i];
11891
+ if (diff) return diff;
11892
+ i++;
11893
+ }
11894
+ if (a.length < b.length) return a.length === 1 && a[0] === PathScore.Static + PathScore.Segment ? -1 : 1;
11895
+ else if (a.length > b.length) return b.length === 1 && b[0] === PathScore.Static + PathScore.Segment ? 1 : -1;
11896
+ return 0;
12148
11897
  }
12149
- const RouterLinkImpl = /* @__PURE__ */ defineComponent({
12150
- name: "RouterLink",
12151
- compatConfig: { MODE: 3 },
12152
- props: {
12153
- to: {
12154
- type: [String, Object],
12155
- required: true
12156
- },
12157
- replace: Boolean,
12158
- activeClass: String,
12159
- // inactiveClass: String,
12160
- exactActiveClass: String,
12161
- custom: Boolean,
12162
- ariaCurrentValue: {
12163
- type: String,
12164
- default: "page"
12165
- },
12166
- viewTransition: Boolean
12167
- },
12168
- useLink,
12169
- setup(props, { slots }) {
12170
- const link = reactive(useLink(props));
12171
- const { options } = inject(routerKey);
12172
- const elClass = computed(() => ({
12173
- [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
12174
- // [getLinkClass(
12175
- // props.inactiveClass,
12176
- // options.linkInactiveClass,
12177
- // 'router-link-inactive'
12178
- // )]: !link.isExactActive,
12179
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
12180
- }));
12181
- return () => {
12182
- const children = slots.default && preferSingleVNode(slots.default(link));
12183
- return props.custom ? children : h("a", {
12184
- "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
12185
- href: link.href,
12186
- // this would override user added attrs but Vue will still add
12187
- // the listener, so we end up triggering both
12188
- onClick: link.navigate,
12189
- class: elClass.value
12190
- }, children);
12191
- };
11898
+ function comparePathParserScore(a, b) {
11899
+ let i = 0;
11900
+ const aScore = a.score;
11901
+ const bScore = b.score;
11902
+ while (i < aScore.length && i < bScore.length) {
11903
+ const comp = compareScoreArray(aScore[i], bScore[i]);
11904
+ if (comp) return comp;
11905
+ i++;
12192
11906
  }
12193
- });
12194
- const RouterLink = RouterLinkImpl;
12195
- function guardEvent(e) {
12196
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
12197
- return;
12198
- if (e.defaultPrevented)
12199
- return;
12200
- if (e.button !== void 0 && e.button !== 0)
12201
- return;
12202
- if (e.currentTarget && e.currentTarget.getAttribute) {
12203
- const target = e.currentTarget.getAttribute("target");
12204
- if (/\b_blank\b/i.test(target))
12205
- return;
11907
+ if (Math.abs(bScore.length - aScore.length) === 1) {
11908
+ if (isLastScoreNegative(aScore)) return 1;
11909
+ if (isLastScoreNegative(bScore)) return -1;
12206
11910
  }
12207
- if (e.preventDefault)
12208
- e.preventDefault();
12209
- return true;
11911
+ return bScore.length - aScore.length;
12210
11912
  }
12211
- function includesParams(outer, inner) {
12212
- for (const key in inner) {
12213
- const innerValue = inner[key];
12214
- const outerValue = outer[key];
12215
- if (typeof innerValue === "string") {
12216
- if (innerValue !== outerValue)
12217
- return false;
12218
- } else {
12219
- if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
12220
- return false;
11913
+ function isLastScoreNegative(score) {
11914
+ const last = score[score.length - 1];
11915
+ return score.length > 0 && last[last.length - 1] < 0;
11916
+ }
11917
+ const PATH_PARSER_OPTIONS_DEFAULTS = {
11918
+ strict: false,
11919
+ end: true,
11920
+ sensitive: false
11921
+ };
11922
+ function createRouteRecordMatcher(record, parent, options) {
11923
+ const parser = tokensToParser(tokenizePath(record.path), options);
11924
+ if (process.env.NODE_ENV !== "production") {
11925
+ const existingKeys = /* @__PURE__ */ new Set();
11926
+ for (const key of parser.keys) {
11927
+ if (existingKeys.has(key.name)) warn$1(`Found duplicated params with name "${key.name}" for path "${record.path}". Only the last one will be available on "$route.params".`);
11928
+ existingKeys.add(key.name);
12221
11929
  }
12222
11930
  }
12223
- return true;
12224
- }
12225
- function getOriginalPath(record) {
12226
- return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
12227
- }
12228
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
12229
- const RouterViewImpl = /* @__PURE__ */ defineComponent({
12230
- name: "RouterView",
12231
- // #674 we manually inherit them
12232
- inheritAttrs: false,
12233
- props: {
12234
- name: {
12235
- type: String,
12236
- default: "default"
12237
- },
12238
- route: Object
12239
- },
12240
- // Better compat for @vue/compat users
12241
- // https://github.com/vuejs/router/issues/1315
12242
- compatConfig: { MODE: 3 },
12243
- setup(props, { attrs, slots }) {
12244
- process.env.NODE_ENV !== "production" && warnDeprecatedUsage();
12245
- const injectedRoute = inject(routerViewLocationKey);
12246
- const routeToDisplay = computed(() => props.route || injectedRoute.value);
12247
- const injectedDepth = inject(viewDepthKey, 0);
12248
- const depth = computed(() => {
12249
- let initialDepth = unref(injectedDepth);
12250
- const { matched } = routeToDisplay.value;
12251
- let matchedRoute;
12252
- while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) {
12253
- initialDepth++;
12254
- }
12255
- return initialDepth;
12256
- });
12257
- const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
12258
- provide(viewDepthKey, computed(() => depth.value + 1));
12259
- provide(matchedRouteKey, matchedRouteRef);
12260
- provide(routerViewLocationKey, routeToDisplay);
12261
- const viewRef = ref();
12262
- watch(() => [viewRef.value, matchedRouteRef.value, props.name], ([instance, to, name], [oldInstance, from, oldName]) => {
12263
- if (to) {
12264
- to.instances[name] = instance;
12265
- if (from && from !== to && instance && instance === oldInstance) {
12266
- if (!to.leaveGuards.size) {
12267
- to.leaveGuards = from.leaveGuards;
12268
- }
12269
- if (!to.updateGuards.size) {
12270
- to.updateGuards = from.updateGuards;
12271
- }
12272
- }
12273
- }
12274
- if (instance && to && // if there is no instance but to and from are the same this might be
12275
- // the first visit
12276
- (!from || !isSameRouteRecord(to, from) || !oldInstance)) {
12277
- (to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
12278
- }
12279
- }, { flush: "post" });
12280
- return () => {
12281
- const route = routeToDisplay.value;
12282
- const currentName = props.name;
12283
- const matchedRoute = matchedRouteRef.value;
12284
- const ViewComponent = matchedRoute && matchedRoute.components[currentName];
12285
- if (!ViewComponent) {
12286
- return normalizeSlot(slots.default, { Component: ViewComponent, route });
12287
- }
12288
- const routePropsOption = matchedRoute.props[currentName];
12289
- const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
12290
- const onVnodeUnmounted = (vnode) => {
12291
- if (vnode.component.isUnmounted) {
12292
- matchedRoute.instances[currentName] = null;
12293
- }
12294
- };
12295
- const component = h(ViewComponent, assign({}, routeProps, attrs, {
12296
- onVnodeUnmounted,
12297
- ref: viewRef
12298
- }));
12299
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser && component.ref) {
12300
- const info = {
12301
- depth: depth.value,
12302
- name: matchedRoute.name,
12303
- path: matchedRoute.path,
12304
- meta: matchedRoute.meta
12305
- };
12306
- const internalInstances = isArray(component.ref) ? component.ref.map((r) => r.i) : [component.ref.i];
12307
- internalInstances.forEach((instance) => {
12308
- instance.__vrv_devtools = info;
12309
- });
12310
- }
12311
- return (
12312
- // pass the vnode to the slot as a prop.
12313
- // h and <component :is="..."> both accept vnodes
12314
- normalizeSlot(slots.default, { Component: component, route }) || component
12315
- );
12316
- };
11931
+ const matcher = assign(parser, {
11932
+ record,
11933
+ parent,
11934
+ children: [],
11935
+ alias: []
11936
+ });
11937
+ if (parent) {
11938
+ if (!matcher.record.aliasOf === !parent.record.aliasOf) parent.children.push(matcher);
12317
11939
  }
12318
- });
12319
- function normalizeSlot(slot, data) {
12320
- if (!slot)
12321
- return null;
12322
- const slotContent = slot(data);
12323
- return slotContent.length === 1 ? slotContent[0] : slotContent;
11940
+ return matcher;
12324
11941
  }
12325
- const RouterView = RouterViewImpl;
12326
- function warnDeprecatedUsage() {
12327
- const instance = getCurrentInstance();
12328
- const parentName = instance.parent && instance.parent.type.name;
12329
- const parentSubTreeType = instance.parent && instance.parent.subTree && instance.parent.subTree.type;
12330
- if (parentName && (parentName === "KeepAlive" || parentName.includes("Transition")) && typeof parentSubTreeType === "object" && parentSubTreeType.name === "RouterView") {
12331
- const comp = parentName === "KeepAlive" ? "keep-alive" : "transition";
12332
- warn(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.
12333
- Use slot props instead:
12334
-
12335
- <router-view v-slot="{ Component }">
12336
- <${comp}>
12337
- <component :is="Component" />
12338
- </${comp}>
12339
- </router-view>`);
11942
+ function createRouterMatcher(routes, globalOptions) {
11943
+ const matchers = [];
11944
+ const matcherMap = /* @__PURE__ */ new Map();
11945
+ globalOptions = mergeOptions(PATH_PARSER_OPTIONS_DEFAULTS, globalOptions);
11946
+ function getRecordMatcher(name) {
11947
+ return matcherMap.get(name);
12340
11948
  }
12341
- }
12342
- function formatRouteLocation(routeLocation, tooltip) {
12343
- const copy = assign({}, routeLocation, {
12344
- // remove variables that can contain vue instances
12345
- matched: routeLocation.matched.map((matched) => omit(matched, ["instances", "children", "aliasOf"]))
12346
- });
12347
- return {
12348
- _custom: {
12349
- type: null,
12350
- readOnly: true,
12351
- display: routeLocation.fullPath,
12352
- tooltip,
12353
- value: copy
12354
- }
12355
- };
12356
- }
12357
- function formatDisplay(display) {
12358
- return {
12359
- _custom: {
12360
- display
12361
- }
12362
- };
12363
- }
12364
- let routerId = 0;
12365
- function addDevtools(app, router, matcher) {
12366
- if (router.__hasDevtools)
12367
- return;
12368
- router.__hasDevtools = true;
12369
- const id = routerId++;
12370
- setupDevtoolsPlugin({
12371
- id: "org.vuejs.router" + (id ? "." + id : ""),
12372
- label: "Vue Router",
12373
- packageName: "vue-router",
12374
- homepage: "https://router.vuejs.org",
12375
- logo: "https://router.vuejs.org/logo.png",
12376
- componentStateTypes: ["Routing"],
12377
- app
12378
- }, (api) => {
12379
- if (typeof api.now !== "function") {
12380
- console.warn("[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
12381
- }
12382
- api.on.inspectComponent((payload, ctx) => {
12383
- if (payload.instanceData) {
12384
- payload.instanceData.state.push({
12385
- type: "Routing",
12386
- key: "$route",
12387
- editable: false,
12388
- value: formatRouteLocation(router.currentRoute.value, "Current Route")
12389
- });
12390
- }
12391
- });
12392
- api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {
12393
- if (componentInstance.__vrv_devtools) {
12394
- const info = componentInstance.__vrv_devtools;
12395
- node.tags.push({
12396
- label: (info.name ? `${info.name.toString()}: ` : "") + info.path,
12397
- textColor: 0,
12398
- tooltip: "This component is rendered by &lt;router-view&gt;",
12399
- backgroundColor: PINK_500
12400
- });
12401
- }
12402
- if (isArray(componentInstance.__vrl_devtools)) {
12403
- componentInstance.__devtoolsApi = api;
12404
- componentInstance.__vrl_devtools.forEach((devtoolsData) => {
12405
- let label = devtoolsData.route.path;
12406
- let backgroundColor = ORANGE_400;
12407
- let tooltip = "";
12408
- let textColor = 0;
12409
- if (devtoolsData.error) {
12410
- label = devtoolsData.error;
12411
- backgroundColor = RED_100;
12412
- textColor = RED_700;
12413
- } else if (devtoolsData.isExactActive) {
12414
- backgroundColor = LIME_500;
12415
- tooltip = "This is exactly active";
12416
- } else if (devtoolsData.isActive) {
12417
- backgroundColor = BLUE_600;
12418
- tooltip = "This link is active";
12419
- }
12420
- node.tags.push({
12421
- label,
12422
- textColor,
12423
- tooltip,
12424
- backgroundColor
12425
- });
12426
- });
12427
- }
12428
- });
12429
- watch(router.currentRoute, () => {
12430
- refreshRoutesView();
12431
- api.notifyComponentUpdate();
12432
- api.sendInspectorTree(routerInspectorId);
12433
- api.sendInspectorState(routerInspectorId);
12434
- });
12435
- const navigationsLayerId = "router:navigations:" + id;
12436
- api.addTimelineLayer({
12437
- id: navigationsLayerId,
12438
- label: `Router${id ? " " + id : ""} Navigations`,
12439
- color: 4237508
12440
- });
12441
- router.onError((error, to) => {
12442
- api.addTimelineEvent({
12443
- layerId: navigationsLayerId,
12444
- event: {
12445
- title: "Error during Navigation",
12446
- subtitle: to.fullPath,
12447
- logType: "error",
12448
- time: api.now(),
12449
- data: { error },
12450
- groupId: to.meta.__navigationId
12451
- }
12452
- });
12453
- });
12454
- let navigationId = 0;
12455
- router.beforeEach((to, from) => {
12456
- const data = {
12457
- guard: formatDisplay("beforeEach"),
12458
- from: formatRouteLocation(from, "Current Location during this navigation"),
12459
- to: formatRouteLocation(to, "Target location")
12460
- };
12461
- Object.defineProperty(to.meta, "__navigationId", {
12462
- value: navigationId++
12463
- });
12464
- api.addTimelineEvent({
12465
- layerId: navigationsLayerId,
12466
- event: {
12467
- time: api.now(),
12468
- title: "Start of navigation",
12469
- subtitle: to.fullPath,
12470
- data,
12471
- groupId: to.meta.__navigationId
12472
- }
12473
- });
12474
- });
12475
- router.afterEach((to, from, failure) => {
12476
- const data = {
12477
- guard: formatDisplay("afterEach")
12478
- };
12479
- if (failure) {
12480
- data.failure = {
12481
- _custom: {
12482
- type: Error,
12483
- readOnly: true,
12484
- display: failure ? failure.message : "",
12485
- tooltip: "Navigation Failure",
12486
- value: failure
12487
- }
12488
- };
12489
- data.status = formatDisplay("❌");
12490
- } else {
12491
- data.status = formatDisplay("✅");
12492
- }
12493
- data.from = formatRouteLocation(from, "Current Location during this navigation");
12494
- data.to = formatRouteLocation(to, "Target location");
12495
- api.addTimelineEvent({
12496
- layerId: navigationsLayerId,
12497
- event: {
12498
- title: "End of navigation",
12499
- subtitle: to.fullPath,
12500
- time: api.now(),
12501
- data,
12502
- logType: failure ? "warning" : "default",
12503
- groupId: to.meta.__navigationId
12504
- }
12505
- });
12506
- });
12507
- const routerInspectorId = "router-inspector:" + id;
12508
- api.addInspector({
12509
- id: routerInspectorId,
12510
- label: "Routes" + (id ? " " + id : ""),
12511
- icon: "book",
12512
- treeFilterPlaceholder: "Search routes"
12513
- });
12514
- function refreshRoutesView() {
12515
- if (!activeRoutesPayload)
12516
- return;
12517
- const payload = activeRoutesPayload;
12518
- let routes = matcher.getRoutes().filter((route) => !route.parent || // these routes have a parent with no component which will not appear in the view
12519
- // therefore we still need to include them
12520
- !route.parent.record.components);
12521
- routes.forEach(resetMatchStateOnRouteRecord);
12522
- if (payload.filter) {
12523
- routes = routes.filter((route) => (
12524
- // save matches state based on the payload
12525
- isRouteMatching(route, payload.filter.toLowerCase())
12526
- ));
12527
- }
12528
- routes.forEach((route) => markRouteRecordActive(route, router.currentRoute.value));
12529
- payload.rootNodes = routes.map(formatRouteRecordForInspector);
11949
+ function addRoute(record, parent, originalRecord) {
11950
+ const isRootAdd = !originalRecord;
11951
+ const mainNormalizedRecord = normalizeRouteRecord(record);
11952
+ if (process.env.NODE_ENV !== "production") checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent);
11953
+ mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
11954
+ const options = mergeOptions(globalOptions, record);
11955
+ const normalizedRecords = [mainNormalizedRecord];
11956
+ if ("alias" in record) {
11957
+ const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
11958
+ for (const alias of aliases) normalizedRecords.push(normalizeRouteRecord(assign({}, mainNormalizedRecord, {
11959
+ components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
11960
+ path: alias,
11961
+ aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
11962
+ })));
12530
11963
  }
12531
- let activeRoutesPayload;
12532
- api.on.getInspectorTree((payload) => {
12533
- activeRoutesPayload = payload;
12534
- if (payload.app === app && payload.inspectorId === routerInspectorId) {
12535
- refreshRoutesView();
11964
+ let matcher;
11965
+ let originalMatcher;
11966
+ for (const normalizedRecord of normalizedRecords) {
11967
+ const { path } = normalizedRecord;
11968
+ if (parent && path[0] !== "/") {
11969
+ const parentPath = parent.record.path;
11970
+ const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
11971
+ normalizedRecord.path = parent.record.path + (path && connectingSlash + path);
12536
11972
  }
12537
- });
12538
- api.on.getInspectorState((payload) => {
12539
- if (payload.app === app && payload.inspectorId === routerInspectorId) {
12540
- const routes = matcher.getRoutes();
12541
- const route = routes.find((route2) => route2.record.__vd_id === payload.nodeId);
12542
- if (route) {
12543
- payload.state = {
12544
- options: formatRouteRecordMatcherForStateInspector(route)
12545
- };
11973
+ if (process.env.NODE_ENV !== "production" && normalizedRecord.path === "*") throw new Error('Catch all routes ("*") must now be defined using a param with a custom regexp.\nSee more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes.');
11974
+ matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
11975
+ if (process.env.NODE_ENV !== "production" && parent && path[0] === "/") checkMissingParamsInAbsolutePath(matcher, parent);
11976
+ if (originalRecord) {
11977
+ originalRecord.alias.push(matcher);
11978
+ if (process.env.NODE_ENV !== "production") checkSameParams(originalRecord, matcher);
11979
+ } else {
11980
+ originalMatcher = originalMatcher || matcher;
11981
+ if (originalMatcher !== matcher) originalMatcher.alias.push(matcher);
11982
+ if (isRootAdd && record.name && !isAliasRecord(matcher)) {
11983
+ if (process.env.NODE_ENV !== "production") checkSameNameAsAncestor(record, parent);
11984
+ removeRoute(record.name);
12546
11985
  }
12547
11986
  }
12548
- });
12549
- api.sendInspectorTree(routerInspectorId);
12550
- api.sendInspectorState(routerInspectorId);
12551
- });
12552
- }
12553
- function modifierForKey(key) {
12554
- if (key.optional) {
12555
- return key.repeatable ? "*" : "?";
12556
- } else {
12557
- return key.repeatable ? "+" : "";
12558
- }
12559
- }
12560
- function formatRouteRecordMatcherForStateInspector(route) {
12561
- const { record } = route;
12562
- const fields = [
12563
- { editable: false, key: "path", value: record.path }
12564
- ];
12565
- if (record.name != null) {
12566
- fields.push({
12567
- editable: false,
12568
- key: "name",
12569
- value: record.name
12570
- });
12571
- }
12572
- fields.push({ editable: false, key: "regexp", value: route.re });
12573
- if (route.keys.length) {
12574
- fields.push({
12575
- editable: false,
12576
- key: "keys",
12577
- value: {
12578
- _custom: {
12579
- type: null,
12580
- readOnly: true,
12581
- display: route.keys.map((key) => `${key.name}${modifierForKey(key)}`).join(" "),
12582
- tooltip: "Param keys",
12583
- value: route.keys
12584
- }
11987
+ if (isMatchable(matcher)) insertMatcher(matcher);
11988
+ if (mainNormalizedRecord.children) {
11989
+ const children = mainNormalizedRecord.children;
11990
+ for (let i = 0; i < children.length; i++) addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
12585
11991
  }
12586
- });
11992
+ originalRecord = originalRecord || matcher;
11993
+ }
11994
+ return originalMatcher ? () => {
11995
+ removeRoute(originalMatcher);
11996
+ } : noop;
12587
11997
  }
12588
- if (record.redirect != null) {
12589
- fields.push({
12590
- editable: false,
12591
- key: "redirect",
12592
- value: record.redirect
12593
- });
11998
+ function removeRoute(matcherRef) {
11999
+ if (isRouteName(matcherRef)) {
12000
+ const matcher = matcherMap.get(matcherRef);
12001
+ if (matcher) {
12002
+ matcherMap.delete(matcherRef);
12003
+ matchers.splice(matchers.indexOf(matcher), 1);
12004
+ matcher.children.forEach(removeRoute);
12005
+ matcher.alias.forEach(removeRoute);
12006
+ }
12007
+ } else {
12008
+ const index = matchers.indexOf(matcherRef);
12009
+ if (index > -1) {
12010
+ matchers.splice(index, 1);
12011
+ if (matcherRef.record.name) matcherMap.delete(matcherRef.record.name);
12012
+ matcherRef.children.forEach(removeRoute);
12013
+ matcherRef.alias.forEach(removeRoute);
12014
+ }
12015
+ }
12594
12016
  }
12595
- if (route.alias.length) {
12596
- fields.push({
12597
- editable: false,
12598
- key: "aliases",
12599
- value: route.alias.map((alias) => alias.record.path)
12600
- });
12017
+ function getRoutes() {
12018
+ return matchers;
12601
12019
  }
12602
- if (Object.keys(route.record.meta).length) {
12603
- fields.push({
12604
- editable: false,
12605
- key: "meta",
12606
- value: route.record.meta
12607
- });
12020
+ function insertMatcher(matcher) {
12021
+ const index = findInsertionIndex(matcher, matchers);
12022
+ matchers.splice(index, 0, matcher);
12023
+ if (matcher.record.name && !isAliasRecord(matcher)) matcherMap.set(matcher.record.name, matcher);
12608
12024
  }
12609
- fields.push({
12610
- key: "score",
12611
- editable: false,
12612
- value: {
12613
- _custom: {
12614
- type: null,
12615
- readOnly: true,
12616
- display: route.score.map((score) => score.join(", ")).join(" | "),
12617
- tooltip: "Score used to sort routes",
12618
- value: route.score
12025
+ function resolve(location$1, currentLocation) {
12026
+ let matcher;
12027
+ let params = {};
12028
+ let path;
12029
+ let name;
12030
+ if ("name" in location$1 && location$1.name) {
12031
+ matcher = matcherMap.get(location$1.name);
12032
+ if (!matcher) throw createRouterError(ErrorTypes.MATCHER_NOT_FOUND, { location: location$1 });
12033
+ if (process.env.NODE_ENV !== "production") {
12034
+ const invalidParams = Object.keys(location$1.params || {}).filter((paramName) => !matcher.keys.find((k) => k.name === paramName));
12035
+ if (invalidParams.length) warn$1(`Discarded invalid param(s) "${invalidParams.join('", "')}" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`);
12036
+ }
12037
+ name = matcher.record.name;
12038
+ params = assign(pickParams(currentLocation.params, matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name)), location$1.params && pickParams(location$1.params, matcher.keys.map((k) => k.name)));
12039
+ path = matcher.stringify(params);
12040
+ } else if (location$1.path != null) {
12041
+ path = location$1.path;
12042
+ if (process.env.NODE_ENV !== "production" && !path.startsWith("/")) warn$1(`The Matcher cannot resolve relative paths but received "${path}". Unless you directly called \`matcher.resolve("${path}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`);
12043
+ matcher = matchers.find((m) => m.re.test(path));
12044
+ if (matcher) {
12045
+ params = matcher.parse(path);
12046
+ name = matcher.record.name;
12619
12047
  }
12048
+ } else {
12049
+ matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path));
12050
+ if (!matcher) throw createRouterError(ErrorTypes.MATCHER_NOT_FOUND, {
12051
+ location: location$1,
12052
+ currentLocation
12053
+ });
12054
+ name = matcher.record.name;
12055
+ params = assign({}, currentLocation.params, location$1.params);
12056
+ path = matcher.stringify(params);
12620
12057
  }
12621
- });
12622
- return fields;
12058
+ const matched = [];
12059
+ let parentMatcher = matcher;
12060
+ while (parentMatcher) {
12061
+ matched.unshift(parentMatcher.record);
12062
+ parentMatcher = parentMatcher.parent;
12063
+ }
12064
+ return {
12065
+ name,
12066
+ path,
12067
+ params,
12068
+ matched,
12069
+ meta: mergeMetaFields(matched)
12070
+ };
12071
+ }
12072
+ routes.forEach((route) => addRoute(route));
12073
+ function clearRoutes() {
12074
+ matchers.length = 0;
12075
+ matcherMap.clear();
12076
+ }
12077
+ return {
12078
+ addRoute,
12079
+ resolve,
12080
+ removeRoute,
12081
+ clearRoutes,
12082
+ getRoutes,
12083
+ getRecordMatcher
12084
+ };
12623
12085
  }
12624
- const PINK_500 = 15485081;
12625
- const BLUE_600 = 2450411;
12626
- const LIME_500 = 8702998;
12627
- const CYAN_400 = 2282478;
12628
- const ORANGE_400 = 16486972;
12629
- const DARK = 6710886;
12630
- const RED_100 = 16704226;
12631
- const RED_700 = 12131356;
12632
- function formatRouteRecordForInspector(route) {
12633
- const tags = [];
12634
- const { record } = route;
12635
- if (record.name != null) {
12636
- tags.push({
12637
- label: String(record.name),
12638
- textColor: 0,
12639
- backgroundColor: CYAN_400
12640
- });
12086
+ function pickParams(params, keys) {
12087
+ const newParams = {};
12088
+ for (const key of keys) if (key in params) newParams[key] = params[key];
12089
+ return newParams;
12090
+ }
12091
+ function normalizeRouteRecord(record) {
12092
+ const normalized = {
12093
+ path: record.path,
12094
+ redirect: record.redirect,
12095
+ name: record.name,
12096
+ meta: record.meta || {},
12097
+ aliasOf: record.aliasOf,
12098
+ beforeEnter: record.beforeEnter,
12099
+ props: normalizeRecordProps(record),
12100
+ children: record.children || [],
12101
+ instances: {},
12102
+ leaveGuards: /* @__PURE__ */ new Set(),
12103
+ updateGuards: /* @__PURE__ */ new Set(),
12104
+ enterCallbacks: {},
12105
+ components: "components" in record ? record.components || null : record.component && { default: record.component }
12106
+ };
12107
+ Object.defineProperty(normalized, "mods", { value: {} });
12108
+ return normalized;
12109
+ }
12110
+ function normalizeRecordProps(record) {
12111
+ const propsObject = {};
12112
+ const props = record.props || false;
12113
+ if ("component" in record) propsObject.default = props;
12114
+ else for (const name in record.components) propsObject[name] = typeof props === "object" ? props[name] : props;
12115
+ return propsObject;
12116
+ }
12117
+ function isAliasRecord(record) {
12118
+ while (record) {
12119
+ if (record.record.aliasOf) return true;
12120
+ record = record.parent;
12641
12121
  }
12642
- if (record.aliasOf) {
12643
- tags.push({
12644
- label: "alias",
12645
- textColor: 0,
12646
- backgroundColor: ORANGE_400
12647
- });
12122
+ return false;
12123
+ }
12124
+ function mergeMetaFields(matched) {
12125
+ return matched.reduce((meta, record) => assign(meta, record.meta), {});
12126
+ }
12127
+ function isSameParam(a, b) {
12128
+ return a.name === b.name && a.optional === b.optional && a.repeatable === b.repeatable;
12129
+ }
12130
+ function checkSameParams(a, b) {
12131
+ for (const key of a.keys) if (!key.optional && !b.keys.find(isSameParam.bind(null, key))) return warn$1(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`);
12132
+ for (const key of b.keys) if (!key.optional && !a.keys.find(isSameParam.bind(null, key))) return warn$1(`Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`);
12133
+ }
12134
+ function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {
12135
+ if (parent && parent.record.name && !mainNormalizedRecord.name && !mainNormalizedRecord.path) warn$1(`The route named "${String(parent.record.name)}" has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.`);
12136
+ }
12137
+ function checkSameNameAsAncestor(record, parent) {
12138
+ for (let ancestor = parent; ancestor; ancestor = ancestor.parent) if (ancestor.record.name === record.name) throw new Error(`A route named "${String(record.name)}" has been added as a ${parent === ancestor ? "child" : "descendant"} of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.`);
12139
+ }
12140
+ function checkMissingParamsInAbsolutePath(record, parent) {
12141
+ for (const key of parent.keys) if (!record.keys.find(isSameParam.bind(null, key))) return warn$1(`Absolute path "${record.record.path}" must have the exact same param named "${key.name}" as its parent "${parent.record.path}".`);
12142
+ }
12143
+ function findInsertionIndex(matcher, matchers) {
12144
+ let lower = 0;
12145
+ let upper = matchers.length;
12146
+ while (lower !== upper) {
12147
+ const mid = lower + upper >> 1;
12148
+ if (comparePathParserScore(matcher, matchers[mid]) < 0) upper = mid;
12149
+ else lower = mid + 1;
12648
12150
  }
12649
- if (route.__vd_match) {
12650
- tags.push({
12651
- label: "matches",
12652
- textColor: 0,
12653
- backgroundColor: PINK_500
12654
- });
12151
+ const insertionAncestor = getInsertionAncestor(matcher);
12152
+ if (insertionAncestor) {
12153
+ upper = matchers.lastIndexOf(insertionAncestor, upper - 1);
12154
+ if (process.env.NODE_ENV !== "production" && upper < 0) warn$1(`Finding ancestor route "${insertionAncestor.record.path}" failed for "${matcher.record.path}"`);
12655
12155
  }
12656
- if (route.__vd_exactActive) {
12657
- tags.push({
12658
- label: "exact",
12659
- textColor: 0,
12660
- backgroundColor: LIME_500
12661
- });
12156
+ return upper;
12157
+ }
12158
+ function getInsertionAncestor(matcher) {
12159
+ let ancestor = matcher;
12160
+ while (ancestor = ancestor.parent) if (isMatchable(ancestor) && comparePathParserScore(matcher, ancestor) === 0) return ancestor;
12161
+ }
12162
+ function isMatchable({ record }) {
12163
+ return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
12164
+ }
12165
+ function useLink(props) {
12166
+ const router = inject(routerKey);
12167
+ const currentRoute = inject(routeLocationKey);
12168
+ let hasPrevious = false;
12169
+ let previousTo = null;
12170
+ const route = computed(() => {
12171
+ const to = unref(props.to);
12172
+ if (process.env.NODE_ENV !== "production" && (!hasPrevious || to !== previousTo)) {
12173
+ if (!isRouteLocation(to)) if (hasPrevious) warn$1(`Invalid value for prop "to" in useLink()
12174
+ - to:`, to, `
12175
+ - previous to:`, previousTo, `
12176
+ - props:`, props);
12177
+ else warn$1(`Invalid value for prop "to" in useLink()
12178
+ - to:`, to, `
12179
+ - props:`, props);
12180
+ previousTo = to;
12181
+ hasPrevious = true;
12182
+ }
12183
+ return router.resolve(to);
12184
+ });
12185
+ const activeRecordIndex = computed(() => {
12186
+ const { matched } = route.value;
12187
+ const { length } = matched;
12188
+ const routeMatched = matched[length - 1];
12189
+ const currentMatched = currentRoute.matched;
12190
+ if (!routeMatched || !currentMatched.length) return -1;
12191
+ const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
12192
+ if (index > -1) return index;
12193
+ const parentRecordPath = getOriginalPath(matched[length - 2]);
12194
+ return length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index;
12195
+ });
12196
+ const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
12197
+ const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
12198
+ function navigate(e = {}) {
12199
+ if (guardEvent(e)) {
12200
+ const p = router[unref(props.replace) ? "replace" : "push"](unref(props.to)).catch(noop);
12201
+ if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) document.startViewTransition(() => p);
12202
+ return p;
12203
+ }
12204
+ return Promise.resolve();
12662
12205
  }
12663
- if (route.__vd_active) {
12664
- tags.push({
12665
- label: "active",
12666
- textColor: 0,
12667
- backgroundColor: BLUE_600
12668
- });
12206
+ if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
12207
+ const instance = getCurrentInstance();
12208
+ if (instance) {
12209
+ const linkContextDevtools = {
12210
+ route: route.value,
12211
+ isActive: isActive.value,
12212
+ isExactActive: isExactActive.value,
12213
+ error: null
12214
+ };
12215
+ instance.__vrl_devtools = instance.__vrl_devtools || [];
12216
+ instance.__vrl_devtools.push(linkContextDevtools);
12217
+ watchEffect(() => {
12218
+ linkContextDevtools.route = route.value;
12219
+ linkContextDevtools.isActive = isActive.value;
12220
+ linkContextDevtools.isExactActive = isExactActive.value;
12221
+ linkContextDevtools.error = isRouteLocation(unref(props.to)) ? null : 'Invalid "to" value';
12222
+ }, { flush: "post" });
12223
+ }
12669
12224
  }
12670
- if (record.redirect) {
12671
- tags.push({
12672
- label: typeof record.redirect === "string" ? `redirect: ${record.redirect}` : "redirects",
12673
- textColor: 16777215,
12674
- backgroundColor: DARK
12675
- });
12225
+ return {
12226
+ route,
12227
+ href: computed(() => route.value.href),
12228
+ isActive,
12229
+ isExactActive,
12230
+ navigate
12231
+ };
12232
+ }
12233
+ function preferSingleVNode(vnodes) {
12234
+ return vnodes.length === 1 ? vnodes[0] : vnodes;
12235
+ }
12236
+ const RouterLinkImpl = /* @__PURE__ */ defineComponent({
12237
+ name: "RouterLink",
12238
+ compatConfig: { MODE: 3 },
12239
+ props: {
12240
+ to: {
12241
+ type: [String, Object],
12242
+ required: true
12243
+ },
12244
+ replace: Boolean,
12245
+ activeClass: String,
12246
+ exactActiveClass: String,
12247
+ custom: Boolean,
12248
+ ariaCurrentValue: {
12249
+ type: String,
12250
+ default: "page"
12251
+ },
12252
+ viewTransition: Boolean
12253
+ },
12254
+ useLink,
12255
+ setup(props, { slots }) {
12256
+ const link = reactive(useLink(props));
12257
+ const { options } = inject(routerKey);
12258
+ const elClass = computed(() => ({
12259
+ [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
12260
+ [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
12261
+ }));
12262
+ return () => {
12263
+ const children = slots.default && preferSingleVNode(slots.default(link));
12264
+ return props.custom ? children : h("a", {
12265
+ "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
12266
+ href: link.href,
12267
+ onClick: link.navigate,
12268
+ class: elClass.value
12269
+ }, children);
12270
+ };
12676
12271
  }
12677
- let id = record.__vd_id;
12678
- if (id == null) {
12679
- id = String(routeRecordId++);
12680
- record.__vd_id = id;
12272
+ });
12273
+ const RouterLink = RouterLinkImpl;
12274
+ function guardEvent(e) {
12275
+ if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
12276
+ if (e.defaultPrevented) return;
12277
+ if (e.button !== void 0 && e.button !== 0) return;
12278
+ if (e.currentTarget && e.currentTarget.getAttribute) {
12279
+ const target = e.currentTarget.getAttribute("target");
12280
+ if (/\b_blank\b/i.test(target)) return;
12681
12281
  }
12682
- return {
12683
- id,
12684
- label: record.path,
12685
- tags,
12686
- children: route.children.map(formatRouteRecordForInspector)
12687
- };
12282
+ if (e.preventDefault) e.preventDefault();
12283
+ return true;
12688
12284
  }
12689
- let routeRecordId = 0;
12690
- const EXTRACT_REGEXP_RE = /^\/(.*)\/([a-z]*)$/;
12691
- function markRouteRecordActive(route, currentRoute) {
12692
- const isExactActive = currentRoute.matched.length && isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);
12693
- route.__vd_exactActive = route.__vd_active = isExactActive;
12694
- if (!isExactActive) {
12695
- route.__vd_active = currentRoute.matched.some((match) => isSameRouteRecord(match, route.record));
12285
+ function includesParams(outer, inner) {
12286
+ for (const key in inner) {
12287
+ const innerValue = inner[key];
12288
+ const outerValue = outer[key];
12289
+ if (typeof innerValue === "string") {
12290
+ if (innerValue !== outerValue) return false;
12291
+ } else if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i])) return false;
12696
12292
  }
12697
- route.children.forEach((childRoute) => markRouteRecordActive(childRoute, currentRoute));
12293
+ return true;
12698
12294
  }
12699
- function resetMatchStateOnRouteRecord(route) {
12700
- route.__vd_match = false;
12701
- route.children.forEach(resetMatchStateOnRouteRecord);
12295
+ function getOriginalPath(record) {
12296
+ return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
12702
12297
  }
12703
- function isRouteMatching(route, filter) {
12704
- const found = String(route.re).match(EXTRACT_REGEXP_RE);
12705
- route.__vd_match = false;
12706
- if (!found || found.length < 3) {
12707
- return false;
12708
- }
12709
- const nonEndingRE = new RegExp(found[1].replace(/\$$/, ""), found[2]);
12710
- if (nonEndingRE.test(filter)) {
12711
- route.children.forEach((child) => isRouteMatching(child, filter));
12712
- if (route.record.path !== "/" || filter === "/") {
12713
- route.__vd_match = route.re.test(filter);
12714
- return true;
12715
- }
12716
- return false;
12298
+ const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
12299
+ const RouterViewImpl = /* @__PURE__ */ defineComponent({
12300
+ name: "RouterView",
12301
+ inheritAttrs: false,
12302
+ props: {
12303
+ name: {
12304
+ type: String,
12305
+ default: "default"
12306
+ },
12307
+ route: Object
12308
+ },
12309
+ compatConfig: { MODE: 3 },
12310
+ setup(props, { attrs, slots }) {
12311
+ process.env.NODE_ENV !== "production" && warnDeprecatedUsage();
12312
+ const injectedRoute = inject(routerViewLocationKey);
12313
+ const routeToDisplay = computed(() => props.route || injectedRoute.value);
12314
+ const injectedDepth = inject(viewDepthKey, 0);
12315
+ const depth = computed(() => {
12316
+ let initialDepth = unref(injectedDepth);
12317
+ const { matched } = routeToDisplay.value;
12318
+ let matchedRoute;
12319
+ while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) initialDepth++;
12320
+ return initialDepth;
12321
+ });
12322
+ const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
12323
+ provide(viewDepthKey, computed(() => depth.value + 1));
12324
+ provide(matchedRouteKey, matchedRouteRef);
12325
+ provide(routerViewLocationKey, routeToDisplay);
12326
+ const viewRef = ref();
12327
+ watch(() => [
12328
+ viewRef.value,
12329
+ matchedRouteRef.value,
12330
+ props.name
12331
+ ], ([instance, to, name], [oldInstance, from, oldName]) => {
12332
+ if (to) {
12333
+ to.instances[name] = instance;
12334
+ if (from && from !== to && instance && instance === oldInstance) {
12335
+ if (!to.leaveGuards.size) to.leaveGuards = from.leaveGuards;
12336
+ if (!to.updateGuards.size) to.updateGuards = from.updateGuards;
12337
+ }
12338
+ }
12339
+ if (instance && to && (!from || !isSameRouteRecord(to, from) || !oldInstance)) (to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
12340
+ }, { flush: "post" });
12341
+ return () => {
12342
+ const route = routeToDisplay.value;
12343
+ const currentName = props.name;
12344
+ const matchedRoute = matchedRouteRef.value;
12345
+ const ViewComponent = matchedRoute && matchedRoute.components[currentName];
12346
+ if (!ViewComponent) return normalizeSlot(slots.default, {
12347
+ Component: ViewComponent,
12348
+ route
12349
+ });
12350
+ const routePropsOption = matchedRoute.props[currentName];
12351
+ const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
12352
+ const onVnodeUnmounted = (vnode) => {
12353
+ if (vnode.component.isUnmounted) matchedRoute.instances[currentName] = null;
12354
+ };
12355
+ const component = h(ViewComponent, assign({}, routeProps, attrs, {
12356
+ onVnodeUnmounted,
12357
+ ref: viewRef
12358
+ }));
12359
+ if ((process.env.NODE_ENV !== "production" || false) && isBrowser && component.ref) {
12360
+ const info = {
12361
+ depth: depth.value,
12362
+ name: matchedRoute.name,
12363
+ path: matchedRoute.path,
12364
+ meta: matchedRoute.meta
12365
+ };
12366
+ (isArray(component.ref) ? component.ref.map((r) => r.i) : [component.ref.i]).forEach((instance) => {
12367
+ instance.__vrv_devtools = info;
12368
+ });
12369
+ }
12370
+ return normalizeSlot(slots.default, {
12371
+ Component: component,
12372
+ route
12373
+ }) || component;
12374
+ };
12717
12375
  }
12718
- const path = route.record.path.toLowerCase();
12719
- const decodedPath = decode(path);
12720
- if (!filter.startsWith("/") && (decodedPath.includes(filter) || path.includes(filter)))
12721
- return true;
12722
- if (decodedPath.startsWith(filter) || path.startsWith(filter))
12723
- return true;
12724
- if (route.record.name && String(route.record.name).includes(filter))
12725
- return true;
12726
- return route.children.some((child) => isRouteMatching(child, filter));
12376
+ });
12377
+ function normalizeSlot(slot, data) {
12378
+ if (!slot) return null;
12379
+ const slotContent = slot(data);
12380
+ return slotContent.length === 1 ? slotContent[0] : slotContent;
12727
12381
  }
12728
- function omit(obj, keys) {
12729
- const ret = {};
12730
- for (const key in obj) {
12731
- if (!keys.includes(key)) {
12732
- ret[key] = obj[key];
12733
- }
12382
+ const RouterView = RouterViewImpl;
12383
+ function warnDeprecatedUsage() {
12384
+ const instance = getCurrentInstance();
12385
+ const parentName = instance.parent && instance.parent.type.name;
12386
+ const parentSubTreeType = instance.parent && instance.parent.subTree && instance.parent.subTree.type;
12387
+ if (parentName && (parentName === "KeepAlive" || parentName.includes("Transition")) && typeof parentSubTreeType === "object" && parentSubTreeType.name === "RouterView") {
12388
+ const comp = parentName === "KeepAlive" ? "keep-alive" : "transition";
12389
+ warn$1(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.
12390
+ Use slot props instead:
12391
+
12392
+ <router-view v-slot="{ Component }">
12393
+ <${comp}>
12394
+ <component :is="Component" />
12395
+ </${comp}>
12396
+ </router-view>`);
12734
12397
  }
12735
- return ret;
12736
12398
  }
12737
12399
  function createRouter(options) {
12738
12400
  const matcher = createRouterMatcher(options.routes, options);
12739
12401
  const parseQuery$1 = options.parseQuery || parseQuery;
12740
12402
  const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
12741
12403
  const routerHistory = options.history;
12742
- if (process.env.NODE_ENV !== "production" && !routerHistory)
12743
- throw new Error('Provide the "history" option when calling "createRouter()": https://router.vuejs.org/api/interfaces/RouterOptions.html#history');
12404
+ if (process.env.NODE_ENV !== "production" && !routerHistory) throw new Error('Provide the "history" option when calling "createRouter()": https://router.vuejs.org/api/interfaces/RouterOptions.html#history');
12744
12405
  const beforeGuards = useCallbacks();
12745
12406
  const beforeResolveGuards = useCallbacks();
12746
12407
  const afterGuards = useCallbacks();
12747
12408
  const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
12748
12409
  let pendingLocation = START_LOCATION_NORMALIZED;
12749
- if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) {
12750
- history.scrollRestoration = "manual";
12751
- }
12410
+ if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) history.scrollRestoration = "manual";
12752
12411
  const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue);
12753
12412
  const encodeParams = applyToParams.bind(null, encodeParam);
12754
- const decodeParams = (
12755
- // @ts-expect-error: intentionally avoid the type check
12756
- applyToParams.bind(null, decode)
12757
- );
12413
+ const decodeParams = applyToParams.bind(null, decode);
12758
12414
  function addRoute(parentOrRoute, route) {
12759
12415
  let parent;
12760
12416
  let record;
12761
12417
  if (isRouteName(parentOrRoute)) {
12762
12418
  parent = matcher.getRecordMatcher(parentOrRoute);
12763
- if (process.env.NODE_ENV !== "production" && !parent) {
12764
- warn(`Parent route "${String(parentOrRoute)}" not found when adding child route`, route);
12765
- }
12419
+ if (process.env.NODE_ENV !== "production" && !parent) warn$1(`Parent route "${String(parentOrRoute)}" not found when adding child route`, route);
12766
12420
  record = route;
12767
- } else {
12768
- record = parentOrRoute;
12769
- }
12421
+ } else record = parentOrRoute;
12770
12422
  return matcher.addRoute(record, parent);
12771
12423
  }
12772
12424
  function removeRoute(name) {
12773
12425
  const recordMatcher = matcher.getRecordMatcher(name);
12774
- if (recordMatcher) {
12775
- matcher.removeRoute(recordMatcher);
12776
- } else if (process.env.NODE_ENV !== "production") {
12777
- warn(`Cannot remove non-existent route "${String(name)}"`);
12778
- }
12426
+ if (recordMatcher) matcher.removeRoute(recordMatcher);
12427
+ else if (process.env.NODE_ENV !== "production") warn$1(`Cannot remove non-existent route "${String(name)}"`);
12779
12428
  }
12780
12429
  function getRoutes() {
12781
12430
  return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
@@ -12787,53 +12436,37 @@ function createRouter(options) {
12787
12436
  currentLocation = assign({}, currentLocation || currentRoute.value);
12788
12437
  if (typeof rawLocation === "string") {
12789
12438
  const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
12790
- const matchedRoute2 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
12791
- const href2 = routerHistory.createHref(locationNormalized.fullPath);
12439
+ const matchedRoute$1 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
12440
+ const href$1 = routerHistory.createHref(locationNormalized.fullPath);
12792
12441
  if (process.env.NODE_ENV !== "production") {
12793
- if (href2.startsWith("//"))
12794
- warn(`Location "${rawLocation}" resolved to "${href2}". A resolved location cannot start with multiple slashes.`);
12795
- else if (!matchedRoute2.matched.length) {
12796
- warn(`No match found for location with path "${rawLocation}"`);
12797
- }
12442
+ if (href$1.startsWith("//")) warn$1(`Location "${rawLocation}" resolved to "${href$1}". A resolved location cannot start with multiple slashes.`);
12443
+ else if (!matchedRoute$1.matched.length) warn$1(`No match found for location with path "${rawLocation}"`);
12798
12444
  }
12799
- return assign(locationNormalized, matchedRoute2, {
12800
- params: decodeParams(matchedRoute2.params),
12445
+ return assign(locationNormalized, matchedRoute$1, {
12446
+ params: decodeParams(matchedRoute$1.params),
12801
12447
  hash: decode(locationNormalized.hash),
12802
12448
  redirectedFrom: void 0,
12803
- href: href2
12449
+ href: href$1
12804
12450
  });
12805
12451
  }
12806
12452
  if (process.env.NODE_ENV !== "production" && !isRouteLocation(rawLocation)) {
12807
- warn(`router.resolve() was passed an invalid location. This will fail in production.
12453
+ warn$1(`router.resolve() was passed an invalid location. This will fail in production.
12808
12454
  - Location:`, rawLocation);
12809
12455
  return resolve({});
12810
12456
  }
12811
12457
  let matcherLocation;
12812
12458
  if (rawLocation.path != null) {
12813
- if (process.env.NODE_ENV !== "production" && "params" in rawLocation && !("name" in rawLocation) && // @ts-expect-error: the type is never
12814
- Object.keys(rawLocation.params).length) {
12815
- warn(`Path "${rawLocation.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`);
12816
- }
12817
- matcherLocation = assign({}, rawLocation, {
12818
- path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path
12819
- });
12459
+ if (process.env.NODE_ENV !== "production" && "params" in rawLocation && !("name" in rawLocation) && Object.keys(rawLocation.params).length) warn$1(`Path "${rawLocation.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`);
12460
+ matcherLocation = assign({}, rawLocation, { path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path });
12820
12461
  } else {
12821
12462
  const targetParams = assign({}, rawLocation.params);
12822
- for (const key in targetParams) {
12823
- if (targetParams[key] == null) {
12824
- delete targetParams[key];
12825
- }
12826
- }
12827
- matcherLocation = assign({}, rawLocation, {
12828
- params: encodeParams(targetParams)
12829
- });
12463
+ for (const key in targetParams) if (targetParams[key] == null) delete targetParams[key];
12464
+ matcherLocation = assign({}, rawLocation, { params: encodeParams(targetParams) });
12830
12465
  currentLocation.params = encodeParams(currentLocation.params);
12831
12466
  }
12832
12467
  const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
12833
12468
  const hash = rawLocation.hash || "";
12834
- if (process.env.NODE_ENV !== "production" && hash && !hash.startsWith("#")) {
12835
- warn(`A \`hash\` should always start with the character "#". Replace "${hash}" with "#${hash}".`);
12836
- }
12469
+ if (process.env.NODE_ENV !== "production" && hash && !hash.startsWith("#")) warn$1(`A \`hash\` should always start with the character "#". Replace "${hash}" with "#${hash}".`);
12837
12470
  matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
12838
12471
  const fullPath = stringifyURL(stringifyQuery$1, assign({}, rawLocation, {
12839
12472
  hash: encodeHash(hash),
@@ -12841,25 +12474,13 @@ function createRouter(options) {
12841
12474
  }));
12842
12475
  const href = routerHistory.createHref(fullPath);
12843
12476
  if (process.env.NODE_ENV !== "production") {
12844
- if (href.startsWith("//")) {
12845
- warn(`Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.`);
12846
- } else if (!matchedRoute.matched.length) {
12847
- warn(`No match found for location with path "${rawLocation.path != null ? rawLocation.path : rawLocation}"`);
12848
- }
12477
+ if (href.startsWith("//")) warn$1(`Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.`);
12478
+ else if (!matchedRoute.matched.length) warn$1(`No match found for location with path "${rawLocation.path != null ? rawLocation.path : rawLocation}"`);
12849
12479
  }
12850
12480
  return assign({
12851
12481
  fullPath,
12852
- // keep the hash encoded so fullPath is effectively path + encodedQuery +
12853
- // hash
12854
12482
  hash,
12855
- query: (
12856
- // if the user is using a custom query lib like qs, we might have
12857
- // nested objects, so we keep the query as is, meaning it can contain
12858
- // numbers at `$route.query`, but at the point, the user will have to
12859
- // use their own type anyway.
12860
- // https://github.com/vuejs/router/issues/328#issuecomment-649481567
12861
- stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
12862
- )
12483
+ query: stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
12863
12484
  }, matchedRoute, {
12864
12485
  redirectedFrom: void 0,
12865
12486
  href
@@ -12869,12 +12490,10 @@ function createRouter(options) {
12869
12490
  return typeof to === "string" ? parseURL(parseQuery$1, to, currentRoute.value.path) : assign({}, to);
12870
12491
  }
12871
12492
  function checkCanceledNavigation(to, from) {
12872
- if (pendingLocation !== to) {
12873
- return createRouterError(8, {
12874
- from,
12875
- to
12876
- });
12877
- }
12493
+ if (pendingLocation !== to) return createRouterError(ErrorTypes.NAVIGATION_CANCELLED, {
12494
+ from,
12495
+ to
12496
+ });
12878
12497
  }
12879
12498
  function push(to) {
12880
12499
  return pushWithRedirect(to);
@@ -12882,20 +12501,17 @@ function createRouter(options) {
12882
12501
  function replace(to) {
12883
12502
  return push(assign(locationAsObject(to), { replace: true }));
12884
12503
  }
12885
- function handleRedirectRecord(to) {
12504
+ function handleRedirectRecord(to, from) {
12886
12505
  const lastMatched = to.matched[to.matched.length - 1];
12887
12506
  if (lastMatched && lastMatched.redirect) {
12888
12507
  const { redirect } = lastMatched;
12889
- let newTargetLocation = typeof redirect === "function" ? redirect(to) : redirect;
12508
+ let newTargetLocation = typeof redirect === "function" ? redirect(to, from) : redirect;
12890
12509
  if (typeof newTargetLocation === "string") {
12891
- newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : (
12892
- // force empty params
12893
- { path: newTargetLocation }
12894
- );
12510
+ newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : { path: newTargetLocation };
12895
12511
  newTargetLocation.params = {};
12896
12512
  }
12897
12513
  if (process.env.NODE_ENV !== "production" && newTargetLocation.path == null && !("name" in newTargetLocation)) {
12898
- warn(`Invalid redirect found:
12514
+ warn$1(`Invalid redirect found:
12899
12515
  ${JSON.stringify(newTargetLocation, null, 2)}
12900
12516
  when navigating to "${to.fullPath}". A redirect must contain a name or path. This will break in production.`);
12901
12517
  throw new Error("Invalid redirect");
@@ -12903,7 +12519,6 @@ ${JSON.stringify(newTargetLocation, null, 2)}
12903
12519
  return assign({
12904
12520
  query: to.query,
12905
12521
  hash: to.hash,
12906
- // avoid transferring params if the redirect has a path
12907
12522
  params: newTargetLocation.path != null ? {} : to.params
12908
12523
  }, newTargetLocation);
12909
12524
  }
@@ -12913,80 +12528,39 @@ ${JSON.stringify(newTargetLocation, null, 2)}
12913
12528
  const from = currentRoute.value;
12914
12529
  const data = to.state;
12915
12530
  const force = to.force;
12916
- const replace2 = to.replace === true;
12917
- const shouldRedirect = handleRedirectRecord(targetLocation);
12918
- if (shouldRedirect)
12919
- return pushWithRedirect(
12920
- assign(locationAsObject(shouldRedirect), {
12921
- state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data,
12922
- force,
12923
- replace: replace2
12924
- }),
12925
- // keep original redirectedFrom if it exists
12926
- redirectedFrom || targetLocation
12927
- );
12531
+ const replace$1 = to.replace === true;
12532
+ const shouldRedirect = handleRedirectRecord(targetLocation, from);
12533
+ if (shouldRedirect) return pushWithRedirect(assign(locationAsObject(shouldRedirect), {
12534
+ state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data,
12535
+ force,
12536
+ replace: replace$1
12537
+ }), redirectedFrom || targetLocation);
12928
12538
  const toLocation = targetLocation;
12929
12539
  toLocation.redirectedFrom = redirectedFrom;
12930
12540
  let failure;
12931
12541
  if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
12932
- failure = createRouterError(16, { to: toLocation, from });
12933
- handleScroll(
12934
- from,
12935
- from,
12936
- // this is a push, the only way for it to be triggered from a
12937
- // history.listen is with a redirect, which makes it become a push
12938
- true,
12939
- // This cannot be the first navigation because the initial location
12940
- // cannot be manually navigated to
12941
- false
12942
- );
12542
+ failure = createRouterError(ErrorTypes.NAVIGATION_DUPLICATED, {
12543
+ to: toLocation,
12544
+ from
12545
+ });
12546
+ handleScroll(from, from, true, false);
12943
12547
  }
12944
- return (failure ? Promise.resolve(failure) : navigate(toLocation, from)).catch((error) => isNavigationFailure(error) ? (
12945
- // navigation redirects still mark the router as ready
12946
- isNavigationFailure(
12947
- error,
12948
- 2
12949
- /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
12950
- ) ? error : markAsReady(error)
12951
- ) : (
12952
- // reject any unknown error
12953
- triggerError(error, toLocation, from)
12954
- )).then((failure2) => {
12955
- if (failure2) {
12956
- if (isNavigationFailure(
12957
- failure2,
12958
- 2
12959
- /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
12960
- )) {
12961
- if (process.env.NODE_ENV !== "production" && // we are redirecting to the same location we were already at
12962
- isSameRouteLocation(stringifyQuery$1, resolve(failure2.to), toLocation) && // and we have done it a couple of times
12963
- redirectedFrom && // @ts-expect-error: added only in dev
12964
- (redirectedFrom._count = redirectedFrom._count ? (
12965
- // @ts-expect-error
12966
- redirectedFrom._count + 1
12967
- ) : 1) > 30) {
12968
- warn(`Detected a possibly infinite redirection in a navigation guard when going from "${from.fullPath}" to "${toLocation.fullPath}". Aborting to avoid a Stack Overflow.
12548
+ return (failure ? Promise.resolve(failure) : navigate(toLocation, from)).catch((error) => isNavigationFailure(error) ? isNavigationFailure(error, ErrorTypes.NAVIGATION_GUARD_REDIRECT) ? error : markAsReady(error) : triggerError(error, toLocation, from)).then((failure$1) => {
12549
+ if (failure$1) {
12550
+ if (isNavigationFailure(failure$1, ErrorTypes.NAVIGATION_GUARD_REDIRECT)) {
12551
+ if (process.env.NODE_ENV !== "production" && isSameRouteLocation(stringifyQuery$1, resolve(failure$1.to), toLocation) && redirectedFrom && (redirectedFrom._count = redirectedFrom._count ? redirectedFrom._count + 1 : 1) > 30) {
12552
+ warn$1(`Detected a possibly infinite redirection in a navigation guard when going from "${from.fullPath}" to "${toLocation.fullPath}". Aborting to avoid a Stack Overflow.
12969
12553
  Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`);
12970
- return Promise.reject(new Error("Infinite redirect in navigation guard"));
12554
+ return Promise.reject(/* @__PURE__ */ new Error("Infinite redirect in navigation guard"));
12971
12555
  }
12972
- return pushWithRedirect(
12973
- // keep options
12974
- assign({
12975
- // preserve an existing replacement but allow the redirect to override it
12976
- replace: replace2
12977
- }, locationAsObject(failure2.to), {
12978
- state: typeof failure2.to === "object" ? assign({}, data, failure2.to.state) : data,
12979
- force
12980
- }),
12981
- // preserve the original redirectedFrom if any
12982
- redirectedFrom || toLocation
12983
- );
12556
+ return pushWithRedirect(assign({ replace: replace$1 }, locationAsObject(failure$1.to), {
12557
+ state: typeof failure$1.to === "object" ? assign({}, data, failure$1.to.state) : data,
12558
+ force
12559
+ }), redirectedFrom || toLocation);
12984
12560
  }
12985
- } else {
12986
- failure2 = finalizeNavigation(toLocation, from, true, replace2, data);
12987
- }
12988
- triggerAfterEach(toLocation, from, failure2);
12989
- return failure2;
12561
+ } else failure$1 = finalizeNavigation(toLocation, from, true, replace$1, data);
12562
+ triggerAfterEach(toLocation, from, failure$1);
12563
+ return failure$1;
12990
12564
  });
12991
12565
  }
12992
12566
  function checkCanceledNavigationAndReject(to, from) {
@@ -13001,41 +12575,27 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13001
12575
  let guards;
13002
12576
  const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
13003
12577
  guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from);
13004
- for (const record of leavingRecords) {
13005
- record.leaveGuards.forEach((guard) => {
13006
- guards.push(guardToPromiseFn(guard, to, from));
13007
- });
13008
- }
12578
+ for (const record of leavingRecords) record.leaveGuards.forEach((guard) => {
12579
+ guards.push(guardToPromiseFn(guard, to, from));
12580
+ });
13009
12581
  const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
13010
12582
  guards.push(canceledNavigationCheck);
13011
12583
  return runGuardQueue(guards).then(() => {
13012
12584
  guards = [];
13013
- for (const guard of beforeGuards.list()) {
13014
- guards.push(guardToPromiseFn(guard, to, from));
13015
- }
12585
+ for (const guard of beforeGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
13016
12586
  guards.push(canceledNavigationCheck);
13017
12587
  return runGuardQueue(guards);
13018
12588
  }).then(() => {
13019
12589
  guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from);
13020
- for (const record of updatingRecords) {
13021
- record.updateGuards.forEach((guard) => {
13022
- guards.push(guardToPromiseFn(guard, to, from));
13023
- });
13024
- }
12590
+ for (const record of updatingRecords) record.updateGuards.forEach((guard) => {
12591
+ guards.push(guardToPromiseFn(guard, to, from));
12592
+ });
13025
12593
  guards.push(canceledNavigationCheck);
13026
12594
  return runGuardQueue(guards);
13027
12595
  }).then(() => {
13028
12596
  guards = [];
13029
- for (const record of enteringRecords) {
13030
- if (record.beforeEnter) {
13031
- if (isArray(record.beforeEnter)) {
13032
- for (const beforeEnter of record.beforeEnter)
13033
- guards.push(guardToPromiseFn(beforeEnter, to, from));
13034
- } else {
13035
- guards.push(guardToPromiseFn(record.beforeEnter, to, from));
13036
- }
13037
- }
13038
- }
12597
+ for (const record of enteringRecords) if (record.beforeEnter) if (isArray(record.beforeEnter)) for (const beforeEnter of record.beforeEnter) guards.push(guardToPromiseFn(beforeEnter, to, from));
12598
+ else guards.push(guardToPromiseFn(record.beforeEnter, to, from));
13039
12599
  guards.push(canceledNavigationCheck);
13040
12600
  return runGuardQueue(guards);
13041
12601
  }).then(() => {
@@ -13045,113 +12605,57 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13045
12605
  return runGuardQueue(guards);
13046
12606
  }).then(() => {
13047
12607
  guards = [];
13048
- for (const guard of beforeResolveGuards.list()) {
13049
- guards.push(guardToPromiseFn(guard, to, from));
13050
- }
12608
+ for (const guard of beforeResolveGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
13051
12609
  guards.push(canceledNavigationCheck);
13052
12610
  return runGuardQueue(guards);
13053
- }).catch((err) => isNavigationFailure(
13054
- err,
13055
- 8
13056
- /* ErrorTypes.NAVIGATION_CANCELLED */
13057
- ) ? err : Promise.reject(err));
12611
+ }).catch((err) => isNavigationFailure(err, ErrorTypes.NAVIGATION_CANCELLED) ? err : Promise.reject(err));
13058
12612
  }
13059
12613
  function triggerAfterEach(to, from, failure) {
13060
12614
  afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from, failure)));
13061
12615
  }
13062
- function finalizeNavigation(toLocation, from, isPush, replace2, data) {
12616
+ function finalizeNavigation(toLocation, from, isPush, replace$1, data) {
13063
12617
  const error = checkCanceledNavigation(toLocation, from);
13064
- if (error)
13065
- return error;
12618
+ if (error) return error;
13066
12619
  const isFirstNavigation = from === START_LOCATION_NORMALIZED;
13067
12620
  const state = !isBrowser ? {} : history.state;
13068
- if (isPush) {
13069
- if (replace2 || isFirstNavigation)
13070
- routerHistory.replace(toLocation.fullPath, assign({
13071
- scroll: isFirstNavigation && state && state.scroll
13072
- }, data));
13073
- else
13074
- routerHistory.push(toLocation.fullPath, data);
13075
- }
12621
+ if (isPush) if (replace$1 || isFirstNavigation) routerHistory.replace(toLocation.fullPath, assign({ scroll: isFirstNavigation && state && state.scroll }, data));
12622
+ else routerHistory.push(toLocation.fullPath, data);
13076
12623
  currentRoute.value = toLocation;
13077
12624
  handleScroll(toLocation, from, isPush, isFirstNavigation);
13078
12625
  markAsReady();
13079
12626
  }
13080
12627
  let removeHistoryListener;
13081
12628
  function setupListeners() {
13082
- if (removeHistoryListener)
13083
- return;
12629
+ if (removeHistoryListener) return;
13084
12630
  removeHistoryListener = routerHistory.listen((to, _from, info) => {
13085
- if (!router.listening)
13086
- return;
12631
+ if (!router.listening) return;
13087
12632
  const toLocation = resolve(to);
13088
- const shouldRedirect = handleRedirectRecord(toLocation);
12633
+ const shouldRedirect = handleRedirectRecord(toLocation, router.currentRoute.value);
13089
12634
  if (shouldRedirect) {
13090
- pushWithRedirect(assign(shouldRedirect, { replace: true, force: true }), toLocation).catch(noop);
12635
+ pushWithRedirect(assign(shouldRedirect, {
12636
+ replace: true,
12637
+ force: true
12638
+ }), toLocation).catch(noop);
13091
12639
  return;
13092
12640
  }
13093
12641
  pendingLocation = toLocation;
13094
12642
  const from = currentRoute.value;
13095
- if (isBrowser) {
13096
- saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
13097
- }
12643
+ if (isBrowser) saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
13098
12644
  navigate(toLocation, from).catch((error) => {
13099
- if (isNavigationFailure(
13100
- error,
13101
- 4 | 8
13102
- /* ErrorTypes.NAVIGATION_CANCELLED */
13103
- )) {
13104
- return error;
13105
- }
13106
- if (isNavigationFailure(
13107
- error,
13108
- 2
13109
- /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
13110
- )) {
13111
- pushWithRedirect(
13112
- assign(locationAsObject(error.to), {
13113
- force: true
13114
- }),
13115
- toLocation
13116
- // avoid an uncaught rejection, let push call triggerError
13117
- ).then((failure) => {
13118
- if (isNavigationFailure(
13119
- failure,
13120
- 4 | 16
13121
- /* ErrorTypes.NAVIGATION_DUPLICATED */
13122
- ) && !info.delta && info.type === NavigationType.pop) {
13123
- routerHistory.go(-1, false);
13124
- }
12645
+ if (isNavigationFailure(error, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED)) return error;
12646
+ if (isNavigationFailure(error, ErrorTypes.NAVIGATION_GUARD_REDIRECT)) {
12647
+ pushWithRedirect(assign(locationAsObject(error.to), { force: true }), toLocation).then((failure) => {
12648
+ if (isNavigationFailure(failure, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED) && !info.delta && info.type === NavigationType.pop) routerHistory.go(-1, false);
13125
12649
  }).catch(noop);
13126
12650
  return Promise.reject();
13127
12651
  }
13128
- if (info.delta) {
13129
- routerHistory.go(-info.delta, false);
13130
- }
12652
+ if (info.delta) routerHistory.go(-info.delta, false);
13131
12653
  return triggerError(error, toLocation, from);
13132
12654
  }).then((failure) => {
13133
- failure = failure || finalizeNavigation(
13134
- // after navigation, all matched components are resolved
13135
- toLocation,
13136
- from,
13137
- false
13138
- );
12655
+ failure = failure || finalizeNavigation(toLocation, from, false);
13139
12656
  if (failure) {
13140
- if (info.delta && // a new navigation has been triggered, so we do not want to revert, that will change the current history
13141
- // entry while a different route is displayed
13142
- !isNavigationFailure(
13143
- failure,
13144
- 8
13145
- /* ErrorTypes.NAVIGATION_CANCELLED */
13146
- )) {
13147
- routerHistory.go(-info.delta, false);
13148
- } else if (info.type === NavigationType.pop && isNavigationFailure(
13149
- failure,
13150
- 4 | 16
13151
- /* ErrorTypes.NAVIGATION_DUPLICATED */
13152
- )) {
13153
- routerHistory.go(-1, false);
13154
- }
12657
+ if (info.delta && !isNavigationFailure(failure, ErrorTypes.NAVIGATION_CANCELLED)) routerHistory.go(-info.delta, false);
12658
+ else if (info.type === NavigationType.pop && isNavigationFailure(failure, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED)) routerHistory.go(-1, false);
13155
12659
  }
13156
12660
  triggerAfterEach(toLocation, from, failure);
13157
12661
  }).catch(noop);
@@ -13163,36 +12667,31 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13163
12667
  function triggerError(error, to, from) {
13164
12668
  markAsReady(error);
13165
12669
  const list = errorListeners.list();
13166
- if (list.length) {
13167
- list.forEach((handler) => handler(error, to, from));
13168
- } else {
13169
- if (process.env.NODE_ENV !== "production") {
13170
- warn("uncaught error during route navigation:");
13171
- }
12670
+ if (list.length) list.forEach((handler) => handler(error, to, from));
12671
+ else {
12672
+ if (process.env.NODE_ENV !== "production") warn$1("uncaught error during route navigation:");
13172
12673
  console.error(error);
13173
12674
  }
13174
12675
  return Promise.reject(error);
13175
12676
  }
13176
12677
  function isReady() {
13177
- if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
13178
- return Promise.resolve();
13179
- return new Promise((resolve2, reject) => {
13180
- readyHandlers.add([resolve2, reject]);
12678
+ if (ready && currentRoute.value !== START_LOCATION_NORMALIZED) return Promise.resolve();
12679
+ return new Promise((resolve$1, reject) => {
12680
+ readyHandlers.add([resolve$1, reject]);
13181
12681
  });
13182
12682
  }
13183
12683
  function markAsReady(err) {
13184
12684
  if (!ready) {
13185
12685
  ready = !err;
13186
12686
  setupListeners();
13187
- readyHandlers.list().forEach(([resolve2, reject]) => err ? reject(err) : resolve2());
12687
+ readyHandlers.list().forEach(([resolve$1, reject]) => err ? reject(err) : resolve$1());
13188
12688
  readyHandlers.reset();
13189
12689
  }
13190
12690
  return err;
13191
12691
  }
13192
12692
  function handleScroll(to, from, isPush, isFirstNavigation) {
13193
12693
  const { scrollBehavior } = options;
13194
- if (!isBrowser || !scrollBehavior)
13195
- return Promise.resolve();
12694
+ if (!isBrowser || !scrollBehavior) return Promise.resolve();
13196
12695
  const scrollPosition = !isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0)) || (isFirstNavigation || !isPush) && history.state && history.state.scroll || null;
13197
12696
  return nextTick().then(() => scrollBehavior(to, from, scrollPosition)).then((position) => position && scrollToPosition(position)).catch((err) => triggerError(err, to, from));
13198
12697
  }
@@ -13220,31 +12719,25 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13220
12719
  onError: errorListeners.add,
13221
12720
  isReady,
13222
12721
  install(app) {
13223
- const router2 = this;
13224
12722
  app.component("RouterLink", RouterLink);
13225
12723
  app.component("RouterView", RouterView);
13226
- app.config.globalProperties.$router = router2;
12724
+ app.config.globalProperties.$router = router;
13227
12725
  Object.defineProperty(app.config.globalProperties, "$route", {
13228
12726
  enumerable: true,
13229
12727
  get: () => unref(currentRoute)
13230
12728
  });
13231
- if (isBrowser && // used for the initial navigation client side to avoid pushing
13232
- // multiple times when the router is used in multiple apps
13233
- !started && currentRoute.value === START_LOCATION_NORMALIZED) {
12729
+ if (isBrowser && !started && currentRoute.value === START_LOCATION_NORMALIZED) {
13234
12730
  started = true;
13235
12731
  push(routerHistory.location).catch((err) => {
13236
- if (process.env.NODE_ENV !== "production")
13237
- warn("Unexpected error when starting the router:", err);
12732
+ if (process.env.NODE_ENV !== "production") warn$1("Unexpected error when starting the router:", err);
13238
12733
  });
13239
12734
  }
13240
12735
  const reactiveRoute = {};
13241
- for (const key in START_LOCATION_NORMALIZED) {
13242
- Object.defineProperty(reactiveRoute, key, {
13243
- get: () => currentRoute.value[key],
13244
- enumerable: true
13245
- });
13246
- }
13247
- app.provide(routerKey, router2);
12736
+ for (const key in START_LOCATION_NORMALIZED) Object.defineProperty(reactiveRoute, key, {
12737
+ get: () => currentRoute.value[key],
12738
+ enumerable: true
12739
+ });
12740
+ app.provide(routerKey, router);
13248
12741
  app.provide(routeLocationKey, shallowReactive(reactiveRoute));
13249
12742
  app.provide(routerViewLocationKey, currentRoute);
13250
12743
  const unmountApp = app.unmount;
@@ -13261,9 +12754,7 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13261
12754
  }
13262
12755
  unmountApp();
13263
12756
  };
13264
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
13265
- addDevtools(app, router2, matcher);
13266
- }
12757
+ if ((process.env.NODE_ENV !== "production" || false) && isBrowser) addDevtools(app, router, matcher);
13267
12758
  }
13268
12759
  };
13269
12760
  function runGuardQueue(guards) {
@@ -13271,28 +12762,6 @@ ${JSON.stringify(newTargetLocation, null, 2)}
13271
12762
  }
13272
12763
  return router;
13273
12764
  }
13274
- function extractChangingRecords(to, from) {
13275
- const leavingRecords = [];
13276
- const updatingRecords = [];
13277
- const enteringRecords = [];
13278
- const len = Math.max(from.matched.length, to.matched.length);
13279
- for (let i = 0; i < len; i++) {
13280
- const recordFrom = from.matched[i];
13281
- if (recordFrom) {
13282
- if (to.matched.find((record) => isSameRouteRecord(record, recordFrom)))
13283
- updatingRecords.push(recordFrom);
13284
- else
13285
- leavingRecords.push(recordFrom);
13286
- }
13287
- const recordTo = to.matched[i];
13288
- if (recordTo) {
13289
- if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) {
13290
- enteringRecords.push(recordTo);
13291
- }
13292
- }
13293
- }
13294
- return [leavingRecords, updatingRecords, enteringRecords];
13295
- }
13296
12765
  function useRouter() {
13297
12766
  return inject(routerKey);
13298
12767
  }
@@ -13643,6 +13112,8 @@ class WebFileUtil {
13643
13112
  return WebConfig.staticUrl + url;
13644
13113
  }
13645
13114
  }
13115
+ class RootModel extends Transformer {
13116
+ }
13646
13117
  const _hoisted_1$d = { class: "image-error" };
13647
13118
  const _hoisted_2$9 = {
13648
13119
  key: 1,
@@ -13817,7 +13288,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
13817
13288
  FeedbackUtil.toastError("请先传入 entity 参数");
13818
13289
  return;
13819
13290
  }
13820
- const entityData = Transformer.parse(response.data, props.entity);
13291
+ const entityData = RootModel.parse(response.data, props.entity);
13821
13292
  if (entityData && entityData.url) {
13822
13293
  emits("upload", entityData);
13823
13294
  isUploading.value = false;
@@ -13892,8 +13363,7 @@ function getFormConfig(Class, field) {
13892
13363
  }
13893
13364
  function getFormConfigList(Class) {
13894
13365
  const fieldList = Object.keys(new Class());
13895
- const list = fieldList.map((field) => getFormConfig(Class, field)).filter((item) => !!item.key);
13896
- return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
13366
+ return fieldList.map((field) => getFormConfig(Class, field)).filter((item) => !!item.key && !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
13897
13367
  }
13898
13368
  var FormTrim = /* @__PURE__ */ ((FormTrim2) => {
13899
13369
  FormTrim2[FormTrim2["ALL"] = 0] = "ALL";
@@ -14489,7 +13959,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
14489
13959
  }
14490
13960
  });
14491
13961
  const AMoney = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-f221d0de"]]);
14492
- class QueryPage extends Transformer {
13962
+ class QueryPage extends RootModel {
14493
13963
  /**
14494
13964
  * ### 分页页数
14495
13965
  */
@@ -14499,7 +13969,7 @@ class QueryPage extends Transformer {
14499
13969
  */
14500
13970
  pageSize = 20;
14501
13971
  }
14502
- class QuerySort extends Transformer {
13972
+ class QuerySort extends RootModel {
14503
13973
  /**
14504
13974
  * ### 排序字段 默认 `id`
14505
13975
  */
@@ -14534,7 +14004,7 @@ var __decorateClass$3 = (decorators, target, key, kind) => {
14534
14004
  if (result) __defProp$3(target, key, result);
14535
14005
  return result;
14536
14006
  };
14537
- class QueryResponsePage extends Transformer {
14007
+ class QueryResponsePage extends RootModel {
14538
14008
  /**
14539
14009
  * ### 返回的当前页数据列表
14540
14010
  */
@@ -15100,7 +14570,7 @@ class Http {
15100
14570
  */
15101
14571
  async requestModel(postData, parseClass) {
15102
14572
  const result = await this.requestRaw(postData);
15103
- return Transformer.parse(result, parseClass);
14573
+ return RootModel.parse(result, parseClass);
15104
14574
  }
15105
14575
  /**
15106
14576
  * ### 发送请求并获取转换后的模型数组
@@ -15109,7 +14579,7 @@ class Http {
15109
14579
  */
15110
14580
  async requestModelList(postData, parseClass) {
15111
14581
  const result = await this.requestRaw(postData);
15112
- return result.map((item) => Transformer.parse(item, parseClass));
14582
+ return result.map((item) => RootModel.parse(item, parseClass));
15113
14583
  }
15114
14584
  /**
15115
14585
  * ### POST 发送请求并获取原始 `data`
@@ -15216,7 +14686,7 @@ class Http {
15216
14686
  }
15217
14687
  }
15218
14688
  }
15219
- class ExportModel extends Transformer {
14689
+ class ExportModel extends RootModel {
15220
14690
  /**
15221
14691
  * ### 创建导出任务的API地址
15222
14692
  */
@@ -15488,7 +14958,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15488
14958
  }
15489
14959
  if (result.code === WebConfig.successCode) {
15490
14960
  FeedbackUtil.toastSuccess(props.uploadSuccess);
15491
- const entity = Transformer.parse(result.data, props.entity);
14961
+ const entity = RootModel.parse(result.data, props.entity);
15492
14962
  props.onConfirm(entity);
15493
14963
  } else {
15494
14964
  FeedbackUtil.alertError(
@@ -16980,8 +16450,7 @@ function getSearchConfig(Class, field) {
16980
16450
  }
16981
16451
  function getSearchConfigList(Class) {
16982
16452
  const fieldList = Object.keys(new Class());
16983
- const list = fieldList.map((field) => getSearchConfig(Class, field)).filter((item) => !!item.key);
16984
- return list.filter((item) => !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
16453
+ return fieldList.map((field) => getSearchConfig(Class, field)).filter((item) => !!item.key && !item.hide).sort((a, b) => (b.order || 0) - (a.order || 0));
16985
16454
  }
16986
16455
  const KEY = "[Table]";
16987
16456
  function Table(config = {}) {
@@ -16995,8 +16464,7 @@ function getTableConfig(Class, field) {
16995
16464
  }
16996
16465
  function getTableConfigList(Class) {
16997
16466
  const fieldList = Object.keys(new Class());
16998
- const list = fieldList.map((field) => getTableConfig(Class, field)).filter((item) => !!item.key);
16999
- return list.sort((a, b) => (b.order || 0) - (a.order || 0));
16467
+ return fieldList.map((field) => getTableConfig(Class, field)).filter((item) => !!item.key && !item.removed).sort((a, b) => (b.order || 0) - (a.order || 0));
17000
16468
  }
17001
16469
  var __defProp$2 = Object.defineProperty;
17002
16470
  var __decorateClass$2 = (decorators, target, key, kind) => {
@@ -17007,7 +16475,7 @@ var __decorateClass$2 = (decorators, target, key, kind) => {
17007
16475
  if (result) __defProp$2(target, key, result);
17008
16476
  return result;
17009
16477
  };
17010
- class QueryRequest extends Transformer {
16478
+ class QueryRequest extends RootModel {
17011
16479
  /**
17012
16480
  * ### 查询信息
17013
16481
  */
@@ -17053,7 +16521,7 @@ __decorateClass$1([
17053
16521
  ], QueryRequestPage.prototype, "page");
17054
16522
  function useBaseTable(serviceClass, option = {}) {
17055
16523
  const isLoading = ref(false);
17056
- const service = Transformer.newInstance(serviceClass);
16524
+ const service = RootModel.newInstance(serviceClass);
17057
16525
  service.loading = isLoading;
17058
16526
  const request = ref(new QueryRequestPage(service.entityClass));
17059
16527
  if (option.defaultFilter) {
@@ -17061,7 +16529,7 @@ function useBaseTable(serviceClass, option = {}) {
17061
16529
  }
17062
16530
  const response = ref(new QueryResponsePage());
17063
16531
  const list = ref([]);
17064
- const entity = Transformer.newInstance(service.entityClass);
16532
+ const entity = RootModel.newInstance(service.entityClass);
17065
16533
  const selectList = ref([]);
17066
16534
  async function onGetList() {
17067
16535
  let req = request.value;
@@ -17235,11 +16703,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
17235
16703
  return (_ctx, _cache) => {
17236
16704
  return openBlock(), createBlock(unref(ADialog), {
17237
16705
  "disable-confirm": unref(disableConfirm),
17238
- height: _ctx.height || "70%",
16706
+ height: __props.height || "70%",
17239
16707
  "hide-footer": !props.props.isMultiple,
17240
16708
  loading: unref(isLoading),
17241
16709
  title: dialogTitle.value,
17242
- width: _ctx.width || "70%",
16710
+ width: __props.width || "70%",
17243
16711
  "is-selector": "",
17244
16712
  onCancel: _cache[0] || (_cache[0] = ($event) => props.props.onCancel()),
17245
16713
  onConfirm: _cache[1] || (_cache[1] = ($event) => props.props.onConfirm(unref(selectList).filter((item) => !item.isDisabled)))
@@ -17253,9 +16721,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
17253
16721
  default: withCtx(() => [
17254
16722
  createVNode(unref(_sfc_main$2), {
17255
16723
  "column-list": fields.value,
17256
- "data-list": _ctx.unPaginate || _ctx.treeList ? unref(list) : unref(response).list,
16724
+ "data-list": __props.unPaginate || __props.treeList ? unref(list) : unref(response).list,
17257
16725
  entity: unref(entity),
17258
- "hide-add": _ctx.hideAdd,
16726
+ "hide-add": __props.hideAdd,
17259
16727
  "hide-ctrl": props.props.isMultiple,
17260
16728
  "on-add": onAdd,
17261
16729
  "on-search": unref(onSearch),
@@ -17287,12 +16755,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
17287
16755
  underline: "never",
17288
16756
  onClick: ($event) => props.props.onConfirm(data)
17289
16757
  }, {
17290
- default: withCtx(() => _cache[2] || (_cache[2] = [
16758
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
17291
16759
  createTextVNode(" 选择 ", -1)
17292
- ])),
17293
- _: 2,
17294
- __: [2]
17295
- }, 1032, ["disabled", "onClick"])
16760
+ ])]),
16761
+ _: 1
16762
+ }, 8, ["disabled", "onClick"])
17296
16763
  ]),
17297
16764
  key: "0"
17298
16765
  } : void 0
@@ -17404,7 +16871,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
17404
16871
  isShow.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
17405
16872
  createElementVNode("div", _hoisted_2$3, toDisplayString(unref(WebI18n).get().SelectTableColumnsToShow), 1),
17406
16873
  createElementVNode("div", _hoisted_3$3, [
17407
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item) => {
16874
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columnList, (item) => {
17408
16875
  return openBlock(), createBlock(unref(ElCheckTag), {
17409
16876
  key: item.key,
17410
16877
  checked: !!list.value.find((i) => i === item.key),
@@ -17412,7 +16879,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
17412
16879
  onChange: ($event) => changed($event, item)
17413
16880
  }, {
17414
16881
  default: withCtx(() => [
17415
- createTextVNode(toDisplayString(unref(getFieldLabel)(_ctx.entityClass, item.key)), 1)
16882
+ createTextVNode(toDisplayString(unref(getFieldLabel)(__props.entityClass, item.key)), 1)
17416
16883
  ]),
17417
16884
  _: 2
17418
16885
  }, 1032, ["checked", "disabled", "onChange"]);
@@ -17445,7 +16912,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
17445
16912
  return (_ctx, _cache) => {
17446
16913
  return openBlock(), createBlock(unref(ACopy), {
17447
16914
  content: value.value,
17448
- wrap: _ctx.column.wrap
16915
+ wrap: __props.column.wrap
17449
16916
  }, {
17450
16917
  default: withCtx(() => [
17451
16918
  createTextVNode(toDisplayString(value.value), 1)
@@ -17469,14 +16936,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17469
16936
  const value = computed(() => props.data[key]);
17470
16937
  return (_ctx, _cache) => {
17471
16938
  return openBlock(), createElementBlock("div", _hoisted_1$3, [
17472
- _ctx.column.color ? (openBlock(), createElementBlock("span", {
16939
+ __props.column.color ? (openBlock(), createElementBlock("span", {
17473
16940
  key: 0,
17474
16941
  style: normalizeStyle({
17475
- backgroundColor: _ctx.dictionary.get(value.value)?.color || unref(WebColor).NORMAL
16942
+ backgroundColor: __props.dictionary.get(value.value)?.color || unref(WebColor).NORMAL
17476
16943
  }),
17477
16944
  class: "light"
17478
16945
  }, null, 4)) : createCommentVNode("", true),
17479
- createTextVNode(" " + toDisplayString(_ctx.dictionary.getLabel(value.value, _ctx.column.emptyValue)), 1)
16946
+ createTextVNode(" " + toDisplayString(__props.dictionary.getLabel(value.value, __props.column.emptyValue)), 1)
17480
16947
  ]);
17481
16948
  };
17482
16949
  }
@@ -17570,7 +17037,7 @@ function useTableColumn(params) {
17570
17037
  if (list.length === 0) {
17571
17038
  list = getTableConfigList(entityClass);
17572
17039
  }
17573
- allColumnList.value = list.filter((item) => !item.removed).map((item) => {
17040
+ allColumnList.value = list.map((item) => {
17574
17041
  if (item.money && !item.align) {
17575
17042
  item.align = "right";
17576
17043
  }
@@ -18071,14 +17538,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18071
17538
  const ServiceClass = props.service || hook?.serviceClass;
18072
17539
  let EntityClass;
18073
17540
  if (ServiceClass) {
18074
- EntityClass = Transformer.newInstance(ServiceClass).entityClass;
17541
+ EntityClass = RootModel.newInstance(ServiceClass).entityClass;
18075
17542
  } else {
18076
17543
  EntityClass = props.entity;
18077
17544
  }
18078
17545
  if (!EntityClass) {
18079
17546
  throw new Error("[ATable] entity/service/useHook 三者必须传入一个");
18080
17547
  }
18081
- const entityInstance = Transformer.newInstance(EntityClass);
17548
+ const entityInstance = RootModel.newInstance(EntityClass);
18082
17549
  const modelConfig = getModelConfig(EntityClass);
18083
17550
  const dataListRef = computed(() => {
18084
17551
  if (props.dataList.length > 0) {
@@ -18336,7 +17803,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18336
17803
  function getService() {
18337
17804
  let service;
18338
17805
  if (props.service) {
18339
- service = Transformer.newInstance(props.service);
17806
+ service = RootModel.newInstance(props.service);
18340
17807
  } else if (props.useHook) {
18341
17808
  service = props.useHook.service;
18342
17809
  } else {
@@ -18425,6 +17892,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18425
17892
  }
18426
17893
  if (props.defaultFilter) {
18427
17894
  searchFilter.value = props.defaultFilter;
17895
+ } else if (props.useHook) {
17896
+ searchFilter.value = props.useHook.request.value?.filter;
18428
17897
  }
18429
17898
  onSearch();
18430
17899
  return (_ctx, _cache) => {
@@ -18670,8 +18139,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18670
18139
  default: withCtx(() => [
18671
18140
  createTextVNode(toDisplayString(unref(WebI18n).get().Add), 1)
18672
18141
  ]),
18673
- _: 2
18674
- }, 1032, ["disabled", "onClick"])) : createCommentVNode("", true),
18142
+ _: 1
18143
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
18675
18144
  !props.hideEdit ? (openBlock(), createBlock(unref(ElLink), {
18676
18145
  key: 2,
18677
18146
  disabled: unref(isEditDisabled)(getRowEntity(scope)),
@@ -18681,8 +18150,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18681
18150
  default: withCtx(() => [
18682
18151
  createTextVNode(toDisplayString(unref(WebI18n).get().Update), 1)
18683
18152
  ]),
18684
- _: 2
18685
- }, 1032, ["disabled", "onClick"])) : createCommentVNode("", true),
18153
+ _: 1
18154
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
18686
18155
  __props.showDetail ? (openBlock(), createBlock(unref(ElLink), {
18687
18156
  key: 3,
18688
18157
  disabled: unref(isDetailDisabled)(getRowEntity(scope)),
@@ -18692,8 +18161,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18692
18161
  default: withCtx(() => [
18693
18162
  createTextVNode(toDisplayString(unref(WebI18n).get().Detail), 1)
18694
18163
  ]),
18695
- _: 2
18696
- }, 1032, ["disabled", "onClick"])) : createCommentVNode("", true),
18164
+ _: 1
18165
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
18697
18166
  __props.showEnableAndDisable ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
18698
18167
  getRowEntity(scope).isDisabled ? (openBlock(), createBlock(unref(ElLink), {
18699
18168
  key: 0,
@@ -18704,8 +18173,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18704
18173
  default: withCtx(() => [
18705
18174
  createTextVNode(toDisplayString(unref(WebI18n).get().Enable), 1)
18706
18175
  ]),
18707
- _: 2
18708
- }, 1032, ["disabled", "onClick"])) : (openBlock(), createBlock(unref(ElLink), {
18176
+ _: 1
18177
+ }, 8, ["disabled", "onClick"])) : (openBlock(), createBlock(unref(ElLink), {
18709
18178
  key: 1,
18710
18179
  disabled: unref(isDisableChangeStatus)(getRowEntity(scope)),
18711
18180
  type: "warning",
@@ -18715,8 +18184,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18715
18184
  default: withCtx(() => [
18716
18185
  createTextVNode(toDisplayString(unref(WebI18n).get().Disable), 1)
18717
18186
  ]),
18718
- _: 2
18719
- }, 1032, ["disabled", "onClick"]))
18187
+ _: 1
18188
+ }, 8, ["disabled", "onClick"]))
18720
18189
  ], 64)) : createCommentVNode("", true),
18721
18190
  !__props.hideDelete ? (openBlock(), createBlock(unref(ElLink), {
18722
18191
  key: 5,
@@ -18728,8 +18197,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18728
18197
  default: withCtx(() => [
18729
18198
  createTextVNode(toDisplayString(unref(WebI18n).get().Delete), 1)
18730
18199
  ]),
18731
- _: 2
18732
- }, 1032, ["disabled", "onClick"])) : createCommentVNode("", true),
18200
+ _: 1
18201
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
18733
18202
  scope.$index >= 0 ? renderSlot(_ctx.$slots, "endRow", {
18734
18203
  key: 6,
18735
18204
  data: getRowEntity(scope),
@@ -19081,9 +18550,9 @@ class DisableEnum extends WebEnum {
19081
18550
  }
19082
18551
  function useDetail(props, ServiceClass, option = {}) {
19083
18552
  const isLoading = ref(false);
19084
- const service = Transformer.newInstance(ServiceClass);
18553
+ const service = RootModel.newInstance(ServiceClass);
19085
18554
  service.loading = isLoading;
19086
- const formData = ref(props.param ? props.param.copy() : Transformer.newInstance(service.entityClass));
18555
+ const formData = ref(props.param ? props.param.copy() : RootModel.newInstance(service.entityClass));
19087
18556
  const title = ref(WebI18n.get().Detail);
19088
18557
  async function getDetail() {
19089
18558
  if (formData.value.id) {
@@ -19678,7 +19147,7 @@ function useTable(serviceClass, option = {}) {
19678
19147
  const result = useBaseTable(serviceClass, option);
19679
19148
  async function onEdit(row) {
19680
19149
  if (!option.editView) {
19681
- await FeedbackUtil.toastError("请为 useTable 的 option 传入 editor");
19150
+ FeedbackUtil.toastError("请为 useTable 的 option 传入 editor");
19682
19151
  return;
19683
19152
  }
19684
19153
  try {
@@ -19719,7 +19188,7 @@ function useTableTree(serviceClass, option = {}) {
19719
19188
  return;
19720
19189
  }
19721
19190
  try {
19722
- let param = Transformer.newInstance(result.service.entityClass);
19191
+ let param = RootModel.newInstance(result.service.entityClass);
19723
19192
  param.parentId = row.id;
19724
19193
  if (option.beforeAddRow) {
19725
19194
  const result2 = option.beforeAddRow(param, row);
@@ -19736,8 +19205,6 @@ function useTableTree(serviceClass, option = {}) {
19736
19205
  onAddRow
19737
19206
  });
19738
19207
  }
19739
- class RootModel extends Transformer {
19740
- }
19741
19208
  var __defProp = Object.defineProperty;
19742
19209
  var __decorateClass = (decorators, target, key, kind) => {
19743
19210
  var result = void 0;
@@ -19919,7 +19386,7 @@ class RouterUtil {
19919
19386
  }
19920
19387
  }
19921
19388
  }
19922
- class AbstractService extends Transformer {
19389
+ class AbstractService extends RootModel {
19923
19390
  /**
19924
19391
  * ### `Loading`
19925
19392
  * 你可以将这个传入的对象绑定到你需要 `Loading` 的 `DOM` 上
@@ -20009,7 +19476,7 @@ class AbstractCurdService extends AbstractService {
20009
19476
  */
20010
19477
  async getPage(request, apiUrl = this.urlGetPage) {
20011
19478
  const responsePage = await this.api(apiUrl).requestModel(request, QueryResponsePage);
20012
- responsePage.list = responsePage.list.map((json) => Transformer.parse(json, this.entityClass));
19479
+ responsePage.list = responsePage.list.map((json) => RootModel.parse(json, this.entityClass));
20013
19480
  return responsePage;
20014
19481
  }
20015
19482
  /**
@@ -20134,7 +19601,7 @@ class ClipboardUtil {
20134
19601
  */
20135
19602
  static async copy(content) {
20136
19603
  const { toClipboard } = useClipboard();
20137
- return toClipboard(content);
19604
+ await toClipboard(content);
20138
19605
  }
20139
19606
  }
20140
19607
  export {