@qwik.dev/router 2.0.0-beta.10 → 2.0.0-beta.11
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/lib/adapters/azure-swa/vite/index.cjs +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +73 -69
- package/lib/adapters/bun-server/vite/index.cjs +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +77 -73
- package/lib/adapters/cloud-run/vite/index.cjs +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +104 -100
- package/lib/adapters/cloudflare-pages/vite/{index-DwovcBp3.js → index-Bg_9YkM5.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-C455V8_A.cjs → index-C1aDmh1S.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-CHT9Y93A.js +254 -0
- package/lib/adapters/cloudflare-pages/vite/{index-DKcVHRBy.cjs → index-Ck7KvpK1.cjs} +1 -1
- package/lib/adapters/cloudflare-pages/vite/{index-D3HITboM.js → index-Cp1cjAds.js} +1 -1
- package/lib/adapters/cloudflare-pages/vite/index-D9RL9dvJ.cjs +5 -0
- package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -1
- package/lib/adapters/cloudflare-pages/vite/index.mjs +1 -1
- package/lib/adapters/deno-server/vite/index.cjs +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +81 -77
- package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
- package/lib/adapters/netlify-edge/vite/index.mjs +119 -115
- package/lib/adapters/node-server/vite/index.cjs +2 -2
- package/lib/adapters/node-server/vite/index.mjs +78 -74
- package/lib/adapters/shared/vite/index.cjs +2 -2
- package/lib/adapters/shared/vite/index.mjs +108 -104
- package/lib/adapters/ssg/vite/index.cjs +2 -2
- package/lib/adapters/ssg/vite/index.mjs +100 -96
- package/lib/adapters/vercel-edge/vite/index.cjs +2 -2
- package/lib/adapters/vercel-edge/vite/index.mjs +114 -110
- package/lib/index.qwik.cjs +39 -33
- package/lib/index.qwik.mjs +39 -33
- package/lib/middleware/request-handler/index.cjs +8 -8
- package/lib/middleware/request-handler/index.mjs +598 -587
- package/lib/vite/index.cjs +17 -17
- package/lib/vite/index.d.ts +3 -3
- package/lib/vite/index.mjs +242 -230
- package/package.json +4 -4
- package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
- package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
|
@@ -1,164 +1,167 @@
|
|
|
1
|
-
import { _serialize as
|
|
1
|
+
import { _serialize as q, _UNINITIALIZED as ye, _deserialize as te, _verifySerializable as Qe } from "@qwik.dev/core/internal";
|
|
2
2
|
import "@qwik.dev/core";
|
|
3
|
-
import { ServerError as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return Re(e,
|
|
3
|
+
import { ServerError as D, RedirectMessage as H, RewriteMessage as we, AbortMessage as pe } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
+
const re = /* @__PURE__ */ new WeakMap(), ie = "qaction", J = "qloaders", Ee = "qfunc", oe = "qdata", je = "q:route";
|
|
5
|
+
function ze(e, n) {
|
|
6
|
+
const t = ce(e), r = ae(e), i = ce(n), o = ae(n);
|
|
7
|
+
return Re(e, t, r, n, i, o);
|
|
8
8
|
}
|
|
9
|
-
function Re(e,
|
|
9
|
+
function Re(e, n, t, r, i, o) {
|
|
10
10
|
if (r.startsWith("/build/"))
|
|
11
11
|
return null;
|
|
12
12
|
let a = null;
|
|
13
|
-
for (;
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
13
|
+
for (; n < t; ) {
|
|
14
|
+
const c = e.charCodeAt(n++), s = r.charCodeAt(i++);
|
|
15
|
+
if (c === 91) {
|
|
16
|
+
const l = be(e, n), f = n + (l ? 3 : 0), u = z(
|
|
17
17
|
e,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
f,
|
|
19
|
+
t,
|
|
20
20
|
93
|
|
21
21
|
/* CLOSE_BRACKET */
|
|
22
|
-
),
|
|
22
|
+
), m = e.substring(f, u), p = z(
|
|
23
23
|
e,
|
|
24
24
|
u + 1,
|
|
25
|
-
|
|
25
|
+
t,
|
|
26
26
|
47
|
|
27
27
|
/* SLASH */
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
), g = e.substring(u + 1, p);
|
|
29
|
+
n = u + 1;
|
|
30
|
+
const w = i - 1;
|
|
31
|
+
if (l) {
|
|
32
|
+
const R = Be(
|
|
33
|
+
m,
|
|
34
|
+
g,
|
|
35
35
|
r,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
w,
|
|
37
|
+
o,
|
|
38
38
|
e,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
n + g.length + 1,
|
|
40
|
+
t
|
|
41
41
|
);
|
|
42
|
-
if (
|
|
43
|
-
return Object.assign(a || (a = {}),
|
|
42
|
+
if (R)
|
|
43
|
+
return Object.assign(a || (a = {}), R);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
45
|
+
const b = z(r, w, o, 47, g);
|
|
46
|
+
if (b == -1)
|
|
47
47
|
return null;
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
const M = r.substring(w, b);
|
|
49
|
+
if (!l && !g && !M)
|
|
50
50
|
return null;
|
|
51
|
-
|
|
52
|
-
} else if (
|
|
51
|
+
i = b, (a || (a = {}))[m] = decodeURIComponent(M);
|
|
52
|
+
} else if (c !== s && !(isNaN(s) && Ge(e, n)))
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return se(e, n) && se(r, i) ? a || {} : null;
|
|
56
56
|
}
|
|
57
|
-
function Ge(e,
|
|
58
|
-
return e.charCodeAt(
|
|
57
|
+
function Ge(e, n) {
|
|
58
|
+
return e.charCodeAt(n) === 91 && be(e, n + 1);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const t = e.length;
|
|
62
|
-
return t > 1 && e.charCodeAt(t - 1) === 47 ? t - 1 : t;
|
|
63
|
-
}
|
|
64
|
-
function oe(e, t) {
|
|
60
|
+
function ae(e) {
|
|
65
61
|
const n = e.length;
|
|
66
|
-
return
|
|
62
|
+
return n > 1 && e.charCodeAt(n - 1) === 47 ? n - 1 : n;
|
|
67
63
|
}
|
|
68
|
-
function
|
|
64
|
+
function se(e, n) {
|
|
65
|
+
const t = e.length;
|
|
66
|
+
return n >= t || n == t - 1 && e.charCodeAt(n) === 47;
|
|
67
|
+
}
|
|
68
|
+
function ce(e) {
|
|
69
69
|
return e.charCodeAt(0) === 47 ? 1 : 0;
|
|
70
70
|
}
|
|
71
|
-
function be(e,
|
|
72
|
-
return e.charCodeAt(
|
|
71
|
+
function be(e, n) {
|
|
72
|
+
return e.charCodeAt(n) === 46 && e.charCodeAt(n + 1) === 46 && e.charCodeAt(n + 2) === 46;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
for (;
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
for (let a = 0; a <
|
|
79
|
-
if (e.charCodeAt(
|
|
74
|
+
function z(e, n, t, r, i = "") {
|
|
75
|
+
for (; n < t && e.charCodeAt(n) !== r; )
|
|
76
|
+
n++;
|
|
77
|
+
const o = i.length;
|
|
78
|
+
for (let a = 0; a < o; a++)
|
|
79
|
+
if (e.charCodeAt(n - o + a) !== i.charCodeAt(a))
|
|
80
80
|
return -1;
|
|
81
|
-
return
|
|
81
|
+
return n - o;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
for (;
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
let
|
|
91
|
-
return
|
|
83
|
+
function Be(e, n, t, r, i, o, a, c) {
|
|
84
|
+
t.charCodeAt(r) === 47 && r++;
|
|
85
|
+
let s = i;
|
|
86
|
+
const l = n + "/";
|
|
87
|
+
for (; s >= r; ) {
|
|
88
|
+
const f = Re(o, a, c, t, s, i);
|
|
89
|
+
if (f) {
|
|
90
|
+
let m = t.substring(r, Math.min(s, i));
|
|
91
|
+
return m.endsWith(l) && (m = m.substring(0, m.length - l.length)), f[e] = decodeURIComponent(m), f;
|
|
92
92
|
}
|
|
93
|
-
const u =
|
|
94
|
-
if (
|
|
93
|
+
const u = Ke(t, r, l, s, r - 1) + l.length;
|
|
94
|
+
if (s === u)
|
|
95
95
|
break;
|
|
96
|
-
|
|
96
|
+
s = u;
|
|
97
97
|
}
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
let
|
|
102
|
-
return
|
|
100
|
+
function Ke(e, n, t, r, i) {
|
|
101
|
+
let o = e.lastIndexOf(t, r);
|
|
102
|
+
return o == r - t.length && (o = e.lastIndexOf(t, r - t.length - 1)), o > n ? o : i;
|
|
103
103
|
}
|
|
104
|
-
var
|
|
105
|
-
const Ae = (e) => e == null ? e : (Object.getOwnPropertyNames(e).forEach((
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
}), Object.freeze(e)),
|
|
104
|
+
var W = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Loaders = 1] = "Loaders", e[e.OriginalPathname = 2] = "OriginalPathname", e[e.RouteBundleNames = 3] = "RouteBundleNames", e))(W || {}), $ = /* @__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((n) => {
|
|
106
|
+
const t = e[n];
|
|
107
|
+
t && typeof t == "object" && !Object.isFrozen(t) && Ae(t);
|
|
108
|
+
}), Object.freeze(e)), ve = async (e, n, t, r, i) => {
|
|
109
109
|
if (!Array.isArray(e))
|
|
110
110
|
return null;
|
|
111
111
|
for (const o of e) {
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
112
|
+
const a = o[W.RouteName], c = ze(a, r);
|
|
113
|
+
if (!c)
|
|
114
114
|
continue;
|
|
115
|
-
const s = o[
|
|
116
|
-
s.forEach((
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(
|
|
121
|
-
|
|
115
|
+
const s = o[W.Loaders], l = o[W.RouteBundleNames], f = new Array(s.length), u = [];
|
|
116
|
+
s.forEach((p, g) => {
|
|
117
|
+
le(
|
|
118
|
+
p,
|
|
119
|
+
u,
|
|
120
|
+
(w) => f[g] = w,
|
|
121
|
+
t
|
|
122
122
|
);
|
|
123
123
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
let m;
|
|
125
|
+
if (!i) {
|
|
126
|
+
const p = Je(n, r);
|
|
127
|
+
le(
|
|
128
|
+
p,
|
|
129
|
+
u,
|
|
130
|
+
(g) => m = g?.default,
|
|
131
|
+
t
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return u.length > 0 && await Promise.all(u), [a, c, f, Ae(m), l];
|
|
132
135
|
}
|
|
133
136
|
return null;
|
|
134
|
-
},
|
|
137
|
+
}, le = (e, n, t, r) => {
|
|
135
138
|
if (typeof e == "function") {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
+
const i = re.get(e);
|
|
140
|
+
if (i)
|
|
141
|
+
t(i);
|
|
139
142
|
else {
|
|
140
|
-
const
|
|
141
|
-
typeof
|
|
142
|
-
|
|
143
|
-
r !== !1 &&
|
|
143
|
+
const o = e();
|
|
144
|
+
typeof o.then == "function" ? n.push(
|
|
145
|
+
o.then((a) => {
|
|
146
|
+
r !== !1 && re.set(e, a), t(a);
|
|
144
147
|
})
|
|
145
|
-
) :
|
|
148
|
+
) : o && t(o);
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
|
-
}, Je = (e,
|
|
151
|
+
}, Je = (e, n) => {
|
|
149
152
|
if (e) {
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
(r) => r[$.Pathname] ===
|
|
153
|
+
n = n.endsWith("/") ? n : n + "/";
|
|
154
|
+
const t = e.find(
|
|
155
|
+
(r) => r[$.Pathname] === n || n.startsWith(r[$.Pathname])
|
|
153
156
|
);
|
|
154
|
-
if (
|
|
155
|
-
return
|
|
157
|
+
if (t)
|
|
158
|
+
return t[$.MenuLoader];
|
|
156
159
|
}
|
|
157
160
|
};
|
|
158
|
-
var
|
|
161
|
+
var Y = /* @__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))(Y || {});
|
|
159
162
|
const Ye = (e) => e && typeof e.then == "function";
|
|
160
|
-
function
|
|
161
|
-
const
|
|
163
|
+
function Ve(e) {
|
|
164
|
+
const n = [];
|
|
162
165
|
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
166
|
private: !0,
|
|
164
167
|
noCache: !0
|
|
@@ -171,64 +174,64 @@ function ve(e) {
|
|
|
171
174
|
}), typeof e == "number" && (e = {
|
|
172
175
|
maxAge: e,
|
|
173
176
|
sMaxAge: e
|
|
174
|
-
}), e.immutable &&
|
|
177
|
+
}), e.immutable && n.push("immutable"), e.maxAge && n.push(`max-age=${e.maxAge}`), e.sMaxAge && n.push(`s-maxage=${e.sMaxAge}`), e.noStore && n.push("no-store"), e.noCache && n.push("no-cache"), e.private && n.push("private"), e.public && n.push("public"), e.staleWhileRevalidate && n.push(`stale-while-revalidate=${e.staleWhileRevalidate}`), e.staleIfError && n.push(`stale-if-error=${e.staleIfError}`), n.join(", ");
|
|
175
178
|
}
|
|
176
|
-
const
|
|
179
|
+
const Xe = {
|
|
177
180
|
lax: "Lax",
|
|
178
181
|
Lax: "Lax",
|
|
179
182
|
None: "None",
|
|
180
183
|
none: "None",
|
|
181
184
|
strict: "Strict",
|
|
182
185
|
Strict: "Strict"
|
|
183
|
-
},
|
|
186
|
+
}, Ze = {
|
|
184
187
|
seconds: 1,
|
|
185
188
|
minutes: 60,
|
|
186
189
|
hours: 3600,
|
|
187
190
|
days: 3600 * 24,
|
|
188
191
|
weeks: 3600 * 24 * 7
|
|
189
|
-
},
|
|
190
|
-
const r = [`${e}=${
|
|
191
|
-
typeof
|
|
192
|
-
const
|
|
193
|
-
return
|
|
192
|
+
}, de = (e, n, t) => {
|
|
193
|
+
const r = [`${e}=${n}`];
|
|
194
|
+
typeof t.domain == "string" && r.push(`Domain=${t.domain}`), typeof t.maxAge == "number" ? r.push(`Max-Age=${t.maxAge}`) : Array.isArray(t.maxAge) ? r.push(`Max-Age=${t.maxAge[0] * Ze[t.maxAge[1]]}`) : typeof t.expires == "number" || typeof t.expires == "string" ? r.push(`Expires=${t.expires}`) : t.expires instanceof Date && r.push(`Expires=${t.expires.toUTCString()}`), t.httpOnly && r.push("HttpOnly"), typeof t.path == "string" && r.push(`Path=${t.path}`);
|
|
195
|
+
const i = en(t.sameSite);
|
|
196
|
+
return i && r.push(`SameSite=${i}`), t.secure && r.push("Secure"), r.join("; ");
|
|
194
197
|
};
|
|
195
|
-
function
|
|
198
|
+
function fe(e) {
|
|
196
199
|
try {
|
|
197
200
|
return decodeURIComponent(e);
|
|
198
201
|
} catch {
|
|
199
202
|
return e;
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
|
-
const
|
|
203
|
-
const
|
|
205
|
+
const He = (e) => {
|
|
206
|
+
const n = {};
|
|
204
207
|
if (typeof e == "string" && e !== "") {
|
|
205
|
-
const
|
|
206
|
-
for (const r of
|
|
207
|
-
const
|
|
208
|
-
|
|
208
|
+
const t = e.split(";");
|
|
209
|
+
for (const r of t) {
|
|
210
|
+
const i = r.indexOf("=");
|
|
211
|
+
i !== -1 && (n[fe(r.slice(0, i).trim())] = fe(r.slice(i + 1).trim()));
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
|
-
return
|
|
214
|
+
return n;
|
|
212
215
|
};
|
|
213
|
-
function
|
|
216
|
+
function en(e) {
|
|
214
217
|
if (e === !0)
|
|
215
218
|
return "Strict";
|
|
216
219
|
if (e === !1)
|
|
217
220
|
return "None";
|
|
218
221
|
if (e)
|
|
219
|
-
return
|
|
222
|
+
return Xe[e];
|
|
220
223
|
}
|
|
221
|
-
const x = Symbol("request-cookies"),
|
|
222
|
-
class
|
|
224
|
+
const x = Symbol("request-cookies"), k = Symbol("response-cookies"), T = Symbol("live-cookies");
|
|
225
|
+
class nn {
|
|
223
226
|
[x];
|
|
224
|
-
[
|
|
225
|
-
[
|
|
227
|
+
[k] = {};
|
|
228
|
+
[T] = {};
|
|
226
229
|
appendCounter = 0;
|
|
227
|
-
constructor(
|
|
228
|
-
this[x] =
|
|
230
|
+
constructor(n) {
|
|
231
|
+
this[x] = He(n), this[T] = { ...this[x] };
|
|
229
232
|
}
|
|
230
|
-
get(
|
|
231
|
-
const r = this[
|
|
233
|
+
get(n, t = !0) {
|
|
234
|
+
const r = this[t ? T : x][n];
|
|
232
235
|
return r ? {
|
|
233
236
|
value: r,
|
|
234
237
|
json() {
|
|
@@ -239,71 +242,71 @@ class en {
|
|
|
239
242
|
}
|
|
240
243
|
} : null;
|
|
241
244
|
}
|
|
242
|
-
getAll(
|
|
243
|
-
return Object.keys(this[
|
|
244
|
-
(
|
|
245
|
+
getAll(n = !0) {
|
|
246
|
+
return Object.keys(this[n ? T : x]).reduce(
|
|
247
|
+
(t, r) => (t[r] = this.get(r), t),
|
|
245
248
|
{}
|
|
246
249
|
);
|
|
247
250
|
}
|
|
248
|
-
has(
|
|
249
|
-
return !!this[
|
|
251
|
+
has(n, t = !0) {
|
|
252
|
+
return !!this[t ? T : x][n];
|
|
250
253
|
}
|
|
251
|
-
set(
|
|
252
|
-
this[
|
|
253
|
-
const
|
|
254
|
-
this[
|
|
254
|
+
set(n, t, r = {}) {
|
|
255
|
+
this[T][n] = typeof t == "string" ? t : JSON.stringify(t);
|
|
256
|
+
const i = typeof t == "string" ? t : encodeURIComponent(JSON.stringify(t));
|
|
257
|
+
this[k][n] = de(n, i, r);
|
|
255
258
|
}
|
|
256
|
-
append(
|
|
257
|
-
this[
|
|
258
|
-
const
|
|
259
|
-
this[
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
append(n, t, r = {}) {
|
|
260
|
+
this[T][n] = typeof t == "string" ? t : JSON.stringify(t);
|
|
261
|
+
const i = typeof t == "string" ? t : encodeURIComponent(JSON.stringify(t));
|
|
262
|
+
this[k][++this.appendCounter] = de(
|
|
263
|
+
n,
|
|
264
|
+
i,
|
|
262
265
|
r
|
|
263
266
|
);
|
|
264
267
|
}
|
|
265
|
-
delete(
|
|
266
|
-
this.set(
|
|
268
|
+
delete(n, t) {
|
|
269
|
+
this.set(n, "deleted", { ...t, maxAge: 0 }), this[T][n] = null;
|
|
267
270
|
}
|
|
268
271
|
headers() {
|
|
269
|
-
return Object.values(this[
|
|
272
|
+
return Object.values(this[k]);
|
|
270
273
|
}
|
|
271
274
|
}
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
+
const kn = (e, n) => {
|
|
276
|
+
const t = n.headers();
|
|
277
|
+
if (t.length > 0) {
|
|
275
278
|
const r = new Headers(e);
|
|
276
|
-
for (const
|
|
277
|
-
r.append("Set-Cookie",
|
|
279
|
+
for (const i of t)
|
|
280
|
+
r.append("Set-Cookie", i);
|
|
278
281
|
return r;
|
|
279
282
|
}
|
|
280
283
|
return e;
|
|
281
284
|
};
|
|
282
|
-
function
|
|
283
|
-
let
|
|
284
|
-
return
|
|
285
|
+
function G(e, n) {
|
|
286
|
+
let t = "Server Error";
|
|
287
|
+
return n != null && (typeof n.message == "string" ? t = n.message : t = String(n)), "<html>" + _e(e, t) + "</html>";
|
|
285
288
|
}
|
|
286
|
-
function _e(e,
|
|
287
|
-
typeof e != "number" && (e = 500), typeof
|
|
288
|
-
const
|
|
289
|
+
function _e(e, n) {
|
|
290
|
+
typeof e != "number" && (e = 500), typeof n == "string" ? n = rn(n) : n = "";
|
|
291
|
+
const t = typeof n == "string" ? "600px" : "300px", r = e >= 500 ? an : on;
|
|
289
292
|
return `
|
|
290
293
|
<head>
|
|
291
294
|
<meta charset="utf-8">
|
|
292
295
|
<meta http-equiv="Status" content="${e}">
|
|
293
|
-
<title>${e} ${
|
|
296
|
+
<title>${e} ${n}</title>
|
|
294
297
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
295
298
|
<style>
|
|
296
299
|
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: ${
|
|
300
|
+
p { max-width: ${t}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${r}; overflow: hidden; }
|
|
298
301
|
strong { display: inline-block; padding: 15px; background: ${r}; color: white; }
|
|
299
302
|
span { display: inline-block; padding: 15px; }
|
|
300
303
|
</style>
|
|
301
304
|
</head>
|
|
302
|
-
<body><p><strong>${e}</strong> <span>${
|
|
305
|
+
<body><p><strong>${e}</strong> <span>${n}</span></p></body>
|
|
303
306
|
`;
|
|
304
307
|
}
|
|
305
|
-
const
|
|
306
|
-
switch (
|
|
308
|
+
const tn = /[&<>]/g, rn = (e) => e.replace(tn, (n) => {
|
|
309
|
+
switch (n) {
|
|
307
310
|
case "&":
|
|
308
311
|
return "&";
|
|
309
312
|
case "<":
|
|
@@ -313,146 +316,147 @@ const nn = /[&<>]/g, tn = (e) => e.replace(nn, (t) => {
|
|
|
313
316
|
default:
|
|
314
317
|
return "";
|
|
315
318
|
}
|
|
316
|
-
}),
|
|
317
|
-
let
|
|
319
|
+
}), on = "#006ce9", an = "#713fc2";
|
|
320
|
+
let F;
|
|
318
321
|
import("node:async_hooks").then((e) => {
|
|
319
|
-
const
|
|
320
|
-
|
|
322
|
+
const n = e.AsyncLocalStorage;
|
|
323
|
+
F = new n(), globalThis.qcAsyncRequestStore = F;
|
|
321
324
|
}).catch((e) => {
|
|
322
325
|
console.warn(
|
|
323
326
|
"AsyncLocalStorage not available, continuing without it. This might impact concurrent server calls.",
|
|
324
327
|
e
|
|
325
328
|
);
|
|
326
329
|
});
|
|
327
|
-
function
|
|
328
|
-
let
|
|
329
|
-
const a = new Promise((
|
|
330
|
+
function sn(e, n, t, r, i = "/") {
|
|
331
|
+
let o;
|
|
332
|
+
const a = new Promise((s) => o = s), c = ln(
|
|
330
333
|
e,
|
|
331
|
-
t,
|
|
332
334
|
n,
|
|
333
|
-
|
|
334
|
-
i
|
|
335
|
+
t,
|
|
336
|
+
i,
|
|
337
|
+
o
|
|
335
338
|
);
|
|
336
339
|
return {
|
|
337
340
|
response: a,
|
|
338
|
-
requestEv:
|
|
339
|
-
completion:
|
|
341
|
+
requestEv: c,
|
|
342
|
+
completion: F ? F.run(c, ue, c, r, o) : ue(c, r, o)
|
|
340
343
|
};
|
|
341
344
|
}
|
|
342
|
-
async function
|
|
345
|
+
async function ue(e, n, t) {
|
|
343
346
|
try {
|
|
344
347
|
((a) => new URL(a.pathname + a.search, a))(e.originalUrl);
|
|
345
348
|
} catch {
|
|
346
349
|
const a = "Resource Not Found";
|
|
347
350
|
e.status(404);
|
|
348
|
-
const
|
|
349
|
-
return e.html(404,
|
|
351
|
+
const c = G(404, a);
|
|
352
|
+
return e.html(404, c), new D(404, a);
|
|
350
353
|
}
|
|
351
354
|
let r = 1;
|
|
352
|
-
async function
|
|
355
|
+
async function i() {
|
|
353
356
|
try {
|
|
354
357
|
await e.next();
|
|
355
|
-
} catch (
|
|
356
|
-
if (
|
|
358
|
+
} catch (o) {
|
|
359
|
+
if (o instanceof H)
|
|
357
360
|
await e.getWritableStream().close();
|
|
358
|
-
else if (
|
|
361
|
+
else if (o instanceof we) {
|
|
359
362
|
if (r > 50)
|
|
360
363
|
throw new Error("Infinite rewrite loop");
|
|
361
364
|
r += 1;
|
|
362
365
|
const a = new URL(e.url);
|
|
363
|
-
a.pathname =
|
|
364
|
-
const { loadedRoute:
|
|
365
|
-
return e.resetRoute(
|
|
366
|
-
} else if (
|
|
366
|
+
a.pathname = o.pathname;
|
|
367
|
+
const { loadedRoute: c, requestHandlers: s } = await n(a);
|
|
368
|
+
return e.resetRoute(c, s, a), await i();
|
|
369
|
+
} else if (o instanceof D) {
|
|
367
370
|
if (!e.headersSent) {
|
|
368
|
-
const a =
|
|
369
|
-
if (
|
|
370
|
-
e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await
|
|
371
|
+
const a = o.status, c = e.request.headers.get("Accept");
|
|
372
|
+
if (c && !c.includes("text/html"))
|
|
373
|
+
e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await q([o.data]));
|
|
371
374
|
else {
|
|
372
|
-
const
|
|
373
|
-
e.html(a,
|
|
375
|
+
const s = G(o.status, o.data);
|
|
376
|
+
e.html(a, s);
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
|
-
} else if (!(
|
|
377
|
-
if (
|
|
379
|
+
} else if (!(o instanceof pe)) {
|
|
380
|
+
if (I(e) !== "dev")
|
|
378
381
|
try {
|
|
379
382
|
e.headersSent || (e.headers.set("content-type", "text/html; charset=utf-8"), e.cacheControl({ noCache: !0 }), e.status(500));
|
|
380
383
|
const a = e.getWritableStream();
|
|
381
384
|
if (!a.locked) {
|
|
382
|
-
const
|
|
383
|
-
await
|
|
385
|
+
const c = a.getWriter();
|
|
386
|
+
await c.write(E.encode(G(500, "Internal Server Error"))), await c.close();
|
|
384
387
|
}
|
|
385
388
|
} catch {
|
|
386
389
|
console.error("Unable to render error page");
|
|
387
390
|
}
|
|
388
|
-
return
|
|
391
|
+
return o;
|
|
389
392
|
}
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
395
|
try {
|
|
393
|
-
return await
|
|
396
|
+
return await i();
|
|
394
397
|
} finally {
|
|
395
|
-
e.isDirty() ||
|
|
398
|
+
e.isDirty() || t(null);
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
function V(e) {
|
|
402
|
+
const n = e.endsWith(C);
|
|
403
|
+
if (n) {
|
|
404
|
+
const t = e.length - C.length + (globalThis.__NO_TRAILING_SLASH__ ? 0 : 1);
|
|
401
405
|
e = e.slice(0, t), e === "" && (e = "/");
|
|
402
406
|
}
|
|
403
|
-
return e;
|
|
407
|
+
return { pathname: e, isInternal: n };
|
|
404
408
|
}
|
|
405
|
-
const
|
|
409
|
+
const ee = "@isQData", C = "/q-data.json", Te = Symbol("RequestEvLoaders"), Me = Symbol("RequestEvMode"), Ne = Symbol("RequestEvRoute"), xe = Symbol(
|
|
406
410
|
"RequestEvLoaderSerializationStrategyMap"
|
|
407
|
-
),
|
|
408
|
-
function
|
|
409
|
-
const { request:
|
|
410
|
-
|
|
411
|
-
let
|
|
412
|
-
const
|
|
413
|
-
for (
|
|
414
|
-
const d =
|
|
415
|
-
Ye(
|
|
411
|
+
), Ce = "@routeName", Q = "@actionId", Ie = "@actionFormData", cn = "@nonce", Pe = "@rewrite", X = "@serverTiming", Le = "qData";
|
|
412
|
+
function ln(e, n, t, r, i) {
|
|
413
|
+
const { request: o, platform: a, env: c } = e, s = /* @__PURE__ */ new Map(), l = new nn(o.headers.get("cookie")), f = new Headers(), u = new URL(o.url), { pathname: m, isInternal: p } = V(u.pathname);
|
|
414
|
+
p && (u.pathname = m, s.set(ee, !0));
|
|
415
|
+
let g = -1, w = null, b, M = e.locale, R = 200;
|
|
416
|
+
const qe = async () => {
|
|
417
|
+
for (g++; g < t.length; ) {
|
|
418
|
+
const d = t[g], h = d(A);
|
|
419
|
+
Ye(h) && await h, g++;
|
|
416
420
|
}
|
|
417
|
-
},
|
|
418
|
-
|
|
421
|
+
}, De = (d, h, y = u) => {
|
|
422
|
+
n = d, t = h, u.pathname = y.pathname, u.search = y.search, g = -1;
|
|
419
423
|
}, N = () => {
|
|
420
|
-
if (
|
|
424
|
+
if (w !== null)
|
|
421
425
|
throw new Error("Response already sent");
|
|
422
|
-
},
|
|
426
|
+
}, U = (d, h) => {
|
|
423
427
|
if (N(), typeof d == "number") {
|
|
424
|
-
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
} else if (
|
|
428
|
-
|
|
429
|
-
}), d.headers.getSetCookie().forEach((
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
428
|
+
R = d;
|
|
429
|
+
const _ = A.getWritableStream().getWriter();
|
|
430
|
+
_.write(typeof h == "string" ? E.encode(h) : h), _.close();
|
|
431
|
+
} else if (R = d.status, d.headers.forEach((y, _) => {
|
|
432
|
+
_.toLowerCase() !== "set-cookie" && f.append(_, y);
|
|
433
|
+
}), d.headers.getSetCookie().forEach((y) => {
|
|
434
|
+
const _ = y.indexOf("=");
|
|
435
|
+
if (_ === -1)
|
|
432
436
|
return;
|
|
433
|
-
const
|
|
434
|
-
|
|
437
|
+
const Fe = y.slice(0, _).trim(), Se = y.slice(_ + 1).trim();
|
|
438
|
+
l.set(Fe, Se);
|
|
435
439
|
}), d.body) {
|
|
436
|
-
const
|
|
437
|
-
d.body.pipeTo(
|
|
440
|
+
const y = A.getWritableStream();
|
|
441
|
+
d.body.pipeTo(y);
|
|
438
442
|
} else
|
|
439
|
-
|
|
440
|
-
return
|
|
441
|
-
},
|
|
442
|
-
[
|
|
443
|
-
[
|
|
444
|
-
[
|
|
445
|
-
get [
|
|
446
|
-
return
|
|
443
|
+
A.getWritableStream().getWriter().close();
|
|
444
|
+
return ne();
|
|
445
|
+
}, ne = () => (g = B, new pe()), P = {}, A = {
|
|
446
|
+
[Te]: P,
|
|
447
|
+
[xe]: /* @__PURE__ */ new Map(),
|
|
448
|
+
[Me]: e.mode,
|
|
449
|
+
get [Ne]() {
|
|
450
|
+
return n;
|
|
447
451
|
},
|
|
448
|
-
cookie:
|
|
449
|
-
headers:
|
|
450
|
-
env:
|
|
451
|
-
method:
|
|
452
|
-
signal:
|
|
452
|
+
cookie: l,
|
|
453
|
+
headers: f,
|
|
454
|
+
env: c,
|
|
455
|
+
method: o.method,
|
|
456
|
+
signal: o.signal,
|
|
453
457
|
originalUrl: new URL(u),
|
|
454
458
|
get params() {
|
|
455
|
-
return
|
|
459
|
+
return n?.[L.Params] ?? {};
|
|
456
460
|
},
|
|
457
461
|
get pathname() {
|
|
458
462
|
return u.pathname;
|
|
@@ -461,348 +465,351 @@ function cn(e, t, n, r, o) {
|
|
|
461
465
|
get query() {
|
|
462
466
|
return u.searchParams;
|
|
463
467
|
},
|
|
464
|
-
request:
|
|
468
|
+
request: o,
|
|
465
469
|
url: u,
|
|
466
470
|
basePathname: r,
|
|
467
|
-
sharedMap:
|
|
471
|
+
sharedMap: s,
|
|
468
472
|
get headersSent() {
|
|
469
|
-
return
|
|
473
|
+
return w !== null;
|
|
470
474
|
},
|
|
471
475
|
get exited() {
|
|
472
|
-
return
|
|
476
|
+
return g >= B;
|
|
473
477
|
},
|
|
474
478
|
get clientConn() {
|
|
475
479
|
return e.getClientConn();
|
|
476
480
|
},
|
|
477
|
-
next:
|
|
478
|
-
resetRoute:
|
|
479
|
-
exit:
|
|
480
|
-
cacheControl: (d,
|
|
481
|
-
N(),
|
|
481
|
+
next: qe,
|
|
482
|
+
resetRoute: De,
|
|
483
|
+
exit: ne,
|
|
484
|
+
cacheControl: (d, h = "Cache-Control") => {
|
|
485
|
+
N(), f.set(h, Ve(d));
|
|
482
486
|
},
|
|
483
487
|
resolveValue: (async (d) => {
|
|
484
|
-
const
|
|
488
|
+
const h = d.__id;
|
|
485
489
|
if (d.__brand === "server_loader") {
|
|
486
|
-
if (!(
|
|
490
|
+
if (!(h in P))
|
|
487
491
|
throw new Error(
|
|
488
492
|
"You can not get the returned data of a loader that has not been executed for this request."
|
|
489
493
|
);
|
|
490
|
-
if (
|
|
491
|
-
const
|
|
492
|
-
await
|
|
494
|
+
if (P[h] === ye) {
|
|
495
|
+
const y = I(A) === "dev";
|
|
496
|
+
await Ue(d, P, A, y);
|
|
493
497
|
}
|
|
494
498
|
}
|
|
495
|
-
return
|
|
499
|
+
return P[h];
|
|
496
500
|
}),
|
|
497
|
-
status: (d) => typeof d == "number" ? (N(),
|
|
498
|
-
locale: (d) => (typeof d == "string" && (
|
|
499
|
-
error: (d,
|
|
500
|
-
redirect: (d,
|
|
501
|
-
if (N(),
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
status: (d) => typeof d == "number" ? (N(), R = d, d) : R,
|
|
502
|
+
locale: (d) => (typeof d == "string" && (M = d), M || ""),
|
|
503
|
+
error: (d, h) => (R = d, f.delete("Cache-Control"), new D(d, h)),
|
|
504
|
+
redirect: (d, h) => {
|
|
505
|
+
if (N(), R = d, h) {
|
|
506
|
+
if (/([^:])\/{2,}/.test(h)) {
|
|
507
|
+
const y = h.replace(/([^:])\/{2,}/g, "$1/");
|
|
508
|
+
console.warn(`Redirect URL ${h} is invalid, fixing to ${y}`), h = y;
|
|
509
|
+
}
|
|
510
|
+
f.set("Location", h);
|
|
504
511
|
}
|
|
505
|
-
return
|
|
512
|
+
return f.delete("Cache-Control"), d > 301 && f.set("Cache-Control", "no-store"), g = B, new H();
|
|
506
513
|
},
|
|
507
514
|
rewrite: (d) => {
|
|
508
515
|
if (N(), d.startsWith("http"))
|
|
509
516
|
throw new Error("Rewrite does not support absolute urls");
|
|
510
|
-
return
|
|
517
|
+
return s.set(Pe, !0), new we(d.replace(/\/+/g, "/"));
|
|
511
518
|
},
|
|
512
519
|
defer: (d) => typeof d == "function" ? d : () => d,
|
|
513
|
-
fail: (d,
|
|
520
|
+
fail: (d, h) => (N(), R = d, f.delete("Cache-Control"), {
|
|
514
521
|
failed: !0,
|
|
515
|
-
...
|
|
522
|
+
...h
|
|
516
523
|
}),
|
|
517
|
-
text: (d,
|
|
518
|
-
html: (d,
|
|
519
|
-
parseBody: async () =>
|
|
520
|
-
json: (d,
|
|
521
|
-
send:
|
|
522
|
-
isDirty: () =>
|
|
524
|
+
text: (d, h) => (f.set("Content-Type", "text/plain; charset=utf-8"), U(d, h)),
|
|
525
|
+
html: (d, h) => (f.set("Content-Type", "text/html; charset=utf-8"), U(d, h)),
|
|
526
|
+
parseBody: async () => b !== void 0 ? b : b = fn(A, s),
|
|
527
|
+
json: (d, h) => (f.set("Content-Type", "application/json; charset=utf-8"), U(d, JSON.stringify(h))),
|
|
528
|
+
send: U,
|
|
529
|
+
isDirty: () => w !== null,
|
|
523
530
|
getWritableStream: () => {
|
|
524
|
-
if (
|
|
531
|
+
if (w === null) {
|
|
525
532
|
if (e.mode === "dev") {
|
|
526
|
-
const d =
|
|
527
|
-
d &&
|
|
533
|
+
const d = s.get(X);
|
|
534
|
+
d && f.set(
|
|
528
535
|
"Server-Timing",
|
|
529
|
-
d.map(([
|
|
536
|
+
d.map(([h, y]) => `${h};dur=${y}`).join(",")
|
|
530
537
|
);
|
|
531
538
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
l,
|
|
539
|
+
w = e.getWritableStream(
|
|
540
|
+
R,
|
|
535
541
|
f,
|
|
536
|
-
|
|
537
|
-
|
|
542
|
+
l,
|
|
543
|
+
i,
|
|
544
|
+
A
|
|
538
545
|
);
|
|
539
546
|
}
|
|
540
|
-
return
|
|
547
|
+
return w;
|
|
541
548
|
}
|
|
542
549
|
};
|
|
543
|
-
return Object.freeze(
|
|
550
|
+
return Object.freeze(A);
|
|
544
551
|
}
|
|
545
|
-
function
|
|
546
|
-
return e[
|
|
552
|
+
function O(e) {
|
|
553
|
+
return e[Te];
|
|
547
554
|
}
|
|
548
|
-
function
|
|
549
|
-
return e[Ce];
|
|
550
|
-
}
|
|
551
|
-
function ln(e) {
|
|
555
|
+
function Oe(e) {
|
|
552
556
|
return e[xe];
|
|
553
557
|
}
|
|
554
|
-
function
|
|
558
|
+
function dn(e) {
|
|
555
559
|
return e[Ne];
|
|
556
560
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
561
|
+
function I(e) {
|
|
562
|
+
return e[Me];
|
|
563
|
+
}
|
|
564
|
+
const B = Number.MAX_SAFE_INTEGER, fn = async ({ request: e, method: n, query: t }, r) => {
|
|
565
|
+
const i = e.headers.get("content-type")?.split(/[;,]/, 1)[0].trim() ?? "";
|
|
566
|
+
if (i === "application/x-www-form-urlencoded" || i === "multipart/form-data") {
|
|
567
|
+
const o = await e.formData();
|
|
568
|
+
return r.set(Ie, o), un(o);
|
|
562
569
|
} else {
|
|
563
|
-
if (
|
|
570
|
+
if (i === "application/json")
|
|
564
571
|
return await e.json();
|
|
565
|
-
if (
|
|
566
|
-
if (
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
572
|
+
if (i === "application/qwik-json") {
|
|
573
|
+
if (n === "GET" && t.has(oe)) {
|
|
574
|
+
const o = t.get(oe);
|
|
575
|
+
if (o)
|
|
569
576
|
try {
|
|
570
|
-
return
|
|
577
|
+
return te(decodeURIComponent(o));
|
|
571
578
|
} catch {
|
|
572
579
|
}
|
|
573
580
|
}
|
|
574
|
-
return
|
|
581
|
+
return te(await e.text());
|
|
575
582
|
}
|
|
576
583
|
}
|
|
577
|
-
},
|
|
584
|
+
}, un = (e) => [...e.entries()].reduce((t, [r, i]) => (r.split(".").reduce((o, a, c, s) => {
|
|
578
585
|
if (a.endsWith("[]")) {
|
|
579
|
-
const
|
|
580
|
-
return
|
|
586
|
+
const l = a.slice(0, -2);
|
|
587
|
+
return o[l] = o[l] || [], o[l] = [...o[l], i];
|
|
581
588
|
}
|
|
582
|
-
return
|
|
583
|
-
},
|
|
584
|
-
function
|
|
585
|
-
const { params:
|
|
586
|
-
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
const
|
|
589
|
+
return c < s.length - 1 ? o[a] = o[a] || (Number.isNaN(+s[c + 1]) ? {} : []) : o[a] = i;
|
|
590
|
+
}, t), t), {});
|
|
591
|
+
function hn(e) {
|
|
592
|
+
const { params: n, request: t, status: r, locale: i, originalUrl: o } = e, a = {};
|
|
593
|
+
t.headers.forEach((M, R) => a[R] = M);
|
|
594
|
+
const c = e.sharedMap.get(Q), s = e.sharedMap.get(Ie), l = e.sharedMap.get(Ce), f = e.sharedMap.get(cn), u = e.request.headers, m = new URL(o.pathname + o.search, o), p = u.get("X-Forwarded-Host"), g = u.get("X-Forwarded-Proto");
|
|
595
|
+
p && (m.port = "", m.host = p), g && (m.protocol = g);
|
|
596
|
+
const w = O(e), b = Oe(e);
|
|
590
597
|
return {
|
|
591
|
-
url:
|
|
598
|
+
url: m.href,
|
|
592
599
|
requestHeaders: a,
|
|
593
|
-
locale:
|
|
594
|
-
nonce:
|
|
600
|
+
locale: i(),
|
|
601
|
+
nonce: f,
|
|
595
602
|
containerAttributes: {
|
|
596
|
-
[je]:
|
|
603
|
+
[je]: l
|
|
597
604
|
},
|
|
598
605
|
qwikrouter: {
|
|
599
|
-
routeName:
|
|
606
|
+
routeName: l,
|
|
600
607
|
ev: e,
|
|
601
|
-
params: { ...
|
|
602
|
-
loadedRoute:
|
|
608
|
+
params: { ...n },
|
|
609
|
+
loadedRoute: dn(e),
|
|
603
610
|
response: {
|
|
604
611
|
status: r(),
|
|
605
|
-
loaders:
|
|
606
|
-
loadersSerializationStrategy:
|
|
607
|
-
action:
|
|
608
|
-
formData:
|
|
612
|
+
loaders: w,
|
|
613
|
+
loadersSerializationStrategy: b,
|
|
614
|
+
action: c,
|
|
615
|
+
formData: s
|
|
609
616
|
}
|
|
610
617
|
}
|
|
611
618
|
};
|
|
612
619
|
}
|
|
613
|
-
const
|
|
614
|
-
const
|
|
615
|
-
if (e && he(
|
|
616
|
-
i,
|
|
620
|
+
const mn = (e, n, t, r, i, o) => {
|
|
621
|
+
const a = [], c = [], s = [], l = !!(n && An(n[L.Mods]));
|
|
622
|
+
if (o && s.push(Nn), e && he(
|
|
617
623
|
a,
|
|
624
|
+
c,
|
|
618
625
|
s,
|
|
619
626
|
e,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
),
|
|
623
|
-
const f =
|
|
624
|
-
r && (
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
i,
|
|
627
|
+
l,
|
|
628
|
+
t
|
|
629
|
+
), n) {
|
|
630
|
+
const f = n[L.RouteName];
|
|
631
|
+
r && (t === "POST" || t === "PUT" || t === "PATCH" || t === "DELETE") && (r === "lax-proto" ? s.unshift(_n) : s.unshift(Tn)), l && ((t === "POST" || t === "GET") && s.push(pn), s.push(Rn), o && s.push(xn));
|
|
632
|
+
const u = n[L.Mods];
|
|
633
|
+
he(
|
|
628
634
|
a,
|
|
635
|
+
c,
|
|
629
636
|
s,
|
|
637
|
+
u,
|
|
630
638
|
l,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}), s.push(mn(a)), s.push(gn(i)), s.push(o));
|
|
639
|
+
t
|
|
640
|
+
), l && (s.push((m) => {
|
|
641
|
+
m.sharedMap.set(Ce, f);
|
|
642
|
+
}), s.push(gn(c)), s.push(yn(a)), s.push(i));
|
|
636
643
|
}
|
|
637
644
|
return s;
|
|
638
|
-
}, he = (e,
|
|
645
|
+
}, he = (e, n, t, r, i, o) => {
|
|
639
646
|
for (const a of r) {
|
|
640
|
-
typeof a.onRequest == "function" ?
|
|
641
|
-
let
|
|
642
|
-
switch (
|
|
647
|
+
typeof a.onRequest == "function" ? t.push(a.onRequest) : Array.isArray(a.onRequest) && t.push(...a.onRequest);
|
|
648
|
+
let c;
|
|
649
|
+
switch (o) {
|
|
643
650
|
case "GET": {
|
|
644
|
-
|
|
651
|
+
c = a.onGet;
|
|
645
652
|
break;
|
|
646
653
|
}
|
|
647
654
|
case "POST": {
|
|
648
|
-
|
|
655
|
+
c = a.onPost;
|
|
649
656
|
break;
|
|
650
657
|
}
|
|
651
658
|
case "PUT": {
|
|
652
|
-
|
|
659
|
+
c = a.onPut;
|
|
653
660
|
break;
|
|
654
661
|
}
|
|
655
662
|
case "PATCH": {
|
|
656
|
-
|
|
663
|
+
c = a.onPatch;
|
|
657
664
|
break;
|
|
658
665
|
}
|
|
659
666
|
case "DELETE": {
|
|
660
|
-
|
|
667
|
+
c = a.onDelete;
|
|
661
668
|
break;
|
|
662
669
|
}
|
|
663
670
|
case "OPTIONS": {
|
|
664
|
-
|
|
671
|
+
c = a.onOptions;
|
|
665
672
|
break;
|
|
666
673
|
}
|
|
667
674
|
case "HEAD": {
|
|
668
|
-
|
|
675
|
+
c = a.onHead;
|
|
669
676
|
break;
|
|
670
677
|
}
|
|
671
678
|
}
|
|
672
|
-
if (typeof
|
|
673
|
-
for (const
|
|
674
|
-
typeof
|
|
679
|
+
if (typeof c == "function" ? t.push(c) : Array.isArray(c) && t.push(...c), i)
|
|
680
|
+
for (const s of Object.values(a))
|
|
681
|
+
typeof s == "function" && (s.__brand === "server_loader" ? e.push(s) : s.__brand === "server_action" && n.push(s));
|
|
675
682
|
}
|
|
676
683
|
};
|
|
677
|
-
function
|
|
678
|
-
return async (
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
|
|
684
|
+
function gn(e) {
|
|
685
|
+
return async (n) => {
|
|
686
|
+
const t = n;
|
|
687
|
+
if (t.headersSent) {
|
|
688
|
+
t.exit();
|
|
682
689
|
return;
|
|
683
690
|
}
|
|
684
|
-
const { method: r } =
|
|
685
|
-
if (
|
|
691
|
+
const { method: r } = t, i = O(t), o = I(t) === "dev";
|
|
692
|
+
if (o && r === "GET" && t.query.has(ie) && console.warn(
|
|
686
693
|
`Seems like you are submitting a Qwik Action via GET request. Qwik Actions should be submitted via POST request.
|
|
687
694
|
Make sure your <form> has method="POST" attribute, like this: <form method="POST">`
|
|
688
695
|
), r === "POST") {
|
|
689
|
-
const a =
|
|
696
|
+
const a = t.query.get(ie);
|
|
690
697
|
if (a) {
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
if (!
|
|
698
|
+
const c = globalThis._qwikActionsMap, s = e.find((l) => l.__id === a) ?? c?.get(a);
|
|
699
|
+
if (s) {
|
|
700
|
+
t.sharedMap.set(Q, a);
|
|
701
|
+
const l = await t.parseBody();
|
|
702
|
+
if (!l || typeof l != "object")
|
|
696
703
|
throw new Error(
|
|
697
704
|
`Expected request data for the action id ${a} to be an object`
|
|
698
705
|
);
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
701
|
-
|
|
706
|
+
const f = await ke(t, s.__validators, l, o);
|
|
707
|
+
if (!f.success)
|
|
708
|
+
i[a] = t.fail(f.status ?? 500, f.error);
|
|
702
709
|
else {
|
|
703
|
-
const u =
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
() =>
|
|
707
|
-
) : await
|
|
708
|
-
|
|
710
|
+
const u = o ? await j(
|
|
711
|
+
t,
|
|
712
|
+
s.__qrl.getHash(),
|
|
713
|
+
() => s.__qrl.call(t, f.data, t)
|
|
714
|
+
) : await s.__qrl.call(t, f.data, t);
|
|
715
|
+
o && S(u, s.__qrl), i[a] = u;
|
|
709
716
|
}
|
|
710
717
|
}
|
|
711
718
|
}
|
|
712
719
|
}
|
|
713
720
|
};
|
|
714
721
|
}
|
|
715
|
-
function
|
|
716
|
-
return async (
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
|
|
722
|
+
function yn(e) {
|
|
723
|
+
return async (n) => {
|
|
724
|
+
const t = n;
|
|
725
|
+
if (t.headersSent) {
|
|
726
|
+
t.exit();
|
|
720
727
|
return;
|
|
721
728
|
}
|
|
722
|
-
const r =
|
|
729
|
+
const r = O(t), i = I(t) === "dev";
|
|
723
730
|
if (e.length > 0) {
|
|
724
|
-
let
|
|
725
|
-
if (
|
|
726
|
-
const
|
|
727
|
-
for (const
|
|
728
|
-
|
|
731
|
+
let o = [];
|
|
732
|
+
if (t.query.has(J)) {
|
|
733
|
+
const c = t.query.getAll(J);
|
|
734
|
+
for (const s of e)
|
|
735
|
+
c.includes(s.__id) ? o.push(s) : r[s.__id] = ye;
|
|
729
736
|
} else
|
|
730
|
-
|
|
731
|
-
const a =
|
|
732
|
-
(
|
|
737
|
+
o = e;
|
|
738
|
+
const a = o.map(
|
|
739
|
+
(c) => Ue(c, r, t, i)
|
|
733
740
|
);
|
|
734
741
|
await Promise.all(a);
|
|
735
742
|
}
|
|
736
743
|
};
|
|
737
744
|
}
|
|
738
|
-
async function
|
|
739
|
-
const
|
|
740
|
-
return
|
|
741
|
-
|
|
745
|
+
async function Ue(e, n, t, r) {
|
|
746
|
+
const i = e.__id;
|
|
747
|
+
return n[i] = ke(
|
|
748
|
+
t,
|
|
742
749
|
e.__validators,
|
|
743
750
|
void 0,
|
|
744
751
|
// data
|
|
745
752
|
r
|
|
746
|
-
).then((a) => a.success ? r ?
|
|
747
|
-
|
|
753
|
+
).then((a) => a.success ? r ? j(
|
|
754
|
+
t,
|
|
748
755
|
e.__qrl.getHash(),
|
|
749
|
-
() => e.__qrl.call(
|
|
750
|
-
) : e.__qrl.call(
|
|
756
|
+
() => e.__qrl.call(t, t)
|
|
757
|
+
) : e.__qrl.call(t, t) : t.fail(a.status ?? 500, a.error)).then((a) => (typeof a == "function" ? n[i] = a() : (r && S(a, e.__qrl), n[i] = a), a)), Oe(t).set(i, e.__serializationStrategy), n[i];
|
|
751
758
|
}
|
|
752
|
-
async function
|
|
753
|
-
let
|
|
759
|
+
async function ke(e, n, t, r) {
|
|
760
|
+
let i = {
|
|
754
761
|
success: !0,
|
|
755
|
-
data:
|
|
762
|
+
data: t
|
|
756
763
|
};
|
|
757
|
-
if (
|
|
758
|
-
for (const
|
|
759
|
-
if (r ?
|
|
764
|
+
if (n)
|
|
765
|
+
for (const o of n)
|
|
766
|
+
if (r ? i = await j(
|
|
760
767
|
e,
|
|
761
768
|
"validator$",
|
|
762
|
-
() =>
|
|
763
|
-
) :
|
|
764
|
-
|
|
769
|
+
() => o.validate(e, t)
|
|
770
|
+
) : i = await o.validate(e, t), i.success)
|
|
771
|
+
t = i.data;
|
|
765
772
|
else
|
|
766
|
-
return
|
|
767
|
-
return
|
|
773
|
+
return i;
|
|
774
|
+
return i;
|
|
768
775
|
}
|
|
769
|
-
function
|
|
776
|
+
function wn(e) {
|
|
770
777
|
return e ? typeof e == "object" && Symbol.asyncIterator in e : !1;
|
|
771
778
|
}
|
|
772
|
-
async function
|
|
773
|
-
const
|
|
774
|
-
if (
|
|
779
|
+
async function pn(e) {
|
|
780
|
+
const n = e.query.get(Ee);
|
|
781
|
+
if (n && e.request.headers.get("X-QRL") === n && e.request.headers.get("Content-Type") === "application/qwik-json") {
|
|
775
782
|
e.exit();
|
|
776
|
-
const
|
|
783
|
+
const t = I(e) === "dev", r = await e.parseBody();
|
|
777
784
|
if (Array.isArray(r)) {
|
|
778
|
-
const [
|
|
779
|
-
if (
|
|
785
|
+
const [i, ...o] = r;
|
|
786
|
+
if (bn(i) && i.getHash() === n) {
|
|
780
787
|
let a;
|
|
781
788
|
try {
|
|
782
|
-
|
|
789
|
+
t ? a = await j(
|
|
783
790
|
e,
|
|
784
|
-
`server_${
|
|
785
|
-
() =>
|
|
786
|
-
) : a = await
|
|
787
|
-
} catch (
|
|
788
|
-
throw
|
|
791
|
+
`server_${i.getSymbol()}`,
|
|
792
|
+
() => i.apply(e, o)
|
|
793
|
+
) : a = await i.apply(e, o);
|
|
794
|
+
} catch (c) {
|
|
795
|
+
throw c instanceof D ? e.error(c.status, c.data) : e.error(500, "Invalid request");
|
|
789
796
|
}
|
|
790
|
-
if (
|
|
797
|
+
if (wn(a)) {
|
|
791
798
|
e.headers.set("Content-Type", "text/qwik-json-stream");
|
|
792
|
-
const
|
|
793
|
-
for await (const
|
|
794
|
-
|
|
795
|
-
const
|
|
799
|
+
const s = e.getWritableStream().getWriter();
|
|
800
|
+
for await (const l of a) {
|
|
801
|
+
t && S(l, i);
|
|
802
|
+
const f = await q([l]);
|
|
796
803
|
if (e.signal.aborted)
|
|
797
804
|
break;
|
|
798
|
-
await
|
|
805
|
+
await s.write(E.encode(`${f}
|
|
799
806
|
`));
|
|
800
807
|
}
|
|
801
|
-
|
|
808
|
+
s.close();
|
|
802
809
|
} else {
|
|
803
|
-
|
|
804
|
-
const
|
|
805
|
-
e.send(200,
|
|
810
|
+
S(a, i), e.headers.set("Content-Type", "application/qwik-json");
|
|
811
|
+
const c = await q([a]);
|
|
812
|
+
e.send(200, c);
|
|
806
813
|
}
|
|
807
814
|
return;
|
|
808
815
|
}
|
|
@@ -810,93 +817,91 @@ async function wn(e) {
|
|
|
810
817
|
throw e.error(500, "Invalid request");
|
|
811
818
|
}
|
|
812
819
|
}
|
|
813
|
-
function
|
|
814
|
-
const { basePathname:
|
|
815
|
-
if (!r.has(
|
|
820
|
+
function Rn(e) {
|
|
821
|
+
const { basePathname: n, originalUrl: t, sharedMap: r } = e, { pathname: i, search: o } = t;
|
|
822
|
+
if (!r.has(ee) && i !== n && !i.endsWith(".html")) {
|
|
816
823
|
if (globalThis.__NO_TRAILING_SLASH__) {
|
|
817
|
-
if (
|
|
824
|
+
if (i.endsWith("/"))
|
|
818
825
|
throw e.redirect(
|
|
819
|
-
|
|
820
|
-
|
|
826
|
+
Y.MovedPermanently,
|
|
827
|
+
i.slice(0, i.length - 1) + o
|
|
821
828
|
);
|
|
822
|
-
} else if (!
|
|
823
|
-
throw e.redirect(
|
|
829
|
+
} else if (!i.endsWith("/"))
|
|
830
|
+
throw e.redirect(Y.MovedPermanently, i + "/" + o);
|
|
824
831
|
}
|
|
825
832
|
}
|
|
826
|
-
function
|
|
833
|
+
function S(e, n) {
|
|
827
834
|
try {
|
|
828
|
-
|
|
829
|
-
} catch (
|
|
830
|
-
throw
|
|
835
|
+
Qe(e, void 0);
|
|
836
|
+
} catch (t) {
|
|
837
|
+
throw t instanceof Error && n.dev && (t.loc = n.dev), t;
|
|
831
838
|
}
|
|
832
839
|
}
|
|
833
|
-
const
|
|
834
|
-
function
|
|
835
|
-
const
|
|
836
|
-
return
|
|
840
|
+
const bn = (e) => typeof e == "function" && typeof e.getSymbol == "function";
|
|
841
|
+
function An(e) {
|
|
842
|
+
const n = e[e.length - 1];
|
|
843
|
+
return n && typeof n.default == "function";
|
|
837
844
|
}
|
|
838
845
|
function Z(e) {
|
|
839
846
|
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
|
|
841
|
-
return `${e.pathname}${
|
|
847
|
+
const n = e.search.slice(1).replaceAll(/&?q(action|data|func|loaders)=[^&]+/g, "");
|
|
848
|
+
return `${e.pathname}${n ? `?${n}` : ""}${e.hash}`;
|
|
842
849
|
}
|
|
843
850
|
const E = /* @__PURE__ */ new TextEncoder();
|
|
844
|
-
function An(e) {
|
|
845
|
-
ke(e, "lax-proto");
|
|
846
|
-
}
|
|
847
851
|
function _n(e) {
|
|
848
|
-
|
|
852
|
+
We(e, "lax-proto");
|
|
849
853
|
}
|
|
850
|
-
function
|
|
851
|
-
|
|
854
|
+
function Tn(e) {
|
|
855
|
+
We(e);
|
|
856
|
+
}
|
|
857
|
+
function We(e, n) {
|
|
858
|
+
if (In(
|
|
852
859
|
e.request.headers,
|
|
853
860
|
"application/x-www-form-urlencoded",
|
|
854
861
|
"multipart/form-data",
|
|
855
862
|
"text/plain"
|
|
856
863
|
)) {
|
|
857
|
-
const r = e.request.headers.get("origin"),
|
|
858
|
-
let
|
|
859
|
-
if (
|
|
864
|
+
const r = e.request.headers.get("origin"), i = e.url.origin;
|
|
865
|
+
let o = r !== i;
|
|
866
|
+
if (o && n && r?.replace(/^http(s)?/g, "") === i.replace(/^http(s)?/g, "") && (o = !1), o)
|
|
860
867
|
throw e.error(
|
|
861
868
|
403,
|
|
862
869
|
`CSRF check failed. Cross-site ${e.method} form submissions are forbidden.
|
|
863
|
-
The request origin "${r}" does not match the server origin "${
|
|
870
|
+
The request origin "${r}" does not match the server origin "${i}".`
|
|
864
871
|
);
|
|
865
872
|
}
|
|
866
873
|
}
|
|
867
|
-
function
|
|
868
|
-
return async (
|
|
869
|
-
if (
|
|
874
|
+
function Mn(e) {
|
|
875
|
+
return async (n) => {
|
|
876
|
+
if (n.headersSent || n.sharedMap.has(ee))
|
|
870
877
|
return;
|
|
871
|
-
|
|
872
|
-
const r =
|
|
878
|
+
n.request.headers.forEach((f, u) => f);
|
|
879
|
+
const r = n.headers;
|
|
873
880
|
r.has("Content-Type") || r.set("Content-Type", "text/html; charset=utf-8");
|
|
874
|
-
const { readable:
|
|
881
|
+
const { readable: i, writable: o } = new TextEncoderStream(), a = n.getWritableStream(), c = i.pipeTo(a, { preventClose: !0 }), s = o.getWriter(), l = n.status();
|
|
875
882
|
try {
|
|
876
|
-
const
|
|
877
|
-
base:
|
|
878
|
-
stream:
|
|
883
|
+
const f = I(n) === "static", u = hn(n), m = await e({
|
|
884
|
+
base: n.basePathname + "build/",
|
|
885
|
+
stream: s,
|
|
879
886
|
serverData: u,
|
|
880
887
|
containerAttributes: {
|
|
881
|
-
"q:render":
|
|
888
|
+
"q:render": f ? "static" : "",
|
|
882
889
|
...u.containerAttributes
|
|
883
890
|
}
|
|
884
|
-
}),
|
|
885
|
-
loaders:
|
|
886
|
-
action:
|
|
887
|
-
status:
|
|
888
|
-
href: Z(
|
|
891
|
+
}), p = {
|
|
892
|
+
loaders: O(n),
|
|
893
|
+
action: n.sharedMap.get(Q),
|
|
894
|
+
status: l !== 200 ? l : 200,
|
|
895
|
+
href: Z(n.url)
|
|
889
896
|
};
|
|
890
|
-
typeof
|
|
897
|
+
typeof m.html == "string" && await s.write(m.html), n.sharedMap.set(Le, p);
|
|
891
898
|
} finally {
|
|
892
|
-
await
|
|
899
|
+
await s.ready, await s.close(), await c;
|
|
893
900
|
}
|
|
894
901
|
await a.close();
|
|
895
902
|
};
|
|
896
903
|
}
|
|
897
|
-
async function
|
|
898
|
-
if (!e.sharedMap.has(O))
|
|
899
|
-
return;
|
|
904
|
+
async function Nn(e) {
|
|
900
905
|
try {
|
|
901
906
|
await e.next();
|
|
902
907
|
} catch (i) {
|
|
@@ -905,9 +910,9 @@ async function Mn(e) {
|
|
|
905
910
|
}
|
|
906
911
|
if (e.headersSent)
|
|
907
912
|
return;
|
|
908
|
-
const n = e.status(),
|
|
909
|
-
if (n >= 301 && n <= 308 &&
|
|
910
|
-
const i =
|
|
913
|
+
const n = e.status(), t = e.headers.get("Location");
|
|
914
|
+
if (n >= 301 && n <= 308 && t) {
|
|
915
|
+
const i = Cn(t);
|
|
911
916
|
if (i) {
|
|
912
917
|
e.headers.set("Location", i), e.getWritableStream().close();
|
|
913
918
|
return;
|
|
@@ -915,177 +920,183 @@ async function Mn(e) {
|
|
|
915
920
|
e.status(200), e.headers.delete("Location");
|
|
916
921
|
}
|
|
917
922
|
}
|
|
918
|
-
async function
|
|
919
|
-
if (
|
|
923
|
+
async function xn(e) {
|
|
924
|
+
if (await e.next(), e.headersSent || e.exited)
|
|
920
925
|
return;
|
|
921
|
-
const n = e.status(),
|
|
922
|
-
e.request.headers.forEach((l,
|
|
923
|
-
let
|
|
924
|
-
const i = e.query.getAll(
|
|
925
|
-
if (
|
|
926
|
+
const n = e.status(), t = e.headers.get("Location");
|
|
927
|
+
e.request.headers.forEach((l, f) => l), e.headers.set("Content-Type", "application/json; charset=utf-8");
|
|
928
|
+
let r = O(e);
|
|
929
|
+
const i = e.query.getAll(J), o = i.length > 0;
|
|
930
|
+
if (o) {
|
|
926
931
|
const l = {};
|
|
927
|
-
for (const
|
|
928
|
-
const
|
|
929
|
-
l[
|
|
932
|
+
for (const f of i) {
|
|
933
|
+
const u = r[f];
|
|
934
|
+
l[f] = u;
|
|
930
935
|
}
|
|
931
|
-
|
|
936
|
+
r = l;
|
|
932
937
|
}
|
|
933
|
-
const
|
|
938
|
+
const a = o ? {
|
|
934
939
|
// send minimal data to the client
|
|
935
|
-
loaders:
|
|
940
|
+
loaders: r,
|
|
936
941
|
status: n !== 200 ? n : 200,
|
|
937
942
|
href: Z(e.url)
|
|
938
943
|
} : {
|
|
939
|
-
loaders:
|
|
940
|
-
action: e.sharedMap.get(
|
|
944
|
+
loaders: r,
|
|
945
|
+
action: e.sharedMap.get(Q),
|
|
941
946
|
status: n !== 200 ? n : 200,
|
|
942
947
|
href: Z(e.url),
|
|
943
|
-
redirect:
|
|
944
|
-
isRewrite: e.sharedMap.get(
|
|
945
|
-
}, c = e.getWritableStream().getWriter(),
|
|
946
|
-
c.write(E.encode(
|
|
948
|
+
redirect: t ?? void 0,
|
|
949
|
+
isRewrite: e.sharedMap.get(Pe)
|
|
950
|
+
}, c = e.getWritableStream().getWriter(), s = await q([a]);
|
|
951
|
+
c.write(E.encode(s)), e.sharedMap.set(Le, a), c.close();
|
|
947
952
|
}
|
|
948
|
-
function
|
|
953
|
+
function Cn(e) {
|
|
949
954
|
if (e.startsWith("/")) {
|
|
950
|
-
|
|
951
|
-
|
|
955
|
+
if (!e.includes(C)) {
|
|
956
|
+
const n = new URL(e, "http://localhost");
|
|
957
|
+
return (n.pathname.endsWith("/") ? n.pathname.slice(0, -1) : n.pathname) + C + n.search;
|
|
958
|
+
}
|
|
959
|
+
return e;
|
|
952
960
|
} else
|
|
953
961
|
return;
|
|
954
962
|
}
|
|
955
963
|
function me() {
|
|
956
964
|
return typeof performance < "u" ? performance.now() : 0;
|
|
957
965
|
}
|
|
958
|
-
async function
|
|
966
|
+
async function j(e, n, t) {
|
|
959
967
|
const r = me();
|
|
960
968
|
try {
|
|
961
|
-
return await
|
|
969
|
+
return await t();
|
|
962
970
|
} finally {
|
|
963
|
-
const
|
|
964
|
-
let
|
|
965
|
-
|
|
971
|
+
const i = me() - r;
|
|
972
|
+
let o = e.sharedMap.get(X);
|
|
973
|
+
o || e.sharedMap.set(X, o = []), o.push([n, i]);
|
|
966
974
|
}
|
|
967
975
|
}
|
|
968
|
-
function
|
|
969
|
-
const
|
|
970
|
-
return
|
|
976
|
+
function In(e, ...n) {
|
|
977
|
+
const t = e.get("content-type")?.split(/;/, 1)[0].trim() ?? "";
|
|
978
|
+
return n.includes(t);
|
|
971
979
|
}
|
|
972
|
-
let
|
|
973
|
-
async function Wn(e,
|
|
974
|
-
const { render:
|
|
975
|
-
let { qwikRouterConfig:
|
|
976
|
-
if (
|
|
980
|
+
let K;
|
|
981
|
+
async function Wn(e, n) {
|
|
982
|
+
const { render: t, checkOrigin: r } = n;
|
|
983
|
+
let { qwikRouterConfig: i } = n;
|
|
984
|
+
if (i || (K || (K = await import("@qwik-router-config")), i = K), !i)
|
|
977
985
|
throw new Error("qwikRouterConfig is required.");
|
|
978
|
-
const
|
|
986
|
+
const { pathname: o, isInternal: a } = V(e.url.pathname), c = await ge(
|
|
987
|
+
i,
|
|
979
988
|
o,
|
|
980
|
-
a,
|
|
981
989
|
e.request.method,
|
|
982
990
|
r ?? !0,
|
|
983
|
-
|
|
991
|
+
t,
|
|
992
|
+
a
|
|
984
993
|
);
|
|
985
|
-
if (
|
|
986
|
-
const [
|
|
987
|
-
return
|
|
994
|
+
if (c) {
|
|
995
|
+
const [s, l] = c;
|
|
996
|
+
return sn(
|
|
988
997
|
e,
|
|
989
|
-
|
|
990
|
-
|
|
998
|
+
s,
|
|
999
|
+
l,
|
|
991
1000
|
async (u) => {
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
1001
|
+
const { pathname: m } = V(u.pathname), p = await ge(
|
|
1002
|
+
i,
|
|
1003
|
+
m,
|
|
995
1004
|
e.request.method,
|
|
996
1005
|
r ?? !0,
|
|
997
|
-
|
|
1006
|
+
t,
|
|
1007
|
+
a
|
|
998
1008
|
);
|
|
999
|
-
if (
|
|
1000
|
-
const [
|
|
1001
|
-
return { loadedRoute:
|
|
1009
|
+
if (p) {
|
|
1010
|
+
const [g, w] = p;
|
|
1011
|
+
return { loadedRoute: g, requestHandlers: w };
|
|
1002
1012
|
} else
|
|
1003
1013
|
return { loadedRoute: null, requestHandlers: [] };
|
|
1004
1014
|
},
|
|
1005
|
-
|
|
1015
|
+
i.basePathname
|
|
1006
1016
|
);
|
|
1007
1017
|
}
|
|
1008
1018
|
return null;
|
|
1009
1019
|
}
|
|
1010
|
-
async function ge(e,
|
|
1011
|
-
const { routes:
|
|
1012
|
-
|
|
1020
|
+
async function ge(e, n, t, r, i, o) {
|
|
1021
|
+
const { routes: a, serverPlugins: c, menus: s, cacheModules: l } = e, f = await ve(a, s, l, n, o), u = mn(
|
|
1022
|
+
c,
|
|
1013
1023
|
f,
|
|
1014
|
-
|
|
1024
|
+
t,
|
|
1015
1025
|
r,
|
|
1016
|
-
|
|
1026
|
+
Mn(i),
|
|
1027
|
+
o
|
|
1017
1028
|
);
|
|
1018
|
-
return
|
|
1029
|
+
return u.length > 0 ? [f, u] : null;
|
|
1019
1030
|
}
|
|
1020
1031
|
const Pn = [
|
|
1021
1032
|
// Will be replaced in post-build with the 404s generated by SSG
|
|
1022
1033
|
"__QWIK_ROUTER_NOT_FOUND_ARRAY__"
|
|
1023
1034
|
];
|
|
1024
|
-
function
|
|
1025
|
-
for (const [
|
|
1026
|
-
if (e.startsWith(
|
|
1027
|
-
return
|
|
1035
|
+
function $n(e) {
|
|
1036
|
+
for (const [n, t] of Pn)
|
|
1037
|
+
if (e.startsWith(n))
|
|
1038
|
+
return t;
|
|
1028
1039
|
return _e(404, "Resource Not Found");
|
|
1029
1040
|
}
|
|
1030
|
-
const
|
|
1031
|
-
function
|
|
1041
|
+
const v = /* @__PURE__ */ new Set(["__QWIK_ROUTER_STATIC_PATHS_ARRAY__"]);
|
|
1042
|
+
function qn(e, n) {
|
|
1032
1043
|
if (e.toUpperCase() !== "GET")
|
|
1033
1044
|
return !1;
|
|
1034
|
-
const
|
|
1035
|
-
if (
|
|
1045
|
+
const t = n.pathname;
|
|
1046
|
+
if (t.startsWith("/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/") || t.startsWith("/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/") || v.has(t))
|
|
1036
1047
|
return !0;
|
|
1037
|
-
if (
|
|
1038
|
-
const r =
|
|
1039
|
-
if (
|
|
1048
|
+
if (t.endsWith("/q-data.json")) {
|
|
1049
|
+
const r = t.replace(/\/q-data.json$/, "");
|
|
1050
|
+
if (v.has(r + "/") || v.has(r))
|
|
1040
1051
|
return !0;
|
|
1041
1052
|
}
|
|
1042
1053
|
return !1;
|
|
1043
1054
|
}
|
|
1044
|
-
class
|
|
1045
|
-
constructor(
|
|
1046
|
-
super(typeof
|
|
1055
|
+
class Dn extends Error {
|
|
1056
|
+
constructor(n, t) {
|
|
1057
|
+
super(typeof t == "string" ? t : void 0), this.status = n, this.data = t;
|
|
1047
1058
|
}
|
|
1048
1059
|
}
|
|
1049
1060
|
class $e {
|
|
1050
1061
|
}
|
|
1051
|
-
class Dn extends $e {
|
|
1052
|
-
}
|
|
1053
1062
|
class Fn extends $e {
|
|
1054
|
-
|
|
1055
|
-
|
|
1063
|
+
}
|
|
1064
|
+
class Sn extends $e {
|
|
1065
|
+
constructor(n) {
|
|
1066
|
+
super(), this.pathname = n;
|
|
1056
1067
|
}
|
|
1057
1068
|
}
|
|
1058
|
-
class
|
|
1069
|
+
class Qn {
|
|
1059
1070
|
#e = null;
|
|
1060
1071
|
#n = new TextEncoder();
|
|
1061
1072
|
#t = new TransformStream({
|
|
1062
|
-
transform: (
|
|
1063
|
-
|
|
1073
|
+
transform: (n, t) => {
|
|
1074
|
+
n = String(n);
|
|
1064
1075
|
let r = "";
|
|
1065
|
-
for (let
|
|
1066
|
-
const
|
|
1076
|
+
for (let i = 0; i < n.length; i++) {
|
|
1077
|
+
const o = n[i], a = o.charCodeAt(0);
|
|
1067
1078
|
if (this.#e !== null) {
|
|
1068
|
-
const
|
|
1079
|
+
const c = this.#e;
|
|
1069
1080
|
if (this.#e = null, 56320 <= a && a <= 57343) {
|
|
1070
|
-
r +=
|
|
1081
|
+
r += c + o;
|
|
1071
1082
|
continue;
|
|
1072
1083
|
}
|
|
1073
1084
|
r += "�";
|
|
1074
1085
|
}
|
|
1075
1086
|
if (55296 <= a && a <= 56319) {
|
|
1076
|
-
this.#e =
|
|
1087
|
+
this.#e = o;
|
|
1077
1088
|
continue;
|
|
1078
1089
|
}
|
|
1079
1090
|
if (56320 <= a && a <= 57343) {
|
|
1080
1091
|
r += "�";
|
|
1081
1092
|
continue;
|
|
1082
1093
|
}
|
|
1083
|
-
r +=
|
|
1094
|
+
r += o;
|
|
1084
1095
|
}
|
|
1085
|
-
r &&
|
|
1096
|
+
r && t.enqueue(this.#n.encode(r));
|
|
1086
1097
|
},
|
|
1087
|
-
flush: (
|
|
1088
|
-
this.#e !== null &&
|
|
1098
|
+
flush: (n) => {
|
|
1099
|
+
this.#e !== null && n.enqueue(new Uint8Array([239, 191, 189]));
|
|
1089
1100
|
}
|
|
1090
1101
|
});
|
|
1091
1102
|
get encoding() {
|
|
@@ -1103,14 +1114,14 @@ class Sn {
|
|
|
1103
1114
|
}
|
|
1104
1115
|
export {
|
|
1105
1116
|
$e as AbortMessage,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1117
|
+
Fn as RedirectMessage,
|
|
1118
|
+
Le as RequestEvShareQData,
|
|
1119
|
+
Sn as RewriteMessage,
|
|
1120
|
+
Dn as ServerError,
|
|
1121
|
+
Qn as _TextEncoderStream_polyfill,
|
|
1122
|
+
G as getErrorHtml,
|
|
1123
|
+
$n as getNotFound,
|
|
1124
|
+
qn as isStaticPath,
|
|
1125
|
+
kn as mergeHeadersCookies,
|
|
1115
1126
|
Wn as requestHandler
|
|
1116
1127
|
};
|