@demiurgejs/core 0.2.0-beta.2 → 0.2.0-beta.3
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/dist/adapter/testing.js.map +1 -1
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/{document-shell-D1xo6cEA.js → document-shell-WoM8yZlR.js} +2 -2
- package/dist/chunks/{document-shell-D1xo6cEA.js.map → document-shell-WoM8yZlR.js.map} +1 -1
- package/dist/chunks/{image-codec-BGTx_t5K.js → image-codec-Di53WpcH.js} +2 -2
- package/dist/chunks/{image-codec-BGTx_t5K.js.map → image-codec-Di53WpcH.js.map} +1 -1
- package/dist/chunks/{images-B9MqcjSA.js → images-Edar3eU1.js} +2 -2
- package/dist/chunks/{images-B9MqcjSA.js.map → images-Edar3eU1.js.map} +1 -1
- package/dist/chunks/{request-metadata-D5NrT8ks.js → request-metadata-DaIYq4Ea.js} +214 -179
- package/dist/chunks/request-metadata-DaIYq4Ea.js.map +1 -0
- package/dist/chunks/{streaming-BQ1bykDo.js → streaming-D0fGAuiO.js} +5 -5
- package/dist/chunks/streaming-D0fGAuiO.js.map +1 -0
- package/dist/chunks/{testing-B_iMFYz_.js → testing-CRflAw4X.js} +1228 -1074
- package/dist/chunks/testing-CRflAw4X.js.map +1 -0
- package/dist/data/cache.d.ts +8 -0
- package/dist/data/cache.d.ts.map +1 -1
- package/dist/data/idempotency.d.ts.map +1 -1
- package/dist/data/index.d.ts +3 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/testing.d.ts.map +1 -1
- package/dist/data/testing.js +94 -72
- package/dist/data/testing.js.map +1 -1
- package/dist/data/tiered.d.ts +7 -0
- package/dist/data/tiered.d.ts.map +1 -0
- package/dist/document/deferred-scripts.d.ts.map +1 -1
- package/dist/document/hydration.d.ts.map +1 -1
- package/dist/document/index.d.ts +1 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/trusted-types.d.ts +10 -0
- package/dist/document/trusted-types.d.ts.map +1 -0
- package/dist/edge/index.js +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +768 -432
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +9 -9
- package/dist/kv/index.d.ts +2 -0
- package/dist/kv/index.d.ts.map +1 -1
- package/dist/kv/index.js +71 -48
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/rate-limit-store.d.ts +8 -0
- package/dist/kv/rate-limit-store.d.ts.map +1 -0
- package/dist/kv/store.d.ts.map +1 -1
- package/dist/node/http.d.ts.map +1 -1
- package/dist/node/image.d.ts.map +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/index.js.map +1 -1
- package/dist/node/static.d.ts.map +1 -1
- package/dist/node/streaming.d.ts.map +1 -1
- package/dist/platform/images.d.ts.map +1 -1
- package/dist/platform/index.d.ts +5 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/observability.d.ts +2 -1
- package/dist/platform/observability.d.ts.map +1 -1
- package/dist/platform/web-vitals-client.d.ts +32 -0
- package/dist/platform/web-vitals-client.d.ts.map +1 -0
- package/dist/platform/web-vitals.d.ts +78 -0
- package/dist/platform/web-vitals.d.ts.map +1 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +84 -46
- package/dist/redis/index.js.map +1 -1
- package/dist/redis/rate-limit-store.d.ts +8 -0
- package/dist/redis/rate-limit-store.d.ts.map +1 -0
- package/dist/redis/store.d.ts.map +1 -1
- package/dist/route/action.d.ts.map +1 -1
- package/dist/route/middleware.d.ts.map +1 -1
- package/dist/route/response.d.ts.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +1 -0
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/security/cookies.d.ts +26 -0
- package/dist/security/cookies.d.ts.map +1 -0
- package/dist/security/env.d.ts.map +1 -1
- package/dist/security/fetch-metadata.d.ts +29 -0
- package/dist/security/fetch-metadata.d.ts.map +1 -0
- package/dist/security/index.d.ts +5 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/rate-limit.d.ts +6 -3
- package/dist/security/rate-limit.d.ts.map +1 -1
- package/dist/security/request.d.ts.map +1 -1
- package/dist/security/types.d.ts +72 -3
- package/dist/security/types.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/request-handler.d.ts +6 -2
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +1030 -666
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +2 -0
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/policy-verification.d.ts.map +1 -1
- package/dist/vite/route-audit.d.ts +50 -0
- package/dist/vite/route-audit.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/request-metadata-D5NrT8ks.js.map +0 -1
- package/dist/chunks/streaming-BQ1bykDo.js.map +0 -1
- package/dist/chunks/testing-B_iMFYz_.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,186 +1,186 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { g as
|
|
4
|
-
import { k as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { k as
|
|
8
|
-
import { d as
|
|
1
|
+
import { jsx as V } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as re, useState as F, useRef as z, useEffect as P, useMemo as ne, createElement as w, useContext as oe, Component as ae } from "react";
|
|
3
|
+
import { g as ie, H as se, h as U, i as ce, j as I } from "./chunks/request-metadata-DaIYq4Ea.js";
|
|
4
|
+
import { F as xr, k as Cr, l as Ir, m as Nr, n as Lr, d as Pr, o as Dr, q as Or, t as Mr, u as Fr, v as zr, p as Ur, a as Br, w as _r, x as jr } from "./chunks/request-metadata-DaIYq4Ea.js";
|
|
5
|
+
import { z as B, x as ue, A as le, B as fe, C as de, D as he, R as me, E as D, F as pe, y as W, G as ge, i as q, H as we, N as _, I as ye, J as ve, K as be, L as Se, O as Ee, P as Re, Q as Te, S as ke } from "./chunks/testing-CRflAw4X.js";
|
|
6
|
+
import { T as Vr, U as Wr, V as qr, W as Gr, X as Kr, Y as Jr, Z as Yr, _ as Zr, $ as Xr, a0 as Qr, a1 as en, u as tn, a2 as rn, d as nn, c as on, q as an, f as sn, e as cn, a3 as un, a4 as ln, a5 as fn, a6 as dn, a7 as hn, a8 as mn, a9 as pn, aa as gn, ab as wn, ac as yn, h as vn, ad as bn, ae as Sn, af as En, ag as Rn, ah as Tn, ai as kn, aj as An, ak as $n, m as xn, al as Cn, am as In, an as Nn, ao as Ln, ap as Pn, aq as Dn, s as On, ar as Mn, w as Fn, as as zn, at as Un, au as Bn, av as _n, aw as jn, ax as Hn, v as Vn, g as Wn, a as qn } from "./chunks/testing-CRflAw4X.js";
|
|
7
|
+
import { k as Ae } from "./chunks/images-Edar3eU1.js";
|
|
8
|
+
import { d as Kn, l as Jn, m as Yn, n as Zn, f as Xn, o as Qn, q as eo, a as to, s as ro, t as no, b as oo, h as ao, j as io, r as so } from "./chunks/images-Edar3eU1.js";
|
|
9
9
|
import "react-dom/server";
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const t = e.now ?? Date.now, r = e.defaultTtl ??
|
|
10
|
+
const $e = "24h", xe = 1e4;
|
|
11
|
+
function Yt(e = {}) {
|
|
12
|
+
const t = e.now ?? Date.now, r = e.defaultTtl ?? $e, n = e.maximumEntries ?? xe;
|
|
13
13
|
if (!Number.isSafeInteger(n) || n <= 0)
|
|
14
14
|
throw new Error(
|
|
15
15
|
"Demiurge idempotency maximumEntries must be a positive integer."
|
|
16
16
|
);
|
|
17
|
-
const
|
|
18
|
-
if (!Number.isFinite(
|
|
17
|
+
const o = B(r);
|
|
18
|
+
if (!Number.isFinite(o))
|
|
19
19
|
throw new Error("Demiurge idempotency defaultTtl must be finite.");
|
|
20
|
-
const
|
|
20
|
+
const a = /* @__PURE__ */ new Map();
|
|
21
21
|
return {
|
|
22
|
-
async run(
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const d =
|
|
26
|
-
if (d && (d.pending || d.expiresAt >
|
|
22
|
+
async run(i) {
|
|
23
|
+
const s = ue(i.key), l = t();
|
|
24
|
+
Ce(a, l);
|
|
25
|
+
const d = a.get(s);
|
|
26
|
+
if (d && (d.pending || d.expiresAt > l))
|
|
27
27
|
return {
|
|
28
|
-
key:
|
|
28
|
+
key: s,
|
|
29
29
|
replayed: !0,
|
|
30
30
|
value: await d.value
|
|
31
31
|
};
|
|
32
|
-
if (
|
|
32
|
+
if (a.size >= n && Ie(a), a.size >= n)
|
|
33
33
|
throw new Error(
|
|
34
34
|
"Demiurge idempotency store is at capacity with in-flight mutations."
|
|
35
35
|
);
|
|
36
|
-
const
|
|
36
|
+
const p = Promise.resolve().then(i.fn), c = {
|
|
37
37
|
expiresAt: Number.POSITIVE_INFINITY,
|
|
38
38
|
pending: !0,
|
|
39
|
-
value:
|
|
39
|
+
value: p
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
a.set(s, c);
|
|
42
42
|
try {
|
|
43
|
-
const
|
|
44
|
-
return c.pending = !1, c.expiresAt = t() +
|
|
45
|
-
key:
|
|
43
|
+
const f = await p;
|
|
44
|
+
return c.pending = !1, c.expiresAt = t() + B(i.ttl ?? r), {
|
|
45
|
+
key: s,
|
|
46
46
|
replayed: !1,
|
|
47
|
-
value:
|
|
47
|
+
value: f
|
|
48
48
|
};
|
|
49
|
-
} catch (
|
|
50
|
-
throw
|
|
49
|
+
} catch (f) {
|
|
50
|
+
throw a.get(s) === c && a.delete(s), f;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Ce(e, t) {
|
|
56
56
|
for (const [r, n] of e)
|
|
57
57
|
!n.pending && n.expiresAt <= t && e.delete(r);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Ie(e) {
|
|
60
60
|
for (const [t, r] of e)
|
|
61
61
|
if (!r.pending) {
|
|
62
62
|
e.delete(t);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Zt(e, t) {
|
|
67
67
|
return e.run(t);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function Xt(e) {
|
|
70
70
|
return {
|
|
71
71
|
entries: e
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Qt(e) {
|
|
75
75
|
return [
|
|
76
76
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
77
77
|
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.entries.some((r) => r.alternates?.length) ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : ""}>`,
|
|
78
|
-
...e.entries.map(
|
|
78
|
+
...e.entries.map(Le),
|
|
79
79
|
"</urlset>",
|
|
80
80
|
""
|
|
81
81
|
].join(`
|
|
82
82
|
`);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function er(e) {
|
|
85
85
|
return e;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function tr(e) {
|
|
88
88
|
return e;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function rr(e) {
|
|
91
91
|
const t = [];
|
|
92
92
|
for (const r of e.rules ?? []) {
|
|
93
|
-
for (const n of
|
|
93
|
+
for (const n of A(r.userAgent))
|
|
94
94
|
t.push(`User-agent: ${n}`);
|
|
95
|
-
for (const n of
|
|
95
|
+
for (const n of A(r.allow))
|
|
96
96
|
t.push(`Allow: ${n}`);
|
|
97
|
-
for (const n of
|
|
97
|
+
for (const n of A(r.disallow))
|
|
98
98
|
t.push(`Disallow: ${n}`);
|
|
99
99
|
t.push("");
|
|
100
100
|
}
|
|
101
101
|
e.host && t.push(`Host: ${e.host}`);
|
|
102
|
-
for (const r of
|
|
102
|
+
for (const r of A(e.sitemap))
|
|
103
103
|
t.push(`Sitemap: ${r}`);
|
|
104
104
|
return `${t.join(`
|
|
105
105
|
`).replace(/\n+$/, "")}
|
|
106
106
|
`;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820",
|
|
110
|
-
return
|
|
111
|
-
`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${
|
|
112
|
-
` <rect width="100%" height="100%" fill="${
|
|
113
|
-
|
|
114
|
-
` <text x="72" y="${
|
|
115
|
-
|
|
108
|
+
function Ne(e) {
|
|
109
|
+
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", o = e.foreground ?? "#ffffff", a = N(e.title, 120), i = e.subtitle ? N(e.subtitle, 160) : void 0, s = e.brand ? N(e.brand, 80) : void 0;
|
|
110
|
+
return Oe(t, r), [
|
|
111
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${E(a)}">`,
|
|
112
|
+
` <rect width="100%" height="100%" fill="${E(n)}" />`,
|
|
113
|
+
s ? ` <text x="72" y="96" fill="${E(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="32" font-weight="700">${R(s)}</text>` : null,
|
|
114
|
+
` <text x="72" y="${i ? 300 : 340}" fill="${E(o)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="76" font-weight="800">${R(a)}</text>`,
|
|
115
|
+
i ? ` <text x="72" y="392" fill="${E(o)}" fill-opacity="0.78" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="38" font-weight="500">${R(i)}</text>` : null,
|
|
116
116
|
"</svg>"
|
|
117
|
-
].filter((
|
|
117
|
+
].filter((l) => !!l).join(`
|
|
118
118
|
`);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
return new Response(
|
|
120
|
+
function nr(e) {
|
|
121
|
+
return new Response(Ne(e), {
|
|
122
122
|
headers: {
|
|
123
123
|
"cache-control": "public, max-age=31536000, immutable",
|
|
124
124
|
"content-type": "image/svg+xml; charset=utf-8"
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Le(e) {
|
|
129
129
|
return [
|
|
130
130
|
" <url>",
|
|
131
|
-
` <loc>${
|
|
132
|
-
e.lastModified ? ` <lastmod>${
|
|
131
|
+
` <loc>${R(e.url)}</loc>`,
|
|
132
|
+
e.lastModified ? ` <lastmod>${R(Pe(e.lastModified))}</lastmod>` : null,
|
|
133
133
|
e.changeFrequency ? ` <changefreq>${e.changeFrequency}</changefreq>` : null,
|
|
134
|
-
e.priority !== void 0 ? ` <priority>${
|
|
134
|
+
e.priority !== void 0 ? ` <priority>${De(e.priority)}</priority>` : null,
|
|
135
135
|
...(e.alternates ?? []).map(
|
|
136
|
-
(t) => ` <xhtml:link rel="alternate" hreflang="${
|
|
136
|
+
(t) => ` <xhtml:link rel="alternate" hreflang="${E(t.hrefLang)}" href="${E(t.href)}" />`
|
|
137
137
|
),
|
|
138
138
|
" </url>"
|
|
139
139
|
].filter((t) => !!t).join(`
|
|
140
140
|
`);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Pe(e) {
|
|
143
143
|
return e instanceof Date ? e.toISOString() : e;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function De(e) {
|
|
146
146
|
if (e < 0 || e > 1)
|
|
147
147
|
throw new Error("Sitemap entry priority must be between 0 and 1.");
|
|
148
148
|
return String(e);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function A(e) {
|
|
151
151
|
return e === void 0 ? [] : Array.isArray(e) ? e : [e];
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function R(e) {
|
|
154
154
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
156
|
+
function E(e) {
|
|
157
|
+
return R(e).replaceAll('"', """).replaceAll("'", "'");
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function N(e, t) {
|
|
160
160
|
return e.length > t ? `${e.slice(0, t - 3)}...` : e;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Oe(e, t) {
|
|
163
163
|
if (!Number.isSafeInteger(e) || e <= 0)
|
|
164
164
|
throw new Error("OG image width must be a positive integer.");
|
|
165
165
|
if (!Number.isSafeInteger(t) || t <= 0)
|
|
166
166
|
throw new Error("OG image height must be a positive integer.");
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
168
|
+
function or(e) {
|
|
169
|
+
return le(
|
|
170
170
|
async (t) => {
|
|
171
171
|
const r = e.input ? await e.input(t) : void 0, n = {
|
|
172
172
|
...t,
|
|
173
173
|
input: r
|
|
174
|
-
},
|
|
174
|
+
}, o = async () => await Me(
|
|
175
175
|
await e.handler(n),
|
|
176
176
|
t
|
|
177
177
|
);
|
|
178
178
|
if (!e.idempotency)
|
|
179
|
-
return await
|
|
180
|
-
const
|
|
179
|
+
return await o();
|
|
180
|
+
const a = typeof e.idempotency.key == "function" ? e.idempotency.key(n) : e.idempotency.key;
|
|
181
181
|
return (await e.idempotency.store.run({
|
|
182
|
-
fn:
|
|
183
|
-
key:
|
|
182
|
+
fn: o,
|
|
183
|
+
key: a,
|
|
184
184
|
ttl: e.idempotency.ttl
|
|
185
185
|
})).value;
|
|
186
186
|
},
|
|
@@ -191,7 +191,7 @@ function St(e) {
|
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const ar = {
|
|
195
195
|
async formData({ request: e }) {
|
|
196
196
|
return await e.formData();
|
|
197
197
|
},
|
|
@@ -202,10 +202,10 @@ const Et = {
|
|
|
202
202
|
return await e.text();
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
|
-
async function
|
|
206
|
-
return e instanceof Response ? e : await
|
|
205
|
+
async function Me(e, t) {
|
|
206
|
+
return e instanceof Response ? e : await fe(e, t);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function ir(e) {
|
|
209
209
|
return typeof e == "function" ? {
|
|
210
210
|
kind: "page",
|
|
211
211
|
render: { mode: "ssr" },
|
|
@@ -218,10 +218,10 @@ function Rt(e) {
|
|
|
218
218
|
view: e.view
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function sr(e) {
|
|
222
222
|
return e;
|
|
223
223
|
}
|
|
224
|
-
const
|
|
224
|
+
const cr = {
|
|
225
225
|
hmac(e) {
|
|
226
226
|
return {
|
|
227
227
|
kind: "response",
|
|
@@ -229,7 +229,7 @@ const xt = {
|
|
|
229
229
|
const r = new Uint8Array(await t.request.arrayBuffer()), n = t.request.headers.get(
|
|
230
230
|
e.header ?? "x-webhook-signature"
|
|
231
231
|
);
|
|
232
|
-
return n ? await
|
|
232
|
+
return n ? await Fe(r, n, e) ? await e.handler({
|
|
233
233
|
...t,
|
|
234
234
|
rawBody: r,
|
|
235
235
|
text: () => new TextDecoder().decode(r)
|
|
@@ -245,15 +245,15 @@ const xt = {
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
async function
|
|
249
|
-
const n = r.algorithm ?? "SHA-256",
|
|
248
|
+
async function Fe(e, t, r) {
|
|
249
|
+
const n = r.algorithm ?? "SHA-256", o = r.encoding ?? "hex", a = ze(
|
|
250
250
|
t,
|
|
251
251
|
n,
|
|
252
252
|
r.prefix
|
|
253
|
-
),
|
|
254
|
-
if (!
|
|
253
|
+
), i = Ue(a, o);
|
|
254
|
+
if (!i)
|
|
255
255
|
return !1;
|
|
256
|
-
const
|
|
256
|
+
const s = await globalThis.crypto.subtle.importKey(
|
|
257
257
|
"raw",
|
|
258
258
|
new TextEncoder().encode(r.secret),
|
|
259
259
|
{
|
|
@@ -265,16 +265,16 @@ async function Ae(e, t, r) {
|
|
|
265
265
|
);
|
|
266
266
|
return await globalThis.crypto.subtle.verify(
|
|
267
267
|
"HMAC",
|
|
268
|
-
o,
|
|
269
268
|
s,
|
|
269
|
+
i,
|
|
270
270
|
Uint8Array.from(e).buffer
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
const n = e.trim(),
|
|
275
|
-
return
|
|
273
|
+
function ze(e, t, r) {
|
|
274
|
+
const n = e.trim(), o = r === void 0 ? `${t.toLowerCase().replace("-", "")}=` : r;
|
|
275
|
+
return o !== !1 && n.startsWith(o) ? n.slice(o.length).trim() : n;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Ue(e, t) {
|
|
278
278
|
if (t === "hex")
|
|
279
279
|
return /^(?:[0-9a-f]{2})+$/i.test(e) ? Uint8Array.from(
|
|
280
280
|
e.match(/.{2}/g) ?? [],
|
|
@@ -291,47 +291,110 @@ function $e(e, t) {
|
|
|
291
291
|
return null;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
const Be = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/, _e = {
|
|
295
|
+
host: "__Host-",
|
|
296
|
+
none: "",
|
|
297
|
+
secure: "__Secure-"
|
|
298
|
+
}, j = 4096;
|
|
299
|
+
function O(e, t = "host") {
|
|
300
|
+
return `${_e[t]}${e}`;
|
|
301
|
+
}
|
|
302
|
+
function je(e) {
|
|
303
|
+
const t = e.scope ?? "host", r = O(e.name, t), n = [], o = (a, i) => {
|
|
304
|
+
n.push({ code: a, message: i, name: r });
|
|
305
|
+
};
|
|
306
|
+
if (Be.test(e.name) || o(
|
|
307
|
+
"cookie-name-invalid",
|
|
308
|
+
`Cookie name ${JSON.stringify(e.name)} contains a character that a cookie name cannot hold. Use letters, digits, or the token characters that RFC 6265 allows.`
|
|
309
|
+
), (e.name.startsWith("__Host-") || e.name.startsWith("__Secure-")) && o(
|
|
310
|
+
"cookie-name-carries-prefix",
|
|
311
|
+
`Cookie name ${JSON.stringify(e.name)} already carries a prefix. Remove the prefix from name and declare scope ${JSON.stringify(t === "none" ? "host" : t)} instead.`
|
|
312
|
+
), t !== "none" && e.secure === !1 && o(
|
|
313
|
+
"cookie-scope-requires-secure",
|
|
314
|
+
`Cookie ${r} uses scope ${JSON.stringify(t)}, so it requires Secure. Remove secure: false, or declare scope "none" for a cookie that a browser must accept over plain HTTP.`
|
|
315
|
+
), t === "host" && e.domain !== void 0 && o(
|
|
316
|
+
"cookie-domain-not-allowed",
|
|
317
|
+
`Cookie ${r} uses scope "host", so it cannot carry a Domain attribute. Remove domain, or declare scope "secure" to share the cookie with subdomains.`
|
|
318
|
+
), t === "host" && e.path !== void 0 && e.path !== "/" && o(
|
|
319
|
+
"cookie-path-not-allowed",
|
|
320
|
+
`Cookie ${r} uses scope "host", so it requires Path=/. Remove path, or declare scope "secure" for a cookie that a path must limit.`
|
|
321
|
+
), e.sameSite === "None" && e.secure === !1 && o(
|
|
322
|
+
"cookie-same-site-none-requires-secure",
|
|
323
|
+
`Cookie ${r} declares SameSite=None, so it requires Secure. Remove secure: false, or declare a SameSite policy of "Lax" or "Strict".`
|
|
324
|
+
), e.maxAge !== void 0 && (!Number.isInteger(e.maxAge) || e.maxAge < 0) && o(
|
|
325
|
+
"cookie-max-age-invalid",
|
|
326
|
+
`Cookie ${r} declares maxAge ${JSON.stringify(e.maxAge)}. Use a whole number of seconds that is zero or greater.`
|
|
327
|
+
), n.length === 0) {
|
|
328
|
+
const a = new TextEncoder().encode(G(e, t, r)).length;
|
|
329
|
+
a > j && o(
|
|
330
|
+
"cookie-too-large",
|
|
331
|
+
`Cookie ${r} serializes to ${a} bytes, and a browser drops a cookie above ${j} bytes. Store the payload on the server and keep an identifier in the cookie.`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
return n;
|
|
335
|
+
}
|
|
336
|
+
function ur(e, t = "host") {
|
|
337
|
+
if (typeof document > "u")
|
|
338
|
+
return;
|
|
339
|
+
const r = typeof e == "string" ? { name: e, scope: t } : e;
|
|
340
|
+
return de(document.cookie).get(
|
|
341
|
+
O(r.name, r.scope ?? "host")
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
function lr(e) {
|
|
345
|
+
const t = je(e);
|
|
346
|
+
if (t.length > 0)
|
|
347
|
+
throw new Error(
|
|
348
|
+
`Demiurge rejected a cookie declaration. ${t.map((n) => n.message).join(" ")}`
|
|
349
|
+
);
|
|
350
|
+
const r = e.scope ?? "host";
|
|
351
|
+
return G(e, r, O(e.name, r));
|
|
352
|
+
}
|
|
353
|
+
function G(e, t, r) {
|
|
354
|
+
const n = [`${r}=${encodeURIComponent(e.value)}`], o = t === "host" ? "/" : e.path ?? "/";
|
|
355
|
+
return n.push(`Path=${o}`), t !== "host" && e.domain !== void 0 && n.push(`Domain=${e.domain}`), e.expires && n.push(`Expires=${e.expires.toUTCString()}`), e.maxAge !== void 0 && n.push(`Max-Age=${e.maxAge}`), n.push(`SameSite=${e.sameSite ?? "Lax"}`), (e.httpOnly ?? !0) && n.push("HttpOnly"), (t !== "none" || (e.secure ?? !0)) && n.push("Secure"), n.join("; ");
|
|
356
|
+
}
|
|
357
|
+
class He extends Error {
|
|
295
358
|
issues;
|
|
296
359
|
constructor(t) {
|
|
297
|
-
super(
|
|
360
|
+
super(Ye(t)), this.name = "EnvValidationError", this.issues = t;
|
|
298
361
|
}
|
|
299
362
|
}
|
|
300
|
-
function
|
|
363
|
+
function fr(e) {
|
|
301
364
|
return e;
|
|
302
365
|
}
|
|
303
|
-
function
|
|
366
|
+
function dr(e, t) {
|
|
304
367
|
const r = [], n = {};
|
|
305
|
-
for (const
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
if (
|
|
309
|
-
n[
|
|
368
|
+
for (const o of Object.keys(e)) {
|
|
369
|
+
const a = e[o], i = t[String(o)];
|
|
370
|
+
if (i === void 0 || i === "") {
|
|
371
|
+
if (a.optional) {
|
|
372
|
+
n[o] = void 0;
|
|
310
373
|
continue;
|
|
311
374
|
}
|
|
312
375
|
r.push({
|
|
313
376
|
code: "missing",
|
|
314
|
-
key: String(
|
|
315
|
-
message: `Environment variable ${String(
|
|
377
|
+
key: String(o),
|
|
378
|
+
message: `Environment variable ${String(o)} is required.`
|
|
316
379
|
});
|
|
317
380
|
continue;
|
|
318
381
|
}
|
|
319
382
|
try {
|
|
320
|
-
n[
|
|
321
|
-
} catch (
|
|
383
|
+
n[o] = a.parse(String(o), i);
|
|
384
|
+
} catch (s) {
|
|
322
385
|
r.push({
|
|
323
386
|
code: "invalid",
|
|
324
|
-
key: String(
|
|
325
|
-
message:
|
|
387
|
+
key: String(o),
|
|
388
|
+
message: s instanceof Error ? s.message : `Environment variable ${String(o)} is invalid.`
|
|
326
389
|
});
|
|
327
390
|
}
|
|
328
391
|
}
|
|
329
392
|
if (r.length)
|
|
330
|
-
throw new
|
|
393
|
+
throw new He(r);
|
|
331
394
|
return n;
|
|
332
395
|
}
|
|
333
|
-
function
|
|
334
|
-
return
|
|
396
|
+
function Ve(e = {}) {
|
|
397
|
+
return T(e, !1, (t, r) => {
|
|
335
398
|
if (r === "true" || r === "1")
|
|
336
399
|
return !0;
|
|
337
400
|
if (r === "false" || r === "0")
|
|
@@ -339,8 +402,8 @@ function Te(e = {}) {
|
|
|
339
402
|
throw new Error(`Environment variable ${t} must be true, false, 1, or 0.`);
|
|
340
403
|
});
|
|
341
404
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
405
|
+
function We(e, t = {}) {
|
|
406
|
+
return T(t, !1, (r, n) => {
|
|
344
407
|
if (e.includes(n))
|
|
345
408
|
return n;
|
|
346
409
|
throw new Error(
|
|
@@ -348,8 +411,8 @@ function Ie(e, t = {}) {
|
|
|
348
411
|
);
|
|
349
412
|
});
|
|
350
413
|
}
|
|
351
|
-
function
|
|
352
|
-
return
|
|
414
|
+
function qe(e = {}) {
|
|
415
|
+
return T(e, !1, (t, r) => {
|
|
353
416
|
if (!/^-?\d+$/.test(r))
|
|
354
417
|
throw new Error(`Environment variable ${t} must be an integer.`);
|
|
355
418
|
const n = Number(r);
|
|
@@ -366,22 +429,22 @@ function De(e = {}) {
|
|
|
366
429
|
return n;
|
|
367
430
|
});
|
|
368
431
|
}
|
|
369
|
-
function
|
|
370
|
-
return
|
|
432
|
+
function Ge(e = {}) {
|
|
433
|
+
return T(
|
|
371
434
|
e,
|
|
372
435
|
!0,
|
|
373
|
-
(t, r) =>
|
|
436
|
+
(t, r) => K(t, r, e)
|
|
374
437
|
);
|
|
375
438
|
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
439
|
+
function Ke(e = {}) {
|
|
440
|
+
return T(
|
|
378
441
|
e,
|
|
379
442
|
!1,
|
|
380
|
-
(t, r) =>
|
|
443
|
+
(t, r) => K(t, r, e)
|
|
381
444
|
);
|
|
382
445
|
}
|
|
383
|
-
function
|
|
384
|
-
return
|
|
446
|
+
function Je(e = {}) {
|
|
447
|
+
return T(e, !1, (t, r) => {
|
|
385
448
|
let n;
|
|
386
449
|
try {
|
|
387
450
|
n = new URL(r);
|
|
@@ -395,32 +458,32 @@ function Oe(e = {}) {
|
|
|
395
458
|
return n;
|
|
396
459
|
});
|
|
397
460
|
}
|
|
398
|
-
const
|
|
399
|
-
boolean:
|
|
400
|
-
enum:
|
|
401
|
-
integer:
|
|
402
|
-
secret:
|
|
403
|
-
string:
|
|
404
|
-
url:
|
|
461
|
+
const hr = {
|
|
462
|
+
boolean: Ve,
|
|
463
|
+
enum: We,
|
|
464
|
+
integer: qe,
|
|
465
|
+
secret: Ge,
|
|
466
|
+
string: Ke,
|
|
467
|
+
url: Je
|
|
405
468
|
};
|
|
406
|
-
function
|
|
469
|
+
function T(e, t, r) {
|
|
407
470
|
return {
|
|
408
471
|
optional: e.optional ?? !1,
|
|
409
472
|
parse: r,
|
|
410
473
|
sensitive: t
|
|
411
474
|
};
|
|
412
475
|
}
|
|
413
|
-
function
|
|
476
|
+
function K(e, t, r) {
|
|
414
477
|
if (r.minLength !== void 0 && t.length < r.minLength)
|
|
415
478
|
throw new Error(
|
|
416
479
|
`Environment variable ${e} must be at least ${r.minLength} characters.`
|
|
417
480
|
);
|
|
418
481
|
return t;
|
|
419
482
|
}
|
|
420
|
-
function
|
|
483
|
+
function Ye(e) {
|
|
421
484
|
return e.length === 1 ? e[0].message : `Environment validation failed with ${e.length} issues.`;
|
|
422
485
|
}
|
|
423
|
-
function
|
|
486
|
+
function mr(e = {}) {
|
|
424
487
|
return async function(r) {
|
|
425
488
|
if (r.method.toUpperCase() !== "POST")
|
|
426
489
|
return new Response(null, {
|
|
@@ -429,25 +492,25 @@ function It(e = {}) {
|
|
|
429
492
|
},
|
|
430
493
|
status: 405
|
|
431
494
|
});
|
|
432
|
-
const n =
|
|
495
|
+
const n = Xe(r);
|
|
433
496
|
if (n)
|
|
434
497
|
return n;
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
return
|
|
438
|
-
e.maxBodySize !== void 0 && (r =
|
|
439
|
-
let
|
|
498
|
+
const o = Qe(e, r);
|
|
499
|
+
if (o)
|
|
500
|
+
return o;
|
|
501
|
+
e.maxBodySize !== void 0 && (r = he({ maxBodySize: e.maxBodySize }, r));
|
|
502
|
+
let a;
|
|
440
503
|
try {
|
|
441
|
-
|
|
442
|
-
} catch (
|
|
443
|
-
return
|
|
504
|
+
a = await r.json();
|
|
505
|
+
} catch (s) {
|
|
506
|
+
return s instanceof me ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
|
|
444
507
|
status: 400
|
|
445
508
|
});
|
|
446
509
|
}
|
|
447
|
-
const
|
|
448
|
-
for (let
|
|
449
|
-
await e.onReport?.(s
|
|
450
|
-
index:
|
|
510
|
+
const i = et(a);
|
|
511
|
+
for (let s = 0; s < i.length; s += 1)
|
|
512
|
+
await e.onReport?.(i[s], {
|
|
513
|
+
index: s,
|
|
451
514
|
request: r
|
|
452
515
|
});
|
|
453
516
|
return new Response(null, {
|
|
@@ -455,20 +518,20 @@ function It(e = {}) {
|
|
|
455
518
|
});
|
|
456
519
|
};
|
|
457
520
|
}
|
|
458
|
-
const
|
|
521
|
+
const Ze = /* @__PURE__ */ new Set([
|
|
459
522
|
"application/csp-report",
|
|
460
523
|
"application/reports+json"
|
|
461
524
|
]);
|
|
462
|
-
function
|
|
525
|
+
function Xe(e) {
|
|
463
526
|
const t = e.headers.get("content-type");
|
|
464
527
|
if (!t)
|
|
465
528
|
return null;
|
|
466
529
|
const r = t.split(";", 1)[0]?.trim().toLowerCase();
|
|
467
|
-
return r &&
|
|
530
|
+
return r && Ze.has(r) ? null : new Response("Unsupported security report Content-Type.", {
|
|
468
531
|
status: 415
|
|
469
532
|
});
|
|
470
533
|
}
|
|
471
|
-
function
|
|
534
|
+
function Qe(e, t) {
|
|
472
535
|
if (e.maxBodySize === void 0)
|
|
473
536
|
return null;
|
|
474
537
|
const r = t.headers.get("content-length");
|
|
@@ -479,32 +542,32 @@ function Pe(e, t) {
|
|
|
479
542
|
status: 400
|
|
480
543
|
});
|
|
481
544
|
const n = Number(r);
|
|
482
|
-
return Number.isSafeInteger(n) ? n >
|
|
545
|
+
return Number.isSafeInteger(n) ? n > D(e.maxBodySize) ? new Response("Security report body too large.", {
|
|
483
546
|
status: 413
|
|
484
547
|
}) : null : new Response("Invalid Content-Length.", {
|
|
485
548
|
status: 400
|
|
486
549
|
});
|
|
487
550
|
}
|
|
488
|
-
function
|
|
489
|
-
return Array.isArray(e) ? e :
|
|
551
|
+
function et(e) {
|
|
552
|
+
return Array.isArray(e) ? e : tt(e) && "csp-report" in e ? [e["csp-report"]] : [e];
|
|
490
553
|
}
|
|
491
|
-
function
|
|
554
|
+
function tt(e) {
|
|
492
555
|
return typeof e == "object" && e !== null;
|
|
493
556
|
}
|
|
494
|
-
function
|
|
557
|
+
function pr(e, t) {
|
|
495
558
|
const r = {}, n = [];
|
|
496
|
-
let
|
|
497
|
-
for (const [
|
|
498
|
-
const
|
|
499
|
-
r[
|
|
559
|
+
let o = 0;
|
|
560
|
+
for (const [a, i] of Object.entries(t.files)) {
|
|
561
|
+
const s = e.getAll(a).filter(ot);
|
|
562
|
+
r[a] = s, i.required && s.length === 0 && n.push({
|
|
500
563
|
code: "file-missing",
|
|
501
|
-
field:
|
|
502
|
-
message: `Upload field ${
|
|
564
|
+
field: a,
|
|
565
|
+
message: `Upload field ${a} requires at least one file.`
|
|
503
566
|
});
|
|
504
|
-
for (const
|
|
505
|
-
|
|
567
|
+
for (const l of s)
|
|
568
|
+
o += l.size, rt(a, l, i, n);
|
|
506
569
|
}
|
|
507
|
-
return t.maxTotalSize !== void 0 &&
|
|
570
|
+
return t.maxTotalSize !== void 0 && o > D(t.maxTotalSize) && n.push({
|
|
508
571
|
code: "total-upload-too-large",
|
|
509
572
|
field: "*",
|
|
510
573
|
message: `Uploaded files exceed the maximum total size of ${t.maxTotalSize}.`
|
|
@@ -512,27 +575,27 @@ function Dt(e, t) {
|
|
|
512
575
|
files: r,
|
|
513
576
|
issues: n,
|
|
514
577
|
ok: n.length === 0,
|
|
515
|
-
totalSize:
|
|
578
|
+
totalSize: o
|
|
516
579
|
};
|
|
517
580
|
}
|
|
518
|
-
function
|
|
519
|
-
r.maxSize !== void 0 && t.size >
|
|
581
|
+
function rt(e, t, r, n) {
|
|
582
|
+
r.maxSize !== void 0 && t.size > D(r.maxSize) && n.push({
|
|
520
583
|
code: "file-too-large",
|
|
521
584
|
field: e,
|
|
522
585
|
message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
|
|
523
|
-
}), r.types?.length && !
|
|
586
|
+
}), r.types?.length && !nt(t.type, r.types) && n.push({
|
|
524
587
|
code: "file-type-not-allowed",
|
|
525
588
|
field: e,
|
|
526
589
|
message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
|
|
527
590
|
});
|
|
528
591
|
}
|
|
529
|
-
function
|
|
592
|
+
function nt(e, t) {
|
|
530
593
|
return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
|
|
531
594
|
}
|
|
532
|
-
function
|
|
595
|
+
function ot(e) {
|
|
533
596
|
return e instanceof File;
|
|
534
597
|
}
|
|
535
|
-
function
|
|
598
|
+
function at(e, t) {
|
|
536
599
|
const r = t.headers.get("origin");
|
|
537
600
|
if (!r)
|
|
538
601
|
return {
|
|
@@ -541,7 +604,7 @@ function qe(e, t) {
|
|
|
541
604
|
origin: r,
|
|
542
605
|
reason: e.allowMissingOrigin ? void 0 : "missing-origin"
|
|
543
606
|
};
|
|
544
|
-
const n =
|
|
607
|
+
const n = J(r);
|
|
545
608
|
if (!n)
|
|
546
609
|
return {
|
|
547
610
|
allowed: !1,
|
|
@@ -549,28 +612,28 @@ function qe(e, t) {
|
|
|
549
612
|
origin: r,
|
|
550
613
|
reason: "invalid-origin"
|
|
551
614
|
};
|
|
552
|
-
const
|
|
615
|
+
const o = it(e, n, t);
|
|
553
616
|
return {
|
|
554
|
-
allowed:
|
|
617
|
+
allowed: o,
|
|
555
618
|
expected: e.origins,
|
|
556
619
|
origin: n,
|
|
557
|
-
reason:
|
|
620
|
+
reason: o ? void 0 : "origin-not-allowed"
|
|
558
621
|
};
|
|
559
622
|
}
|
|
560
|
-
function
|
|
561
|
-
return !e ||
|
|
623
|
+
function gr(e, t) {
|
|
624
|
+
return !e || at(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
|
|
562
625
|
status: 403
|
|
563
626
|
});
|
|
564
627
|
}
|
|
565
|
-
function
|
|
628
|
+
function it(e, t, r) {
|
|
566
629
|
return e.origins === "same-origin" ? t === new URL(r.url).origin : e.origins.some(
|
|
567
|
-
(n) =>
|
|
630
|
+
(n) => st(n, t)
|
|
568
631
|
);
|
|
569
632
|
}
|
|
570
|
-
function
|
|
571
|
-
return e === "null" ? t === "null" :
|
|
633
|
+
function st(e, t) {
|
|
634
|
+
return e === "null" ? t === "null" : J(e) === t;
|
|
572
635
|
}
|
|
573
|
-
function
|
|
636
|
+
function J(e) {
|
|
574
637
|
if (e === "null")
|
|
575
638
|
return e;
|
|
576
639
|
try {
|
|
@@ -588,122 +651,122 @@ function j(e) {
|
|
|
588
651
|
return null;
|
|
589
652
|
}
|
|
590
653
|
}
|
|
591
|
-
function
|
|
592
|
-
const t =
|
|
654
|
+
function ct(e) {
|
|
655
|
+
const t = W(e.routes), r = e.loadNavigationData ?? Z;
|
|
593
656
|
return function() {
|
|
594
|
-
const [
|
|
657
|
+
const [o, a] = F(() => $()), [i, s] = F(
|
|
595
658
|
() => e.initialMatch ?? { status: "loading" }
|
|
596
|
-
),
|
|
597
|
-
|
|
659
|
+
), l = z(!!e.initialMatch), d = z(0);
|
|
660
|
+
P(() => {
|
|
598
661
|
function c() {
|
|
599
|
-
|
|
662
|
+
a($());
|
|
600
663
|
}
|
|
601
664
|
return window.addEventListener("popstate", c), () => window.removeEventListener("popstate", c);
|
|
602
|
-
}, []),
|
|
603
|
-
let c = !1,
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
606
|
-
return
|
|
665
|
+
}, []), P(() => {
|
|
666
|
+
let c = !1, f = !1;
|
|
667
|
+
const h = ++d.current, v = new AbortController(), S = () => !c && h === d.current;
|
|
668
|
+
if (l.current && lt(e.initialMatch) === o.pathname)
|
|
669
|
+
return l.current = !1, () => {
|
|
607
670
|
c = !0;
|
|
608
671
|
};
|
|
609
|
-
|
|
610
|
-
|
|
672
|
+
s({ status: "loading" }), ge(t, o.pathname).then((m) => {
|
|
673
|
+
S() && !f && m && s({ loading: m, status: "loading" });
|
|
611
674
|
}).catch(() => {
|
|
612
675
|
});
|
|
613
|
-
const
|
|
614
|
-
return Promise.resolve(r(
|
|
615
|
-
(
|
|
676
|
+
const b = new Request(o.href, { signal: v.signal });
|
|
677
|
+
return Promise.resolve(r(b)).then(
|
|
678
|
+
(m) => q(
|
|
616
679
|
t,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
680
|
+
o.pathname,
|
|
681
|
+
b,
|
|
682
|
+
m,
|
|
620
683
|
void 0,
|
|
621
684
|
{ documentContributions: !1 }
|
|
622
685
|
)
|
|
623
|
-
).then((
|
|
624
|
-
|
|
625
|
-
}).catch(async (
|
|
626
|
-
if (
|
|
686
|
+
).then((m) => {
|
|
687
|
+
f = !0, S() && s(m);
|
|
688
|
+
}).catch(async (m) => {
|
|
689
|
+
if (f = !0, !S() || v.signal.aborted)
|
|
627
690
|
return;
|
|
628
|
-
const
|
|
691
|
+
const k = await we(
|
|
629
692
|
t,
|
|
630
|
-
|
|
693
|
+
o.pathname
|
|
631
694
|
);
|
|
632
|
-
|
|
633
|
-
Error:
|
|
634
|
-
error:
|
|
635
|
-
pathname:
|
|
695
|
+
S() && s({
|
|
696
|
+
Error: k,
|
|
697
|
+
error: m,
|
|
698
|
+
pathname: o.pathname,
|
|
636
699
|
status: "error"
|
|
637
700
|
});
|
|
638
701
|
}), () => {
|
|
639
|
-
c = !0,
|
|
702
|
+
c = !0, v.abort();
|
|
640
703
|
};
|
|
641
|
-
}, [
|
|
642
|
-
const
|
|
704
|
+
}, [o.pathname, o.search]);
|
|
705
|
+
const p = ne(
|
|
643
706
|
() => ({
|
|
644
707
|
navigation: e.navigation ?? "server",
|
|
645
708
|
push(c) {
|
|
646
|
-
const
|
|
709
|
+
const f = $();
|
|
647
710
|
window.history.pushState(null, "", c);
|
|
648
|
-
const
|
|
649
|
-
|
|
711
|
+
const h = $();
|
|
712
|
+
a(h), f.pathname === h.pathname && f.search === h.search && f.hash !== h.hash && pt(h.hash);
|
|
650
713
|
}
|
|
651
714
|
}),
|
|
652
715
|
[]
|
|
653
716
|
);
|
|
654
|
-
return
|
|
655
|
-
value:
|
|
656
|
-
children:
|
|
657
|
-
key: `${
|
|
717
|
+
return w(X.Provider, {
|
|
718
|
+
value: p,
|
|
719
|
+
children: w(dt, {
|
|
720
|
+
key: `${o.pathname}${o.search}`,
|
|
658
721
|
Loading: e.loading,
|
|
659
722
|
NotFound: e.notFound,
|
|
660
|
-
match:
|
|
723
|
+
match: i
|
|
661
724
|
})
|
|
662
725
|
});
|
|
663
726
|
};
|
|
664
727
|
}
|
|
665
|
-
function
|
|
666
|
-
const r = t.getAttribute(
|
|
728
|
+
function ut(e, t) {
|
|
729
|
+
const r = t.getAttribute(ce);
|
|
667
730
|
return e.status === "not-found" ? r === "not-found" : e.status === "ready" && r === null;
|
|
668
731
|
}
|
|
669
|
-
function
|
|
732
|
+
function lt(e) {
|
|
670
733
|
if (e)
|
|
671
734
|
return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
|
|
672
735
|
}
|
|
673
|
-
async function
|
|
736
|
+
async function wr(e) {
|
|
674
737
|
const t = e.root ?? document.getElementById("root");
|
|
675
738
|
if (!t)
|
|
676
739
|
throw new Error(
|
|
677
740
|
"Demiurge expected a #root element in the framework document."
|
|
678
741
|
);
|
|
679
|
-
const r =
|
|
742
|
+
const r = W(e.routes), n = e.loadNavigationData ?? Z, o = e.initialData ?? ie(document), a = await q(
|
|
680
743
|
r,
|
|
681
744
|
window.location.pathname,
|
|
682
745
|
new Request(window.location.href),
|
|
683
|
-
|
|
746
|
+
o ?? await n(new Request(window.location.href)),
|
|
684
747
|
void 0,
|
|
685
748
|
{ documentContributions: !1 }
|
|
686
|
-
),
|
|
687
|
-
|
|
749
|
+
), i = ut(a, t), s = ct(
|
|
750
|
+
i ? {
|
|
688
751
|
...e,
|
|
689
|
-
initialMatch:
|
|
752
|
+
initialMatch: a,
|
|
690
753
|
loadNavigationData: n,
|
|
691
|
-
navigation:
|
|
754
|
+
navigation: o?.navigation ?? e.navigation
|
|
692
755
|
} : {
|
|
693
756
|
...e,
|
|
694
757
|
loadNavigationData: n,
|
|
695
|
-
navigation:
|
|
758
|
+
navigation: o?.navigation ?? e.navigation
|
|
696
759
|
}
|
|
697
|
-
), { createRoot:
|
|
760
|
+
), { createRoot: l, hydrateRoot: d } = ft(
|
|
698
761
|
await import("react-dom/client")
|
|
699
762
|
);
|
|
700
|
-
if (
|
|
701
|
-
d(t,
|
|
763
|
+
if (i && t.hasAttribute(se)) {
|
|
764
|
+
d(t, w(s)), U();
|
|
702
765
|
return;
|
|
703
766
|
}
|
|
704
|
-
t.replaceChildren(),
|
|
767
|
+
t.replaceChildren(), l(t).render(w(s)), U();
|
|
705
768
|
}
|
|
706
|
-
function
|
|
769
|
+
function ft(e) {
|
|
707
770
|
const t = typeof e.createRoot == "function" && typeof e.hydrateRoot == "function" ? e : e.default;
|
|
708
771
|
if (!t || typeof t.createRoot != "function" || typeof t.hydrateRoot != "function")
|
|
709
772
|
throw new Error(
|
|
@@ -711,57 +774,57 @@ function Ze(e) {
|
|
|
711
774
|
);
|
|
712
775
|
return t;
|
|
713
776
|
}
|
|
714
|
-
function
|
|
715
|
-
const t =
|
|
716
|
-
return /* @__PURE__ */
|
|
777
|
+
function yr(e) {
|
|
778
|
+
const t = wt(), r = pe(e);
|
|
779
|
+
return /* @__PURE__ */ V(
|
|
717
780
|
"a",
|
|
718
781
|
{
|
|
719
782
|
className: e.className,
|
|
720
783
|
href: r,
|
|
721
784
|
onClick: (n) => {
|
|
722
|
-
t.navigation === "server" &&
|
|
785
|
+
t.navigation === "server" && gt(n) && (n.preventDefault(), t.push(r));
|
|
723
786
|
},
|
|
724
787
|
children: e.children
|
|
725
788
|
}
|
|
726
789
|
);
|
|
727
790
|
}
|
|
728
|
-
function
|
|
791
|
+
function dt({
|
|
729
792
|
Loading: e,
|
|
730
793
|
NotFound: t,
|
|
731
794
|
match: r
|
|
732
795
|
}) {
|
|
733
796
|
if (r.status === "loading") {
|
|
734
797
|
const c = r.loading ?? e;
|
|
735
|
-
return c ?
|
|
798
|
+
return c ? w(c) : null;
|
|
736
799
|
}
|
|
737
800
|
if (r.status === "not-found") {
|
|
738
|
-
const c = r.notFound ?? t ??
|
|
801
|
+
const c = r.notFound ?? t ?? Te;
|
|
739
802
|
return r.layouts.reduceRight(
|
|
740
|
-
(
|
|
741
|
-
children:
|
|
803
|
+
(f, h) => w(h, {
|
|
804
|
+
children: f,
|
|
742
805
|
path: {},
|
|
743
806
|
pathname: r.pathname
|
|
744
807
|
}),
|
|
745
|
-
|
|
808
|
+
w(c, { pathname: r.pathname })
|
|
746
809
|
);
|
|
747
810
|
}
|
|
748
811
|
if (r.status === "error")
|
|
749
|
-
return r.Error ?
|
|
812
|
+
return r.Error ? w(r.Error, {
|
|
750
813
|
error: r.error,
|
|
751
814
|
pathname: r.pathname,
|
|
752
|
-
status:
|
|
815
|
+
status: Y(r.error)
|
|
753
816
|
}) : null;
|
|
754
|
-
const { data: n, error:
|
|
755
|
-
(c,
|
|
817
|
+
const { data: n, error: o, page: a, layouts: i, path: s, pathname: l } = r.match, d = w(a, { data: n, path: s, pathname: l }), p = i.reduceRight(
|
|
818
|
+
(c, f) => w(f, { path: s, pathname: l, children: c }),
|
|
756
819
|
d
|
|
757
820
|
);
|
|
758
|
-
return
|
|
759
|
-
Error:
|
|
760
|
-
children:
|
|
761
|
-
pathname:
|
|
821
|
+
return w(ht, {
|
|
822
|
+
Error: o,
|
|
823
|
+
children: p,
|
|
824
|
+
pathname: l
|
|
762
825
|
});
|
|
763
826
|
}
|
|
764
|
-
class
|
|
827
|
+
class ht extends ae {
|
|
765
828
|
static getDerivedStateFromError(t) {
|
|
766
829
|
return { error: t };
|
|
767
830
|
}
|
|
@@ -770,17 +833,17 @@ class Xe extends K {
|
|
|
770
833
|
this.state.error !== void 0 && t.pathname !== this.props.pathname && this.setState({ error: void 0 });
|
|
771
834
|
}
|
|
772
835
|
render() {
|
|
773
|
-
return this.state.error !== void 0 ? this.props.Error ?
|
|
836
|
+
return this.state.error !== void 0 ? this.props.Error ? w(this.props.Error, {
|
|
774
837
|
error: this.state.error,
|
|
775
838
|
pathname: this.props.pathname,
|
|
776
|
-
status:
|
|
839
|
+
status: Y(this.state.error)
|
|
777
840
|
}) : null : this.props.children;
|
|
778
841
|
}
|
|
779
842
|
}
|
|
780
|
-
function
|
|
781
|
-
return
|
|
843
|
+
function Y(e) {
|
|
844
|
+
return ke(e) ? e.status : 500;
|
|
782
845
|
}
|
|
783
|
-
function
|
|
846
|
+
function $() {
|
|
784
847
|
return {
|
|
785
848
|
hash: window.location.hash,
|
|
786
849
|
href: window.location.href,
|
|
@@ -788,42 +851,42 @@ function S() {
|
|
|
788
851
|
search: window.location.search
|
|
789
852
|
};
|
|
790
853
|
}
|
|
791
|
-
async function
|
|
854
|
+
async function Z(e) {
|
|
792
855
|
const t = new Headers(e.headers);
|
|
793
|
-
t.set("accept", "application/json"), t.set(
|
|
856
|
+
t.set("accept", "application/json"), t.set(_, ye);
|
|
794
857
|
const r = await fetch(new Request(e, {
|
|
795
858
|
credentials: "same-origin",
|
|
796
859
|
headers: t
|
|
797
|
-
})), n = r.headers.get(
|
|
798
|
-
if (n ===
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
860
|
+
})), n = r.headers.get(_);
|
|
861
|
+
if (n === ve) {
|
|
862
|
+
const o = await r.json();
|
|
863
|
+
if (o.hasData !== !0)
|
|
801
864
|
throw new Error("Demiurge received malformed navigation route data.");
|
|
802
|
-
return { data:
|
|
865
|
+
return { data: o.data, hasData: !0 };
|
|
803
866
|
}
|
|
804
|
-
if (n ===
|
|
867
|
+
if (n === be)
|
|
805
868
|
return { hasData: !0 };
|
|
806
|
-
if (n ===
|
|
807
|
-
const
|
|
869
|
+
if (n === Se || !r.ok) {
|
|
870
|
+
const o = await mt(r), a = Ee.includes(
|
|
808
871
|
r.status
|
|
809
872
|
) ? r.status : 500;
|
|
810
|
-
throw
|
|
811
|
-
detail: typeof
|
|
812
|
-
title: typeof
|
|
873
|
+
throw Re(a, {
|
|
874
|
+
detail: typeof o?.detail == "string" ? o.detail : void 0,
|
|
875
|
+
title: typeof o?.title == "string" ? o.title : void 0
|
|
813
876
|
});
|
|
814
877
|
}
|
|
815
878
|
throw new Error(
|
|
816
879
|
"Demiurge expected a navigation data response from the application server."
|
|
817
880
|
);
|
|
818
881
|
}
|
|
819
|
-
async function
|
|
882
|
+
async function mt(e) {
|
|
820
883
|
try {
|
|
821
884
|
return await e.json();
|
|
822
885
|
} catch {
|
|
823
886
|
return;
|
|
824
887
|
}
|
|
825
888
|
}
|
|
826
|
-
function
|
|
889
|
+
function pt(e) {
|
|
827
890
|
queueMicrotask(() => {
|
|
828
891
|
if (!e) {
|
|
829
892
|
window.scrollTo?.(0, 0);
|
|
@@ -838,45 +901,45 @@ function Qe(e) {
|
|
|
838
901
|
document.getElementById(t)?.scrollIntoView?.();
|
|
839
902
|
});
|
|
840
903
|
}
|
|
841
|
-
function
|
|
904
|
+
function gt(e) {
|
|
842
905
|
return e.button === 0 && !e.metaKey && !e.altKey && !e.ctrlKey && !e.shiftKey;
|
|
843
906
|
}
|
|
844
|
-
const
|
|
907
|
+
const X = re({
|
|
845
908
|
navigation: "document",
|
|
846
909
|
push(e) {
|
|
847
910
|
window.location.href = e;
|
|
848
911
|
}
|
|
849
912
|
});
|
|
850
|
-
function
|
|
851
|
-
return
|
|
913
|
+
function wt() {
|
|
914
|
+
return oe(X);
|
|
852
915
|
}
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
return /* @__PURE__ */
|
|
916
|
+
function vr({ className: e, id: t, policy: r, ...n }) {
|
|
917
|
+
const o = Ae(n, r);
|
|
918
|
+
return /* @__PURE__ */ V(
|
|
856
919
|
"img",
|
|
857
920
|
{
|
|
858
|
-
alt:
|
|
921
|
+
alt: o.alt,
|
|
859
922
|
className: e,
|
|
860
|
-
decoding:
|
|
861
|
-
fetchPriority:
|
|
862
|
-
height:
|
|
923
|
+
decoding: o.decoding,
|
|
924
|
+
fetchPriority: o.fetchPriority,
|
|
925
|
+
height: o.height,
|
|
863
926
|
id: t,
|
|
864
|
-
loading:
|
|
865
|
-
sizes:
|
|
866
|
-
src:
|
|
867
|
-
srcSet:
|
|
868
|
-
width:
|
|
927
|
+
loading: o.loading,
|
|
928
|
+
sizes: o.sizes,
|
|
929
|
+
src: o.src,
|
|
930
|
+
srcSet: o.srcSet,
|
|
931
|
+
width: o.width
|
|
869
932
|
}
|
|
870
933
|
);
|
|
871
934
|
}
|
|
872
|
-
const
|
|
935
|
+
const yt = "https://js.sentry-cdn.com", br = {
|
|
873
936
|
/**
|
|
874
937
|
* Plausible loads one script and posts events to its own API. The snippet
|
|
875
938
|
* carries configuration in `data-domain`, so no inline code is involved.
|
|
876
939
|
* `endpoint` accepts a same-origin path prefix for a proxied deployment.
|
|
877
940
|
*/
|
|
878
941
|
plausible(e) {
|
|
879
|
-
const t =
|
|
942
|
+
const t = vt(e.domain), r = H(e.endpoint ?? "https://plausible.io");
|
|
880
943
|
return {
|
|
881
944
|
consent: e.consent ?? !1,
|
|
882
945
|
domain: t,
|
|
@@ -887,7 +950,7 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
887
950
|
},
|
|
888
951
|
provider: "plausible",
|
|
889
952
|
scripts: [
|
|
890
|
-
|
|
953
|
+
I({
|
|
891
954
|
dataApi: `${r.base}/api/event`,
|
|
892
955
|
dataDomain: t,
|
|
893
956
|
defer: !0,
|
|
@@ -905,8 +968,8 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
905
968
|
* why the integration also declares a `connect-src` need.
|
|
906
969
|
*/
|
|
907
970
|
sentry(e) {
|
|
908
|
-
const t =
|
|
909
|
-
e.loaderHost ??
|
|
971
|
+
const t = Et(e.dsn), r = St(
|
|
972
|
+
e.loaderHost ?? yt,
|
|
910
973
|
"Sentry loader host"
|
|
911
974
|
);
|
|
912
975
|
return {
|
|
@@ -920,7 +983,7 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
920
983
|
projectId: t.projectId,
|
|
921
984
|
provider: "sentry",
|
|
922
985
|
scripts: [
|
|
923
|
-
|
|
986
|
+
I({
|
|
924
987
|
crossOrigin: "anonymous",
|
|
925
988
|
needs: { connect: [t.origin] },
|
|
926
989
|
purpose: "error-monitoring",
|
|
@@ -939,7 +1002,7 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
939
1002
|
* to, and an optional same-origin entry script that starts the SDK.
|
|
940
1003
|
*/
|
|
941
1004
|
openTelemetry(e) {
|
|
942
|
-
const t =
|
|
1005
|
+
const t = H(e.endpoint), r = e.script;
|
|
943
1006
|
if (r !== void 0 && !r.startsWith("/"))
|
|
944
1007
|
throw new Error(
|
|
945
1008
|
"OpenTelemetry browser instrumentation must be a same-origin script path."
|
|
@@ -951,7 +1014,7 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
951
1014
|
needs: r ? { connect: [t.source], script: ["'self'"] } : { connect: [t.source] },
|
|
952
1015
|
provider: "opentelemetry",
|
|
953
1016
|
scripts: r ? [
|
|
954
|
-
|
|
1017
|
+
I({
|
|
955
1018
|
needs: { connect: [t.source] },
|
|
956
1019
|
purpose: "observability",
|
|
957
1020
|
src: r,
|
|
@@ -965,8 +1028,8 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
965
1028
|
const t = {};
|
|
966
1029
|
for (const r of e)
|
|
967
1030
|
for (const n of ["connect", "img", "script"]) {
|
|
968
|
-
const
|
|
969
|
-
!
|
|
1031
|
+
const o = r.needs[n];
|
|
1032
|
+
!o || o.length === 0 || (t[n] = [.../* @__PURE__ */ new Set([...t[n] ?? [], ...o])]);
|
|
970
1033
|
}
|
|
971
1034
|
return { security: { needs: t } };
|
|
972
1035
|
},
|
|
@@ -975,13 +1038,13 @@ const rt = "https://js.sentry-cdn.com", zt = {
|
|
|
975
1038
|
return e.flatMap((t) => [...t.scripts]);
|
|
976
1039
|
}
|
|
977
1040
|
};
|
|
978
|
-
function
|
|
1041
|
+
function vt(e) {
|
|
979
1042
|
const t = e.trim();
|
|
980
1043
|
if (!t || t.includes("/") || t.includes(" "))
|
|
981
1044
|
throw new Error("Analytics domain must be a hostname without a path.");
|
|
982
1045
|
return t;
|
|
983
1046
|
}
|
|
984
|
-
function
|
|
1047
|
+
function H(e) {
|
|
985
1048
|
if (e.startsWith("/")) {
|
|
986
1049
|
if (e.startsWith("//"))
|
|
987
1050
|
throw new Error("Analytics endpoint must not be a scheme-relative URL.");
|
|
@@ -990,10 +1053,10 @@ function L(e) {
|
|
|
990
1053
|
source: "'self'"
|
|
991
1054
|
};
|
|
992
1055
|
}
|
|
993
|
-
const t =
|
|
1056
|
+
const t = bt(e);
|
|
994
1057
|
return { base: t.origin, source: t.origin };
|
|
995
1058
|
}
|
|
996
|
-
function
|
|
1059
|
+
function bt(e) {
|
|
997
1060
|
let t;
|
|
998
1061
|
try {
|
|
999
1062
|
t = new URL(e);
|
|
@@ -1004,7 +1067,7 @@ function at(e) {
|
|
|
1004
1067
|
throw new Error("Analytics endpoint must use HTTPS.");
|
|
1005
1068
|
return t;
|
|
1006
1069
|
}
|
|
1007
|
-
function
|
|
1070
|
+
function St(e, t) {
|
|
1008
1071
|
let r;
|
|
1009
1072
|
try {
|
|
1010
1073
|
r = new URL(e);
|
|
@@ -1015,7 +1078,7 @@ function it(e, t) {
|
|
|
1015
1078
|
throw new Error(`${t} must use HTTPS.`);
|
|
1016
1079
|
return r.origin;
|
|
1017
1080
|
}
|
|
1018
|
-
function
|
|
1081
|
+
function Et(e) {
|
|
1019
1082
|
let t;
|
|
1020
1083
|
try {
|
|
1021
1084
|
t = new URL(e);
|
|
@@ -1037,143 +1100,416 @@ function ot(e) {
|
|
|
1037
1100
|
publicKey: t.username
|
|
1038
1101
|
};
|
|
1039
1102
|
}
|
|
1040
|
-
function
|
|
1103
|
+
function Sr(e = {}) {
|
|
1041
1104
|
return {
|
|
1042
1105
|
async request(t) {
|
|
1043
|
-
await
|
|
1106
|
+
await x({ kind: "request", signal: t }, e);
|
|
1044
1107
|
},
|
|
1045
1108
|
async serverStart(t = {}) {
|
|
1046
|
-
await
|
|
1109
|
+
await x({ kind: "server-start", signal: t }, e);
|
|
1047
1110
|
},
|
|
1048
1111
|
async trace(t) {
|
|
1049
|
-
await
|
|
1112
|
+
await x({ kind: "trace", signal: t }, e);
|
|
1050
1113
|
},
|
|
1051
1114
|
async reportWebVitals(t) {
|
|
1052
|
-
await
|
|
1115
|
+
await x({ kind: "web-vital", signal: t }, e);
|
|
1053
1116
|
}
|
|
1054
1117
|
};
|
|
1055
1118
|
}
|
|
1056
|
-
async function
|
|
1119
|
+
async function x(e, t) {
|
|
1057
1120
|
await t.onEvent?.(e), e.kind === "request" ? await t.request?.(e.signal) : e.kind === "server-start" ? await t.serverStart?.(e.signal) : e.kind === "trace" ? await t.trace?.(e.signal) : await t.webVitals?.(e.signal);
|
|
1058
1121
|
}
|
|
1122
|
+
const Rt = [
|
|
1123
|
+
"CLS",
|
|
1124
|
+
"FCP",
|
|
1125
|
+
"FID",
|
|
1126
|
+
"INP",
|
|
1127
|
+
"LCP",
|
|
1128
|
+
"TTFB"
|
|
1129
|
+
], L = [
|
|
1130
|
+
"CLS",
|
|
1131
|
+
"FCP",
|
|
1132
|
+
"INP",
|
|
1133
|
+
"LCP",
|
|
1134
|
+
"TTFB"
|
|
1135
|
+
], Tt = new Set(Rt), kt = /* @__PURE__ */ new Set([
|
|
1136
|
+
"back-forward",
|
|
1137
|
+
"back-forward-cache",
|
|
1138
|
+
"navigate",
|
|
1139
|
+
"prerender",
|
|
1140
|
+
"reload",
|
|
1141
|
+
"restore"
|
|
1142
|
+
]), At = /* @__PURE__ */ new Set([
|
|
1143
|
+
"good",
|
|
1144
|
+
"needs-improvement",
|
|
1145
|
+
"poor"
|
|
1146
|
+
]);
|
|
1147
|
+
function $t(e) {
|
|
1148
|
+
return typeof e == "string" && Tt.has(e);
|
|
1149
|
+
}
|
|
1150
|
+
function xt(e) {
|
|
1151
|
+
return typeof e == "string" && kt.has(e);
|
|
1152
|
+
}
|
|
1153
|
+
function Ct(e) {
|
|
1154
|
+
return typeof e == "string" && At.has(e);
|
|
1155
|
+
}
|
|
1156
|
+
const It = {
|
|
1157
|
+
CLS: { good: 0.1, poor: 0.25 },
|
|
1158
|
+
FCP: { good: 1800, poor: 3e3 },
|
|
1159
|
+
FID: { good: 100, poor: 300 },
|
|
1160
|
+
INP: { good: 200, poor: 500 },
|
|
1161
|
+
LCP: { good: 2500, poor: 4e3 },
|
|
1162
|
+
TTFB: { good: 800, poor: 1800 }
|
|
1163
|
+
};
|
|
1164
|
+
function Nt(e, t) {
|
|
1165
|
+
const r = It[e];
|
|
1166
|
+
return t <= r.good ? "good" : t > r.poor ? "poor" : "needs-improvement";
|
|
1167
|
+
}
|
|
1168
|
+
const Q = 32;
|
|
1169
|
+
function Er(e) {
|
|
1170
|
+
const t = Dt(e.endpoint), r = Ot(e.metrics), n = Mt(e.sampleRate);
|
|
1171
|
+
return {
|
|
1172
|
+
endpoint: t.url,
|
|
1173
|
+
kind: "web-vitals",
|
|
1174
|
+
metrics: r,
|
|
1175
|
+
needs: { connect: [t.source] },
|
|
1176
|
+
sampleRate: n
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
function Rr(...e) {
|
|
1180
|
+
const t = /* @__PURE__ */ new Set();
|
|
1181
|
+
for (const r of e)
|
|
1182
|
+
for (const n of r.needs.connect ?? [])
|
|
1183
|
+
t.add(n);
|
|
1184
|
+
return t.size === 0 ? { security: { needs: {} } } : { security: { needs: { connect: [...t] } } };
|
|
1185
|
+
}
|
|
1186
|
+
async function Tr(e, t = {}) {
|
|
1187
|
+
const r = t.maxMetrics ?? Q;
|
|
1188
|
+
let n;
|
|
1189
|
+
try {
|
|
1190
|
+
n = await e.json();
|
|
1191
|
+
} catch {
|
|
1192
|
+
return { ok: !1, reason: "unreadable-body" };
|
|
1193
|
+
}
|
|
1194
|
+
return Lt(n, r);
|
|
1195
|
+
}
|
|
1196
|
+
function Lt(e, t = Q) {
|
|
1197
|
+
if (!ee(e) || !Array.isArray(e.metrics))
|
|
1198
|
+
return { ok: !1, reason: "invalid-payload" };
|
|
1199
|
+
if (e.metrics.length > t)
|
|
1200
|
+
return { ok: !1, reason: "too-many-metrics" };
|
|
1201
|
+
const r = [];
|
|
1202
|
+
for (const n of e.metrics) {
|
|
1203
|
+
const o = Pt(n);
|
|
1204
|
+
if (!o)
|
|
1205
|
+
return { ok: !1, reason: "invalid-payload" };
|
|
1206
|
+
r.push(o);
|
|
1207
|
+
}
|
|
1208
|
+
return { metrics: r, ok: !0 };
|
|
1209
|
+
}
|
|
1210
|
+
function Pt(e) {
|
|
1211
|
+
if (!ee(e))
|
|
1212
|
+
return;
|
|
1213
|
+
const { id: t, name: r, navigationType: n, rating: o, url: a, value: i } = e;
|
|
1214
|
+
if (!(typeof t != "string" || t.length === 0 || t.length > 128) && !(!$t(r) || !xt(n)) && Ct(o) && !(typeof a != "string" || a.length === 0 || a.length > 2048) && !(typeof i != "number" || !Number.isFinite(i) || i < 0))
|
|
1215
|
+
return { id: t, name: r, navigationType: n, rating: o, url: a, value: i };
|
|
1216
|
+
}
|
|
1217
|
+
function ee(e) {
|
|
1218
|
+
return typeof e == "object" && e !== null;
|
|
1219
|
+
}
|
|
1220
|
+
function Dt(e) {
|
|
1221
|
+
if (e.startsWith("/")) {
|
|
1222
|
+
if (e.startsWith("//"))
|
|
1223
|
+
throw new Error(
|
|
1224
|
+
"The web vitals endpoint must not be a scheme-relative URL."
|
|
1225
|
+
);
|
|
1226
|
+
return { source: "'self'", url: e };
|
|
1227
|
+
}
|
|
1228
|
+
let t;
|
|
1229
|
+
try {
|
|
1230
|
+
t = new URL(e);
|
|
1231
|
+
} catch {
|
|
1232
|
+
throw new Error(
|
|
1233
|
+
"The web vitals endpoint must be a same-origin path or an absolute URL."
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
if (t.protocol !== "https:")
|
|
1237
|
+
throw new Error("The web vitals endpoint must use HTTPS.");
|
|
1238
|
+
return { source: t.origin, url: t.href };
|
|
1239
|
+
}
|
|
1240
|
+
function Ot(e) {
|
|
1241
|
+
if (!e)
|
|
1242
|
+
return L;
|
|
1243
|
+
const t = [];
|
|
1244
|
+
for (const r of e) {
|
|
1245
|
+
if (!L.includes(r))
|
|
1246
|
+
throw new Error(
|
|
1247
|
+
`The browser collector does not measure ${JSON.stringify(r)}. Demiurge collects ${L.join(", ")}.`
|
|
1248
|
+
);
|
|
1249
|
+
t.includes(r) || t.push(r);
|
|
1250
|
+
}
|
|
1251
|
+
if (t.length === 0)
|
|
1252
|
+
throw new Error("A web vitals integration must collect one metric or more.");
|
|
1253
|
+
return t;
|
|
1254
|
+
}
|
|
1255
|
+
function Mt(e) {
|
|
1256
|
+
if (e === void 0)
|
|
1257
|
+
return 1;
|
|
1258
|
+
if (!Number.isFinite(e) || e < 0 || e > 1)
|
|
1259
|
+
throw new Error("The web vitals sample rate must be between 0 and 1.");
|
|
1260
|
+
return e;
|
|
1261
|
+
}
|
|
1262
|
+
const Ft = 1e3, zt = 5e3, Ut = 40;
|
|
1263
|
+
function Bt(e, t = {}) {
|
|
1264
|
+
if (typeof window > "u" || typeof PerformanceObserver > "u")
|
|
1265
|
+
return () => {
|
|
1266
|
+
};
|
|
1267
|
+
const r = t.random ?? Math.random;
|
|
1268
|
+
if (e.sampleRate < 1 && r() >= e.sampleRate)
|
|
1269
|
+
return () => {
|
|
1270
|
+
};
|
|
1271
|
+
const n = t.transport ?? _t, o = new Set(e.metrics), a = [], i = [], s = /* @__PURE__ */ new Set();
|
|
1272
|
+
let l = jt(), d = 0, p = 0, c = 0, f = 0, h, v, S = !1;
|
|
1273
|
+
const b = (u, g) => {
|
|
1274
|
+
if (S || s.has(u))
|
|
1275
|
+
return;
|
|
1276
|
+
s.add(u);
|
|
1277
|
+
const y = {
|
|
1278
|
+
id: `${u}-${Date.now()}-${Math.floor(r() * 1e9)}`,
|
|
1279
|
+
name: u,
|
|
1280
|
+
navigationType: l,
|
|
1281
|
+
rating: Nt(u, g),
|
|
1282
|
+
url: window.location.href,
|
|
1283
|
+
value: Math.round(g * 1e3) / 1e3
|
|
1284
|
+
};
|
|
1285
|
+
i.push(y), t.onReport?.(y);
|
|
1286
|
+
}, m = () => {
|
|
1287
|
+
if (S || (h !== void 0 && b("LCP", h), v !== void 0 && b("INP", v), o.has("CLS") && b("CLS", d), i.length === 0))
|
|
1288
|
+
return;
|
|
1289
|
+
const u = i.splice(0, i.length);
|
|
1290
|
+
n(e.endpoint, { metrics: u });
|
|
1291
|
+
}, k = () => {
|
|
1292
|
+
document.visibilityState === "hidden" && m();
|
|
1293
|
+
}, M = (u) => {
|
|
1294
|
+
u.persisted && (l = "back-forward-cache", s.clear(), d = 0, p = 0, c = 0, f = 0, h = void 0, v = void 0, o.has("FCP") && b("FCP", performance.now() - u.timeStamp));
|
|
1295
|
+
};
|
|
1296
|
+
if (o.has("TTFB")) {
|
|
1297
|
+
const u = te();
|
|
1298
|
+
u && u.responseStart > 0 && b("TTFB", u.responseStart);
|
|
1299
|
+
}
|
|
1300
|
+
return o.has("FCP") && C(a, { buffered: !0, type: "paint" }, (u) => {
|
|
1301
|
+
for (const g of u)
|
|
1302
|
+
g.name === "first-contentful-paint" && b("FCP", g.startTime);
|
|
1303
|
+
}), o.has("LCP") && C(
|
|
1304
|
+
a,
|
|
1305
|
+
{ buffered: !0, type: "largest-contentful-paint" },
|
|
1306
|
+
(u) => {
|
|
1307
|
+
const g = u.at(-1);
|
|
1308
|
+
g && (h = g.startTime);
|
|
1309
|
+
}
|
|
1310
|
+
), o.has("CLS") && C(a, { buffered: !0, type: "layout-shift" }, (u) => {
|
|
1311
|
+
for (const g of u) {
|
|
1312
|
+
const y = g;
|
|
1313
|
+
if (y.hadRecentInput)
|
|
1314
|
+
continue;
|
|
1315
|
+
p > 0 && y.startTime - f < Ft && y.startTime - c < zt ? p += y.value : (p = y.value, c = y.startTime), f = y.startTime, d = Math.max(d, p);
|
|
1316
|
+
}
|
|
1317
|
+
}), o.has("INP") && C(
|
|
1318
|
+
a,
|
|
1319
|
+
{
|
|
1320
|
+
buffered: !0,
|
|
1321
|
+
durationThreshold: Ut,
|
|
1322
|
+
type: "event"
|
|
1323
|
+
},
|
|
1324
|
+
(u) => {
|
|
1325
|
+
for (const g of u)
|
|
1326
|
+
v = Math.max(v ?? 0, g.duration);
|
|
1327
|
+
}
|
|
1328
|
+
), document.addEventListener("visibilitychange", k), window.addEventListener("pagehide", m), window.addEventListener("pageshow", M), () => {
|
|
1329
|
+
m(), S = !0;
|
|
1330
|
+
for (const u of a)
|
|
1331
|
+
u.disconnect();
|
|
1332
|
+
document.removeEventListener("visibilitychange", k), window.removeEventListener("pagehide", m), window.removeEventListener("pageshow", M);
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
function kr({ integration: e, onReport: t, transport: r }) {
|
|
1336
|
+
return P(
|
|
1337
|
+
() => Bt(e, { onReport: t, transport: r }),
|
|
1338
|
+
[e, t, r]
|
|
1339
|
+
), null;
|
|
1340
|
+
}
|
|
1341
|
+
function _t(e, t) {
|
|
1342
|
+
const r = JSON.stringify(t);
|
|
1343
|
+
if (typeof navigator < "u" && typeof navigator.sendBeacon == "function") {
|
|
1344
|
+
const n = new Blob([r], { type: "application/json" });
|
|
1345
|
+
if (navigator.sendBeacon(e, n))
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
fetch(e, {
|
|
1349
|
+
body: r,
|
|
1350
|
+
headers: { "content-type": "application/json" },
|
|
1351
|
+
keepalive: !0,
|
|
1352
|
+
method: "POST"
|
|
1353
|
+
}).catch(() => {
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
function C(e, t, r) {
|
|
1357
|
+
try {
|
|
1358
|
+
const n = new PerformanceObserver((o) => r(o.getEntries()));
|
|
1359
|
+
n.observe(t), e.push(n);
|
|
1360
|
+
} catch {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
function te() {
|
|
1365
|
+
if (!(typeof performance > "u"))
|
|
1366
|
+
return performance.getEntriesByType("navigation")[0];
|
|
1367
|
+
}
|
|
1368
|
+
function jt() {
|
|
1369
|
+
const e = te();
|
|
1370
|
+
return e?.type === "back_forward" ? "back-forward" : e?.type === "reload" || e?.type === "prerender" ? e.type : "navigate";
|
|
1371
|
+
}
|
|
1059
1372
|
export {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1373
|
+
L as COLLECTED_WEB_VITAL_NAMES,
|
|
1374
|
+
Vr as CacheNotFoundError,
|
|
1375
|
+
He as EnvValidationError,
|
|
1376
|
+
xr as FRAMEWORK_TRUSTED_TYPES_POLICY,
|
|
1377
|
+
Ee as HTTP_ERROR_STATUSES,
|
|
1378
|
+
Wr as HttpError,
|
|
1379
|
+
vr as Image,
|
|
1380
|
+
yr as Link,
|
|
1381
|
+
Cr as Script,
|
|
1382
|
+
Rt as WEB_VITAL_NAMES,
|
|
1383
|
+
It as WEB_VITAL_THRESHOLDS,
|
|
1384
|
+
kr as WebVitals,
|
|
1385
|
+
or as action,
|
|
1386
|
+
ar as actionInput,
|
|
1387
|
+
br as analytics,
|
|
1388
|
+
qr as applyFetchMetadataVary,
|
|
1389
|
+
Ir as assertAdapterCapabilities,
|
|
1390
|
+
Gr as auditScriptDependencies,
|
|
1391
|
+
Kr as cacheNotFound,
|
|
1392
|
+
Nr as checkAdapterCapabilities,
|
|
1393
|
+
Jr as checkFetchMetadata,
|
|
1394
|
+
at as checkWebSocketOrigin,
|
|
1395
|
+
Bt as collectWebVitals,
|
|
1396
|
+
Yr as createCache,
|
|
1397
|
+
Zr as createCorsHeaders,
|
|
1398
|
+
Xr as createCsrfCookie,
|
|
1399
|
+
Qr as createCsrfToken,
|
|
1400
|
+
ct as createFileRouter,
|
|
1401
|
+
Lr as createFrameworkScriptUrl,
|
|
1402
|
+
en as createInvalidation,
|
|
1403
|
+
tn as createMemoryCache,
|
|
1404
|
+
rn as createMemoryCacheStore,
|
|
1405
|
+
Yt as createMemoryIdempotencyStore,
|
|
1406
|
+
nn as createMemoryRateLimitStore,
|
|
1407
|
+
on as createRequestHandler,
|
|
1408
|
+
lr as createSecureCookie,
|
|
1409
|
+
an as createSecurityAudit,
|
|
1410
|
+
sn as createSecurityHeaders,
|
|
1411
|
+
mr as createSecurityReportHandler,
|
|
1412
|
+
cn as cspHash,
|
|
1413
|
+
un as cspNonce,
|
|
1414
|
+
Kn as defaultFontPath,
|
|
1415
|
+
Pr as defineAdapter,
|
|
1416
|
+
fr as defineEnvSchema,
|
|
1417
|
+
Jn as defineFonts,
|
|
1418
|
+
Yn as defineImages,
|
|
1419
|
+
Sr as defineInstrumentation,
|
|
1420
|
+
Dr as defineLinks,
|
|
1421
|
+
ln as defineMetadata,
|
|
1422
|
+
sr as defineMiddleware,
|
|
1423
|
+
tr as defineOgImage,
|
|
1424
|
+
er as defineRobots,
|
|
1425
|
+
fn as defineRoutePolicy,
|
|
1426
|
+
Or as defineScripts,
|
|
1427
|
+
dn as defineSecurityPolicy,
|
|
1428
|
+
Xt as defineSitemap,
|
|
1429
|
+
hn as defineTags,
|
|
1430
|
+
Er as defineWebVitals,
|
|
1431
|
+
mn as enforceAllowedMethods,
|
|
1432
|
+
pn as enforceCsrfProtection,
|
|
1433
|
+
gn as enforceFetchMetadataPolicy,
|
|
1434
|
+
wn as enforceRateLimit,
|
|
1435
|
+
yn as enforceRequestSecurity,
|
|
1436
|
+
gr as enforceWebSocketOrigin,
|
|
1437
|
+
hr as env,
|
|
1438
|
+
Zn as font,
|
|
1439
|
+
Xn as fontAssetFileName,
|
|
1440
|
+
Qn as fontAssetUrl,
|
|
1441
|
+
eo as fontLinks,
|
|
1442
|
+
to as fontMediaType,
|
|
1443
|
+
ro as fontPreloadLinks,
|
|
1444
|
+
no as fontSources,
|
|
1445
|
+
oo as fontStylesheetUrl,
|
|
1446
|
+
Mr as getScriptWorker,
|
|
1447
|
+
vn as handleRequestWithManifest,
|
|
1448
|
+
pe as href,
|
|
1449
|
+
bn as html,
|
|
1450
|
+
Re as httpError,
|
|
1451
|
+
wr as hydrateFileRouter,
|
|
1452
|
+
ao as isAllowedImageSource,
|
|
1453
|
+
Sn as isCacheNotFoundError,
|
|
1454
|
+
ke as isHttpError,
|
|
1455
|
+
En as issueCsrfToken,
|
|
1456
|
+
Rn as json,
|
|
1457
|
+
Tn as jsonl,
|
|
1458
|
+
kn as link,
|
|
1459
|
+
An as mergeRoutePolicies,
|
|
1460
|
+
$n as mergeRouteSecurityPolicies,
|
|
1461
|
+
xn as mergeSecurityPolicies,
|
|
1462
|
+
Cn as meta,
|
|
1463
|
+
Fr as modulePreload,
|
|
1464
|
+
In as notFound,
|
|
1465
|
+
ir as page,
|
|
1466
|
+
D as parseBodySize,
|
|
1467
|
+
B as parseCacheDuration,
|
|
1468
|
+
de as parseCookieHeader,
|
|
1469
|
+
io as parseImageOptimizerRequest,
|
|
1470
|
+
Nn as parseRateLimitWindow,
|
|
1471
|
+
Lt as parseWebVitalsBeacon,
|
|
1472
|
+
Ae as planImageTransform,
|
|
1473
|
+
zr as preconnect,
|
|
1474
|
+
Ur as preload,
|
|
1475
|
+
Ln as query,
|
|
1476
|
+
ur as readSecureCookie,
|
|
1477
|
+
Tr as readWebVitalsBeacon,
|
|
1478
|
+
Pn as redirect,
|
|
1479
|
+
so as renderFontFaceCss,
|
|
1480
|
+
nr as renderOgImageResponse,
|
|
1481
|
+
Ne as renderOgImageSvg,
|
|
1482
|
+
Br as renderPageResponse,
|
|
1483
|
+
rr as renderRobots,
|
|
1484
|
+
Qt as renderSitemap,
|
|
1485
|
+
_r as resolveLinks,
|
|
1486
|
+
Dn as resolveMetadata,
|
|
1487
|
+
jr as resolveScripts,
|
|
1488
|
+
le as response,
|
|
1489
|
+
Zt as runIdempotentMutation,
|
|
1490
|
+
I as script,
|
|
1491
|
+
O as secureCookieName,
|
|
1492
|
+
On as security,
|
|
1493
|
+
_t as sendWebVitalsBeacon,
|
|
1494
|
+
ue as serializeCacheKey,
|
|
1495
|
+
Mn as serializeCacheNamespace,
|
|
1496
|
+
Fn as serializeCacheTag,
|
|
1497
|
+
zn as serverTiming,
|
|
1498
|
+
Un as sse,
|
|
1499
|
+
U as startDeferredScripts,
|
|
1500
|
+
Bn as stream,
|
|
1501
|
+
_n as structuredData,
|
|
1502
|
+
jn as tag,
|
|
1503
|
+
Hn as text,
|
|
1504
|
+
fe as toResponse,
|
|
1505
|
+
Vn as validateCorsPolicy,
|
|
1506
|
+
dr as validateEnv,
|
|
1507
|
+
Wn as validateRateLimitPolicy,
|
|
1508
|
+
qn as validateRouteModules,
|
|
1509
|
+
je as validateSecureCookie,
|
|
1510
|
+
pr as validateUploads,
|
|
1511
|
+
Nt as webVitalRating,
|
|
1512
|
+
Rr as webVitalsPolicy,
|
|
1513
|
+
cr as webhook
|
|
1178
1514
|
};
|
|
1179
1515
|
//# sourceMappingURL=index.js.map
|