@demiurgejs/core 0.2.0-beta.3 → 0.2.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -11
- package/bin/demiurge.mjs +47 -13
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/browser/file-router.d.ts +388 -5
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/browser/focus.d.ts +20 -0
- package/dist/browser/focus.d.ts.map +1 -0
- package/dist/browser/index.d.ts +7 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/mutation-action.d.ts +81 -0
- package/dist/browser/mutation-action.d.ts.map +1 -0
- package/dist/chunks/document-shell-9GPwtcTt.js +36 -0
- package/dist/chunks/document-shell-9GPwtcTt.js.map +1 -0
- package/dist/chunks/{image-codec-Di53WpcH.js → image-codec-Dh1POFhE.js} +2 -2
- package/dist/chunks/{image-codec-Di53WpcH.js.map → image-codec-Dh1POFhE.js.map} +1 -1
- package/dist/chunks/{images-Edar3eU1.js → images-CG7ZzayG.js} +99 -91
- package/dist/chunks/images-CG7ZzayG.js.map +1 -0
- package/dist/chunks/index-0MNiR_wo.js +833 -0
- package/dist/chunks/index-0MNiR_wo.js.map +1 -0
- package/dist/chunks/manifest-vO6c0G0W.js +19 -0
- package/dist/chunks/manifest-vO6c0G0W.js.map +1 -0
- package/dist/chunks/plugin-BZauDxRY.js +2310 -0
- package/dist/chunks/plugin-BZauDxRY.js.map +1 -0
- package/dist/chunks/session-store-ChModVcq.js +92 -0
- package/dist/chunks/session-store-ChModVcq.js.map +1 -0
- package/dist/chunks/static-files-ehaD1kE7.js +51 -0
- package/dist/chunks/static-files-ehaD1kE7.js.map +1 -0
- package/dist/chunks/streaming-GYIsVTQH.js +560 -0
- package/dist/chunks/streaming-GYIsVTQH.js.map +1 -0
- package/dist/chunks/testing-CUwGj2ie.js +4751 -0
- package/dist/chunks/testing-CUwGj2ie.js.map +1 -0
- package/dist/chunks/vite-QoqrGl6f.js +259 -0
- package/dist/chunks/vite-QoqrGl6f.js.map +1 -0
- package/dist/cli.d.ts +19 -25
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +289 -128
- package/dist/cli.js.map +1 -1
- package/dist/config/define.d.ts +3 -0
- package/dist/config/define.d.ts.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +78 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +12 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/types.d.ts +74 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/validate.d.ts +9 -0
- package/dist/config/validate.d.ts.map +1 -0
- package/dist/config/vite.d.ts +12 -0
- package/dist/config/vite.d.ts.map +1 -0
- package/dist/data/cache.d.ts +2 -0
- package/dist/data/cache.d.ts.map +1 -1
- package/dist/data/idempotency.d.ts.map +1 -1
- package/dist/deployment/testing.d.ts +25 -0
- package/dist/deployment/testing.d.ts.map +1 -0
- package/dist/deployment/testing.js +171 -0
- package/dist/deployment/testing.js.map +1 -0
- package/dist/document/hydration.d.ts +9 -0
- package/dist/document/hydration.d.ts.map +1 -1
- package/dist/document/index.d.ts +4 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/metadata.d.ts +8 -0
- package/dist/document/metadata.d.ts.map +1 -1
- package/dist/document/navigation.d.ts +28 -0
- package/dist/document/navigation.d.ts.map +1 -0
- package/dist/document/render.d.ts +3 -1
- package/dist/document/render.d.ts.map +1 -1
- package/dist/document/seo.d.ts.map +1 -1
- package/dist/edge/assets.d.ts.map +1 -1
- package/dist/edge/index.js +55 -73
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1883 -692
- package/dist/index.js.map +1 -1
- package/dist/inspect/command.d.ts +28 -0
- package/dist/inspect/command.d.ts.map +1 -0
- package/dist/inspect/index.d.ts +9 -0
- package/dist/inspect/index.d.ts.map +1 -0
- package/dist/inspect/redact.d.ts +35 -0
- package/dist/inspect/redact.d.ts.map +1 -0
- package/dist/inspect/report.d.ts +24 -0
- package/dist/inspect/report.d.ts.map +1 -0
- package/dist/inspect/types.d.ts +102 -0
- package/dist/inspect/types.d.ts.map +1 -0
- package/dist/internal/testing.js +5 -5
- package/dist/kv/index.d.ts +2 -0
- package/dist/kv/index.d.ts.map +1 -1
- package/dist/kv/index.js +170 -73
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/session-store.d.ts +20 -0
- package/dist/kv/session-store.d.ts.map +1 -0
- package/dist/manifest.d.ts +10 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/node/http.d.ts +5 -0
- package/dist/node/http.d.ts.map +1 -1
- package/dist/node/image.d.ts.map +1 -1
- package/dist/node/index.d.ts +4 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +257 -182
- package/dist/node/index.js.map +1 -1
- package/dist/node/serve.d.ts +47 -0
- package/dist/node/serve.d.ts.map +1 -0
- package/dist/node/static.d.ts.map +1 -1
- package/dist/platform/fonts.d.ts.map +1 -1
- package/dist/platform/image-url.d.ts.map +1 -1
- package/dist/platform/url.d.ts +19 -0
- package/dist/platform/url.d.ts.map +1 -0
- package/dist/platform/web-vitals.d.ts.map +1 -1
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +186 -69
- package/dist/redis/index.js.map +1 -1
- package/dist/redis/session-store.d.ts +9 -0
- package/dist/redis/session-store.d.ts.map +1 -0
- package/dist/route/index.d.ts +3 -2
- package/dist/route/index.d.ts.map +1 -1
- package/dist/route/mutation.d.ts +97 -0
- package/dist/route/mutation.d.ts.map +1 -0
- package/dist/route/serialization.d.ts +24 -0
- package/dist/route/serialization.d.ts.map +1 -0
- package/dist/route/types.d.ts +6 -1
- package/dist/route/types.d.ts.map +1 -1
- package/dist/route/webhook.d.ts +6 -1
- package/dist/route/webhook.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +8 -0
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/router/navigation-data.d.ts +9 -1
- package/dist/router/navigation-data.d.ts.map +1 -1
- package/dist/routing/generate.d.ts +3 -0
- package/dist/routing/generate.d.ts.map +1 -1
- package/dist/routing/index.d.ts +3 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/locale.d.ts +43 -0
- package/dist/routing/locale.d.ts.map +1 -0
- package/dist/routing/types.d.ts +12 -0
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/security/audit.d.ts +2 -1
- package/dist/security/audit.d.ts.map +1 -1
- package/dist/security/authorization.d.ts +36 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/cookie-session.d.ts +43 -0
- package/dist/security/cookie-session.d.ts.map +1 -0
- package/dist/security/csrf.d.ts +1 -1
- package/dist/security/csrf.d.ts.map +1 -1
- package/dist/security/env-startup.d.ts +13 -0
- package/dist/security/env-startup.d.ts.map +1 -0
- package/dist/security/env.d.ts +49 -11
- package/dist/security/env.d.ts.map +1 -1
- package/dist/security/exceptions.d.ts +29 -0
- package/dist/security/exceptions.d.ts.map +1 -0
- package/dist/security/finding-codes.d.ts +56 -0
- package/dist/security/finding-codes.d.ts.map +1 -0
- package/dist/security/index.d.ts +14 -3
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts +2 -5
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/report.d.ts +2 -1
- package/dist/security/report.d.ts.map +1 -1
- package/dist/security/request.d.ts +1 -0
- package/dist/security/request.d.ts.map +1 -1
- package/dist/security/session-manager.d.ts +32 -0
- package/dist/security/session-manager.d.ts.map +1 -0
- package/dist/security/session-store.d.ts +51 -0
- package/dist/security/session-store.d.ts.map +1 -0
- package/dist/security/testing.d.ts +10 -0
- package/dist/security/testing.d.ts.map +1 -0
- package/dist/security/testing.js +145 -0
- package/dist/security/testing.js.map +1 -0
- package/dist/security/types.d.ts +139 -5
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/upload.d.ts +3 -3
- package/dist/security/upload.d.ts.map +1 -1
- package/dist/security/verification.d.ts.map +1 -1
- package/dist/server/document-shell.d.ts.map +1 -1
- package/dist/server/errors.d.ts +1 -0
- package/dist/server/errors.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/not-found.d.ts +1 -0
- package/dist/server/not-found.d.ts.map +1 -1
- package/dist/server/render-tree.d.ts.map +1 -1
- package/dist/server/request-handler.d.ts +7 -2
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/server/request-metadata.d.ts +1 -0
- package/dist/server/request-metadata.d.ts.map +1 -1
- package/dist/server/ssr.d.ts +2 -0
- package/dist/server/ssr.d.ts.map +1 -1
- package/dist/server-only/browser.d.ts +2 -0
- package/dist/server-only/browser.d.ts.map +1 -0
- package/dist/server-only/browser.js +4 -0
- package/dist/server-only/browser.js.map +1 -0
- package/dist/server-only/index.d.ts +2 -0
- package/dist/server-only/index.d.ts.map +1 -0
- package/dist/server-only/index.js +2 -0
- package/dist/server-only/index.js.map +1 -0
- package/dist/static/index.d.ts +2 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +380 -363
- package/dist/static/index.js.map +1 -1
- package/dist/static/preview.d.ts.map +1 -1
- package/dist/static/vercel.d.ts +11 -2
- package/dist/static/vercel.d.ts.map +1 -1
- package/dist/static-files.d.ts +12 -0
- package/dist/static-files.d.ts.map +1 -1
- package/dist/type-guards.d.ts +19 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/vite/env-boundary.d.ts +14 -0
- package/dist/vite/env-boundary.d.ts.map +1 -0
- package/dist/vite/index.d.ts +13 -6
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +29 -1560
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +24 -3
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/policy-verification.d.ts +33 -2
- package/dist/vite/policy-verification.d.ts.map +1 -1
- package/dist/vite/route-audit.d.ts +14 -2
- package/dist/vite/route-audit.d.ts.map +1 -1
- package/dist/vite/server-only-boundary.d.ts +8 -0
- package/dist/vite/server-only-boundary.d.ts.map +1 -0
- package/package.json +24 -6
- package/dist/chunks/document-shell-WoM8yZlR.js +0 -35
- package/dist/chunks/document-shell-WoM8yZlR.js.map +0 -1
- package/dist/chunks/images-Edar3eU1.js.map +0 -1
- package/dist/chunks/request-metadata-DaIYq4Ea.js +0 -677
- package/dist/chunks/request-metadata-DaIYq4Ea.js.map +0 -1
- package/dist/chunks/static-files-DUjHw-4H.js +0 -11
- package/dist/chunks/static-files-DUjHw-4H.js.map +0 -1
- package/dist/chunks/streaming-D0fGAuiO.js +0 -469
- package/dist/chunks/streaming-D0fGAuiO.js.map +0 -1
- package/dist/chunks/testing-CRflAw4X.js +0 -3475
- package/dist/chunks/testing-CRflAw4X.js.map +0 -1
- package/dist/route/action.d.ts +0 -33
- package/dist/route/action.d.ts.map +0 -1
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
import { renderToString as ee } from "react-dom/server";
|
|
2
|
+
import { createContext as te, useContext as ne, useEffect as re, createElement as g } from "react";
|
|
3
|
+
const F = "__demiurge_data", ie = "data-demiurge-hydrate", oe = "data-demiurge-fallback";
|
|
4
|
+
function ce(e, t = {}) {
|
|
5
|
+
return ae(
|
|
6
|
+
JSON.stringify({ data: e, hasData: !0, ...t })
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
function nt(e) {
|
|
10
|
+
const t = e.getElementById(F), n = t?.tagName === "TEMPLATE" ? t.content.textContent : t?.textContent;
|
|
11
|
+
if (n)
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(n);
|
|
14
|
+
} catch (r) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
"Demiurge could not parse the initial route data payload.",
|
|
17
|
+
{ cause: r }
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function ae(e) {
|
|
22
|
+
return e.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
23
|
+
}
|
|
24
|
+
const T = "demiurge", N = /* @__PURE__ */ new WeakMap();
|
|
25
|
+
function C(e, t) {
|
|
26
|
+
return se(e)?.createScriptURL(t) ?? t;
|
|
27
|
+
}
|
|
28
|
+
function se(e) {
|
|
29
|
+
if (!e)
|
|
30
|
+
return null;
|
|
31
|
+
const t = N.get(e);
|
|
32
|
+
if (t !== void 0)
|
|
33
|
+
return t;
|
|
34
|
+
const n = ue(e);
|
|
35
|
+
return N.set(e, n), n;
|
|
36
|
+
}
|
|
37
|
+
function ue(e) {
|
|
38
|
+
const t = e.trustedTypes;
|
|
39
|
+
if (!t || typeof t.createPolicy != "function")
|
|
40
|
+
return null;
|
|
41
|
+
try {
|
|
42
|
+
return t.createPolicy(T, {
|
|
43
|
+
// The framework passes only a URL that the server rendered into its own
|
|
44
|
+
// placeholder attribute. `script-src` and `worker-src` still govern that
|
|
45
|
+
// URL, so this policy adds a type without widening the source rules.
|
|
46
|
+
createScriptURL: (n) => n
|
|
47
|
+
});
|
|
48
|
+
} catch (n) {
|
|
49
|
+
return console.error(
|
|
50
|
+
`Demiurge could not create the ${JSON.stringify(T)} Trusted Types policy. Add ${JSON.stringify(T)} to the document trusted-types directive.`,
|
|
51
|
+
n
|
|
52
|
+
), null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const E = "text/demiurge-script", f = "data-demiurge-script", p = "data-demiurge-script-src", A = "data-demiurge-script-type", P = "data-demiurge-script-started", de = 2e3, le = [
|
|
56
|
+
"data-api",
|
|
57
|
+
"data-demiurge-script-placement",
|
|
58
|
+
"data-domain",
|
|
59
|
+
"id",
|
|
60
|
+
"integrity",
|
|
61
|
+
"referrerpolicy"
|
|
62
|
+
], j = /* @__PURE__ */ new Map();
|
|
63
|
+
function S(e) {
|
|
64
|
+
return e === "idle" || e === "worker";
|
|
65
|
+
}
|
|
66
|
+
function J(e) {
|
|
67
|
+
const t = e ?? (typeof document > "u" ? void 0 : document);
|
|
68
|
+
if (!t)
|
|
69
|
+
return;
|
|
70
|
+
const n = t.querySelectorAll(
|
|
71
|
+
`script[${f}]:not([${P}])`
|
|
72
|
+
);
|
|
73
|
+
for (const r of [...n]) {
|
|
74
|
+
const i = r.getAttribute(f);
|
|
75
|
+
if (!(i !== "idle" && i !== "worker")) {
|
|
76
|
+
if (r.setAttribute(P, ""), i === "worker") {
|
|
77
|
+
ye(r);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
fe(r, () => pe(r));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function rt(e) {
|
|
85
|
+
return j.get(e);
|
|
86
|
+
}
|
|
87
|
+
function fe(e, t) {
|
|
88
|
+
const n = e.ownerDocument.defaultView;
|
|
89
|
+
if (n && typeof n.requestIdleCallback == "function") {
|
|
90
|
+
n.requestIdleCallback(() => t(), { timeout: de });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
(n ?? globalThis).setTimeout(t, 1);
|
|
94
|
+
}
|
|
95
|
+
function pe(e) {
|
|
96
|
+
const t = e.ownerDocument, n = e.getAttribute(p);
|
|
97
|
+
if (!n)
|
|
98
|
+
return;
|
|
99
|
+
const r = t.createElement("script"), i = e.getAttribute(A);
|
|
100
|
+
for (const a of le) {
|
|
101
|
+
const c = e.getAttribute(a);
|
|
102
|
+
c !== null && r.setAttribute(a, c);
|
|
103
|
+
}
|
|
104
|
+
e.removeAttribute("id"), i && (r.type = i), r.async = !0, r.nonce = e.nonce, r.src = C(t.defaultView, n), t.head.appendChild(r);
|
|
105
|
+
}
|
|
106
|
+
function ye(e) {
|
|
107
|
+
const t = e.getAttribute(p), n = e.ownerDocument.defaultView;
|
|
108
|
+
if (!t)
|
|
109
|
+
return;
|
|
110
|
+
if (!n || typeof n.Worker != "function") {
|
|
111
|
+
console.error(
|
|
112
|
+
`Demiurge could not start the worker script ${JSON.stringify(t)}. This runtime has no Worker constructor.`
|
|
113
|
+
);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const r = e.getAttribute(A);
|
|
117
|
+
try {
|
|
118
|
+
j.set(
|
|
119
|
+
t,
|
|
120
|
+
new n.Worker(C(n, t), {
|
|
121
|
+
type: r === "module" ? "module" : "classic"
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
} catch (i) {
|
|
125
|
+
console.error(
|
|
126
|
+
`Demiurge could not start the worker script ${JSON.stringify(t)}.`,
|
|
127
|
+
i
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function it(e) {
|
|
132
|
+
return e;
|
|
133
|
+
}
|
|
134
|
+
function ot(e, t = {}) {
|
|
135
|
+
return {
|
|
136
|
+
...t,
|
|
137
|
+
href: e,
|
|
138
|
+
kind: "link",
|
|
139
|
+
rel: "preconnect"
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function ct(e, t) {
|
|
143
|
+
return {
|
|
144
|
+
...t,
|
|
145
|
+
href: e,
|
|
146
|
+
kind: "link",
|
|
147
|
+
rel: "preload"
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function at(e) {
|
|
151
|
+
return {
|
|
152
|
+
href: e,
|
|
153
|
+
kind: "link",
|
|
154
|
+
rel: "modulepreload"
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async function st(e, t) {
|
|
158
|
+
const n = [];
|
|
159
|
+
for (const r of e) {
|
|
160
|
+
if (!r)
|
|
161
|
+
continue;
|
|
162
|
+
const i = typeof r == "function" ? await r(t) : r;
|
|
163
|
+
n.push(...i);
|
|
164
|
+
}
|
|
165
|
+
return me(n).sort(ge);
|
|
166
|
+
}
|
|
167
|
+
function me(e) {
|
|
168
|
+
const t = /* @__PURE__ */ new Map();
|
|
169
|
+
for (const n of e)
|
|
170
|
+
t.set(U(n), {
|
|
171
|
+
...t.get(U(n)),
|
|
172
|
+
...n
|
|
173
|
+
});
|
|
174
|
+
return [...t.values()];
|
|
175
|
+
}
|
|
176
|
+
function U(e) {
|
|
177
|
+
return [
|
|
178
|
+
e.rel,
|
|
179
|
+
e.href,
|
|
180
|
+
e.as ?? "",
|
|
181
|
+
e.type ?? "",
|
|
182
|
+
e.crossOrigin ?? ""
|
|
183
|
+
].join("\0");
|
|
184
|
+
}
|
|
185
|
+
function ge(e, t) {
|
|
186
|
+
return M(e.rel) - M(t.rel) || e.href.localeCompare(t.href);
|
|
187
|
+
}
|
|
188
|
+
function M(e) {
|
|
189
|
+
return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
|
|
190
|
+
}
|
|
191
|
+
const l = "data-demiurge-document-contribution", b = "data-demiurge-script-strategy", m = "data-demiurge-navigation-status", Y = "__demiurge_navigation_status", V = "data-demiurge-navigation-status-style", he = "demiurge-navigation-status", Ae = ".demiurge-navigation-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}";
|
|
192
|
+
function ut(e) {
|
|
193
|
+
const t = typeof document > "u" ? void 0 : document;
|
|
194
|
+
if (!t || t.querySelector(`[${m}]`))
|
|
195
|
+
return t?.querySelector(`[${m}]`);
|
|
196
|
+
const n = t.createElement("style");
|
|
197
|
+
n.setAttribute(V, ""), n.textContent = Ae;
|
|
198
|
+
const r = [...t.scripts].reverse().find((a) => a.nonce)?.nonce;
|
|
199
|
+
r && (n.nonce = r), t.head.append(n);
|
|
200
|
+
const i = t.createElement("div");
|
|
201
|
+
return i.id = Y, i.setAttribute(m, ""), i.className = he, i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), t.body.prepend(i), i;
|
|
202
|
+
}
|
|
203
|
+
function dt(e, t) {
|
|
204
|
+
const r = (typeof document > "u" ? void 0 : document)?.querySelector(
|
|
205
|
+
`[${m}]`
|
|
206
|
+
);
|
|
207
|
+
r && (r.textContent = e);
|
|
208
|
+
}
|
|
209
|
+
function lt(e) {
|
|
210
|
+
return {
|
|
211
|
+
dir: e.dir,
|
|
212
|
+
lang: e.lang,
|
|
213
|
+
links: [...e.links ?? []],
|
|
214
|
+
metadata: e.metadata,
|
|
215
|
+
scripts: (e.scripts ?? []).map(Se),
|
|
216
|
+
title: e.metadata.title ?? e.title ?? "Demiurge App"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function Se(e) {
|
|
220
|
+
return {
|
|
221
|
+
async: e.async,
|
|
222
|
+
crossOrigin: e.crossOrigin,
|
|
223
|
+
dataApi: e.dataApi,
|
|
224
|
+
dataDomain: e.dataDomain,
|
|
225
|
+
defer: e.defer,
|
|
226
|
+
id: e.id,
|
|
227
|
+
integrity: e.integrity,
|
|
228
|
+
kind: "script",
|
|
229
|
+
referrerPolicy: e.referrerPolicy,
|
|
230
|
+
src: e.src,
|
|
231
|
+
strategy: e.strategy,
|
|
232
|
+
type: e.type
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function ft(e, t) {
|
|
236
|
+
const n = typeof document > "u" ? void 0 : document;
|
|
237
|
+
if (n) {
|
|
238
|
+
n.title = e.title, e.lang && (n.documentElement.lang = e.lang), e.dir && (n.documentElement.dir = e.dir), ve(n, e.scripts);
|
|
239
|
+
for (const r of n.head.querySelectorAll(
|
|
240
|
+
`[${l}]:not(script)`
|
|
241
|
+
))
|
|
242
|
+
r.remove();
|
|
243
|
+
$e(n, e.metadata);
|
|
244
|
+
for (const r of e.links)
|
|
245
|
+
n.head.append(_(n, r));
|
|
246
|
+
J(n);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function $e(e, t) {
|
|
250
|
+
t.description && e.head.append(v(e, {
|
|
251
|
+
content: t.description,
|
|
252
|
+
name: "description"
|
|
253
|
+
})), t.canonical && e.head.append(_(e, {
|
|
254
|
+
href: t.canonical,
|
|
255
|
+
rel: "canonical"
|
|
256
|
+
})), t.robots && e.head.append(v(e, {
|
|
257
|
+
content: [
|
|
258
|
+
t.robots.index === !1 ? "noindex" : "index",
|
|
259
|
+
t.robots.follow === !1 ? "nofollow" : "follow"
|
|
260
|
+
].join(", "),
|
|
261
|
+
name: "robots"
|
|
262
|
+
}));
|
|
263
|
+
const n = t.openGraph;
|
|
264
|
+
for (const [r, i] of [
|
|
265
|
+
["og:title", n?.title],
|
|
266
|
+
["og:description", n?.description],
|
|
267
|
+
["og:image", n?.image]
|
|
268
|
+
])
|
|
269
|
+
i && e.head.append(v(e, { content: i, property: r }));
|
|
270
|
+
for (const r of t.custom)
|
|
271
|
+
e.head.append(
|
|
272
|
+
r.kind === "link" ? _(e, r) : v(e, r)
|
|
273
|
+
);
|
|
274
|
+
for (const r of t.structuredData) {
|
|
275
|
+
const i = e.createElement("script");
|
|
276
|
+
i.type = "application/ld+json", i.textContent = JSON.stringify(r.value), w(i), W(i, e), e.head.append(i);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function v(e, t) {
|
|
280
|
+
const n = e.createElement("meta");
|
|
281
|
+
return n.content = t.content, t.name && (n.name = t.name), t.property && n.setAttribute("property", t.property), w(n), n;
|
|
282
|
+
}
|
|
283
|
+
function _(e, t) {
|
|
284
|
+
const n = e.createElement("link");
|
|
285
|
+
return n.rel = t.rel, n.href = t.href, t.as && (n.as = t.as), t.type && (n.type = t.type), t.crossOrigin && (n.crossOrigin = t.crossOrigin), t.hrefLang && (n.hreflang = t.hrefLang), w(n), n;
|
|
286
|
+
}
|
|
287
|
+
function ve(e, t) {
|
|
288
|
+
const n = /* @__PURE__ */ new Map();
|
|
289
|
+
for (const r of e.querySelectorAll(
|
|
290
|
+
`script[${l}]`
|
|
291
|
+
))
|
|
292
|
+
n.set(be(r), r);
|
|
293
|
+
for (const r of t) {
|
|
294
|
+
const i = we(r);
|
|
295
|
+
n.delete(i) || e.head.append(Ee(e, r));
|
|
296
|
+
}
|
|
297
|
+
for (const r of n.values())
|
|
298
|
+
r.remove();
|
|
299
|
+
}
|
|
300
|
+
function Ee(e, t) {
|
|
301
|
+
const n = e.createElement("script");
|
|
302
|
+
return w(n), n.setAttribute(b, t.strategy), W(n, e), t.id && (n.id = t.id), t.integrity && (n.integrity = t.integrity), t.crossOrigin && (n.crossOrigin = t.crossOrigin), t.referrerPolicy && (n.referrerPolicy = t.referrerPolicy), t.dataApi && (n.dataset.api = t.dataApi), t.dataDomain && (n.dataset.domain = t.dataDomain), S(t.strategy) ? (n.type = E, n.setAttribute(f, t.strategy), n.setAttribute(p, t.src), t.type && n.setAttribute(A, t.type), n) : (n.async = t.async ?? !1, n.defer = t.defer ?? !1, n.type = t.type ?? H(t.strategy), n.src = C(e.defaultView, t.src), n);
|
|
303
|
+
}
|
|
304
|
+
function W(e, t) {
|
|
305
|
+
const n = [...t.scripts].reverse().find((r) => r.nonce)?.nonce;
|
|
306
|
+
n && (e.nonce = n);
|
|
307
|
+
}
|
|
308
|
+
function w(e) {
|
|
309
|
+
e.setAttribute(l, "");
|
|
310
|
+
}
|
|
311
|
+
function be(e) {
|
|
312
|
+
const t = e.getAttribute(b) ?? e.getAttribute(f) ?? Re(e);
|
|
313
|
+
return [e.getAttribute(p) ?? e.getAttribute("src") ?? "", e.getAttribute("type") ?? "", e.integrity, t].join("\0");
|
|
314
|
+
}
|
|
315
|
+
function we(e) {
|
|
316
|
+
const t = S(e.strategy) ? E : e.type ?? H(e.strategy);
|
|
317
|
+
return [e.src, t, e.integrity ?? "", e.strategy].join("\0");
|
|
318
|
+
}
|
|
319
|
+
function Re(e) {
|
|
320
|
+
return e.type === "module" ? "module" : "afterInteractive";
|
|
321
|
+
}
|
|
322
|
+
function H(e) {
|
|
323
|
+
return e === "module" ? "module" : "";
|
|
324
|
+
}
|
|
325
|
+
const ke = /* @__PURE__ */ new Set([
|
|
326
|
+
"afterInteractive",
|
|
327
|
+
"beforeInteractive",
|
|
328
|
+
"idle",
|
|
329
|
+
"module",
|
|
330
|
+
"worker"
|
|
331
|
+
]), u = Symbol("demiurge.scriptPlacement"), K = te(
|
|
332
|
+
void 0
|
|
333
|
+
);
|
|
334
|
+
function De(e = {}) {
|
|
335
|
+
let t = !1;
|
|
336
|
+
const n = [...e.scripts ?? []], r = new Set(n.map((c) => c.src)), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
337
|
+
return {
|
|
338
|
+
get dev() {
|
|
339
|
+
return e.dev ?? !1;
|
|
340
|
+
},
|
|
341
|
+
get headFlushed() {
|
|
342
|
+
return t;
|
|
343
|
+
},
|
|
344
|
+
flushHead() {
|
|
345
|
+
t = !0;
|
|
346
|
+
},
|
|
347
|
+
nonce: e.nonce,
|
|
348
|
+
register(c) {
|
|
349
|
+
if (r.has(c.src) || i.has(c.src))
|
|
350
|
+
return "skip";
|
|
351
|
+
if (i.add(c.src), !t)
|
|
352
|
+
return a.set(c.src, {
|
|
353
|
+
...c,
|
|
354
|
+
[u]: "hoisted"
|
|
355
|
+
}), "hoist";
|
|
356
|
+
if (c.strategy === "beforeInteractive" && (e.dev ?? !1))
|
|
357
|
+
throw new Error(
|
|
358
|
+
`A render-discovered beforeInteractive script ${JSON.stringify(c.src)} was found after the document head flushed. Declare it in export const scripts.`
|
|
359
|
+
);
|
|
360
|
+
return "render";
|
|
361
|
+
},
|
|
362
|
+
scripts() {
|
|
363
|
+
return z([...n, ...a.values()]);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function pt(e) {
|
|
368
|
+
const t = ne(K), n = _e(e);
|
|
369
|
+
if (re(() => {
|
|
370
|
+
S(n.strategy) && J();
|
|
371
|
+
}), !t) {
|
|
372
|
+
if (typeof document > "u")
|
|
373
|
+
throw new Error(
|
|
374
|
+
`The script ${JSON.stringify(n.src)} rendered outside a Demiurge document render context. A server render must wrap its component tree with the script render context.`
|
|
375
|
+
);
|
|
376
|
+
return Ie(n.src) ? null : L({
|
|
377
|
+
...n,
|
|
378
|
+
[u]: "in-place"
|
|
379
|
+
}, Te());
|
|
380
|
+
}
|
|
381
|
+
return t.register(n) !== "render" ? null : L({
|
|
382
|
+
...n,
|
|
383
|
+
[u]: "in-place"
|
|
384
|
+
}, t.nonce);
|
|
385
|
+
}
|
|
386
|
+
function L(e, t) {
|
|
387
|
+
return S(e.strategy) ? g("script", {
|
|
388
|
+
"data-api": e.dataApi,
|
|
389
|
+
[f]: e.strategy,
|
|
390
|
+
"data-demiurge-script-placement": e[u],
|
|
391
|
+
[p]: e.src,
|
|
392
|
+
[A]: e.type,
|
|
393
|
+
"data-domain": e.dataDomain,
|
|
394
|
+
id: e.id,
|
|
395
|
+
integrity: e.integrity,
|
|
396
|
+
nonce: e.nonce ?? t,
|
|
397
|
+
referrerPolicy: e.referrerPolicy,
|
|
398
|
+
type: E
|
|
399
|
+
}) : g("script", {
|
|
400
|
+
async: e.async,
|
|
401
|
+
crossOrigin: e.crossOrigin,
|
|
402
|
+
"data-api": e.dataApi,
|
|
403
|
+
"data-domain": e.dataDomain,
|
|
404
|
+
"data-demiurge-script-placement": e[u],
|
|
405
|
+
defer: e.defer,
|
|
406
|
+
id: e.id,
|
|
407
|
+
integrity: e.integrity,
|
|
408
|
+
nonce: e.nonce ?? t,
|
|
409
|
+
referrerPolicy: e.referrerPolicy,
|
|
410
|
+
src: e.src,
|
|
411
|
+
type: e.type ?? Ne(e.strategy)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function Ie(e) {
|
|
415
|
+
if (typeof document > "u")
|
|
416
|
+
return !1;
|
|
417
|
+
const t = new URL(e, document.baseURI).href;
|
|
418
|
+
return [...document.scripts].some(
|
|
419
|
+
(n) => n.src === t && n.dataset.demiurgeScriptPlacement !== "in-place"
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
function Te() {
|
|
423
|
+
if (!(typeof document > "u"))
|
|
424
|
+
return [...document.scripts].reverse().find((e) => e.nonce)?.nonce;
|
|
425
|
+
}
|
|
426
|
+
function yt(e) {
|
|
427
|
+
return e;
|
|
428
|
+
}
|
|
429
|
+
function _e(e) {
|
|
430
|
+
const t = e.strategy ?? "afterInteractive";
|
|
431
|
+
if (!ke.has(t))
|
|
432
|
+
throw new Error(
|
|
433
|
+
`Unsupported script strategy ${JSON.stringify(t)}. Demiurge supports "beforeInteractive", "module", "afterInteractive", "idle", and "worker".`
|
|
434
|
+
);
|
|
435
|
+
if (t === "module" && e.type && e.type !== "module")
|
|
436
|
+
throw new Error(
|
|
437
|
+
'The "module" script strategy cannot be combined with type="text/javascript".'
|
|
438
|
+
);
|
|
439
|
+
if (t === "worker" && (e.async || e.defer))
|
|
440
|
+
throw new Error(
|
|
441
|
+
'The "worker" script strategy runs off the main thread, so it cannot be combined with async or defer.'
|
|
442
|
+
);
|
|
443
|
+
return {
|
|
444
|
+
...e,
|
|
445
|
+
kind: "script",
|
|
446
|
+
strategy: t
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function Oe(e, t) {
|
|
450
|
+
return g(K.Provider, { value: e, children: t });
|
|
451
|
+
}
|
|
452
|
+
async function mt(e, t) {
|
|
453
|
+
const n = [];
|
|
454
|
+
for (const r of e) {
|
|
455
|
+
if (!r)
|
|
456
|
+
continue;
|
|
457
|
+
const i = typeof r == "function" ? await r(t) : r;
|
|
458
|
+
n.push(...i);
|
|
459
|
+
}
|
|
460
|
+
return z(Ce(n));
|
|
461
|
+
}
|
|
462
|
+
function Ce(e) {
|
|
463
|
+
const t = /* @__PURE__ */ new Map();
|
|
464
|
+
for (const n of e)
|
|
465
|
+
t.set(B(n), {
|
|
466
|
+
...t.get(B(n)),
|
|
467
|
+
...n
|
|
468
|
+
});
|
|
469
|
+
return [...t.values()];
|
|
470
|
+
}
|
|
471
|
+
function B(e) {
|
|
472
|
+
return [
|
|
473
|
+
e.src,
|
|
474
|
+
e.type ?? "",
|
|
475
|
+
e.integrity ?? "",
|
|
476
|
+
e.strategy
|
|
477
|
+
].join("\0");
|
|
478
|
+
}
|
|
479
|
+
function xe(e, t) {
|
|
480
|
+
return q(e.strategy) - q(t.strategy) || e.src.localeCompare(t.src);
|
|
481
|
+
}
|
|
482
|
+
function z(e) {
|
|
483
|
+
return e.sort(xe);
|
|
484
|
+
}
|
|
485
|
+
function Ne(e) {
|
|
486
|
+
return e === "module" ? "module" : void 0;
|
|
487
|
+
}
|
|
488
|
+
function q(e) {
|
|
489
|
+
return e === "beforeInteractive" ? 0 : e === "module" ? 1 : e === "afterInteractive" ? 2 : e === "idle" ? 3 : 4;
|
|
490
|
+
}
|
|
491
|
+
const Pe = "data-demiurge-structured-data";
|
|
492
|
+
function Ue(e) {
|
|
493
|
+
if (e.body) {
|
|
494
|
+
const { html: t, ...n } = e.body, { prefix: r, suffix: i } = Me({ ...e, body: n });
|
|
495
|
+
return `${r}${t}${i}`;
|
|
496
|
+
}
|
|
497
|
+
return Le(e);
|
|
498
|
+
}
|
|
499
|
+
function Me({
|
|
500
|
+
body: e,
|
|
501
|
+
dir: t,
|
|
502
|
+
entrySrc: n,
|
|
503
|
+
lang: r = "en",
|
|
504
|
+
links: i = [],
|
|
505
|
+
metadata: a,
|
|
506
|
+
nonce: c,
|
|
507
|
+
scripts: $ = [],
|
|
508
|
+
styles: R = [],
|
|
509
|
+
title: k = "Demiurge App"
|
|
510
|
+
}) {
|
|
511
|
+
const D = a?.title ?? k, y = [
|
|
512
|
+
...$.filter((I) => I[u] !== "hoisted").map((I) => ` ${x(I, c)}`),
|
|
513
|
+
Ge(e.data, e.navigation, e.locale),
|
|
514
|
+
...n ? [X(n, c)] : []
|
|
515
|
+
].join(`
|
|
516
|
+
`);
|
|
517
|
+
return {
|
|
518
|
+
prefix: `<!doctype html>
|
|
519
|
+
<html lang="${s(r)}"${o("dir", t)}>
|
|
520
|
+
<head>
|
|
521
|
+
${Z({ links: i, metadata: a, nonce: c, scripts: $, styles: R, title: D })}
|
|
522
|
+
</head>
|
|
523
|
+
<body>
|
|
524
|
+
${e.navigation === "document" ? "" : Q(c)}
|
|
525
|
+
${qe(e)}`,
|
|
526
|
+
suffix: `</div>
|
|
527
|
+
${y}
|
|
528
|
+
</body>
|
|
529
|
+
</html>
|
|
530
|
+
`
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function Le({
|
|
534
|
+
dir: e,
|
|
535
|
+
entrySrc: t,
|
|
536
|
+
lang: n = "en",
|
|
537
|
+
links: r = [],
|
|
538
|
+
metadata: i,
|
|
539
|
+
nonce: a,
|
|
540
|
+
scripts: c = [],
|
|
541
|
+
styles: $ = [],
|
|
542
|
+
title: R = "Demiurge App"
|
|
543
|
+
}) {
|
|
544
|
+
const k = i?.title ?? R, D = [
|
|
545
|
+
Q(a),
|
|
546
|
+
Be(),
|
|
547
|
+
...c.filter((y) => y[u] !== "hoisted").map((y) => ` ${x(y, a)}`),
|
|
548
|
+
...t ? [X(t, a)] : []
|
|
549
|
+
].join(`
|
|
550
|
+
`);
|
|
551
|
+
return `<!doctype html>
|
|
552
|
+
<html lang="${s(n)}"${o("dir", e)}>
|
|
553
|
+
<head>
|
|
554
|
+
${Z({ links: r, metadata: i, nonce: a, scripts: c, styles: $, title: k })}
|
|
555
|
+
</head>
|
|
556
|
+
<body>
|
|
557
|
+
${D}
|
|
558
|
+
</body>
|
|
559
|
+
</html>
|
|
560
|
+
`;
|
|
561
|
+
}
|
|
562
|
+
function Q(e) {
|
|
563
|
+
return " <style " + V + o("nonce", e) + `>.demiurge-navigation-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}</style>
|
|
564
|
+
<div id="` + Y + '" ' + m + ' class="demiurge-navigation-status" role="status" aria-live="polite" aria-atomic="true"></div>';
|
|
565
|
+
}
|
|
566
|
+
function Be(e) {
|
|
567
|
+
return ' <div id="root"></div>';
|
|
568
|
+
}
|
|
569
|
+
function qe(e) {
|
|
570
|
+
const t = e.fallback ? ` ${oe}="${s(e.fallback)}"` : "";
|
|
571
|
+
return ` <div id="root" ${ie}=""${t}>`;
|
|
572
|
+
}
|
|
573
|
+
function Ge(e, t, n) {
|
|
574
|
+
return ` <template id="${F}">${ce(e, { locale: n, navigation: t })}</template>`;
|
|
575
|
+
}
|
|
576
|
+
function X(e, t) {
|
|
577
|
+
return ` <script type="module" src="${s(e)}"${o("nonce", t)}><\/script>`;
|
|
578
|
+
}
|
|
579
|
+
function Z({
|
|
580
|
+
links: e,
|
|
581
|
+
metadata: t,
|
|
582
|
+
nonce: n,
|
|
583
|
+
scripts: r,
|
|
584
|
+
styles: i,
|
|
585
|
+
title: a
|
|
586
|
+
}) {
|
|
587
|
+
return [
|
|
588
|
+
d({
|
|
589
|
+
content: t?.charset ?? "UTF-8",
|
|
590
|
+
name: "charset"
|
|
591
|
+
}),
|
|
592
|
+
d({
|
|
593
|
+
content: t?.viewport ?? "width=device-width, initial-scale=1.0",
|
|
594
|
+
name: "viewport"
|
|
595
|
+
}),
|
|
596
|
+
` <title>${s(a)}</title>`,
|
|
597
|
+
...t?.description ? [
|
|
598
|
+
d({
|
|
599
|
+
content: t.description,
|
|
600
|
+
name: "description"
|
|
601
|
+
}, !0)
|
|
602
|
+
] : [],
|
|
603
|
+
...t?.canonical ? [
|
|
604
|
+
O({
|
|
605
|
+
href: t.canonical,
|
|
606
|
+
rel: "canonical"
|
|
607
|
+
}, !0)
|
|
608
|
+
] : [],
|
|
609
|
+
...Fe(t),
|
|
610
|
+
...je(t),
|
|
611
|
+
...(t?.custom ?? []).map(Je),
|
|
612
|
+
...(t?.structuredData ?? []).map(
|
|
613
|
+
(c) => Ye(c, n)
|
|
614
|
+
),
|
|
615
|
+
...i.map(
|
|
616
|
+
(c) => ` <link rel="stylesheet" href="${s(c)}" />`
|
|
617
|
+
),
|
|
618
|
+
...e.map((c) => O(c, !0)),
|
|
619
|
+
...r.filter((c) => c[u] === "hoisted").map((c) => ` ${x(c, n)}`)
|
|
620
|
+
].join(`
|
|
621
|
+
`);
|
|
622
|
+
}
|
|
623
|
+
function Fe(e) {
|
|
624
|
+
if (!e?.robots)
|
|
625
|
+
return [];
|
|
626
|
+
const t = [
|
|
627
|
+
e.robots.index === !1 ? "noindex" : "index",
|
|
628
|
+
e.robots.follow === !1 ? "nofollow" : "follow"
|
|
629
|
+
];
|
|
630
|
+
return [
|
|
631
|
+
d({
|
|
632
|
+
content: t.join(", "),
|
|
633
|
+
name: "robots"
|
|
634
|
+
}, !0)
|
|
635
|
+
];
|
|
636
|
+
}
|
|
637
|
+
function je(e) {
|
|
638
|
+
return e?.openGraph ? [
|
|
639
|
+
e.openGraph.title ? d({
|
|
640
|
+
content: e.openGraph.title,
|
|
641
|
+
property: "og:title"
|
|
642
|
+
}, !0) : null,
|
|
643
|
+
e.openGraph.description ? d({
|
|
644
|
+
content: e.openGraph.description,
|
|
645
|
+
property: "og:description"
|
|
646
|
+
}, !0) : null,
|
|
647
|
+
e.openGraph.image ? d({
|
|
648
|
+
content: e.openGraph.image,
|
|
649
|
+
property: "og:image"
|
|
650
|
+
}, !0) : null
|
|
651
|
+
].filter((t) => !!t) : [];
|
|
652
|
+
}
|
|
653
|
+
function Je(e) {
|
|
654
|
+
return e.kind === "link" ? O(e, !0) : d(e, !0);
|
|
655
|
+
}
|
|
656
|
+
function Ye(e, t) {
|
|
657
|
+
return ` <script type="application/ld+json"${` ${l}` + (t ? "" : ` ${Pe}`)}${o("nonce", t)}>${He(JSON.stringify(e.value))}<\/script>`;
|
|
658
|
+
}
|
|
659
|
+
function d(e, t = !1) {
|
|
660
|
+
const n = t ? ` ${l}` : "";
|
|
661
|
+
if (e.name === "charset")
|
|
662
|
+
return ` <meta${n} charset="${s(e.content)}" />`;
|
|
663
|
+
const r = e.name ? ` name="${s(e.name)}"` : "", i = e.property ? ` property="${s(e.property)}"` : "";
|
|
664
|
+
return ` <meta${n}${r}${i} content="${s(e.content)}" />`;
|
|
665
|
+
}
|
|
666
|
+
function O(e, t = !1) {
|
|
667
|
+
return ` <link${t ? ` ${l}` : ""}${o("rel", e.rel)}${o("href", e.href)}${o("as", e.as)}${o("type", e.type)}${o("crossorigin", e.crossOrigin)}${o("hreflang", e.hrefLang)} />`;
|
|
668
|
+
}
|
|
669
|
+
function x(e, t) {
|
|
670
|
+
return S(e.strategy) ? Ve(e, t) : `<script ${l}${o(b, e.strategy)}${o("id", e.id)}${o("src", e.src)}${o("type", e.type ?? We(e.strategy))}${o("nonce", e.nonce ?? t)}${o("integrity", e.integrity)}${o("crossorigin", e.crossOrigin)}${o("referrerpolicy", e.referrerPolicy)}${o("data-api", e.dataApi)}${o("data-domain", e.dataDomain)}${o("data-demiurge-script-placement", e[u])}${G("async", e.async)}${G("defer", e.defer)}><\/script>`;
|
|
671
|
+
}
|
|
672
|
+
function Ve(e, t) {
|
|
673
|
+
return `<script ${l}${o(b, e.strategy)}${o("id", e.id)}${o("type", E)}${o("nonce", e.nonce ?? t)}${o("integrity", e.integrity)}${o("crossorigin", e.crossOrigin)}${o("referrerpolicy", e.referrerPolicy)}${o("data-api", e.dataApi)}${o("data-domain", e.dataDomain)}${o(f, e.strategy)}${o(p, e.src)}${o(A, e.type)}${o("data-demiurge-script-placement", e[u])}><\/script>`;
|
|
674
|
+
}
|
|
675
|
+
function We(e) {
|
|
676
|
+
return e === "module" ? "module" : void 0;
|
|
677
|
+
}
|
|
678
|
+
function o(e, t) {
|
|
679
|
+
return t ? ` ${e}="${s(t)}"` : "";
|
|
680
|
+
}
|
|
681
|
+
function G(e, t) {
|
|
682
|
+
return t ? ` ${e}` : "";
|
|
683
|
+
}
|
|
684
|
+
function s(e) {
|
|
685
|
+
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
686
|
+
}
|
|
687
|
+
function He(e) {
|
|
688
|
+
return e.replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
689
|
+
}
|
|
690
|
+
function Ke(e, t) {
|
|
691
|
+
const n = g(e.page, {
|
|
692
|
+
data: e.data,
|
|
693
|
+
locale: e.locale,
|
|
694
|
+
path: e.path,
|
|
695
|
+
pathname: e.pathname
|
|
696
|
+
}), r = e.layouts.reduceRight(
|
|
697
|
+
(i, a) => g(a, {
|
|
698
|
+
children: i,
|
|
699
|
+
locale: e.locale,
|
|
700
|
+
path: e.path,
|
|
701
|
+
pathname: e.pathname
|
|
702
|
+
}),
|
|
703
|
+
n
|
|
704
|
+
);
|
|
705
|
+
return t ? Oe(t, r) : r;
|
|
706
|
+
}
|
|
707
|
+
function ze(e, t = {}) {
|
|
708
|
+
return De({
|
|
709
|
+
dev: t.dev,
|
|
710
|
+
nonce: t.nonce,
|
|
711
|
+
scripts: e.scripts
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
function Qe(e, t = {}) {
|
|
715
|
+
const n = ze(e, t), r = ee(Ke(e, n));
|
|
716
|
+
return Ue({
|
|
717
|
+
body: {
|
|
718
|
+
data: e.data,
|
|
719
|
+
html: r,
|
|
720
|
+
locale: t.locale,
|
|
721
|
+
navigation: e.render.mode === "static" ? "document" : t.navigation
|
|
722
|
+
},
|
|
723
|
+
entrySrc: t.clientEntry,
|
|
724
|
+
dir: t.dir,
|
|
725
|
+
lang: t.lang,
|
|
726
|
+
links: e.links,
|
|
727
|
+
metadata: e.metadata,
|
|
728
|
+
nonce: t.nonce,
|
|
729
|
+
scripts: n.scripts(),
|
|
730
|
+
styles: t.styles,
|
|
731
|
+
title: t.title
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function gt(e, t = {}) {
|
|
735
|
+
const n = Qe(e, t);
|
|
736
|
+
return new Response(n, {
|
|
737
|
+
headers: {
|
|
738
|
+
"content-type": "text/html; charset=utf-8"
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
const h = /* @__PURE__ */ new WeakMap();
|
|
743
|
+
function ht(e) {
|
|
744
|
+
return h.get(e);
|
|
745
|
+
}
|
|
746
|
+
function At(e) {
|
|
747
|
+
return h.get(e)?.clientIp;
|
|
748
|
+
}
|
|
749
|
+
function St(e, t) {
|
|
750
|
+
h.set(e, t);
|
|
751
|
+
}
|
|
752
|
+
function $t(e, t) {
|
|
753
|
+
const n = h.get(e);
|
|
754
|
+
n && h.set(t, n);
|
|
755
|
+
}
|
|
756
|
+
const Xe = {
|
|
757
|
+
backgroundLifetime: !1,
|
|
758
|
+
crossOriginIsolationHeaders: !1,
|
|
759
|
+
nonceInjection: !1,
|
|
760
|
+
requestTimeoutEnforcement: !1,
|
|
761
|
+
sharedCache: !1,
|
|
762
|
+
staticOutput: !1,
|
|
763
|
+
streaming: !1,
|
|
764
|
+
webSocket: !1,
|
|
765
|
+
webTransport: !1
|
|
766
|
+
};
|
|
767
|
+
function vt(e) {
|
|
768
|
+
return {
|
|
769
|
+
capabilities: {
|
|
770
|
+
...Xe,
|
|
771
|
+
...e.capabilities
|
|
772
|
+
},
|
|
773
|
+
name: e.name
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function Ze(e, t) {
|
|
777
|
+
const n = [...new Set(t)], r = n.filter(
|
|
778
|
+
(i) => !e.capabilities[i]
|
|
779
|
+
);
|
|
780
|
+
return {
|
|
781
|
+
adapter: e.name,
|
|
782
|
+
missing: r,
|
|
783
|
+
ok: r.length === 0,
|
|
784
|
+
required: n
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function Et(e, t) {
|
|
788
|
+
const n = Ze(e, t);
|
|
789
|
+
if (!n.ok)
|
|
790
|
+
throw new Error(
|
|
791
|
+
`Adapter "${e.name}" does not support required capabilities: ${n.missing.join(", ")}.`
|
|
792
|
+
);
|
|
793
|
+
return n;
|
|
794
|
+
}
|
|
795
|
+
export {
|
|
796
|
+
st as A,
|
|
797
|
+
mt as B,
|
|
798
|
+
lt as C,
|
|
799
|
+
De as D,
|
|
800
|
+
Oe as E,
|
|
801
|
+
T as F,
|
|
802
|
+
$t as G,
|
|
803
|
+
ie as H,
|
|
804
|
+
ht as I,
|
|
805
|
+
Pe as S,
|
|
806
|
+
gt as a,
|
|
807
|
+
Ke as b,
|
|
808
|
+
ze as c,
|
|
809
|
+
vt as d,
|
|
810
|
+
Ue as e,
|
|
811
|
+
Qe as f,
|
|
812
|
+
ut as g,
|
|
813
|
+
ft as h,
|
|
814
|
+
nt as i,
|
|
815
|
+
J as j,
|
|
816
|
+
oe as k,
|
|
817
|
+
dt as l,
|
|
818
|
+
_e as m,
|
|
819
|
+
pt as n,
|
|
820
|
+
Et as o,
|
|
821
|
+
ct as p,
|
|
822
|
+
Ze as q,
|
|
823
|
+
Me as r,
|
|
824
|
+
St as s,
|
|
825
|
+
C as t,
|
|
826
|
+
it as u,
|
|
827
|
+
yt as v,
|
|
828
|
+
At as w,
|
|
829
|
+
rt as x,
|
|
830
|
+
at as y,
|
|
831
|
+
ot as z
|
|
832
|
+
};
|
|
833
|
+
//# sourceMappingURL=index-0MNiR_wo.js.map
|