nuxt-ignis 0.5.0-rc.1 → 0.5.0-rc.2

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 (161) hide show
  1. package/.data/content/contents.sqlite +0 -0
  2. package/.env +1 -1
  3. package/.nuxt/components.d.ts +218 -230
  4. package/.nuxt/content/components.ts +108 -107
  5. package/.nuxt/dev/index.mjs +148 -111
  6. package/.nuxt/dev/index.mjs.map +1 -1
  7. package/.nuxt/dist/server/client.manifest.json +2 -2
  8. package/.nuxt/dist/server/client.manifest.mjs +2 -2
  9. package/.nuxt/eslint-typegen.d.ts +60 -6
  10. package/.nuxt/eslint.config.d.mts +3 -3
  11. package/.nuxt/eslint.config.mjs +11 -11
  12. package/.nuxt/imports.d.ts +56 -56
  13. package/.nuxt/manifest/latest.json +1 -1
  14. package/.nuxt/manifest/meta/dev.json +1 -1
  15. package/.nuxt/mdc-image-component.mjs +1 -1
  16. package/.nuxt/module/nuxt-robots.d.ts +12 -12
  17. package/.nuxt/module/nuxt-seo-utils.d.ts +10 -10
  18. package/.nuxt/module/nuxt-site-config.d.ts +11 -8
  19. package/.nuxt/module/nuxt-sitemap.d.ts +17 -17
  20. package/.nuxt/nitro.json +5 -5
  21. package/.nuxt/nuxt.d.ts +11 -8
  22. package/.nuxt/nuxt.json +2 -2
  23. package/.nuxt/nuxt.node.d.ts +9 -7
  24. package/.nuxt/tsconfig.app.json +186 -162
  25. package/.nuxt/tsconfig.json +188 -161
  26. package/.nuxt/tsconfig.node.json +101 -84
  27. package/.nuxt/tsconfig.server.json +124 -120
  28. package/.nuxt/tsconfig.shared.json +60 -55
  29. package/.nuxt/types/build.d.ts +1 -1
  30. package/.nuxt/types/components.d.ts +288 -300
  31. package/.nuxt/types/i18n-plugin.d.ts +2 -2
  32. package/.nuxt/types/imports.d.ts +677 -673
  33. package/.nuxt/types/modules.d.ts +34 -14
  34. package/.nuxt/types/nitro-imports.d.ts +249 -249
  35. package/.nuxt/types/nitro-nuxt.d.ts +3 -1
  36. package/.nuxt/types/nitro-routes.d.ts +15 -15
  37. package/.nuxt/types/plugins.d.ts +36 -36
  38. package/.nuxt/ui-image-component.ts +1 -1
  39. package/.output/nitro.json +2 -2
  40. package/.output/public/_fonts/31PZhXd_YTCmsoiPQZc-xVtAWAkLogRFRj5mWplmKFE-6WsTw05QKugcwLySGc_b9CIheG8j8LRyo47qPL430Mk.woff2 +0 -0
  41. package/.output/public/_fonts/9FWLUGCSCYLRIRMtCzLrt4Go7DMFXOeN_pyCOJD_44Y-Yh2wNaqrq_e759vVlc3tX81lMwRu9ktkQJX_Svgs-VI.woff2 +0 -0
  42. package/.output/public/_fonts/BQnDL9FFy0Q_jvURlmv87luvmXLSMbSuXsfZv_R2Rkk-y5MVrLtP4J_1al8rz8R-MDaUOMAHckAWCwDrKhw25fY.woff2 +0 -0
  43. package/.output/public/_fonts/JSrPAbQHsQEdUrIE5Ts6fIQ2ymsa4i7HhiCpui6ulCc-_AoyGWssOn06OMh3ZY_GddBBPRny4Igxin4fT_1K6F4.woff2 +0 -0
  44. package/.output/public/_fonts/Jtqhy44WKYEjGWTSusP5YJfJv7Wf74QqgkBOI9u_77s-Rl_Bht5SvmaotE20bkavBEAJEEGEa0hcz3d_8yOeXmw.woff +0 -0
  45. package/.output/public/_fonts/M-60tFLmAJxdPjHsK-2ILWom5zPbu37lb3Qex2waL14-A9y4QcXALPi_RvQsmRsSFUxrT3_J213W4zPFIXetlbw.woff2 +0 -0
  46. package/.output/public/_fonts/T-ozk-QJ_Ck37B2RHPl2i-s_gAGGo7suFgagWoJ8bO4-maDXQ_nEXKAaLHm4Joud3DJR9EVzS7QXWMWK8YOTIcs.woff2 +0 -0
  47. package/.output/public/_fonts/TTYbISAfwy-y4uVGS9AH32sK7b2xJsoCESo64ryf8LU-y87nRMqBGo42rUOW9tWZa06o4oTa0USJrAMMoKDamgs.woff2 +0 -0
  48. package/.output/public/_fonts/Y_5DOsLit49q2i2tbcNxnyUen9__GPCX8mwAi03q1aA-pBCjVKDT5tBT3BJckh9uzNkfUWeUIBPz9Y8T55vcj8E.woff2 +0 -0
  49. package/.output/public/_fonts/ZHaz3DhCHNWhsElqYfuM71rfBBDgjuU2sd34vaYJwQg-71NZaZSGjxzAGjCMnCc2zS5rS_EGA0xHKPGCggWuXik.woff +0 -0
  50. package/.output/public/_fonts/h9PwCjip_BNPVO50hT4v29USWFv6H3ZlYx_IestfqgY-sYfLVuZXl9E1aYbn1S0pAr4zfdQ_WT7iBZhrgQY6N-4.woff2 +0 -0
  51. package/.output/public/_fonts/l00UCz_-QvI_NO8AGcu7ooAcrFDlxYUdxCSCh6gBwd4-vPjTZ3ztgw27A2TnHeCycxPvUtXWEVpG33_97ra6su8.woff2 +0 -0
  52. package/.output/public/_fonts/nuenOq7ZFSZ65QudJO7uQ0sOjDqow2WjfXrQh4S9gEc-uF81rxcswER5srfhzyLfPoGlKNAIt2C_BvkXFOc19rw.woff2 +0 -0
  53. package/.output/public/_fonts/pWMvGwciZ-EfQsfR2ueelhC7Jnt5K-8Px8PjPK0mDII-eT9iD0iZ9WWhTJs6V5GxXr0iaUwx_WxgGGriOiGb81o.woff2 +0 -0
  54. package/.output/public/_fonts/y3mP_zJcojQwJn30TpF_XxDzgeM6Nbk7MaRg1Ne0YcI-lFx13nqMCMgk_S70gRmwEHXlE5BLp1B4W82RpFihpMs.woff2 +0 -0
  55. package/.output/public/_fonts/zr3WxpLd5PmlBr7e4PWGkhZv6XTg70Pi4sCbC-CEV0Q-v2yL98XOiD3FkbiYlYYeAeTSVSkgAckeOp55Q5kHJmU.woff2 +0 -0
  56. package/.output/public/_ignis-config.json +1789 -1
  57. package/.output/public/_nuxt/Bhpb4lc3.js +1 -0
  58. package/.output/public/_nuxt/{DXbccJ2T.js → BqsN2CZp.js} +1 -1
  59. package/.output/public/_nuxt/C9ePPGPX.js +94 -0
  60. package/.output/public/_nuxt/CQozUI2A.js +1 -0
  61. package/.output/public/_nuxt/DBJqMhGy.js +35 -0
  62. package/.output/public/_nuxt/{BiUZ9mZX.js → DvwlldUy.js} +1 -1
  63. package/.output/public/_nuxt/RbPLLy5S.js +1 -0
  64. package/.output/public/_nuxt/{DXBpKbsa.js → aetvq4w9.js} +40 -32
  65. package/.output/public/_nuxt/builds/latest.json +1 -1
  66. package/.output/public/_nuxt/builds/meta/cbc9377a-971e-4db1-b4b1-01807b82ee58.json +1 -0
  67. package/.output/public/_nuxt/entry.whtwWr_z.css +1 -0
  68. package/.output/public/_nuxt/error-404.Cq535Uij.css +1 -0
  69. package/.output/public/_nuxt/error-500.BHm_N15n.css +1 -0
  70. package/.output/public/_nuxt/{dJ-vStNn.js → jpnxxCHq.js} +1 -1
  71. package/.output/public/nuxt-spec.png +0 -0
  72. package/.output/server/chunks/_/error-500.mjs.map +1 -1
  73. package/.output/server/chunks/_/nitro.mjs +273 -154
  74. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  75. package/.output/server/chunks/build/client.manifest.mjs +64 -64
  76. package/.output/server/chunks/routes/renderer.mjs +3 -3
  77. package/.output/server/chunks/routes/renderer.mjs.map +1 -1
  78. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +131 -96
  79. package/.output/server/node_modules/@vue/compiler-core/package.json +4 -4
  80. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +4 -1
  81. package/.output/server/node_modules/@vue/compiler-dom/package.json +3 -3
  82. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +10 -1
  83. package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
  84. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +4 -3
  85. package/.output/server/node_modules/@vue/reactivity/package.json +2 -2
  86. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +25 -27
  87. package/.output/server/node_modules/@vue/runtime-core/package.json +3 -3
  88. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +40 -14
  89. package/.output/server/node_modules/@vue/runtime-dom/package.json +4 -4
  90. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +1 -1
  91. package/.output/server/node_modules/@vue/server-renderer/package.json +4 -4
  92. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +1 -1
  93. package/.output/server/node_modules/@vue/shared/package.json +1 -1
  94. package/.output/server/node_modules/debug/package.json +1 -1
  95. package/.output/server/node_modules/vue/dist/vue.cjs.js +1 -1
  96. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +1 -1
  97. package/.output/server/node_modules/vue/package.json +6 -6
  98. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +158 -53
  99. package/.output/server/node_modules/vue-bundle-renderer/package.json +16 -11
  100. package/.output/server/node_modules/vue-router/dist/devtools-BLCumUwL.mjs +1218 -0
  101. package/.output/server/node_modules/vue-router/dist/vue-router.mjs +1459 -3688
  102. package/.output/server/node_modules/vue-router/package.json +43 -38
  103. package/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
  104. package/.output/server/package.json +13 -13
  105. package/README.md +4 -0
  106. package/app/app.vue +2 -2
  107. package/app/assets/css/ignis-open-props.css +4 -5
  108. package/app/components/CurrentTime.vue +8 -1
  109. package/app/components/ignis/{IgnisInfo.vue → IgnisContent.vue} +3 -3
  110. package/app/components/ignis/{IgnisConfig.vue → IgnisContentConfig.vue} +5 -1
  111. package/app/components/ignis/IgnisContentFeatures.vue +102 -0
  112. package/app/components/ignis/{IgnisWelcome.vue → IgnisContentWelcome.vue} +2 -2
  113. package/app/components/ignis/IgnisFooter.vue +11 -3
  114. package/app/pages/_ignis-config.vue +1 -1
  115. package/app/pages/_ignis-info.vue +1 -1
  116. package/app/pages/_ignis-welcome.vue +1 -1
  117. package/app/pages/index.vue +2 -2
  118. package/bin/cli.js +59 -0
  119. package/bin/set-app-vue.js +18 -0
  120. package/bin/set-css.js +3 -8
  121. package/bin/set-eslint.js +3 -8
  122. package/bin/setup.js +208 -45
  123. package/features.ts +17 -8
  124. package/nuxt.config.ts +9 -4
  125. package/package.json +15 -17
  126. package/public/_ignis-config.json +1789 -1
  127. package/test/config/css-multiple.txt +30 -24
  128. package/test/config/css-nuxt-ui.txt +34 -28
  129. package/test/config/css-open-props.txt +1812 -1805
  130. package/test/config/css-single.txt +28 -22
  131. package/test/config/css-tailwind.txt +55 -48
  132. package/test/config/custom-lang.txt +27 -21
  133. package/test/config/db-neon.txt +28 -22
  134. package/test/config/db-supabase.txt +31 -25
  135. package/test/config/default.txt +27 -21
  136. package/test/config/equipment-1-composable.txt +33 -27
  137. package/test/config/equipment-2-plugins.txt +34 -28
  138. package/test/config/equipment-all.txt +38 -32
  139. package/test/config/forms-formkit.txt +32 -26
  140. package/test/config/forms-vueform.txt +28 -22
  141. package/test/config/i18n.txt +36 -30
  142. package/test/config/no-default-css.txt +24 -18
  143. package/test/config/open-props.txt +1811 -1804
  144. package/test/config/seo-ssr-false.txt +35 -29
  145. package/test/config/ui-nuxt-ui.txt +33 -27
  146. package/test/config/ui-tailwind.txt +54 -47
  147. package/test/features.test.ts +33 -33
  148. package/.nuxt/i18n.options.mjs +0 -165
  149. package/.nuxt/nuxt-i18n-logger.mjs +0 -1
  150. package/.output/public/_nuxt/BA2WKEAc.js +0 -1
  151. package/.output/public/_nuxt/BE_a_Zhd.js +0 -1
  152. package/.output/public/_nuxt/Bnm5Nral.js +0 -1
  153. package/.output/public/_nuxt/BrY1radz.js +0 -35
  154. package/.output/public/_nuxt/CmzFGS1a.js +0 -90
  155. package/.output/public/_nuxt/builds/meta/9a624d26-216d-4e69-b3a7-54b68357876f.json +0 -1
  156. package/.output/public/_nuxt/entry.jMyW6Sg0.css +0 -1
  157. package/.output/public/_nuxt/error-404.BGUbR0Uk.css +0 -1
  158. package/.output/public/_nuxt/error-500.CQfkKpQ2.css +0 -1
  159. package/.output/server/node_modules/vue-router/dist/vue-router.node.mjs +0 -2
  160. package/app/components/ignis/IgnisFeatureList.vue +0 -111
  161. /package/app/components/ignis/{IgnisFeature.vue → IgnisContentFeaturesDetail.vue} +0 -0
@@ -0,0 +1,1218 @@
1
+ /*!
2
+ * vue-router v4.6.3
3
+ * (c) 2025 Eduardo San Martin Morote
4
+ * @license MIT
5
+ */
6
+ import { getCurrentInstance, inject, onActivated, onDeactivated, onUnmounted, watch } from "vue";
7
+ import { setupDevtoolsPlugin } from "@vue/devtools-api";
8
+
9
+ //#region src/utils/env.ts
10
+ const isBrowser = typeof document !== "undefined";
11
+
12
+ //#endregion
13
+ //#region src/utils/index.ts
14
+ /**
15
+ * Identity function that returns the value as is.
16
+ *
17
+ * @param v - the value to return
18
+ *
19
+ * @internal
20
+ */
21
+ const identityFn = (v) => v;
22
+ /**
23
+ * Allows differentiating lazy components from functional components and vue-class-component
24
+ * @internal
25
+ *
26
+ * @param component
27
+ */
28
+ function isRouteComponent(component) {
29
+ return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
30
+ }
31
+ function isESModule(obj) {
32
+ return obj.__esModule || obj[Symbol.toStringTag] === "Module" || obj.default && isRouteComponent(obj.default);
33
+ }
34
+ const assign = Object.assign;
35
+ function applyToParams(fn, params) {
36
+ const newParams = {};
37
+ for (const key in params) {
38
+ const value = params[key];
39
+ newParams[key] = isArray(value) ? value.map(fn) : fn(value);
40
+ }
41
+ return newParams;
42
+ }
43
+ const noop = () => {};
44
+ /**
45
+ * Typesafe alternative to Array.isArray
46
+ * https://github.com/microsoft/TypeScript/pull/48228
47
+ */
48
+ const isArray = Array.isArray;
49
+ function mergeOptions(defaults, partialOptions) {
50
+ const options = {};
51
+ for (const key in defaults) options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
52
+ return options;
53
+ }
54
+
55
+ //#endregion
56
+ //#region src/warning.ts
57
+ function warn$1(msg) {
58
+ const args = Array.from(arguments).slice(1);
59
+ console.warn.apply(console, ["[Vue Router warn]: " + msg].concat(args));
60
+ }
61
+
62
+ //#endregion
63
+ //#region src/encoding.ts
64
+ /**
65
+ * Encoding Rules (␣ = Space)
66
+ * - Path: ␣ " < > # ? { }
67
+ * - Query: ␣ " < > # & =
68
+ * - Hash: ␣ " < > `
69
+ *
70
+ * On top of that, the RFC3986 (https://tools.ietf.org/html/rfc3986#section-2.2)
71
+ * defines some extra characters to be encoded. Most browsers do not encode them
72
+ * in encodeURI https://github.com/whatwg/url/issues/369, so it may be safer to
73
+ * also encode `!'()*`. Leaving un-encoded only ASCII alphanumeric(`a-zA-Z0-9`)
74
+ * plus `-._~`. This extra safety should be applied to query by patching the
75
+ * string returned by encodeURIComponent encodeURI also encodes `[\]^`. `\`
76
+ * should be encoded to avoid ambiguity. Browsers (IE, FF, C) transform a `\`
77
+ * into a `/` if directly typed in. The _backtick_ (`````) should also be
78
+ * encoded everywhere because some browsers like FF encode it when directly
79
+ * written while others don't. Safari and IE don't encode ``"<>{}``` in hash.
80
+ */
81
+ const HASH_RE = /#/g;
82
+ const AMPERSAND_RE = /&/g;
83
+ const SLASH_RE = /\//g;
84
+ const EQUAL_RE = /=/g;
85
+ const IM_RE = /\?/g;
86
+ const PLUS_RE = /\+/g;
87
+ /**
88
+ * NOTE: It's not clear to me if we should encode the + symbol in queries, it
89
+ * seems to be less flexible than not doing so and I can't find out the legacy
90
+ * systems requiring this for regular requests like text/html. In the standard,
91
+ * the encoding of the plus character is only mentioned for
92
+ * application/x-www-form-urlencoded
93
+ * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo
94
+ * leave the plus character as is in queries. To be more flexible, we allow the
95
+ * plus character on the query, but it can also be manually encoded by the user.
96
+ *
97
+ * Resources:
98
+ * - https://url.spec.whatwg.org/#urlencoded-parsing
99
+ * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
100
+ */
101
+ const ENC_BRACKET_OPEN_RE = /%5B/g;
102
+ const ENC_BRACKET_CLOSE_RE = /%5D/g;
103
+ const ENC_CARET_RE = /%5E/g;
104
+ const ENC_BACKTICK_RE = /%60/g;
105
+ const ENC_CURLY_OPEN_RE = /%7B/g;
106
+ const ENC_PIPE_RE = /%7C/g;
107
+ const ENC_CURLY_CLOSE_RE = /%7D/g;
108
+ const ENC_SPACE_RE = /%20/g;
109
+ /**
110
+ * Encode characters that need to be encoded on the path, search and hash
111
+ * sections of the URL.
112
+ *
113
+ * @internal
114
+ * @param text - string to encode
115
+ * @returns encoded string
116
+ */
117
+ function commonEncode(text) {
118
+ return text == null ? "" : encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
119
+ }
120
+ /**
121
+ * Encode characters that need to be encoded on the hash section of the URL.
122
+ *
123
+ * @param text - string to encode
124
+ * @returns encoded string
125
+ */
126
+ function encodeHash(text) {
127
+ return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
128
+ }
129
+ /**
130
+ * Encode characters that need to be encoded query values on the query
131
+ * section of the URL.
132
+ *
133
+ * @param text - string to encode
134
+ * @returns encoded string
135
+ */
136
+ function encodeQueryValue(text) {
137
+ 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, "^");
138
+ }
139
+ /**
140
+ * Like `encodeQueryValue` but also encodes the `=` character.
141
+ *
142
+ * @param text - string to encode
143
+ */
144
+ function encodeQueryKey(text) {
145
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
146
+ }
147
+ /**
148
+ * Encode characters that need to be encoded on the path section of the URL.
149
+ *
150
+ * @param text - string to encode
151
+ * @returns encoded string
152
+ */
153
+ function encodePath(text) {
154
+ return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
155
+ }
156
+ /**
157
+ * Encode characters that need to be encoded on the path section of the URL as a
158
+ * param. This function encodes everything {@link encodePath} does plus the
159
+ * slash (`/`) character. If `text` is `null` or `undefined`, returns an empty
160
+ * string instead.
161
+ *
162
+ * @param text - string to encode
163
+ * @returns encoded string
164
+ */
165
+ function encodeParam(text) {
166
+ return encodePath(text).replace(SLASH_RE, "%2F");
167
+ }
168
+ function decode(text) {
169
+ if (text == null) return null;
170
+ try {
171
+ return decodeURIComponent("" + text);
172
+ } catch (err) {
173
+ process.env.NODE_ENV !== "production" && warn$1(`Error decoding "${text}". Using original value`);
174
+ }
175
+ return "" + text;
176
+ }
177
+
178
+ //#endregion
179
+ //#region src/location.ts
180
+ const TRAILING_SLASH_RE = /\/$/;
181
+ const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, "");
182
+ /**
183
+ * Transforms a URI into a normalized history location
184
+ *
185
+ * @param parseQuery
186
+ * @param location - URI to normalize
187
+ * @param currentLocation - current absolute location. Allows resolving relative
188
+ * paths. Must start with `/`. Defaults to `/`
189
+ * @returns a normalized history location
190
+ */
191
+ function parseURL(parseQuery$1, location, currentLocation = "/") {
192
+ let path, query = {}, searchString = "", hash = "";
193
+ const hashPos = location.indexOf("#");
194
+ let searchPos = location.indexOf("?");
195
+ searchPos = hashPos >= 0 && searchPos > hashPos ? -1 : searchPos;
196
+ if (searchPos >= 0) {
197
+ path = location.slice(0, searchPos);
198
+ searchString = location.slice(searchPos, hashPos > 0 ? hashPos : location.length);
199
+ query = parseQuery$1(searchString.slice(1));
200
+ }
201
+ if (hashPos >= 0) {
202
+ path = path || location.slice(0, hashPos);
203
+ hash = location.slice(hashPos, location.length);
204
+ }
205
+ path = resolveRelativePath(path != null ? path : location, currentLocation);
206
+ return {
207
+ fullPath: path + searchString + hash,
208
+ path,
209
+ query,
210
+ hash: decode(hash)
211
+ };
212
+ }
213
+ function NEW_stringifyURL(stringifyQuery$1, path, query, hash = "") {
214
+ const searchText = stringifyQuery$1(query);
215
+ return path + (searchText && "?") + searchText + encodeHash(hash);
216
+ }
217
+ /**
218
+ * Stringifies a URL object
219
+ *
220
+ * @param stringifyQuery
221
+ * @param location
222
+ */
223
+ function stringifyURL(stringifyQuery$1, location) {
224
+ const query = location.query ? stringifyQuery$1(location.query) : "";
225
+ return location.path + (query && "?") + query + (location.hash || "");
226
+ }
227
+ /**
228
+ * Strips off the base from the beginning of a location.pathname in a non-case-sensitive way.
229
+ *
230
+ * @param pathname - location.pathname
231
+ * @param base - base to strip off
232
+ */
233
+ function stripBase(pathname, base) {
234
+ if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase())) return pathname;
235
+ return pathname.slice(base.length) || "/";
236
+ }
237
+ /**
238
+ * Checks if two RouteLocation are equal. This means that both locations are
239
+ * pointing towards the same {@link RouteRecord} and that all `params`, `query`
240
+ * parameters and `hash` are the same
241
+ *
242
+ * @param stringifyQuery - A function that takes a query object of type LocationQueryRaw and returns a string representation of it.
243
+ * @param a - first {@link RouteLocation}
244
+ * @param b - second {@link RouteLocation}
245
+ */
246
+ function isSameRouteLocation(stringifyQuery$1, a, b) {
247
+ const aLastIndex = a.matched.length - 1;
248
+ const bLastIndex = b.matched.length - 1;
249
+ 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;
250
+ }
251
+ /**
252
+ * Check if two `RouteRecords` are equal. Takes into account aliases: they are
253
+ * considered equal to the `RouteRecord` they are aliasing.
254
+ *
255
+ * @param a - first {@link RouteRecord}
256
+ * @param b - second {@link RouteRecord}
257
+ */
258
+ function isSameRouteRecord(a, b) {
259
+ return (a.aliasOf || a) === (b.aliasOf || b);
260
+ }
261
+ function isSameRouteLocationParams(a, b) {
262
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
263
+ for (const key in a) if (!isSameRouteLocationParamsValue(a[key], b[key])) return false;
264
+ return true;
265
+ }
266
+ function isSameRouteLocationParamsValue(a, b) {
267
+ return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
268
+ }
269
+ /**
270
+ * Check if two arrays are the same or if an array with one single entry is the
271
+ * same as another primitive value. Used to check query and parameters
272
+ *
273
+ * @param a - array of values
274
+ * @param b - array of values or a single value
275
+ */
276
+ function isEquivalentArray(a, b) {
277
+ return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
278
+ }
279
+ /**
280
+ * Resolves a relative path that starts with `.`.
281
+ *
282
+ * @param to - path location we are resolving
283
+ * @param from - currentLocation.path, should start with `/`
284
+ */
285
+ function resolveRelativePath(to, from) {
286
+ if (to.startsWith("/")) return to;
287
+ if (process.env.NODE_ENV !== "production" && !from.startsWith("/")) {
288
+ warn$1(`Cannot resolve a relative location without an absolute path. Trying to resolve "${to}" from "${from}". It should look like "/${from}".`);
289
+ return to;
290
+ }
291
+ if (!to) return from;
292
+ const fromSegments = from.split("/");
293
+ const toSegments = to.split("/");
294
+ const lastToSegment = toSegments[toSegments.length - 1];
295
+ if (lastToSegment === ".." || lastToSegment === ".") toSegments.push("");
296
+ let position = fromSegments.length - 1;
297
+ let toPosition;
298
+ let segment;
299
+ for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
300
+ segment = toSegments[toPosition];
301
+ if (segment === ".") continue;
302
+ if (segment === "..") {
303
+ if (position > 1) position--;
304
+ } else break;
305
+ }
306
+ return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/");
307
+ }
308
+ /**
309
+ * Initial route location where the router is. Can be used in navigation guards
310
+ * to differentiate the initial navigation.
311
+ *
312
+ * @example
313
+ * ```js
314
+ * import { START_LOCATION } from 'vue-router'
315
+ *
316
+ * router.beforeEach((to, from) => {
317
+ * if (from === START_LOCATION) {
318
+ * // initial navigation
319
+ * }
320
+ * })
321
+ * ```
322
+ */
323
+ const START_LOCATION_NORMALIZED = {
324
+ path: "/",
325
+ name: void 0,
326
+ params: {},
327
+ query: {},
328
+ hash: "",
329
+ fullPath: "/",
330
+ matched: [],
331
+ meta: {},
332
+ redirectedFrom: void 0
333
+ };
334
+
335
+ //#endregion
336
+ //#region src/history/common.ts
337
+ let NavigationType = /* @__PURE__ */ function(NavigationType$1) {
338
+ NavigationType$1["pop"] = "pop";
339
+ NavigationType$1["push"] = "push";
340
+ return NavigationType$1;
341
+ }({});
342
+ let NavigationDirection = /* @__PURE__ */ function(NavigationDirection$1) {
343
+ NavigationDirection$1["back"] = "back";
344
+ NavigationDirection$1["forward"] = "forward";
345
+ NavigationDirection$1["unknown"] = "";
346
+ return NavigationDirection$1;
347
+ }({});
348
+ /**
349
+ * Starting location for Histories
350
+ */
351
+ const START = "";
352
+ /**
353
+ * Normalizes a base by removing any trailing slash and reading the base tag if
354
+ * present.
355
+ *
356
+ * @param base - base to normalize
357
+ */
358
+ function normalizeBase(base) {
359
+ if (!base) if (isBrowser) {
360
+ const baseEl = document.querySelector("base");
361
+ base = baseEl && baseEl.getAttribute("href") || "/";
362
+ base = base.replace(/^\w+:\/\/[^\/]+/, "");
363
+ } else base = "/";
364
+ if (base[0] !== "/" && base[0] !== "#") base = "/" + base;
365
+ return removeTrailingSlash(base);
366
+ }
367
+ const BEFORE_HASH_RE = /^[^#]+#/;
368
+ function createHref(base, location) {
369
+ return base.replace(BEFORE_HASH_RE, "#") + location;
370
+ }
371
+
372
+ //#endregion
373
+ //#region src/scrollBehavior.ts
374
+ function getElementPosition(el, offset) {
375
+ const docRect = document.documentElement.getBoundingClientRect();
376
+ const elRect = el.getBoundingClientRect();
377
+ return {
378
+ behavior: offset.behavior,
379
+ left: elRect.left - docRect.left - (offset.left || 0),
380
+ top: elRect.top - docRect.top - (offset.top || 0)
381
+ };
382
+ }
383
+ const computeScrollPosition = () => ({
384
+ left: window.scrollX,
385
+ top: window.scrollY
386
+ });
387
+ function scrollToPosition(position) {
388
+ let scrollToOptions;
389
+ if ("el" in position) {
390
+ const positionEl = position.el;
391
+ const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#");
392
+ /**
393
+ * `id`s can accept pretty much any characters, including CSS combinators
394
+ * like `>` or `~`. It's still possible to retrieve elements using
395
+ * `document.getElementById('~')` but it needs to be escaped when using
396
+ * `document.querySelector('#\\~')` for it to be valid. The only
397
+ * requirements for `id`s are them to be unique on the page and to not be
398
+ * empty (`id=""`). Because of that, when passing an id selector, it should
399
+ * be properly escaped for it to work with `querySelector`. We could check
400
+ * for the id selector to be simple (no CSS combinators `+ >~`) but that
401
+ * would make things inconsistent since they are valid characters for an
402
+ * `id` but would need to be escaped when using `querySelector`, breaking
403
+ * their usage and ending up in no selector returned. Selectors need to be
404
+ * escaped:
405
+ *
406
+ * - `#1-thing` becomes `#\31 -thing`
407
+ * - `#with~symbols` becomes `#with\\~symbols`
408
+ *
409
+ * - More information about the topic can be found at
410
+ * https://mathiasbynens.be/notes/html5-id-class.
411
+ * - Practical example: https://mathiasbynens.be/demo/html5-id
412
+ */
413
+ if (process.env.NODE_ENV !== "production" && typeof position.el === "string") {
414
+ if (!isIdSelector || !document.getElementById(position.el.slice(1))) try {
415
+ const foundEl = document.querySelector(position.el);
416
+ if (isIdSelector && foundEl) {
417
+ warn$1(`The selector "${position.el}" should be passed as "el: document.querySelector('${position.el}')" because it starts with "#".`);
418
+ return;
419
+ }
420
+ } catch (err) {
421
+ 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).`);
422
+ return;
423
+ }
424
+ }
425
+ const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl) : positionEl;
426
+ if (!el) {
427
+ process.env.NODE_ENV !== "production" && warn$1(`Couldn't find element using selector "${position.el}" returned by scrollBehavior.`);
428
+ return;
429
+ }
430
+ scrollToOptions = getElementPosition(el, position);
431
+ } else scrollToOptions = position;
432
+ if ("scrollBehavior" in document.documentElement.style) window.scrollTo(scrollToOptions);
433
+ else window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);
434
+ }
435
+ function getScrollKey(path, delta) {
436
+ return (history.state ? history.state.position - delta : -1) + path;
437
+ }
438
+ const scrollPositions = /* @__PURE__ */ new Map();
439
+ function saveScrollPosition(key, scrollPosition) {
440
+ scrollPositions.set(key, scrollPosition);
441
+ }
442
+ function getSavedScrollPosition(key) {
443
+ const scroll = scrollPositions.get(key);
444
+ scrollPositions.delete(key);
445
+ return scroll;
446
+ }
447
+ /**
448
+ * ScrollBehavior instance used by the router to compute and restore the scroll
449
+ * position when navigating.
450
+ */
451
+
452
+ //#endregion
453
+ //#region src/types/typeGuards.ts
454
+ function isRouteLocation(route) {
455
+ return typeof route === "string" || route && typeof route === "object";
456
+ }
457
+ function isRouteName(name) {
458
+ return typeof name === "string" || typeof name === "symbol";
459
+ }
460
+
461
+ //#endregion
462
+ //#region src/errors.ts
463
+ /**
464
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
465
+ * {@link NavigationFailureType}.
466
+ *
467
+ * @internal
468
+ */
469
+ let ErrorTypes = /* @__PURE__ */ function(ErrorTypes$1) {
470
+ ErrorTypes$1[ErrorTypes$1["MATCHER_NOT_FOUND"] = 1] = "MATCHER_NOT_FOUND";
471
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_GUARD_REDIRECT"] = 2] = "NAVIGATION_GUARD_REDIRECT";
472
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_ABORTED"] = 4] = "NAVIGATION_ABORTED";
473
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_CANCELLED"] = 8] = "NAVIGATION_CANCELLED";
474
+ ErrorTypes$1[ErrorTypes$1["NAVIGATION_DUPLICATED"] = 16] = "NAVIGATION_DUPLICATED";
475
+ return ErrorTypes$1;
476
+ }({});
477
+ const NavigationFailureSymbol = Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
478
+ /**
479
+ * Enumeration with all possible types for navigation failures. Can be passed to
480
+ * {@link isNavigationFailure} to check for specific failures.
481
+ */
482
+ let NavigationFailureType = /* @__PURE__ */ function(NavigationFailureType$1) {
483
+ /**
484
+ * An aborted navigation is a navigation that failed because a navigation
485
+ * guard returned `false` or called `next(false)`
486
+ */
487
+ NavigationFailureType$1[NavigationFailureType$1["aborted"] = 4] = "aborted";
488
+ /**
489
+ * A cancelled navigation is a navigation that failed because a more recent
490
+ * navigation finished started (not necessarily finished).
491
+ */
492
+ NavigationFailureType$1[NavigationFailureType$1["cancelled"] = 8] = "cancelled";
493
+ /**
494
+ * A duplicated navigation is a navigation that failed because it was
495
+ * initiated while already being at the exact same location.
496
+ */
497
+ NavigationFailureType$1[NavigationFailureType$1["duplicated"] = 16] = "duplicated";
498
+ return NavigationFailureType$1;
499
+ }({});
500
+ const ErrorTypeMessages = {
501
+ [ErrorTypes.MATCHER_NOT_FOUND]({ location, currentLocation }) {
502
+ return `No match for\n ${JSON.stringify(location)}${currentLocation ? "\nwhile being at\n" + JSON.stringify(currentLocation) : ""}`;
503
+ },
504
+ [ErrorTypes.NAVIGATION_GUARD_REDIRECT]({ from, to }) {
505
+ return `Redirected from "${from.fullPath}" to "${stringifyRoute(to)}" via a navigation guard.`;
506
+ },
507
+ [ErrorTypes.NAVIGATION_ABORTED]({ from, to }) {
508
+ return `Navigation aborted from "${from.fullPath}" to "${to.fullPath}" via a navigation guard.`;
509
+ },
510
+ [ErrorTypes.NAVIGATION_CANCELLED]({ from, to }) {
511
+ return `Navigation cancelled from "${from.fullPath}" to "${to.fullPath}" with a new navigation.`;
512
+ },
513
+ [ErrorTypes.NAVIGATION_DUPLICATED]({ from, to }) {
514
+ return `Avoided redundant navigation to current location: "${from.fullPath}".`;
515
+ }
516
+ };
517
+ /**
518
+ * Creates a typed NavigationFailure object.
519
+ * @internal
520
+ * @param type - NavigationFailureType
521
+ * @param params - { from, to }
522
+ */
523
+ function createRouterError(type, params) {
524
+ if (process.env.NODE_ENV !== "production" || false) return assign(new Error(ErrorTypeMessages[type](params)), {
525
+ type,
526
+ [NavigationFailureSymbol]: true
527
+ }, params);
528
+ else return assign(/* @__PURE__ */ new Error(), {
529
+ type,
530
+ [NavigationFailureSymbol]: true
531
+ }, params);
532
+ }
533
+ function isNavigationFailure(error, type) {
534
+ return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
535
+ }
536
+ const propertiesToLog = [
537
+ "params",
538
+ "query",
539
+ "hash"
540
+ ];
541
+ function stringifyRoute(to) {
542
+ if (typeof to === "string") return to;
543
+ if (to.path != null) return to.path;
544
+ const location = {};
545
+ for (const key of propertiesToLog) if (key in to) location[key] = to[key];
546
+ return JSON.stringify(location, null, 2);
547
+ }
548
+
549
+ //#endregion
550
+ //#region src/query.ts
551
+ /**
552
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
553
+ * version with the leading `?` and without Should work as URLSearchParams
554
+
555
+ * @internal
556
+ *
557
+ * @param search - search string to parse
558
+ * @returns a query object
559
+ */
560
+ function parseQuery(search) {
561
+ const query = {};
562
+ if (search === "" || search === "?") return query;
563
+ const searchParams = (search[0] === "?" ? search.slice(1) : search).split("&");
564
+ for (let i = 0; i < searchParams.length; ++i) {
565
+ const searchParam = searchParams[i].replace(PLUS_RE, " ");
566
+ const eqPos = searchParam.indexOf("=");
567
+ const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
568
+ const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
569
+ if (key in query) {
570
+ let currentValue = query[key];
571
+ if (!isArray(currentValue)) currentValue = query[key] = [currentValue];
572
+ currentValue.push(value);
573
+ } else query[key] = value;
574
+ }
575
+ return query;
576
+ }
577
+ /**
578
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
579
+ * doesn't prepend a `?`
580
+ *
581
+ * @internal
582
+ *
583
+ * @param query - query object to stringify
584
+ * @returns string version of the query without the leading `?`
585
+ */
586
+ function stringifyQuery(query) {
587
+ let search = "";
588
+ for (let key in query) {
589
+ const value = query[key];
590
+ key = encodeQueryKey(key);
591
+ if (value == null) {
592
+ if (value !== void 0) search += (search.length ? "&" : "") + key;
593
+ continue;
594
+ }
595
+ (isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)]).forEach((value$1) => {
596
+ if (value$1 !== void 0) {
597
+ search += (search.length ? "&" : "") + key;
598
+ if (value$1 != null) search += "=" + value$1;
599
+ }
600
+ });
601
+ }
602
+ return search;
603
+ }
604
+ /**
605
+ * Transforms a {@link LocationQueryRaw} into a {@link LocationQuery} by casting
606
+ * numbers into strings, removing keys with an undefined value and replacing
607
+ * undefined with null in arrays
608
+ *
609
+ * @param query - query object to normalize
610
+ * @returns a normalized query object
611
+ */
612
+ function normalizeQuery(query) {
613
+ const normalizedQuery = {};
614
+ for (const key in query) {
615
+ const value = query[key];
616
+ if (value !== void 0) normalizedQuery[key] = isArray(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
617
+ }
618
+ return normalizedQuery;
619
+ }
620
+
621
+ //#endregion
622
+ //#region src/injectionSymbols.ts
623
+ /**
624
+ * RouteRecord being rendered by the closest ancestor Router View. Used for
625
+ * `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
626
+ * Location Matched
627
+ *
628
+ * @internal
629
+ */
630
+ const matchedRouteKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
631
+ /**
632
+ * Allows overriding the router view depth to control which component in
633
+ * `matched` is rendered. rvd stands for Router View Depth
634
+ *
635
+ * @internal
636
+ */
637
+ const viewDepthKey = Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
638
+ /**
639
+ * Allows overriding the router instance returned by `useRouter` in tests. r
640
+ * stands for router
641
+ *
642
+ * @internal
643
+ */
644
+ const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
645
+ /**
646
+ * Allows overriding the current route returned by `useRoute` in tests. rl
647
+ * stands for route location
648
+ *
649
+ * @internal
650
+ */
651
+ const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
652
+ /**
653
+ * Allows overriding the current route used by router-view. Internally this is
654
+ * used when the `route` prop is passed.
655
+ *
656
+ * @internal
657
+ */
658
+ const routerViewLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
659
+
660
+ //#endregion
661
+ //#region src/utils/callbacks.ts
662
+ /**
663
+ * Create a list of callbacks that can be reset. Used to create before and after navigation guards list
664
+ */
665
+ function useCallbacks() {
666
+ let handlers = [];
667
+ function add(handler) {
668
+ handlers.push(handler);
669
+ return () => {
670
+ const i = handlers.indexOf(handler);
671
+ if (i > -1) handlers.splice(i, 1);
672
+ };
673
+ }
674
+ function reset() {
675
+ handlers = [];
676
+ }
677
+ return {
678
+ add,
679
+ list: () => handlers.slice(),
680
+ reset
681
+ };
682
+ }
683
+
684
+ //#endregion
685
+ //#region src/navigationGuards.ts
686
+ function registerGuard(record, name, guard) {
687
+ const removeFromList = () => {
688
+ record[name].delete(guard);
689
+ };
690
+ onUnmounted(removeFromList);
691
+ onDeactivated(removeFromList);
692
+ onActivated(() => {
693
+ record[name].add(guard);
694
+ });
695
+ record[name].add(guard);
696
+ }
697
+ /**
698
+ * Add a navigation guard that triggers whenever the component for the current
699
+ * location is about to be left. Similar to {@link beforeRouteLeave} but can be
700
+ * used in any component. The guard is removed when the component is unmounted.
701
+ *
702
+ * @param leaveGuard - {@link NavigationGuard}
703
+ */
704
+ function onBeforeRouteLeave(leaveGuard) {
705
+ if (process.env.NODE_ENV !== "production" && !getCurrentInstance()) {
706
+ warn$1("getCurrentInstance() returned null. onBeforeRouteLeave() must be called at the top of a setup function");
707
+ return;
708
+ }
709
+ const activeRecord = inject(matchedRouteKey, {}).value;
710
+ if (!activeRecord) {
711
+ 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?");
712
+ return;
713
+ }
714
+ registerGuard(activeRecord, "leaveGuards", leaveGuard);
715
+ }
716
+ /**
717
+ * Add a navigation guard that triggers whenever the current location is about
718
+ * to be updated. Similar to {@link beforeRouteUpdate} but can be used in any
719
+ * component. The guard is removed when the component is unmounted.
720
+ *
721
+ * @param updateGuard - {@link NavigationGuard}
722
+ */
723
+ function onBeforeRouteUpdate(updateGuard) {
724
+ if (process.env.NODE_ENV !== "production" && !getCurrentInstance()) {
725
+ warn$1("getCurrentInstance() returned null. onBeforeRouteUpdate() must be called at the top of a setup function");
726
+ return;
727
+ }
728
+ const activeRecord = inject(matchedRouteKey, {}).value;
729
+ if (!activeRecord) {
730
+ 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?");
731
+ return;
732
+ }
733
+ registerGuard(activeRecord, "updateGuards", updateGuard);
734
+ }
735
+ function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
736
+ const enterCallbackArray = record && (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
737
+ return () => new Promise((resolve, reject) => {
738
+ const next = (valid) => {
739
+ if (valid === false) reject(createRouterError(ErrorTypes.NAVIGATION_ABORTED, {
740
+ from,
741
+ to
742
+ }));
743
+ else if (valid instanceof Error) reject(valid);
744
+ else if (isRouteLocation(valid)) reject(createRouterError(ErrorTypes.NAVIGATION_GUARD_REDIRECT, {
745
+ from: to,
746
+ to: valid
747
+ }));
748
+ else {
749
+ if (enterCallbackArray && record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") enterCallbackArray.push(valid);
750
+ resolve();
751
+ }
752
+ };
753
+ const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, process.env.NODE_ENV !== "production" ? canOnlyBeCalledOnce(next, to, from) : next));
754
+ let guardCall = Promise.resolve(guardReturn);
755
+ if (guard.length < 3) guardCall = guardCall.then(next);
756
+ if (process.env.NODE_ENV !== "production" && guard.length > 2) {
757
+ 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.`;
758
+ if (typeof guardReturn === "object" && "then" in guardReturn) guardCall = guardCall.then((resolvedValue) => {
759
+ if (!next._called) {
760
+ warn$1(message);
761
+ return Promise.reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
762
+ }
763
+ return resolvedValue;
764
+ });
765
+ else if (guardReturn !== void 0) {
766
+ if (!next._called) {
767
+ warn$1(message);
768
+ reject(/* @__PURE__ */ new Error("Invalid navigation guard"));
769
+ return;
770
+ }
771
+ }
772
+ }
773
+ guardCall.catch((err) => reject(err));
774
+ });
775
+ }
776
+ function canOnlyBeCalledOnce(next, to, from) {
777
+ let called = 0;
778
+ return function() {
779
+ 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.`);
780
+ next._called = true;
781
+ if (called === 1) next.apply(null, arguments);
782
+ };
783
+ }
784
+ function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
785
+ const guards = [];
786
+ for (const record of matched) {
787
+ 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.`);
788
+ for (const name in record.components) {
789
+ let rawComponent = record.components[name];
790
+ if (process.env.NODE_ENV !== "production") {
791
+ if (!rawComponent || typeof rawComponent !== "object" && typeof rawComponent !== "function") {
792
+ warn$1(`Component "${name}" in record with path "${record.path}" is not a valid component. Received "${String(rawComponent)}".`);
793
+ throw new Error("Invalid route component");
794
+ } else if ("then" in rawComponent) {
795
+ 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.`);
796
+ const promise = rawComponent;
797
+ rawComponent = () => promise;
798
+ } else if (rawComponent.__asyncLoader && !rawComponent.__warnedDefineAsync) {
799
+ rawComponent.__warnedDefineAsync = true;
800
+ warn$1(`Component "${name}" in record with path "${record.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`);
801
+ }
802
+ }
803
+ if (guardType !== "beforeRouteEnter" && !record.instances[name]) continue;
804
+ if (isRouteComponent(rawComponent)) {
805
+ const guard = (rawComponent.__vccOpts || rawComponent)[guardType];
806
+ guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
807
+ } else {
808
+ let componentPromise = rawComponent();
809
+ if (process.env.NODE_ENV !== "production" && !("catch" in componentPromise)) {
810
+ 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.`);
811
+ componentPromise = Promise.resolve(componentPromise);
812
+ }
813
+ guards.push(() => componentPromise.then((resolved) => {
814
+ if (!resolved) throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
815
+ const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
816
+ record.mods[name] = resolved;
817
+ record.components[name] = resolvedComponent;
818
+ const guard = (resolvedComponent.__vccOpts || resolvedComponent)[guardType];
819
+ return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
820
+ }));
821
+ }
822
+ }
823
+ }
824
+ return guards;
825
+ }
826
+ /**
827
+ * Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
828
+ *
829
+ * @param route - resolved route to load
830
+ */
831
+ function loadRouteLocation(route) {
832
+ 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) => {
833
+ const rawComponent = record.components[name];
834
+ if (typeof rawComponent === "function" && !("displayName" in rawComponent)) promises.push(rawComponent().then((resolved) => {
835
+ 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.`));
836
+ const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
837
+ record.mods[name] = resolved;
838
+ record.components[name] = resolvedComponent;
839
+ }));
840
+ return promises;
841
+ }, [])))).then(() => route);
842
+ }
843
+ /**
844
+ * Split the leaving, updating, and entering records.
845
+ * @internal
846
+ *
847
+ * @param to - Location we are navigating to
848
+ * @param from - Location we are navigating from
849
+ */
850
+ function extractChangingRecords(to, from) {
851
+ const leavingRecords = [];
852
+ const updatingRecords = [];
853
+ const enteringRecords = [];
854
+ const len = Math.max(from.matched.length, to.matched.length);
855
+ for (let i = 0; i < len; i++) {
856
+ const recordFrom = from.matched[i];
857
+ if (recordFrom) if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) updatingRecords.push(recordFrom);
858
+ else leavingRecords.push(recordFrom);
859
+ const recordTo = to.matched[i];
860
+ if (recordTo) {
861
+ if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) enteringRecords.push(recordTo);
862
+ }
863
+ }
864
+ return [
865
+ leavingRecords,
866
+ updatingRecords,
867
+ enteringRecords
868
+ ];
869
+ }
870
+
871
+ //#endregion
872
+ //#region src/devtools.ts
873
+ /**
874
+ * Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).
875
+ *
876
+ * @param routeLocation - routeLocation to format
877
+ * @param tooltip - optional tooltip
878
+ * @returns a copy of the routeLocation
879
+ */
880
+ function formatRouteLocation(routeLocation, tooltip) {
881
+ const copy = assign({}, routeLocation, { matched: routeLocation.matched.map((matched) => omit(matched, [
882
+ "instances",
883
+ "children",
884
+ "aliasOf"
885
+ ])) });
886
+ return { _custom: {
887
+ type: null,
888
+ readOnly: true,
889
+ display: routeLocation.fullPath,
890
+ tooltip,
891
+ value: copy
892
+ } };
893
+ }
894
+ function formatDisplay(display) {
895
+ return { _custom: { display } };
896
+ }
897
+ let routerId = 0;
898
+ function addDevtools(app, router, matcher) {
899
+ if (router.__hasDevtools) return;
900
+ router.__hasDevtools = true;
901
+ const id = routerId++;
902
+ setupDevtoolsPlugin({
903
+ id: "org.vuejs.router" + (id ? "." + id : ""),
904
+ label: "Vue Router",
905
+ packageName: "vue-router",
906
+ homepage: "https://router.vuejs.org",
907
+ logo: "https://router.vuejs.org/logo.png",
908
+ componentStateTypes: ["Routing"],
909
+ app
910
+ }, (api) => {
911
+ 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.");
912
+ api.on.inspectComponent((payload, ctx) => {
913
+ if (payload.instanceData) payload.instanceData.state.push({
914
+ type: "Routing",
915
+ key: "$route",
916
+ editable: false,
917
+ value: formatRouteLocation(router.currentRoute.value, "Current Route")
918
+ });
919
+ });
920
+ api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {
921
+ if (componentInstance.__vrv_devtools) {
922
+ const info = componentInstance.__vrv_devtools;
923
+ node.tags.push({
924
+ label: (info.name ? `${info.name.toString()}: ` : "") + info.path,
925
+ textColor: 0,
926
+ tooltip: "This component is rendered by &lt;router-view&gt;",
927
+ backgroundColor: PINK_500
928
+ });
929
+ }
930
+ if (isArray(componentInstance.__vrl_devtools)) {
931
+ componentInstance.__devtoolsApi = api;
932
+ componentInstance.__vrl_devtools.forEach((devtoolsData) => {
933
+ let label = devtoolsData.route.path;
934
+ let backgroundColor = ORANGE_400;
935
+ let tooltip = "";
936
+ let textColor = 0;
937
+ if (devtoolsData.error) {
938
+ label = devtoolsData.error;
939
+ backgroundColor = RED_100;
940
+ textColor = RED_700;
941
+ } else if (devtoolsData.isExactActive) {
942
+ backgroundColor = LIME_500;
943
+ tooltip = "This is exactly active";
944
+ } else if (devtoolsData.isActive) {
945
+ backgroundColor = BLUE_600;
946
+ tooltip = "This link is active";
947
+ }
948
+ node.tags.push({
949
+ label,
950
+ textColor,
951
+ tooltip,
952
+ backgroundColor
953
+ });
954
+ });
955
+ }
956
+ });
957
+ watch(router.currentRoute, () => {
958
+ refreshRoutesView();
959
+ api.notifyComponentUpdate();
960
+ api.sendInspectorTree(routerInspectorId);
961
+ api.sendInspectorState(routerInspectorId);
962
+ });
963
+ const navigationsLayerId = "router:navigations:" + id;
964
+ api.addTimelineLayer({
965
+ id: navigationsLayerId,
966
+ label: `Router${id ? " " + id : ""} Navigations`,
967
+ color: 4237508
968
+ });
969
+ router.onError((error, to) => {
970
+ api.addTimelineEvent({
971
+ layerId: navigationsLayerId,
972
+ event: {
973
+ title: "Error during Navigation",
974
+ subtitle: to.fullPath,
975
+ logType: "error",
976
+ time: api.now(),
977
+ data: { error },
978
+ groupId: to.meta.__navigationId
979
+ }
980
+ });
981
+ });
982
+ let navigationId = 0;
983
+ router.beforeEach((to, from) => {
984
+ const data = {
985
+ guard: formatDisplay("beforeEach"),
986
+ from: formatRouteLocation(from, "Current Location during this navigation"),
987
+ to: formatRouteLocation(to, "Target location")
988
+ };
989
+ Object.defineProperty(to.meta, "__navigationId", { value: navigationId++ });
990
+ api.addTimelineEvent({
991
+ layerId: navigationsLayerId,
992
+ event: {
993
+ time: api.now(),
994
+ title: "Start of navigation",
995
+ subtitle: to.fullPath,
996
+ data,
997
+ groupId: to.meta.__navigationId
998
+ }
999
+ });
1000
+ });
1001
+ router.afterEach((to, from, failure) => {
1002
+ const data = { guard: formatDisplay("afterEach") };
1003
+ if (failure) {
1004
+ data.failure = { _custom: {
1005
+ type: Error,
1006
+ readOnly: true,
1007
+ display: failure ? failure.message : "",
1008
+ tooltip: "Navigation Failure",
1009
+ value: failure
1010
+ } };
1011
+ data.status = formatDisplay("❌");
1012
+ } else data.status = formatDisplay("✅");
1013
+ data.from = formatRouteLocation(from, "Current Location during this navigation");
1014
+ data.to = formatRouteLocation(to, "Target location");
1015
+ api.addTimelineEvent({
1016
+ layerId: navigationsLayerId,
1017
+ event: {
1018
+ title: "End of navigation",
1019
+ subtitle: to.fullPath,
1020
+ time: api.now(),
1021
+ data,
1022
+ logType: failure ? "warning" : "default",
1023
+ groupId: to.meta.__navigationId
1024
+ }
1025
+ });
1026
+ });
1027
+ /**
1028
+ * Inspector of Existing routes
1029
+ */
1030
+ const routerInspectorId = "router-inspector:" + id;
1031
+ api.addInspector({
1032
+ id: routerInspectorId,
1033
+ label: "Routes" + (id ? " " + id : ""),
1034
+ icon: "book",
1035
+ treeFilterPlaceholder: "Search routes"
1036
+ });
1037
+ function refreshRoutesView() {
1038
+ if (!activeRoutesPayload) return;
1039
+ const payload = activeRoutesPayload;
1040
+ let routes = matcher.getRoutes().filter((route) => !route.parent || !route.parent.record.components);
1041
+ routes.forEach(resetMatchStateOnRouteRecord);
1042
+ if (payload.filter) routes = routes.filter((route) => isRouteMatching(route, payload.filter.toLowerCase()));
1043
+ routes.forEach((route) => markRouteRecordActive(route, router.currentRoute.value));
1044
+ payload.rootNodes = routes.map(formatRouteRecordForInspector);
1045
+ }
1046
+ let activeRoutesPayload;
1047
+ api.on.getInspectorTree((payload) => {
1048
+ activeRoutesPayload = payload;
1049
+ if (payload.app === app && payload.inspectorId === routerInspectorId) refreshRoutesView();
1050
+ });
1051
+ /**
1052
+ * Display information about the currently selected route record
1053
+ */
1054
+ api.on.getInspectorState((payload) => {
1055
+ if (payload.app === app && payload.inspectorId === routerInspectorId) {
1056
+ const route = matcher.getRoutes().find((route$1) => route$1.record.__vd_id === payload.nodeId);
1057
+ if (route) payload.state = { options: formatRouteRecordMatcherForStateInspector(route) };
1058
+ }
1059
+ });
1060
+ api.sendInspectorTree(routerInspectorId);
1061
+ api.sendInspectorState(routerInspectorId);
1062
+ });
1063
+ }
1064
+ function modifierForKey(key) {
1065
+ if (key.optional) return key.repeatable ? "*" : "?";
1066
+ else return key.repeatable ? "+" : "";
1067
+ }
1068
+ function formatRouteRecordMatcherForStateInspector(route) {
1069
+ const { record } = route;
1070
+ const fields = [{
1071
+ editable: false,
1072
+ key: "path",
1073
+ value: record.path
1074
+ }];
1075
+ if (record.name != null) fields.push({
1076
+ editable: false,
1077
+ key: "name",
1078
+ value: record.name
1079
+ });
1080
+ fields.push({
1081
+ editable: false,
1082
+ key: "regexp",
1083
+ value: route.re
1084
+ });
1085
+ if (route.keys.length) fields.push({
1086
+ editable: false,
1087
+ key: "keys",
1088
+ value: { _custom: {
1089
+ type: null,
1090
+ readOnly: true,
1091
+ display: route.keys.map((key) => `${key.name}${modifierForKey(key)}`).join(" "),
1092
+ tooltip: "Param keys",
1093
+ value: route.keys
1094
+ } }
1095
+ });
1096
+ if (record.redirect != null) fields.push({
1097
+ editable: false,
1098
+ key: "redirect",
1099
+ value: record.redirect
1100
+ });
1101
+ if (route.alias.length) fields.push({
1102
+ editable: false,
1103
+ key: "aliases",
1104
+ value: route.alias.map((alias) => alias.record.path)
1105
+ });
1106
+ if (Object.keys(route.record.meta).length) fields.push({
1107
+ editable: false,
1108
+ key: "meta",
1109
+ value: route.record.meta
1110
+ });
1111
+ fields.push({
1112
+ key: "score",
1113
+ editable: false,
1114
+ value: { _custom: {
1115
+ type: null,
1116
+ readOnly: true,
1117
+ display: route.score.map((score) => score.join(", ")).join(" | "),
1118
+ tooltip: "Score used to sort routes",
1119
+ value: route.score
1120
+ } }
1121
+ });
1122
+ return fields;
1123
+ }
1124
+ /**
1125
+ * Extracted from tailwind palette
1126
+ */
1127
+ const PINK_500 = 15485081;
1128
+ const BLUE_600 = 2450411;
1129
+ const LIME_500 = 8702998;
1130
+ const CYAN_400 = 2282478;
1131
+ const ORANGE_400 = 16486972;
1132
+ const DARK = 6710886;
1133
+ const RED_100 = 16704226;
1134
+ const RED_700 = 12131356;
1135
+ function formatRouteRecordForInspector(route) {
1136
+ const tags = [];
1137
+ const { record } = route;
1138
+ if (record.name != null) tags.push({
1139
+ label: String(record.name),
1140
+ textColor: 0,
1141
+ backgroundColor: CYAN_400
1142
+ });
1143
+ if (record.aliasOf) tags.push({
1144
+ label: "alias",
1145
+ textColor: 0,
1146
+ backgroundColor: ORANGE_400
1147
+ });
1148
+ if (route.__vd_match) tags.push({
1149
+ label: "matches",
1150
+ textColor: 0,
1151
+ backgroundColor: PINK_500
1152
+ });
1153
+ if (route.__vd_exactActive) tags.push({
1154
+ label: "exact",
1155
+ textColor: 0,
1156
+ backgroundColor: LIME_500
1157
+ });
1158
+ if (route.__vd_active) tags.push({
1159
+ label: "active",
1160
+ textColor: 0,
1161
+ backgroundColor: BLUE_600
1162
+ });
1163
+ if (record.redirect) tags.push({
1164
+ label: typeof record.redirect === "string" ? `redirect: ${record.redirect}` : "redirects",
1165
+ textColor: 16777215,
1166
+ backgroundColor: DARK
1167
+ });
1168
+ let id = record.__vd_id;
1169
+ if (id == null) {
1170
+ id = String(routeRecordId++);
1171
+ record.__vd_id = id;
1172
+ }
1173
+ return {
1174
+ id,
1175
+ label: record.path,
1176
+ tags,
1177
+ children: route.children.map(formatRouteRecordForInspector)
1178
+ };
1179
+ }
1180
+ let routeRecordId = 0;
1181
+ const EXTRACT_REGEXP_RE = /^\/(.*)\/([a-z]*)$/;
1182
+ function markRouteRecordActive(route, currentRoute) {
1183
+ const isExactActive = currentRoute.matched.length && isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);
1184
+ route.__vd_exactActive = route.__vd_active = isExactActive;
1185
+ if (!isExactActive) route.__vd_active = currentRoute.matched.some((match) => isSameRouteRecord(match, route.record));
1186
+ route.children.forEach((childRoute) => markRouteRecordActive(childRoute, currentRoute));
1187
+ }
1188
+ function resetMatchStateOnRouteRecord(route) {
1189
+ route.__vd_match = false;
1190
+ route.children.forEach(resetMatchStateOnRouteRecord);
1191
+ }
1192
+ function isRouteMatching(route, filter) {
1193
+ const found = String(route.re).match(EXTRACT_REGEXP_RE);
1194
+ route.__vd_match = false;
1195
+ if (!found || found.length < 3) return false;
1196
+ if (new RegExp(found[1].replace(/\$$/, ""), found[2]).test(filter)) {
1197
+ route.children.forEach((child) => isRouteMatching(child, filter));
1198
+ if (route.record.path !== "/" || filter === "/") {
1199
+ route.__vd_match = route.re.test(filter);
1200
+ return true;
1201
+ }
1202
+ return false;
1203
+ }
1204
+ const path = route.record.path.toLowerCase();
1205
+ const decodedPath = decode(path);
1206
+ if (!filter.startsWith("/") && (decodedPath.includes(filter) || path.includes(filter))) return true;
1207
+ if (decodedPath.startsWith(filter) || path.startsWith(filter)) return true;
1208
+ if (route.record.name && String(route.record.name).includes(filter)) return true;
1209
+ return route.children.some((child) => isRouteMatching(child, filter));
1210
+ }
1211
+ function omit(obj, keys) {
1212
+ const ret = {};
1213
+ for (const key in obj) if (!keys.includes(key)) ret[key] = obj[key];
1214
+ return ret;
1215
+ }
1216
+
1217
+ //#endregion
1218
+ export { ErrorTypes, NEW_stringifyURL, NavigationDirection, NavigationFailureType, NavigationType, START, START_LOCATION_NORMALIZED, addDevtools, applyToParams, assign, computeScrollPosition, createHref, createRouterError, decode, encodeHash, encodeParam, encodePath, extractChangingRecords, extractComponentsGuards, getSavedScrollPosition, getScrollKey, guardToPromiseFn, identityFn, isArray, isBrowser, isNavigationFailure, isRouteLocation, isRouteName, isSameRouteLocation, isSameRouteLocationParams, isSameRouteRecord, loadRouteLocation, matchedRouteKey, mergeOptions, noop, normalizeBase, normalizeQuery, onBeforeRouteLeave, onBeforeRouteUpdate, parseQuery, parseURL, resolveRelativePath, routeLocationKey, routerKey, routerViewLocationKey, saveScrollPosition, scrollToPosition, stringifyQuery, stringifyURL, stripBase, useCallbacks, viewDepthKey, warn$1 as warn };