@qwik.dev/router 2.0.0-alpha.9 → 2.0.0-beta.10
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 +1 -1
- package/adapters/static/vite.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/azure-swa/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/azure-swa/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/azure-swa/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/azure-swa/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/azure-swa/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/azure-swa/vite/index.cjs +5 -96
- package/lib/adapters/azure-swa/vite/index.d.ts +13 -13
- package/lib/adapters/azure-swa/vite/index.mjs +201 -26
- package/lib/adapters/bun-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/bun-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/bun-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/bun-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/bun-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/bun-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/bun-server/vite/index.cjs +5 -50
- package/lib/adapters/bun-server/vite/index.d.ts +14 -14
- package/lib/adapters/bun-server/vite/index.mjs +196 -12
- package/lib/adapters/cloud-run/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/cloud-run/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/cloud-run/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/cloud-run/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/cloud-run/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/cloud-run/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/cloud-run/vite/index.cjs +5 -47
- package/lib/adapters/cloud-run/vite/index.d.ts +13 -13
- package/lib/adapters/cloud-run/vite/index.mjs +195 -11
- package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +5 -0
- package/lib/adapters/cloudflare-pages/vite/index-C455V8_A.cjs +1 -0
- package/lib/adapters/cloudflare-pages/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/cloudflare-pages/vite/index-D3HITboM.js +645 -0
- package/lib/adapters/cloudflare-pages/vite/index-DKcVHRBy.cjs +11 -0
- package/lib/adapters/cloudflare-pages/vite/index-DwovcBp3.js +22 -0
- package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +250 -0
- package/lib/adapters/cloudflare-pages/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -115
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +27 -27
- package/lib/adapters/cloudflare-pages/vite/index.mjs +4 -78
- package/lib/adapters/deno-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/deno-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/deno-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/deno-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/deno-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/deno-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/deno-server/vite/index.cjs +5 -62
- package/lib/adapters/deno-server/vite/index.d.ts +14 -14
- package/lib/adapters/deno-server/vite/index.mjs +198 -14
- package/lib/adapters/netlify-edge/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/netlify-edge/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/netlify-edge/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/netlify-edge/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/netlify-edge/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/netlify-edge/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/netlify-edge/vite/index.cjs +6 -129
- package/lib/adapters/netlify-edge/vite/index.d.ts +44 -44
- package/lib/adapters/netlify-edge/vite/index.mjs +240 -60
- package/lib/adapters/node-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/node-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/node-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/node-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/node-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/node-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/node-server/vite/index.cjs +5 -50
- package/lib/adapters/node-server/vite/index.d.ts +14 -14
- package/lib/adapters/node-server/vite/index.mjs +196 -12
- package/lib/adapters/shared/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/shared/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/shared/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/shared/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/shared/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/shared/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/shared/vite/index.cjs +5 -371
- package/lib/adapters/shared/vite/index.d.ts +108 -114
- package/lib/adapters/shared/vite/index.mjs +158 -288
- package/lib/adapters/ssg/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/ssg/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/ssg/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/ssg/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/ssg/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/ssg/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/ssg/vite/index.cjs +5 -0
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +201 -0
- package/lib/adapters/vercel-edge/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/vercel-edge/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/vercel-edge/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/vercel-edge/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/vercel-edge/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/vercel-edge/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/vercel-edge/vite/index.cjs +5 -118
- package/lib/adapters/vercel-edge/vite/index.d.ts +45 -45
- package/lib/adapters/vercel-edge/vite/index.mjs +230 -51
- package/lib/index.d.ts +1000 -810
- package/lib/index.qwik.cjs +438 -203
- package/lib/index.qwik.mjs +440 -205
- package/lib/middleware/aws-lambda/index.cjs +1 -0
- package/lib/middleware/aws-lambda/index.d.ts +49 -48
- package/lib/middleware/aws-lambda/index.mjs +27 -41
- package/lib/middleware/azure-swa/index.cjs +1 -0
- package/lib/middleware/azure-swa/index.d.ts +28 -28
- package/lib/middleware/azure-swa/index.mjs +46 -269
- package/lib/middleware/bun/index.cjs +1 -0
- package/lib/middleware/bun/index.d.ts +35 -35
- package/lib/middleware/bun/index.mjs +68 -120
- package/lib/middleware/cloudflare-pages/index.cjs +1 -0
- package/lib/middleware/cloudflare-pages/index.d.ts +35 -35
- package/lib/middleware/cloudflare-pages/index.mjs +48 -80
- package/lib/middleware/deno/index.cjs +1 -0
- package/lib/middleware/deno/index.d.ts +47 -47
- package/lib/middleware/deno/index.mjs +63 -110
- package/lib/middleware/firebase/index.cjs +1 -0
- package/lib/middleware/firebase/index.d.ts +26 -26
- package/lib/middleware/firebase/index.mjs +16 -28
- package/lib/middleware/netlify-edge/index.cjs +1 -0
- package/lib/middleware/netlify-edge/index.d.ts +27 -27
- package/lib/middleware/netlify-edge/index.mjs +36 -64
- package/lib/middleware/node/index.cjs +1 -314
- package/lib/middleware/node/index.d.ts +64 -64
- package/lib/middleware/node/index.mjs +116 -198
- package/lib/middleware/request-handler/index.cjs +11 -1538
- package/lib/middleware/request-handler/index.d.ts +711 -676
- package/lib/middleware/request-handler/index.mjs +895 -1281
- package/lib/middleware/vercel-edge/index.cjs +1 -0
- package/lib/middleware/vercel-edge/index.d.ts +26 -26
- package/lib/middleware/vercel-edge/index.mjs +47 -82
- package/lib/modules.d.ts +4 -12
- package/lib/service-worker.cjs +1 -267
- package/lib/service-worker.d.ts +15 -4
- package/lib/service-worker.mjs +3 -263
- package/lib/ssg/deno.cjs +1 -0
- package/lib/ssg/deno.mjs +6 -0
- package/lib/ssg/index-CBIchDYq.js +651 -0
- package/lib/ssg/index-ClHGw5z1.js +6 -0
- package/lib/ssg/index-DTIOTwZo.cjs +11 -0
- package/lib/ssg/index-vQuPcef3.cjs +1 -0
- package/lib/ssg/index.cjs +1 -0
- package/lib/{static → ssg}/index.d.ts +96 -96
- package/lib/ssg/index.mjs +22 -0
- package/lib/ssg/node.cjs +11 -0
- package/lib/ssg/node.mjs +651 -0
- package/lib/vite/index.cjs +29 -27484
- package/lib/vite/index.d.ts +170 -154
- package/lib/vite/index.mjs +1422 -27288
- package/modules.d.ts +4 -12
- package/package.json +51 -40
- package/ssg.d.ts +2 -0
- package/static.d.ts +1 -1
- package/lib/adapters/static/vite/index.cjs +0 -361
- package/lib/adapters/static/vite/index.d.ts +0 -10
- package/lib/adapters/static/vite/index.mjs +0 -324
- package/lib/static/deno.mjs +0 -8
- package/lib/static/index.cjs +0 -67
- package/lib/static/index.mjs +0 -48
- package/lib/static/node.cjs +0 -1124
- package/lib/static/node.mjs +0 -1086
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
|
@@ -1,1502 +1,1116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { _serialize as D, _UNINITIALIZED as ye, _deserialize as ee, _verifySerializable as Se } from "@qwik.dev/core/internal";
|
|
2
|
+
import "@qwik.dev/core";
|
|
3
|
+
import { ServerError as F, RedirectMessage as H, RewriteMessage as we, AbortMessage as pe } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
+
const ne = /* @__PURE__ */ new WeakMap(), te = "qaction", v = "qloaders", Qe = "qfunc", re = "qdata", je = "q:route";
|
|
5
|
+
function Ee(e, t) {
|
|
6
|
+
const n = ae(e), r = ie(e), o = ae(t), i = ie(t);
|
|
7
|
+
return Re(e, n, r, t, o, i);
|
|
8
|
+
}
|
|
9
|
+
function Re(e, t, n, r, o, i) {
|
|
10
|
+
if (r.startsWith("/build/"))
|
|
11
|
+
return null;
|
|
12
|
+
let a = null;
|
|
13
|
+
for (; t < n; ) {
|
|
14
|
+
const s = e.charCodeAt(t++), c = r.charCodeAt(o++);
|
|
15
|
+
if (s === 91) {
|
|
16
|
+
const f = be(e, t), l = t + (f ? 3 : 0), u = B(
|
|
17
|
+
e,
|
|
18
|
+
l,
|
|
19
|
+
n,
|
|
20
|
+
93
|
|
21
|
+
/* CLOSE_BRACKET */
|
|
22
|
+
), h = e.substring(l, u), y = B(
|
|
23
|
+
e,
|
|
24
|
+
u + 1,
|
|
25
|
+
n,
|
|
26
|
+
47
|
|
27
|
+
/* SLASH */
|
|
28
|
+
), w = e.substring(u + 1, y);
|
|
29
|
+
t = u + 1;
|
|
30
|
+
const R = o - 1;
|
|
31
|
+
if (f) {
|
|
32
|
+
const M = ze(
|
|
33
|
+
h,
|
|
34
|
+
w,
|
|
35
|
+
r,
|
|
36
|
+
R,
|
|
37
|
+
i,
|
|
38
|
+
e,
|
|
39
|
+
t + w.length + 1,
|
|
40
|
+
n
|
|
41
|
+
);
|
|
42
|
+
if (M)
|
|
43
|
+
return Object.assign(a || (a = {}), M);
|
|
44
|
+
}
|
|
45
|
+
const p = B(r, R, i, 47, w);
|
|
46
|
+
if (p == -1)
|
|
47
|
+
return null;
|
|
48
|
+
const T = r.substring(R, p);
|
|
49
|
+
if (!f && !w && !T)
|
|
50
|
+
return null;
|
|
51
|
+
o = p, (a || (a = {}))[h] = decodeURIComponent(T);
|
|
52
|
+
} else if (s !== c && !(isNaN(c) && Ge(e, t)))
|
|
53
|
+
return null;
|
|
7
54
|
}
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
55
|
+
return oe(e, t) && oe(r, o) ? a || {} : null;
|
|
56
|
+
}
|
|
57
|
+
function Ge(e, t) {
|
|
58
|
+
return e.charCodeAt(t) === 91 && be(e, t + 1);
|
|
59
|
+
}
|
|
60
|
+
function ie(e) {
|
|
61
|
+
const t = e.length;
|
|
62
|
+
return t > 1 && e.charCodeAt(t - 1) === 47 ? t - 1 : t;
|
|
63
|
+
}
|
|
64
|
+
function oe(e, t) {
|
|
65
|
+
const n = e.length;
|
|
66
|
+
return t >= n || t == n - 1 && e.charCodeAt(t) === 47;
|
|
67
|
+
}
|
|
68
|
+
function ae(e) {
|
|
69
|
+
return e.charCodeAt(0) === 47 ? 1 : 0;
|
|
70
|
+
}
|
|
71
|
+
function be(e, t) {
|
|
72
|
+
return e.charCodeAt(t) === 46 && e.charCodeAt(t + 1) === 46 && e.charCodeAt(t + 2) === 46;
|
|
73
|
+
}
|
|
74
|
+
function B(e, t, n, r, o = "") {
|
|
75
|
+
for (; t < n && e.charCodeAt(t) !== r; )
|
|
76
|
+
t++;
|
|
77
|
+
const i = o.length;
|
|
78
|
+
for (let a = 0; a < i; a++)
|
|
79
|
+
if (e.charCodeAt(t - i + a) !== o.charCodeAt(a))
|
|
80
|
+
return -1;
|
|
81
|
+
return t - i;
|
|
82
|
+
}
|
|
83
|
+
function ze(e, t, n, r, o, i, a, s) {
|
|
84
|
+
n.charCodeAt(r) === 47 && r++;
|
|
85
|
+
let c = o;
|
|
86
|
+
const f = t + "/";
|
|
87
|
+
for (; c >= r; ) {
|
|
88
|
+
const l = Re(i, a, s, n, c, o);
|
|
89
|
+
if (l) {
|
|
90
|
+
let h = n.substring(r, Math.min(c, o));
|
|
91
|
+
return h.endsWith(f) && (h = h.substring(0, h.length - f.length)), l[e] = decodeURIComponent(h), l;
|
|
16
92
|
}
|
|
93
|
+
const u = Be(n, r, f, c, r - 1) + f.length;
|
|
94
|
+
if (c === u)
|
|
95
|
+
break;
|
|
96
|
+
c = u;
|
|
17
97
|
}
|
|
18
|
-
return
|
|
98
|
+
return null;
|
|
19
99
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (typeof message === "string") {
|
|
25
|
-
message = escapeHtml(message);
|
|
26
|
-
} else {
|
|
27
|
-
message = "";
|
|
28
|
-
}
|
|
29
|
-
const width = typeof message === "string" ? "600px" : "300px";
|
|
30
|
-
const color = status >= 500 ? COLOR_500 : COLOR_400;
|
|
31
|
-
return `
|
|
32
|
-
<head>
|
|
33
|
-
<meta charset="utf-8">
|
|
34
|
-
<meta http-equiv="Status" content="${status}">
|
|
35
|
-
<title>${status} ${message}</title>
|
|
36
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
37
|
-
<style>
|
|
38
|
-
body { color: ${color}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
|
|
39
|
-
p { max-width: ${width}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${color}; overflow: hidden; }
|
|
40
|
-
strong { display: inline-block; padding: 15px; background: ${color}; color: white; }
|
|
41
|
-
span { display: inline-block; padding: 15px; }
|
|
42
|
-
</style>
|
|
43
|
-
</head>
|
|
44
|
-
<body><p><strong>${status}</strong> <span>${message}</span></p></body>
|
|
45
|
-
`;
|
|
100
|
+
function Be(e, t, n, r, o) {
|
|
101
|
+
let i = e.lastIndexOf(n, r);
|
|
102
|
+
return i == r - n.length && (i = e.lastIndexOf(n, r - n.length - 1)), i > t ? i : o;
|
|
46
103
|
}
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
104
|
+
var k = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Loaders = 1] = "Loaders", e[e.OriginalPathname = 2] = "OriginalPathname", e[e.RouteBundleNames = 3] = "RouteBundleNames", e))(k || {}), $ = /* @__PURE__ */ ((e) => (e[e.Pathname = 0] = "Pathname", e[e.MenuLoader = 1] = "MenuLoader", e))($ || {}), L = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Params = 1] = "Params", e[e.Mods = 2] = "Mods", e[e.Menu = 3] = "Menu", e[e.RouteBundleNames = 4] = "RouteBundleNames", e))(L || {});
|
|
105
|
+
const Ae = (e) => e == null ? e : (Object.getOwnPropertyNames(e).forEach((t) => {
|
|
106
|
+
const n = e[t];
|
|
107
|
+
n && typeof n == "object" && !Object.isFrozen(n) && Ae(n);
|
|
108
|
+
}), Object.freeze(e)), Ke = async (e, t, n, r) => {
|
|
109
|
+
if (!Array.isArray(e))
|
|
110
|
+
return null;
|
|
111
|
+
for (const o of e) {
|
|
112
|
+
const i = o[k.RouteName], a = Ee(i, r);
|
|
113
|
+
if (!a)
|
|
114
|
+
continue;
|
|
115
|
+
const s = o[k.Loaders], c = o[k.RouteBundleNames], f = new Array(s.length), l = [];
|
|
116
|
+
s.forEach((y, w) => {
|
|
117
|
+
se(
|
|
118
|
+
y,
|
|
119
|
+
l,
|
|
120
|
+
(R) => f[w] = R,
|
|
121
|
+
n
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
const u = Je(t, r);
|
|
125
|
+
let h;
|
|
126
|
+
return se(
|
|
127
|
+
u,
|
|
128
|
+
l,
|
|
129
|
+
(y) => h = y?.default,
|
|
130
|
+
n
|
|
131
|
+
), l.length > 0 && await Promise.all(l), [i, a, f, Ae(h), c];
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}, se = (e, t, n, r) => {
|
|
135
|
+
if (typeof e == "function") {
|
|
136
|
+
const o = ne.get(e);
|
|
137
|
+
if (o)
|
|
138
|
+
n(o);
|
|
139
|
+
else {
|
|
140
|
+
const i = e();
|
|
141
|
+
typeof i.then == "function" ? t.push(
|
|
142
|
+
i.then((a) => {
|
|
143
|
+
r !== !1 && ne.set(e, a), n(a);
|
|
144
|
+
})
|
|
145
|
+
) : i && n(i);
|
|
59
146
|
}
|
|
60
|
-
}
|
|
147
|
+
}
|
|
148
|
+
}, Je = (e, t) => {
|
|
149
|
+
if (e) {
|
|
150
|
+
t = t.endsWith("/") ? t : t + "/";
|
|
151
|
+
const n = e.find(
|
|
152
|
+
(r) => r[$.Pathname] === t || t.startsWith(r[$.Pathname] + (t.endsWith("/") ? "" : "/"))
|
|
153
|
+
);
|
|
154
|
+
if (n)
|
|
155
|
+
return n[$.MenuLoader];
|
|
156
|
+
}
|
|
61
157
|
};
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
158
|
+
var V = /* @__PURE__ */ ((e) => (e[e.Continue = 100] = "Continue", e[e.SwitchingProtocols = 101] = "SwitchingProtocols", e[e.Processing = 102] = "Processing", e[e.Ok = 200] = "Ok", e[e.Created = 201] = "Created", e[e.Accepted = 202] = "Accepted", e[e.NonAuthoritativeInformation = 203] = "NonAuthoritativeInformation", e[e.NoContent = 204] = "NoContent", e[e.ResetContent = 205] = "ResetContent", e[e.PartialContent = 206] = "PartialContent", e[e.MultiStatus = 207] = "MultiStatus", e[e.AlreadyReported = 208] = "AlreadyReported", e[e.ImUsed = 226] = "ImUsed", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.Found = 302] = "Found", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.SwitchProxy = 306] = "SwitchProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.LengthRequired = 411] = "LengthRequired", e[e.PreconditionFailed = 412] = "PreconditionFailed", e[e.PayloadTooLarge = 413] = "PayloadTooLarge", e[e.UriTooLong = 414] = "UriTooLong", e[e.UnsupportedMediaType = 415] = "UnsupportedMediaType", e[e.RangeNotSatisfiable = 416] = "RangeNotSatisfiable", e[e.ExpectationFailed = 417] = "ExpectationFailed", e[e.IAmATeapot = 418] = "IAmATeapot", e[e.MisdirectedRequest = 421] = "MisdirectedRequest", e[e.UnprocessableEntity = 422] = "UnprocessableEntity", e[e.Locked = 423] = "Locked", e[e.FailedDependency = 424] = "FailedDependency", e[e.UpgradeRequired = 426] = "UpgradeRequired", e[e.PreconditionRequired = 428] = "PreconditionRequired", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.RequestHeaderFieldsTooLarge = 431] = "RequestHeaderFieldsTooLarge", e[e.UnavailableForLegalReasons = 451] = "UnavailableForLegalReasons", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout", e[e.HttpVersionNotSupported = 505] = "HttpVersionNotSupported", e[e.VariantAlsoNegotiates = 506] = "VariantAlsoNegotiates", e[e.InsufficientStorage = 507] = "InsufficientStorage", e[e.LoopDetected = 508] = "LoopDetected", e[e.NotExtended = 510] = "NotExtended", e[e.NetworkAuthenticationRequired = 511] = "NetworkAuthenticationRequired", e))(V || {});
|
|
159
|
+
const Ye = (e) => e && typeof e.then == "function";
|
|
160
|
+
function ve(e) {
|
|
161
|
+
const t = [];
|
|
162
|
+
return e === "day" ? e = 3600 * 24 : e === "week" ? e = 3600 * 24 * 7 : e === "month" ? e = 3600 * 24 * 30 : e === "year" ? e = 3600 * 24 * 365 : e === "private" ? e = {
|
|
163
|
+
private: !0,
|
|
164
|
+
noCache: !0
|
|
165
|
+
} : e === "immutable" ? e = {
|
|
166
|
+
public: !0,
|
|
167
|
+
immutable: !0,
|
|
168
|
+
maxAge: 3600 * 24 * 365
|
|
169
|
+
} : e === "no-cache" && (e = {
|
|
170
|
+
noCache: !0
|
|
171
|
+
}), typeof e == "number" && (e = {
|
|
172
|
+
maxAge: e,
|
|
173
|
+
sMaxAge: e
|
|
174
|
+
}), e.immutable && t.push("immutable"), e.maxAge && t.push(`max-age=${e.maxAge}`), e.sMaxAge && t.push(`s-maxage=${e.sMaxAge}`), e.noStore && t.push("no-store"), e.noCache && t.push("no-cache"), e.private && t.push("private"), e.public && t.push("public"), e.staleWhileRevalidate && t.push(`stale-while-revalidate=${e.staleWhileRevalidate}`), e.staleIfError && t.push(`stale-if-error=${e.staleIfError}`), t.join(", ");
|
|
175
|
+
}
|
|
176
|
+
const Ve = {
|
|
67
177
|
lax: "Lax",
|
|
68
178
|
Lax: "Lax",
|
|
69
179
|
None: "None",
|
|
70
180
|
none: "None",
|
|
71
181
|
strict: "Strict",
|
|
72
182
|
Strict: "Strict"
|
|
73
|
-
}
|
|
74
|
-
var UNIT = {
|
|
183
|
+
}, Xe = {
|
|
75
184
|
seconds: 1,
|
|
76
|
-
minutes:
|
|
77
|
-
hours:
|
|
78
|
-
days:
|
|
79
|
-
weeks:
|
|
185
|
+
minutes: 60,
|
|
186
|
+
hours: 3600,
|
|
187
|
+
days: 3600 * 24,
|
|
188
|
+
weeks: 3600 * 24 * 7
|
|
189
|
+
}, ce = (e, t, n) => {
|
|
190
|
+
const r = [`${e}=${t}`];
|
|
191
|
+
typeof n.domain == "string" && r.push(`Domain=${n.domain}`), typeof n.maxAge == "number" ? r.push(`Max-Age=${n.maxAge}`) : Array.isArray(n.maxAge) ? r.push(`Max-Age=${n.maxAge[0] * Xe[n.maxAge[1]]}`) : typeof n.expires == "number" || typeof n.expires == "string" ? r.push(`Expires=${n.expires}`) : n.expires instanceof Date && r.push(`Expires=${n.expires.toUTCString()}`), n.httpOnly && r.push("HttpOnly"), typeof n.path == "string" && r.push(`Path=${n.path}`);
|
|
192
|
+
const o = He(n.sameSite);
|
|
193
|
+
return o && r.push(`SameSite=${o}`), n.secure && r.push("Secure"), r.join("; ");
|
|
80
194
|
};
|
|
81
|
-
|
|
82
|
-
const c = [`${cookieName}=${cookieValue}`];
|
|
83
|
-
if (typeof options.domain === "string") {
|
|
84
|
-
c.push(`Domain=${options.domain}`);
|
|
85
|
-
}
|
|
86
|
-
if (typeof options.maxAge === "number") {
|
|
87
|
-
c.push(`Max-Age=${options.maxAge}`);
|
|
88
|
-
} else if (Array.isArray(options.maxAge)) {
|
|
89
|
-
c.push(`Max-Age=${options.maxAge[0] * UNIT[options.maxAge[1]]}`);
|
|
90
|
-
} else if (typeof options.expires === "number" || typeof options.expires == "string") {
|
|
91
|
-
c.push(`Expires=${options.expires}`);
|
|
92
|
-
} else if (options.expires instanceof Date) {
|
|
93
|
-
c.push(`Expires=${options.expires.toUTCString()}`);
|
|
94
|
-
}
|
|
95
|
-
if (options.httpOnly) {
|
|
96
|
-
c.push("HttpOnly");
|
|
97
|
-
}
|
|
98
|
-
if (typeof options.path === "string") {
|
|
99
|
-
c.push(`Path=${options.path}`);
|
|
100
|
-
}
|
|
101
|
-
const sameSite = resolveSameSite(options.sameSite);
|
|
102
|
-
if (sameSite) {
|
|
103
|
-
c.push(`SameSite=${sameSite}`);
|
|
104
|
-
}
|
|
105
|
-
if (options.secure) {
|
|
106
|
-
c.push("Secure");
|
|
107
|
-
}
|
|
108
|
-
return c.join("; ");
|
|
109
|
-
};
|
|
110
|
-
function tryDecodeUriComponent(str) {
|
|
195
|
+
function le(e) {
|
|
111
196
|
try {
|
|
112
|
-
return decodeURIComponent(
|
|
197
|
+
return decodeURIComponent(e);
|
|
113
198
|
} catch {
|
|
114
|
-
return
|
|
199
|
+
return e;
|
|
115
200
|
}
|
|
116
201
|
}
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
if (typeof
|
|
120
|
-
const
|
|
121
|
-
for (const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
cookie[tryDecodeUriComponent(cookieSegment.slice(0, separatorIndex).trim())] = tryDecodeUriComponent(cookieSegment.slice(separatorIndex + 1).trim());
|
|
125
|
-
}
|
|
202
|
+
const Ze = (e) => {
|
|
203
|
+
const t = {};
|
|
204
|
+
if (typeof e == "string" && e !== "") {
|
|
205
|
+
const n = e.split(";");
|
|
206
|
+
for (const r of n) {
|
|
207
|
+
const o = r.indexOf("=");
|
|
208
|
+
o !== -1 && (t[le(r.slice(0, o).trim())] = le(r.slice(o + 1).trim()));
|
|
126
209
|
}
|
|
127
210
|
}
|
|
128
|
-
return
|
|
211
|
+
return t;
|
|
129
212
|
};
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
213
|
+
function He(e) {
|
|
214
|
+
if (e === !0)
|
|
132
215
|
return "Strict";
|
|
133
|
-
|
|
134
|
-
if (sameSite === false) {
|
|
216
|
+
if (e === !1)
|
|
135
217
|
return "None";
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return SAMESITE[sameSite];
|
|
139
|
-
}
|
|
140
|
-
return void 0;
|
|
218
|
+
if (e)
|
|
219
|
+
return Ve[e];
|
|
141
220
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
[
|
|
147
|
-
[RES_COOKIE] = {};
|
|
148
|
-
[LIVE_COOKIE] = {};
|
|
221
|
+
const x = Symbol("request-cookies"), q = Symbol("response-cookies"), _ = Symbol("live-cookies");
|
|
222
|
+
class en {
|
|
223
|
+
[x];
|
|
224
|
+
[q] = {};
|
|
225
|
+
[_] = {};
|
|
149
226
|
appendCounter = 0;
|
|
150
|
-
constructor(
|
|
151
|
-
this[
|
|
152
|
-
this[LIVE_COOKIE] = { ...this[REQ_COOKIE] };
|
|
227
|
+
constructor(t) {
|
|
228
|
+
this[x] = Ze(t), this[_] = { ...this[x] };
|
|
153
229
|
}
|
|
154
|
-
get(
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
value,
|
|
230
|
+
get(t, n = !0) {
|
|
231
|
+
const r = this[n ? _ : x][t];
|
|
232
|
+
return r ? {
|
|
233
|
+
value: r,
|
|
161
234
|
json() {
|
|
162
|
-
return JSON.parse(
|
|
235
|
+
return JSON.parse(r);
|
|
163
236
|
},
|
|
164
237
|
number() {
|
|
165
|
-
return Number(
|
|
238
|
+
return Number(r);
|
|
166
239
|
}
|
|
167
|
-
};
|
|
240
|
+
} : null;
|
|
168
241
|
}
|
|
169
|
-
getAll(
|
|
170
|
-
return Object.keys(this[
|
|
171
|
-
(
|
|
172
|
-
cookies[cookieName] = this.get(cookieName);
|
|
173
|
-
return cookies;
|
|
174
|
-
},
|
|
242
|
+
getAll(t = !0) {
|
|
243
|
+
return Object.keys(this[t ? _ : x]).reduce(
|
|
244
|
+
(n, r) => (n[r] = this.get(r), n),
|
|
175
245
|
{}
|
|
176
246
|
);
|
|
177
247
|
}
|
|
178
|
-
has(
|
|
179
|
-
return !!this[
|
|
180
|
-
}
|
|
181
|
-
set(
|
|
182
|
-
this[
|
|
183
|
-
const
|
|
184
|
-
this[
|
|
185
|
-
}
|
|
186
|
-
append(
|
|
187
|
-
this[
|
|
188
|
-
const
|
|
189
|
-
this[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
248
|
+
has(t, n = !0) {
|
|
249
|
+
return !!this[n ? _ : x][t];
|
|
250
|
+
}
|
|
251
|
+
set(t, n, r = {}) {
|
|
252
|
+
this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
|
|
253
|
+
const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
|
|
254
|
+
this[q][t] = ce(t, o, r);
|
|
255
|
+
}
|
|
256
|
+
append(t, n, r = {}) {
|
|
257
|
+
this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
|
|
258
|
+
const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
|
|
259
|
+
this[q][++this.appendCounter] = ce(
|
|
260
|
+
t,
|
|
261
|
+
o,
|
|
262
|
+
r
|
|
193
263
|
);
|
|
194
264
|
}
|
|
195
|
-
delete(
|
|
196
|
-
this.set(
|
|
197
|
-
this[LIVE_COOKIE][name] = null;
|
|
265
|
+
delete(t, n) {
|
|
266
|
+
this.set(t, "deleted", { ...n, maxAge: 0 }), this[_][t] = null;
|
|
198
267
|
}
|
|
199
268
|
headers() {
|
|
200
|
-
return Object.values(this[
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
var mergeHeadersCookies = (headers, cookies) => {
|
|
204
|
-
const cookieHeaders = cookies.headers();
|
|
205
|
-
if (cookieHeaders.length > 0) {
|
|
206
|
-
const newHeaders = new Headers(headers);
|
|
207
|
-
for (const cookie of cookieHeaders) {
|
|
208
|
-
newHeaders.append("Set-Cookie", cookie);
|
|
209
|
-
}
|
|
210
|
-
return newHeaders;
|
|
269
|
+
return Object.values(this[q]);
|
|
211
270
|
}
|
|
212
|
-
return headers;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// packages/qwik-router/src/middleware/request-handler/redirect-handler.ts
|
|
216
|
-
var AbortMessage = class {
|
|
217
|
-
};
|
|
218
|
-
var RedirectMessage = class extends AbortMessage {
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// packages/qwik-router/src/runtime/src/constants.ts
|
|
222
|
-
var MODULE_CACHE = /* @__PURE__ */ new WeakMap();
|
|
223
|
-
var QACTION_KEY = "qaction";
|
|
224
|
-
var QFN_KEY = "qfunc";
|
|
225
|
-
var QDATA_KEY = "qdata";
|
|
226
|
-
|
|
227
|
-
// packages/qwik-router/src/runtime/src/route-matcher.ts
|
|
228
|
-
function matchRoute(route, path) {
|
|
229
|
-
const routeIdx = startIdxSkipSlash(route);
|
|
230
|
-
const routeLength = lengthNoTrailingSlash(route);
|
|
231
|
-
const pathIdx = startIdxSkipSlash(path);
|
|
232
|
-
const pathLength = lengthNoTrailingSlash(path);
|
|
233
|
-
return matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength);
|
|
234
271
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const paramName = route.substring(paramNameStart, paramNameEnd);
|
|
245
|
-
const paramSuffixEnd = scan(route, paramNameEnd + 1, routeLength, 47 /* SLASH */);
|
|
246
|
-
const suffix = route.substring(paramNameEnd + 1, paramSuffixEnd);
|
|
247
|
-
routeIdx = paramNameEnd + 1;
|
|
248
|
-
const paramValueStart = pathIdx - 1;
|
|
249
|
-
if (isMany) {
|
|
250
|
-
const match = recursiveScan(
|
|
251
|
-
paramName,
|
|
252
|
-
suffix,
|
|
253
|
-
path,
|
|
254
|
-
paramValueStart,
|
|
255
|
-
pathLength,
|
|
256
|
-
route,
|
|
257
|
-
routeIdx + suffix.length + 1,
|
|
258
|
-
routeLength
|
|
259
|
-
);
|
|
260
|
-
if (match) {
|
|
261
|
-
return Object.assign(params || (params = {}), match);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
const paramValueEnd = scan(path, paramValueStart, pathLength, 47 /* SLASH */, suffix);
|
|
265
|
-
if (paramValueEnd == -1) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
const paramValue = path.substring(paramValueStart, paramValueEnd);
|
|
269
|
-
if (!isMany && !suffix && !paramValue) {
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
pathIdx = paramValueEnd;
|
|
273
|
-
(params || (params = {}))[paramName] = decodeURIComponent(paramValue);
|
|
274
|
-
} else if (routeCh !== pathCh) {
|
|
275
|
-
if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
if (allConsumed(route, routeIdx) && allConsumed(path, pathIdx)) {
|
|
281
|
-
return params || {};
|
|
282
|
-
} else {
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
function isRestParameter(text, idx) {
|
|
287
|
-
return text.charCodeAt(idx) === 91 /* OPEN_BRACKET */ && isThreeDots(text, idx + 1);
|
|
288
|
-
}
|
|
289
|
-
function lengthNoTrailingSlash(text) {
|
|
290
|
-
const length = text.length;
|
|
291
|
-
return length > 1 && text.charCodeAt(length - 1) === 47 /* SLASH */ ? length - 1 : length;
|
|
292
|
-
}
|
|
293
|
-
function allConsumed(text, idx) {
|
|
294
|
-
const length = text.length;
|
|
295
|
-
return idx >= length || idx == length - 1 && text.charCodeAt(idx) === 47 /* SLASH */;
|
|
296
|
-
}
|
|
297
|
-
function startIdxSkipSlash(text) {
|
|
298
|
-
return text.charCodeAt(0) === 47 /* SLASH */ ? 1 : 0;
|
|
299
|
-
}
|
|
300
|
-
function isThreeDots(text, idx) {
|
|
301
|
-
return text.charCodeAt(idx) === 46 /* DOT */ && text.charCodeAt(idx + 1) === 46 /* DOT */ && text.charCodeAt(idx + 2) === 46 /* DOT */;
|
|
302
|
-
}
|
|
303
|
-
function scan(text, idx, end, ch, suffix = "") {
|
|
304
|
-
while (idx < end && text.charCodeAt(idx) !== ch) {
|
|
305
|
-
idx++;
|
|
306
|
-
}
|
|
307
|
-
const suffixLength = suffix.length;
|
|
308
|
-
for (let i = 0; i < suffixLength; i++) {
|
|
309
|
-
if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) {
|
|
310
|
-
return -1;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return idx - suffixLength;
|
|
314
|
-
}
|
|
315
|
-
function recursiveScan(paramName, suffix, path, pathStart, pathLength, route, routeStart, routeLength) {
|
|
316
|
-
if (path.charCodeAt(pathStart) === 47 /* SLASH */) {
|
|
317
|
-
pathStart++;
|
|
318
|
-
}
|
|
319
|
-
let pathIdx = pathLength;
|
|
320
|
-
const sep = suffix + "/";
|
|
321
|
-
while (pathIdx >= pathStart) {
|
|
322
|
-
const match = matchRoutePart(route, routeStart, routeLength, path, pathIdx, pathLength);
|
|
323
|
-
if (match) {
|
|
324
|
-
let value = path.substring(pathStart, Math.min(pathIdx, pathLength));
|
|
325
|
-
if (value.endsWith(sep)) {
|
|
326
|
-
value = value.substring(0, value.length - sep.length);
|
|
327
|
-
}
|
|
328
|
-
match[paramName] = decodeURIComponent(value);
|
|
329
|
-
return match;
|
|
330
|
-
}
|
|
331
|
-
const newPathIdx = lastIndexOf(path, pathStart, sep, pathIdx, pathStart - 1) + sep.length;
|
|
332
|
-
if (pathIdx === newPathIdx) {
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
pathIdx = newPathIdx;
|
|
336
|
-
}
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
function lastIndexOf(text, start, match, searchIdx, notFoundIdx) {
|
|
340
|
-
let idx = text.lastIndexOf(match, searchIdx);
|
|
341
|
-
if (idx == searchIdx - match.length) {
|
|
342
|
-
idx = text.lastIndexOf(match, searchIdx - match.length - 1);
|
|
343
|
-
}
|
|
344
|
-
return idx > start ? idx : notFoundIdx;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// packages/qwik-router/src/runtime/src/utils.ts
|
|
348
|
-
var isPromise = (value) => {
|
|
349
|
-
return value && typeof value.then === "function";
|
|
350
|
-
};
|
|
351
|
-
var deepFreeze = (obj) => {
|
|
352
|
-
if (obj == null) {
|
|
353
|
-
return obj;
|
|
354
|
-
}
|
|
355
|
-
Object.getOwnPropertyNames(obj).forEach((prop) => {
|
|
356
|
-
const value = obj[prop];
|
|
357
|
-
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
358
|
-
deepFreeze(value);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
return Object.freeze(obj);
|
|
272
|
+
const Un = (e, t) => {
|
|
273
|
+
const n = t.headers();
|
|
274
|
+
if (n.length > 0) {
|
|
275
|
+
const r = new Headers(e);
|
|
276
|
+
for (const o of n)
|
|
277
|
+
r.append("Set-Cookie", o);
|
|
278
|
+
return r;
|
|
279
|
+
}
|
|
280
|
+
return e;
|
|
362
281
|
};
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
);
|
|
386
|
-
});
|
|
387
|
-
const menuLoader = getMenuLoader(menus, pathname);
|
|
388
|
-
let menu = void 0;
|
|
389
|
-
loadModule(
|
|
390
|
-
menuLoader,
|
|
391
|
-
pendingLoads,
|
|
392
|
-
(menuModule) => menu = menuModule == null ? void 0 : menuModule.default,
|
|
393
|
-
cacheModules
|
|
394
|
-
);
|
|
395
|
-
if (pendingLoads.length > 0) {
|
|
396
|
-
await Promise.all(pendingLoads);
|
|
397
|
-
}
|
|
398
|
-
return [routeName, params, modules, deepFreeze(menu), routeBundleNames];
|
|
399
|
-
}
|
|
400
|
-
return null;
|
|
401
|
-
};
|
|
402
|
-
var loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => {
|
|
403
|
-
if (typeof moduleLoader === "function") {
|
|
404
|
-
const loadedModule = MODULE_CACHE.get(moduleLoader);
|
|
405
|
-
if (loadedModule) {
|
|
406
|
-
moduleSetter(loadedModule);
|
|
407
|
-
} else {
|
|
408
|
-
const moduleOrPromise = moduleLoader();
|
|
409
|
-
if (typeof moduleOrPromise.then === "function") {
|
|
410
|
-
pendingLoads.push(
|
|
411
|
-
moduleOrPromise.then((loadedModule2) => {
|
|
412
|
-
if (cacheModules !== false) {
|
|
413
|
-
MODULE_CACHE.set(moduleLoader, loadedModule2);
|
|
414
|
-
}
|
|
415
|
-
moduleSetter(loadedModule2);
|
|
416
|
-
})
|
|
417
|
-
);
|
|
418
|
-
} else if (moduleOrPromise) {
|
|
419
|
-
moduleSetter(moduleOrPromise);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
var getMenuLoader = (menus, pathname) => {
|
|
425
|
-
if (menus) {
|
|
426
|
-
pathname = pathname.endsWith("/") ? pathname : pathname + "/";
|
|
427
|
-
const menu = menus.find(
|
|
428
|
-
(m) => m[0] === pathname || pathname.startsWith(m[0] + (pathname.endsWith("/") ? "" : "/"))
|
|
429
|
-
);
|
|
430
|
-
if (menu) {
|
|
431
|
-
return menu[1];
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
// packages/qwik-router/src/middleware/request-handler/cache-control.ts
|
|
437
|
-
function createCacheControl(cacheControl) {
|
|
438
|
-
const controls = [];
|
|
439
|
-
if (cacheControl === "day") {
|
|
440
|
-
cacheControl = 60 * 60 * 24;
|
|
441
|
-
} else if (cacheControl === "week") {
|
|
442
|
-
cacheControl = 60 * 60 * 24 * 7;
|
|
443
|
-
} else if (cacheControl === "month") {
|
|
444
|
-
cacheControl = 60 * 60 * 24 * 30;
|
|
445
|
-
} else if (cacheControl === "year") {
|
|
446
|
-
cacheControl = 60 * 60 * 24 * 365;
|
|
447
|
-
} else if (cacheControl === "private") {
|
|
448
|
-
cacheControl = {
|
|
449
|
-
private: true,
|
|
450
|
-
noCache: true
|
|
451
|
-
};
|
|
452
|
-
} else if (cacheControl === "immutable") {
|
|
453
|
-
cacheControl = {
|
|
454
|
-
public: true,
|
|
455
|
-
immutable: true,
|
|
456
|
-
maxAge: 60 * 60 * 24 * 365,
|
|
457
|
-
staleWhileRevalidate: 60 * 60 * 24 * 365
|
|
458
|
-
};
|
|
459
|
-
} else if (cacheControl === "no-cache") {
|
|
460
|
-
cacheControl = {
|
|
461
|
-
noCache: true
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
if (typeof cacheControl === "number") {
|
|
465
|
-
cacheControl = {
|
|
466
|
-
maxAge: cacheControl,
|
|
467
|
-
sMaxAge: cacheControl,
|
|
468
|
-
staleWhileRevalidate: cacheControl
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
if (cacheControl.immutable) {
|
|
472
|
-
controls.push("immutable");
|
|
473
|
-
}
|
|
474
|
-
if (cacheControl.maxAge) {
|
|
475
|
-
controls.push(`max-age=${cacheControl.maxAge}`);
|
|
476
|
-
}
|
|
477
|
-
if (cacheControl.sMaxAge) {
|
|
478
|
-
controls.push(`s-maxage=${cacheControl.sMaxAge}`);
|
|
479
|
-
}
|
|
480
|
-
if (cacheControl.noStore) {
|
|
481
|
-
controls.push("no-store");
|
|
482
|
-
}
|
|
483
|
-
if (cacheControl.noCache) {
|
|
484
|
-
controls.push("no-cache");
|
|
485
|
-
}
|
|
486
|
-
if (cacheControl.private) {
|
|
487
|
-
controls.push("private");
|
|
488
|
-
}
|
|
489
|
-
if (cacheControl.public) {
|
|
490
|
-
controls.push("public");
|
|
491
|
-
}
|
|
492
|
-
if (cacheControl.staleWhileRevalidate) {
|
|
493
|
-
controls.push(`stale-while-revalidate=${cacheControl.staleWhileRevalidate}`);
|
|
494
|
-
}
|
|
495
|
-
if (cacheControl.staleIfError) {
|
|
496
|
-
controls.push(`stale-if-error=${cacheControl.staleIfError}`);
|
|
497
|
-
}
|
|
498
|
-
return controls.join(", ");
|
|
282
|
+
function K(e, t) {
|
|
283
|
+
let n = "Server Error";
|
|
284
|
+
return t != null && (typeof t.message == "string" ? n = t.message : n = String(t)), "<html>" + _e(e, n) + "</html>";
|
|
285
|
+
}
|
|
286
|
+
function _e(e, t) {
|
|
287
|
+
typeof e != "number" && (e = 500), typeof t == "string" ? t = tn(t) : t = "";
|
|
288
|
+
const n = typeof t == "string" ? "600px" : "300px", r = e >= 500 ? on : rn;
|
|
289
|
+
return `
|
|
290
|
+
<head>
|
|
291
|
+
<meta charset="utf-8">
|
|
292
|
+
<meta http-equiv="Status" content="${e}">
|
|
293
|
+
<title>${e} ${t}</title>
|
|
294
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
295
|
+
<style>
|
|
296
|
+
body { color: ${r}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
|
|
297
|
+
p { max-width: ${n}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${r}; overflow: hidden; }
|
|
298
|
+
strong { display: inline-block; padding: 15px; background: ${r}; color: white; }
|
|
299
|
+
span { display: inline-block; padding: 15px; }
|
|
300
|
+
</style>
|
|
301
|
+
</head>
|
|
302
|
+
<body><p><strong>${e}</strong> <span>${t}</span></p></body>
|
|
303
|
+
`;
|
|
499
304
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
305
|
+
const nn = /[&<>]/g, tn = (e) => e.replace(nn, (t) => {
|
|
306
|
+
switch (t) {
|
|
307
|
+
case "&":
|
|
308
|
+
return "&";
|
|
309
|
+
case "<":
|
|
310
|
+
return "<";
|
|
311
|
+
case ">":
|
|
312
|
+
return ">";
|
|
313
|
+
default:
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
}), rn = "#006ce9", on = "#713fc2";
|
|
317
|
+
let S;
|
|
318
|
+
import("node:async_hooks").then((e) => {
|
|
319
|
+
const t = e.AsyncLocalStorage;
|
|
320
|
+
S = new t(), globalThis.qcAsyncRequestStore = S;
|
|
321
|
+
}).catch((e) => {
|
|
508
322
|
console.warn(
|
|
509
323
|
"AsyncLocalStorage not available, continuing without it. This might impact concurrent server calls.",
|
|
510
|
-
|
|
324
|
+
e
|
|
511
325
|
);
|
|
512
326
|
});
|
|
513
|
-
function
|
|
514
|
-
let
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
trailingSlash,
|
|
522
|
-
basePathname,
|
|
523
|
-
qwikSerializer,
|
|
524
|
-
resolve
|
|
327
|
+
function an(e, t, n, r, o = "/") {
|
|
328
|
+
let i;
|
|
329
|
+
const a = new Promise((c) => i = c), s = cn(
|
|
330
|
+
e,
|
|
331
|
+
t,
|
|
332
|
+
n,
|
|
333
|
+
o,
|
|
334
|
+
i
|
|
525
335
|
);
|
|
526
336
|
return {
|
|
527
|
-
response:
|
|
528
|
-
requestEv,
|
|
529
|
-
completion:
|
|
337
|
+
response: a,
|
|
338
|
+
requestEv: s,
|
|
339
|
+
completion: S ? S.run(s, de, s, r, i) : de(s, r, i)
|
|
530
340
|
};
|
|
531
341
|
}
|
|
532
|
-
async function
|
|
342
|
+
async function de(e, t, n) {
|
|
533
343
|
try {
|
|
534
|
-
|
|
535
|
-
} catch
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
await writer.close();
|
|
344
|
+
((a) => new URL(a.pathname + a.search, a))(e.originalUrl);
|
|
345
|
+
} catch {
|
|
346
|
+
const a = "Resource Not Found";
|
|
347
|
+
e.status(404);
|
|
348
|
+
const s = K(404, a);
|
|
349
|
+
return e.html(404, s), new F(404, a);
|
|
350
|
+
}
|
|
351
|
+
let r = 1;
|
|
352
|
+
async function o() {
|
|
353
|
+
try {
|
|
354
|
+
await e.next();
|
|
355
|
+
} catch (i) {
|
|
356
|
+
if (i instanceof H)
|
|
357
|
+
await e.getWritableStream().close();
|
|
358
|
+
else if (i instanceof we) {
|
|
359
|
+
if (r > 50)
|
|
360
|
+
throw new Error("Infinite rewrite loop");
|
|
361
|
+
r += 1;
|
|
362
|
+
const a = new URL(e.url);
|
|
363
|
+
a.pathname = i.pathname;
|
|
364
|
+
const { loadedRoute: s, requestHandlers: c } = await t(a);
|
|
365
|
+
return e.resetRoute(s, c, a), await o();
|
|
366
|
+
} else if (i instanceof F) {
|
|
367
|
+
if (!e.headersSent) {
|
|
368
|
+
const a = i.status, s = e.request.headers.get("Accept");
|
|
369
|
+
if (s && !s.includes("text/html"))
|
|
370
|
+
e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await D([i.data]));
|
|
371
|
+
else {
|
|
372
|
+
const c = K(i.status, i.data);
|
|
373
|
+
e.html(a, c);
|
|
565
374
|
}
|
|
566
|
-
} catch {
|
|
567
|
-
console.error("Unable to render error page");
|
|
568
375
|
}
|
|
376
|
+
} else if (!(i instanceof pe)) {
|
|
377
|
+
if (P(e) !== "dev")
|
|
378
|
+
try {
|
|
379
|
+
e.headersSent || (e.headers.set("content-type", "text/html; charset=utf-8"), e.cacheControl({ noCache: !0 }), e.status(500));
|
|
380
|
+
const a = e.getWritableStream();
|
|
381
|
+
if (!a.locked) {
|
|
382
|
+
const s = a.getWriter();
|
|
383
|
+
await s.write(E.encode(K(500, "Internal Server Error"))), await s.close();
|
|
384
|
+
}
|
|
385
|
+
} catch {
|
|
386
|
+
console.error("Unable to render error page");
|
|
387
|
+
}
|
|
388
|
+
return i;
|
|
569
389
|
}
|
|
570
|
-
return e;
|
|
571
390
|
}
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
return await o();
|
|
572
394
|
} finally {
|
|
573
|
-
|
|
574
|
-
resolve(null);
|
|
575
|
-
}
|
|
395
|
+
e.isDirty() || n(null);
|
|
576
396
|
}
|
|
577
|
-
return void 0;
|
|
578
397
|
}
|
|
579
|
-
function
|
|
580
|
-
if (
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
if (pathname === "") {
|
|
584
|
-
pathname = "/";
|
|
585
|
-
}
|
|
398
|
+
function fe(e) {
|
|
399
|
+
if (e.endsWith(C)) {
|
|
400
|
+
const t = e.length - Te + (globalThis.__NO_TRAILING_SLASH__ ? 0 : 1);
|
|
401
|
+
e = e.slice(0, t), e === "" && (e = "/");
|
|
586
402
|
}
|
|
587
|
-
return
|
|
403
|
+
return e;
|
|
588
404
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
var RequestEvSharedActionId = "@actionId";
|
|
601
|
-
var RequestEvSharedActionFormData = "@actionFormData";
|
|
602
|
-
var RequestEvSharedNonce = "@nonce";
|
|
603
|
-
function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manifest, trailingSlash, basePathname, qwikSerializer, resolved) {
|
|
604
|
-
const { request, platform, env } = serverRequestEv;
|
|
605
|
-
const sharedMap = /* @__PURE__ */ new Map();
|
|
606
|
-
const cookie = new Cookie(request.headers.get("cookie"));
|
|
607
|
-
const headers = new Headers();
|
|
608
|
-
const url = new URL(request.url);
|
|
609
|
-
if (url.pathname.endsWith(QDATA_JSON)) {
|
|
610
|
-
url.pathname = url.pathname.slice(0, -QDATA_JSON_LEN);
|
|
611
|
-
if (trailingSlash && !url.pathname.endsWith("/")) {
|
|
612
|
-
url.pathname += "/";
|
|
613
|
-
}
|
|
614
|
-
sharedMap.set(IsQData, true);
|
|
615
|
-
}
|
|
616
|
-
sharedMap.set("@manifest", manifest);
|
|
617
|
-
let routeModuleIndex = -1;
|
|
618
|
-
let writableStream = null;
|
|
619
|
-
let requestData = void 0;
|
|
620
|
-
let locale = serverRequestEv.locale;
|
|
621
|
-
let status = 200;
|
|
622
|
-
const next = async () => {
|
|
623
|
-
routeModuleIndex++;
|
|
624
|
-
while (routeModuleIndex < requestHandlers.length) {
|
|
625
|
-
const moduleRequestHandler = requestHandlers[routeModuleIndex];
|
|
626
|
-
const asyncStore2 = globalThis.qcAsyncRequestStore;
|
|
627
|
-
const result = (asyncStore2 == null ? void 0 : asyncStore2.run) ? asyncStore2.run(requestEv, moduleRequestHandler, requestEv) : moduleRequestHandler(requestEv);
|
|
628
|
-
if (isPromise(result)) {
|
|
629
|
-
await result;
|
|
630
|
-
}
|
|
631
|
-
routeModuleIndex++;
|
|
405
|
+
const O = "@isQData", C = "/q-data.json", Te = C.length, Me = Symbol("RequestEvLoaders"), Ne = Symbol("RequestEvMode"), xe = Symbol("RequestEvRoute"), Ce = Symbol(
|
|
406
|
+
"RequestEvLoaderSerializationStrategyMap"
|
|
407
|
+
), Pe = "@routeName", j = "@actionId", Ie = "@actionFormData", sn = "@nonce", Le = "@rewrite", X = "@serverTiming", Oe = "qData";
|
|
408
|
+
function cn(e, t, n, r, o) {
|
|
409
|
+
const { request: i, platform: a, env: s } = e, c = /* @__PURE__ */ new Map(), f = new en(i.headers.get("cookie")), l = new Headers(), u = new URL(i.url);
|
|
410
|
+
u.pathname.endsWith(C) && (u.pathname = u.pathname.slice(0, -Te), !globalThis.__NO_TRAILING_SLASH__ && !u.pathname.endsWith("/") && (u.pathname += "/"), c.set(O, !0));
|
|
411
|
+
let h = -1, y = null, w, R = e.locale, p = 200;
|
|
412
|
+
const T = async () => {
|
|
413
|
+
for (h++; h < n.length; ) {
|
|
414
|
+
const d = n[h], m = globalThis.qcAsyncRequestStore, g = m?.run ? m.run(b, d, b) : d(b);
|
|
415
|
+
Ye(g) && await g, h++;
|
|
632
416
|
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
417
|
+
}, M = (d, m, g = u) => {
|
|
418
|
+
t = d, n = m, u.pathname = g.pathname, u.search = g.search, h = -1;
|
|
419
|
+
}, N = () => {
|
|
420
|
+
if (y !== null)
|
|
636
421
|
throw new Error("Response already sent");
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
[RequestEvLoaders]: loaders,
|
|
684
|
-
[RequestEvMode]: serverRequestEv.mode,
|
|
685
|
-
[RequestEvTrailingSlash]: trailingSlash,
|
|
686
|
-
[RequestEvRoute]: loadedRoute,
|
|
687
|
-
[RequestEvQwikSerializer]: qwikSerializer,
|
|
688
|
-
cookie,
|
|
689
|
-
headers,
|
|
690
|
-
env,
|
|
691
|
-
method: request.method,
|
|
692
|
-
signal: request.signal,
|
|
693
|
-
params: (loadedRoute == null ? void 0 : loadedRoute[1]) ?? {},
|
|
694
|
-
pathname: url.pathname,
|
|
695
|
-
platform,
|
|
696
|
-
query: url.searchParams,
|
|
697
|
-
request,
|
|
698
|
-
url,
|
|
699
|
-
basePathname,
|
|
700
|
-
sharedMap,
|
|
422
|
+
}, W = (d, m) => {
|
|
423
|
+
if (N(), typeof d == "number") {
|
|
424
|
+
p = d;
|
|
425
|
+
const A = b.getWritableStream().getWriter();
|
|
426
|
+
A.write(typeof m == "string" ? E.encode(m) : m), A.close();
|
|
427
|
+
} else if (p = d.status, d.headers.forEach((g, A) => {
|
|
428
|
+
A.toLowerCase() !== "set-cookie" && l.append(A, g);
|
|
429
|
+
}), d.headers.getSetCookie().forEach((g) => {
|
|
430
|
+
const A = g.indexOf("=");
|
|
431
|
+
if (A === -1)
|
|
432
|
+
return;
|
|
433
|
+
const De = g.slice(0, A).trim(), Fe = g.slice(A + 1).trim();
|
|
434
|
+
f.set(De, Fe);
|
|
435
|
+
}), d.body) {
|
|
436
|
+
const g = b.getWritableStream();
|
|
437
|
+
d.body.pipeTo(g);
|
|
438
|
+
} else
|
|
439
|
+
b.getWritableStream().getWriter().close();
|
|
440
|
+
return z();
|
|
441
|
+
}, z = () => (h = ue, new pe()), I = {}, b = {
|
|
442
|
+
[Me]: I,
|
|
443
|
+
[Ce]: /* @__PURE__ */ new Map(),
|
|
444
|
+
[Ne]: e.mode,
|
|
445
|
+
get [xe]() {
|
|
446
|
+
return t;
|
|
447
|
+
},
|
|
448
|
+
cookie: f,
|
|
449
|
+
headers: l,
|
|
450
|
+
env: s,
|
|
451
|
+
method: i.method,
|
|
452
|
+
signal: i.signal,
|
|
453
|
+
originalUrl: new URL(u),
|
|
454
|
+
get params() {
|
|
455
|
+
return t?.[L.Params] ?? {};
|
|
456
|
+
},
|
|
457
|
+
get pathname() {
|
|
458
|
+
return u.pathname;
|
|
459
|
+
},
|
|
460
|
+
platform: a,
|
|
461
|
+
get query() {
|
|
462
|
+
return u.searchParams;
|
|
463
|
+
},
|
|
464
|
+
request: i,
|
|
465
|
+
url: u,
|
|
466
|
+
basePathname: r,
|
|
467
|
+
sharedMap: c,
|
|
701
468
|
get headersSent() {
|
|
702
|
-
return
|
|
469
|
+
return y !== null;
|
|
703
470
|
},
|
|
704
471
|
get exited() {
|
|
705
|
-
return
|
|
472
|
+
return h >= ue;
|
|
706
473
|
},
|
|
707
474
|
get clientConn() {
|
|
708
|
-
return
|
|
475
|
+
return e.getClientConn();
|
|
709
476
|
},
|
|
710
|
-
next,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
477
|
+
next: T,
|
|
478
|
+
resetRoute: M,
|
|
479
|
+
exit: z,
|
|
480
|
+
cacheControl: (d, m = "Cache-Control") => {
|
|
481
|
+
N(), l.set(m, ve(d));
|
|
715
482
|
},
|
|
716
|
-
resolveValue: async (
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
if (!(
|
|
483
|
+
resolveValue: (async (d) => {
|
|
484
|
+
const m = d.__id;
|
|
485
|
+
if (d.__brand === "server_loader") {
|
|
486
|
+
if (!(m in I))
|
|
720
487
|
throw new Error(
|
|
721
488
|
"You can not get the returned data of a loader that has not been executed for this request."
|
|
722
489
|
);
|
|
490
|
+
if (I[m] === ye) {
|
|
491
|
+
const g = P(b) === "dev";
|
|
492
|
+
await We(d, I, b, g);
|
|
723
493
|
}
|
|
724
494
|
}
|
|
725
|
-
return
|
|
726
|
-
},
|
|
727
|
-
status: (
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
495
|
+
return I[m];
|
|
496
|
+
}),
|
|
497
|
+
status: (d) => typeof d == "number" ? (N(), p = d, d) : p,
|
|
498
|
+
locale: (d) => (typeof d == "string" && (R = d), R || ""),
|
|
499
|
+
error: (d, m) => (p = d, l.delete("Cache-Control"), new F(d, m)),
|
|
500
|
+
redirect: (d, m) => {
|
|
501
|
+
if (N(), p = d, m) {
|
|
502
|
+
const g = m.replace(/([^:])\/{2,}/g, "$1/");
|
|
503
|
+
m !== g && console.warn(`Redirect URL ${m} is invalid, fixing to ${g}`), l.set("Location", g);
|
|
732
504
|
}
|
|
733
|
-
return
|
|
505
|
+
return l.delete("Cache-Control"), d > 301 && l.set("Cache-Control", "no-store"), z(), new H();
|
|
734
506
|
},
|
|
735
|
-
|
|
736
|
-
if (
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
return locale || "";
|
|
740
|
-
},
|
|
741
|
-
error: (statusCode, message) => {
|
|
742
|
-
status = statusCode;
|
|
743
|
-
return new ServerError(statusCode, message);
|
|
744
|
-
},
|
|
745
|
-
redirect: (statusCode, url2) => {
|
|
746
|
-
check();
|
|
747
|
-
status = statusCode;
|
|
748
|
-
if (url2) {
|
|
749
|
-
const fixedURL = url2.replace(/([^:])\/{2,}/g, "$1/");
|
|
750
|
-
if (url2 !== fixedURL) {
|
|
751
|
-
console.warn(`Redirect URL ${url2} is invalid, fixing to ${fixedURL}`);
|
|
752
|
-
}
|
|
753
|
-
headers.set("Location", fixedURL);
|
|
754
|
-
}
|
|
755
|
-
if (statusCode > 301 && !headers.get("Cache-Control")) {
|
|
756
|
-
headers.set("Cache-Control", "no-store");
|
|
757
|
-
}
|
|
758
|
-
exit();
|
|
759
|
-
return new RedirectMessage();
|
|
760
|
-
},
|
|
761
|
-
defer: (returnData) => {
|
|
762
|
-
return typeof returnData === "function" ? returnData : () => returnData;
|
|
763
|
-
},
|
|
764
|
-
fail: (statusCode, data) => {
|
|
765
|
-
check();
|
|
766
|
-
status = statusCode;
|
|
767
|
-
return {
|
|
768
|
-
failed: true,
|
|
769
|
-
...data
|
|
770
|
-
};
|
|
771
|
-
},
|
|
772
|
-
text: (statusCode, text) => {
|
|
773
|
-
headers.set("Content-Type", "text/plain; charset=utf-8");
|
|
774
|
-
return send(statusCode, text);
|
|
775
|
-
},
|
|
776
|
-
html: (statusCode, html) => {
|
|
777
|
-
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
778
|
-
return send(statusCode, html);
|
|
779
|
-
},
|
|
780
|
-
parseBody: async () => {
|
|
781
|
-
if (requestData !== void 0) {
|
|
782
|
-
return requestData;
|
|
783
|
-
}
|
|
784
|
-
return requestData = parseRequest(requestEv, sharedMap, qwikSerializer);
|
|
785
|
-
},
|
|
786
|
-
json: (statusCode, data) => {
|
|
787
|
-
headers.set("Content-Type", "application/json; charset=utf-8");
|
|
788
|
-
return send(statusCode, JSON.stringify(data));
|
|
789
|
-
},
|
|
790
|
-
send,
|
|
791
|
-
isDirty: () => {
|
|
792
|
-
return writableStream !== null;
|
|
507
|
+
rewrite: (d) => {
|
|
508
|
+
if (N(), d.startsWith("http"))
|
|
509
|
+
throw new Error("Rewrite does not support absolute urls");
|
|
510
|
+
return c.set(Le, !0), new we(d.replace(/\/+/g, "/"));
|
|
793
511
|
},
|
|
512
|
+
defer: (d) => typeof d == "function" ? d : () => d,
|
|
513
|
+
fail: (d, m) => (N(), p = d, l.delete("Cache-Control"), {
|
|
514
|
+
failed: !0,
|
|
515
|
+
...m
|
|
516
|
+
}),
|
|
517
|
+
text: (d, m) => (l.set("Content-Type", "text/plain; charset=utf-8"), W(d, m)),
|
|
518
|
+
html: (d, m) => (l.set("Content-Type", "text/html; charset=utf-8"), W(d, m)),
|
|
519
|
+
parseBody: async () => w !== void 0 ? w : w = dn(b, c),
|
|
520
|
+
json: (d, m) => (l.set("Content-Type", "application/json; charset=utf-8"), W(d, JSON.stringify(m))),
|
|
521
|
+
send: W,
|
|
522
|
+
isDirty: () => y !== null,
|
|
794
523
|
getWritableStream: () => {
|
|
795
|
-
if (
|
|
796
|
-
if (
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
524
|
+
if (y === null) {
|
|
525
|
+
if (e.mode === "dev") {
|
|
526
|
+
const d = c.get(X);
|
|
527
|
+
d && l.set(
|
|
528
|
+
"Server-Timing",
|
|
529
|
+
d.map(([m, g]) => `${m};dur=${g}`).join(",")
|
|
530
|
+
);
|
|
801
531
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
532
|
+
y = e.getWritableStream(
|
|
533
|
+
p,
|
|
534
|
+
l,
|
|
535
|
+
f,
|
|
536
|
+
o,
|
|
537
|
+
b
|
|
808
538
|
);
|
|
809
539
|
}
|
|
810
|
-
return
|
|
540
|
+
return y;
|
|
811
541
|
}
|
|
812
542
|
};
|
|
813
|
-
return Object.freeze(
|
|
543
|
+
return Object.freeze(b);
|
|
814
544
|
}
|
|
815
|
-
function
|
|
816
|
-
return
|
|
545
|
+
function U(e) {
|
|
546
|
+
return e[Me];
|
|
817
547
|
}
|
|
818
|
-
function
|
|
819
|
-
return
|
|
548
|
+
function Ue(e) {
|
|
549
|
+
return e[Ce];
|
|
820
550
|
}
|
|
821
|
-
function
|
|
822
|
-
return
|
|
551
|
+
function ln(e) {
|
|
552
|
+
return e[xe];
|
|
823
553
|
}
|
|
824
|
-
function
|
|
825
|
-
return
|
|
554
|
+
function P(e) {
|
|
555
|
+
return e[Ne];
|
|
826
556
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
return qwikSerializer._deserialize(decodeURIComponent(data));
|
|
844
|
-
} catch {
|
|
845
|
-
}
|
|
557
|
+
const ue = Number.MAX_SAFE_INTEGER, dn = async ({ request: e, method: t, query: n }, r) => {
|
|
558
|
+
const o = e.headers.get("content-type")?.split(/[;,]/, 1)[0].trim() ?? "";
|
|
559
|
+
if (o === "application/x-www-form-urlencoded" || o === "multipart/form-data") {
|
|
560
|
+
const i = await e.formData();
|
|
561
|
+
return r.set(Ie, i), fn(i);
|
|
562
|
+
} else {
|
|
563
|
+
if (o === "application/json")
|
|
564
|
+
return await e.json();
|
|
565
|
+
if (o === "application/qwik-json") {
|
|
566
|
+
if (t === "GET" && n.has(re)) {
|
|
567
|
+
const i = n.get(re);
|
|
568
|
+
if (i)
|
|
569
|
+
try {
|
|
570
|
+
return ee(decodeURIComponent(i));
|
|
571
|
+
} catch {
|
|
572
|
+
}
|
|
846
573
|
}
|
|
574
|
+
return ee(await e.text());
|
|
847
575
|
}
|
|
848
|
-
return qwikSerializer._deserialize(await request.text());
|
|
849
|
-
}
|
|
850
|
-
return void 0;
|
|
851
|
-
};
|
|
852
|
-
var formToObj = (formData) => {
|
|
853
|
-
const values = [...formData.entries()].reduce((values2, [name, value]) => {
|
|
854
|
-
name.split(".").reduce((object, key, index, keys) => {
|
|
855
|
-
if (key.endsWith("[]")) {
|
|
856
|
-
const arrayKey = key.slice(0, -2);
|
|
857
|
-
object[arrayKey] = object[arrayKey] || [];
|
|
858
|
-
return object[arrayKey] = [...object[arrayKey], value];
|
|
859
|
-
}
|
|
860
|
-
if (index < keys.length - 1) {
|
|
861
|
-
return object[key] = object[key] || (Number.isNaN(+keys[index + 1]) ? {} : []);
|
|
862
|
-
}
|
|
863
|
-
return object[key] = value;
|
|
864
|
-
}, values2);
|
|
865
|
-
return values2;
|
|
866
|
-
}, {});
|
|
867
|
-
return values;
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
// packages/qwik-router/src/middleware/request-handler/response-page.ts
|
|
871
|
-
function getQwikRouterServerData(requestEv) {
|
|
872
|
-
const { url, params, request, status, locale } = requestEv;
|
|
873
|
-
const requestHeaders = {};
|
|
874
|
-
request.headers.forEach((value, key) => requestHeaders[key] = value);
|
|
875
|
-
const action = requestEv.sharedMap.get(RequestEvSharedActionId);
|
|
876
|
-
const formData = requestEv.sharedMap.get(RequestEvSharedActionFormData);
|
|
877
|
-
const routeName = requestEv.sharedMap.get(RequestRouteName);
|
|
878
|
-
const nonce = requestEv.sharedMap.get(RequestEvSharedNonce);
|
|
879
|
-
const headers = requestEv.request.headers;
|
|
880
|
-
const reconstructedUrl = new URL(url.pathname + url.search, url);
|
|
881
|
-
const host = headers.get("X-Forwarded-Host");
|
|
882
|
-
const protocol = headers.get("X-Forwarded-Proto");
|
|
883
|
-
if (host) {
|
|
884
|
-
reconstructedUrl.port = "";
|
|
885
|
-
reconstructedUrl.host = host;
|
|
886
|
-
}
|
|
887
|
-
if (protocol) {
|
|
888
|
-
reconstructedUrl.protocol = protocol;
|
|
889
576
|
}
|
|
577
|
+
}, fn = (e) => [...e.entries()].reduce((n, [r, o]) => (r.split(".").reduce((i, a, s, c) => {
|
|
578
|
+
if (a.endsWith("[]")) {
|
|
579
|
+
const f = a.slice(0, -2);
|
|
580
|
+
return i[f] = i[f] || [], i[f] = [...i[f], o];
|
|
581
|
+
}
|
|
582
|
+
return s < c.length - 1 ? i[a] = i[a] || (Number.isNaN(+c[s + 1]) ? {} : []) : i[a] = o;
|
|
583
|
+
}, n), n), {});
|
|
584
|
+
function un(e) {
|
|
585
|
+
const { params: t, request: n, status: r, locale: o, originalUrl: i } = e, a = {};
|
|
586
|
+
n.headers.forEach((T, M) => a[M] = T);
|
|
587
|
+
const s = e.sharedMap.get(j), c = e.sharedMap.get(Ie), f = e.sharedMap.get(Pe), l = e.sharedMap.get(sn), u = e.request.headers, h = new URL(i.pathname + i.search, i), y = u.get("X-Forwarded-Host"), w = u.get("X-Forwarded-Proto");
|
|
588
|
+
y && (h.port = "", h.host = y), w && (h.protocol = w);
|
|
589
|
+
const R = U(e), p = Ue(e);
|
|
890
590
|
return {
|
|
891
|
-
url:
|
|
892
|
-
requestHeaders,
|
|
893
|
-
locale:
|
|
894
|
-
nonce,
|
|
591
|
+
url: h.href,
|
|
592
|
+
requestHeaders: a,
|
|
593
|
+
locale: o(),
|
|
594
|
+
nonce: l,
|
|
895
595
|
containerAttributes: {
|
|
896
|
-
|
|
596
|
+
[je]: f
|
|
897
597
|
},
|
|
898
598
|
qwikrouter: {
|
|
899
|
-
routeName,
|
|
900
|
-
ev:
|
|
901
|
-
params: { ...
|
|
902
|
-
loadedRoute:
|
|
599
|
+
routeName: f,
|
|
600
|
+
ev: e,
|
|
601
|
+
params: { ...t },
|
|
602
|
+
loadedRoute: ln(e),
|
|
903
603
|
response: {
|
|
904
|
-
status:
|
|
905
|
-
loaders:
|
|
906
|
-
|
|
907
|
-
|
|
604
|
+
status: r(),
|
|
605
|
+
loaders: R,
|
|
606
|
+
loadersSerializationStrategy: p,
|
|
607
|
+
action: s,
|
|
608
|
+
formData: c
|
|
908
609
|
}
|
|
909
610
|
}
|
|
910
611
|
};
|
|
911
612
|
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
requestHandlers.push(handleRedirect);
|
|
943
|
-
_resolveRequestHandlers(
|
|
944
|
-
routeLoaders,
|
|
945
|
-
routeActions,
|
|
946
|
-
requestHandlers,
|
|
947
|
-
routeModules,
|
|
948
|
-
isPageRoute,
|
|
949
|
-
method
|
|
950
|
-
);
|
|
951
|
-
if (isPageRoute) {
|
|
952
|
-
requestHandlers.push((ev) => {
|
|
953
|
-
ev.sharedMap.set(RequestRouteName, routeName);
|
|
954
|
-
});
|
|
955
|
-
requestHandlers.push(actionsMiddleware(routeActions, routeLoaders));
|
|
956
|
-
requestHandlers.push(renderHandler);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
return requestHandlers;
|
|
960
|
-
};
|
|
961
|
-
var _resolveRequestHandlers = (routeLoaders, routeActions, requestHandlers, routeModules, collectActions, method) => {
|
|
962
|
-
for (const routeModule of routeModules) {
|
|
963
|
-
if (typeof routeModule.onRequest === "function") {
|
|
964
|
-
requestHandlers.push(routeModule.onRequest);
|
|
965
|
-
} else if (Array.isArray(routeModule.onRequest)) {
|
|
966
|
-
requestHandlers.push(...routeModule.onRequest);
|
|
967
|
-
}
|
|
968
|
-
let methodReqHandler;
|
|
969
|
-
switch (method) {
|
|
613
|
+
const hn = (e, t, n, r, o) => {
|
|
614
|
+
const i = [], a = [], s = [], c = !!(t && bn(t[L.Mods]));
|
|
615
|
+
if (e && he(
|
|
616
|
+
i,
|
|
617
|
+
a,
|
|
618
|
+
s,
|
|
619
|
+
e,
|
|
620
|
+
c,
|
|
621
|
+
n
|
|
622
|
+
), t) {
|
|
623
|
+
const f = t[L.RouteName];
|
|
624
|
+
r && (n === "POST" || n === "PUT" || n === "PATCH" || n === "DELETE") && (r === "lax-proto" ? s.unshift(An) : s.unshift(_n)), c && ((n === "POST" || n === "GET") && s.push(wn), s.push(pn), s.push(Nn));
|
|
625
|
+
const l = t[L.Mods];
|
|
626
|
+
s.push(Mn), he(
|
|
627
|
+
i,
|
|
628
|
+
a,
|
|
629
|
+
s,
|
|
630
|
+
l,
|
|
631
|
+
c,
|
|
632
|
+
n
|
|
633
|
+
), c && (s.push((u) => {
|
|
634
|
+
u.sharedMap.set(Pe, f);
|
|
635
|
+
}), s.push(mn(a)), s.push(gn(i)), s.push(o));
|
|
636
|
+
}
|
|
637
|
+
return s;
|
|
638
|
+
}, he = (e, t, n, r, o, i) => {
|
|
639
|
+
for (const a of r) {
|
|
640
|
+
typeof a.onRequest == "function" ? n.push(a.onRequest) : Array.isArray(a.onRequest) && n.push(...a.onRequest);
|
|
641
|
+
let s;
|
|
642
|
+
switch (i) {
|
|
970
643
|
case "GET": {
|
|
971
|
-
|
|
644
|
+
s = a.onGet;
|
|
972
645
|
break;
|
|
973
646
|
}
|
|
974
647
|
case "POST": {
|
|
975
|
-
|
|
648
|
+
s = a.onPost;
|
|
976
649
|
break;
|
|
977
650
|
}
|
|
978
651
|
case "PUT": {
|
|
979
|
-
|
|
652
|
+
s = a.onPut;
|
|
980
653
|
break;
|
|
981
654
|
}
|
|
982
655
|
case "PATCH": {
|
|
983
|
-
|
|
656
|
+
s = a.onPatch;
|
|
984
657
|
break;
|
|
985
658
|
}
|
|
986
659
|
case "DELETE": {
|
|
987
|
-
|
|
660
|
+
s = a.onDelete;
|
|
988
661
|
break;
|
|
989
662
|
}
|
|
990
663
|
case "OPTIONS": {
|
|
991
|
-
|
|
664
|
+
s = a.onOptions;
|
|
992
665
|
break;
|
|
993
666
|
}
|
|
994
667
|
case "HEAD": {
|
|
995
|
-
|
|
668
|
+
s = a.onHead;
|
|
996
669
|
break;
|
|
997
670
|
}
|
|
998
671
|
}
|
|
999
|
-
if (typeof
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
requestHandlers.push(...methodReqHandler);
|
|
1003
|
-
}
|
|
1004
|
-
if (collectActions) {
|
|
1005
|
-
for (const module of Object.values(routeModule)) {
|
|
1006
|
-
if (typeof module === "function") {
|
|
1007
|
-
if (module.__brand === "server_loader") {
|
|
1008
|
-
routeLoaders.push(module);
|
|
1009
|
-
} else if (module.__brand === "server_action") {
|
|
1010
|
-
routeActions.push(module);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
672
|
+
if (typeof s == "function" ? n.push(s) : Array.isArray(s) && n.push(...s), o)
|
|
673
|
+
for (const c of Object.values(a))
|
|
674
|
+
typeof c == "function" && (c.__brand === "server_loader" ? e.push(c) : c.__brand === "server_action" && t.push(c));
|
|
1015
675
|
}
|
|
1016
676
|
};
|
|
1017
|
-
function
|
|
1018
|
-
return async (
|
|
1019
|
-
|
|
1020
|
-
|
|
677
|
+
function mn(e) {
|
|
678
|
+
return async (t) => {
|
|
679
|
+
const n = t;
|
|
680
|
+
if (n.headersSent) {
|
|
681
|
+
n.exit();
|
|
1021
682
|
return;
|
|
1022
683
|
}
|
|
1023
|
-
const { method } =
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
)
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
const selectedActionId = requestEv.query.get(QACTION_KEY);
|
|
1036
|
-
if (selectedActionId) {
|
|
1037
|
-
const serverActionsMap = globalThis._qwikActionsMap;
|
|
1038
|
-
const action = routeActions.find((action2) => action2.__id === selectedActionId) ?? (serverActionsMap == null ? void 0 : serverActionsMap.get(selectedActionId));
|
|
1039
|
-
if (action) {
|
|
1040
|
-
requestEv.sharedMap.set(RequestEvSharedActionId, selectedActionId);
|
|
1041
|
-
const data = await requestEv.parseBody();
|
|
1042
|
-
if (!data || typeof data !== "object") {
|
|
684
|
+
const { method: r } = n, o = U(n), i = P(n) === "dev";
|
|
685
|
+
if (i && r === "GET" && n.query.has(te) && console.warn(
|
|
686
|
+
`Seems like you are submitting a Qwik Action via GET request. Qwik Actions should be submitted via POST request.
|
|
687
|
+
Make sure your <form> has method="POST" attribute, like this: <form method="POST">`
|
|
688
|
+
), r === "POST") {
|
|
689
|
+
const a = n.query.get(te);
|
|
690
|
+
if (a) {
|
|
691
|
+
const s = globalThis._qwikActionsMap, c = e.find((f) => f.__id === a) ?? s?.get(a);
|
|
692
|
+
if (c) {
|
|
693
|
+
n.sharedMap.set(j, a);
|
|
694
|
+
const f = await n.parseBody();
|
|
695
|
+
if (!f || typeof f != "object")
|
|
1043
696
|
throw new Error(
|
|
1044
|
-
`Expected request data for the action id ${
|
|
697
|
+
`Expected request data for the action id ${a} to be an object`
|
|
1045
698
|
);
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
if (isDev) {
|
|
1057
|
-
verifySerializable(qwikSerializer, actionResolved, action.__qrl);
|
|
1058
|
-
}
|
|
1059
|
-
loaders[selectedActionId] = actionResolved;
|
|
699
|
+
const l = await qe(n, c.__validators, f, i);
|
|
700
|
+
if (!l.success)
|
|
701
|
+
o[a] = n.fail(l.status ?? 500, l.error);
|
|
702
|
+
else {
|
|
703
|
+
const u = i ? await G(
|
|
704
|
+
n,
|
|
705
|
+
c.__qrl.getHash(),
|
|
706
|
+
() => c.__qrl.call(n, l.data, n)
|
|
707
|
+
) : await c.__qrl.call(n, l.data, n);
|
|
708
|
+
i && Q(u, c.__qrl), o[a] = u;
|
|
1060
709
|
}
|
|
1061
710
|
}
|
|
1062
711
|
}
|
|
1063
712
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
}
|
|
1087
|
-
}).then((resolvedLoader) => {
|
|
1088
|
-
if (typeof resolvedLoader === "function") {
|
|
1089
|
-
loaders[loaderId] = resolvedLoader();
|
|
1090
|
-
} else {
|
|
1091
|
-
if (isDev) {
|
|
1092
|
-
verifySerializable(qwikSerializer, resolvedLoader, loader.__qrl);
|
|
1093
|
-
}
|
|
1094
|
-
loaders[loaderId] = resolvedLoader;
|
|
1095
|
-
}
|
|
1096
|
-
return resolvedLoader;
|
|
1097
|
-
});
|
|
1098
|
-
return loaders[loaderId];
|
|
1099
|
-
});
|
|
1100
|
-
await Promise.all(resolvedLoadersPromises);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function gn(e) {
|
|
716
|
+
return async (t) => {
|
|
717
|
+
const n = t;
|
|
718
|
+
if (n.headersSent) {
|
|
719
|
+
n.exit();
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
const r = U(n), o = P(n) === "dev";
|
|
723
|
+
if (e.length > 0) {
|
|
724
|
+
let i = [];
|
|
725
|
+
if (n.query.has(v)) {
|
|
726
|
+
const s = n.query.getAll(v);
|
|
727
|
+
for (const c of e)
|
|
728
|
+
s.includes(c.__id) ? i.push(c) : r[c.__id] = ye;
|
|
729
|
+
} else
|
|
730
|
+
i = e;
|
|
731
|
+
const a = i.map(
|
|
732
|
+
(s) => We(s, r, n, o)
|
|
733
|
+
);
|
|
734
|
+
await Promise.all(a);
|
|
1101
735
|
}
|
|
1102
736
|
};
|
|
1103
737
|
}
|
|
1104
|
-
async function
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
738
|
+
async function We(e, t, n, r) {
|
|
739
|
+
const o = e.__id;
|
|
740
|
+
return t[o] = qe(
|
|
741
|
+
n,
|
|
742
|
+
e.__validators,
|
|
743
|
+
void 0,
|
|
744
|
+
// data
|
|
745
|
+
r
|
|
746
|
+
).then((a) => a.success ? r ? G(
|
|
747
|
+
n,
|
|
748
|
+
e.__qrl.getHash(),
|
|
749
|
+
() => e.__qrl.call(n, n)
|
|
750
|
+
) : e.__qrl.call(n, n) : n.fail(a.status ?? 500, a.error)).then((a) => (typeof a == "function" ? t[o] = a() : (r && Q(a, e.__qrl), t[o] = a), a)), Ue(n).set(o, e.__serializationStrategy), t[o];
|
|
751
|
+
}
|
|
752
|
+
async function qe(e, t, n, r) {
|
|
753
|
+
let o = {
|
|
754
|
+
success: !0,
|
|
755
|
+
data: n
|
|
1108
756
|
};
|
|
1109
|
-
if (
|
|
1110
|
-
for (const
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
if (!lastResult.success) {
|
|
1121
|
-
return lastResult;
|
|
1122
|
-
} else {
|
|
1123
|
-
data = lastResult.data;
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
return lastResult;
|
|
757
|
+
if (t)
|
|
758
|
+
for (const i of t)
|
|
759
|
+
if (r ? o = await G(
|
|
760
|
+
e,
|
|
761
|
+
"validator$",
|
|
762
|
+
() => i.validate(e, n)
|
|
763
|
+
) : o = await i.validate(e, n), o.success)
|
|
764
|
+
n = o.data;
|
|
765
|
+
else
|
|
766
|
+
return o;
|
|
767
|
+
return o;
|
|
1128
768
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return
|
|
769
|
+
function yn(e) {
|
|
770
|
+
return e ? typeof e == "object" && Symbol.asyncIterator in e : !1;
|
|
1131
771
|
}
|
|
1132
|
-
async function
|
|
1133
|
-
const
|
|
1134
|
-
if (
|
|
1135
|
-
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
);
|
|
1149
|
-
} else {
|
|
1150
|
-
result = await qrl.apply(ev, args);
|
|
772
|
+
async function wn(e) {
|
|
773
|
+
const t = e.query.get(Qe);
|
|
774
|
+
if (t && e.request.headers.get("X-QRL") === t && e.request.headers.get("Content-Type") === "application/qwik-json") {
|
|
775
|
+
e.exit();
|
|
776
|
+
const n = P(e) === "dev", r = await e.parseBody();
|
|
777
|
+
if (Array.isArray(r)) {
|
|
778
|
+
const [o, ...i] = r;
|
|
779
|
+
if (Rn(o) && o.getHash() === t) {
|
|
780
|
+
let a;
|
|
781
|
+
try {
|
|
782
|
+
n ? a = await G(
|
|
783
|
+
e,
|
|
784
|
+
`server_${o.getSymbol()}`,
|
|
785
|
+
() => o.apply(e, i)
|
|
786
|
+
) : a = await o.apply(e, i);
|
|
787
|
+
} catch (s) {
|
|
788
|
+
throw s instanceof F ? e.error(s.status, s.data) : e.error(500, "Invalid request");
|
|
1151
789
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1154
|
-
const
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}
|
|
1160
|
-
const message = await qwikSerializer._serialize([item]);
|
|
1161
|
-
if (ev.signal.aborted) {
|
|
790
|
+
if (yn(a)) {
|
|
791
|
+
e.headers.set("Content-Type", "text/qwik-json-stream");
|
|
792
|
+
const c = e.getWritableStream().getWriter();
|
|
793
|
+
for await (const f of a) {
|
|
794
|
+
n && Q(f, o);
|
|
795
|
+
const l = await D([f]);
|
|
796
|
+
if (e.signal.aborted)
|
|
1162
797
|
break;
|
|
1163
|
-
}
|
|
1164
|
-
await stream.write(encoder.encode(`${message}
|
|
798
|
+
await c.write(E.encode(`${l}
|
|
1165
799
|
`));
|
|
1166
800
|
}
|
|
1167
|
-
|
|
801
|
+
c.close();
|
|
1168
802
|
} else {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
ev.send(200, message);
|
|
803
|
+
Q(a, o), e.headers.set("Content-Type", "application/qwik-json");
|
|
804
|
+
const s = await D([a]);
|
|
805
|
+
e.send(200, s);
|
|
1173
806
|
}
|
|
1174
807
|
return;
|
|
1175
808
|
}
|
|
1176
809
|
}
|
|
1177
|
-
throw
|
|
810
|
+
throw e.error(500, "Invalid request");
|
|
1178
811
|
}
|
|
1179
812
|
}
|
|
1180
|
-
function
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
}
|
|
1189
|
-
} else {
|
|
1190
|
-
if (pathname.endsWith("/")) {
|
|
1191
|
-
throw ev.redirect(
|
|
1192
|
-
301 /* MovedPermanently */,
|
|
1193
|
-
pathname.slice(0, pathname.length - 1) + url.search
|
|
813
|
+
function pn(e) {
|
|
814
|
+
const { basePathname: t, originalUrl: n, sharedMap: r } = e, { pathname: o, search: i } = n;
|
|
815
|
+
if (!r.has(O) && o !== t && !o.endsWith(".html")) {
|
|
816
|
+
if (globalThis.__NO_TRAILING_SLASH__) {
|
|
817
|
+
if (o.endsWith("/"))
|
|
818
|
+
throw e.redirect(
|
|
819
|
+
V.MovedPermanently,
|
|
820
|
+
o.slice(0, o.length - 1) + i
|
|
1194
821
|
);
|
|
1195
|
-
|
|
1196
|
-
|
|
822
|
+
} else if (!o.endsWith("/"))
|
|
823
|
+
throw e.redirect(V.MovedPermanently, o + "/" + i);
|
|
1197
824
|
}
|
|
1198
825
|
}
|
|
1199
|
-
function
|
|
826
|
+
function Q(e, t) {
|
|
1200
827
|
try {
|
|
1201
|
-
|
|
1202
|
-
} catch (
|
|
1203
|
-
|
|
1204
|
-
e.loc = qrl.dev;
|
|
1205
|
-
}
|
|
1206
|
-
throw e;
|
|
828
|
+
Se(e, void 0);
|
|
829
|
+
} catch (n) {
|
|
830
|
+
throw n instanceof Error && t.dev && (n.loc = t.dev), n;
|
|
1207
831
|
}
|
|
1208
832
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
const lastRouteModule = routeModules[routeModules.length - 1];
|
|
1214
|
-
return lastRouteModule && typeof lastRouteModule.default === "function";
|
|
833
|
+
const Rn = (e) => typeof e == "function" && typeof e.getSymbol == "function";
|
|
834
|
+
function bn(e) {
|
|
835
|
+
const t = e[e.length - 1];
|
|
836
|
+
return t && typeof t.default == "function";
|
|
1215
837
|
}
|
|
1216
|
-
function
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
} else {
|
|
1226
|
-
if (url.pathname.endsWith("/")) {
|
|
1227
|
-
url.pathname = url.pathname.slice(0, -1);
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
const search = url.search.slice(1).replaceAll(/&?q(action|data|func)=[^&]+/g, "");
|
|
1231
|
-
return `${url.pathname}${search ? `?${search}` : ""}${url.hash}`;
|
|
838
|
+
function Z(e) {
|
|
839
|
+
e = new URL(e), e.pathname.endsWith(C) && (e.pathname = e.pathname.slice(0, -C.length)), globalThis.__NO_TRAILING_SLASH__ ? e.pathname.endsWith("/") && (e.pathname = e.pathname.slice(0, -1)) : e.pathname.endsWith("/") || (e.pathname += "/");
|
|
840
|
+
const t = e.search.slice(1).replaceAll(/&?q(action|data|func|loaders)=[^&]+/g, "");
|
|
841
|
+
return `${e.pathname}${t ? `?${t}` : ""}${e.hash}`;
|
|
842
|
+
}
|
|
843
|
+
const E = /* @__PURE__ */ new TextEncoder();
|
|
844
|
+
function An(e) {
|
|
845
|
+
ke(e, "lax-proto");
|
|
1232
846
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
847
|
+
function _n(e) {
|
|
848
|
+
ke(e);
|
|
849
|
+
}
|
|
850
|
+
function ke(e, t) {
|
|
851
|
+
if (Cn(
|
|
852
|
+
e.request.headers,
|
|
1237
853
|
"application/x-www-form-urlencoded",
|
|
1238
854
|
"multipart/form-data",
|
|
1239
855
|
"text/plain"
|
|
1240
|
-
)
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if (forbidden) {
|
|
1246
|
-
throw requestEv.error(
|
|
856
|
+
)) {
|
|
857
|
+
const r = e.request.headers.get("origin"), o = e.url.origin;
|
|
858
|
+
let i = r !== o;
|
|
859
|
+
if (i && t && r?.replace(/^http(s)?/g, "") === o.replace(/^http(s)?/g, "") && (i = !1), i)
|
|
860
|
+
throw e.error(
|
|
1247
861
|
403,
|
|
1248
|
-
`CSRF check failed. Cross-site ${
|
|
1249
|
-
The request origin "${
|
|
862
|
+
`CSRF check failed. Cross-site ${e.method} form submissions are forbidden.
|
|
863
|
+
The request origin "${r}" does not match the server origin "${o}".`
|
|
1250
864
|
);
|
|
1251
|
-
}
|
|
1252
865
|
}
|
|
1253
866
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return async (
|
|
1256
|
-
if (
|
|
1257
|
-
return;
|
|
1258
|
-
}
|
|
1259
|
-
const isPageDataReq = requestEv.sharedMap.has(IsQData);
|
|
1260
|
-
if (isPageDataReq) {
|
|
867
|
+
function Tn(e) {
|
|
868
|
+
return async (t) => {
|
|
869
|
+
if (t.headersSent || t.sharedMap.has(O))
|
|
1261
870
|
return;
|
|
1262
|
-
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
if (!responseHeaders.has("Content-Type")) {
|
|
1267
|
-
responseHeaders.set("Content-Type", "text/html; charset=utf-8");
|
|
1268
|
-
}
|
|
1269
|
-
const trailingSlash = getRequestTrailingSlash(requestEv);
|
|
1270
|
-
const { readable, writable } = new TextEncoderStream();
|
|
1271
|
-
const writableStream = requestEv.getWritableStream();
|
|
1272
|
-
const pipe = readable.pipeTo(writableStream, { preventClose: true });
|
|
1273
|
-
const stream = writable.getWriter();
|
|
1274
|
-
const status = requestEv.status();
|
|
871
|
+
t.request.headers.forEach((l, u) => l);
|
|
872
|
+
const r = t.headers;
|
|
873
|
+
r.has("Content-Type") || r.set("Content-Type", "text/html; charset=utf-8");
|
|
874
|
+
const { readable: o, writable: i } = new TextEncoderStream(), a = t.getWritableStream(), s = o.pipeTo(a, { preventClose: !0 }), c = i.getWriter(), f = t.status();
|
|
1275
875
|
try {
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
stream,
|
|
1281
|
-
serverData,
|
|
876
|
+
const l = P(t) === "static", u = un(t), h = await e({
|
|
877
|
+
base: t.basePathname + "build/",
|
|
878
|
+
stream: c,
|
|
879
|
+
serverData: u,
|
|
1282
880
|
containerAttributes: {
|
|
1283
|
-
|
|
1284
|
-
...
|
|
881
|
+
"q:render": l ? "static" : "",
|
|
882
|
+
...u.containerAttributes
|
|
1285
883
|
}
|
|
1286
|
-
})
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
href: getPathname(requestEv.url, trailingSlash)
|
|
884
|
+
}), y = {
|
|
885
|
+
loaders: U(t),
|
|
886
|
+
action: t.sharedMap.get(j),
|
|
887
|
+
status: f !== 200 ? f : 200,
|
|
888
|
+
href: Z(t.url)
|
|
1292
889
|
};
|
|
1293
|
-
|
|
1294
|
-
await stream.write(result.html);
|
|
1295
|
-
}
|
|
1296
|
-
requestEv.sharedMap.set("qData", qData);
|
|
890
|
+
typeof h.html == "string" && await c.write(h.html), t.sharedMap.set(Oe, y);
|
|
1297
891
|
} finally {
|
|
1298
|
-
await
|
|
1299
|
-
await stream.close();
|
|
1300
|
-
await pipe;
|
|
892
|
+
await c.ready, await c.close(), await s;
|
|
1301
893
|
}
|
|
1302
|
-
await
|
|
894
|
+
await a.close();
|
|
1303
895
|
};
|
|
1304
896
|
}
|
|
1305
|
-
async function
|
|
1306
|
-
|
|
1307
|
-
if (!isPageDataReq) {
|
|
897
|
+
async function Mn(e) {
|
|
898
|
+
if (!e.sharedMap.has(O))
|
|
1308
899
|
return;
|
|
1309
|
-
}
|
|
1310
900
|
try {
|
|
1311
|
-
await
|
|
1312
|
-
} catch (
|
|
1313
|
-
if (!(
|
|
1314
|
-
throw
|
|
1315
|
-
}
|
|
901
|
+
await e.next();
|
|
902
|
+
} catch (i) {
|
|
903
|
+
if (!(i instanceof H))
|
|
904
|
+
throw i;
|
|
1316
905
|
}
|
|
1317
|
-
if (
|
|
906
|
+
if (e.headersSent)
|
|
1318
907
|
return;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
const adaptedLocation = makeQDataPath(location);
|
|
1325
|
-
if (adaptedLocation) {
|
|
1326
|
-
requestEv.headers.set("Location", adaptedLocation);
|
|
1327
|
-
requestEv.getWritableStream().close();
|
|
908
|
+
const n = e.status(), r = e.headers.get("Location");
|
|
909
|
+
if (n >= 301 && n <= 308 && r) {
|
|
910
|
+
const i = xn(r);
|
|
911
|
+
if (i) {
|
|
912
|
+
e.headers.set("Location", i), e.getWritableStream().close();
|
|
1328
913
|
return;
|
|
1329
|
-
} else
|
|
1330
|
-
|
|
1331
|
-
requestEv.headers.delete("Location");
|
|
1332
|
-
}
|
|
914
|
+
} else
|
|
915
|
+
e.status(200), e.headers.delete("Location");
|
|
1333
916
|
}
|
|
1334
917
|
}
|
|
1335
|
-
async function
|
|
1336
|
-
|
|
1337
|
-
if (!isPageDataReq) {
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
await requestEv.next();
|
|
1341
|
-
if (requestEv.headersSent || requestEv.exited) {
|
|
918
|
+
async function Nn(e) {
|
|
919
|
+
if (!e.sharedMap.has(O) || (await e.next(), e.headersSent || e.exited))
|
|
1342
920
|
return;
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
921
|
+
const n = e.status(), r = e.headers.get("Location");
|
|
922
|
+
e.request.headers.forEach((l, u) => l), e.headers.set("Content-Type", "application/json; charset=utf-8");
|
|
923
|
+
let o = U(e);
|
|
924
|
+
const i = e.query.getAll(v), a = i.length > 0;
|
|
925
|
+
if (a) {
|
|
926
|
+
const l = {};
|
|
927
|
+
for (const u of i) {
|
|
928
|
+
const h = o[u];
|
|
929
|
+
l[u] = h;
|
|
930
|
+
}
|
|
931
|
+
o = l;
|
|
932
|
+
}
|
|
933
|
+
const s = a ? {
|
|
934
|
+
// send minimal data to the client
|
|
935
|
+
loaders: o,
|
|
936
|
+
status: n !== 200 ? n : 200,
|
|
937
|
+
href: Z(e.url)
|
|
938
|
+
} : {
|
|
939
|
+
loaders: o,
|
|
940
|
+
action: e.sharedMap.get(j),
|
|
941
|
+
status: n !== 200 ? n : 200,
|
|
942
|
+
href: Z(e.url),
|
|
943
|
+
redirect: r ?? void 0,
|
|
944
|
+
isRewrite: e.sharedMap.get(Le)
|
|
945
|
+
}, c = e.getWritableStream().getWriter(), f = await D([s]);
|
|
946
|
+
c.write(E.encode(f)), e.sharedMap.set(Oe, s), c.close();
|
|
1363
947
|
}
|
|
1364
|
-
function
|
|
1365
|
-
if (
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
return
|
|
1370
|
-
} else {
|
|
1371
|
-
return void 0;
|
|
1372
|
-
}
|
|
948
|
+
function xn(e) {
|
|
949
|
+
if (e.startsWith("/")) {
|
|
950
|
+
const t = C, n = new URL(e, "http://localhost");
|
|
951
|
+
return (n.pathname.endsWith("/") ? n.pathname.slice(0, -1) : n.pathname) + (t.startsWith("/") ? "" : "/") + t + n.search;
|
|
952
|
+
} else
|
|
953
|
+
return;
|
|
1373
954
|
}
|
|
1374
|
-
function
|
|
1375
|
-
return typeof performance
|
|
955
|
+
function me() {
|
|
956
|
+
return typeof performance < "u" ? performance.now() : 0;
|
|
1376
957
|
}
|
|
1377
|
-
async function
|
|
1378
|
-
const
|
|
958
|
+
async function G(e, t, n) {
|
|
959
|
+
const r = me();
|
|
1379
960
|
try {
|
|
1380
|
-
return await
|
|
961
|
+
return await n();
|
|
1381
962
|
} finally {
|
|
1382
|
-
const
|
|
1383
|
-
let
|
|
1384
|
-
|
|
1385
|
-
requestEv.sharedMap.set("@serverTiming", measurements = []);
|
|
1386
|
-
}
|
|
1387
|
-
measurements.push([name, duration]);
|
|
963
|
+
const o = me() - r;
|
|
964
|
+
let i = e.sharedMap.get(X);
|
|
965
|
+
i || e.sharedMap.set(X, i = []), i.push([t, o]);
|
|
1388
966
|
}
|
|
1389
967
|
}
|
|
1390
|
-
function
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
return types.includes(type);
|
|
968
|
+
function Cn(e, ...t) {
|
|
969
|
+
const n = e.get("content-type")?.split(/;/, 1)[0].trim() ?? "";
|
|
970
|
+
return t.includes(n);
|
|
1394
971
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
if (!
|
|
972
|
+
let J;
|
|
973
|
+
async function Wn(e, t) {
|
|
974
|
+
const { render: n, checkOrigin: r } = t;
|
|
975
|
+
let { qwikRouterConfig: o } = t;
|
|
976
|
+
if (o || (J || (J = await import("@qwik-router-config")), o = J), !o)
|
|
1400
977
|
throw new Error("qwikRouterConfig is required.");
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
serverRequestEv.request.method,
|
|
1408
|
-
checkOrigin ?? true,
|
|
1409
|
-
render
|
|
978
|
+
const i = e.url.pathname, a = fe(i), s = await ge(
|
|
979
|
+
o,
|
|
980
|
+
a,
|
|
981
|
+
e.request.method,
|
|
982
|
+
r ?? !0,
|
|
983
|
+
n
|
|
1410
984
|
);
|
|
1411
|
-
if (
|
|
1412
|
-
const [
|
|
1413
|
-
return
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
985
|
+
if (s) {
|
|
986
|
+
const [c, f] = s;
|
|
987
|
+
return an(
|
|
988
|
+
e,
|
|
989
|
+
c,
|
|
990
|
+
f,
|
|
991
|
+
async (u) => {
|
|
992
|
+
const h = fe(u.pathname), y = await ge(
|
|
993
|
+
o,
|
|
994
|
+
h,
|
|
995
|
+
e.request.method,
|
|
996
|
+
r ?? !0,
|
|
997
|
+
n
|
|
998
|
+
);
|
|
999
|
+
if (y) {
|
|
1000
|
+
const [w, R] = y;
|
|
1001
|
+
return { loadedRoute: w, requestHandlers: R };
|
|
1002
|
+
} else
|
|
1003
|
+
return { loadedRoute: null, requestHandlers: [] };
|
|
1004
|
+
},
|
|
1005
|
+
o.basePathname
|
|
1421
1006
|
);
|
|
1422
1007
|
}
|
|
1423
1008
|
return null;
|
|
1424
1009
|
}
|
|
1425
|
-
async function
|
|
1426
|
-
const { routes, serverPlugins, menus, cacheModules } =
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
checkOrigin,
|
|
1433
|
-
renderQwikMiddleware(renderFn)
|
|
1010
|
+
async function ge(e, t, n, r, o) {
|
|
1011
|
+
const { routes: i, serverPlugins: a, menus: s, cacheModules: c } = e, f = await Ke(i, s, c, t), l = hn(
|
|
1012
|
+
a,
|
|
1013
|
+
f,
|
|
1014
|
+
n,
|
|
1015
|
+
r,
|
|
1016
|
+
Tn(o)
|
|
1434
1017
|
);
|
|
1435
|
-
|
|
1436
|
-
|
|
1018
|
+
return l.length > 0 ? [f, l] : null;
|
|
1019
|
+
}
|
|
1020
|
+
const Pn = [
|
|
1021
|
+
// Will be replaced in post-build with the 404s generated by SSG
|
|
1022
|
+
"__QWIK_ROUTER_NOT_FOUND_ARRAY__"
|
|
1023
|
+
];
|
|
1024
|
+
function qn(e) {
|
|
1025
|
+
for (const [t, n] of Pn)
|
|
1026
|
+
if (e.startsWith(t))
|
|
1027
|
+
return n;
|
|
1028
|
+
return _e(404, "Resource Not Found");
|
|
1029
|
+
}
|
|
1030
|
+
const Y = /* @__PURE__ */ new Set(["__QWIK_ROUTER_STATIC_PATHS_ARRAY__"]);
|
|
1031
|
+
function kn(e, t) {
|
|
1032
|
+
if (e.toUpperCase() !== "GET")
|
|
1033
|
+
return !1;
|
|
1034
|
+
const n = t.pathname;
|
|
1035
|
+
if (n.startsWith("/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/") || n.startsWith("/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/") || Y.has(n))
|
|
1036
|
+
return !0;
|
|
1037
|
+
if (n.endsWith("/q-data.json")) {
|
|
1038
|
+
const r = n.replace(/\/q-data.json$/, "");
|
|
1039
|
+
if (Y.has(r + "/") || Y.has(r))
|
|
1040
|
+
return !0;
|
|
1041
|
+
}
|
|
1042
|
+
return !1;
|
|
1043
|
+
}
|
|
1044
|
+
class $n extends Error {
|
|
1045
|
+
constructor(t, n) {
|
|
1046
|
+
super(typeof n == "string" ? n : void 0), this.status = t, this.data = n;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
class $e {
|
|
1050
|
+
}
|
|
1051
|
+
class Dn extends $e {
|
|
1052
|
+
}
|
|
1053
|
+
class Fn extends $e {
|
|
1054
|
+
constructor(t) {
|
|
1055
|
+
super(), this.pathname = t;
|
|
1437
1056
|
}
|
|
1438
|
-
return null;
|
|
1439
1057
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
#
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
const highSurrogate = this.#pendingHighSurrogate;
|
|
1454
|
-
this.#pendingHighSurrogate = null;
|
|
1455
|
-
if (56320 <= codeUnit && codeUnit <= 57343) {
|
|
1456
|
-
finalChunk += highSurrogate + item;
|
|
1058
|
+
class Sn {
|
|
1059
|
+
#e = null;
|
|
1060
|
+
#n = new TextEncoder();
|
|
1061
|
+
#t = new TransformStream({
|
|
1062
|
+
transform: (t, n) => {
|
|
1063
|
+
t = String(t);
|
|
1064
|
+
let r = "";
|
|
1065
|
+
for (let o = 0; o < t.length; o++) {
|
|
1066
|
+
const i = t[o], a = i.charCodeAt(0);
|
|
1067
|
+
if (this.#e !== null) {
|
|
1068
|
+
const s = this.#e;
|
|
1069
|
+
if (this.#e = null, 56320 <= a && a <= 57343) {
|
|
1070
|
+
r += s + i;
|
|
1457
1071
|
continue;
|
|
1458
1072
|
}
|
|
1459
|
-
|
|
1073
|
+
r += "�";
|
|
1460
1074
|
}
|
|
1461
|
-
if (55296 <=
|
|
1462
|
-
this.#
|
|
1075
|
+
if (55296 <= a && a <= 56319) {
|
|
1076
|
+
this.#e = i;
|
|
1463
1077
|
continue;
|
|
1464
1078
|
}
|
|
1465
|
-
if (56320 <=
|
|
1466
|
-
|
|
1079
|
+
if (56320 <= a && a <= 57343) {
|
|
1080
|
+
r += "�";
|
|
1467
1081
|
continue;
|
|
1468
1082
|
}
|
|
1469
|
-
|
|
1470
|
-
}
|
|
1471
|
-
if (finalChunk) {
|
|
1472
|
-
controller.enqueue(this.#handle.encode(finalChunk));
|
|
1083
|
+
r += i;
|
|
1473
1084
|
}
|
|
1085
|
+
r && n.enqueue(this.#n.encode(r));
|
|
1474
1086
|
},
|
|
1475
|
-
flush: (
|
|
1476
|
-
|
|
1477
|
-
controller.enqueue(new Uint8Array([239, 191, 189]));
|
|
1478
|
-
}
|
|
1087
|
+
flush: (t) => {
|
|
1088
|
+
this.#e !== null && t.enqueue(new Uint8Array([239, 191, 189]));
|
|
1479
1089
|
}
|
|
1480
1090
|
});
|
|
1481
1091
|
get encoding() {
|
|
1482
|
-
return this.#
|
|
1092
|
+
return this.#n.encoding;
|
|
1483
1093
|
}
|
|
1484
1094
|
get readable() {
|
|
1485
|
-
return this.#
|
|
1095
|
+
return this.#t.readable;
|
|
1486
1096
|
}
|
|
1487
1097
|
get writable() {
|
|
1488
|
-
return this.#
|
|
1098
|
+
return this.#t.writable;
|
|
1489
1099
|
}
|
|
1490
1100
|
get [Symbol.toStringTag]() {
|
|
1491
1101
|
return "TextEncoderStream";
|
|
1492
1102
|
}
|
|
1493
|
-
}
|
|
1103
|
+
}
|
|
1494
1104
|
export {
|
|
1495
|
-
AbortMessage,
|
|
1496
|
-
RedirectMessage,
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1105
|
+
$e as AbortMessage,
|
|
1106
|
+
Dn as RedirectMessage,
|
|
1107
|
+
Oe as RequestEvShareQData,
|
|
1108
|
+
Fn as RewriteMessage,
|
|
1109
|
+
$n as ServerError,
|
|
1110
|
+
Sn as _TextEncoderStream_polyfill,
|
|
1111
|
+
K as getErrorHtml,
|
|
1112
|
+
qn as getNotFound,
|
|
1113
|
+
kn as isStaticPath,
|
|
1114
|
+
Un as mergeHeadersCookies,
|
|
1115
|
+
Wn as requestHandler
|
|
1502
1116
|
};
|