@demiurgejs/core 0.1.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 (151) hide show
  1. package/README.md +5 -0
  2. package/bin/demiurge.mjs +51 -0
  3. package/dist/adapter/testing.d.ts +33 -0
  4. package/dist/adapter/testing.d.ts.map +1 -0
  5. package/dist/adapter/testing.js +251 -0
  6. package/dist/adapter/testing.js.map +1 -0
  7. package/dist/browser/file-router.d.ts.map +1 -1
  8. package/dist/chunks/document-shell-D1xo6cEA.js +35 -0
  9. package/dist/chunks/document-shell-D1xo6cEA.js.map +1 -0
  10. package/dist/chunks/image-codec-BGTx_t5K.js +141 -0
  11. package/dist/chunks/image-codec-BGTx_t5K.js.map +1 -0
  12. package/dist/chunks/images-B9MqcjSA.js +339 -0
  13. package/dist/chunks/images-B9MqcjSA.js.map +1 -0
  14. package/dist/chunks/request-metadata-D5NrT8ks.js +642 -0
  15. package/dist/chunks/request-metadata-D5NrT8ks.js.map +1 -0
  16. package/dist/chunks/streaming-BQ1bykDo.js +469 -0
  17. package/dist/chunks/streaming-BQ1bykDo.js.map +1 -0
  18. package/dist/chunks/{testing-DR3eQAvY.js → testing-B_iMFYz_.js} +2376 -1927
  19. package/dist/chunks/testing-B_iMFYz_.js.map +1 -0
  20. package/dist/cli.d.ts +42 -0
  21. package/dist/cli.d.ts.map +1 -0
  22. package/dist/cli.js +173 -0
  23. package/dist/cli.js.map +1 -0
  24. package/dist/document/deferred-scripts.d.ts +11 -0
  25. package/dist/document/deferred-scripts.d.ts.map +1 -0
  26. package/dist/document/index.d.ts +4 -2
  27. package/dist/document/index.d.ts.map +1 -1
  28. package/dist/document/render.d.ts +1 -1
  29. package/dist/document/render.d.ts.map +1 -1
  30. package/dist/document/scripts.d.ts +34 -1
  31. package/dist/document/scripts.d.ts.map +1 -1
  32. package/dist/edge/assets.d.ts +14 -0
  33. package/dist/edge/assets.d.ts.map +1 -0
  34. package/dist/edge/index.d.ts +19 -0
  35. package/dist/edge/index.d.ts.map +1 -0
  36. package/dist/edge/index.js +286 -0
  37. package/dist/edge/index.js.map +1 -0
  38. package/dist/edge/stores.d.ts +8 -0
  39. package/dist/edge/stores.d.ts.map +1 -0
  40. package/dist/edge/streaming.d.ts +7 -0
  41. package/dist/edge/streaming.d.ts.map +1 -0
  42. package/dist/index.d.ts +9 -9
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +894 -1043
  45. package/dist/index.js.map +1 -1
  46. package/dist/internal/testing.js +12 -11
  47. package/dist/internal/testing.js.map +1 -1
  48. package/dist/kv/index.d.ts +3 -0
  49. package/dist/kv/index.d.ts.map +1 -0
  50. package/dist/kv/index.js +103 -0
  51. package/dist/kv/index.js.map +1 -0
  52. package/dist/kv/store.d.ts +28 -0
  53. package/dist/kv/store.d.ts.map +1 -0
  54. package/dist/node/font.d.ts +5 -0
  55. package/dist/node/font.d.ts.map +1 -0
  56. package/dist/node/image.d.ts +15 -0
  57. package/dist/node/image.d.ts.map +1 -0
  58. package/dist/node/index.d.ts +4 -0
  59. package/dist/node/index.d.ts.map +1 -1
  60. package/dist/node/index.js +25 -23
  61. package/dist/node/index.js.map +1 -1
  62. package/dist/node/streaming.d.ts +2 -0
  63. package/dist/node/streaming.d.ts.map +1 -1
  64. package/dist/platform/analytics.d.ts +58 -5
  65. package/dist/platform/analytics.d.ts.map +1 -1
  66. package/dist/platform/font-assets.d.ts +19 -0
  67. package/dist/platform/font-assets.d.ts.map +1 -0
  68. package/dist/platform/fonts.d.ts +14 -4
  69. package/dist/platform/fonts.d.ts.map +1 -1
  70. package/dist/platform/image-codec.d.ts +15 -0
  71. package/dist/platform/image-codec.d.ts.map +1 -0
  72. package/dist/platform/image-url.d.ts +17 -0
  73. package/dist/platform/image-url.d.ts.map +1 -0
  74. package/dist/platform/image.d.ts +8 -0
  75. package/dist/platform/image.d.ts.map +1 -0
  76. package/dist/platform/images.d.ts +15 -0
  77. package/dist/platform/images.d.ts.map +1 -1
  78. package/dist/platform/index.d.ts +8 -5
  79. package/dist/platform/index.d.ts.map +1 -1
  80. package/dist/redis/index.d.ts +3 -0
  81. package/dist/redis/index.d.ts.map +1 -0
  82. package/dist/redis/index.js +171 -0
  83. package/dist/redis/index.js.map +1 -0
  84. package/dist/redis/store.d.ts +8 -0
  85. package/dist/redis/store.d.ts.map +1 -0
  86. package/dist/route/action.d.ts +11 -11
  87. package/dist/route/action.d.ts.map +1 -1
  88. package/dist/route/index.d.ts +2 -1
  89. package/dist/route/index.d.ts.map +1 -1
  90. package/dist/route/middleware.d.ts +7 -0
  91. package/dist/route/middleware.d.ts.map +1 -0
  92. package/dist/route/page.d.ts +2 -2
  93. package/dist/route/page.d.ts.map +1 -1
  94. package/dist/route/response.d.ts +19 -19
  95. package/dist/route/response.d.ts.map +1 -1
  96. package/dist/route/types.d.ts +55 -31
  97. package/dist/route/types.d.ts.map +1 -1
  98. package/dist/route/webhook.d.ts +1 -1
  99. package/dist/router/manifest.d.ts +1 -0
  100. package/dist/router/manifest.d.ts.map +1 -1
  101. package/dist/routing/generate.d.ts +2 -0
  102. package/dist/routing/generate.d.ts.map +1 -1
  103. package/dist/routing/index.d.ts +1 -1
  104. package/dist/routing/index.d.ts.map +1 -1
  105. package/dist/routing/types.d.ts +2 -0
  106. package/dist/routing/types.d.ts.map +1 -1
  107. package/dist/security/cors.d.ts.map +1 -1
  108. package/dist/security/index.d.ts +4 -2
  109. package/dist/security/index.d.ts.map +1 -1
  110. package/dist/security/policy.d.ts +5 -1
  111. package/dist/security/policy.d.ts.map +1 -1
  112. package/dist/security/types.d.ts +34 -13
  113. package/dist/security/types.d.ts.map +1 -1
  114. package/dist/security/verification.d.ts +8 -0
  115. package/dist/security/verification.d.ts.map +1 -0
  116. package/dist/server/document-shell.d.ts +12 -0
  117. package/dist/server/document-shell.d.ts.map +1 -0
  118. package/dist/server/errors.d.ts.map +1 -1
  119. package/dist/server/not-found.d.ts.map +1 -1
  120. package/dist/server/render-tree.d.ts +6 -1
  121. package/dist/server/render-tree.d.ts.map +1 -1
  122. package/dist/server/request-handler.d.ts +4 -1
  123. package/dist/server/request-handler.d.ts.map +1 -1
  124. package/dist/server/ssr.d.ts +1 -0
  125. package/dist/server/ssr.d.ts.map +1 -1
  126. package/dist/static/images.d.ts +13 -0
  127. package/dist/static/images.d.ts.map +1 -0
  128. package/dist/static/index.d.ts +18 -0
  129. package/dist/static/index.d.ts.map +1 -1
  130. package/dist/static/index.js +677 -129
  131. package/dist/static/index.js.map +1 -1
  132. package/dist/static/preview.d.ts +8 -0
  133. package/dist/static/preview.d.ts.map +1 -0
  134. package/dist/static/vercel.d.ts +34 -0
  135. package/dist/static/vercel.d.ts.map +1 -0
  136. package/dist/vite/index.d.ts +3 -2
  137. package/dist/vite/index.d.ts.map +1 -1
  138. package/dist/vite/index.js +782 -329
  139. package/dist/vite/index.js.map +1 -1
  140. package/dist/vite/plugin.d.ts +20 -0
  141. package/dist/vite/plugin.d.ts.map +1 -1
  142. package/dist/vite/policy-verification.d.ts +10 -0
  143. package/dist/vite/policy-verification.d.ts.map +1 -0
  144. package/package.json +38 -2
  145. package/dist/chunks/index-BnX9Qxbm.js +0 -44
  146. package/dist/chunks/index-BnX9Qxbm.js.map +0 -1
  147. package/dist/chunks/ssr-BJejKlkZ.js +0 -275
  148. package/dist/chunks/ssr-BJejKlkZ.js.map +0 -1
  149. package/dist/chunks/streaming-DN1DnbRE.js +0 -343
  150. package/dist/chunks/streaming-DN1DnbRE.js.map +0 -1
  151. package/dist/chunks/testing-DR3eQAvY.js.map +0 -1
@@ -0,0 +1,642 @@
1
+ import { renderToString as N } from "react-dom/server";
2
+ import { createContext as L, useContext as q, useEffect as j, createElement as f } from "react";
3
+ const F = {
4
+ backgroundLifetime: !1,
5
+ crossOriginIsolationHeaders: !1,
6
+ nonceInjection: !1,
7
+ sharedCache: !1,
8
+ staticOutput: !1,
9
+ streaming: !1,
10
+ webSocket: !1,
11
+ webTransport: !1
12
+ };
13
+ function _e(e) {
14
+ return {
15
+ capabilities: {
16
+ ...F,
17
+ ...e.capabilities
18
+ },
19
+ name: e.name
20
+ };
21
+ }
22
+ function J(e, t) {
23
+ const r = [...new Set(t)], n = r.filter(
24
+ (o) => !e.capabilities[o]
25
+ );
26
+ return {
27
+ adapter: e.name,
28
+ missing: n,
29
+ ok: n.length === 0,
30
+ required: r
31
+ };
32
+ }
33
+ function xe(e, t) {
34
+ const r = J(e, t);
35
+ if (!r.ok)
36
+ throw new Error(
37
+ `Adapter "${e.name}" does not support required capabilities: ${r.missing.join(", ")}.`
38
+ );
39
+ return r;
40
+ }
41
+ const x = "__demiurge_data", G = "data-demiurge-hydrate", H = "data-demiurge-fallback";
42
+ function W(e, t = {}) {
43
+ return Y(
44
+ JSON.stringify({ data: e, hasData: !0, ...t })
45
+ );
46
+ }
47
+ function Oe(e) {
48
+ const t = e.getElementById(x), r = t?.tagName === "TEMPLATE" ? t.content.textContent : t?.textContent;
49
+ if (r)
50
+ try {
51
+ return JSON.parse(r);
52
+ } catch (n) {
53
+ throw new Error(
54
+ "Demiurge could not parse the initial route data payload.",
55
+ { cause: n }
56
+ );
57
+ }
58
+ }
59
+ function Y(e) {
60
+ return e.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
61
+ }
62
+ const O = "text/demiurge-script", p = "data-demiurge-script", y = "data-demiurge-script-src", h = "data-demiurge-script-type", R = "data-demiurge-script-started", z = 2e3, K = [
63
+ "data-api",
64
+ "data-demiurge-script-placement",
65
+ "data-domain",
66
+ "id",
67
+ "integrity",
68
+ "referrerpolicy"
69
+ ], P = /* @__PURE__ */ new Map();
70
+ function A(e) {
71
+ return e === "idle" || e === "worker";
72
+ }
73
+ function V(e) {
74
+ const t = e ?? (typeof document > "u" ? void 0 : document);
75
+ if (!t)
76
+ return;
77
+ const r = t.querySelectorAll(
78
+ `script[${p}]:not([${R}])`
79
+ );
80
+ for (const n of [...r]) {
81
+ const o = n.getAttribute(p);
82
+ if (!(o !== "idle" && o !== "worker")) {
83
+ if (n.setAttribute(R, ""), o === "worker") {
84
+ Z(n);
85
+ continue;
86
+ }
87
+ Q(n, () => X(n));
88
+ }
89
+ }
90
+ }
91
+ function Pe(e) {
92
+ return P.get(e);
93
+ }
94
+ function Q(e, t) {
95
+ const r = e.ownerDocument.defaultView;
96
+ if (r && typeof r.requestIdleCallback == "function") {
97
+ r.requestIdleCallback(() => t(), { timeout: z });
98
+ return;
99
+ }
100
+ (r ?? globalThis).setTimeout(t, 1);
101
+ }
102
+ function X(e) {
103
+ const t = e.ownerDocument, r = e.getAttribute(y);
104
+ if (!r)
105
+ return;
106
+ const n = t.createElement("script"), o = e.getAttribute(h);
107
+ for (const s of K) {
108
+ const c = e.getAttribute(s);
109
+ c !== null && n.setAttribute(s, c);
110
+ }
111
+ e.removeAttribute("id"), o && (n.type = o), n.async = !0, n.nonce = e.nonce, n.src = r, t.head.appendChild(n);
112
+ }
113
+ function Z(e) {
114
+ const t = e.getAttribute(y), r = e.ownerDocument.defaultView;
115
+ if (!t)
116
+ return;
117
+ if (!r || typeof r.Worker != "function") {
118
+ console.error(
119
+ `Demiurge could not start the worker script ${JSON.stringify(t)}. This runtime has no Worker constructor.`
120
+ );
121
+ return;
122
+ }
123
+ const n = e.getAttribute(h);
124
+ try {
125
+ P.set(
126
+ t,
127
+ new r.Worker(t, { type: n === "module" ? "module" : "classic" })
128
+ );
129
+ } catch (o) {
130
+ console.error(
131
+ `Demiurge could not start the worker script ${JSON.stringify(t)}.`,
132
+ o
133
+ );
134
+ }
135
+ }
136
+ const ee = /* @__PURE__ */ new Set([
137
+ "afterInteractive",
138
+ "beforeInteractive",
139
+ "idle",
140
+ "module",
141
+ "worker"
142
+ ]), u = Symbol("demiurge.scriptPlacement"), B = L(
143
+ void 0
144
+ );
145
+ function te(e = {}) {
146
+ let t = !1;
147
+ const r = [...e.scripts ?? []], n = new Set(r.map((c) => c.src)), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
148
+ return {
149
+ get dev() {
150
+ return e.dev ?? !1;
151
+ },
152
+ get headFlushed() {
153
+ return t;
154
+ },
155
+ flushHead() {
156
+ t = !0;
157
+ },
158
+ nonce: e.nonce,
159
+ register(c) {
160
+ if (n.has(c.src) || o.has(c.src))
161
+ return "skip";
162
+ if (o.add(c.src), !t)
163
+ return s.set(c.src, {
164
+ ...c,
165
+ [u]: "hoisted"
166
+ }), "hoist";
167
+ if (c.strategy === "beforeInteractive" && (e.dev ?? !1))
168
+ throw new Error(
169
+ `A render-discovered beforeInteractive script ${JSON.stringify(c.src)} was found after the document head flushed. Declare it in export const scripts.`
170
+ );
171
+ return "render";
172
+ },
173
+ scripts() {
174
+ return M([...r, ...s.values()]);
175
+ }
176
+ };
177
+ }
178
+ function Be(e) {
179
+ const t = q(B), r = oe(e);
180
+ if (j(() => {
181
+ A(r.strategy) && V();
182
+ }), !t) {
183
+ if (typeof document > "u")
184
+ throw new Error(
185
+ `The script ${JSON.stringify(r.src)} rendered outside a Demiurge document render context. A server render must wrap its component tree with the script render context.`
186
+ );
187
+ return re(r.src) ? null : v({
188
+ ...r,
189
+ [u]: "in-place"
190
+ }, ne());
191
+ }
192
+ return t.register(r) !== "render" ? null : v({
193
+ ...r,
194
+ [u]: "in-place"
195
+ }, t.nonce);
196
+ }
197
+ function v(e, t) {
198
+ return A(e.strategy) ? f("script", {
199
+ "data-api": e.dataApi,
200
+ [p]: e.strategy,
201
+ "data-demiurge-script-placement": e[u],
202
+ [y]: e.src,
203
+ [h]: e.type,
204
+ "data-domain": e.dataDomain,
205
+ id: e.id,
206
+ integrity: e.integrity,
207
+ nonce: e.nonce ?? t,
208
+ referrerPolicy: e.referrerPolicy,
209
+ type: O
210
+ }) : f("script", {
211
+ async: e.async,
212
+ crossOrigin: e.crossOrigin,
213
+ "data-api": e.dataApi,
214
+ "data-domain": e.dataDomain,
215
+ "data-demiurge-script-placement": e[u],
216
+ defer: e.defer,
217
+ id: e.id,
218
+ integrity: e.integrity,
219
+ nonce: e.nonce ?? t,
220
+ referrerPolicy: e.referrerPolicy,
221
+ src: e.src,
222
+ type: e.type ?? ae(e.strategy)
223
+ });
224
+ }
225
+ function re(e) {
226
+ if (typeof document > "u")
227
+ return !1;
228
+ const t = new URL(e, document.baseURI).href;
229
+ return [...document.scripts].some(
230
+ (r) => r.src === t && r.dataset.demiurgeScriptPlacement !== "in-place"
231
+ );
232
+ }
233
+ function ne() {
234
+ if (!(typeof document > "u"))
235
+ return [...document.scripts].reverse().find((e) => e.nonce)?.nonce;
236
+ }
237
+ function Me(e) {
238
+ return e;
239
+ }
240
+ function oe(e) {
241
+ const t = e.strategy ?? "afterInteractive";
242
+ if (!ee.has(t))
243
+ throw new Error(
244
+ `Unsupported script strategy ${JSON.stringify(t)}. Demiurge supports "beforeInteractive", "module", "afterInteractive", "idle", and "worker".`
245
+ );
246
+ if (t === "module" && e.type && e.type !== "module")
247
+ throw new Error(
248
+ 'The "module" script strategy cannot be combined with type="text/javascript".'
249
+ );
250
+ if (t === "worker" && (e.async || e.defer))
251
+ throw new Error(
252
+ 'The "worker" script strategy runs off the main thread, so it cannot be combined with async or defer.'
253
+ );
254
+ return {
255
+ ...e,
256
+ kind: "script",
257
+ strategy: t
258
+ };
259
+ }
260
+ function ie(e, t) {
261
+ return f(B.Provider, { value: e, children: t });
262
+ }
263
+ async function Te(e, t) {
264
+ const r = [];
265
+ for (const n of e) {
266
+ if (!n)
267
+ continue;
268
+ const o = typeof n == "function" ? await n(t) : n;
269
+ r.push(...o);
270
+ }
271
+ return M(ce(r));
272
+ }
273
+ function ce(e) {
274
+ const t = /* @__PURE__ */ new Map();
275
+ for (const r of e)
276
+ t.set(D(r), {
277
+ ...t.get(D(r)),
278
+ ...r
279
+ });
280
+ return [...t.values()];
281
+ }
282
+ function D(e) {
283
+ return [
284
+ e.src,
285
+ e.type ?? "",
286
+ e.integrity ?? "",
287
+ e.strategy
288
+ ].join("\0");
289
+ }
290
+ function se(e, t) {
291
+ return k(e.strategy) - k(t.strategy) || e.src.localeCompare(t.src);
292
+ }
293
+ function M(e) {
294
+ return e.sort(se);
295
+ }
296
+ function ae(e) {
297
+ return e === "module" ? "module" : void 0;
298
+ }
299
+ function k(e) {
300
+ return e === "beforeInteractive" ? 0 : e === "module" ? 1 : e === "afterInteractive" ? 2 : e === "idle" ? 3 : 4;
301
+ }
302
+ const ue = "data-demiurge-structured-data";
303
+ function de(e) {
304
+ if (e.body) {
305
+ const { html: t, ...r } = e.body, { prefix: n, suffix: o } = le({ ...e, body: r });
306
+ return `${n}${t}${o}`;
307
+ }
308
+ return fe(e);
309
+ }
310
+ function le({
311
+ body: e,
312
+ entrySrc: t,
313
+ lang: r = "en",
314
+ links: n = [],
315
+ metadata: o,
316
+ nonce: s,
317
+ scripts: c = [],
318
+ styles: $ = [],
319
+ title: w = "Demiurge App"
320
+ }) {
321
+ const g = o?.title ?? w, l = [
322
+ ...c.filter((S) => S[u] !== "hoisted").map((S) => ` ${E(S, s)}`),
323
+ ye(e.data, e.navigation),
324
+ ...t ? [T(t, s)] : []
325
+ ].join(`
326
+ `);
327
+ return {
328
+ prefix: `<!doctype html>
329
+ <html lang="${a(r)}">
330
+ <head>
331
+ ${U({ links: n, metadata: o, nonce: s, scripts: c, styles: $, title: g })}
332
+ </head>
333
+ <body>
334
+ ${me(e)}`,
335
+ suffix: `</div>
336
+ ${l}
337
+ </body>
338
+ </html>
339
+ `
340
+ };
341
+ }
342
+ function fe({
343
+ entrySrc: e,
344
+ lang: t = "en",
345
+ links: r = [],
346
+ metadata: n,
347
+ nonce: o,
348
+ scripts: s = [],
349
+ styles: c = [],
350
+ title: $ = "Demiurge App"
351
+ }) {
352
+ const w = n?.title ?? $, g = [
353
+ pe(),
354
+ ...s.filter((l) => l[u] !== "hoisted").map((l) => ` ${E(l, o)}`),
355
+ ...e ? [T(e, o)] : []
356
+ ].join(`
357
+ `);
358
+ return `<!doctype html>
359
+ <html lang="${a(t)}">
360
+ <head>
361
+ ${U({ links: r, metadata: n, nonce: o, scripts: s, styles: c, title: w })}
362
+ </head>
363
+ <body>
364
+ ${g}
365
+ </body>
366
+ </html>
367
+ `;
368
+ }
369
+ function pe(e) {
370
+ return ' <div id="root"></div>';
371
+ }
372
+ function me(e) {
373
+ const t = e.fallback ? ` ${H}="${a(e.fallback)}"` : "";
374
+ return ` <div id="root" ${G}=""${t}>`;
375
+ }
376
+ function ye(e, t) {
377
+ return ` <template id="${x}">${W(e, { navigation: t })}</template>`;
378
+ }
379
+ function T(e, t) {
380
+ return ` <script type="module" src="${a(e)}"${i("nonce", t)}><\/script>`;
381
+ }
382
+ function U({
383
+ links: e,
384
+ metadata: t,
385
+ nonce: r,
386
+ scripts: n,
387
+ styles: o,
388
+ title: s
389
+ }) {
390
+ return [
391
+ d({
392
+ content: t?.charset ?? "UTF-8",
393
+ name: "charset"
394
+ }),
395
+ d({
396
+ content: t?.viewport ?? "width=device-width, initial-scale=1.0",
397
+ name: "viewport"
398
+ }),
399
+ ` <title>${a(s)}</title>`,
400
+ ...t?.description ? [
401
+ d({
402
+ content: t.description,
403
+ name: "description"
404
+ })
405
+ ] : [],
406
+ ...t?.canonical ? [
407
+ b({
408
+ href: t.canonical,
409
+ rel: "canonical"
410
+ })
411
+ ] : [],
412
+ ...he(t),
413
+ ...$e(t),
414
+ ...(t?.custom ?? []).map(we),
415
+ ...(t?.structuredData ?? []).map(
416
+ (c) => ge(c, r)
417
+ ),
418
+ ...o.map(
419
+ (c) => ` <link rel="stylesheet" href="${a(c)}" />`
420
+ ),
421
+ ...e.map(b),
422
+ ...n.filter((c) => c[u] === "hoisted").map((c) => ` ${E(c, r)}`)
423
+ ].join(`
424
+ `);
425
+ }
426
+ function he(e) {
427
+ if (!e?.robots)
428
+ return [];
429
+ const t = [
430
+ e.robots.index === !1 ? "noindex" : "index",
431
+ e.robots.follow === !1 ? "nofollow" : "follow"
432
+ ];
433
+ return [
434
+ d({
435
+ content: t.join(", "),
436
+ name: "robots"
437
+ })
438
+ ];
439
+ }
440
+ function $e(e) {
441
+ return e?.openGraph ? [
442
+ e.openGraph.title ? d({
443
+ content: e.openGraph.title,
444
+ property: "og:title"
445
+ }) : null,
446
+ e.openGraph.description ? d({
447
+ content: e.openGraph.description,
448
+ property: "og:description"
449
+ }) : null,
450
+ e.openGraph.image ? d({
451
+ content: e.openGraph.image,
452
+ property: "og:image"
453
+ }) : null
454
+ ].filter((t) => !!t) : [];
455
+ }
456
+ function we(e) {
457
+ return e.kind === "link" ? b(e) : d(e);
458
+ }
459
+ function ge(e, t) {
460
+ return ` <script type="application/ld+json"${t ? "" : ` ${ue}`}${i("nonce", t)}>${Ae(JSON.stringify(e.value))}<\/script>`;
461
+ }
462
+ function d(e) {
463
+ if (e.name === "charset")
464
+ return ` <meta charset="${a(e.content)}" />`;
465
+ const t = e.name ? ` name="${a(e.name)}"` : "", r = e.property ? ` property="${a(e.property)}"` : "";
466
+ return ` <meta${t}${r} content="${a(e.content)}" />`;
467
+ }
468
+ function b(e) {
469
+ return ` <link${i("rel", e.rel)}${i("href", e.href)}${i("as", e.as)}${i("type", e.type)}${i("crossorigin", e.crossOrigin)}${i("hreflang", e.hrefLang)} />`;
470
+ }
471
+ function E(e, t) {
472
+ return A(e.strategy) ? Se(e, t) : `<script${i("id", e.id)}${i("src", e.src)}${i("type", e.type ?? be(e.strategy))}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i("data-demiurge-script-placement", e[u])}${I("async", e.async)}${I("defer", e.defer)}><\/script>`;
473
+ }
474
+ function Se(e, t) {
475
+ return `<script${i("id", e.id)}${i("type", O)}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i(p, e.strategy)}${i(y, e.src)}${i(h, e.type)}${i("data-demiurge-script-placement", e[u])}><\/script>`;
476
+ }
477
+ function be(e) {
478
+ return e === "module" ? "module" : void 0;
479
+ }
480
+ function i(e, t) {
481
+ return t ? ` ${e}="${a(t)}"` : "";
482
+ }
483
+ function I(e, t) {
484
+ return t ? ` ${e}` : "";
485
+ }
486
+ function a(e) {
487
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
488
+ }
489
+ function Ae(e) {
490
+ return e.replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
491
+ }
492
+ function Ue(e) {
493
+ return e;
494
+ }
495
+ function Ne(e, t = {}) {
496
+ return {
497
+ ...t,
498
+ href: e,
499
+ kind: "link",
500
+ rel: "preconnect"
501
+ };
502
+ }
503
+ function Le(e, t) {
504
+ return {
505
+ ...t,
506
+ href: e,
507
+ kind: "link",
508
+ rel: "preload"
509
+ };
510
+ }
511
+ function qe(e) {
512
+ return {
513
+ href: e,
514
+ kind: "link",
515
+ rel: "modulepreload"
516
+ };
517
+ }
518
+ async function je(e, t) {
519
+ const r = [];
520
+ for (const n of e) {
521
+ if (!n)
522
+ continue;
523
+ const o = typeof n == "function" ? await n(t) : n;
524
+ r.push(...o);
525
+ }
526
+ return Ee(r).sort(Re);
527
+ }
528
+ function Ee(e) {
529
+ const t = /* @__PURE__ */ new Map();
530
+ for (const r of e)
531
+ t.set(C(r), {
532
+ ...t.get(C(r)),
533
+ ...r
534
+ });
535
+ return [...t.values()];
536
+ }
537
+ function C(e) {
538
+ return [
539
+ e.rel,
540
+ e.href,
541
+ e.as ?? "",
542
+ e.type ?? "",
543
+ e.crossOrigin ?? ""
544
+ ].join("\0");
545
+ }
546
+ function Re(e, t) {
547
+ return _(e.rel) - _(t.rel) || e.href.localeCompare(t.href);
548
+ }
549
+ function _(e) {
550
+ return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
551
+ }
552
+ function ve(e, t) {
553
+ const r = f(e.page, {
554
+ data: e.data,
555
+ path: e.path,
556
+ pathname: e.pathname
557
+ }), n = e.layouts.reduceRight(
558
+ (o, s) => f(s, {
559
+ children: o,
560
+ path: e.path,
561
+ pathname: e.pathname
562
+ }),
563
+ r
564
+ );
565
+ return t ? ie(t, n) : n;
566
+ }
567
+ function De(e, t = {}) {
568
+ return te({
569
+ dev: t.dev,
570
+ nonce: t.nonce,
571
+ scripts: e.scripts
572
+ });
573
+ }
574
+ function ke(e, t = {}) {
575
+ const r = De(e, t), n = N(ve(e, r));
576
+ return de({
577
+ body: {
578
+ data: e.data,
579
+ html: n,
580
+ navigation: e.render.mode === "static" ? "document" : t.navigation
581
+ },
582
+ entrySrc: t.clientEntry,
583
+ lang: t.lang,
584
+ links: e.links,
585
+ metadata: e.metadata,
586
+ nonce: t.nonce,
587
+ scripts: r.scripts(),
588
+ styles: t.styles,
589
+ title: t.title
590
+ });
591
+ }
592
+ function Fe(e, t = {}) {
593
+ const r = ke(e, t);
594
+ return new Response(r, {
595
+ headers: {
596
+ "content-type": "text/html; charset=utf-8"
597
+ }
598
+ });
599
+ }
600
+ const m = /* @__PURE__ */ new WeakMap();
601
+ function Je(e) {
602
+ return m.get(e);
603
+ }
604
+ function Ge(e, t) {
605
+ m.set(e, t);
606
+ }
607
+ function He(e, t) {
608
+ const r = m.get(e);
609
+ r && m.set(t, r);
610
+ }
611
+ export {
612
+ He as A,
613
+ G as H,
614
+ ue as S,
615
+ Fe as a,
616
+ ve as b,
617
+ De as c,
618
+ _e as d,
619
+ de as e,
620
+ ke as f,
621
+ Oe as g,
622
+ V as h,
623
+ H as i,
624
+ oe as j,
625
+ Be as k,
626
+ xe as l,
627
+ J as m,
628
+ Ue as n,
629
+ Me as o,
630
+ Le as p,
631
+ Pe as q,
632
+ le as r,
633
+ Ge as s,
634
+ qe as t,
635
+ Ne as u,
636
+ je as v,
637
+ Te as w,
638
+ te as x,
639
+ ie as y,
640
+ Je as z
641
+ };
642
+ //# sourceMappingURL=request-metadata-D5NrT8ks.js.map