@voltro/web 0.52.0 → 0.53.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 +229 -0
- package/THIRD-PARTY-NOTICES.md +281 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +180 -70
- package/dist/mount.js +1 -1
- package/dist/{routerState-DAT472IC.js → routerState-Cr6fTbka.js} +4 -2
- package/dist/serverContext-BwzZ6Q7d.js +1148 -0
- package/dist/ssr.d.ts +29 -0
- package/dist/ssr.js +45 -45
- package/package.json +3 -3
- package/dist/serverContext-CzmZZwuQ.js +0 -910
|
@@ -0,0 +1,1148 @@
|
|
|
1
|
+
import { t as e } from "./globalContext-AuflFFmy.js";
|
|
2
|
+
import { l as t, n, t as r } from "./defaultFallbacks-SQ45vAhz.js";
|
|
3
|
+
import { i, p as a } from "./routerState-Cr6fTbka.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 { useServerRequest as ee } from "@voltro/client";
|
|
6
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
7
|
+
import { flushSync as g } from "react-dom";
|
|
8
|
+
import { Either as _, Schema as te } from "effect";
|
|
9
|
+
//#region src/routeEventBus.ts
|
|
10
|
+
var v = {
|
|
11
|
+
pathname: "/",
|
|
12
|
+
params: {},
|
|
13
|
+
loaderData: void 0
|
|
14
|
+
}, y = /* @__PURE__ */ new Set(), ne = (e) => {
|
|
15
|
+
v = e;
|
|
16
|
+
for (let e of y) e();
|
|
17
|
+
}, b = () => v, re = (e) => (y.add(e), () => {
|
|
18
|
+
y.delete(e);
|
|
19
|
+
}), ie = class extends Error {
|
|
20
|
+
_voltroControl = "not-found";
|
|
21
|
+
constructor(e) {
|
|
22
|
+
super(e ? `Not found: ${e}` : "Not found"), this.name = "NotFoundError";
|
|
23
|
+
}
|
|
24
|
+
}, x = class extends Error {
|
|
25
|
+
_voltroControl = "redirect";
|
|
26
|
+
location;
|
|
27
|
+
status;
|
|
28
|
+
constructor(e, t) {
|
|
29
|
+
super(`Redirect: ${e}`), this.name = "RedirectError", this.location = e, this.status = t?.status ?? 303;
|
|
30
|
+
}
|
|
31
|
+
}, ae = (e) => {
|
|
32
|
+
throw new ie(e);
|
|
33
|
+
}, S = (e, t) => {
|
|
34
|
+
throw new x(e, t);
|
|
35
|
+
}, oe = (e) => e instanceof Error && e._voltroControl === "not-found", C = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", w = (e, t) => {
|
|
36
|
+
let n = {};
|
|
37
|
+
for (let [r, i] of e.entries()) {
|
|
38
|
+
let e = n[r];
|
|
39
|
+
e === void 0 ? n[r] = t?.arrayKeys?.has(r) ? [i] : i : Array.isArray(e) ? e.push(i) : n[r] = [e, i];
|
|
40
|
+
}
|
|
41
|
+
return n;
|
|
42
|
+
}, T = (e, t) => {
|
|
43
|
+
if (t <= 0) return !1;
|
|
44
|
+
let n = e;
|
|
45
|
+
return n._tag === "TupleType" && (n.rest?.length ?? 0) > 0 ? !0 : n._tag === "Union" ? (n.types ?? []).some((e) => T(e, t - 1)) : n._tag === "Transformation" || n._tag === "Refinement" ? n.from !== void 0 && T(n.from, t - 1) || n.to !== void 0 && T(n.to, t - 1) : !1;
|
|
46
|
+
}, E = (e) => {
|
|
47
|
+
let t = e.ast;
|
|
48
|
+
for (let e = 0; e < 3 && t._tag === "Transformation"; e++) t = t.from;
|
|
49
|
+
let n = /* @__PURE__ */ new Set();
|
|
50
|
+
if (t._tag !== "TypeLiteral") return n;
|
|
51
|
+
for (let e of t.propertySignatures) T(e.type, 6) && n.add(String(e.name));
|
|
52
|
+
return n;
|
|
53
|
+
}, D = (e, t) => {
|
|
54
|
+
let n = te.decodeUnknownEither(e), r = n(w(t, { arrayKeys: E(e) }));
|
|
55
|
+
if (_.isRight(r)) return r.right;
|
|
56
|
+
let i = n({});
|
|
57
|
+
if (_.isRight(i)) return i.right;
|
|
58
|
+
throw Error("searchParams schema could not decode an EMPTY query — every field must be optional or carry a default (Schema.optionalWith(..., { default })). An invalid query string falls back to these defaults instead of crashing the render, so a schema without them has no total answer.", { cause: i.left });
|
|
59
|
+
}, O = (e) => {
|
|
60
|
+
let t = new URLSearchParams(), n = (e, n) => {
|
|
61
|
+
if (n != null) switch (typeof n) {
|
|
62
|
+
case "string":
|
|
63
|
+
t.append(e, n);
|
|
64
|
+
return;
|
|
65
|
+
case "number":
|
|
66
|
+
case "boolean":
|
|
67
|
+
case "bigint":
|
|
68
|
+
t.append(e, String(n));
|
|
69
|
+
return;
|
|
70
|
+
default: throw Error(`withQuery: search param "${e}" is a ${typeof n} — a link encodes only strings, numbers, booleans and arrays of those. A Date (or object) has no canonical URL form; declare the field as a string/number transform in the page's searchParams schema and pass that.`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
for (let [t, r] of Object.entries(e)) if (Array.isArray(r)) for (let e of r) n(t, e);
|
|
74
|
+
else n(t, r);
|
|
75
|
+
return t;
|
|
76
|
+
}, se = [
|
|
77
|
+
"static",
|
|
78
|
+
"spa",
|
|
79
|
+
"ssr",
|
|
80
|
+
"isr"
|
|
81
|
+
], ce = 0, k = 1, A = 2, le = 3, ue = (e) => e.startsWith("[[...") && e.endsWith("]]") ? {
|
|
82
|
+
source: "(.*)",
|
|
83
|
+
paramName: e.slice(5, -2),
|
|
84
|
+
weight: A
|
|
85
|
+
} : e.startsWith("[...") && e.endsWith("]") ? {
|
|
86
|
+
source: "(.+)",
|
|
87
|
+
paramName: e.slice(4, -1),
|
|
88
|
+
weight: le
|
|
89
|
+
} : e.startsWith("[") && e.endsWith("]") ? {
|
|
90
|
+
source: "([^/]+)",
|
|
91
|
+
paramName: e.slice(1, -1),
|
|
92
|
+
weight: k
|
|
93
|
+
} : {
|
|
94
|
+
source: e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
95
|
+
paramName: null,
|
|
96
|
+
weight: ce
|
|
97
|
+
}, de = (e) => {
|
|
98
|
+
let t = e.pattern.split("/").map(ue);
|
|
99
|
+
for (let n = 0; n < t.length - 1; n++) {
|
|
100
|
+
let r = t[n];
|
|
101
|
+
if (r.weight === le || r.weight === A) throw Error(`Route ${JSON.stringify(e.pattern)}: catch-all segment must be last. Anything after a catch-all is unreachable.`);
|
|
102
|
+
}
|
|
103
|
+
let n, r = t[t.length - 1];
|
|
104
|
+
n = r && r.weight === A ? `${t.slice(0, -1).map((e) => e.source).join("/")}(?:/(.*))?` : t.map((e) => e.source).join("/");
|
|
105
|
+
let i = t.map((e) => e.paramName).filter((e) => e !== null), a = t.reduce((e, t) => e + t.weight, 0);
|
|
106
|
+
return {
|
|
107
|
+
...e,
|
|
108
|
+
regex: RegExp(`^${n}$`),
|
|
109
|
+
paramNames: i,
|
|
110
|
+
priority: a
|
|
111
|
+
};
|
|
112
|
+
}, fe = (e) => [...e].map((e, t) => ({
|
|
113
|
+
route: e,
|
|
114
|
+
index: t
|
|
115
|
+
})).sort((e, t) => e.route.priority === t.route.priority ? e.index - t.index : e.route.priority - t.route.priority).map(({ route: e }) => e), j = (e, t) => {
|
|
116
|
+
let n = fe(e);
|
|
117
|
+
for (let e of n) {
|
|
118
|
+
let n = e.regex.exec(t);
|
|
119
|
+
if (n) {
|
|
120
|
+
let t = {};
|
|
121
|
+
for (let r = 0; r < e.paramNames.length; r++) {
|
|
122
|
+
let i = n[r + 1];
|
|
123
|
+
t[e.paramNames[r]] = i === void 0 ? "" : decodeURIComponent(i);
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
route: e,
|
|
127
|
+
params: t
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}, pe = (e, t, n) => M(`${e}__seg${t}`, n), M = (e, t) => `${e}\u0000${Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1).map(([e, t]) => `${e}=${t}`).join("")}`, me = (e, t) => {
|
|
133
|
+
let n = e(t);
|
|
134
|
+
return n instanceof Promise ? n.then(a) : a(n);
|
|
135
|
+
}, he = (e, t, n, r) => e === void 0 ? null : typeof e == "function" ? e({
|
|
136
|
+
params: t,
|
|
137
|
+
loaderData: n,
|
|
138
|
+
locale: r ?? "en"
|
|
139
|
+
}) : e, ge = (e, t) => {
|
|
140
|
+
let n = null, r = -1;
|
|
141
|
+
for (let i of e) (i.prefix === "" || t === i.prefix || t.startsWith(`${i.prefix}/`)) && i.prefix.length > r && (n = i, r = i.prefix.length);
|
|
142
|
+
return n;
|
|
143
|
+
}, _e = (e, t, n) => {
|
|
144
|
+
if (e) for (let r = n; r >= 0; r--) {
|
|
145
|
+
let n = e[r]?.[t];
|
|
146
|
+
if (n !== void 0) return n;
|
|
147
|
+
}
|
|
148
|
+
}, ve = class {
|
|
149
|
+
entries = /* @__PURE__ */ new Map();
|
|
150
|
+
get(e) {
|
|
151
|
+
return this.entries.get(e);
|
|
152
|
+
}
|
|
153
|
+
start(e, t) {
|
|
154
|
+
let n = this.entries.get(e);
|
|
155
|
+
if (n) return n;
|
|
156
|
+
let r = new AbortController(), i;
|
|
157
|
+
try {
|
|
158
|
+
i = Promise.resolve(t(r.signal));
|
|
159
|
+
} catch (e) {
|
|
160
|
+
i = Promise.reject(e);
|
|
161
|
+
}
|
|
162
|
+
let a = {
|
|
163
|
+
status: "pending",
|
|
164
|
+
promise: i.then((t) => {
|
|
165
|
+
r.signal.aborted || this.entries.set(e, {
|
|
166
|
+
status: "success",
|
|
167
|
+
data: t
|
|
168
|
+
});
|
|
169
|
+
}, (t) => {
|
|
170
|
+
r.signal.aborted || this.entries.set(e, {
|
|
171
|
+
status: "error",
|
|
172
|
+
error: t
|
|
173
|
+
});
|
|
174
|
+
}),
|
|
175
|
+
controller: r
|
|
176
|
+
};
|
|
177
|
+
return this.entries.set(e, a), a;
|
|
178
|
+
}
|
|
179
|
+
abort(e) {
|
|
180
|
+
let t = this.entries.get(e);
|
|
181
|
+
t?.status === "pending" && (t.controller.abort(), this.entries.delete(e));
|
|
182
|
+
}
|
|
183
|
+
invalidate(e) {
|
|
184
|
+
let t = `${e}\u0000`;
|
|
185
|
+
for (let e of this.entries.keys()) e.startsWith(t) && this.entries.delete(e);
|
|
186
|
+
}
|
|
187
|
+
seed(e, t) {
|
|
188
|
+
this.entries.has(e) || this.entries.set(e, {
|
|
189
|
+
status: "success",
|
|
190
|
+
data: t
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
clear() {
|
|
194
|
+
this.entries.clear();
|
|
195
|
+
}
|
|
196
|
+
}, N = { kind: "native" }, ye = (e, t) => {
|
|
197
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return N;
|
|
198
|
+
let n = e.target, r = n instanceof Element ? n.closest("a") : null;
|
|
199
|
+
if (!r) return N;
|
|
200
|
+
let i = r.getAttribute("href");
|
|
201
|
+
if (i === null) return N;
|
|
202
|
+
let a = r.getAttribute("target");
|
|
203
|
+
if (a && a !== "_self" || r.hasAttribute("download") || r.hasAttribute("data-no-spa")) return N;
|
|
204
|
+
let o = r.getAttribute("rel");
|
|
205
|
+
if (o && /(^|\s)external(\s|$)/i.test(o)) return N;
|
|
206
|
+
let s, c;
|
|
207
|
+
try {
|
|
208
|
+
c = new URL(t), s = new URL(i, c);
|
|
209
|
+
} catch {
|
|
210
|
+
return N;
|
|
211
|
+
}
|
|
212
|
+
return s.origin !== c.origin || s.pathname === c.pathname && s.search === c.search && s.hash !== "" ? N : {
|
|
213
|
+
kind: "spa",
|
|
214
|
+
to: s.pathname + s.search + s.hash
|
|
215
|
+
};
|
|
216
|
+
}, P = (e) => {
|
|
217
|
+
let t = e.replace(/^#/, "");
|
|
218
|
+
try {
|
|
219
|
+
return decodeURIComponent(t);
|
|
220
|
+
} catch {
|
|
221
|
+
return t;
|
|
222
|
+
}
|
|
223
|
+
}, F = (e) => {
|
|
224
|
+
let t = P(e);
|
|
225
|
+
return t ? document.getElementById(t) ?? document.getElementsByName(t)[0] ?? null : null;
|
|
226
|
+
}, be = (e) => {
|
|
227
|
+
if (typeof window.requestAnimationFrame == "function") {
|
|
228
|
+
window.requestAnimationFrame(e);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
window.setTimeout(e, 0);
|
|
232
|
+
}, xe = (e) => {
|
|
233
|
+
if (!e.hash) {
|
|
234
|
+
window.scrollTo(0, 0);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
be(() => {
|
|
238
|
+
let t = F(e.hash);
|
|
239
|
+
if (t) {
|
|
240
|
+
t.scrollIntoView();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
window.scrollTo(0, 0);
|
|
244
|
+
});
|
|
245
|
+
}, I = 0, Se = () => {
|
|
246
|
+
let e = typeof crypto < "u" ? crypto : void 0;
|
|
247
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : (I += 1, `k${Date.now().toString(36)}-${I}`);
|
|
248
|
+
}, Ce = e("router", null), L = () => {
|
|
249
|
+
let e = c(Ce);
|
|
250
|
+
if (!e) throw Error("Router hooks must be used inside <Router>.");
|
|
251
|
+
return e;
|
|
252
|
+
}, R = Symbol.for("@voltro/web/loaderData:absent"), z = e("loaderData", R), we = (e, t) => {
|
|
253
|
+
if (!e || e.pathname !== t) return;
|
|
254
|
+
let n = {};
|
|
255
|
+
for (let [t, r] of e.segments) n[t] = r;
|
|
256
|
+
return {
|
|
257
|
+
page: e.page,
|
|
258
|
+
segments: n
|
|
259
|
+
};
|
|
260
|
+
}, Te = (e, t) => {
|
|
261
|
+
if (e === t) return !0;
|
|
262
|
+
if (!e || !t || !Object.is(e.page, t.page)) return !1;
|
|
263
|
+
let n = Object.keys(e.segments), r = Object.keys(t.segments);
|
|
264
|
+
return n.length === r.length && n.every((n) => Object.is(e.segments[Number(n)], t.segments[Number(n)]));
|
|
265
|
+
}, Ee = () => {
|
|
266
|
+
if (typeof document > "u") return;
|
|
267
|
+
let e = document.cookie.match(/(?:^|;\s*)voltro:locale=([^;]*)/);
|
|
268
|
+
return e ? decodeURIComponent(e[1]) : void 0;
|
|
269
|
+
}, De = (e) => {
|
|
270
|
+
if (e === null || typeof document > "u") return () => {};
|
|
271
|
+
let t = document.title, n = [], r = [], i = [], a = [], o = [];
|
|
272
|
+
typeof e.title == "string" && (document.title = e.title);
|
|
273
|
+
let s = (e, t) => {
|
|
274
|
+
let i = e.name ? `meta[name="${e.name}"]` : e.property ? `meta[property="${e.property}"]` : null;
|
|
275
|
+
if (!i) return;
|
|
276
|
+
let a = document.head.querySelector(i);
|
|
277
|
+
if (a) r.push({
|
|
278
|
+
el: a,
|
|
279
|
+
previous: a.content
|
|
280
|
+
}), a.content = t;
|
|
281
|
+
else {
|
|
282
|
+
let r = document.createElement("meta");
|
|
283
|
+
e.name && r.setAttribute("name", e.name), e.property && r.setAttribute("property", e.property), r.setAttribute("content", t), document.head.appendChild(r), n.push(r);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
if (typeof e.description == "string" && s({ name: "description" }, e.description), e.noIndex && s({ name: "robots" }, "noindex, nofollow"), e.tags) for (let t of e.tags) s(t, t.content);
|
|
287
|
+
if (e.canonical) {
|
|
288
|
+
let t = document.head.querySelector("link[rel=\"canonical\"]");
|
|
289
|
+
if (t) a.push({
|
|
290
|
+
el: t,
|
|
291
|
+
previous: t.href
|
|
292
|
+
}), t.href = e.canonical;
|
|
293
|
+
else {
|
|
294
|
+
let t = document.createElement("link");
|
|
295
|
+
t.rel = "canonical", t.href = e.canonical, document.head.appendChild(t), i.push(t);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (e.links) for (let t of e.links) {
|
|
299
|
+
let e = document.createElement("link");
|
|
300
|
+
e.rel = t.rel, e.href = t.href, t.hreflang && e.setAttribute("hreflang", t.hreflang), t.type && (e.type = t.type), t.title && (e.title = t.title), document.head.appendChild(e), i.push(e);
|
|
301
|
+
}
|
|
302
|
+
if (e.jsonLd) for (let t of e.jsonLd) {
|
|
303
|
+
let e = document.createElement("script");
|
|
304
|
+
e.type = "application/ld+json", e.setAttribute("data-voltro-page-jsonld", ""), e.textContent = Oe(t), document.head.appendChild(e), o.push(e);
|
|
305
|
+
}
|
|
306
|
+
return () => {
|
|
307
|
+
document.title = t;
|
|
308
|
+
for (let e of n) e.parentNode?.removeChild(e);
|
|
309
|
+
for (let e of i) e.parentNode?.removeChild(e);
|
|
310
|
+
for (let e of o) e.parentNode?.removeChild(e);
|
|
311
|
+
for (let { el: e, previous: t } of r) e.content = t;
|
|
312
|
+
for (let { el: e, previous: t } of a) e.href = t;
|
|
313
|
+
};
|
|
314
|
+
}, Oe = (e) => JSON.stringify(e).replace(/<\/(script)/gi, "<\\/$1").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"), ke = class extends o {
|
|
315
|
+
state = { error: null };
|
|
316
|
+
static getDerivedStateFromError(e) {
|
|
317
|
+
return { error: e };
|
|
318
|
+
}
|
|
319
|
+
componentDidUpdate(e) {
|
|
320
|
+
e.resetKey !== this.props.resetKey && this.state.error !== null && this.setState({ error: null });
|
|
321
|
+
}
|
|
322
|
+
componentDidCatch(e, t) {
|
|
323
|
+
console.error("[@voltro/web] route render error:", e, t);
|
|
324
|
+
}
|
|
325
|
+
reset = () => {
|
|
326
|
+
this.setState({ error: null });
|
|
327
|
+
};
|
|
328
|
+
render() {
|
|
329
|
+
if (this.state.error !== null) {
|
|
330
|
+
let { Fallback: e } = this.props;
|
|
331
|
+
return /* @__PURE__ */ m(e, {
|
|
332
|
+
error: this.state.error,
|
|
333
|
+
reset: this.reset
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return this.props.children;
|
|
337
|
+
}
|
|
338
|
+
}, Ae = "data-voltro-page-slot", je = () => /* @__PURE__ */ m("div", { [Ae]: "" }), Me = (e) => {
|
|
339
|
+
let t = document;
|
|
340
|
+
if (typeof t.startViewTransition != "function" || typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
341
|
+
e();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
t.startViewTransition(() => {
|
|
345
|
+
g(e);
|
|
346
|
+
});
|
|
347
|
+
}, Ne = { status: "idle" }, Pe = { status: "pending" }, Fe = () => window.history.state ?? {}, Ie = (e, t, n) => {
|
|
348
|
+
let r = j(n, t)?.route.pattern;
|
|
349
|
+
return r === void 0 ? !1 : Array.isArray(e) ? e.includes(r) : e === r;
|
|
350
|
+
}, Le = ({ routes: e, notFounds: a = [], notFound: o = n, errorFallback: c = r, viewTransitions: ee = !1 }) => {
|
|
351
|
+
let [h, g] = f(() => window.location.pathname), [_, te] = f(() => window.location.pathname), [v, y] = f(() => window.location.search + window.location.hash), [b, re] = f([]), ie = d(!1), x = d(0), ae = d(!1);
|
|
352
|
+
v.split("#")[0];
|
|
353
|
+
let S = d(new ve()), w = d(/* @__PURE__ */ new Map()), [T, E] = f(null), D = d(void 0), O = s((e, t) => (w.current.set(e, t), () => {
|
|
354
|
+
w.current.delete(e);
|
|
355
|
+
}), []), se = d(/* @__PURE__ */ new Map()), ce = d(null), k = d(null), A = u(() => fe(e.map(de)), [e]);
|
|
356
|
+
l(() => {
|
|
357
|
+
if (typeof window > "u") return;
|
|
358
|
+
let e = window.history.scrollRestoration;
|
|
359
|
+
try {
|
|
360
|
+
window.history.scrollRestoration = "manual";
|
|
361
|
+
} catch {}
|
|
362
|
+
return window.history.state?.__vwebKey || window.history.replaceState({
|
|
363
|
+
...window.history.state,
|
|
364
|
+
__vwebKey: Se()
|
|
365
|
+
}, ""), () => {
|
|
366
|
+
try {
|
|
367
|
+
window.history.scrollRestoration = e;
|
|
368
|
+
} catch {}
|
|
369
|
+
};
|
|
370
|
+
}, []);
|
|
371
|
+
let le = () => window.history.state?.__vwebKey ?? "initial";
|
|
372
|
+
l(() => {
|
|
373
|
+
let e = () => {
|
|
374
|
+
let e = Fe(), t = e.__vwebIdx ?? 0;
|
|
375
|
+
if (ae.current) {
|
|
376
|
+
ae.current = !1, x.current = t;
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
let n = t - x.current, r = window.location.pathname + window.location.search + window.location.hash;
|
|
380
|
+
for (let e of w.current.values()) if (e({ to: r })) {
|
|
381
|
+
ae.current = !0, window.history.go(-n), E({
|
|
382
|
+
to: r,
|
|
383
|
+
retry: () => {
|
|
384
|
+
E(null), window.history.go(n);
|
|
385
|
+
},
|
|
386
|
+
reset: () => E(null)
|
|
387
|
+
});
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
x.current = t;
|
|
391
|
+
let i = se.current.get(le());
|
|
392
|
+
ce.current = i ?? {
|
|
393
|
+
x: 0,
|
|
394
|
+
y: 0
|
|
395
|
+
}, D.current = void 0, re(e.__vwebBg ?? []), g(window.location.pathname), y(window.location.search + window.location.hash);
|
|
396
|
+
};
|
|
397
|
+
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
398
|
+
}, []);
|
|
399
|
+
let ue = s((e, t, n) => {
|
|
400
|
+
se.current.set(le(), {
|
|
401
|
+
x: window.scrollX,
|
|
402
|
+
y: window.scrollY
|
|
403
|
+
}), D.current = n?.transition;
|
|
404
|
+
let r = Fe(), i = {
|
|
405
|
+
p: window.location.pathname,
|
|
406
|
+
s: window.location.search + window.location.hash
|
|
407
|
+
}, a = n?.replace ? r.__vwebBg ?? [] : ie.current ? [...r.__vwebBg ?? [], i] : [i], o = n?.replace ? x.current : x.current + 1, s = {
|
|
408
|
+
__vwebKey: Se(),
|
|
409
|
+
__vwebIdx: o,
|
|
410
|
+
...a.length > 0 ? { __vwebBg: a } : {}
|
|
411
|
+
};
|
|
412
|
+
n?.replace ? window.history.replaceState(s, "", e) : window.history.pushState(s, "", e), x.current = o, re(a), g(t.pathname), y(t.search + t.hash), k.current = n?.scroll === !1 ? null : t;
|
|
413
|
+
}, []), N = s((e, t) => {
|
|
414
|
+
let n = new URL(window.location.href), r = new URL(e, n);
|
|
415
|
+
if (r.pathname !== n.pathname || r.search !== n.search || r.hash !== n.hash) {
|
|
416
|
+
for (let n of w.current.values()) if (n({
|
|
417
|
+
to: e,
|
|
418
|
+
...t ? { opts: t } : {}
|
|
419
|
+
})) {
|
|
420
|
+
E({
|
|
421
|
+
to: e,
|
|
422
|
+
...t ? { opts: t } : {},
|
|
423
|
+
retry: () => {
|
|
424
|
+
E(null), ue(e, r, t);
|
|
425
|
+
},
|
|
426
|
+
reset: () => E(null)
|
|
427
|
+
});
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
ue(e, r, t);
|
|
431
|
+
}
|
|
432
|
+
}, [ue]);
|
|
433
|
+
l(() => {
|
|
434
|
+
if (typeof document > "u") return;
|
|
435
|
+
let e = (e) => {
|
|
436
|
+
let t = ye(e, window.location.href);
|
|
437
|
+
t.kind === "spa" && (e.preventDefault(), N(t.to));
|
|
438
|
+
};
|
|
439
|
+
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
440
|
+
}, [N]);
|
|
441
|
+
let P = u(() => j(A, h), [A, h]), F = d(/* @__PURE__ */ new Map()), [I, L] = f(0), Oe = P?.route.load ? P.route.pattern : null;
|
|
442
|
+
l(() => {
|
|
443
|
+
let e = P?.route;
|
|
444
|
+
if (!e?.load || F.current.has(e.pattern)) return;
|
|
445
|
+
let t = !1;
|
|
446
|
+
return e.load().then((n) => {
|
|
447
|
+
t || (F.current.set(e.pattern, n), L((e) => e + 1));
|
|
448
|
+
}).catch(() => {}), () => {
|
|
449
|
+
t = !0;
|
|
450
|
+
};
|
|
451
|
+
}, [Oe]);
|
|
452
|
+
let Ae = d(/* @__PURE__ */ new Set()), Le = s((e) => {
|
|
453
|
+
let t = e.load;
|
|
454
|
+
t && (F.current.has(e.pattern) || Ae.current.has(e.pattern) || (Ae.current.add(e.pattern), t().then((t) => {
|
|
455
|
+
F.current.set(e.pattern, t);
|
|
456
|
+
}).catch(() => {
|
|
457
|
+
Ae.current.delete(e.pattern);
|
|
458
|
+
})));
|
|
459
|
+
}, []), B = u(() => {
|
|
460
|
+
if (!P) return null;
|
|
461
|
+
let e = P.route;
|
|
462
|
+
if (!e.load) return e;
|
|
463
|
+
let t = F.current.get(e.pattern);
|
|
464
|
+
return t ? {
|
|
465
|
+
...e,
|
|
466
|
+
...Y(t),
|
|
467
|
+
load: void 0
|
|
468
|
+
} : null;
|
|
469
|
+
}, [P, I]), Be = b.length > 0 ? b[b.length - 1] : void 0, Ue = P === null || !P.route.load || F.current.has(P.route.pattern), We = Be !== void 0 && !Ue, V = Be !== void 0 && Ue && B?.intercept !== void 0 && Ie(B.intercept.from, Be.p, A);
|
|
470
|
+
l(() => {
|
|
471
|
+
ie.current = V;
|
|
472
|
+
}, [V]), l(() => {
|
|
473
|
+
V && (k.current = null);
|
|
474
|
+
}, [V]);
|
|
475
|
+
let Ge = b.length > 0 ? b[0] : void 0, H = V || We ? Ge.p : h, Ke = V || We ? Ge.s : v, U = u(() => V ? [...b.slice(1), {
|
|
476
|
+
p: h,
|
|
477
|
+
s: v
|
|
478
|
+
}] : [], [
|
|
479
|
+
V,
|
|
480
|
+
b,
|
|
481
|
+
h,
|
|
482
|
+
v
|
|
483
|
+
]), W = u(() => j(A, H), [A, H]), qe = u(() => {
|
|
484
|
+
if (!W) return null;
|
|
485
|
+
let e = W.route;
|
|
486
|
+
if (!e.load) return e;
|
|
487
|
+
let t = F.current.get(e.pattern);
|
|
488
|
+
return t ? {
|
|
489
|
+
...e,
|
|
490
|
+
...Y(t),
|
|
491
|
+
load: void 0
|
|
492
|
+
} : null;
|
|
493
|
+
}, [W, I]), Je = Ke.split("#")[0] ?? "";
|
|
494
|
+
l(() => {
|
|
495
|
+
let e = W?.route;
|
|
496
|
+
if (!e?.load || F.current.has(e.pattern)) return;
|
|
497
|
+
let t = !1;
|
|
498
|
+
return e.load().then((n) => {
|
|
499
|
+
t || (F.current.set(e.pattern, n), L((e) => e + 1));
|
|
500
|
+
}).catch(() => {}), () => {
|
|
501
|
+
t = !0;
|
|
502
|
+
};
|
|
503
|
+
}, [W?.route.pattern]);
|
|
504
|
+
let G = u(() => j(A, _), [A, _]), K = u(() => {
|
|
505
|
+
if (!G) return null;
|
|
506
|
+
let e = G.route;
|
|
507
|
+
if (!e.load) return e;
|
|
508
|
+
let t = F.current.get(e.pattern);
|
|
509
|
+
return t ? {
|
|
510
|
+
...e,
|
|
511
|
+
...Y(t),
|
|
512
|
+
load: void 0
|
|
513
|
+
} : null;
|
|
514
|
+
}, [G, I]), Ye = s((e) => {
|
|
515
|
+
let t = new URL(e, window.location.origin), n = j(A, t.pathname);
|
|
516
|
+
if (!n) return;
|
|
517
|
+
let r = (e, r) => {
|
|
518
|
+
S.current.start(e, (e) => me(r, {
|
|
519
|
+
params: n.params,
|
|
520
|
+
pathname: t.pathname,
|
|
521
|
+
search: t.search,
|
|
522
|
+
signal: e,
|
|
523
|
+
isServer: !1
|
|
524
|
+
}));
|
|
525
|
+
};
|
|
526
|
+
Le(n.route), n.route.loader && r(M(n.route.pattern, n.params), n.route.loader), n.route.chain?.forEach((e, t) => {
|
|
527
|
+
e.loader && r(pe(n.route.pattern, t, n.params), e.loader);
|
|
528
|
+
});
|
|
529
|
+
}, [A, Le]), [q, J] = f({ status: "idle" }), X = d(void 0);
|
|
530
|
+
X.current === void 0 && (X.current = i());
|
|
531
|
+
let Xe = d(!1), [Ze, Qe] = f(() => X.current?.pageClientOnly === !0 && X.current.pathname === h);
|
|
532
|
+
l(() => {
|
|
533
|
+
Qe(!1);
|
|
534
|
+
}, []);
|
|
535
|
+
let [Z, $e] = f(() => ({
|
|
536
|
+
pathname: h,
|
|
537
|
+
data: we(X.current ?? null, h),
|
|
538
|
+
chain: P?.route.chain
|
|
539
|
+
}));
|
|
540
|
+
l(() => {
|
|
541
|
+
let e = (D.current ?? ee) && _ !== H, t = !1, n = (n) => {
|
|
542
|
+
if (!e || t) {
|
|
543
|
+
n();
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
t = !0, Me(n);
|
|
547
|
+
}, r = (e) => {
|
|
548
|
+
n(() => {
|
|
549
|
+
te(H), $e((t) => t.pathname === H && Te(t.data, e) ? t : {
|
|
550
|
+
pathname: H,
|
|
551
|
+
data: e,
|
|
552
|
+
chain: W?.route.chain
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
let t = k.current;
|
|
556
|
+
t !== null && (k.current = null, xe(t));
|
|
557
|
+
};
|
|
558
|
+
if (!W) {
|
|
559
|
+
J({ status: "idle" }), r(void 0);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (!qe) {
|
|
563
|
+
J({
|
|
564
|
+
status: "pending",
|
|
565
|
+
key: M(W.route.pattern, W.params)
|
|
566
|
+
});
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
let i = qe, { params: a } = W, o = i.chain, s = (i.Pending ?? _e(o, "Pending", o ? o.length - 1 : -1)) !== void 0, c = [];
|
|
570
|
+
if (i.loader) {
|
|
571
|
+
let e = i.loader;
|
|
572
|
+
c.push({
|
|
573
|
+
cacheKey: M(i.pattern, a),
|
|
574
|
+
target: "page",
|
|
575
|
+
run: (t) => me(e, {
|
|
576
|
+
params: a,
|
|
577
|
+
pathname: H,
|
|
578
|
+
search: Je,
|
|
579
|
+
signal: t,
|
|
580
|
+
isServer: !1
|
|
581
|
+
})
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
if (i.chain?.forEach((e, t) => {
|
|
585
|
+
if (e.loader) {
|
|
586
|
+
let n = e.loader;
|
|
587
|
+
c.push({
|
|
588
|
+
cacheKey: pe(i.pattern, t, a),
|
|
589
|
+
target: t,
|
|
590
|
+
run: (e) => me(n, {
|
|
591
|
+
params: a,
|
|
592
|
+
pathname: H,
|
|
593
|
+
search: Je,
|
|
594
|
+
signal: e,
|
|
595
|
+
isServer: !1
|
|
596
|
+
})
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}), c.length === 0) {
|
|
600
|
+
J({ status: "idle" }), r(void 0);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
let l = M(i.pattern, a), u = X.current;
|
|
604
|
+
if (u && !Xe.current && h === u.pathname) {
|
|
605
|
+
Xe.current = !0;
|
|
606
|
+
for (let e of c) e.target === "page" ? u.pageRan && S.current.seed(e.cacheKey, u.page) : u.segments.has(e.target) && S.current.seed(e.cacheKey, u.segments.get(e.target));
|
|
607
|
+
}
|
|
608
|
+
let d = c.map((e) => ({
|
|
609
|
+
spec: e,
|
|
610
|
+
entry: S.current.start(e.cacheKey, e.run)
|
|
611
|
+
})), f = () => {
|
|
612
|
+
let e = {}, t;
|
|
613
|
+
for (let { spec: n } of d) {
|
|
614
|
+
let r = S.current.get(n.cacheKey);
|
|
615
|
+
if (!r || r.status === "pending") return null;
|
|
616
|
+
if (r.status === "error") return {
|
|
617
|
+
ok: !1,
|
|
618
|
+
error: r.error
|
|
619
|
+
};
|
|
620
|
+
n.target === "page" ? t = r.data : e[n.target] = r.data;
|
|
621
|
+
}
|
|
622
|
+
return {
|
|
623
|
+
ok: !0,
|
|
624
|
+
data: {
|
|
625
|
+
page: t,
|
|
626
|
+
segments: e
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
}, p = f();
|
|
630
|
+
if (p) {
|
|
631
|
+
p.ok ? (J({
|
|
632
|
+
status: "success",
|
|
633
|
+
key: l,
|
|
634
|
+
data: p.data
|
|
635
|
+
}), r(p.data)) : (J({
|
|
636
|
+
status: "error",
|
|
637
|
+
key: l,
|
|
638
|
+
error: p.error
|
|
639
|
+
}), C(p.error) || r(void 0));
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
J({
|
|
643
|
+
status: "pending",
|
|
644
|
+
key: l
|
|
645
|
+
}), s && n(() => te(h));
|
|
646
|
+
let m = !1, g = d.map(({ entry: e }) => e.status === "pending" ? e.promise : Promise.resolve());
|
|
647
|
+
return Promise.all(g).then(() => {
|
|
648
|
+
if (m) return;
|
|
649
|
+
let e = f();
|
|
650
|
+
e && (e.ok ? (J({
|
|
651
|
+
status: "success",
|
|
652
|
+
key: l,
|
|
653
|
+
data: e.data
|
|
654
|
+
}), r(e.data)) : (J({
|
|
655
|
+
status: "error",
|
|
656
|
+
key: l,
|
|
657
|
+
error: e.error
|
|
658
|
+
}), C(e.error) || r(void 0)));
|
|
659
|
+
}), () => {
|
|
660
|
+
m = !0;
|
|
661
|
+
};
|
|
662
|
+
}, [
|
|
663
|
+
W,
|
|
664
|
+
qe,
|
|
665
|
+
H
|
|
666
|
+
]);
|
|
667
|
+
let [et, tt] = f(/* @__PURE__ */ new Map());
|
|
668
|
+
l(() => {
|
|
669
|
+
if (U.length === 0) {
|
|
670
|
+
tt((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
let e = !1, t = (t, n) => {
|
|
674
|
+
e || tt((e) => {
|
|
675
|
+
let r = e.get(t);
|
|
676
|
+
if (r !== void 0 && r.status === n.status && (n.status !== "success" || r.data === n.data)) return e;
|
|
677
|
+
let i = new Map(e);
|
|
678
|
+
return i.set(t, n), i;
|
|
679
|
+
});
|
|
680
|
+
};
|
|
681
|
+
for (let n of U) {
|
|
682
|
+
let r = `${n.p}${n.s}`, i = j(A, n.p);
|
|
683
|
+
if (!i) {
|
|
684
|
+
t(r, {
|
|
685
|
+
status: "error",
|
|
686
|
+
error: /* @__PURE__ */ Error(`no route for ${n.p}`)
|
|
687
|
+
});
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
let a = i.route;
|
|
691
|
+
if (a.load && !F.current.has(a.pattern)) {
|
|
692
|
+
a.load().then((e) => {
|
|
693
|
+
F.current.set(a.pattern, e), L((e) => e + 1);
|
|
694
|
+
}).catch(() => {}), t(r, { status: "pending" });
|
|
695
|
+
continue;
|
|
696
|
+
}
|
|
697
|
+
let o = a.load ? {
|
|
698
|
+
...a,
|
|
699
|
+
...Y(F.current.get(a.pattern)),
|
|
700
|
+
load: void 0
|
|
701
|
+
} : a, s = o.loader;
|
|
702
|
+
if (!s) {
|
|
703
|
+
t(r, {
|
|
704
|
+
status: "success",
|
|
705
|
+
data: void 0
|
|
706
|
+
});
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
let c = M(o.pattern, i.params), l = n.s.split("#")[0] ?? "";
|
|
710
|
+
S.current.start(c, (e) => me(s, {
|
|
711
|
+
params: i.params,
|
|
712
|
+
pathname: n.p,
|
|
713
|
+
search: l,
|
|
714
|
+
signal: e,
|
|
715
|
+
isServer: !1
|
|
716
|
+
}));
|
|
717
|
+
let u = () => {
|
|
718
|
+
let e = S.current.get(c);
|
|
719
|
+
return !e || e.status === "pending" ? !1 : (e.status === "error" ? t(r, {
|
|
720
|
+
status: "error",
|
|
721
|
+
error: e.error
|
|
722
|
+
}) : t(r, {
|
|
723
|
+
status: "success",
|
|
724
|
+
data: e.data
|
|
725
|
+
}), !0);
|
|
726
|
+
};
|
|
727
|
+
if (u()) continue;
|
|
728
|
+
t(r, { status: "pending" });
|
|
729
|
+
let d = S.current.get(c);
|
|
730
|
+
d?.status === "pending" && d.promise.then(() => {
|
|
731
|
+
e || u();
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
return () => {
|
|
735
|
+
e = !0;
|
|
736
|
+
};
|
|
737
|
+
}, [
|
|
738
|
+
U,
|
|
739
|
+
A,
|
|
740
|
+
I
|
|
741
|
+
]);
|
|
742
|
+
let nt = U.length > 0 ? U[U.length - 1] : void 0, Q = nt === void 0 ? Ne : et.get(`${nt.p}${nt.s}`) ?? Pe;
|
|
743
|
+
l(() => {
|
|
744
|
+
Q.status === "error" && C(Q.error) && N(Q.error.location, { replace: !0 });
|
|
745
|
+
}, [Q, N]);
|
|
746
|
+
let $ = Z.data?.page, rt = _ === H, it = Z.pathname === _, at = it ? Z.data?.page : void 0, ot = K?.loader === void 0 ? R : at, st = Ee(), ct = u(() => {
|
|
747
|
+
if (V && P && B && (B.loader === void 0 || Q.status === "success")) {
|
|
748
|
+
let e = P.params.locale ?? st, t = Q.status === "success" ? Q.data : void 0;
|
|
749
|
+
return he(B.meta, P.params, t, e);
|
|
750
|
+
}
|
|
751
|
+
if (!G) return null;
|
|
752
|
+
let e = G.params.locale ?? st;
|
|
753
|
+
return he(K?.meta, G.params, $, e);
|
|
754
|
+
}, [
|
|
755
|
+
V,
|
|
756
|
+
P,
|
|
757
|
+
B,
|
|
758
|
+
Q,
|
|
759
|
+
G,
|
|
760
|
+
K,
|
|
761
|
+
$,
|
|
762
|
+
st
|
|
763
|
+
]);
|
|
764
|
+
l(() => De(ct), [ct]);
|
|
765
|
+
let [lt, ut] = f(""), dt = d(!1), [ft, pt] = f(!1);
|
|
766
|
+
l(() => {
|
|
767
|
+
if (!dt.current) {
|
|
768
|
+
dt.current = !0, pt(!0);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
let e = ct?.title ?? (typeof document < "u" ? document.title : "");
|
|
772
|
+
ut(e && e.length > 0 ? e : V ? h : _);
|
|
773
|
+
}, [
|
|
774
|
+
_,
|
|
775
|
+
ct,
|
|
776
|
+
V,
|
|
777
|
+
h
|
|
778
|
+
]), l(() => {
|
|
779
|
+
let e = ce.current;
|
|
780
|
+
e && (ce.current = null, be(() => window.scrollTo(e.x, e.y)));
|
|
781
|
+
}, [_]);
|
|
782
|
+
let mt = u(() => ({
|
|
783
|
+
pathname: _,
|
|
784
|
+
search: Ke,
|
|
785
|
+
navigate: N,
|
|
786
|
+
params: G?.params ?? {},
|
|
787
|
+
prefetch: Ye,
|
|
788
|
+
loaderData: $,
|
|
789
|
+
registerBlocker: O,
|
|
790
|
+
blocked: T
|
|
791
|
+
}), [
|
|
792
|
+
_,
|
|
793
|
+
Ke,
|
|
794
|
+
N,
|
|
795
|
+
G,
|
|
796
|
+
Ye,
|
|
797
|
+
$,
|
|
798
|
+
O,
|
|
799
|
+
T
|
|
800
|
+
]);
|
|
801
|
+
l(() => {
|
|
802
|
+
if (typeof window > "u") return;
|
|
803
|
+
let e = (e) => {
|
|
804
|
+
let t = !1;
|
|
805
|
+
for (let e of w.current.values()) if (e({ to: window.location.pathname })) {
|
|
806
|
+
t = !0;
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
t && (e.preventDefault(), e.returnValue = "");
|
|
810
|
+
};
|
|
811
|
+
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
812
|
+
}, []), l(() => {
|
|
813
|
+
ne({
|
|
814
|
+
pathname: _,
|
|
815
|
+
params: G?.params ?? {},
|
|
816
|
+
loaderData: $
|
|
817
|
+
});
|
|
818
|
+
}, [
|
|
819
|
+
_,
|
|
820
|
+
G,
|
|
821
|
+
$
|
|
822
|
+
]), l(() => {
|
|
823
|
+
if (q.status === "pending") return t({
|
|
824
|
+
id: "voltro:router:loader",
|
|
825
|
+
kind: "loading",
|
|
826
|
+
label: "Loading…"
|
|
827
|
+
});
|
|
828
|
+
}, [q.status]), l(() => {
|
|
829
|
+
if (q.status === "error") return t({
|
|
830
|
+
id: "voltro:router:loader-error",
|
|
831
|
+
kind: "error",
|
|
832
|
+
label: "Loader failed"
|
|
833
|
+
});
|
|
834
|
+
}, [q.status]), l(() => {
|
|
835
|
+
q.status === "error" && C(q.error) && N(q.error.location, { replace: !0 });
|
|
836
|
+
}, [q, N]);
|
|
837
|
+
let ht = () => {
|
|
838
|
+
let e = ge(a, _);
|
|
839
|
+
if (e) {
|
|
840
|
+
let { Component: t, chain: n } = e;
|
|
841
|
+
return He(n, /* @__PURE__ */ m(t, {}), _, c);
|
|
842
|
+
}
|
|
843
|
+
return /* @__PURE__ */ m(o, {});
|
|
844
|
+
}, gt = rt && G && q.status === "error" ? q.error : void 0, _t;
|
|
845
|
+
if (!G) _t = ht();
|
|
846
|
+
else if (oe(gt)) _t = ht();
|
|
847
|
+
else {
|
|
848
|
+
let e = G.route.chain, t = e ? e.length - 1 : -1, n = K?.ErrorBoundary ?? _e(e, "Error", t) ?? c, r;
|
|
849
|
+
if (Ze) r = /* @__PURE__ */ m(je, {});
|
|
850
|
+
else if (rt && q.status === "error" && !C(q.error)) r = /* @__PURE__ */ m(n, {
|
|
851
|
+
error: q.error,
|
|
852
|
+
reset: () => {
|
|
853
|
+
S.current.invalidate(G.route.pattern), g((e) => e), J({ status: "idle" });
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
else if (rt && q.status === "pending") {
|
|
857
|
+
let i = K?.Pending ?? _e(e, "Pending", t);
|
|
858
|
+
if (i) r = /* @__PURE__ */ m(i, {});
|
|
859
|
+
else if (K?.Component) {
|
|
860
|
+
let e = K.Component;
|
|
861
|
+
r = /* @__PURE__ */ m(ke, {
|
|
862
|
+
resetKey: _,
|
|
863
|
+
Fallback: n,
|
|
864
|
+
children: /* @__PURE__ */ m(z.Provider, {
|
|
865
|
+
value: ot,
|
|
866
|
+
children: /* @__PURE__ */ m(e, {})
|
|
867
|
+
})
|
|
868
|
+
});
|
|
869
|
+
} else r = null;
|
|
870
|
+
} else {
|
|
871
|
+
let e = K?.Component;
|
|
872
|
+
r = e ? /* @__PURE__ */ m(ke, {
|
|
873
|
+
resetKey: _,
|
|
874
|
+
Fallback: n,
|
|
875
|
+
children: /* @__PURE__ */ m(z.Provider, {
|
|
876
|
+
value: ot,
|
|
877
|
+
children: /* @__PURE__ */ m(e, {})
|
|
878
|
+
})
|
|
879
|
+
}) : null;
|
|
880
|
+
}
|
|
881
|
+
_t = He(e, r, _, c, (t) => {
|
|
882
|
+
if (it) return Z.data?.segments[t];
|
|
883
|
+
let n = e?.[t]?.Layout;
|
|
884
|
+
return n !== void 0 && n === Z.chain?.[t]?.Layout ? Z.data?.segments[t] : void 0;
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
let vt = null;
|
|
888
|
+
return V && U.length > 0 && (vt = /* @__PURE__ */ m(p, { children: U.map((e) => {
|
|
889
|
+
let t = `${e.p}${e.s}`, n = j(A, e.p);
|
|
890
|
+
if (!n) return null;
|
|
891
|
+
let r = n.route, i = r.load ? F.current.has(r.pattern) ? {
|
|
892
|
+
...r,
|
|
893
|
+
...Y(F.current.get(r.pattern)),
|
|
894
|
+
load: void 0
|
|
895
|
+
} : null : r;
|
|
896
|
+
if (!i) return /* @__PURE__ */ m(ze, {
|
|
897
|
+
onDismiss: () => window.history.back(),
|
|
898
|
+
children: null
|
|
899
|
+
}, t);
|
|
900
|
+
let a = et.get(t) ?? Pe, o = i.Component, s = i.ErrorBoundary ?? c, l = i.Pending, u;
|
|
901
|
+
u = a.status === "error" && !C(a.error) ? /* @__PURE__ */ m(s, {
|
|
902
|
+
error: a.error,
|
|
903
|
+
reset: () => {
|
|
904
|
+
S.current.invalidate(i.pattern), g((e) => e), tt(/* @__PURE__ */ new Map());
|
|
905
|
+
}
|
|
906
|
+
}) : a.status === "success" ? o ? /* @__PURE__ */ m(ke, {
|
|
907
|
+
resetKey: t,
|
|
908
|
+
Fallback: s,
|
|
909
|
+
children: /* @__PURE__ */ m(z.Provider, {
|
|
910
|
+
value: i.loader === void 0 ? R : a.data,
|
|
911
|
+
children: /* @__PURE__ */ m(o, {})
|
|
912
|
+
})
|
|
913
|
+
}) : null : l ? /* @__PURE__ */ m(l, {}) : null;
|
|
914
|
+
let d = {
|
|
915
|
+
pathname: e.p,
|
|
916
|
+
search: e.s,
|
|
917
|
+
navigate: N,
|
|
918
|
+
params: n.params,
|
|
919
|
+
prefetch: Ye,
|
|
920
|
+
loaderData: a.status === "success" ? a.data : void 0,
|
|
921
|
+
registerBlocker: O,
|
|
922
|
+
blocked: T
|
|
923
|
+
};
|
|
924
|
+
return /* @__PURE__ */ m(Ce.Provider, {
|
|
925
|
+
value: d,
|
|
926
|
+
children: /* @__PURE__ */ m(ze, {
|
|
927
|
+
onDismiss: () => window.history.back(),
|
|
928
|
+
children: u
|
|
929
|
+
})
|
|
930
|
+
}, t);
|
|
931
|
+
}) })), /* @__PURE__ */ m(Re, {
|
|
932
|
+
value: mt,
|
|
933
|
+
announcer: ft ? /* @__PURE__ */ m(Ve, { message: lt }) : null,
|
|
934
|
+
overlay: vt,
|
|
935
|
+
children: _t
|
|
936
|
+
});
|
|
937
|
+
}, Re = ({ value: e, announcer: t, overlay: n = null, children: r }) => /* @__PURE__ */ h(Ce.Provider, {
|
|
938
|
+
value: e,
|
|
939
|
+
children: [
|
|
940
|
+
r,
|
|
941
|
+
t,
|
|
942
|
+
n
|
|
943
|
+
]
|
|
944
|
+
}), B = (e, t) => /* @__PURE__ */ m(Re, {
|
|
945
|
+
value: e,
|
|
946
|
+
announcer: null,
|
|
947
|
+
children: t
|
|
948
|
+
}), ze = ({ onDismiss: e, children: t }) => {
|
|
949
|
+
let n = d(null);
|
|
950
|
+
return l(() => {
|
|
951
|
+
let e = n.current;
|
|
952
|
+
if (e && !e.open) {
|
|
953
|
+
if (typeof e.showModal == "function") try {
|
|
954
|
+
e.showModal();
|
|
955
|
+
} catch {
|
|
956
|
+
e.setAttribute("open", "");
|
|
957
|
+
}
|
|
958
|
+
else e.setAttribute("open", "");
|
|
959
|
+
}
|
|
960
|
+
let t = document.body.style.overflow;
|
|
961
|
+
return document.body.style.overflow = "hidden", () => {
|
|
962
|
+
document.body.style.overflow = t, e?.open && (typeof e.close == "function" ? e.close() : e.removeAttribute("open"));
|
|
963
|
+
};
|
|
964
|
+
}, []), /* @__PURE__ */ m("dialog", {
|
|
965
|
+
ref: n,
|
|
966
|
+
"data-vweb-overlay": "",
|
|
967
|
+
"aria-modal": "true",
|
|
968
|
+
onCancel: (t) => {
|
|
969
|
+
t.preventDefault(), e();
|
|
970
|
+
},
|
|
971
|
+
children: t
|
|
972
|
+
});
|
|
973
|
+
}, Be = {
|
|
974
|
+
position: "absolute",
|
|
975
|
+
width: 1,
|
|
976
|
+
height: 1,
|
|
977
|
+
padding: 0,
|
|
978
|
+
margin: -1,
|
|
979
|
+
overflow: "hidden",
|
|
980
|
+
clip: "rect(0, 0, 0, 0)",
|
|
981
|
+
whiteSpace: "nowrap",
|
|
982
|
+
border: 0
|
|
983
|
+
}, Ve = ({ message: e }) => /* @__PURE__ */ m("div", {
|
|
984
|
+
"data-vweb-route-announcer": "",
|
|
985
|
+
role: "status",
|
|
986
|
+
"aria-live": "assertive",
|
|
987
|
+
"aria-atomic": "true",
|
|
988
|
+
style: Be,
|
|
989
|
+
children: e
|
|
990
|
+
}), He = (e, t, n, r, i) => {
|
|
991
|
+
if (!e || e.length === 0) return t;
|
|
992
|
+
let a = t;
|
|
993
|
+
for (let t = e.length - 1; t >= 0; t--) {
|
|
994
|
+
let r = e[t];
|
|
995
|
+
if (r.Layout) {
|
|
996
|
+
let e = r.Layout;
|
|
997
|
+
a = /* @__PURE__ */ m(z.Provider, {
|
|
998
|
+
value: r.loader === void 0 ? R : i?.(t),
|
|
999
|
+
children: /* @__PURE__ */ m(e, { children: a })
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
if (r.Error) {
|
|
1003
|
+
let e = r.Error;
|
|
1004
|
+
a = /* @__PURE__ */ m(ke, {
|
|
1005
|
+
resetKey: n,
|
|
1006
|
+
Fallback: e,
|
|
1007
|
+
children: a
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
return a;
|
|
1012
|
+
}, Ue = () => L().pathname, We = () => L().navigate, V = () => L().params, Ge = () => {
|
|
1013
|
+
let e = c(z);
|
|
1014
|
+
if (e === R) throw Error("useLoaderData() was called at a level that declares no `loader`. Export `loader` from this page/layout, or — if this component is shared between routes that have one and routes that do not — read it with `useOptionalLoaderData()`, which returns `undefined` here instead of throwing. The React component stack below names the component.");
|
|
1015
|
+
return e;
|
|
1016
|
+
}, H = () => {
|
|
1017
|
+
let e = c(z);
|
|
1018
|
+
return e === R ? void 0 : e;
|
|
1019
|
+
}, Ke = () => L().prefetch, U = (e) => {
|
|
1020
|
+
let { registerBlocker: t, blocked: n } = L(), r = d(Symbol("voltro:blocker")), i = d(e);
|
|
1021
|
+
return i.current = e, l(() => {
|
|
1022
|
+
let e = r.current;
|
|
1023
|
+
return t(e, (e) => {
|
|
1024
|
+
let t = i.current;
|
|
1025
|
+
return typeof t == "function" ? t(e) : t;
|
|
1026
|
+
});
|
|
1027
|
+
}, [t]), n ? {
|
|
1028
|
+
blocked: !0,
|
|
1029
|
+
to: n.to,
|
|
1030
|
+
retry: n.retry,
|
|
1031
|
+
reset: n.reset
|
|
1032
|
+
} : { blocked: !1 };
|
|
1033
|
+
}, W = (e) => e instanceof URLSearchParams ? e : new URLSearchParams(e);
|
|
1034
|
+
function qe(e) {
|
|
1035
|
+
let { navigate: t, pathname: n, search: r } = L();
|
|
1036
|
+
return s((i, a) => {
|
|
1037
|
+
let o = new URLSearchParams(r.split("#")[0] ?? ""), s = e === void 0 ? W(typeof i == "function" ? i(o) : i).toString() : O(typeof i == "function" ? i(D(e, o)) : i).toString(), c = s ? `${n}?${s}` : n;
|
|
1038
|
+
t(c, {
|
|
1039
|
+
replace: !a?.push,
|
|
1040
|
+
...a?.scroll === void 0 ? {} : { scroll: a.scroll }
|
|
1041
|
+
});
|
|
1042
|
+
}, [
|
|
1043
|
+
t,
|
|
1044
|
+
e,
|
|
1045
|
+
n,
|
|
1046
|
+
r
|
|
1047
|
+
]);
|
|
1048
|
+
}
|
|
1049
|
+
var Je = (e) => e;
|
|
1050
|
+
function G(e, t) {
|
|
1051
|
+
let n = O(t).toString();
|
|
1052
|
+
return n ? `${e}?${n}` : e;
|
|
1053
|
+
}
|
|
1054
|
+
var K = (e, t) => `${e}#${t.replace(/^#/, "")}`, Ye = (e) => /^([a-z][a-z0-9+.-]*:|\/\/|#)/i.test(e), q = ({ to: e, children: t, onClick: n, prefetch: r = !1, replace: i = !1, transition: a, onMouseEnter: o, onFocus: c, ref: u, ...f }) => {
|
|
1055
|
+
let ee = We(), p = Ke(), h = Ye(e), g = d(null), _ = s((e) => {
|
|
1056
|
+
g.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
1057
|
+
}, [u]);
|
|
1058
|
+
l(() => {
|
|
1059
|
+
if (r !== "visible" || h) return;
|
|
1060
|
+
let t = g.current;
|
|
1061
|
+
if (!t || typeof IntersectionObserver > "u") return;
|
|
1062
|
+
let n = new IntersectionObserver((t) => {
|
|
1063
|
+
t.some((e) => e.isIntersecting) && (n.disconnect(), p(e));
|
|
1064
|
+
}, { rootMargin: "128px" });
|
|
1065
|
+
return n.observe(t), () => n.disconnect();
|
|
1066
|
+
}, [
|
|
1067
|
+
r,
|
|
1068
|
+
h,
|
|
1069
|
+
e,
|
|
1070
|
+
p
|
|
1071
|
+
]);
|
|
1072
|
+
let te = (t) => {
|
|
1073
|
+
if (h || t.metaKey || t.ctrlKey || t.shiftKey || t.altKey || t.button !== 0) return;
|
|
1074
|
+
t.preventDefault(), n?.(t);
|
|
1075
|
+
let r = i || a !== void 0 ? {
|
|
1076
|
+
...i ? { replace: i } : {},
|
|
1077
|
+
...a === void 0 ? {} : { transition: a }
|
|
1078
|
+
} : void 0;
|
|
1079
|
+
ee(e, r);
|
|
1080
|
+
}, v = (t) => {
|
|
1081
|
+
r && !h && p(e), o?.(t);
|
|
1082
|
+
}, y = (t) => {
|
|
1083
|
+
r && !h && p(e), c?.(t);
|
|
1084
|
+
};
|
|
1085
|
+
return /* @__PURE__ */ m("a", {
|
|
1086
|
+
...f,
|
|
1087
|
+
ref: _,
|
|
1088
|
+
href: e,
|
|
1089
|
+
onClick: te,
|
|
1090
|
+
onMouseEnter: v,
|
|
1091
|
+
onFocus: y,
|
|
1092
|
+
children: t
|
|
1093
|
+
});
|
|
1094
|
+
}, J = (e) => q({
|
|
1095
|
+
...e,
|
|
1096
|
+
to: e.to
|
|
1097
|
+
}), Y = (e) => ({
|
|
1098
|
+
Component: e.default,
|
|
1099
|
+
meta: e.meta,
|
|
1100
|
+
loader: e.loader,
|
|
1101
|
+
ErrorBoundary: e.ErrorBoundary,
|
|
1102
|
+
Pending: e.Pending,
|
|
1103
|
+
renderMode: e.renderMode,
|
|
1104
|
+
interactive: e.interactive,
|
|
1105
|
+
intercept: e.intercept
|
|
1106
|
+
}), X = (e, t, n = {}) => ({
|
|
1107
|
+
pattern: e,
|
|
1108
|
+
...Y(t),
|
|
1109
|
+
chain: n.chain
|
|
1110
|
+
}), Xe = (e, t, n = {}) => ({
|
|
1111
|
+
pattern: e,
|
|
1112
|
+
load: t,
|
|
1113
|
+
chain: n.chain
|
|
1114
|
+
}), Ze = async (e, t) => {
|
|
1115
|
+
let n = j(e.map(de), t)?.route.load;
|
|
1116
|
+
if (n) try {
|
|
1117
|
+
await n();
|
|
1118
|
+
} catch {}
|
|
1119
|
+
};
|
|
1120
|
+
//#endregion
|
|
1121
|
+
//#region src/serverContext.tsx
|
|
1122
|
+
function Qe(e) {
|
|
1123
|
+
let t = ee(), n = c(Ce), r;
|
|
1124
|
+
if (t !== null) {
|
|
1125
|
+
let e = t.url.indexOf("?");
|
|
1126
|
+
r = new URLSearchParams(e >= 0 ? t.url.slice(e + 1) : "");
|
|
1127
|
+
} else r = n === null ? typeof window < "u" ? new URLSearchParams(window.location.search) : new URLSearchParams() : new URLSearchParams((n.search.split("#")[0] ?? "").replace(/^\?/, ""));
|
|
1128
|
+
return e === void 0 ? r : D(e, r);
|
|
1129
|
+
}
|
|
1130
|
+
var Z = (e) => {
|
|
1131
|
+
let t = {};
|
|
1132
|
+
if (!e) return t;
|
|
1133
|
+
for (let n of e.split(";")) {
|
|
1134
|
+
let e = n.indexOf("=");
|
|
1135
|
+
if (e < 0) continue;
|
|
1136
|
+
let r = n.slice(0, e).trim();
|
|
1137
|
+
if (!r) continue;
|
|
1138
|
+
let i = n.slice(e + 1).trim();
|
|
1139
|
+
i.startsWith("\"") && i.endsWith("\"") && (i = i.slice(1, -1));
|
|
1140
|
+
try {
|
|
1141
|
+
i = decodeURIComponent(i);
|
|
1142
|
+
} catch {}
|
|
1143
|
+
t[r] = i;
|
|
1144
|
+
}
|
|
1145
|
+
return t;
|
|
1146
|
+
};
|
|
1147
|
+
//#endregion
|
|
1148
|
+
export { H as A, x as B, he as C, Ge as D, U as E, G as F, b as G, C as H, D as I, ne as K, O as L, Ke as M, qe as N, Ue as O, K as P, w as R, ye as S, fe as T, ae as U, oe as V, S as W, M as _, z as a, Ze as b, je as c, Le as d, Ce as f, Xe as g, ge as h, ve as i, V as j, We as k, J as l, Je as m, Qe as n, R as o, de as p, re as q, q as r, Ae as s, Z as t, se as u, j as v, pe as w, B as x, X as y, ie as z };
|