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

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