@voltro/web 0.8.0 → 0.10.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.
@@ -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-ga64vk2B.js";
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, _ = (e) => (h.add(e), () => {
14
+ }, g = () => m, ne = (e) => (h.add(e), () => {
15
15
  h.delete(e);
16
- }), v = class extends Error {
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
- }, y = class extends Error {
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
- }, 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("]]") ? {
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: T
40
+ weight: w
36
41
  } : e.startsWith("[...") && e.endsWith("]") ? {
37
42
  source: "(.+)",
38
43
  paramName: e.slice(4, -1),
39
- weight: E
44
+ weight: T
40
45
  } : e.startsWith("[") && e.endsWith("]") ? {
41
46
  source: "([^/]+)",
42
47
  paramName: e.slice(1, -1),
43
- weight: w
48
+ weight: ie
44
49
  } : {
45
50
  source: e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
46
51
  paramName: null,
47
52
  weight: C
48
- }, re = (e) => {
49
- let t = e.pattern.split("/").map(D);
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 === E || r.weight === T) throw Error(`Route ${JSON.stringify(e.pattern)}: catch-all segment must be last. Anything after a catch-all is unreachable.`);
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 === T ? `${t.slice(0, -1).map((e) => e.source).join("/")}(?:/(.*))?` : t.map((e) => e.source).join("/");
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
- }, ie = (e) => [...e].map((e, t) => ({
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), O = (e, t) => {
67
- let n = ie(e);
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) => 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) => {
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
- }, A = (e, t, n) => {
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
- }, j = { kind: "native" }, ue = (e, t) => {
148
- if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return j;
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 j;
155
+ if (!r) return M;
151
156
  let i = r.getAttribute("href");
152
- if (i === null) return j;
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 j;
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 j;
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 j;
166
+ return M;
162
167
  }
163
- return s.origin !== c.origin || s.pathname === c.pathname && s.search === c.search && s.hash !== "" ? j : {
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
- }, M = (e) => {
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
- }, N = (e) => {
175
- let t = M(e);
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 = N(e.hash);
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
- }, P = 0, pe = () => {
201
+ }, F = 0, pe = () => {
197
202
  let e = typeof crypto < "u" ? crypto : void 0;
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);
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
- }, L = e("loaderData", void 0), me = (e, t) => {
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 = R(t), document.head.appendChild(e), o.push(e);
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
- }, R = (e) => JSON.stringify(e).replace(/<\/(script)/gi, "<\\/$1").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"), z = class extends o {
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
- }, 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), () => {
291
- x.current.delete(e);
292
- }), []), E = d(/* @__PURE__ */ new Map()), D = d(null), j = u(() => ie(e.map(re)), [e]);
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 = E.current.get(M());
312
- D.current = e ?? {
316
+ let e = w.current.get(M());
317
+ T.current = e ?? {
313
318
  x: 0,
314
319
  y: 0
315
- }, h(window.location.pathname), y(window.location.search + window.location.hash);
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
- E.current.set(M(), {
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), y(t.search + t.hash), n?.scroll !== !1 && fe(t);
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 x.current.values()) if (n({
334
+ for (let n of b.current.values()) if (n({
330
335
  to: e,
331
336
  ...t ? { opts: t } : {}
332
337
  })) {
333
- w({
338
+ C({
334
339
  to: e,
335
340
  ...t ? { opts: t } : {},
336
341
  retry: () => {
337
- w(null), N(e, r, t);
342
+ C(null), N(e, r, t);
338
343
  },
339
- reset: () => w(null)
344
+ reset: () => C(null)
340
345
  });
341
346
  return;
342
347
  }
@@ -351,81 +356,85 @@ var m = {
351
356
  };
352
357
  return document.addEventListener("click", e), () => document.removeEventListener("click", e);
353
358
  }, [P]);
354
- let I = u(() => O(j, m), [j, m]), R = d(/* @__PURE__ */ new Map()), [ve, ye] = f(0);
359
+ let F = u(() => k(E, m), [E, m]), L = d(/* @__PURE__ */ new Map()), [ve, be] = f(0);
355
360
  l(() => {
356
- let e = I?.route;
357
- if (!e?.load || R.current.has(e.pattern)) return;
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 || (R.current.set(e.pattern, n), ye((e) => e + 1));
365
+ t || (L.current.set(e.pattern, n), be((e) => e + 1));
361
366
  }).catch(() => {}), () => {
362
367
  t = !0;
363
368
  };
364
- }, [I?.route.load ? I.route.pattern : null]);
365
- let B = u(() => {
366
- if (!I) return null;
367
- let e = I.route;
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 = R.current.get(e.pattern);
374
+ let t = L.current.get(e.pattern);
370
375
  return t ? {
371
376
  ...e,
372
- ...Ee(t),
377
+ ...ke(t),
373
378
  load: void 0
374
379
  } : null;
375
- }, [I, ve]), V = u(() => O(j, g), [j, g]), H = u(() => {
376
- if (!V) return null;
377
- let e = V.route;
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 = R.current.get(e.pattern);
384
+ let t = L.current.get(e.pattern);
380
385
  return t ? {
381
386
  ...e,
382
- ...Ee(t),
387
+ ...ke(t),
383
388
  load: void 0
384
389
  } : null;
385
- }, [V, ve]), Se = s((e) => {
386
- let t = new URL(e, window.location.origin), n = O(j, t.pathname);
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
- b.current.start(e, (e) => oe(r, {
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(k(n.route.pattern, n.params), n.route.loader), n.route.chain?.forEach((e, t) => {
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
- }, [j]), [U, W] = f({ status: "idle" }), G = d(void 0);
403
+ }, [E]), [U, W] = f({ status: "idle" }), G = d(void 0);
399
404
  G.current === void 0 && (G.current = a());
400
- let Ce = d(!1), [K, we] = f(() => ({
405
+ let we = d(!1), [Te, Ee] = f(() => G.current?.pageClientOnly === !0 && G.current.pathname === m);
406
+ l(() => {
407
+ Ee(!1);
408
+ }, []);
409
+ let [K, De] = f(() => ({
401
410
  pathname: m,
402
411
  data: me(G.current ?? null, m),
403
- chain: I?.route.chain
412
+ chain: F?.route.chain
404
413
  }));
405
414
  l(() => {
406
415
  let e = (e) => {
407
- _(m), we((t) => t.pathname === m && he(t.data, e) ? t : {
416
+ ne(m), De((t) => t.pathname === m && he(t.data, e) ? t : {
408
417
  pathname: m,
409
418
  data: e,
410
- chain: I?.route.chain
419
+ chain: F?.route.chain
411
420
  });
412
421
  };
413
- if (!I) {
422
+ if (!F) {
414
423
  W({ status: "idle" }), e(void 0);
415
424
  return;
416
425
  }
417
- if (!B) {
426
+ if (!z) {
418
427
  W({
419
428
  status: "pending",
420
- key: k(I.route.pattern, I.params)
429
+ key: A(F.route.pattern, F.params)
421
430
  });
422
431
  return;
423
432
  }
424
- let t = B, { params: n } = I, r = t.chain, i = (t.Pending ?? A(r, "Pending", r ? r.length - 1 : -1)) !== void 0, a = [];
433
+ let t = z, { params: n } = F, r = t.chain, i = (t.Pending ?? j(r, "Pending", r ? r.length - 1 : -1)) !== void 0, a = [];
425
434
  if (t.loader) {
426
435
  let e = t.loader;
427
436
  a.push({
428
- cacheKey: k(t.pattern, n),
437
+ cacheKey: A(t.pattern, n),
429
438
  target: "page",
430
439
  run: (t) => oe(e, {
431
440
  params: n,
@@ -451,18 +460,18 @@ var m = {
451
460
  W({ status: "idle" }), e(void 0);
452
461
  return;
453
462
  }
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));
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));
458
467
  }
459
468
  let c = a.map((e) => ({
460
469
  spec: e,
461
- entry: b.current.start(e.cacheKey, e.run)
470
+ entry: y.current.start(e.cacheKey, e.run)
462
471
  })), l = () => {
463
472
  let e = {}, t;
464
473
  for (let { spec: n } of c) {
465
- let r = b.current.get(n.cacheKey);
474
+ let r = y.current.get(n.cacheKey);
466
475
  if (!r || r.status === "pending") return null;
467
476
  if (r.status === "error") return {
468
477
  ok: !1,
@@ -487,13 +496,13 @@ var m = {
487
496
  status: "error",
488
497
  key: o,
489
498
  error: u.error
490
- }), S(u.error) || e(void 0));
499
+ }), x(u.error) || e(void 0));
491
500
  return;
492
501
  }
493
502
  W({
494
503
  status: "pending",
495
504
  key: o
496
- }), i && _(m);
505
+ }), i && ne(m);
497
506
  let d = !1, f = c.map(({ entry: e }) => e.status === "pending" ? e.promise : Promise.resolve());
498
507
  return Promise.all(f).then(() => {
499
508
  if (d) return;
@@ -506,62 +515,62 @@ var m = {
506
515
  status: "error",
507
516
  key: o,
508
517
  error: t.error
509
- }), S(t.error) || e(void 0)));
518
+ }), x(t.error) || e(void 0)));
510
519
  }), () => {
511
520
  d = !0;
512
521
  };
513
522
  }, [
514
- I,
515
- B,
523
+ F,
524
+ z,
516
525
  m
517
526
  ]);
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);
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);
522
531
  }, [
532
+ B,
523
533
  V,
524
- H,
525
534
  q,
526
- De
535
+ Ae
527
536
  ]);
528
537
  l(() => _e(X), [X]);
529
- let [Oe, Z] = f(""), Q = d(!1), [ke, Ae] = f(!1);
538
+ let [je, Z] = f(""), Q = d(!1), [Me, Ne] = f(!1);
530
539
  l(() => {
531
540
  if (!Q.current) {
532
- Q.current = !0, Ae(!0);
541
+ Q.current = !0, Ne(!0);
533
542
  return;
534
543
  }
535
544
  let e = X?.title ?? (typeof document < "u" ? document.title : "");
536
545
  Z(e && e.length > 0 ? e : g);
537
546
  }, [g, X]), l(() => {
538
- let e = D.current;
539
- e && (D.current = null, de(() => window.scrollTo(e.x, e.y)));
547
+ let e = T.current;
548
+ e && (T.current = null, de(() => window.scrollTo(e.x, e.y)));
540
549
  }, [g]);
541
- let je = u(() => ({
550
+ let Pe = u(() => ({
542
551
  pathname: g,
543
- search: v,
552
+ search: _,
544
553
  navigate: P,
545
- params: V?.params ?? {},
546
- prefetch: Se,
554
+ params: B?.params ?? {},
555
+ prefetch: H,
547
556
  loaderData: q,
548
- registerBlocker: T,
549
- blocked: C
557
+ registerBlocker: ie,
558
+ blocked: S
550
559
  }), [
551
560
  g,
552
- v,
561
+ _,
553
562
  P,
554
- V,
555
- Se,
563
+ B,
564
+ H,
556
565
  q,
557
- T,
558
- C
566
+ ie,
567
+ S
559
568
  ]);
560
569
  l(() => {
561
570
  if (typeof window > "u") return;
562
571
  let e = (e) => {
563
572
  let t = !1;
564
- for (let e of x.current.values()) if (e({ to: window.location.pathname })) {
573
+ for (let e of b.current.values()) if (e({ to: window.location.pathname })) {
565
574
  t = !0;
566
575
  break;
567
576
  }
@@ -571,12 +580,12 @@ var m = {
571
580
  }, []), l(() => {
572
581
  te({
573
582
  pathname: g,
574
- params: V?.params ?? {},
583
+ params: B?.params ?? {},
575
584
  loaderData: q
576
585
  });
577
586
  }, [
578
587
  g,
579
- V,
588
+ B,
580
589
  q
581
590
  ]), l(() => {
582
591
  if (U.status === "pending") return t({
@@ -591,62 +600,63 @@ var m = {
591
600
  label: "Loader failed"
592
601
  });
593
602
  }, [U.status]), l(() => {
594
- U.status === "error" && S(U.error) && P(U.error.location, { replace: !0 });
603
+ U.status === "error" && x(U.error) && P(U.error.location, { replace: !0 });
595
604
  }, [U, P]);
596
- let Me = () => {
605
+ let Fe = () => {
597
606
  let e = ce(i, g);
598
607
  if (e) {
599
608
  let { Component: t, chain: n } = e;
600
- return xe(n, /* @__PURE__ */ p(t, {}), g, c);
609
+ return Ce(n, /* @__PURE__ */ p(t, {}), g, c);
601
610
  }
602
611
  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();
612
+ }, Ie = J && B && U.status === "error" ? U.error : void 0, $;
613
+ if (!B) $ = Fe();
614
+ else if (re(Ie)) $ = Fe();
606
615
  else {
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, {
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, {
609
619
  error: U.error,
610
620
  reset: () => {
611
- b.current.invalidate(V.route.pattern), h((e) => e), W({ status: "idle" });
621
+ y.current.invalidate(B.route.pattern), h((e) => e), W({ status: "idle" });
612
622
  }
613
623
  });
614
624
  else if (J && U.status === "pending") {
615
- let i = H?.Pending ?? A(e, "Pending", t);
625
+ let i = V?.Pending ?? j(e, "Pending", t);
616
626
  if (i) r = /* @__PURE__ */ p(i, {});
617
- else if (H?.Component) {
618
- let e = H.Component;
619
- r = /* @__PURE__ */ p(z, {
627
+ else if (V?.Component) {
628
+ let e = V.Component;
629
+ r = /* @__PURE__ */ p(ye, {
620
630
  resetKey: g,
621
631
  Fallback: n,
622
- children: /* @__PURE__ */ p(L.Provider, {
623
- value: Te,
632
+ children: /* @__PURE__ */ p(R.Provider, {
633
+ value: Oe,
624
634
  children: /* @__PURE__ */ p(e, {})
625
635
  })
626
636
  });
627
637
  } else r = null;
628
638
  } else {
629
- let e = H?.Component;
630
- r = e ? /* @__PURE__ */ p(z, {
639
+ let e = V?.Component;
640
+ r = e ? /* @__PURE__ */ p(ye, {
631
641
  resetKey: g,
632
642
  Fallback: n,
633
- children: /* @__PURE__ */ p(L.Provider, {
634
- value: Te,
643
+ children: /* @__PURE__ */ p(R.Provider, {
644
+ value: Oe,
635
645
  children: /* @__PURE__ */ p(e, {})
636
646
  })
637
647
  }) : null;
638
648
  }
639
- $ = xe(e, r, g, c, (t) => {
649
+ $ = Ce(e, r, g, c, (t) => {
640
650
  if (Y) return K.data?.segments[t];
641
651
  let n = e?.[t]?.Layout;
642
652
  return n !== void 0 && n === K.chain?.[t]?.Layout ? K.data?.segments[t] : void 0;
643
653
  });
644
654
  }
645
- return /* @__PURE__ */ ee(F.Provider, {
646
- value: je,
647
- children: [$, ke ? /* @__PURE__ */ p(be, { message: Oe }) : null]
655
+ return /* @__PURE__ */ ee(I.Provider, {
656
+ value: Pe,
657
+ children: [$, Me ? /* @__PURE__ */ p(Se, { message: je }) : null]
648
658
  });
649
- }, ye = {
659
+ }, B = {
650
660
  position: "absolute",
651
661
  width: 1,
652
662
  height: 1,
@@ -656,28 +666,28 @@ var m = {
656
666
  clip: "rect(0, 0, 0, 0)",
657
667
  whiteSpace: "nowrap",
658
668
  border: 0
659
- }, be = ({ message: e }) => /* @__PURE__ */ p("div", {
669
+ }, Se = ({ message: e }) => /* @__PURE__ */ p("div", {
660
670
  "data-vweb-route-announcer": "",
661
671
  role: "status",
662
672
  "aria-live": "assertive",
663
673
  "aria-atomic": "true",
664
- style: ye,
674
+ style: B,
665
675
  children: e
666
- }), xe = (e, t, n, r, i) => {
676
+ }), Ce = (e, t, n, r, i) => {
667
677
  if (!e || e.length === 0) return t;
668
678
  let a = t;
669
679
  for (let t = e.length - 1; t >= 0; t--) {
670
680
  let r = e[t];
671
681
  if (r.Layout) {
672
682
  let e = r.Layout;
673
- a = /* @__PURE__ */ p(L.Provider, {
683
+ a = /* @__PURE__ */ p(R.Provider, {
674
684
  value: i?.(t),
675
685
  children: /* @__PURE__ */ p(e, { children: a })
676
686
  });
677
687
  }
678
688
  if (r.Error) {
679
689
  let e = r.Error;
680
- a = /* @__PURE__ */ p(z, {
690
+ a = /* @__PURE__ */ p(ye, {
681
691
  resetKey: n,
682
692
  Fallback: e,
683
693
  children: a
@@ -685,8 +695,8 @@ var m = {
685
695
  }
686
696
  }
687
697
  return a;
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);
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);
690
700
  return i.current = e, l(() => {
691
701
  let e = r.current;
692
702
  return t(e, (e) => {
@@ -699,22 +709,22 @@ var m = {
699
709
  retry: n.retry,
700
710
  reset: n.reset
701
711
  } : { blocked: !1 };
702
- }, G = (e) => e instanceof URLSearchParams ? e : new URLSearchParams(e), Ce = () => {
703
- let { navigate: e } = I();
712
+ }, Te = (e) => e instanceof URLSearchParams ? e : new URLSearchParams(e), Ee = () => {
713
+ let { navigate: e } = L();
704
714
  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;
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;
706
716
  e(o, {
707
717
  replace: !n?.push,
708
718
  ...n?.scroll === void 0 ? {} : { scroll: n.scroll }
709
719
  });
710
720
  }, [e]);
711
- }, K = (e) => e, we = (e, t) => {
721
+ }, K = (e) => e, De = (e, t) => {
712
722
  let n = new URLSearchParams();
713
723
  for (let [e, r] of Object.entries(t)) r !== void 0 && n.append(e, String(r));
714
724
  let r = n.toString();
715
725
  return r ? `${e}?${r}` : e;
716
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 }) => {
717
- let c = V(), l = U(), u = J(e), d = (t) => {
727
+ let c = H(), l = G(), u = J(e), d = (t) => {
718
728
  u || t.metaKey || t.ctrlKey || t.shiftKey || t.altKey || t.button !== 0 || (t.preventDefault(), n?.(t), c(e, i ? { replace: i } : void 0));
719
729
  }, f = (t) => {
720
730
  r && !u && l(e), a?.(t);
@@ -729,10 +739,10 @@ var m = {
729
739
  onFocus: ee,
730
740
  children: t
731
741
  });
732
- }, Te = (e) => Y({
742
+ }, Oe = (e) => Y({
733
743
  ...e,
734
744
  to: e.to
735
- }), Ee = (e) => ({
745
+ }), ke = (e) => ({
736
746
  Component: e.default,
737
747
  meta: e.meta,
738
748
  loader: e.loader,
@@ -740,30 +750,30 @@ var m = {
740
750
  Pending: e.Pending,
741
751
  renderMode: e.renderMode,
742
752
  interactive: e.interactive
743
- }), De = (e, t, n = {}) => ({
753
+ }), Ae = (e, t, n = {}) => ({
744
754
  pattern: e,
745
- ...Ee(t),
755
+ ...ke(t),
746
756
  chain: n.chain
747
757
  }), X = (e, t, n = {}) => ({
748
758
  pattern: e,
749
759
  load: t,
750
760
  chain: n.chain
751
- }), Oe = async (e, t) => {
752
- let n = O(e.map(re), t)?.route.load;
761
+ }), je = async (e, t) => {
762
+ let n = k(e.map(D), t)?.route.load;
753
763
  if (n) try {
754
764
  await n();
755
765
  } catch {}
756
- }, Z = e("serverRequest", null), Q = () => c(Z), ke = () => {
766
+ }, Z = e("serverRequest", null), Q = () => c(Z), Me = () => {
757
767
  let e = Q();
758
768
  if (e !== null) {
759
769
  let t = e.url.indexOf("?");
760
770
  return new URLSearchParams(t >= 0 ? e.url.slice(t + 1) : "");
761
771
  }
762
772
  return typeof window < "u" ? new URLSearchParams(window.location.search) : new URLSearchParams();
763
- }, Ae = ({ value: e, children: t }) => /* @__PURE__ */ p(Z.Provider, {
773
+ }, Ne = ({ value: e, children: t }) => /* @__PURE__ */ p(Z.Provider, {
764
774
  value: e,
765
775
  children: t
766
- }), je = (e) => {
776
+ }), Pe = (e) => {
767
777
  let t = {};
768
778
  if (!e) return t;
769
779
  for (let n of e.split(";")) {
@@ -781,4 +791,4 @@ var m = {
781
791
  return t;
782
792
  };
783
793
  //#endregion
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 };
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 };