@demiurgejs/core 0.2.0-beta.3 → 0.2.0-beta.4

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