@jasonshimmy/custom-elements-runtime 3.0.0 → 3.1.1

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 (68) hide show
  1. package/README.md +118 -81
  2. package/dist/custom-elements-runtime.cjs.js +3 -3
  3. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  4. package/dist/custom-elements-runtime.es.js +77 -72
  5. package/dist/custom-elements-runtime.es.js.map +1 -1
  6. package/dist/custom-elements-runtime.jit-css.cjs.js +1 -1
  7. package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -1
  8. package/dist/custom-elements-runtime.jit-css.es.js +25 -26
  9. package/dist/custom-elements-runtime.jit-css.es.js.map +1 -1
  10. package/dist/custom-elements-runtime.router.cjs.js +8 -8
  11. package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
  12. package/dist/custom-elements-runtime.router.es.js +134 -134
  13. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  14. package/dist/custom-elements-runtime.ssr-middleware.cjs.js +2 -0
  15. package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -0
  16. package/dist/custom-elements-runtime.ssr-middleware.es.js +69 -0
  17. package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -0
  18. package/dist/custom-elements-runtime.ssr.cjs.js +3 -1
  19. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
  20. package/dist/custom-elements-runtime.ssr.es.js +158 -39
  21. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  22. package/dist/custom-elements-runtime.vite-plugin.cjs.js +1 -1
  23. package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -1
  24. package/dist/custom-elements-runtime.vite-plugin.es.js +81 -49
  25. package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -1
  26. package/dist/hooks-x8M4knLc.cjs +6 -0
  27. package/dist/hooks-x8M4knLc.cjs.map +1 -0
  28. package/dist/hooks-xWZhQHco.js +1465 -0
  29. package/dist/hooks-xWZhQHco.js.map +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/namespace-helpers-D4wC2-qA.js +61 -0
  32. package/dist/namespace-helpers-D4wC2-qA.js.map +1 -0
  33. package/dist/namespace-helpers-ckeEOxpR.cjs +2 -0
  34. package/dist/namespace-helpers-ckeEOxpR.cjs.map +1 -0
  35. package/dist/router/matcher.d.ts +14 -0
  36. package/dist/runtime/component/factory.d.ts +16 -2
  37. package/dist/runtime/hydration.d.ts +33 -0
  38. package/dist/runtime/render.d.ts +0 -11
  39. package/dist/runtime/scheduler.d.ts +12 -0
  40. package/dist/runtime/ssr-context.d.ts +47 -0
  41. package/dist/runtime/ssr-utils.d.ts +9 -0
  42. package/dist/runtime/types.d.ts +18 -0
  43. package/dist/runtime/vdom-ssr-dsd.d.ts +82 -0
  44. package/dist/runtime/vdom-ssr.d.ts +2 -6
  45. package/dist/ssr-middleware.d.ts +125 -0
  46. package/dist/ssr.d.ts +95 -33
  47. package/dist/template-compiler-CTUhEHr8.cjs +22 -0
  48. package/dist/template-compiler-CTUhEHr8.cjs.map +1 -0
  49. package/dist/template-compiler-ZhSg1yPh.js +3724 -0
  50. package/dist/template-compiler-ZhSg1yPh.js.map +1 -0
  51. package/dist/vite-plugin.d.ts +94 -4
  52. package/package.json +6 -1
  53. package/dist/helpers-CweFZFWU.js +0 -987
  54. package/dist/helpers-CweFZFWU.js.map +0 -1
  55. package/dist/helpers-DeWjSmOl.cjs +0 -5
  56. package/dist/helpers-DeWjSmOl.cjs.map +0 -1
  57. package/dist/hooks-BrrLKSub.cjs +0 -3
  58. package/dist/hooks-BrrLKSub.cjs.map +0 -1
  59. package/dist/hooks-DyShDHKo.js +0 -403
  60. package/dist/hooks-DyShDHKo.js.map +0 -1
  61. package/dist/namespace-helpers-CnpZ5__p.js +0 -45
  62. package/dist/namespace-helpers-CnpZ5__p.js.map +0 -1
  63. package/dist/namespace-helpers-CyIDtI97.cjs +0 -2
  64. package/dist/namespace-helpers-CyIDtI97.cjs.map +0 -1
  65. package/dist/template-compiler-B5uN1EQw.js +0 -3731
  66. package/dist/template-compiler-B5uN1EQw.js.map +0 -1
  67. package/dist/template-compiler-Cx623BSB.cjs +0 -23
  68. package/dist/template-compiler-Cx623BSB.cjs.map +0 -1
@@ -1,7 +1,6 @@
1
- import { a as m, d as q } from "./logger-BvkEbVM4.js";
2
- import { f as nt, r as et, c as I } from "./helpers-CweFZFWU.js";
3
- import { c as it, h as U } from "./template-compiler-B5uN1EQw.js";
4
- import { l as lt, m as ut, b as St, o as Rt } from "./hooks-DyShDHKo.js";
1
+ import { a as g, d as q } from "./logger-BvkEbVM4.js";
2
+ import { j as nt, r as et, w as it, x as lt, b as St, z as Rt, d as I } from "./hooks-xWZhQHco.js";
3
+ import { c as ut, h as U } from "./template-compiler-ZhSg1yPh.js";
5
4
  import { createStore as ft } from "./custom-elements-runtime.store.es.js";
6
5
  import { match as $t } from "./custom-elements-runtime.directives.es.js";
7
6
  const ht = {
@@ -36,23 +35,23 @@ function xt(t) {
36
35
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
37
36
  }
38
37
  function Pt(t) {
39
- const r = t.path || "/", g = C(r), a = g === "/" ? [] : g.split("/").filter(Boolean), c = [], o = [];
38
+ const r = t.path || "/", d = C(r), a = d === "/" ? [] : d.split("/").filter(Boolean), c = [], o = [];
40
39
  for (let i = 0; i < a.length; i++) {
41
40
  const l = a[i];
42
41
  if (l === "*") {
43
42
  if (i !== a.length - 1)
44
- return m(
43
+ return g(
45
44
  `Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`
46
45
  ), { invalid: !0 };
47
46
  const A = `splat${c.length}`;
48
47
  c.push(A), o.push("__SPLAT__");
49
48
  continue;
50
49
  }
51
- const d = l.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
52
- if (d) {
53
- const A = d[1], x = !!d[2];
50
+ const y = l.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
51
+ if (y) {
52
+ const A = y[1], x = !!y[2];
54
53
  if (x && i !== a.length - 1)
55
- return m(
54
+ return g(
56
55
  `Route '${t.path}' contains a splat param ':${A}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`
57
56
  ), { invalid: !0 };
58
57
  c.push(A), o.push(x ? "__SPLAT__" : "([^/]+)");
@@ -71,20 +70,20 @@ function Pt(t) {
71
70
  try {
72
71
  return { regex: new RegExp(w), paramNames: c };
73
72
  } catch (i) {
74
- return m(`Failed to compile route regex for '${t.path}': ${String(i)}`), { invalid: !0 };
73
+ return g(`Failed to compile route regex for '${t.path}': ${String(i)}`), { invalid: !0 };
75
74
  }
76
75
  }
77
76
  const Q = (t, r) => {
78
- const g = C(r);
77
+ const d = C(r);
79
78
  for (const a of t) {
80
79
  let c = dt.get(a);
81
80
  if (c || (c = Pt(a), dt.set(a, c)), c.invalid) continue;
82
- const { regex: o, paramNames: w } = c, i = o.exec(g);
81
+ const { regex: o, paramNames: w } = c, i = o.exec(d);
83
82
  if (i) {
84
83
  const l = {};
85
- for (let d = 0; d < w.length; d++) {
86
- const A = i[d + 1] || "";
87
- l[w[d]] = A ? Ct(A) : "";
84
+ for (let y = 0; y < w.length; y++) {
85
+ const A = i[y + 1] || "";
86
+ l[w[y]] = A ? Ct(A) : "";
88
87
  }
89
88
  return { route: a, params: l };
90
89
  }
@@ -92,12 +91,13 @@ const Q = (t, r) => {
92
91
  return { route: null, params: {} };
93
92
  };
94
93
  function rt(t, r) {
95
- for (const g of t)
96
- if (Q([g], r).route !== null) return g;
94
+ for (const d of t)
95
+ if (Q([d], r).route !== null) return d;
97
96
  return null;
98
97
  }
99
- function Wt(t, r) {
100
- return Q(t, r);
98
+ function Ut(t, r) {
99
+ const d = r.split("?")[0].split("#")[0];
100
+ return Q(t, d);
101
101
  }
102
102
  const yt = 50;
103
103
  let J = {}, B = {};
@@ -107,13 +107,13 @@ function kt() {
107
107
  function _t() {
108
108
  const t = Object.entries(J);
109
109
  if (t.length <= yt) return;
110
- const g = t.sort(
110
+ const d = t.sort(
111
111
  ([, a], [, c]) => a.lastAccessed - c.lastAccessed
112
112
  ).slice(
113
113
  0,
114
114
  t.length - yt
115
115
  );
116
- for (const [a] of g)
116
+ for (const [a] of d)
117
117
  delete J[a];
118
118
  }
119
119
  async function qt(t) {
@@ -124,7 +124,7 @@ async function qt(t) {
124
124
  return r.lastAccessed = Date.now(), r.component;
125
125
  if (B[t.path] !== void 0)
126
126
  return B[t.path];
127
- const g = typeof window > "u";
127
+ const d = typeof window > "u";
128
128
  try {
129
129
  const a = t.load().then((c) => {
130
130
  _t();
@@ -136,7 +136,7 @@ async function qt(t) {
136
136
  }).catch((c) => {
137
137
  delete B[t.path];
138
138
  const o = c instanceof Error ? c.message : String(c);
139
- throw g && q(
139
+ throw d && q(
140
140
  `SSR component load failed for route: ${t.path}. ${o}`
141
141
  ), new Error(
142
142
  `Failed to load component for route: ${t.path}. ${o}`
@@ -153,12 +153,12 @@ async function qt(t) {
153
153
  }
154
154
  throw new Error(`No component or loader defined for route: ${t.path}`);
155
155
  }
156
- let y = null;
156
+ let m = null;
157
157
  function Tt(t) {
158
- y = t;
158
+ m = t;
159
159
  }
160
160
  function mt() {
161
- return y;
161
+ return m;
162
162
  }
163
163
  const K = /* @__PURE__ */ new Set();
164
164
  let z = null;
@@ -170,33 +170,33 @@ function bt() {
170
170
  }
171
171
  z = null;
172
172
  }
173
- if (y)
173
+ if (m)
174
174
  try {
175
175
  let t = !1;
176
- z = y.subscribe((r) => {
176
+ z = m.subscribe((r) => {
177
177
  t = !0;
178
- for (const g of K)
178
+ for (const d of K)
179
179
  try {
180
- g(r);
180
+ d(r);
181
181
  } catch {
182
182
  }
183
183
  });
184
184
  try {
185
- E.base = y.base;
185
+ E.base = m.base;
186
186
  } catch {
187
187
  }
188
188
  if (t) {
189
- const r = y.getCurrent();
190
- for (const g of K)
189
+ const r = m.getCurrent();
190
+ for (const d of K)
191
191
  try {
192
- g(r);
192
+ d(r);
193
193
  } catch {
194
194
  }
195
195
  } else {
196
- const r = y.getCurrent();
197
- for (const g of K)
196
+ const r = m.getCurrent();
197
+ for (const d of K)
198
198
  try {
199
- g(r);
199
+ d(r);
200
200
  } catch {
201
201
  }
202
202
  }
@@ -214,7 +214,7 @@ function It() {
214
214
  const E = {
215
215
  store: {
216
216
  subscribe(t) {
217
- if (y) return y.store.subscribe(t);
217
+ if (m) return m.store.subscribe(t);
218
218
  try {
219
219
  t({ path: "/", params: {}, query: {} });
220
220
  } catch {
@@ -223,12 +223,12 @@ const E = {
223
223
  };
224
224
  },
225
225
  getState() {
226
- return y ? y.getCurrent() : { path: "/", params: {}, query: {} };
226
+ return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
227
227
  },
228
228
  setState(t) {
229
- if (y)
229
+ if (m)
230
230
  try {
231
- y.store.setState(
231
+ m.store.setState(
232
232
  t
233
233
  );
234
234
  } catch {
@@ -237,23 +237,23 @@ const E = {
237
237
  },
238
238
  subscribe(t) {
239
239
  if (typeof t != "function")
240
- return m("activeRouterProxy.subscribe: listener must be a function"), () => {
240
+ return g("activeRouterProxy.subscribe: listener must be a function"), () => {
241
241
  };
242
- if (K.add(t), y)
242
+ if (K.add(t), m)
243
243
  if (!z)
244
244
  bt();
245
245
  else
246
246
  try {
247
- const r = y.getCurrent();
247
+ const r = m.getCurrent();
248
248
  r && t(r);
249
249
  } catch (r) {
250
- m("activeRouterProxy subscription failed", r);
250
+ g("activeRouterProxy subscription failed", r);
251
251
  }
252
252
  else
253
253
  try {
254
254
  t({ path: "/", params: {}, query: {} });
255
255
  } catch (r) {
256
- m("activeRouterProxy fallback state delivery failed", r);
256
+ g("activeRouterProxy fallback state delivery failed", r);
257
257
  }
258
258
  return () => {
259
259
  try {
@@ -261,47 +261,47 @@ const E = {
261
261
  try {
262
262
  z();
263
263
  } catch (r) {
264
- m("activeRouterProxy inner unsubscribe failed", r);
264
+ g("activeRouterProxy inner unsubscribe failed", r);
265
265
  }
266
266
  z = null;
267
267
  }
268
268
  } catch (r) {
269
- m("activeRouterProxy unsubscribe failed", r);
269
+ g("activeRouterProxy unsubscribe failed", r);
270
270
  }
271
271
  };
272
272
  },
273
273
  getCurrent() {
274
- return y ? y.getCurrent() : { path: "/", params: {}, query: {} };
274
+ return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
275
275
  },
276
276
  async push(t) {
277
- return y ? y.push(t) : Promise.resolve();
277
+ return m ? m.push(t) : Promise.resolve();
278
278
  },
279
279
  async replace(t) {
280
- return y ? y.replace(t) : Promise.resolve();
280
+ return m ? m.replace(t) : Promise.resolve();
281
281
  },
282
282
  back() {
283
- if (y)
284
- return y.back();
283
+ if (m)
284
+ return m.back();
285
285
  },
286
286
  matchRoute(t) {
287
- return y ? y.matchRoute(t) : { route: null, params: {} };
287
+ return m ? m.matchRoute(t) : { route: null, params: {} };
288
288
  },
289
289
  resolveRouteComponent(t) {
290
- return y ? y.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
290
+ return m ? m.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
291
291
  },
292
292
  base: "",
293
293
  scrollToFragment(t) {
294
- return y ? y.scrollToFragment(t) : Promise.resolve(!1);
294
+ return m ? m.scrollToFragment(t) : Promise.resolve(!1);
295
295
  },
296
296
  destroy() {
297
- y && y.destroy();
297
+ m && m.destroy();
298
298
  }
299
299
  };
300
300
  function Mt(t) {
301
- const { routes: r, base: g = "", initialUrl: a, scrollToFragment: c = !0 } = t, o = At(g), w = typeof c == "boolean" ? { ...ht, enabled: c } : { ...ht, ...c };
302
- let i, l, d, A, x, F, V, X = () => {
301
+ const { routes: r, base: d = "", initialUrl: a, scrollToFragment: c = !0 } = t, o = At(d), w = typeof c == "boolean" ? { ...ht, enabled: c } : { ...ht, ...c };
302
+ let i, l, y, A, x, F, V, X = () => {
303
303
  };
304
- const T = /* @__PURE__ */ new Set(), W = 10;
304
+ const T = /* @__PURE__ */ new Set(), j = 10;
305
305
  let k = 0;
306
306
  const G = async (s, u) => {
307
307
  const e = rt(r, s.path);
@@ -310,13 +310,13 @@ function Mt(t) {
310
310
  const n = await e.beforeEnter(s, u);
311
311
  if (typeof n == "string") {
312
312
  const h = `${s.path}->${n}`;
313
- return T.has(h) || k >= W ? (q(`Redirect loop detected: ${h}`), !1) : n;
313
+ return T.has(h) || k >= j ? (q(`Redirect loop detected: ${h}`), !1) : n;
314
314
  }
315
315
  return n !== !1;
316
316
  } catch (n) {
317
317
  q("beforeEnter error", n);
318
318
  try {
319
- d.setState(u);
319
+ y.setState(u);
320
320
  } catch {
321
321
  }
322
322
  throw n;
@@ -328,13 +328,13 @@ function Mt(t) {
328
328
  const n = await e.onEnter(s, u);
329
329
  if (typeof n == "string") {
330
330
  const h = `${s.path}->${n}`;
331
- return T.has(h) || k >= W ? (q(`Redirect loop detected: ${h}`), !1) : n;
331
+ return T.has(h) || k >= j ? (q(`Redirect loop detected: ${h}`), !1) : n;
332
332
  }
333
333
  return n !== !1;
334
334
  } catch (n) {
335
335
  q("onEnter error", n);
336
336
  try {
337
- d.setState(u);
337
+ y.setState(u);
338
338
  } catch {
339
339
  }
340
340
  throw n;
@@ -350,12 +350,12 @@ function Mt(t) {
350
350
  } catch (n) {
351
351
  q("afterEnter error", n);
352
352
  }
353
- }, P = /* @__PURE__ */ new Map(), j = 100, M = (s) => {
353
+ }, P = /* @__PURE__ */ new Map(), W = 100, M = (s) => {
354
354
  if (P.has(s))
355
355
  return P.get(s);
356
356
  const u = Q(r, s);
357
- if (P.size >= j) {
358
- const e = Math.floor(j * 0.25), n = Array.from(P.keys());
357
+ if (P.size >= W) {
358
+ const e = Math.floor(W * 0.25), n = Array.from(P.keys());
359
359
  for (let h = 0; h < e && h < n.length; h++)
360
360
  P.delete(n[h]);
361
361
  }
@@ -416,25 +416,25 @@ function Mt(t) {
416
416
  return S(!0);
417
417
  b = requestAnimationFrame(N);
418
418
  } catch (wt) {
419
- m("Scroll retry attempt failed:", wt), b = requestAnimationFrame(N);
419
+ g("Scroll retry attempt failed:", wt), b = requestAnimationFrame(N);
420
420
  }
421
421
  };
422
422
  b = requestAnimationFrame(N);
423
423
  } catch (N) {
424
- m("Initial scroll attempt failed:", N), S(!1);
424
+ g("Initial scroll attempt failed:", N), S(!1);
425
425
  }
426
426
  };
427
427
  v = setTimeout(() => {
428
428
  S(!1);
429
429
  }, e), D().catch((N) => {
430
- m("Scroll attempt failed:", N), S(!1);
430
+ g("Scroll attempt failed:", N), S(!1);
431
431
  });
432
432
  });
433
433
  }
434
434
  let f = !1;
435
435
  const _ = async (s, u = !1) => {
436
436
  if (f) {
437
- m(`Navigation to ${s} blocked - navigation already in progress`);
437
+ g(`Navigation to ${s} blocked - navigation already in progress`);
438
438
  return;
439
439
  }
440
440
  f = !0, k = 0, T.clear();
@@ -454,7 +454,7 @@ function Mt(t) {
454
454
  try {
455
455
  const e = O(s), n = M(e.path);
456
456
  if (!n.route) throw new Error(`No route found for ${e.path}`);
457
- const h = d.getState(), v = {
457
+ const h = y.getState(), v = {
458
458
  path: e.path,
459
459
  params: n.params,
460
460
  query: e.query,
@@ -479,7 +479,7 @@ function Mt(t) {
479
479
  const S = Et(e.query), D = o + e.path + (S || "") + (e.fragment ? "#" + e.fragment : "");
480
480
  u ? window.history.replaceState({}, "", D) : window.history.pushState({}, "", D);
481
481
  }
482
- if (d.setState(v), Y(v, h), typeof window < "u" && typeof document < "u")
482
+ if (y.setState(v), Y(v, h), typeof window < "u" && typeof document < "u")
483
483
  try {
484
484
  const S = v.fragment;
485
485
  w.enabled && S && R(
@@ -494,14 +494,14 @@ function Mt(t) {
494
494
  if (q("Navigation error:", e), e instanceof Error && (e.stack?.includes("runBeforeEnter") || e.stack?.includes("runOnEnter")))
495
495
  throw e;
496
496
  try {
497
- const n = d.getState();
497
+ const n = y.getState();
498
498
  if (!Q(r, n.path).route) {
499
499
  let v = r.find((b) => b.path === "/");
500
500
  if (v || (v = r.find(
501
501
  (b) => !b.path.includes(":") && !b.path.includes("*")
502
502
  )), !v && r.length > 0 && (v = r[0]), v) {
503
503
  const b = Q(r, v.path);
504
- d.setState({
504
+ y.setState({
505
505
  path: v.path,
506
506
  params: b.params,
507
507
  query: {}
@@ -510,7 +510,7 @@ function Mt(t) {
510
510
  q("No fallback route available for error recovery");
511
511
  }
512
512
  } catch (n) {
513
- m(
513
+ g(
514
514
  "State recovery failed during navigation error:",
515
515
  n
516
516
  );
@@ -524,13 +524,13 @@ function Mt(t) {
524
524
  for (const e of s) {
525
525
  if (!e.path)
526
526
  return q("Router configuration error: Route missing path", e), !1;
527
- u.has(e.path) && m(`Duplicate route path detected: ${e.path}`), u.add(e.path), !e.component && !e.load && m(`Route '${e.path}' has no component or load function`);
527
+ u.has(e.path) && g(`Duplicate route path detected: ${e.path}`), u.add(e.path), !e.component && !e.load && g(`Route '${e.path}' has no component or load function`);
528
528
  }
529
529
  return !0;
530
530
  })(r), typeof window > "u" || typeof a < "u") {
531
531
  for (const s of r)
532
532
  M(s.path);
533
- m(`Pre-compiled ${r.length} routes for SSR`);
533
+ g(`Pre-compiled ${r.length} routes for SSR`);
534
534
  }
535
535
  if (typeof window < "u" && typeof document < "u" && typeof a > "u") {
536
536
  i = () => {
@@ -538,11 +538,11 @@ function Mt(t) {
538
538
  const e = new URL(window.location.href), n = e.pathname, h = n.startsWith(o) ? n.slice(o.length) : n, v = C(h || "/"), b = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
539
539
  return { path: v, query: b, fragment: $ };
540
540
  } catch (e) {
541
- return m("Invalid URL detected, falling back to safe defaults", e), { path: "/", query: {}, fragment: "" };
541
+ return g("Invalid URL detected, falling back to safe defaults", e), { path: "/", query: {}, fragment: "" };
542
542
  }
543
543
  }, l = i();
544
544
  const s = M(l.path);
545
- d = ft({
545
+ y = ft({
546
546
  path: l.path,
547
547
  params: s.params,
548
548
  query: l.query,
@@ -559,14 +559,14 @@ function Mt(t) {
559
559
  const e = new URL(a || "/", "http://localhost"), n = e.pathname, h = n.startsWith(o) ? n.slice(o.length) : n, v = C(h || "/"), b = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
560
560
  return { path: v, query: b, fragment: $ };
561
561
  } catch (e) {
562
- return m(
562
+ return g(
563
563
  "Invalid SSR URL detected, falling back to safe defaults",
564
564
  e
565
565
  ), { path: "/", query: {}, fragment: "" };
566
566
  }
567
567
  }, l = i();
568
568
  const s = M(l.path);
569
- d = ft({
569
+ y = ft({
570
570
  path: l.path,
571
571
  params: s.params,
572
572
  query: l.query,
@@ -576,14 +576,14 @@ function Mt(t) {
576
576
  await u(e.path);
577
577
  };
578
578
  const u = async (e) => {
579
- if (k++, k > W) {
579
+ if (k++, k > j) {
580
580
  q(`SSR redirect depth exceeded for path: ${e}`);
581
581
  return;
582
582
  }
583
583
  try {
584
584
  const n = O(e), h = M(n.path);
585
585
  if (!h.route) throw new Error(`No route found for ${n.path}`);
586
- const v = d.getState(), b = {
586
+ const v = y.getState(), b = {
587
587
  path: n.path,
588
588
  params: h.params,
589
589
  query: n.query,
@@ -607,7 +607,7 @@ function Mt(t) {
607
607
  }
608
608
  if (S === !1) return;
609
609
  }
610
- d.setState(b), $?.afterEnter && $.afterEnter(b, v);
610
+ y.setState(b), $?.afterEnter && $.afterEnter(b, v);
611
611
  } catch (n) {
612
612
  throw q("SSR navigation error:", n), n;
613
613
  }
@@ -618,19 +618,19 @@ function Mt(t) {
618
618
  return {
619
619
  _cleanupScrollState: tt,
620
620
  destroy: X,
621
- store: d,
621
+ store: y,
622
622
  push: x,
623
623
  replace: F,
624
624
  back: V,
625
- subscribe: d.subscribe,
625
+ subscribe: y.subscribe,
626
626
  matchRoute: (s) => M(s),
627
- getCurrent: () => d.getState(),
627
+ getCurrent: () => y.getState(),
628
628
  resolveRouteComponent: qt,
629
629
  base: o,
630
630
  // Public API: allow components or tests to explicitly request scrolling to
631
631
  // a fragment when they know their DOM is ready. Returns true if scrolled.
632
632
  scrollToFragment: (s) => {
633
- const u = s || d.getState().fragment;
633
+ const u = s || y.getState().fragment;
634
634
  return !u || typeof window > "u" || typeof document > "u" ? Promise.resolve(!1) : R(
635
635
  u,
636
636
  w.offset,
@@ -641,14 +641,14 @@ function Mt(t) {
641
641
  }
642
642
  function jt(t) {
643
643
  kt();
644
- const r = Mt(t), g = mt();
645
- if (g) {
644
+ const r = Mt(t), d = mt();
645
+ if (d) {
646
646
  try {
647
- g.destroy();
647
+ d.destroy();
648
648
  } catch {
649
649
  }
650
650
  try {
651
- g._cleanupScrollState?.();
651
+ d._cleanupScrollState?.();
652
652
  } catch {
653
653
  }
654
654
  }
@@ -670,17 +670,17 @@ function jt(t) {
670
670
  }
671
671
  } catch {
672
672
  }
673
- return it("router-view", async () => {
673
+ return ut("router-view", async () => {
674
674
  if (!mt()) return U`<div>Router not initialized.</div>`;
675
675
  const a = et(E.getCurrent()), c = typeof window > "u";
676
676
  let o;
677
- c || (lt(() => {
677
+ c || (it(() => {
678
678
  try {
679
679
  typeof E.subscribe == "function" && (o = E.subscribe((i) => {
680
680
  try {
681
- i && typeof i == "object" && typeof i.path == "string" ? a.value = i : (m("router-view received invalid state", i), a.value = { path: "/", params: {}, query: {} });
681
+ i && typeof i == "object" && typeof i.path == "string" ? a.value = i : (g("router-view received invalid state", i), a.value = { path: "/", params: {}, query: {} });
682
682
  } catch (l) {
683
- m("router-view subscription update failed", l);
683
+ g("router-view subscription update failed", l);
684
684
  try {
685
685
  a.value = { path: "/", params: {}, query: {} };
686
686
  } catch {
@@ -688,14 +688,14 @@ function jt(t) {
688
688
  }
689
689
  }));
690
690
  } catch (i) {
691
- m("router-view subscribe failed", i);
691
+ g("router-view subscribe failed", i);
692
692
  }
693
- }), ut(() => {
693
+ }), lt(() => {
694
694
  if (typeof o == "function") {
695
695
  try {
696
696
  o();
697
697
  } catch (i) {
698
- m("router-view unsubscribe failed", i);
698
+ g("router-view unsubscribe failed", i);
699
699
  }
700
700
  o = void 0;
701
701
  }
@@ -709,14 +709,14 @@ function jt(t) {
709
709
  if (typeof l == "string")
710
710
  return { tag: l, props: {}, children: [] };
711
711
  if (typeof l == "function") {
712
- const d = l();
713
- return (d instanceof Promise ? d : Promise.resolve(d)).then((x) => typeof x == "string" ? { tag: x, props: {}, children: [] } : x);
712
+ const y = l();
713
+ return (y instanceof Promise ? y : Promise.resolve(y)).then((x) => typeof x == "string" ? { tag: x, props: {}, children: [] } : x);
714
714
  }
715
715
  return U`<div>Invalid route component</div>`;
716
716
  } catch {
717
717
  return U`<div>Invalid route component</div>`;
718
718
  }
719
- }), it("router-link", () => {
719
+ }), ut("router-link", () => {
720
720
  const a = St({
721
721
  to: "",
722
722
  tag: "a",
@@ -743,19 +743,19 @@ function jt(t) {
743
743
  ),
744
744
  isExternal: Z(i) || !!a.external
745
745
  } : null;
746
- let d;
746
+ let y;
747
747
  Rt(() => "a,button{display:inline-block;}");
748
748
  const A = et(a.class || ""), x = et(a.style || "");
749
749
  if (!c) {
750
750
  let p = null;
751
- lt((R) => {
751
+ it((R) => {
752
752
  try {
753
753
  if (typeof E.subscribe == "function") {
754
- d = E.subscribe((f) => {
754
+ y = E.subscribe((f) => {
755
755
  try {
756
- f && typeof f == "object" && typeof f.path == "string" ? o.value = f : (m("router-link received invalid state", f), o.value = { path: "/", params: {}, query: {} });
756
+ f && typeof f == "object" && typeof f.path == "string" ? o.value = f : (g("router-link received invalid state", f), o.value = { path: "/", params: {}, query: {} });
757
757
  } catch (_) {
758
- m("router-link subscription update failed", _);
758
+ g("router-link subscription update failed", _);
759
759
  try {
760
760
  o.value = { path: "/", params: {}, query: {} };
761
761
  } catch {
@@ -766,7 +766,7 @@ function jt(t) {
766
766
  const f = E.getCurrent();
767
767
  f && typeof f.path == "string" && (o.value = f);
768
768
  } catch (f) {
769
- m("router-link initial state sync failed", f);
769
+ g("router-link initial state sync failed", f);
770
770
  }
771
771
  p = setInterval(() => {
772
772
  try {
@@ -777,7 +777,7 @@ function jt(t) {
777
777
  }, 100);
778
778
  }
779
779
  } catch (f) {
780
- m("router-link subscribe failed", f);
780
+ g("router-link subscribe failed", f);
781
781
  }
782
782
  try {
783
783
  const f = R?._host;
@@ -794,22 +794,22 @@ function jt(t) {
794
794
  }
795
795
  }
796
796
  } catch (f) {
797
- m("router-link host migration failed", f);
797
+ g("router-link host migration failed", f);
798
798
  }
799
- }), ut(() => {
800
- if (typeof d == "function")
799
+ }), lt(() => {
800
+ if (typeof y == "function")
801
801
  try {
802
- d();
802
+ y();
803
803
  } catch (R) {
804
- m("router-link unsubscribe failed", R);
804
+ g("router-link unsubscribe failed", R);
805
805
  } finally {
806
- d = void 0;
806
+ y = void 0;
807
807
  }
808
808
  if (p)
809
809
  try {
810
810
  clearInterval(p);
811
811
  } catch (R) {
812
- m("router-link sync interval cleanup failed", R);
812
+ g("router-link sync interval cleanup failed", R);
813
813
  } finally {
814
814
  p = null;
815
815
  }
@@ -822,7 +822,7 @@ function jt(t) {
822
822
  const p = E.base ?? "", R = a.to || "";
823
823
  return !o.value || typeof o.value.path != "string" ? !1 : gt(o.value.path, R, p);
824
824
  } catch (p) {
825
- return m("isExactActive computation error", p), !1;
825
+ return g("isExactActive computation error", p), !1;
826
826
  }
827
827
  }), V = I(() => {
828
828
  if (c && l)
@@ -831,7 +831,7 @@ function jt(t) {
831
831
  const p = E.base ?? "", R = a.to || "";
832
832
  return !o.value || typeof o.value.path != "string" ? !1 : a.exact ? F.value : vt(o.value.path, R, p);
833
833
  } catch (p) {
834
- return m("isActive computation error", p), !1;
834
+ return g("isActive computation error", p), !1;
835
835
  }
836
836
  }), X = I(() => {
837
837
  const p = String(a.to || "");
@@ -849,15 +849,15 @@ function jt(t) {
849
849
  const R = (A && A.value || a.class || "").split(/\s+/).filter(Boolean), f = {};
850
850
  for (const _ of R) f[_] = !0;
851
851
  return f;
852
- }), W = I(() => ({
852
+ }), j = I(() => ({
853
853
  ...T.value,
854
854
  [a.activeClass || "active"]: V.value,
855
855
  [a.exactActiveClass || "exact-active"]: F.value
856
856
  })), k = I(
857
- () => Object.keys(W.value).filter((p) => W.value[p]).join(" ")
857
+ () => Object.keys(j.value).filter((p) => j.value[p]).join(" ")
858
858
  ), G = I(() => a.tag || "a"), at = I(() => G.value === "button"), Y = I(
859
859
  () => F.value ? a.ariaCurrentValue : null
860
- ), P = I(() => !!a.disabled), j = I(() => {
860
+ ), P = I(() => !!a.disabled), W = I(() => {
861
861
  const p = String(a.to || "");
862
862
  return (Z(p) || !!a.external) && G.value === "a";
863
863
  }), M = I(
@@ -875,10 +875,10 @@ function jt(t) {
875
875
  p.preventDefault();
876
876
  } catch {
877
877
  }
878
- m("Blocked unsafe javascript: URI in router-link.to");
878
+ g("Blocked unsafe javascript: URI in router-link.to");
879
879
  return;
880
880
  }
881
- j.value || (p.preventDefault(), a.replace ? E.replace(a.to) : E.push(a.to));
881
+ W.value || (p.preventDefault(), a.replace ? E.replace(a.to) : E.push(a.to));
882
882
  };
883
883
  return U`
884
884
  ${$t().when(
@@ -906,8 +906,8 @@ function jt(t) {
906
906
  aria-current="${Y.value}"
907
907
  aria-disabled="${P.value ? "true" : null}"
908
908
  tabindex="${P.value ? "-1" : null}"
909
- target="${j.value ? "_blank" : null}"
910
- rel="${j.value ? "noopener noreferrer" : null}"
909
+ target="${W.value ? "_blank" : null}"
910
+ rel="${W.value ? "noopener noreferrer" : null}"
911
911
  @click="${tt}"
912
912
  ><slot></slot
913
913
  ></a>
@@ -915,21 +915,21 @@ function jt(t) {
915
915
  `;
916
916
  }), r;
917
917
  }
918
- function gt(t, r, g) {
918
+ function gt(t, r, d) {
919
919
  if (Z(r)) return !1;
920
920
  let c = (r.split("#")[0] || "/").split("?")[0];
921
- if (g && g !== "/") {
922
- const i = C(g), l = C(c);
921
+ if (d && d !== "/") {
922
+ const i = C(d), l = C(c);
923
923
  l.startsWith(i) ? c = l.slice(i.length) || "/" : c = l;
924
924
  }
925
925
  const o = C(t), w = C(c);
926
926
  return o === w;
927
927
  }
928
- function vt(t, r, g) {
928
+ function vt(t, r, d) {
929
929
  if (Z(r)) return !1;
930
930
  let c = (r.split("#")[0] || "/").split("?")[0];
931
- if (g && g !== "/") {
932
- const i = C(g), l = C(c);
931
+ if (d && d !== "/") {
932
+ const i = C(d), l = C(c);
933
933
  l.startsWith(i) ? c = l.slice(i.length) || "/" : c = l;
934
934
  }
935
935
  const o = C(t), w = C(c);
@@ -945,7 +945,7 @@ export {
945
945
  Z as isAbsoluteUrl,
946
946
  pt as isDangerousScheme,
947
947
  Q as matchRoute,
948
- Wt as matchRouteSSR,
948
+ Ut as matchRouteSSR,
949
949
  C as normalizePathForRoute,
950
950
  st as parseQuery,
951
951
  qt as resolveRouteComponent,