@claude-sessions/web 0.4.5 → 0.4.6
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/build/client/_app/immutable/assets/0.cQgYior5.css +1 -0
- package/build/client/_app/immutable/assets/0.cQgYior5.css.br +0 -0
- package/build/client/_app/immutable/assets/0.cQgYior5.css.gz +0 -0
- package/build/client/_app/immutable/chunks/B8g5xi4b.js +1 -0
- package/build/client/_app/immutable/chunks/B8g5xi4b.js.br +0 -0
- package/build/client/_app/immutable/chunks/B8g5xi4b.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CG99hqDQ.js +2 -0
- package/build/client/_app/immutable/chunks/CG99hqDQ.js.br +0 -0
- package/build/client/_app/immutable/chunks/CG99hqDQ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CiIZzKcO.js +1 -0
- package/build/client/_app/immutable/chunks/CiIZzKcO.js.br +0 -0
- package/build/client/_app/immutable/chunks/CiIZzKcO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BmH_exS6.js → DDmWtjsj.js} +1 -1
- package/build/client/_app/immutable/chunks/DDmWtjsj.js.br +0 -0
- package/build/client/_app/immutable/chunks/DDmWtjsj.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DWa7QuMS.js +1 -0
- package/build/client/_app/immutable/chunks/DWa7QuMS.js.br +0 -0
- package/build/client/_app/immutable/chunks/DWa7QuMS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dw50LpzA.js +1 -0
- package/build/client/_app/immutable/chunks/Dw50LpzA.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dw50LpzA.js.gz +0 -0
- package/build/client/_app/immutable/chunks/aZi3OCpL.js +96 -0
- package/build/client/_app/immutable/chunks/aZi3OCpL.js.br +0 -0
- package/build/client/_app/immutable/chunks/aZi3OCpL.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.CYY1PZCN.js +2 -0
- package/build/client/_app/immutable/entry/app.CYY1PZCN.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CYY1PZCN.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.D84fuMw9.js +1 -0
- package/build/client/_app/immutable/entry/start.D84fuMw9.js.br +2 -0
- package/build/client/_app/immutable/entry/start.D84fuMw9.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.B2uv-WBM.js +1 -0
- package/build/client/_app/immutable/nodes/0.B2uv-WBM.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.B2uv-WBM.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.BoxEAqK6.js +1 -0
- package/build/client/_app/immutable/nodes/1.BoxEAqK6.js.br +3 -0
- package/build/client/_app/immutable/nodes/1.BoxEAqK6.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.yd31CwaR.js → 2.mKAMmHlh.js} +1 -1
- package/build/client/_app/immutable/nodes/2.mKAMmHlh.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.mKAMmHlh.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.Dj8iwfME.js +4 -0
- package/build/client/_app/immutable/nodes/3.Dj8iwfME.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.Dj8iwfME.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +290 -228
- package/build/server/chunks/0-DChhR3gd.js +17 -0
- package/build/server/chunks/{0-D3SWM5E2.js.map → 0-DChhR3gd.js.map} +1 -1
- package/build/server/chunks/1-BBSPd3nB.js +9 -0
- package/build/server/chunks/{1-CXfgX4ux.js.map → 1-BBSPd3nB.js.map} +1 -1
- package/build/server/chunks/2-C20RW_lJ.js +9 -0
- package/build/server/chunks/{2-MV5uDYTL.js.map → 2-C20RW_lJ.js.map} +1 -1
- package/build/server/chunks/3-D3wL2YSE.js +9 -0
- package/build/server/chunks/{3-CsnDqfbG.js.map → 3-D3wL2YSE.js.map} +1 -1
- package/build/server/chunks/{InputModal-B9P0hP_j.js → InputModal-1qJGryUa.js} +6 -7
- package/build/server/chunks/InputModal-1qJGryUa.js.map +1 -0
- package/build/server/chunks/{Toast-DWQ-hmJu.js → Toast-C9b_dWm4.js} +7 -8
- package/build/server/chunks/Toast-C9b_dWm4.js.map +1 -0
- package/build/server/chunks/_layout.svelte-CdDMC1RI.js +134 -0
- package/build/server/chunks/_layout.svelte-CdDMC1RI.js.map +1 -0
- package/build/server/chunks/{_page.svelte-CGQGusC6.js → _page.svelte-CVL9fjg-.js} +10 -13
- package/build/server/chunks/_page.svelte-CVL9fjg-.js.map +1 -0
- package/build/server/chunks/{_page.svelte-BiD6gfpa.js → _page.svelte-Dx2ikKP_.js} +451 -497
- package/build/server/chunks/_page.svelte-Dx2ikKP_.js.map +1 -0
- package/build/server/chunks/{_server.ts-CDdRYdYO.js → _server.ts-B3M-jxF5.js} +2 -2
- package/build/server/chunks/{_server.ts-CDdRYdYO.js.map → _server.ts-B3M-jxF5.js.map} +1 -1
- package/build/server/chunks/{_server.ts-iCUks3KF.js → _server.ts-BCOHCAjW.js} +2 -2
- package/build/server/chunks/{_server.ts-iCUks3KF.js.map → _server.ts-BCOHCAjW.js.map} +1 -1
- package/build/server/chunks/{_server.ts-ChObRyrd.js → _server.ts-BGA9W8aM.js} +2 -2
- package/build/server/chunks/{_server.ts-ChObRyrd.js.map → _server.ts-BGA9W8aM.js.map} +1 -1
- package/build/server/chunks/{_server.ts-D5wsc-pR.js → _server.ts-BWxgSwZN.js} +2 -2
- package/build/server/chunks/{_server.ts-D5wsc-pR.js.map → _server.ts-BWxgSwZN.js.map} +1 -1
- package/build/server/chunks/{_server.ts-kfmLCgu8.js → _server.ts-C0mKXnG1.js} +2 -2
- package/build/server/chunks/{_server.ts-kfmLCgu8.js.map → _server.ts-C0mKXnG1.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BsgoVOBd.js → _server.ts-C9GYaVf1.js} +3 -3
- package/build/server/chunks/{_server.ts-BsgoVOBd.js.map → _server.ts-C9GYaVf1.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CPDPReZU.js → _server.ts-COPvamIQ.js} +2 -2
- package/build/server/chunks/{_server.ts-CPDPReZU.js.map → _server.ts-COPvamIQ.js.map} +1 -1
- package/build/server/chunks/{_server.ts-DLSXCOEM.js → _server.ts-CrKc6LEy.js} +2 -2
- package/build/server/chunks/{_server.ts-DLSXCOEM.js.map → _server.ts-CrKc6LEy.js.map} +1 -1
- package/build/server/chunks/{_server.ts-CKxzPqOL.js → _server.ts-DOSGEHuw.js} +2 -2
- package/build/server/chunks/{_server.ts-CKxzPqOL.js.map → _server.ts-DOSGEHuw.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Be1LFWpG.js → _server.ts-DP0i5Bdl.js} +2 -2
- package/build/server/chunks/{_server.ts-Be1LFWpG.js.map → _server.ts-DP0i5Bdl.js.map} +1 -1
- package/build/server/chunks/{_server.ts-crvQ7CTS.js → _server.ts-DmN9rdOH.js} +3 -3
- package/build/server/chunks/{_server.ts-crvQ7CTS.js.map → _server.ts-DmN9rdOH.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Brg38LxG.js → _server.ts-DmWsoikX.js} +2 -2
- package/build/server/chunks/{_server.ts-Brg38LxG.js.map → _server.ts-DmWsoikX.js.map} +1 -1
- package/build/server/chunks/{_server.ts-BOyCbZXG.js → _server.ts-F01KLghS.js} +2 -2
- package/build/server/chunks/{_server.ts-BOyCbZXG.js.map → _server.ts-F01KLghS.js.map} +1 -1
- package/build/server/chunks/{_server.ts-blDzB5RZ.js → _server.ts-QLTE_2dV.js} +2 -2
- package/build/server/chunks/{_server.ts-blDzB5RZ.js.map → _server.ts-QLTE_2dV.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Fv64R5tZ.js → _server.ts-WZF_VFnZ.js} +2 -2
- package/build/server/chunks/{_server.ts-Fv64R5tZ.js.map → _server.ts-WZF_VFnZ.js.map} +1 -1
- package/build/server/chunks/{_server.ts-Dc0z7zpD.js → _server.ts-rTWeIoSC.js} +3 -3
- package/build/server/chunks/{_server.ts-Dc0z7zpD.js.map → _server.ts-rTWeIoSC.js.map} +1 -1
- package/build/server/chunks/{index4-B6vRxXfo.js → client-BtcIwznP.js} +3 -23
- package/build/server/chunks/client-BtcIwznP.js.map +1 -0
- package/build/server/chunks/{error.svelte-BNCG_dZH.js → error.svelte-B02-pvoO.js} +5 -4
- package/build/server/chunks/error.svelte-B02-pvoO.js.map +1 -0
- package/build/server/chunks/index-CoD1IJuy.js.map +1 -1
- package/build/server/chunks/index2-B2Ld-FFX.js +3575 -0
- package/build/server/chunks/index2-B2Ld-FFX.js.map +1 -0
- package/build/server/chunks/{index3-D8yIZRD-.js → index3-DNyQGNm8.js} +3 -3
- package/build/server/chunks/index3-DNyQGNm8.js.map +1 -0
- package/build/server/chunks/index4-CfOR2iO6.js +21 -0
- package/build/server/chunks/index4-CfOR2iO6.js.map +1 -0
- package/build/server/chunks/root-B5iYE7yO.js +1182 -0
- package/build/server/chunks/root-B5iYE7yO.js.map +1 -0
- package/build/server/chunks/{session-BwU3zV40.js → session-Dxp1vf6f.js} +2 -2
- package/build/server/chunks/{session-BwU3zV40.js.map → session-Dxp1vf6f.js.map} +1 -1
- package/build/server/index.js +703 -1411
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +21 -21
- package/build/server/manifest.js.map +1 -1
- package/package.json +23 -23
- package/build/client/_app/immutable/assets/0.BTIBK81-.css +0 -1
- package/build/client/_app/immutable/assets/0.BTIBK81-.css.br +0 -0
- package/build/client/_app/immutable/assets/0.BTIBK81-.css.gz +0 -0
- package/build/client/_app/immutable/chunks/B-Z9hXPk.js +0 -1
- package/build/client/_app/immutable/chunks/B-Z9hXPk.js.br +0 -0
- package/build/client/_app/immutable/chunks/B-Z9hXPk.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BmH_exS6.js.br +0 -0
- package/build/client/_app/immutable/chunks/BmH_exS6.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cr0eW1j3.js +0 -1
- package/build/client/_app/immutable/chunks/Cr0eW1j3.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cr0eW1j3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DOXVKi87.js +0 -2
- package/build/client/_app/immutable/chunks/DOXVKi87.js.br +0 -0
- package/build/client/_app/immutable/chunks/DOXVKi87.js.gz +0 -0
- package/build/client/_app/immutable/chunks/WodlV_jD.js +0 -96
- package/build/client/_app/immutable/chunks/WodlV_jD.js.br +0 -0
- package/build/client/_app/immutable/chunks/WodlV_jD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/YXuXYbOb.js +0 -1
- package/build/client/_app/immutable/chunks/YXuXYbOb.js.br +0 -0
- package/build/client/_app/immutable/chunks/YXuXYbOb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/vDyoI7lw.js +0 -1
- package/build/client/_app/immutable/chunks/vDyoI7lw.js.br +0 -0
- package/build/client/_app/immutable/chunks/vDyoI7lw.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Kf_4i_t0.js +0 -2
- package/build/client/_app/immutable/entry/app.Kf_4i_t0.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Kf_4i_t0.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DrVGwFzz.js +0 -1
- package/build/client/_app/immutable/entry/start.DrVGwFzz.js.br +0 -0
- package/build/client/_app/immutable/entry/start.DrVGwFzz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.Dfn2ZpXY.js +0 -1
- package/build/client/_app/immutable/nodes/0.Dfn2ZpXY.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.Dfn2ZpXY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.CWRD2TOY.js +0 -1
- package/build/client/_app/immutable/nodes/1.CWRD2TOY.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.CWRD2TOY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.yd31CwaR.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.yd31CwaR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.Dh5fbLPm.js +0 -4
- package/build/client/_app/immutable/nodes/3.Dh5fbLPm.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.Dh5fbLPm.js.gz +0 -0
- package/build/server/chunks/0-D3SWM5E2.js +0 -17
- package/build/server/chunks/1-CXfgX4ux.js +0 -9
- package/build/server/chunks/2-MV5uDYTL.js +0 -9
- package/build/server/chunks/3-CsnDqfbG.js +0 -9
- package/build/server/chunks/InputModal-B9P0hP_j.js.map +0 -1
- package/build/server/chunks/Toast-DWQ-hmJu.js.map +0 -1
- package/build/server/chunks/_layout.svelte-Cgt3CiZy.js +0 -106
- package/build/server/chunks/_layout.svelte-Cgt3CiZy.js.map +0 -1
- package/build/server/chunks/_page.svelte-BiD6gfpa.js.map +0 -1
- package/build/server/chunks/_page.svelte-CGQGusC6.js.map +0 -1
- package/build/server/chunks/error.svelte-BNCG_dZH.js.map +0 -1
- package/build/server/chunks/exports-BXvEiaiv.js +0 -238
- package/build/server/chunks/exports-BXvEiaiv.js.map +0 -1
- package/build/server/chunks/index-D4ev3Ona.js +0 -1352
- package/build/server/chunks/index-D4ev3Ona.js.map +0 -1
- package/build/server/chunks/index2-ybZwlzIk.js +0 -1925
- package/build/server/chunks/index2-ybZwlzIk.js.map +0 -1
- package/build/server/chunks/index3-D8yIZRD-.js.map +0 -1
- package/build/server/chunks/index4-B6vRxXfo.js.map +0 -1
package/build/server/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as text_decoder, b as base64_decode,
|
|
4
|
-
import { D as DevalueError, i as is_primitive, g as get_type, a as is_plain_object, e as enumerable_symbols, s as stringify_key, b as stringify_string, r as render, c as is_passive_event, u as uneval } from './chunks/index-D4ev3Ona.js';
|
|
1
|
+
import { D as DevalueError, i as is_primitive, g as get_type, a as is_plain_object, e as enumerable_symbols, s as stringify_key, b as stringify_string, v as valid_array_indices, c as browser, u as uneval, r as readable, w as writable } from './chunks/index2-B2Ld-FFX.js';
|
|
2
|
+
import { H as HttpError, j as json, t as text, S as SvelteKitError, R as Redirect, e as error, A as ActionFailure } from './chunks/index-CoD1IJuy.js';
|
|
3
|
+
import { w as with_request_store, t as text_decoder, b as base64_decode, r as root, d as decode_pathname, n as normalize_path, a as disable_search, c as decode_params, v as validate_layout_server_exports, e as validate_layout_exports, f as validate_page_server_exports, g as validate_page_exports, h as text_encoder, i as resolve, m as make_trackable, j as get_relative_path, k as base64_encode } from './chunks/root-B5iYE7yO.js';
|
|
5
4
|
import { s as set_private_env, a as set_public_env, p as public_env } from './chunks/shared-server-DaWdgxVh.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -34,6 +33,10 @@ function reset() {
|
|
|
34
33
|
assets = initial.assets;
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
|
37
|
+
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
38
|
+
const MUTATIVE_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
|
|
39
|
+
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
|
37
40
|
function encode64(arraybuffer) {
|
|
38
41
|
const dv = new DataView(arraybuffer);
|
|
39
42
|
let binaryString = "";
|
|
@@ -110,6 +113,7 @@ const NAN = -3;
|
|
|
110
113
|
const POSITIVE_INFINITY = -4;
|
|
111
114
|
const NEGATIVE_INFINITY = -5;
|
|
112
115
|
const NEGATIVE_ZERO = -6;
|
|
116
|
+
const SPARSE = -7;
|
|
113
117
|
function parse(serialized, revivers) {
|
|
114
118
|
return unflatten(JSON.parse(serialized), revivers);
|
|
115
119
|
}
|
|
@@ -243,6 +247,14 @@ function unflatten(parsed, revivers) {
|
|
|
243
247
|
default:
|
|
244
248
|
throw new Error(`Unknown type ${type}`);
|
|
245
249
|
}
|
|
250
|
+
} else if (value[0] === SPARSE) {
|
|
251
|
+
const len = value[1];
|
|
252
|
+
const array = new Array(len);
|
|
253
|
+
hydrated[index] = array;
|
|
254
|
+
for (let i = 2; i < value.length; i += 2) {
|
|
255
|
+
const idx = value[i];
|
|
256
|
+
array[idx] = hydrate(value[i + 1]);
|
|
257
|
+
}
|
|
246
258
|
} else {
|
|
247
259
|
const array = new Array(value.length);
|
|
248
260
|
hydrated[index] = array;
|
|
@@ -255,7 +267,7 @@ function unflatten(parsed, revivers) {
|
|
|
255
267
|
} else {
|
|
256
268
|
const object = {};
|
|
257
269
|
hydrated[index] = object;
|
|
258
|
-
for (const key
|
|
270
|
+
for (const key of Object.keys(value)) {
|
|
259
271
|
if (key === "__proto__") {
|
|
260
272
|
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
261
273
|
}
|
|
@@ -325,20 +337,44 @@ function stringify$1(value, reducers) {
|
|
|
325
337
|
const { source, flags } = thing;
|
|
326
338
|
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
327
339
|
break;
|
|
328
|
-
case "Array":
|
|
340
|
+
case "Array": {
|
|
341
|
+
let mostly_dense = false;
|
|
329
342
|
str = "[";
|
|
330
343
|
for (let i = 0; i < thing.length; i += 1) {
|
|
331
344
|
if (i > 0) str += ",";
|
|
332
|
-
if (i
|
|
345
|
+
if (Object.hasOwn(thing, i)) {
|
|
333
346
|
keys.push(`[${i}]`);
|
|
334
347
|
str += flatten(thing[i]);
|
|
335
348
|
keys.pop();
|
|
336
|
-
} else {
|
|
349
|
+
} else if (mostly_dense) {
|
|
337
350
|
str += HOLE;
|
|
351
|
+
} else {
|
|
352
|
+
const populated_keys = valid_array_indices(
|
|
353
|
+
/** @type {any[]} */
|
|
354
|
+
thing
|
|
355
|
+
);
|
|
356
|
+
const population = populated_keys.length;
|
|
357
|
+
const d = String(thing.length).length;
|
|
358
|
+
const hole_cost = (thing.length - population) * 3;
|
|
359
|
+
const sparse_cost = 4 + d + population * (d + 1);
|
|
360
|
+
if (hole_cost > sparse_cost) {
|
|
361
|
+
str = "[" + SPARSE + "," + thing.length;
|
|
362
|
+
for (let j = 0; j < populated_keys.length; j++) {
|
|
363
|
+
const key = populated_keys[j];
|
|
364
|
+
keys.push(`[${key}]`);
|
|
365
|
+
str += "," + key + "," + flatten(thing[key]);
|
|
366
|
+
keys.pop();
|
|
367
|
+
}
|
|
368
|
+
break;
|
|
369
|
+
} else {
|
|
370
|
+
mostly_dense = true;
|
|
371
|
+
str += HOLE;
|
|
372
|
+
}
|
|
338
373
|
}
|
|
339
374
|
}
|
|
340
375
|
str += "]";
|
|
341
376
|
break;
|
|
377
|
+
}
|
|
342
378
|
case "Set":
|
|
343
379
|
str = '["Set"';
|
|
344
380
|
for (const value2 of thing) {
|
|
@@ -414,7 +450,15 @@ function stringify$1(value, reducers) {
|
|
|
414
450
|
}
|
|
415
451
|
if (Object.getPrototypeOf(thing) === null) {
|
|
416
452
|
str = '["null"';
|
|
417
|
-
for (const key
|
|
453
|
+
for (const key of Object.keys(thing)) {
|
|
454
|
+
if (key === "__proto__") {
|
|
455
|
+
throw new DevalueError(
|
|
456
|
+
`Cannot stringify objects with __proto__ keys`,
|
|
457
|
+
keys,
|
|
458
|
+
thing,
|
|
459
|
+
value
|
|
460
|
+
);
|
|
461
|
+
}
|
|
418
462
|
keys.push(stringify_key(key));
|
|
419
463
|
str += `,${stringify_string(key)},${flatten(thing[key])}`;
|
|
420
464
|
keys.pop();
|
|
@@ -423,7 +467,15 @@ function stringify$1(value, reducers) {
|
|
|
423
467
|
} else {
|
|
424
468
|
str = "{";
|
|
425
469
|
let started = false;
|
|
426
|
-
for (const key
|
|
470
|
+
for (const key of Object.keys(thing)) {
|
|
471
|
+
if (key === "__proto__") {
|
|
472
|
+
throw new DevalueError(
|
|
473
|
+
`Cannot stringify objects with __proto__ keys`,
|
|
474
|
+
keys,
|
|
475
|
+
thing,
|
|
476
|
+
value
|
|
477
|
+
);
|
|
478
|
+
}
|
|
427
479
|
if (started) str += ",";
|
|
428
480
|
started = true;
|
|
429
481
|
keys.push(stringify_key(key));
|
|
@@ -570,32 +622,49 @@ async function deserialize_binary_form(request) {
|
|
|
570
622
|
if (file_offsets_length > 0) {
|
|
571
623
|
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
572
624
|
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
|
625
|
+
const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
|
|
626
|
+
if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) {
|
|
627
|
+
throw deserialize_error("invalid file offset table");
|
|
628
|
+
}
|
|
573
629
|
file_offsets = /** @type {Array<number>} */
|
|
574
|
-
|
|
630
|
+
parsed_offsets;
|
|
575
631
|
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
576
632
|
}
|
|
633
|
+
const file_spans = [];
|
|
577
634
|
const [data, meta] = parse(text_decoder.decode(data_buffer), {
|
|
578
635
|
File: ([name, type, size, last_modified, index]) => {
|
|
579
|
-
if (
|
|
636
|
+
if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") {
|
|
637
|
+
throw deserialize_error("invalid file metadata");
|
|
638
|
+
}
|
|
639
|
+
let offset = file_offsets[index];
|
|
640
|
+
if (offset === void 0) {
|
|
641
|
+
throw deserialize_error("duplicate file offset table index");
|
|
642
|
+
}
|
|
643
|
+
file_offsets[index] = void 0;
|
|
644
|
+
offset += files_start_offset;
|
|
645
|
+
if (offset + size > content_length) {
|
|
580
646
|
throw deserialize_error("file data overflow");
|
|
581
647
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
size,
|
|
587
|
-
last_modified,
|
|
588
|
-
get_chunk,
|
|
589
|
-
files_start_offset + file_offsets[index]
|
|
590
|
-
),
|
|
591
|
-
{
|
|
592
|
-
getPrototypeOf() {
|
|
593
|
-
return File.prototype;
|
|
594
|
-
}
|
|
648
|
+
file_spans.push({ offset, size });
|
|
649
|
+
return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), {
|
|
650
|
+
getPrototypeOf() {
|
|
651
|
+
return File.prototype;
|
|
595
652
|
}
|
|
596
|
-
);
|
|
653
|
+
});
|
|
597
654
|
}
|
|
598
655
|
});
|
|
656
|
+
file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
|
|
657
|
+
for (let i = 1; i < file_spans.length; i++) {
|
|
658
|
+
const previous = file_spans[i - 1];
|
|
659
|
+
const current = file_spans[i];
|
|
660
|
+
const previous_end = previous.offset + previous.size;
|
|
661
|
+
if (previous_end < current.offset) {
|
|
662
|
+
throw deserialize_error("gaps in file data");
|
|
663
|
+
}
|
|
664
|
+
if (previous_end > current.offset) {
|
|
665
|
+
throw deserialize_error("overlapping file data");
|
|
666
|
+
}
|
|
667
|
+
}
|
|
599
668
|
void (async () => {
|
|
600
669
|
let has_more = true;
|
|
601
670
|
while (has_more) {
|
|
@@ -677,7 +746,7 @@ class LazyFile {
|
|
|
677
746
|
return new ReadableStream({
|
|
678
747
|
start: async (controller) => {
|
|
679
748
|
let chunk_start = 0;
|
|
680
|
-
let start_chunk
|
|
749
|
+
let start_chunk;
|
|
681
750
|
for (chunk_index = 0; ; chunk_index++) {
|
|
682
751
|
const chunk = await this.#get_chunk(chunk_index);
|
|
683
752
|
if (!chunk) return null;
|
|
@@ -755,899 +824,234 @@ function deep_set(object, keys, value) {
|
|
|
755
824
|
check_prototype_pollution(final_key);
|
|
756
825
|
current[final_key] = value;
|
|
757
826
|
}
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
827
|
+
function negotiate(accept, types) {
|
|
828
|
+
const parts = [];
|
|
829
|
+
accept.split(",").forEach((str, i) => {
|
|
830
|
+
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
|
831
|
+
if (match) {
|
|
832
|
+
const [, type, subtype, q = "1"] = match;
|
|
833
|
+
parts.push({ type, subtype, q: +q, i });
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
parts.sort((a, b) => {
|
|
837
|
+
if (a.q !== b.q) {
|
|
838
|
+
return b.q - a.q;
|
|
839
|
+
}
|
|
840
|
+
if (a.subtype === "*" !== (b.subtype === "*")) {
|
|
841
|
+
return a.subtype === "*" ? 1 : -1;
|
|
842
|
+
}
|
|
843
|
+
if (a.type === "*" !== (b.type === "*")) {
|
|
844
|
+
return a.type === "*" ? 1 : -1;
|
|
845
|
+
}
|
|
846
|
+
return a.i - b.i;
|
|
847
|
+
});
|
|
848
|
+
let accepted;
|
|
849
|
+
let min_priority = Infinity;
|
|
850
|
+
for (const mimetype of types) {
|
|
851
|
+
const [type, subtype] = mimetype.split("/");
|
|
852
|
+
const priority = parts.findIndex(
|
|
853
|
+
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
|
854
|
+
);
|
|
855
|
+
if (priority !== -1 && priority < min_priority) {
|
|
856
|
+
accepted = mimetype;
|
|
857
|
+
min_priority = priority;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
return accepted;
|
|
772
861
|
}
|
|
773
|
-
function
|
|
774
|
-
|
|
862
|
+
function is_content_type(request, ...types) {
|
|
863
|
+
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
|
864
|
+
return types.includes(type.toLowerCase());
|
|
775
865
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
866
|
+
function is_form_content_type(request) {
|
|
867
|
+
return is_content_type(
|
|
868
|
+
request,
|
|
869
|
+
"application/x-www-form-urlencoded",
|
|
870
|
+
"multipart/form-data",
|
|
871
|
+
"text/plain",
|
|
872
|
+
BINARY_FORM_CONTENT_TYPE
|
|
873
|
+
);
|
|
781
874
|
}
|
|
782
|
-
function
|
|
783
|
-
{
|
|
784
|
-
|
|
785
|
-
|
|
875
|
+
function coalesce_to_error(err) {
|
|
876
|
+
return err instanceof Error || err && /** @type {any} */
|
|
877
|
+
err.name && /** @type {any} */
|
|
878
|
+
err.message ? (
|
|
879
|
+
/** @type {Error} */
|
|
880
|
+
err
|
|
881
|
+
) : new Error(JSON.stringify(err));
|
|
786
882
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
883
|
+
function normalize_error(error) {
|
|
884
|
+
return (
|
|
885
|
+
/** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
|
|
886
|
+
error
|
|
887
|
+
);
|
|
790
888
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (node === null) {
|
|
794
|
-
hydration_mismatch();
|
|
795
|
-
throw HYDRATION_ERROR;
|
|
796
|
-
}
|
|
797
|
-
return hydrate_node = node;
|
|
889
|
+
function get_status(error) {
|
|
890
|
+
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
|
798
891
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
892
|
+
function get_message(error) {
|
|
893
|
+
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
|
801
894
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
895
|
+
const escape_html_attr_dict = {
|
|
896
|
+
"&": "&",
|
|
897
|
+
'"': """
|
|
898
|
+
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
|
899
|
+
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
|
900
|
+
// However, that doesn't apply in SvelteKit
|
|
901
|
+
};
|
|
902
|
+
const escape_html_dict = {
|
|
903
|
+
"&": "&",
|
|
904
|
+
"<": "<"
|
|
905
|
+
};
|
|
906
|
+
const surrogates = (
|
|
907
|
+
// high surrogate without paired low surrogate
|
|
908
|
+
"[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
|
|
909
|
+
);
|
|
910
|
+
const escape_html_attr_regex = new RegExp(
|
|
911
|
+
`[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
|
|
912
|
+
"g"
|
|
913
|
+
);
|
|
914
|
+
const escape_html_regex = new RegExp(
|
|
915
|
+
`[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
|
|
916
|
+
"g"
|
|
917
|
+
);
|
|
918
|
+
function escape_html(str, is_attr) {
|
|
919
|
+
const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
|
|
920
|
+
const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
|
|
921
|
+
if (match.length === 2) {
|
|
922
|
+
return match;
|
|
809
923
|
}
|
|
810
|
-
|
|
811
|
-
}
|
|
924
|
+
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
|
925
|
+
});
|
|
926
|
+
return escaped_str;
|
|
812
927
|
}
|
|
813
|
-
function
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
node.data
|
|
821
|
-
);
|
|
822
|
-
if (data === HYDRATION_END) {
|
|
823
|
-
if (depth === 0) return node;
|
|
824
|
-
depth -= 1;
|
|
825
|
-
} else if (data === HYDRATION_START || data === HYDRATION_START_ELSE) {
|
|
826
|
-
depth += 1;
|
|
827
|
-
}
|
|
928
|
+
function method_not_allowed(mod, method) {
|
|
929
|
+
return text(`${method} method not allowed`, {
|
|
930
|
+
status: 405,
|
|
931
|
+
headers: {
|
|
932
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
|
933
|
+
// "The server must generate an Allow header field in a 405 status code response"
|
|
934
|
+
allow: allowed_methods(mod).join(", ")
|
|
828
935
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
function allowed_methods(mod) {
|
|
939
|
+
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
|
940
|
+
if ("GET" in mod && !("HEAD" in mod)) {
|
|
941
|
+
allowed.push("HEAD");
|
|
835
942
|
}
|
|
943
|
+
return allowed;
|
|
836
944
|
}
|
|
837
|
-
function
|
|
838
|
-
|
|
839
|
-
let version = source(0);
|
|
840
|
-
let stop;
|
|
841
|
-
return () => {
|
|
842
|
-
if (effect_tracking()) {
|
|
843
|
-
get(version);
|
|
844
|
-
render_effect(() => {
|
|
845
|
-
if (subscribers === 0) {
|
|
846
|
-
stop = untrack(() => start(() => increment(version)));
|
|
847
|
-
}
|
|
848
|
-
subscribers += 1;
|
|
849
|
-
return () => {
|
|
850
|
-
queue_micro_task(() => {
|
|
851
|
-
subscribers -= 1;
|
|
852
|
-
if (subscribers === 0) {
|
|
853
|
-
stop?.();
|
|
854
|
-
stop = void 0;
|
|
855
|
-
increment(version);
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
};
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
};
|
|
945
|
+
function get_global_name(options) {
|
|
946
|
+
return `__sveltekit_${options.version_hash}`;
|
|
862
947
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
/** @type {Boundary | null} */
|
|
869
|
-
parent;
|
|
870
|
-
is_pending = false;
|
|
871
|
-
/** @type {TemplateNode} */
|
|
872
|
-
#anchor;
|
|
873
|
-
/** @type {TemplateNode | null} */
|
|
874
|
-
#hydrate_open = hydrating ? hydrate_node : null;
|
|
875
|
-
/** @type {BoundaryProps} */
|
|
876
|
-
#props;
|
|
877
|
-
/** @type {((anchor: Node) => void)} */
|
|
878
|
-
#children;
|
|
879
|
-
/** @type {Effect} */
|
|
880
|
-
#effect;
|
|
881
|
-
/** @type {Effect | null} */
|
|
882
|
-
#main_effect = null;
|
|
883
|
-
/** @type {Effect | null} */
|
|
884
|
-
#pending_effect = null;
|
|
885
|
-
/** @type {Effect | null} */
|
|
886
|
-
#failed_effect = null;
|
|
887
|
-
/** @type {DocumentFragment | null} */
|
|
888
|
-
#offscreen_fragment = null;
|
|
889
|
-
/** @type {TemplateNode | null} */
|
|
890
|
-
#pending_anchor = null;
|
|
891
|
-
#local_pending_count = 0;
|
|
892
|
-
#pending_count = 0;
|
|
893
|
-
#is_creating_fallback = false;
|
|
894
|
-
/** @type {Set<Effect>} */
|
|
895
|
-
#dirty_effects = /* @__PURE__ */ new Set();
|
|
896
|
-
/** @type {Set<Effect>} */
|
|
897
|
-
#maybe_dirty_effects = /* @__PURE__ */ new Set();
|
|
898
|
-
/**
|
|
899
|
-
* A source containing the number of pending async deriveds/expressions.
|
|
900
|
-
* Only created if `$effect.pending()` is used inside the boundary,
|
|
901
|
-
* otherwise updating the source results in needless `Batch.ensure()`
|
|
902
|
-
* calls followed by no-op flushes
|
|
903
|
-
* @type {Source<number> | null}
|
|
904
|
-
*/
|
|
905
|
-
#effect_pending = null;
|
|
906
|
-
#effect_pending_subscriber = createSubscriber(() => {
|
|
907
|
-
this.#effect_pending = source(this.#local_pending_count);
|
|
908
|
-
return () => {
|
|
909
|
-
this.#effect_pending = null;
|
|
910
|
-
};
|
|
948
|
+
function static_error_page(options, status, message) {
|
|
949
|
+
let page = options.templates.error({ status, message: escape_html(message) });
|
|
950
|
+
return text(page, {
|
|
951
|
+
headers: { "content-type": "text/html; charset=utf-8" },
|
|
952
|
+
status
|
|
911
953
|
});
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
this.#effect = block(() => {
|
|
925
|
-
active_effect.b = this;
|
|
926
|
-
if (hydrating) {
|
|
927
|
-
const comment = this.#hydrate_open;
|
|
928
|
-
hydrate_next();
|
|
929
|
-
const server_rendered_pending = (
|
|
930
|
-
/** @type {Comment} */
|
|
931
|
-
comment.nodeType === COMMENT_NODE && /** @type {Comment} */
|
|
932
|
-
comment.data === HYDRATION_START_ELSE
|
|
933
|
-
);
|
|
934
|
-
if (server_rendered_pending) {
|
|
935
|
-
this.#hydrate_pending_content();
|
|
936
|
-
} else {
|
|
937
|
-
this.#hydrate_resolved_content();
|
|
938
|
-
if (this.#pending_count === 0) {
|
|
939
|
-
this.is_pending = false;
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
} else {
|
|
943
|
-
var anchor = this.#get_anchor();
|
|
944
|
-
try {
|
|
945
|
-
this.#main_effect = branch(() => children(anchor));
|
|
946
|
-
} catch (error) {
|
|
947
|
-
this.error(error);
|
|
948
|
-
}
|
|
949
|
-
if (this.#pending_count > 0) {
|
|
950
|
-
this.#show_pending_snippet();
|
|
951
|
-
} else {
|
|
952
|
-
this.is_pending = false;
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
return () => {
|
|
956
|
-
this.#pending_anchor?.remove();
|
|
957
|
-
};
|
|
958
|
-
}, flags);
|
|
959
|
-
if (hydrating) {
|
|
960
|
-
this.#anchor = hydrate_node;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
#hydrate_resolved_content() {
|
|
964
|
-
try {
|
|
965
|
-
this.#main_effect = branch(() => this.#children(this.#anchor));
|
|
966
|
-
} catch (error) {
|
|
967
|
-
this.error(error);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
#hydrate_pending_content() {
|
|
971
|
-
const pending = this.#props.pending;
|
|
972
|
-
if (!pending) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
976
|
-
Batch.enqueue(() => {
|
|
977
|
-
var anchor = this.#get_anchor();
|
|
978
|
-
this.#main_effect = this.#run(() => {
|
|
979
|
-
Batch.ensure();
|
|
980
|
-
return branch(() => this.#children(anchor));
|
|
981
|
-
});
|
|
982
|
-
if (this.#pending_count > 0) {
|
|
983
|
-
this.#show_pending_snippet();
|
|
984
|
-
} else {
|
|
985
|
-
pause_effect(
|
|
986
|
-
/** @type {Effect} */
|
|
987
|
-
this.#pending_effect,
|
|
988
|
-
() => {
|
|
989
|
-
this.#pending_effect = null;
|
|
990
|
-
}
|
|
991
|
-
);
|
|
992
|
-
this.is_pending = false;
|
|
993
|
-
}
|
|
954
|
+
}
|
|
955
|
+
async function handle_fatal_error(event, state, options, error) {
|
|
956
|
+
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
|
957
|
+
const status = get_status(error);
|
|
958
|
+
const body = await handle_error_and_jsonify(event, state, options, error);
|
|
959
|
+
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
|
960
|
+
"application/json",
|
|
961
|
+
"text/html"
|
|
962
|
+
]);
|
|
963
|
+
if (event.isDataRequest || type === "application/json") {
|
|
964
|
+
return json(body, {
|
|
965
|
+
status
|
|
994
966
|
});
|
|
995
967
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
anchor = this.#pending_anchor;
|
|
1002
|
-
}
|
|
1003
|
-
return anchor;
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* Defer an effect inside a pending boundary until the boundary resolves
|
|
1007
|
-
* @param {Effect} effect
|
|
1008
|
-
*/
|
|
1009
|
-
defer_effect(effect) {
|
|
1010
|
-
defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
|
1014
|
-
* @returns {boolean}
|
|
1015
|
-
*/
|
|
1016
|
-
is_rendered() {
|
|
1017
|
-
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
|
968
|
+
return static_error_page(options, status, body.message);
|
|
969
|
+
}
|
|
970
|
+
async function handle_error_and_jsonify(event, state, options, error) {
|
|
971
|
+
if (error instanceof HttpError) {
|
|
972
|
+
return { message: "Unknown Error", ...error.body };
|
|
1018
973
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
974
|
+
const status = get_status(error);
|
|
975
|
+
const message = get_message(error);
|
|
976
|
+
return await with_request_store(
|
|
977
|
+
{ event, state },
|
|
978
|
+
() => options.hooks.handleError({ error, event, status, message })
|
|
979
|
+
) ?? { message };
|
|
980
|
+
}
|
|
981
|
+
function redirect_response(status, location) {
|
|
982
|
+
const response = new Response(void 0, {
|
|
983
|
+
status,
|
|
984
|
+
headers: { location }
|
|
985
|
+
});
|
|
986
|
+
return response;
|
|
987
|
+
}
|
|
988
|
+
function clarify_devalue_error(event, error) {
|
|
989
|
+
if (error.path) {
|
|
990
|
+
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
|
|
1021
991
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
*/
|
|
1025
|
-
#run(fn) {
|
|
1026
|
-
var previous_effect = active_effect;
|
|
1027
|
-
var previous_reaction = active_reaction;
|
|
1028
|
-
var previous_ctx = component_context;
|
|
1029
|
-
set_active_effect(this.#effect);
|
|
1030
|
-
set_active_reaction(this.#effect);
|
|
1031
|
-
set_component_context(this.#effect.ctx);
|
|
1032
|
-
try {
|
|
1033
|
-
return fn();
|
|
1034
|
-
} catch (e) {
|
|
1035
|
-
handle_error(e);
|
|
1036
|
-
return null;
|
|
1037
|
-
} finally {
|
|
1038
|
-
set_active_effect(previous_effect);
|
|
1039
|
-
set_active_reaction(previous_reaction);
|
|
1040
|
-
set_component_context(previous_ctx);
|
|
1041
|
-
}
|
|
992
|
+
if (error.path === "") {
|
|
993
|
+
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
|
1042
994
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
this.#offscreen_fragment = document.createDocumentFragment();
|
|
1050
|
-
this.#offscreen_fragment.append(
|
|
1051
|
-
/** @type {TemplateNode} */
|
|
1052
|
-
this.#pending_anchor
|
|
1053
|
-
);
|
|
1054
|
-
move_effect(this.#main_effect, this.#offscreen_fragment);
|
|
1055
|
-
}
|
|
1056
|
-
if (this.#pending_effect === null) {
|
|
1057
|
-
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
1058
|
-
}
|
|
995
|
+
return error.message;
|
|
996
|
+
}
|
|
997
|
+
function serialize_uses(node) {
|
|
998
|
+
const uses = {};
|
|
999
|
+
if (node.uses && node.uses.dependencies.size > 0) {
|
|
1000
|
+
uses.dependencies = Array.from(node.uses.dependencies);
|
|
1059
1001
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
* if any, such that we can replace the snippet with content once work is done
|
|
1063
|
-
* @param {1 | -1} d
|
|
1064
|
-
*/
|
|
1065
|
-
#update_pending_count(d) {
|
|
1066
|
-
if (!this.has_pending_snippet()) {
|
|
1067
|
-
if (this.parent) {
|
|
1068
|
-
this.parent.#update_pending_count(d);
|
|
1069
|
-
}
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
this.#pending_count += d;
|
|
1073
|
-
if (this.#pending_count === 0) {
|
|
1074
|
-
this.is_pending = false;
|
|
1075
|
-
for (const e of this.#dirty_effects) {
|
|
1076
|
-
set_signal_status(e, DIRTY);
|
|
1077
|
-
schedule_effect(e);
|
|
1078
|
-
}
|
|
1079
|
-
for (const e of this.#maybe_dirty_effects) {
|
|
1080
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
1081
|
-
schedule_effect(e);
|
|
1082
|
-
}
|
|
1083
|
-
this.#dirty_effects.clear();
|
|
1084
|
-
this.#maybe_dirty_effects.clear();
|
|
1085
|
-
if (this.#pending_effect) {
|
|
1086
|
-
pause_effect(this.#pending_effect, () => {
|
|
1087
|
-
this.#pending_effect = null;
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
if (this.#offscreen_fragment) {
|
|
1091
|
-
this.#anchor.before(this.#offscreen_fragment);
|
|
1092
|
-
this.#offscreen_fragment = null;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1002
|
+
if (node.uses && node.uses.search_params.size > 0) {
|
|
1003
|
+
uses.search_params = Array.from(node.uses.search_params);
|
|
1095
1004
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
* and controls when the current `pending` snippet (if any) is removed.
|
|
1099
|
-
* Do not call from inside the class
|
|
1100
|
-
* @param {1 | -1} d
|
|
1101
|
-
*/
|
|
1102
|
-
update_pending_count(d) {
|
|
1103
|
-
this.#update_pending_count(d);
|
|
1104
|
-
this.#local_pending_count += d;
|
|
1105
|
-
if (this.#effect_pending) {
|
|
1106
|
-
internal_set(this.#effect_pending, this.#local_pending_count);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
get_effect_pending() {
|
|
1110
|
-
this.#effect_pending_subscriber();
|
|
1111
|
-
return get(
|
|
1112
|
-
/** @type {Source<number>} */
|
|
1113
|
-
this.#effect_pending
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
/** @param {unknown} error */
|
|
1117
|
-
error(error) {
|
|
1118
|
-
var onerror = this.#props.onerror;
|
|
1119
|
-
let failed = this.#props.failed;
|
|
1120
|
-
if (this.#is_creating_fallback || !onerror && !failed) {
|
|
1121
|
-
throw error;
|
|
1122
|
-
}
|
|
1123
|
-
if (this.#main_effect) {
|
|
1124
|
-
destroy_effect(this.#main_effect);
|
|
1125
|
-
this.#main_effect = null;
|
|
1126
|
-
}
|
|
1127
|
-
if (this.#pending_effect) {
|
|
1128
|
-
destroy_effect(this.#pending_effect);
|
|
1129
|
-
this.#pending_effect = null;
|
|
1130
|
-
}
|
|
1131
|
-
if (this.#failed_effect) {
|
|
1132
|
-
destroy_effect(this.#failed_effect);
|
|
1133
|
-
this.#failed_effect = null;
|
|
1134
|
-
}
|
|
1135
|
-
if (hydrating) {
|
|
1136
|
-
set_hydrate_node(
|
|
1137
|
-
/** @type {TemplateNode} */
|
|
1138
|
-
this.#hydrate_open
|
|
1139
|
-
);
|
|
1140
|
-
next();
|
|
1141
|
-
set_hydrate_node(skip_nodes());
|
|
1142
|
-
}
|
|
1143
|
-
var did_reset = false;
|
|
1144
|
-
var calling_on_error = false;
|
|
1145
|
-
const reset = () => {
|
|
1146
|
-
if (did_reset) {
|
|
1147
|
-
svelte_boundary_reset_noop();
|
|
1148
|
-
return;
|
|
1149
|
-
}
|
|
1150
|
-
did_reset = true;
|
|
1151
|
-
if (calling_on_error) {
|
|
1152
|
-
svelte_boundary_reset_onerror();
|
|
1153
|
-
}
|
|
1154
|
-
Batch.ensure();
|
|
1155
|
-
this.#local_pending_count = 0;
|
|
1156
|
-
if (this.#failed_effect !== null) {
|
|
1157
|
-
pause_effect(this.#failed_effect, () => {
|
|
1158
|
-
this.#failed_effect = null;
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
this.is_pending = this.has_pending_snippet();
|
|
1162
|
-
this.#main_effect = this.#run(() => {
|
|
1163
|
-
this.#is_creating_fallback = false;
|
|
1164
|
-
return branch(() => this.#children(this.#anchor));
|
|
1165
|
-
});
|
|
1166
|
-
if (this.#pending_count > 0) {
|
|
1167
|
-
this.#show_pending_snippet();
|
|
1168
|
-
} else {
|
|
1169
|
-
this.is_pending = false;
|
|
1170
|
-
}
|
|
1171
|
-
};
|
|
1172
|
-
var previous_reaction = active_reaction;
|
|
1173
|
-
try {
|
|
1174
|
-
set_active_reaction(null);
|
|
1175
|
-
calling_on_error = true;
|
|
1176
|
-
onerror?.(error, reset);
|
|
1177
|
-
calling_on_error = false;
|
|
1178
|
-
} catch (error2) {
|
|
1179
|
-
invoke_error_boundary(error2, this.#effect && this.#effect.parent);
|
|
1180
|
-
} finally {
|
|
1181
|
-
set_active_reaction(previous_reaction);
|
|
1182
|
-
}
|
|
1183
|
-
if (failed) {
|
|
1184
|
-
queue_micro_task(() => {
|
|
1185
|
-
this.#failed_effect = this.#run(() => {
|
|
1186
|
-
Batch.ensure();
|
|
1187
|
-
this.#is_creating_fallback = true;
|
|
1188
|
-
try {
|
|
1189
|
-
return branch(() => {
|
|
1190
|
-
failed(
|
|
1191
|
-
this.#anchor,
|
|
1192
|
-
() => error,
|
|
1193
|
-
() => reset
|
|
1194
|
-
);
|
|
1195
|
-
});
|
|
1196
|
-
} catch (error2) {
|
|
1197
|
-
invoke_error_boundary(
|
|
1198
|
-
error2,
|
|
1199
|
-
/** @type {Effect} */
|
|
1200
|
-
this.#effect.parent
|
|
1201
|
-
);
|
|
1202
|
-
return null;
|
|
1203
|
-
} finally {
|
|
1204
|
-
this.#is_creating_fallback = false;
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1005
|
+
if (node.uses && node.uses.params.size > 0) {
|
|
1006
|
+
uses.params = Array.from(node.uses.params);
|
|
1209
1007
|
}
|
|
1008
|
+
if (node.uses?.parent) uses.parent = 1;
|
|
1009
|
+
if (node.uses?.route) uses.route = 1;
|
|
1010
|
+
if (node.uses?.url) uses.url = 1;
|
|
1011
|
+
return uses;
|
|
1210
1012
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
let last_propagated_event = null;
|
|
1214
|
-
function handle_event_propagation(event) {
|
|
1215
|
-
var handler_element = this;
|
|
1216
|
-
var owner_document = (
|
|
1217
|
-
/** @type {Node} */
|
|
1218
|
-
handler_element.ownerDocument
|
|
1219
|
-
);
|
|
1220
|
-
var event_name = event.type;
|
|
1221
|
-
var path = event.composedPath?.() || [];
|
|
1222
|
-
var current_target = (
|
|
1223
|
-
/** @type {null | Element} */
|
|
1224
|
-
path[0] || event.target
|
|
1225
|
-
);
|
|
1226
|
-
last_propagated_event = event;
|
|
1227
|
-
var path_idx = 0;
|
|
1228
|
-
var handled_at = last_propagated_event === event && event.__root;
|
|
1229
|
-
if (handled_at) {
|
|
1230
|
-
var at_idx = path.indexOf(handled_at);
|
|
1231
|
-
if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
|
|
1232
|
-
window)) {
|
|
1233
|
-
event.__root = handler_element;
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
var handler_idx = path.indexOf(handler_element);
|
|
1237
|
-
if (handler_idx === -1) {
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
if (at_idx <= handler_idx) {
|
|
1241
|
-
path_idx = at_idx;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
current_target = /** @type {Element} */
|
|
1245
|
-
path[path_idx] || event.target;
|
|
1246
|
-
if (current_target === handler_element) return;
|
|
1247
|
-
define_property(event, "currentTarget", {
|
|
1248
|
-
configurable: true,
|
|
1249
|
-
get() {
|
|
1250
|
-
return current_target || owner_document;
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1253
|
-
var previous_reaction = active_reaction;
|
|
1254
|
-
var previous_effect = active_effect;
|
|
1255
|
-
set_active_reaction(null);
|
|
1256
|
-
set_active_effect(null);
|
|
1257
|
-
try {
|
|
1258
|
-
var throw_error;
|
|
1259
|
-
var other_errors = [];
|
|
1260
|
-
while (current_target !== null) {
|
|
1261
|
-
var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
|
|
1262
|
-
current_target.host || null;
|
|
1263
|
-
try {
|
|
1264
|
-
var delegated = current_target["__" + event_name];
|
|
1265
|
-
if (delegated != null && (!/** @type {any} */
|
|
1266
|
-
current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1267
|
-
// -> the target could not have been disabled because it emits the event in the first place
|
|
1268
|
-
event.target === current_target)) {
|
|
1269
|
-
delegated.call(current_target, event);
|
|
1270
|
-
}
|
|
1271
|
-
} catch (error) {
|
|
1272
|
-
if (throw_error) {
|
|
1273
|
-
other_errors.push(error);
|
|
1274
|
-
} else {
|
|
1275
|
-
throw_error = error;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
|
|
1279
|
-
break;
|
|
1280
|
-
}
|
|
1281
|
-
current_target = parent_element;
|
|
1282
|
-
}
|
|
1283
|
-
if (throw_error) {
|
|
1284
|
-
for (let error of other_errors) {
|
|
1285
|
-
queueMicrotask(() => {
|
|
1286
|
-
throw error;
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
throw throw_error;
|
|
1290
|
-
}
|
|
1291
|
-
} finally {
|
|
1292
|
-
event.__root = handler_element;
|
|
1293
|
-
delete event.currentTarget;
|
|
1294
|
-
set_active_reaction(previous_reaction);
|
|
1295
|
-
set_active_effect(previous_effect);
|
|
1296
|
-
}
|
|
1013
|
+
function has_prerendered_path(manifest, pathname) {
|
|
1014
|
+
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
|
1297
1015
|
}
|
|
1298
|
-
function
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
if (effect.nodes === null) {
|
|
1304
|
-
effect.nodes = { start, end, a: null, t: null };
|
|
1016
|
+
function format_server_error(status, error, event) {
|
|
1017
|
+
const formatted_text = `
|
|
1018
|
+
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
|
|
1019
|
+
if (status === 404) {
|
|
1020
|
+
return formatted_text;
|
|
1305
1021
|
}
|
|
1022
|
+
return `${formatted_text}
|
|
1023
|
+
${error.stack}`;
|
|
1306
1024
|
}
|
|
1307
|
-
function
|
|
1308
|
-
|
|
1025
|
+
function get_node_type(node_id) {
|
|
1026
|
+
const parts = node_id?.split("/");
|
|
1027
|
+
const filename = parts?.at(-1);
|
|
1028
|
+
if (!filename) return "unknown";
|
|
1029
|
+
const dot_parts = filename.split(".");
|
|
1030
|
+
return dot_parts.slice(0, -1).join(".");
|
|
1309
1031
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
const previous_hydrate_node = hydrate_node;
|
|
1316
|
-
try {
|
|
1317
|
-
var anchor = get_first_child(target);
|
|
1318
|
-
while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
|
|
1319
|
-
anchor.data !== HYDRATION_START)) {
|
|
1320
|
-
anchor = get_next_sibling(anchor);
|
|
1321
|
-
}
|
|
1322
|
-
if (!anchor) {
|
|
1323
|
-
throw HYDRATION_ERROR;
|
|
1324
|
-
}
|
|
1325
|
-
set_hydrating(true);
|
|
1326
|
-
set_hydrate_node(
|
|
1327
|
-
/** @type {Comment} */
|
|
1328
|
-
anchor
|
|
1329
|
-
);
|
|
1330
|
-
const instance = _mount(component, { ...options2, anchor });
|
|
1331
|
-
set_hydrating(false);
|
|
1332
|
-
return (
|
|
1333
|
-
/** @type {Exports} */
|
|
1334
|
-
instance
|
|
1335
|
-
);
|
|
1336
|
-
} catch (error) {
|
|
1337
|
-
if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
|
|
1338
|
-
throw error;
|
|
1339
|
-
}
|
|
1340
|
-
if (error !== HYDRATION_ERROR) {
|
|
1341
|
-
console.warn("Failed to hydrate: ", error);
|
|
1342
|
-
}
|
|
1343
|
-
if (options2.recover === false) {
|
|
1344
|
-
hydration_failed();
|
|
1345
|
-
}
|
|
1346
|
-
init_operations();
|
|
1347
|
-
clear_text_content(target);
|
|
1348
|
-
set_hydrating(false);
|
|
1349
|
-
return mount(component, options2);
|
|
1350
|
-
} finally {
|
|
1351
|
-
set_hydrating(was_hydrating);
|
|
1352
|
-
set_hydrate_node(previous_hydrate_node);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
const document_listeners = /* @__PURE__ */ new Map();
|
|
1356
|
-
function _mount(Component, { target, anchor, props = {}, events, context, intro = true }) {
|
|
1357
|
-
init_operations();
|
|
1358
|
-
var registered_events = /* @__PURE__ */ new Set();
|
|
1359
|
-
var event_handle = (events2) => {
|
|
1360
|
-
for (var i = 0; i < events2.length; i++) {
|
|
1361
|
-
var event_name = events2[i];
|
|
1362
|
-
if (registered_events.has(event_name)) continue;
|
|
1363
|
-
registered_events.add(event_name);
|
|
1364
|
-
var passive = is_passive_event(event_name);
|
|
1365
|
-
target.addEventListener(event_name, handle_event_propagation, { passive });
|
|
1366
|
-
var n = document_listeners.get(event_name);
|
|
1367
|
-
if (n === void 0) {
|
|
1368
|
-
document.addEventListener(event_name, handle_event_propagation, { passive });
|
|
1369
|
-
document_listeners.set(event_name, 1);
|
|
1370
|
-
} else {
|
|
1371
|
-
document_listeners.set(event_name, n + 1);
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
};
|
|
1375
|
-
event_handle(array_from(all_registered_events));
|
|
1376
|
-
root_event_handles.add(event_handle);
|
|
1377
|
-
var component = void 0;
|
|
1378
|
-
var unmount2 = component_root(() => {
|
|
1379
|
-
var anchor_node = anchor ?? target.appendChild(create_text());
|
|
1380
|
-
boundary(
|
|
1381
|
-
/** @type {TemplateNode} */
|
|
1382
|
-
anchor_node,
|
|
1383
|
-
{
|
|
1384
|
-
pending: () => {
|
|
1385
|
-
}
|
|
1386
|
-
},
|
|
1387
|
-
(anchor_node2) => {
|
|
1388
|
-
if (context) {
|
|
1389
|
-
push$1({});
|
|
1390
|
-
var ctx = (
|
|
1391
|
-
/** @type {ComponentContext} */
|
|
1392
|
-
component_context
|
|
1393
|
-
);
|
|
1394
|
-
ctx.c = context;
|
|
1395
|
-
}
|
|
1396
|
-
if (events) {
|
|
1397
|
-
props.$$events = events;
|
|
1398
|
-
}
|
|
1399
|
-
if (hydrating) {
|
|
1400
|
-
assign_nodes(
|
|
1401
|
-
/** @type {TemplateNode} */
|
|
1402
|
-
anchor_node2,
|
|
1403
|
-
null
|
|
1404
|
-
);
|
|
1405
|
-
}
|
|
1406
|
-
component = Component(anchor_node2, props) || {};
|
|
1407
|
-
if (hydrating) {
|
|
1408
|
-
active_effect.nodes.end = hydrate_node;
|
|
1409
|
-
if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
|
|
1410
|
-
hydrate_node.data !== HYDRATION_END) {
|
|
1411
|
-
hydration_mismatch();
|
|
1412
|
-
throw HYDRATION_ERROR;
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
if (context) {
|
|
1416
|
-
pop$1();
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
);
|
|
1420
|
-
return () => {
|
|
1421
|
-
for (var event_name of registered_events) {
|
|
1422
|
-
target.removeEventListener(event_name, handle_event_propagation);
|
|
1423
|
-
var n = (
|
|
1424
|
-
/** @type {number} */
|
|
1425
|
-
document_listeners.get(event_name)
|
|
1426
|
-
);
|
|
1427
|
-
if (--n === 0) {
|
|
1428
|
-
document.removeEventListener(event_name, handle_event_propagation);
|
|
1429
|
-
document_listeners.delete(event_name);
|
|
1430
|
-
} else {
|
|
1431
|
-
document_listeners.set(event_name, n);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
root_event_handles.delete(event_handle);
|
|
1435
|
-
if (anchor_node !== anchor) {
|
|
1436
|
-
anchor_node.parentNode?.removeChild(anchor_node);
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
});
|
|
1440
|
-
mounted_components.set(component, unmount2);
|
|
1441
|
-
return component;
|
|
1442
|
-
}
|
|
1443
|
-
let mounted_components = /* @__PURE__ */ new WeakMap();
|
|
1444
|
-
function unmount(component, options2) {
|
|
1445
|
-
const fn = mounted_components.get(component);
|
|
1446
|
-
if (fn) {
|
|
1447
|
-
mounted_components.delete(component);
|
|
1448
|
-
return fn(options2);
|
|
1449
|
-
}
|
|
1450
|
-
return Promise.resolve();
|
|
1451
|
-
}
|
|
1452
|
-
function asClassComponent$1(component) {
|
|
1453
|
-
return class extends Svelte4Component {
|
|
1454
|
-
/** @param {any} options */
|
|
1455
|
-
constructor(options2) {
|
|
1456
|
-
super({
|
|
1457
|
-
component,
|
|
1458
|
-
...options2
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
};
|
|
1032
|
+
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
1033
|
+
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
1034
|
+
function stringify(data, transport) {
|
|
1035
|
+
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
1036
|
+
return stringify$1(data, encoders);
|
|
1462
1037
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
* }} options
|
|
1472
|
-
*/
|
|
1473
|
-
constructor(options2) {
|
|
1474
|
-
var sources = /* @__PURE__ */ new Map();
|
|
1475
|
-
var add_source = (key, value) => {
|
|
1476
|
-
var s = mutable_source(value, false, false);
|
|
1477
|
-
sources.set(key, s);
|
|
1478
|
-
return s;
|
|
1479
|
-
};
|
|
1480
|
-
const props = new Proxy(
|
|
1481
|
-
{ ...options2.props || {}, $$events: {} },
|
|
1482
|
-
{
|
|
1483
|
-
get(target, prop) {
|
|
1484
|
-
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
1485
|
-
},
|
|
1486
|
-
has(target, prop) {
|
|
1487
|
-
if (prop === LEGACY_PROPS) return true;
|
|
1488
|
-
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
|
1489
|
-
return Reflect.has(target, prop);
|
|
1490
|
-
},
|
|
1491
|
-
set(target, prop, value) {
|
|
1492
|
-
set(sources.get(prop) ?? add_source(prop, value), value);
|
|
1493
|
-
return Reflect.set(target, prop, value);
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
);
|
|
1497
|
-
this.#instance = (options2.hydrate ? hydrate : mount)(options2.component, {
|
|
1498
|
-
target: options2.target,
|
|
1499
|
-
anchor: options2.anchor,
|
|
1500
|
-
props,
|
|
1501
|
-
context: options2.context,
|
|
1502
|
-
intro: options2.intro ?? false,
|
|
1503
|
-
recover: options2.recover
|
|
1504
|
-
});
|
|
1505
|
-
if (!options2?.props?.$$host || options2.sync === false) {
|
|
1506
|
-
flushSync();
|
|
1507
|
-
}
|
|
1508
|
-
this.#events = props.$$events;
|
|
1509
|
-
for (const key of Object.keys(this.#instance)) {
|
|
1510
|
-
if (key === "$set" || key === "$destroy" || key === "$on") continue;
|
|
1511
|
-
define_property(this, key, {
|
|
1512
|
-
get() {
|
|
1513
|
-
return this.#instance[key];
|
|
1514
|
-
},
|
|
1515
|
-
/** @param {any} value */
|
|
1516
|
-
set(value) {
|
|
1517
|
-
this.#instance[key] = value;
|
|
1518
|
-
},
|
|
1519
|
-
enumerable: true
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
this.#instance.$set = /** @param {Record<string, any>} next */
|
|
1523
|
-
(next2) => {
|
|
1524
|
-
Object.assign(props, next2);
|
|
1525
|
-
};
|
|
1526
|
-
this.#instance.$destroy = () => {
|
|
1527
|
-
unmount(this.#instance);
|
|
1528
|
-
};
|
|
1529
|
-
}
|
|
1530
|
-
/** @param {Record<string, any>} props */
|
|
1531
|
-
$set(props) {
|
|
1532
|
-
this.#instance.$set(props);
|
|
1533
|
-
}
|
|
1534
|
-
/**
|
|
1535
|
-
* @param {string} event
|
|
1536
|
-
* @param {(...args: any[]) => any} callback
|
|
1537
|
-
* @returns {any}
|
|
1538
|
-
*/
|
|
1539
|
-
$on(event, callback) {
|
|
1540
|
-
this.#events[event] = this.#events[event] || [];
|
|
1541
|
-
const cb = (...args) => callback.call(this, ...args);
|
|
1542
|
-
this.#events[event].push(cb);
|
|
1543
|
-
return () => {
|
|
1544
|
-
this.#events[event] = this.#events[event].filter(
|
|
1545
|
-
/** @param {any} fn */
|
|
1546
|
-
(fn) => fn !== cb
|
|
1547
|
-
);
|
|
1548
|
-
};
|
|
1549
|
-
}
|
|
1550
|
-
$destroy() {
|
|
1551
|
-
this.#instance.$destroy();
|
|
1552
|
-
}
|
|
1038
|
+
function parse_remote_arg(string, transport) {
|
|
1039
|
+
if (!string) return void 0;
|
|
1040
|
+
const json_string = text_decoder.decode(
|
|
1041
|
+
// no need to add back `=` characters, atob can handle it
|
|
1042
|
+
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
|
1043
|
+
);
|
|
1044
|
+
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
|
1045
|
+
return parse(json_string, decoders);
|
|
1553
1046
|
}
|
|
1047
|
+
function create_remote_key(id, payload) {
|
|
1048
|
+
return id + "/" + payload;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1554
1051
|
let read_implementation = null;
|
|
1555
1052
|
function set_read_implementation(fn) {
|
|
1556
1053
|
read_implementation = fn;
|
|
1557
1054
|
}
|
|
1558
|
-
function asClassComponent(component) {
|
|
1559
|
-
const component_constructor = asClassComponent$1(component);
|
|
1560
|
-
const _render = (props, { context, csp } = {}) => {
|
|
1561
|
-
const result = render(component, { props, context, csp });
|
|
1562
|
-
const munged = Object.defineProperties(
|
|
1563
|
-
/** @type {LegacyRenderResult & PromiseLike<LegacyRenderResult>} */
|
|
1564
|
-
{},
|
|
1565
|
-
{
|
|
1566
|
-
css: {
|
|
1567
|
-
value: { code: "", map: null }
|
|
1568
|
-
},
|
|
1569
|
-
head: {
|
|
1570
|
-
get: () => result.head
|
|
1571
|
-
},
|
|
1572
|
-
html: {
|
|
1573
|
-
get: () => result.body
|
|
1574
|
-
},
|
|
1575
|
-
then: {
|
|
1576
|
-
/**
|
|
1577
|
-
* this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
|
|
1578
|
-
*
|
|
1579
|
-
* @template TResult1
|
|
1580
|
-
* @template [TResult2=never]
|
|
1581
|
-
* @param { (value: LegacyRenderResult) => TResult1 } onfulfilled
|
|
1582
|
-
* @param { (reason: unknown) => TResult2 } onrejected
|
|
1583
|
-
*/
|
|
1584
|
-
value: (onfulfilled, onrejected) => {
|
|
1585
|
-
{
|
|
1586
|
-
const user_result = onfulfilled({
|
|
1587
|
-
css: munged.css,
|
|
1588
|
-
head: munged.head,
|
|
1589
|
-
html: munged.html
|
|
1590
|
-
});
|
|
1591
|
-
return Promise.resolve(user_result);
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
);
|
|
1597
|
-
return munged;
|
|
1598
|
-
};
|
|
1599
|
-
component_constructor.render = _render;
|
|
1600
|
-
return component_constructor;
|
|
1601
|
-
}
|
|
1602
|
-
function Root($$renderer, $$props) {
|
|
1603
|
-
$$renderer.component(($$renderer2) => {
|
|
1604
|
-
let {
|
|
1605
|
-
stores,
|
|
1606
|
-
page,
|
|
1607
|
-
constructors,
|
|
1608
|
-
components = [],
|
|
1609
|
-
form,
|
|
1610
|
-
data_0 = null,
|
|
1611
|
-
data_1 = null
|
|
1612
|
-
} = $$props;
|
|
1613
|
-
{
|
|
1614
|
-
setContext("__svelte__", stores);
|
|
1615
|
-
}
|
|
1616
|
-
{
|
|
1617
|
-
stores.page.set(page);
|
|
1618
|
-
}
|
|
1619
|
-
const Pyramid_1 = constructors[1];
|
|
1620
|
-
if (constructors[1]) {
|
|
1621
|
-
$$renderer2.push("<!--[-->");
|
|
1622
|
-
const Pyramid_0 = constructors[0];
|
|
1623
|
-
$$renderer2.push(`<!---->`);
|
|
1624
|
-
Pyramid_0($$renderer2, {
|
|
1625
|
-
data: data_0,
|
|
1626
|
-
form,
|
|
1627
|
-
params: page.params,
|
|
1628
|
-
children: ($$renderer3) => {
|
|
1629
|
-
$$renderer3.push(`<!---->`);
|
|
1630
|
-
Pyramid_1($$renderer3, { data: data_1, form, params: page.params });
|
|
1631
|
-
$$renderer3.push(`<!---->`);
|
|
1632
|
-
},
|
|
1633
|
-
$$slots: { default: true }
|
|
1634
|
-
});
|
|
1635
|
-
$$renderer2.push(`<!---->`);
|
|
1636
|
-
} else {
|
|
1637
|
-
$$renderer2.push("<!--[!-->");
|
|
1638
|
-
const Pyramid_0 = constructors[0];
|
|
1639
|
-
$$renderer2.push(`<!---->`);
|
|
1640
|
-
Pyramid_0($$renderer2, { data: data_0, form, params: page.params });
|
|
1641
|
-
$$renderer2.push(`<!---->`);
|
|
1642
|
-
}
|
|
1643
|
-
$$renderer2.push(`<!--]--> `);
|
|
1644
|
-
{
|
|
1645
|
-
$$renderer2.push("<!--[!-->");
|
|
1646
|
-
}
|
|
1647
|
-
$$renderer2.push(`<!--]-->`);
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
|
-
const root = asClassComponent(Root);
|
|
1651
1055
|
const options = {
|
|
1652
1056
|
app_template_contains_nonce: false,
|
|
1653
1057
|
async: false,
|
|
@@ -1666,7 +1070,7 @@ const options = {
|
|
|
1666
1070
|
service_worker_options: void 0,
|
|
1667
1071
|
templates: {
|
|
1668
1072
|
app: ({ head, body, assets, nonce, env }) => `<!doctype html>
|
|
1669
|
-
<html lang="
|
|
1073
|
+
<html lang="en" data-theme="dark">
|
|
1670
1074
|
<head>
|
|
1671
1075
|
<meta charset="utf-8" />
|
|
1672
1076
|
<link
|
|
@@ -1744,248 +1148,40 @@ const options = {
|
|
|
1744
1148
|
</head>
|
|
1745
1149
|
<body>
|
|
1746
1150
|
<div class="error">
|
|
1747
|
-
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
|
1748
|
-
},
|
|
1749
|
-
version_hash: "
|
|
1750
|
-
};
|
|
1751
|
-
async function get_hooks() {
|
|
1752
|
-
let handle;
|
|
1753
|
-
let handleFetch;
|
|
1754
|
-
let handleError;
|
|
1755
|
-
let handleValidationError;
|
|
1756
|
-
let init;
|
|
1757
|
-
let reroute;
|
|
1758
|
-
let transport;
|
|
1759
|
-
return {
|
|
1760
|
-
handle,
|
|
1761
|
-
handleFetch,
|
|
1762
|
-
handleError,
|
|
1763
|
-
handleValidationError,
|
|
1764
|
-
init,
|
|
1765
|
-
reroute,
|
|
1766
|
-
transport
|
|
1767
|
-
};
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
function with_resolvers() {
|
|
1771
|
-
let resolve2;
|
|
1772
|
-
let reject;
|
|
1773
|
-
const promise = new Promise((res, rej) => {
|
|
1774
|
-
resolve2 = res;
|
|
1775
|
-
reject = rej;
|
|
1776
|
-
});
|
|
1777
|
-
return { promise, resolve: resolve2, reject };
|
|
1778
|
-
}
|
|
1779
|
-
const NULL_BODY_STATUS = [101, 103, 204, 205, 304];
|
|
1780
|
-
const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
|
|
1781
|
-
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
|
1782
|
-
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
1783
|
-
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
|
1784
|
-
function negotiate(accept, types) {
|
|
1785
|
-
const parts = [];
|
|
1786
|
-
accept.split(",").forEach((str, i) => {
|
|
1787
|
-
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
|
1788
|
-
if (match) {
|
|
1789
|
-
const [, type, subtype, q = "1"] = match;
|
|
1790
|
-
parts.push({ type, subtype, q: +q, i });
|
|
1791
|
-
}
|
|
1792
|
-
});
|
|
1793
|
-
parts.sort((a, b) => {
|
|
1794
|
-
if (a.q !== b.q) {
|
|
1795
|
-
return b.q - a.q;
|
|
1796
|
-
}
|
|
1797
|
-
if (a.subtype === "*" !== (b.subtype === "*")) {
|
|
1798
|
-
return a.subtype === "*" ? 1 : -1;
|
|
1799
|
-
}
|
|
1800
|
-
if (a.type === "*" !== (b.type === "*")) {
|
|
1801
|
-
return a.type === "*" ? 1 : -1;
|
|
1802
|
-
}
|
|
1803
|
-
return a.i - b.i;
|
|
1804
|
-
});
|
|
1805
|
-
let accepted;
|
|
1806
|
-
let min_priority = Infinity;
|
|
1807
|
-
for (const mimetype of types) {
|
|
1808
|
-
const [type, subtype] = mimetype.split("/");
|
|
1809
|
-
const priority = parts.findIndex(
|
|
1810
|
-
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
|
1811
|
-
);
|
|
1812
|
-
if (priority !== -1 && priority < min_priority) {
|
|
1813
|
-
accepted = mimetype;
|
|
1814
|
-
min_priority = priority;
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
return accepted;
|
|
1818
|
-
}
|
|
1819
|
-
function is_content_type(request, ...types) {
|
|
1820
|
-
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
|
1821
|
-
return types.includes(type.toLowerCase());
|
|
1822
|
-
}
|
|
1823
|
-
function is_form_content_type(request) {
|
|
1824
|
-
return is_content_type(
|
|
1825
|
-
request,
|
|
1826
|
-
"application/x-www-form-urlencoded",
|
|
1827
|
-
"multipart/form-data",
|
|
1828
|
-
"text/plain",
|
|
1829
|
-
BINARY_FORM_CONTENT_TYPE
|
|
1830
|
-
);
|
|
1831
|
-
}
|
|
1832
|
-
function coalesce_to_error(err) {
|
|
1833
|
-
return err instanceof Error || err && /** @type {any} */
|
|
1834
|
-
err.name && /** @type {any} */
|
|
1835
|
-
err.message ? (
|
|
1836
|
-
/** @type {Error} */
|
|
1837
|
-
err
|
|
1838
|
-
) : new Error(JSON.stringify(err));
|
|
1839
|
-
}
|
|
1840
|
-
function normalize_error(error2) {
|
|
1841
|
-
return (
|
|
1842
|
-
/** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
|
|
1843
|
-
error2
|
|
1844
|
-
);
|
|
1845
|
-
}
|
|
1846
|
-
function get_status(error2) {
|
|
1847
|
-
return error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500;
|
|
1848
|
-
}
|
|
1849
|
-
function get_message(error2) {
|
|
1850
|
-
return error2 instanceof SvelteKitError ? error2.text : "Internal Error";
|
|
1851
|
-
}
|
|
1852
|
-
const escape_html_attr_dict = {
|
|
1853
|
-
"&": "&",
|
|
1854
|
-
'"': """
|
|
1855
|
-
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
|
1856
|
-
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
|
1857
|
-
// However, that doesn't apply in SvelteKit
|
|
1858
|
-
};
|
|
1859
|
-
const escape_html_dict = {
|
|
1860
|
-
"&": "&",
|
|
1861
|
-
"<": "<"
|
|
1151
|
+
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
|
1152
|
+
},
|
|
1153
|
+
version_hash: "a1znh"
|
|
1862
1154
|
};
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
}
|
|
1881
|
-
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
|
1882
|
-
});
|
|
1883
|
-
return escaped_str;
|
|
1884
|
-
}
|
|
1885
|
-
function method_not_allowed(mod, method) {
|
|
1886
|
-
return text(`${method} method not allowed`, {
|
|
1887
|
-
status: 405,
|
|
1888
|
-
headers: {
|
|
1889
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
|
1890
|
-
// "The server must generate an Allow header field in a 405 status code response"
|
|
1891
|
-
allow: allowed_methods(mod).join(", ")
|
|
1892
|
-
}
|
|
1893
|
-
});
|
|
1894
|
-
}
|
|
1895
|
-
function allowed_methods(mod) {
|
|
1896
|
-
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
|
1897
|
-
if ("GET" in mod && !("HEAD" in mod)) {
|
|
1898
|
-
allowed.push("HEAD");
|
|
1899
|
-
}
|
|
1900
|
-
return allowed;
|
|
1901
|
-
}
|
|
1902
|
-
function get_global_name(options2) {
|
|
1903
|
-
return `__sveltekit_${options2.version_hash}`;
|
|
1904
|
-
}
|
|
1905
|
-
function static_error_page(options2, status, message) {
|
|
1906
|
-
let page = options2.templates.error({ status, message: escape_html(message) });
|
|
1907
|
-
return text(page, {
|
|
1908
|
-
headers: { "content-type": "text/html; charset=utf-8" },
|
|
1909
|
-
status
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
async function handle_fatal_error(event, state, options2, error2) {
|
|
1913
|
-
error2 = error2 instanceof HttpError ? error2 : coalesce_to_error(error2);
|
|
1914
|
-
const status = get_status(error2);
|
|
1915
|
-
const body2 = await handle_error_and_jsonify(event, state, options2, error2);
|
|
1916
|
-
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
|
1917
|
-
"application/json",
|
|
1918
|
-
"text/html"
|
|
1919
|
-
]);
|
|
1920
|
-
if (event.isDataRequest || type === "application/json") {
|
|
1921
|
-
return json(body2, {
|
|
1922
|
-
status
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
return static_error_page(options2, status, body2.message);
|
|
1926
|
-
}
|
|
1927
|
-
async function handle_error_and_jsonify(event, state, options2, error2) {
|
|
1928
|
-
if (error2 instanceof HttpError) {
|
|
1929
|
-
return { message: "Unknown Error", ...error2.body };
|
|
1930
|
-
}
|
|
1931
|
-
const status = get_status(error2);
|
|
1932
|
-
const message = get_message(error2);
|
|
1933
|
-
return await with_request_store(
|
|
1934
|
-
{ event, state },
|
|
1935
|
-
() => options2.hooks.handleError({ error: error2, event, status, message })
|
|
1936
|
-
) ?? { message };
|
|
1155
|
+
async function get_hooks() {
|
|
1156
|
+
let handle;
|
|
1157
|
+
let handleFetch;
|
|
1158
|
+
let handleError;
|
|
1159
|
+
let handleValidationError;
|
|
1160
|
+
let init;
|
|
1161
|
+
let reroute;
|
|
1162
|
+
let transport;
|
|
1163
|
+
return {
|
|
1164
|
+
handle,
|
|
1165
|
+
handleFetch,
|
|
1166
|
+
handleError,
|
|
1167
|
+
handleValidationError,
|
|
1168
|
+
init,
|
|
1169
|
+
reroute,
|
|
1170
|
+
transport
|
|
1171
|
+
};
|
|
1937
1172
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1173
|
+
|
|
1174
|
+
function with_resolvers() {
|
|
1175
|
+
let resolve2;
|
|
1176
|
+
let reject;
|
|
1177
|
+
const promise = new Promise((res, rej) => {
|
|
1178
|
+
resolve2 = res;
|
|
1179
|
+
reject = rej;
|
|
1942
1180
|
});
|
|
1943
|
-
return
|
|
1944
|
-
}
|
|
1945
|
-
function clarify_devalue_error(event, error2) {
|
|
1946
|
-
if (error2.path) {
|
|
1947
|
-
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error2.message} (${error2.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
|
|
1948
|
-
}
|
|
1949
|
-
if (error2.path === "") {
|
|
1950
|
-
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
|
1951
|
-
}
|
|
1952
|
-
return error2.message;
|
|
1953
|
-
}
|
|
1954
|
-
function serialize_uses(node) {
|
|
1955
|
-
const uses = {};
|
|
1956
|
-
if (node.uses && node.uses.dependencies.size > 0) {
|
|
1957
|
-
uses.dependencies = Array.from(node.uses.dependencies);
|
|
1958
|
-
}
|
|
1959
|
-
if (node.uses && node.uses.search_params.size > 0) {
|
|
1960
|
-
uses.search_params = Array.from(node.uses.search_params);
|
|
1961
|
-
}
|
|
1962
|
-
if (node.uses && node.uses.params.size > 0) {
|
|
1963
|
-
uses.params = Array.from(node.uses.params);
|
|
1964
|
-
}
|
|
1965
|
-
if (node.uses?.parent) uses.parent = 1;
|
|
1966
|
-
if (node.uses?.route) uses.route = 1;
|
|
1967
|
-
if (node.uses?.url) uses.url = 1;
|
|
1968
|
-
return uses;
|
|
1969
|
-
}
|
|
1970
|
-
function has_prerendered_path(manifest, pathname) {
|
|
1971
|
-
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
|
1972
|
-
}
|
|
1973
|
-
function format_server_error(status, error2, event) {
|
|
1974
|
-
const formatted_text = `
|
|
1975
|
-
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
|
|
1976
|
-
if (status === 404) {
|
|
1977
|
-
return formatted_text;
|
|
1978
|
-
}
|
|
1979
|
-
return `${formatted_text}
|
|
1980
|
-
${error2.stack}`;
|
|
1981
|
-
}
|
|
1982
|
-
function get_node_type(node_id) {
|
|
1983
|
-
const parts = node_id?.split("/");
|
|
1984
|
-
const filename = parts?.at(-1);
|
|
1985
|
-
if (!filename) return "unknown";
|
|
1986
|
-
const dot_parts = filename.split(".");
|
|
1987
|
-
return dot_parts.slice(0, -1).join(".");
|
|
1181
|
+
return { promise, resolve: resolve2, reject };
|
|
1988
1182
|
}
|
|
1183
|
+
const NULL_BODY_STATUS = [101, 103, 204, 205, 304];
|
|
1184
|
+
const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
|
|
1989
1185
|
async function render_endpoint(event, event_state, mod, state) {
|
|
1990
1186
|
const method = (
|
|
1991
1187
|
/** @type {import('types').HttpMethod} */
|
|
@@ -2009,8 +1205,8 @@ async function render_endpoint(event, event_state, mod, state) {
|
|
|
2009
1205
|
return new Response(void 0, { status: 204 });
|
|
2010
1206
|
}
|
|
2011
1207
|
}
|
|
2012
|
-
event_state.is_endpoint_request = true;
|
|
2013
1208
|
try {
|
|
1209
|
+
event_state.allows_commands = true;
|
|
2014
1210
|
const response = await with_request_store(
|
|
2015
1211
|
{ event, state: event_state },
|
|
2016
1212
|
() => handler(
|
|
@@ -2172,7 +1368,7 @@ async function handle_action_json_request(event, event_state, options2, server)
|
|
|
2172
1368
|
check_named_default_separate(actions);
|
|
2173
1369
|
try {
|
|
2174
1370
|
const data = await call_action(event, event_state, actions);
|
|
2175
|
-
if (
|
|
1371
|
+
if (browser) ;
|
|
2176
1372
|
if (data instanceof ActionFailure) {
|
|
2177
1373
|
return action_json({
|
|
2178
1374
|
type: "failure",
|
|
@@ -2257,7 +1453,7 @@ async function handle_action_request(event, event_state, server) {
|
|
|
2257
1453
|
check_named_default_separate(actions);
|
|
2258
1454
|
try {
|
|
2259
1455
|
const data = await call_action(event, event_state, actions);
|
|
2260
|
-
if (
|
|
1456
|
+
if (browser) ;
|
|
2261
1457
|
if (data instanceof ActionFailure) {
|
|
2262
1458
|
return {
|
|
2263
1459
|
type: "failure",
|
|
@@ -2326,6 +1522,7 @@ async function call_action(event, event_state, actions) {
|
|
|
2326
1522
|
},
|
|
2327
1523
|
fn: async (current2) => {
|
|
2328
1524
|
const traced_event = merge_tracing(event, current2);
|
|
1525
|
+
event_state.allows_commands = true;
|
|
2329
1526
|
const result = await with_request_store(
|
|
2330
1527
|
{ event: traced_event, state: event_state },
|
|
2331
1528
|
() => action(traced_event)
|
|
@@ -2367,13 +1564,14 @@ function try_serialize(data, fn, route_id) {
|
|
|
2367
1564
|
);
|
|
2368
1565
|
if (data instanceof Response) {
|
|
2369
1566
|
throw new Error(
|
|
2370
|
-
`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" })
|
|
1567
|
+
`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`,
|
|
1568
|
+
{ cause: e }
|
|
2371
1569
|
);
|
|
2372
1570
|
}
|
|
2373
1571
|
if ("path" in error2) {
|
|
2374
1572
|
let message = `Data returned from action inside ${route_id} is not serializable: ${error2.message}`;
|
|
2375
1573
|
if (error2.path !== "") message += ` (data.${error2.path})`;
|
|
2376
|
-
throw new Error(message);
|
|
1574
|
+
throw new Error(message, { cause: e });
|
|
2377
1575
|
}
|
|
2378
1576
|
throw error2;
|
|
2379
1577
|
}
|
|
@@ -2437,7 +1635,6 @@ function server_data_serializer(event, event_state, options2) {
|
|
|
2437
1635
|
options2,
|
|
2438
1636
|
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
|
2439
1637
|
);
|
|
2440
|
-
data = void 0;
|
|
2441
1638
|
str = uneval([, error2], replacer);
|
|
2442
1639
|
}
|
|
2443
1640
|
return {
|
|
@@ -2481,7 +1678,7 @@ function server_data_serializer(event, event_state, options2) {
|
|
|
2481
1678
|
event,
|
|
2482
1679
|
/** @type {any} */
|
|
2483
1680
|
e
|
|
2484
|
-
));
|
|
1681
|
+
), { cause: e });
|
|
2485
1682
|
}
|
|
2486
1683
|
},
|
|
2487
1684
|
get_data(csp) {
|
|
@@ -2574,7 +1771,7 @@ function server_data_serializer_json(event, event_state, options2) {
|
|
|
2574
1771
|
event,
|
|
2575
1772
|
/** @type {any} */
|
|
2576
1773
|
e
|
|
2577
|
-
));
|
|
1774
|
+
), { cause: e });
|
|
2578
1775
|
}
|
|
2579
1776
|
},
|
|
2580
1777
|
get_data() {
|
|
@@ -3106,16 +2303,22 @@ class BaseProvider {
|
|
|
3106
2303
|
#style_src_elem_needs_csp;
|
|
3107
2304
|
/** @type {import('types').CspDirectives} */
|
|
3108
2305
|
#directives;
|
|
3109
|
-
/** @type {import('types').Csp.Source
|
|
2306
|
+
/** @type {Set<import('types').Csp.Source>} */
|
|
3110
2307
|
#script_src;
|
|
3111
|
-
/** @type {import('types').Csp.Source
|
|
2308
|
+
/** @type {Set<import('types').Csp.Source>} */
|
|
3112
2309
|
#script_src_elem;
|
|
3113
|
-
/** @type {import('types').Csp.Source
|
|
2310
|
+
/** @type {Set<import('types').Csp.Source>} */
|
|
3114
2311
|
#style_src;
|
|
3115
|
-
/** @type {import('types').Csp.Source
|
|
2312
|
+
/** @type {Set<import('types').Csp.Source>} */
|
|
3116
2313
|
#style_src_attr;
|
|
3117
|
-
/** @type {import('types').Csp.Source
|
|
2314
|
+
/** @type {Set<import('types').Csp.Source>} */
|
|
3118
2315
|
#style_src_elem;
|
|
2316
|
+
/** @type {boolean} */
|
|
2317
|
+
script_needs_nonce;
|
|
2318
|
+
/** @type {boolean} */
|
|
2319
|
+
style_needs_nonce;
|
|
2320
|
+
/** @type {boolean} */
|
|
2321
|
+
script_needs_hash;
|
|
3119
2322
|
/** @type {string} */
|
|
3120
2323
|
#nonce;
|
|
3121
2324
|
/**
|
|
@@ -3127,26 +2330,28 @@ class BaseProvider {
|
|
|
3127
2330
|
this.#use_hashes = use_hashes;
|
|
3128
2331
|
this.#directives = directives;
|
|
3129
2332
|
const d = this.#directives;
|
|
3130
|
-
this.#script_src =
|
|
3131
|
-
this.#script_src_elem =
|
|
3132
|
-
this.#style_src =
|
|
3133
|
-
this.#style_src_attr =
|
|
3134
|
-
this.#style_src_elem =
|
|
2333
|
+
this.#script_src = /* @__PURE__ */ new Set();
|
|
2334
|
+
this.#script_src_elem = /* @__PURE__ */ new Set();
|
|
2335
|
+
this.#style_src = /* @__PURE__ */ new Set();
|
|
2336
|
+
this.#style_src_attr = /* @__PURE__ */ new Set();
|
|
2337
|
+
this.#style_src_elem = /* @__PURE__ */ new Set();
|
|
3135
2338
|
const effective_script_src = d["script-src"] || d["default-src"];
|
|
3136
2339
|
const script_src_elem = d["script-src-elem"];
|
|
3137
2340
|
const effective_style_src = d["style-src"] || d["default-src"];
|
|
3138
2341
|
const style_src_attr = d["style-src-attr"];
|
|
3139
2342
|
const style_src_elem = d["style-src-elem"];
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
this.#
|
|
3143
|
-
this.#
|
|
3144
|
-
this.#
|
|
3145
|
-
this.#
|
|
2343
|
+
const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
|
|
2344
|
+
const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
|
|
2345
|
+
this.#script_src_needs_csp = script_needs_csp(effective_script_src);
|
|
2346
|
+
this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
|
|
2347
|
+
this.#style_src_needs_csp = style_needs_csp(effective_style_src);
|
|
2348
|
+
this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
|
|
2349
|
+
this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
|
|
3146
2350
|
this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
|
|
3147
2351
|
this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
|
|
3148
2352
|
this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
|
|
3149
2353
|
this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
|
|
2354
|
+
this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
|
|
3150
2355
|
this.#nonce = nonce;
|
|
3151
2356
|
}
|
|
3152
2357
|
/** @param {string} content */
|
|
@@ -3154,10 +2359,21 @@ class BaseProvider {
|
|
|
3154
2359
|
if (!this.#script_needs_csp) return;
|
|
3155
2360
|
const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
|
|
3156
2361
|
if (this.#script_src_needs_csp) {
|
|
3157
|
-
this.#script_src.
|
|
2362
|
+
this.#script_src.add(source);
|
|
3158
2363
|
}
|
|
3159
2364
|
if (this.#script_src_elem_needs_csp) {
|
|
3160
|
-
this.#script_src_elem.
|
|
2365
|
+
this.#script_src_elem.add(source);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
/** @param {`sha256-${string}`[]} hashes */
|
|
2369
|
+
add_script_hashes(hashes) {
|
|
2370
|
+
for (const hash2 of hashes) {
|
|
2371
|
+
if (this.#script_src_needs_csp) {
|
|
2372
|
+
this.#script_src.add(hash2);
|
|
2373
|
+
}
|
|
2374
|
+
if (this.#script_src_elem_needs_csp) {
|
|
2375
|
+
this.#script_src_elem.add(hash2);
|
|
2376
|
+
}
|
|
3161
2377
|
}
|
|
3162
2378
|
}
|
|
3163
2379
|
/** @param {string} content */
|
|
@@ -3165,19 +2381,19 @@ class BaseProvider {
|
|
|
3165
2381
|
if (!this.#style_needs_csp) return;
|
|
3166
2382
|
const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
|
|
3167
2383
|
if (this.#style_src_needs_csp) {
|
|
3168
|
-
this.#style_src.
|
|
2384
|
+
this.#style_src.add(source);
|
|
3169
2385
|
}
|
|
3170
2386
|
if (this.#style_src_attr_needs_csp) {
|
|
3171
|
-
this.#style_src_attr.
|
|
2387
|
+
this.#style_src_attr.add(source);
|
|
3172
2388
|
}
|
|
3173
2389
|
if (this.#style_src_elem_needs_csp) {
|
|
3174
2390
|
const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
|
|
3175
2391
|
const d = this.#directives;
|
|
3176
|
-
if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.
|
|
3177
|
-
this.#style_src_elem.
|
|
2392
|
+
if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) {
|
|
2393
|
+
this.#style_src_elem.add(sha256_empty_comment_hash);
|
|
3178
2394
|
}
|
|
3179
2395
|
if (source !== sha256_empty_comment_hash) {
|
|
3180
|
-
this.#style_src_elem.
|
|
2396
|
+
this.#style_src_elem.add(source);
|
|
3181
2397
|
}
|
|
3182
2398
|
}
|
|
3183
2399
|
}
|
|
@@ -3187,31 +2403,31 @@ class BaseProvider {
|
|
|
3187
2403
|
get_header(is_meta = false) {
|
|
3188
2404
|
const header = [];
|
|
3189
2405
|
const directives = { ...this.#directives };
|
|
3190
|
-
if (this.#style_src.
|
|
2406
|
+
if (this.#style_src.size > 0) {
|
|
3191
2407
|
directives["style-src"] = [
|
|
3192
2408
|
...directives["style-src"] || directives["default-src"] || [],
|
|
3193
2409
|
...this.#style_src
|
|
3194
2410
|
];
|
|
3195
2411
|
}
|
|
3196
|
-
if (this.#style_src_attr.
|
|
2412
|
+
if (this.#style_src_attr.size > 0) {
|
|
3197
2413
|
directives["style-src-attr"] = [
|
|
3198
2414
|
...directives["style-src-attr"] || [],
|
|
3199
2415
|
...this.#style_src_attr
|
|
3200
2416
|
];
|
|
3201
2417
|
}
|
|
3202
|
-
if (this.#style_src_elem.
|
|
2418
|
+
if (this.#style_src_elem.size > 0) {
|
|
3203
2419
|
directives["style-src-elem"] = [
|
|
3204
2420
|
...directives["style-src-elem"] || [],
|
|
3205
2421
|
...this.#style_src_elem
|
|
3206
2422
|
];
|
|
3207
2423
|
}
|
|
3208
|
-
if (this.#script_src.
|
|
2424
|
+
if (this.#script_src.size > 0) {
|
|
3209
2425
|
directives["script-src"] = [
|
|
3210
2426
|
...directives["script-src"] || directives["default-src"] || [],
|
|
3211
2427
|
...this.#script_src
|
|
3212
2428
|
];
|
|
3213
2429
|
}
|
|
3214
|
-
if (this.#script_src_elem.
|
|
2430
|
+
if (this.#script_src_elem.size > 0) {
|
|
3215
2431
|
directives["script-src-elem"] = [
|
|
3216
2432
|
...directives["script-src-elem"] || [],
|
|
3217
2433
|
...this.#script_src_elem
|
|
@@ -3285,6 +2501,9 @@ class Csp {
|
|
|
3285
2501
|
this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
|
|
3286
2502
|
this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
|
|
3287
2503
|
}
|
|
2504
|
+
get script_needs_hash() {
|
|
2505
|
+
return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
|
|
2506
|
+
}
|
|
3288
2507
|
get script_needs_nonce() {
|
|
3289
2508
|
return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
|
|
3290
2509
|
}
|
|
@@ -3296,6 +2515,11 @@ class Csp {
|
|
|
3296
2515
|
this.csp_provider.add_script(content);
|
|
3297
2516
|
this.report_only_provider.add_script(content);
|
|
3298
2517
|
}
|
|
2518
|
+
/** @param {`sha256-${string}`[]} hashes */
|
|
2519
|
+
add_script_hashes(hashes) {
|
|
2520
|
+
this.csp_provider.add_script_hashes(hashes);
|
|
2521
|
+
this.report_only_provider.add_script_hashes(hashes);
|
|
2522
|
+
}
|
|
3299
2523
|
/** @param {string} content */
|
|
3300
2524
|
add_style(content) {
|
|
3301
2525
|
this.csp_provider.add_style(content);
|
|
@@ -3315,8 +2539,11 @@ function exec(match, params, matchers) {
|
|
|
3315
2539
|
buffered = 0;
|
|
3316
2540
|
}
|
|
3317
2541
|
if (value === void 0) {
|
|
3318
|
-
if (param.rest)
|
|
3319
|
-
|
|
2542
|
+
if (param.rest) {
|
|
2543
|
+
value = "";
|
|
2544
|
+
} else {
|
|
2545
|
+
continue;
|
|
2546
|
+
}
|
|
3320
2547
|
}
|
|
3321
2548
|
if (!param.matcher || matchers[param.matcher](value)) {
|
|
3322
2549
|
result[param.name] = value;
|
|
@@ -3339,6 +2566,20 @@ function exec(match, params, matchers) {
|
|
|
3339
2566
|
if (buffered) return;
|
|
3340
2567
|
return result;
|
|
3341
2568
|
}
|
|
2569
|
+
function find_route(path, routes, matchers) {
|
|
2570
|
+
for (const route of routes) {
|
|
2571
|
+
const match = route.pattern.exec(path);
|
|
2572
|
+
if (!match) continue;
|
|
2573
|
+
const matched = exec(match, route.params, matchers);
|
|
2574
|
+
if (matched) {
|
|
2575
|
+
return {
|
|
2576
|
+
route,
|
|
2577
|
+
params: decode_params(matched)
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return null;
|
|
2582
|
+
}
|
|
3342
2583
|
function generate_route_object(route, url, manifest) {
|
|
3343
2584
|
const { errors, layouts, leaf } = route;
|
|
3344
2585
|
const nodes = [...errors, ...layouts.map((l) => l?.[1]), leaf[1]].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(manifest._.client.nodes?.[n], url)}`).join(",\n ");
|
|
@@ -3370,20 +2611,9 @@ async function resolve_route(resolved_path, url, manifest) {
|
|
|
3370
2611
|
if (!manifest._.client.routes) {
|
|
3371
2612
|
return text("Server-side route resolution disabled", { status: 400 });
|
|
3372
2613
|
}
|
|
3373
|
-
let route = null;
|
|
3374
|
-
let params = {};
|
|
3375
2614
|
const matchers = await manifest._.matchers();
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
if (!match) continue;
|
|
3379
|
-
const matched = exec(match, candidate.params, matchers);
|
|
3380
|
-
if (matched) {
|
|
3381
|
-
route = candidate;
|
|
3382
|
-
params = decode_params(matched);
|
|
3383
|
-
break;
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
return create_server_routing_response(route, params, url, manifest).response;
|
|
2615
|
+
const result = find_route(resolved_path, manifest._.client.routes, matchers);
|
|
2616
|
+
return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest).response;
|
|
3387
2617
|
}
|
|
3388
2618
|
function create_server_routing_response(route, params, url, manifest) {
|
|
3389
2619
|
const headers2 = new Headers({
|
|
@@ -3447,13 +2677,15 @@ async function render_response({
|
|
|
3447
2677
|
const stylesheets = new Set(client.stylesheets);
|
|
3448
2678
|
const fonts = new Set(client.fonts);
|
|
3449
2679
|
const link_headers = /* @__PURE__ */ new Set();
|
|
3450
|
-
const link_tags = /* @__PURE__ */ new Set();
|
|
3451
2680
|
const inline_styles = /* @__PURE__ */ new Map();
|
|
3452
2681
|
let rendered;
|
|
3453
2682
|
const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
|
|
3454
2683
|
let base$1 = base;
|
|
3455
2684
|
let assets$1 = assets;
|
|
3456
2685
|
let base_expression = s(base);
|
|
2686
|
+
const csp = new Csp(options2.csp, {
|
|
2687
|
+
prerender: !!state.prerendering
|
|
2688
|
+
});
|
|
3457
2689
|
{
|
|
3458
2690
|
if (!state.prerendering?.fallback) {
|
|
3459
2691
|
const segments = event.url.pathname.slice(base.length).split("/").slice(2);
|
|
@@ -3509,10 +2741,12 @@ async function render_response({
|
|
|
3509
2741
|
page: props.page
|
|
3510
2742
|
}
|
|
3511
2743
|
]
|
|
3512
|
-
])
|
|
2744
|
+
]),
|
|
2745
|
+
csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash }
|
|
3513
2746
|
};
|
|
3514
2747
|
try {
|
|
3515
|
-
if (
|
|
2748
|
+
if (browser) ;
|
|
2749
|
+
event_state.allows_commands = false;
|
|
3516
2750
|
rendered = await with_request_store({ event, state: event_state }, async () => {
|
|
3517
2751
|
if (relative) override({ base: base$1, assets: assets$1 });
|
|
3518
2752
|
const maybe_promise = options2.root.render(props, render_opts);
|
|
@@ -3523,8 +2757,14 @@ async function render_response({
|
|
|
3523
2757
|
if (options2.async) {
|
|
3524
2758
|
reset();
|
|
3525
2759
|
}
|
|
3526
|
-
const { head: head2, html: html2, css } =
|
|
3527
|
-
|
|
2760
|
+
const { head: head2, html: html2, css, hashes } = (
|
|
2761
|
+
/** @type {ReturnType<typeof options.root.render>} */
|
|
2762
|
+
options2.async ? await rendered2 : rendered2
|
|
2763
|
+
);
|
|
2764
|
+
if (hashes) {
|
|
2765
|
+
csp.add_script_hashes(hashes.script);
|
|
2766
|
+
}
|
|
2767
|
+
return { head: head2, html: html2, css, hashes };
|
|
3528
2768
|
});
|
|
3529
2769
|
} finally {
|
|
3530
2770
|
reset();
|
|
@@ -3534,17 +2774,20 @@ async function render_response({
|
|
|
3534
2774
|
for (const url of node.stylesheets) stylesheets.add(url);
|
|
3535
2775
|
for (const url of node.fonts) fonts.add(url);
|
|
3536
2776
|
if (node.inline_styles && !client.inline) {
|
|
3537
|
-
Object.entries(await node.inline_styles()).forEach(([
|
|
2777
|
+
Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
|
|
2778
|
+
if (typeof css === "string") {
|
|
2779
|
+
inline_styles.set(filename, css);
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
|
|
2783
|
+
});
|
|
3538
2784
|
}
|
|
3539
2785
|
}
|
|
3540
2786
|
} else {
|
|
3541
|
-
rendered = { head: "", html: "", css: { code: "", map: null } };
|
|
2787
|
+
rendered = { head: "", html: "", css: { code: "", map: null }, hashes: { script: [] } };
|
|
3542
2788
|
}
|
|
3543
|
-
|
|
2789
|
+
const head = new Head(rendered.head, !!state.prerendering);
|
|
3544
2790
|
let body2 = rendered.html;
|
|
3545
|
-
const csp = new Csp(options2.csp, {
|
|
3546
|
-
prerender: !!state.prerendering
|
|
3547
|
-
});
|
|
3548
2791
|
const prefixed = (path) => {
|
|
3549
2792
|
if (path.startsWith("/")) {
|
|
3550
2793
|
return base + path;
|
|
@@ -3554,10 +2797,9 @@ async function render_response({
|
|
|
3554
2797
|
const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
|
|
3555
2798
|
if (style) {
|
|
3556
2799
|
const attributes = [];
|
|
3557
|
-
if (csp.style_needs_nonce) attributes.push(`
|
|
2800
|
+
if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
|
|
3558
2801
|
csp.add_style(style);
|
|
3559
|
-
head
|
|
3560
|
-
<style${attributes.join("")}>${style}</style>`;
|
|
2802
|
+
head.add_style(style, attributes);
|
|
3561
2803
|
}
|
|
3562
2804
|
for (const dep of stylesheets) {
|
|
3563
2805
|
const path = prefixed(dep);
|
|
@@ -3569,14 +2811,13 @@ async function render_response({
|
|
|
3569
2811
|
link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
|
|
3570
2812
|
}
|
|
3571
2813
|
}
|
|
3572
|
-
head
|
|
3573
|
-
<link href="${path}" ${attributes.join(" ")}>`;
|
|
2814
|
+
head.add_stylesheet(path, attributes);
|
|
3574
2815
|
}
|
|
3575
2816
|
for (const dep of fonts) {
|
|
3576
2817
|
const path = prefixed(dep);
|
|
3577
2818
|
if (resolve_opts.preload({ type: "font", path })) {
|
|
3578
2819
|
const ext = dep.slice(dep.lastIndexOf(".") + 1);
|
|
3579
|
-
|
|
2820
|
+
head.add_link_tag(path, ['rel="preload"', 'as="font"', `type="font/${ext}"`, "crossorigin"]);
|
|
3580
2821
|
link_headers.add(
|
|
3581
2822
|
`<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`
|
|
3582
2823
|
);
|
|
@@ -3602,17 +2843,12 @@ async function render_response({
|
|
|
3602
2843
|
for (const path of included_modulepreloads) {
|
|
3603
2844
|
link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
|
|
3604
2845
|
if (options2.preload_strategy !== "modulepreload") {
|
|
3605
|
-
head
|
|
3606
|
-
<link rel="preload" as="script" crossorigin="anonymous" href="${path}">`;
|
|
2846
|
+
head.add_script_preload(path);
|
|
3607
2847
|
} else {
|
|
3608
|
-
|
|
2848
|
+
head.add_link_tag(path, ['rel="modulepreload"']);
|
|
3609
2849
|
}
|
|
3610
2850
|
}
|
|
3611
2851
|
}
|
|
3612
|
-
if (state.prerendering && link_tags.size > 0) {
|
|
3613
|
-
head += Array.from(link_tags).map((tag) => `
|
|
3614
|
-
${tag}`).join("");
|
|
3615
|
-
}
|
|
3616
2852
|
if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
|
|
3617
2853
|
const pathname = add_resolution_suffix(event.url.pathname);
|
|
3618
2854
|
state.prerendering.dependencies.set(
|
|
@@ -3774,16 +3010,14 @@ ${indent}}`);
|
|
|
3774
3010
|
"content-type": "text/html"
|
|
3775
3011
|
});
|
|
3776
3012
|
if (state.prerendering) {
|
|
3777
|
-
const http_equiv = [];
|
|
3778
3013
|
const csp_headers = csp.csp_provider.get_meta();
|
|
3779
3014
|
if (csp_headers) {
|
|
3780
|
-
|
|
3015
|
+
head.add_http_equiv(csp_headers);
|
|
3781
3016
|
}
|
|
3782
3017
|
if (state.prerendering.cache) {
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
head = http_equiv.join("\n") + head;
|
|
3018
|
+
head.add_http_equiv(
|
|
3019
|
+
`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`
|
|
3020
|
+
);
|
|
3787
3021
|
}
|
|
3788
3022
|
} else {
|
|
3789
3023
|
const csp_header = csp.csp_provider.get_header();
|
|
@@ -3798,9 +3032,8 @@ ${indent}}`);
|
|
|
3798
3032
|
headers2.set("link", Array.from(link_headers).join(", "));
|
|
3799
3033
|
}
|
|
3800
3034
|
}
|
|
3801
|
-
head += rendered.head;
|
|
3802
3035
|
const html = options2.templates.app({
|
|
3803
|
-
head,
|
|
3036
|
+
head: head.build(),
|
|
3804
3037
|
body: body2,
|
|
3805
3038
|
assets: assets$1,
|
|
3806
3039
|
nonce: (
|
|
@@ -3835,6 +3068,73 @@ ${indent}}`);
|
|
|
3835
3068
|
}
|
|
3836
3069
|
);
|
|
3837
3070
|
}
|
|
3071
|
+
class Head {
|
|
3072
|
+
#rendered;
|
|
3073
|
+
#prerendering;
|
|
3074
|
+
/** @type {string[]} */
|
|
3075
|
+
#http_equiv = [];
|
|
3076
|
+
/** @type {string[]} */
|
|
3077
|
+
#link_tags = [];
|
|
3078
|
+
/** @type {string[]} */
|
|
3079
|
+
#script_preloads = [];
|
|
3080
|
+
/** @type {string[]} */
|
|
3081
|
+
#style_tags = [];
|
|
3082
|
+
/** @type {string[]} */
|
|
3083
|
+
#stylesheet_links = [];
|
|
3084
|
+
/**
|
|
3085
|
+
* @param {string} rendered
|
|
3086
|
+
* @param {boolean} prerendering
|
|
3087
|
+
*/
|
|
3088
|
+
constructor(rendered, prerendering) {
|
|
3089
|
+
this.#rendered = rendered;
|
|
3090
|
+
this.#prerendering = prerendering;
|
|
3091
|
+
}
|
|
3092
|
+
build() {
|
|
3093
|
+
return [
|
|
3094
|
+
...this.#http_equiv,
|
|
3095
|
+
...this.#link_tags,
|
|
3096
|
+
...this.#script_preloads,
|
|
3097
|
+
this.#rendered,
|
|
3098
|
+
...this.#style_tags,
|
|
3099
|
+
...this.#stylesheet_links
|
|
3100
|
+
].join("\n ");
|
|
3101
|
+
}
|
|
3102
|
+
/**
|
|
3103
|
+
* @param {string} style
|
|
3104
|
+
* @param {string[]} attributes
|
|
3105
|
+
*/
|
|
3106
|
+
add_style(style, attributes) {
|
|
3107
|
+
this.#style_tags.push(
|
|
3108
|
+
`<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`
|
|
3109
|
+
);
|
|
3110
|
+
}
|
|
3111
|
+
/**
|
|
3112
|
+
* @param {string} href
|
|
3113
|
+
* @param {string[]} attributes
|
|
3114
|
+
*/
|
|
3115
|
+
add_stylesheet(href, attributes) {
|
|
3116
|
+
this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
|
|
3117
|
+
}
|
|
3118
|
+
/** @param {string} href */
|
|
3119
|
+
add_script_preload(href) {
|
|
3120
|
+
this.#script_preloads.push(
|
|
3121
|
+
`<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`
|
|
3122
|
+
);
|
|
3123
|
+
}
|
|
3124
|
+
/**
|
|
3125
|
+
* @param {string} href
|
|
3126
|
+
* @param {string[]} attributes
|
|
3127
|
+
*/
|
|
3128
|
+
add_link_tag(href, attributes) {
|
|
3129
|
+
if (!this.#prerendering) return;
|
|
3130
|
+
this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
|
|
3131
|
+
}
|
|
3132
|
+
/** @param {string} tag */
|
|
3133
|
+
add_http_equiv(tag) {
|
|
3134
|
+
if (!this.#prerendering) return;
|
|
3135
|
+
this.#http_equiv.push(tag);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3838
3138
|
class PageNodes {
|
|
3839
3139
|
data;
|
|
3840
3140
|
/**
|
|
@@ -4053,21 +3353,10 @@ async function handle_remote_call_internal(event, state, options2, manifest, id)
|
|
|
4053
3353
|
);
|
|
4054
3354
|
}
|
|
4055
3355
|
const { payloads } = await event.request.json();
|
|
4056
|
-
const args =
|
|
4057
|
-
|
|
4058
|
-
const results = await Promise.all(
|
|
4059
|
-
args.map(async (arg, i) => {
|
|
4060
|
-
try {
|
|
4061
|
-
return { type: "result", data: get_result(arg, i) };
|
|
4062
|
-
} catch (error2) {
|
|
4063
|
-
return {
|
|
4064
|
-
type: "error",
|
|
4065
|
-
error: await handle_error_and_jsonify(event, state, options2, error2),
|
|
4066
|
-
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
|
4067
|
-
};
|
|
4068
|
-
}
|
|
4069
|
-
})
|
|
3356
|
+
const args = await Promise.all(
|
|
3357
|
+
payloads.map((payload2) => parse_remote_arg(payload2, transport))
|
|
4070
3358
|
);
|
|
3359
|
+
const results = await with_request_store({ event, state }, () => info.run(args, options2));
|
|
4071
3360
|
return json(
|
|
4072
3361
|
/** @type {RemoteFunctionResponse} */
|
|
4073
3362
|
{
|
|
@@ -4094,6 +3383,7 @@ async function handle_remote_call_internal(event, state, options2, manifest, id)
|
|
|
4094
3383
|
);
|
|
4095
3384
|
}
|
|
4096
3385
|
const { data: data2, meta, form_data } = await deserialize_binary_form(event.request);
|
|
3386
|
+
form_client_refreshes = meta.remote_refreshes;
|
|
4097
3387
|
if (additional_args && !("id" in data2)) {
|
|
4098
3388
|
data2.id = JSON.parse(decodeURIComponent(additional_args));
|
|
4099
3389
|
}
|
|
@@ -4323,7 +3613,7 @@ async function render_page(event, event_state, page, options2, manifest, state,
|
|
|
4323
3613
|
const ssr = nodes.ssr();
|
|
4324
3614
|
const csr = nodes.csr();
|
|
4325
3615
|
if (ssr === false && !(state.prerendering && should_prerender_data)) {
|
|
4326
|
-
if (
|
|
3616
|
+
if (browser && action_result && !event.request.headers.has("x-sveltekit-action")) ;
|
|
4327
3617
|
return await render_response({
|
|
4328
3618
|
branch: [],
|
|
4329
3619
|
fetched,
|
|
@@ -4509,13 +3799,16 @@ async function render_page(event, event_state, page, options2, manifest, state,
|
|
|
4509
3799
|
data_serializer: ssr === false ? server_data_serializer(event, event_state, options2) : data_serializer
|
|
4510
3800
|
});
|
|
4511
3801
|
} catch (e) {
|
|
3802
|
+
if (e instanceof Redirect) {
|
|
3803
|
+
return redirect_response(e.status, e.location);
|
|
3804
|
+
}
|
|
4512
3805
|
return await respond_with_error({
|
|
4513
3806
|
event,
|
|
4514
3807
|
event_state,
|
|
4515
3808
|
options: options2,
|
|
4516
3809
|
manifest,
|
|
4517
3810
|
state,
|
|
4518
|
-
status: 500,
|
|
3811
|
+
status: e instanceof HttpError ? e.status : 500,
|
|
4519
3812
|
error: e,
|
|
4520
3813
|
resolve_opts
|
|
4521
3814
|
});
|
|
@@ -4970,190 +4263,193 @@ function add_cookies_to_headers(headers2, cookies) {
|
|
|
4970
4263
|
}
|
|
4971
4264
|
}
|
|
4972
4265
|
}
|
|
4973
|
-
var
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4266
|
+
var defaultParseOptions = {
|
|
4267
|
+
decodeValues: true,
|
|
4268
|
+
map: false,
|
|
4269
|
+
silent: false,
|
|
4270
|
+
split: "auto"
|
|
4271
|
+
// auto = split strings but not arrays
|
|
4272
|
+
};
|
|
4273
|
+
function isForbiddenKey(key2) {
|
|
4274
|
+
return typeof key2 !== "string" || key2 in {};
|
|
4275
|
+
}
|
|
4276
|
+
function createNullObj() {
|
|
4277
|
+
return /* @__PURE__ */ Object.create(null);
|
|
4278
|
+
}
|
|
4279
|
+
function isNonEmptyString(str) {
|
|
4280
|
+
return typeof str === "string" && !!str.trim();
|
|
4281
|
+
}
|
|
4282
|
+
function parseString(setCookieValue, options2) {
|
|
4283
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
4284
|
+
var nameValuePairStr = parts.shift();
|
|
4285
|
+
var parsed = parseNameValuePair(nameValuePairStr);
|
|
4286
|
+
var name = parsed.name;
|
|
4287
|
+
var value = parsed.value;
|
|
4288
|
+
options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
|
|
4289
|
+
if (isForbiddenKey(name)) {
|
|
4290
|
+
return null;
|
|
4988
4291
|
}
|
|
4989
|
-
|
|
4990
|
-
|
|
4292
|
+
try {
|
|
4293
|
+
value = options2.decodeValues ? decodeURIComponent(value) : value;
|
|
4294
|
+
} catch (e) {
|
|
4295
|
+
console.error(
|
|
4296
|
+
"set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
|
|
4297
|
+
e
|
|
4298
|
+
);
|
|
4991
4299
|
}
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
var
|
|
4997
|
-
var
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
return null;
|
|
5001
|
-
}
|
|
5002
|
-
try {
|
|
5003
|
-
value = options2.decodeValues ? decodeURIComponent(value) : value;
|
|
5004
|
-
} catch (e) {
|
|
5005
|
-
console.error(
|
|
5006
|
-
"set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
|
|
5007
|
-
e
|
|
5008
|
-
);
|
|
4300
|
+
var cookie2 = createNullObj();
|
|
4301
|
+
cookie2.name = name;
|
|
4302
|
+
cookie2.value = value;
|
|
4303
|
+
parts.forEach(function(part) {
|
|
4304
|
+
var sides = part.split("=");
|
|
4305
|
+
var key2 = sides.shift().trimLeft().toLowerCase();
|
|
4306
|
+
if (isForbiddenKey(key2)) {
|
|
4307
|
+
return;
|
|
5009
4308
|
}
|
|
5010
|
-
var
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
var
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
cookie2.secure = true;
|
|
5027
|
-
} else if (key2 === "httponly") {
|
|
5028
|
-
cookie2.httpOnly = true;
|
|
5029
|
-
} else if (key2 === "samesite") {
|
|
5030
|
-
cookie2.sameSite = value2;
|
|
5031
|
-
} else if (key2 === "partitioned") {
|
|
5032
|
-
cookie2.partitioned = true;
|
|
5033
|
-
} else if (key2) {
|
|
5034
|
-
cookie2[key2] = value2;
|
|
5035
|
-
}
|
|
5036
|
-
});
|
|
5037
|
-
return cookie2;
|
|
5038
|
-
}
|
|
5039
|
-
function parseNameValuePair(nameValuePairStr) {
|
|
5040
|
-
var name = "";
|
|
5041
|
-
var value = "";
|
|
5042
|
-
var nameValueArr = nameValuePairStr.split("=");
|
|
5043
|
-
if (nameValueArr.length > 1) {
|
|
5044
|
-
name = nameValueArr.shift();
|
|
5045
|
-
value = nameValueArr.join("=");
|
|
5046
|
-
} else {
|
|
5047
|
-
value = nameValuePairStr;
|
|
4309
|
+
var value2 = sides.join("=");
|
|
4310
|
+
if (key2 === "expires") {
|
|
4311
|
+
cookie2.expires = new Date(value2);
|
|
4312
|
+
} else if (key2 === "max-age") {
|
|
4313
|
+
var n = parseInt(value2, 10);
|
|
4314
|
+
if (!Number.isNaN(n)) cookie2.maxAge = n;
|
|
4315
|
+
} else if (key2 === "secure") {
|
|
4316
|
+
cookie2.secure = true;
|
|
4317
|
+
} else if (key2 === "httponly") {
|
|
4318
|
+
cookie2.httpOnly = true;
|
|
4319
|
+
} else if (key2 === "samesite") {
|
|
4320
|
+
cookie2.sameSite = value2;
|
|
4321
|
+
} else if (key2 === "partitioned") {
|
|
4322
|
+
cookie2.partitioned = true;
|
|
4323
|
+
} else if (key2) {
|
|
4324
|
+
cookie2[key2] = value2;
|
|
5048
4325
|
}
|
|
5049
|
-
|
|
4326
|
+
});
|
|
4327
|
+
return cookie2;
|
|
4328
|
+
}
|
|
4329
|
+
function parseNameValuePair(nameValuePairStr) {
|
|
4330
|
+
var name = "";
|
|
4331
|
+
var value = "";
|
|
4332
|
+
var nameValueArr = nameValuePairStr.split("=");
|
|
4333
|
+
if (nameValueArr.length > 1) {
|
|
4334
|
+
name = nameValueArr.shift();
|
|
4335
|
+
value = nameValueArr.join("=");
|
|
4336
|
+
} else {
|
|
4337
|
+
value = nameValuePairStr;
|
|
5050
4338
|
}
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
} else {
|
|
5057
|
-
return createNullObj();
|
|
5058
|
-
}
|
|
5059
|
-
}
|
|
5060
|
-
if (input.headers) {
|
|
5061
|
-
if (typeof input.headers.getSetCookie === "function") {
|
|
5062
|
-
input = input.headers.getSetCookie();
|
|
5063
|
-
} else if (input.headers["set-cookie"]) {
|
|
5064
|
-
input = input.headers["set-cookie"];
|
|
5065
|
-
} else {
|
|
5066
|
-
var sch = input.headers[Object.keys(input.headers).find(function(key2) {
|
|
5067
|
-
return key2.toLowerCase() === "set-cookie";
|
|
5068
|
-
})];
|
|
5069
|
-
if (!sch && input.headers.cookie && !options2.silent) {
|
|
5070
|
-
console.warn(
|
|
5071
|
-
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
5072
|
-
);
|
|
5073
|
-
}
|
|
5074
|
-
input = sch;
|
|
5075
|
-
}
|
|
5076
|
-
}
|
|
5077
|
-
if (!Array.isArray(input)) {
|
|
5078
|
-
input = [input];
|
|
5079
|
-
}
|
|
4339
|
+
return { name, value };
|
|
4340
|
+
}
|
|
4341
|
+
function parseSetCookie(input, options2) {
|
|
4342
|
+
options2 = options2 ? Object.assign({}, defaultParseOptions, options2) : defaultParseOptions;
|
|
4343
|
+
if (!input) {
|
|
5080
4344
|
if (!options2.map) {
|
|
5081
|
-
return
|
|
5082
|
-
return parseString(str, options2);
|
|
5083
|
-
}).filter(Boolean);
|
|
4345
|
+
return [];
|
|
5084
4346
|
} else {
|
|
5085
|
-
|
|
5086
|
-
return input.filter(isNonEmptyString).reduce(function(cookies2, str) {
|
|
5087
|
-
var cookie2 = parseString(str, options2);
|
|
5088
|
-
if (cookie2 && !isForbiddenKey(cookie2.name)) {
|
|
5089
|
-
cookies2[cookie2.name] = cookie2;
|
|
5090
|
-
}
|
|
5091
|
-
return cookies2;
|
|
5092
|
-
}, cookies);
|
|
4347
|
+
return createNullObj();
|
|
5093
4348
|
}
|
|
5094
4349
|
}
|
|
5095
|
-
|
|
5096
|
-
if (
|
|
5097
|
-
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
var cookiesSeparatorFound;
|
|
5109
|
-
function skipWhitespace() {
|
|
5110
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
5111
|
-
pos += 1;
|
|
4350
|
+
if (input.headers) {
|
|
4351
|
+
if (typeof input.headers.getSetCookie === "function") {
|
|
4352
|
+
input = input.headers.getSetCookie();
|
|
4353
|
+
} else if (input.headers["set-cookie"]) {
|
|
4354
|
+
input = input.headers["set-cookie"];
|
|
4355
|
+
} else {
|
|
4356
|
+
var sch = input.headers[Object.keys(input.headers).find(function(key2) {
|
|
4357
|
+
return key2.toLowerCase() === "set-cookie";
|
|
4358
|
+
})];
|
|
4359
|
+
if (!sch && input.headers.cookie && !options2.silent) {
|
|
4360
|
+
console.warn(
|
|
4361
|
+
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
4362
|
+
);
|
|
5112
4363
|
}
|
|
5113
|
-
|
|
4364
|
+
input = sch;
|
|
5114
4365
|
}
|
|
5115
|
-
|
|
4366
|
+
}
|
|
4367
|
+
var split = options2.split;
|
|
4368
|
+
var isArray = Array.isArray(input);
|
|
4369
|
+
if (split === "auto") {
|
|
4370
|
+
split = !isArray;
|
|
4371
|
+
}
|
|
4372
|
+
if (!isArray) {
|
|
4373
|
+
input = [input];
|
|
4374
|
+
}
|
|
4375
|
+
input = input.filter(isNonEmptyString);
|
|
4376
|
+
if (split) {
|
|
4377
|
+
input = input.map(splitCookiesString).flat();
|
|
4378
|
+
}
|
|
4379
|
+
if (!options2.map) {
|
|
4380
|
+
return input.map(function(str) {
|
|
4381
|
+
return parseString(str, options2);
|
|
4382
|
+
}).filter(Boolean);
|
|
4383
|
+
} else {
|
|
4384
|
+
var cookies = createNullObj();
|
|
4385
|
+
return input.reduce(function(cookies2, str) {
|
|
4386
|
+
var cookie2 = parseString(str, options2);
|
|
4387
|
+
if (cookie2 && !isForbiddenKey(cookie2.name)) {
|
|
4388
|
+
cookies2[cookie2.name] = cookie2;
|
|
4389
|
+
}
|
|
4390
|
+
return cookies2;
|
|
4391
|
+
}, cookies);
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4394
|
+
function splitCookiesString(cookiesString) {
|
|
4395
|
+
if (Array.isArray(cookiesString)) {
|
|
4396
|
+
return cookiesString;
|
|
4397
|
+
}
|
|
4398
|
+
if (typeof cookiesString !== "string") {
|
|
4399
|
+
return [];
|
|
4400
|
+
}
|
|
4401
|
+
var cookiesStrings = [];
|
|
4402
|
+
var pos = 0;
|
|
4403
|
+
var start;
|
|
4404
|
+
var ch;
|
|
4405
|
+
var lastComma;
|
|
4406
|
+
var nextStart;
|
|
4407
|
+
var cookiesSeparatorFound;
|
|
4408
|
+
function skipWhitespace() {
|
|
4409
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
4410
|
+
pos += 1;
|
|
4411
|
+
}
|
|
4412
|
+
return pos < cookiesString.length;
|
|
4413
|
+
}
|
|
4414
|
+
function notSpecialChar() {
|
|
4415
|
+
ch = cookiesString.charAt(pos);
|
|
4416
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
4417
|
+
}
|
|
4418
|
+
while (pos < cookiesString.length) {
|
|
4419
|
+
start = pos;
|
|
4420
|
+
cookiesSeparatorFound = false;
|
|
4421
|
+
while (skipWhitespace()) {
|
|
5116
4422
|
ch = cookiesString.charAt(pos);
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
ch = cookiesString.charAt(pos);
|
|
5124
|
-
if (ch === ",") {
|
|
5125
|
-
lastComma = pos;
|
|
4423
|
+
if (ch === ",") {
|
|
4424
|
+
lastComma = pos;
|
|
4425
|
+
pos += 1;
|
|
4426
|
+
skipWhitespace();
|
|
4427
|
+
nextStart = pos;
|
|
4428
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
5126
4429
|
pos += 1;
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
cookiesSeparatorFound = true;
|
|
5134
|
-
pos = nextStart;
|
|
5135
|
-
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
5136
|
-
start = pos;
|
|
5137
|
-
} else {
|
|
5138
|
-
pos = lastComma + 1;
|
|
5139
|
-
}
|
|
4430
|
+
}
|
|
4431
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
4432
|
+
cookiesSeparatorFound = true;
|
|
4433
|
+
pos = nextStart;
|
|
4434
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
4435
|
+
start = pos;
|
|
5140
4436
|
} else {
|
|
5141
|
-
pos
|
|
4437
|
+
pos = lastComma + 1;
|
|
5142
4438
|
}
|
|
4439
|
+
} else {
|
|
4440
|
+
pos += 1;
|
|
5143
4441
|
}
|
|
5144
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
5145
|
-
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
5146
|
-
}
|
|
5147
4442
|
}
|
|
5148
|
-
|
|
4443
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
4444
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
4445
|
+
}
|
|
5149
4446
|
}
|
|
5150
|
-
|
|
5151
|
-
setCookie.exports.parse = parse;
|
|
5152
|
-
setCookie.exports.parseString = parseString;
|
|
5153
|
-
setCookie.exports.splitCookiesString = splitCookiesString;
|
|
5154
|
-
return setCookie.exports;
|
|
4447
|
+
return cookiesStrings;
|
|
5155
4448
|
}
|
|
5156
|
-
|
|
4449
|
+
parseSetCookie.parseSetCookie = parseSetCookie;
|
|
4450
|
+
parseSetCookie.parse = parseSetCookie;
|
|
4451
|
+
parseSetCookie.parseString = parseString;
|
|
4452
|
+
parseSetCookie.splitCookiesString = splitCookiesString;
|
|
5157
4453
|
function create_fetch({ event, options: options2, manifest, state, get_cookie_header, set_internal }) {
|
|
5158
4454
|
const server_fetch = async (info, init2) => {
|
|
5159
4455
|
const original_request = normalize_fetch_input(info, init2, event.url);
|
|
@@ -5175,7 +4471,8 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
|
|
|
5175
4471
|
if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) {
|
|
5176
4472
|
request.headers.delete("origin");
|
|
5177
4473
|
}
|
|
5178
|
-
|
|
4474
|
+
const decoded = decodeURIComponent(url.pathname);
|
|
4475
|
+
if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
|
|
5179
4476
|
if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
|
|
5180
4477
|
const cookie2 = get_cookie_header(url, request.headers.get("cookie"));
|
|
5181
4478
|
if (cookie2) request.headers.set("cookie", cookie2);
|
|
@@ -5183,7 +4480,6 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
|
|
|
5183
4480
|
return fetch(request);
|
|
5184
4481
|
}
|
|
5185
4482
|
const prefix = assets || base;
|
|
5186
|
-
const decoded = decodeURIComponent(url.pathname);
|
|
5187
4483
|
const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
|
|
5188
4484
|
const filename_html = `${filename}/index.html`;
|
|
5189
4485
|
const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
|
|
@@ -5233,8 +4529,8 @@ function create_fetch({ event, options: options2, manifest, state, get_cookie_he
|
|
|
5233
4529
|
const response = await internal_fetch(request, options2, manifest, state);
|
|
5234
4530
|
const set_cookie = response.headers.get("set-cookie");
|
|
5235
4531
|
if (set_cookie) {
|
|
5236
|
-
for (const str of
|
|
5237
|
-
const { name, value, ...options3 } =
|
|
4532
|
+
for (const str of splitCookiesString(set_cookie)) {
|
|
4533
|
+
const { name, value, ...options3 } = parseString(str, {
|
|
5238
4534
|
decodeValues: false
|
|
5239
4535
|
});
|
|
5240
4536
|
const path = options3.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/");
|
|
@@ -5484,16 +4780,11 @@ async function internal_respond(request, options2, manifest, state) {
|
|
|
5484
4780
|
}
|
|
5485
4781
|
if (!state.prerendering?.fallback) {
|
|
5486
4782
|
const matchers = await manifest._.matchers();
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
route = candidate;
|
|
5493
|
-
event.route = { id: route.id };
|
|
5494
|
-
event.params = decode_params(matched);
|
|
5495
|
-
break;
|
|
5496
|
-
}
|
|
4783
|
+
const result = find_route(resolved_path, manifest._.routes, matchers);
|
|
4784
|
+
if (result) {
|
|
4785
|
+
route = result.route;
|
|
4786
|
+
event.route = { id: route.id };
|
|
4787
|
+
event.params = result.params;
|
|
5497
4788
|
}
|
|
5498
4789
|
}
|
|
5499
4790
|
let resolve_opts = {
|
|
@@ -5508,12 +4799,12 @@ async function internal_respond(request, options2, manifest, state) {
|
|
|
5508
4799
|
if (url.pathname === base || url.pathname === base + "/") {
|
|
5509
4800
|
trailing_slash = "always";
|
|
5510
4801
|
} else if (page_nodes) {
|
|
5511
|
-
if (
|
|
4802
|
+
if (browser) ;
|
|
5512
4803
|
trailing_slash = page_nodes.trailing_slash();
|
|
5513
4804
|
} else if (route.endpoint) {
|
|
5514
4805
|
const node = await route.endpoint();
|
|
5515
4806
|
trailing_slash = node.trailingSlash ?? "never";
|
|
5516
|
-
if (
|
|
4807
|
+
if (browser) ;
|
|
5517
4808
|
}
|
|
5518
4809
|
if (!is_data_request) {
|
|
5519
4810
|
const normalized = normalize_path(url.pathname, trailing_slash);
|
|
@@ -5571,6 +4862,7 @@ async function internal_respond(request, options2, manifest, state) {
|
|
|
5571
4862
|
current: root_span
|
|
5572
4863
|
}
|
|
5573
4864
|
};
|
|
4865
|
+
event_state.allows_commands = MUTATIVE_METHODS.includes(request.method);
|
|
5574
4866
|
return await with_request_store(
|
|
5575
4867
|
{ event: traced_event, state: event_state },
|
|
5576
4868
|
() => options2.hooks.handle({
|
|
@@ -5722,20 +5014,20 @@ async function internal_respond(request, options2, manifest, state) {
|
|
|
5722
5014
|
resolve_opts
|
|
5723
5015
|
);
|
|
5724
5016
|
} else {
|
|
5725
|
-
const
|
|
5017
|
+
const allowed_methods = new Set(allowed_page_methods);
|
|
5726
5018
|
const node = await manifest._.nodes[route.page.leaf]();
|
|
5727
5019
|
if (node?.server?.actions) {
|
|
5728
|
-
|
|
5020
|
+
allowed_methods.add("POST");
|
|
5729
5021
|
}
|
|
5730
5022
|
if (method === "OPTIONS") {
|
|
5731
5023
|
response2 = new Response(null, {
|
|
5732
5024
|
status: 204,
|
|
5733
5025
|
headers: {
|
|
5734
|
-
allow: Array.from(
|
|
5026
|
+
allow: Array.from(allowed_methods.values()).join(", ")
|
|
5735
5027
|
}
|
|
5736
5028
|
});
|
|
5737
5029
|
} else {
|
|
5738
|
-
const mod = [...
|
|
5030
|
+
const mod = [...allowed_methods].reduce(
|
|
5739
5031
|
(acc, curr) => {
|
|
5740
5032
|
acc[curr] = true;
|
|
5741
5033
|
return acc;
|
|
@@ -5773,7 +5065,7 @@ async function internal_respond(request, options2, manifest, state) {
|
|
|
5773
5065
|
});
|
|
5774
5066
|
}
|
|
5775
5067
|
if (state.depth === 0) {
|
|
5776
|
-
if (
|
|
5068
|
+
if (browser && event2.url.pathname === "/.well-known/appspecific/com.chrome.devtools.json") ;
|
|
5777
5069
|
return await respond_with_error({
|
|
5778
5070
|
event: event2,
|
|
5779
5071
|
event_state,
|