@voltro/web 0.6.0 → 0.8.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/CHANGELOG.md +41 -0
- package/dist/index.d.ts +81 -1
- package/dist/index.js +68 -45
- package/dist/mount-D3k8Ozdm.js +76 -0
- package/dist/mount.js +1 -1
- package/dist/routerState-ga64vk2B.js +99 -0
- package/dist/{serverContext-DSValgbm.js → serverContext-BW0GF8fv.js} +291 -249
- package/dist/ssr.d.ts +168 -14
- package/dist/ssr.js +40 -39
- package/package.json +3 -3
- package/dist/mount-DhGdfjSE.js +0 -74
|
@@ -1,57 +1,58 @@
|
|
|
1
1
|
import { t as e } from "./globalContext-d4A-ugDg.js";
|
|
2
2
|
import { c as t, n, t as r } from "./defaultFallbacks-CGs2z5qv.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { f as i, i as a } from "./routerState-ga64vk2B.js";
|
|
4
|
+
import { Component as o, useCallback as s, useContext as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
5
|
+
import { jsx as p, jsxs as ee } from "react/jsx-runtime";
|
|
5
6
|
//#region src/routeEventBus.ts
|
|
6
|
-
var
|
|
7
|
+
var m = {
|
|
7
8
|
pathname: "/",
|
|
8
9
|
params: {},
|
|
9
10
|
loaderData: void 0
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
for (let e of
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
}),
|
|
11
|
+
}, h = /* @__PURE__ */ new Set(), te = (e) => {
|
|
12
|
+
m = e;
|
|
13
|
+
for (let e of h) e();
|
|
14
|
+
}, g = () => m, _ = (e) => (h.add(e), () => {
|
|
15
|
+
h.delete(e);
|
|
16
|
+
}), v = class extends Error {
|
|
16
17
|
_voltroControl = "not-found";
|
|
17
18
|
constructor(e) {
|
|
18
19
|
super(e ? `Not found: ${e}` : "Not found"), this.name = "NotFoundError";
|
|
19
20
|
}
|
|
20
|
-
},
|
|
21
|
+
}, y = class extends Error {
|
|
21
22
|
_voltroControl = "redirect";
|
|
22
23
|
location;
|
|
23
24
|
status;
|
|
24
25
|
constructor(e, t) {
|
|
25
26
|
super(`Redirect: ${e}`), this.name = "RedirectError", this.location = e, this.status = t?.status ?? 303;
|
|
26
27
|
}
|
|
27
|
-
},
|
|
28
|
-
throw new
|
|
29
|
-
},
|
|
30
|
-
throw new
|
|
31
|
-
}, ne = (e) => e instanceof Error && e._voltroControl === "not-found",
|
|
28
|
+
}, b = (e) => {
|
|
29
|
+
throw new v(e);
|
|
30
|
+
}, x = (e, t) => {
|
|
31
|
+
throw new y(e, t);
|
|
32
|
+
}, ne = (e) => e instanceof Error && e._voltroControl === "not-found", S = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", C = 0, w = 1, T = 2, E = 3, D = (e) => e.startsWith("[[...") && e.endsWith("]]") ? {
|
|
32
33
|
source: "(.*)",
|
|
33
34
|
paramName: e.slice(5, -2),
|
|
34
|
-
weight:
|
|
35
|
+
weight: T
|
|
35
36
|
} : e.startsWith("[...") && e.endsWith("]") ? {
|
|
36
37
|
source: "(.+)",
|
|
37
38
|
paramName: e.slice(4, -1),
|
|
38
|
-
weight:
|
|
39
|
+
weight: E
|
|
39
40
|
} : e.startsWith("[") && e.endsWith("]") ? {
|
|
40
41
|
source: "([^/]+)",
|
|
41
42
|
paramName: e.slice(1, -1),
|
|
42
|
-
weight:
|
|
43
|
+
weight: w
|
|
43
44
|
} : {
|
|
44
45
|
source: e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
45
46
|
paramName: null,
|
|
46
|
-
weight:
|
|
47
|
-
},
|
|
48
|
-
let t = e.pattern.split("/").map(
|
|
47
|
+
weight: C
|
|
48
|
+
}, re = (e) => {
|
|
49
|
+
let t = e.pattern.split("/").map(D);
|
|
49
50
|
for (let n = 0; n < t.length - 1; n++) {
|
|
50
51
|
let r = t[n];
|
|
51
|
-
if (r.weight ===
|
|
52
|
+
if (r.weight === E || r.weight === T) throw Error(`Route ${JSON.stringify(e.pattern)}: catch-all segment must be last. Anything after a catch-all is unreachable.`);
|
|
52
53
|
}
|
|
53
54
|
let n, r = t[t.length - 1];
|
|
54
|
-
n = r && r.weight ===
|
|
55
|
+
n = r && r.weight === T ? `${t.slice(0, -1).map((e) => e.source).join("/")}(?:/(.*))?` : t.map((e) => e.source).join("/");
|
|
55
56
|
let i = t.map((e) => e.paramName).filter((e) => e !== null), a = t.reduce((e, t) => e + t.weight, 0);
|
|
56
57
|
return {
|
|
57
58
|
...e,
|
|
@@ -62,7 +63,7 @@ var f = {
|
|
|
62
63
|
}, ie = (e) => [...e].map((e, t) => ({
|
|
63
64
|
route: e,
|
|
64
65
|
index: t
|
|
65
|
-
})).sort((e, t) => e.route.priority === t.route.priority ? e.index - t.index : e.route.priority - t.route.priority).map(({ route: e }) => e),
|
|
66
|
+
})).sort((e, t) => e.route.priority === t.route.priority ? e.index - t.index : e.route.priority - t.route.priority).map(({ route: e }) => e), O = (e, t) => {
|
|
66
67
|
let n = ie(e);
|
|
67
68
|
for (let e of n) {
|
|
68
69
|
let n = e.regex.exec(t);
|
|
@@ -79,20 +80,23 @@ var f = {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
return null;
|
|
82
|
-
},
|
|
83
|
+
}, ae = (e, t, n) => k(`${e}__seg${t}`, n), k = (e, t) => `${e}\u0000${Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1).map(([e, t]) => `${e}=${t}`).join("")}`, oe = (e, t) => {
|
|
84
|
+
let n = e(t);
|
|
85
|
+
return n instanceof Promise ? n.then(i) : i(n);
|
|
86
|
+
}, se = (e, t, n, r) => e === void 0 ? null : typeof e == "function" ? e({
|
|
83
87
|
params: t,
|
|
84
88
|
loaderData: n,
|
|
85
89
|
locale: r ?? "en"
|
|
86
|
-
}) : e,
|
|
90
|
+
}) : e, ce = (e, t) => {
|
|
87
91
|
let n = null, r = -1;
|
|
88
92
|
for (let i of e) (i.prefix === "" || t === i.prefix || t.startsWith(`${i.prefix}/`)) && i.prefix.length > r && (n = i, r = i.prefix.length);
|
|
89
93
|
return n;
|
|
90
|
-
},
|
|
94
|
+
}, A = (e, t, n) => {
|
|
91
95
|
if (e) for (let r = n; r >= 0; r--) {
|
|
92
96
|
let n = e[r]?.[t];
|
|
93
97
|
if (n !== void 0) return n;
|
|
94
98
|
}
|
|
95
|
-
},
|
|
99
|
+
}, le = class {
|
|
96
100
|
entries = /* @__PURE__ */ new Map();
|
|
97
101
|
get(e) {
|
|
98
102
|
return this.entries.get(e);
|
|
@@ -131,70 +135,89 @@ var f = {
|
|
|
131
135
|
let t = `${e}\u0000`;
|
|
132
136
|
for (let e of this.entries.keys()) e.startsWith(t) && this.entries.delete(e);
|
|
133
137
|
}
|
|
138
|
+
seed(e, t) {
|
|
139
|
+
this.entries.has(e) || this.entries.set(e, {
|
|
140
|
+
status: "success",
|
|
141
|
+
data: t
|
|
142
|
+
});
|
|
143
|
+
}
|
|
134
144
|
clear() {
|
|
135
145
|
this.entries.clear();
|
|
136
146
|
}
|
|
137
|
-
},
|
|
138
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return
|
|
147
|
+
}, j = { kind: "native" }, ue = (e, t) => {
|
|
148
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return j;
|
|
139
149
|
let n = e.target, r = n instanceof Element ? n.closest("a") : null;
|
|
140
|
-
if (!r) return
|
|
150
|
+
if (!r) return j;
|
|
141
151
|
let i = r.getAttribute("href");
|
|
142
|
-
if (i === null) return
|
|
152
|
+
if (i === null) return j;
|
|
143
153
|
let a = r.getAttribute("target");
|
|
144
|
-
if (a && a !== "_self" || r.hasAttribute("download") || r.hasAttribute("data-no-spa")) return
|
|
154
|
+
if (a && a !== "_self" || r.hasAttribute("download") || r.hasAttribute("data-no-spa")) return j;
|
|
145
155
|
let o = r.getAttribute("rel");
|
|
146
|
-
if (o && /(^|\s)external(\s|$)/i.test(o)) return
|
|
156
|
+
if (o && /(^|\s)external(\s|$)/i.test(o)) return j;
|
|
147
157
|
let s, c;
|
|
148
158
|
try {
|
|
149
159
|
c = new URL(t), s = new URL(i, c);
|
|
150
160
|
} catch {
|
|
151
|
-
return
|
|
161
|
+
return j;
|
|
152
162
|
}
|
|
153
|
-
return s.origin !== c.origin || s.pathname === c.pathname && s.search === c.search && s.hash !== "" ?
|
|
163
|
+
return s.origin !== c.origin || s.pathname === c.pathname && s.search === c.search && s.hash !== "" ? j : {
|
|
154
164
|
kind: "spa",
|
|
155
165
|
to: s.pathname + s.search + s.hash
|
|
156
166
|
};
|
|
157
|
-
},
|
|
167
|
+
}, M = (e) => {
|
|
158
168
|
let t = e.replace(/^#/, "");
|
|
159
169
|
try {
|
|
160
170
|
return decodeURIComponent(t);
|
|
161
171
|
} catch {
|
|
162
172
|
return t;
|
|
163
173
|
}
|
|
164
|
-
},
|
|
165
|
-
let t =
|
|
174
|
+
}, N = (e) => {
|
|
175
|
+
let t = M(e);
|
|
166
176
|
return t ? document.getElementById(t) ?? document.getElementsByName(t)[0] ?? null : null;
|
|
167
|
-
},
|
|
177
|
+
}, de = (e) => {
|
|
168
178
|
if (typeof window.requestAnimationFrame == "function") {
|
|
169
179
|
window.requestAnimationFrame(e);
|
|
170
180
|
return;
|
|
171
181
|
}
|
|
172
182
|
window.setTimeout(e, 0);
|
|
173
|
-
},
|
|
183
|
+
}, fe = (e) => {
|
|
174
184
|
if (!e.hash) {
|
|
175
185
|
window.scrollTo(0, 0);
|
|
176
186
|
return;
|
|
177
187
|
}
|
|
178
|
-
|
|
179
|
-
let t =
|
|
188
|
+
de(() => {
|
|
189
|
+
let t = N(e.hash);
|
|
180
190
|
if (t) {
|
|
181
191
|
t.scrollIntoView();
|
|
182
192
|
return;
|
|
183
193
|
}
|
|
184
194
|
window.scrollTo(0, 0);
|
|
185
195
|
});
|
|
186
|
-
},
|
|
196
|
+
}, P = 0, pe = () => {
|
|
187
197
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
188
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : (
|
|
189
|
-
},
|
|
190
|
-
let e =
|
|
198
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : (P += 1, `k${Date.now().toString(36)}-${P}`);
|
|
199
|
+
}, F = e("router", null), I = () => {
|
|
200
|
+
let e = c(F);
|
|
191
201
|
if (!e) throw Error("Router hooks must be used inside <Router>.");
|
|
192
202
|
return e;
|
|
193
|
-
},
|
|
203
|
+
}, L = e("loaderData", void 0), me = (e, t) => {
|
|
204
|
+
if (!e || e.pathname !== t) return;
|
|
205
|
+
let n = {};
|
|
206
|
+
for (let [t, r] of e.segments) n[t] = r;
|
|
207
|
+
return {
|
|
208
|
+
page: e.page,
|
|
209
|
+
segments: n
|
|
210
|
+
};
|
|
211
|
+
}, he = (e, t) => {
|
|
212
|
+
if (e === t) return !0;
|
|
213
|
+
if (!e || !t || !Object.is(e.page, t.page)) return !1;
|
|
214
|
+
let n = Object.keys(e.segments), r = Object.keys(t.segments);
|
|
215
|
+
return n.length === r.length && n.every((n) => Object.is(e.segments[Number(n)], t.segments[Number(n)]));
|
|
216
|
+
}, ge = () => {
|
|
194
217
|
if (typeof document > "u") return;
|
|
195
218
|
let e = document.cookie.match(/(?:^|;\s*)voltro:lang=([^;]*)/);
|
|
196
219
|
return e ? decodeURIComponent(e[1]) : void 0;
|
|
197
|
-
},
|
|
220
|
+
}, _e = (e) => {
|
|
198
221
|
if (e === null || typeof document > "u") return () => {};
|
|
199
222
|
let t = document.title, n = [], r = [], i = [], a = [], o = [];
|
|
200
223
|
typeof e.title == "string" && (document.title = e.title);
|
|
@@ -229,7 +252,7 @@ var f = {
|
|
|
229
252
|
}
|
|
230
253
|
if (e.jsonLd) for (let t of e.jsonLd) {
|
|
231
254
|
let e = document.createElement("script");
|
|
232
|
-
e.type = "application/ld+json", e.setAttribute("data-voltro-page-jsonld", ""), e.textContent =
|
|
255
|
+
e.type = "application/ld+json", e.setAttribute("data-voltro-page-jsonld", ""), e.textContent = R(t), document.head.appendChild(e), o.push(e);
|
|
233
256
|
}
|
|
234
257
|
return () => {
|
|
235
258
|
document.title = t;
|
|
@@ -239,7 +262,7 @@ var f = {
|
|
|
239
262
|
for (let { el: e, previous: t } of r) e.content = t;
|
|
240
263
|
for (let { el: e, previous: t } of a) e.href = t;
|
|
241
264
|
};
|
|
242
|
-
},
|
|
265
|
+
}, R = (e) => JSON.stringify(e).replace(/<\/(script)/gi, "<\\/$1").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"), z = class extends o {
|
|
243
266
|
state = { error: null };
|
|
244
267
|
static getDerivedStateFromError(e) {
|
|
245
268
|
return { error: e };
|
|
@@ -256,18 +279,18 @@ var f = {
|
|
|
256
279
|
render() {
|
|
257
280
|
if (this.state.error !== null) {
|
|
258
281
|
let { Fallback: e } = this.props;
|
|
259
|
-
return /* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ p(e, {
|
|
260
283
|
error: this.state.error,
|
|
261
284
|
reset: this.reset
|
|
262
285
|
});
|
|
263
286
|
}
|
|
264
287
|
return this.props.children;
|
|
265
288
|
}
|
|
266
|
-
},
|
|
267
|
-
let [
|
|
289
|
+
}, ve = ({ routes: e, notFounds: i = [], notFound: o = n, errorFallback: c = r }) => {
|
|
290
|
+
let [m, h] = f(() => window.location.pathname), [g, _] = f(() => window.location.pathname), [v, y] = f(() => window.location.search + window.location.hash), b = d(new le()), x = d(/* @__PURE__ */ new Map()), [C, w] = f(null), T = s((e, t) => (x.current.set(e, t), () => {
|
|
268
291
|
x.current.delete(e);
|
|
269
|
-
}), []),
|
|
270
|
-
|
|
292
|
+
}), []), E = d(/* @__PURE__ */ new Map()), D = d(null), j = u(() => ie(e.map(re)), [e]);
|
|
293
|
+
l(() => {
|
|
271
294
|
if (typeof window > "u") return;
|
|
272
295
|
let e = window.history.scrollRestoration;
|
|
273
296
|
try {
|
|
@@ -275,7 +298,7 @@ var f = {
|
|
|
275
298
|
} catch {}
|
|
276
299
|
return window.history.state?.__vwebKey || window.history.replaceState({
|
|
277
300
|
...window.history.state,
|
|
278
|
-
__vwebKey:
|
|
301
|
+
__vwebKey: pe()
|
|
279
302
|
}, ""), () => {
|
|
280
303
|
try {
|
|
281
304
|
window.history.scrollRestoration = e;
|
|
@@ -283,120 +306,130 @@ var f = {
|
|
|
283
306
|
};
|
|
284
307
|
}, []);
|
|
285
308
|
let M = () => window.history.state?.__vwebKey ?? "initial";
|
|
286
|
-
|
|
309
|
+
l(() => {
|
|
287
310
|
let e = () => {
|
|
288
|
-
let e =
|
|
289
|
-
|
|
311
|
+
let e = E.current.get(M());
|
|
312
|
+
D.current = e ?? {
|
|
290
313
|
x: 0,
|
|
291
314
|
y: 0
|
|
292
|
-
},
|
|
315
|
+
}, h(window.location.pathname), y(window.location.search + window.location.hash);
|
|
293
316
|
};
|
|
294
317
|
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
295
318
|
}, []);
|
|
296
|
-
let N =
|
|
297
|
-
|
|
319
|
+
let N = s((e, t, n) => {
|
|
320
|
+
E.current.set(M(), {
|
|
298
321
|
x: window.scrollX,
|
|
299
322
|
y: window.scrollY
|
|
300
323
|
});
|
|
301
|
-
let r = { __vwebKey:
|
|
302
|
-
n?.replace ? window.history.replaceState(r, "", e) : window.history.pushState(r, "", e),
|
|
303
|
-
}, []),
|
|
324
|
+
let r = { __vwebKey: pe() };
|
|
325
|
+
n?.replace ? window.history.replaceState(r, "", e) : window.history.pushState(r, "", e), h(t.pathname), y(t.search + t.hash), n?.scroll !== !1 && fe(t);
|
|
326
|
+
}, []), P = s((e, t) => {
|
|
304
327
|
let n = new URL(window.location.href), r = new URL(e, n);
|
|
305
328
|
if (!(r.pathname === n.pathname && r.search === n.search && r.hash === n.hash)) {
|
|
306
329
|
for (let n of x.current.values()) if (n({
|
|
307
330
|
to: e,
|
|
308
331
|
...t ? { opts: t } : {}
|
|
309
332
|
})) {
|
|
310
|
-
|
|
333
|
+
w({
|
|
311
334
|
to: e,
|
|
312
335
|
...t ? { opts: t } : {},
|
|
313
336
|
retry: () => {
|
|
314
|
-
|
|
337
|
+
w(null), N(e, r, t);
|
|
315
338
|
},
|
|
316
|
-
reset: () =>
|
|
339
|
+
reset: () => w(null)
|
|
317
340
|
});
|
|
318
341
|
return;
|
|
319
342
|
}
|
|
320
343
|
N(e, r, t);
|
|
321
344
|
}
|
|
322
345
|
}, [N]);
|
|
323
|
-
|
|
346
|
+
l(() => {
|
|
324
347
|
if (typeof document > "u") return;
|
|
325
348
|
let e = (e) => {
|
|
326
|
-
let t =
|
|
327
|
-
t.kind === "spa" && (e.preventDefault(),
|
|
349
|
+
let t = ue(e, window.location.href);
|
|
350
|
+
t.kind === "spa" && (e.preventDefault(), P(t.to));
|
|
328
351
|
};
|
|
329
352
|
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
330
|
-
}, [
|
|
331
|
-
let
|
|
332
|
-
|
|
333
|
-
let e =
|
|
334
|
-
if (!e?.load ||
|
|
353
|
+
}, [P]);
|
|
354
|
+
let I = u(() => O(j, m), [j, m]), R = d(/* @__PURE__ */ new Map()), [ve, ye] = f(0);
|
|
355
|
+
l(() => {
|
|
356
|
+
let e = I?.route;
|
|
357
|
+
if (!e?.load || R.current.has(e.pattern)) return;
|
|
335
358
|
let t = !1;
|
|
336
359
|
return e.load().then((n) => {
|
|
337
|
-
t || (
|
|
360
|
+
t || (R.current.set(e.pattern, n), ye((e) => e + 1));
|
|
338
361
|
}).catch(() => {}), () => {
|
|
339
362
|
t = !0;
|
|
340
363
|
};
|
|
341
|
-
}, [
|
|
342
|
-
let
|
|
343
|
-
if (!
|
|
344
|
-
let e =
|
|
364
|
+
}, [I?.route.load ? I.route.pattern : null]);
|
|
365
|
+
let B = u(() => {
|
|
366
|
+
if (!I) return null;
|
|
367
|
+
let e = I.route;
|
|
345
368
|
if (!e.load) return e;
|
|
346
|
-
let t =
|
|
369
|
+
let t = R.current.get(e.pattern);
|
|
347
370
|
return t ? {
|
|
348
371
|
...e,
|
|
349
|
-
...
|
|
372
|
+
...Ee(t),
|
|
350
373
|
load: void 0
|
|
351
374
|
} : null;
|
|
352
|
-
}, [
|
|
353
|
-
if (!
|
|
354
|
-
let e =
|
|
375
|
+
}, [I, ve]), V = u(() => O(j, g), [j, g]), H = u(() => {
|
|
376
|
+
if (!V) return null;
|
|
377
|
+
let e = V.route;
|
|
355
378
|
if (!e.load) return e;
|
|
356
|
-
let t =
|
|
379
|
+
let t = R.current.get(e.pattern);
|
|
357
380
|
return t ? {
|
|
358
381
|
...e,
|
|
359
|
-
...
|
|
382
|
+
...Ee(t),
|
|
360
383
|
load: void 0
|
|
361
384
|
} : null;
|
|
362
|
-
}, [
|
|
363
|
-
let t = new URL(e, window.location.origin), n =
|
|
385
|
+
}, [V, ve]), Se = s((e) => {
|
|
386
|
+
let t = new URL(e, window.location.origin), n = O(j, t.pathname);
|
|
364
387
|
if (!n) return;
|
|
365
388
|
let r = (e, r) => {
|
|
366
|
-
|
|
389
|
+
b.current.start(e, (e) => oe(r, {
|
|
367
390
|
params: n.params,
|
|
368
391
|
pathname: t.pathname,
|
|
369
392
|
signal: e
|
|
370
393
|
}));
|
|
371
394
|
};
|
|
372
|
-
n.route.loader && r(
|
|
373
|
-
e.loader && r(
|
|
395
|
+
n.route.loader && r(k(n.route.pattern, n.params), n.route.loader), n.route.chain?.forEach((e, t) => {
|
|
396
|
+
e.loader && r(ae(n.route.pattern, t, n.params), e.loader);
|
|
374
397
|
});
|
|
375
|
-
}, [j]), [
|
|
376
|
-
|
|
398
|
+
}, [j]), [U, W] = f({ status: "idle" }), G = d(void 0);
|
|
399
|
+
G.current === void 0 && (G.current = a());
|
|
400
|
+
let Ce = d(!1), [K, we] = f(() => ({
|
|
401
|
+
pathname: m,
|
|
402
|
+
data: me(G.current ?? null, m),
|
|
403
|
+
chain: I?.route.chain
|
|
404
|
+
}));
|
|
405
|
+
l(() => {
|
|
377
406
|
let e = (e) => {
|
|
378
|
-
|
|
407
|
+
_(m), we((t) => t.pathname === m && he(t.data, e) ? t : {
|
|
408
|
+
pathname: m,
|
|
409
|
+
data: e,
|
|
410
|
+
chain: I?.route.chain
|
|
411
|
+
});
|
|
379
412
|
};
|
|
380
|
-
if (!
|
|
381
|
-
|
|
413
|
+
if (!I) {
|
|
414
|
+
W({ status: "idle" }), e(void 0);
|
|
382
415
|
return;
|
|
383
416
|
}
|
|
384
|
-
if (!
|
|
385
|
-
|
|
417
|
+
if (!B) {
|
|
418
|
+
W({
|
|
386
419
|
status: "pending",
|
|
387
|
-
key:
|
|
420
|
+
key: k(I.route.pattern, I.params)
|
|
388
421
|
});
|
|
389
422
|
return;
|
|
390
423
|
}
|
|
391
|
-
let t =
|
|
424
|
+
let t = B, { params: n } = I, r = t.chain, i = (t.Pending ?? A(r, "Pending", r ? r.length - 1 : -1)) !== void 0, a = [];
|
|
392
425
|
if (t.loader) {
|
|
393
426
|
let e = t.loader;
|
|
394
427
|
a.push({
|
|
395
|
-
cacheKey:
|
|
428
|
+
cacheKey: k(t.pattern, n),
|
|
396
429
|
target: "page",
|
|
397
|
-
run: (t) => e
|
|
430
|
+
run: (t) => oe(e, {
|
|
398
431
|
params: n,
|
|
399
|
-
pathname:
|
|
432
|
+
pathname: m,
|
|
400
433
|
signal: t
|
|
401
434
|
})
|
|
402
435
|
});
|
|
@@ -405,26 +438,31 @@ var f = {
|
|
|
405
438
|
if (e.loader) {
|
|
406
439
|
let i = e.loader;
|
|
407
440
|
a.push({
|
|
408
|
-
cacheKey:
|
|
441
|
+
cacheKey: ae(t.pattern, r, n),
|
|
409
442
|
target: r,
|
|
410
|
-
run: (e) => i
|
|
443
|
+
run: (e) => oe(i, {
|
|
411
444
|
params: n,
|
|
412
|
-
pathname:
|
|
445
|
+
pathname: m,
|
|
413
446
|
signal: e
|
|
414
447
|
})
|
|
415
448
|
});
|
|
416
449
|
}
|
|
417
450
|
}), a.length === 0) {
|
|
418
|
-
|
|
451
|
+
W({ status: "idle" }), e(void 0);
|
|
419
452
|
return;
|
|
420
453
|
}
|
|
421
|
-
let o =
|
|
454
|
+
let o = k(t.pattern, n), s = G.current;
|
|
455
|
+
if (s && !Ce.current && m === s.pathname) {
|
|
456
|
+
Ce.current = !0;
|
|
457
|
+
for (let e of a) e.target === "page" ? s.pageRan && b.current.seed(e.cacheKey, s.page) : s.segments.has(e.target) && b.current.seed(e.cacheKey, s.segments.get(e.target));
|
|
458
|
+
}
|
|
459
|
+
let c = a.map((e) => ({
|
|
422
460
|
spec: e,
|
|
423
|
-
entry:
|
|
424
|
-
})),
|
|
461
|
+
entry: b.current.start(e.cacheKey, e.run)
|
|
462
|
+
})), l = () => {
|
|
425
463
|
let e = {}, t;
|
|
426
|
-
for (let { spec: n } of
|
|
427
|
-
let r =
|
|
464
|
+
for (let { spec: n } of c) {
|
|
465
|
+
let r = b.current.get(n.cacheKey);
|
|
428
466
|
if (!r || r.status === "pending") return null;
|
|
429
467
|
if (r.status === "error") return {
|
|
430
468
|
ok: !1,
|
|
@@ -439,87 +477,87 @@ var f = {
|
|
|
439
477
|
segments: e
|
|
440
478
|
}
|
|
441
479
|
};
|
|
442
|
-
},
|
|
443
|
-
if (
|
|
444
|
-
|
|
480
|
+
}, u = l();
|
|
481
|
+
if (u) {
|
|
482
|
+
u.ok ? (W({
|
|
445
483
|
status: "success",
|
|
446
484
|
key: o,
|
|
447
|
-
data:
|
|
448
|
-
}), e(
|
|
485
|
+
data: u.data
|
|
486
|
+
}), e(u.data)) : (W({
|
|
449
487
|
status: "error",
|
|
450
488
|
key: o,
|
|
451
|
-
error:
|
|
452
|
-
}),
|
|
489
|
+
error: u.error
|
|
490
|
+
}), S(u.error) || e(void 0));
|
|
453
491
|
return;
|
|
454
492
|
}
|
|
455
|
-
|
|
493
|
+
W({
|
|
456
494
|
status: "pending",
|
|
457
495
|
key: o
|
|
458
|
-
}), i &&
|
|
459
|
-
let
|
|
460
|
-
return Promise.all(
|
|
461
|
-
if (
|
|
462
|
-
let t =
|
|
463
|
-
t && (t.ok ? (
|
|
496
|
+
}), i && _(m);
|
|
497
|
+
let d = !1, f = c.map(({ entry: e }) => e.status === "pending" ? e.promise : Promise.resolve());
|
|
498
|
+
return Promise.all(f).then(() => {
|
|
499
|
+
if (d) return;
|
|
500
|
+
let t = l();
|
|
501
|
+
t && (t.ok ? (W({
|
|
464
502
|
status: "success",
|
|
465
503
|
key: o,
|
|
466
504
|
data: t.data
|
|
467
|
-
}), e(t.data)) : (
|
|
505
|
+
}), e(t.data)) : (W({
|
|
468
506
|
status: "error",
|
|
469
507
|
key: o,
|
|
470
508
|
error: t.error
|
|
471
|
-
}),
|
|
509
|
+
}), S(t.error) || e(void 0)));
|
|
472
510
|
}), () => {
|
|
473
|
-
|
|
511
|
+
d = !0;
|
|
474
512
|
};
|
|
475
513
|
}, [
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
514
|
+
I,
|
|
515
|
+
B,
|
|
516
|
+
m
|
|
479
517
|
]);
|
|
480
|
-
let q =
|
|
481
|
-
if (!
|
|
482
|
-
let e =
|
|
483
|
-
return
|
|
518
|
+
let q = K.data?.page, J = g === m, Y = K.pathname === g, Te = Y ? K.data?.page : void 0, De = ge(), X = u(() => {
|
|
519
|
+
if (!V) return null;
|
|
520
|
+
let e = V.params.locale ?? De;
|
|
521
|
+
return se(H?.meta, V.params, q, e);
|
|
484
522
|
}, [
|
|
523
|
+
V,
|
|
485
524
|
H,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
X
|
|
525
|
+
q,
|
|
526
|
+
De
|
|
489
527
|
]);
|
|
490
|
-
|
|
491
|
-
let [
|
|
492
|
-
|
|
493
|
-
if (!
|
|
494
|
-
|
|
528
|
+
l(() => _e(X), [X]);
|
|
529
|
+
let [Oe, Z] = f(""), Q = d(!1), [ke, Ae] = f(!1);
|
|
530
|
+
l(() => {
|
|
531
|
+
if (!Q.current) {
|
|
532
|
+
Q.current = !0, Ae(!0);
|
|
495
533
|
return;
|
|
496
534
|
}
|
|
497
|
-
let e =
|
|
498
|
-
|
|
499
|
-
}, [
|
|
500
|
-
let e =
|
|
501
|
-
e && (
|
|
502
|
-
}, [
|
|
503
|
-
let
|
|
504
|
-
pathname:
|
|
505
|
-
search:
|
|
506
|
-
navigate:
|
|
507
|
-
params:
|
|
508
|
-
prefetch:
|
|
509
|
-
loaderData:
|
|
510
|
-
registerBlocker:
|
|
511
|
-
blocked:
|
|
535
|
+
let e = X?.title ?? (typeof document < "u" ? document.title : "");
|
|
536
|
+
Z(e && e.length > 0 ? e : g);
|
|
537
|
+
}, [g, X]), l(() => {
|
|
538
|
+
let e = D.current;
|
|
539
|
+
e && (D.current = null, de(() => window.scrollTo(e.x, e.y)));
|
|
540
|
+
}, [g]);
|
|
541
|
+
let je = u(() => ({
|
|
542
|
+
pathname: g,
|
|
543
|
+
search: v,
|
|
544
|
+
navigate: P,
|
|
545
|
+
params: V?.params ?? {},
|
|
546
|
+
prefetch: Se,
|
|
547
|
+
loaderData: q,
|
|
548
|
+
registerBlocker: T,
|
|
549
|
+
blocked: C
|
|
512
550
|
}), [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
551
|
+
g,
|
|
552
|
+
v,
|
|
553
|
+
P,
|
|
554
|
+
V,
|
|
555
|
+
Se,
|
|
556
|
+
q,
|
|
557
|
+
T,
|
|
558
|
+
C
|
|
521
559
|
]);
|
|
522
|
-
|
|
560
|
+
l(() => {
|
|
523
561
|
if (typeof window > "u") return;
|
|
524
562
|
let e = (e) => {
|
|
525
563
|
let t = !1;
|
|
@@ -530,81 +568,85 @@ var f = {
|
|
|
530
568
|
t && (e.preventDefault(), e.returnValue = "");
|
|
531
569
|
};
|
|
532
570
|
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
533
|
-
}, []),
|
|
571
|
+
}, []), l(() => {
|
|
534
572
|
te({
|
|
535
|
-
pathname:
|
|
536
|
-
params:
|
|
537
|
-
loaderData:
|
|
573
|
+
pathname: g,
|
|
574
|
+
params: V?.params ?? {},
|
|
575
|
+
loaderData: q
|
|
538
576
|
});
|
|
539
577
|
}, [
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
]),
|
|
544
|
-
if (
|
|
578
|
+
g,
|
|
579
|
+
V,
|
|
580
|
+
q
|
|
581
|
+
]), l(() => {
|
|
582
|
+
if (U.status === "pending") return t({
|
|
545
583
|
id: "voltro:router:loader",
|
|
546
584
|
kind: "loading",
|
|
547
585
|
label: "Loading…"
|
|
548
586
|
});
|
|
549
|
-
}, [
|
|
550
|
-
if (
|
|
587
|
+
}, [U.status]), l(() => {
|
|
588
|
+
if (U.status === "error") return t({
|
|
551
589
|
id: "voltro:router:loader-error",
|
|
552
590
|
kind: "error",
|
|
553
591
|
label: "Loader failed"
|
|
554
592
|
});
|
|
555
|
-
}, [
|
|
556
|
-
|
|
557
|
-
}, [
|
|
558
|
-
let
|
|
559
|
-
let e =
|
|
593
|
+
}, [U.status]), l(() => {
|
|
594
|
+
U.status === "error" && S(U.error) && P(U.error.location, { replace: !0 });
|
|
595
|
+
}, [U, P]);
|
|
596
|
+
let Me = () => {
|
|
597
|
+
let e = ce(i, g);
|
|
560
598
|
if (e) {
|
|
561
599
|
let { Component: t, chain: n } = e;
|
|
562
|
-
return
|
|
600
|
+
return xe(n, /* @__PURE__ */ p(t, {}), g, c);
|
|
563
601
|
}
|
|
564
|
-
return /* @__PURE__ */
|
|
565
|
-
},
|
|
566
|
-
if (!
|
|
567
|
-
else if (ne(
|
|
602
|
+
return /* @__PURE__ */ p(o, {});
|
|
603
|
+
}, Ne = J && V && U.status === "error" ? U.error : void 0, $;
|
|
604
|
+
if (!V) $ = Me();
|
|
605
|
+
else if (ne(Ne)) $ = Me();
|
|
568
606
|
else {
|
|
569
|
-
let e =
|
|
570
|
-
if (
|
|
571
|
-
error:
|
|
607
|
+
let e = V.route.chain, t = e ? e.length - 1 : -1, n = H?.ErrorBoundary ?? A(e, "Error", t) ?? c, r;
|
|
608
|
+
if (J && U.status === "error" && !S(U.error)) r = /* @__PURE__ */ p(n, {
|
|
609
|
+
error: U.error,
|
|
572
610
|
reset: () => {
|
|
573
|
-
|
|
611
|
+
b.current.invalidate(V.route.pattern), h((e) => e), W({ status: "idle" });
|
|
574
612
|
}
|
|
575
613
|
});
|
|
576
|
-
else if (
|
|
577
|
-
let i =
|
|
578
|
-
if (i) r = /* @__PURE__ */
|
|
579
|
-
else if (
|
|
580
|
-
let e =
|
|
581
|
-
r = /* @__PURE__ */
|
|
582
|
-
resetKey:
|
|
614
|
+
else if (J && U.status === "pending") {
|
|
615
|
+
let i = H?.Pending ?? A(e, "Pending", t);
|
|
616
|
+
if (i) r = /* @__PURE__ */ p(i, {});
|
|
617
|
+
else if (H?.Component) {
|
|
618
|
+
let e = H.Component;
|
|
619
|
+
r = /* @__PURE__ */ p(z, {
|
|
620
|
+
resetKey: g,
|
|
583
621
|
Fallback: n,
|
|
584
|
-
children: /* @__PURE__ */
|
|
585
|
-
value:
|
|
586
|
-
children: /* @__PURE__ */
|
|
622
|
+
children: /* @__PURE__ */ p(L.Provider, {
|
|
623
|
+
value: Te,
|
|
624
|
+
children: /* @__PURE__ */ p(e, {})
|
|
587
625
|
})
|
|
588
626
|
});
|
|
589
627
|
} else r = null;
|
|
590
628
|
} else {
|
|
591
|
-
let e =
|
|
592
|
-
r = e ? /* @__PURE__ */
|
|
593
|
-
resetKey:
|
|
629
|
+
let e = H?.Component;
|
|
630
|
+
r = e ? /* @__PURE__ */ p(z, {
|
|
631
|
+
resetKey: g,
|
|
594
632
|
Fallback: n,
|
|
595
|
-
children: /* @__PURE__ */
|
|
596
|
-
value:
|
|
597
|
-
children: /* @__PURE__ */
|
|
633
|
+
children: /* @__PURE__ */ p(L.Provider, {
|
|
634
|
+
value: Te,
|
|
635
|
+
children: /* @__PURE__ */ p(e, {})
|
|
598
636
|
})
|
|
599
637
|
}) : null;
|
|
600
638
|
}
|
|
601
|
-
$ =
|
|
639
|
+
$ = xe(e, r, g, c, (t) => {
|
|
640
|
+
if (Y) return K.data?.segments[t];
|
|
641
|
+
let n = e?.[t]?.Layout;
|
|
642
|
+
return n !== void 0 && n === K.chain?.[t]?.Layout ? K.data?.segments[t] : void 0;
|
|
643
|
+
});
|
|
602
644
|
}
|
|
603
|
-
return /* @__PURE__ */ ee(
|
|
604
|
-
value:
|
|
605
|
-
children: [$,
|
|
645
|
+
return /* @__PURE__ */ ee(F.Provider, {
|
|
646
|
+
value: je,
|
|
647
|
+
children: [$, ke ? /* @__PURE__ */ p(be, { message: Oe }) : null]
|
|
606
648
|
});
|
|
607
|
-
},
|
|
649
|
+
}, ye = {
|
|
608
650
|
position: "absolute",
|
|
609
651
|
width: 1,
|
|
610
652
|
height: 1,
|
|
@@ -614,28 +656,28 @@ var f = {
|
|
|
614
656
|
clip: "rect(0, 0, 0, 0)",
|
|
615
657
|
whiteSpace: "nowrap",
|
|
616
658
|
border: 0
|
|
617
|
-
},
|
|
659
|
+
}, be = ({ message: e }) => /* @__PURE__ */ p("div", {
|
|
618
660
|
"data-vweb-route-announcer": "",
|
|
619
661
|
role: "status",
|
|
620
662
|
"aria-live": "assertive",
|
|
621
663
|
"aria-atomic": "true",
|
|
622
|
-
style:
|
|
664
|
+
style: ye,
|
|
623
665
|
children: e
|
|
624
|
-
}),
|
|
666
|
+
}), xe = (e, t, n, r, i) => {
|
|
625
667
|
if (!e || e.length === 0) return t;
|
|
626
668
|
let a = t;
|
|
627
669
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
628
670
|
let r = e[t];
|
|
629
671
|
if (r.Layout) {
|
|
630
672
|
let e = r.Layout;
|
|
631
|
-
a = /* @__PURE__ */
|
|
673
|
+
a = /* @__PURE__ */ p(L.Provider, {
|
|
632
674
|
value: i?.(t),
|
|
633
|
-
children: /* @__PURE__ */
|
|
675
|
+
children: /* @__PURE__ */ p(e, { children: a })
|
|
634
676
|
});
|
|
635
677
|
}
|
|
636
678
|
if (r.Error) {
|
|
637
679
|
let e = r.Error;
|
|
638
|
-
a = /* @__PURE__ */
|
|
680
|
+
a = /* @__PURE__ */ p(z, {
|
|
639
681
|
resetKey: n,
|
|
640
682
|
Fallback: e,
|
|
641
683
|
children: a
|
|
@@ -643,9 +685,9 @@ var f = {
|
|
|
643
685
|
}
|
|
644
686
|
}
|
|
645
687
|
return a;
|
|
646
|
-
},
|
|
647
|
-
let { registerBlocker: t, blocked: n } =
|
|
648
|
-
return i.current = e,
|
|
688
|
+
}, B = () => I().pathname, V = () => I().navigate, H = () => I().params, Se = () => c(L), U = () => I().prefetch, W = (e) => {
|
|
689
|
+
let { registerBlocker: t, blocked: n } = I(), r = d(Symbol("voltro:blocker")), i = d(e);
|
|
690
|
+
return i.current = e, l(() => {
|
|
649
691
|
let e = r.current;
|
|
650
692
|
return t(e, (e) => {
|
|
651
693
|
let t = i.current;
|
|
@@ -657,40 +699,40 @@ var f = {
|
|
|
657
699
|
retry: n.retry,
|
|
658
700
|
reset: n.reset
|
|
659
701
|
} : { blocked: !1 };
|
|
660
|
-
},
|
|
661
|
-
let { navigate: e } =
|
|
662
|
-
return
|
|
663
|
-
let r = new URLSearchParams(typeof window < "u" ? window.location.search : ""), i =
|
|
702
|
+
}, G = (e) => e instanceof URLSearchParams ? e : new URLSearchParams(e), Ce = () => {
|
|
703
|
+
let { navigate: e } = I();
|
|
704
|
+
return s((t, n) => {
|
|
705
|
+
let r = new URLSearchParams(typeof window < "u" ? window.location.search : ""), i = G(typeof t == "function" ? t(r) : t).toString(), a = typeof window < "u" ? window.location.pathname : "/", o = i ? `${a}?${i}` : a;
|
|
664
706
|
e(o, {
|
|
665
707
|
replace: !n?.push,
|
|
666
708
|
...n?.scroll === void 0 ? {} : { scroll: n.scroll }
|
|
667
709
|
});
|
|
668
710
|
}, [e]);
|
|
669
|
-
},
|
|
711
|
+
}, K = (e) => e, we = (e, t) => {
|
|
670
712
|
let n = new URLSearchParams();
|
|
671
713
|
for (let [e, r] of Object.entries(t)) r !== void 0 && n.append(e, String(r));
|
|
672
714
|
let r = n.toString();
|
|
673
715
|
return r ? `${e}?${r}` : e;
|
|
674
|
-
},
|
|
675
|
-
let c = V(), l =
|
|
716
|
+
}, q = (e, t) => `${e}#${t.replace(/^#/, "")}`, J = (e) => /^([a-z][a-z0-9+.-]*:|\/\/|#)/i.test(e), Y = ({ to: e, children: t, onClick: n, prefetch: r = !1, replace: i = !1, onMouseEnter: a, onFocus: o, ...s }) => {
|
|
717
|
+
let c = V(), l = U(), u = J(e), d = (t) => {
|
|
676
718
|
u || t.metaKey || t.ctrlKey || t.shiftKey || t.altKey || t.button !== 0 || (t.preventDefault(), n?.(t), c(e, i ? { replace: i } : void 0));
|
|
677
719
|
}, f = (t) => {
|
|
678
720
|
r && !u && l(e), a?.(t);
|
|
679
|
-
},
|
|
721
|
+
}, ee = (t) => {
|
|
680
722
|
r && !u && l(e), o?.(t);
|
|
681
723
|
};
|
|
682
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ p("a", {
|
|
683
725
|
...s,
|
|
684
726
|
href: e,
|
|
685
|
-
onClick:
|
|
727
|
+
onClick: d,
|
|
686
728
|
onMouseEnter: f,
|
|
687
|
-
onFocus:
|
|
729
|
+
onFocus: ee,
|
|
688
730
|
children: t
|
|
689
731
|
});
|
|
690
|
-
},
|
|
732
|
+
}, Te = (e) => Y({
|
|
691
733
|
...e,
|
|
692
734
|
to: e.to
|
|
693
|
-
}),
|
|
735
|
+
}), Ee = (e) => ({
|
|
694
736
|
Component: e.default,
|
|
695
737
|
meta: e.meta,
|
|
696
738
|
loader: e.loader,
|
|
@@ -698,30 +740,30 @@ var f = {
|
|
|
698
740
|
Pending: e.Pending,
|
|
699
741
|
renderMode: e.renderMode,
|
|
700
742
|
interactive: e.interactive
|
|
701
|
-
}),
|
|
743
|
+
}), De = (e, t, n = {}) => ({
|
|
702
744
|
pattern: e,
|
|
703
|
-
...
|
|
745
|
+
...Ee(t),
|
|
704
746
|
chain: n.chain
|
|
705
|
-
}),
|
|
747
|
+
}), X = (e, t, n = {}) => ({
|
|
706
748
|
pattern: e,
|
|
707
749
|
load: t,
|
|
708
750
|
chain: n.chain
|
|
709
|
-
}),
|
|
710
|
-
let n =
|
|
751
|
+
}), Oe = async (e, t) => {
|
|
752
|
+
let n = O(e.map(re), t)?.route.load;
|
|
711
753
|
if (n) try {
|
|
712
754
|
await n();
|
|
713
755
|
} catch {}
|
|
714
|
-
},
|
|
715
|
-
let e =
|
|
756
|
+
}, Z = e("serverRequest", null), Q = () => c(Z), ke = () => {
|
|
757
|
+
let e = Q();
|
|
716
758
|
if (e !== null) {
|
|
717
759
|
let t = e.url.indexOf("?");
|
|
718
760
|
return new URLSearchParams(t >= 0 ? e.url.slice(t + 1) : "");
|
|
719
761
|
}
|
|
720
762
|
return typeof window < "u" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
721
|
-
},
|
|
763
|
+
}, Ae = ({ value: e, children: t }) => /* @__PURE__ */ p(Z.Provider, {
|
|
722
764
|
value: e,
|
|
723
765
|
children: t
|
|
724
|
-
}),
|
|
766
|
+
}), je = (e) => {
|
|
725
767
|
let t = {};
|
|
726
768
|
if (!e) return t;
|
|
727
769
|
for (let n of e.split(";")) {
|
|
@@ -739,4 +781,4 @@ var f = {
|
|
|
739
781
|
return t;
|
|
740
782
|
};
|
|
741
783
|
//#endregion
|
|
742
|
-
export {
|
|
784
|
+
export { Ce as A, te as B, ie as C, V as D, B as E, ne as F, S as I, b as L, we as M, v as N, H as O, y as P, x as R, ae as S, Se as T, _ as V, O as _, Q as a, ue as b, L as c, F as d, re as f, k as g, X as h, ke as i, q as j, U as k, Te as l, ce as m, Ae as n, Y as o, K as p, je as r, le as s, Z as t, ve as u, De as v, W as w, se as x, Oe as y, g as z };
|