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

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