@demiurgejs/core 0.2.0-beta.5 → 0.2.0-beta.7

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.
Files changed (94) hide show
  1. package/README.md +14 -0
  2. package/bin/demiurge.mjs +6 -0
  3. package/dist/browser/file-router.d.ts +1 -0
  4. package/dist/browser/file-router.d.ts.map +1 -1
  5. package/dist/chunks/{document-shell-9GPwtcTt.js → document-shell-C0aPrkhd.js} +2 -2
  6. package/dist/chunks/{document-shell-9GPwtcTt.js.map → document-shell-C0aPrkhd.js.map} +1 -1
  7. package/dist/chunks/image-CRerJ5BY.js +145 -0
  8. package/dist/chunks/image-CRerJ5BY.js.map +1 -0
  9. package/dist/chunks/{image-codec-Dh1POFhE.js → image-codec-CQ8Cwxwb.js} +2 -2
  10. package/dist/chunks/{image-codec-Dh1POFhE.js.map → image-codec-CQ8Cwxwb.js.map} +1 -1
  11. package/dist/chunks/{images-CG7ZzayG.js → images-QgdmLyQ3.js} +11 -11
  12. package/dist/chunks/{images-CG7ZzayG.js.map → images-QgdmLyQ3.js.map} +1 -1
  13. package/dist/chunks/{index-0MNiR_wo.js → index-LYve1rQp.js} +286 -351
  14. package/dist/chunks/index-LYve1rQp.js.map +1 -0
  15. package/dist/chunks/links-iU22QkCE.js +68 -0
  16. package/dist/chunks/links-iU22QkCE.js.map +1 -0
  17. package/dist/chunks/{plugin-BZauDxRY.js → plugin-bkP6WwrS.js} +13 -12
  18. package/dist/chunks/{plugin-BZauDxRY.js.map → plugin-bkP6WwrS.js.map} +1 -1
  19. package/dist/chunks/runtime-BH519j2t.js +294 -0
  20. package/dist/chunks/runtime-BH519j2t.js.map +1 -0
  21. package/dist/chunks/streaming-BlKlC3nw.js +427 -0
  22. package/dist/chunks/streaming-BlKlC3nw.js.map +1 -0
  23. package/dist/chunks/{testing-CUwGj2ie.js → testing-BEW1nchS.js} +645 -630
  24. package/dist/chunks/testing-BEW1nchS.js.map +1 -0
  25. package/dist/chunks/{vite-QoqrGl6f.js → vite-BADZA8Fl.js} +73 -70
  26. package/dist/chunks/vite-BADZA8Fl.js.map +1 -0
  27. package/dist/cli.d.ts +8 -2
  28. package/dist/cli.d.ts.map +1 -1
  29. package/dist/cli.js +186 -122
  30. package/dist/cli.js.map +1 -1
  31. package/dist/config/index.js +2 -2
  32. package/dist/config/types.d.ts +3 -1
  33. package/dist/config/types.d.ts.map +1 -1
  34. package/dist/config/validate.d.ts.map +1 -1
  35. package/dist/data/cache.d.ts +5 -0
  36. package/dist/data/cache.d.ts.map +1 -1
  37. package/dist/data/index.d.ts +1 -1
  38. package/dist/data/index.d.ts.map +1 -1
  39. package/dist/data/testing.d.ts.map +1 -1
  40. package/dist/data/testing.js +101 -67
  41. package/dist/data/testing.js.map +1 -1
  42. package/dist/data/tiered.d.ts.map +1 -1
  43. package/dist/edge/index.js +27 -26
  44. package/dist/edge/index.js.map +1 -1
  45. package/dist/edge/stores.d.ts.map +1 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +910 -891
  49. package/dist/index.js.map +1 -1
  50. package/dist/internal/testing.js +2 -2
  51. package/dist/kv/index.js +7 -6
  52. package/dist/kv/index.js.map +1 -1
  53. package/dist/kv/store.d.ts.map +1 -1
  54. package/dist/node/http.d.ts +2 -0
  55. package/dist/node/http.d.ts.map +1 -1
  56. package/dist/node/index.d.ts +1 -1
  57. package/dist/node/index.d.ts.map +1 -1
  58. package/dist/node/index.js +12 -11
  59. package/dist/node/index.js.map +1 -1
  60. package/dist/node/serve.d.ts +4 -0
  61. package/dist/node/serve.d.ts.map +1 -1
  62. package/dist/redis/index.js +29 -28
  63. package/dist/redis/index.js.map +1 -1
  64. package/dist/redis/store.d.ts.map +1 -1
  65. package/dist/route/serialization.d.ts +4 -4
  66. package/dist/route/serialization.d.ts.map +1 -1
  67. package/dist/static/index.d.ts.map +1 -1
  68. package/dist/static/index.js +255 -255
  69. package/dist/static/index.js.map +1 -1
  70. package/dist/static/testing.d.ts +26 -0
  71. package/dist/static/testing.d.ts.map +1 -0
  72. package/dist/static/testing.js +76 -0
  73. package/dist/static/testing.js.map +1 -0
  74. package/dist/testing/index.d.ts +47 -0
  75. package/dist/testing/index.d.ts.map +1 -0
  76. package/dist/testing/index.js +99 -0
  77. package/dist/testing/index.js.map +1 -0
  78. package/dist/vercel/build.d.ts +31 -0
  79. package/dist/vercel/build.d.ts.map +1 -0
  80. package/dist/vercel/config.d.ts +15 -0
  81. package/dist/vercel/config.d.ts.map +1 -0
  82. package/dist/vercel/index.d.ts +7 -0
  83. package/dist/vercel/index.d.ts.map +1 -0
  84. package/dist/vercel/index.js +11 -0
  85. package/dist/vercel/index.js.map +1 -0
  86. package/dist/vercel/runtime.d.ts +29 -0
  87. package/dist/vercel/runtime.d.ts.map +1 -0
  88. package/dist/vite/index.js +1 -1
  89. package/package.json +13 -1
  90. package/dist/chunks/index-0MNiR_wo.js.map +0 -1
  91. package/dist/chunks/streaming-GYIsVTQH.js +0 -560
  92. package/dist/chunks/streaming-GYIsVTQH.js.map +0 -1
  93. package/dist/chunks/testing-CUwGj2ie.js.map +0 -1
  94. package/dist/chunks/vite-QoqrGl6f.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,24 +1,26 @@
1
- import { jsx as Et } from "react/jsx-runtime";
2
- import { createContext as We, useCallback as At, createElement as R, useContext as Je, useRef as k, useMemo as ae, useActionState as nr, useId as or, useLayoutEffect as ne, useState as U, useEffect as Y, Fragment as Te, Component as ir } from "react";
3
- import { g as ar, h as at, i as sr, H as cr, j as st, k as ur, l as lr, m as Me } from "./chunks/index-0MNiR_wo.js";
4
- import { F as oi, n as ii, o as ai, q as si, t as ci, d as ui, u as li, v as di, w as fi, x as hi, y as pi, z as mi, p as yi, a as gi, A as wi, B as vi } from "./chunks/index-0MNiR_wo.js";
5
- import { O as ct, J as dr, P as Ge, i as ee, Q as fr, R as hr, s as Ye, S as Ze, T as Xe, U as pr, V as xt, W as mr, l as Qe, L as kt, X as Be, Y as yr, r as gr, z as Rt, Z as wr, _ as ut, $ as vr, a0 as br, a1 as Sr, a2 as Er, a3 as Ar, a4 as xr, a5 as kr, a6 as Rr } from "./chunks/testing-CUwGj2ie.js";
6
- import { a7 as Si, D as Ei, a8 as Ai, a9 as xi, aa as ki, ab as Ri, ac as Ti, ad as Mi, ae as Ci, af as $i, ag as Ni, ah as Li, ai as Ii, aj as Di, ak as Pi, al as Oi, am as _i, an as Fi, H as Ui, ao as Bi, e as Hi, c as zi, G as ji, n as Vi, k as qi, ap as Ki, aq as Wi, ar as Ji, f as Gi, as as Yi, at as Zi, au as Xi, av as Qi, aw as ea, ax as ta, ay as ra, az as na, aA as oa, aB as ia, aC as aa, q as sa, aD as ca, aE as ua, h as la, aF as da, aG as fa, x as ha, aH as pa, aI as ma, aJ as ya, aK as ga, j as wa, aL as va, aM as ba, aN as Sa, m as Ea, aO as Aa, aP as xa, aQ as ka, aR as Ra, aS as Ta, aT as Ma, aU as Ca, aV as $a, aW as Na, p as La, aX as Ia, u as Da, aY as Pa, aZ as Oa, a_ as _a, w as Fa, a$ as Ua, I as Ba, K as Ha, b0 as za, b1 as ja, b2 as Va, b3 as qa, b4 as Ka, b5 as Wa, b6 as Ja, b7 as Ga, N as Ya, v as Za, b8 as Xa, o as Qa, b as es } from "./chunks/testing-CUwGj2ie.js";
7
- import { I as Tr } from "./chunks/static-files-ehaD1kE7.js";
8
- import { D as rs, c as ns, i as os } from "./chunks/static-files-ehaD1kE7.js";
9
- import { k as Mr } from "./chunks/images-CG7ZzayG.js";
10
- import { d as as, l as ss, m as cs, n as us, f as ls, o as ds, q as fs, a as hs, s as ps, t as ms, b as ys, h as gs, j as ws, r as vs } from "./chunks/images-CG7ZzayG.js";
11
- import { c as Ss, s as Es } from "./chunks/session-store-ChModVcq.js";
1
+ import { jsx as kt } from "react/jsx-runtime";
2
+ import { createContext as Ge, useCallback as Rt, createElement as R, useContext as Ye, useRef as k, useMemo as ce, useActionState as ar, useId as sr, useLayoutEffect as ie, useState as U, useEffect as X, Fragment as Ce, Component as cr } from "react";
3
+ import { flushSync as ur } from "react-dom";
4
+ import { g as lr, h as ct, i as dr, H as fr, j as ut, k as hr, l as pr, m as $e } from "./chunks/index-LYve1rQp.js";
5
+ import { F as li, n as di, o as fi, p as hi, q as pi, d as mi, t as yi, u as gi, v as wi, a as vi, w as bi } from "./chunks/index-LYve1rQp.js";
6
+ import { O as lt, J as mr, P as Ze, i as re, Q as yr, R as gr, s as Xe, S as Qe, T as et, U as wr, V as Tt, W as vr, l as tt, L as Mt, X as ze, Y as br, r as Sr, z as Ct, Z as Er, _ as dt, $ as Ar, a0 as xr, a1 as kr, a2 as Rr, a3 as Tr, a4 as Mr, a5 as Cr, a6 as $r } from "./chunks/testing-BEW1nchS.js";
7
+ import { a7 as Ei, D as Ai, a8 as xi, a9 as ki, aa as Ri, ab as Ti, ac as Mi, ad as Ci, ae as $i, af as Ni, ag as Li, ah as Ii, ai as Di, aj as Pi, ak as Oi, al as _i, am as Fi, an as Ui, H as Bi, ao as Hi, e as zi, c as Vi, G as ji, n as qi, k as Ki, ap as Wi, aq as Ji, ar as Gi, f as Yi, as as Zi, at as Xi, au as Qi, av as ea, aw as ta, ax as ra, ay as na, az as oa, aA as ia, aB as aa, aC as sa, q as ca, aD as ua, aE as la, h as da, aF as fa, aG as ha, x as pa, aH as ma, aI as ya, aJ as ga, aK as wa, j as va, aL as ba, aM as Sa, aN as Ea, m as Aa, aO as xa, aP as ka, aQ as Ra, aR as Ta, aS as Ma, aT as Ca, aU as $a, aV as Na, aW as La, p as Ia, aX as Da, u as Pa, aY as Oa, aZ as _a, a_ as Fa, w as Ua, a$ as Ba, I as Ha, K as za, b0 as Va, b1 as ja, b2 as qa, b3 as Ka, b4 as Wa, b5 as Ja, b6 as Ga, b7 as Ya, N as Za, v as Xa, b8 as Qa, o as es, b as ts } from "./chunks/testing-BEW1nchS.js";
8
+ import { I as Nr } from "./chunks/static-files-ehaD1kE7.js";
9
+ import { D as ns, c as os, i as is } from "./chunks/static-files-ehaD1kE7.js";
10
+ import { d as ss, m as cs, a as us, p as ls, r as ds } from "./chunks/links-iU22QkCE.js";
11
+ import { k as Lr } from "./chunks/images-QgdmLyQ3.js";
12
+ import { d as hs, l as ps, m as ms, n as ys, f as gs, o as ws, q as vs, b as bs, s as Ss, t as Es, c as As, i as xs, p as ks, r as Rs } from "./chunks/images-QgdmLyQ3.js";
13
+ import { c as Ms, s as Cs } from "./chunks/session-store-ChModVcq.js";
12
14
  import "react-dom/server";
13
- function xo(e) {
15
+ function $o(e) {
14
16
  return {
15
17
  entries: e.map((t) => ({
16
18
  ...t,
17
- alternates: Cr(t.alternates ?? [])
19
+ alternates: Ir(t.alternates ?? [])
18
20
  }))
19
21
  };
20
22
  }
21
- function Cr(e) {
23
+ function Ir(e) {
22
24
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
23
25
  for (const n of e) {
24
26
  const o = n.hrefLang.toLowerCase();
@@ -39,67 +41,67 @@ function Cr(e) {
39
41
  }
40
42
  return [...t].map(([n, o]) => ({ href: o, hrefLang: n }));
41
43
  }
42
- function ko(e) {
44
+ function No(e) {
43
45
  return [
44
46
  '<?xml version="1.0" encoding="UTF-8"?>',
45
47
  `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.entries.some((r) => r.alternates?.length) ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : ""}>`,
46
- ...e.entries.map(Nr),
48
+ ...e.entries.map(Pr),
47
49
  "</urlset>",
48
50
  ""
49
51
  ].join(`
50
52
  `);
51
53
  }
52
- function Ro(e) {
54
+ function Lo(e) {
53
55
  return e;
54
56
  }
55
- function To(e) {
57
+ function Io(e) {
56
58
  return e;
57
59
  }
58
- function Mo(e) {
60
+ function Do(e) {
59
61
  const t = [];
60
62
  for (const r of e.rules ?? []) {
61
- for (const n of de(r.userAgent))
63
+ for (const n of he(r.userAgent))
62
64
  t.push(`User-agent: ${n}`);
63
- for (const n of de(r.allow))
65
+ for (const n of he(r.allow))
64
66
  t.push(`Allow: ${n}`);
65
- for (const n of de(r.disallow))
67
+ for (const n of he(r.disallow))
66
68
  t.push(`Disallow: ${n}`);
67
69
  t.push("");
68
70
  }
69
71
  e.host && t.push(`Host: ${e.host}`);
70
- for (const r of de(e.sitemap))
72
+ for (const r of he(e.sitemap))
71
73
  t.push(`Sitemap: ${r}`);
72
74
  return `${t.join(`
73
75
  `).replace(/\n+$/, "")}
74
76
  `;
75
77
  }
76
- function $r(e) {
77
- const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", o = e.foreground ?? "#ffffff", i = Ce(e.title, 120), s = e.subtitle ? Ce(e.subtitle, 160) : void 0, a = e.brand ? Ce(e.brand, 80) : void 0;
78
- return Dr(t, r), [
78
+ function Dr(e) {
79
+ const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", o = e.foreground ?? "#ffffff", i = Ne(e.title, 120), s = e.subtitle ? Ne(e.subtitle, 160) : void 0, a = e.brand ? Ne(e.brand, 80) : void 0;
80
+ return Fr(t, r), [
79
81
  `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${j(i)}">`,
80
82
  ` <rect width="100%" height="100%" fill="${j(n)}" />`,
81
- a ? ` <text x="72" y="96" fill="${j(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="32" font-weight="700">${X(a)}</text>` : null,
82
- ` <text x="72" y="${s ? 300 : 340}" fill="${j(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="76" font-weight="800">${X(i)}</text>`,
83
- s ? ` <text x="72" y="392" fill="${j(o)}" fill-opacity="0.78" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="38" font-weight="500">${X(s)}</text>` : null,
83
+ a ? ` <text x="72" y="96" fill="${j(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="32" font-weight="700">${ee(a)}</text>` : null,
84
+ ` <text x="72" y="${s ? 300 : 340}" fill="${j(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="76" font-weight="800">${ee(i)}</text>`,
85
+ s ? ` <text x="72" y="392" fill="${j(o)}" fill-opacity="0.78" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="38" font-weight="500">${ee(s)}</text>` : null,
84
86
  "</svg>"
85
- ].filter((u) => !!u).join(`
87
+ ].filter((l) => !!l).join(`
86
88
  `);
87
89
  }
88
- function Co(e) {
89
- return new Response($r(e), {
90
+ function Po(e) {
91
+ return new Response(Dr(e), {
90
92
  headers: {
91
- "cache-control": Tr,
93
+ "cache-control": Nr,
92
94
  "content-type": "image/svg+xml; charset=utf-8"
93
95
  }
94
96
  });
95
97
  }
96
- function Nr(e) {
98
+ function Pr(e) {
97
99
  return [
98
100
  " <url>",
99
- ` <loc>${X(e.url)}</loc>`,
100
- e.lastModified ? ` <lastmod>${X(Lr(e.lastModified))}</lastmod>` : null,
101
+ ` <loc>${ee(e.url)}</loc>`,
102
+ e.lastModified ? ` <lastmod>${ee(Or(e.lastModified))}</lastmod>` : null,
101
103
  e.changeFrequency ? ` <changefreq>${e.changeFrequency}</changefreq>` : null,
102
- e.priority !== void 0 ? ` <priority>${Ir(e.priority)}</priority>` : null,
104
+ e.priority !== void 0 ? ` <priority>${_r(e.priority)}</priority>` : null,
103
105
  ...(e.alternates ?? []).map(
104
106
  (t) => ` <xhtml:link rel="alternate" hreflang="${j(t.hrefLang)}" href="${j(t.href)}" />`
105
107
  ),
@@ -107,57 +109,57 @@ function Nr(e) {
107
109
  ].filter((t) => !!t).join(`
108
110
  `);
109
111
  }
110
- function Lr(e) {
112
+ function Or(e) {
111
113
  return e instanceof Date ? e.toISOString() : e;
112
114
  }
113
- function Ir(e) {
115
+ function _r(e) {
114
116
  if (e < 0 || e > 1)
115
117
  throw new Error("Sitemap entry priority must be between 0 and 1.");
116
118
  return String(e);
117
119
  }
118
- function de(e) {
120
+ function he(e) {
119
121
  return e === void 0 ? [] : Array.isArray(e) ? e : [e];
120
122
  }
121
- function X(e) {
123
+ function ee(e) {
122
124
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
123
125
  }
124
126
  function j(e) {
125
- return X(e).replaceAll('"', "&quot;").replaceAll("'", "&apos;");
127
+ return ee(e).replaceAll('"', "&quot;").replaceAll("'", "&apos;");
126
128
  }
127
- function Ce(e, t) {
129
+ function Ne(e, t) {
128
130
  return e.length > t ? `${e.slice(0, t - 3)}...` : e;
129
131
  }
130
- function Dr(e, t) {
132
+ function Fr(e, t) {
131
133
  if (!Number.isSafeInteger(e) || e <= 0)
132
134
  throw new Error("OG image width must be a positive integer.");
133
135
  if (!Number.isSafeInteger(t) || t <= 0)
134
136
  throw new Error("OG image height must be a positive integer.");
135
137
  }
136
- const Pr = "24h", Or = 1e4;
137
- function $o(e = {}) {
138
- const t = e.now ?? Date.now, r = e.defaultTtl ?? Pr, n = e.maximumEntries ?? Or;
138
+ const Ur = "24h", Br = 1e4;
139
+ function Oo(e = {}) {
140
+ const t = e.now ?? Date.now, r = e.defaultTtl ?? Ur, n = e.maximumEntries ?? Br;
139
141
  if (!Number.isSafeInteger(n) || n <= 0)
140
142
  throw new Error(
141
143
  "Demiurge idempotency maximumEntries must be a positive integer."
142
144
  );
143
- const o = ct(r);
145
+ const o = lt(r);
144
146
  if (!Number.isFinite(o))
145
147
  throw new Error("Demiurge idempotency defaultTtl must be finite.");
146
148
  const i = /* @__PURE__ */ new Map();
147
149
  return {
148
150
  async run(s) {
149
- const a = dr(s.key), u = t();
150
- _r(i, u);
151
+ const a = mr(s.key), l = t();
152
+ Hr(i, l);
151
153
  const d = i.get(a);
152
- if (d && (d.pending || d.expiresAt > u)) {
154
+ if (d && (d.pending || d.expiresAt > l)) {
153
155
  const h = await d.value;
154
156
  return {
155
157
  key: a,
156
158
  replayed: !0,
157
- value: lt(h)
159
+ value: ft(h)
158
160
  };
159
161
  }
160
- if (i.size >= n && Fr(i), i.size >= n)
162
+ if (i.size >= n && zr(i), i.size >= n)
161
163
  throw new Error(
162
164
  "Demiurge idempotency store is at capacity with in-flight mutations."
163
165
  );
@@ -169,10 +171,10 @@ function $o(e = {}) {
169
171
  i.set(a, A);
170
172
  try {
171
173
  const h = await v;
172
- return A.pending = !1, A.expiresAt = t() + ct(s.ttl ?? r), {
174
+ return A.pending = !1, A.expiresAt = t() + lt(s.ttl ?? r), {
173
175
  key: a,
174
176
  replayed: !1,
175
- value: lt(h)
177
+ value: ft(h)
176
178
  };
177
179
  } catch (h) {
178
180
  throw i.get(a) === A && i.delete(a), h;
@@ -180,24 +182,24 @@ function $o(e = {}) {
180
182
  }
181
183
  };
182
184
  }
183
- function lt(e) {
185
+ function ft(e) {
184
186
  return e instanceof Response ? e.clone() : e;
185
187
  }
186
- function _r(e, t) {
188
+ function Hr(e, t) {
187
189
  for (const [r, n] of e)
188
190
  !n.pending && n.expiresAt <= t && e.delete(r);
189
191
  }
190
- function Fr(e) {
192
+ function zr(e) {
191
193
  for (const [t, r] of e)
192
194
  if (!r.pending) {
193
195
  e.delete(t);
194
196
  return;
195
197
  }
196
198
  }
197
- function No(e, t) {
199
+ function _o(e, t) {
198
200
  return e.run(t);
199
201
  }
200
- function Lo(e) {
202
+ function Fo(e) {
201
203
  return typeof e == "function" ? {
202
204
  kind: "page",
203
205
  render: { mode: "ssr" },
@@ -210,10 +212,10 @@ function Lo(e) {
210
212
  view: e.view
211
213
  };
212
214
  }
213
- function Io(e) {
215
+ function Uo(e) {
214
216
  return e;
215
217
  }
216
- const Do = {
218
+ const Bo = {
217
219
  hmac(e) {
218
220
  return {
219
221
  kind: "response",
@@ -221,7 +223,7 @@ const Do = {
221
223
  const r = new Uint8Array(await t.request.arrayBuffer()), n = t.request.headers.get(
222
224
  e.header ?? "x-webhook-signature"
223
225
  );
224
- return n ? await Ur(r, n, e) ? await e.handler({
226
+ return n ? await Vr(r, n, e) ? await e.handler({
225
227
  ...t,
226
228
  rawBody: r,
227
229
  text: () => new TextDecoder().decode(r)
@@ -245,12 +247,12 @@ const Do = {
245
247
  };
246
248
  }
247
249
  };
248
- async function Ur(e, t, r) {
249
- const n = r.algorithm ?? "SHA-256", o = r.encoding ?? "hex", i = Br(
250
+ async function Vr(e, t, r) {
251
+ const n = r.algorithm ?? "SHA-256", o = r.encoding ?? "hex", i = jr(
250
252
  t,
251
253
  n,
252
254
  r.prefix
253
- ), s = Hr(i, o);
255
+ ), s = qr(i, o);
254
256
  if (!s)
255
257
  return !1;
256
258
  const a = await globalThis.crypto.subtle.importKey(
@@ -270,11 +272,11 @@ async function Ur(e, t, r) {
270
272
  Uint8Array.from(e).buffer
271
273
  );
272
274
  }
273
- function Br(e, t, r) {
275
+ function jr(e, t, r) {
274
276
  const n = e.trim(), o = r === void 0 ? `${t.toLowerCase().replace("-", "")}=` : r;
275
277
  return o !== !1 && n.startsWith(o) ? n.slice(o.length).trim() : n;
276
278
  }
277
- function Hr(e, t) {
279
+ function qr(e, t) {
278
280
  if (t === "hex")
279
281
  return /^(?:[0-9a-f]{2})+$/i.test(e) ? Uint8Array.from(
280
282
  e.match(/.{2}/g) ?? [],
@@ -291,19 +293,19 @@ function Hr(e, t) {
291
293
  return null;
292
294
  }
293
295
  }
294
- const zr = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/, jr = {
296
+ const Kr = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/, Wr = {
295
297
  host: "__Host-",
296
298
  none: "",
297
299
  secure: "__Secure-"
298
- }, dt = 4096;
299
- function ce(e, t = "host") {
300
- return `${jr[t]}${e}`;
300
+ }, ht = 4096;
301
+ function le(e, t = "host") {
302
+ return `${Wr[t]}${e}`;
301
303
  }
302
- function Vr(e) {
303
- const t = e.scope ?? "host", r = ce(e.name, t), n = [], o = (i, s) => {
304
+ function Jr(e) {
305
+ const t = e.scope ?? "host", r = le(e.name, t), n = [], o = (i, s) => {
304
306
  n.push({ code: i, message: s, name: r });
305
307
  };
306
- if (zr.test(e.name) || o(
308
+ if (Kr.test(e.name) || o(
307
309
  "cookie-name-invalid",
308
310
  `Cookie name ${JSON.stringify(e.name)} contains a character that a cookie name cannot hold. Use letters, digits, or the token characters that RFC 6265 allows.`
309
311
  ), (e.name.startsWith("__Host-") || e.name.startsWith("__Secure-")) && o(
@@ -325,63 +327,63 @@ function Vr(e) {
325
327
  "cookie-max-age-invalid",
326
328
  `Cookie ${r} declares maxAge ${JSON.stringify(e.maxAge)}. Use a whole number of seconds that is zero or greater.`
327
329
  ), n.length === 0) {
328
- const i = new TextEncoder().encode(Tt(e, t, r)).length;
329
- i > dt && o(
330
+ const i = new TextEncoder().encode($t(e, t, r)).length;
331
+ i > ht && o(
330
332
  "cookie-too-large",
331
- `Cookie ${r} serializes to ${i} bytes, and a browser drops a cookie above ${dt} bytes. Store the payload on the server and keep an identifier in the cookie.`
333
+ `Cookie ${r} serializes to ${i} bytes, and a browser drops a cookie above ${ht} bytes. Store the payload on the server and keep an identifier in the cookie.`
332
334
  );
333
335
  }
334
336
  return n;
335
337
  }
336
- function Po(e, t = "host") {
338
+ function Ho(e, t = "host") {
337
339
  if (typeof document > "u")
338
340
  return;
339
341
  const r = typeof e == "string" ? { name: e, scope: t } : e;
340
- return Ge(document.cookie).get(
341
- ce(r.name, r.scope ?? "host")
342
+ return Ze(document.cookie).get(
343
+ le(r.name, r.scope ?? "host")
342
344
  );
343
345
  }
344
- function Se(e) {
345
- const t = Vr(e);
346
+ function Ae(e) {
347
+ const t = Jr(e);
346
348
  if (t.length > 0)
347
349
  throw new Error(
348
350
  `Demiurge rejected a cookie declaration. ${t.map((n) => n.message).join(" ")}`
349
351
  );
350
352
  const r = e.scope ?? "host";
351
- return Tt(e, r, ce(e.name, r));
353
+ return $t(e, r, le(e.name, r));
352
354
  }
353
- function Tt(e, t, r) {
355
+ function $t(e, t, r) {
354
356
  const n = [`${r}=${encodeURIComponent(e.value)}`], o = t === "host" ? "/" : e.path ?? "/";
355
357
  return n.push(`Path=${o}`), t !== "host" && e.domain !== void 0 && n.push(`Domain=${e.domain}`), e.expires && n.push(`Expires=${e.expires.toUTCString()}`), e.maxAge !== void 0 && n.push(`Max-Age=${e.maxAge}`), n.push(`SameSite=${e.sameSite ?? "Lax"}`), (e.httpOnly ?? !0) && n.push("HttpOnly"), (t !== "none" || (e.secure ?? !0)) && n.push("Secure"), n.join("; ");
356
358
  }
357
- const qr = 10080 * 60 * 1e3, Kr = 1440 * 60 * 1e3, ft = 32;
358
- function Oo(e) {
359
- const t = Ct(e);
360
- return Mt(t, Jr(t.keys));
359
+ const Gr = 10080 * 60 * 1e3, Yr = 1440 * 60 * 1e3, pt = 32;
360
+ function zo(e) {
361
+ const t = Lt(e);
362
+ return Nt(t, Xr(t.keys));
361
363
  }
362
- function _o(e) {
363
- const t = Ct(e);
364
+ function Vo(e) {
365
+ const t = Lt(e);
364
366
  for (const r of t.keys)
365
367
  if (r.value.byteLength !== 32)
366
368
  throw new Error(
367
369
  `Demiurge encrypted cookie session key ${JSON.stringify(r.id)} must contain exactly 32 bytes for AES-256-GCM.`
368
370
  );
369
- return Mt(
371
+ return Nt(
370
372
  t,
371
- Gr(t.keys, t.randomBytes)
373
+ Qr(t.keys, t.randomBytes)
372
374
  );
373
375
  }
374
- function Mt(e, t) {
375
- const r = ce(
376
+ function Nt(e, t) {
377
+ const r = le(
376
378
  e.cookie.name,
377
379
  e.cookie.scope ?? "host"
378
380
  );
379
381
  return {
380
382
  cookieName: r,
381
383
  async open(n) {
382
- const o = Ge(n.headers.get("cookie") ?? "").get(r), i = e.now(), s = o ? await t.decode(o) : void 0;
383
- let a = s?.record, u = !!(o && !s), d = !!(s && !s.currentKey);
384
- a && Zr(a, i) ? (a = void 0, u = !0, d = !1) : a && e.renewal && e.idleExpirationMs !== !1 && a.idleExpiresAt !== void 0 && a.idleExpiresAt - i <= e.idleExpirationMs / 4 && (a = {
384
+ const o = Ze(n.headers.get("cookie") ?? "").get(r), i = e.now(), s = o ? await t.decode(o) : void 0;
385
+ let a = s?.record, l = !!(o && !s), d = !!(s && !s.currentKey);
386
+ a && tn(a, i) ? (a = void 0, l = !0, d = !1) : a && e.renewal && e.idleExpirationMs !== !1 && a.idleExpiresAt !== void 0 && a.idleExpiresAt - i <= e.idleExpirationMs / 4 && (a = {
385
387
  ...a,
386
388
  idleExpiresAt: Math.min(
387
389
  a.expiresAt,
@@ -395,10 +397,10 @@ function Mt(e, t) {
395
397
  "Demiurge cannot change a session that does not exist. Create the session first."
396
398
  );
397
399
  return a;
398
- }, A = (h) => (a = Le(h), u = !1, d = !0, Le(h));
400
+ }, A = (h) => (a = De(h), l = !1, d = !0, De(h));
399
401
  return {
400
402
  async commit() {
401
- return u ? [Xr(e.cookie)] : !a || !d ? [] : [Se({
403
+ return l ? [rn(e.cookie)] : !a || !d ? [] : [Ae({
402
404
  ...e.cookie,
403
405
  expires: new Date(a.expiresAt),
404
406
  value: await t.encode(a)
@@ -409,18 +411,18 @@ function Mt(e, t) {
409
411
  throw new Error(
410
412
  "Demiurge cannot create a session when one already exists. Rotate or update the current session."
411
413
  );
412
- const E = e.now(), g = et(
414
+ const E = e.now(), g = rt(
413
415
  "absoluteExpirationMs",
414
416
  p.absoluteExpirationMs ?? e.absoluteExpirationMs
415
- ), b = p.idleExpirationMs === void 0 ? e.idleExpirationMs : $t(p.idleExpirationMs), m = E + g;
417
+ ), b = p.idleExpirationMs === void 0 ? e.idleExpirationMs : It(p.idleExpirationMs), y = E + g;
416
418
  return A({
417
419
  createdAt: E,
418
- data: Ne(h),
419
- expiresAt: m,
420
- id: pt(e.randomBytes),
420
+ data: Ie(h),
421
+ expiresAt: y,
422
+ id: yt(e.randomBytes),
421
423
  ...b === !1 ? {} : {
422
424
  idleExpiresAt: Math.min(
423
- m,
425
+ y,
424
426
  E + b
425
427
  )
426
428
  },
@@ -428,17 +430,17 @@ function Mt(e, t) {
428
430
  });
429
431
  },
430
432
  destroy() {
431
- a = void 0, u = !0, d = !1;
433
+ a = void 0, l = !0, d = !1;
432
434
  },
433
435
  get() {
434
- return a ? Le(a) : void 0;
436
+ return a ? De(a) : void 0;
435
437
  },
436
438
  rotate(h) {
437
439
  const p = v();
438
440
  return A({
439
441
  ...p,
440
- data: h === void 0 ? p.data : Ne(h),
441
- id: pt(e.randomBytes),
442
+ data: h === void 0 ? p.data : Ie(h),
443
+ id: yt(e.randomBytes),
442
444
  version: p.version + 1
443
445
  });
444
446
  },
@@ -446,7 +448,7 @@ function Mt(e, t) {
446
448
  const p = v();
447
449
  return A({
448
450
  ...p,
449
- data: Ne(h),
451
+ data: Ie(h),
450
452
  version: p.version + 1
451
453
  });
452
454
  }
@@ -454,12 +456,12 @@ function Mt(e, t) {
454
456
  }
455
457
  };
456
458
  }
457
- function Ct(e) {
458
- const t = Wr(e.keys), r = et(
459
+ function Lt(e) {
460
+ const t = Zr(e.keys), r = rt(
459
461
  "absoluteExpirationMs",
460
- e.absoluteExpirationMs ?? qr
461
- ), n = $t(
462
- e.idleExpirationMs ?? Kr
462
+ e.absoluteExpirationMs ?? Gr
463
+ ), n = It(
464
+ e.idleExpirationMs ?? Yr
463
465
  );
464
466
  return {
465
467
  absoluteExpirationMs: r,
@@ -467,11 +469,11 @@ function Ct(e) {
467
469
  idleExpirationMs: n,
468
470
  keys: t,
469
471
  now: e.now ?? Date.now,
470
- randomBytes: e.randomBytes ?? Qr,
472
+ randomBytes: e.randomBytes ?? nn,
471
473
  renewal: e.renewal ?? !0
472
474
  };
473
475
  }
474
- function Wr(e) {
476
+ function Zr(e) {
475
477
  if (e.length === 0)
476
478
  throw new Error(
477
479
  "Demiurge cookie sessions require at least one key. Put the current key first."
@@ -494,28 +496,28 @@ function Wr(e) {
494
496
  }
495
497
  return [...e];
496
498
  }
497
- function et(e, t) {
499
+ function rt(e, t) {
498
500
  if (!Number.isSafeInteger(t) || t <= 0)
499
501
  throw new Error(
500
502
  `Demiurge cookie session ${e} must be a positive whole number of milliseconds.`
501
503
  );
502
504
  return t;
503
505
  }
504
- function $t(e) {
505
- return e === !1 ? !1 : et("idleExpirationMs", e);
506
+ function It(e) {
507
+ return e === !1 ? !1 : rt("idleExpirationMs", e);
506
508
  }
507
- function Jr(e) {
509
+ function Xr(e) {
508
510
  return {
509
511
  async decode(t) {
510
512
  const r = t.split(".");
511
513
  if (r.length !== 4 || r[0] !== "s1")
512
514
  return;
513
- const n = e.findIndex((v) => v.id === r[1]), o = e[n], i = be(r[2]), s = be(r[3]);
515
+ const n = e.findIndex((v) => v.id === r[1]), o = e[n], i = Ee(r[2]), s = Ee(r[3]);
514
516
  if (!o || !i || !s)
515
517
  return;
516
518
  const a = await crypto.subtle.importKey(
517
519
  "raw",
518
- I(o.value),
520
+ L(o.value),
519
521
  { hash: "SHA-256", name: "HMAC" },
520
522
  !1,
521
523
  ["verify"]
@@ -523,47 +525,47 @@ function Jr(e) {
523
525
  if (!await crypto.subtle.verify(
524
526
  "HMAC",
525
527
  a,
526
- I(s),
527
- I(Q(`s1.${o.id}.${r[2]}`))
528
+ L(s),
529
+ L(te(`s1.${o.id}.${r[2]}`))
528
530
  ))
529
531
  return;
530
- const d = Nt(i);
532
+ const d = Dt(i);
531
533
  return d ? { currentKey: n === 0, record: d } : void 0;
532
534
  },
533
535
  async encode(t) {
534
- const r = e[0], n = se(Q(JSON.stringify(t))), o = `s1.${r.id}.${n}`, i = await crypto.subtle.importKey(
536
+ const r = e[0], n = ue(te(JSON.stringify(t))), o = `s1.${r.id}.${n}`, i = await crypto.subtle.importKey(
535
537
  "raw",
536
- I(r.value),
538
+ L(r.value),
537
539
  { hash: "SHA-256", name: "HMAC" },
538
540
  !1,
539
541
  ["sign"]
540
542
  ), s = await crypto.subtle.sign(
541
543
  "HMAC",
542
544
  i,
543
- I(Q(o))
545
+ L(te(o))
544
546
  );
545
- return `${o}.${se(new Uint8Array(s))}`;
547
+ return `${o}.${ue(new Uint8Array(s))}`;
546
548
  }
547
549
  };
548
550
  }
549
- function Gr(e, t) {
551
+ function Qr(e, t) {
550
552
  return {
551
553
  async decode(r) {
552
554
  const n = r.split(".");
553
555
  if (n.length !== 4 || n[0] !== "e1")
554
556
  return;
555
- const o = e.findIndex((u) => u.id === n[1]), i = e[o], s = be(n[2]), a = be(n[3]);
557
+ const o = e.findIndex((l) => l.id === n[1]), i = e[o], s = Ee(n[2]), a = Ee(n[3]);
556
558
  if (!(!i || s?.byteLength !== 12 || !a))
557
559
  try {
558
- const u = await ht(i), d = await crypto.subtle.decrypt(
560
+ const l = await mt(i), d = await crypto.subtle.decrypt(
559
561
  {
560
- additionalData: I(Q(`e1.${i.id}`)),
561
- iv: I(s),
562
+ additionalData: L(te(`e1.${i.id}`)),
563
+ iv: L(s),
562
564
  name: "AES-GCM"
563
565
  },
564
- u,
565
- I(a)
566
- ), v = Nt(new Uint8Array(d));
566
+ l,
567
+ L(a)
568
+ ), v = Dt(new Uint8Array(d));
567
569
  return v ? { currentKey: o === 0, record: v } : void 0;
568
570
  } catch {
569
571
  return;
@@ -575,90 +577,90 @@ function Gr(e, t) {
575
577
  throw new Error(
576
578
  "Demiurge cookie session randomBytes returned an incorrect byte count."
577
579
  );
578
- const i = await ht(n), s = await crypto.subtle.encrypt(
580
+ const i = await mt(n), s = await crypto.subtle.encrypt(
579
581
  {
580
- additionalData: I(Q(`e1.${n.id}`)),
581
- iv: I(o),
582
+ additionalData: L(te(`e1.${n.id}`)),
583
+ iv: L(o),
582
584
  name: "AES-GCM"
583
585
  },
584
586
  i,
585
- I(Q(JSON.stringify(r)))
587
+ L(te(JSON.stringify(r)))
586
588
  );
587
- return `e1.${n.id}.${se(o)}.${se(new Uint8Array(s))}`;
589
+ return `e1.${n.id}.${ue(o)}.${ue(new Uint8Array(s))}`;
588
590
  }
589
591
  };
590
592
  }
591
- async function ht(e) {
593
+ async function mt(e) {
592
594
  return await crypto.subtle.importKey(
593
595
  "raw",
594
- I(e.value),
596
+ L(e.value),
595
597
  "AES-GCM",
596
598
  !1,
597
599
  ["decrypt", "encrypt"]
598
600
  );
599
601
  }
600
- function Nt(e) {
602
+ function Dt(e) {
601
603
  try {
602
604
  const t = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(e));
603
- return !ee(t) || !$e(t.createdAt) || !$e(t.expiresAt) || typeof t.id != "string" || !/^[A-Za-z0-9_-]{43}$/.test(t.id) || !Yr(t.version) || t.idleExpiresAt !== void 0 && !$e(t.idleExpiresAt) || !ve(t.data) ? void 0 : t;
605
+ return !re(t) || !Le(t.createdAt) || !Le(t.expiresAt) || typeof t.id != "string" || !/^[A-Za-z0-9_-]{43}$/.test(t.id) || !en(t.version) || t.idleExpiresAt !== void 0 && !Le(t.idleExpiresAt) || !Se(t.data) ? void 0 : t;
604
606
  } catch {
605
607
  return;
606
608
  }
607
609
  }
608
- function $e(e) {
610
+ function Le(e) {
609
611
  return typeof e == "number" && Number.isSafeInteger(e) && e >= 0;
610
612
  }
611
- function Yr(e) {
613
+ function en(e) {
612
614
  return typeof e == "number" && Number.isSafeInteger(e) && e >= 0;
613
615
  }
614
- function ve(e) {
615
- return e === null || typeof e == "boolean" || typeof e == "string" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(ve) : ee(e) && Object.values(e).every(ve);
616
+ function Se(e) {
617
+ return e === null || typeof e == "boolean" || typeof e == "string" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(Se) : re(e) && Object.values(e).every(Se);
616
618
  }
617
- function Zr(e, t) {
619
+ function tn(e, t) {
618
620
  return e.expiresAt <= t || e.idleExpiresAt !== void 0 && e.idleExpiresAt <= t;
619
621
  }
620
- function Xr(e) {
621
- return Se({
622
+ function rn(e) {
623
+ return Ae({
622
624
  ...e,
623
625
  expires: /* @__PURE__ */ new Date(0),
624
626
  maxAge: 0,
625
627
  value: ""
626
628
  });
627
629
  }
628
- function pt(e) {
629
- const t = e(ft);
630
- if (t.byteLength !== ft)
630
+ function yt(e) {
631
+ const t = e(pt);
632
+ if (t.byteLength !== pt)
631
633
  throw new Error(
632
634
  "Demiurge cookie session randomBytes returned an incorrect byte count."
633
635
  );
634
- return se(t);
636
+ return ue(t);
635
637
  }
636
- function Qr(e) {
638
+ function nn(e) {
637
639
  return crypto.getRandomValues(new Uint8Array(e));
638
640
  }
639
- function Ne(e) {
640
- if (!ve(e))
641
+ function Ie(e) {
642
+ if (!Se(e))
641
643
  throw new Error(
642
644
  "Demiurge session data must contain only finite JSON values."
643
645
  );
644
646
  return structuredClone(e);
645
647
  }
646
- function Le(e) {
648
+ function De(e) {
647
649
  return structuredClone(e);
648
650
  }
649
- function Q(e) {
651
+ function te(e) {
650
652
  return new TextEncoder().encode(e);
651
653
  }
652
- function I(e) {
654
+ function L(e) {
653
655
  return Uint8Array.from(e).buffer;
654
656
  }
655
- function se(e) {
657
+ function ue(e) {
656
658
  let t = "";
657
659
  for (const r of e)
658
660
  t += String.fromCharCode(r);
659
661
  return btoa(t).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
660
662
  }
661
- function be(e) {
663
+ function Ee(e) {
662
664
  if (/^[A-Za-z0-9_-]+$/.test(e))
663
665
  try {
664
666
  const t = "=".repeat((4 - e.length % 4) % 4), r = atob(e.replaceAll("-", "+").replaceAll("_", "/") + t);
@@ -667,34 +669,34 @@ function be(e) {
667
669
  return;
668
670
  }
669
671
  }
670
- const en = 10080 * 60 * 1e3, tn = 1440 * 60 * 1e3;
671
- class rn extends Error {
672
+ const on = 10080 * 60 * 1e3, an = 1440 * 60 * 1e3;
673
+ class sn extends Error {
672
674
  constructor(t) {
673
675
  super(
674
676
  `Demiurge session ${t} conflicted with another request. Load the current session before another lifecycle operation.`
675
677
  ), this.name = "SessionStoreConflictError";
676
678
  }
677
679
  }
678
- class mt extends Error {
680
+ class gt extends Error {
679
681
  constructor(t) {
680
682
  super(
681
683
  `Demiurge session ${t} failed because the session store is unavailable.`
682
684
  ), this.name = "SessionStoreUnavailableError";
683
685
  }
684
686
  }
685
- function Fo(e) {
686
- const t = nn(e), r = ce(
687
+ function jo(e) {
688
+ const t = cn(e), r = le(
687
689
  t.cookie.name,
688
690
  t.cookie.scope ?? "host"
689
691
  );
690
692
  return {
691
693
  cookieName: r,
692
694
  async open(n) {
693
- const o = Ge(n.headers.get("cookie") ?? "").get(r), i = o ? await sn(o, t.keys) : void 0, s = t.now();
694
- let a = i ? await t.store.read(i.id, s) : void 0, u = !!(o && (!i || !a)), d = !!(a && i && !i.currentKey);
695
+ const o = Ze(n.headers.get("cookie") ?? "").get(r), i = o ? await dn(o, t.keys) : void 0, s = t.now();
696
+ let a = i ? await t.store.read(i.id, s) : void 0, l = !!(o && (!i || !a)), d = !!(a && i && !i.currentKey);
695
697
  if (a && t.renewal && t.idleExpirationMs !== !1 && a.idleExpiresAt !== void 0 && a.idleExpiresAt - s <= t.idleExpirationMs / 4) {
696
698
  const h = await t.store.update({
697
- ...Ie(a),
699
+ ...Pe(a),
698
700
  idleExpiresAt: Math.min(
699
701
  a.expiresAt,
700
702
  s + t.idleExpirationMs
@@ -703,9 +705,9 @@ function Fo(e) {
703
705
  if (h.status === "stored")
704
706
  a = h.record, d = !0;
705
707
  else if (h.status === "conflict")
706
- a = await t.store.read(a.id, s), u = !a;
708
+ a = await t.store.read(a.id, s), l = !a;
707
709
  else
708
- throw new mt("renewal");
710
+ throw new gt("renewal");
709
711
  }
710
712
  const v = () => {
711
713
  if (!a)
@@ -715,17 +717,17 @@ function Fo(e) {
715
717
  return a;
716
718
  }, A = (h, p) => {
717
719
  if (h.status === "conflict")
718
- throw new rn(p);
720
+ throw new sn(p);
719
721
  if (h.status === "unavailable")
720
- throw new mt(p);
721
- return a = Pe(h.record), u = !1, d = !0, Pe(h.record);
722
+ throw new gt(p);
723
+ return a = _e(h.record), l = !1, d = !0, _e(h.record);
722
724
  };
723
725
  return {
724
726
  async commit() {
725
- return u ? [cn(t.cookie)] : !a || !d ? [] : [Se({
727
+ return l ? [fn(t.cookie)] : !a || !d ? [] : [Ae({
726
728
  ...t.cookie,
727
729
  expires: new Date(a.expiresAt),
728
- value: await an(a.id, t.keys[0])
730
+ value: await ln(a.id, t.keys[0])
729
731
  })];
730
732
  },
731
733
  async create(h, p = {}) {
@@ -733,17 +735,17 @@ function Fo(e) {
733
735
  throw new Error(
734
736
  "Demiurge cannot create a session when one already exists. Rotate or update the current session."
735
737
  );
736
- const E = t.now(), g = tt(
738
+ const E = t.now(), g = nt(
737
739
  "absoluteExpirationMs",
738
740
  p.absoluteExpirationMs ?? t.absoluteExpirationMs
739
- ), b = p.idleExpirationMs === void 0 ? t.idleExpirationMs : Lt(p.idleExpirationMs), m = E + g, T = {
741
+ ), b = p.idleExpirationMs === void 0 ? t.idleExpirationMs : Pt(p.idleExpirationMs), y = E + g, T = {
740
742
  createdAt: E,
741
- data: De(h),
742
- expiresAt: m,
743
- id: yt(t.randomBytes),
743
+ data: Oe(h),
744
+ expiresAt: y,
745
+ id: wt(t.randomBytes),
744
746
  ...b === !1 ? {} : {
745
747
  idleExpiresAt: Math.min(
746
- m,
748
+ y,
747
749
  E + b
748
750
  )
749
751
  }
@@ -751,16 +753,16 @@ function Fo(e) {
751
753
  return A(await t.store.create(T), "creation");
752
754
  },
753
755
  async destroy() {
754
- a && await t.store.destroy(a.id), a = void 0, u = !0, d = !1;
756
+ a && await t.store.destroy(a.id), a = void 0, l = !0, d = !1;
755
757
  },
756
758
  get() {
757
- return a ? Pe(a) : void 0;
759
+ return a ? _e(a) : void 0;
758
760
  },
759
761
  async rotate(h) {
760
762
  const p = v(), E = {
761
- ...Ie(p),
762
- data: h === void 0 ? p.data : De(h),
763
- id: yt(t.randomBytes)
763
+ ...Pe(p),
764
+ data: h === void 0 ? p.data : Oe(h),
765
+ id: wt(t.randomBytes)
764
766
  };
765
767
  return A(
766
768
  await t.store.rotate(p.id, E, p.version),
@@ -771,8 +773,8 @@ function Fo(e) {
771
773
  const p = v();
772
774
  return A(
773
775
  await t.store.update({
774
- ...Ie(p),
775
- data: De(h)
776
+ ...Pe(p),
777
+ data: Oe(h)
776
778
  }, p.version),
777
779
  "update"
778
780
  );
@@ -781,29 +783,29 @@ function Fo(e) {
781
783
  }
782
784
  };
783
785
  }
784
- function nn(e) {
786
+ function cn(e) {
785
787
  if (!e.store || typeof e.store.read != "function")
786
788
  throw new Error(
787
789
  "Demiurge session manager requires a SessionStore implementation."
788
790
  );
789
- const t = on(e.keys);
791
+ const t = un(e.keys);
790
792
  return {
791
- absoluteExpirationMs: tt(
793
+ absoluteExpirationMs: nt(
792
794
  "absoluteExpirationMs",
793
- e.absoluteExpirationMs ?? en
795
+ e.absoluteExpirationMs ?? on
794
796
  ),
795
797
  cookie: { ...e.cookie, name: e.cookie?.name ?? "session" },
796
- idleExpirationMs: Lt(
797
- e.idleExpirationMs ?? tn
798
+ idleExpirationMs: Pt(
799
+ e.idleExpirationMs ?? an
798
800
  ),
799
801
  keys: t,
800
802
  now: e.now ?? Date.now,
801
- randomBytes: e.randomBytes ?? un,
803
+ randomBytes: e.randomBytes ?? hn,
802
804
  renewal: e.renewal ?? !0,
803
805
  store: e.store
804
806
  };
805
807
  }
806
- function on(e) {
808
+ function un(e) {
807
809
  if (e.length === 0)
808
810
  throw new Error(
809
811
  "Demiurge session manager requires at least one key. Put the current key first."
@@ -822,30 +824,30 @@ function on(e) {
822
824
  }
823
825
  return [...e];
824
826
  }
825
- async function an(e, t) {
827
+ async function ln(e, t) {
826
828
  const r = `i1.${t.id}.${e}`, n = await crypto.subtle.importKey(
827
829
  "raw",
828
- oe(t.value),
830
+ ae(t.value),
829
831
  { hash: "SHA-256", name: "HMAC" },
830
832
  !1,
831
833
  ["sign"]
832
834
  ), o = await crypto.subtle.sign(
833
835
  "HMAC",
834
836
  n,
835
- oe(new TextEncoder().encode(r))
837
+ ae(new TextEncoder().encode(r))
836
838
  );
837
- return `${r}.${It(new Uint8Array(o))}`;
839
+ return `${r}.${Ot(new Uint8Array(o))}`;
838
840
  }
839
- async function sn(e, t) {
841
+ async function dn(e, t) {
840
842
  const r = e.split(".");
841
843
  if (r.length !== 4 || r[0] !== "i1" || !/^[A-Za-z0-9_-]{43}$/.test(r[2]))
842
844
  return;
843
- const n = t.findIndex((u) => u.id === r[1]), o = t[n], i = ln(r[3]);
845
+ const n = t.findIndex((l) => l.id === r[1]), o = t[n], i = pn(r[3]);
844
846
  if (!o || !i)
845
847
  return;
846
848
  const s = await crypto.subtle.importKey(
847
849
  "raw",
848
- oe(o.value),
850
+ ae(o.value),
849
851
  { hash: "SHA-256", name: "HMAC" },
850
852
  !1,
851
853
  ["verify"]
@@ -853,63 +855,63 @@ async function sn(e, t) {
853
855
  return await crypto.subtle.verify(
854
856
  "HMAC",
855
857
  s,
856
- oe(i),
857
- oe(new TextEncoder().encode(r.slice(0, 3).join(".")))
858
+ ae(i),
859
+ ae(new TextEncoder().encode(r.slice(0, 3).join(".")))
858
860
  ) ? { currentKey: n === 0, id: r[2] } : void 0;
859
861
  }
860
- function Ie(e) {
862
+ function Pe(e) {
861
863
  const { version: t, ...r } = e;
862
864
  return r;
863
865
  }
864
- function cn(e) {
865
- return Se({
866
+ function fn(e) {
867
+ return Ae({
866
868
  ...e,
867
869
  expires: /* @__PURE__ */ new Date(0),
868
870
  maxAge: 0,
869
871
  value: ""
870
872
  });
871
873
  }
872
- function tt(e, t) {
874
+ function nt(e, t) {
873
875
  if (!Number.isSafeInteger(t) || t <= 0)
874
876
  throw new Error(
875
877
  `Demiurge session manager ${e} must be a positive whole number of milliseconds.`
876
878
  );
877
879
  return t;
878
880
  }
879
- function Lt(e) {
880
- return e === !1 ? !1 : tt("idleExpirationMs", e);
881
+ function Pt(e) {
882
+ return e === !1 ? !1 : nt("idleExpirationMs", e);
881
883
  }
882
- function yt(e) {
884
+ function wt(e) {
883
885
  const t = e(32);
884
886
  if (t.byteLength !== 32)
885
887
  throw new Error(
886
888
  "Demiurge session manager randomBytes returned an incorrect byte count."
887
889
  );
888
- return It(t);
890
+ return Ot(t);
889
891
  }
890
- function un(e) {
892
+ function hn(e) {
891
893
  return crypto.getRandomValues(new Uint8Array(e));
892
894
  }
893
- function De(e) {
894
- if (!He(e))
895
+ function Oe(e) {
896
+ if (!Ve(e))
895
897
  throw new Error(
896
898
  "Demiurge session data must contain only finite JSON values."
897
899
  );
898
900
  return structuredClone(e);
899
901
  }
900
- function He(e) {
901
- return e === null || typeof e == "boolean" || typeof e == "string" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(He) : typeof e == "object" && e !== null && Object.values(e).every(He);
902
+ function Ve(e) {
903
+ return e === null || typeof e == "boolean" || typeof e == "string" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(Ve) : typeof e == "object" && e !== null && Object.values(e).every(Ve);
902
904
  }
903
- function Pe(e) {
905
+ function _e(e) {
904
906
  return structuredClone(e);
905
907
  }
906
- function It(e) {
908
+ function Ot(e) {
907
909
  let t = "";
908
910
  for (const r of e)
909
911
  t += String.fromCharCode(r);
910
912
  return btoa(t).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
911
913
  }
912
- function ln(e) {
914
+ function pn(e) {
913
915
  if (/^[A-Za-z0-9_-]+$/.test(e))
914
916
  try {
915
917
  const t = "=".repeat((4 - e.length % 4) % 4), r = atob(e.replaceAll("-", "+").replaceAll("_", "/") + t);
@@ -918,10 +920,10 @@ function ln(e) {
918
920
  return;
919
921
  }
920
922
  }
921
- function oe(e) {
923
+ function ae(e) {
922
924
  return Uint8Array.from(e).buffer;
923
925
  }
924
- function Uo(e = {}) {
926
+ function qo(e = {}) {
925
927
  return async function(r) {
926
928
  if (r.method.toUpperCase() !== "POST")
927
929
  return new Response(null, {
@@ -930,22 +932,22 @@ function Uo(e = {}) {
930
932
  },
931
933
  status: 405
932
934
  });
933
- const n = fn(r);
935
+ const n = yn(r);
934
936
  if (n)
935
937
  return n;
936
- const o = hn(e, r);
938
+ const o = gn(e, r);
937
939
  if (o)
938
940
  return o;
939
- e.maxBodySize !== void 0 && (r = fr({ maxBodySize: e.maxBodySize }, r));
941
+ e.maxBodySize !== void 0 && (r = yr({ maxBodySize: e.maxBodySize }, r));
940
942
  let i;
941
943
  try {
942
944
  i = await r.json();
943
945
  } catch (a) {
944
- return a instanceof hr ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
946
+ return a instanceof gr ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
945
947
  status: 400
946
948
  });
947
949
  }
948
- const s = pn(i);
950
+ const s = wn(i);
949
951
  for (let a = 0; a < s.length; a += 1)
950
952
  await e.onReport?.(s[a], {
951
953
  index: a,
@@ -956,20 +958,20 @@ function Uo(e = {}) {
956
958
  });
957
959
  };
958
960
  }
959
- const dn = /* @__PURE__ */ new Set([
961
+ const mn = /* @__PURE__ */ new Set([
960
962
  "application/csp-report",
961
963
  "application/reports+json"
962
964
  ]);
963
- function fn(e) {
965
+ function yn(e) {
964
966
  const t = e.headers.get("content-type");
965
967
  if (!t)
966
968
  return null;
967
969
  const r = t.split(";", 1)[0]?.trim().toLowerCase();
968
- return r && dn.has(r) ? null : new Response("Unsupported security report Content-Type.", {
970
+ return r && mn.has(r) ? null : new Response("Unsupported security report Content-Type.", {
969
971
  status: 415
970
972
  });
971
973
  }
972
- function hn(e, t) {
974
+ function gn(e, t) {
973
975
  if (e.maxBodySize === void 0)
974
976
  return null;
975
977
  const r = t.headers.get("content-length");
@@ -980,29 +982,29 @@ function hn(e, t) {
980
982
  status: 400
981
983
  });
982
984
  const n = Number(r);
983
- return Number.isSafeInteger(n) ? n > Ye(e.maxBodySize) ? new Response("Security report body too large.", {
985
+ return Number.isSafeInteger(n) ? n > Xe(e.maxBodySize) ? new Response("Security report body too large.", {
984
986
  status: 413
985
987
  }) : null : new Response("Invalid Content-Length.", {
986
988
  status: 400
987
989
  });
988
990
  }
989
- function pn(e) {
990
- return Array.isArray(e) ? e : Ze(e) && "csp-report" in e ? [e["csp-report"]] : [e];
991
+ function wn(e) {
992
+ return Array.isArray(e) ? e : Qe(e) && "csp-report" in e ? [e["csp-report"]] : [e];
991
993
  }
992
- function Bo(e, t) {
994
+ function Ko(e, t) {
993
995
  const r = {}, n = [];
994
996
  let o = 0;
995
997
  for (const [i, s] of Object.entries(t.files)) {
996
- const a = e.getAll(i).filter(gn);
998
+ const a = e.getAll(i).filter(Sn);
997
999
  r[i] = a, s.required && a.length === 0 && n.push({
998
1000
  code: "file-missing",
999
1001
  field: i,
1000
1002
  message: `Upload field ${i} requires at least one file.`
1001
1003
  });
1002
- for (const u of a)
1003
- o += u.size, mn(i, u, s, n);
1004
+ for (const l of a)
1005
+ o += l.size, vn(i, l, s, n);
1004
1006
  }
1005
- return t.maxTotalSize !== void 0 && o > Ye(t.maxTotalSize) && n.push({
1007
+ return t.maxTotalSize !== void 0 && o > Xe(t.maxTotalSize) && n.push({
1006
1008
  code: "total-upload-too-large",
1007
1009
  field: "*",
1008
1010
  message: `Uploaded files exceed the maximum total size of ${t.maxTotalSize}.`
@@ -1013,24 +1015,24 @@ function Bo(e, t) {
1013
1015
  totalSize: o
1014
1016
  };
1015
1017
  }
1016
- function mn(e, t, r, n) {
1017
- r.maxSize !== void 0 && t.size > Ye(r.maxSize) && n.push({
1018
+ function vn(e, t, r, n) {
1019
+ r.maxSize !== void 0 && t.size > Xe(r.maxSize) && n.push({
1018
1020
  code: "file-too-large",
1019
1021
  field: e,
1020
1022
  message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
1021
- }), r.types?.length && !yn(t.type, r.types) && n.push({
1023
+ }), r.types?.length && !bn(t.type, r.types) && n.push({
1022
1024
  code: "file-type-not-allowed",
1023
1025
  field: e,
1024
1026
  message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
1025
1027
  });
1026
1028
  }
1027
- function yn(e, t) {
1029
+ function bn(e, t) {
1028
1030
  return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
1029
1031
  }
1030
- function gn(e) {
1032
+ function Sn(e) {
1031
1033
  return e instanceof File;
1032
1034
  }
1033
- function wn(e, t) {
1035
+ function En(e, t) {
1034
1036
  const r = t.headers.get("origin");
1035
1037
  if (!r)
1036
1038
  return {
@@ -1039,7 +1041,7 @@ function wn(e, t) {
1039
1041
  origin: r,
1040
1042
  reason: e.allowMissingOrigin ? void 0 : "missing-origin"
1041
1043
  };
1042
- const n = Dt(r);
1044
+ const n = _t(r);
1043
1045
  if (!n)
1044
1046
  return {
1045
1047
  allowed: !1,
@@ -1047,7 +1049,7 @@ function wn(e, t) {
1047
1049
  origin: r,
1048
1050
  reason: "invalid-origin"
1049
1051
  };
1050
- const o = vn(e, n, t);
1052
+ const o = An(e, n, t);
1051
1053
  return {
1052
1054
  allowed: o,
1053
1055
  expected: e.origins,
@@ -1055,20 +1057,20 @@ function wn(e, t) {
1055
1057
  reason: o ? void 0 : "origin-not-allowed"
1056
1058
  };
1057
1059
  }
1058
- function Ho(e, t) {
1059
- return !e || wn(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
1060
+ function Wo(e, t) {
1061
+ return !e || En(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
1060
1062
  status: 403
1061
1063
  });
1062
1064
  }
1063
- function vn(e, t, r) {
1065
+ function An(e, t, r) {
1064
1066
  return e.origins === "same-origin" ? t === new URL(r.url).origin : e.origins.some(
1065
- (n) => bn(n, t)
1067
+ (n) => xn(n, t)
1066
1068
  );
1067
1069
  }
1068
- function bn(e, t) {
1069
- return e === "null" ? t === "null" : Dt(e) === t;
1070
+ function xn(e, t) {
1071
+ return e === "null" ? t === "null" : _t(e) === t;
1070
1072
  }
1071
- function Dt(e) {
1073
+ function _t(e) {
1072
1074
  if (e === "null")
1073
1075
  return e;
1074
1076
  try {
@@ -1086,27 +1088,27 @@ function Dt(e) {
1086
1088
  return null;
1087
1089
  }
1088
1090
  }
1089
- const Pt = We({
1091
+ const Ft = Ge({
1090
1092
  register: () => () => {
1091
1093
  },
1092
1094
  focus: () => !1
1093
1095
  });
1094
- function Sn() {
1095
- const e = Je(Pt), t = k(void 0), r = At((n) => {
1096
+ function kn() {
1097
+ const e = Ye(Ft), t = k(void 0), r = Rt((n) => {
1096
1098
  t.current?.(), t.current = void 0, n && (t.current = e.register(n));
1097
1099
  }, [e]);
1098
- return ae(() => ({
1100
+ return ce(() => ({
1099
1101
  ref: r,
1100
1102
  tabIndex: -1
1101
1103
  }), [r]);
1102
1104
  }
1103
- function zo(e) {
1104
- const { as: t, children: r, ref: n, ...o } = e, i = Sn(), s = At((a) => {
1105
+ function Jo(e) {
1106
+ const { as: t, children: r, ref: n, ...o } = e, i = kn(), s = Rt((a) => {
1105
1107
  if (a) {
1106
- i.ref(a), gt(n, a);
1108
+ i.ref(a), vt(n, a);
1107
1109
  return;
1108
1110
  }
1109
- gt(n, null), i.ref(null);
1111
+ vt(n, null), i.ref(null);
1110
1112
  }, [i.ref, n]);
1111
1113
  return R(t ?? "div", {
1112
1114
  ...o,
@@ -1115,22 +1117,22 @@ function zo(e) {
1115
1117
  children: r
1116
1118
  });
1117
1119
  }
1118
- function gt(e, t) {
1120
+ function vt(e, t) {
1119
1121
  typeof e == "function" ? e(t) : e && (e.current = t);
1120
1122
  }
1121
- const Ot = Symbol("Demiurge mutation form action");
1122
- let ie;
1123
- const ze = /* @__PURE__ */ new Set();
1124
- function En(e) {
1125
- return ie = e, () => {
1126
- ie === e && (ie = void 0);
1123
+ const Ut = Symbol("Demiurge mutation form action");
1124
+ let se;
1125
+ const je = /* @__PURE__ */ new Set();
1126
+ function Rn(e) {
1127
+ return se = e, () => {
1128
+ se === e && (se = void 0);
1127
1129
  };
1128
1130
  }
1129
- function je(e) {
1130
- for (const t of ze)
1131
+ function qe(e) {
1132
+ for (const t of je)
1131
1133
  t !== e && t.abort();
1132
1134
  }
1133
- function An(e) {
1135
+ function Tn(e) {
1134
1136
  let t;
1135
1137
  return (r, n) => {
1136
1138
  t?.controller.abort();
@@ -1139,77 +1141,77 @@ function An(e) {
1139
1141
  // TYPE-EVIDENCE: the function assigns the promise before it exposes the invocation.
1140
1142
  promise: void 0
1141
1143
  };
1142
- ze.add(o);
1143
- const s = Xe({
1144
+ je.add(o);
1145
+ const s = et({
1144
1146
  to: e.route,
1145
1147
  ...e.path === void 0 ? {} : { path: e.path }
1146
- }), a = xn({
1148
+ }), a = Mn({
1147
1149
  body: n,
1148
1150
  method: e.method,
1149
1151
  signal: o.signal,
1150
1152
  url: s
1151
1153
  });
1152
- return i.promise = a.then(async (u) => {
1154
+ return i.promise = a.then(async (l) => {
1153
1155
  if (t !== i) return await t.promise;
1154
- if (u.status === "redirect") {
1155
- const d = Ut(u.location);
1156
- if (!d) return Oe("The mutation returned an unsafe redirect.");
1157
- je(o), ie?.redirect(d, u.history, o);
1158
- } else u.status === "success" && u.revalidate && await ie?.refresh();
1159
- return o.signal.aborted ? r ?? Oe("The mutation was cancelled.") : t === i ? u : await t.promise;
1160
- }).catch(async (u) => {
1156
+ if (l.status === "redirect") {
1157
+ const d = zt(l.location);
1158
+ if (!d) return Fe("The mutation returned an unsafe redirect.");
1159
+ qe(o), se?.redirect(d, l.history, o);
1160
+ } else l.status === "success" && l.revalidate && await se?.refresh();
1161
+ return o.signal.aborted ? r ?? Fe("The mutation was cancelled.") : t === i ? l : await t.promise;
1162
+ }).catch(async (l) => {
1161
1163
  if (t !== i) return await t.promise;
1162
1164
  if (o.signal.aborted && r) return r;
1163
- if (o.signal.aborted) return Oe("The mutation was cancelled.");
1164
- throw u;
1165
+ if (o.signal.aborted) return Fe("The mutation was cancelled.");
1166
+ throw l;
1165
1167
  }).finally(() => {
1166
- ze.delete(o);
1168
+ je.delete(o);
1167
1169
  }), t = i, i.promise;
1168
1170
  };
1169
1171
  }
1170
- function jo(e, t) {
1171
- const r = Xe({
1172
+ function Go(e, t) {
1173
+ const r = et({
1172
1174
  to: e.route,
1173
1175
  ...e.path === void 0 ? {} : { path: e.path }
1174
- }), n = ae(
1175
- () => An(e),
1176
+ }), n = ce(
1177
+ () => Tn(e),
1176
1178
  [e.method, r]
1177
- ), [o, i, s] = nr(n, t), a = ae(() => {
1178
- const u = (d) => i(d);
1179
- return Object.defineProperty(u, Ot, {
1179
+ ), [o, i, s] = ar(n, t), a = ce(() => {
1180
+ const l = (d) => i(d);
1181
+ return Object.defineProperty(l, Ut, {
1180
1182
  value: { method: "POST", url: r }
1181
- }), u;
1183
+ }), l;
1182
1184
  }, [i, r]);
1183
1185
  return [o, a, s];
1184
1186
  }
1185
- function _t(e) {
1186
- return e[Ot];
1187
+ function Bt(e) {
1188
+ return e[Ut];
1187
1189
  }
1188
- async function xn(e) {
1189
- const { result: t } = await Ft(e);
1190
+ async function Mn(e) {
1191
+ const { result: t } = await Ht(e);
1190
1192
  if (!t)
1191
1193
  throw new Error("Demiurge expected a versioned mutation result.");
1192
1194
  return t;
1193
1195
  }
1194
- async function Ft(e) {
1196
+ async function Ht(e) {
1195
1197
  const t = await fetch(e.url, {
1196
1198
  body: e.body,
1197
1199
  credentials: "same-origin",
1198
1200
  headers: {
1199
- accept: xt,
1200
- [mr]: pr,
1201
+ accept: Tt,
1202
+ [vr]: wr,
1201
1203
  ...e.contentType ? { "content-type": e.contentType } : {}
1202
1204
  },
1203
1205
  method: e.method,
1204
1206
  redirect: "manual",
1205
1207
  signal: e.signal
1206
1208
  });
1207
- return { response: t, result: await kn(t) };
1209
+ return { response: t, result: await Cn(t) };
1208
1210
  }
1209
- async function kn(e) {
1211
+ async function Cn(e) {
1210
1212
  const t = e.headers.get("content-type");
1211
1213
  if (!t) return;
1212
- const [r, ...n] = t?.split(";").map((s) => s.trim().toLowerCase()) ?? [], o = xt.split(";")[0];
1214
+ const [r, ...n] = t?.split(";").map((s) => s.trim().toLowerCase()) ?? [], o = Tt.split(";")[0];
1213
1215
  if (r !== o) return;
1214
1216
  if (n.length !== 1 || n[0] !== "v=1")
1215
1217
  throw new Error("Demiurge received a malformed versioned mutation result.");
@@ -1219,25 +1221,25 @@ async function kn(e) {
1219
1221
  } catch {
1220
1222
  throw new Error("Demiurge received a malformed versioned mutation result.");
1221
1223
  }
1222
- if (!ee(i) || i.version !== 1 || typeof i.status != "string")
1224
+ if (!re(i) || i.version !== 1 || typeof i.status != "string")
1223
1225
  throw new Error("Demiurge received a malformed versioned mutation result.");
1224
1226
  if (i.status === "success") {
1225
- if (!Z(i, ["data", "revalidate", "status", "version"]) || i.revalidate !== void 0 && typeof i.revalidate != "boolean" || "data" in i && !Ve(i.data)) throw fe();
1227
+ if (!Q(i, ["data", "revalidate", "status", "version"]) || i.revalidate !== void 0 && typeof i.revalidate != "boolean" || "data" in i && !Ke(i.data)) throw pe();
1226
1228
  return { version: 1, status: "success", ...i.data === void 0 ? {} : { data: i.data }, ...i.revalidate === void 0 ? {} : { revalidate: i.revalidate } };
1227
1229
  }
1228
1230
  if (i.status === "invalid") {
1229
- if (!Z(i, ["status", "validation", "version"]) || !Rn(i.validation)) throw fe();
1231
+ if (!Q(i, ["status", "validation", "version"]) || !$n(i.validation)) throw pe();
1230
1232
  return { version: 1, status: "invalid", validation: i.validation };
1231
1233
  }
1232
1234
  if (i.status === "failed") {
1233
- if (!Z(i, ["message", "status", "version"]) || i.message !== void 0 && typeof i.message != "string") throw fe();
1235
+ if (!Q(i, ["message", "status", "version"]) || i.message !== void 0 && typeof i.message != "string") throw pe();
1234
1236
  return { version: 1, status: "failed", ...i.message === void 0 ? {} : { message: i.message } };
1235
1237
  }
1236
- if (i.status === "redirect" && typeof i.location == "string" && (i.history === "push" || i.history === "replace") && Z(i, ["history", "location", "status", "version"]))
1238
+ if (i.status === "redirect" && typeof i.location == "string" && (i.history === "push" || i.history === "replace") && Q(i, ["history", "location", "status", "version"]))
1237
1239
  return { version: 1, status: "redirect", location: i.location, history: i.history };
1238
- throw fe();
1240
+ throw pe();
1239
1241
  }
1240
- function Ut(e) {
1242
+ function zt(e) {
1241
1243
  try {
1242
1244
  const t = new URL(e, window.location.href);
1243
1245
  return t.protocol !== window.location.protocol || t.origin !== window.location.origin || t.username || t.password ? void 0 : `${t.pathname}${t.search}${t.hash}`;
@@ -1245,51 +1247,51 @@ function Ut(e) {
1245
1247
  return;
1246
1248
  }
1247
1249
  }
1248
- function Oe(e) {
1250
+ function Fe(e) {
1249
1251
  return { version: 1, status: "failed", message: e };
1250
1252
  }
1251
- function fe() {
1253
+ function pe() {
1252
1254
  return new Error("Demiurge received a malformed mutation result.");
1253
1255
  }
1254
- function Z(e, t) {
1256
+ function Q(e, t) {
1255
1257
  return Object.keys(e).every((r) => t.includes(r));
1256
1258
  }
1257
- function Rn(e) {
1258
- return ee(e) && Z(e, ["issues"]) && Array.isArray(e.issues) && e.issues.every(Tn);
1259
+ function $n(e) {
1260
+ return re(e) && Q(e, ["issues"]) && Array.isArray(e.issues) && e.issues.every(Nn);
1259
1261
  }
1260
- function Tn(e) {
1261
- return ee(e) && Z(e, ["code", "message", "path"]) && typeof e.code == "string" && typeof e.message == "string" && Array.isArray(e.path) && (e.path.length === 0 || typeof e.path[0] == "string") && e.path.every((t) => typeof t == "string" || typeof t == "number");
1262
+ function Nn(e) {
1263
+ return re(e) && Q(e, ["code", "message", "path"]) && typeof e.code == "string" && typeof e.message == "string" && Array.isArray(e.path) && (e.path.length === 0 || typeof e.path[0] == "string") && e.path.every((t) => typeof t == "string" || typeof t == "number");
1262
1264
  }
1263
- function Ve(e) {
1264
- return e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(Ve) : ee(e) && Object.values(e).every(Ve);
1265
+ function Ke(e) {
1266
+ return e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every(Ke) : re(e) && Object.values(e).every(Ke);
1265
1267
  }
1266
- function Mn(e) {
1267
- const t = kt(e.routes), r = e.loadNavigationData ?? Kt;
1268
+ function Ln(e) {
1269
+ const t = Mt(e.routes), r = e.loadNavigationData ?? Gt;
1268
1270
  return function() {
1269
- const [o, i] = U(() => F()), [s, a] = U(e.locale), u = Be(o.pathname, e.locales), d = k(o), [v, A] = U(
1271
+ const [o, i] = U(() => F()), [s, a] = U(e.locale), l = ze(o.pathname, e.locales), d = k(o), [v, A] = U(
1270
1272
  () => e.initialMatch ?? { status: "loading" }
1271
- ), h = k(!!e.initialMatch), p = k(!0), E = k(0), g = k(void 0), b = k("navigation"), m = k(/* @__PURE__ */ new Map()), T = k(/* @__PURE__ */ new Map()), [H, w] = U(0), [$, C] = U(0), V = k(/* @__PURE__ */ new Set()), [Qt, rt] = U(0), O = k("push"), [ue, Ae] = U(null), [q, xe] = U(null), nt = k(null);
1272
- nt.current = ue;
1273
- const K = k(void 0), ke = k(void 0), P = k(void 0), W = k(!1), ot = k(/* @__PURE__ */ new Map()), J = k([]), er = k(0);
1274
- function G() {
1275
- const c = P.current, l = qt();
1276
- c && ot.current.set(c, l), On(c, l);
1273
+ ), h = k(!!e.initialMatch), p = k(!0), E = k(0), g = k(void 0), b = k("navigation"), y = k(/* @__PURE__ */ new Map()), T = k(/* @__PURE__ */ new Map()), [H, w] = U(0), [$, C] = U(0), q = k(/* @__PURE__ */ new Set()), [rr, ot] = U(0), O = k("push"), z = k(!1), [de, ke] = U(null), [K, Re] = U(null), it = k(null);
1274
+ it.current = de;
1275
+ const W = k(void 0), Te = k(void 0), D = k(void 0), J = k(!1), at = k(/* @__PURE__ */ new Map()), G = k([]), nr = k(0);
1276
+ function Y() {
1277
+ const c = D.current, u = Jt();
1278
+ c && at.current.set(c, u), Bn(c, u);
1277
1279
  }
1278
- const Re = ae(() => ({
1280
+ const Me = ce(() => ({
1279
1281
  register(c) {
1280
- const l = {
1282
+ const u = {
1281
1283
  element: c,
1282
- order: er.current++
1284
+ order: nr.current++
1283
1285
  };
1284
- return J.current.length > 0 && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn(
1286
+ return G.current.length > 0 && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn(
1285
1287
  "Demiurge found more than one RouteFocusBoundary. The first boundary remains active."
1286
- ), J.current.push(l), () => {
1287
- const f = J.current.indexOf(l);
1288
- f !== -1 && J.current.splice(f, 1);
1288
+ ), G.current.push(u), () => {
1289
+ const f = G.current.indexOf(u);
1290
+ f !== -1 && G.current.splice(f, 1);
1289
1291
  };
1290
1292
  },
1291
1293
  focus() {
1292
- const c = J.current.slice().sort((l, f) => l.order - f.order)[0]?.element;
1294
+ const c = G.current.slice().sort((u, f) => u.order - f.order)[0]?.element;
1293
1295
  if (!c || !c.isConnected || typeof c.focus != "function")
1294
1296
  return !1;
1295
1297
  try {
@@ -1300,202 +1302,205 @@ function Mn(e) {
1300
1302
  return !0;
1301
1303
  }
1302
1304
  }), []);
1303
- ne(() => (e.navigation !== "document" && ar(), () => {
1304
- J.current = [];
1305
- }), [e.navigation]), Y(() => () => {
1306
- je();
1307
- for (const c of V.current) c();
1308
- V.current.clear();
1309
- for (const c of m.current.values()) c.abort();
1310
- m.current.clear(), T.current.clear();
1305
+ ie(() => (e.navigation !== "document" && lr(), () => {
1306
+ G.current = [];
1307
+ }), [e.navigation]), X(() => () => {
1308
+ qe();
1309
+ for (const c of q.current) c();
1310
+ q.current.clear();
1311
+ for (const c of y.current.values()) c.abort();
1312
+ y.current.clear(), T.current.clear();
1311
1313
  }, []);
1312
- function te(c) {
1313
- je(c);
1314
- let l = !1;
1315
- for (const [f, y] of m.current) {
1316
- if (y === c) continue;
1317
- y.abort(), m.current.delete(f);
1314
+ function ne(c) {
1315
+ qe(c);
1316
+ let u = !1;
1317
+ for (const [f, m] of y.current) {
1318
+ if (m === c) continue;
1319
+ m.abort(), y.current.delete(f);
1318
1320
  const S = T.current.get(f);
1319
1321
  (S?.state === "submitting" || S?.state === "loading") && T.current.set(f, {
1320
1322
  state: "idle",
1321
1323
  form: S.form,
1322
1324
  submissionKey: S.submissionKey,
1323
1325
  ...S.state === "loading" && S.result ? { result: S.result } : {}
1324
- }), l = !0;
1326
+ }), u = !0;
1325
1327
  }
1326
- l && w((f) => f + 1);
1328
+ u && w((f) => f + 1);
1327
1329
  }
1328
- function z() {
1330
+ function V() {
1329
1331
  E.current++, g.current?.abort(), g.current = void 0;
1330
1332
  }
1331
- Y(() => {
1333
+ X(() => {
1332
1334
  if (e.navigation === "document")
1333
1335
  return;
1334
1336
  const c = window.history.scrollRestoration;
1335
- window.history.scrollRestoration = "manual", P.current = wt(), G();
1336
- const l = () => {
1337
- W.current || G();
1337
+ window.history.scrollRestoration = "manual", D.current = bt(), Y();
1338
+ const u = () => {
1339
+ J.current || Y();
1338
1340
  };
1339
- return window.addEventListener("scroll", l, { passive: !0 }), () => {
1340
- window.removeEventListener("scroll", l), window.history.scrollRestoration = c;
1341
+ return window.addEventListener("scroll", u, { passive: !0 }), () => {
1342
+ window.removeEventListener("scroll", u), window.history.scrollRestoration = c;
1341
1343
  };
1342
- }, [e.navigation]), Y(() => {
1344
+ }, [e.navigation]), X(() => {
1343
1345
  function c() {
1344
- te(), O.current = "pop", W.current = !0, P.current = wt(), ke.current = ot.current.get(
1345
- P.current
1346
- ) ?? _n();
1347
- const l = F(), f = d.current;
1348
- (f.pathname !== l.pathname || f.search !== l.search) && (z(), b.current = "navigation"), d.current = l, e.navigation !== "document" && f.pathname === l.pathname && f.search === l.search && f.hash !== l.hash && pe(l.hash), i(l);
1346
+ ne(), z.current = !1, O.current = "pop", J.current = !0, D.current = bt(), Te.current = at.current.get(
1347
+ D.current
1348
+ ) ?? Hn();
1349
+ const u = F(), f = d.current;
1350
+ (f.pathname !== u.pathname || f.search !== u.search) && (V(), b.current = "navigation"), d.current = u, e.navigation !== "document" && f.pathname === u.pathname && f.search === u.search && f.hash !== u.hash && ye(u.hash), i(u);
1349
1351
  }
1350
1352
  return window.addEventListener("popstate", c), () => window.removeEventListener("popstate", c);
1351
- }, []), Y(() => {
1352
- let c = !1, l = !1;
1353
- const f = ++E.current, y = new AbortController();
1354
- g.current = y;
1355
- const S = b.current, D = () => !c && f === E.current;
1356
- if (Ae(null), xe(null), h.current && $n(e.initialMatch) === u)
1353
+ }, []), X(() => {
1354
+ let c = !1, u = !1;
1355
+ const f = ++E.current, m = new AbortController();
1356
+ g.current = m;
1357
+ const S = b.current, I = () => !c && f === E.current;
1358
+ if (ke(null), Re(null), h.current && Dn(e.initialMatch) === l)
1357
1359
  return h.current = !1, p.current = !1, () => {
1358
- c = !0, y.abort(), g.current === y && (g.current = void 0);
1360
+ c = !0, m.abort(), g.current === m && (g.current = void 0);
1359
1361
  };
1360
1362
  const _ = p.current;
1361
- p.current = !1, S !== "refresh" && e.navigation !== "document" && !_ && (K.current = {
1363
+ p.current = !1, S !== "refresh" && e.navigation !== "document" && !_ && (W.current = {
1362
1364
  navigation: O.current,
1363
- position: O.current === "pop" ? ke.current : void 0
1364
- }, ke.current = void 0), S !== "refresh" && (A({ status: "loading" }), yr(t, u).then((x) => {
1365
- D() && !l && x && A({ loading: x, status: "loading" });
1365
+ position: O.current === "pop" ? Te.current : void 0
1366
+ }, Te.current = void 0), S !== "refresh" && !z.current && (A({ status: "loading" }), br(t, l).then((x) => {
1367
+ I() && !u && x && A({ loading: x, status: "loading" });
1366
1368
  }).catch(() => {
1367
1369
  }));
1368
- const re = new Request(o.href, { signal: y.signal });
1369
- return Promise.resolve(r(re)).then(async (x) => {
1370
+ const oe = new Request(o.href, { signal: m.signal });
1371
+ return Promise.resolve(r(oe)).then(async (x) => {
1370
1372
  const N = x.url ? new URL(x.url, o.href) : new URL(o.href);
1371
1373
  N.hash || (N.hash = o.hash);
1372
- const M = x.locale ?? (e.locales ? gr(new Request(N), e.locales).locale : s);
1374
+ const M = x.locale ?? (e.locales ? Sr(new Request(N), e.locales).locale : s);
1373
1375
  return {
1374
1376
  initialData: x,
1375
1377
  responseUrl: N,
1376
- nextMatch: await Rt(
1378
+ nextMatch: await Ct(
1377
1379
  t,
1378
- Be(N.pathname, e.locales),
1379
- new Request(N.href, { signal: y.signal }),
1380
+ ze(N.pathname, e.locales),
1381
+ new Request(N.href, { signal: m.signal }),
1380
1382
  x,
1381
1383
  void 0,
1382
1384
  { documentContributions: !1, locale: M }
1383
1385
  )
1384
1386
  };
1385
1387
  }).then(({ initialData: x, nextMatch: N, responseUrl: M }) => {
1386
- if (l = !0, D()) {
1387
- if (x.document && at(x.document), "locale" in x && x.locale && a(x.locale), M.href !== o.href) {
1388
- window.history.replaceState(window.history.state, "", M);
1389
- const L = F();
1390
- d.current = L, i(L);
1391
- }
1392
- A(N), rt((L) => L + 1), S !== "refresh" && Ae({
1393
- kind: O.current,
1394
- outcome: N.status === "not-found" ? "not-found" : "ready",
1395
- title: document.title || "Demiurge App",
1396
- url: new URL(o.href)
1397
- });
1388
+ if (u = !0, I()) {
1389
+ const P = () => {
1390
+ if (x.document && ct(x.document), "locale" in x && x.locale && a(x.locale), M.href !== o.href) {
1391
+ window.history.replaceState(window.history.state, "", M);
1392
+ const fe = F();
1393
+ d.current = fe, i(fe);
1394
+ }
1395
+ A(N), ot((fe) => fe + 1), S !== "refresh" && ke({
1396
+ kind: O.current,
1397
+ outcome: N.status === "not-found" ? "not-found" : "ready",
1398
+ title: document.title || "Demiurge App",
1399
+ url: new URL(o.href)
1400
+ });
1401
+ }, Z = z.current;
1402
+ z.current = !1, Z ? Gn(P) : P();
1398
1403
  }
1399
1404
  }).catch(async (x) => {
1400
- if (l = !0, !D() || y.signal.aborted)
1405
+ if (u = !0, !I() || m.signal.aborted)
1401
1406
  return;
1402
- const N = await wr(
1407
+ const N = await Er(
1403
1408
  t,
1404
- u
1409
+ l
1405
1410
  );
1406
- if (D()) {
1407
- const M = typeof x == "object" && x ? Wt.get(x) : void 0;
1408
- M && at(M), A({
1411
+ if (I()) {
1412
+ const M = typeof x == "object" && x ? Yt.get(x) : void 0;
1413
+ M && ct(M), A({
1409
1414
  Error: N,
1410
1415
  error: x,
1411
1416
  locale: s,
1412
- pathname: u,
1417
+ pathname: l,
1413
1418
  status: "error"
1414
- }), Ae(S === "refresh" ? null : {
1419
+ }), ke(S === "refresh" ? null : {
1415
1420
  kind: O.current,
1416
1421
  outcome: "error",
1417
1422
  title: M?.title ?? "Navigation failed",
1418
1423
  url: new URL(o.href)
1419
- }), rt((L) => L + 1);
1424
+ }), ot((P) => P + 1);
1420
1425
  }
1421
1426
  }), () => {
1422
- c = !0, y.abort(), g.current === y && (g.current = void 0);
1427
+ c = !0, m.abort(), g.current === m && (g.current = void 0);
1423
1428
  };
1424
- }, [u, o.pathname, o.search, $]), ne(() => {
1425
- if (!(!q || e.navigation === "document")) {
1426
- if (q.url.hash) {
1427
- K.current && (K.current = void 0, pe(q.url.hash)), W.current = !1;
1429
+ }, [l, o.pathname, o.search, $]), ie(() => {
1430
+ if (!(!K || e.navigation === "document")) {
1431
+ if (K.url.hash) {
1432
+ W.current && (W.current = void 0, ye(K.url.hash)), J.current = !1;
1428
1433
  return;
1429
1434
  }
1430
- if (Re.focus(), K.current) {
1431
- const c = K.current;
1432
- K.current = void 0, Fn(e.navigationScroll, {
1433
- ...q,
1435
+ if (Me.focus(), W.current) {
1436
+ const c = W.current;
1437
+ W.current = void 0, zn(e.navigationScroll, {
1438
+ ...K,
1434
1439
  kind: c.navigation,
1435
1440
  navigation: c.navigation,
1436
1441
  position: c.position
1437
1442
  });
1438
1443
  }
1439
- W.current = !1, jn(q, e.navigationAccessibility);
1444
+ J.current = !1, Wn(K, e.navigationAccessibility);
1440
1445
  }
1441
1446
  }, [
1442
- q,
1443
- Re,
1447
+ K,
1448
+ Me,
1444
1449
  e.navigation,
1445
1450
  e.navigationAccessibility,
1446
1451
  e.navigationScroll
1447
1452
  ]);
1448
- function B(c, l) {
1449
- T.current.set(c, l), w((f) => f + 1);
1453
+ function B(c, u) {
1454
+ T.current.set(c, u), w((f) => f + 1);
1450
1455
  }
1451
- function tr(c, l) {
1452
- const f = Fe(c, l), y = T.current.get(f);
1453
- y?.form === c && (y.state === "loading" && y.result || (m.current.get(f)?.abort(), m.current.delete(f), T.current.delete(f), w((S) => S + 1)));
1456
+ function or(c, u) {
1457
+ const f = Be(c, u), m = T.current.get(f);
1458
+ m?.form === c && (m.state === "loading" && m.result || (y.current.get(f)?.abort(), y.current.delete(f), T.current.delete(f), w((S) => S + 1)));
1454
1459
  }
1455
- const rr = ae(
1460
+ const ir = ce(
1456
1461
  () => ({
1457
1462
  navigation: e.navigation ?? "server",
1458
1463
  locale: s,
1459
1464
  locales: e.locales,
1460
1465
  submissionVersion: H,
1461
- getMutationNavigation(c, l) {
1462
- const f = Fe(c, l);
1466
+ getMutationNavigation(c, u) {
1467
+ const f = Be(c, u);
1463
1468
  return T.current.get(f) ?? {
1464
1469
  state: "idle",
1465
1470
  form: c,
1466
- submissionKey: l
1471
+ submissionKey: u
1467
1472
  };
1468
1473
  },
1469
- releaseMutationNavigation: tr,
1474
+ releaseMutationNavigation: or,
1470
1475
  push(c) {
1471
- te(), W.current = !1;
1472
- const l = F();
1473
- O.current = "push", e.navigation !== "document" && G();
1474
- const f = ge();
1475
- window.history.pushState(f.state, "", c), P.current = f.key;
1476
- const y = F();
1477
- (l.pathname !== y.pathname || l.search !== y.search) && (z(), b.current = "navigation"), d.current = y, i(y), l.pathname === y.pathname && l.search === y.search && l.hash !== y.hash && pe(y.hash);
1476
+ ne(), J.current = !1;
1477
+ const u = F();
1478
+ O.current = "push", e.navigation !== "document" && Y();
1479
+ const f = ve();
1480
+ window.history.pushState(f.state, "", c), D.current = f.key;
1481
+ const m = F();
1482
+ z.current = At(e.viewTransitions) && (u.pathname !== m.pathname || u.search !== m.search), (u.pathname !== m.pathname || u.search !== m.search) && (V(), b.current = "navigation"), d.current = m, i(m), u.pathname === m.pathname && u.search === m.search && u.hash !== m.hash && ye(m.hash);
1478
1483
  },
1479
1484
  replace(c) {
1480
- te(), W.current = !1;
1481
- const l = F();
1482
- O.current = "replace", e.navigation !== "document" && G(), window.history.replaceState(
1483
- we(window.history.state, P.current),
1485
+ ne(), J.current = !1;
1486
+ const u = F();
1487
+ O.current = "replace", e.navigation !== "document" && Y(), window.history.replaceState(
1488
+ be(window.history.state, D.current),
1484
1489
  "",
1485
1490
  c
1486
1491
  );
1487
1492
  const f = F();
1488
- (l.pathname !== f.pathname || l.search !== f.search) && (z(), b.current = "navigation"), d.current = f, i(f), e.navigation !== "document" && l.pathname === f.pathname && l.search === f.search && l.hash !== f.hash && pe(f.hash);
1493
+ z.current = At(e.viewTransitions) && (u.pathname !== f.pathname || u.search !== f.search), (u.pathname !== f.pathname || u.search !== f.search) && (V(), b.current = "navigation"), d.current = f, i(f), e.navigation !== "document" && u.pathname === f.pathname && u.search === f.search && u.hash !== f.hash && ye(f.hash);
1489
1494
  },
1490
- async submitMutation(c, l, f) {
1495
+ async submitMutation(c, u, f) {
1491
1496
  if ((e.navigation ?? "server") !== "server") return;
1492
- const y = Bn(c, l);
1493
- if (!y) return;
1494
- const S = Fe(c, f);
1495
- m.current.get(S)?.abort();
1496
- const D = new AbortController();
1497
- m.current.set(S, D);
1498
- const _ = y.formData, re = () => !D.signal.aborted && m.current.get(S) === D;
1497
+ const m = jn(c, u);
1498
+ if (!m) return;
1499
+ const S = Be(c, f);
1500
+ y.current.get(S)?.abort();
1501
+ const I = new AbortController();
1502
+ y.current.set(S, I);
1503
+ const _ = m.formData, oe = () => !I.signal.aborted && y.current.get(S) === I;
1499
1504
  B(S, {
1500
1505
  state: "submitting",
1501
1506
  form: c,
@@ -1504,129 +1509,129 @@ function Mn(e) {
1504
1509
  });
1505
1510
  let x;
1506
1511
  try {
1507
- const N = await Ft({
1508
- body: y.body,
1509
- contentType: y.contentType,
1510
- method: y.method,
1511
- signal: D.signal,
1512
- url: y.url
1512
+ const N = await Ht({
1513
+ body: m.body,
1514
+ contentType: m.contentType,
1515
+ method: m.method,
1516
+ signal: I.signal,
1517
+ url: m.url
1513
1518
  });
1514
- if (x = N.response, !re()) return;
1519
+ if (x = N.response, !oe()) return;
1515
1520
  const M = N.result;
1516
- if (!re()) return;
1521
+ if (!oe()) return;
1517
1522
  if (M?.status === "invalid") {
1518
1523
  B(S, { state: "invalid", form: c, submissionKey: f, formData: _, result: M });
1519
1524
  return;
1520
1525
  }
1521
1526
  if (M?.status === "redirect") {
1522
- const L = Ut(M.location);
1523
- if (!L) {
1527
+ const P = zt(M.location);
1528
+ if (!P) {
1524
1529
  B(S, { state: "error", form: c, submissionKey: f, formData: _, response: x });
1525
1530
  return;
1526
1531
  }
1527
- if (z(), te(D), b.current = "navigation", B(S, { state: "loading", form: c, submissionKey: f, formData: _ }), G(), M.history === "replace")
1532
+ if (V(), ne(I), b.current = "navigation", B(S, { state: "loading", form: c, submissionKey: f, formData: _ }), Y(), M.history === "replace")
1528
1533
  window.history.replaceState(
1529
- we(null, P.current),
1534
+ be(null, D.current),
1530
1535
  "",
1531
- L
1536
+ P
1532
1537
  );
1533
1538
  else {
1534
- const le = ge();
1535
- window.history.pushState(le.state, "", L), P.current = le.key;
1539
+ const Z = ve();
1540
+ window.history.pushState(Z.state, "", P), D.current = Z.key;
1536
1541
  }
1537
- O.current = M.history, d.current = F(), i(d.current), C((le) => le + 1);
1542
+ O.current = M.history, d.current = F(), i(d.current), C((Z) => Z + 1);
1538
1543
  return;
1539
1544
  }
1540
1545
  if (M?.status === "failed" || !x.ok) {
1541
1546
  B(S, { state: "error", form: c, submissionKey: f, formData: _, response: x });
1542
1547
  return;
1543
1548
  }
1544
- M?.status === "success" && M.revalidate ? (B(S, { state: "loading", form: c, submissionKey: f, formData: _, result: M }), z(), b.current = "refresh", C((L) => L + 1)) : B(S, { state: "idle", form: c, submissionKey: f, result: M });
1549
+ M?.status === "success" && M.revalidate ? (B(S, { state: "loading", form: c, submissionKey: f, formData: _, result: M }), V(), b.current = "refresh", C((P) => P + 1)) : B(S, { state: "idle", form: c, submissionKey: f, result: M });
1545
1550
  } catch {
1546
- re() && B(S, { state: "error", form: c, submissionKey: f, formData: _, response: x });
1551
+ oe() && B(S, { state: "error", form: c, submissionKey: f, formData: _, response: x });
1547
1552
  } finally {
1548
- m.current.get(S) === D && m.current.delete(S);
1553
+ y.current.get(S) === I && y.current.delete(S);
1549
1554
  }
1550
1555
  }
1551
1556
  }),
1552
1557
  [H]
1553
1558
  );
1554
- return ne(() => En({
1555
- redirect(c, l, f) {
1556
- if (z(), te(f), b.current = "navigation", G(), l === "replace")
1559
+ return ie(() => Rn({
1560
+ redirect(c, u, f) {
1561
+ if (V(), ne(f), z.current = !1, b.current = "navigation", Y(), u === "replace")
1557
1562
  window.history.replaceState(
1558
- we(null, P.current),
1563
+ be(null, D.current),
1559
1564
  "",
1560
1565
  c
1561
1566
  );
1562
1567
  else {
1563
- const y = ge();
1564
- window.history.pushState(y.state, "", c), P.current = y.key;
1568
+ const m = ve();
1569
+ window.history.pushState(m.state, "", c), D.current = m.key;
1565
1570
  }
1566
- O.current = l, d.current = F(), i(d.current), C((y) => y + 1);
1571
+ O.current = u, d.current = F(), i(d.current), C((m) => m + 1);
1567
1572
  },
1568
1573
  refresh() {
1569
1574
  return new Promise((c) => {
1570
- z(), b.current = "refresh", V.current.add(c), C((l) => l + 1);
1575
+ V(), b.current = "refresh", q.current.add(c), C((u) => u + 1);
1571
1576
  });
1572
1577
  }
1573
- }), [s, e.locales, e.navigation]), R(Yt.Provider, {
1574
- value: rr,
1575
- children: R(Pt.Provider, {
1576
- value: Re,
1577
- children: R(Dn, {
1578
+ }), [s, e.locales, e.navigation]), R(Qt.Provider, {
1579
+ value: ir,
1580
+ children: R(Ft.Provider, {
1581
+ value: Me,
1582
+ children: R(Fn, {
1578
1583
  key: `${o.pathname}${o.search}`,
1579
1584
  Loading: e.loading,
1580
1585
  NotFound: e.notFound,
1581
1586
  match: v,
1582
- pendingCommit: ue,
1583
- resolvedRouteVersion: Qt,
1587
+ pendingCommit: de,
1588
+ resolvedRouteVersion: rr,
1584
1589
  onCommitted: (c) => {
1585
- nt.current === c && xe(c);
1590
+ it.current === c && Re(c);
1586
1591
  },
1587
1592
  onRenderError: () => {
1588
- xe(ue ? { ...ue, outcome: "error", title: "Navigation failed" } : null), it();
1593
+ Re(de ? { ...de, outcome: "error", title: "Navigation failed" } : null), st();
1589
1594
  },
1590
- onRouteCommitted: it
1595
+ onRouteCommitted: st
1591
1596
  })
1592
1597
  })
1593
1598
  });
1594
- function it() {
1595
- for (const c of V.current) c();
1596
- V.current.clear();
1597
- for (const [c, l] of T.current)
1598
- l.state === "loading" && T.current.set(c, {
1599
+ function st() {
1600
+ for (const c of q.current) c();
1601
+ q.current.clear();
1602
+ for (const [c, u] of T.current)
1603
+ u.state === "loading" && T.current.set(c, {
1599
1604
  state: "idle",
1600
- form: l.form,
1601
- submissionKey: l.submissionKey,
1602
- result: l.result
1605
+ form: u.form,
1606
+ submissionKey: u.submissionKey,
1607
+ result: u.result
1603
1608
  });
1604
1609
  w((c) => c + 1);
1605
1610
  }
1606
1611
  };
1607
1612
  }
1608
- function Cn(e, t) {
1609
- const r = t.getAttribute(ur);
1613
+ function In(e, t) {
1614
+ const r = t.getAttribute(hr);
1610
1615
  return e.status === "not-found" ? r === "not-found" : e.status === "ready" && r === null;
1611
1616
  }
1612
- function $n(e) {
1617
+ function Dn(e) {
1613
1618
  if (e)
1614
1619
  return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
1615
1620
  }
1616
- async function Vo(e) {
1621
+ async function Yo(e) {
1617
1622
  const t = e.root ?? document.getElementById("root");
1618
1623
  if (!t)
1619
1624
  throw new Error(
1620
1625
  "Demiurge expected a #root element in the framework document."
1621
1626
  );
1622
- const r = kt(e.routes), n = e.loadNavigationData ?? Kt, o = e.initialData ?? sr(document), i = await Rt(
1627
+ const r = Mt(e.routes), n = e.loadNavigationData ?? Gt, o = e.initialData ?? dr(document), i = await Ct(
1623
1628
  r,
1624
- Be(window.location.pathname, e.locales),
1629
+ ze(window.location.pathname, e.locales),
1625
1630
  new Request(window.location.href),
1626
1631
  o ?? await n(new Request(window.location.href)),
1627
1632
  void 0,
1628
1633
  { documentContributions: !1, locale: o?.locale ?? e.locale }
1629
- ), s = Cn(i, t), a = Mn(
1634
+ ), s = In(i, t), a = Ln(
1630
1635
  s ? {
1631
1636
  ...e,
1632
1637
  locale: o?.locale ?? e.locale,
@@ -1638,16 +1643,16 @@ async function Vo(e) {
1638
1643
  loadNavigationData: n,
1639
1644
  navigation: o?.navigation ?? e.navigation
1640
1645
  }
1641
- ), { createRoot: u, hydrateRoot: d } = Nn(
1646
+ ), { createRoot: l, hydrateRoot: d } = Pn(
1642
1647
  await import("react-dom/client")
1643
1648
  );
1644
- if (s && t.hasAttribute(cr)) {
1645
- d(t, R(a)), st();
1649
+ if (s && t.hasAttribute(fr)) {
1650
+ d(t, R(a)), ut();
1646
1651
  return;
1647
1652
  }
1648
- t.replaceChildren(), u(t).render(R(a)), st();
1653
+ t.replaceChildren(), l(t).render(R(a)), ut();
1649
1654
  }
1650
- function Nn(e) {
1655
+ function Pn(e) {
1651
1656
  const t = typeof e.createRoot == "function" && typeof e.hydrateRoot == "function" ? e : e.default;
1652
1657
  if (!t || typeof t.createRoot != "function" || typeof t.hydrateRoot != "function")
1653
1658
  throw new Error(
@@ -1655,65 +1660,65 @@ function Nn(e) {
1655
1660
  );
1656
1661
  return t;
1657
1662
  }
1658
- function Ln(e, t) {
1659
- const r = Ee(), {
1663
+ function On(e, t) {
1664
+ const r = xe(), {
1660
1665
  children: n,
1661
1666
  download: o,
1662
1667
  hash: i,
1663
1668
  locale: s,
1664
1669
  onClick: a,
1665
- path: u,
1670
+ path: l,
1666
1671
  reloadDocument: d,
1667
1672
  replace: v,
1668
1673
  search: A,
1669
1674
  target: h,
1670
1675
  to: p,
1671
1676
  ...E
1672
- } = e, g = Xe(e), b = s, m = r.locales && (b ?? r.locale) ? Qe(
1677
+ } = e, g = et(e), b = s, y = r.locales && (b ?? r.locale) ? tt(
1673
1678
  g,
1674
1679
  b ?? r.locale,
1675
1680
  r.locales,
1676
1681
  typeof window > "u" ? "http://demiurge.local" : window.location.href
1677
1682
  ) : g;
1678
- return /* @__PURE__ */ Et(
1683
+ return /* @__PURE__ */ kt(
1679
1684
  "a",
1680
1685
  {
1681
1686
  ...E,
1682
1687
  download: o,
1683
- href: m,
1688
+ href: y,
1684
1689
  ref: t,
1685
1690
  target: h,
1686
1691
  onClick: (T) => {
1687
- a?.(T), r.navigation === "server" && !d && zn(T, { download: o, target: h, to: m }) && (T.preventDefault(), v ? r.replace(m) : r.push(m));
1692
+ a?.(T), r.navigation === "server" && !d && Kn(T, { download: o, target: h, to: y }) && (T.preventDefault(), v ? r.replace(y) : r.push(y));
1688
1693
  },
1689
1694
  children: n
1690
1695
  }
1691
1696
  );
1692
1697
  }
1693
- function qo(e) {
1694
- return Ln(e, e.ref ?? null);
1698
+ function Zo(e) {
1699
+ return On(e, e.ref ?? null);
1695
1700
  }
1696
- const Bt = We(void 0);
1697
- function Ko(e) {
1698
- const t = Ee(), r = k(t);
1701
+ const Vt = Ge(void 0);
1702
+ function Xo(e) {
1703
+ const t = xe(), r = k(t);
1699
1704
  r.current = t;
1700
- const n = or(), o = e.submissionKey ?? n, i = k(null), s = Ht(), a = typeof e.action == "function" ? e.action : void 0, u = a ? _t(a) : void 0, d = !!(a && s && t.navigation === "server");
1701
- ne(() => () => {
1705
+ const n = sr(), o = e.submissionKey ?? n, i = k(null), s = jt(), a = typeof e.action == "function" ? e.action : void 0, l = a ? Bt(a) : void 0, d = !!(a && s && t.navigation === "server");
1706
+ ie(() => () => {
1702
1707
  i.current && r.current.releaseMutationNavigation(i.current, o);
1703
1708
  }, [o]);
1704
1709
  function v(g) {
1705
1710
  const b = e.onSubmit;
1706
1711
  if (b?.(g), a || g.defaultPrevented || t.navigation !== "server") return;
1707
- const m = g.nativeEvent.submitter;
1708
- Jt(g.currentTarget, m) && (g.preventDefault(), t.submitMutation(
1712
+ const y = g.nativeEvent.submitter;
1713
+ Zt(g.currentTarget, y) && (g.preventDefault(), t.submitMutation(
1709
1714
  g.currentTarget,
1710
- m,
1715
+ y,
1711
1716
  o
1712
1717
  ));
1713
1718
  }
1714
- const { submissionKey: A, ...h } = e, p = a ? d ? a : u?.url : h.action, E = typeof p == "string" && t.locales && (e.locale ?? t.locale) ? Qe(p, e.locale ?? t.locale, t.locales, typeof window > "u" ? "http://demiurge.local" : window.location.href) : p;
1719
+ const { submissionKey: A, ...h } = e, p = a ? d ? a : l?.url : h.action, E = typeof p == "string" && t.locales && (e.locale ?? t.locale) ? tt(p, e.locale ?? t.locale, t.locales, typeof window > "u" ? "http://demiurge.local" : window.location.href) : p;
1715
1720
  return R(
1716
- Bt.Provider,
1721
+ Vt.Provider,
1717
1722
  {
1718
1723
  value: o,
1719
1724
  children: R("form", {
@@ -1732,8 +1737,8 @@ function Ko(e) {
1732
1737
  }
1733
1738
  );
1734
1739
  }
1735
- function Wo(e) {
1736
- const t = Ee(), r = Ht(), n = _t(e.formAction), o = r && t.navigation === "server", i = t.locales && (e.locale ?? t.locale) ? Qe(n.url, e.locale ?? t.locale, t.locales, typeof window > "u" ? "http://demiurge.local" : window.location.href) : n.url;
1740
+ function Qo(e) {
1741
+ const t = xe(), r = jt(), n = Bt(e.formAction), o = r && t.navigation === "server", i = t.locales && (e.locale ?? t.locale) ? tt(n.url, e.locale ?? t.locale, t.locales, typeof window > "u" ? "http://demiurge.local" : window.location.href) : n.url;
1737
1742
  return R("button", {
1738
1743
  ...e,
1739
1744
  locale: void 0,
@@ -1741,18 +1746,18 @@ function Wo(e) {
1741
1746
  formMethod: o ? void 0 : "post"
1742
1747
  });
1743
1748
  }
1744
- function Ht() {
1749
+ function jt() {
1745
1750
  const [e, t] = U(!1);
1746
- return Y(() => t(!0), []), e;
1751
+ return X(() => t(!0), []), e;
1747
1752
  }
1748
- function In(e) {
1749
- const t = Je(Bt);
1750
- return Ee().getMutationNavigation(e?.form, e?.submissionKey ?? t);
1753
+ function _n(e) {
1754
+ const t = Ye(Vt);
1755
+ return xe().getMutationNavigation(e?.form, e?.submissionKey ?? t);
1751
1756
  }
1752
- function Jo(e) {
1753
- return In({ submissionKey: e });
1757
+ function ei(e) {
1758
+ return _n({ submissionKey: e });
1754
1759
  }
1755
- function Dn({
1760
+ function Fn({
1756
1761
  Loading: e,
1757
1762
  NotFound: t,
1758
1763
  match: r,
@@ -1763,51 +1768,51 @@ function Dn({
1763
1768
  onRouteCommitted: a
1764
1769
  }) {
1765
1770
  if (r.status === "loading") {
1766
- const m = r.loading ?? e;
1767
- return m ? R(m) : null;
1771
+ const y = r.loading ?? e;
1772
+ return y ? R(y) : null;
1768
1773
  }
1769
1774
  if (r.status === "not-found") {
1770
- const m = r.notFound ?? t ?? kr;
1771
- return R(Te, null, r.layouts.reduceRight(
1775
+ const y = r.notFound ?? t ?? Cr;
1776
+ return R(Ce, null, r.layouts.reduceRight(
1772
1777
  (T, H) => R(H, {
1773
1778
  children: T,
1774
1779
  locale: r.locale,
1775
1780
  path: {},
1776
1781
  pathname: r.pathname
1777
1782
  }),
1778
- R(m, { locale: r.locale, pathname: r.pathname })
1779
- ), R(_e, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s }));
1783
+ R(y, { locale: r.locale, pathname: r.pathname })
1784
+ ), R(Ue, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s }));
1780
1785
  }
1781
1786
  if (r.status === "error")
1782
- return R(Te, null, r.Error ? R(r.Error, {
1787
+ return R(Ce, null, r.Error ? R(r.Error, {
1783
1788
  error: r.error,
1784
1789
  locale: "locale" in r ? r.locale : void 0,
1785
1790
  pathname: r.pathname,
1786
- status: zt(r.error)
1787
- }) : null, R(_e, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s }));
1788
- const { data: u, error: d, locale: v, page: A, layouts: h, path: p, pathname: E } = r.match, g = R(A, { data: u, locale: v, path: p, pathname: E }), b = h.reduceRight(
1789
- (m, T) => R(T, { path: p, pathname: E, locale: v, children: m }),
1791
+ status: qt(r.error)
1792
+ }) : null, R(Ue, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s }));
1793
+ const { data: l, error: d, locale: v, page: A, layouts: h, path: p, pathname: E } = r.match, g = R(A, { data: l, locale: v, path: p, pathname: E }), b = h.reduceRight(
1794
+ (y, T) => R(T, { path: p, pathname: E, locale: v, children: y }),
1790
1795
  g
1791
1796
  );
1792
- return R(Pn, {
1797
+ return R(Un, {
1793
1798
  Error: d,
1794
- children: R(Te, null, b, R(_e, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s })),
1799
+ children: R(Ce, null, b, R(Ue, { commit: i, onCommit: o, onRouteCommitted: a, resolvedRouteVersion: s })),
1795
1800
  onError: n,
1796
1801
  pathname: E
1797
1802
  });
1798
1803
  }
1799
- function _e({
1804
+ function Ue({
1800
1805
  commit: e,
1801
1806
  onCommit: t,
1802
1807
  onRouteCommitted: r,
1803
1808
  resolvedRouteVersion: n
1804
1809
  }) {
1805
1810
  const o = k(null), i = k(0);
1806
- return ne(() => {
1811
+ return ie(() => {
1807
1812
  n > i.current && (i.current = n, r()), e && o.current !== e && (o.current = e, t(e));
1808
1813
  }, [e, t, r, n]), null;
1809
1814
  }
1810
- class Pn extends ir {
1815
+ class Un extends cr {
1811
1816
  static getDerivedStateFromError(t) {
1812
1817
  return { error: t };
1813
1818
  }
@@ -1822,12 +1827,12 @@ class Pn extends ir {
1822
1827
  return this.state.error !== void 0 ? this.props.Error ? R(this.props.Error, {
1823
1828
  error: this.state.error,
1824
1829
  pathname: this.props.pathname,
1825
- status: zt(this.state.error)
1830
+ status: qt(this.state.error)
1826
1831
  }) : null : this.props.children;
1827
1832
  }
1828
1833
  }
1829
- function zt(e) {
1830
- return Rr(e) ? e.status : 500;
1834
+ function qt(e) {
1835
+ return $r(e) ? e.status : 500;
1831
1836
  }
1832
1837
  function F() {
1833
1838
  return {
@@ -1837,43 +1842,43 @@ function F() {
1837
1842
  search: window.location.search
1838
1843
  };
1839
1844
  }
1840
- const qe = "__demiurge_scroll", Ke = "__demiurge_history_entry";
1841
- let jt = 0;
1842
- function wt() {
1843
- const e = Vt(window.history.state);
1845
+ const We = "__demiurge_scroll", Je = "__demiurge_history_entry";
1846
+ let Kt = 0;
1847
+ function bt() {
1848
+ const e = Wt(window.history.state);
1844
1849
  if (e) return e;
1845
- const t = ge(window.history.state);
1850
+ const t = ve(window.history.state);
1846
1851
  return window.history.replaceState(t.state, "", window.location.href), t.key;
1847
1852
  }
1848
- function ge(e) {
1849
- const t = `entry:${++jt}`;
1850
- return { key: t, state: we(e, t) };
1853
+ function ve(e) {
1854
+ const t = `entry:${++Kt}`;
1855
+ return { key: t, state: be(e, t) };
1851
1856
  }
1852
- function we(e, t = `entry:${++jt}`) {
1853
- return e && typeof e == "object" ? { ...e, [Ke]: t } : { [Ke]: t };
1857
+ function be(e, t = `entry:${++Kt}`) {
1858
+ return e && typeof e == "object" ? { ...e, [Je]: t } : { [Je]: t };
1854
1859
  }
1855
- function Vt(e) {
1860
+ function Wt(e) {
1856
1861
  if (!e || typeof e != "object") return;
1857
- const t = Reflect.get(e, Ke);
1862
+ const t = Reflect.get(e, Je);
1858
1863
  return typeof t == "string" ? t : void 0;
1859
1864
  }
1860
- function qt() {
1865
+ function Jt() {
1861
1866
  return { x: window.scrollX, y: window.scrollY };
1862
1867
  }
1863
- function On(e, t = qt()) {
1868
+ function Bn(e, t = Jt()) {
1864
1869
  const r = window.history.state;
1865
- if (e && Vt(r) !== e) return;
1866
- const n = r && typeof r == "object" ? { ...r, [qe]: t } : { [qe]: t };
1870
+ if (e && Wt(r) !== e) return;
1871
+ const n = r && typeof r == "object" ? { ...r, [We]: t } : { [We]: t };
1867
1872
  try {
1868
1873
  window.history.replaceState(n, "", window.location.href);
1869
1874
  } catch {
1870
1875
  }
1871
1876
  }
1872
- function _n() {
1873
- const e = window.history.state?.[qe];
1877
+ function Hn() {
1878
+ const e = window.history.state?.[We];
1874
1879
  return e && typeof e == "object" && typeof e.x == "number" && typeof e.y == "number" ? { x: e.x, y: e.y } : void 0;
1875
1880
  }
1876
- function Fn(e, t) {
1881
+ function zn(e, t) {
1877
1882
  if (t.kind === "pop" && t.url.hash || e === !1)
1878
1883
  return;
1879
1884
  if (typeof e == "function") {
@@ -1886,14 +1891,14 @@ function Fn(e, t) {
1886
1891
  const r = t.kind === "pop" ? t.position?.x ?? 0 : 0, n = t.kind === "pop" ? t.position?.y ?? 0 : 0;
1887
1892
  window.scrollTo?.(r, n);
1888
1893
  }
1889
- async function Kt(e) {
1894
+ async function Gt(e) {
1890
1895
  const t = new Headers(e.headers);
1891
- t.set("accept", "application/json"), t.set(ut, vr);
1896
+ t.set("accept", "application/json"), t.set(dt, Ar);
1892
1897
  const r = await fetch(new Request(e, {
1893
1898
  credentials: "same-origin",
1894
1899
  headers: t
1895
- })), n = r.headers.get(ut);
1896
- if (n === br) {
1900
+ })), n = r.headers.get(dt);
1901
+ if (n === xr) {
1897
1902
  const o = await r.json();
1898
1903
  if (o.hasData !== !0)
1899
1904
  throw new Error("Demiurge received malformed navigation route data.");
@@ -1905,8 +1910,8 @@ async function Kt(e) {
1905
1910
  url: r.url
1906
1911
  };
1907
1912
  }
1908
- if (n === Sr) {
1909
- const o = await vt(r);
1913
+ if (n === kr) {
1914
+ const o = await St(r);
1910
1915
  return {
1911
1916
  document: o?.document,
1912
1917
  hasData: !0,
@@ -1914,21 +1919,21 @@ async function Kt(e) {
1914
1919
  url: r.url
1915
1920
  };
1916
1921
  }
1917
- if (n === Er || !r.ok) {
1918
- const o = await vt(r), i = Ar.includes(
1922
+ if (n === Rr || !r.ok) {
1923
+ const o = await St(r), i = Tr.includes(
1919
1924
  r.status
1920
- ) ? r.status : 500, s = xr(i, {
1925
+ ) ? r.status : 500, s = Mr(i, {
1921
1926
  detail: o?.error?.detail,
1922
1927
  title: o?.error?.title
1923
1928
  });
1924
- throw o?.document && Wt.set(s, o.document), s;
1929
+ throw o?.document && Yt.set(s, o.document), s;
1925
1930
  }
1926
1931
  throw new Error(
1927
1932
  "Demiurge expected a navigation data response from the application server."
1928
1933
  );
1929
1934
  }
1930
- const Wt = /* @__PURE__ */ new WeakMap();
1931
- async function vt(e) {
1935
+ const Yt = /* @__PURE__ */ new WeakMap();
1936
+ async function St(e) {
1932
1937
  try {
1933
1938
  return await e.json();
1934
1939
  } catch (t) {
@@ -1936,16 +1941,16 @@ async function vt(e) {
1936
1941
  return;
1937
1942
  }
1938
1943
  }
1939
- function Fe(e, t) {
1944
+ function Be(e, t) {
1940
1945
  if (t) return t;
1941
1946
  if (!e) return "default";
1942
- let r = bt.get(e);
1943
- return r || (r = `form:${Un++}`, bt.set(e, r)), r;
1947
+ let r = Et.get(e);
1948
+ return r || (r = `form:${Vn++}`, Et.set(e, r)), r;
1944
1949
  }
1945
- const bt = /* @__PURE__ */ new WeakMap();
1946
- let Un = 1;
1947
- function Jt(e, t) {
1948
- const r = Gt(e, t);
1950
+ const Et = /* @__PURE__ */ new WeakMap();
1951
+ let Vn = 1;
1952
+ function Zt(e, t) {
1953
+ const r = Xt(e, t);
1949
1954
  if (!r) return !1;
1950
1955
  const { action: n, enctype: o, method: i, target: s } = r;
1951
1956
  if (!["POST", "PUT", "PATCH", "DELETE"].includes(i) || s && s.toLowerCase() !== "_self") return !1;
@@ -1956,15 +1961,15 @@ function Jt(e, t) {
1956
1961
  }
1957
1962
  return ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"].includes(o);
1958
1963
  }
1959
- function Bn(e, t) {
1960
- if (!Jt(e, t)) return;
1961
- const { action: r, enctype: n, method: o } = Gt(e, t), i = t ? new FormData(e, t) : new FormData(e);
1964
+ function jn(e, t) {
1965
+ if (!Zt(e, t)) return;
1966
+ const { action: r, enctype: n, method: o } = Xt(e, t), i = t ? new FormData(e, t) : new FormData(e);
1962
1967
  if (n === "multipart/form-data")
1963
1968
  return { body: i, contentType: void 0, formData: i, method: o, url: r };
1964
1969
  if (n === "application/x-www-form-urlencoded") {
1965
1970
  const a = new URLSearchParams();
1966
- for (const [u, d] of i)
1967
- typeof d == "string" ? a.append(u, d) : a.append(u, d.name);
1971
+ for (const [l, d] of i)
1972
+ typeof d == "string" ? a.append(l, d) : a.append(l, d.name);
1968
1973
  return {
1969
1974
  body: a,
1970
1975
  contentType: "application/x-www-form-urlencoded;charset=UTF-8",
@@ -1974,8 +1979,8 @@ function Bn(e, t) {
1974
1979
  };
1975
1980
  }
1976
1981
  const s = [];
1977
- for (const [a, u] of i)
1978
- s.push(`${a}=${typeof u == "string" ? u : u.name}`);
1982
+ for (const [a, l] of i)
1983
+ s.push(`${a}=${typeof l == "string" ? l : l.name}`);
1979
1984
  return {
1980
1985
  body: `${s.join(`\r
1981
1986
  `)}\r
@@ -1986,23 +1991,23 @@ function Bn(e, t) {
1986
1991
  url: r
1987
1992
  };
1988
1993
  }
1989
- function Gt(e, t) {
1990
- if (!Hn(t)) return;
1994
+ function Xt(e, t) {
1995
+ if (!qn(t)) return;
1991
1996
  const r = t instanceof HTMLButtonElement || t instanceof HTMLInputElement ? t : void 0;
1992
1997
  return {
1993
- action: (he(r, "formaction") ?? e.action) || window.location.href,
1994
- enctype: ((he(r, "formenctype") ?? e.enctype) || "application/x-www-form-urlencoded").toLowerCase(),
1995
- method: ((he(r, "formmethod") ?? e.method) || "get").toUpperCase(),
1996
- target: he(r, "formtarget") ?? e.target
1998
+ action: (me(r, "formaction") ?? e.action) || window.location.href,
1999
+ enctype: ((me(r, "formenctype") ?? e.enctype) || "application/x-www-form-urlencoded").toLowerCase(),
2000
+ method: ((me(r, "formmethod") ?? e.method) || "get").toUpperCase(),
2001
+ target: me(r, "formtarget") ?? e.target
1997
2002
  };
1998
2003
  }
1999
- function he(e, t) {
2004
+ function me(e, t) {
2000
2005
  return e?.hasAttribute(t) ? e.getAttribute(t) ?? "" : void 0;
2001
2006
  }
2002
- function Hn(e) {
2007
+ function qn(e) {
2003
2008
  return e ? e instanceof HTMLButtonElement ? !e.disabled && e.type === "submit" : e instanceof HTMLInputElement && !e.disabled && e.type === "submit" : !0;
2004
2009
  }
2005
- function pe(e) {
2010
+ function ye(e) {
2006
2011
  queueMicrotask(() => {
2007
2012
  if (!e) {
2008
2013
  window.scrollTo?.(0, 0);
@@ -2017,13 +2022,13 @@ function pe(e) {
2017
2022
  document.getElementById(t)?.scrollIntoView?.();
2018
2023
  });
2019
2024
  }
2020
- function zn(e, t) {
2025
+ function Kn(e, t) {
2021
2026
  if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey || t.download !== void 0 && t.download !== !1 || t.target !== void 0 && t.target.toLowerCase() !== "_self")
2022
2027
  return !1;
2023
2028
  const r = new URL(t.to, window.location.href);
2024
2029
  return (r.protocol === "http:" || r.protocol === "https:") && r.origin === window.location.origin;
2025
2030
  }
2026
- function jn(e, t) {
2031
+ function Wn(e, t) {
2027
2032
  const r = t?.announce ?? "title";
2028
2033
  if (r === !1) return;
2029
2034
  let n;
@@ -2032,12 +2037,26 @@ function jn(e, t) {
2032
2037
  } catch {
2033
2038
  return;
2034
2039
  }
2035
- n && Vn(n);
2040
+ n && Jn(n);
2041
+ }
2042
+ function Jn(e) {
2043
+ pr(e);
2036
2044
  }
2037
- function Vn(e) {
2038
- lr(e);
2045
+ function At(e) {
2046
+ return e === !0 && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches && typeof document.startViewTransition == "function";
2039
2047
  }
2040
- const Yt = We({
2048
+ function Gn(e) {
2049
+ if (typeof document.startViewTransition != "function") {
2050
+ e();
2051
+ return;
2052
+ }
2053
+ try {
2054
+ document.startViewTransition(() => ur(e));
2055
+ } catch {
2056
+ e();
2057
+ }
2058
+ }
2059
+ const Qt = Ge({
2041
2060
  navigation: "document",
2042
2061
  submissionVersion: 0,
2043
2062
  push(e) {
@@ -2055,12 +2074,12 @@ const Yt = We({
2055
2074
  window.location.replace(e);
2056
2075
  }
2057
2076
  });
2058
- function Ee() {
2059
- return Je(Yt);
2077
+ function xe() {
2078
+ return Ye(Qt);
2060
2079
  }
2061
- function Go({ className: e, id: t, policy: r, ...n }) {
2062
- const o = Mr(n, r);
2063
- return /* @__PURE__ */ Et(
2080
+ function ti({ className: e, id: t, policy: r, ...n }) {
2081
+ const o = Lr(n, r);
2082
+ return /* @__PURE__ */ kt(
2064
2083
  "img",
2065
2084
  {
2066
2085
  alt: o.alt,
@@ -2077,14 +2096,14 @@ function Go({ className: e, id: t, policy: r, ...n }) {
2077
2096
  }
2078
2097
  );
2079
2098
  }
2080
- const qn = "https://js.sentry-cdn.com", Yo = {
2099
+ const Yn = "https://js.sentry-cdn.com", ri = {
2081
2100
  /**
2082
2101
  * Plausible loads one script and posts events to its own API. The snippet
2083
2102
  * carries configuration in `data-domain`, so no inline code is involved.
2084
2103
  * `endpoint` accepts a same-origin path prefix for a proxied deployment.
2085
2104
  */
2086
2105
  plausible(e) {
2087
- const t = Kn(e.domain), r = St(e.endpoint ?? "https://plausible.io");
2106
+ const t = Zn(e.domain), r = xt(e.endpoint ?? "https://plausible.io");
2088
2107
  return {
2089
2108
  consent: e.consent ?? !1,
2090
2109
  domain: t,
@@ -2095,7 +2114,7 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2095
2114
  },
2096
2115
  provider: "plausible",
2097
2116
  scripts: [
2098
- Me({
2117
+ $e({
2099
2118
  dataApi: `${r.base}/api/event`,
2100
2119
  dataDomain: t,
2101
2120
  defer: !0,
@@ -2113,8 +2132,8 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2113
2132
  * why the integration also declares a `connect-src` need.
2114
2133
  */
2115
2134
  sentry(e) {
2116
- const t = Gn(e.dsn), r = Jn(
2117
- e.loaderHost ?? qn,
2135
+ const t = eo(e.dsn), r = Qn(
2136
+ e.loaderHost ?? Yn,
2118
2137
  "Sentry loader host"
2119
2138
  );
2120
2139
  return {
@@ -2128,7 +2147,7 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2128
2147
  projectId: t.projectId,
2129
2148
  provider: "sentry",
2130
2149
  scripts: [
2131
- Me({
2150
+ $e({
2132
2151
  crossOrigin: "anonymous",
2133
2152
  needs: { connect: [t.origin] },
2134
2153
  purpose: "error-monitoring",
@@ -2147,7 +2166,7 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2147
2166
  * to, and an optional same-origin entry script that starts the SDK.
2148
2167
  */
2149
2168
  openTelemetry(e) {
2150
- const t = St(e.endpoint), r = e.script;
2169
+ const t = xt(e.endpoint), r = e.script;
2151
2170
  if (r !== void 0 && !r.startsWith("/"))
2152
2171
  throw new Error(
2153
2172
  "OpenTelemetry browser instrumentation must be a same-origin script path."
@@ -2159,7 +2178,7 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2159
2178
  needs: r ? { connect: [t.source], script: ["'self'"] } : { connect: [t.source] },
2160
2179
  provider: "opentelemetry",
2161
2180
  scripts: r ? [
2162
- Me({
2181
+ $e({
2163
2182
  needs: { connect: [t.source] },
2164
2183
  purpose: "observability",
2165
2184
  src: r,
@@ -2183,13 +2202,13 @@ const qn = "https://js.sentry-cdn.com", Yo = {
2183
2202
  return e.flatMap((t) => [...t.scripts]);
2184
2203
  }
2185
2204
  };
2186
- function Kn(e) {
2205
+ function Zn(e) {
2187
2206
  const t = e.trim();
2188
2207
  if (!t || t.includes("/") || t.includes(" "))
2189
2208
  throw new Error("Analytics domain must be a hostname without a path.");
2190
2209
  return t;
2191
2210
  }
2192
- function St(e) {
2211
+ function xt(e) {
2193
2212
  if (e.startsWith("/")) {
2194
2213
  if (e.startsWith("//"))
2195
2214
  throw new Error("Analytics endpoint must not be a scheme-relative URL.");
@@ -2198,10 +2217,10 @@ function St(e) {
2198
2217
  source: "'self'"
2199
2218
  };
2200
2219
  }
2201
- const t = Wn(e);
2220
+ const t = Xn(e);
2202
2221
  return { base: t.origin, source: t.origin };
2203
2222
  }
2204
- function Wn(e) {
2223
+ function Xn(e) {
2205
2224
  let t;
2206
2225
  try {
2207
2226
  t = new URL(e);
@@ -2212,7 +2231,7 @@ function Wn(e) {
2212
2231
  throw new Error("Analytics endpoint must use HTTPS.");
2213
2232
  return t;
2214
2233
  }
2215
- function Jn(e, t) {
2234
+ function Qn(e, t) {
2216
2235
  let r;
2217
2236
  try {
2218
2237
  r = new URL(e);
@@ -2223,7 +2242,7 @@ function Jn(e, t) {
2223
2242
  throw new Error(`${t} must use HTTPS.`);
2224
2243
  return r.origin;
2225
2244
  }
2226
- function Gn(e) {
2245
+ function eo(e) {
2227
2246
  let t;
2228
2247
  try {
2229
2248
  t = new URL(e);
@@ -2245,60 +2264,60 @@ function Gn(e) {
2245
2264
  publicKey: t.username
2246
2265
  };
2247
2266
  }
2248
- function Zo(e = {}) {
2267
+ function ni(e = {}) {
2249
2268
  return {
2250
2269
  async request(t) {
2251
- await me({ kind: "request", signal: t }, e);
2270
+ await ge({ kind: "request", signal: t }, e);
2252
2271
  },
2253
2272
  async serverStart(t = {}) {
2254
- await me({ kind: "server-start", signal: t }, e);
2273
+ await ge({ kind: "server-start", signal: t }, e);
2255
2274
  },
2256
2275
  async trace(t) {
2257
- await me({ kind: "trace", signal: t }, e);
2276
+ await ge({ kind: "trace", signal: t }, e);
2258
2277
  },
2259
2278
  async reportWebVitals(t) {
2260
- await me({ kind: "web-vital", signal: t }, e);
2279
+ await ge({ kind: "web-vital", signal: t }, e);
2261
2280
  }
2262
2281
  };
2263
2282
  }
2264
- async function me(e, t) {
2283
+ async function ge(e, t) {
2265
2284
  await t.onEvent?.(e), e.kind === "request" ? await t.request?.(e.signal) : e.kind === "server-start" ? await t.serverStart?.(e.signal) : e.kind === "trace" ? await t.trace?.(e.signal) : await t.webVitals?.(e.signal);
2266
2285
  }
2267
- const Yn = [
2286
+ const to = [
2268
2287
  "CLS",
2269
2288
  "FCP",
2270
2289
  "FID",
2271
2290
  "INP",
2272
2291
  "LCP",
2273
2292
  "TTFB"
2274
- ], Ue = [
2293
+ ], He = [
2275
2294
  "CLS",
2276
2295
  "FCP",
2277
2296
  "INP",
2278
2297
  "LCP",
2279
2298
  "TTFB"
2280
- ], Zn = new Set(Yn), Xn = /* @__PURE__ */ new Set([
2299
+ ], ro = new Set(to), no = /* @__PURE__ */ new Set([
2281
2300
  "back-forward",
2282
2301
  "back-forward-cache",
2283
2302
  "navigate",
2284
2303
  "prerender",
2285
2304
  "reload",
2286
2305
  "restore"
2287
- ]), Qn = /* @__PURE__ */ new Set([
2306
+ ]), oo = /* @__PURE__ */ new Set([
2288
2307
  "good",
2289
2308
  "needs-improvement",
2290
2309
  "poor"
2291
2310
  ]);
2292
- function eo(e) {
2293
- return typeof e == "string" && Zn.has(e);
2311
+ function io(e) {
2312
+ return typeof e == "string" && ro.has(e);
2294
2313
  }
2295
- function to(e) {
2296
- return typeof e == "string" && Xn.has(e);
2314
+ function ao(e) {
2315
+ return typeof e == "string" && no.has(e);
2297
2316
  }
2298
- function ro(e) {
2299
- return typeof e == "string" && Qn.has(e);
2317
+ function so(e) {
2318
+ return typeof e == "string" && oo.has(e);
2300
2319
  }
2301
- const no = {
2320
+ const co = {
2302
2321
  CLS: { good: 0.1, poor: 0.25 },
2303
2322
  FCP: { good: 1800, poor: 3e3 },
2304
2323
  FID: { good: 100, poor: 300 },
@@ -2306,13 +2325,13 @@ const no = {
2306
2325
  LCP: { good: 2500, poor: 4e3 },
2307
2326
  TTFB: { good: 800, poor: 1800 }
2308
2327
  };
2309
- function oo(e, t) {
2310
- const r = no[e];
2328
+ function uo(e, t) {
2329
+ const r = co[e];
2311
2330
  return t <= r.good ? "good" : t > r.poor ? "poor" : "needs-improvement";
2312
2331
  }
2313
- const Zt = 32;
2314
- function Xo(e) {
2315
- const t = so(e.endpoint), r = co(e.metrics), n = uo(e.sampleRate);
2332
+ const er = 32;
2333
+ function oi(e) {
2334
+ const t = ho(e.endpoint), r = po(e.metrics), n = mo(e.sampleRate);
2316
2335
  return {
2317
2336
  endpoint: t.url,
2318
2337
  kind: "web-vitals",
@@ -2321,45 +2340,45 @@ function Xo(e) {
2321
2340
  sampleRate: n
2322
2341
  };
2323
2342
  }
2324
- function Qo(...e) {
2343
+ function ii(...e) {
2325
2344
  const t = /* @__PURE__ */ new Set();
2326
2345
  for (const r of e)
2327
2346
  for (const n of r.needs.connect ?? [])
2328
2347
  t.add(n);
2329
2348
  return t.size === 0 ? { security: { needs: {} } } : { security: { needs: { connect: [...t] } } };
2330
2349
  }
2331
- async function ei(e, t = {}) {
2332
- const r = t.maxMetrics ?? Zt;
2350
+ async function ai(e, t = {}) {
2351
+ const r = t.maxMetrics ?? er;
2333
2352
  let n;
2334
2353
  try {
2335
2354
  n = await e.json();
2336
2355
  } catch {
2337
2356
  return { ok: !1, reason: "unreadable-body" };
2338
2357
  }
2339
- return io(n, r);
2358
+ return lo(n, r);
2340
2359
  }
2341
- function io(e, t = Zt) {
2342
- if (!Ze(e) || !Array.isArray(e.metrics))
2360
+ function lo(e, t = er) {
2361
+ if (!Qe(e) || !Array.isArray(e.metrics))
2343
2362
  return { ok: !1, reason: "invalid-payload" };
2344
2363
  if (e.metrics.length > t)
2345
2364
  return { ok: !1, reason: "too-many-metrics" };
2346
2365
  const r = [];
2347
2366
  for (const n of e.metrics) {
2348
- const o = ao(n);
2367
+ const o = fo(n);
2349
2368
  if (!o)
2350
2369
  return { ok: !1, reason: "invalid-payload" };
2351
2370
  r.push(o);
2352
2371
  }
2353
2372
  return { metrics: r, ok: !0 };
2354
2373
  }
2355
- function ao(e) {
2356
- if (!Ze(e))
2374
+ function fo(e) {
2375
+ if (!Qe(e))
2357
2376
  return;
2358
2377
  const { id: t, name: r, navigationType: n, rating: o, url: i, value: s } = e;
2359
- if (!(typeof t != "string" || t.length === 0 || t.length > 128) && !(!eo(r) || !to(n)) && ro(o) && !(typeof i != "string" || i.length === 0 || i.length > 2048) && !(typeof s != "number" || !Number.isFinite(s) || s < 0))
2378
+ if (!(typeof t != "string" || t.length === 0 || t.length > 128) && !(!io(r) || !ao(n)) && so(o) && !(typeof i != "string" || i.length === 0 || i.length > 2048) && !(typeof s != "number" || !Number.isFinite(s) || s < 0))
2360
2379
  return { id: t, name: r, navigationType: n, rating: o, url: i, value: s };
2361
2380
  }
2362
- function so(e) {
2381
+ function ho(e) {
2363
2382
  if (e.startsWith("/")) {
2364
2383
  if (e.startsWith("//"))
2365
2384
  throw new Error(
@@ -2379,14 +2398,14 @@ function so(e) {
2379
2398
  throw new Error("The web vitals endpoint must use HTTPS.");
2380
2399
  return { source: t.origin, url: t.href };
2381
2400
  }
2382
- function co(e) {
2401
+ function po(e) {
2383
2402
  if (!e)
2384
- return Ue;
2403
+ return He;
2385
2404
  const t = [];
2386
2405
  for (const r of e) {
2387
- if (!Ue.includes(r))
2406
+ if (!He.includes(r))
2388
2407
  throw new Error(
2389
- `The browser collector does not measure ${JSON.stringify(r)}. Demiurge collects ${Ue.join(", ")}.`
2408
+ `The browser collector does not measure ${JSON.stringify(r)}. Demiurge collects ${He.join(", ")}.`
2390
2409
  );
2391
2410
  t.includes(r) || t.push(r);
2392
2411
  }
@@ -2394,15 +2413,15 @@ function co(e) {
2394
2413
  throw new Error("A web vitals integration must collect one metric or more.");
2395
2414
  return t;
2396
2415
  }
2397
- function uo(e) {
2416
+ function mo(e) {
2398
2417
  if (e === void 0)
2399
2418
  return 1;
2400
2419
  if (!Number.isFinite(e) || e < 0 || e > 1)
2401
2420
  throw new Error("The web vitals sample rate must be between 0 and 1.");
2402
2421
  return e;
2403
2422
  }
2404
- const lo = 1e3, fo = 5e3, ho = 40;
2405
- function po(e, t = {}) {
2423
+ const yo = 1e3, go = 5e3, wo = 40;
2424
+ function vo(e, t = {}) {
2406
2425
  if (typeof window > "u" || typeof PerformanceObserver > "u")
2407
2426
  return () => {
2408
2427
  };
@@ -2410,8 +2429,8 @@ function po(e, t = {}) {
2410
2429
  if (e.sampleRate < 1 && r() >= e.sampleRate)
2411
2430
  return () => {
2412
2431
  };
2413
- const n = t.transport ?? mo, o = new Set(e.metrics), i = [], s = [], a = /* @__PURE__ */ new Set();
2414
- let u = yo(), d = 0, v = 0, A = 0, h = 0, p, E, g = !1;
2432
+ const n = t.transport ?? bo, o = new Set(e.metrics), i = [], s = [], a = /* @__PURE__ */ new Set();
2433
+ let l = So(), d = 0, v = 0, A = 0, h = 0, p, E, g = !1;
2415
2434
  const b = (w, $) => {
2416
2435
  if (g || a.has(w))
2417
2436
  return;
@@ -2419,68 +2438,68 @@ function po(e, t = {}) {
2419
2438
  const C = {
2420
2439
  id: `${w}-${Date.now()}-${Math.floor(r() * 1e9)}`,
2421
2440
  name: w,
2422
- navigationType: u,
2423
- rating: oo(w, $),
2441
+ navigationType: l,
2442
+ rating: uo(w, $),
2424
2443
  url: window.location.href,
2425
2444
  value: Math.round($ * 1e3) / 1e3
2426
2445
  };
2427
2446
  s.push(C), t.onReport?.(C);
2428
- }, m = () => {
2447
+ }, y = () => {
2429
2448
  if (g || (p !== void 0 && b("LCP", p), E !== void 0 && b("INP", E), o.has("CLS") && b("CLS", d), s.length === 0))
2430
2449
  return;
2431
2450
  const w = s.splice(0, s.length);
2432
2451
  n(e.endpoint, { metrics: w });
2433
2452
  }, T = () => {
2434
- document.visibilityState === "hidden" && m();
2453
+ document.visibilityState === "hidden" && y();
2435
2454
  }, H = (w) => {
2436
- w.persisted && (u = "back-forward-cache", a.clear(), d = 0, v = 0, A = 0, h = 0, p = void 0, E = void 0, o.has("FCP") && b("FCP", performance.now() - w.timeStamp));
2455
+ w.persisted && (l = "back-forward-cache", a.clear(), d = 0, v = 0, A = 0, h = 0, p = void 0, E = void 0, o.has("FCP") && b("FCP", performance.now() - w.timeStamp));
2437
2456
  };
2438
2457
  if (o.has("TTFB")) {
2439
- const w = Xt();
2458
+ const w = tr();
2440
2459
  w && w.responseStart > 0 && b("TTFB", w.responseStart);
2441
2460
  }
2442
- return o.has("FCP") && ye(i, { buffered: !0, type: "paint" }, (w) => {
2461
+ return o.has("FCP") && we(i, { buffered: !0, type: "paint" }, (w) => {
2443
2462
  for (const $ of w)
2444
2463
  $.name === "first-contentful-paint" && b("FCP", $.startTime);
2445
- }), o.has("LCP") && ye(
2464
+ }), o.has("LCP") && we(
2446
2465
  i,
2447
2466
  { buffered: !0, type: "largest-contentful-paint" },
2448
2467
  (w) => {
2449
2468
  const $ = w.at(-1);
2450
2469
  $ && (p = $.startTime);
2451
2470
  }
2452
- ), o.has("CLS") && ye(i, { buffered: !0, type: "layout-shift" }, (w) => {
2471
+ ), o.has("CLS") && we(i, { buffered: !0, type: "layout-shift" }, (w) => {
2453
2472
  for (const $ of w) {
2454
2473
  const C = $;
2455
2474
  if (C.hadRecentInput)
2456
2475
  continue;
2457
- v > 0 && C.startTime - h < lo && C.startTime - A < fo ? v += C.value : (v = C.value, A = C.startTime), h = C.startTime, d = Math.max(d, v);
2476
+ v > 0 && C.startTime - h < yo && C.startTime - A < go ? v += C.value : (v = C.value, A = C.startTime), h = C.startTime, d = Math.max(d, v);
2458
2477
  }
2459
- }), o.has("INP") && ye(
2478
+ }), o.has("INP") && we(
2460
2479
  i,
2461
2480
  {
2462
2481
  buffered: !0,
2463
- durationThreshold: ho,
2482
+ durationThreshold: wo,
2464
2483
  type: "event"
2465
2484
  },
2466
2485
  (w) => {
2467
2486
  for (const $ of w)
2468
2487
  E = Math.max(E ?? 0, $.duration);
2469
2488
  }
2470
- ), document.addEventListener("visibilitychange", T), window.addEventListener("pagehide", m), window.addEventListener("pageshow", H), () => {
2471
- m(), g = !0;
2489
+ ), document.addEventListener("visibilitychange", T), window.addEventListener("pagehide", y), window.addEventListener("pageshow", H), () => {
2490
+ y(), g = !0;
2472
2491
  for (const w of i)
2473
2492
  w.disconnect();
2474
- document.removeEventListener("visibilitychange", T), window.removeEventListener("pagehide", m), window.removeEventListener("pageshow", H);
2493
+ document.removeEventListener("visibilitychange", T), window.removeEventListener("pagehide", y), window.removeEventListener("pageshow", H);
2475
2494
  };
2476
2495
  }
2477
- function ti({ integration: e, onReport: t, transport: r }) {
2478
- return Y(
2479
- () => po(e, { onReport: t, transport: r }),
2496
+ function si({ integration: e, onReport: t, transport: r }) {
2497
+ return X(
2498
+ () => vo(e, { onReport: t, transport: r }),
2480
2499
  [e, t, r]
2481
2500
  ), null;
2482
2501
  }
2483
- function mo(e, t) {
2502
+ function bo(e, t) {
2484
2503
  const r = JSON.stringify(t);
2485
2504
  if (typeof navigator < "u" && typeof navigator.sendBeacon == "function") {
2486
2505
  const n = new Blob([r], { type: "application/json" });
@@ -2495,7 +2514,7 @@ function mo(e, t) {
2495
2514
  }).catch(() => {
2496
2515
  });
2497
2516
  }
2498
- function ye(e, t, r) {
2517
+ function we(e, t, r) {
2499
2518
  try {
2500
2519
  const n = new PerformanceObserver((o) => r(o.getEntries()));
2501
2520
  n.observe(t), e.push(n);
@@ -2503,204 +2522,204 @@ function ye(e, t, r) {
2503
2522
  return;
2504
2523
  }
2505
2524
  }
2506
- function Xt() {
2525
+ function tr() {
2507
2526
  if (!(typeof performance > "u"))
2508
2527
  return performance.getEntriesByType("navigation")[0];
2509
2528
  }
2510
- function yo() {
2511
- const e = Xt();
2529
+ function So() {
2530
+ const e = tr();
2512
2531
  return e?.type === "back_forward" ? "back-forward" : e?.type === "reload" || e?.type === "prerender" ? e.type : "navigate";
2513
2532
  }
2514
2533
  export {
2515
- Ue as COLLECTED_WEB_VITAL_NAMES,
2516
- Si as CacheNotFoundError,
2517
- rs as DEFAULT_CONTENT_TYPE,
2518
- Ei as DEFAULT_MAX_BODY_SIZE,
2519
- Ai as EnvValidationError,
2520
- oi as FRAMEWORK_TRUSTED_TYPES_POLICY,
2521
- Ko as Form,
2522
- Ar as HTTP_ERROR_STATUSES,
2523
- xi as HttpError,
2524
- Go as Image,
2525
- qo as Link,
2526
- mr as MUTATION_REQUEST_HEADER,
2527
- pr as MUTATION_REQUEST_VALUE,
2528
- xt as MUTATION_RESPONSE_MEDIA_TYPE,
2529
- Wo as MutationSubmit,
2530
- ki as MutationValidationError,
2531
- zo as RouteFocusBoundary,
2532
- Ri as RouteSerializationError,
2533
- ii as Script,
2534
- rn as SessionStoreConflictError,
2535
- mt as SessionStoreUnavailableError,
2536
- Yn as WEB_VITAL_NAMES,
2537
- no as WEB_VITAL_THRESHOLDS,
2538
- ti as WebVitals,
2539
- Yo as analytics,
2540
- Be as applicationPathname,
2541
- Ti as applyFetchMetadataVary,
2542
- Mi as applyLocalizedMetadata,
2543
- ai as assertAdapterCapabilities,
2544
- Ci as attachExceptionSource,
2545
- $i as auditScriptDependencies,
2546
- Ni as authorizeRoute,
2547
- Li as cacheNotFound,
2548
- si as checkAdapterCapabilities,
2549
- Ii as checkFetchMetadata,
2550
- wn as checkWebSocketOrigin,
2551
- po as collectWebVitals,
2552
- ns as contentTypeForExtension,
2553
- Di as createCache,
2554
- Pi as createCorsHeaders,
2555
- Oi as createCsrfCookie,
2556
- _i as createCsrfToken,
2557
- _o as createEncryptedCookieSession,
2558
- Mn as createFileRouter,
2559
- ci as createFrameworkScriptUrl,
2560
- Fi as createInvalidation,
2561
- Ui as createMemoryCache,
2562
- Bi as createMemoryCacheStore,
2563
- $o as createMemoryIdempotencyStore,
2564
- Hi as createMemoryRateLimitStore,
2565
- Ss as createMemorySessionStore,
2566
- An as createMutationAction,
2567
- zi as createRequestHandler,
2568
- Se as createSecureCookie,
2534
+ He as COLLECTED_WEB_VITAL_NAMES,
2535
+ Ei as CacheNotFoundError,
2536
+ ns as DEFAULT_CONTENT_TYPE,
2537
+ Ai as DEFAULT_MAX_BODY_SIZE,
2538
+ xi as EnvValidationError,
2539
+ li as FRAMEWORK_TRUSTED_TYPES_POLICY,
2540
+ Xo as Form,
2541
+ Tr as HTTP_ERROR_STATUSES,
2542
+ ki as HttpError,
2543
+ ti as Image,
2544
+ Zo as Link,
2545
+ vr as MUTATION_REQUEST_HEADER,
2546
+ wr as MUTATION_REQUEST_VALUE,
2547
+ Tt as MUTATION_RESPONSE_MEDIA_TYPE,
2548
+ Qo as MutationSubmit,
2549
+ Ri as MutationValidationError,
2550
+ Jo as RouteFocusBoundary,
2551
+ Ti as RouteSerializationError,
2552
+ di as Script,
2553
+ sn as SessionStoreConflictError,
2554
+ gt as SessionStoreUnavailableError,
2555
+ to as WEB_VITAL_NAMES,
2556
+ co as WEB_VITAL_THRESHOLDS,
2557
+ si as WebVitals,
2558
+ ri as analytics,
2559
+ ze as applicationPathname,
2560
+ Mi as applyFetchMetadataVary,
2561
+ Ci as applyLocalizedMetadata,
2562
+ fi as assertAdapterCapabilities,
2563
+ $i as attachExceptionSource,
2564
+ Ni as auditScriptDependencies,
2565
+ Li as authorizeRoute,
2566
+ Ii as cacheNotFound,
2567
+ hi as checkAdapterCapabilities,
2568
+ Di as checkFetchMetadata,
2569
+ En as checkWebSocketOrigin,
2570
+ vo as collectWebVitals,
2571
+ os as contentTypeForExtension,
2572
+ Pi as createCache,
2573
+ Oi as createCorsHeaders,
2574
+ _i as createCsrfCookie,
2575
+ Fi as createCsrfToken,
2576
+ Vo as createEncryptedCookieSession,
2577
+ Ln as createFileRouter,
2578
+ pi as createFrameworkScriptUrl,
2579
+ Ui as createInvalidation,
2580
+ Bi as createMemoryCache,
2581
+ Hi as createMemoryCacheStore,
2582
+ Oo as createMemoryIdempotencyStore,
2583
+ zi as createMemoryRateLimitStore,
2584
+ Ms as createMemorySessionStore,
2585
+ Tn as createMutationAction,
2586
+ Vi as createRequestHandler,
2587
+ Ae as createSecureCookie,
2569
2588
  ji as createSecurityAudit,
2570
- Vi as createSecurityHeaders,
2571
- Uo as createSecurityReportHandler,
2572
- Fo as createSessionManager,
2573
- Oo as createSignedCookieSession,
2574
- qi as cspHash,
2575
- Ki as cspNonce,
2576
- as as defaultFontPath,
2577
- ui as defineAdapter,
2578
- Wi as defineAuthorization,
2579
- Ji as defineEnvSchema,
2580
- ss as defineFonts,
2581
- cs as defineImages,
2582
- Zo as defineInstrumentation,
2583
- li as defineLinks,
2584
- Gi as defineLocales,
2585
- Yi as defineMetadata,
2586
- Io as defineMiddleware,
2587
- To as defineOgImage,
2588
- Ro as defineRobots,
2589
- Zi as defineRoutePolicy,
2590
- di as defineScripts,
2591
- Xi as defineSecurityPolicy,
2592
- xo as defineSitemap,
2593
- Qi as defineTags,
2594
- Xo as defineWebVitals,
2595
- ea as deserializeEnvSchema,
2596
- ta as enforceAllowedMethods,
2597
- ra as enforceCsrfProtection,
2598
- na as enforceFetchMetadataPolicy,
2599
- oa as enforceRateLimit,
2600
- ia as enforceRequestSecurity,
2601
- Ho as enforceWebSocketOrigin,
2602
- aa as env,
2603
- us as font,
2604
- ls as fontAssetFileName,
2605
- ds as fontAssetUrl,
2606
- fs as fontLinks,
2607
- hs as fontMediaType,
2608
- ps as fontPreloadLinks,
2609
- ms as fontSources,
2610
- ys as fontStylesheetUrl,
2611
- sa as getBodySizeException,
2612
- ca as getCspException,
2613
- ua as getCsrfException,
2614
- fi as getRequestClientAddress,
2615
- hi as getScriptWorker,
2616
- la as handleRequestWithManifest,
2617
- Xe as href,
2618
- da as html,
2619
- xr as httpError,
2620
- Vo as hydrateFileRouter,
2621
- gs as isAllowedImageSource,
2622
- fa as isCacheNotFoundError,
2623
- os as isContentHashedFileName,
2624
- Rr as isHttpError,
2625
- ha as isSecurityException,
2626
- pa as issueCsrfToken,
2627
- ma as json,
2628
- ya as jsonl,
2629
- ga as link,
2630
- wa as localeDirection,
2631
- Qe as localizeHref,
2632
- va as mergeRouteAccess,
2633
- ba as mergeRoutePolicies,
2634
- Sa as mergeRouteSecurityPolicies,
2635
- Ea as mergeSecurityPolicies,
2636
- Aa as meta,
2637
- pi as modulePreload,
2638
- xa as mutation,
2639
- ka as mutationInput,
2640
- Ra as notFound,
2641
- Lo as page,
2642
- Ye as parseBodySize,
2643
- ct as parseCacheDuration,
2644
- Ge as parseCookieHeader,
2645
- ws as parseImageOptimizerRequest,
2646
- Ta as parseRateLimitWindow,
2647
- io as parseWebVitalsBeacon,
2648
- Ma as permitsRequest,
2649
- Mr as planImageTransform,
2650
- mi as preconnect,
2651
- yi as preload,
2652
- Ca as query,
2653
- $a as readEnv,
2654
- Po as readSecureCookie,
2655
- ei as readWebVitalsBeacon,
2656
- Na as redirect,
2657
- vs as renderFontFaceCss,
2658
- Co as renderOgImageResponse,
2659
- $r as renderOgImageSvg,
2660
- gi as renderPageResponse,
2661
- Mo as renderRobots,
2662
- ko as renderSitemap,
2663
- La as resolveCsp,
2664
- Ia as resolveCsrf,
2665
- wi as resolveLinks,
2666
- gr as resolveLocale,
2667
- Da as resolveMaxBodySize,
2668
- Pa as resolveMetadata,
2669
- Oa as resolveRouteAccess,
2670
- vi as resolveScripts,
2671
- _a as response,
2672
- No as runIdempotentMutation,
2673
- Me as script,
2674
- ce as secureCookieName,
2675
- Fa as security,
2676
- mo as sendWebVitalsBeacon,
2677
- dr as serializeCacheKey,
2678
- Ua as serializeCacheNamespace,
2679
- Ba as serializeCacheTag,
2680
- Ha as serializeEnvSchema,
2681
- Es as serializeSessionNamespace,
2682
- za as serverTiming,
2589
+ qi as createSecurityHeaders,
2590
+ qo as createSecurityReportHandler,
2591
+ jo as createSessionManager,
2592
+ zo as createSignedCookieSession,
2593
+ Ki as cspHash,
2594
+ Wi as cspNonce,
2595
+ hs as defaultFontPath,
2596
+ mi as defineAdapter,
2597
+ Ji as defineAuthorization,
2598
+ Gi as defineEnvSchema,
2599
+ ps as defineFonts,
2600
+ ms as defineImages,
2601
+ ni as defineInstrumentation,
2602
+ ss as defineLinks,
2603
+ Yi as defineLocales,
2604
+ Zi as defineMetadata,
2605
+ Uo as defineMiddleware,
2606
+ Io as defineOgImage,
2607
+ Lo as defineRobots,
2608
+ Xi as defineRoutePolicy,
2609
+ yi as defineScripts,
2610
+ Qi as defineSecurityPolicy,
2611
+ $o as defineSitemap,
2612
+ ea as defineTags,
2613
+ oi as defineWebVitals,
2614
+ ta as deserializeEnvSchema,
2615
+ ra as enforceAllowedMethods,
2616
+ na as enforceCsrfProtection,
2617
+ oa as enforceFetchMetadataPolicy,
2618
+ ia as enforceRateLimit,
2619
+ aa as enforceRequestSecurity,
2620
+ Wo as enforceWebSocketOrigin,
2621
+ sa as env,
2622
+ ys as font,
2623
+ gs as fontAssetFileName,
2624
+ ws as fontAssetUrl,
2625
+ vs as fontLinks,
2626
+ bs as fontMediaType,
2627
+ Ss as fontPreloadLinks,
2628
+ Es as fontSources,
2629
+ As as fontStylesheetUrl,
2630
+ ca as getBodySizeException,
2631
+ ua as getCspException,
2632
+ la as getCsrfException,
2633
+ gi as getRequestClientAddress,
2634
+ wi as getScriptWorker,
2635
+ da as handleRequestWithManifest,
2636
+ et as href,
2637
+ fa as html,
2638
+ Mr as httpError,
2639
+ Yo as hydrateFileRouter,
2640
+ xs as isAllowedImageSource,
2641
+ ha as isCacheNotFoundError,
2642
+ is as isContentHashedFileName,
2643
+ $r as isHttpError,
2644
+ pa as isSecurityException,
2645
+ ma as issueCsrfToken,
2646
+ ya as json,
2647
+ ga as jsonl,
2648
+ wa as link,
2649
+ va as localeDirection,
2650
+ tt as localizeHref,
2651
+ ba as mergeRouteAccess,
2652
+ Sa as mergeRoutePolicies,
2653
+ Ea as mergeRouteSecurityPolicies,
2654
+ Aa as mergeSecurityPolicies,
2655
+ xa as meta,
2656
+ cs as modulePreload,
2657
+ ka as mutation,
2658
+ Ra as mutationInput,
2659
+ Ta as notFound,
2660
+ Fo as page,
2661
+ Xe as parseBodySize,
2662
+ lt as parseCacheDuration,
2663
+ Ze as parseCookieHeader,
2664
+ ks as parseImageOptimizerRequest,
2665
+ Ma as parseRateLimitWindow,
2666
+ lo as parseWebVitalsBeacon,
2667
+ Ca as permitsRequest,
2668
+ Lr as planImageTransform,
2669
+ us as preconnect,
2670
+ ls as preload,
2671
+ $a as query,
2672
+ Na as readEnv,
2673
+ Ho as readSecureCookie,
2674
+ ai as readWebVitalsBeacon,
2675
+ La as redirect,
2676
+ Rs as renderFontFaceCss,
2677
+ Po as renderOgImageResponse,
2678
+ Dr as renderOgImageSvg,
2679
+ vi as renderPageResponse,
2680
+ Do as renderRobots,
2681
+ No as renderSitemap,
2682
+ Ia as resolveCsp,
2683
+ Da as resolveCsrf,
2684
+ ds as resolveLinks,
2685
+ Sr as resolveLocale,
2686
+ Pa as resolveMaxBodySize,
2687
+ Oa as resolveMetadata,
2688
+ _a as resolveRouteAccess,
2689
+ bi as resolveScripts,
2690
+ Fa as response,
2691
+ _o as runIdempotentMutation,
2692
+ $e as script,
2693
+ le as secureCookieName,
2694
+ Ua as security,
2695
+ bo as sendWebVitalsBeacon,
2696
+ mr as serializeCacheKey,
2697
+ Ba as serializeCacheNamespace,
2698
+ Ha as serializeCacheTag,
2699
+ za as serializeEnvSchema,
2700
+ Cs as serializeSessionNamespace,
2701
+ Va as serverTiming,
2683
2702
  ja as sse,
2684
- st as startDeferredScripts,
2685
- Va as stream,
2686
- qa as structuredData,
2687
- Ka as tag,
2688
- Wa as text,
2689
- Ja as toResponse,
2690
- Ga as unstable_resetEnvironment,
2691
- Ya as unstable_startEnvironment,
2692
- Jo as useFormNavigation,
2693
- jo as useMutationAction,
2694
- In as useNavigation,
2695
- Sn as useRouteFocusBoundary,
2696
- Za as validateCorsPolicy,
2697
- Xa as validateEnv,
2698
- Qa as validateRateLimitPolicy,
2699
- es as validateRouteModules,
2700
- Vr as validateSecureCookie,
2701
- Bo as validateUploads,
2702
- oo as webVitalRating,
2703
- Qo as webVitalsPolicy,
2704
- Do as webhook
2703
+ ut as startDeferredScripts,
2704
+ qa as stream,
2705
+ Ka as structuredData,
2706
+ Wa as tag,
2707
+ Ja as text,
2708
+ Ga as toResponse,
2709
+ Ya as unstable_resetEnvironment,
2710
+ Za as unstable_startEnvironment,
2711
+ ei as useFormNavigation,
2712
+ Go as useMutationAction,
2713
+ _n as useNavigation,
2714
+ kn as useRouteFocusBoundary,
2715
+ Xa as validateCorsPolicy,
2716
+ Qa as validateEnv,
2717
+ es as validateRateLimitPolicy,
2718
+ ts as validateRouteModules,
2719
+ Jr as validateSecureCookie,
2720
+ Ko as validateUploads,
2721
+ uo as webVitalRating,
2722
+ ii as webVitalsPolicy,
2723
+ Bo as webhook
2705
2724
  };
2706
2725
  //# sourceMappingURL=index.js.map