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