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

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 (107) hide show
  1. package/README.md +2 -0
  2. package/dist/adapter/testing.d.ts +33 -0
  3. package/dist/adapter/testing.d.ts.map +1 -0
  4. package/dist/adapter/testing.js +251 -0
  5. package/dist/adapter/testing.js.map +1 -0
  6. package/dist/browser/file-router.d.ts.map +1 -1
  7. package/dist/chunks/document-shell-D1xo6cEA.js +35 -0
  8. package/dist/chunks/document-shell-D1xo6cEA.js.map +1 -0
  9. package/dist/chunks/image-codec-BGTx_t5K.js +141 -0
  10. package/dist/chunks/image-codec-BGTx_t5K.js.map +1 -0
  11. package/dist/chunks/images-B9MqcjSA.js +339 -0
  12. package/dist/chunks/images-B9MqcjSA.js.map +1 -0
  13. package/dist/chunks/request-metadata-D5NrT8ks.js +642 -0
  14. package/dist/chunks/request-metadata-D5NrT8ks.js.map +1 -0
  15. package/dist/chunks/streaming-BQ1bykDo.js +469 -0
  16. package/dist/chunks/streaming-BQ1bykDo.js.map +1 -0
  17. package/dist/chunks/{testing-DBjVCN5v.js → testing-B_iMFYz_.js} +768 -761
  18. package/dist/chunks/testing-B_iMFYz_.js.map +1 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +63 -54
  21. package/dist/cli.js.map +1 -1
  22. package/dist/document/deferred-scripts.d.ts +11 -0
  23. package/dist/document/deferred-scripts.d.ts.map +1 -0
  24. package/dist/document/index.d.ts +3 -1
  25. package/dist/document/index.d.ts.map +1 -1
  26. package/dist/document/render.d.ts.map +1 -1
  27. package/dist/document/scripts.d.ts +12 -1
  28. package/dist/document/scripts.d.ts.map +1 -1
  29. package/dist/edge/assets.d.ts +14 -0
  30. package/dist/edge/assets.d.ts.map +1 -0
  31. package/dist/edge/index.d.ts +19 -0
  32. package/dist/edge/index.d.ts.map +1 -0
  33. package/dist/edge/index.js +286 -0
  34. package/dist/edge/index.js.map +1 -0
  35. package/dist/edge/stores.d.ts +8 -0
  36. package/dist/edge/stores.d.ts.map +1 -0
  37. package/dist/edge/streaming.d.ts +7 -0
  38. package/dist/edge/streaming.d.ts.map +1 -0
  39. package/dist/index.d.ts +5 -5
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +423 -420
  42. package/dist/index.js.map +1 -1
  43. package/dist/internal/testing.js +9 -9
  44. package/dist/kv/index.d.ts +3 -0
  45. package/dist/kv/index.d.ts.map +1 -0
  46. package/dist/kv/index.js +103 -0
  47. package/dist/kv/index.js.map +1 -0
  48. package/dist/kv/store.d.ts +28 -0
  49. package/dist/kv/store.d.ts.map +1 -0
  50. package/dist/node/font.d.ts +5 -0
  51. package/dist/node/font.d.ts.map +1 -0
  52. package/dist/node/image.d.ts +15 -0
  53. package/dist/node/image.d.ts.map +1 -0
  54. package/dist/node/index.d.ts +4 -0
  55. package/dist/node/index.d.ts.map +1 -1
  56. package/dist/node/index.js +25 -23
  57. package/dist/node/index.js.map +1 -1
  58. package/dist/node/streaming.d.ts.map +1 -1
  59. package/dist/platform/analytics.d.ts +58 -5
  60. package/dist/platform/analytics.d.ts.map +1 -1
  61. package/dist/platform/font-assets.d.ts +19 -0
  62. package/dist/platform/font-assets.d.ts.map +1 -0
  63. package/dist/platform/fonts.d.ts +14 -4
  64. package/dist/platform/fonts.d.ts.map +1 -1
  65. package/dist/platform/image-codec.d.ts +15 -0
  66. package/dist/platform/image-codec.d.ts.map +1 -0
  67. package/dist/platform/image-url.d.ts +17 -0
  68. package/dist/platform/image-url.d.ts.map +1 -0
  69. package/dist/platform/image.d.ts +8 -0
  70. package/dist/platform/image.d.ts.map +1 -0
  71. package/dist/platform/images.d.ts +15 -0
  72. package/dist/platform/images.d.ts.map +1 -1
  73. package/dist/platform/index.d.ts +8 -5
  74. package/dist/platform/index.d.ts.map +1 -1
  75. package/dist/redis/index.d.ts +3 -0
  76. package/dist/redis/index.d.ts.map +1 -0
  77. package/dist/redis/index.js +171 -0
  78. package/dist/redis/index.js.map +1 -0
  79. package/dist/redis/store.d.ts +8 -0
  80. package/dist/redis/store.d.ts.map +1 -0
  81. package/dist/security/index.d.ts +1 -1
  82. package/dist/security/index.d.ts.map +1 -1
  83. package/dist/security/policy.d.ts +2 -27
  84. package/dist/security/policy.d.ts.map +1 -1
  85. package/dist/security/types.d.ts +10 -3
  86. package/dist/security/types.d.ts.map +1 -1
  87. package/dist/security/verification.d.ts.map +1 -1
  88. package/dist/server/document-shell.d.ts +12 -0
  89. package/dist/server/document-shell.d.ts.map +1 -0
  90. package/dist/static/images.d.ts +13 -0
  91. package/dist/static/images.d.ts.map +1 -0
  92. package/dist/static/index.d.ts +8 -0
  93. package/dist/static/index.d.ts.map +1 -1
  94. package/dist/static/index.js +421 -313
  95. package/dist/static/index.js.map +1 -1
  96. package/dist/static/vercel.d.ts +3 -0
  97. package/dist/static/vercel.d.ts.map +1 -1
  98. package/dist/vite/index.js +412 -387
  99. package/dist/vite/index.js.map +1 -1
  100. package/dist/vite/plugin.d.ts +7 -0
  101. package/dist/vite/plugin.d.ts.map +1 -1
  102. package/package.json +34 -3
  103. package/dist/chunks/request-metadata-DwEO1EAS.js +0 -477
  104. package/dist/chunks/request-metadata-DwEO1EAS.js.map +0 -1
  105. package/dist/chunks/streaming-Ci6vf3BB.js +0 -353
  106. package/dist/chunks/streaming-Ci6vf3BB.js.map +0 -1
  107. package/dist/chunks/testing-DBjVCN5v.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,25 +1,27 @@
1
- import { jsx as H } from "react/jsx-runtime";
2
- import { createContext as _, useState as I, useRef as T, useEffect as C, useMemo as V, createElement as f, useContext as W, Component as G } from "react";
3
- import { g as K, H as Y, h as Z, i as Q } from "./chunks/request-metadata-DwEO1EAS.js";
4
- import { j as Qt, k as Xt, l as Jt, d as er, m as tr, r as rr, n as nr } from "./chunks/request-metadata-DwEO1EAS.js";
5
- import { p as z, k as X, l as J, t as ee, n as te, R as re, o as x, q as ne, j as O, u as ae, w as L, x as ie, N as D, y as oe, z as se, A as ce, B as ue, H as le, C as fe, D as de, E as me } from "./chunks/testing-DBjVCN5v.js";
6
- import { F as ir, G as or, I as sr, J as cr, K as ur, L as lr, M as fr, O as dr, P as mr, a as hr, Q as gr, S as pr, d as wr, b as yr, T as vr, U as br, V as Er, W as Sr, X as Rr, Y as Ar, Z as $r, _ as xr, $ as kr, a0 as Ir, h as Tr, a1 as Cr, a2 as zr, a3 as Dr, a4 as Nr, a5 as Or, a6 as Lr, a7 as Mr, m as Pr, a8 as Ur, a9 as Fr, aa as jr, ab as Br, ac as qr, ad as Hr, ae as _r, af as Vr, ag as Wr, ah as Gr, ai as Kr, s as Yr, aj as Zr, ak as Qr, al as Xr, am as Jr, an as en, ao as tn, ap as rn, aq as nn, e as an, f as on, v as sn } from "./chunks/testing-DBjVCN5v.js";
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";
7
9
  import "react-dom/server";
8
- const he = "24h", ge = 1e4;
9
- function vt(e = {}) {
10
- const t = e.now ?? Date.now, r = e.defaultTtl ?? he, n = e.maximumEntries ?? ge;
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;
11
13
  if (!Number.isSafeInteger(n) || n <= 0)
12
14
  throw new Error(
13
15
  "Demiurge idempotency maximumEntries must be a positive integer."
14
16
  );
15
- const a = z(r);
17
+ const a = C(r);
16
18
  if (!Number.isFinite(a))
17
19
  throw new Error("Demiurge idempotency defaultTtl must be finite.");
18
20
  const i = /* @__PURE__ */ new Map();
19
21
  return {
20
22
  async run(s) {
21
23
  const o = X(s.key), u = t();
22
- pe(i, u);
24
+ ge(i, u);
23
25
  const d = i.get(o);
24
26
  if (d && (d.pending || d.expiresAt > u))
25
27
  return {
@@ -31,15 +33,15 @@ function vt(e = {}) {
31
33
  throw new Error(
32
34
  "Demiurge idempotency store is at capacity with in-flight mutations."
33
35
  );
34
- const p = Promise.resolve().then(s.fn), c = {
36
+ const g = Promise.resolve().then(s.fn), c = {
35
37
  expiresAt: Number.POSITIVE_INFINITY,
36
38
  pending: !0,
37
- value: p
39
+ value: g
38
40
  };
39
41
  i.set(o, c);
40
42
  try {
41
- const l = await p;
42
- return c.pending = !1, c.expiresAt = t() + z(s.ttl ?? r), {
43
+ const l = await g;
44
+ return c.pending = !1, c.expiresAt = t() + C(s.ttl ?? r), {
43
45
  key: o,
44
46
  replayed: !1,
45
47
  value: l
@@ -50,7 +52,7 @@ function vt(e = {}) {
50
52
  }
51
53
  };
52
54
  }
53
- function pe(e, t) {
55
+ function ge(e, t) {
54
56
  for (const [r, n] of e)
55
57
  !n.pending && n.expiresAt <= t && e.delete(r);
56
58
  }
@@ -61,15 +63,15 @@ function we(e) {
61
63
  return;
62
64
  }
63
65
  }
64
- function bt(e, t) {
66
+ function ht(e, t) {
65
67
  return e.run(t);
66
68
  }
67
- function Et(e) {
69
+ function pt(e) {
68
70
  return {
69
71
  entries: e
70
72
  };
71
73
  }
72
- function St(e) {
74
+ function gt(e) {
73
75
  return [
74
76
  '<?xml version="1.0" encoding="UTF-8"?>',
75
77
  `<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"' : ""}>`,
@@ -79,13 +81,13 @@ function St(e) {
79
81
  ].join(`
80
82
  `);
81
83
  }
82
- function Rt(e) {
84
+ function wt(e) {
83
85
  return e;
84
86
  }
85
- function At(e) {
87
+ function yt(e) {
86
88
  return e;
87
89
  }
88
- function $t(e) {
90
+ function vt(e) {
89
91
  const t = [];
90
92
  for (const r of e.rules ?? []) {
91
93
  for (const n of b(r.userAgent))
@@ -104,18 +106,18 @@ function $t(e) {
104
106
  `;
105
107
  }
106
108
  function ye(e) {
107
- const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", a = e.foreground ?? "#ffffff", i = A(e.title, 120), s = e.subtitle ? A(e.subtitle, 160) : void 0, o = e.brand ? A(e.brand, 80) : void 0;
108
- return Se(t, r), [
109
- `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${g(i)}">`,
110
- ` <rect width="100%" height="100%" fill="${g(n)}" />`,
111
- o ? ` <text x="72" y="96" fill="${g(a)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="32" font-weight="700">${w(o)}</text>` : null,
112
- ` <text x="72" y="${s ? 300 : 340}" fill="${g(a)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="76" font-weight="800">${w(i)}</text>`,
113
- s ? ` <text x="72" y="392" fill="${g(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,
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,
114
116
  "</svg>"
115
117
  ].filter((u) => !!u).join(`
116
118
  `);
117
119
  }
118
- function xt(e) {
120
+ function bt(e) {
119
121
  return new Response(ye(e), {
120
122
  headers: {
121
123
  "cache-control": "public, max-age=31536000, immutable",
@@ -129,9 +131,9 @@ function ve(e) {
129
131
  ` <loc>${w(e.url)}</loc>`,
130
132
  e.lastModified ? ` <lastmod>${w(be(e.lastModified))}</lastmod>` : null,
131
133
  e.changeFrequency ? ` <changefreq>${e.changeFrequency}</changefreq>` : null,
132
- e.priority !== void 0 ? ` <priority>${Ee(e.priority)}</priority>` : null,
134
+ e.priority !== void 0 ? ` <priority>${Se(e.priority)}</priority>` : null,
133
135
  ...(e.alternates ?? []).map(
134
- (t) => ` <xhtml:link rel="alternate" hreflang="${g(t.hrefLang)}" href="${g(t.href)}" />`
136
+ (t) => ` <xhtml:link rel="alternate" hreflang="${p(t.hrefLang)}" href="${p(t.href)}" />`
135
137
  ),
136
138
  " </url>"
137
139
  ].filter((t) => !!t).join(`
@@ -140,7 +142,7 @@ function ve(e) {
140
142
  function be(e) {
141
143
  return e instanceof Date ? e.toISOString() : e;
142
144
  }
143
- function Ee(e) {
145
+ function Se(e) {
144
146
  if (e < 0 || e > 1)
145
147
  throw new Error("Sitemap entry priority must be between 0 and 1.");
146
148
  return String(e);
@@ -151,19 +153,19 @@ function b(e) {
151
153
  function w(e) {
152
154
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
153
155
  }
154
- function g(e) {
156
+ function p(e) {
155
157
  return w(e).replaceAll('"', "&quot;").replaceAll("'", "&apos;");
156
158
  }
157
- function A(e, t) {
159
+ function x(e, t) {
158
160
  return e.length > t ? `${e.slice(0, t - 3)}...` : e;
159
161
  }
160
- function Se(e, t) {
162
+ function Ee(e, t) {
161
163
  if (!Number.isSafeInteger(e) || e <= 0)
162
164
  throw new Error("OG image width must be a positive integer.");
163
165
  if (!Number.isSafeInteger(t) || t <= 0)
164
166
  throw new Error("OG image height must be a positive integer.");
165
167
  }
166
- function kt(e) {
168
+ function St(e) {
167
169
  return J(
168
170
  async (t) => {
169
171
  const r = e.input ? await e.input(t) : void 0, n = {
@@ -189,7 +191,7 @@ function kt(e) {
189
191
  }
190
192
  );
191
193
  }
192
- const It = {
194
+ const Et = {
193
195
  async formData({ request: e }) {
194
196
  return await e.formData();
195
197
  },
@@ -201,9 +203,9 @@ const It = {
201
203
  }
202
204
  };
203
205
  async function Re(e, t) {
204
- return e instanceof Response ? e : await ee(e, t);
206
+ return e instanceof Response ? e : await Q(e, t);
205
207
  }
206
- function Tt(e) {
208
+ function Rt(e) {
207
209
  return typeof e == "function" ? {
208
210
  kind: "page",
209
211
  render: { mode: "ssr" },
@@ -216,10 +218,10 @@ function Tt(e) {
216
218
  view: e.view
217
219
  };
218
220
  }
219
- function Ct(e) {
221
+ function At(e) {
220
222
  return e;
221
223
  }
222
- const zt = {
224
+ const xt = {
223
225
  hmac(e) {
224
226
  return {
225
227
  kind: "response",
@@ -244,11 +246,11 @@ const zt = {
244
246
  }
245
247
  };
246
248
  async function Ae(e, t, r) {
247
- const n = r.algorithm ?? "SHA-256", a = r.encoding ?? "hex", i = $e(
249
+ const n = r.algorithm ?? "SHA-256", a = r.encoding ?? "hex", i = xe(
248
250
  t,
249
251
  n,
250
252
  r.prefix
251
- ), s = xe(i, a);
253
+ ), s = $e(i, a);
252
254
  if (!s)
253
255
  return !1;
254
256
  const o = await globalThis.crypto.subtle.importKey(
@@ -268,11 +270,11 @@ async function Ae(e, t, r) {
268
270
  Uint8Array.from(e).buffer
269
271
  );
270
272
  }
271
- function $e(e, t, r) {
273
+ function xe(e, t, r) {
272
274
  const n = e.trim(), a = r === void 0 ? `${t.toLowerCase().replace("-", "")}=` : r;
273
275
  return a !== !1 && n.startsWith(a) ? n.slice(a.length).trim() : n;
274
276
  }
275
- function xe(e, t) {
277
+ function $e(e, t) {
276
278
  if (t === "hex")
277
279
  return /^(?:[0-9a-f]{2})+$/i.test(e) ? Uint8Array.from(
278
280
  e.match(/.{2}/g) ?? [],
@@ -292,13 +294,13 @@ function xe(e, t) {
292
294
  class ke extends Error {
293
295
  issues;
294
296
  constructor(t) {
295
- super(Oe(t)), this.name = "EnvValidationError", this.issues = t;
297
+ super(Le(t)), this.name = "EnvValidationError", this.issues = t;
296
298
  }
297
299
  }
298
- function Dt(e) {
300
+ function $t(e) {
299
301
  return e;
300
302
  }
301
- function Nt(e, t) {
303
+ function kt(e, t) {
302
304
  const r = [], n = {};
303
305
  for (const a of Object.keys(e)) {
304
306
  const i = e[a], s = t[String(a)];
@@ -328,7 +330,7 @@ function Nt(e, t) {
328
330
  throw new ke(r);
329
331
  return n;
330
332
  }
331
- function Ie(e = {}) {
333
+ function Te(e = {}) {
332
334
  return y(e, !1, (t, r) => {
333
335
  if (r === "true" || r === "1")
334
336
  return !0;
@@ -337,7 +339,7 @@ function Ie(e = {}) {
337
339
  throw new Error(`Environment variable ${t} must be true, false, 1, or 0.`);
338
340
  });
339
341
  }
340
- function Te(e, t = {}) {
342
+ function Ie(e, t = {}) {
341
343
  return y(t, !1, (r, n) => {
342
344
  if (e.includes(n))
343
345
  return n;
@@ -346,7 +348,7 @@ function Te(e, t = {}) {
346
348
  );
347
349
  });
348
350
  }
349
- function Ce(e = {}) {
351
+ function De(e = {}) {
350
352
  return y(e, !1, (t, r) => {
351
353
  if (!/^-?\d+$/.test(r))
352
354
  throw new Error(`Environment variable ${t} must be an integer.`);
@@ -364,21 +366,21 @@ function Ce(e = {}) {
364
366
  return n;
365
367
  });
366
368
  }
367
- function ze(e = {}) {
369
+ function Ne(e = {}) {
368
370
  return y(
369
371
  e,
370
372
  !0,
371
- (t, r) => M(t, r, e)
373
+ (t, r) => U(t, r, e)
372
374
  );
373
375
  }
374
- function De(e = {}) {
376
+ function Ce(e = {}) {
375
377
  return y(
376
378
  e,
377
379
  !1,
378
- (t, r) => M(t, r, e)
380
+ (t, r) => U(t, r, e)
379
381
  );
380
382
  }
381
- function Ne(e = {}) {
383
+ function Oe(e = {}) {
382
384
  return y(e, !1, (t, r) => {
383
385
  let n;
384
386
  try {
@@ -393,13 +395,13 @@ function Ne(e = {}) {
393
395
  return n;
394
396
  });
395
397
  }
396
- const Ot = {
397
- boolean: Ie,
398
- enum: Te,
399
- integer: Ce,
400
- secret: ze,
401
- string: De,
402
- url: Ne
398
+ const Tt = {
399
+ boolean: Te,
400
+ enum: Ie,
401
+ integer: De,
402
+ secret: Ne,
403
+ string: Ce,
404
+ url: Oe
403
405
  };
404
406
  function y(e, t, r) {
405
407
  return {
@@ -408,17 +410,17 @@ function y(e, t, r) {
408
410
  sensitive: t
409
411
  };
410
412
  }
411
- function M(e, t, r) {
413
+ function U(e, t, r) {
412
414
  if (r.minLength !== void 0 && t.length < r.minLength)
413
415
  throw new Error(
414
416
  `Environment variable ${e} must be at least ${r.minLength} characters.`
415
417
  );
416
418
  return t;
417
419
  }
418
- function Oe(e) {
420
+ function Le(e) {
419
421
  return e.length === 1 ? e[0].message : `Environment validation failed with ${e.length} issues.`;
420
422
  }
421
- function Lt(e = {}) {
423
+ function It(e = {}) {
422
424
  return async function(r) {
423
425
  if (r.method.toUpperCase() !== "POST")
424
426
  return new Response(null, {
@@ -433,12 +435,12 @@ function Lt(e = {}) {
433
435
  const a = Pe(e, r);
434
436
  if (a)
435
437
  return a;
436
- e.maxBodySize !== void 0 && (r = te({ maxBodySize: e.maxBodySize }, r));
438
+ e.maxBodySize !== void 0 && (r = ee({ maxBodySize: e.maxBodySize }, r));
437
439
  let i;
438
440
  try {
439
441
  i = await r.json();
440
442
  } catch (o) {
441
- return o instanceof re ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
443
+ return o instanceof te ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
442
444
  status: 400
443
445
  });
444
446
  }
@@ -453,7 +455,7 @@ function Lt(e = {}) {
453
455
  });
454
456
  };
455
457
  }
456
- const Le = /* @__PURE__ */ new Set([
458
+ const ze = /* @__PURE__ */ new Set([
457
459
  "application/csp-report",
458
460
  "application/reports+json"
459
461
  ]);
@@ -462,7 +464,7 @@ function Me(e) {
462
464
  if (!t)
463
465
  return null;
464
466
  const r = t.split(";", 1)[0]?.trim().toLowerCase();
465
- return r && Le.has(r) ? null : new Response("Unsupported security report Content-Type.", {
467
+ return r && ze.has(r) ? null : new Response("Unsupported security report Content-Type.", {
466
468
  status: 415
467
469
  });
468
470
  }
@@ -477,32 +479,32 @@ function Pe(e, t) {
477
479
  status: 400
478
480
  });
479
481
  const n = Number(r);
480
- return Number.isSafeInteger(n) ? n > x(e.maxBodySize) ? new Response("Security report body too large.", {
482
+ return Number.isSafeInteger(n) ? n > $(e.maxBodySize) ? new Response("Security report body too large.", {
481
483
  status: 413
482
484
  }) : null : new Response("Invalid Content-Length.", {
483
485
  status: 400
484
486
  });
485
487
  }
486
488
  function Ue(e) {
487
- return Array.isArray(e) ? e : Fe(e) && "csp-report" in e ? [e["csp-report"]] : [e];
489
+ return Array.isArray(e) ? e : je(e) && "csp-report" in e ? [e["csp-report"]] : [e];
488
490
  }
489
- function Fe(e) {
491
+ function je(e) {
490
492
  return typeof e == "object" && e !== null;
491
493
  }
492
- function Mt(e, t) {
494
+ function Dt(e, t) {
493
495
  const r = {}, n = [];
494
496
  let a = 0;
495
497
  for (const [i, s] of Object.entries(t.files)) {
496
- const o = e.getAll(i).filter(qe);
498
+ const o = e.getAll(i).filter(Be);
497
499
  r[i] = o, s.required && o.length === 0 && n.push({
498
500
  code: "file-missing",
499
501
  field: i,
500
502
  message: `Upload field ${i} requires at least one file.`
501
503
  });
502
504
  for (const u of o)
503
- a += u.size, je(i, u, s, n);
505
+ a += u.size, Fe(i, u, s, n);
504
506
  }
505
- return t.maxTotalSize !== void 0 && a > x(t.maxTotalSize) && n.push({
507
+ return t.maxTotalSize !== void 0 && a > $(t.maxTotalSize) && n.push({
506
508
  code: "total-upload-too-large",
507
509
  field: "*",
508
510
  message: `Uploaded files exceed the maximum total size of ${t.maxTotalSize}.`
@@ -513,24 +515,24 @@ function Mt(e, t) {
513
515
  totalSize: a
514
516
  };
515
517
  }
516
- function je(e, t, r, n) {
517
- r.maxSize !== void 0 && t.size > x(r.maxSize) && n.push({
518
+ function Fe(e, t, r, n) {
519
+ r.maxSize !== void 0 && t.size > $(r.maxSize) && n.push({
518
520
  code: "file-too-large",
519
521
  field: e,
520
522
  message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
521
- }), r.types?.length && !Be(t.type, r.types) && n.push({
523
+ }), r.types?.length && !He(t.type, r.types) && n.push({
522
524
  code: "file-type-not-allowed",
523
525
  field: e,
524
526
  message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
525
527
  });
526
528
  }
527
- function Be(e, t) {
529
+ function He(e, t) {
528
530
  return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
529
531
  }
530
- function qe(e) {
532
+ function Be(e) {
531
533
  return e instanceof File;
532
534
  }
533
- function He(e, t) {
535
+ function qe(e, t) {
534
536
  const r = t.headers.get("origin");
535
537
  if (!r)
536
538
  return {
@@ -539,7 +541,7 @@ function He(e, t) {
539
541
  origin: r,
540
542
  reason: e.allowMissingOrigin ? void 0 : "missing-origin"
541
543
  };
542
- const n = P(r);
544
+ const n = j(r);
543
545
  if (!n)
544
546
  return {
545
547
  allowed: !1,
@@ -555,8 +557,8 @@ function He(e, t) {
555
557
  reason: a ? void 0 : "origin-not-allowed"
556
558
  };
557
559
  }
558
- function Pt(e, t) {
559
- return !e || He(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
560
+ function Nt(e, t) {
561
+ return !e || qe(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
560
562
  status: 403
561
563
  });
562
564
  }
@@ -566,9 +568,9 @@ function _e(e, t, r) {
566
568
  );
567
569
  }
568
570
  function Ve(e, t) {
569
- return e === "null" ? t === "null" : P(e) === t;
571
+ return e === "null" ? t === "null" : j(e) === t;
570
572
  }
571
- function P(e) {
573
+ function j(e) {
572
574
  if (e === "null")
573
575
  return e;
574
576
  try {
@@ -587,30 +589,30 @@ function P(e) {
587
589
  }
588
590
  }
589
591
  function We(e) {
590
- const t = O(e.routes), r = e.loadNavigationData ?? F;
592
+ const t = M(e.routes), r = e.loadNavigationData ?? H;
591
593
  return function() {
592
- const [a, i] = I(() => E()), [s, o] = I(
594
+ const [a, i] = T(() => S()), [s, o] = T(
593
595
  () => e.initialMatch ?? { status: "loading" }
594
- ), u = T(!!e.initialMatch), d = T(0);
595
- C(() => {
596
+ ), u = I(!!e.initialMatch), d = I(0);
597
+ D(() => {
596
598
  function c() {
597
- i(E());
599
+ i(S());
598
600
  }
599
601
  return window.addEventListener("popstate", c), () => window.removeEventListener("popstate", c);
600
- }, []), C(() => {
602
+ }, []), D(() => {
601
603
  let c = !1, l = !1;
602
604
  const m = ++d.current, R = new AbortController(), v = () => !c && m === d.current;
603
- if (u.current && Ke(e.initialMatch) === a.pathname)
605
+ if (u.current && Ge(e.initialMatch) === a.pathname)
604
606
  return u.current = !1, () => {
605
607
  c = !0;
606
608
  };
607
- o({ status: "loading" }), ae(t, a.pathname).then((h) => {
609
+ o({ status: "loading" }), ne(t, a.pathname).then((h) => {
608
610
  v() && !l && h && o({ loading: h, status: "loading" });
609
611
  }).catch(() => {
610
612
  });
611
613
  const k = new Request(a.href, { signal: R.signal });
612
614
  return Promise.resolve(r(k)).then(
613
- (h) => L(
615
+ (h) => P(
614
616
  t,
615
617
  a.pathname,
616
618
  k,
@@ -623,7 +625,7 @@ function We(e) {
623
625
  }).catch(async (h) => {
624
626
  if (l = !0, !v() || R.signal.aborted)
625
627
  return;
626
- const q = await ie(
628
+ const q = await ae(
627
629
  t,
628
630
  a.pathname
629
631
  );
@@ -637,21 +639,21 @@ function We(e) {
637
639
  c = !0, R.abort();
638
640
  };
639
641
  }, [a.pathname, a.search]);
640
- const p = V(
642
+ const g = V(
641
643
  () => ({
642
644
  navigation: e.navigation ?? "server",
643
645
  push(c) {
644
- const l = E();
646
+ const l = S();
645
647
  window.history.pushState(null, "", c);
646
- const m = E();
647
- i(m), l.pathname === m.pathname && l.search === m.search && l.hash !== m.hash && Je(m.hash);
648
+ const m = S();
649
+ i(m), l.pathname === m.pathname && l.search === m.search && l.hash !== m.hash && Qe(m.hash);
648
650
  }
649
651
  }),
650
652
  []
651
653
  );
652
- return f(j.Provider, {
653
- value: p,
654
- children: f(Ze, {
654
+ return f(B.Provider, {
655
+ value: g,
656
+ children: f(Ye, {
655
657
  key: `${a.pathname}${a.search}`,
656
658
  Loading: e.loading,
657
659
  NotFound: e.notFound,
@@ -660,28 +662,28 @@ function We(e) {
660
662
  });
661
663
  };
662
664
  }
663
- function Ge(e, t) {
664
- const r = t.getAttribute(Z);
665
+ function Ke(e, t) {
666
+ const r = t.getAttribute(Y);
665
667
  return e.status === "not-found" ? r === "not-found" : e.status === "ready" && r === null;
666
668
  }
667
- function Ke(e) {
669
+ function Ge(e) {
668
670
  if (e)
669
671
  return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
670
672
  }
671
- async function Ut(e) {
673
+ async function Ct(e) {
672
674
  const t = e.root ?? document.getElementById("root");
673
675
  if (!t)
674
676
  throw new Error(
675
677
  "Demiurge expected a #root element in the framework document."
676
678
  );
677
- const r = O(e.routes), n = e.loadNavigationData ?? F, a = e.initialData ?? K(document), i = await L(
679
+ const r = M(e.routes), n = e.loadNavigationData ?? H, a = e.initialData ?? G(document), i = await P(
678
680
  r,
679
681
  window.location.pathname,
680
682
  new Request(window.location.href),
681
683
  a ?? await n(new Request(window.location.href)),
682
684
  void 0,
683
685
  { documentContributions: !1 }
684
- ), s = Ge(i, t), o = We(
686
+ ), s = Ke(i, t), o = We(
685
687
  s ? {
686
688
  ...e,
687
689
  initialMatch: i,
@@ -692,16 +694,16 @@ async function Ut(e) {
692
694
  loadNavigationData: n,
693
695
  navigation: a?.navigation ?? e.navigation
694
696
  }
695
- ), { createRoot: u, hydrateRoot: d } = Ye(
697
+ ), { createRoot: u, hydrateRoot: d } = Ze(
696
698
  await import("react-dom/client")
697
699
  );
698
- if (s && t.hasAttribute(Y)) {
699
- d(t, f(o));
700
+ if (s && t.hasAttribute(Z)) {
701
+ d(t, f(o)), N();
700
702
  return;
701
703
  }
702
- t.replaceChildren(), u(t).render(f(o));
704
+ t.replaceChildren(), u(t).render(f(o)), N();
703
705
  }
704
- function Ye(e) {
706
+ function Ze(e) {
705
707
  const t = typeof e.createRoot == "function" && typeof e.hydrateRoot == "function" ? e : e.default;
706
708
  if (!t || typeof t.createRoot != "function" || typeof t.hydrateRoot != "function")
707
709
  throw new Error(
@@ -709,9 +711,9 @@ function Ye(e) {
709
711
  );
710
712
  return t;
711
713
  }
712
- function Ft(e) {
713
- const t = tt(), r = ne(e);
714
- return /* @__PURE__ */ H(
714
+ function Ot(e) {
715
+ const t = tt(), r = re(e);
716
+ return /* @__PURE__ */ z(
715
717
  "a",
716
718
  {
717
719
  className: e.className,
@@ -723,7 +725,7 @@ function Ft(e) {
723
725
  }
724
726
  );
725
727
  }
726
- function Ze({
728
+ function Ye({
727
729
  Loading: e,
728
730
  NotFound: t,
729
731
  match: r
@@ -733,7 +735,7 @@ function Ze({
733
735
  return c ? f(c) : null;
734
736
  }
735
737
  if (r.status === "not-found") {
736
- const c = r.notFound ?? t ?? de;
738
+ const c = r.notFound ?? t ?? fe;
737
739
  return r.layouts.reduceRight(
738
740
  (l, m) => f(m, {
739
741
  children: l,
@@ -747,19 +749,19 @@ function Ze({
747
749
  return r.Error ? f(r.Error, {
748
750
  error: r.error,
749
751
  pathname: r.pathname,
750
- status: U(r.error)
752
+ status: F(r.error)
751
753
  }) : null;
752
- const { data: n, error: a, page: i, layouts: s, path: o, pathname: u } = r.match, d = f(i, { data: n, path: o, pathname: u }), p = s.reduceRight(
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(
753
755
  (c, l) => f(l, { path: o, pathname: u, children: c }),
754
756
  d
755
757
  );
756
- return f(Qe, {
758
+ return f(Xe, {
757
759
  Error: a,
758
- children: p,
760
+ children: g,
759
761
  pathname: u
760
762
  });
761
763
  }
762
- class Qe extends G {
764
+ class Xe extends K {
763
765
  static getDerivedStateFromError(t) {
764
766
  return { error: t };
765
767
  }
@@ -771,14 +773,14 @@ class Qe extends G {
771
773
  return this.state.error !== void 0 ? this.props.Error ? f(this.props.Error, {
772
774
  error: this.state.error,
773
775
  pathname: this.props.pathname,
774
- status: U(this.state.error)
776
+ status: F(this.state.error)
775
777
  }) : null : this.props.children;
776
778
  }
777
779
  }
778
- function U(e) {
779
- return me(e) ? e.status : 500;
780
+ function F(e) {
781
+ return de(e) ? e.status : 500;
780
782
  }
781
- function E() {
783
+ function S() {
782
784
  return {
783
785
  hash: window.location.hash,
784
786
  href: window.location.href,
@@ -786,26 +788,26 @@ function E() {
786
788
  search: window.location.search
787
789
  };
788
790
  }
789
- async function F(e) {
791
+ async function H(e) {
790
792
  const t = new Headers(e.headers);
791
- t.set("accept", "application/json"), t.set(D, oe);
793
+ t.set("accept", "application/json"), t.set(O, ie);
792
794
  const r = await fetch(new Request(e, {
793
795
  credentials: "same-origin",
794
796
  headers: t
795
- })), n = r.headers.get(D);
796
- if (n === se) {
797
+ })), n = r.headers.get(O);
798
+ if (n === oe) {
797
799
  const a = await r.json();
798
800
  if (a.hasData !== !0)
799
801
  throw new Error("Demiurge received malformed navigation route data.");
800
802
  return { data: a.data, hasData: !0 };
801
803
  }
802
- if (n === ce)
804
+ if (n === se)
803
805
  return { hasData: !0 };
804
- if (n === ue || !r.ok) {
805
- const a = await Xe(r), i = le.includes(
806
+ if (n === ce || !r.ok) {
807
+ const a = await Je(r), i = ue.includes(
806
808
  r.status
807
809
  ) ? r.status : 500;
808
- throw fe(i, {
810
+ throw le(i, {
809
811
  detail: typeof a?.detail == "string" ? a.detail : void 0,
810
812
  title: typeof a?.title == "string" ? a.title : void 0
811
813
  });
@@ -814,14 +816,14 @@ async function F(e) {
814
816
  "Demiurge expected a navigation data response from the application server."
815
817
  );
816
818
  }
817
- async function Xe(e) {
819
+ async function Je(e) {
818
820
  try {
819
821
  return await e.json();
820
822
  } catch {
821
823
  return;
822
824
  }
823
825
  }
824
- function Je(e) {
826
+ function Qe(e) {
825
827
  queueMicrotask(() => {
826
828
  if (!e) {
827
829
  window.scrollTo?.(0, 0);
@@ -839,202 +841,159 @@ function Je(e) {
839
841
  function et(e) {
840
842
  return e.button === 0 && !e.metaKey && !e.altKey && !e.ctrlKey && !e.shiftKey;
841
843
  }
842
- const j = _({
844
+ const B = _({
843
845
  navigation: "document",
844
846
  push(e) {
845
847
  window.location.href = e;
846
848
  }
847
849
  });
848
850
  function tt() {
849
- return W(j);
850
- }
851
- const rt = "/_demiurge/image";
852
- function jt(e) {
853
- return e;
854
- }
855
- function Bt(e, t = {}) {
856
- return B(e, t) !== null;
857
- }
858
- function qt(e, t = {}) {
859
- const r = B(e.src, t);
860
- if (!r)
861
- throw new Error(`Image source "${e.src}" is not allowed by the image policy.`);
862
- $("width", e.width), $("height", e.height), st(e.quality);
863
- const n = e.format ?? "auto", i = ct(e.width, e.widths).map((o) => {
864
- const u = Math.round(e.height / e.width * o);
865
- return {
866
- format: n,
867
- height: u,
868
- src: ut({
869
- format: n,
870
- optimizerPath: t.optimizerPath ?? rt,
871
- quality: e.quality,
872
- src: e.src,
873
- width: o
874
- }),
875
- width: o
876
- };
877
- }), s = i[0];
878
- return {
879
- alt: e.alt,
880
- decoding: "async",
881
- fetchPriority: e.priority ? "high" : void 0,
882
- height: e.height,
883
- loading: e.priority ? "eager" : "lazy",
884
- sizes: e.sizes,
885
- source: r,
886
- src: s.src,
887
- srcSet: i.map((o) => `${o.src} ${o.width}w`).join(", "),
888
- variants: i,
889
- width: e.width
890
- };
891
- }
892
- function B(e, t) {
893
- if (e.startsWith("/") && !e.startsWith("//"))
894
- return t.local === !1 ? null : { kind: "local", src: e };
895
- let r;
896
- try {
897
- r = new URL(e);
898
- } catch {
899
- return null;
900
- }
901
- return r.protocol !== "https:" && r.protocol !== "http:" ? null : nt(r, t.remote ?? []) ? { kind: "remote", src: r.toString() } : null;
851
+ return W(B);
902
852
  }
903
- function nt(e, t) {
904
- return t.some(
905
- (r) => typeof r == "string" ? at(e, r) : it(e, r)
853
+ function Lt({ className: e, id: t, policy: r, ...n }) {
854
+ const a = me(n, r);
855
+ return /* @__PURE__ */ z(
856
+ "img",
857
+ {
858
+ alt: a.alt,
859
+ className: e,
860
+ decoding: a.decoding,
861
+ fetchPriority: a.fetchPriority,
862
+ height: a.height,
863
+ id: t,
864
+ loading: a.loading,
865
+ sizes: a.sizes,
866
+ src: a.src,
867
+ srcSet: a.srcSet,
868
+ width: a.width
869
+ }
906
870
  );
907
871
  }
908
- function at(e, t) {
909
- try {
910
- return e.origin === new URL(t).origin;
911
- } catch {
912
- return !1;
913
- }
914
- }
915
- function it(e, t) {
916
- return t.protocol && e.protocol !== t.protocol || e.hostname !== t.hostname || t.port !== void 0 && e.port !== t.port ? !1 : t.pathname ? ot(e.pathname, t.pathname) : !0;
917
- }
918
- function ot(e, t) {
919
- return t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t;
920
- }
921
- function $(e, t) {
922
- if (!Number.isInteger(t) || t <= 0)
923
- throw new Error(`Image ${e} must be a positive integer.`);
924
- }
925
- function st(e) {
926
- if (e !== void 0 && (!Number.isInteger(e) || e < 1 || e > 100))
927
- throw new Error("Image quality must be an integer between 1 and 100.");
928
- }
929
- function ct(e, t) {
930
- const r = t ?? [e, e * 2], n = [...new Set(r)];
931
- for (const a of n)
932
- $("width", a);
933
- return n.sort((a, i) => a - i);
934
- }
935
- function ut({
936
- format: e,
937
- optimizerPath: t,
938
- quality: r,
939
- src: n,
940
- width: a
941
- }) {
942
- const i = new URLSearchParams({
943
- src: n,
944
- w: String(a)
945
- });
946
- return r !== void 0 && i.set("q", String(r)), e !== "auto" && i.set("f", e), `${t}?${i.toString()}`;
947
- }
948
- const Ht = {
949
- google(e) {
872
+ const rt = "https://js.sentry-cdn.com", zt = {
873
+ /**
874
+ * Plausible loads one script and posts events to its own API. The snippet
875
+ * carries configuration in `data-domain`, so no inline code is involved.
876
+ * `endpoint` accepts a same-origin path prefix for a proxied deployment.
877
+ */
878
+ plausible(e) {
879
+ const t = nt(e.domain), r = L(e.endpoint ?? "https://plausible.io");
950
880
  return {
951
- display: e.display ?? "swap",
952
- family: e.family,
953
- kind: "font",
954
- source: "google",
955
- src: e.src,
956
- style: e.style ?? "normal",
957
- weight: e.weight ?? 400
881
+ consent: e.consent ?? !1,
882
+ domain: t,
883
+ kind: "analytics",
884
+ needs: {
885
+ connect: [r.source],
886
+ script: [r.source]
887
+ },
888
+ provider: "plausible",
889
+ scripts: [
890
+ A({
891
+ dataApi: `${r.base}/api/event`,
892
+ dataDomain: t,
893
+ defer: !0,
894
+ needs: { connect: [r.source] },
895
+ purpose: "analytics",
896
+ src: `${r.base}/js/script.js`,
897
+ strategy: e.strategy ?? "afterInteractive"
898
+ })
899
+ ]
958
900
  };
959
901
  },
960
- local(e) {
961
- if (!e.src.trim())
962
- throw new Error("Local font source must not be empty.");
902
+ /**
903
+ * The Sentry loader script carries the DSN in its own filename, so a page
904
+ * needs no inline configuration call. Events go to the DSN host, which is
905
+ * why the integration also declares a `connect-src` need.
906
+ */
907
+ sentry(e) {
908
+ const t = ot(e.dsn), r = it(
909
+ e.loaderHost ?? rt,
910
+ "Sentry loader host"
911
+ );
963
912
  return {
964
- display: e.display ?? "swap",
965
- family: e.name,
966
- kind: "font",
967
- source: "local",
968
- src: e.src,
969
- style: e.style ?? "normal",
970
- weight: e.weight ?? 400
913
+ consent: e.consent ?? !1,
914
+ ingestOrigin: t.origin,
915
+ kind: "analytics",
916
+ needs: {
917
+ connect: [t.origin],
918
+ script: [r]
919
+ },
920
+ projectId: t.projectId,
921
+ provider: "sentry",
922
+ scripts: [
923
+ A({
924
+ crossOrigin: "anonymous",
925
+ needs: { connect: [t.origin] },
926
+ purpose: "error-monitoring",
927
+ src: `${r}/${t.publicKey}.min.js`,
928
+ // Errors thrown before the app is interactive are the ones an
929
+ // application can least afford to lose.
930
+ strategy: e.strategy ?? "beforeInteractive"
931
+ })
932
+ ]
971
933
  };
972
- }
973
- };
974
- function _t(e) {
975
- return [...e];
976
- }
977
- function Vt(e) {
978
- return e.filter((t) => t.src).map((t) => ({
979
- as: "font",
980
- crossOrigin: "anonymous",
981
- href: t.src,
982
- kind: "link",
983
- rel: "preload",
984
- type: lt(t.src)
985
- }));
986
- }
987
- function Wt(e) {
988
- return e.filter((t) => t.source === "local" && t.src).map((t) => {
989
- const r = t.src;
990
- return [
991
- "@font-face {",
992
- ` font-family: "${N(t.family)}";`,
993
- ` src: url("${N(r)}") format("${ft(r)}");`,
994
- ` font-style: ${t.style};`,
995
- ` font-weight: ${t.weight};`,
996
- ` font-display: ${t.display};`,
997
- "}"
998
- ].join(`
999
- `);
1000
- }).join(`
1001
- `);
1002
- }
1003
- function lt(e) {
1004
- return e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() === "woff" ? "font/woff" : "font/woff2";
1005
- }
1006
- function ft(e) {
1007
- return e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() === "woff" ? "woff" : "woff2";
1008
- }
1009
- function N(e) {
1010
- return e.replace(/[\\"]/g, "\\$&");
1011
- }
1012
- const Gt = {
1013
- plausible(e) {
1014
- const t = dt(e.domain), r = mt(e.endpoint ?? "https://plausible.io");
934
+ },
935
+ /**
936
+ * OpenTelemetry publishes no hosted browser loader. Browser instrumentation
937
+ * is application code bundled from npm packages, so this helper describes
938
+ * the part a policy has to know about: the OTLP endpoint the exporter posts
939
+ * to, and an optional same-origin entry script that starts the SDK.
940
+ */
941
+ openTelemetry(e) {
942
+ const t = L(e.endpoint), r = e.script;
943
+ if (r !== void 0 && !r.startsWith("/"))
944
+ throw new Error(
945
+ "OpenTelemetry browser instrumentation must be a same-origin script path."
946
+ );
1015
947
  return {
1016
- connectSrc: r.origin,
1017
948
  consent: e.consent ?? !1,
1018
- domain: t,
949
+ endpoint: t.base || "/",
1019
950
  kind: "analytics",
1020
- provider: "plausible",
1021
- script: Q({
1022
- dataApi: `${r.origin}/api/event`,
1023
- dataDomain: t,
1024
- purpose: "analytics",
1025
- src: `${r.origin}/js/script.js`,
1026
- strategy: e.strategy ?? "afterInteractive"
1027
- })
951
+ needs: r ? { connect: [t.source], script: ["'self'"] } : { connect: [t.source] },
952
+ provider: "opentelemetry",
953
+ scripts: r ? [
954
+ A({
955
+ needs: { connect: [t.source] },
956
+ purpose: "observability",
957
+ src: r,
958
+ strategy: e.strategy ?? "module"
959
+ })
960
+ ] : []
1028
961
  };
962
+ },
963
+ /** Merges the CSP needs of every integration into one route policy. */
964
+ policy(...e) {
965
+ const t = {};
966
+ for (const r of e)
967
+ 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])]);
970
+ }
971
+ return { security: { needs: t } };
972
+ },
973
+ /** Collects the script contributions of every integration. */
974
+ scripts(...e) {
975
+ return e.flatMap((t) => [...t.scripts]);
1029
976
  }
1030
977
  };
1031
- function dt(e) {
978
+ function nt(e) {
1032
979
  const t = e.trim();
1033
980
  if (!t || t.includes("/") || t.includes(" "))
1034
981
  throw new Error("Analytics domain must be a hostname without a path.");
1035
982
  return t;
1036
983
  }
1037
- function mt(e) {
984
+ function L(e) {
985
+ if (e.startsWith("/")) {
986
+ if (e.startsWith("//"))
987
+ throw new Error("Analytics endpoint must not be a scheme-relative URL.");
988
+ return {
989
+ base: e === "/" ? "" : e.replace(/\/+$/, ""),
990
+ source: "'self'"
991
+ };
992
+ }
993
+ const t = at(e);
994
+ return { base: t.origin, source: t.origin };
995
+ }
996
+ function at(e) {
1038
997
  let t;
1039
998
  try {
1040
999
  t = new URL(e);
@@ -1045,132 +1004,176 @@ function mt(e) {
1045
1004
  throw new Error("Analytics endpoint must use HTTPS.");
1046
1005
  return t;
1047
1006
  }
1048
- function Kt(e = {}) {
1007
+ function it(e, t) {
1008
+ let r;
1009
+ try {
1010
+ r = new URL(e);
1011
+ } catch {
1012
+ throw new Error(`${t} must be an absolute URL.`);
1013
+ }
1014
+ if (r.protocol !== "https:")
1015
+ throw new Error(`${t} must use HTTPS.`);
1016
+ return r.origin;
1017
+ }
1018
+ function ot(e) {
1019
+ let t;
1020
+ try {
1021
+ t = new URL(e);
1022
+ } catch {
1023
+ throw new Error("Sentry DSN must be an absolute URL.");
1024
+ }
1025
+ if (t.protocol !== "https:")
1026
+ throw new Error("Sentry DSN must use HTTPS.");
1027
+ const r = t.pathname.replace(/^\//, "");
1028
+ if (!t.username || t.password)
1029
+ throw new Error(
1030
+ "Sentry DSN must carry a public key and no secret key."
1031
+ );
1032
+ if (!/^[A-Za-z0-9_-]+$/.test(r))
1033
+ throw new Error("Sentry DSN must end with a project identifier.");
1034
+ return {
1035
+ origin: t.origin,
1036
+ projectId: r,
1037
+ publicKey: t.username
1038
+ };
1039
+ }
1040
+ function Mt(e = {}) {
1049
1041
  return {
1050
1042
  async request(t) {
1051
- await S({ kind: "request", signal: t }, e);
1043
+ await E({ kind: "request", signal: t }, e);
1052
1044
  },
1053
1045
  async serverStart(t = {}) {
1054
- await S({ kind: "server-start", signal: t }, e);
1046
+ await E({ kind: "server-start", signal: t }, e);
1055
1047
  },
1056
1048
  async trace(t) {
1057
- await S({ kind: "trace", signal: t }, e);
1049
+ await E({ kind: "trace", signal: t }, e);
1058
1050
  },
1059
1051
  async reportWebVitals(t) {
1060
- await S({ kind: "web-vital", signal: t }, e);
1052
+ await E({ kind: "web-vital", signal: t }, e);
1061
1053
  }
1062
1054
  };
1063
1055
  }
1064
- async function S(e, t) {
1056
+ async function E(e, t) {
1065
1057
  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);
1066
1058
  }
1067
1059
  export {
1068
1060
  ke as EnvValidationError,
1069
- le as HTTP_ERROR_STATUSES,
1070
- ir as HttpError,
1071
- Ft as Link,
1072
- Qt as Script,
1073
- kt as action,
1074
- It as actionInput,
1075
- Gt as analytics,
1076
- Xt as assertAdapterCapabilities,
1077
- or as auditScriptDependencies,
1078
- Jt as checkAdapterCapabilities,
1079
- He as checkWebSocketOrigin,
1080
- sr as createCache,
1081
- cr as createCorsHeaders,
1082
- ur as createCsrfCookie,
1083
- lr as createCsrfToken,
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,
1084
1077
  We as createFileRouter,
1085
- fr as createInvalidation,
1086
- dr as createMemoryCache,
1087
- mr as createMemoryCacheStore,
1088
- vt as createMemoryIdempotencyStore,
1089
- hr as createMemoryRateLimitStore,
1090
- gr as createRequestHandler,
1091
- pr as createSecurityAudit,
1092
- wr as createSecurityHeaders,
1093
- Lt as createSecurityReportHandler,
1094
- yr as cspHash,
1095
- vr as cspNonce,
1096
- er as defineAdapter,
1097
- Dt as defineEnvSchema,
1098
- _t as defineFonts,
1099
- jt as defineImages,
1100
- Kt as defineInstrumentation,
1101
- br as defineLinks,
1102
- Er as defineMetadata,
1103
- Ct as defineMiddleware,
1104
- At as defineOgImage,
1105
- Rt as defineRobots,
1106
- Sr as defineRoutePolicy,
1107
- tr as defineScripts,
1108
- Rr as defineSecurityPolicy,
1109
- Et as defineSitemap,
1110
- Ar as defineTags,
1111
- $r as enforceAllowedMethods,
1112
- xr as enforceCsrfProtection,
1113
- kr as enforceRateLimit,
1114
- Ir as enforceRequestSecurity,
1115
- Pt as enforceWebSocketOrigin,
1116
- Ot as env,
1117
- Ht as font,
1118
- Vt as fontPreloadLinks,
1119
- Tr as handleRequestWithManifest,
1120
- ne as href,
1121
- Cr as html,
1122
- fe as httpError,
1123
- Ut as hydrateFileRouter,
1124
- Bt as isAllowedImageSource,
1125
- me as isHttpError,
1126
- zr as issueCsrfToken,
1127
- Dr as json,
1128
- Nr as jsonl,
1129
- Or as link,
1130
- Lr as mergeRoutePolicies,
1131
- Mr as mergeRouteSecurityPolicies,
1132
- Pr as mergeSecurityPolicies,
1133
- Ur as meta,
1134
- Fr as modulePreload,
1135
- jr as notFound,
1136
- Tt as page,
1137
- x as parseBodySize,
1138
- z as parseCacheDuration,
1139
- Br as parseCookieHeader,
1140
- qr as parseRateLimitWindow,
1141
- qt as planImageTransform,
1142
- Hr as preconnect,
1143
- _r as preload,
1144
- Vr as query,
1145
- Wr as redirect,
1146
- Wt as renderFontFaceCss,
1147
- xt as renderOgImageResponse,
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,
1148
1150
  ye as renderOgImageSvg,
1149
- rr as renderPageResponse,
1150
- $t as renderRobots,
1151
- St as renderSitemap,
1152
- Gr as resolveLinks,
1153
- Kr as resolveMetadata,
1154
- nr as resolveScripts,
1151
+ Zt as renderPageResponse,
1152
+ vt as renderRobots,
1153
+ gt as renderSitemap,
1154
+ Yt as resolveLinks,
1155
+ Pr as resolveMetadata,
1156
+ Xt as resolveScripts,
1155
1157
  J as response,
1156
- bt as runIdempotentMutation,
1157
- Q as script,
1158
- Yr as security,
1158
+ ht as runIdempotentMutation,
1159
+ A as script,
1160
+ Ur as security,
1159
1161
  X as serializeCacheKey,
1160
- Zr as serializeCacheNamespace,
1161
- Qr as serializeCacheTag,
1162
- Xr as serverTiming,
1163
- Jr as sse,
1164
- en as stream,
1165
- tn as structuredData,
1166
- rn as tag,
1167
- nn as text,
1168
- ee as toResponse,
1169
- an as validateCorsPolicy,
1170
- Nt as validateEnv,
1171
- on as validateRateLimitPolicy,
1172
- sn as validateRouteModules,
1173
- Mt as validateUploads,
1174
- zt as webhook
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
1175
1178
  };
1176
1179
  //# sourceMappingURL=index.js.map