@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.
- package/README.md +2 -0
- package/dist/adapter/testing.d.ts +33 -0
- package/dist/adapter/testing.d.ts.map +1 -0
- package/dist/adapter/testing.js +251 -0
- package/dist/adapter/testing.js.map +1 -0
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/document-shell-D1xo6cEA.js +35 -0
- package/dist/chunks/document-shell-D1xo6cEA.js.map +1 -0
- package/dist/chunks/image-codec-BGTx_t5K.js +141 -0
- package/dist/chunks/image-codec-BGTx_t5K.js.map +1 -0
- package/dist/chunks/images-B9MqcjSA.js +339 -0
- package/dist/chunks/images-B9MqcjSA.js.map +1 -0
- package/dist/chunks/request-metadata-D5NrT8ks.js +642 -0
- package/dist/chunks/request-metadata-D5NrT8ks.js.map +1 -0
- package/dist/chunks/streaming-BQ1bykDo.js +469 -0
- package/dist/chunks/streaming-BQ1bykDo.js.map +1 -0
- package/dist/chunks/{testing-DBjVCN5v.js → testing-B_iMFYz_.js} +768 -761
- package/dist/chunks/testing-B_iMFYz_.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +63 -54
- package/dist/cli.js.map +1 -1
- package/dist/document/deferred-scripts.d.ts +11 -0
- package/dist/document/deferred-scripts.d.ts.map +1 -0
- package/dist/document/index.d.ts +3 -1
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/render.d.ts.map +1 -1
- package/dist/document/scripts.d.ts +12 -1
- package/dist/document/scripts.d.ts.map +1 -1
- package/dist/edge/assets.d.ts +14 -0
- package/dist/edge/assets.d.ts.map +1 -0
- package/dist/edge/index.d.ts +19 -0
- package/dist/edge/index.d.ts.map +1 -0
- package/dist/edge/index.js +286 -0
- package/dist/edge/index.js.map +1 -0
- package/dist/edge/stores.d.ts +8 -0
- package/dist/edge/stores.d.ts.map +1 -0
- package/dist/edge/streaming.d.ts +7 -0
- package/dist/edge/streaming.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +423 -420
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +9 -9
- package/dist/kv/index.d.ts +3 -0
- package/dist/kv/index.d.ts.map +1 -0
- package/dist/kv/index.js +103 -0
- package/dist/kv/index.js.map +1 -0
- package/dist/kv/store.d.ts +28 -0
- package/dist/kv/store.d.ts.map +1 -0
- package/dist/node/font.d.ts +5 -0
- package/dist/node/font.d.ts.map +1 -0
- package/dist/node/image.d.ts +15 -0
- package/dist/node/image.d.ts.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +25 -23
- package/dist/node/index.js.map +1 -1
- package/dist/node/streaming.d.ts.map +1 -1
- package/dist/platform/analytics.d.ts +58 -5
- package/dist/platform/analytics.d.ts.map +1 -1
- package/dist/platform/font-assets.d.ts +19 -0
- package/dist/platform/font-assets.d.ts.map +1 -0
- package/dist/platform/fonts.d.ts +14 -4
- package/dist/platform/fonts.d.ts.map +1 -1
- package/dist/platform/image-codec.d.ts +15 -0
- package/dist/platform/image-codec.d.ts.map +1 -0
- package/dist/platform/image-url.d.ts +17 -0
- package/dist/platform/image-url.d.ts.map +1 -0
- package/dist/platform/image.d.ts +8 -0
- package/dist/platform/image.d.ts.map +1 -0
- package/dist/platform/images.d.ts +15 -0
- package/dist/platform/images.d.ts.map +1 -1
- package/dist/platform/index.d.ts +8 -5
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/redis/index.d.ts +3 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +171 -0
- package/dist/redis/index.js.map +1 -0
- package/dist/redis/store.d.ts +8 -0
- package/dist/redis/store.d.ts.map +1 -0
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts +2 -27
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/types.d.ts +10 -3
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/verification.d.ts.map +1 -1
- package/dist/server/document-shell.d.ts +12 -0
- package/dist/server/document-shell.d.ts.map +1 -0
- package/dist/static/images.d.ts +13 -0
- package/dist/static/images.d.ts.map +1 -0
- package/dist/static/index.d.ts +8 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +421 -313
- package/dist/static/index.js.map +1 -1
- package/dist/static/vercel.d.ts +3 -0
- package/dist/static/vercel.d.ts.map +1 -1
- package/dist/vite/index.js +412 -387
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +7 -0
- package/dist/vite/plugin.d.ts.map +1 -1
- package/package.json +34 -3
- package/dist/chunks/request-metadata-DwEO1EAS.js +0 -477
- package/dist/chunks/request-metadata-DwEO1EAS.js.map +0 -1
- package/dist/chunks/streaming-Ci6vf3BB.js +0 -353
- package/dist/chunks/streaming-Ci6vf3BB.js.map +0 -1
- package/dist/chunks/testing-DBjVCN5v.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createElement as
|
|
3
|
-
import { renderToString as
|
|
1
|
+
import { w as $t, v as kt, x as _e, y as Ve, e as Je, z as Dt, A as Nt, l as Ot, a as Lt } from "./request-metadata-D5NrT8ks.js";
|
|
2
|
+
import { createElement as fe } from "react";
|
|
3
|
+
import { renderToString as Ke } from "react-dom/server";
|
|
4
4
|
import { jsxs as I, jsx as M } from "react/jsx-runtime";
|
|
5
|
-
const
|
|
5
|
+
const Ae = ["build", "private", "public"], It = {
|
|
6
6
|
app: "demiurge-memory",
|
|
7
7
|
environment: "local",
|
|
8
8
|
schemaVersion: 1
|
|
9
9
|
}, Mt = 1e4, Ut = 3e4;
|
|
10
|
-
function
|
|
10
|
+
function ni(e) {
|
|
11
11
|
return (...t) => ({
|
|
12
12
|
fn: () => e.fn(...t),
|
|
13
13
|
key: e.key(...t),
|
|
@@ -17,44 +17,44 @@ function ti(e) {
|
|
|
17
17
|
ttl: e.ttl
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function si(e) {
|
|
21
21
|
return { id: e };
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function ii(e) {
|
|
24
24
|
return e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const t = e.now ?? Date.now, r = Wt(e.refreshLeaseTtl), n =
|
|
26
|
+
function Ye(e) {
|
|
27
|
+
const t = e.now ?? Date.now, r = Wt(e.refreshLeaseTtl), n = Ze(e.namespace), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
28
28
|
return {
|
|
29
29
|
async get(o) {
|
|
30
30
|
const a = o.scope ?? "request";
|
|
31
31
|
if (a === "none")
|
|
32
32
|
return await o.fn();
|
|
33
|
-
const c =
|
|
33
|
+
const c = $e(o.key);
|
|
34
34
|
if (a === "request")
|
|
35
35
|
return await Ft(s, c, o, t);
|
|
36
|
-
const u =
|
|
37
|
-
(g) =>
|
|
36
|
+
const u = ke(n, a, c), f = (o.tags ?? []).map(
|
|
37
|
+
(g) => De(n, a, le(g))
|
|
38
38
|
), l = await e.store.get(u);
|
|
39
39
|
if (l && (l.expiresAt === null || l.expiresAt > t()))
|
|
40
40
|
return l.value;
|
|
41
41
|
if (l && qt(l, t())) {
|
|
42
|
-
const g = zt(e.store),
|
|
42
|
+
const g = zt(e.store), A = globalThis.crypto.randomUUID();
|
|
43
43
|
if (await g.acquireRefreshLease(
|
|
44
44
|
u,
|
|
45
|
-
|
|
45
|
+
A,
|
|
46
46
|
t() + r
|
|
47
47
|
)) {
|
|
48
|
-
const
|
|
48
|
+
const te = Bt({
|
|
49
49
|
key: u,
|
|
50
50
|
now: t,
|
|
51
51
|
onBackgroundError: e.onBackgroundError,
|
|
52
52
|
refreshStore: g,
|
|
53
53
|
request: o,
|
|
54
54
|
tags: f,
|
|
55
|
-
token:
|
|
55
|
+
token: A
|
|
56
56
|
});
|
|
57
|
-
e.waitUntil?.(
|
|
57
|
+
e.waitUntil?.(te);
|
|
58
58
|
}
|
|
59
59
|
return l.value;
|
|
60
60
|
}
|
|
@@ -63,44 +63,44 @@ function Qe(e) {
|
|
|
63
63
|
if (m)
|
|
64
64
|
return await m.promise;
|
|
65
65
|
const d = { invalidated: !1 }, P = Promise.resolve().then(o.fn).then(async (g) => (d.invalidated || await e.store.set(u, {
|
|
66
|
-
expiresAt:
|
|
67
|
-
staleUntil:
|
|
66
|
+
expiresAt: Qe(t(), o.ttl),
|
|
67
|
+
staleUntil: Xe(
|
|
68
68
|
t(),
|
|
69
69
|
o.ttl,
|
|
70
70
|
o.staleWhileRevalidate
|
|
71
71
|
),
|
|
72
72
|
tags: f,
|
|
73
73
|
value: g
|
|
74
|
-
}), g)),
|
|
74
|
+
}), g)), $ = {
|
|
75
75
|
promise: P,
|
|
76
76
|
state: d,
|
|
77
77
|
tags: f
|
|
78
78
|
};
|
|
79
|
-
i.set(u,
|
|
79
|
+
i.set(u, $);
|
|
80
80
|
try {
|
|
81
81
|
return await P;
|
|
82
82
|
} finally {
|
|
83
|
-
i.get(u) ===
|
|
83
|
+
i.get(u) === $ && i.delete(u);
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
async invalidateKey(o) {
|
|
87
|
-
const a =
|
|
87
|
+
const a = $e(o), c = s.delete(a);
|
|
88
88
|
let u = !1;
|
|
89
89
|
const f = await Promise.all(
|
|
90
|
-
|
|
91
|
-
const m =
|
|
90
|
+
Ae.map((l) => {
|
|
91
|
+
const m = ke(n, l, a), d = i.get(m);
|
|
92
92
|
return d && (d.state.invalidated = !0, u = !0), e.store.delete(m);
|
|
93
93
|
})
|
|
94
94
|
);
|
|
95
95
|
return c || u || f.some(Boolean);
|
|
96
96
|
},
|
|
97
97
|
async invalidateTags(o) {
|
|
98
|
-
const a = o.map(
|
|
98
|
+
const a = o.map(le), c = Gt(
|
|
99
99
|
s,
|
|
100
100
|
new Set(a)
|
|
101
101
|
), u = new Set(
|
|
102
|
-
|
|
103
|
-
(m) => a.map((d) =>
|
|
102
|
+
Ae.flatMap(
|
|
103
|
+
(m) => a.map((d) => De(n, m, d))
|
|
104
104
|
)
|
|
105
105
|
);
|
|
106
106
|
let f = 0;
|
|
@@ -113,7 +113,7 @@ function Qe(e) {
|
|
|
113
113
|
}
|
|
114
114
|
function ge(e = {}) {
|
|
115
115
|
const t = e.now ?? Date.now;
|
|
116
|
-
return
|
|
116
|
+
return Ye({
|
|
117
117
|
namespace: It,
|
|
118
118
|
now: t,
|
|
119
119
|
onBackgroundError: e.onBackgroundError,
|
|
@@ -131,8 +131,8 @@ function Ht(e = {}) {
|
|
|
131
131
|
throw new Error(
|
|
132
132
|
"Demiurge memory cache maximumEntries must be a positive integer."
|
|
133
133
|
);
|
|
134
|
-
|
|
135
|
-
let i =
|
|
134
|
+
re(t, r, s()), jt(t, n);
|
|
135
|
+
let i = ne(t);
|
|
136
136
|
return {
|
|
137
137
|
acquireRefreshLease(o, a, c) {
|
|
138
138
|
const u = s(), f = r.get(o);
|
|
@@ -142,7 +142,7 @@ function Ht(e = {}) {
|
|
|
142
142
|
return r.delete(o), t.delete(o);
|
|
143
143
|
},
|
|
144
144
|
get(o) {
|
|
145
|
-
return s() >= i && (
|
|
145
|
+
return s() >= i && (re(t, r, s()), i = ne(t)), t.get(o);
|
|
146
146
|
},
|
|
147
147
|
invalidateTags(o) {
|
|
148
148
|
const a = new Set(o);
|
|
@@ -166,7 +166,7 @@ function Ht(e = {}) {
|
|
|
166
166
|
},
|
|
167
167
|
set(o, a) {
|
|
168
168
|
const c = s();
|
|
169
|
-
c >= i && (
|
|
169
|
+
c >= i && (re(t, r, c), i = ne(t)), r.delete(o), Ce(
|
|
170
170
|
t,
|
|
171
171
|
r,
|
|
172
172
|
n,
|
|
@@ -176,7 +176,7 @@ function Ht(e = {}) {
|
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function re(e, t, r) {
|
|
180
180
|
for (const [n, s] of e)
|
|
181
181
|
s.staleUntil !== null && s.staleUntil <= r && (e.delete(n), t.delete(n));
|
|
182
182
|
}
|
|
@@ -198,14 +198,14 @@ function jt(e, t) {
|
|
|
198
198
|
e.delete(r);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function ne(e) {
|
|
202
202
|
let t = Number.POSITIVE_INFINITY;
|
|
203
203
|
for (const r of e.values())
|
|
204
204
|
r.staleUntil !== null && (t = Math.min(t, r.staleUntil));
|
|
205
205
|
return t;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
const t =
|
|
207
|
+
function Ze(e) {
|
|
208
|
+
const t = se("app", e.app), r = se(
|
|
209
209
|
"environment",
|
|
210
210
|
e.environment
|
|
211
211
|
);
|
|
@@ -213,13 +213,13 @@ function Xe(e) {
|
|
|
213
213
|
throw new Error(
|
|
214
214
|
"Demiurge cache namespace schemaVersion must be a non-negative integer or string."
|
|
215
215
|
);
|
|
216
|
-
const n =
|
|
216
|
+
const n = se(
|
|
217
217
|
"schemaVersion",
|
|
218
218
|
String(e.schemaVersion)
|
|
219
219
|
);
|
|
220
220
|
return `${t}:${r}:${n}`;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function oi(e) {
|
|
223
223
|
return {
|
|
224
224
|
async key(t) {
|
|
225
225
|
return {
|
|
@@ -264,10 +264,10 @@ function U(e) {
|
|
|
264
264
|
const r = Number(t[1]), n = t[2];
|
|
265
265
|
return n === "h" ? r * 36e5 : n === "m" ? r * 6e4 : n === "s" ? r * 1e3 : r;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
267
|
+
function $e(e) {
|
|
268
|
+
return de(e, /* @__PURE__ */ new Set());
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function le(e) {
|
|
271
271
|
return e.id;
|
|
272
272
|
}
|
|
273
273
|
async function Ft(e, t, r, n) {
|
|
@@ -276,7 +276,7 @@ async function Ft(e, t, r, n) {
|
|
|
276
276
|
return await s.value;
|
|
277
277
|
const i = Promise.resolve().then(r.fn), o = {
|
|
278
278
|
expiresAt: n() + U(r.ttl),
|
|
279
|
-
tags: (r.tags ?? []).map(
|
|
279
|
+
tags: (r.tags ?? []).map(le),
|
|
280
280
|
value: i
|
|
281
281
|
};
|
|
282
282
|
e.set(t, o);
|
|
@@ -286,17 +286,17 @@ async function Ft(e, t, r, n) {
|
|
|
286
286
|
throw e.get(t) === o && e.delete(t), a;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function ke(e, t, r) {
|
|
290
290
|
return `${e}:${t}:key:${r}`;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function De(e, t, r) {
|
|
293
293
|
return `${e}:${t}:tag:${r}`;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function Qe(e, t) {
|
|
296
296
|
const r = U(t);
|
|
297
297
|
return Number.isFinite(r) ? e + r : null;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Xe(e, t, r) {
|
|
300
300
|
const n = U(t);
|
|
301
301
|
if (!Number.isFinite(n)) {
|
|
302
302
|
if (r !== void 0)
|
|
@@ -329,8 +329,8 @@ async function Bt(e) {
|
|
|
329
329
|
try {
|
|
330
330
|
const t = await e.request.fn(), r = e.now();
|
|
331
331
|
await e.refreshStore.publishRefresh(e.key, e.token, {
|
|
332
|
-
expiresAt:
|
|
333
|
-
staleUntil:
|
|
332
|
+
expiresAt: Qe(r, e.request.ttl),
|
|
333
|
+
staleUntil: Xe(
|
|
334
334
|
r,
|
|
335
335
|
e.request.ttl,
|
|
336
336
|
e.request.staleWhileRevalidate
|
|
@@ -344,7 +344,7 @@ async function Bt(e) {
|
|
|
344
344
|
await e.refreshStore.releaseRefreshLease(e.key, e.token);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function se(e, t) {
|
|
348
348
|
const r = [...t].some((n) => {
|
|
349
349
|
const s = n.charCodeAt(0);
|
|
350
350
|
return s <= 31 || s === 127;
|
|
@@ -361,7 +361,7 @@ function Gt(e, t) {
|
|
|
361
361
|
s.tags.some((i) => t.has(i)) && (e.delete(n), r += 1);
|
|
362
362
|
return r;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function de(e, t) {
|
|
365
365
|
if (e === null || typeof e == "boolean" || typeof e == "string")
|
|
366
366
|
return JSON.stringify(e);
|
|
367
367
|
if (typeof e == "number") {
|
|
@@ -389,7 +389,7 @@ function le(e, t) {
|
|
|
389
389
|
throw t.delete(e), new Error(
|
|
390
390
|
"Demiurge cache key arrays must be dense and cannot contain accessors or custom properties."
|
|
391
391
|
);
|
|
392
|
-
const c = `[${e.map((u) =>
|
|
392
|
+
const c = `[${e.map((u) => de(u, t)).join(",")}]`;
|
|
393
393
|
return t.delete(e), c;
|
|
394
394
|
}
|
|
395
395
|
const r = Object.getPrototypeOf(e);
|
|
@@ -406,86 +406,26 @@ function le(e, t) {
|
|
|
406
406
|
"Demiurge cache key objects require enumerable string data properties."
|
|
407
407
|
);
|
|
408
408
|
const s = e, i = `{${Object.keys(s).sort().map(
|
|
409
|
-
(o) => `${JSON.stringify(o)}:${
|
|
409
|
+
(o) => `${JSON.stringify(o)}:${de(s[o], t)}`
|
|
410
410
|
).join(",")}}`;
|
|
411
411
|
return t.delete(e), i;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function ai(e) {
|
|
414
414
|
return e;
|
|
415
415
|
}
|
|
416
|
-
function oi(e, t = {}) {
|
|
417
|
-
return {
|
|
418
|
-
...t,
|
|
419
|
-
href: e,
|
|
420
|
-
kind: "link",
|
|
421
|
-
rel: "preconnect"
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function ai(e, t) {
|
|
425
|
-
return {
|
|
426
|
-
...t,
|
|
427
|
-
href: e,
|
|
428
|
-
kind: "link",
|
|
429
|
-
rel: "preload"
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
416
|
function ci(e) {
|
|
433
|
-
return {
|
|
434
|
-
href: e,
|
|
435
|
-
kind: "link",
|
|
436
|
-
rel: "modulepreload"
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
async function _t(e, t) {
|
|
440
|
-
const r = [];
|
|
441
|
-
for (const n of e) {
|
|
442
|
-
if (!n)
|
|
443
|
-
continue;
|
|
444
|
-
const s = typeof n == "function" ? await n(t) : n;
|
|
445
|
-
r.push(...s);
|
|
446
|
-
}
|
|
447
|
-
return Vt(r).sort(Jt);
|
|
448
|
-
}
|
|
449
|
-
function Vt(e) {
|
|
450
|
-
const t = /* @__PURE__ */ new Map();
|
|
451
|
-
for (const r of e)
|
|
452
|
-
t.set(Ne(r), {
|
|
453
|
-
...t.get(Ne(r)),
|
|
454
|
-
...r
|
|
455
|
-
});
|
|
456
|
-
return [...t.values()];
|
|
457
|
-
}
|
|
458
|
-
function Ne(e) {
|
|
459
|
-
return [
|
|
460
|
-
e.rel,
|
|
461
|
-
e.href,
|
|
462
|
-
e.as ?? "",
|
|
463
|
-
e.type ?? "",
|
|
464
|
-
e.crossOrigin ?? ""
|
|
465
|
-
].join("\0");
|
|
466
|
-
}
|
|
467
|
-
function Jt(e, t) {
|
|
468
|
-
return Oe(e.rel) - Oe(t.rel) || e.href.localeCompare(t.href);
|
|
469
|
-
}
|
|
470
|
-
function Oe(e) {
|
|
471
|
-
return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
|
|
472
|
-
}
|
|
473
|
-
function ui(e) {
|
|
474
|
-
return e;
|
|
475
|
-
}
|
|
476
|
-
function fi(e) {
|
|
477
417
|
return {
|
|
478
418
|
...e,
|
|
479
419
|
kind: "meta"
|
|
480
420
|
};
|
|
481
421
|
}
|
|
482
|
-
function
|
|
422
|
+
function ui(e) {
|
|
483
423
|
return {
|
|
484
424
|
...e,
|
|
485
425
|
kind: "link"
|
|
486
426
|
};
|
|
487
427
|
}
|
|
488
|
-
function
|
|
428
|
+
function fi(e) {
|
|
489
429
|
return {
|
|
490
430
|
kind: "structured-data",
|
|
491
431
|
value: e
|
|
@@ -497,8 +437,8 @@ function v(...e) {
|
|
|
497
437
|
structuredData: []
|
|
498
438
|
};
|
|
499
439
|
for (const i of e)
|
|
500
|
-
i &&
|
|
501
|
-
const r =
|
|
440
|
+
i && _t(t, i);
|
|
441
|
+
const r = Jt(t), n = t.description, s = Kt(t.openGraph, r, n);
|
|
502
442
|
return {
|
|
503
443
|
canonical: t.canonical,
|
|
504
444
|
charset: "utf-8",
|
|
@@ -511,8 +451,8 @@ function v(...e) {
|
|
|
511
451
|
viewport: "width=device-width, initial-scale=1"
|
|
512
452
|
};
|
|
513
453
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
454
|
+
function _t(e, t) {
|
|
455
|
+
Vt(e, t.title), t.description !== void 0 && (e.description = t.description), t.canonical !== void 0 && (e.canonical = t.canonical), t.robots && (e.robots = {
|
|
516
456
|
...e.robots ?? {},
|
|
517
457
|
...t.robots
|
|
518
458
|
}), t.openGraph && (e.openGraph = {
|
|
@@ -520,7 +460,7 @@ function Kt(e, t) {
|
|
|
520
460
|
...t.openGraph
|
|
521
461
|
}), t.custom && e.custom.push(...t.custom), t.structuredData && e.structuredData.push(...t.structuredData);
|
|
522
462
|
}
|
|
523
|
-
function
|
|
463
|
+
function Vt(e, t) {
|
|
524
464
|
if (t !== void 0) {
|
|
525
465
|
if (typeof t == "string") {
|
|
526
466
|
e.title = t;
|
|
@@ -529,10 +469,10 @@ function Yt(e, t) {
|
|
|
529
469
|
t.default !== void 0 && (e.titleDefault = t.default), t.format && (e.titleFormat = t.format);
|
|
530
470
|
}
|
|
531
471
|
}
|
|
532
|
-
function
|
|
472
|
+
function Jt(e) {
|
|
533
473
|
return e.title === void 0 ? e.titleDefault : e.titleFormat ? e.titleFormat(e.title) : e.title;
|
|
534
474
|
}
|
|
535
|
-
function
|
|
475
|
+
function Kt(e, t, r) {
|
|
536
476
|
if (!(!e && !t && !r))
|
|
537
477
|
return {
|
|
538
478
|
...t ? { title: t } : {},
|
|
@@ -540,7 +480,7 @@ function Qt(e, t, r) {
|
|
|
540
480
|
...e ?? {}
|
|
541
481
|
};
|
|
542
482
|
}
|
|
543
|
-
function
|
|
483
|
+
function et(e) {
|
|
544
484
|
const t = {
|
|
545
485
|
fallbacks: {
|
|
546
486
|
error: [],
|
|
@@ -612,11 +552,11 @@ function rt(e) {
|
|
|
612
552
|
file: r,
|
|
613
553
|
fileSegments: s,
|
|
614
554
|
segments: R(s),
|
|
615
|
-
score:
|
|
555
|
+
score: dr(s),
|
|
616
556
|
load: n
|
|
617
557
|
});
|
|
618
558
|
}
|
|
619
|
-
return
|
|
559
|
+
return Yt(t.routes), t.routes.sort(Xt), t.layouts.sort(
|
|
620
560
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
621
561
|
), t.policies.sort(
|
|
622
562
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
@@ -630,7 +570,7 @@ function rt(e) {
|
|
|
630
570
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
631
571
|
), t;
|
|
632
572
|
}
|
|
633
|
-
function
|
|
573
|
+
function Yt(e) {
|
|
634
574
|
const t = /* @__PURE__ */ new Map();
|
|
635
575
|
for (const r of e) {
|
|
636
576
|
const n = r.segments.findIndex(
|
|
@@ -640,37 +580,37 @@ function Xt(e) {
|
|
|
640
580
|
throw new Error(
|
|
641
581
|
`Catchall route segment in "${r.file}" must be the final URL segment.`
|
|
642
582
|
);
|
|
643
|
-
const s = r.segments.map(
|
|
583
|
+
const s = r.segments.map(Zt).join("/"), i = t.get(s);
|
|
644
584
|
if (i)
|
|
645
585
|
throw new Error(
|
|
646
|
-
`Ambiguous routes "${i.file}" and "${r.file}" have the same runtime shape and both match "${
|
|
586
|
+
`Ambiguous routes "${i.file}" and "${r.file}" have the same runtime shape and both match "${Qt(r.segments)}".`
|
|
647
587
|
);
|
|
648
588
|
t.set(s, r);
|
|
649
589
|
}
|
|
650
590
|
}
|
|
651
|
-
function
|
|
591
|
+
function Zt(e) {
|
|
652
592
|
return e.startsWith("*") ? "*" : e.startsWith(":") ? ":" : `=${e}`;
|
|
653
593
|
}
|
|
654
|
-
function
|
|
594
|
+
function Qt(e) {
|
|
655
595
|
return e.length === 0 ? "/" : `/${e.map((t) => t.startsWith(":") || t.startsWith("*") ? "example" : t).join("/")}`;
|
|
656
596
|
}
|
|
657
|
-
function
|
|
597
|
+
function Xt(e, t) {
|
|
658
598
|
const r = Math.max(e.segments.length, t.segments.length);
|
|
659
599
|
for (let n = 0; n < r; n += 1) {
|
|
660
|
-
const s =
|
|
600
|
+
const s = Ne(t.segments[n]) - Ne(e.segments[n]);
|
|
661
601
|
if (s !== 0)
|
|
662
602
|
return s;
|
|
663
603
|
}
|
|
664
604
|
return e.file.localeCompare(t.file);
|
|
665
605
|
}
|
|
666
|
-
function
|
|
606
|
+
function Ne(e) {
|
|
667
607
|
return e === void 0 ? 4 : e.startsWith("*") ? 1 : e.startsWith(":") ? 2 : 3;
|
|
668
608
|
}
|
|
669
|
-
async function
|
|
670
|
-
const o = i.documentContributions ?? !0, a =
|
|
609
|
+
async function tt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(), i = {}) {
|
|
610
|
+
const o = i.documentContributions ?? !0, a = F(e.routes, t);
|
|
671
611
|
if (!a)
|
|
672
612
|
return {
|
|
673
|
-
...await
|
|
613
|
+
...await me(e, t, {
|
|
674
614
|
documentContributions: o
|
|
675
615
|
}),
|
|
676
616
|
status: "not-found"
|
|
@@ -680,7 +620,7 @@ async function nt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(
|
|
|
680
620
|
), u = await a.route.load();
|
|
681
621
|
if (!u.GET || u.GET.kind !== "page")
|
|
682
622
|
return {
|
|
683
|
-
...await
|
|
623
|
+
...await me(e, t, {
|
|
684
624
|
fallback: ye(
|
|
685
625
|
e.fallbacks.notFound,
|
|
686
626
|
a.route
|
|
@@ -703,8 +643,8 @@ async function nt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(
|
|
|
703
643
|
status: "ready",
|
|
704
644
|
match: {
|
|
705
645
|
data: u.GET.data && !n?.hasData ? await u.GET.data(m) : n?.data,
|
|
706
|
-
error: await
|
|
707
|
-
links: o ? await
|
|
646
|
+
error: await rt(e, a.route),
|
|
647
|
+
links: o ? await kt(
|
|
708
648
|
[
|
|
709
649
|
...f.map((d) => d.links),
|
|
710
650
|
u.links
|
|
@@ -722,7 +662,7 @@ async function nt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(
|
|
|
722
662
|
path: a.path,
|
|
723
663
|
pathname: t,
|
|
724
664
|
render: u.GET.render,
|
|
725
|
-
scripts: o ? await
|
|
665
|
+
scripts: o ? await $t(
|
|
726
666
|
[
|
|
727
667
|
...f.map((d) => d.scripts),
|
|
728
668
|
u.scripts
|
|
@@ -732,7 +672,7 @@ async function nt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(
|
|
|
732
672
|
}
|
|
733
673
|
};
|
|
734
674
|
}
|
|
735
|
-
async function
|
|
675
|
+
async function li(e, t = {}) {
|
|
736
676
|
const r = ge(), n = [];
|
|
737
677
|
for (const s of e.routes) {
|
|
738
678
|
const i = await s.load();
|
|
@@ -742,8 +682,8 @@ async function mi(e, t = {}) {
|
|
|
742
682
|
throw new Error(
|
|
743
683
|
`Page route "${s.file}" uses render mode "${i.GET.render.mode}" and cannot be emitted as static output. Set render: { mode: "static" } or deploy a runtime adapter.`
|
|
744
684
|
);
|
|
745
|
-
const o =
|
|
746
|
-
if (
|
|
685
|
+
const o = or(s.segments);
|
|
686
|
+
if (cr(s.segments).length === 0) {
|
|
747
687
|
n.push({
|
|
748
688
|
file: s.file,
|
|
749
689
|
path: {},
|
|
@@ -758,28 +698,28 @@ async function mi(e, t = {}) {
|
|
|
758
698
|
);
|
|
759
699
|
const c = await i.paths({ cache: r });
|
|
760
700
|
for (const u of c) {
|
|
761
|
-
const f =
|
|
701
|
+
const f = ur(s, o, u);
|
|
762
702
|
n.push({
|
|
763
703
|
file: s.file,
|
|
764
704
|
path: f,
|
|
765
705
|
pattern: o,
|
|
766
|
-
pathname:
|
|
706
|
+
pathname: lr(s.segments, f)
|
|
767
707
|
});
|
|
768
708
|
}
|
|
769
709
|
}
|
|
770
710
|
return n;
|
|
771
711
|
}
|
|
772
|
-
async function
|
|
773
|
-
const r =
|
|
712
|
+
async function di(e, t) {
|
|
713
|
+
const r = F(e.routes, t);
|
|
774
714
|
if (r)
|
|
775
|
-
return await
|
|
715
|
+
return await sr(
|
|
776
716
|
ye(e.fallbacks.loading, r.route)
|
|
777
717
|
);
|
|
778
718
|
}
|
|
779
|
-
async function
|
|
719
|
+
async function er(e, t) {
|
|
780
720
|
let r;
|
|
781
721
|
try {
|
|
782
|
-
r =
|
|
722
|
+
r = F(e.routes, t);
|
|
783
723
|
} catch (n) {
|
|
784
724
|
if (!(n instanceof Ee)) throw n;
|
|
785
725
|
return await Se(
|
|
@@ -788,20 +728,20 @@ async function nr(e, t) {
|
|
|
788
728
|
)
|
|
789
729
|
);
|
|
790
730
|
}
|
|
791
|
-
return r ? await
|
|
731
|
+
return r ? await rt(e, r.route) : await tr(e, t);
|
|
792
732
|
}
|
|
793
|
-
async function
|
|
733
|
+
async function rt(e, t) {
|
|
794
734
|
return await Se(
|
|
795
735
|
ye(e.fallbacks.error, t)
|
|
796
736
|
);
|
|
797
737
|
}
|
|
798
|
-
async function
|
|
738
|
+
async function tr(e, t) {
|
|
799
739
|
return await Se(
|
|
800
|
-
|
|
740
|
+
nt(e.fallbacks.error, t)
|
|
801
741
|
);
|
|
802
742
|
}
|
|
803
|
-
async function
|
|
804
|
-
const s = await (r.fallback ??
|
|
743
|
+
async function me(e, t, r = {}) {
|
|
744
|
+
const s = await (r.fallback ?? nt(e.fallbacks.notFound, t))?.load(), i = s?.default, o = r.documentContributions ?? !0;
|
|
805
745
|
if (s?.layout === !1)
|
|
806
746
|
return {
|
|
807
747
|
layouts: [],
|
|
@@ -809,7 +749,7 @@ async function de(e, t, r = {}) {
|
|
|
809
749
|
notFound: i,
|
|
810
750
|
pathname: t
|
|
811
751
|
};
|
|
812
|
-
const a = r.layouts ??
|
|
752
|
+
const a = r.layouts ?? rr(e, t);
|
|
813
753
|
try {
|
|
814
754
|
const c = await Promise.all(
|
|
815
755
|
a.map((u) => u.load())
|
|
@@ -834,16 +774,16 @@ async function de(e, t, r = {}) {
|
|
|
834
774
|
};
|
|
835
775
|
}
|
|
836
776
|
}
|
|
837
|
-
function
|
|
838
|
-
const r =
|
|
777
|
+
function rr(e, t) {
|
|
778
|
+
const r = X(t);
|
|
839
779
|
return e.layouts.filter(
|
|
840
|
-
(n) => !n.fileSegments.some(
|
|
780
|
+
(n) => !n.fileSegments.some(Q) && we(n.segments, r)
|
|
841
781
|
);
|
|
842
782
|
}
|
|
843
|
-
function
|
|
844
|
-
const r =
|
|
783
|
+
function nr(e, t) {
|
|
784
|
+
const r = X(t);
|
|
845
785
|
return e.policies.filter(
|
|
846
|
-
(n) => !n.fileSegments.some(
|
|
786
|
+
(n) => !n.fileSegments.some(Q) && we(n.segments, r)
|
|
847
787
|
);
|
|
848
788
|
}
|
|
849
789
|
function ye(e, t) {
|
|
@@ -853,34 +793,34 @@ function ye(e, t) {
|
|
|
853
793
|
return n;
|
|
854
794
|
}
|
|
855
795
|
}
|
|
856
|
-
function
|
|
857
|
-
const r =
|
|
796
|
+
function nt(e, t) {
|
|
797
|
+
const r = X(t);
|
|
858
798
|
for (let n = e.length - 1; n >= 0; n -= 1) {
|
|
859
799
|
const s = e[n];
|
|
860
|
-
if (!s.fileSegments.some(
|
|
800
|
+
if (!s.fileSegments.some(Q) && we(s.segments, r))
|
|
861
801
|
return s;
|
|
862
802
|
}
|
|
863
803
|
}
|
|
864
804
|
function we(e, t) {
|
|
865
805
|
return e.every((r, n) => r.startsWith("*") ? t.length > n : r.startsWith(":") ? !!t[n] : t[n] === r);
|
|
866
806
|
}
|
|
867
|
-
async function
|
|
807
|
+
async function sr(e) {
|
|
868
808
|
return e ? (await e.load()).default : void 0;
|
|
869
809
|
}
|
|
870
810
|
async function Se(e) {
|
|
871
811
|
return e ? (await e.load()).default : void 0;
|
|
872
812
|
}
|
|
873
|
-
function
|
|
874
|
-
const r =
|
|
813
|
+
function F(e, t) {
|
|
814
|
+
const r = X(t);
|
|
875
815
|
for (const n of e) {
|
|
876
|
-
const s =
|
|
816
|
+
const s = ir(n.segments, r);
|
|
877
817
|
if (s)
|
|
878
818
|
return { route: n, path: s };
|
|
879
819
|
}
|
|
880
820
|
return null;
|
|
881
821
|
}
|
|
882
|
-
const
|
|
883
|
-
function
|
|
822
|
+
const mi = tt, hi = F;
|
|
823
|
+
function ir(e, t) {
|
|
884
824
|
const r = {};
|
|
885
825
|
for (let n = 0; n < e.length; n += 1) {
|
|
886
826
|
const s = e[n], i = t[n];
|
|
@@ -897,7 +837,7 @@ function cr(e, t) {
|
|
|
897
837
|
}
|
|
898
838
|
return e.length === t.length ? r : null;
|
|
899
839
|
}
|
|
900
|
-
function
|
|
840
|
+
function pi(e, t) {
|
|
901
841
|
return e.every(
|
|
902
842
|
(r, n) => t[n] === r
|
|
903
843
|
);
|
|
@@ -908,21 +848,21 @@ function T(e, t) {
|
|
|
908
848
|
);
|
|
909
849
|
}
|
|
910
850
|
function R(e) {
|
|
911
|
-
return e.flatMap((t) =>
|
|
851
|
+
return e.flatMap((t) => Q(t) ? [] : t === "index" ? [] : t.startsWith("[...") && t.endsWith("]") ? [`*${t.slice(4, -1)}`] : t.startsWith("[") && t.endsWith("]") ? [`:${t.slice(1, -1)}`] : [t]);
|
|
912
852
|
}
|
|
913
|
-
function
|
|
853
|
+
function Q(e) {
|
|
914
854
|
return e.startsWith("(") && e.endsWith(")");
|
|
915
855
|
}
|
|
916
|
-
function
|
|
917
|
-
return e.length === 0 ? "/" : `/${e.map(
|
|
856
|
+
function or(e) {
|
|
857
|
+
return e.length === 0 ? "/" : `/${e.map(ar).join("/")}`;
|
|
918
858
|
}
|
|
919
|
-
function
|
|
859
|
+
function ar(e) {
|
|
920
860
|
return e.startsWith("*") ? `[...${e.slice(1)}]` : e.startsWith(":") ? `[${e.slice(1)}]` : e;
|
|
921
861
|
}
|
|
922
|
-
function
|
|
862
|
+
function cr(e) {
|
|
923
863
|
return e.flatMap((t) => t.startsWith(":") || t.startsWith("*") ? [t.slice(1)] : []);
|
|
924
864
|
}
|
|
925
|
-
function
|
|
865
|
+
function ur(e, t, r) {
|
|
926
866
|
const n = {};
|
|
927
867
|
for (const s of e.segments) {
|
|
928
868
|
if (!s.startsWith(":") && !s.startsWith("*"))
|
|
@@ -932,7 +872,7 @@ function dr(e, t, r) {
|
|
|
932
872
|
throw new Error(
|
|
933
873
|
`Static paths for "${e.file}" must include "${i}" for "${t}".`
|
|
934
874
|
);
|
|
935
|
-
if (!
|
|
875
|
+
if (!fr(o))
|
|
936
876
|
throw new Error(
|
|
937
877
|
`Static path "${i}" for "${e.file}" must be a string, number, or boolean.`
|
|
938
878
|
);
|
|
@@ -940,16 +880,16 @@ function dr(e, t, r) {
|
|
|
940
880
|
}
|
|
941
881
|
return n;
|
|
942
882
|
}
|
|
943
|
-
function
|
|
883
|
+
function fr(e) {
|
|
944
884
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
945
885
|
}
|
|
946
|
-
function
|
|
886
|
+
function lr(e, t) {
|
|
947
887
|
return `/${e.map((n) => n.startsWith("*") ? t[n.slice(1)].split("/").filter(Boolean).map(encodeURIComponent).join("/") : n.startsWith(":") ? encodeURIComponent(t[n.slice(1)]) : encodeURIComponent(n)).filter(Boolean).join("/")}`;
|
|
948
888
|
}
|
|
949
|
-
function
|
|
889
|
+
function dr(e) {
|
|
950
890
|
return R(e).reduce((t, r) => r.startsWith("*") ? t : r.startsWith(":") ? t + 1 : t + 2, 0);
|
|
951
891
|
}
|
|
952
|
-
function
|
|
892
|
+
function X(e) {
|
|
953
893
|
return e.replace(/^\/|\/$/g, "").split("/").filter(Boolean).map((t) => {
|
|
954
894
|
try {
|
|
955
895
|
return decodeURIComponent(t);
|
|
@@ -967,35 +907,35 @@ class Ee extends URIError {
|
|
|
967
907
|
), this.name = "MalformedPathnameError", this.pathname = t;
|
|
968
908
|
}
|
|
969
909
|
}
|
|
970
|
-
const C = "x-demiurge-navigation",
|
|
971
|
-
function
|
|
972
|
-
return e.headers.get(C) ===
|
|
910
|
+
const C = "x-demiurge-navigation", mr = "data", hr = "data", ie = "error", Oe = "not-found";
|
|
911
|
+
function st(e) {
|
|
912
|
+
return e.headers.get(C) === mr;
|
|
973
913
|
}
|
|
974
|
-
function
|
|
914
|
+
function pr(e) {
|
|
975
915
|
return Response.json(
|
|
976
916
|
{ data: e, hasData: !0 },
|
|
977
917
|
{
|
|
978
918
|
headers: {
|
|
979
919
|
"cache-control": "no-store",
|
|
980
|
-
[C]:
|
|
920
|
+
[C]: hr,
|
|
981
921
|
vary: C
|
|
982
922
|
}
|
|
983
923
|
}
|
|
984
924
|
);
|
|
985
925
|
}
|
|
986
|
-
function
|
|
926
|
+
function z(e, t) {
|
|
987
927
|
return e.headers.set("cache-control", "no-store"), e.headers.set(C, t), e.headers.append("vary", C), e;
|
|
988
928
|
}
|
|
989
|
-
function
|
|
929
|
+
function gr(e) {
|
|
990
930
|
if (typeof e == "string")
|
|
991
931
|
return e;
|
|
992
|
-
const t = Er(
|
|
932
|
+
const t = yr(Er(
|
|
993
933
|
e.to,
|
|
994
934
|
"path" in e ? e.path : void 0
|
|
995
|
-
)), r = e.search === void 0 ? t.search :
|
|
935
|
+
)), r = e.search === void 0 ? t.search : wr(e.search), n = e.hash === void 0 ? t.hash : e.hash ? e.hash.startsWith("#") ? e.hash : `#${e.hash}` : "";
|
|
996
936
|
return `${t.pathname}${r}${n}`;
|
|
997
937
|
}
|
|
998
|
-
function
|
|
938
|
+
function yr(e) {
|
|
999
939
|
const t = e.indexOf("#"), r = t === -1 ? e : e.slice(0, t), n = r.indexOf("?");
|
|
1000
940
|
return {
|
|
1001
941
|
hash: t === -1 ? "" : e.slice(t),
|
|
@@ -1003,15 +943,15 @@ function Er(e) {
|
|
|
1003
943
|
search: n === -1 ? "" : r.slice(n)
|
|
1004
944
|
};
|
|
1005
945
|
}
|
|
1006
|
-
function
|
|
946
|
+
function wr(e) {
|
|
1007
947
|
if (!e)
|
|
1008
948
|
return "";
|
|
1009
949
|
if (typeof e == "string")
|
|
1010
950
|
return e.startsWith("?") ? e : `?${e}`;
|
|
1011
|
-
const r = (e instanceof URLSearchParams ? e :
|
|
951
|
+
const r = (e instanceof URLSearchParams ? e : Sr(e)).toString();
|
|
1012
952
|
return r ? `?${r}` : "";
|
|
1013
953
|
}
|
|
1014
|
-
function
|
|
954
|
+
function Sr(e) {
|
|
1015
955
|
const t = new URLSearchParams();
|
|
1016
956
|
for (const [r, n] of Object.entries(e)) {
|
|
1017
957
|
const s = Array.isArray(n) ? n : [n];
|
|
@@ -1020,7 +960,7 @@ function vr(e) {
|
|
|
1020
960
|
}
|
|
1021
961
|
return t;
|
|
1022
962
|
}
|
|
1023
|
-
function
|
|
963
|
+
function Er(e, t) {
|
|
1024
964
|
return t ? e.replace(
|
|
1025
965
|
/\[(\.\.\.)?([a-zA-Z_$][a-zA-Z0-9_$]*)\]/g,
|
|
1026
966
|
(r, n, s) => {
|
|
@@ -1031,7 +971,7 @@ function br(e, t) {
|
|
|
1031
971
|
}
|
|
1032
972
|
) : e;
|
|
1033
973
|
}
|
|
1034
|
-
function
|
|
974
|
+
function gi(e, t) {
|
|
1035
975
|
return {
|
|
1036
976
|
cors: t?.cors,
|
|
1037
977
|
kind: "json",
|
|
@@ -1041,7 +981,7 @@ function wi(e, t) {
|
|
|
1041
981
|
init: b(t)
|
|
1042
982
|
};
|
|
1043
983
|
}
|
|
1044
|
-
function
|
|
984
|
+
function yi(e, t) {
|
|
1045
985
|
return {
|
|
1046
986
|
cors: t?.cors,
|
|
1047
987
|
init: b(t),
|
|
@@ -1051,7 +991,7 @@ function Si(e, t) {
|
|
|
1051
991
|
timing: S(t?.timing)
|
|
1052
992
|
};
|
|
1053
993
|
}
|
|
1054
|
-
function
|
|
994
|
+
function wi(e, t) {
|
|
1055
995
|
return {
|
|
1056
996
|
cors: t?.cors,
|
|
1057
997
|
kind: "text",
|
|
@@ -1061,7 +1001,7 @@ function Ei(e, t) {
|
|
|
1061
1001
|
init: b(t)
|
|
1062
1002
|
};
|
|
1063
1003
|
}
|
|
1064
|
-
function
|
|
1004
|
+
function Si(e, t) {
|
|
1065
1005
|
return {
|
|
1066
1006
|
cors: t?.cors,
|
|
1067
1007
|
kind: "html",
|
|
@@ -1071,18 +1011,18 @@ function Ri(e, t) {
|
|
|
1071
1011
|
init: b(t)
|
|
1072
1012
|
};
|
|
1073
1013
|
}
|
|
1074
|
-
function
|
|
1014
|
+
function Ei(e, t) {
|
|
1075
1015
|
const r = typeof t == "number" ? void 0 : t;
|
|
1076
1016
|
return {
|
|
1077
1017
|
cors: r?.cors,
|
|
1078
1018
|
kind: "redirect",
|
|
1079
1019
|
security: r?.security,
|
|
1080
1020
|
timing: S(r?.timing),
|
|
1081
|
-
to:
|
|
1021
|
+
to: kr(e) ? gr(e) : e,
|
|
1082
1022
|
init: typeof t == "number" ? { status: t } : b(t)
|
|
1083
1023
|
};
|
|
1084
1024
|
}
|
|
1085
|
-
function
|
|
1025
|
+
function Ri(e, t) {
|
|
1086
1026
|
return {
|
|
1087
1027
|
cors: t?.cors,
|
|
1088
1028
|
kind: "not-found",
|
|
@@ -1092,7 +1032,7 @@ function bi(e, t) {
|
|
|
1092
1032
|
init: b(t)
|
|
1093
1033
|
};
|
|
1094
1034
|
}
|
|
1095
|
-
function
|
|
1035
|
+
function vi(e, t) {
|
|
1096
1036
|
return {
|
|
1097
1037
|
cors: t?.cors,
|
|
1098
1038
|
kind: "response",
|
|
@@ -1101,7 +1041,7 @@ function Ti(e, t) {
|
|
|
1101
1041
|
timing: S(t?.timing)
|
|
1102
1042
|
};
|
|
1103
1043
|
}
|
|
1104
|
-
function
|
|
1044
|
+
function bi(e, t) {
|
|
1105
1045
|
return {
|
|
1106
1046
|
body: e,
|
|
1107
1047
|
cors: t?.cors,
|
|
@@ -1111,7 +1051,7 @@ function xi(e, t) {
|
|
|
1111
1051
|
timing: S(t?.timing)
|
|
1112
1052
|
};
|
|
1113
1053
|
}
|
|
1114
|
-
function
|
|
1054
|
+
function Ti(e, t) {
|
|
1115
1055
|
return {
|
|
1116
1056
|
cors: t?.cors,
|
|
1117
1057
|
events: e,
|
|
@@ -1121,15 +1061,15 @@ function Pi(e, t) {
|
|
|
1121
1061
|
timing: S(t?.timing)
|
|
1122
1062
|
};
|
|
1123
1063
|
}
|
|
1124
|
-
function
|
|
1064
|
+
function xi(...e) {
|
|
1125
1065
|
return e;
|
|
1126
1066
|
}
|
|
1127
|
-
async function
|
|
1067
|
+
async function Rr(e, t) {
|
|
1128
1068
|
switch (e.kind) {
|
|
1129
1069
|
case "json":
|
|
1130
1070
|
return new Response(JSON.stringify(await y(e.value, t)), {
|
|
1131
1071
|
...e.init,
|
|
1132
|
-
headers:
|
|
1072
|
+
headers: oe(
|
|
1133
1073
|
e.init?.headers,
|
|
1134
1074
|
"content-type",
|
|
1135
1075
|
"application/json; charset=utf-8"
|
|
@@ -1137,10 +1077,10 @@ async function Tr(e, t) {
|
|
|
1137
1077
|
});
|
|
1138
1078
|
case "jsonl":
|
|
1139
1079
|
return new Response(
|
|
1140
|
-
|
|
1080
|
+
br(await y(e.lines, t)),
|
|
1141
1081
|
{
|
|
1142
1082
|
...e.init,
|
|
1143
|
-
headers:
|
|
1083
|
+
headers: G(e.init?.headers, {
|
|
1144
1084
|
"cache-control": "no-cache",
|
|
1145
1085
|
"content-type": "application/x-ndjson; charset=utf-8",
|
|
1146
1086
|
"x-accel-buffering": "no"
|
|
@@ -1150,7 +1090,7 @@ async function Tr(e, t) {
|
|
|
1150
1090
|
case "text":
|
|
1151
1091
|
return new Response(await y(e.value, t), {
|
|
1152
1092
|
...e.init,
|
|
1153
|
-
headers:
|
|
1093
|
+
headers: oe(
|
|
1154
1094
|
e.init?.headers,
|
|
1155
1095
|
"content-type",
|
|
1156
1096
|
"text/plain; charset=utf-8"
|
|
@@ -1159,7 +1099,7 @@ async function Tr(e, t) {
|
|
|
1159
1099
|
case "html":
|
|
1160
1100
|
return new Response(await y(e.value, t), {
|
|
1161
1101
|
...e.init,
|
|
1162
|
-
headers:
|
|
1102
|
+
headers: oe(
|
|
1163
1103
|
e.init?.headers,
|
|
1164
1104
|
"content-type",
|
|
1165
1105
|
"text/html; charset=utf-8"
|
|
@@ -1185,10 +1125,10 @@ async function Tr(e, t) {
|
|
|
1185
1125
|
return await y(e.response, t);
|
|
1186
1126
|
case "stream":
|
|
1187
1127
|
return new Response(
|
|
1188
|
-
|
|
1128
|
+
Tr(await y(e.body, t)),
|
|
1189
1129
|
{
|
|
1190
1130
|
...e.init,
|
|
1191
|
-
headers:
|
|
1131
|
+
headers: G(e.init?.headers, {
|
|
1192
1132
|
"content-type": "application/octet-stream",
|
|
1193
1133
|
"x-accel-buffering": "no"
|
|
1194
1134
|
})
|
|
@@ -1196,10 +1136,10 @@ async function Tr(e, t) {
|
|
|
1196
1136
|
);
|
|
1197
1137
|
case "sse":
|
|
1198
1138
|
return new Response(
|
|
1199
|
-
|
|
1139
|
+
vr(await y(e.events, t)),
|
|
1200
1140
|
{
|
|
1201
1141
|
...e.init,
|
|
1202
|
-
headers:
|
|
1142
|
+
headers: G(e.init?.headers, {
|
|
1203
1143
|
"cache-control": "no-cache",
|
|
1204
1144
|
"content-type": "text/event-stream; charset=utf-8",
|
|
1205
1145
|
"x-accel-buffering": "no"
|
|
@@ -1213,16 +1153,16 @@ async function y(e, t) {
|
|
|
1213
1153
|
t
|
|
1214
1154
|
);
|
|
1215
1155
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return
|
|
1156
|
+
function oe(e, t, r) {
|
|
1157
|
+
return G(e, { [t]: r });
|
|
1218
1158
|
}
|
|
1219
|
-
function
|
|
1159
|
+
function G(e, t) {
|
|
1220
1160
|
const r = new Headers(e);
|
|
1221
1161
|
for (const [n, s] of Object.entries(t))
|
|
1222
1162
|
r.has(n) || r.set(n, s);
|
|
1223
1163
|
return r;
|
|
1224
1164
|
}
|
|
1225
|
-
function
|
|
1165
|
+
function vr(e) {
|
|
1226
1166
|
const t = new TextEncoder(), r = Re(e);
|
|
1227
1167
|
return new ReadableStream({
|
|
1228
1168
|
async pull(n) {
|
|
@@ -1231,14 +1171,14 @@ function xr(e) {
|
|
|
1231
1171
|
n.close();
|
|
1232
1172
|
return;
|
|
1233
1173
|
}
|
|
1234
|
-
n.enqueue(t.encode(
|
|
1174
|
+
n.enqueue(t.encode(Ar(s.value)));
|
|
1235
1175
|
},
|
|
1236
1176
|
async cancel() {
|
|
1237
1177
|
await r.return?.();
|
|
1238
1178
|
}
|
|
1239
1179
|
});
|
|
1240
1180
|
}
|
|
1241
|
-
function
|
|
1181
|
+
function br(e) {
|
|
1242
1182
|
const t = new TextEncoder(), r = Re(e);
|
|
1243
1183
|
return new ReadableStream({
|
|
1244
1184
|
async pull(n) {
|
|
@@ -1255,7 +1195,7 @@ function Pr(e) {
|
|
|
1255
1195
|
}
|
|
1256
1196
|
});
|
|
1257
1197
|
}
|
|
1258
|
-
function
|
|
1198
|
+
function Tr(e) {
|
|
1259
1199
|
const t = new TextEncoder(), r = Re(e);
|
|
1260
1200
|
return new ReadableStream({
|
|
1261
1201
|
async pull(n) {
|
|
@@ -1264,14 +1204,14 @@ function kr(e) {
|
|
|
1264
1204
|
n.close();
|
|
1265
1205
|
return;
|
|
1266
1206
|
}
|
|
1267
|
-
n.enqueue(
|
|
1207
|
+
n.enqueue(xr(s.value, t));
|
|
1268
1208
|
},
|
|
1269
1209
|
async cancel() {
|
|
1270
1210
|
await r.return?.();
|
|
1271
1211
|
}
|
|
1272
1212
|
});
|
|
1273
1213
|
}
|
|
1274
|
-
function
|
|
1214
|
+
function xr(e, t) {
|
|
1275
1215
|
return typeof e == "string" ? t.encode(e) : e;
|
|
1276
1216
|
}
|
|
1277
1217
|
function Re(e) {
|
|
@@ -1286,9 +1226,9 @@ function Re(e) {
|
|
|
1286
1226
|
}
|
|
1287
1227
|
};
|
|
1288
1228
|
}
|
|
1289
|
-
return Symbol.asyncIterator in e ? e[Symbol.asyncIterator]() :
|
|
1229
|
+
return Symbol.asyncIterator in e ? e[Symbol.asyncIterator]() : Pr(e[Symbol.iterator]());
|
|
1290
1230
|
}
|
|
1291
|
-
function
|
|
1231
|
+
function Pr(e) {
|
|
1292
1232
|
return {
|
|
1293
1233
|
async next() {
|
|
1294
1234
|
return e.next();
|
|
@@ -1298,21 +1238,21 @@ function Ar(e) {
|
|
|
1298
1238
|
}
|
|
1299
1239
|
};
|
|
1300
1240
|
}
|
|
1301
|
-
function
|
|
1241
|
+
function Ar(e) {
|
|
1302
1242
|
if (typeof e == "string")
|
|
1303
|
-
return
|
|
1243
|
+
return Cr(e);
|
|
1304
1244
|
const t = [];
|
|
1305
1245
|
if (e.comment !== void 0 && t.push(...N("", e.comment)), e.id !== void 0 && t.push(...N("id", e.id)), e.event !== void 0 && t.push(...N("event", e.event)), e.retry !== void 0) {
|
|
1306
1246
|
if (!Number.isInteger(e.retry) || e.retry < 0)
|
|
1307
1247
|
throw new Error("SSE retry must be a non-negative integer.");
|
|
1308
1248
|
t.push(`retry: ${e.retry}`);
|
|
1309
1249
|
}
|
|
1310
|
-
return e.data !== void 0 && t.push(...N("data",
|
|
1250
|
+
return e.data !== void 0 && t.push(...N("data", $r(e.data))), `${t.join(`
|
|
1311
1251
|
`)}
|
|
1312
1252
|
|
|
1313
1253
|
`;
|
|
1314
1254
|
}
|
|
1315
|
-
function
|
|
1255
|
+
function Cr(e) {
|
|
1316
1256
|
return `${N("data", e).join(`
|
|
1317
1257
|
`)}
|
|
1318
1258
|
|
|
@@ -1323,10 +1263,10 @@ function N(e, t) {
|
|
|
1323
1263
|
(r) => e ? `${e}: ${r}` : `: ${r}`
|
|
1324
1264
|
);
|
|
1325
1265
|
}
|
|
1326
|
-
function
|
|
1266
|
+
function $r(e) {
|
|
1327
1267
|
return typeof e == "string" ? e : JSON.stringify(e);
|
|
1328
1268
|
}
|
|
1329
|
-
function
|
|
1269
|
+
function kr(e) {
|
|
1330
1270
|
return typeof e == "object" && e !== null && !(e instanceof URL) && "to" in e;
|
|
1331
1271
|
}
|
|
1332
1272
|
function b(e) {
|
|
@@ -1340,10 +1280,10 @@ function b(e) {
|
|
|
1340
1280
|
} = e;
|
|
1341
1281
|
return s;
|
|
1342
1282
|
}
|
|
1343
|
-
function
|
|
1283
|
+
function Dr(e, t) {
|
|
1344
1284
|
if (!t?.length)
|
|
1345
1285
|
return e;
|
|
1346
|
-
const r = new Headers(e.headers), n =
|
|
1286
|
+
const r = new Headers(e.headers), n = Nr(t), s = r.get("server-timing");
|
|
1347
1287
|
return r.set(
|
|
1348
1288
|
"server-timing",
|
|
1349
1289
|
s ? `${s}, ${n}` : n
|
|
@@ -1353,15 +1293,15 @@ function Lr(e, t) {
|
|
|
1353
1293
|
statusText: e.statusText
|
|
1354
1294
|
});
|
|
1355
1295
|
}
|
|
1356
|
-
function
|
|
1357
|
-
return e.map(
|
|
1296
|
+
function Nr(e) {
|
|
1297
|
+
return e.map(Or).join(", ");
|
|
1358
1298
|
}
|
|
1359
1299
|
function S(e) {
|
|
1360
1300
|
if (e)
|
|
1361
1301
|
return Array.isArray(e) ? e : [e];
|
|
1362
1302
|
}
|
|
1363
|
-
function
|
|
1364
|
-
if (!
|
|
1303
|
+
function Or(e) {
|
|
1304
|
+
if (!Lr(e.name))
|
|
1365
1305
|
throw new Error(
|
|
1366
1306
|
`Server-Timing metric name "${e.name}" is not a valid token.`
|
|
1367
1307
|
);
|
|
@@ -1369,20 +1309,20 @@ function Mr(e) {
|
|
|
1369
1309
|
if (e.duration !== void 0) {
|
|
1370
1310
|
if (!Number.isFinite(e.duration) || e.duration < 0)
|
|
1371
1311
|
throw new Error("Server-Timing metric duration must be a non-negative finite number.");
|
|
1372
|
-
t.push(`dur=${
|
|
1312
|
+
t.push(`dur=${Ir(e.duration)}`);
|
|
1373
1313
|
}
|
|
1374
|
-
return e.description !== void 0 && t.push(`desc="${
|
|
1314
|
+
return e.description !== void 0 && t.push(`desc="${Mr(e.description)}"`), t.join(";");
|
|
1375
1315
|
}
|
|
1376
|
-
function
|
|
1316
|
+
function Lr(e) {
|
|
1377
1317
|
return /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(e);
|
|
1378
1318
|
}
|
|
1379
|
-
function
|
|
1319
|
+
function Ir(e) {
|
|
1380
1320
|
return Number.isInteger(e), String(e);
|
|
1381
1321
|
}
|
|
1382
|
-
function
|
|
1322
|
+
function Mr(e) {
|
|
1383
1323
|
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
1384
1324
|
}
|
|
1385
|
-
const
|
|
1325
|
+
const Ur = [
|
|
1386
1326
|
400,
|
|
1387
1327
|
401,
|
|
1388
1328
|
402,
|
|
@@ -1423,7 +1363,7 @@ const Fr = [
|
|
|
1423
1363
|
508,
|
|
1424
1364
|
510,
|
|
1425
1365
|
511
|
|
1426
|
-
],
|
|
1366
|
+
], Hr = {
|
|
1427
1367
|
400: "Bad Request",
|
|
1428
1368
|
401: "Unauthorized",
|
|
1429
1369
|
402: "Payment Required",
|
|
@@ -1464,8 +1404,8 @@ const Fr = [
|
|
|
1464
1404
|
508: "Loop Detected",
|
|
1465
1405
|
510: "Not Extended",
|
|
1466
1406
|
511: "Network Authentication Required"
|
|
1467
|
-
},
|
|
1468
|
-
class
|
|
1407
|
+
}, jr = new Set(Ur);
|
|
1408
|
+
class it extends Error {
|
|
1469
1409
|
detail;
|
|
1470
1410
|
extensions;
|
|
1471
1411
|
headers;
|
|
@@ -1473,29 +1413,29 @@ class at extends Error {
|
|
|
1473
1413
|
title;
|
|
1474
1414
|
type;
|
|
1475
1415
|
constructor(t, r = {}, n = {}) {
|
|
1476
|
-
|
|
1416
|
+
Fr(t);
|
|
1477
1417
|
const s = typeof r == "string" ? { detail: r } : r, {
|
|
1478
1418
|
detail: i,
|
|
1479
|
-
title: o =
|
|
1419
|
+
title: o = Hr[t],
|
|
1480
1420
|
type: a = "about:blank",
|
|
1481
1421
|
...c
|
|
1482
1422
|
} = s;
|
|
1483
1423
|
super(i ?? o, { cause: n.cause }), this.name = "HttpError", this.detail = i, this.extensions = Object.freeze({ ...c }), this.headers = new Headers(n.headers), this.status = t, this.title = o, this.type = a;
|
|
1484
1424
|
}
|
|
1485
1425
|
}
|
|
1486
|
-
function
|
|
1487
|
-
return new
|
|
1426
|
+
function Pi(e, t, r) {
|
|
1427
|
+
return new it(e, t, r);
|
|
1488
1428
|
}
|
|
1489
1429
|
function ve(e) {
|
|
1490
|
-
return e instanceof
|
|
1430
|
+
return e instanceof it;
|
|
1491
1431
|
}
|
|
1492
|
-
function
|
|
1493
|
-
if (!
|
|
1432
|
+
function Fr(e) {
|
|
1433
|
+
if (!jr.has(e))
|
|
1494
1434
|
throw new RangeError(
|
|
1495
1435
|
`HTTP error status must be a standard 4xx or 5xx status; received ${JSON.stringify(e)}.`
|
|
1496
1436
|
);
|
|
1497
1437
|
}
|
|
1498
|
-
function
|
|
1438
|
+
function Le({ pathname: e }) {
|
|
1499
1439
|
return /* @__PURE__ */ I("main", { children: [
|
|
1500
1440
|
/* @__PURE__ */ M("h1", { children: "404" }),
|
|
1501
1441
|
/* @__PURE__ */ I("p", { children: [
|
|
@@ -1505,14 +1445,14 @@ function Me({ pathname: e }) {
|
|
|
1505
1445
|
] })
|
|
1506
1446
|
] });
|
|
1507
1447
|
}
|
|
1508
|
-
function
|
|
1448
|
+
function Ie({ status: e }) {
|
|
1509
1449
|
return /* @__PURE__ */ I("main", { children: [
|
|
1510
1450
|
/* @__PURE__ */ M("h1", { children: e }),
|
|
1511
1451
|
/* @__PURE__ */ M("p", { children: "Something went wrong." })
|
|
1512
1452
|
] });
|
|
1513
1453
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const { message: n, name: s, stack: i } =
|
|
1454
|
+
function Wr({ error: e, pathname: t, status: r }) {
|
|
1455
|
+
const { message: n, name: s, stack: i } = ot(e);
|
|
1516
1456
|
return /* @__PURE__ */ I("main", { children: [
|
|
1517
1457
|
/* @__PURE__ */ I("h1", { children: [
|
|
1518
1458
|
r,
|
|
@@ -1525,7 +1465,7 @@ function Br({ error: e, pathname: t, status: r }) {
|
|
|
1525
1465
|
i ? /* @__PURE__ */ M("pre", { children: i }) : null
|
|
1526
1466
|
] });
|
|
1527
1467
|
}
|
|
1528
|
-
function
|
|
1468
|
+
function ot(e) {
|
|
1529
1469
|
return e instanceof Error ? {
|
|
1530
1470
|
message: e.message,
|
|
1531
1471
|
name: e.name,
|
|
@@ -1536,27 +1476,27 @@ function ct(e) {
|
|
|
1536
1476
|
stack: void 0
|
|
1537
1477
|
};
|
|
1538
1478
|
}
|
|
1539
|
-
const
|
|
1540
|
-
function
|
|
1541
|
-
return
|
|
1479
|
+
const qr = ["text/html", "application/xhtml+xml"];
|
|
1480
|
+
function at(e) {
|
|
1481
|
+
return zr(e.headers.get("accept"));
|
|
1542
1482
|
}
|
|
1543
|
-
function
|
|
1544
|
-
return e ?
|
|
1545
|
-
(t) => t.quality > 0 &&
|
|
1483
|
+
function zr(e) {
|
|
1484
|
+
return e ? Br(e).some(
|
|
1485
|
+
(t) => t.quality > 0 && qr.includes(t.type)
|
|
1546
1486
|
) : !1;
|
|
1547
1487
|
}
|
|
1548
|
-
function
|
|
1488
|
+
function Br(e) {
|
|
1549
1489
|
return e.split(",").flatMap((t) => {
|
|
1550
1490
|
const [r, ...n] = t.split(";"), s = r.trim().toLowerCase();
|
|
1551
1491
|
return s ? [
|
|
1552
1492
|
{
|
|
1553
|
-
quality:
|
|
1493
|
+
quality: Gr(n),
|
|
1554
1494
|
type: s
|
|
1555
1495
|
}
|
|
1556
1496
|
] : [];
|
|
1557
1497
|
});
|
|
1558
1498
|
}
|
|
1559
|
-
function
|
|
1499
|
+
function Gr(e) {
|
|
1560
1500
|
for (const t of e) {
|
|
1561
1501
|
const [r, n] = t.split("=");
|
|
1562
1502
|
if (r?.trim().toLowerCase() !== "q")
|
|
@@ -1566,8 +1506,8 @@ function Jr(e) {
|
|
|
1566
1506
|
}
|
|
1567
1507
|
return 1;
|
|
1568
1508
|
}
|
|
1569
|
-
const
|
|
1570
|
-
function
|
|
1509
|
+
const _r = "application/problem+json";
|
|
1510
|
+
function Vr({
|
|
1571
1511
|
detail: e,
|
|
1572
1512
|
instance: t,
|
|
1573
1513
|
status: r,
|
|
@@ -1584,26 +1524,26 @@ function Yr({
|
|
|
1584
1524
|
...i
|
|
1585
1525
|
};
|
|
1586
1526
|
}
|
|
1587
|
-
function
|
|
1527
|
+
function J(e, t) {
|
|
1588
1528
|
const r = new Headers(t?.headers);
|
|
1589
|
-
return r.set("content-type", `${
|
|
1529
|
+
return r.set("content-type", `${_r}; charset=utf-8`), new Response(JSON.stringify(Vr(e)), {
|
|
1590
1530
|
...t,
|
|
1591
1531
|
headers: r,
|
|
1592
1532
|
status: e.status
|
|
1593
1533
|
});
|
|
1594
1534
|
}
|
|
1595
|
-
const
|
|
1596
|
-
function
|
|
1535
|
+
const Jr = "Internal Server Error";
|
|
1536
|
+
function ct(e) {
|
|
1597
1537
|
return e === !0 && process.env.NODE_ENV !== "production";
|
|
1598
1538
|
}
|
|
1599
|
-
async function
|
|
1539
|
+
async function _(e, t, r, n, s = {}) {
|
|
1600
1540
|
s.onError?.(r, n);
|
|
1601
1541
|
const i = new URL(t.url);
|
|
1602
|
-
return n === "page" || n === "middleware" &&
|
|
1542
|
+
return n === "page" || n === "middleware" && at(t) ? await Yr(e, i, r, s) : Kr(i, r, s);
|
|
1603
1543
|
}
|
|
1604
|
-
function
|
|
1544
|
+
function Kr(e, t, r = {}) {
|
|
1605
1545
|
if (ve(t))
|
|
1606
|
-
return
|
|
1546
|
+
return J(
|
|
1607
1547
|
{
|
|
1608
1548
|
...t.extensions,
|
|
1609
1549
|
detail: t.detail,
|
|
@@ -1614,20 +1554,20 @@ function Qr(e, t, r = {}) {
|
|
|
1614
1554
|
},
|
|
1615
1555
|
{ headers: t.headers }
|
|
1616
1556
|
);
|
|
1617
|
-
const { message: n } =
|
|
1618
|
-
return
|
|
1557
|
+
const { message: n } = ot(t);
|
|
1558
|
+
return J({
|
|
1619
1559
|
// `detail` carries the thrown message, so it is dev only for the same
|
|
1620
1560
|
// reason the stack is.
|
|
1621
|
-
...
|
|
1561
|
+
...ct(r.dev) ? { detail: n } : {},
|
|
1622
1562
|
instance: `${e.pathname}${e.search}`,
|
|
1623
1563
|
status: 500,
|
|
1624
1564
|
title: "Internal Server Error"
|
|
1625
1565
|
});
|
|
1626
1566
|
}
|
|
1627
|
-
async function
|
|
1628
|
-
const s =
|
|
1567
|
+
async function Yr(e, t, r, n) {
|
|
1568
|
+
const s = ut(r);
|
|
1629
1569
|
try {
|
|
1630
|
-
const i = await
|
|
1570
|
+
const i = await Qr(
|
|
1631
1571
|
e,
|
|
1632
1572
|
t.pathname,
|
|
1633
1573
|
r,
|
|
@@ -1638,26 +1578,26 @@ async function Xr(e, t, r, n) {
|
|
|
1638
1578
|
status: s
|
|
1639
1579
|
});
|
|
1640
1580
|
} catch (i) {
|
|
1641
|
-
return n.onError?.(i, "page"),
|
|
1581
|
+
return n.onError?.(i, "page"), Zr();
|
|
1642
1582
|
}
|
|
1643
1583
|
}
|
|
1644
|
-
function
|
|
1645
|
-
return new Response(
|
|
1584
|
+
function Zr() {
|
|
1585
|
+
return new Response(Jr, {
|
|
1646
1586
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
1647
1587
|
status: 500
|
|
1648
1588
|
});
|
|
1649
1589
|
}
|
|
1650
|
-
async function
|
|
1651
|
-
const s = await
|
|
1590
|
+
async function Qr(e, t, r, n) {
|
|
1591
|
+
const s = await Xr(e, t, n), i = _e({
|
|
1652
1592
|
dev: n.dev,
|
|
1653
1593
|
nonce: n.nonce
|
|
1654
|
-
}), o =
|
|
1655
|
-
|
|
1594
|
+
}), o = Ke(
|
|
1595
|
+
Ve(
|
|
1656
1596
|
i,
|
|
1657
|
-
|
|
1597
|
+
fe(s, { error: r, pathname: t, status: ut(r) })
|
|
1658
1598
|
)
|
|
1659
1599
|
);
|
|
1660
|
-
return
|
|
1600
|
+
return Je({
|
|
1661
1601
|
body: { data: void 0, html: o, navigation: n.navigation },
|
|
1662
1602
|
entrySrc: n.clientEntry,
|
|
1663
1603
|
lang: n.lang,
|
|
@@ -1667,19 +1607,19 @@ async function tn(e, t, r, n) {
|
|
|
1667
1607
|
title: n.title
|
|
1668
1608
|
});
|
|
1669
1609
|
}
|
|
1670
|
-
function
|
|
1610
|
+
function ut(e) {
|
|
1671
1611
|
return ve(e) ? e.status : 500;
|
|
1672
1612
|
}
|
|
1673
|
-
async function
|
|
1674
|
-
if (
|
|
1675
|
-
return
|
|
1613
|
+
async function Xr(e, t, r) {
|
|
1614
|
+
if (ct(r.dev))
|
|
1615
|
+
return Wr;
|
|
1676
1616
|
try {
|
|
1677
|
-
return await
|
|
1617
|
+
return await er(e, t) ?? Ie;
|
|
1678
1618
|
} catch {
|
|
1679
|
-
return
|
|
1619
|
+
return Ie;
|
|
1680
1620
|
}
|
|
1681
1621
|
}
|
|
1682
|
-
const
|
|
1622
|
+
const K = "{nonce}", Me = `'nonce-${K}'`, ft = {
|
|
1683
1623
|
baseUri: ["'self'"],
|
|
1684
1624
|
connectSrc: ["'self'"],
|
|
1685
1625
|
defaultSrc: ["'self'"],
|
|
@@ -1688,14 +1628,14 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1688
1628
|
frameAncestors: ["'none'"],
|
|
1689
1629
|
imgSrc: ["'self'", "data:", "blob:"],
|
|
1690
1630
|
objectSrc: ["'none'"],
|
|
1691
|
-
scriptSrc: [
|
|
1692
|
-
styleSrc: ["'self'",
|
|
1631
|
+
scriptSrc: [Me, "'strict-dynamic'"],
|
|
1632
|
+
styleSrc: ["'self'", Me],
|
|
1693
1633
|
upgradeInsecureRequests: !0
|
|
1694
|
-
},
|
|
1695
|
-
...
|
|
1634
|
+
}, en = {
|
|
1635
|
+
...ft,
|
|
1696
1636
|
scriptSrc: ["'self'"],
|
|
1697
1637
|
styleSrc: ["'self'"]
|
|
1698
|
-
},
|
|
1638
|
+
}, Ue = {
|
|
1699
1639
|
contentTypeOptions: "nosniff",
|
|
1700
1640
|
crossOriginOpenerPolicy: "same-origin",
|
|
1701
1641
|
crossOriginResourcePolicy: "same-origin",
|
|
@@ -1706,27 +1646,27 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1706
1646
|
maxAge: 31536e3,
|
|
1707
1647
|
preload: !1
|
|
1708
1648
|
}
|
|
1709
|
-
},
|
|
1649
|
+
}, tn = {
|
|
1710
1650
|
contentTypeOptions: "nosniff",
|
|
1711
1651
|
crossOriginResourcePolicy: "same-origin",
|
|
1712
1652
|
referrerPolicy: "strict-origin-when-cross-origin"
|
|
1713
|
-
},
|
|
1653
|
+
}, D = {
|
|
1714
1654
|
api(e = {}) {
|
|
1715
1655
|
return O(
|
|
1716
1656
|
{
|
|
1717
|
-
headers:
|
|
1657
|
+
headers: tn
|
|
1718
1658
|
},
|
|
1719
1659
|
e
|
|
1720
1660
|
);
|
|
1721
1661
|
},
|
|
1722
1662
|
preset(e, t = {}) {
|
|
1723
|
-
return e === "api" ?
|
|
1663
|
+
return e === "api" ? D.api(t) : e === "cross-origin-isolated" ? D.crossOriginIsolated(t) : e === "static" ? D.static(t) : D.strict(t);
|
|
1724
1664
|
},
|
|
1725
1665
|
static(e = {}) {
|
|
1726
1666
|
return O(
|
|
1727
1667
|
{
|
|
1728
|
-
csp:
|
|
1729
|
-
headers:
|
|
1668
|
+
csp: en,
|
|
1669
|
+
headers: Ue
|
|
1730
1670
|
},
|
|
1731
1671
|
e
|
|
1732
1672
|
);
|
|
@@ -1734,15 +1674,15 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1734
1674
|
strict(e = {}) {
|
|
1735
1675
|
return O(
|
|
1736
1676
|
{
|
|
1737
|
-
csp:
|
|
1738
|
-
headers:
|
|
1677
|
+
csp: ft,
|
|
1678
|
+
headers: Ue
|
|
1739
1679
|
},
|
|
1740
1680
|
e
|
|
1741
1681
|
);
|
|
1742
1682
|
},
|
|
1743
1683
|
crossOriginIsolated(e = {}) {
|
|
1744
1684
|
return O(
|
|
1745
|
-
|
|
1685
|
+
D.strict({
|
|
1746
1686
|
headers: {
|
|
1747
1687
|
crossOriginEmbedderPolicy: "require-corp",
|
|
1748
1688
|
crossOriginOpenerPolicy: "same-origin"
|
|
@@ -1755,138 +1695,154 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1755
1695
|
function Ai(e) {
|
|
1756
1696
|
return e;
|
|
1757
1697
|
}
|
|
1758
|
-
function
|
|
1698
|
+
function Ci(e) {
|
|
1759
1699
|
return e;
|
|
1760
1700
|
}
|
|
1761
|
-
function
|
|
1701
|
+
function rn(...e) {
|
|
1762
1702
|
return e.reduce((t, r) => r ? O(t, r) : t, {});
|
|
1763
1703
|
}
|
|
1764
|
-
function
|
|
1704
|
+
function Y(...e) {
|
|
1765
1705
|
const t = e.reduce((r, n) => n ? {
|
|
1766
|
-
document:
|
|
1767
|
-
security:
|
|
1706
|
+
document: rn(r.document, n.document),
|
|
1707
|
+
security: nn(r.security, n.security)
|
|
1768
1708
|
} : r, {});
|
|
1769
1709
|
return {
|
|
1770
1710
|
...t,
|
|
1771
|
-
document:
|
|
1711
|
+
document: on(t.document, t.security?.needs)
|
|
1772
1712
|
};
|
|
1773
1713
|
}
|
|
1774
|
-
function
|
|
1714
|
+
function nn(...e) {
|
|
1775
1715
|
return e.reduce((t, r) => r ? {
|
|
1776
1716
|
csrf: r.csrf ?? t.csrf,
|
|
1777
|
-
needs:
|
|
1717
|
+
needs: sn(t.needs, r.needs),
|
|
1778
1718
|
rateLimit: r.rateLimit ?? t.rateLimit,
|
|
1779
|
-
request:
|
|
1719
|
+
request: mt(t.request, r.request)
|
|
1780
1720
|
} : t, {});
|
|
1781
1721
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1722
|
+
const lt = [
|
|
1723
|
+
{ directive: "connectSrc", need: "connect" },
|
|
1724
|
+
{ directive: "imgSrc", need: "img" },
|
|
1725
|
+
{ directive: "scriptSrc", need: "script" }
|
|
1726
|
+
];
|
|
1727
|
+
function sn(e, t) {
|
|
1728
|
+
const r = {};
|
|
1729
|
+
for (const { need: n } of lt) {
|
|
1730
|
+
const s = [.../* @__PURE__ */ new Set([
|
|
1731
|
+
...e?.[n] ?? [],
|
|
1732
|
+
...t?.[n] ?? []
|
|
1733
|
+
])];
|
|
1734
|
+
s.length > 0 && (r[n] = s);
|
|
1735
|
+
}
|
|
1736
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
1788
1737
|
}
|
|
1789
|
-
function
|
|
1790
|
-
if (!e?.csp || !t
|
|
1738
|
+
function on(e, t) {
|
|
1739
|
+
if (!e?.csp || !t)
|
|
1791
1740
|
return e;
|
|
1792
|
-
|
|
1741
|
+
let r = e.csp;
|
|
1742
|
+
for (const { directive: n, need: s } of lt)
|
|
1743
|
+
r = an(r, n, s, t[s]);
|
|
1744
|
+
return r === e.csp ? e : { ...e, csp: r };
|
|
1745
|
+
}
|
|
1746
|
+
function an(e, t, r, n) {
|
|
1747
|
+
if (!n || n.length === 0)
|
|
1748
|
+
return e;
|
|
1749
|
+
if (e[t] === !1)
|
|
1793
1750
|
throw new Error(
|
|
1794
|
-
`A route policy declares security.needs
|
|
1751
|
+
`A route policy declares security.needs.${r} and sets csp.${t} to false. Set an explicit csp.${t} that includes ${n.join(", ")}.`
|
|
1795
1752
|
);
|
|
1796
|
-
if (e
|
|
1753
|
+
if (e[t] === void 0 && e.defaultSrc === void 0)
|
|
1797
1754
|
return e;
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1755
|
+
const s = x(
|
|
1756
|
+
e[t] ?? e.defaultSrc
|
|
1757
|
+
) ?? [];
|
|
1758
|
+
return Array.isArray(s) ? {
|
|
1800
1759
|
...e,
|
|
1801
|
-
|
|
1802
|
-
...e.csp,
|
|
1803
|
-
scriptSrc: [.../* @__PURE__ */ new Set([...n, ...t])]
|
|
1804
|
-
}
|
|
1760
|
+
[t]: [.../* @__PURE__ */ new Set([...s, ...n])]
|
|
1805
1761
|
} : e;
|
|
1806
1762
|
}
|
|
1807
1763
|
async function $i(e, t = "sha256") {
|
|
1808
1764
|
const r = await globalThis.crypto.subtle.digest(
|
|
1809
|
-
|
|
1765
|
+
Rn(t),
|
|
1810
1766
|
new TextEncoder().encode(e)
|
|
1811
1767
|
);
|
|
1812
|
-
return `'${t}-${
|
|
1768
|
+
return `'${t}-${vn(new Uint8Array(r))}'`;
|
|
1813
1769
|
}
|
|
1814
|
-
function
|
|
1815
|
-
e.csp &&
|
|
1816
|
-
const r = new Headers(), n = e.csp !== !1 && e.csp ?
|
|
1770
|
+
function W(e, t = {}) {
|
|
1771
|
+
e.csp && wn(e.csp), yn(e);
|
|
1772
|
+
const r = new Headers(), n = e.csp !== !1 && e.csp ? hn(e.csp, t) : void 0, s = dn(e.trustedTypes), i = e.trustedTypes ? e.trustedTypes.mode === "report-only" : !1;
|
|
1817
1773
|
return w(
|
|
1818
1774
|
r,
|
|
1819
1775
|
"content-security-policy",
|
|
1820
|
-
|
|
1776
|
+
Z(n, i ? void 0 : s)
|
|
1821
1777
|
), w(
|
|
1822
1778
|
r,
|
|
1823
1779
|
"content-security-policy-report-only",
|
|
1824
|
-
i ?
|
|
1825
|
-
),
|
|
1780
|
+
i ? Z(s, pt(e.csp)) : void 0
|
|
1781
|
+
), ln(r, e.headers, t), r;
|
|
1826
1782
|
}
|
|
1827
|
-
function
|
|
1828
|
-
return !e || !e.csp ? !1 :
|
|
1783
|
+
function ee(e) {
|
|
1784
|
+
return !e || !e.csp ? !1 : q(e.csp).some(([, t]) => {
|
|
1829
1785
|
const r = x(t);
|
|
1830
|
-
return Array.isArray(r) && r.some((n) => n.includes(
|
|
1786
|
+
return Array.isArray(r) && r.some((n) => n.includes(K));
|
|
1831
1787
|
});
|
|
1832
1788
|
}
|
|
1833
|
-
function
|
|
1789
|
+
function dt() {
|
|
1834
1790
|
const e = new Uint8Array(16);
|
|
1835
1791
|
return globalThis.crypto.getRandomValues(e), btoa(String.fromCharCode(...e));
|
|
1836
1792
|
}
|
|
1837
1793
|
function O(e, t) {
|
|
1838
1794
|
return {
|
|
1839
|
-
csp:
|
|
1840
|
-
headers:
|
|
1795
|
+
csp: un(e.csp, t.csp),
|
|
1796
|
+
headers: cn(e.headers, t.headers),
|
|
1841
1797
|
trustedTypes: t.trustedTypes ?? e.trustedTypes
|
|
1842
1798
|
};
|
|
1843
1799
|
}
|
|
1844
|
-
function
|
|
1845
|
-
const r =
|
|
1800
|
+
function cn(e, t) {
|
|
1801
|
+
const r = mt(e, t);
|
|
1846
1802
|
return !r || t?.reportingEndpoints === !1 || e?.reportingEndpoints && t?.reportingEndpoints && (r.reportingEndpoints = {
|
|
1847
1803
|
...e.reportingEndpoints,
|
|
1848
1804
|
...t.reportingEndpoints
|
|
1849
1805
|
}), r;
|
|
1850
1806
|
}
|
|
1851
|
-
function
|
|
1807
|
+
function mt(e, t) {
|
|
1852
1808
|
return t ? {
|
|
1853
1809
|
...e ?? {},
|
|
1854
1810
|
...t
|
|
1855
1811
|
} : e;
|
|
1856
1812
|
}
|
|
1857
|
-
function
|
|
1813
|
+
function un(e, t) {
|
|
1858
1814
|
if (t === !1)
|
|
1859
1815
|
return !1;
|
|
1860
1816
|
if (!t)
|
|
1861
1817
|
return e;
|
|
1862
1818
|
if (!e)
|
|
1863
|
-
return
|
|
1864
|
-
const r =
|
|
1819
|
+
return ae(t);
|
|
1820
|
+
const r = ae(e), n = ae(t), s = {
|
|
1865
1821
|
...r,
|
|
1866
1822
|
...n
|
|
1867
1823
|
};
|
|
1868
|
-
for (const [i, o] of
|
|
1824
|
+
for (const [i, o] of q(t)) {
|
|
1869
1825
|
const a = x(
|
|
1870
1826
|
r[i]
|
|
1871
1827
|
);
|
|
1872
|
-
!be(o) && Array.isArray(a) && Array.isArray(o) &&
|
|
1828
|
+
!be(o) && Array.isArray(a) && Array.isArray(o) && ht(
|
|
1873
1829
|
s,
|
|
1874
1830
|
i,
|
|
1875
|
-
|
|
1831
|
+
fn([...a, ...o])
|
|
1876
1832
|
);
|
|
1877
1833
|
}
|
|
1878
1834
|
return s;
|
|
1879
1835
|
}
|
|
1880
|
-
function
|
|
1836
|
+
function ae(e) {
|
|
1881
1837
|
const t = { ...e };
|
|
1882
|
-
for (const [r, n] of
|
|
1883
|
-
be(n) &&
|
|
1838
|
+
for (const [r, n] of q(e))
|
|
1839
|
+
be(n) && ht(t, r, n.replace);
|
|
1884
1840
|
return t;
|
|
1885
1841
|
}
|
|
1886
|
-
function
|
|
1842
|
+
function fn(e) {
|
|
1887
1843
|
return [...new Set(e)];
|
|
1888
1844
|
}
|
|
1889
|
-
function
|
|
1845
|
+
function ht(e, t, r) {
|
|
1890
1846
|
if (!(t === "reportTo" || t === "upgradeInsecureRequests")) {
|
|
1891
1847
|
if (t === "reportUri") {
|
|
1892
1848
|
e.reportUri = r;
|
|
@@ -1895,87 +1851,87 @@ function pt(e, t, r) {
|
|
|
1895
1851
|
e[t] = r;
|
|
1896
1852
|
}
|
|
1897
1853
|
}
|
|
1898
|
-
function
|
|
1854
|
+
function ln(e, t, r) {
|
|
1899
1855
|
t && (w(e, "referrer-policy", t.referrerPolicy), w(e, "x-content-type-options", t.contentTypeOptions), w(e, "cross-origin-opener-policy", t.crossOriginOpenerPolicy), w(e, "cross-origin-embedder-policy", t.crossOriginEmbedderPolicy), w(e, "cross-origin-resource-policy", t.crossOriginResourcePolicy), w(e, "permissions-policy", t.permissionsPolicy), w(
|
|
1900
1856
|
e,
|
|
1901
1857
|
"reporting-endpoints",
|
|
1902
|
-
|
|
1858
|
+
pn(t.reportingEndpoints)
|
|
1903
1859
|
), t.strictTransportSecurity && (!r.request || new URL(r.request.url).protocol === "https:") && e.set(
|
|
1904
1860
|
"strict-transport-security",
|
|
1905
|
-
|
|
1861
|
+
mn(t.strictTransportSecurity)
|
|
1906
1862
|
));
|
|
1907
1863
|
}
|
|
1908
|
-
function
|
|
1864
|
+
function dn(e) {
|
|
1909
1865
|
if (!e)
|
|
1910
1866
|
return;
|
|
1911
1867
|
const t = [];
|
|
1912
|
-
return e.requireFor?.includes("script") && t.push("require-trusted-types-for 'script'"), e.policies.length > 0 && t.push(`trusted-types ${e.policies.join(" ")}`),
|
|
1868
|
+
return e.requireFor?.includes("script") && t.push("require-trusted-types-for 'script'"), e.policies.length > 0 && t.push(`trusted-types ${e.policies.join(" ")}`), Z(...t);
|
|
1913
1869
|
}
|
|
1914
|
-
function
|
|
1870
|
+
function Z(...e) {
|
|
1915
1871
|
const t = e.filter((r) => r);
|
|
1916
1872
|
return t.length > 0 ? t.join("; ") : void 0;
|
|
1917
1873
|
}
|
|
1918
1874
|
function w(e, t, r) {
|
|
1919
1875
|
r && e.set(t, r);
|
|
1920
1876
|
}
|
|
1921
|
-
function
|
|
1877
|
+
function mn(e) {
|
|
1922
1878
|
const t = [`max-age=${e.maxAge}`];
|
|
1923
1879
|
return e.includeSubDomains && t.push("includeSubDomains"), e.preload && t.push("preload"), t.join("; ");
|
|
1924
1880
|
}
|
|
1925
|
-
function
|
|
1881
|
+
function hn(e, t) {
|
|
1926
1882
|
const r = [];
|
|
1927
|
-
for (const [s, i] of
|
|
1883
|
+
for (const [s, i] of q(e)) {
|
|
1928
1884
|
if (s === "reportTo" || s === "reportUri")
|
|
1929
1885
|
continue;
|
|
1930
1886
|
const o = x(i);
|
|
1931
1887
|
if (o === !1 || o === void 0)
|
|
1932
1888
|
continue;
|
|
1933
|
-
const a =
|
|
1889
|
+
const a = gt(s);
|
|
1934
1890
|
if (o === !0) {
|
|
1935
1891
|
r.push(a);
|
|
1936
1892
|
continue;
|
|
1937
1893
|
}
|
|
1938
1894
|
r.push(
|
|
1939
|
-
`${a} ${
|
|
1895
|
+
`${a} ${En(o, t).join(" ")}`
|
|
1940
1896
|
);
|
|
1941
1897
|
}
|
|
1942
|
-
const n =
|
|
1898
|
+
const n = pt(e);
|
|
1943
1899
|
return n && r.push(n), r.join("; ");
|
|
1944
1900
|
}
|
|
1945
|
-
function
|
|
1901
|
+
function pt(e) {
|
|
1946
1902
|
if (!e)
|
|
1947
1903
|
return;
|
|
1948
1904
|
const t = [], r = x(e.reportUri);
|
|
1949
|
-
return Array.isArray(r) && r.length && t.push(`report-uri ${r.join(" ")}`), e.reportTo && t.push(`report-to ${e.reportTo}`),
|
|
1905
|
+
return Array.isArray(r) && r.length && t.push(`report-uri ${r.join(" ")}`), e.reportTo && t.push(`report-to ${e.reportTo}`), Z(...t);
|
|
1950
1906
|
}
|
|
1951
|
-
function
|
|
1907
|
+
function pn(e) {
|
|
1952
1908
|
if (e)
|
|
1953
|
-
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${
|
|
1909
|
+
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${gn(r)}"`).join(", ");
|
|
1954
1910
|
}
|
|
1955
|
-
function
|
|
1911
|
+
function gn(e) {
|
|
1956
1912
|
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
1957
1913
|
}
|
|
1958
|
-
function
|
|
1914
|
+
function yn(e) {
|
|
1959
1915
|
const t = e.headers?.reportingEndpoints;
|
|
1960
1916
|
if (t) {
|
|
1961
1917
|
const s = Object.entries(t);
|
|
1962
1918
|
if (s.length === 0)
|
|
1963
1919
|
throw new Error("Demiurge Reporting-Endpoints requires at least one endpoint.");
|
|
1964
1920
|
for (const [i, o] of s)
|
|
1965
|
-
|
|
1921
|
+
He(i), je(o, `Reporting-Endpoints member ${JSON.stringify(i)}`);
|
|
1966
1922
|
}
|
|
1967
1923
|
const r = e.csp || void 0;
|
|
1968
|
-
if (r?.reportTo && (
|
|
1924
|
+
if (r?.reportTo && (He(r.reportTo), !t || !(r.reportTo in t)))
|
|
1969
1925
|
throw new Error(
|
|
1970
1926
|
`Demiurge CSP report-to group ${JSON.stringify(r.reportTo)} is not defined in headers.reportingEndpoints.`
|
|
1971
1927
|
);
|
|
1972
1928
|
const n = x(r?.reportUri);
|
|
1973
1929
|
for (const s of Array.isArray(n) ? n : [])
|
|
1974
|
-
|
|
1930
|
+
je(s, "CSP report-uri target");
|
|
1975
1931
|
}
|
|
1976
|
-
function
|
|
1977
|
-
for (const [t, r] of
|
|
1978
|
-
const n =
|
|
1932
|
+
function wn(e) {
|
|
1933
|
+
for (const [t, r] of q(e)) {
|
|
1934
|
+
const n = gt(t);
|
|
1979
1935
|
if (r === void 0)
|
|
1980
1936
|
continue;
|
|
1981
1937
|
if (t === "reportTo") {
|
|
@@ -2005,14 +1961,14 @@ function be(e) {
|
|
|
2005
1961
|
function x(e) {
|
|
2006
1962
|
return be(e) ? e.replace : e;
|
|
2007
1963
|
}
|
|
2008
|
-
function
|
|
1964
|
+
function He(e) {
|
|
2009
1965
|
if (!/^(?:[a-z]|\*)[a-z0-9_.*-]*$/.test(e))
|
|
2010
1966
|
throw new Error(
|
|
2011
1967
|
`Invalid reporting endpoint name ${JSON.stringify(e)}. Use a lowercase Structured Field key.`
|
|
2012
1968
|
);
|
|
2013
1969
|
}
|
|
2014
|
-
function
|
|
2015
|
-
if (!
|
|
1970
|
+
function je(e, t) {
|
|
1971
|
+
if (!Sn(e) || /[\s,;"\\]/.test(e) || !e.startsWith("/") && !e.startsWith("https://"))
|
|
2016
1972
|
throw new Error(`${t} must be a same-origin path or an HTTPS URL.`);
|
|
2017
1973
|
if (e.startsWith("//"))
|
|
2018
1974
|
throw new Error(`${t} must not be a scheme-relative URL.`);
|
|
@@ -2025,39 +1981,39 @@ function We(e, t) {
|
|
|
2025
1981
|
if (r.username || r.password || r.hash)
|
|
2026
1982
|
throw new Error(`${t} must not contain credentials or a fragment.`);
|
|
2027
1983
|
}
|
|
2028
|
-
function
|
|
1984
|
+
function Sn(e) {
|
|
2029
1985
|
return /^[\x20-\x7e]+$/.test(e);
|
|
2030
1986
|
}
|
|
2031
|
-
function
|
|
1987
|
+
function q(e) {
|
|
2032
1988
|
return Object.entries(e);
|
|
2033
1989
|
}
|
|
2034
|
-
function
|
|
1990
|
+
function En(e, t) {
|
|
2035
1991
|
return e.map((r) => {
|
|
2036
|
-
if (!r.includes(
|
|
1992
|
+
if (!r.includes(K))
|
|
2037
1993
|
return r;
|
|
2038
1994
|
if (!t.nonce)
|
|
2039
1995
|
throw new Error("Demiurge security policy requires a CSP nonce.");
|
|
2040
|
-
return r.replaceAll(
|
|
1996
|
+
return r.replaceAll(K, t.nonce);
|
|
2041
1997
|
});
|
|
2042
1998
|
}
|
|
2043
|
-
function
|
|
1999
|
+
function gt(e) {
|
|
2044
2000
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
2045
2001
|
}
|
|
2046
|
-
function
|
|
2002
|
+
function Rn(e) {
|
|
2047
2003
|
return e === "sha384" ? "SHA-384" : e === "sha512" ? "SHA-512" : "SHA-256";
|
|
2048
2004
|
}
|
|
2049
|
-
function
|
|
2005
|
+
function vn(e) {
|
|
2050
2006
|
let t = "";
|
|
2051
2007
|
for (const r of e)
|
|
2052
2008
|
t += String.fromCharCode(r);
|
|
2053
2009
|
return typeof btoa == "function" ? btoa(t) : Buffer.from(t, "binary").toString("base64");
|
|
2054
2010
|
}
|
|
2055
|
-
function
|
|
2011
|
+
function yt(e, t, r = {}) {
|
|
2056
2012
|
Te(e);
|
|
2057
2013
|
const n = t.request.headers.get("origin"), s = new Headers();
|
|
2058
|
-
if (e.origins !== "*" &&
|
|
2014
|
+
if (e.origins !== "*" && wt(s, "Origin"), !n)
|
|
2059
2015
|
return s;
|
|
2060
|
-
const i =
|
|
2016
|
+
const i = xn(e, n);
|
|
2061
2017
|
if (!i)
|
|
2062
2018
|
return s;
|
|
2063
2019
|
if (s.set("access-control-allow-origin", i), e.credentials && s.set("access-control-allow-credentials", "true"), e.exposeHeaders?.length && s.set("access-control-expose-headers", e.exposeHeaders.join(", ")), r.preflight) {
|
|
@@ -2069,26 +2025,26 @@ function wt(e, t, r = {}) {
|
|
|
2069
2025
|
}
|
|
2070
2026
|
return s;
|
|
2071
2027
|
}
|
|
2072
|
-
function
|
|
2028
|
+
function V(e, t, r) {
|
|
2073
2029
|
if (!t)
|
|
2074
2030
|
return e;
|
|
2075
2031
|
const n = new Headers(e.headers);
|
|
2076
|
-
return
|
|
2032
|
+
return Pn(n, yt(t, { request: r })), new Response(e.body, {
|
|
2077
2033
|
headers: n,
|
|
2078
2034
|
status: e.status,
|
|
2079
2035
|
statusText: e.statusText
|
|
2080
2036
|
});
|
|
2081
2037
|
}
|
|
2082
|
-
function
|
|
2038
|
+
function bn(e, t) {
|
|
2083
2039
|
const r = t.headers.get("access-control-request-method"), n = An(r);
|
|
2084
2040
|
if (!n)
|
|
2085
2041
|
return null;
|
|
2086
|
-
const s =
|
|
2042
|
+
const s = St(e, n);
|
|
2087
2043
|
if (!s?.cors)
|
|
2088
2044
|
return null;
|
|
2089
|
-
const i = s.cors.methods ??
|
|
2045
|
+
const i = s.cors.methods ?? Cn(e);
|
|
2090
2046
|
return i.includes(n) ? new Response(null, {
|
|
2091
|
-
headers:
|
|
2047
|
+
headers: yt(
|
|
2092
2048
|
s.cors,
|
|
2093
2049
|
{ request: t },
|
|
2094
2050
|
{
|
|
@@ -2110,41 +2066,41 @@ function Te(e) {
|
|
|
2110
2066
|
);
|
|
2111
2067
|
if (e.origins !== "*")
|
|
2112
2068
|
for (const t of e.origins)
|
|
2113
|
-
|
|
2069
|
+
Tn(t);
|
|
2114
2070
|
if (e.maxAge !== void 0 && (!Number.isSafeInteger(e.maxAge) || e.maxAge < 0))
|
|
2115
2071
|
throw new Error(
|
|
2116
2072
|
"Demiurge CORS maxAge must be a non-negative integer number of seconds."
|
|
2117
2073
|
);
|
|
2118
2074
|
}
|
|
2119
|
-
function
|
|
2075
|
+
function Tn(e) {
|
|
2120
2076
|
let t;
|
|
2121
2077
|
try {
|
|
2122
2078
|
t = new URL(e);
|
|
2123
2079
|
} catch {
|
|
2124
|
-
throw
|
|
2080
|
+
throw Fe(e);
|
|
2125
2081
|
}
|
|
2126
2082
|
if (t.protocol !== "http:" && t.protocol !== "https:" || t.origin !== e)
|
|
2127
|
-
throw
|
|
2083
|
+
throw Fe(e);
|
|
2128
2084
|
}
|
|
2129
|
-
function
|
|
2085
|
+
function Fe(e) {
|
|
2130
2086
|
return new Error(
|
|
2131
2087
|
`Demiurge CORS origin ${JSON.stringify(e)} must be a canonical HTTP(S) origin without credentials, a path, query, or fragment.`
|
|
2132
2088
|
);
|
|
2133
2089
|
}
|
|
2134
|
-
function
|
|
2090
|
+
function xn(e, t) {
|
|
2135
2091
|
return e.origins === "*" ? "*" : e.origins.includes(t) ? t : null;
|
|
2136
2092
|
}
|
|
2137
|
-
function
|
|
2093
|
+
function Pn(e, t) {
|
|
2138
2094
|
t.forEach((r, n) => {
|
|
2139
2095
|
if (n === "vary" && e.has("vary")) {
|
|
2140
2096
|
for (const s of r.split(","))
|
|
2141
|
-
|
|
2097
|
+
wt(e, s.trim());
|
|
2142
2098
|
return;
|
|
2143
2099
|
}
|
|
2144
2100
|
e.set(n, r);
|
|
2145
2101
|
});
|
|
2146
2102
|
}
|
|
2147
|
-
function
|
|
2103
|
+
function wt(e, t) {
|
|
2148
2104
|
if (!t)
|
|
2149
2105
|
return;
|
|
2150
2106
|
const r = e.get("vary")?.split(",").map((n) => n.trim()).filter(Boolean) ?? [];
|
|
@@ -2156,13 +2112,13 @@ function An(e) {
|
|
|
2156
2112
|
const t = e.toUpperCase();
|
|
2157
2113
|
return $n(t) ? t : null;
|
|
2158
2114
|
}
|
|
2159
|
-
function
|
|
2160
|
-
return t === "HEAD" ? e.HEAD ??
|
|
2115
|
+
function St(e, t) {
|
|
2116
|
+
return t === "HEAD" ? e.HEAD ?? We(e.GET) : We(e[t]);
|
|
2161
2117
|
}
|
|
2162
|
-
function
|
|
2118
|
+
function We(e) {
|
|
2163
2119
|
return e?.kind === "page" ? void 0 : e;
|
|
2164
2120
|
}
|
|
2165
|
-
function
|
|
2121
|
+
function Cn(e) {
|
|
2166
2122
|
return [
|
|
2167
2123
|
"GET",
|
|
2168
2124
|
"POST",
|
|
@@ -2171,25 +2127,25 @@ function Dn(e) {
|
|
|
2171
2127
|
"DELETE",
|
|
2172
2128
|
"OPTIONS",
|
|
2173
2129
|
"HEAD"
|
|
2174
|
-
].filter((t) =>
|
|
2130
|
+
].filter((t) => St(e, t));
|
|
2175
2131
|
}
|
|
2176
2132
|
function $n(e) {
|
|
2177
2133
|
return e === "GET" || e === "POST" || e === "PUT" || e === "PATCH" || e === "DELETE" || e === "OPTIONS" || e === "HEAD";
|
|
2178
2134
|
}
|
|
2179
|
-
const
|
|
2180
|
-
function
|
|
2181
|
-
const t = [], r = e.document, n = r ?
|
|
2182
|
-
r &&
|
|
2183
|
-
const s = e.route ?
|
|
2184
|
-
return r?.scripts && (
|
|
2135
|
+
const kn = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]);
|
|
2136
|
+
function Dn(e = {}) {
|
|
2137
|
+
const t = [], r = e.document, n = r ? Ln(r.policy, r.headers, t) : {};
|
|
2138
|
+
r && Nn(r.policy, t);
|
|
2139
|
+
const s = e.route ? zn(e.route, t) : void 0;
|
|
2140
|
+
return r?.scripts && (In(
|
|
2185
2141
|
r.policy.csp,
|
|
2186
2142
|
r.scripts,
|
|
2187
2143
|
r.headers,
|
|
2188
2144
|
t
|
|
2189
2145
|
), r.scriptDependencies && t.push(
|
|
2190
|
-
...
|
|
2146
|
+
...On(
|
|
2191
2147
|
r.scripts,
|
|
2192
|
-
|
|
2148
|
+
Mn(r.scriptDependencies)
|
|
2193
2149
|
)
|
|
2194
2150
|
)), {
|
|
2195
2151
|
findings: t,
|
|
@@ -2197,20 +2153,20 @@ function On(e = {}) {
|
|
|
2197
2153
|
route: s
|
|
2198
2154
|
};
|
|
2199
2155
|
}
|
|
2200
|
-
function
|
|
2156
|
+
function Nn(e, t) {
|
|
2201
2157
|
if (!e.trustedTypes || e.trustedTypes.mode !== "report-only")
|
|
2202
2158
|
return;
|
|
2203
|
-
const r = e.csp || void 0, n = !!
|
|
2159
|
+
const r = e.csp || void 0, n = !!he(r?.reportUri)?.length, s = e.headers?.reportingEndpoints, i = !!(r?.reportTo && s && s[r.reportTo]);
|
|
2204
2160
|
!n && !i && t.push({
|
|
2205
2161
|
code: "report-only-target-missing",
|
|
2206
2162
|
message: "Trusted Types report-only mode has no deliverable target. Configure CSP reportTo with a matching Reporting-Endpoints member, reportUri for compatibility, or both.",
|
|
2207
2163
|
severity: "warning"
|
|
2208
2164
|
});
|
|
2209
2165
|
}
|
|
2210
|
-
function
|
|
2166
|
+
function On(e, t = {}) {
|
|
2211
2167
|
const r = t.requirePurpose ?? !0, n = [];
|
|
2212
2168
|
for (const s of e) {
|
|
2213
|
-
const i =
|
|
2169
|
+
const i = _n(s);
|
|
2214
2170
|
i && (r && !s.purpose && n.push({
|
|
2215
2171
|
code: "script-purpose-missing",
|
|
2216
2172
|
message: `Third-party script ${s.src} should declare a purpose for audits and consent flows.`,
|
|
@@ -2223,7 +2179,7 @@ function In(e, t = {}) {
|
|
|
2223
2179
|
code: "script-third-party-before-interactive",
|
|
2224
2180
|
message: `Third-party script ${s.src} runs before the app is interactive and should be justified by policy.`,
|
|
2225
2181
|
severity: "warning"
|
|
2226
|
-
}),
|
|
2182
|
+
}), Vn(i) && n.push({
|
|
2227
2183
|
code: "script-gtm-wide-trust-boundary",
|
|
2228
2184
|
message: "Google Tag Manager can load additional scripts at runtime and should be treated as a wide trust boundary.",
|
|
2229
2185
|
severity: "warning"
|
|
@@ -2231,9 +2187,9 @@ function In(e, t = {}) {
|
|
|
2231
2187
|
}
|
|
2232
2188
|
return n;
|
|
2233
2189
|
}
|
|
2234
|
-
function
|
|
2190
|
+
function Ln(e, t, r) {
|
|
2235
2191
|
try {
|
|
2236
|
-
return Object.fromEntries(
|
|
2192
|
+
return Object.fromEntries(W(e, t));
|
|
2237
2193
|
} catch (n) {
|
|
2238
2194
|
return r.push({
|
|
2239
2195
|
code: "security-header-render-failed",
|
|
@@ -2242,12 +2198,12 @@ function Mn(e, t, r) {
|
|
|
2242
2198
|
}), {};
|
|
2243
2199
|
}
|
|
2244
2200
|
}
|
|
2245
|
-
function
|
|
2201
|
+
function In(e, t, r, n) {
|
|
2246
2202
|
if (!e)
|
|
2247
2203
|
return;
|
|
2248
|
-
const s =
|
|
2204
|
+
const s = Un(e);
|
|
2249
2205
|
for (const i of t) {
|
|
2250
|
-
if (
|
|
2206
|
+
if (Hn(s) && !i.nonce) {
|
|
2251
2207
|
n.push({
|
|
2252
2208
|
code: "csp-script-missing-nonce",
|
|
2253
2209
|
message: `Document script ${i.src} needs a nonce for the effective script-src policy.`,
|
|
@@ -2255,33 +2211,33 @@ function Un(e, t, r, n) {
|
|
|
2255
2211
|
});
|
|
2256
2212
|
continue;
|
|
2257
2213
|
}
|
|
2258
|
-
i.nonce && r?.nonce && i.nonce === r.nonce ||
|
|
2214
|
+
i.nonce && r?.nonce && i.nonce === r.nonce || jn(s, i.src) || n.push({
|
|
2259
2215
|
code: "csp-script-src-blocked",
|
|
2260
2216
|
message: `Document script ${i.src} is not allowed by the effective script-src policy.`,
|
|
2261
2217
|
severity: "error"
|
|
2262
2218
|
});
|
|
2263
2219
|
}
|
|
2264
2220
|
}
|
|
2265
|
-
function
|
|
2221
|
+
function Mn(e) {
|
|
2266
2222
|
return typeof e == "boolean" ? {} : e;
|
|
2267
2223
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return
|
|
2224
|
+
function Un(e) {
|
|
2225
|
+
return he(e.scriptSrc) ?? he(e.defaultSrc) ?? [];
|
|
2270
2226
|
}
|
|
2271
|
-
function
|
|
2227
|
+
function he(e) {
|
|
2272
2228
|
if (e)
|
|
2273
2229
|
return "replace" in e ? e.replace : e;
|
|
2274
2230
|
}
|
|
2275
|
-
function
|
|
2231
|
+
function Hn(e) {
|
|
2276
2232
|
return e.some((t) => t.includes("'nonce-{nonce}'"));
|
|
2277
2233
|
}
|
|
2278
|
-
function
|
|
2279
|
-
return
|
|
2234
|
+
function jn(e, t) {
|
|
2235
|
+
return qn(e) ? !1 : e.includes("*") ? !0 : e.includes("'none'") || e.some((r) => r.startsWith("'nonce-")) ? !1 : e.includes("'self'") && Fn(t) || t.startsWith("https:") && e.includes("https:") || t.startsWith("http:") && e.includes("http:") ? !0 : e.some((r) => Wn(r, t));
|
|
2280
2236
|
}
|
|
2281
|
-
function
|
|
2237
|
+
function Fn(e) {
|
|
2282
2238
|
return e.startsWith("/") && !e.startsWith("//");
|
|
2283
2239
|
}
|
|
2284
|
-
function
|
|
2240
|
+
function Wn(e, t) {
|
|
2285
2241
|
if (e.startsWith("'"))
|
|
2286
2242
|
return !1;
|
|
2287
2243
|
try {
|
|
@@ -2291,19 +2247,19 @@ function zn(e, t) {
|
|
|
2291
2247
|
return !1;
|
|
2292
2248
|
}
|
|
2293
2249
|
}
|
|
2294
|
-
function
|
|
2250
|
+
function qn(e) {
|
|
2295
2251
|
return e.includes("'strict-dynamic'") && e.some(
|
|
2296
2252
|
(t) => t.startsWith("'nonce-") || /^'sha(?:256|384|512)-/.test(t)
|
|
2297
2253
|
);
|
|
2298
2254
|
}
|
|
2299
|
-
function
|
|
2300
|
-
return
|
|
2255
|
+
function zn(e, t) {
|
|
2256
|
+
return Bn(e.cors, t), Gn(e.method, e.security, t), {
|
|
2301
2257
|
cors: e.cors,
|
|
2302
2258
|
method: e.method,
|
|
2303
2259
|
security: e.security
|
|
2304
2260
|
};
|
|
2305
2261
|
}
|
|
2306
|
-
function
|
|
2262
|
+
function Bn(e, t) {
|
|
2307
2263
|
if (e)
|
|
2308
2264
|
try {
|
|
2309
2265
|
Te(e);
|
|
@@ -2315,8 +2271,8 @@ function _n(e, t) {
|
|
|
2315
2271
|
});
|
|
2316
2272
|
}
|
|
2317
2273
|
}
|
|
2318
|
-
function
|
|
2319
|
-
|
|
2274
|
+
function Gn(e, t, r) {
|
|
2275
|
+
kn.has(e) && (t?.csrf === !1 && r.push({
|
|
2320
2276
|
code: "csrf-disabled",
|
|
2321
2277
|
message: "CSRF protection is explicitly disabled for this unsafe route.",
|
|
2322
2278
|
severity: "info"
|
|
@@ -2330,7 +2286,7 @@ function Vn(e, t, r) {
|
|
|
2330
2286
|
severity: "warning"
|
|
2331
2287
|
}));
|
|
2332
2288
|
}
|
|
2333
|
-
function
|
|
2289
|
+
function _n(e) {
|
|
2334
2290
|
try {
|
|
2335
2291
|
const t = new URL(e.src);
|
|
2336
2292
|
if (t.protocol === "http:" || t.protocol === "https:")
|
|
@@ -2340,17 +2296,17 @@ function Jn(e) {
|
|
|
2340
2296
|
}
|
|
2341
2297
|
return null;
|
|
2342
2298
|
}
|
|
2343
|
-
function
|
|
2299
|
+
function Vn(e) {
|
|
2344
2300
|
return e.hostname === "www.googletagmanager.com" && (e.pathname === "/gtm.js" || e.pathname === "/ns.html");
|
|
2345
2301
|
}
|
|
2346
|
-
const
|
|
2347
|
-
function
|
|
2302
|
+
const Jn = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]), Kn = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/;
|
|
2303
|
+
function Yn() {
|
|
2348
2304
|
const e = new Uint8Array(32);
|
|
2349
2305
|
return globalThis.crypto.getRandomValues(e), btoa(String.fromCharCode(...e)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
2350
2306
|
}
|
|
2351
|
-
function
|
|
2307
|
+
function Zn(e, t = {}) {
|
|
2352
2308
|
const r = t.cookie ?? "csrf-token";
|
|
2353
|
-
if (!
|
|
2309
|
+
if (!Kn.test(r))
|
|
2354
2310
|
throw new Error("Demiurge CSRF cookie name is invalid.");
|
|
2355
2311
|
if (!e)
|
|
2356
2312
|
throw new Error("Demiurge CSRF token must not be empty.");
|
|
@@ -2361,25 +2317,25 @@ function Xn(e, t = {}) {
|
|
|
2361
2317
|
];
|
|
2362
2318
|
return (t.secure ?? !0) && n.push("Secure"), n.join("; ");
|
|
2363
2319
|
}
|
|
2364
|
-
function
|
|
2365
|
-
const t =
|
|
2320
|
+
function ki(e = {}) {
|
|
2321
|
+
const t = Yn();
|
|
2366
2322
|
return {
|
|
2367
|
-
cookie:
|
|
2323
|
+
cookie: Zn(t, e),
|
|
2368
2324
|
token: t
|
|
2369
2325
|
};
|
|
2370
2326
|
}
|
|
2371
|
-
function
|
|
2372
|
-
if (!
|
|
2327
|
+
function Qn(e, t) {
|
|
2328
|
+
if (!Jn.has(t.method.toUpperCase()) || e === !1)
|
|
2373
2329
|
return null;
|
|
2374
2330
|
const r = t.headers.get("cookie");
|
|
2375
2331
|
if (e === void 0 && !r?.trim())
|
|
2376
2332
|
return null;
|
|
2377
|
-
const n =
|
|
2378
|
-
return !i || !o || !
|
|
2333
|
+
const n = es(e ?? !0), i = Xn(r).get(n.cookie), o = t.headers.get(n.header);
|
|
2334
|
+
return !i || !o || !rs(i, o) ? new Response("Invalid CSRF token.", {
|
|
2379
2335
|
status: 403
|
|
2380
2336
|
}) : null;
|
|
2381
2337
|
}
|
|
2382
|
-
function
|
|
2338
|
+
function Xn(e) {
|
|
2383
2339
|
const t = /* @__PURE__ */ new Map();
|
|
2384
2340
|
if (!e)
|
|
2385
2341
|
return t;
|
|
@@ -2388,11 +2344,11 @@ function ts(e) {
|
|
|
2388
2344
|
if (n === -1)
|
|
2389
2345
|
continue;
|
|
2390
2346
|
const s = r.slice(0, n).trim(), i = r.slice(n + 1).trim();
|
|
2391
|
-
s && t.set(s,
|
|
2347
|
+
s && t.set(s, ts(i));
|
|
2392
2348
|
}
|
|
2393
2349
|
return t;
|
|
2394
2350
|
}
|
|
2395
|
-
function
|
|
2351
|
+
function es(e) {
|
|
2396
2352
|
return e === !0 ? {
|
|
2397
2353
|
cookie: "csrf-token",
|
|
2398
2354
|
header: "x-csrf-token"
|
|
@@ -2401,27 +2357,27 @@ function rs(e) {
|
|
|
2401
2357
|
header: e.header ?? "x-csrf-token"
|
|
2402
2358
|
};
|
|
2403
2359
|
}
|
|
2404
|
-
function
|
|
2360
|
+
function ts(e) {
|
|
2405
2361
|
try {
|
|
2406
2362
|
return decodeURIComponent(e);
|
|
2407
2363
|
} catch {
|
|
2408
2364
|
return e;
|
|
2409
2365
|
}
|
|
2410
2366
|
}
|
|
2411
|
-
function
|
|
2367
|
+
function rs(e, t) {
|
|
2412
2368
|
let r = e.length ^ t.length;
|
|
2413
2369
|
const n = Math.max(e.length, t.length);
|
|
2414
2370
|
for (let s = 0; s < n; s += 1)
|
|
2415
2371
|
r |= e.charCodeAt(s) ^ t.charCodeAt(s);
|
|
2416
2372
|
return r === 0;
|
|
2417
2373
|
}
|
|
2418
|
-
const
|
|
2374
|
+
const ns = {
|
|
2419
2375
|
h: 3600 * 1e3,
|
|
2420
2376
|
m: 60 * 1e3,
|
|
2421
2377
|
s: 1e3
|
|
2422
|
-
},
|
|
2423
|
-
function
|
|
2424
|
-
const t = e.maximumEntries ??
|
|
2378
|
+
}, ss = 1e4;
|
|
2379
|
+
function Et(e = {}) {
|
|
2380
|
+
const t = e.maximumEntries ?? ss;
|
|
2425
2381
|
if (!Number.isSafeInteger(t) || t <= 0)
|
|
2426
2382
|
throw new Error(
|
|
2427
2383
|
"Demiurge rate limit maximumEntries must be a positive integer."
|
|
@@ -2430,38 +2386,38 @@ function Rt(e = {}) {
|
|
|
2430
2386
|
let n = Number.POSITIVE_INFINITY;
|
|
2431
2387
|
return {
|
|
2432
2388
|
increment(s, i, o) {
|
|
2433
|
-
o >= n && (
|
|
2389
|
+
o >= n && (is(r, o), n = os(r));
|
|
2434
2390
|
const a = r.get(s);
|
|
2435
2391
|
if (!a || a.resetAt <= o) {
|
|
2436
2392
|
const c = {
|
|
2437
2393
|
count: 1,
|
|
2438
2394
|
resetAt: o + i
|
|
2439
2395
|
};
|
|
2440
|
-
return !a && r.size >= t &&
|
|
2396
|
+
return !a && r.size >= t && as(r), r.set(s, c), n = Math.min(n, c.resetAt), c;
|
|
2441
2397
|
}
|
|
2442
2398
|
return a.count += 1, a;
|
|
2443
2399
|
}
|
|
2444
2400
|
};
|
|
2445
2401
|
}
|
|
2446
|
-
function
|
|
2402
|
+
function is(e, t) {
|
|
2447
2403
|
for (const [r, n] of e)
|
|
2448
2404
|
n.resetAt <= t && e.delete(r);
|
|
2449
2405
|
}
|
|
2450
|
-
function
|
|
2406
|
+
function os(e) {
|
|
2451
2407
|
let t = Number.POSITIVE_INFINITY;
|
|
2452
2408
|
for (const r of e.values())
|
|
2453
2409
|
t = Math.min(t, r.resetAt);
|
|
2454
2410
|
return t;
|
|
2455
2411
|
}
|
|
2456
|
-
function
|
|
2412
|
+
function as(e) {
|
|
2457
2413
|
const t = e.keys().next().value;
|
|
2458
2414
|
t !== void 0 && e.delete(t);
|
|
2459
2415
|
}
|
|
2460
|
-
function
|
|
2416
|
+
function cs(e, t, r, n = Date.now()) {
|
|
2461
2417
|
if (!e)
|
|
2462
2418
|
return null;
|
|
2463
2419
|
xe(e);
|
|
2464
|
-
const s =
|
|
2420
|
+
const s = Rt(e.window), i = us(e, t), o = r.increment(i, s, n), a = Math.max(0, e.limit - o.count), c = new Headers({
|
|
2465
2421
|
"retry-after": String(Math.ceil(Math.max(0, o.resetAt - n) / 1e3)),
|
|
2466
2422
|
"x-ratelimit-limit": String(e.limit),
|
|
2467
2423
|
"x-ratelimit-remaining": String(a),
|
|
@@ -2472,7 +2428,7 @@ function fs(e, t, r, n = Date.now()) {
|
|
|
2472
2428
|
status: 429
|
|
2473
2429
|
}) : null;
|
|
2474
2430
|
}
|
|
2475
|
-
function
|
|
2431
|
+
function Rt(e) {
|
|
2476
2432
|
if (typeof e == "number") {
|
|
2477
2433
|
if (!Number.isSafeInteger(e) || e <= 0)
|
|
2478
2434
|
throw new Error("Demiurge rate limit window must be a positive integer.");
|
|
@@ -2481,7 +2437,7 @@ function vt(e) {
|
|
|
2481
2437
|
const t = /^(\d+)(s|m|h)$/i.exec(e.trim());
|
|
2482
2438
|
if (!t)
|
|
2483
2439
|
throw new Error("Demiurge rate limit window must use an s/m/h suffix.");
|
|
2484
|
-
const r = Number(t[1]), n = t[2].toLowerCase(), s = r *
|
|
2440
|
+
const r = Number(t[1]), n = t[2].toLowerCase(), s = r * ns[n];
|
|
2485
2441
|
if (!Number.isSafeInteger(s))
|
|
2486
2442
|
throw new Error("Demiurge rate limit window is too large.");
|
|
2487
2443
|
return s;
|
|
@@ -2489,28 +2445,28 @@ function vt(e) {
|
|
|
2489
2445
|
function xe(e) {
|
|
2490
2446
|
if (!Number.isSafeInteger(e.limit) || e.limit <= 0)
|
|
2491
2447
|
throw new Error("Demiurge rate limit limit must be a positive integer.");
|
|
2492
|
-
|
|
2448
|
+
Rt(e.window);
|
|
2493
2449
|
}
|
|
2494
|
-
function
|
|
2495
|
-
return `${
|
|
2450
|
+
function us(e, t) {
|
|
2451
|
+
return `${fs(e.key)}:${ls(e.key, t)}`;
|
|
2496
2452
|
}
|
|
2497
|
-
function
|
|
2453
|
+
function fs(e) {
|
|
2498
2454
|
return typeof e == "string" ? e : `header:${e.header.toLowerCase()}`;
|
|
2499
2455
|
}
|
|
2500
|
-
function
|
|
2501
|
-
return e === "ip" ?
|
|
2456
|
+
function ls(e, t) {
|
|
2457
|
+
return e === "ip" ? ds(t) : t.headers.get(e.header) ?? "missing";
|
|
2502
2458
|
}
|
|
2503
|
-
function
|
|
2504
|
-
return
|
|
2459
|
+
function ds(e) {
|
|
2460
|
+
return Dt(e)?.clientIp ?? "unknown";
|
|
2505
2461
|
}
|
|
2506
|
-
const
|
|
2462
|
+
const ms = {
|
|
2507
2463
|
b: 1,
|
|
2508
2464
|
gb: 1024 ** 3,
|
|
2509
2465
|
kb: 1024,
|
|
2510
2466
|
mb: 1024 ** 2
|
|
2511
2467
|
};
|
|
2512
|
-
function
|
|
2513
|
-
const n =
|
|
2468
|
+
function hs(e, t, r) {
|
|
2469
|
+
const n = gs(e, r);
|
|
2514
2470
|
if (n)
|
|
2515
2471
|
return n;
|
|
2516
2472
|
if (e?.maxBodySize === void 0)
|
|
@@ -2518,12 +2474,12 @@ function gs(e, t, r) {
|
|
|
2518
2474
|
const s = t.headers.get("content-length");
|
|
2519
2475
|
if (!s)
|
|
2520
2476
|
return null;
|
|
2521
|
-
const i =
|
|
2477
|
+
const i = ys(s);
|
|
2522
2478
|
if (i === null)
|
|
2523
2479
|
return new Response("Invalid Content-Length.", {
|
|
2524
2480
|
status: 400
|
|
2525
2481
|
});
|
|
2526
|
-
const o =
|
|
2482
|
+
const o = vt(e.maxBodySize);
|
|
2527
2483
|
return i > o ? new Response("Request body too large.", {
|
|
2528
2484
|
status: 413
|
|
2529
2485
|
}) : null;
|
|
@@ -2533,10 +2489,10 @@ class L extends Error {
|
|
|
2533
2489
|
super("Demiurge request body exceeded maxBodySize while being read."), this.name = "RequestBodyTooLargeError";
|
|
2534
2490
|
}
|
|
2535
2491
|
}
|
|
2536
|
-
function
|
|
2492
|
+
function ps(e, t) {
|
|
2537
2493
|
if (e?.maxBodySize === void 0 || t.body === null)
|
|
2538
2494
|
return t;
|
|
2539
|
-
const r =
|
|
2495
|
+
const r = vt(e.maxBodySize), n = t.body.getReader();
|
|
2540
2496
|
let s = 0;
|
|
2541
2497
|
const i = new ReadableStream({
|
|
2542
2498
|
async pull(a) {
|
|
@@ -2568,18 +2524,18 @@ function ys(e, t) {
|
|
|
2568
2524
|
});
|
|
2569
2525
|
return Nt(t, o), o;
|
|
2570
2526
|
}
|
|
2571
|
-
function
|
|
2527
|
+
function B() {
|
|
2572
2528
|
return new Response("Request body too large.", { status: 413 });
|
|
2573
2529
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return !e?.allowedMethods ||
|
|
2530
|
+
function gs(e, t) {
|
|
2531
|
+
return !e?.allowedMethods || ws(e.allowedMethods, t) ? null : new Response(null, {
|
|
2576
2532
|
headers: {
|
|
2577
|
-
allow:
|
|
2533
|
+
allow: Ss(e.allowedMethods)
|
|
2578
2534
|
},
|
|
2579
2535
|
status: 405
|
|
2580
2536
|
});
|
|
2581
2537
|
}
|
|
2582
|
-
function
|
|
2538
|
+
function vt(e) {
|
|
2583
2539
|
if (typeof e == "number") {
|
|
2584
2540
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
2585
2541
|
throw new Error("Demiurge request maxBodySize must be a non-negative integer.");
|
|
@@ -2590,25 +2546,25 @@ function bt(e) {
|
|
|
2590
2546
|
throw new Error(
|
|
2591
2547
|
"Demiurge request maxBodySize must use bytes or a b/kb/mb/gb suffix."
|
|
2592
2548
|
);
|
|
2593
|
-
const r = Number(t[1]), n = t[2].toLowerCase(), s = r *
|
|
2549
|
+
const r = Number(t[1]), n = t[2].toLowerCase(), s = r * ms[n];
|
|
2594
2550
|
if (!Number.isSafeInteger(s))
|
|
2595
2551
|
throw new Error("Demiurge request maxBodySize is too large.");
|
|
2596
2552
|
return s;
|
|
2597
2553
|
}
|
|
2598
|
-
function
|
|
2554
|
+
function ys(e) {
|
|
2599
2555
|
if (!/^\d+$/.test(e))
|
|
2600
2556
|
return null;
|
|
2601
2557
|
const t = Number(e);
|
|
2602
2558
|
return Number.isSafeInteger(t) ? t : null;
|
|
2603
2559
|
}
|
|
2604
|
-
function
|
|
2560
|
+
function ws(e, t) {
|
|
2605
2561
|
return e.includes(t) || t === "HEAD" && e.includes("GET");
|
|
2606
2562
|
}
|
|
2607
|
-
function
|
|
2563
|
+
function Ss(e) {
|
|
2608
2564
|
const t = [...e];
|
|
2609
2565
|
return t.includes("GET") && !t.includes("HEAD") && t.push("HEAD"), t.join(", ");
|
|
2610
2566
|
}
|
|
2611
|
-
const
|
|
2567
|
+
const Es = [
|
|
2612
2568
|
"GET",
|
|
2613
2569
|
"POST",
|
|
2614
2570
|
"PUT",
|
|
@@ -2617,15 +2573,15 @@ const vs = [
|
|
|
2617
2573
|
"OPTIONS",
|
|
2618
2574
|
"HEAD"
|
|
2619
2575
|
];
|
|
2620
|
-
function
|
|
2576
|
+
function Rs(e, t = {}) {
|
|
2621
2577
|
for (const [n, s] of Object.entries(e)) {
|
|
2622
|
-
|
|
2623
|
-
for (const i of
|
|
2578
|
+
vs(n, s);
|
|
2579
|
+
for (const i of Es) {
|
|
2624
2580
|
const o = s[i];
|
|
2625
|
-
!o || o.kind === "page" ||
|
|
2581
|
+
!o || o.kind === "page" || bs(n, i, o, s);
|
|
2626
2582
|
}
|
|
2627
2583
|
}
|
|
2628
|
-
const r =
|
|
2584
|
+
const r = et(
|
|
2629
2585
|
Object.fromEntries(
|
|
2630
2586
|
Object.entries(e).map(([n, s]) => [
|
|
2631
2587
|
n,
|
|
@@ -2635,33 +2591,33 @@ function bs(e, t = {}) {
|
|
|
2635
2591
|
);
|
|
2636
2592
|
return As(r, e, t.adapter), r;
|
|
2637
2593
|
}
|
|
2638
|
-
function
|
|
2594
|
+
function vs(e, t) {
|
|
2639
2595
|
const r = t.policy?.security?.rateLimit;
|
|
2640
|
-
r &&
|
|
2596
|
+
r && j(e, "policy", "rate limit", () => {
|
|
2641
2597
|
xe(r);
|
|
2642
2598
|
});
|
|
2643
2599
|
}
|
|
2644
|
-
function
|
|
2645
|
-
r.cors &&
|
|
2646
|
-
Te(r.cors),
|
|
2647
|
-
}), r.security?.rateLimit &&
|
|
2600
|
+
function bs(e, t, r, n) {
|
|
2601
|
+
r.cors && j(e, t, "CORS", () => {
|
|
2602
|
+
Te(r.cors), Ts(e, t, r.cors.methods, n);
|
|
2603
|
+
}), r.security?.rateLimit && j(e, t, "rate limit", () => {
|
|
2648
2604
|
xe(r.security.rateLimit);
|
|
2649
2605
|
});
|
|
2650
2606
|
}
|
|
2651
|
-
function
|
|
2607
|
+
function Ts(e, t, r, n) {
|
|
2652
2608
|
if (r) {
|
|
2653
2609
|
for (const s of r)
|
|
2654
|
-
if (s !== "OPTIONS" && !
|
|
2610
|
+
if (s !== "OPTIONS" && !xs(n, s))
|
|
2655
2611
|
throw new Error(
|
|
2656
2612
|
`Route ${JSON.stringify(e)} export ${t} allows CORS method ${s}, but the route does not export that response capability.`
|
|
2657
2613
|
);
|
|
2658
2614
|
}
|
|
2659
2615
|
}
|
|
2660
|
-
function
|
|
2616
|
+
function xs(e, t) {
|
|
2661
2617
|
const r = t === "HEAD" ? e.HEAD ?? e.GET : e[t];
|
|
2662
|
-
return
|
|
2618
|
+
return Ps(r) ? r : void 0;
|
|
2663
2619
|
}
|
|
2664
|
-
function
|
|
2620
|
+
function Ps(e) {
|
|
2665
2621
|
return !!(e && e.kind !== "page");
|
|
2666
2622
|
}
|
|
2667
2623
|
function As(e, t, r) {
|
|
@@ -2669,17 +2625,17 @@ function As(e, t, r) {
|
|
|
2669
2625
|
const i = t[s.file], o = i?.GET;
|
|
2670
2626
|
if (!o || o.kind !== "page")
|
|
2671
2627
|
continue;
|
|
2672
|
-
const a =
|
|
2628
|
+
const a = Y(
|
|
2673
2629
|
...e.policies.filter(
|
|
2674
2630
|
(c) => T(c.fileSegments, s.fileSegments)
|
|
2675
2631
|
).map((c) => t[c.file]?.policy),
|
|
2676
2632
|
i.policy
|
|
2677
2633
|
);
|
|
2678
|
-
|
|
2634
|
+
qe(s.file, "GET", a, r), Os(
|
|
2679
2635
|
s.file,
|
|
2680
2636
|
o.render.mode,
|
|
2681
2637
|
a.document
|
|
2682
|
-
),
|
|
2638
|
+
), Cs(
|
|
2683
2639
|
s.file,
|
|
2684
2640
|
"GET",
|
|
2685
2641
|
a,
|
|
@@ -2697,13 +2653,13 @@ function As(e, t, r) {
|
|
|
2697
2653
|
...e.fallbacks.notFound
|
|
2698
2654
|
];
|
|
2699
2655
|
for (const s of n) {
|
|
2700
|
-
const i =
|
|
2656
|
+
const i = Y(
|
|
2701
2657
|
...e.policies.filter(
|
|
2702
2658
|
(o) => T(o.fileSegments, s.fileSegments)
|
|
2703
2659
|
).map((o) => t[o.file]?.policy),
|
|
2704
2660
|
t[s.file]?.policy
|
|
2705
2661
|
);
|
|
2706
|
-
|
|
2662
|
+
qe(
|
|
2707
2663
|
s.file,
|
|
2708
2664
|
"policy",
|
|
2709
2665
|
i,
|
|
@@ -2711,47 +2667,103 @@ function As(e, t, r) {
|
|
|
2711
2667
|
);
|
|
2712
2668
|
}
|
|
2713
2669
|
}
|
|
2714
|
-
function
|
|
2670
|
+
function Cs(e, t, r, n) {
|
|
2715
2671
|
const s = n.flatMap(
|
|
2716
2672
|
(l) => Array.isArray(l) ? l : []
|
|
2717
2673
|
);
|
|
2718
2674
|
if (s.length === 0 || !r.document)
|
|
2719
2675
|
return;
|
|
2720
|
-
const i = "startup-verification-nonce", a =
|
|
2676
|
+
const i = "startup-verification-nonce", a = Dn({
|
|
2721
2677
|
document: {
|
|
2722
2678
|
headers: { nonce: i },
|
|
2723
2679
|
policy: r.document,
|
|
2724
2680
|
scripts: s.map((l) => ({
|
|
2725
2681
|
...l,
|
|
2726
|
-
nonce:
|
|
2682
|
+
nonce: ee(r.document) ? i : l.nonce
|
|
2727
2683
|
}))
|
|
2728
2684
|
}
|
|
2729
2685
|
}).findings.find(
|
|
2730
2686
|
(l) => l.code === "csp-script-src-blocked"
|
|
2731
2687
|
);
|
|
2732
|
-
if (!a)
|
|
2688
|
+
if (!a) {
|
|
2689
|
+
ks(
|
|
2690
|
+
e,
|
|
2691
|
+
t,
|
|
2692
|
+
r.document.csp,
|
|
2693
|
+
s
|
|
2694
|
+
);
|
|
2733
2695
|
return;
|
|
2696
|
+
}
|
|
2734
2697
|
const c = s.find(
|
|
2735
2698
|
(l) => a.message.includes(l.src)
|
|
2736
|
-
), f = (
|
|
2699
|
+
), f = (W(r.document, { nonce: i }).get("content-security-policy") ?? "").split("; ").find(
|
|
2737
2700
|
(l) => l.startsWith("script-src ")
|
|
2738
2701
|
) ?? "default-src (script-src fallback)";
|
|
2739
2702
|
throw new Error(
|
|
2740
2703
|
`Route ${JSON.stringify(e)} export ${t} declares script ${JSON.stringify(c?.src)} that violates the effective ${f} policy.`
|
|
2741
2704
|
);
|
|
2742
2705
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2706
|
+
const $s = [
|
|
2707
|
+
{ directive: "connectSrc", name: "connect-src", need: "connect" },
|
|
2708
|
+
{ directive: "imgSrc", name: "img-src", need: "img" }
|
|
2709
|
+
];
|
|
2710
|
+
function ks(e, t, r, n) {
|
|
2711
|
+
if (r)
|
|
2712
|
+
for (const s of n)
|
|
2713
|
+
for (const { directive: i, name: o, need: a } of $s) {
|
|
2714
|
+
const c = s.needs?.[a] ?? [];
|
|
2715
|
+
if (c.length === 0)
|
|
2716
|
+
continue;
|
|
2717
|
+
const u = H(r[i]) ?? H(r.defaultSrc);
|
|
2718
|
+
if (u !== void 0) {
|
|
2719
|
+
for (const f of c)
|
|
2720
|
+
if (!(Array.isArray(u) && Ds(u, f)))
|
|
2721
|
+
throw new Error(
|
|
2722
|
+
`Route ${JSON.stringify(e)} export ${t} declares script ${JSON.stringify(s.src)} that needs ${o} ${f}, which the effective policy does not allow. Add ${f} to security.needs.${a} or to csp.${i} for this route.`
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
function Ds(e, t) {
|
|
2728
|
+
return e.includes("'none'") ? !1 : e.includes("*") || e.includes(t) ? !0 : t.startsWith("'") ? !1 : e.some((r) => Ns(r, t));
|
|
2729
|
+
}
|
|
2730
|
+
function Ns(e, t) {
|
|
2731
|
+
if (e.startsWith("'"))
|
|
2732
|
+
return !1;
|
|
2733
|
+
let r;
|
|
2734
|
+
try {
|
|
2735
|
+
r = new URL(t);
|
|
2736
|
+
} catch {
|
|
2737
|
+
return !1;
|
|
2738
|
+
}
|
|
2739
|
+
if (e === `${r.protocol}`)
|
|
2740
|
+
return !0;
|
|
2741
|
+
let n;
|
|
2742
|
+
try {
|
|
2743
|
+
n = new URL(e);
|
|
2744
|
+
} catch {
|
|
2745
|
+
return !1;
|
|
2746
|
+
}
|
|
2747
|
+
if (n.protocol !== r.protocol || n.port !== r.port)
|
|
2748
|
+
return !1;
|
|
2749
|
+
if (n.hostname.startsWith("*.")) {
|
|
2750
|
+
const s = n.hostname.slice(1);
|
|
2751
|
+
return r.hostname.endsWith(s) && r.hostname !== n.hostname.slice(2);
|
|
2752
|
+
}
|
|
2753
|
+
return n.hostname === r.hostname;
|
|
2754
|
+
}
|
|
2755
|
+
function qe(e, t, r, n) {
|
|
2756
|
+
j(e, t, "effective document", () => {
|
|
2757
|
+
W(r.document ?? {}, {
|
|
2746
2758
|
nonce: "startup-verification-nonce"
|
|
2747
2759
|
});
|
|
2748
|
-
}), !(!n || !
|
|
2760
|
+
}), !(!n || !ee(r.document)) && j(e, t, "effective CSP", () => {
|
|
2749
2761
|
Ot(n, ["nonceInjection"]);
|
|
2750
2762
|
});
|
|
2751
2763
|
}
|
|
2752
|
-
function
|
|
2764
|
+
function Os(e, t, r) {
|
|
2753
2765
|
if (t === "static") {
|
|
2754
|
-
const s =
|
|
2766
|
+
const s = Ls(r?.csp);
|
|
2755
2767
|
if (s)
|
|
2756
2768
|
throw new Error(
|
|
2757
2769
|
`Route ${JSON.stringify(e)} uses render mode "static" with an effective ${s} directive that depends on a CSP nonce. Use security.static() for static output or remove the nonce source from the document policy.`
|
|
@@ -2760,49 +2772,49 @@ function $s(e, t, r) {
|
|
|
2760
2772
|
}
|
|
2761
2773
|
if (t !== "streaming")
|
|
2762
2774
|
return;
|
|
2763
|
-
const n =
|
|
2764
|
-
if (!(!n ||
|
|
2775
|
+
const n = Is(r?.csp);
|
|
2776
|
+
if (!(!n || Ms(n.sources)))
|
|
2765
2777
|
throw new Error(
|
|
2766
2778
|
`Route ${JSON.stringify(e)} uses render mode "streaming" with an effective ${n.name} directive that does not allow React runtime inline payload scripts. Add a nonce placeholder or allow 'unsafe-inline' without nonce or hash sources.`
|
|
2767
2779
|
);
|
|
2768
2780
|
}
|
|
2769
|
-
function
|
|
2781
|
+
function Ls(e) {
|
|
2770
2782
|
if (e)
|
|
2771
2783
|
for (const [t, r] of Object.entries(e)) {
|
|
2772
|
-
const n =
|
|
2773
|
-
if (Array.isArray(n) && n.some((s) =>
|
|
2774
|
-
return
|
|
2784
|
+
const n = H(r);
|
|
2785
|
+
if (Array.isArray(n) && n.some((s) => Us(s)))
|
|
2786
|
+
return js(t);
|
|
2775
2787
|
}
|
|
2776
2788
|
}
|
|
2777
|
-
function
|
|
2789
|
+
function Is(e) {
|
|
2778
2790
|
if (!e)
|
|
2779
2791
|
return;
|
|
2780
|
-
const t =
|
|
2792
|
+
const t = H(e.scriptSrc);
|
|
2781
2793
|
if (Array.isArray(t))
|
|
2782
2794
|
return { name: "script-src", sources: t };
|
|
2783
|
-
const r =
|
|
2795
|
+
const r = H(e.defaultSrc);
|
|
2784
2796
|
if (Array.isArray(r))
|
|
2785
2797
|
return { name: "default-src", sources: r };
|
|
2786
2798
|
}
|
|
2787
|
-
function
|
|
2788
|
-
return e.some((t) =>
|
|
2799
|
+
function Ms(e) {
|
|
2800
|
+
return e.some((t) => bt(t)) ? !0 : e.includes("'unsafe-inline'") && !e.some((t) => Hs(t));
|
|
2789
2801
|
}
|
|
2790
|
-
function
|
|
2791
|
-
return
|
|
2802
|
+
function Us(e) {
|
|
2803
|
+
return bt(e) || /^'nonce-[^']*'$/i.test(e);
|
|
2792
2804
|
}
|
|
2793
|
-
function
|
|
2805
|
+
function bt(e) {
|
|
2794
2806
|
return e.includes("{nonce}");
|
|
2795
2807
|
}
|
|
2796
|
-
function
|
|
2808
|
+
function Hs(e) {
|
|
2797
2809
|
return /^'(?:nonce-|sha256-|sha384-|sha512-)/i.test(e);
|
|
2798
2810
|
}
|
|
2799
|
-
function
|
|
2811
|
+
function H(e) {
|
|
2800
2812
|
return e && typeof e == "object" && !Array.isArray(e) && "replace" in e ? e.replace : e;
|
|
2801
2813
|
}
|
|
2802
|
-
function
|
|
2814
|
+
function js(e) {
|
|
2803
2815
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
2804
2816
|
}
|
|
2805
|
-
function
|
|
2817
|
+
function j(e, t, r, n) {
|
|
2806
2818
|
try {
|
|
2807
2819
|
n();
|
|
2808
2820
|
} catch (s) {
|
|
@@ -2815,8 +2827,8 @@ function H(e, t, r, n) {
|
|
|
2815
2827
|
);
|
|
2816
2828
|
}
|
|
2817
2829
|
}
|
|
2818
|
-
function
|
|
2819
|
-
return
|
|
2830
|
+
function Fs(e) {
|
|
2831
|
+
return J({
|
|
2820
2832
|
instance: `${e.pathname}${e.search}`,
|
|
2821
2833
|
status: 404,
|
|
2822
2834
|
title: "Not Found"
|
|
@@ -2824,11 +2836,11 @@ function Hs(e) {
|
|
|
2824
2836
|
}
|
|
2825
2837
|
async function pe(e, t, r = {}) {
|
|
2826
2838
|
const n = new URL(t.url);
|
|
2827
|
-
if (!
|
|
2828
|
-
return
|
|
2829
|
-
const s = await
|
|
2839
|
+
if (!at(t))
|
|
2840
|
+
return Fs(n);
|
|
2841
|
+
const s = await me(e, n.pathname, {
|
|
2830
2842
|
onLayoutError: (u) => r.onError?.(u, "page")
|
|
2831
|
-
}), i = await
|
|
2843
|
+
}), i = await Ws(e, n.pathname), o = r.nonce ?? (ee(i) ? dt() : void 0), a = qs(s, { ...r, nonce: o }), c = W(i ?? {}, {
|
|
2832
2844
|
nonce: o,
|
|
2833
2845
|
request: t
|
|
2834
2846
|
});
|
|
@@ -2840,43 +2852,43 @@ async function pe(e, t, r = {}) {
|
|
|
2840
2852
|
}
|
|
2841
2853
|
);
|
|
2842
2854
|
}
|
|
2843
|
-
async function
|
|
2855
|
+
async function Ws(e, t) {
|
|
2844
2856
|
const r = await Promise.all(
|
|
2845
|
-
|
|
2857
|
+
nr(e, t).map((n) => n.load())
|
|
2846
2858
|
);
|
|
2847
|
-
return
|
|
2859
|
+
return Y(...r.map((n) => n.policy)).document;
|
|
2848
2860
|
}
|
|
2849
|
-
function
|
|
2850
|
-
const r = e.notFound ??
|
|
2861
|
+
function qs(e, t = {}) {
|
|
2862
|
+
const r = e.notFound ?? Le;
|
|
2851
2863
|
try {
|
|
2852
|
-
return
|
|
2864
|
+
return ce(e, r, e.layouts, t);
|
|
2853
2865
|
} catch (n) {
|
|
2854
2866
|
t.onError?.(n, "page");
|
|
2855
2867
|
}
|
|
2856
2868
|
try {
|
|
2857
|
-
return
|
|
2869
|
+
return ce(e, r, [], t);
|
|
2858
2870
|
} catch (n) {
|
|
2859
2871
|
t.onError?.(n, "page");
|
|
2860
2872
|
}
|
|
2861
|
-
return
|
|
2873
|
+
return ce(e, Le, [], t);
|
|
2862
2874
|
}
|
|
2863
|
-
function
|
|
2875
|
+
function ce(e, t, r, n) {
|
|
2864
2876
|
const s = r.reduceRight(
|
|
2865
|
-
(o, a) =>
|
|
2877
|
+
(o, a) => fe(a, {
|
|
2866
2878
|
children: o,
|
|
2867
2879
|
path: {},
|
|
2868
2880
|
pathname: e.pathname
|
|
2869
2881
|
}),
|
|
2870
|
-
|
|
2871
|
-
), i =
|
|
2882
|
+
fe(t, { pathname: e.pathname })
|
|
2883
|
+
), i = _e({
|
|
2872
2884
|
dev: n.dev,
|
|
2873
2885
|
nonce: n.nonce
|
|
2874
2886
|
});
|
|
2875
|
-
return
|
|
2887
|
+
return Je({
|
|
2876
2888
|
body: {
|
|
2877
2889
|
data: void 0,
|
|
2878
2890
|
fallback: "not-found",
|
|
2879
|
-
html:
|
|
2891
|
+
html: Ke(Ve(i, s)),
|
|
2880
2892
|
navigation: n.navigation
|
|
2881
2893
|
},
|
|
2882
2894
|
entrySrc: n.clientEntry,
|
|
@@ -2888,7 +2900,7 @@ function ae(e, t, r, n) {
|
|
|
2888
2900
|
title: n.title
|
|
2889
2901
|
});
|
|
2890
2902
|
}
|
|
2891
|
-
const
|
|
2903
|
+
const Tt = [
|
|
2892
2904
|
"GET",
|
|
2893
2905
|
"POST",
|
|
2894
2906
|
"PUT",
|
|
@@ -2896,12 +2908,12 @@ const xt = [
|
|
|
2896
2908
|
"DELETE",
|
|
2897
2909
|
"OPTIONS",
|
|
2898
2910
|
"HEAD"
|
|
2899
|
-
],
|
|
2900
|
-
function
|
|
2901
|
-
e.routeModules &&
|
|
2902
|
-
const t =
|
|
2903
|
-
return e.cacheStore &&
|
|
2904
|
-
return await
|
|
2911
|
+
], xt = Et();
|
|
2912
|
+
function Di(e) {
|
|
2913
|
+
e.routeModules && Rs(e.routeModules, { adapter: e.adapter });
|
|
2914
|
+
const t = et(e.routes), r = e.rateLimitStore ?? Et();
|
|
2915
|
+
return e.cacheStore && Ze(e.cacheStore.namespace), async function(s) {
|
|
2916
|
+
return await zs(t, s, {
|
|
2905
2917
|
cacheStore: e.cacheStore,
|
|
2906
2918
|
onError: e.onError,
|
|
2907
2919
|
rateLimitStore: r,
|
|
@@ -2910,22 +2922,22 @@ function Oi(e) {
|
|
|
2910
2922
|
});
|
|
2911
2923
|
};
|
|
2912
2924
|
}
|
|
2913
|
-
async function
|
|
2914
|
-
rateLimitStore:
|
|
2925
|
+
async function zs(e, t, r = {
|
|
2926
|
+
rateLimitStore: xt
|
|
2915
2927
|
}) {
|
|
2916
|
-
const n = new URL(t.url), s =
|
|
2928
|
+
const n = new URL(t.url), s = _s(n, r), i = st(t);
|
|
2917
2929
|
let o;
|
|
2918
2930
|
try {
|
|
2919
|
-
o =
|
|
2931
|
+
o = F(e.routes, n.pathname);
|
|
2920
2932
|
} catch (a) {
|
|
2921
2933
|
if (!(a instanceof Ee))
|
|
2922
2934
|
throw a;
|
|
2923
|
-
const c =
|
|
2935
|
+
const c = J({
|
|
2924
2936
|
instance: `${n.pathname}${n.search}`,
|
|
2925
2937
|
status: 400,
|
|
2926
2938
|
title: "Bad Request"
|
|
2927
2939
|
});
|
|
2928
|
-
return i ?
|
|
2940
|
+
return i ? z(c, ie) : c;
|
|
2929
2941
|
}
|
|
2930
2942
|
if (!o)
|
|
2931
2943
|
try {
|
|
@@ -2934,7 +2946,7 @@ async function Ws(e, t, r = {
|
|
|
2934
2946
|
t,
|
|
2935
2947
|
s
|
|
2936
2948
|
);
|
|
2937
|
-
return i ?
|
|
2949
|
+
return i ? z(a, Oe) : a;
|
|
2938
2950
|
} catch (a) {
|
|
2939
2951
|
return s.onError(a, "page"), new Response("Not Found", {
|
|
2940
2952
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
@@ -2942,7 +2954,7 @@ async function Ws(e, t, r = {
|
|
|
2942
2954
|
});
|
|
2943
2955
|
}
|
|
2944
2956
|
try {
|
|
2945
|
-
const a = await
|
|
2957
|
+
const a = await Bs(
|
|
2946
2958
|
e,
|
|
2947
2959
|
t,
|
|
2948
2960
|
n,
|
|
@@ -2950,65 +2962,65 @@ async function Ws(e, t, r = {
|
|
|
2950
2962
|
r,
|
|
2951
2963
|
s
|
|
2952
2964
|
);
|
|
2953
|
-
return i && !a.headers.has(C) ?
|
|
2965
|
+
return i && !a.headers.has(C) ? z(
|
|
2954
2966
|
a,
|
|
2955
|
-
a.status === 404 ?
|
|
2967
|
+
a.status === 404 ? Oe : ie
|
|
2956
2968
|
) : a;
|
|
2957
2969
|
} catch (a) {
|
|
2958
|
-
const c = await
|
|
2970
|
+
const c = await _(
|
|
2959
2971
|
e,
|
|
2960
2972
|
t,
|
|
2961
2973
|
a,
|
|
2962
2974
|
"middleware",
|
|
2963
2975
|
s
|
|
2964
2976
|
);
|
|
2965
|
-
return i ?
|
|
2977
|
+
return i ? z(c, ie) : c;
|
|
2966
2978
|
}
|
|
2967
2979
|
}
|
|
2968
|
-
async function
|
|
2980
|
+
async function Bs(e, t, r, n, s, i) {
|
|
2969
2981
|
const o = await n.route.load();
|
|
2970
2982
|
if (t.method.toUpperCase() === "OPTIONS") {
|
|
2971
|
-
const h =
|
|
2983
|
+
const h = bn(o, t);
|
|
2972
2984
|
if (h)
|
|
2973
2985
|
return h;
|
|
2974
2986
|
}
|
|
2975
|
-
const a =
|
|
2987
|
+
const a = Ys(t.method);
|
|
2976
2988
|
if (!a)
|
|
2977
|
-
return
|
|
2978
|
-
const c =
|
|
2989
|
+
return Ge(o);
|
|
2990
|
+
const c = Zs(o, a);
|
|
2979
2991
|
if (!c)
|
|
2980
|
-
return
|
|
2981
|
-
const u = await
|
|
2992
|
+
return Ge(o);
|
|
2993
|
+
const u = await Js(
|
|
2982
2994
|
e,
|
|
2983
2995
|
n.route,
|
|
2984
2996
|
o,
|
|
2985
2997
|
c
|
|
2986
|
-
), f = u.security, l =
|
|
2998
|
+
), f = u.security, l = Qn(f?.csrf, t);
|
|
2987
2999
|
if (l)
|
|
2988
|
-
return
|
|
2989
|
-
const m =
|
|
3000
|
+
return V(l, ue(c), t);
|
|
3001
|
+
const m = cs(
|
|
2990
3002
|
f?.rateLimit,
|
|
2991
3003
|
t,
|
|
2992
|
-
s.rateLimitStore ??
|
|
3004
|
+
s.rateLimitStore ?? xt
|
|
2993
3005
|
);
|
|
2994
3006
|
if (m)
|
|
2995
|
-
return
|
|
3007
|
+
return V(
|
|
2996
3008
|
m,
|
|
2997
|
-
|
|
3009
|
+
ue(c),
|
|
2998
3010
|
t
|
|
2999
3011
|
);
|
|
3000
|
-
const d =
|
|
3012
|
+
const d = hs(
|
|
3001
3013
|
f?.request,
|
|
3002
3014
|
t,
|
|
3003
3015
|
a
|
|
3004
3016
|
);
|
|
3005
3017
|
if (d)
|
|
3006
|
-
return
|
|
3018
|
+
return V(
|
|
3007
3019
|
d,
|
|
3008
|
-
|
|
3020
|
+
ue(c),
|
|
3009
3021
|
t
|
|
3010
3022
|
);
|
|
3011
|
-
t =
|
|
3023
|
+
t = ps(f?.request, t);
|
|
3012
3024
|
const P = {};
|
|
3013
3025
|
if (c.kind === "page") {
|
|
3014
3026
|
const h = {
|
|
@@ -3018,29 +3030,29 @@ async function qs(e, t, r, n, s, i) {
|
|
|
3018
3030
|
context: P,
|
|
3019
3031
|
search: r.searchParams,
|
|
3020
3032
|
url: r
|
|
3021
|
-
},
|
|
3033
|
+
}, te = await ze(
|
|
3022
3034
|
e,
|
|
3023
3035
|
n.route
|
|
3024
|
-
),
|
|
3036
|
+
), k = ee(u.document) ? dt() : void 0, Pt = Gs(s.cacheStore);
|
|
3025
3037
|
let E;
|
|
3026
3038
|
try {
|
|
3027
|
-
E = await
|
|
3039
|
+
E = await Be(te, h, async () => {
|
|
3028
3040
|
try {
|
|
3029
|
-
const p = await
|
|
3041
|
+
const p = await tt(
|
|
3030
3042
|
e,
|
|
3031
3043
|
r.pathname,
|
|
3032
3044
|
t,
|
|
3033
3045
|
void 0,
|
|
3034
|
-
|
|
3046
|
+
Pt,
|
|
3035
3047
|
{ requestContext: P }
|
|
3036
3048
|
);
|
|
3037
3049
|
if (p.status !== "ready")
|
|
3038
3050
|
return await pe(e, t, {
|
|
3039
3051
|
...i,
|
|
3040
|
-
nonce:
|
|
3052
|
+
nonce: k
|
|
3041
3053
|
});
|
|
3042
|
-
if (
|
|
3043
|
-
return
|
|
3054
|
+
if (st(t))
|
|
3055
|
+
return pr(p.match.data);
|
|
3044
3056
|
if (p.match.render.mode === "streaming" && !s.renderPage)
|
|
3045
3057
|
throw new Error(
|
|
3046
3058
|
"Streaming page routes require an adapter renderer. Pass renderNodePageResponse from @demiurgejs/core/node as createRequestHandler({ renderPage })."
|
|
@@ -3048,9 +3060,9 @@ async function qs(e, t, r, n, s, i) {
|
|
|
3048
3060
|
return await (s.renderPage ?? Lt)(p.match, {
|
|
3049
3061
|
...s.ssr,
|
|
3050
3062
|
dev: s.dev,
|
|
3051
|
-
nonce:
|
|
3052
|
-
onStreamError: (
|
|
3053
|
-
s.onError?.(
|
|
3063
|
+
nonce: k,
|
|
3064
|
+
onStreamError: (Ct) => {
|
|
3065
|
+
s.onError?.(Ct, {
|
|
3054
3066
|
pathname: r.pathname,
|
|
3055
3067
|
site: "page"
|
|
3056
3068
|
});
|
|
@@ -3058,49 +3070,49 @@ async function qs(e, t, r, n, s, i) {
|
|
|
3058
3070
|
signal: t.signal
|
|
3059
3071
|
});
|
|
3060
3072
|
} catch (p) {
|
|
3061
|
-
return p instanceof L ?
|
|
3073
|
+
return p instanceof L ? B() : await _(e, t, p, "page", {
|
|
3062
3074
|
...i,
|
|
3063
|
-
nonce:
|
|
3075
|
+
nonce: k
|
|
3064
3076
|
});
|
|
3065
3077
|
}
|
|
3066
3078
|
});
|
|
3067
3079
|
} catch (p) {
|
|
3068
3080
|
if (!(p instanceof L))
|
|
3069
3081
|
throw p;
|
|
3070
|
-
E =
|
|
3082
|
+
E = B();
|
|
3071
3083
|
}
|
|
3072
|
-
const
|
|
3073
|
-
nonce:
|
|
3084
|
+
const At = W(u.document ?? {}, {
|
|
3085
|
+
nonce: k,
|
|
3074
3086
|
request: t
|
|
3075
3087
|
});
|
|
3076
|
-
for (const [p, Pe] of
|
|
3088
|
+
for (const [p, Pe] of At)
|
|
3077
3089
|
E.headers.set(p, Pe);
|
|
3078
|
-
return
|
|
3090
|
+
return k && E.headers.set("cache-control", "private, no-store"), a === "HEAD" ? (await E.body?.cancel(), new Response(null, {
|
|
3079
3091
|
headers: E.headers,
|
|
3080
3092
|
status: E.status
|
|
3081
3093
|
})) : E;
|
|
3082
3094
|
}
|
|
3083
|
-
const
|
|
3095
|
+
const $ = {
|
|
3084
3096
|
path: n.path,
|
|
3085
3097
|
pathname: r.pathname,
|
|
3086
3098
|
request: t,
|
|
3087
3099
|
context: P,
|
|
3088
3100
|
search: r.searchParams,
|
|
3089
3101
|
url: r
|
|
3090
|
-
}, g = await
|
|
3102
|
+
}, g = await ze(
|
|
3091
3103
|
e,
|
|
3092
3104
|
n.route
|
|
3093
3105
|
);
|
|
3094
|
-
let
|
|
3106
|
+
let A;
|
|
3095
3107
|
try {
|
|
3096
|
-
|
|
3108
|
+
A = await Be(g, $, async () => {
|
|
3097
3109
|
try {
|
|
3098
|
-
return c.kind === "not-found" && c.body === void 0 ?
|
|
3110
|
+
return c.kind === "not-found" && c.body === void 0 ? Vs(
|
|
3099
3111
|
await pe(e, t, i),
|
|
3100
3112
|
c.init
|
|
3101
|
-
) : await
|
|
3113
|
+
) : await Rr(c, $);
|
|
3102
3114
|
} catch (h) {
|
|
3103
|
-
return h instanceof L ?
|
|
3115
|
+
return h instanceof L ? B() : await _(
|
|
3104
3116
|
e,
|
|
3105
3117
|
t,
|
|
3106
3118
|
h,
|
|
@@ -3112,12 +3124,12 @@ async function qs(e, t, r, n, s, i) {
|
|
|
3112
3124
|
} catch (h) {
|
|
3113
3125
|
if (!(h instanceof L))
|
|
3114
3126
|
throw h;
|
|
3115
|
-
|
|
3127
|
+
A = B();
|
|
3116
3128
|
}
|
|
3117
3129
|
try {
|
|
3118
|
-
return
|
|
3130
|
+
return Ks(A, c, t, a);
|
|
3119
3131
|
} catch (h) {
|
|
3120
|
-
return await
|
|
3132
|
+
return await _(
|
|
3121
3133
|
e,
|
|
3122
3134
|
t,
|
|
3123
3135
|
h,
|
|
@@ -3126,10 +3138,10 @@ async function qs(e, t, r, n, s, i) {
|
|
|
3126
3138
|
);
|
|
3127
3139
|
}
|
|
3128
3140
|
}
|
|
3129
|
-
function
|
|
3130
|
-
return e ?
|
|
3141
|
+
function Gs(e) {
|
|
3142
|
+
return e ? Ye(e) : ge();
|
|
3131
3143
|
}
|
|
3132
|
-
function
|
|
3144
|
+
function _s(e, t) {
|
|
3133
3145
|
return {
|
|
3134
3146
|
...t.ssr,
|
|
3135
3147
|
dev: t.dev,
|
|
@@ -3139,7 +3151,7 @@ function Bs(e, t) {
|
|
|
3139
3151
|
transformDocument: t.transformDocument
|
|
3140
3152
|
};
|
|
3141
3153
|
}
|
|
3142
|
-
function
|
|
3154
|
+
function Vs(e, t) {
|
|
3143
3155
|
if (!t)
|
|
3144
3156
|
return e;
|
|
3145
3157
|
const r = new Headers(e.headers), n = new Headers(t.headers);
|
|
@@ -3153,13 +3165,13 @@ function Gs(e, t) {
|
|
|
3153
3165
|
statusText: t.statusText ?? e.statusText
|
|
3154
3166
|
});
|
|
3155
3167
|
}
|
|
3156
|
-
async function
|
|
3168
|
+
async function Js(e, t, r, n) {
|
|
3157
3169
|
const s = await Promise.all(
|
|
3158
3170
|
e.policies.filter(
|
|
3159
3171
|
(i) => T(i.fileSegments, t.fileSegments)
|
|
3160
3172
|
).map((i) => i.load())
|
|
3161
3173
|
);
|
|
3162
|
-
return
|
|
3174
|
+
return Y(
|
|
3163
3175
|
...s.map((i) => i.policy),
|
|
3164
3176
|
r.policy,
|
|
3165
3177
|
{
|
|
@@ -3167,7 +3179,7 @@ async function _s(e, t, r, n) {
|
|
|
3167
3179
|
}
|
|
3168
3180
|
);
|
|
3169
3181
|
}
|
|
3170
|
-
async function
|
|
3182
|
+
async function ze(e, t) {
|
|
3171
3183
|
return (await Promise.all(
|
|
3172
3184
|
e.middlewares.filter(
|
|
3173
3185
|
(n) => T(n.fileSegments, t.fileSegments)
|
|
@@ -3176,7 +3188,7 @@ async function Ge(e, t) {
|
|
|
3176
3188
|
(n) => n.middleware ? [n.middleware] : []
|
|
3177
3189
|
);
|
|
3178
3190
|
}
|
|
3179
|
-
async function
|
|
3191
|
+
async function Be(e, t, r) {
|
|
3180
3192
|
let n = -1;
|
|
3181
3193
|
async function s(i) {
|
|
3182
3194
|
if (i <= n)
|
|
@@ -3187,9 +3199,9 @@ async function _e(e, t, r) {
|
|
|
3187
3199
|
}
|
|
3188
3200
|
return await s(0);
|
|
3189
3201
|
}
|
|
3190
|
-
function
|
|
3191
|
-
const s =
|
|
3192
|
-
|
|
3202
|
+
function Ks(e, t, r, n) {
|
|
3203
|
+
const s = Dr(
|
|
3204
|
+
V(e, t.cors, r),
|
|
3193
3205
|
t.timing
|
|
3194
3206
|
);
|
|
3195
3207
|
return n === "HEAD" ? new Response(null, {
|
|
@@ -3198,117 +3210,112 @@ function Vs(e, t, r, n) {
|
|
|
3198
3210
|
statusText: s.statusText
|
|
3199
3211
|
}) : s;
|
|
3200
3212
|
}
|
|
3201
|
-
function
|
|
3213
|
+
function ue(e) {
|
|
3202
3214
|
return e.kind === "page" ? void 0 : e.cors;
|
|
3203
3215
|
}
|
|
3204
|
-
function
|
|
3216
|
+
function Ys(e) {
|
|
3205
3217
|
const t = e.toUpperCase();
|
|
3206
|
-
return
|
|
3218
|
+
return Tt.includes(t) ? t : null;
|
|
3207
3219
|
}
|
|
3208
|
-
function
|
|
3220
|
+
function Zs(e, t) {
|
|
3209
3221
|
return t === "HEAD" ? e.HEAD ?? e.GET : e[t];
|
|
3210
3222
|
}
|
|
3211
|
-
function
|
|
3223
|
+
function Ge(e) {
|
|
3212
3224
|
return new Response(null, {
|
|
3213
3225
|
headers: {
|
|
3214
|
-
allow:
|
|
3226
|
+
allow: Qs(e).join(", ")
|
|
3215
3227
|
},
|
|
3216
3228
|
status: 405
|
|
3217
3229
|
});
|
|
3218
3230
|
}
|
|
3219
|
-
function
|
|
3220
|
-
const t =
|
|
3231
|
+
function Qs(e) {
|
|
3232
|
+
const t = Tt.filter((r) => e[r]);
|
|
3221
3233
|
return e.GET && !t.includes("HEAD") && t.push("HEAD"), t;
|
|
3222
3234
|
}
|
|
3223
3235
|
export {
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3236
|
+
hs as $,
|
|
3237
|
+
hr as A,
|
|
3238
|
+
Oe as B,
|
|
3239
|
+
ie as C,
|
|
3240
|
+
Pi as D,
|
|
3241
|
+
Le as E,
|
|
3242
|
+
ve as F,
|
|
3243
|
+
it as G,
|
|
3244
|
+
Ur as H,
|
|
3245
|
+
On as I,
|
|
3246
|
+
Ye as J,
|
|
3247
|
+
yt as K,
|
|
3248
|
+
Zn as L,
|
|
3249
|
+
Yn as M,
|
|
3238
3250
|
C as N,
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3251
|
+
oi as O,
|
|
3252
|
+
ge as P,
|
|
3253
|
+
Ht as Q,
|
|
3242
3254
|
L as R,
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
Ae as k,
|
|
3298
|
-
Ti as l,
|
|
3299
|
-
on as m,
|
|
3300
|
-
ys as n,
|
|
3301
|
-
bt as o,
|
|
3255
|
+
Dn as S,
|
|
3256
|
+
Me as T,
|
|
3257
|
+
ai as U,
|
|
3258
|
+
Ci as V,
|
|
3259
|
+
Ai as W,
|
|
3260
|
+
ii as X,
|
|
3261
|
+
gs as Y,
|
|
3262
|
+
Qn as Z,
|
|
3263
|
+
cs as _,
|
|
3264
|
+
Rs as a,
|
|
3265
|
+
Si as a0,
|
|
3266
|
+
ki as a1,
|
|
3267
|
+
gi as a2,
|
|
3268
|
+
yi as a3,
|
|
3269
|
+
ui as a4,
|
|
3270
|
+
Y as a5,
|
|
3271
|
+
nn as a6,
|
|
3272
|
+
ci as a7,
|
|
3273
|
+
Ri as a8,
|
|
3274
|
+
Xn as a9,
|
|
3275
|
+
Rt as aa,
|
|
3276
|
+
ni as ab,
|
|
3277
|
+
Ei as ac,
|
|
3278
|
+
v as ad,
|
|
3279
|
+
Ze as ae,
|
|
3280
|
+
le as af,
|
|
3281
|
+
xi as ag,
|
|
3282
|
+
Ti as ah,
|
|
3283
|
+
bi as ai,
|
|
3284
|
+
fi as aj,
|
|
3285
|
+
si as ak,
|
|
3286
|
+
wi as al,
|
|
3287
|
+
hi as am,
|
|
3288
|
+
T as an,
|
|
3289
|
+
pi as ao,
|
|
3290
|
+
mi as ap,
|
|
3291
|
+
ir as aq,
|
|
3292
|
+
dr as ar,
|
|
3293
|
+
X as as,
|
|
3294
|
+
R as at,
|
|
3295
|
+
li as b,
|
|
3296
|
+
Di as c,
|
|
3297
|
+
Et as d,
|
|
3298
|
+
$i as e,
|
|
3299
|
+
W as f,
|
|
3300
|
+
xe as g,
|
|
3301
|
+
zs as h,
|
|
3302
|
+
dt as i,
|
|
3303
|
+
F as j,
|
|
3304
|
+
et as k,
|
|
3305
|
+
$e as l,
|
|
3306
|
+
rn as m,
|
|
3307
|
+
vi as n,
|
|
3308
|
+
ps as o,
|
|
3302
3309
|
U as p,
|
|
3303
|
-
|
|
3310
|
+
vt as q,
|
|
3304
3311
|
pe as r,
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3312
|
+
D as s,
|
|
3313
|
+
Rr as t,
|
|
3314
|
+
gr as u,
|
|
3315
|
+
Te as v,
|
|
3316
|
+
di as w,
|
|
3317
|
+
tt as x,
|
|
3318
|
+
er as y,
|
|
3319
|
+
mr as z
|
|
3313
3320
|
};
|
|
3314
|
-
//# sourceMappingURL=testing-
|
|
3321
|
+
//# sourceMappingURL=testing-B_iMFYz_.js.map
|