@jasonshimmy/custom-elements-runtime 3.1.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements-runtime.cjs.js +1 -1
- package/dist/custom-elements-runtime.es.js +3 -3
- package/dist/custom-elements-runtime.jit-css.cjs.js +1 -1
- package/dist/custom-elements-runtime.jit-css.es.js +2 -2
- package/dist/custom-elements-runtime.router.cjs.js +14 -14
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +469 -468
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js +3 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.es.js +44 -42
- package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +2 -2
- package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +5 -4
- package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
- package/dist/{hooks-xWZhQHco.js → hooks-BH-CpUun.js} +223 -214
- package/dist/hooks-BH-CpUun.js.map +1 -0
- package/dist/hooks-NOFG9QRQ.cjs +6 -0
- package/dist/hooks-NOFG9QRQ.cjs.map +1 -0
- package/dist/runtime/ssr-context.d.ts +1 -13
- package/dist/runtime/vdom-ssr-dsd.d.ts +14 -0
- package/dist/ssr-middleware.d.ts +18 -2
- package/dist/ssr.d.ts +3 -4
- package/dist/template-compiler-CDvhsHia.cjs +22 -0
- package/dist/template-compiler-CDvhsHia.cjs.map +1 -0
- package/dist/{template-compiler-ZhSg1yPh.js → template-compiler-DiE69FLO.js} +4 -4
- package/dist/template-compiler-DiE69FLO.js.map +1 -0
- package/package.json +1 -1
- package/dist/hooks-x8M4knLc.cjs +0 -6
- package/dist/hooks-x8M4knLc.cjs.map +0 -1
- package/dist/hooks-xWZhQHco.js.map +0 -1
- package/dist/template-compiler-CTUhEHr8.cjs +0 -22
- package/dist/template-compiler-CTUhEHr8.cjs.map +0 -1
- package/dist/template-compiler-ZhSg1yPh.js.map +0 -1
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { j as nt, r as et, w as it, x as lt, b as
|
|
3
|
-
import { c as ut, h as
|
|
1
|
+
import { a as m, d as k } from "./logger-BvkEbVM4.js";
|
|
2
|
+
import { j as nt, g as St, r as et, w as it, x as lt, b as Rt, z as Et, d as M } from "./hooks-BH-CpUun.js";
|
|
3
|
+
import { c as ut, h as j } from "./template-compiler-DiE69FLO.js";
|
|
4
4
|
import { createStore as ft } from "./custom-elements-runtime.store.es.js";
|
|
5
5
|
import { match as $t } from "./custom-elements-runtime.directives.es.js";
|
|
6
6
|
const ht = {
|
|
7
7
|
enabled: !0,
|
|
8
8
|
offset: 0,
|
|
9
9
|
timeoutMs: 2e3
|
|
10
|
-
}, st = (t) => t ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(t)) : {},
|
|
10
|
+
}, st = (t) => t ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(t)) : {}, Ct = (t) => {
|
|
11
11
|
if (!t || Object.keys(t).length === 0) return "";
|
|
12
12
|
try {
|
|
13
13
|
return "?" + new URLSearchParams(t).toString();
|
|
14
14
|
} catch {
|
|
15
15
|
return "";
|
|
16
16
|
}
|
|
17
|
-
}, pt = (t) => t ? /^\s*javascript\s*:/i.test(t) : !1,
|
|
17
|
+
}, pt = (t) => t ? /^\s*javascript\s*:/i.test(t) : !1, Q = (t) => /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t) || t.startsWith("//"), xt = (t) => {
|
|
18
18
|
try {
|
|
19
19
|
return decodeURIComponent(t);
|
|
20
20
|
} catch {
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function x(t) {
|
|
25
25
|
if (!t) return "/";
|
|
26
26
|
let r = t.replace(/\/+/g, "/");
|
|
27
27
|
return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r;
|
|
28
28
|
}
|
|
29
29
|
const At = (t) => {
|
|
30
30
|
if (!t) return "";
|
|
31
|
-
const r =
|
|
31
|
+
const r = x(t);
|
|
32
32
|
return r === "/" ? "" : r;
|
|
33
33
|
}, dt = /* @__PURE__ */ new WeakMap();
|
|
34
|
-
function
|
|
34
|
+
function Pt(t) {
|
|
35
35
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const r = t.path || "/",
|
|
39
|
-
for (let
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
43
|
-
return
|
|
37
|
+
function kt(t) {
|
|
38
|
+
const r = t.path || "/", p = x(r), o = p === "/" ? [] : p.split("/").filter(Boolean), c = [], a = [];
|
|
39
|
+
for (let v = 0; v < o.length; v++) {
|
|
40
|
+
const l = o[v];
|
|
41
|
+
if (l === "*") {
|
|
42
|
+
if (v !== o.length - 1)
|
|
43
|
+
return m(
|
|
44
44
|
`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
45
45
|
), { invalid: !0 };
|
|
46
|
-
const
|
|
47
|
-
c.push(
|
|
46
|
+
const S = `splat${c.length}`;
|
|
47
|
+
c.push(S), a.push("__SPLAT__");
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
`Route '${t.path}' contains a splat param ':${
|
|
50
|
+
const d = l.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
|
|
51
|
+
if (d) {
|
|
52
|
+
const S = d[1], C = !!d[2];
|
|
53
|
+
if (C && v !== o.length - 1)
|
|
54
|
+
return m(
|
|
55
|
+
`Route '${t.path}' contains a splat param ':${S}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
56
56
|
), { invalid: !0 };
|
|
57
|
-
c.push(
|
|
57
|
+
c.push(S), a.push(C ? "__SPLAT__" : "([^/]+)");
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
a.push(Pt(l));
|
|
61
61
|
}
|
|
62
|
-
let
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
else if (
|
|
66
|
-
const
|
|
67
|
-
|
|
62
|
+
let g;
|
|
63
|
+
if (a.length === 0)
|
|
64
|
+
g = "^/$";
|
|
65
|
+
else if (a[a.length - 1] === "__SPLAT__") {
|
|
66
|
+
const l = a.slice(0, -1).join("/");
|
|
67
|
+
l ? g = `^/${l}(?:/(.*))?(?:/)?$` : g = "^(?:/(.*))?(?:/)?$";
|
|
68
68
|
} else
|
|
69
|
-
|
|
69
|
+
g = `^/${a.join("/")}(?:/)?$`;
|
|
70
70
|
try {
|
|
71
|
-
return { regex: new RegExp(
|
|
72
|
-
} catch (
|
|
73
|
-
return
|
|
71
|
+
return { regex: new RegExp(g), paramNames: c };
|
|
72
|
+
} catch (v) {
|
|
73
|
+
return m(`Failed to compile route regex for '${t.path}': ${String(v)}`), { invalid: !0 };
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
for (const
|
|
79
|
-
let c = dt.get(
|
|
80
|
-
if (c || (c =
|
|
81
|
-
const { regex:
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
for (let
|
|
85
|
-
const
|
|
86
|
-
|
|
76
|
+
const J = (t, r) => {
|
|
77
|
+
const p = x(r);
|
|
78
|
+
for (const o of t) {
|
|
79
|
+
let c = dt.get(o);
|
|
80
|
+
if (c || (c = kt(o), dt.set(o, c)), c.invalid) continue;
|
|
81
|
+
const { regex: a, paramNames: g } = c, v = a.exec(p);
|
|
82
|
+
if (v) {
|
|
83
|
+
const l = {};
|
|
84
|
+
for (let d = 0; d < g.length; d++) {
|
|
85
|
+
const S = v[d + 1] || "";
|
|
86
|
+
l[g[d]] = S ? xt(S) : "";
|
|
87
87
|
}
|
|
88
|
-
return { route:
|
|
88
|
+
return { route: o, params: l };
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return { route: null, params: {} };
|
|
92
92
|
};
|
|
93
93
|
function rt(t, r) {
|
|
94
|
-
for (const
|
|
95
|
-
if (
|
|
94
|
+
for (const p of t)
|
|
95
|
+
if (J([p], r).route !== null) return p;
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const
|
|
100
|
-
return
|
|
98
|
+
function jt(t, r) {
|
|
99
|
+
const p = r.split("?")[0].split("#")[0];
|
|
100
|
+
return J(t, p);
|
|
101
101
|
}
|
|
102
102
|
const yt = 50;
|
|
103
|
-
let
|
|
104
|
-
function kt() {
|
|
105
|
-
J = {}, B = {};
|
|
106
|
-
}
|
|
103
|
+
let X = {}, H = {};
|
|
107
104
|
function _t() {
|
|
108
|
-
|
|
105
|
+
X = {}, H = {};
|
|
106
|
+
}
|
|
107
|
+
function qt() {
|
|
108
|
+
const t = Object.entries(X);
|
|
109
109
|
if (t.length <= yt) return;
|
|
110
|
-
const
|
|
111
|
-
([,
|
|
110
|
+
const p = t.sort(
|
|
111
|
+
([, o], [, c]) => o.lastAccessed - c.lastAccessed
|
|
112
112
|
).slice(
|
|
113
113
|
0,
|
|
114
114
|
t.length - yt
|
|
115
115
|
);
|
|
116
|
-
for (const [
|
|
117
|
-
delete
|
|
116
|
+
for (const [o] of p)
|
|
117
|
+
delete X[o];
|
|
118
118
|
}
|
|
119
|
-
async function
|
|
119
|
+
async function Tt(t) {
|
|
120
120
|
if (t.component) return t.component;
|
|
121
121
|
if (t.load) {
|
|
122
|
-
const r =
|
|
122
|
+
const r = X[t.path];
|
|
123
123
|
if (r)
|
|
124
124
|
return r.lastAccessed = Date.now(), r.component;
|
|
125
|
-
if (
|
|
126
|
-
return
|
|
127
|
-
const
|
|
125
|
+
if (H[t.path] !== void 0)
|
|
126
|
+
return H[t.path];
|
|
127
|
+
const p = typeof window > "u";
|
|
128
128
|
try {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
return
|
|
133
|
-
component:
|
|
129
|
+
const o = t.load().then((c) => {
|
|
130
|
+
qt();
|
|
131
|
+
const a = c.default;
|
|
132
|
+
return X[t.path] = {
|
|
133
|
+
component: a,
|
|
134
134
|
lastAccessed: Date.now()
|
|
135
|
-
}, delete
|
|
135
|
+
}, delete H[t.path], a;
|
|
136
136
|
}).catch((c) => {
|
|
137
|
-
delete
|
|
138
|
-
const
|
|
139
|
-
throw
|
|
140
|
-
`SSR component load failed for route: ${t.path}. ${
|
|
137
|
+
delete H[t.path];
|
|
138
|
+
const a = c instanceof Error ? c.message : String(c);
|
|
139
|
+
throw p && k(
|
|
140
|
+
`SSR component load failed for route: ${t.path}. ${a}`
|
|
141
141
|
), new Error(
|
|
142
|
-
`Failed to load component for route: ${t.path}. ${
|
|
142
|
+
`Failed to load component for route: ${t.path}. ${a}`
|
|
143
143
|
);
|
|
144
144
|
});
|
|
145
|
-
return
|
|
146
|
-
} catch (
|
|
147
|
-
const c =
|
|
145
|
+
return H[t.path] = o, await o;
|
|
146
|
+
} catch (o) {
|
|
147
|
+
const c = o instanceof Error ? o.message : String(o);
|
|
148
148
|
throw new Error(
|
|
149
149
|
`Failed to load component for route: ${t.path}. ${c}`,
|
|
150
|
-
{ cause:
|
|
150
|
+
{ cause: o }
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
throw new Error(`No component or loader defined for route: ${t.path}`);
|
|
155
155
|
}
|
|
156
|
-
let
|
|
157
|
-
function
|
|
158
|
-
|
|
156
|
+
let y = null;
|
|
157
|
+
function Mt(t) {
|
|
158
|
+
y = t;
|
|
159
159
|
}
|
|
160
160
|
function mt() {
|
|
161
|
-
return
|
|
161
|
+
return y;
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
let
|
|
163
|
+
const V = /* @__PURE__ */ new Set();
|
|
164
|
+
let L = null;
|
|
165
165
|
function bt() {
|
|
166
|
-
if (
|
|
166
|
+
if (L) {
|
|
167
167
|
try {
|
|
168
|
-
|
|
168
|
+
L();
|
|
169
169
|
} catch {
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
L = null;
|
|
172
172
|
}
|
|
173
|
-
if (
|
|
173
|
+
if (y)
|
|
174
174
|
try {
|
|
175
175
|
let t = !1;
|
|
176
|
-
|
|
176
|
+
L = y.subscribe((r) => {
|
|
177
177
|
t = !0;
|
|
178
|
-
for (const
|
|
178
|
+
for (const p of V)
|
|
179
179
|
try {
|
|
180
|
-
|
|
180
|
+
p(r);
|
|
181
181
|
} catch {
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
try {
|
|
185
|
-
|
|
185
|
+
_.base = y.base;
|
|
186
186
|
} catch {
|
|
187
187
|
}
|
|
188
188
|
if (t) {
|
|
189
|
-
const r =
|
|
190
|
-
for (const
|
|
189
|
+
const r = y.getCurrent();
|
|
190
|
+
for (const p of V)
|
|
191
191
|
try {
|
|
192
|
-
|
|
192
|
+
p(r);
|
|
193
193
|
} catch {
|
|
194
194
|
}
|
|
195
195
|
} else {
|
|
196
|
-
const r =
|
|
197
|
-
for (const
|
|
196
|
+
const r = y.getCurrent();
|
|
197
|
+
for (const p of V)
|
|
198
198
|
try {
|
|
199
|
-
|
|
199
|
+
p(r);
|
|
200
200
|
} catch {
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -205,16 +205,16 @@ function bt() {
|
|
|
205
205
|
} catch {
|
|
206
206
|
}
|
|
207
207
|
} catch {
|
|
208
|
-
|
|
208
|
+
L = null;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
function It() {
|
|
212
212
|
bt();
|
|
213
213
|
}
|
|
214
|
-
const
|
|
214
|
+
const _ = {
|
|
215
215
|
store: {
|
|
216
216
|
subscribe(t) {
|
|
217
|
-
if (
|
|
217
|
+
if (y) return y.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
|
|
226
|
+
return y ? y.getCurrent() : { path: "/", params: {}, query: {} };
|
|
227
227
|
},
|
|
228
228
|
setState(t) {
|
|
229
|
-
if (
|
|
229
|
+
if (y)
|
|
230
230
|
try {
|
|
231
|
-
|
|
231
|
+
y.store.setState(
|
|
232
232
|
t
|
|
233
233
|
);
|
|
234
234
|
} catch {
|
|
@@ -237,140 +237,140 @@ const E = {
|
|
|
237
237
|
},
|
|
238
238
|
subscribe(t) {
|
|
239
239
|
if (typeof t != "function")
|
|
240
|
-
return
|
|
240
|
+
return m("activeRouterProxy.subscribe: listener must be a function"), () => {
|
|
241
241
|
};
|
|
242
|
-
if (
|
|
243
|
-
if (!
|
|
242
|
+
if (V.add(t), y)
|
|
243
|
+
if (!L)
|
|
244
244
|
bt();
|
|
245
245
|
else
|
|
246
246
|
try {
|
|
247
|
-
const r =
|
|
247
|
+
const r = y.getCurrent();
|
|
248
248
|
r && t(r);
|
|
249
249
|
} catch (r) {
|
|
250
|
-
|
|
250
|
+
m("activeRouterProxy subscription failed", r);
|
|
251
251
|
}
|
|
252
252
|
else
|
|
253
253
|
try {
|
|
254
254
|
t({ path: "/", params: {}, query: {} });
|
|
255
255
|
} catch (r) {
|
|
256
|
-
|
|
256
|
+
m("activeRouterProxy fallback state delivery failed", r);
|
|
257
257
|
}
|
|
258
258
|
return () => {
|
|
259
259
|
try {
|
|
260
|
-
if (
|
|
260
|
+
if (V.delete(t), V.size === 0 && L) {
|
|
261
261
|
try {
|
|
262
|
-
|
|
262
|
+
L();
|
|
263
263
|
} catch (r) {
|
|
264
|
-
|
|
264
|
+
m("activeRouterProxy inner unsubscribe failed", r);
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
L = null;
|
|
267
267
|
}
|
|
268
268
|
} catch (r) {
|
|
269
|
-
|
|
269
|
+
m("activeRouterProxy unsubscribe failed", r);
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
272
|
},
|
|
273
273
|
getCurrent() {
|
|
274
|
-
return
|
|
274
|
+
return y ? y.getCurrent() : { path: "/", params: {}, query: {} };
|
|
275
275
|
},
|
|
276
276
|
async push(t) {
|
|
277
|
-
return
|
|
277
|
+
return y ? y.push(t) : Promise.resolve();
|
|
278
278
|
},
|
|
279
279
|
async replace(t) {
|
|
280
|
-
return
|
|
280
|
+
return y ? y.replace(t) : Promise.resolve();
|
|
281
281
|
},
|
|
282
282
|
back() {
|
|
283
|
-
if (
|
|
284
|
-
return
|
|
283
|
+
if (y)
|
|
284
|
+
return y.back();
|
|
285
285
|
},
|
|
286
286
|
matchRoute(t) {
|
|
287
|
-
return
|
|
287
|
+
return y ? y.matchRoute(t) : { route: null, params: {} };
|
|
288
288
|
},
|
|
289
289
|
resolveRouteComponent(t) {
|
|
290
|
-
return
|
|
290
|
+
return y ? y.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
|
|
291
291
|
},
|
|
292
292
|
base: "",
|
|
293
293
|
scrollToFragment(t) {
|
|
294
|
-
return
|
|
294
|
+
return y ? y.scrollToFragment(t) : Promise.resolve(!1);
|
|
295
295
|
},
|
|
296
296
|
destroy() {
|
|
297
|
-
|
|
297
|
+
y && y.destroy();
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
function
|
|
301
|
-
const { routes: r, base:
|
|
302
|
-
let
|
|
300
|
+
function Ot(t) {
|
|
301
|
+
const { routes: r, base: p = "", initialUrl: o, scrollToFragment: c = !0 } = t, a = At(p), g = typeof c == "boolean" ? { ...ht, enabled: c } : { ...ht, ...c };
|
|
302
|
+
let v, l, d, S, C, I, W, D = () => {
|
|
303
303
|
};
|
|
304
|
-
const T = /* @__PURE__ */ new Set(),
|
|
304
|
+
const T = /* @__PURE__ */ new Set(), B = 10;
|
|
305
305
|
let q = 0;
|
|
306
|
-
const G = async (s,
|
|
306
|
+
const G = async (s, i) => {
|
|
307
307
|
const e = rt(r, s.path);
|
|
308
308
|
if (!e || !e.beforeEnter) return !0;
|
|
309
309
|
try {
|
|
310
|
-
const n = await e.beforeEnter(s,
|
|
310
|
+
const n = await e.beforeEnter(s, i);
|
|
311
311
|
if (typeof n == "string") {
|
|
312
|
-
const
|
|
313
|
-
return T.has(
|
|
312
|
+
const f = `${s.path}->${n}`;
|
|
313
|
+
return T.has(f) || q >= B ? (k(`Redirect loop detected: ${f}`), !1) : n;
|
|
314
314
|
}
|
|
315
315
|
return n !== !1;
|
|
316
316
|
} catch (n) {
|
|
317
|
-
|
|
317
|
+
k("beforeEnter error", n);
|
|
318
318
|
try {
|
|
319
|
-
|
|
319
|
+
d.setState(i);
|
|
320
320
|
} catch {
|
|
321
321
|
}
|
|
322
322
|
throw n;
|
|
323
323
|
}
|
|
324
|
-
}, at = async (s,
|
|
324
|
+
}, at = async (s, i) => {
|
|
325
325
|
const e = rt(r, s.path);
|
|
326
326
|
if (!e || !e.onEnter) return !0;
|
|
327
327
|
try {
|
|
328
|
-
const n = await e.onEnter(s,
|
|
328
|
+
const n = await e.onEnter(s, i);
|
|
329
329
|
if (typeof n == "string") {
|
|
330
|
-
const
|
|
331
|
-
return T.has(
|
|
330
|
+
const f = `${s.path}->${n}`;
|
|
331
|
+
return T.has(f) || q >= B ? (k(`Redirect loop detected: ${f}`), !1) : n;
|
|
332
332
|
}
|
|
333
333
|
return n !== !1;
|
|
334
334
|
} catch (n) {
|
|
335
|
-
|
|
335
|
+
k("onEnter error", n);
|
|
336
336
|
try {
|
|
337
|
-
|
|
337
|
+
d.setState(i);
|
|
338
338
|
} catch {
|
|
339
339
|
}
|
|
340
340
|
throw n;
|
|
341
341
|
}
|
|
342
|
-
}, Y = (s,
|
|
342
|
+
}, Y = (s, i) => {
|
|
343
343
|
const e = rt(r, s.path);
|
|
344
344
|
if (!(!e || !e.afterEnter))
|
|
345
345
|
try {
|
|
346
|
-
const n = e.afterEnter(s,
|
|
347
|
-
n instanceof Promise && n.catch((
|
|
348
|
-
|
|
346
|
+
const n = e.afterEnter(s, i);
|
|
347
|
+
n instanceof Promise && n.catch((f) => {
|
|
348
|
+
k("afterEnter async error", f);
|
|
349
349
|
});
|
|
350
350
|
} catch (n) {
|
|
351
|
-
|
|
351
|
+
k("afterEnter error", n);
|
|
352
352
|
}
|
|
353
|
-
},
|
|
354
|
-
if (
|
|
355
|
-
return
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const e = Math.floor(
|
|
359
|
-
for (let
|
|
360
|
-
|
|
353
|
+
}, A = /* @__PURE__ */ new Map(), K = 100, O = (s) => {
|
|
354
|
+
if (A.has(s))
|
|
355
|
+
return A.get(s);
|
|
356
|
+
const i = J(r, s);
|
|
357
|
+
if (A.size >= K) {
|
|
358
|
+
const e = Math.floor(K * 0.25), n = Array.from(A.keys());
|
|
359
|
+
for (let f = 0; f < e && f < n.length; f++)
|
|
360
|
+
A.delete(n[f]);
|
|
361
361
|
}
|
|
362
|
-
return
|
|
362
|
+
return A.set(s, i), i;
|
|
363
363
|
}, tt = () => {
|
|
364
364
|
};
|
|
365
|
-
async function
|
|
365
|
+
async function h(s, i = 0) {
|
|
366
366
|
try {
|
|
367
367
|
const e = document.getElementById(s);
|
|
368
368
|
if (!e)
|
|
369
369
|
return !1;
|
|
370
|
-
if (
|
|
370
|
+
if (i > 0)
|
|
371
371
|
try {
|
|
372
|
-
const n = e.getBoundingClientRect(),
|
|
373
|
-
typeof window.scrollTo == "function" && window.scrollTo({ top:
|
|
372
|
+
const n = e.getBoundingClientRect(), f = Math.max(0, window.scrollY + n.top - i);
|
|
373
|
+
typeof window.scrollTo == "function" && window.scrollTo({ top: f, behavior: "auto" });
|
|
374
374
|
} catch {
|
|
375
375
|
try {
|
|
376
376
|
e.scrollIntoView();
|
|
@@ -397,120 +397,120 @@ function Mt(t) {
|
|
|
397
397
|
return !1;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function E(s, i = 0, e = 2e3) {
|
|
401
401
|
return new Promise((n) => {
|
|
402
|
-
let
|
|
403
|
-
const $ = Date.now(),
|
|
404
|
-
|
|
405
|
-
},
|
|
406
|
-
if (!
|
|
402
|
+
let f = !1, b = null, w = null;
|
|
403
|
+
const $ = Date.now(), R = (z) => {
|
|
404
|
+
f || (f = !0, b && clearTimeout(b), w !== null && cancelAnimationFrame(w), n(z));
|
|
405
|
+
}, U = async () => {
|
|
406
|
+
if (!f)
|
|
407
407
|
try {
|
|
408
|
-
if (await
|
|
409
|
-
return
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
408
|
+
if (await h(s, i))
|
|
409
|
+
return R(!0);
|
|
410
|
+
const z = async () => {
|
|
411
|
+
if (f) return;
|
|
412
412
|
if (Date.now() - $ >= e)
|
|
413
|
-
return
|
|
413
|
+
return R(!1);
|
|
414
414
|
try {
|
|
415
|
-
if (await
|
|
416
|
-
return
|
|
417
|
-
|
|
415
|
+
if (await h(s, i))
|
|
416
|
+
return R(!0);
|
|
417
|
+
w = requestAnimationFrame(z);
|
|
418
418
|
} catch (wt) {
|
|
419
|
-
|
|
419
|
+
m("Scroll retry attempt failed:", wt), w = requestAnimationFrame(z);
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
|
-
|
|
423
|
-
} catch (
|
|
424
|
-
|
|
422
|
+
w = requestAnimationFrame(z);
|
|
423
|
+
} catch (z) {
|
|
424
|
+
m("Initial scroll attempt failed:", z), R(!1);
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}, e),
|
|
430
|
-
|
|
427
|
+
b = setTimeout(() => {
|
|
428
|
+
R(!1);
|
|
429
|
+
}, e), U().catch((z) => {
|
|
430
|
+
m("Scroll attempt failed:", z), R(!1);
|
|
431
431
|
});
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
let
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
|
|
434
|
+
let u = !1;
|
|
435
|
+
const P = async (s, i = !1) => {
|
|
436
|
+
if (u) {
|
|
437
|
+
m(`Navigation to ${s} blocked - navigation already in progress`);
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
|
-
|
|
440
|
+
u = !0, q = 0, T.clear();
|
|
441
441
|
try {
|
|
442
|
-
await
|
|
442
|
+
await F(s, i);
|
|
443
443
|
} finally {
|
|
444
|
-
|
|
444
|
+
u = !1, q = 0, T.clear();
|
|
445
445
|
}
|
|
446
|
-
},
|
|
447
|
-
const
|
|
446
|
+
}, N = (s) => {
|
|
447
|
+
const i = s.indexOf("#"), e = i >= 0 ? s.slice(i + 1) : "", n = i >= 0 ? s.slice(0, i) : s, f = n.indexOf("?"), b = f >= 0 ? n.slice(0, f) : n, w = f >= 0 ? st(n.slice(f)) : {}, $ = b.startsWith(a) ? b.slice(a.length) : b;
|
|
448
448
|
return {
|
|
449
|
-
path:
|
|
450
|
-
query:
|
|
449
|
+
path: x($ || "/"),
|
|
450
|
+
query: w,
|
|
451
451
|
fragment: e
|
|
452
452
|
};
|
|
453
|
-
},
|
|
453
|
+
}, F = async (s, i = !1) => {
|
|
454
454
|
try {
|
|
455
|
-
const e =
|
|
455
|
+
const e = N(s), n = O(e.path);
|
|
456
456
|
if (!n.route) throw new Error(`No route found for ${e.path}`);
|
|
457
|
-
const
|
|
457
|
+
const f = d.getState(), b = {
|
|
458
458
|
path: e.path,
|
|
459
459
|
params: n.params,
|
|
460
460
|
query: e.query,
|
|
461
461
|
fragment: e.fragment
|
|
462
|
-
},
|
|
463
|
-
if (
|
|
464
|
-
if (typeof
|
|
462
|
+
}, w = await G(b, f);
|
|
463
|
+
if (w === !1) return;
|
|
464
|
+
if (typeof w == "string") {
|
|
465
465
|
q++;
|
|
466
|
-
const
|
|
467
|
-
T.add(
|
|
466
|
+
const R = `${b.path}->${w}`;
|
|
467
|
+
T.add(R), await F(w, !0);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
const $ = await at(
|
|
470
|
+
const $ = await at(b, f);
|
|
471
471
|
if ($ === !1) return;
|
|
472
472
|
if (typeof $ == "string") {
|
|
473
473
|
q++;
|
|
474
|
-
const
|
|
475
|
-
T.add(
|
|
474
|
+
const R = `${b.path}->${$}`;
|
|
475
|
+
T.add(R), await F($, !0);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
478
|
if (typeof window < "u" && typeof document < "u") {
|
|
479
|
-
const
|
|
480
|
-
|
|
479
|
+
const R = Ct(e.query), U = a + e.path + (R || "") + (e.fragment ? "#" + e.fragment : "");
|
|
480
|
+
i ? window.history.replaceState({}, "", U) : window.history.pushState({}, "", U);
|
|
481
481
|
}
|
|
482
|
-
if (
|
|
482
|
+
if (d.setState(b), Y(b, f), typeof window < "u" && typeof document < "u")
|
|
483
483
|
try {
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
String(
|
|
487
|
-
|
|
488
|
-
|
|
484
|
+
const R = b.fragment;
|
|
485
|
+
g.enabled && R && E(
|
|
486
|
+
String(R),
|
|
487
|
+
g.offset,
|
|
488
|
+
g.timeoutMs
|
|
489
489
|
).catch(() => {
|
|
490
490
|
});
|
|
491
491
|
} catch {
|
|
492
492
|
}
|
|
493
493
|
} catch (e) {
|
|
494
|
-
if (
|
|
494
|
+
if (k("Navigation error:", e), e instanceof Error && (e.stack?.includes("runBeforeEnter") || e.stack?.includes("runOnEnter")))
|
|
495
495
|
throw e;
|
|
496
496
|
try {
|
|
497
|
-
const n =
|
|
498
|
-
if (!
|
|
499
|
-
let
|
|
500
|
-
if (
|
|
501
|
-
(
|
|
502
|
-
)), !
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
path:
|
|
506
|
-
params:
|
|
497
|
+
const n = d.getState();
|
|
498
|
+
if (!J(r, n.path).route) {
|
|
499
|
+
let b = r.find((w) => w.path === "/");
|
|
500
|
+
if (b || (b = r.find(
|
|
501
|
+
(w) => !w.path.includes(":") && !w.path.includes("*")
|
|
502
|
+
)), !b && r.length > 0 && (b = r[0]), b) {
|
|
503
|
+
const w = J(r, b.path);
|
|
504
|
+
d.setState({
|
|
505
|
+
path: b.path,
|
|
506
|
+
params: w.params,
|
|
507
507
|
query: {}
|
|
508
508
|
});
|
|
509
509
|
} else
|
|
510
|
-
|
|
510
|
+
k("No fallback route available for error recovery");
|
|
511
511
|
}
|
|
512
512
|
} catch (n) {
|
|
513
|
-
|
|
513
|
+
m(
|
|
514
514
|
"State recovery failed during navigation error:",
|
|
515
515
|
n
|
|
516
516
|
);
|
|
@@ -519,144 +519,144 @@ function Mt(t) {
|
|
|
519
519
|
};
|
|
520
520
|
if (((s) => {
|
|
521
521
|
if (!s || s.length === 0)
|
|
522
|
-
return
|
|
523
|
-
const
|
|
522
|
+
return k("Router configuration error: No routes provided"), !1;
|
|
523
|
+
const i = /* @__PURE__ */ new Set();
|
|
524
524
|
for (const e of s) {
|
|
525
525
|
if (!e.path)
|
|
526
|
-
return
|
|
527
|
-
|
|
526
|
+
return k("Router configuration error: Route missing path", e), !1;
|
|
527
|
+
i.has(e.path) && m(`Duplicate route path detected: ${e.path}`), i.add(e.path), !e.component && !e.load && m(`Route '${e.path}' has no component or load function`);
|
|
528
528
|
}
|
|
529
529
|
return !0;
|
|
530
|
-
})(r), typeof window > "u" || typeof
|
|
530
|
+
})(r), typeof window > "u" || typeof o < "u") {
|
|
531
531
|
for (const s of r)
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
O(s.path);
|
|
533
|
+
m(`Pre-compiled ${r.length} routes for SSR`);
|
|
534
534
|
}
|
|
535
|
-
if (typeof window < "u" && typeof document < "u" && typeof
|
|
536
|
-
|
|
535
|
+
if (typeof window < "u" && typeof document < "u" && typeof o > "u") {
|
|
536
|
+
v = () => {
|
|
537
537
|
try {
|
|
538
|
-
const e = new URL(window.location.href), n = e.pathname,
|
|
539
|
-
return { path:
|
|
538
|
+
const e = new URL(window.location.href), n = e.pathname, f = n.startsWith(a) ? n.slice(a.length) : n, b = x(f || "/"), w = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
539
|
+
return { path: b, query: w, fragment: $ };
|
|
540
540
|
} catch (e) {
|
|
541
|
-
return
|
|
541
|
+
return m("Invalid URL detected, falling back to safe defaults", e), { path: "/", query: {}, fragment: "" };
|
|
542
542
|
}
|
|
543
|
-
},
|
|
544
|
-
const s =
|
|
545
|
-
|
|
546
|
-
path:
|
|
543
|
+
}, l = v();
|
|
544
|
+
const s = O(l.path);
|
|
545
|
+
d = ft({
|
|
546
|
+
path: l.path,
|
|
547
547
|
params: s.params,
|
|
548
|
-
query:
|
|
549
|
-
fragment:
|
|
550
|
-
}),
|
|
551
|
-
const n =
|
|
552
|
-
await
|
|
548
|
+
query: l.query,
|
|
549
|
+
fragment: l.fragment
|
|
550
|
+
}), S = async (e = !1) => {
|
|
551
|
+
const n = v();
|
|
552
|
+
await P(n.path, e);
|
|
553
553
|
};
|
|
554
|
-
const
|
|
555
|
-
window.addEventListener("popstate",
|
|
556
|
-
|
|
557
|
-
|
|
554
|
+
const i = () => S(!0);
|
|
555
|
+
window.addEventListener("popstate", i), D = () => window.removeEventListener("popstate", i), C = (e) => P(e, !1), I = (e) => P(e, !0), W = () => window.history.back(), queueMicrotask(() => {
|
|
556
|
+
P(l.path, !0).catch((e) => {
|
|
557
|
+
k("Initial navigation error:", e);
|
|
558
558
|
});
|
|
559
559
|
});
|
|
560
560
|
} else {
|
|
561
|
-
|
|
561
|
+
v = () => {
|
|
562
562
|
try {
|
|
563
|
-
const e = new URL(
|
|
564
|
-
return { path:
|
|
563
|
+
const e = new URL(o || "/", "http://localhost"), n = e.pathname, f = n.startsWith(a) ? n.slice(a.length) : n, b = x(f || "/"), w = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
564
|
+
return { path: b, query: w, fragment: $ };
|
|
565
565
|
} catch (e) {
|
|
566
|
-
return
|
|
566
|
+
return m(
|
|
567
567
|
"Invalid SSR URL detected, falling back to safe defaults",
|
|
568
568
|
e
|
|
569
569
|
), { path: "/", query: {}, fragment: "" };
|
|
570
570
|
}
|
|
571
|
-
},
|
|
572
|
-
const s =
|
|
573
|
-
|
|
574
|
-
path:
|
|
571
|
+
}, l = v();
|
|
572
|
+
const s = O(l.path);
|
|
573
|
+
d = ft({
|
|
574
|
+
path: l.path,
|
|
575
575
|
params: s.params,
|
|
576
|
-
query:
|
|
577
|
-
fragment:
|
|
578
|
-
}),
|
|
579
|
-
const e =
|
|
580
|
-
await
|
|
576
|
+
query: l.query,
|
|
577
|
+
fragment: l.fragment
|
|
578
|
+
}), S = async () => {
|
|
579
|
+
const e = v();
|
|
580
|
+
await i(e.path);
|
|
581
581
|
};
|
|
582
|
-
const
|
|
583
|
-
if (q++, q >
|
|
584
|
-
|
|
582
|
+
const i = async (e) => {
|
|
583
|
+
if (q++, q > B) {
|
|
584
|
+
k(`SSR redirect depth exceeded for path: ${e}`);
|
|
585
585
|
return;
|
|
586
586
|
}
|
|
587
587
|
try {
|
|
588
|
-
const n =
|
|
589
|
-
if (!
|
|
590
|
-
const
|
|
588
|
+
const n = N(e), f = O(n.path);
|
|
589
|
+
if (!f.route) throw new Error(`No route found for ${n.path}`);
|
|
590
|
+
const b = d.getState(), w = {
|
|
591
591
|
path: n.path,
|
|
592
|
-
params:
|
|
592
|
+
params: f.params,
|
|
593
593
|
query: n.query,
|
|
594
594
|
fragment: n.fragment
|
|
595
|
-
}, $ = rt(r,
|
|
595
|
+
}, $ = rt(r, w.path);
|
|
596
596
|
if ($?.beforeEnter) {
|
|
597
|
-
const
|
|
598
|
-
if (typeof
|
|
599
|
-
const
|
|
600
|
-
T.add(
|
|
597
|
+
const R = await $.beforeEnter(w, b);
|
|
598
|
+
if (typeof R == "string") {
|
|
599
|
+
const U = `${w.path}->${R}`;
|
|
600
|
+
T.add(U), await i(R);
|
|
601
601
|
return;
|
|
602
602
|
}
|
|
603
|
-
if (
|
|
603
|
+
if (R === !1) return;
|
|
604
604
|
}
|
|
605
605
|
if ($?.onEnter) {
|
|
606
|
-
const
|
|
607
|
-
if (typeof
|
|
608
|
-
const
|
|
609
|
-
T.add(
|
|
606
|
+
const R = await $.onEnter(w, b);
|
|
607
|
+
if (typeof R == "string") {
|
|
608
|
+
const U = `${w.path}->${R}`;
|
|
609
|
+
T.add(U), await i(R);
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
|
-
if (
|
|
612
|
+
if (R === !1) return;
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
d.setState(w), $?.afterEnter && $.afterEnter(w, b);
|
|
615
615
|
} catch (n) {
|
|
616
|
-
throw
|
|
616
|
+
throw k("SSR navigation error:", n), n;
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
|
|
619
|
+
C = async (e) => (q = 0, T.clear(), i(e)), I = async (e) => (q = 0, T.clear(), i(e)), W = () => {
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
622
|
return {
|
|
623
623
|
_cleanupScrollState: tt,
|
|
624
|
-
destroy:
|
|
625
|
-
store:
|
|
626
|
-
push:
|
|
627
|
-
replace:
|
|
628
|
-
back:
|
|
629
|
-
subscribe:
|
|
630
|
-
matchRoute: (s) =>
|
|
631
|
-
getCurrent: () =>
|
|
632
|
-
resolveRouteComponent:
|
|
633
|
-
base:
|
|
624
|
+
destroy: D,
|
|
625
|
+
store: d,
|
|
626
|
+
push: C,
|
|
627
|
+
replace: I,
|
|
628
|
+
back: W,
|
|
629
|
+
subscribe: d.subscribe,
|
|
630
|
+
matchRoute: (s) => O(s),
|
|
631
|
+
getCurrent: () => d.getState(),
|
|
632
|
+
resolveRouteComponent: Tt,
|
|
633
|
+
base: a,
|
|
634
634
|
// Public API: allow components or tests to explicitly request scrolling to
|
|
635
635
|
// a fragment when they know their DOM is ready. Returns true if scrolled.
|
|
636
636
|
scrollToFragment: (s) => {
|
|
637
|
-
const
|
|
638
|
-
return !
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
637
|
+
const i = s || d.getState().fragment;
|
|
638
|
+
return !i || typeof window > "u" || typeof document > "u" ? Promise.resolve(!1) : E(
|
|
639
|
+
i,
|
|
640
|
+
g.offset,
|
|
641
|
+
g.timeoutMs
|
|
642
642
|
);
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
function
|
|
647
|
-
|
|
648
|
-
const r =
|
|
649
|
-
if (
|
|
646
|
+
function Wt(t) {
|
|
647
|
+
_t();
|
|
648
|
+
const r = Ot(t), p = mt();
|
|
649
|
+
if (p) {
|
|
650
650
|
try {
|
|
651
|
-
|
|
651
|
+
p.destroy();
|
|
652
652
|
} catch {
|
|
653
653
|
}
|
|
654
654
|
try {
|
|
655
|
-
|
|
655
|
+
p._cleanupScrollState?.();
|
|
656
656
|
} catch {
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
|
|
659
|
+
Mt(r);
|
|
660
660
|
try {
|
|
661
661
|
It();
|
|
662
662
|
try {
|
|
@@ -675,53 +675,54 @@ function jt(t) {
|
|
|
675
675
|
} catch {
|
|
676
676
|
}
|
|
677
677
|
return ut("router-view", async () => {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
678
|
+
const c = St()?._router, a = c ?? _;
|
|
679
|
+
if (!mt() && !c) return j`<div>Router not initialized.</div>`;
|
|
680
|
+
const g = et(a.getCurrent()), v = typeof window > "u";
|
|
681
|
+
let l;
|
|
682
|
+
v || (it(() => {
|
|
682
683
|
try {
|
|
683
|
-
typeof
|
|
684
|
+
typeof a.subscribe == "function" && (l = a.subscribe((S) => {
|
|
684
685
|
try {
|
|
685
|
-
|
|
686
|
-
} catch (
|
|
687
|
-
|
|
686
|
+
S && typeof S == "object" && typeof S.path == "string" ? g.value = S : (m("router-view received invalid state", S), g.value = { path: "/", params: {}, query: {} });
|
|
687
|
+
} catch (C) {
|
|
688
|
+
m("router-view subscription update failed", C);
|
|
688
689
|
try {
|
|
689
|
-
|
|
690
|
+
g.value = { path: "/", params: {}, query: {} };
|
|
690
691
|
} catch {
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
694
|
}));
|
|
694
|
-
} catch (
|
|
695
|
-
|
|
695
|
+
} catch (S) {
|
|
696
|
+
m("router-view subscribe failed", S);
|
|
696
697
|
}
|
|
697
698
|
}), lt(() => {
|
|
698
|
-
if (typeof
|
|
699
|
+
if (typeof l == "function") {
|
|
699
700
|
try {
|
|
700
|
-
|
|
701
|
-
} catch (
|
|
702
|
-
|
|
701
|
+
l();
|
|
702
|
+
} catch (S) {
|
|
703
|
+
m("router-view unsubscribe failed", S);
|
|
703
704
|
}
|
|
704
|
-
|
|
705
|
+
l = void 0;
|
|
705
706
|
}
|
|
706
707
|
}));
|
|
707
|
-
const
|
|
708
|
-
if (!
|
|
708
|
+
const d = a.matchRoute(g.value.path);
|
|
709
|
+
if (!d || !d.route) return j`<div>Not found</div>`;
|
|
709
710
|
try {
|
|
710
|
-
const
|
|
711
|
-
|
|
711
|
+
const C = await a.resolveRouteComponent(
|
|
712
|
+
d.route
|
|
712
713
|
);
|
|
713
|
-
if (typeof
|
|
714
|
-
return { tag:
|
|
715
|
-
if (typeof
|
|
716
|
-
const
|
|
717
|
-
return (
|
|
714
|
+
if (typeof C == "string")
|
|
715
|
+
return { tag: C, props: { attrs: { ...g.value.params } }, children: [] };
|
|
716
|
+
if (typeof C == "function") {
|
|
717
|
+
const I = C();
|
|
718
|
+
return (I instanceof Promise ? I : Promise.resolve(I)).then((D) => typeof D == "string" ? { tag: D, props: {}, children: [] } : D);
|
|
718
719
|
}
|
|
719
|
-
return
|
|
720
|
+
return j`<div>Invalid route component</div>`;
|
|
720
721
|
} catch {
|
|
721
|
-
return
|
|
722
|
+
return j`<div>Invalid route component</div>`;
|
|
722
723
|
}
|
|
723
724
|
}), ut("router-link", () => {
|
|
724
|
-
const
|
|
725
|
+
const o = Rt({
|
|
725
726
|
to: "",
|
|
726
727
|
tag: "a",
|
|
727
728
|
replace: !1,
|
|
@@ -734,62 +735,62 @@ function jt(t) {
|
|
|
734
735
|
// allow host `class` and `style` attributes to be read via useProps
|
|
735
736
|
class: "",
|
|
736
737
|
style: ""
|
|
737
|
-
}), c = typeof window > "u",
|
|
738
|
+
}), c = typeof window > "u", a = et(_.getCurrent()), g = a.value?.path || "/", v = String(o.to || ""), l = c ? {
|
|
738
739
|
isExactActive: gt(
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
740
|
+
g,
|
|
741
|
+
v,
|
|
742
|
+
_.base
|
|
742
743
|
),
|
|
743
744
|
isActive: vt(
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
745
|
+
g,
|
|
746
|
+
v,
|
|
747
|
+
_.base
|
|
747
748
|
),
|
|
748
|
-
isExternal:
|
|
749
|
+
isExternal: Q(v) || !!o.external
|
|
749
750
|
} : null;
|
|
750
|
-
let
|
|
751
|
-
|
|
752
|
-
const
|
|
751
|
+
let d;
|
|
752
|
+
Et(() => "a,button{display:inline-block;}");
|
|
753
|
+
const S = et(o.class || ""), C = et(o.style || "");
|
|
753
754
|
if (!c) {
|
|
754
|
-
let
|
|
755
|
-
it((
|
|
755
|
+
let h = null;
|
|
756
|
+
it((E) => {
|
|
756
757
|
try {
|
|
757
|
-
if (typeof
|
|
758
|
-
|
|
758
|
+
if (typeof _.subscribe == "function") {
|
|
759
|
+
d = _.subscribe((u) => {
|
|
759
760
|
try {
|
|
760
|
-
|
|
761
|
-
} catch (
|
|
762
|
-
|
|
761
|
+
u && typeof u == "object" && typeof u.path == "string" ? a.value = u : (m("router-link received invalid state", u), a.value = { path: "/", params: {}, query: {} });
|
|
762
|
+
} catch (P) {
|
|
763
|
+
m("router-link subscription update failed", P);
|
|
763
764
|
try {
|
|
764
|
-
|
|
765
|
+
a.value = { path: "/", params: {}, query: {} };
|
|
765
766
|
} catch {
|
|
766
767
|
}
|
|
767
768
|
}
|
|
768
769
|
});
|
|
769
770
|
try {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
} catch (
|
|
773
|
-
|
|
771
|
+
const u = _.getCurrent();
|
|
772
|
+
u && typeof u.path == "string" && (a.value = u);
|
|
773
|
+
} catch (u) {
|
|
774
|
+
m("router-link initial state sync failed", u);
|
|
774
775
|
}
|
|
775
|
-
|
|
776
|
+
h = setInterval(() => {
|
|
776
777
|
try {
|
|
777
|
-
const
|
|
778
|
-
|
|
778
|
+
const u = _.getCurrent();
|
|
779
|
+
u && typeof u.path == "string" && JSON.stringify(a.value) !== JSON.stringify(u) && (a.value = u);
|
|
779
780
|
} catch {
|
|
780
781
|
}
|
|
781
782
|
}, 100);
|
|
782
783
|
}
|
|
783
|
-
} catch (
|
|
784
|
-
|
|
784
|
+
} catch (u) {
|
|
785
|
+
m("router-link subscribe failed", u);
|
|
785
786
|
}
|
|
786
787
|
try {
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
const
|
|
790
|
-
|
|
788
|
+
const u = E?._host;
|
|
789
|
+
if (typeof HTMLElement < "u" && u instanceof HTMLElement) {
|
|
790
|
+
const P = u.getAttribute("class"), N = u.getAttribute("style");
|
|
791
|
+
P && (S.value = P), N && (C.value = N), P !== null && u.removeAttribute("class"), N !== null && u.removeAttribute("style");
|
|
791
792
|
try {
|
|
792
|
-
|
|
793
|
+
E?._requestRender?.();
|
|
793
794
|
try {
|
|
794
795
|
nt();
|
|
795
796
|
} catch {
|
|
@@ -797,121 +798,121 @@ function jt(t) {
|
|
|
797
798
|
} catch {
|
|
798
799
|
}
|
|
799
800
|
}
|
|
800
|
-
} catch (
|
|
801
|
-
|
|
801
|
+
} catch (u) {
|
|
802
|
+
m("router-link host migration failed", u);
|
|
802
803
|
}
|
|
803
804
|
}), lt(() => {
|
|
804
|
-
if (typeof
|
|
805
|
+
if (typeof d == "function")
|
|
805
806
|
try {
|
|
806
|
-
|
|
807
|
-
} catch (
|
|
808
|
-
|
|
807
|
+
d();
|
|
808
|
+
} catch (E) {
|
|
809
|
+
m("router-link unsubscribe failed", E);
|
|
809
810
|
} finally {
|
|
810
|
-
|
|
811
|
+
d = void 0;
|
|
811
812
|
}
|
|
812
|
-
if (
|
|
813
|
+
if (h)
|
|
813
814
|
try {
|
|
814
|
-
clearInterval(
|
|
815
|
-
} catch (
|
|
816
|
-
|
|
815
|
+
clearInterval(h);
|
|
816
|
+
} catch (E) {
|
|
817
|
+
m("router-link sync interval cleanup failed", E);
|
|
817
818
|
} finally {
|
|
818
|
-
|
|
819
|
+
h = null;
|
|
819
820
|
}
|
|
820
821
|
});
|
|
821
822
|
}
|
|
822
|
-
const
|
|
823
|
-
if (c &&
|
|
824
|
-
return
|
|
823
|
+
const I = M(() => {
|
|
824
|
+
if (c && l)
|
|
825
|
+
return l.isExactActive;
|
|
825
826
|
try {
|
|
826
|
-
const
|
|
827
|
-
return !
|
|
828
|
-
} catch (
|
|
829
|
-
return
|
|
827
|
+
const h = _.base ?? "", E = o.to || "";
|
|
828
|
+
return !a.value || typeof a.value.path != "string" ? !1 : gt(a.value.path, E, h);
|
|
829
|
+
} catch (h) {
|
|
830
|
+
return m("isExactActive computation error", h), !1;
|
|
830
831
|
}
|
|
831
|
-
}),
|
|
832
|
-
if (c &&
|
|
833
|
-
return
|
|
832
|
+
}), W = M(() => {
|
|
833
|
+
if (c && l)
|
|
834
|
+
return l.isActive;
|
|
834
835
|
try {
|
|
835
|
-
const
|
|
836
|
-
return !
|
|
837
|
-
} catch (
|
|
838
|
-
return
|
|
836
|
+
const h = _.base ?? "", E = o.to || "";
|
|
837
|
+
return !a.value || typeof a.value.path != "string" ? !1 : o.exact ? I.value : vt(a.value.path, E, h);
|
|
838
|
+
} catch (h) {
|
|
839
|
+
return m("isActive computation error", h), !1;
|
|
839
840
|
}
|
|
840
|
-
}),
|
|
841
|
-
const
|
|
842
|
-
if (pt(
|
|
843
|
-
if (
|
|
844
|
-
const [
|
|
845
|
-
let
|
|
846
|
-
if (
|
|
847
|
-
const ot =
|
|
848
|
-
s.startsWith(ot) ?
|
|
841
|
+
}), D = M(() => {
|
|
842
|
+
const h = String(o.to || "");
|
|
843
|
+
if (pt(h)) return null;
|
|
844
|
+
if (Q(h)) return h;
|
|
845
|
+
const [E, u] = h.split("#"), [P, N] = (E || "").split("?"), F = _.base ?? "";
|
|
846
|
+
let Z = P || "/";
|
|
847
|
+
if (F && F !== "/") {
|
|
848
|
+
const ot = x(F), s = x(Z);
|
|
849
|
+
s.startsWith(ot) ? Z = s.slice(ot.length) || "/" : Z = s;
|
|
849
850
|
}
|
|
850
|
-
const ct =
|
|
851
|
-
return
|
|
852
|
-
}), T =
|
|
853
|
-
const
|
|
854
|
-
for (const
|
|
855
|
-
return
|
|
856
|
-
}),
|
|
851
|
+
const ct = x(Z || "/");
|
|
852
|
+
return F + ct + (N ? "?" + N : "") + (u ? "#" + u : "");
|
|
853
|
+
}), T = M(() => {
|
|
854
|
+
const E = (S && S.value || o.class || "").split(/\s+/).filter(Boolean), u = {};
|
|
855
|
+
for (const P of E) u[P] = !0;
|
|
856
|
+
return u;
|
|
857
|
+
}), B = M(() => ({
|
|
857
858
|
...T.value,
|
|
858
|
-
[
|
|
859
|
-
[
|
|
860
|
-
})), q =
|
|
861
|
-
() => Object.keys(
|
|
862
|
-
), G =
|
|
863
|
-
() =>
|
|
864
|
-
),
|
|
865
|
-
const
|
|
866
|
-
return (
|
|
867
|
-
}),
|
|
868
|
-
() =>
|
|
869
|
-
), tt = (
|
|
870
|
-
if (
|
|
859
|
+
[o.activeClass || "active"]: W.value,
|
|
860
|
+
[o.exactActiveClass || "exact-active"]: I.value
|
|
861
|
+
})), q = M(
|
|
862
|
+
() => Object.keys(B.value).filter((h) => B.value[h]).join(" ")
|
|
863
|
+
), G = M(() => o.tag || "a"), at = M(() => G.value === "button"), Y = M(
|
|
864
|
+
() => I.value ? o.ariaCurrentValue : null
|
|
865
|
+
), A = M(() => !!o.disabled), K = M(() => {
|
|
866
|
+
const h = String(o.to || "");
|
|
867
|
+
return (Q(h) || !!o.external) && G.value === "a";
|
|
868
|
+
}), O = M(
|
|
869
|
+
() => C && C.value || o.style || ""
|
|
870
|
+
), tt = (h) => {
|
|
871
|
+
if (h.defaultPrevented || h.button !== 0 || h.metaKey || h.altKey || h.ctrlKey || h.shiftKey)
|
|
871
872
|
return;
|
|
872
|
-
if (
|
|
873
|
-
|
|
873
|
+
if (A.value) {
|
|
874
|
+
h.preventDefault();
|
|
874
875
|
return;
|
|
875
876
|
}
|
|
876
|
-
const
|
|
877
|
-
if (pt(
|
|
877
|
+
const E = String(o.to || "");
|
|
878
|
+
if (pt(E)) {
|
|
878
879
|
try {
|
|
879
|
-
|
|
880
|
+
h.preventDefault();
|
|
880
881
|
} catch {
|
|
881
882
|
}
|
|
882
|
-
|
|
883
|
+
m("Blocked unsafe javascript: URI in router-link.to");
|
|
883
884
|
return;
|
|
884
885
|
}
|
|
885
|
-
|
|
886
|
+
K.value || (h.preventDefault(), o.replace ? _.replace(o.to) : _.push(o.to));
|
|
886
887
|
};
|
|
887
|
-
return
|
|
888
|
+
return j`
|
|
888
889
|
${$t().when(
|
|
889
890
|
at.value,
|
|
890
|
-
|
|
891
|
+
j`
|
|
891
892
|
<button
|
|
892
893
|
part="button"
|
|
893
894
|
class="${q.value}"
|
|
894
|
-
style="${
|
|
895
|
+
style="${O.value || null}"
|
|
895
896
|
aria-current="${Y.value}"
|
|
896
|
-
disabled="${
|
|
897
|
-
aria-disabled="${
|
|
898
|
-
tabindex="${
|
|
897
|
+
disabled="${A.value ? "" : null}"
|
|
898
|
+
aria-disabled="${A.value ? "true" : null}"
|
|
899
|
+
tabindex="${A.value ? "-1" : null}"
|
|
899
900
|
@click="${tt}"
|
|
900
901
|
>
|
|
901
902
|
<slot></slot>
|
|
902
903
|
</button>
|
|
903
904
|
`
|
|
904
|
-
).otherwise(
|
|
905
|
+
).otherwise(j`
|
|
905
906
|
<a
|
|
906
907
|
part="link"
|
|
907
|
-
href="${
|
|
908
|
+
href="${A.value ? null : D.value}"
|
|
908
909
|
class="${q.value}"
|
|
909
|
-
style="${
|
|
910
|
+
style="${O.value || null}"
|
|
910
911
|
aria-current="${Y.value}"
|
|
911
|
-
aria-disabled="${
|
|
912
|
-
tabindex="${
|
|
913
|
-
target="${
|
|
914
|
-
rel="${
|
|
912
|
+
aria-disabled="${A.value ? "true" : null}"
|
|
913
|
+
tabindex="${A.value ? "-1" : null}"
|
|
914
|
+
target="${K.value ? "_blank" : null}"
|
|
915
|
+
rel="${K.value ? "noopener noreferrer" : null}"
|
|
915
916
|
@click="${tt}"
|
|
916
917
|
><slot></slot
|
|
917
918
|
></a>
|
|
@@ -919,42 +920,42 @@ function jt(t) {
|
|
|
919
920
|
`;
|
|
920
921
|
}), r;
|
|
921
922
|
}
|
|
922
|
-
function gt(t, r,
|
|
923
|
-
if (
|
|
923
|
+
function gt(t, r, p) {
|
|
924
|
+
if (Q(r)) return !1;
|
|
924
925
|
let c = (r.split("#")[0] || "/").split("?")[0];
|
|
925
|
-
if (
|
|
926
|
-
const
|
|
927
|
-
|
|
926
|
+
if (p && p !== "/") {
|
|
927
|
+
const v = x(p), l = x(c);
|
|
928
|
+
l.startsWith(v) ? c = l.slice(v.length) || "/" : c = l;
|
|
928
929
|
}
|
|
929
|
-
const
|
|
930
|
-
return
|
|
930
|
+
const a = x(t), g = x(c);
|
|
931
|
+
return a === g;
|
|
931
932
|
}
|
|
932
|
-
function vt(t, r,
|
|
933
|
-
if (
|
|
933
|
+
function vt(t, r, p) {
|
|
934
|
+
if (Q(r)) return !1;
|
|
934
935
|
let c = (r.split("#")[0] || "/").split("?")[0];
|
|
935
|
-
if (
|
|
936
|
-
const
|
|
937
|
-
|
|
936
|
+
if (p && p !== "/") {
|
|
937
|
+
const v = x(p), l = x(c);
|
|
938
|
+
l.startsWith(v) ? c = l.slice(v.length) || "/" : c = l;
|
|
938
939
|
}
|
|
939
|
-
const
|
|
940
|
-
return
|
|
940
|
+
const a = x(t), g = x(c);
|
|
941
|
+
return g === "/" ? a === "/" : a === g ? !0 : a.startsWith(g.endsWith("/") ? g : g + "/");
|
|
941
942
|
}
|
|
942
943
|
export {
|
|
943
944
|
ht as DEFAULT_SCROLL_CONFIG,
|
|
944
|
-
|
|
945
|
+
_ as activeRouterProxy,
|
|
945
946
|
At as canonicalizeBase,
|
|
946
|
-
|
|
947
|
+
_t as clearComponentCache,
|
|
947
948
|
rt as findMatchedRoute,
|
|
948
|
-
|
|
949
|
-
|
|
949
|
+
Wt as initRouter,
|
|
950
|
+
Q as isAbsoluteUrl,
|
|
950
951
|
pt as isDangerousScheme,
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
952
|
+
J as matchRoute,
|
|
953
|
+
jt as matchRouteSSR,
|
|
954
|
+
x as normalizePathForRoute,
|
|
954
955
|
st as parseQuery,
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
956
|
+
Tt as resolveRouteComponent,
|
|
957
|
+
xt as safeDecode,
|
|
958
|
+
Ct as serializeQuery,
|
|
959
|
+
Ot as useRouter
|
|
959
960
|
};
|
|
960
961
|
//# sourceMappingURL=custom-elements-runtime.router.es.js.map
|