@poveste/vendors 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +22 -0
  2. package/dist/client/b-floating-vue.d.ts +3 -0
  3. package/dist/client/b-floating-vue.js +3377 -0
  4. package/dist/client/b-iconify.d.ts +1 -0
  5. package/dist/client/b-iconify.js +1883 -0
  6. package/dist/client/b-pinia.d.ts +1 -0
  7. package/dist/client/b-pinia.js +2069 -0
  8. package/dist/client/b-scroll.d.ts +2 -0
  9. package/dist/client/b-scroll.js +7 -0
  10. package/dist/client/b-vue-router.d.ts +1 -0
  11. package/dist/client/b-vue-router.js +2773 -0
  12. package/dist/client/b-vue-use.d.ts +1 -0
  13. package/dist/client/b-vue-use.js +9626 -0
  14. package/dist/client/b-vue.d.ts +1 -0
  15. package/dist/client/b-vue.js +1 -0
  16. package/dist/client/index.js +169 -0
  17. package/dist/client/node_modules/@babel/helper-string-parser/package.json +31 -0
  18. package/dist/client/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  19. package/dist/client/node_modules/@babel/parser/package.json +50 -0
  20. package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +262 -0
  21. package/dist/client/node_modules/@babel/types/lib/index-legacy.d.ts +2796 -0
  22. package/dist/client/node_modules/@babel/types/lib/index.d.ts +3616 -0
  23. package/dist/client/node_modules/@babel/types/package.json +39 -0
  24. package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +535 -0
  25. package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +535 -0
  26. package/dist/client/node_modules/@floating-ui/core/package.json +63 -0
  27. package/dist/client/node_modules/@floating-ui/dom/index.d.ts +1 -0
  28. package/dist/client/node_modules/@floating-ui/dom/package.json +74 -0
  29. package/dist/client/node_modules/@floating-ui/dom/src/autoUpdate.d.ts +31 -0
  30. package/dist/client/node_modules/@floating-ui/dom/src/index.d.ts +11 -0
  31. package/dist/client/node_modules/@floating-ui/dom/src/platform.d.ts +2 -0
  32. package/dist/client/node_modules/@floating-ui/dom/src/types.d.ts +128 -0
  33. package/dist/client/node_modules/@floating-ui/dom/src/utils/convertOffsetParentRelativeRectToViewportRelativeRect.d.ts +6 -0
  34. package/dist/client/node_modules/@floating-ui/dom/src/utils/getBoundingClientRect.d.ts +2 -0
  35. package/dist/client/node_modules/@floating-ui/dom/src/utils/getClippingRect.d.ts +12 -0
  36. package/dist/client/node_modules/@floating-ui/dom/src/utils/getComputedStyle.d.ts +1 -0
  37. package/dist/client/node_modules/@floating-ui/dom/src/utils/getCssDimensions.d.ts +4 -0
  38. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDimensions.d.ts +2 -0
  39. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDocumentElement.d.ts +1 -0
  40. package/dist/client/node_modules/@floating-ui/dom/src/utils/getDocumentRect.d.ts +2 -0
  41. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNearestOverflowAncestor.d.ts +1 -0
  42. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNodeName.d.ts +1 -0
  43. package/dist/client/node_modules/@floating-ui/dom/src/utils/getNodeScroll.d.ts +2 -0
  44. package/dist/client/node_modules/@floating-ui/dom/src/utils/getOffsetParent.d.ts +1 -0
  45. package/dist/client/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts +3 -0
  46. package/dist/client/node_modules/@floating-ui/dom/src/utils/getParentNode.d.ts +1 -0
  47. package/dist/client/node_modules/@floating-ui/dom/src/utils/getRectRelativeToOffsetParent.d.ts +2 -0
  48. package/dist/client/node_modules/@floating-ui/dom/src/utils/getScale.d.ts +7 -0
  49. package/dist/client/node_modules/@floating-ui/dom/src/utils/getViewportRect.d.ts +2 -0
  50. package/dist/client/node_modules/@floating-ui/dom/src/utils/getWindowScrollBarX.d.ts +1 -0
  51. package/dist/client/node_modules/@floating-ui/dom/src/utils/is.d.ts +17 -0
  52. package/dist/client/node_modules/@floating-ui/dom/src/utils/math.d.ts +3 -0
  53. package/dist/client/node_modules/@floating-ui/dom/src/utils/unwrapElement.d.ts +2 -0
  54. package/dist/client/node_modules/@floating-ui/dom/src/utils/userAgent.d.ts +1 -0
  55. package/dist/client/node_modules/@floating-ui/dom/src/utils/window.d.ts +1 -0
  56. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +105 -0
  57. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +105 -0
  58. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
  59. package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
  60. package/dist/client/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
  61. package/dist/client/node_modules/@floating-ui/utils/dom/package.json +6 -0
  62. package/dist/client/node_modules/@floating-ui/utils/package.json +70 -0
  63. package/dist/client/node_modules/@iconify/types/package.json +23 -0
  64. package/dist/client/node_modules/@iconify/types/provider.d.ts +44 -0
  65. package/dist/client/node_modules/@iconify/types/types.d.ts +272 -0
  66. package/dist/client/node_modules/@iconify/vue/dist/iconify.d.ts +475 -0
  67. package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +114 -0
  68. package/dist/client/node_modules/@iconify/vue/offline/package.json +14 -0
  69. package/dist/client/node_modules/@iconify/vue/package.json +65 -0
  70. package/dist/client/node_modules/@jridgewell/sourcemap-codec/package.json +63 -0
  71. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +50 -0
  72. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +9 -0
  73. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +16 -0
  74. package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +7 -0
  75. package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +265 -0
  76. package/dist/client/node_modules/@types/web-bluetooth/package.json +46 -0
  77. package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +1100 -0
  78. package/dist/client/node_modules/@vue/compiler-core/package.json +58 -0
  79. package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +45 -0
  80. package/dist/client/node_modules/@vue/compiler-dom/package.json +57 -0
  81. package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +485 -0
  82. package/dist/client/node_modules/@vue/compiler-sfc/package.json +67 -0
  83. package/dist/client/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +4 -0
  84. package/dist/client/node_modules/@vue/compiler-ssr/package.json +34 -0
  85. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/api.d.ts +108 -0
  86. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/app.d.ts +1 -0
  87. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/component.d.ts +78 -0
  88. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/context.d.ts +5 -0
  89. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts +180 -0
  90. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/index.d.ts +6 -0
  91. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/util.d.ts +4 -0
  92. package/dist/client/node_modules/@vue/devtools-api/lib/esm/const.d.ts +2 -0
  93. package/dist/client/node_modules/@vue/devtools-api/lib/esm/env.d.ts +15 -0
  94. package/dist/client/node_modules/@vue/devtools-api/lib/esm/index.d.ts +18 -0
  95. package/dist/client/node_modules/@vue/devtools-api/lib/esm/plugin.d.ts +47 -0
  96. package/dist/client/node_modules/@vue/devtools-api/lib/esm/proxy.d.ts +20 -0
  97. package/dist/client/node_modules/@vue/devtools-api/lib/esm/time.d.ts +2 -0
  98. package/dist/client/node_modules/@vue/devtools-api/package.json +37 -0
  99. package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +753 -0
  100. package/dist/client/node_modules/@vue/reactivity/package.json +55 -0
  101. package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +1839 -0
  102. package/dist/client/node_modules/@vue/runtime-core/package.json +52 -0
  103. package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1430 -0
  104. package/dist/client/node_modules/@vue/runtime-dom/package.json +60 -0
  105. package/dist/client/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +65 -0
  106. package/dist/client/node_modules/@vue/server-renderer/package.json +55 -0
  107. package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +334 -0
  108. package/dist/client/node_modules/@vue/shared/package.json +47 -0
  109. package/dist/client/node_modules/@vueuse/core/index.d.mts +6221 -0
  110. package/dist/client/node_modules/@vueuse/core/index.d.ts +6221 -0
  111. package/dist/client/node_modules/@vueuse/core/metadata.d.mts +1 -0
  112. package/dist/client/node_modules/@vueuse/core/metadata.d.ts +1 -0
  113. package/dist/client/node_modules/@vueuse/core/package.json +57 -0
  114. package/dist/client/node_modules/@vueuse/metadata/index.d.mts +78 -0
  115. package/dist/client/node_modules/@vueuse/metadata/index.d.ts +78 -0
  116. package/dist/client/node_modules/@vueuse/metadata/package.json +46 -0
  117. package/dist/client/node_modules/@vueuse/shared/index.d.mts +1260 -0
  118. package/dist/client/node_modules/@vueuse/shared/index.d.ts +1260 -0
  119. package/dist/client/node_modules/@vueuse/shared/package.json +49 -0
  120. package/dist/client/node_modules/compute-scroll-into-view/dist/index.d.ts +75 -0
  121. package/dist/client/node_modules/compute-scroll-into-view/package.json +82 -0
  122. package/dist/client/node_modules/csstype/index.d.ts +22569 -0
  123. package/dist/client/node_modules/csstype/package.json +70 -0
  124. package/dist/client/node_modules/entities/decode.d.ts +3 -0
  125. package/dist/client/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +19 -0
  126. package/dist/client/node_modules/entities/dist/commonjs/decode.d.ts +205 -0
  127. package/dist/client/node_modules/entities/dist/commonjs/encode.d.ts +22 -0
  128. package/dist/client/node_modules/entities/dist/commonjs/escape.d.ts +46 -0
  129. package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +2 -0
  130. package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +2 -0
  131. package/dist/client/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +3 -0
  132. package/dist/client/node_modules/entities/dist/commonjs/index.d.ts +96 -0
  133. package/dist/client/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts +17 -0
  134. package/dist/client/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts +2 -0
  135. package/dist/client/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts +32 -0
  136. package/dist/client/node_modules/entities/dist/commonjs/package.json +3 -0
  137. package/dist/client/node_modules/entities/dist/esm/decode-codepoint.d.ts +19 -0
  138. package/dist/client/node_modules/entities/dist/esm/decode.d.ts +205 -0
  139. package/dist/client/node_modules/entities/dist/esm/encode.d.ts +22 -0
  140. package/dist/client/node_modules/entities/dist/esm/escape.d.ts +46 -0
  141. package/dist/client/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +2 -0
  142. package/dist/client/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +2 -0
  143. package/dist/client/node_modules/entities/dist/esm/generated/encode-html.d.ts +3 -0
  144. package/dist/client/node_modules/entities/dist/esm/index.d.ts +96 -0
  145. package/dist/client/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts +17 -0
  146. package/dist/client/node_modules/entities/dist/esm/internal/decode-shared.d.ts +2 -0
  147. package/dist/client/node_modules/entities/dist/esm/internal/encode-shared.d.ts +32 -0
  148. package/dist/client/node_modules/entities/dist/esm/package.json +3 -0
  149. package/dist/client/node_modules/entities/escape.d.ts +3 -0
  150. package/dist/client/node_modules/entities/package.json +120 -0
  151. package/dist/client/node_modules/estree-walker/dist/esm/package.json +1 -0
  152. package/dist/client/node_modules/estree-walker/package.json +37 -0
  153. package/dist/client/node_modules/estree-walker/src/package.json +1 -0
  154. package/dist/client/node_modules/estree-walker/types/async.d.ts +53 -0
  155. package/dist/client/node_modules/estree-walker/types/index.d.ts +56 -0
  156. package/dist/client/node_modules/estree-walker/types/sync.d.ts +53 -0
  157. package/dist/client/node_modules/estree-walker/types/walker.d.ts +37 -0
  158. package/dist/client/node_modules/floating-vue/dist/components/Dropdown.d.ts +398 -0
  159. package/dist/client/node_modules/floating-vue/dist/components/Menu.d.ts +398 -0
  160. package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +495 -0
  161. package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +474 -0
  162. package/dist/client/node_modules/floating-vue/dist/components/PopperContent.vue.d.ts +37 -0
  163. package/dist/client/node_modules/floating-vue/dist/components/PopperMethods.d.ts +9 -0
  164. package/dist/client/node_modules/floating-vue/dist/components/PopperWrapper.vue.d.ts +414 -0
  165. package/dist/client/node_modules/floating-vue/dist/components/ThemeClass.d.ts +6 -0
  166. package/dist/client/node_modules/floating-vue/dist/components/Tooltip.d.ts +398 -0
  167. package/dist/client/node_modules/floating-vue/dist/components/TooltipDirective.vue.d.ts +67 -0
  168. package/dist/client/node_modules/floating-vue/dist/config.d.ts +11 -0
  169. package/dist/client/node_modules/floating-vue/dist/directives/v-close-popper.d.ts +13 -0
  170. package/dist/client/node_modules/floating-vue/dist/directives/v-tooltip.d.ts +27 -0
  171. package/dist/client/node_modules/floating-vue/dist/directives/v-tooltip.spec.d.ts +1 -0
  172. package/dist/client/node_modules/floating-vue/dist/index.d.ts +2239 -0
  173. package/dist/client/node_modules/floating-vue/dist/util/assign-deep.d.ts +1 -0
  174. package/dist/client/node_modules/floating-vue/dist/util/env.d.ts +2 -0
  175. package/dist/client/node_modules/floating-vue/dist/util/events.d.ts +14 -0
  176. package/dist/client/node_modules/floating-vue/dist/util/frame.d.ts +1 -0
  177. package/dist/client/node_modules/floating-vue/dist/util/lang.d.ts +1 -0
  178. package/dist/client/node_modules/floating-vue/dist/util/popper.d.ts +3 -0
  179. package/dist/client/node_modules/floating-vue/package.json +80 -0
  180. package/dist/client/node_modules/magic-string/dist/magic-string.cjs.d.ts +289 -0
  181. package/dist/client/node_modules/magic-string/dist/magic-string.es.d.mts +289 -0
  182. package/dist/client/node_modules/magic-string/package.json +67 -0
  183. package/dist/client/node_modules/nanoid/async/index.d.ts +56 -0
  184. package/dist/client/node_modules/nanoid/async/package.json +12 -0
  185. package/dist/client/node_modules/nanoid/index.d.ts +91 -0
  186. package/dist/client/node_modules/nanoid/non-secure/index.d.ts +33 -0
  187. package/dist/client/node_modules/nanoid/non-secure/package.json +6 -0
  188. package/dist/client/node_modules/nanoid/package.json +89 -0
  189. package/dist/client/node_modules/nanoid/url-alphabet/package.json +6 -0
  190. package/dist/client/node_modules/picocolors/package.json +25 -0
  191. package/dist/client/node_modules/picocolors/picocolors.d.ts +5 -0
  192. package/dist/client/node_modules/picocolors/types.d.ts +51 -0
  193. package/dist/client/node_modules/pinia/dist/pinia.d.ts +1074 -0
  194. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/index.d.ts +22 -0
  195. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2/index.d.ts +33 -0
  196. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2.7/index.d.ts +38 -0
  197. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v3/index.d.ts +22 -0
  198. package/dist/client/node_modules/pinia/node_modules/vue-demi/package.json +47 -0
  199. package/dist/client/node_modules/pinia/package.json +96 -0
  200. package/dist/client/node_modules/postcss/lib/at-rule.d.ts +139 -0
  201. package/dist/client/node_modules/postcss/lib/comment.d.ts +67 -0
  202. package/dist/client/node_modules/postcss/lib/container.d.ts +478 -0
  203. package/dist/client/node_modules/postcss/lib/css-syntax-error.d.ts +247 -0
  204. package/dist/client/node_modules/postcss/lib/declaration.d.ts +150 -0
  205. package/dist/client/node_modules/postcss/lib/document.d.ts +68 -0
  206. package/dist/client/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  207. package/dist/client/node_modules/postcss/lib/input.d.ts +226 -0
  208. package/dist/client/node_modules/postcss/lib/lazy-result.d.ts +189 -0
  209. package/dist/client/node_modules/postcss/lib/list.d.ts +60 -0
  210. package/dist/client/node_modules/postcss/lib/no-work-result.d.ts +45 -0
  211. package/dist/client/node_modules/postcss/lib/node.d.ts +555 -0
  212. package/dist/client/node_modules/postcss/lib/parse.d.ts +9 -0
  213. package/dist/client/node_modules/postcss/lib/postcss.d.mts +66 -0
  214. package/dist/client/node_modules/postcss/lib/postcss.d.ts +464 -0
  215. package/dist/client/node_modules/postcss/lib/previous-map.d.ts +80 -0
  216. package/dist/client/node_modules/postcss/lib/processor.d.ts +114 -0
  217. package/dist/client/node_modules/postcss/lib/result.d.ts +204 -0
  218. package/dist/client/node_modules/postcss/lib/root.d.ts +86 -0
  219. package/dist/client/node_modules/postcss/lib/rule.d.ts +126 -0
  220. package/dist/client/node_modules/postcss/lib/stringifier.d.ts +45 -0
  221. package/dist/client/node_modules/postcss/lib/stringify.d.ts +9 -0
  222. package/dist/client/node_modules/postcss/lib/warning.d.ts +146 -0
  223. package/dist/client/node_modules/postcss/package.json +88 -0
  224. package/dist/client/node_modules/scroll-into-view-if-needed/dist/index.d.ts +79 -0
  225. package/dist/client/node_modules/scroll-into-view-if-needed/package.json +80 -0
  226. package/dist/client/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  227. package/dist/client/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  228. package/dist/client/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  229. package/dist/client/node_modules/source-map-js/package.json +71 -0
  230. package/dist/client/node_modules/source-map-js/source-map.d.ts +104 -0
  231. package/dist/client/node_modules/vue/compiler-sfc/index.d.mts +1 -0
  232. package/dist/client/node_modules/vue/compiler-sfc/index.d.ts +1 -0
  233. package/dist/client/node_modules/vue/compiler-sfc/package.json +4 -0
  234. package/dist/client/node_modules/vue/dist/vue.d.mts +7 -0
  235. package/dist/client/node_modules/vue/dist/vue.d.ts +7 -0
  236. package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +25 -0
  237. package/dist/client/node_modules/vue/jsx-runtime/package.json +5 -0
  238. package/dist/client/node_modules/vue/jsx.d.ts +22 -0
  239. package/dist/client/node_modules/vue/package.json +112 -0
  240. package/dist/client/node_modules/vue/server-renderer/index.d.mts +1 -0
  241. package/dist/client/node_modules/vue/server-renderer/index.d.ts +1 -0
  242. package/dist/client/node_modules/vue/server-renderer/package.json +4 -0
  243. package/dist/client/node_modules/vue-resize/package.json +77 -0
  244. package/dist/client/node_modules/vue-router/dist/experimental/index.d.mts +38 -0
  245. package/dist/client/node_modules/vue-router/dist/router-CWoNjPRp.d.mts +1973 -0
  246. package/dist/client/node_modules/vue-router/dist/vue-router.d.mts +361 -0
  247. package/dist/client/node_modules/vue-router/package.json +153 -0
  248. package/dist/client/node_modules/vue-router/vue-router-auto-resolver.d.mts +22 -0
  249. package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.ts +4 -0
  250. package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +1 -0
  251. package/dist/client/vue.runtime.esm-bundler.js +13167 -0
  252. package/entries.js +9 -0
  253. package/floating-vue.d.ts +4 -0
  254. package/iconify.d.ts +4 -0
  255. package/package.json +50 -0
  256. package/pinia.d.ts +4 -0
  257. package/rollup.config.mjs +119 -0
  258. package/scroll.d.ts +4 -0
  259. package/src/client/b-floating-vue.ts +5 -0
  260. package/src/client/b-iconify.ts +1 -0
  261. package/src/client/b-pinia.ts +1 -0
  262. package/src/client/b-scroll.ts +4 -0
  263. package/src/client/b-vue-router.ts +1 -0
  264. package/src/client/b-vue-use.ts +1 -0
  265. package/src/client/b-vue.ts +1 -0
  266. package/tsconfig.json +34 -0
  267. package/vue-router.d.ts +4 -0
  268. package/vue-use.d.ts +4 -0
  269. package/vue.d.ts +4 -0
@@ -0,0 +1,2773 @@
1
+ import { P as onUnmounted, Q as onDeactivated, R as onActivated, O as getCurrentInstance, z as inject, B as watch, L as computed, C as unref, S as watchEffect, d as defineComponent, M as reactive, x as h, T as provide, u as ref, U as shallowRef, b as nextTick, V as shallowReactive } from './vue.runtime.esm-bundler.js';
2
+ import { s as setupDevtoolsPlugin } from './index.js';
3
+
4
+ /*!
5
+ * vue-router v4.6.4
6
+ * (c) 2025 Eduardo San Martin Morote
7
+ * @license MIT
8
+ */
9
+
10
+ //#region src/utils/env.ts
11
+ const isBrowser = typeof document !== "undefined";
12
+
13
+ //#endregion
14
+ //#region src/utils/index.ts
15
+ /**
16
+ * Identity function that returns the value as is.
17
+ *
18
+ * @param v - the value to return
19
+ *
20
+ * @internal
21
+ */
22
+ const identityFn = (v) => v;
23
+ /**
24
+ * Allows differentiating lazy components from functional components and vue-class-component
25
+ * @internal
26
+ *
27
+ * @param component
28
+ */
29
+ function isRouteComponent(component) {
30
+ return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
31
+ }
32
+ function isESModule(obj) {
33
+ return obj.__esModule || obj[Symbol.toStringTag] === "Module" || obj.default && isRouteComponent(obj.default);
34
+ }
35
+ const assign = Object.assign;
36
+ function applyToParams(fn, params) {
37
+ const newParams = {};
38
+ for (const key in params) {
39
+ const value = params[key];
40
+ newParams[key] = isArray(value) ? value.map(fn) : fn(value);
41
+ }
42
+ return newParams;
43
+ }
44
+ const noop = () => {};
45
+ /**
46
+ * Typesafe alternative to Array.isArray
47
+ * https://github.com/microsoft/TypeScript/pull/48228
48
+ *
49
+ * @internal
50
+ */
51
+ const isArray = Array.isArray;
52
+ function mergeOptions(defaults, partialOptions) {
53
+ const options = {};
54
+ for (const key in defaults) options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
55
+ return options;
56
+ }
57
+
58
+ //#endregion
59
+ //#region src/warning.ts
60
+ function warn$1(msg) {
61
+ const args = Array.from(arguments).slice(1);
62
+ console.warn.apply(console, ["[Vue Router warn]: " + msg].concat(args));
63
+ }
64
+
65
+ //#endregion
66
+ //#region src/encoding.ts
67
+ /**
68
+ * Encoding Rules (␣ = Space)
69
+ * - Path: ␣ " < > # ? { }
70
+ * - Query: ␣ " < > # & =
71
+ * - Hash: ␣ " < > `
72
+ *
73
+ * On top of that, the RFC3986 (https://tools.ietf.org/html/rfc3986#section-2.2)
74
+ * defines some extra characters to be encoded. Most browsers do not encode them
75
+ * in encodeURI https://github.com/whatwg/url/issues/369, so it may be safer to
76
+ * also encode `!'()*`. Leaving un-encoded only ASCII alphanumeric(`a-zA-Z0-9`)
77
+ * plus `-._~`. This extra safety should be applied to query by patching the
78
+ * string returned by encodeURIComponent encodeURI also encodes `[\]^`. `\`
79
+ * should be encoded to avoid ambiguity. Browsers (IE, FF, C) transform a `\`
80
+ * into a `/` if directly typed in. The _backtick_ (`````) should also be
81
+ * encoded everywhere because some browsers like FF encode it when directly
82
+ * written while others don't. Safari and IE don't encode ``"<>{}``` in hash.
83
+ */
84
+ const HASH_RE = /#/g;
85
+ const AMPERSAND_RE = /&/g;
86
+ const SLASH_RE = /\//g;
87
+ const EQUAL_RE = /=/g;
88
+ const IM_RE = /\?/g;
89
+ const PLUS_RE = /\+/g;
90
+ /**
91
+ * NOTE: It's not clear to me if we should encode the + symbol in queries, it
92
+ * seems to be less flexible than not doing so and I can't find out the legacy
93
+ * systems requiring this for regular requests like text/html. In the standard,
94
+ * the encoding of the plus character is only mentioned for
95
+ * application/x-www-form-urlencoded
96
+ * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo
97
+ * leave the plus character as is in queries. To be more flexible, we allow the
98
+ * plus character on the query, but it can also be manually encoded by the user.
99
+ *
100
+ * Resources:
101
+ * - https://url.spec.whatwg.org/#urlencoded-parsing
102
+ * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
103
+ */
104
+ const ENC_BRACKET_OPEN_RE = /%5B/g;
105
+ const ENC_BRACKET_CLOSE_RE = /%5D/g;
106
+ const ENC_CARET_RE = /%5E/g;
107
+ const ENC_BACKTICK_RE = /%60/g;
108
+ const ENC_CURLY_OPEN_RE = /%7B/g;
109
+ const ENC_PIPE_RE = /%7C/g;
110
+ const ENC_CURLY_CLOSE_RE = /%7D/g;
111
+ const ENC_SPACE_RE = /%20/g;
112
+ /**
113
+ * Encode characters that need to be encoded on the path, search and hash
114
+ * sections of the URL.
115
+ *
116
+ * @internal
117
+ * @param text - string to encode
118
+ * @returns encoded string
119
+ */
120
+ function commonEncode(text) {
121
+ return text == null ? "" : encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
122
+ }
123
+ /**
124
+ * Encode characters that need to be encoded on the hash section of the URL.
125
+ *
126
+ * @param text - string to encode
127
+ * @returns encoded string
128
+ */
129
+ function encodeHash(text) {
130
+ return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
131
+ }
132
+ /**
133
+ * Encode characters that need to be encoded query values on the query
134
+ * section of the URL.
135
+ *
136
+ * @param text - string to encode
137
+ * @returns encoded string
138
+ */
139
+ function encodeQueryValue(text) {
140
+ return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
141
+ }
142
+ /**
143
+ * Like `encodeQueryValue` but also encodes the `=` character.
144
+ *
145
+ * @param text - string to encode
146
+ */
147
+ function encodeQueryKey(text) {
148
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
149
+ }
150
+ /**
151
+ * Encode characters that need to be encoded on the path section of the URL.
152
+ *
153
+ * @param text - string to encode
154
+ * @returns encoded string
155
+ */
156
+ function encodePath(text) {
157
+ return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
158
+ }
159
+ /**
160
+ * Encode characters that need to be encoded on the path section of the URL as a
161
+ * param. This function encodes everything {@link encodePath} does plus the
162
+ * slash (`/`) character. If `text` is `null` or `undefined`, returns an empty
163
+ * string instead.
164
+ *
165
+ * @param text - string to encode
166
+ * @returns encoded string
167
+ */
168
+ function encodeParam(text) {
169
+ return encodePath(text).replace(SLASH_RE, "%2F");
170
+ }
171
+ function decode(text) {
172
+ if (text == null) return null;
173
+ try {
174
+ return decodeURIComponent("" + text);
175
+ } catch (err) {
176
+ process.env.NODE_ENV !== "production" && warn$1(`Error decoding "${text}". Using original value`);
177
+ }
178
+ return "" + text;
179
+ }
180
+
181
+ //#endregion
182
+ //#region src/location.ts
183
+ const TRAILING_SLASH_RE = /\/$/;
184
+ const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, "");
185
+ /**
186
+ * Transforms a URI into a normalized history location
187
+ *
188
+ * @param parseQuery
189
+ * @param location - URI to normalize
190
+ * @param currentLocation - current absolute location. Allows resolving relative
191
+ * paths. Must start with `/`. Defaults to `/`
192
+ * @returns a normalized history location
193
+ */
194
+ function parseURL(parseQuery$1, location, currentLocation = "/") {
195
+ let path, query = {}, searchString = "", hash = "";
196
+ const hashPos = location.indexOf("#");
197
+ let searchPos = location.indexOf("?");
198
+ searchPos = hashPos >= 0 && searchPos > hashPos ? -1 : searchPos;
199
+ if (searchPos >= 0) {
200
+ path = location.slice(0, searchPos);
201
+ searchString = location.slice(searchPos, hashPos > 0 ? hashPos : location.length);
202
+ query = parseQuery$1(searchString.slice(1));
203
+ }
204
+ if (hashPos >= 0) {
205
+ path = path || location.slice(0, hashPos);
206
+ hash = location.slice(hashPos, location.length);
207
+ }
208
+ path = resolveRelativePath(path != null ? path : location, currentLocation);
209
+ return {
210
+ fullPath: path + searchString + hash,
211
+ path,
212
+ query,
213
+ hash: decode(hash)
214
+ };
215
+ }
216
+ function NEW_stringifyURL(stringifyQuery$1, path, query, hash = "") {
217
+ const searchText = stringifyQuery$1(query);
218
+ return path + (searchText && "?") + searchText + encodeHash(hash);
219
+ }
220
+ /**
221
+ * Stringifies a URL object
222
+ *
223
+ * @param stringifyQuery
224
+ * @param location
225
+ */
226
+ function stringifyURL(stringifyQuery$1, location) {
227
+ const query = location.query ? stringifyQuery$1(location.query) : "";
228
+ return location.path + (query && "?") + query + (location.hash || "");
229
+ }
230
+ /**
231
+ * Strips off the base from the beginning of a location.pathname in a non-case-sensitive way.
232
+ *
233
+ * @param pathname - location.pathname
234
+ * @param base - base to strip off
235
+ */
236
+ function stripBase(pathname, base) {
237
+ if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase())) return pathname;
238
+ return pathname.slice(base.length) || "/";
239
+ }
240
+ /**
241
+ * Checks if two RouteLocation are equal. This means that both locations are
242
+ * pointing towards the same {@link RouteRecord} and that all `params`, `query`
243
+ * parameters and `hash` are the same
244
+ *
245
+ * @param stringifyQuery - A function that takes a query object of type LocationQueryRaw and returns a string representation of it.
246
+ * @param a - first {@link RouteLocation}
247
+ * @param b - second {@link RouteLocation}
248
+ */
249
+ function isSameRouteLocation(stringifyQuery$1, a, b) {
250
+ const aLastIndex = a.matched.length - 1;
251
+ const bLastIndex = b.matched.length - 1;
252
+ 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;
253
+ }
254
+ /**
255
+ * Check if two `RouteRecords` are equal. Takes into account aliases: they are
256
+ * considered equal to the `RouteRecord` they are aliasing.
257
+ *
258
+ * @param a - first {@link RouteRecord}
259
+ * @param b - second {@link RouteRecord}
260
+ */
261
+ function isSameRouteRecord(a, b) {
262
+ return (a.aliasOf || a) === (b.aliasOf || b);
263
+ }
264
+ function isSameRouteLocationParams(a, b) {
265
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
266
+ for (var key in a) if (!isSameRouteLocationParamsValue(a[key], b[key])) return false;
267
+ return true;
268
+ }
269
+ function isSameRouteLocationParamsValue(a, b) {
270
+ return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a?.valueOf() === b?.valueOf();
271
+ }
272
+ /**
273
+ * Check if two arrays are the same or if an array with one single entry is the
274
+ * same as another primitive value. Used to check query and parameters
275
+ *
276
+ * @param a - array of values
277
+ * @param b - array of values or a single value
278
+ */
279
+ function isEquivalentArray(a, b) {
280
+ return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
281
+ }
282
+ /**
283
+ * Resolves a relative path that starts with `.`.
284
+ *
285
+ * @param to - path location we are resolving
286
+ * @param from - currentLocation.path, should start with `/`
287
+ */
288
+ function resolveRelativePath(to, from) {
289
+ if (to.startsWith("/")) return to;
290
+ if (process.env.NODE_ENV !== "production" && !from.startsWith("/")) {
291
+ warn$1(`Cannot resolve a relative location without an absolute path. Trying to resolve "${to}" from "${from}". It should look like "/${from}".`);
292
+ return to;
293
+ }
294
+ if (!to) return from;
295
+ const fromSegments = from.split("/");
296
+ const toSegments = to.split("/");
297
+ const lastToSegment = toSegments[toSegments.length - 1];
298
+ if (lastToSegment === ".." || lastToSegment === ".") toSegments.push("");
299
+ let position = fromSegments.length - 1;
300
+ let toPosition;
301
+ let segment;
302
+ for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
303
+ segment = toSegments[toPosition];
304
+ if (segment === ".") continue;
305
+ if (segment === "..") {
306
+ if (position > 1) position--;
307
+ } else break;
308
+ }
309
+ return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/");
310
+ }
311
+ /**
312
+ * Initial route location where the router is. Can be used in navigation guards
313
+ * to differentiate the initial navigation.
314
+ *
315
+ * @example
316
+ * ```js
317
+ * import { START_LOCATION } from 'vue-router'
318
+ *
319
+ * router.beforeEach((to, from) => {
320
+ * if (from === START_LOCATION) {
321
+ * // initial navigation
322
+ * }
323
+ * })
324
+ * ```
325
+ */
326
+ const START_LOCATION_NORMALIZED = {
327
+ path: "/",
328
+ name: void 0,
329
+ params: {},
330
+ query: {},
331
+ hash: "",
332
+ fullPath: "/",
333
+ matched: [],
334
+ meta: {},
335
+ redirectedFrom: void 0
336
+ };
337
+
338
+ //#endregion
339
+ //#region src/history/common.ts
340
+ let NavigationType = /* @__PURE__ */ function(NavigationType$1) {
341
+ NavigationType$1["pop"] = "pop";
342
+ NavigationType$1["push"] = "push";
343
+ return NavigationType$1;
344
+ }({});
345
+ let NavigationDirection = /* @__PURE__ */ function(NavigationDirection$1) {
346
+ NavigationDirection$1["back"] = "back";
347
+ NavigationDirection$1["forward"] = "forward";
348
+ NavigationDirection$1["unknown"] = "";
349
+ return NavigationDirection$1;
350
+ }({});
351
+ /**
352
+ * Starting location for Histories
353
+ */
354
+ const START = "";
355
+ /**
356
+ * Normalizes a base by removing any trailing slash and reading the base tag if
357
+ * present.
358
+ *
359
+ * @param base - base to normalize
360
+ */
361
+ function normalizeBase(base) {
362
+ if (!base) if (isBrowser) {
363
+ const baseEl = document.querySelector("base");
364
+ base = baseEl && baseEl.getAttribute("href") || "/";
365
+ base = base.replace(/^\w+:\/\/[^\/]+/, "");
366
+ } else base = "/";
367
+ if (base[0] !== "/" && base[0] !== "#") base = "/" + base;
368
+ return removeTrailingSlash(base);
369
+ }
370
+ const BEFORE_HASH_RE = /^[^#]+#/;
371
+ function createHref(base, location) {
372
+ return base.replace(BEFORE_HASH_RE, "#") + location;
373
+ }
374
+
375
+ //#endregion
376
+ //#region src/scrollBehavior.ts
377
+ function getElementPosition(el, offset) {
378
+ const docRect = document.documentElement.getBoundingClientRect();
379
+ const elRect = el.getBoundingClientRect();
380
+ return {
381
+ behavior: offset.behavior,
382
+ left: elRect.left - docRect.left - (offset.left || 0),
383
+ top: elRect.top - docRect.top - (offset.top || 0)
384
+ };
385
+ }
386
+ const computeScrollPosition = () => ({
387
+ left: window.scrollX,
388
+ top: window.scrollY
389
+ });
390
+ function scrollToPosition(position) {
391
+ let scrollToOptions;
392
+ if ("el" in position) {
393
+ const positionEl = position.el;
394
+ const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#");
395
+ /**
396
+ * `id`s can accept pretty much any characters, including CSS combinators
397
+ * like `>` or `~`. It's still possible to retrieve elements using
398
+ * `document.getElementById('~')` but it needs to be escaped when using
399
+ * `document.querySelector('#\\~')` for it to be valid. The only
400
+ * requirements for `id`s are them to be unique on the page and to not be
401
+ * empty (`id=""`). Because of that, when passing an id selector, it should
402
+ * be properly escaped for it to work with `querySelector`. We could check
403
+ * for the id selector to be simple (no CSS combinators `+ >~`) but that
404
+ * would make things inconsistent since they are valid characters for an
405
+ * `id` but would need to be escaped when using `querySelector`, breaking
406
+ * their usage and ending up in no selector returned. Selectors need to be
407
+ * escaped:
408
+ *
409
+ * - `#1-thing` becomes `#\31 -thing`
410
+ * - `#with~symbols` becomes `#with\\~symbols`
411
+ *
412
+ * - More information about the topic can be found at
413
+ * https://mathiasbynens.be/notes/html5-id-class.
414
+ * - Practical example: https://mathiasbynens.be/demo/html5-id
415
+ */
416
+ if (process.env.NODE_ENV !== "production" && typeof position.el === "string") {
417
+ if (!isIdSelector || !document.getElementById(position.el.slice(1))) try {
418
+ const foundEl = document.querySelector(position.el);
419
+ if (isIdSelector && foundEl) {
420
+ warn$1(`The selector "${position.el}" should be passed as "el: document.querySelector('${position.el}')" because it starts with "#".`);
421
+ return;
422
+ }
423
+ } catch (err) {
424
+ 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).`);
425
+ return;
426
+ }
427
+ }
428
+ const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl) : positionEl;
429
+ if (!el) {
430
+ process.env.NODE_ENV !== "production" && warn$1(`Couldn't find element using selector "${position.el}" returned by scrollBehavior.`);
431
+ return;
432
+ }
433
+ scrollToOptions = getElementPosition(el, position);
434
+ } else scrollToOptions = position;
435
+ if ("scrollBehavior" in document.documentElement.style) window.scrollTo(scrollToOptions);
436
+ else window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);
437
+ }
438
+ function getScrollKey(path, delta) {
439
+ return (history.state ? history.state.position - delta : -1) + path;
440
+ }
441
+ const scrollPositions = /* @__PURE__ */ new Map();
442
+ function saveScrollPosition(key, scrollPosition) {
443
+ scrollPositions.set(key, scrollPosition);
444
+ }
445
+ function getSavedScrollPosition(key) {
446
+ const scroll = scrollPositions.get(key);
447
+ scrollPositions.delete(key);
448
+ return scroll;
449
+ }
450
+ /**
451
+ * ScrollBehavior instance used by the router to compute and restore the scroll
452
+ * position when navigating.
453
+ */
454
+
455
+ //#endregion
456
+ //#region src/types/typeGuards.ts
457
+ function isRouteLocation(route) {
458
+ return typeof route === "string" || route && typeof route === "object";
459
+ }
460
+ function isRouteName(name) {
461
+ return typeof name === "string" || typeof name === "symbol";
462
+ }
463
+
464
+ //#endregion
465
+ //#region src/errors.ts
466
+ /**
467
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
468
+ * {@link NavigationFailureType}.
469
+ *
470
+ * @internal
471
+ */
472
+ let ErrorTypes = /* @__PURE__ */ function(ErrorTypes$1) {
473
+ ErrorTypes$1[ErrorTypes$1["MATCHER_NOT_FOUND"] = 1] = "MATCHER_NOT_FOUND";
474
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_GUARD_REDIRECT"] = 2] = "NAVIGATION_GUARD_REDIRECT";
475
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_ABORTED"] = 4] = "NAVIGATION_ABORTED";
476
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_CANCELLED"] = 8] = "NAVIGATION_CANCELLED";
477
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_DUPLICATED"] = 16] = "NAVIGATION_DUPLICATED";
478
+ return ErrorTypes$1;
479
+ }({});
480
+ const NavigationFailureSymbol = Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
481
+ /**
482
+ * Enumeration with all possible types for navigation failures. Can be passed to
483
+ * {@link isNavigationFailure} to check for specific failures.
484
+ */
485
+ let NavigationFailureType = /* @__PURE__ */ function(NavigationFailureType$1) {
486
+ /**
487
+ * An aborted navigation is a navigation that failed because a navigation
488
+ * guard returned `false` or called `next(false)`
489
+ */
490
+ NavigationFailureType$1[NavigationFailureType$1["aborted"] = 4] = "aborted";
491
+ /**
492
+ * A cancelled navigation is a navigation that failed because a more recent
493
+ * navigation finished started (not necessarily finished).
494
+ */
495
+ NavigationFailureType$1[NavigationFailureType$1["cancelled"] = 8] = "cancelled";
496
+ /**
497
+ * A duplicated navigation is a navigation that failed because it was
498
+ * initiated while already being at the exact same location.
499
+ */
500
+ NavigationFailureType$1[NavigationFailureType$1["duplicated"] = 16] = "duplicated";
501
+ return NavigationFailureType$1;
502
+ }({});
503
+ const ErrorTypeMessages = {
504
+ [ErrorTypes.MATCHER_NOT_FOUND]({ location, currentLocation }) {
505
+ return `No match for\n ${JSON.stringify(location)}${currentLocation ? "\nwhile being at\n" + JSON.stringify(currentLocation) : ""}`;
506
+ },
507
+ [ErrorTypes.NAVIGATION_GUARD_REDIRECT]({ from, to }) {
508
+ return `Redirected from "${from.fullPath}" to "${stringifyRoute(to)}" via a navigation guard.`;
509
+ },
510
+ [ErrorTypes.NAVIGATION_ABORTED]({ from, to }) {
511
+ return `Navigation aborted from "${from.fullPath}" to "${to.fullPath}" via a navigation guard.`;
512
+ },
513
+ [ErrorTypes.NAVIGATION_CANCELLED]({ from, to }) {
514
+ return `Navigation cancelled from "${from.fullPath}" to "${to.fullPath}" with a new navigation.`;
515
+ },
516
+ [ErrorTypes.NAVIGATION_DUPLICATED]({ from, to }) {
517
+ return `Avoided redundant navigation to current location: "${from.fullPath}".`;
518
+ }
519
+ };
520
+ /**
521
+ * Creates a typed NavigationFailure object.
522
+ * @internal
523
+ * @param type - NavigationFailureType
524
+ * @param params - { from, to }
525
+ */
526
+ function createRouterError(type, params) {
527
+ if (process.env.NODE_ENV !== "production" || false) return assign(new Error(ErrorTypeMessages[type](params)), {
528
+ type,
529
+ [NavigationFailureSymbol]: true
530
+ }, params);
531
+ else return assign(/* @__PURE__ */ new Error(), {
532
+ type,
533
+ [NavigationFailureSymbol]: true
534
+ }, params);
535
+ }
536
+ function isNavigationFailure(error, type) {
537
+ return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
538
+ }
539
+ const propertiesToLog = [
540
+ "params",
541
+ "query",
542
+ "hash"
543
+ ];
544
+ function stringifyRoute(to) {
545
+ if (typeof to === "string") return to;
546
+ if (to.path != null) return to.path;
547
+ const location = {};
548
+ for (const key of propertiesToLog) if (key in to) location[key] = to[key];
549
+ return JSON.stringify(location, null, 2);
550
+ }
551
+
552
+ //#endregion
553
+ //#region src/query.ts
554
+ /**
555
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
556
+ * version with the leading `?` and without Should work as URLSearchParams
557
+
558
+ * @internal
559
+ *
560
+ * @param search - search string to parse
561
+ * @returns a query object
562
+ */
563
+ function parseQuery(search) {
564
+ const query = {};
565
+ if (search === "" || search === "?") return query;
566
+ const searchParams = (search[0] === "?" ? search.slice(1) : search).split("&");
567
+ for (let i = 0; i < searchParams.length; ++i) {
568
+ const searchParam = searchParams[i].replace(PLUS_RE, " ");
569
+ const eqPos = searchParam.indexOf("=");
570
+ const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
571
+ const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
572
+ if (key in query) {
573
+ let currentValue = query[key];
574
+ if (!isArray(currentValue)) currentValue = query[key] = [currentValue];
575
+ currentValue.push(value);
576
+ } else query[key] = value;
577
+ }
578
+ return query;
579
+ }
580
+ /**
581
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
582
+ * doesn't prepend a `?`
583
+ *
584
+ * @internal
585
+ *
586
+ * @param query - query object to stringify
587
+ * @returns string version of the query without the leading `?`
588
+ */
589
+ function stringifyQuery(query) {
590
+ let search = "";
591
+ for (let key in query) {
592
+ const value = query[key];
593
+ key = encodeQueryKey(key);
594
+ if (value == null) {
595
+ if (value !== void 0) search += (search.length ? "&" : "") + key;
596
+ continue;
597
+ }
598
+ (isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)]).forEach((value$1) => {
599
+ if (value$1 !== void 0) {
600
+ search += (search.length ? "&" : "") + key;
601
+ if (value$1 != null) search += "=" + value$1;
602
+ }
603
+ });
604
+ }
605
+ return search;
606
+ }
607
+ /**
608
+ * Transforms a {@link LocationQueryRaw} into a {@link LocationQuery} by casting
609
+ * numbers into strings, removing keys with an undefined value and replacing
610
+ * undefined with null in arrays
611
+ *
612
+ * @param query - query object to normalize
613
+ * @returns a normalized query object
614
+ */
615
+ function normalizeQuery(query) {
616
+ const normalizedQuery = {};
617
+ for (const key in query) {
618
+ const value = query[key];
619
+ if (value !== void 0) normalizedQuery[key] = isArray(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
620
+ }
621
+ return normalizedQuery;
622
+ }
623
+
624
+ //#endregion
625
+ //#region src/injectionSymbols.ts
626
+ /**
627
+ * RouteRecord being rendered by the closest ancestor Router View. Used for
628
+ * `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
629
+ * Location Matched
630
+ *
631
+ * @internal
632
+ */
633
+ const matchedRouteKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
634
+ /**
635
+ * Allows overriding the router view depth to control which component in
636
+ * `matched` is rendered. rvd stands for Router View Depth
637
+ *
638
+ * @internal
639
+ */
640
+ const viewDepthKey = Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
641
+ /**
642
+ * Allows overriding the router instance returned by `useRouter` in tests. r
643
+ * stands for router
644
+ *
645
+ * @internal
646
+ */
647
+ const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
648
+ /**
649
+ * Allows overriding the current route returned by `useRoute` in tests. rl
650
+ * stands for route location
651
+ *
652
+ * @internal
653
+ */
654
+ const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
655
+ /**
656
+ * Allows overriding the current route used by router-view. Internally this is
657
+ * used when the `route` prop is passed.
658
+ *
659
+ * @internal
660
+ */
661
+ const routerViewLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
662
+
663
+ //#endregion
664
+ //#region src/utils/callbacks.ts
665
+ /**
666
+ * Create a list of callbacks that can be reset. Used to create before and after navigation guards list
667
+ */
668
+ function useCallbacks() {
669
+ let handlers = [];
670
+ function add(handler) {
671
+ handlers.push(handler);
672
+ return () => {
673
+ const i = handlers.indexOf(handler);
674
+ if (i > -1) handlers.splice(i, 1);
675
+ };
676
+ }
677
+ function reset() {
678
+ handlers = [];
679
+ }
680
+ return {
681
+ add,
682
+ list: () => handlers.slice(),
683
+ reset
684
+ };
685
+ }
686
+
687
+ //#endregion
688
+ //#region src/navigationGuards.ts
689
+ function registerGuard(record, name, guard) {
690
+ const removeFromList = () => {
691
+ record[name].delete(guard);
692
+ };
693
+ onUnmounted(removeFromList);
694
+ onDeactivated(removeFromList);
695
+ onActivated(() => {
696
+ record[name].add(guard);
697
+ });
698
+ record[name].add(guard);
699
+ }
700
+ /**
701
+ * Add a navigation guard that triggers whenever the component for the current
702
+ * location is about to be left. Similar to {@link beforeRouteLeave} but can be
703
+ * used in any component. The guard is removed when the component is unmounted.
704
+ *
705
+ * @param leaveGuard - {@link NavigationGuard}
706
+ */
707
+ function onBeforeRouteLeave(leaveGuard) {
708
+ if (process.env.NODE_ENV !== "production" && !getCurrentInstance()) {
709
+ warn$1("getCurrentInstance() returned null. onBeforeRouteLeave() must be called at the top of a setup function");
710
+ return;
711
+ }
712
+ const activeRecord = inject(matchedRouteKey, {}).value;
713
+ if (!activeRecord) {
714
+ process.env.NODE_ENV !== "production" && warn$1("No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?");
715
+ return;
716
+ }
717
+ registerGuard(activeRecord, "leaveGuards", leaveGuard);
718
+ }
719
+ /**
720
+ * Add a navigation guard that triggers whenever the current location is about
721
+ * to be updated. Similar to {@link beforeRouteUpdate} but can be used in any
722
+ * component. The guard is removed when the component is unmounted.
723
+ *
724
+ * @param updateGuard - {@link NavigationGuard}
725
+ */
726
+ function onBeforeRouteUpdate(updateGuard) {
727
+ if (process.env.NODE_ENV !== "production" && !getCurrentInstance()) {
728
+ warn$1("getCurrentInstance() returned null. onBeforeRouteUpdate() must be called at the top of a setup function");
729
+ return;
730
+ }
731
+ const activeRecord = inject(matchedRouteKey, {}).value;
732
+ if (!activeRecord) {
733
+ process.env.NODE_ENV !== "production" && warn$1("No active route record was found when calling `onBeforeRouteUpdate()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?");
734
+ return;
735
+ }
736
+ registerGuard(activeRecord, "updateGuards", updateGuard);
737
+ }
738
+ function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
739
+ const enterCallbackArray = record && (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
740
+ return () => new Promise((resolve, reject) => {
741
+ const next = (valid) => {
742
+ if (valid === false) reject(createRouterError(ErrorTypes.NAVIGATION_ABORTED, {
743
+ from,
744
+ to
745
+ }));
746
+ else if (valid instanceof Error) reject(valid);
747
+ else if (isRouteLocation(valid)) reject(createRouterError(ErrorTypes.NAVIGATION_GUARD_REDIRECT, {
748
+ from: to,
749
+ to: valid
750
+ }));
751
+ else {
752
+ if (enterCallbackArray && record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") enterCallbackArray.push(valid);
753
+ resolve();
754
+ }
755
+ };
756
+ const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, process.env.NODE_ENV !== "production" ? canOnlyBeCalledOnce(next, to, from) : next));
757
+ let guardCall = Promise.resolve(guardReturn);
758
+ if (guard.length < 3) guardCall = guardCall.then(next);
759
+ if (process.env.NODE_ENV !== "production" && guard.length > 2) {
760
+ const message = `The "next" callback was never called inside of ${guard.name ? "\"" + guard.name + "\"" : ""}:\n${guard.toString()}\n. If you are returning a value instead of calling "next", make sure to remove the "next" parameter from your function.`;
761
+ if (typeof guardReturn === "object" && "then" in guardReturn) guardCall = guardCall.then((resolvedValue) => {
762
+ if (!next._called) {
763
+ warn$1(message);
764
+ return Promise.reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
765
+ }
766
+ return resolvedValue;
767
+ });
768
+ else if (guardReturn !== void 0) {
769
+ if (!next._called) {
770
+ warn$1(message);
771
+ reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
772
+ return;
773
+ }
774
+ }
775
+ }
776
+ guardCall.catch((err) => reject(err));
777
+ });
778
+ }
779
+ function canOnlyBeCalledOnce(next, to, from) {
780
+ let called = 0;
781
+ return function() {
782
+ 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.`);
783
+ next._called = true;
784
+ if (called === 1) next.apply(null, arguments);
785
+ };
786
+ }
787
+ function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
788
+ const guards = [];
789
+ for (const record of matched) {
790
+ 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.`);
791
+ for (const name in record.components) {
792
+ let rawComponent = record.components[name];
793
+ if (process.env.NODE_ENV !== "production") {
794
+ if (!rawComponent || typeof rawComponent !== "object" && typeof rawComponent !== "function") {
795
+ warn$1(`Component "${name}" in record with path "${record.path}" is not a valid component. Received "${String(rawComponent)}".`);
796
+ throw new Error("Invalid route component");
797
+ } else if ("then" in rawComponent) {
798
+ 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.`);
799
+ const promise = rawComponent;
800
+ rawComponent = () => promise;
801
+ } else if (rawComponent.__asyncLoader && !rawComponent.__warnedDefineAsync) {
802
+ rawComponent.__warnedDefineAsync = true;
803
+ warn$1(`Component "${name}" in record with path "${record.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`);
804
+ }
805
+ }
806
+ if (guardType !== "beforeRouteEnter" && !record.instances[name]) continue;
807
+ if (isRouteComponent(rawComponent)) {
808
+ const guard = (rawComponent.__vccOpts || rawComponent)[guardType];
809
+ guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
810
+ } else {
811
+ let componentPromise = rawComponent();
812
+ if (process.env.NODE_ENV !== "production" && !("catch" in componentPromise)) {
813
+ 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.`);
814
+ componentPromise = Promise.resolve(componentPromise);
815
+ }
816
+ guards.push(() => componentPromise.then((resolved) => {
817
+ if (!resolved) throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
818
+ const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
819
+ record.mods[name] = resolved;
820
+ record.components[name] = resolvedComponent;
821
+ const guard = (resolvedComponent.__vccOpts || resolvedComponent)[guardType];
822
+ return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
823
+ }));
824
+ }
825
+ }
826
+ }
827
+ return guards;
828
+ }
829
+ /**
830
+ * Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
831
+ *
832
+ * @param route - resolved route to load
833
+ */
834
+ function loadRouteLocation(route) {
835
+ return route.matched.every((record) => record.redirect) ? Promise.reject(/* @__PURE__ */ new Error("Cannot load a route that redirects.")) : Promise.all(route.matched.map((record) => record.components && Promise.all(Object.keys(record.components).reduce((promises, name) => {
836
+ const rawComponent = record.components[name];
837
+ if (typeof rawComponent === "function" && !("displayName" in rawComponent)) promises.push(rawComponent().then((resolved) => {
838
+ if (!resolved) return Promise.reject(/* @__PURE__ */ new Error(`Couldn't resolve component "${name}" at "${record.path}". Ensure you passed a function that returns a promise.`));
839
+ const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
840
+ record.mods[name] = resolved;
841
+ record.components[name] = resolvedComponent;
842
+ }));
843
+ return promises;
844
+ }, [])))).then(() => route);
845
+ }
846
+ /**
847
+ * Split the leaving, updating, and entering records.
848
+ * @internal
849
+ *
850
+ * @param to - Location we are navigating to
851
+ * @param from - Location we are navigating from
852
+ */
853
+ function extractChangingRecords(to, from) {
854
+ const leavingRecords = [];
855
+ const updatingRecords = [];
856
+ const enteringRecords = [];
857
+ const len = Math.max(from.matched.length, to.matched.length);
858
+ for (let i = 0; i < len; i++) {
859
+ const recordFrom = from.matched[i];
860
+ if (recordFrom) if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) updatingRecords.push(recordFrom);
861
+ else leavingRecords.push(recordFrom);
862
+ const recordTo = to.matched[i];
863
+ if (recordTo) {
864
+ if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) enteringRecords.push(recordTo);
865
+ }
866
+ }
867
+ return [
868
+ leavingRecords,
869
+ updatingRecords,
870
+ enteringRecords
871
+ ];
872
+ }
873
+
874
+ //#endregion
875
+ //#region src/devtools.ts
876
+ /**
877
+ * Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).
878
+ *
879
+ * @param routeLocation - routeLocation to format
880
+ * @param tooltip - optional tooltip
881
+ * @returns a copy of the routeLocation
882
+ */
883
+ function formatRouteLocation(routeLocation, tooltip) {
884
+ const copy = assign({}, routeLocation, { matched: routeLocation.matched.map((matched) => omit(matched, [
885
+ "instances",
886
+ "children",
887
+ "aliasOf"
888
+ ])) });
889
+ return { _custom: {
890
+ type: null,
891
+ readOnly: true,
892
+ display: routeLocation.fullPath,
893
+ tooltip,
894
+ value: copy
895
+ } };
896
+ }
897
+ function formatDisplay(display) {
898
+ return { _custom: { display } };
899
+ }
900
+ let routerId = 0;
901
+ function addDevtools(app, router, matcher) {
902
+ if (router.__hasDevtools) return;
903
+ router.__hasDevtools = true;
904
+ const id = routerId++;
905
+ setupDevtoolsPlugin({
906
+ id: "org.vuejs.router" + (id ? "." + id : ""),
907
+ label: "Vue Router",
908
+ packageName: "vue-router",
909
+ homepage: "https://router.vuejs.org",
910
+ logo: "https://router.vuejs.org/logo.png",
911
+ componentStateTypes: ["Routing"],
912
+ app
913
+ }, (api) => {
914
+ 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.");
915
+ api.on.inspectComponent((payload, ctx) => {
916
+ if (payload.instanceData) payload.instanceData.state.push({
917
+ type: "Routing",
918
+ key: "$route",
919
+ editable: false,
920
+ value: formatRouteLocation(router.currentRoute.value, "Current Route")
921
+ });
922
+ });
923
+ api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {
924
+ if (componentInstance.__vrv_devtools) {
925
+ const info = componentInstance.__vrv_devtools;
926
+ node.tags.push({
927
+ label: (info.name ? `${info.name.toString()}: ` : "") + info.path,
928
+ textColor: 0,
929
+ tooltip: "This component is rendered by &lt;router-view&gt;",
930
+ backgroundColor: PINK_500
931
+ });
932
+ }
933
+ if (isArray(componentInstance.__vrl_devtools)) {
934
+ componentInstance.__devtoolsApi = api;
935
+ componentInstance.__vrl_devtools.forEach((devtoolsData) => {
936
+ let label = devtoolsData.route.path;
937
+ let backgroundColor = ORANGE_400;
938
+ let tooltip = "";
939
+ let textColor = 0;
940
+ if (devtoolsData.error) {
941
+ label = devtoolsData.error;
942
+ backgroundColor = RED_100;
943
+ textColor = RED_700;
944
+ } else if (devtoolsData.isExactActive) {
945
+ backgroundColor = LIME_500;
946
+ tooltip = "This is exactly active";
947
+ } else if (devtoolsData.isActive) {
948
+ backgroundColor = BLUE_600;
949
+ tooltip = "This link is active";
950
+ }
951
+ node.tags.push({
952
+ label,
953
+ textColor,
954
+ tooltip,
955
+ backgroundColor
956
+ });
957
+ });
958
+ }
959
+ });
960
+ watch(router.currentRoute, () => {
961
+ refreshRoutesView();
962
+ api.notifyComponentUpdate();
963
+ api.sendInspectorTree(routerInspectorId);
964
+ api.sendInspectorState(routerInspectorId);
965
+ });
966
+ const navigationsLayerId = "router:navigations:" + id;
967
+ api.addTimelineLayer({
968
+ id: navigationsLayerId,
969
+ label: `Router${id ? " " + id : ""} Navigations`,
970
+ color: 4237508
971
+ });
972
+ router.onError((error, to) => {
973
+ api.addTimelineEvent({
974
+ layerId: navigationsLayerId,
975
+ event: {
976
+ title: "Error during Navigation",
977
+ subtitle: to.fullPath,
978
+ logType: "error",
979
+ time: api.now(),
980
+ data: { error },
981
+ groupId: to.meta.__navigationId
982
+ }
983
+ });
984
+ });
985
+ let navigationId = 0;
986
+ router.beforeEach((to, from) => {
987
+ const data = {
988
+ guard: formatDisplay("beforeEach"),
989
+ from: formatRouteLocation(from, "Current Location during this navigation"),
990
+ to: formatRouteLocation(to, "Target location")
991
+ };
992
+ Object.defineProperty(to.meta, "__navigationId", { value: navigationId++ });
993
+ api.addTimelineEvent({
994
+ layerId: navigationsLayerId,
995
+ event: {
996
+ time: api.now(),
997
+ title: "Start of navigation",
998
+ subtitle: to.fullPath,
999
+ data,
1000
+ groupId: to.meta.__navigationId
1001
+ }
1002
+ });
1003
+ });
1004
+ router.afterEach((to, from, failure) => {
1005
+ const data = { guard: formatDisplay("afterEach") };
1006
+ if (failure) {
1007
+ data.failure = { _custom: {
1008
+ type: Error,
1009
+ readOnly: true,
1010
+ display: failure ? failure.message : "",
1011
+ tooltip: "Navigation Failure",
1012
+ value: failure
1013
+ } };
1014
+ data.status = formatDisplay("❌");
1015
+ } else data.status = formatDisplay("✅");
1016
+ data.from = formatRouteLocation(from, "Current Location during this navigation");
1017
+ data.to = formatRouteLocation(to, "Target location");
1018
+ api.addTimelineEvent({
1019
+ layerId: navigationsLayerId,
1020
+ event: {
1021
+ title: "End of navigation",
1022
+ subtitle: to.fullPath,
1023
+ time: api.now(),
1024
+ data,
1025
+ logType: failure ? "warning" : "default",
1026
+ groupId: to.meta.__navigationId
1027
+ }
1028
+ });
1029
+ });
1030
+ /**
1031
+ * Inspector of Existing routes
1032
+ */
1033
+ const routerInspectorId = "router-inspector:" + id;
1034
+ api.addInspector({
1035
+ id: routerInspectorId,
1036
+ label: "Routes" + (id ? " " + id : ""),
1037
+ icon: "book",
1038
+ treeFilterPlaceholder: "Search routes"
1039
+ });
1040
+ function refreshRoutesView() {
1041
+ if (!activeRoutesPayload) return;
1042
+ const payload = activeRoutesPayload;
1043
+ let routes = matcher.getRoutes().filter((route) => !route.parent || !route.parent.record.components);
1044
+ routes.forEach(resetMatchStateOnRouteRecord);
1045
+ if (payload.filter) routes = routes.filter((route) => isRouteMatching(route, payload.filter.toLowerCase()));
1046
+ routes.forEach((route) => markRouteRecordActive(route, router.currentRoute.value));
1047
+ payload.rootNodes = routes.map(formatRouteRecordForInspector);
1048
+ }
1049
+ let activeRoutesPayload;
1050
+ api.on.getInspectorTree((payload) => {
1051
+ activeRoutesPayload = payload;
1052
+ if (payload.app === app && payload.inspectorId === routerInspectorId) refreshRoutesView();
1053
+ });
1054
+ /**
1055
+ * Display information about the currently selected route record
1056
+ */
1057
+ api.on.getInspectorState((payload) => {
1058
+ if (payload.app === app && payload.inspectorId === routerInspectorId) {
1059
+ const route = matcher.getRoutes().find((route$1) => route$1.record.__vd_id === payload.nodeId);
1060
+ if (route) payload.state = { options: formatRouteRecordMatcherForStateInspector(route) };
1061
+ }
1062
+ });
1063
+ api.sendInspectorTree(routerInspectorId);
1064
+ api.sendInspectorState(routerInspectorId);
1065
+ });
1066
+ }
1067
+ function modifierForKey(key) {
1068
+ if (key.optional) return key.repeatable ? "*" : "?";
1069
+ else return key.repeatable ? "+" : "";
1070
+ }
1071
+ function formatRouteRecordMatcherForStateInspector(route) {
1072
+ const { record } = route;
1073
+ const fields = [{
1074
+ editable: false,
1075
+ key: "path",
1076
+ value: record.path
1077
+ }];
1078
+ if (record.name != null) fields.push({
1079
+ editable: false,
1080
+ key: "name",
1081
+ value: record.name
1082
+ });
1083
+ fields.push({
1084
+ editable: false,
1085
+ key: "regexp",
1086
+ value: route.re
1087
+ });
1088
+ if (route.keys.length) fields.push({
1089
+ editable: false,
1090
+ key: "keys",
1091
+ value: { _custom: {
1092
+ type: null,
1093
+ readOnly: true,
1094
+ display: route.keys.map((key) => `${key.name}${modifierForKey(key)}`).join(" "),
1095
+ tooltip: "Param keys",
1096
+ value: route.keys
1097
+ } }
1098
+ });
1099
+ if (record.redirect != null) fields.push({
1100
+ editable: false,
1101
+ key: "redirect",
1102
+ value: record.redirect
1103
+ });
1104
+ if (route.alias.length) fields.push({
1105
+ editable: false,
1106
+ key: "aliases",
1107
+ value: route.alias.map((alias) => alias.record.path)
1108
+ });
1109
+ if (Object.keys(route.record.meta).length) fields.push({
1110
+ editable: false,
1111
+ key: "meta",
1112
+ value: route.record.meta
1113
+ });
1114
+ fields.push({
1115
+ key: "score",
1116
+ editable: false,
1117
+ value: { _custom: {
1118
+ type: null,
1119
+ readOnly: true,
1120
+ display: route.score.map((score) => score.join(", ")).join(" | "),
1121
+ tooltip: "Score used to sort routes",
1122
+ value: route.score
1123
+ } }
1124
+ });
1125
+ return fields;
1126
+ }
1127
+ /**
1128
+ * Extracted from tailwind palette
1129
+ */
1130
+ const PINK_500 = 15485081;
1131
+ const BLUE_600 = 2450411;
1132
+ const LIME_500 = 8702998;
1133
+ const CYAN_400 = 2282478;
1134
+ const ORANGE_400 = 16486972;
1135
+ const DARK = 6710886;
1136
+ const RED_100 = 16704226;
1137
+ const RED_700 = 12131356;
1138
+ function formatRouteRecordForInspector(route) {
1139
+ const tags = [];
1140
+ const { record } = route;
1141
+ if (record.name != null) tags.push({
1142
+ label: String(record.name),
1143
+ textColor: 0,
1144
+ backgroundColor: CYAN_400
1145
+ });
1146
+ if (record.aliasOf) tags.push({
1147
+ label: "alias",
1148
+ textColor: 0,
1149
+ backgroundColor: ORANGE_400
1150
+ });
1151
+ if (route.__vd_match) tags.push({
1152
+ label: "matches",
1153
+ textColor: 0,
1154
+ backgroundColor: PINK_500
1155
+ });
1156
+ if (route.__vd_exactActive) tags.push({
1157
+ label: "exact",
1158
+ textColor: 0,
1159
+ backgroundColor: LIME_500
1160
+ });
1161
+ if (route.__vd_active) tags.push({
1162
+ label: "active",
1163
+ textColor: 0,
1164
+ backgroundColor: BLUE_600
1165
+ });
1166
+ if (record.redirect) tags.push({
1167
+ label: typeof record.redirect === "string" ? `redirect: ${record.redirect}` : "redirects",
1168
+ textColor: 16777215,
1169
+ backgroundColor: DARK
1170
+ });
1171
+ let id = record.__vd_id;
1172
+ if (id == null) {
1173
+ id = String(routeRecordId++);
1174
+ record.__vd_id = id;
1175
+ }
1176
+ return {
1177
+ id,
1178
+ label: record.path,
1179
+ tags,
1180
+ children: route.children.map(formatRouteRecordForInspector)
1181
+ };
1182
+ }
1183
+ let routeRecordId = 0;
1184
+ const EXTRACT_REGEXP_RE = /^\/(.*)\/([a-z]*)$/;
1185
+ function markRouteRecordActive(route, currentRoute) {
1186
+ const isExactActive = currentRoute.matched.length && isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);
1187
+ route.__vd_exactActive = route.__vd_active = isExactActive;
1188
+ if (!isExactActive) route.__vd_active = currentRoute.matched.some((match) => isSameRouteRecord(match, route.record));
1189
+ route.children.forEach((childRoute) => markRouteRecordActive(childRoute, currentRoute));
1190
+ }
1191
+ function resetMatchStateOnRouteRecord(route) {
1192
+ route.__vd_match = false;
1193
+ route.children.forEach(resetMatchStateOnRouteRecord);
1194
+ }
1195
+ function isRouteMatching(route, filter) {
1196
+ const found = String(route.re).match(EXTRACT_REGEXP_RE);
1197
+ route.__vd_match = false;
1198
+ if (!found || found.length < 3) return false;
1199
+ if (new RegExp(found[1].replace(/\$$/, ""), found[2]).test(filter)) {
1200
+ route.children.forEach((child) => isRouteMatching(child, filter));
1201
+ if (route.record.path !== "/" || filter === "/") {
1202
+ route.__vd_match = route.re.test(filter);
1203
+ return true;
1204
+ }
1205
+ return false;
1206
+ }
1207
+ const path = route.record.path.toLowerCase();
1208
+ const decodedPath = decode(path);
1209
+ if (!filter.startsWith("/") && (decodedPath.includes(filter) || path.includes(filter))) return true;
1210
+ if (decodedPath.startsWith(filter) || path.startsWith(filter)) return true;
1211
+ if (route.record.name && String(route.record.name).includes(filter)) return true;
1212
+ return route.children.some((child) => isRouteMatching(child, filter));
1213
+ }
1214
+ function omit(obj, keys) {
1215
+ const ret = {};
1216
+ for (const key in obj) if (!keys.includes(key)) ret[key] = obj[key];
1217
+ return ret;
1218
+ }
1219
+
1220
+ /*!
1221
+ * vue-router v4.6.4
1222
+ * (c) 2025 Eduardo San Martin Morote
1223
+ * @license MIT
1224
+ */
1225
+
1226
+ //#region src/history/html5.ts
1227
+ let createBaseLocation = () => location.protocol + "//" + location.host;
1228
+ /**
1229
+ * Creates a normalized history location from a window.location object
1230
+ * @param base - The base path
1231
+ * @param location - The window.location object
1232
+ */
1233
+ function createCurrentLocation(base, location$1) {
1234
+ const { pathname, search, hash } = location$1;
1235
+ const hashPos = base.indexOf("#");
1236
+ if (hashPos > -1) {
1237
+ let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
1238
+ let pathFromHash = hash.slice(slicePos);
1239
+ if (pathFromHash[0] !== "/") pathFromHash = "/" + pathFromHash;
1240
+ return stripBase(pathFromHash, "");
1241
+ }
1242
+ return stripBase(pathname, base) + search + hash;
1243
+ }
1244
+ function useHistoryListeners(base, historyState, currentLocation, replace) {
1245
+ let listeners = [];
1246
+ let teardowns = [];
1247
+ let pauseState = null;
1248
+ const popStateHandler = ({ state }) => {
1249
+ const to = createCurrentLocation(base, location);
1250
+ const from = currentLocation.value;
1251
+ const fromState = historyState.value;
1252
+ let delta = 0;
1253
+ if (state) {
1254
+ currentLocation.value = to;
1255
+ historyState.value = state;
1256
+ if (pauseState && pauseState === from) {
1257
+ pauseState = null;
1258
+ return;
1259
+ }
1260
+ delta = fromState ? state.position - fromState.position : 0;
1261
+ } else replace(to);
1262
+ listeners.forEach((listener) => {
1263
+ listener(currentLocation.value, from, {
1264
+ delta,
1265
+ type: NavigationType.pop,
1266
+ direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown
1267
+ });
1268
+ });
1269
+ };
1270
+ function pauseListeners() {
1271
+ pauseState = currentLocation.value;
1272
+ }
1273
+ function listen(callback) {
1274
+ listeners.push(callback);
1275
+ const teardown = () => {
1276
+ const index = listeners.indexOf(callback);
1277
+ if (index > -1) listeners.splice(index, 1);
1278
+ };
1279
+ teardowns.push(teardown);
1280
+ return teardown;
1281
+ }
1282
+ function beforeUnloadListener() {
1283
+ if (document.visibilityState === "hidden") {
1284
+ const { history: history$1 } = window;
1285
+ if (!history$1.state) return;
1286
+ history$1.replaceState(assign({}, history$1.state, { scroll: computeScrollPosition() }), "");
1287
+ }
1288
+ }
1289
+ function destroy() {
1290
+ for (const teardown of teardowns) teardown();
1291
+ teardowns = [];
1292
+ window.removeEventListener("popstate", popStateHandler);
1293
+ window.removeEventListener("pagehide", beforeUnloadListener);
1294
+ document.removeEventListener("visibilitychange", beforeUnloadListener);
1295
+ }
1296
+ window.addEventListener("popstate", popStateHandler);
1297
+ window.addEventListener("pagehide", beforeUnloadListener);
1298
+ document.addEventListener("visibilitychange", beforeUnloadListener);
1299
+ return {
1300
+ pauseListeners,
1301
+ listen,
1302
+ destroy
1303
+ };
1304
+ }
1305
+ /**
1306
+ * Creates a state object
1307
+ */
1308
+ function buildState(back, current, forward, replaced = false, computeScroll = false) {
1309
+ return {
1310
+ back,
1311
+ current,
1312
+ forward,
1313
+ replaced,
1314
+ position: window.history.length,
1315
+ scroll: computeScroll ? computeScrollPosition() : null
1316
+ };
1317
+ }
1318
+ function useHistoryStateNavigation(base) {
1319
+ const { history: history$1, location: location$1 } = window;
1320
+ const currentLocation = { value: createCurrentLocation(base, location$1) };
1321
+ const historyState = { value: history$1.state };
1322
+ if (!historyState.value) changeLocation(currentLocation.value, {
1323
+ back: null,
1324
+ current: currentLocation.value,
1325
+ forward: null,
1326
+ position: history$1.length - 1,
1327
+ replaced: true,
1328
+ scroll: null
1329
+ }, true);
1330
+ function changeLocation(to, state, replace$1) {
1331
+ /**
1332
+ * if a base tag is provided, and we are on a normal domain, we have to
1333
+ * respect the provided `base` attribute because pushState() will use it and
1334
+ * potentially erase anything before the `#` like at
1335
+ * https://github.com/vuejs/router/issues/685 where a base of
1336
+ * `/folder/#` but a base of `/` would erase the `/folder/` section. If
1337
+ * there is no host, the `<base>` tag makes no sense and if there isn't a
1338
+ * base tag we can just use everything after the `#`.
1339
+ */
1340
+ const hashIndex = base.indexOf("#");
1341
+ const url = hashIndex > -1 ? (location$1.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to;
1342
+ try {
1343
+ history$1[replace$1 ? "replaceState" : "pushState"](state, "", url);
1344
+ historyState.value = state;
1345
+ } catch (err) {
1346
+ if (process.env.NODE_ENV !== "production") warn$1("Error with push/replace State", err);
1347
+ else console.error(err);
1348
+ location$1[replace$1 ? "replace" : "assign"](url);
1349
+ }
1350
+ }
1351
+ function replace(to, data) {
1352
+ changeLocation(to, assign({}, history$1.state, buildState(historyState.value.back, to, historyState.value.forward, true), data, { position: historyState.value.position }), true);
1353
+ currentLocation.value = to;
1354
+ }
1355
+ function push(to, data) {
1356
+ const currentState = assign({}, historyState.value, history$1.state, {
1357
+ forward: to,
1358
+ scroll: computeScrollPosition()
1359
+ });
1360
+ 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");
1361
+ changeLocation(currentState.current, currentState, true);
1362
+ changeLocation(to, assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data), false);
1363
+ currentLocation.value = to;
1364
+ }
1365
+ return {
1366
+ location: currentLocation,
1367
+ state: historyState,
1368
+ push,
1369
+ replace
1370
+ };
1371
+ }
1372
+ /**
1373
+ * Creates an HTML5 history. Most common history for single page applications.
1374
+ *
1375
+ * @param base -
1376
+ */
1377
+ function createWebHistory(base) {
1378
+ base = normalizeBase(base);
1379
+ const historyNavigation = useHistoryStateNavigation(base);
1380
+ const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
1381
+ function go(delta, triggerListeners = true) {
1382
+ if (!triggerListeners) historyListeners.pauseListeners();
1383
+ history.go(delta);
1384
+ }
1385
+ const routerHistory = assign({
1386
+ location: "",
1387
+ base,
1388
+ go,
1389
+ createHref: createHref.bind(null, base)
1390
+ }, historyNavigation, historyListeners);
1391
+ Object.defineProperty(routerHistory, "location", {
1392
+ enumerable: true,
1393
+ get: () => historyNavigation.location.value
1394
+ });
1395
+ Object.defineProperty(routerHistory, "state", {
1396
+ enumerable: true,
1397
+ get: () => historyNavigation.state.value
1398
+ });
1399
+ return routerHistory;
1400
+ }
1401
+
1402
+ //#endregion
1403
+ //#region src/history/memory.ts
1404
+ /**
1405
+ * Creates an in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.
1406
+ * It's up to the user to replace that location with the starter location by either calling `router.push` or `router.replace`.
1407
+ *
1408
+ * @param base - Base applied to all urls, defaults to '/'
1409
+ * @returns a history object that can be passed to the router constructor
1410
+ */
1411
+ function createMemoryHistory(base = "") {
1412
+ let listeners = [];
1413
+ let queue = [[START, {}]];
1414
+ let position = 0;
1415
+ base = normalizeBase(base);
1416
+ function setLocation(location$1, state = {}) {
1417
+ position++;
1418
+ if (position !== queue.length) queue.splice(position);
1419
+ queue.push([location$1, state]);
1420
+ }
1421
+ function triggerListeners(to, from, { direction, delta }) {
1422
+ const info = {
1423
+ direction,
1424
+ delta,
1425
+ type: NavigationType.pop
1426
+ };
1427
+ for (const callback of listeners) callback(to, from, info);
1428
+ }
1429
+ const routerHistory = {
1430
+ location: START,
1431
+ state: {},
1432
+ base,
1433
+ createHref: createHref.bind(null, base),
1434
+ replace(to, state) {
1435
+ queue.splice(position--, 1);
1436
+ setLocation(to, state);
1437
+ },
1438
+ push(to, state) {
1439
+ setLocation(to, state);
1440
+ },
1441
+ listen(callback) {
1442
+ listeners.push(callback);
1443
+ return () => {
1444
+ const index = listeners.indexOf(callback);
1445
+ if (index > -1) listeners.splice(index, 1);
1446
+ };
1447
+ },
1448
+ destroy() {
1449
+ listeners = [];
1450
+ queue = [[START, {}]];
1451
+ position = 0;
1452
+ },
1453
+ go(delta, shouldTrigger = true) {
1454
+ const from = this.location;
1455
+ const direction = delta < 0 ? NavigationDirection.back : NavigationDirection.forward;
1456
+ position = Math.max(0, Math.min(position + delta, queue.length - 1));
1457
+ if (shouldTrigger) triggerListeners(this.location, from, {
1458
+ direction,
1459
+ delta
1460
+ });
1461
+ }
1462
+ };
1463
+ Object.defineProperty(routerHistory, "location", {
1464
+ enumerable: true,
1465
+ get: () => queue[position][0]
1466
+ });
1467
+ Object.defineProperty(routerHistory, "state", {
1468
+ enumerable: true,
1469
+ get: () => queue[position][1]
1470
+ });
1471
+ return routerHistory;
1472
+ }
1473
+
1474
+ //#endregion
1475
+ //#region src/history/hash.ts
1476
+ /**
1477
+ * Creates a hash history. Useful for web applications with no host (e.g. `file://`) or when configuring a server to
1478
+ * handle any URL is not possible.
1479
+ *
1480
+ * @param base - optional base to provide. Defaults to `location.pathname + location.search` If there is a `<base>` tag
1481
+ * in the `head`, its value will be ignored in favor of this parameter **but note it affects all the history.pushState()
1482
+ * calls**, meaning that if you use a `<base>` tag, it's `href` value **has to match this parameter** (ignoring anything
1483
+ * after the `#`).
1484
+ *
1485
+ * @example
1486
+ * ```js
1487
+ * // at https://example.com/folder
1488
+ * createWebHashHistory() // gives a url of `https://example.com/folder#`
1489
+ * createWebHashHistory('/folder/') // gives a url of `https://example.com/folder/#`
1490
+ * // if the `#` is provided in the base, it won't be added by `createWebHashHistory`
1491
+ * createWebHashHistory('/folder/#/app/') // gives a url of `https://example.com/folder/#/app/`
1492
+ * // you should avoid doing this because it changes the original url and breaks copying urls
1493
+ * createWebHashHistory('/other-folder/') // gives a url of `https://example.com/other-folder/#`
1494
+ *
1495
+ * // at file:///usr/etc/folder/index.html
1496
+ * // for locations with no `host`, the base is ignored
1497
+ * createWebHashHistory('/iAmIgnored') // gives a url of `file:///usr/etc/folder/index.html#`
1498
+ * ```
1499
+ */
1500
+ function createWebHashHistory(base) {
1501
+ base = location.host ? base || location.pathname + location.search : "";
1502
+ if (!base.includes("#")) base += "#";
1503
+ if (process.env.NODE_ENV !== "production" && !base.endsWith("#/") && !base.endsWith("#")) warn$1(`A hash base must end with a "#":\n"${base}" should be "${base.replace(/#.*$/, "#")}".`);
1504
+ return createWebHistory(base);
1505
+ }
1506
+
1507
+ //#endregion
1508
+ //#region src/matcher/pathTokenizer.ts
1509
+ let TokenType = /* @__PURE__ */ function(TokenType$1) {
1510
+ TokenType$1[TokenType$1["Static"] = 0] = "Static";
1511
+ TokenType$1[TokenType$1["Param"] = 1] = "Param";
1512
+ TokenType$1[TokenType$1["Group"] = 2] = "Group";
1513
+ return TokenType$1;
1514
+ }({});
1515
+ var TokenizerState = /* @__PURE__ */ function(TokenizerState$1) {
1516
+ TokenizerState$1[TokenizerState$1["Static"] = 0] = "Static";
1517
+ TokenizerState$1[TokenizerState$1["Param"] = 1] = "Param";
1518
+ TokenizerState$1[TokenizerState$1["ParamRegExp"] = 2] = "ParamRegExp";
1519
+ TokenizerState$1[TokenizerState$1["ParamRegExpEnd"] = 3] = "ParamRegExpEnd";
1520
+ TokenizerState$1[TokenizerState$1["EscapeNext"] = 4] = "EscapeNext";
1521
+ return TokenizerState$1;
1522
+ }(TokenizerState || {});
1523
+ const ROOT_TOKEN = {
1524
+ type: TokenType.Static,
1525
+ value: ""
1526
+ };
1527
+ const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
1528
+ function tokenizePath(path) {
1529
+ if (!path) return [[]];
1530
+ if (path === "/") return [[ROOT_TOKEN]];
1531
+ if (!path.startsWith("/")) throw new Error(process.env.NODE_ENV !== "production" ? `Route paths should start with a "/": "${path}" should be "/${path}".` : `Invalid path "${path}"`);
1532
+ function crash(message) {
1533
+ throw new Error(`ERR (${state})/"${buffer}": ${message}`);
1534
+ }
1535
+ let state = TokenizerState.Static;
1536
+ let previousState = state;
1537
+ const tokens = [];
1538
+ let segment;
1539
+ function finalizeSegment() {
1540
+ if (segment) tokens.push(segment);
1541
+ segment = [];
1542
+ }
1543
+ let i = 0;
1544
+ let char;
1545
+ let buffer = "";
1546
+ let customRe = "";
1547
+ function consumeBuffer() {
1548
+ if (!buffer) return;
1549
+ if (state === TokenizerState.Static) segment.push({
1550
+ type: TokenType.Static,
1551
+ value: buffer
1552
+ });
1553
+ else if (state === TokenizerState.Param || state === TokenizerState.ParamRegExp || state === TokenizerState.ParamRegExpEnd) {
1554
+ if (segment.length > 1 && (char === "*" || char === "+")) crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
1555
+ segment.push({
1556
+ type: TokenType.Param,
1557
+ value: buffer,
1558
+ regexp: customRe,
1559
+ repeatable: char === "*" || char === "+",
1560
+ optional: char === "*" || char === "?"
1561
+ });
1562
+ } else crash("Invalid state to consume buffer");
1563
+ buffer = "";
1564
+ }
1565
+ function addCharToBuffer() {
1566
+ buffer += char;
1567
+ }
1568
+ while (i < path.length) {
1569
+ char = path[i++];
1570
+ if (char === "\\" && state !== TokenizerState.ParamRegExp) {
1571
+ previousState = state;
1572
+ state = TokenizerState.EscapeNext;
1573
+ continue;
1574
+ }
1575
+ switch (state) {
1576
+ case TokenizerState.Static:
1577
+ if (char === "/") {
1578
+ if (buffer) consumeBuffer();
1579
+ finalizeSegment();
1580
+ } else if (char === ":") {
1581
+ consumeBuffer();
1582
+ state = TokenizerState.Param;
1583
+ } else addCharToBuffer();
1584
+ break;
1585
+ case TokenizerState.EscapeNext:
1586
+ addCharToBuffer();
1587
+ state = previousState;
1588
+ break;
1589
+ case TokenizerState.Param:
1590
+ if (char === "(") state = TokenizerState.ParamRegExp;
1591
+ else if (VALID_PARAM_RE.test(char)) addCharToBuffer();
1592
+ else {
1593
+ consumeBuffer();
1594
+ state = TokenizerState.Static;
1595
+ if (char !== "*" && char !== "?" && char !== "+") i--;
1596
+ }
1597
+ break;
1598
+ case TokenizerState.ParamRegExp:
1599
+ if (char === ")") if (customRe[customRe.length - 1] == "\\") customRe = customRe.slice(0, -1) + char;
1600
+ else state = TokenizerState.ParamRegExpEnd;
1601
+ else customRe += char;
1602
+ break;
1603
+ case TokenizerState.ParamRegExpEnd:
1604
+ consumeBuffer();
1605
+ state = TokenizerState.Static;
1606
+ if (char !== "*" && char !== "?" && char !== "+") i--;
1607
+ customRe = "";
1608
+ break;
1609
+ default:
1610
+ crash("Unknown state");
1611
+ break;
1612
+ }
1613
+ }
1614
+ if (state === TokenizerState.ParamRegExp) crash(`Unfinished custom RegExp for param "${buffer}"`);
1615
+ consumeBuffer();
1616
+ finalizeSegment();
1617
+ return tokens;
1618
+ }
1619
+
1620
+ //#endregion
1621
+ //#region src/matcher/pathParserRanker.ts
1622
+ const BASE_PARAM_PATTERN = "[^/]+?";
1623
+ const BASE_PATH_PARSER_OPTIONS = {
1624
+ sensitive: false,
1625
+ strict: false,
1626
+ start: true,
1627
+ end: true
1628
+ };
1629
+ var PathScore = /* @__PURE__ */ function(PathScore$1) {
1630
+ PathScore$1[PathScore$1["_multiplier"] = 10] = "_multiplier";
1631
+ PathScore$1[PathScore$1["Root"] = 90] = "Root";
1632
+ PathScore$1[PathScore$1["Segment"] = 40] = "Segment";
1633
+ PathScore$1[PathScore$1["SubSegment"] = 30] = "SubSegment";
1634
+ PathScore$1[PathScore$1["Static"] = 40] = "Static";
1635
+ PathScore$1[PathScore$1["Dynamic"] = 20] = "Dynamic";
1636
+ PathScore$1[PathScore$1["BonusCustomRegExp"] = 10] = "BonusCustomRegExp";
1637
+ PathScore$1[PathScore$1["BonusWildcard"] = -50] = "BonusWildcard";
1638
+ PathScore$1[PathScore$1["BonusRepeatable"] = -20] = "BonusRepeatable";
1639
+ PathScore$1[PathScore$1["BonusOptional"] = -8] = "BonusOptional";
1640
+ PathScore$1[PathScore$1["BonusStrict"] = .7000000000000001] = "BonusStrict";
1641
+ PathScore$1[PathScore$1["BonusCaseSensitive"] = .25] = "BonusCaseSensitive";
1642
+ return PathScore$1;
1643
+ }(PathScore || {});
1644
+ const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
1645
+ /**
1646
+ * Creates a path parser from an array of Segments (a segment is an array of Tokens)
1647
+ *
1648
+ * @param segments - array of segments returned by tokenizePath
1649
+ * @param extraOptions - optional options for the regexp
1650
+ * @returns a PathParser
1651
+ */
1652
+ function tokensToParser(segments, extraOptions) {
1653
+ const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
1654
+ const score = [];
1655
+ let pattern = options.start ? "^" : "";
1656
+ const keys = [];
1657
+ for (const segment of segments) {
1658
+ const segmentScores = segment.length ? [] : [PathScore.Root];
1659
+ if (options.strict && !segment.length) pattern += "/";
1660
+ for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
1661
+ const token = segment[tokenIndex];
1662
+ let subSegmentScore = PathScore.Segment + (options.sensitive ? PathScore.BonusCaseSensitive : 0);
1663
+ if (token.type === TokenType.Static) {
1664
+ if (!tokenIndex) pattern += "/";
1665
+ pattern += token.value.replace(REGEX_CHARS_RE, "\\$&");
1666
+ subSegmentScore += PathScore.Static;
1667
+ } else if (token.type === TokenType.Param) {
1668
+ const { value, repeatable, optional, regexp } = token;
1669
+ keys.push({
1670
+ name: value,
1671
+ repeatable,
1672
+ optional
1673
+ });
1674
+ const re$1 = regexp ? regexp : BASE_PARAM_PATTERN;
1675
+ if (re$1 !== BASE_PARAM_PATTERN) {
1676
+ subSegmentScore += PathScore.BonusCustomRegExp;
1677
+ try {
1678
+ `${re$1}`;
1679
+ } catch (err) {
1680
+ throw new Error(`Invalid custom RegExp for param "${value}" (${re$1}): ` + err.message);
1681
+ }
1682
+ }
1683
+ let subPattern = repeatable ? `((?:${re$1})(?:/(?:${re$1}))*)` : `(${re$1})`;
1684
+ if (!tokenIndex) subPattern = optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
1685
+ if (optional) subPattern += "?";
1686
+ pattern += subPattern;
1687
+ subSegmentScore += PathScore.Dynamic;
1688
+ if (optional) subSegmentScore += PathScore.BonusOptional;
1689
+ if (repeatable) subSegmentScore += PathScore.BonusRepeatable;
1690
+ if (re$1 === ".*") subSegmentScore += PathScore.BonusWildcard;
1691
+ }
1692
+ segmentScores.push(subSegmentScore);
1693
+ }
1694
+ score.push(segmentScores);
1695
+ }
1696
+ if (options.strict && options.end) {
1697
+ const i = score.length - 1;
1698
+ score[i][score[i].length - 1] += PathScore.BonusStrict;
1699
+ }
1700
+ if (!options.strict) pattern += "/?";
1701
+ if (options.end) pattern += "$";
1702
+ else if (options.strict && !pattern.endsWith("/")) pattern += "(?:/|$)";
1703
+ const re = new RegExp(pattern, options.sensitive ? "" : "i");
1704
+ function parse(path) {
1705
+ const match = path.match(re);
1706
+ const params = {};
1707
+ if (!match) return null;
1708
+ for (let i = 1; i < match.length; i++) {
1709
+ const value = match[i] || "";
1710
+ const key = keys[i - 1];
1711
+ params[key.name] = value && key.repeatable ? value.split("/") : value;
1712
+ }
1713
+ return params;
1714
+ }
1715
+ function stringify(params) {
1716
+ let path = "";
1717
+ let avoidDuplicatedSlash = false;
1718
+ for (const segment of segments) {
1719
+ if (!avoidDuplicatedSlash || !path.endsWith("/")) path += "/";
1720
+ avoidDuplicatedSlash = false;
1721
+ for (const token of segment) if (token.type === TokenType.Static) path += token.value;
1722
+ else if (token.type === TokenType.Param) {
1723
+ const { value, repeatable, optional } = token;
1724
+ const param = value in params ? params[value] : "";
1725
+ if (isArray(param) && !repeatable) throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
1726
+ const text = isArray(param) ? param.join("/") : param;
1727
+ if (!text) if (optional) {
1728
+ if (segment.length < 2) if (path.endsWith("/")) path = path.slice(0, -1);
1729
+ else avoidDuplicatedSlash = true;
1730
+ } else throw new Error(`Missing required param "${value}"`);
1731
+ path += text;
1732
+ }
1733
+ }
1734
+ return path || "/";
1735
+ }
1736
+ return {
1737
+ re,
1738
+ score,
1739
+ keys,
1740
+ parse,
1741
+ stringify
1742
+ };
1743
+ }
1744
+ /**
1745
+ * Compares an array of numbers as used in PathParser.score and returns a
1746
+ * number. This function can be used to `sort` an array
1747
+ *
1748
+ * @param a - first array of numbers
1749
+ * @param b - second array of numbers
1750
+ * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b
1751
+ * should be sorted first
1752
+ */
1753
+ function compareScoreArray(a, b) {
1754
+ let i = 0;
1755
+ while (i < a.length && i < b.length) {
1756
+ const diff = b[i] - a[i];
1757
+ if (diff) return diff;
1758
+ i++;
1759
+ }
1760
+ if (a.length < b.length) return a.length === 1 && a[0] === PathScore.Static + PathScore.Segment ? -1 : 1;
1761
+ else if (a.length > b.length) return b.length === 1 && b[0] === PathScore.Static + PathScore.Segment ? 1 : -1;
1762
+ return 0;
1763
+ }
1764
+ /**
1765
+ * Compare function that can be used with `sort` to sort an array of PathParser
1766
+ *
1767
+ * @param a - first PathParser
1768
+ * @param b - second PathParser
1769
+ * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b
1770
+ */
1771
+ function comparePathParserScore(a, b) {
1772
+ let i = 0;
1773
+ const aScore = a.score;
1774
+ const bScore = b.score;
1775
+ while (i < aScore.length && i < bScore.length) {
1776
+ const comp = compareScoreArray(aScore[i], bScore[i]);
1777
+ if (comp) return comp;
1778
+ i++;
1779
+ }
1780
+ if (Math.abs(bScore.length - aScore.length) === 1) {
1781
+ if (isLastScoreNegative(aScore)) return 1;
1782
+ if (isLastScoreNegative(bScore)) return -1;
1783
+ }
1784
+ return bScore.length - aScore.length;
1785
+ }
1786
+ /**
1787
+ * This allows detecting splats at the end of a path: /home/:id(.*)*
1788
+ *
1789
+ * @param score - score to check
1790
+ * @returns true if the last entry is negative
1791
+ */
1792
+ function isLastScoreNegative(score) {
1793
+ const last = score[score.length - 1];
1794
+ return score.length > 0 && last[last.length - 1] < 0;
1795
+ }
1796
+ const PATH_PARSER_OPTIONS_DEFAULTS = {
1797
+ strict: false,
1798
+ end: true,
1799
+ sensitive: false
1800
+ };
1801
+
1802
+ //#endregion
1803
+ //#region src/matcher/pathMatcher.ts
1804
+ function createRouteRecordMatcher(record, parent, options) {
1805
+ const parser = tokensToParser(tokenizePath(record.path), options);
1806
+ if (process.env.NODE_ENV !== "production") {
1807
+ const existingKeys = /* @__PURE__ */ new Set();
1808
+ for (const key of parser.keys) {
1809
+ 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".`);
1810
+ existingKeys.add(key.name);
1811
+ }
1812
+ }
1813
+ const matcher = assign(parser, {
1814
+ record,
1815
+ parent,
1816
+ children: [],
1817
+ alias: []
1818
+ });
1819
+ if (parent) {
1820
+ if (!matcher.record.aliasOf === !parent.record.aliasOf) parent.children.push(matcher);
1821
+ }
1822
+ return matcher;
1823
+ }
1824
+
1825
+ //#endregion
1826
+ //#region src/matcher/index.ts
1827
+ /**
1828
+ * Creates a Router Matcher.
1829
+ *
1830
+ * @internal
1831
+ * @param routes - array of initial routes
1832
+ * @param globalOptions - global route options
1833
+ */
1834
+ function createRouterMatcher(routes, globalOptions) {
1835
+ const matchers = [];
1836
+ const matcherMap = /* @__PURE__ */ new Map();
1837
+ globalOptions = mergeOptions(PATH_PARSER_OPTIONS_DEFAULTS, globalOptions);
1838
+ function getRecordMatcher(name) {
1839
+ return matcherMap.get(name);
1840
+ }
1841
+ function addRoute(record, parent, originalRecord) {
1842
+ const isRootAdd = !originalRecord;
1843
+ const mainNormalizedRecord = normalizeRouteRecord(record);
1844
+ if (process.env.NODE_ENV !== "production") checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent);
1845
+ mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
1846
+ const options = mergeOptions(globalOptions, record);
1847
+ const normalizedRecords = [mainNormalizedRecord];
1848
+ if ("alias" in record) {
1849
+ const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
1850
+ for (const alias of aliases) normalizedRecords.push(normalizeRouteRecord(assign({}, mainNormalizedRecord, {
1851
+ components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
1852
+ path: alias,
1853
+ aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
1854
+ })));
1855
+ }
1856
+ let matcher;
1857
+ let originalMatcher;
1858
+ for (const normalizedRecord of normalizedRecords) {
1859
+ const { path } = normalizedRecord;
1860
+ if (parent && path[0] !== "/") {
1861
+ const parentPath = parent.record.path;
1862
+ const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
1863
+ normalizedRecord.path = parent.record.path + (path && connectingSlash + path);
1864
+ }
1865
+ 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.");
1866
+ matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
1867
+ if (process.env.NODE_ENV !== "production" && parent && path[0] === "/") checkMissingParamsInAbsolutePath(matcher, parent);
1868
+ if (originalRecord) {
1869
+ originalRecord.alias.push(matcher);
1870
+ if (process.env.NODE_ENV !== "production") checkSameParams(originalRecord, matcher);
1871
+ } else {
1872
+ originalMatcher = originalMatcher || matcher;
1873
+ if (originalMatcher !== matcher) originalMatcher.alias.push(matcher);
1874
+ if (isRootAdd && record.name && !isAliasRecord(matcher)) {
1875
+ if (process.env.NODE_ENV !== "production") checkSameNameAsAncestor(record, parent);
1876
+ removeRoute(record.name);
1877
+ }
1878
+ }
1879
+ if (isMatchable(matcher)) insertMatcher(matcher);
1880
+ if (mainNormalizedRecord.children) {
1881
+ const children = mainNormalizedRecord.children;
1882
+ for (let i = 0; i < children.length; i++) addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
1883
+ }
1884
+ originalRecord = originalRecord || matcher;
1885
+ }
1886
+ return originalMatcher ? () => {
1887
+ removeRoute(originalMatcher);
1888
+ } : noop;
1889
+ }
1890
+ function removeRoute(matcherRef) {
1891
+ if (isRouteName(matcherRef)) {
1892
+ const matcher = matcherMap.get(matcherRef);
1893
+ if (matcher) {
1894
+ matcherMap.delete(matcherRef);
1895
+ matchers.splice(matchers.indexOf(matcher), 1);
1896
+ matcher.children.forEach(removeRoute);
1897
+ matcher.alias.forEach(removeRoute);
1898
+ }
1899
+ } else {
1900
+ const index = matchers.indexOf(matcherRef);
1901
+ if (index > -1) {
1902
+ matchers.splice(index, 1);
1903
+ if (matcherRef.record.name) matcherMap.delete(matcherRef.record.name);
1904
+ matcherRef.children.forEach(removeRoute);
1905
+ matcherRef.alias.forEach(removeRoute);
1906
+ }
1907
+ }
1908
+ }
1909
+ function getRoutes() {
1910
+ return matchers;
1911
+ }
1912
+ function insertMatcher(matcher) {
1913
+ const index = findInsertionIndex(matcher, matchers);
1914
+ matchers.splice(index, 0, matcher);
1915
+ if (matcher.record.name && !isAliasRecord(matcher)) matcherMap.set(matcher.record.name, matcher);
1916
+ }
1917
+ function resolve(location$1, currentLocation) {
1918
+ let matcher;
1919
+ let params = {};
1920
+ let path;
1921
+ let name;
1922
+ if ("name" in location$1 && location$1.name) {
1923
+ matcher = matcherMap.get(location$1.name);
1924
+ if (!matcher) throw createRouterError(ErrorTypes.MATCHER_NOT_FOUND, { location: location$1 });
1925
+ if (process.env.NODE_ENV !== "production") {
1926
+ const invalidParams = Object.keys(location$1.params || {}).filter((paramName) => !matcher.keys.find((k) => k.name === paramName));
1927
+ 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.`);
1928
+ }
1929
+ name = matcher.record.name;
1930
+ 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)));
1931
+ path = matcher.stringify(params);
1932
+ } else if (location$1.path != null) {
1933
+ path = location$1.path;
1934
+ 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.`);
1935
+ matcher = matchers.find((m) => m.re.test(path));
1936
+ if (matcher) {
1937
+ params = matcher.parse(path);
1938
+ name = matcher.record.name;
1939
+ }
1940
+ } else {
1941
+ matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path));
1942
+ if (!matcher) throw createRouterError(ErrorTypes.MATCHER_NOT_FOUND, {
1943
+ location: location$1,
1944
+ currentLocation
1945
+ });
1946
+ name = matcher.record.name;
1947
+ params = assign({}, currentLocation.params, location$1.params);
1948
+ path = matcher.stringify(params);
1949
+ }
1950
+ const matched = [];
1951
+ let parentMatcher = matcher;
1952
+ while (parentMatcher) {
1953
+ matched.unshift(parentMatcher.record);
1954
+ parentMatcher = parentMatcher.parent;
1955
+ }
1956
+ return {
1957
+ name,
1958
+ path,
1959
+ params,
1960
+ matched,
1961
+ meta: mergeMetaFields(matched)
1962
+ };
1963
+ }
1964
+ routes.forEach((route) => addRoute(route));
1965
+ function clearRoutes() {
1966
+ matchers.length = 0;
1967
+ matcherMap.clear();
1968
+ }
1969
+ return {
1970
+ addRoute,
1971
+ resolve,
1972
+ removeRoute,
1973
+ clearRoutes,
1974
+ getRoutes,
1975
+ getRecordMatcher
1976
+ };
1977
+ }
1978
+ /**
1979
+ * Picks an object param to contain only specified keys.
1980
+ *
1981
+ * @param params - params object to pick from
1982
+ * @param keys - keys to pick
1983
+ */
1984
+ function pickParams(params, keys) {
1985
+ const newParams = {};
1986
+ for (const key of keys) if (key in params) newParams[key] = params[key];
1987
+ return newParams;
1988
+ }
1989
+ /**
1990
+ * Normalizes a RouteRecordRaw. Creates a copy
1991
+ *
1992
+ * @param record
1993
+ * @returns the normalized version
1994
+ */
1995
+ function normalizeRouteRecord(record) {
1996
+ const normalized = {
1997
+ path: record.path,
1998
+ redirect: record.redirect,
1999
+ name: record.name,
2000
+ meta: record.meta || {},
2001
+ aliasOf: record.aliasOf,
2002
+ beforeEnter: record.beforeEnter,
2003
+ props: normalizeRecordProps(record),
2004
+ children: record.children || [],
2005
+ instances: {},
2006
+ leaveGuards: /* @__PURE__ */ new Set(),
2007
+ updateGuards: /* @__PURE__ */ new Set(),
2008
+ enterCallbacks: {},
2009
+ components: "components" in record ? record.components || null : record.component && { default: record.component }
2010
+ };
2011
+ Object.defineProperty(normalized, "mods", { value: {} });
2012
+ return normalized;
2013
+ }
2014
+ /**
2015
+ * Normalize the optional `props` in a record to always be an object similar to
2016
+ * components. Also accept a boolean for components.
2017
+ * @param record
2018
+ */
2019
+ function normalizeRecordProps(record) {
2020
+ const propsObject = {};
2021
+ const props = record.props || false;
2022
+ if ("component" in record) propsObject.default = props;
2023
+ else for (const name in record.components) propsObject[name] = typeof props === "object" ? props[name] : props;
2024
+ return propsObject;
2025
+ }
2026
+ /**
2027
+ * Checks if a record or any of its parent is an alias
2028
+ * @param record
2029
+ */
2030
+ function isAliasRecord(record) {
2031
+ while (record) {
2032
+ if (record.record.aliasOf) return true;
2033
+ record = record.parent;
2034
+ }
2035
+ return false;
2036
+ }
2037
+ /**
2038
+ * Merge meta fields of an array of records
2039
+ *
2040
+ * @param matched - array of matched records
2041
+ */
2042
+ function mergeMetaFields(matched) {
2043
+ return matched.reduce((meta, record) => assign(meta, record.meta), {});
2044
+ }
2045
+ function isSameParam(a, b) {
2046
+ return a.name === b.name && a.optional === b.optional && a.repeatable === b.repeatable;
2047
+ }
2048
+ /**
2049
+ * Check if a path and its alias have the same required params
2050
+ *
2051
+ * @param a - original record
2052
+ * @param b - alias record
2053
+ */
2054
+ function checkSameParams(a, b) {
2055
+ 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}"`);
2056
+ 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}"`);
2057
+ }
2058
+ /**
2059
+ * A route with a name and a child with an empty path without a name should warn when adding the route
2060
+ *
2061
+ * @param mainNormalizedRecord - RouteRecordNormalized
2062
+ * @param parent - RouteRecordMatcher
2063
+ */
2064
+ function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {
2065
+ 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.`);
2066
+ }
2067
+ function checkSameNameAsAncestor(record, parent) {
2068
+ 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.`);
2069
+ }
2070
+ function checkMissingParamsInAbsolutePath(record, parent) {
2071
+ 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}".`);
2072
+ }
2073
+ /**
2074
+ * Performs a binary search to find the correct insertion index for a new matcher.
2075
+ *
2076
+ * Matchers are primarily sorted by their score. If scores are tied then we also consider parent/child relationships,
2077
+ * with descendants coming before ancestors. If there's still a tie, new routes are inserted after existing routes.
2078
+ *
2079
+ * @param matcher - new matcher to be inserted
2080
+ * @param matchers - existing matchers
2081
+ */
2082
+ function findInsertionIndex(matcher, matchers) {
2083
+ let lower = 0;
2084
+ let upper = matchers.length;
2085
+ while (lower !== upper) {
2086
+ const mid = lower + upper >> 1;
2087
+ if (comparePathParserScore(matcher, matchers[mid]) < 0) upper = mid;
2088
+ else lower = mid + 1;
2089
+ }
2090
+ const insertionAncestor = getInsertionAncestor(matcher);
2091
+ if (insertionAncestor) {
2092
+ upper = matchers.lastIndexOf(insertionAncestor, upper - 1);
2093
+ if (process.env.NODE_ENV !== "production" && upper < 0) warn$1(`Finding ancestor route "${insertionAncestor.record.path}" failed for "${matcher.record.path}"`);
2094
+ }
2095
+ return upper;
2096
+ }
2097
+ function getInsertionAncestor(matcher) {
2098
+ let ancestor = matcher;
2099
+ while (ancestor = ancestor.parent) if (isMatchable(ancestor) && comparePathParserScore(matcher, ancestor) === 0) return ancestor;
2100
+ }
2101
+ /**
2102
+ * Checks if a matcher can be reachable. This means if it's possible to reach it as a route. For example, routes without
2103
+ * a component, or name, or redirect, are just used to group other routes.
2104
+ * @param matcher
2105
+ * @param matcher.record record of the matcher
2106
+ * @returns
2107
+ */
2108
+ function isMatchable({ record }) {
2109
+ return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
2110
+ }
2111
+
2112
+ //#endregion
2113
+ //#region src/RouterLink.ts
2114
+ /**
2115
+ * Returns the internal behavior of a {@link RouterLink} without the rendering part.
2116
+ *
2117
+ * @param props - a `to` location and an optional `replace` flag
2118
+ */
2119
+ function useLink(props) {
2120
+ const router = inject(routerKey);
2121
+ const currentRoute = inject(routeLocationKey);
2122
+ let hasPrevious = false;
2123
+ let previousTo = null;
2124
+ const route = computed(() => {
2125
+ const to = unref(props.to);
2126
+ if (process.env.NODE_ENV !== "production" && (!hasPrevious || to !== previousTo)) {
2127
+ if (!isRouteLocation(to)) if (hasPrevious) warn$1(`Invalid value for prop "to" in useLink()\n- to:`, to, `\n- previous to:`, previousTo, `\n- props:`, props);
2128
+ else warn$1(`Invalid value for prop "to" in useLink()\n- to:`, to, `\n- props:`, props);
2129
+ previousTo = to;
2130
+ hasPrevious = true;
2131
+ }
2132
+ return router.resolve(to);
2133
+ });
2134
+ const activeRecordIndex = computed(() => {
2135
+ const { matched } = route.value;
2136
+ const { length } = matched;
2137
+ const routeMatched = matched[length - 1];
2138
+ const currentMatched = currentRoute.matched;
2139
+ if (!routeMatched || !currentMatched.length) return -1;
2140
+ const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
2141
+ if (index > -1) return index;
2142
+ const parentRecordPath = getOriginalPath(matched[length - 2]);
2143
+ return length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index;
2144
+ });
2145
+ const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
2146
+ const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
2147
+ function navigate(e = {}) {
2148
+ if (guardEvent(e)) {
2149
+ const p = router[unref(props.replace) ? "replace" : "push"](unref(props.to)).catch(noop);
2150
+ if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) document.startViewTransition(() => p);
2151
+ return p;
2152
+ }
2153
+ return Promise.resolve();
2154
+ }
2155
+ if ((process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) && isBrowser) {
2156
+ const instance = getCurrentInstance();
2157
+ if (instance) {
2158
+ const linkContextDevtools = {
2159
+ route: route.value,
2160
+ isActive: isActive.value,
2161
+ isExactActive: isExactActive.value,
2162
+ error: null
2163
+ };
2164
+ instance.__vrl_devtools = instance.__vrl_devtools || [];
2165
+ instance.__vrl_devtools.push(linkContextDevtools);
2166
+ watchEffect(() => {
2167
+ linkContextDevtools.route = route.value;
2168
+ linkContextDevtools.isActive = isActive.value;
2169
+ linkContextDevtools.isExactActive = isExactActive.value;
2170
+ linkContextDevtools.error = isRouteLocation(unref(props.to)) ? null : "Invalid \"to\" value";
2171
+ }, { flush: "post" });
2172
+ }
2173
+ }
2174
+ /**
2175
+ * NOTE: update {@link _RouterLinkI}'s `$slots` type when updating this
2176
+ */
2177
+ return {
2178
+ route,
2179
+ href: computed(() => route.value.href),
2180
+ isActive,
2181
+ isExactActive,
2182
+ navigate
2183
+ };
2184
+ }
2185
+ function preferSingleVNode(vnodes) {
2186
+ return vnodes.length === 1 ? vnodes[0] : vnodes;
2187
+ }
2188
+ const RouterLinkImpl = /* @__PURE__ */ defineComponent({
2189
+ name: "RouterLink",
2190
+ compatConfig: { MODE: 3 },
2191
+ props: {
2192
+ to: {
2193
+ type: [String, Object],
2194
+ required: true
2195
+ },
2196
+ replace: Boolean,
2197
+ activeClass: String,
2198
+ exactActiveClass: String,
2199
+ custom: Boolean,
2200
+ ariaCurrentValue: {
2201
+ type: String,
2202
+ default: "page"
2203
+ },
2204
+ viewTransition: Boolean
2205
+ },
2206
+ useLink,
2207
+ setup(props, { slots }) {
2208
+ const link = reactive(useLink(props));
2209
+ const { options } = inject(routerKey);
2210
+ const elClass = computed(() => ({
2211
+ [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
2212
+ [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
2213
+ }));
2214
+ return () => {
2215
+ const children = slots.default && preferSingleVNode(slots.default(link));
2216
+ return props.custom ? children : h("a", {
2217
+ "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
2218
+ href: link.href,
2219
+ onClick: link.navigate,
2220
+ class: elClass.value
2221
+ }, children);
2222
+ };
2223
+ }
2224
+ });
2225
+ /**
2226
+ * Component to render a link that triggers a navigation on click.
2227
+ */
2228
+ const RouterLink = RouterLinkImpl;
2229
+ function guardEvent(e) {
2230
+ if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
2231
+ if (e.defaultPrevented) return;
2232
+ if (e.button !== void 0 && e.button !== 0) return;
2233
+ if (e.currentTarget && e.currentTarget.getAttribute) {
2234
+ const target = e.currentTarget.getAttribute("target");
2235
+ if (/\b_blank\b/i.test(target)) return;
2236
+ }
2237
+ if (e.preventDefault) e.preventDefault();
2238
+ return true;
2239
+ }
2240
+ function includesParams(outer, inner) {
2241
+ for (const key in inner) {
2242
+ const innerValue = inner[key];
2243
+ const outerValue = outer[key];
2244
+ if (typeof innerValue === "string") {
2245
+ if (innerValue !== outerValue) return false;
2246
+ } else if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value.valueOf() !== outerValue[i].valueOf())) return false;
2247
+ }
2248
+ return true;
2249
+ }
2250
+ /**
2251
+ * Get the original path value of a record by following its aliasOf
2252
+ * @param record
2253
+ */
2254
+ function getOriginalPath(record) {
2255
+ return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
2256
+ }
2257
+ /**
2258
+ * Utility class to get the active class based on defaults.
2259
+ * @param propClass
2260
+ * @param globalClass
2261
+ * @param defaultClass
2262
+ */
2263
+ const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
2264
+
2265
+ //#endregion
2266
+ //#region src/RouterView.ts
2267
+ const RouterViewImpl = /* @__PURE__ */ defineComponent({
2268
+ name: "RouterView",
2269
+ inheritAttrs: false,
2270
+ props: {
2271
+ name: {
2272
+ type: String,
2273
+ default: "default"
2274
+ },
2275
+ route: Object
2276
+ },
2277
+ compatConfig: { MODE: 3 },
2278
+ setup(props, { attrs, slots }) {
2279
+ process.env.NODE_ENV !== "production" && warnDeprecatedUsage();
2280
+ const injectedRoute = inject(routerViewLocationKey);
2281
+ const routeToDisplay = computed(() => props.route || injectedRoute.value);
2282
+ const injectedDepth = inject(viewDepthKey, 0);
2283
+ const depth = computed(() => {
2284
+ let initialDepth = unref(injectedDepth);
2285
+ const { matched } = routeToDisplay.value;
2286
+ let matchedRoute;
2287
+ while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) initialDepth++;
2288
+ return initialDepth;
2289
+ });
2290
+ const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
2291
+ provide(viewDepthKey, computed(() => depth.value + 1));
2292
+ provide(matchedRouteKey, matchedRouteRef);
2293
+ provide(routerViewLocationKey, routeToDisplay);
2294
+ const viewRef = ref();
2295
+ watch(() => [
2296
+ viewRef.value,
2297
+ matchedRouteRef.value,
2298
+ props.name
2299
+ ], ([instance, to, name], [oldInstance, from, oldName]) => {
2300
+ if (to) {
2301
+ to.instances[name] = instance;
2302
+ if (from && from !== to && instance && instance === oldInstance) {
2303
+ if (!to.leaveGuards.size) to.leaveGuards = from.leaveGuards;
2304
+ if (!to.updateGuards.size) to.updateGuards = from.updateGuards;
2305
+ }
2306
+ }
2307
+ if (instance && to && (!from || !isSameRouteRecord(to, from) || !oldInstance)) (to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
2308
+ }, { flush: "post" });
2309
+ return () => {
2310
+ const route = routeToDisplay.value;
2311
+ const currentName = props.name;
2312
+ const matchedRoute = matchedRouteRef.value;
2313
+ const ViewComponent = matchedRoute && matchedRoute.components[currentName];
2314
+ if (!ViewComponent) return normalizeSlot(slots.default, {
2315
+ Component: ViewComponent,
2316
+ route
2317
+ });
2318
+ const routePropsOption = matchedRoute.props[currentName];
2319
+ const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
2320
+ const onVnodeUnmounted = (vnode) => {
2321
+ if (vnode.component.isUnmounted) matchedRoute.instances[currentName] = null;
2322
+ };
2323
+ const component = h(ViewComponent, assign({}, routeProps, attrs, {
2324
+ onVnodeUnmounted,
2325
+ ref: viewRef
2326
+ }));
2327
+ if ((process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) && isBrowser && component.ref) {
2328
+ const info = {
2329
+ depth: depth.value,
2330
+ name: matchedRoute.name,
2331
+ path: matchedRoute.path,
2332
+ meta: matchedRoute.meta
2333
+ };
2334
+ (isArray(component.ref) ? component.ref.map((r) => r.i) : [component.ref.i]).forEach((instance) => {
2335
+ instance.__vrv_devtools = info;
2336
+ });
2337
+ }
2338
+ return normalizeSlot(slots.default, {
2339
+ Component: component,
2340
+ route
2341
+ }) || component;
2342
+ };
2343
+ }
2344
+ });
2345
+ function normalizeSlot(slot, data) {
2346
+ if (!slot) return null;
2347
+ const slotContent = slot(data);
2348
+ return slotContent.length === 1 ? slotContent[0] : slotContent;
2349
+ }
2350
+ /**
2351
+ * Component to display the current route the user is at.
2352
+ */
2353
+ const RouterView = RouterViewImpl;
2354
+ function warnDeprecatedUsage() {
2355
+ const instance = getCurrentInstance();
2356
+ const parentName = instance.parent && instance.parent.type.name;
2357
+ const parentSubTreeType = instance.parent && instance.parent.subTree && instance.parent.subTree.type;
2358
+ if (parentName && (parentName === "KeepAlive" || parentName.includes("Transition")) && typeof parentSubTreeType === "object" && parentSubTreeType.name === "RouterView") {
2359
+ const comp = parentName === "KeepAlive" ? "keep-alive" : "transition";
2360
+ warn$1(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.
2361
+ Use slot props instead:
2362
+
2363
+ <router-view v-slot="{ Component }">
2364
+ <${comp}>\n <component :is="Component" />\n </${comp}>\n</router-view>`);
2365
+ }
2366
+ }
2367
+
2368
+ //#endregion
2369
+ //#region src/router.ts
2370
+ /**
2371
+ * Creates a Router instance that can be used by a Vue app.
2372
+ *
2373
+ * @param options - {@link RouterOptions}
2374
+ */
2375
+ function createRouter(options) {
2376
+ const matcher = createRouterMatcher(options.routes, options);
2377
+ const parseQuery$1 = options.parseQuery || parseQuery;
2378
+ const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
2379
+ const routerHistory = options.history;
2380
+ 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");
2381
+ const beforeGuards = useCallbacks();
2382
+ const beforeResolveGuards = useCallbacks();
2383
+ const afterGuards = useCallbacks();
2384
+ const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
2385
+ let pendingLocation = START_LOCATION_NORMALIZED;
2386
+ if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) history.scrollRestoration = "manual";
2387
+ const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue);
2388
+ const encodeParams = applyToParams.bind(null, encodeParam);
2389
+ const decodeParams = applyToParams.bind(null, decode);
2390
+ function addRoute(parentOrRoute, route) {
2391
+ let parent;
2392
+ let record;
2393
+ if (isRouteName(parentOrRoute)) {
2394
+ parent = matcher.getRecordMatcher(parentOrRoute);
2395
+ if (process.env.NODE_ENV !== "production" && !parent) warn$1(`Parent route "${String(parentOrRoute)}" not found when adding child route`, route);
2396
+ record = route;
2397
+ } else record = parentOrRoute;
2398
+ return matcher.addRoute(record, parent);
2399
+ }
2400
+ function removeRoute(name) {
2401
+ const recordMatcher = matcher.getRecordMatcher(name);
2402
+ if (recordMatcher) matcher.removeRoute(recordMatcher);
2403
+ else if (process.env.NODE_ENV !== "production") warn$1(`Cannot remove non-existent route "${String(name)}"`);
2404
+ }
2405
+ function getRoutes() {
2406
+ return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
2407
+ }
2408
+ function hasRoute(name) {
2409
+ return !!matcher.getRecordMatcher(name);
2410
+ }
2411
+ function resolve(rawLocation, currentLocation) {
2412
+ currentLocation = assign({}, currentLocation || currentRoute.value);
2413
+ if (typeof rawLocation === "string") {
2414
+ const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
2415
+ const matchedRoute$1 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
2416
+ const href$1 = routerHistory.createHref(locationNormalized.fullPath);
2417
+ if (process.env.NODE_ENV !== "production") {
2418
+ if (href$1.startsWith("//")) warn$1(`Location "${rawLocation}" resolved to "${href$1}". A resolved location cannot start with multiple slashes.`);
2419
+ else if (!matchedRoute$1.matched.length) warn$1(`No match found for location with path "${rawLocation}"`);
2420
+ }
2421
+ return assign(locationNormalized, matchedRoute$1, {
2422
+ params: decodeParams(matchedRoute$1.params),
2423
+ hash: decode(locationNormalized.hash),
2424
+ redirectedFrom: void 0,
2425
+ href: href$1
2426
+ });
2427
+ }
2428
+ if (process.env.NODE_ENV !== "production" && !isRouteLocation(rawLocation)) {
2429
+ warn$1(`router.resolve() was passed an invalid location. This will fail in production.\n- Location:`, rawLocation);
2430
+ return resolve({});
2431
+ }
2432
+ let matcherLocation;
2433
+ if (rawLocation.path != null) {
2434
+ 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.`);
2435
+ matcherLocation = assign({}, rawLocation, { path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path });
2436
+ } else {
2437
+ const targetParams = assign({}, rawLocation.params);
2438
+ for (const key in targetParams) if (targetParams[key] == null) delete targetParams[key];
2439
+ matcherLocation = assign({}, rawLocation, { params: encodeParams(targetParams) });
2440
+ currentLocation.params = encodeParams(currentLocation.params);
2441
+ }
2442
+ const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
2443
+ const hash = rawLocation.hash || "";
2444
+ if (process.env.NODE_ENV !== "production" && hash && !hash.startsWith("#")) warn$1(`A \`hash\` should always start with the character "#". Replace "${hash}" with "#${hash}".`);
2445
+ matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
2446
+ const fullPath = stringifyURL(stringifyQuery$1, assign({}, rawLocation, {
2447
+ hash: encodeHash(hash),
2448
+ path: matchedRoute.path
2449
+ }));
2450
+ const href = routerHistory.createHref(fullPath);
2451
+ if (process.env.NODE_ENV !== "production") {
2452
+ if (href.startsWith("//")) warn$1(`Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.`);
2453
+ else if (!matchedRoute.matched.length) warn$1(`No match found for location with path "${rawLocation.path != null ? rawLocation.path : rawLocation}"`);
2454
+ }
2455
+ return assign({
2456
+ fullPath,
2457
+ hash,
2458
+ query: stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
2459
+ }, matchedRoute, {
2460
+ redirectedFrom: void 0,
2461
+ href
2462
+ });
2463
+ }
2464
+ function locationAsObject(to) {
2465
+ return typeof to === "string" ? parseURL(parseQuery$1, to, currentRoute.value.path) : assign({}, to);
2466
+ }
2467
+ function checkCanceledNavigation(to, from) {
2468
+ if (pendingLocation !== to) return createRouterError(ErrorTypes.NAVIGATION_CANCELLED, {
2469
+ from,
2470
+ to
2471
+ });
2472
+ }
2473
+ function push(to) {
2474
+ return pushWithRedirect(to);
2475
+ }
2476
+ function replace(to) {
2477
+ return push(assign(locationAsObject(to), { replace: true }));
2478
+ }
2479
+ function handleRedirectRecord(to, from) {
2480
+ const lastMatched = to.matched[to.matched.length - 1];
2481
+ if (lastMatched && lastMatched.redirect) {
2482
+ const { redirect } = lastMatched;
2483
+ let newTargetLocation = typeof redirect === "function" ? redirect(to, from) : redirect;
2484
+ if (typeof newTargetLocation === "string") {
2485
+ newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : { path: newTargetLocation };
2486
+ newTargetLocation.params = {};
2487
+ }
2488
+ if (process.env.NODE_ENV !== "production" && newTargetLocation.path == null && !("name" in newTargetLocation)) {
2489
+ warn$1(`Invalid redirect found:\n${JSON.stringify(newTargetLocation, null, 2)}\n when navigating to "${to.fullPath}". A redirect must contain a name or path. This will break in production.`);
2490
+ throw new Error("Invalid redirect");
2491
+ }
2492
+ return assign({
2493
+ query: to.query,
2494
+ hash: to.hash,
2495
+ params: newTargetLocation.path != null ? {} : to.params
2496
+ }, newTargetLocation);
2497
+ }
2498
+ }
2499
+ function pushWithRedirect(to, redirectedFrom) {
2500
+ const targetLocation = pendingLocation = resolve(to);
2501
+ const from = currentRoute.value;
2502
+ const data = to.state;
2503
+ const force = to.force;
2504
+ const replace$1 = to.replace === true;
2505
+ const shouldRedirect = handleRedirectRecord(targetLocation, from);
2506
+ if (shouldRedirect) return pushWithRedirect(assign(locationAsObject(shouldRedirect), {
2507
+ state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data,
2508
+ force,
2509
+ replace: replace$1
2510
+ }), redirectedFrom || targetLocation);
2511
+ const toLocation = targetLocation;
2512
+ toLocation.redirectedFrom = redirectedFrom;
2513
+ let failure;
2514
+ if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
2515
+ failure = createRouterError(ErrorTypes.NAVIGATION_DUPLICATED, {
2516
+ to: toLocation,
2517
+ from
2518
+ });
2519
+ handleScroll(from, from, true, false);
2520
+ }
2521
+ 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) => {
2522
+ if (failure$1) {
2523
+ if (isNavigationFailure(failure$1, ErrorTypes.NAVIGATION_GUARD_REDIRECT)) {
2524
+ if (process.env.NODE_ENV !== "production" && isSameRouteLocation(stringifyQuery$1, resolve(failure$1.to), toLocation) && redirectedFrom && (redirectedFrom._count = redirectedFrom._count ? redirectedFrom._count + 1 : 1) > 30) {
2525
+ 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.\n 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.`);
2526
+ return Promise.reject(/* @__PURE__ */ new Error("Infinite redirect in navigation guard"));
2527
+ }
2528
+ return pushWithRedirect(assign({ replace: replace$1 }, locationAsObject(failure$1.to), {
2529
+ state: typeof failure$1.to === "object" ? assign({}, data, failure$1.to.state) : data,
2530
+ force
2531
+ }), redirectedFrom || toLocation);
2532
+ }
2533
+ } else failure$1 = finalizeNavigation(toLocation, from, true, replace$1, data);
2534
+ triggerAfterEach(toLocation, from, failure$1);
2535
+ return failure$1;
2536
+ });
2537
+ }
2538
+ /**
2539
+ * Helper to reject and skip all navigation guards if a new navigation happened
2540
+ * @param to
2541
+ * @param from
2542
+ */
2543
+ function checkCanceledNavigationAndReject(to, from) {
2544
+ const error = checkCanceledNavigation(to, from);
2545
+ return error ? Promise.reject(error) : Promise.resolve();
2546
+ }
2547
+ function runWithContext(fn) {
2548
+ const app = installedApps.values().next().value;
2549
+ return app && typeof app.runWithContext === "function" ? app.runWithContext(fn) : fn();
2550
+ }
2551
+ function navigate(to, from) {
2552
+ let guards;
2553
+ const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
2554
+ guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from);
2555
+ for (const record of leavingRecords) record.leaveGuards.forEach((guard) => {
2556
+ guards.push(guardToPromiseFn(guard, to, from));
2557
+ });
2558
+ const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
2559
+ guards.push(canceledNavigationCheck);
2560
+ return runGuardQueue(guards).then(() => {
2561
+ guards = [];
2562
+ for (const guard of beforeGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
2563
+ guards.push(canceledNavigationCheck);
2564
+ return runGuardQueue(guards);
2565
+ }).then(() => {
2566
+ guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from);
2567
+ for (const record of updatingRecords) record.updateGuards.forEach((guard) => {
2568
+ guards.push(guardToPromiseFn(guard, to, from));
2569
+ });
2570
+ guards.push(canceledNavigationCheck);
2571
+ return runGuardQueue(guards);
2572
+ }).then(() => {
2573
+ guards = [];
2574
+ for (const record of enteringRecords) if (record.beforeEnter) if (isArray(record.beforeEnter)) for (const beforeEnter of record.beforeEnter) guards.push(guardToPromiseFn(beforeEnter, to, from));
2575
+ else guards.push(guardToPromiseFn(record.beforeEnter, to, from));
2576
+ guards.push(canceledNavigationCheck);
2577
+ return runGuardQueue(guards);
2578
+ }).then(() => {
2579
+ to.matched.forEach((record) => record.enterCallbacks = {});
2580
+ guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from, runWithContext);
2581
+ guards.push(canceledNavigationCheck);
2582
+ return runGuardQueue(guards);
2583
+ }).then(() => {
2584
+ guards = [];
2585
+ for (const guard of beforeResolveGuards.list()) guards.push(guardToPromiseFn(guard, to, from));
2586
+ guards.push(canceledNavigationCheck);
2587
+ return runGuardQueue(guards);
2588
+ }).catch((err) => isNavigationFailure(err, ErrorTypes.NAVIGATION_CANCELLED) ? err : Promise.reject(err));
2589
+ }
2590
+ function triggerAfterEach(to, from, failure) {
2591
+ afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from, failure)));
2592
+ }
2593
+ /**
2594
+ * - Cleans up any navigation guards
2595
+ * - Changes the url if necessary
2596
+ * - Calls the scrollBehavior
2597
+ */
2598
+ function finalizeNavigation(toLocation, from, isPush, replace$1, data) {
2599
+ const error = checkCanceledNavigation(toLocation, from);
2600
+ if (error) return error;
2601
+ const isFirstNavigation = from === START_LOCATION_NORMALIZED;
2602
+ const state = !isBrowser ? {} : history.state;
2603
+ if (isPush) if (replace$1 || isFirstNavigation) routerHistory.replace(toLocation.fullPath, assign({ scroll: isFirstNavigation && state && state.scroll }, data));
2604
+ else routerHistory.push(toLocation.fullPath, data);
2605
+ currentRoute.value = toLocation;
2606
+ handleScroll(toLocation, from, isPush, isFirstNavigation);
2607
+ markAsReady();
2608
+ }
2609
+ let removeHistoryListener;
2610
+ function setupListeners() {
2611
+ if (removeHistoryListener) return;
2612
+ removeHistoryListener = routerHistory.listen((to, _from, info) => {
2613
+ if (!router.listening) return;
2614
+ const toLocation = resolve(to);
2615
+ const shouldRedirect = handleRedirectRecord(toLocation, router.currentRoute.value);
2616
+ if (shouldRedirect) {
2617
+ pushWithRedirect(assign(shouldRedirect, {
2618
+ replace: true,
2619
+ force: true
2620
+ }), toLocation).catch(noop);
2621
+ return;
2622
+ }
2623
+ pendingLocation = toLocation;
2624
+ const from = currentRoute.value;
2625
+ if (isBrowser) saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
2626
+ navigate(toLocation, from).catch((error) => {
2627
+ if (isNavigationFailure(error, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED)) return error;
2628
+ if (isNavigationFailure(error, ErrorTypes.NAVIGATION_GUARD_REDIRECT)) {
2629
+ pushWithRedirect(assign(locationAsObject(error.to), { force: true }), toLocation).then((failure) => {
2630
+ if (isNavigationFailure(failure, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED) && !info.delta && info.type === NavigationType.pop) routerHistory.go(-1, false);
2631
+ }).catch(noop);
2632
+ return Promise.reject();
2633
+ }
2634
+ if (info.delta) routerHistory.go(-info.delta, false);
2635
+ return triggerError(error, toLocation, from);
2636
+ }).then((failure) => {
2637
+ failure = failure || finalizeNavigation(toLocation, from, false);
2638
+ if (failure) {
2639
+ if (info.delta && !isNavigationFailure(failure, ErrorTypes.NAVIGATION_CANCELLED)) routerHistory.go(-info.delta, false);
2640
+ else if (info.type === NavigationType.pop && isNavigationFailure(failure, ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED)) routerHistory.go(-1, false);
2641
+ }
2642
+ triggerAfterEach(toLocation, from, failure);
2643
+ }).catch(noop);
2644
+ });
2645
+ }
2646
+ let readyHandlers = useCallbacks();
2647
+ let errorListeners = useCallbacks();
2648
+ let ready;
2649
+ /**
2650
+ * Trigger errorListeners added via onError and throws the error as well
2651
+ *
2652
+ * @param error - error to throw
2653
+ * @param to - location we were navigating to when the error happened
2654
+ * @param from - location we were navigating from when the error happened
2655
+ * @returns the error as a rejected promise
2656
+ */
2657
+ function triggerError(error, to, from) {
2658
+ markAsReady(error);
2659
+ const list = errorListeners.list();
2660
+ if (list.length) list.forEach((handler) => handler(error, to, from));
2661
+ else {
2662
+ if (process.env.NODE_ENV !== "production") warn$1("uncaught error during route navigation:");
2663
+ console.error(error);
2664
+ }
2665
+ return Promise.reject(error);
2666
+ }
2667
+ function isReady() {
2668
+ if (ready && currentRoute.value !== START_LOCATION_NORMALIZED) return Promise.resolve();
2669
+ return new Promise((resolve$1, reject) => {
2670
+ readyHandlers.add([resolve$1, reject]);
2671
+ });
2672
+ }
2673
+ function markAsReady(err) {
2674
+ if (!ready) {
2675
+ ready = !err;
2676
+ setupListeners();
2677
+ readyHandlers.list().forEach(([resolve$1, reject]) => err ? reject(err) : resolve$1());
2678
+ readyHandlers.reset();
2679
+ }
2680
+ return err;
2681
+ }
2682
+ function handleScroll(to, from, isPush, isFirstNavigation) {
2683
+ const { scrollBehavior } = options;
2684
+ if (!isBrowser || !scrollBehavior) return Promise.resolve();
2685
+ const scrollPosition = !isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0)) || (isFirstNavigation || !isPush) && history.state && history.state.scroll || null;
2686
+ return nextTick().then(() => scrollBehavior(to, from, scrollPosition)).then((position) => position && scrollToPosition(position)).catch((err) => triggerError(err, to, from));
2687
+ }
2688
+ const go = (delta) => routerHistory.go(delta);
2689
+ let started;
2690
+ const installedApps = /* @__PURE__ */ new Set();
2691
+ const router = {
2692
+ currentRoute,
2693
+ listening: true,
2694
+ addRoute,
2695
+ removeRoute,
2696
+ clearRoutes: matcher.clearRoutes,
2697
+ hasRoute,
2698
+ getRoutes,
2699
+ resolve,
2700
+ options,
2701
+ push,
2702
+ replace,
2703
+ go,
2704
+ back: () => go(-1),
2705
+ forward: () => go(1),
2706
+ beforeEach: beforeGuards.add,
2707
+ beforeResolve: beforeResolveGuards.add,
2708
+ afterEach: afterGuards.add,
2709
+ onError: errorListeners.add,
2710
+ isReady,
2711
+ install(app) {
2712
+ app.component("RouterLink", RouterLink);
2713
+ app.component("RouterView", RouterView);
2714
+ app.config.globalProperties.$router = router;
2715
+ Object.defineProperty(app.config.globalProperties, "$route", {
2716
+ enumerable: true,
2717
+ get: () => unref(currentRoute)
2718
+ });
2719
+ if (isBrowser && !started && currentRoute.value === START_LOCATION_NORMALIZED) {
2720
+ started = true;
2721
+ push(routerHistory.location).catch((err) => {
2722
+ if (process.env.NODE_ENV !== "production") warn$1("Unexpected error when starting the router:", err);
2723
+ });
2724
+ }
2725
+ const reactiveRoute = {};
2726
+ for (const key in START_LOCATION_NORMALIZED) Object.defineProperty(reactiveRoute, key, {
2727
+ get: () => currentRoute.value[key],
2728
+ enumerable: true
2729
+ });
2730
+ app.provide(routerKey, router);
2731
+ app.provide(routeLocationKey, shallowReactive(reactiveRoute));
2732
+ app.provide(routerViewLocationKey, currentRoute);
2733
+ const unmountApp = app.unmount;
2734
+ installedApps.add(app);
2735
+ app.unmount = function() {
2736
+ installedApps.delete(app);
2737
+ if (installedApps.size < 1) {
2738
+ pendingLocation = START_LOCATION_NORMALIZED;
2739
+ removeHistoryListener && removeHistoryListener();
2740
+ removeHistoryListener = null;
2741
+ currentRoute.value = START_LOCATION_NORMALIZED;
2742
+ started = false;
2743
+ ready = false;
2744
+ }
2745
+ unmountApp();
2746
+ };
2747
+ if ((process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) && isBrowser) addDevtools(app, router, matcher);
2748
+ }
2749
+ };
2750
+ function runGuardQueue(guards) {
2751
+ return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve());
2752
+ }
2753
+ return router;
2754
+ }
2755
+
2756
+ //#endregion
2757
+ //#region src/useApi.ts
2758
+ /**
2759
+ * Returns the router instance. Equivalent to using `$router` inside
2760
+ * templates.
2761
+ */
2762
+ function useRouter() {
2763
+ return inject(routerKey);
2764
+ }
2765
+ /**
2766
+ * Returns the current route location. Equivalent to using `$route` inside
2767
+ * templates.
2768
+ */
2769
+ function useRoute(_name) {
2770
+ return inject(routeLocationKey);
2771
+ }
2772
+
2773
+ export { NavigationFailureType, RouterLink, RouterView, START_LOCATION_NORMALIZED as START_LOCATION, createMemoryHistory, createRouter, createRouterMatcher, createWebHashHistory, createWebHistory, isNavigationFailure, loadRouteLocation, matchedRouteKey, onBeforeRouteLeave, onBeforeRouteUpdate, parseQuery, routeLocationKey, routerKey, routerViewLocationKey, stringifyQuery, useLink, useRoute, useRouter, viewDepthKey };