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