371 lines
12 KiB
JavaScript
371 lines
12 KiB
JavaScript
import "./async.js";
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/array.js
|
|
/**
|
|
* Removes nullish values from an array.
|
|
*
|
|
* @template T
|
|
* @param {Array<T>} arr
|
|
*/
|
|
function compact(arr) {
|
|
return arr.filter(
|
|
/** @returns {val is NonNullable<T>} */
|
|
(val) => val != null
|
|
);
|
|
}
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/pathname.js
|
|
var DATA_SUFFIX = "/__data.json";
|
|
var HTML_DATA_SUFFIX = ".html__data.json";
|
|
/** @param {string} pathname */
|
|
function has_data_suffix(pathname) {
|
|
return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
|
|
}
|
|
/** @param {string} pathname */
|
|
function add_data_suffix(pathname) {
|
|
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
|
|
return pathname.replace(/\/$/, "") + DATA_SUFFIX;
|
|
}
|
|
/** @param {string} pathname */
|
|
function strip_data_suffix(pathname) {
|
|
if (pathname.endsWith(HTML_DATA_SUFFIX)) return pathname.slice(0, -16) + ".html";
|
|
return pathname.slice(0, -12);
|
|
}
|
|
var ROUTE_SUFFIX = "/__route.js";
|
|
/**
|
|
* @param {string} pathname
|
|
* @returns {boolean}
|
|
*/
|
|
function has_resolution_suffix(pathname) {
|
|
return pathname.endsWith(ROUTE_SUFFIX);
|
|
}
|
|
/**
|
|
* Convert a regular URL to a route to send to SvelteKit's server-side route resolution endpoint
|
|
* @param {string} pathname
|
|
* @returns {string}
|
|
*/
|
|
function add_resolution_suffix(pathname) {
|
|
return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
|
|
}
|
|
/**
|
|
* @param {string} pathname
|
|
* @returns {string}
|
|
*/
|
|
function strip_resolution_suffix(pathname) {
|
|
return pathname.slice(0, -11);
|
|
}
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/telemetry/noop.js
|
|
/**
|
|
* @type {Span}
|
|
*/
|
|
var noop_span = {
|
|
spanContext() {
|
|
return noop_span_context;
|
|
},
|
|
setAttribute() {
|
|
return this;
|
|
},
|
|
setAttributes() {
|
|
return this;
|
|
},
|
|
addEvent() {
|
|
return this;
|
|
},
|
|
setStatus() {
|
|
return this;
|
|
},
|
|
updateName() {
|
|
return this;
|
|
},
|
|
end() {
|
|
return this;
|
|
},
|
|
isRecording() {
|
|
return false;
|
|
},
|
|
recordException() {
|
|
return this;
|
|
},
|
|
addLink() {
|
|
return this;
|
|
},
|
|
addLinks() {
|
|
return this;
|
|
}
|
|
};
|
|
/**
|
|
* @type {SpanContext}
|
|
*/
|
|
var noop_span_context = {
|
|
traceId: "",
|
|
spanId: "",
|
|
traceFlags: 0
|
|
};
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/url.js
|
|
/**
|
|
* Matches a URI scheme. See https://www.rfc-editor.org/rfc/rfc3986#section-3.1
|
|
* @type {RegExp}
|
|
*/
|
|
var SCHEME = /^[a-z][a-z\d+\-.]+:/i;
|
|
var internal = new URL("a://");
|
|
/**
|
|
* @param {string} base
|
|
* @param {string} path
|
|
*/
|
|
function resolve(base, path) {
|
|
if (path[0] === "/" && path[1] === "/") return path;
|
|
let url = new URL(base, internal);
|
|
url = new URL(path, url);
|
|
return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
|
|
}
|
|
/**
|
|
* @param {string} path
|
|
* @param {import('types').TrailingSlash} trailing_slash
|
|
*/
|
|
function normalize_path(path, trailing_slash) {
|
|
if (path === "/" || trailing_slash === "ignore") return path;
|
|
if (trailing_slash === "never") return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
else if (trailing_slash === "always" && !path.endsWith("/")) return path + "/";
|
|
return path;
|
|
}
|
|
/**
|
|
* Decode pathname excluding %25 to prevent further double decoding of params
|
|
* @param {string} pathname
|
|
*/
|
|
function decode_pathname(pathname) {
|
|
return pathname.split("%25").map(decodeURI).join("%25");
|
|
}
|
|
/** @param {Record<string, string>} params */
|
|
function decode_params(params) {
|
|
for (const key in params) params[key] = decodeURIComponent(params[key]);
|
|
return params;
|
|
}
|
|
/**
|
|
* @param {URL} url
|
|
* @param {() => void} callback
|
|
* @param {(search_param: string) => void} search_params_callback
|
|
* @param {boolean} [allow_hash]
|
|
*/
|
|
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
|
|
const tracked = new URL(url);
|
|
Object.defineProperty(tracked, "searchParams", {
|
|
value: new Proxy(tracked.searchParams, { get(obj, key) {
|
|
if (key === "get" || key === "getAll" || key === "has") return (param, ...rest) => {
|
|
search_params_callback(param);
|
|
return obj[key](param, ...rest);
|
|
};
|
|
callback();
|
|
const value = Reflect.get(obj, key);
|
|
return typeof value === "function" ? value.bind(obj) : value;
|
|
} }),
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
/**
|
|
* URL properties that could change during the lifetime of the page,
|
|
* which excludes things like `origin`
|
|
*/
|
|
const tracked_url_properties = [
|
|
"href",
|
|
"pathname",
|
|
"search",
|
|
"toString",
|
|
"toJSON"
|
|
];
|
|
if (allow_hash) tracked_url_properties.push("hash");
|
|
for (const property of tracked_url_properties) Object.defineProperty(tracked, property, {
|
|
get() {
|
|
callback();
|
|
return url[property];
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
tracked[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
return inspect(url, opts);
|
|
};
|
|
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
return inspect(url.searchParams, opts);
|
|
};
|
|
if (!allow_hash) disable_hash(tracked);
|
|
return tracked;
|
|
}
|
|
/**
|
|
* Disallow access to `url.hash` on the server and in `load`
|
|
* @param {URL} url
|
|
*/
|
|
function disable_hash(url) {
|
|
allow_nodejs_console_log(url);
|
|
Object.defineProperty(url, "hash", { get() {
|
|
throw new Error("Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead");
|
|
} });
|
|
}
|
|
/**
|
|
* Disallow access to `url.search` and `url.searchParams` during prerendering
|
|
* @param {URL} url
|
|
*/
|
|
function disable_search(url) {
|
|
allow_nodejs_console_log(url);
|
|
for (const property of ["search", "searchParams"]) Object.defineProperty(url, property, { get() {
|
|
throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
|
|
} });
|
|
}
|
|
/**
|
|
* Allow URL to be console logged, bypassing disabled properties.
|
|
* @param {URL} url
|
|
*/
|
|
function allow_nodejs_console_log(url) {
|
|
url[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
return inspect(new URL(url), opts);
|
|
};
|
|
}
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/hash.js
|
|
/**
|
|
* Hash using djb2
|
|
* @param {import('types').StrictBody[]} values
|
|
*/
|
|
function hash(...values) {
|
|
let hash = 5381;
|
|
for (const value of values) if (typeof value === "string") {
|
|
let i = value.length;
|
|
while (i) hash = hash * 33 ^ value.charCodeAt(--i);
|
|
} else if (ArrayBuffer.isView(value)) {
|
|
const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
let i = buffer.length;
|
|
while (i) hash = hash * 33 ^ buffer[--i];
|
|
} else throw new TypeError("value must be a string or TypedArray");
|
|
return (hash >>> 0).toString(36);
|
|
}
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/routing.js
|
|
/**
|
|
* @param {RegExpMatchArray} match
|
|
* @param {import('types').RouteParam[]} params
|
|
* @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
|
|
*/
|
|
function exec(match, params, matchers) {
|
|
/** @type {Record<string, string>} */
|
|
const result = {};
|
|
const values = match.slice(1);
|
|
const values_needing_match = values.filter((value) => value !== void 0);
|
|
let buffered = 0;
|
|
for (let i = 0; i < params.length; i += 1) {
|
|
const param = params[i];
|
|
let value = values[i - buffered];
|
|
if (param.chained && param.rest && buffered) {
|
|
value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
|
|
buffered = 0;
|
|
}
|
|
if (value === void 0) if (param.rest) value = "";
|
|
else continue;
|
|
if (!param.matcher || matchers[param.matcher](value)) {
|
|
result[param.name] = value;
|
|
const next_param = params[i + 1];
|
|
const next_value = values[i + 1];
|
|
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0;
|
|
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0;
|
|
continue;
|
|
}
|
|
if (param.optional && param.chained) {
|
|
buffered++;
|
|
continue;
|
|
}
|
|
return;
|
|
}
|
|
if (buffered) return;
|
|
return result;
|
|
}
|
|
/**
|
|
* Find the first route that matches the given path
|
|
* @template {{pattern: RegExp, params: import('types').RouteParam[]}} Route
|
|
* @param {string} path - The decoded pathname to match
|
|
* @param {Route[]} routes
|
|
* @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
|
|
* @returns {{ route: Route, params: Record<string, string> } | null}
|
|
*/
|
|
function find_route(path, routes, matchers) {
|
|
for (const route of routes) {
|
|
const match = route.pattern.exec(path);
|
|
if (!match) continue;
|
|
const matched = exec(match, route.params, matchers);
|
|
if (matched) return {
|
|
route,
|
|
params: decode_params(matched)
|
|
};
|
|
}
|
|
return null;
|
|
}
|
|
//#endregion
|
|
//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/exports.js
|
|
/**
|
|
* @param {Set<string>} expected
|
|
*/
|
|
function validator(expected) {
|
|
/**
|
|
* @param {any} module
|
|
* @param {string} [file]
|
|
*/
|
|
function validate(module, file) {
|
|
if (!module) return;
|
|
for (const key in module) {
|
|
if (key[0] === "_" || expected.has(key)) continue;
|
|
const values = [...expected.values()];
|
|
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
|
|
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
|
|
}
|
|
}
|
|
return validate;
|
|
}
|
|
/**
|
|
* @param {string} key
|
|
* @param {string} ext
|
|
* @returns {string | void}
|
|
*/
|
|
function hint_for_supported_files(key, ext = ".js") {
|
|
const supported_files = [];
|
|
if (valid_layout_exports.has(key)) supported_files.push(`+layout${ext}`);
|
|
if (valid_page_exports.has(key)) supported_files.push(`+page${ext}`);
|
|
if (valid_layout_server_exports.has(key)) supported_files.push(`+layout.server${ext}`);
|
|
if (valid_page_server_exports.has(key)) supported_files.push(`+page.server${ext}`);
|
|
if (valid_server_exports.has(key)) supported_files.push(`+server${ext}`);
|
|
if (supported_files.length > 0) return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
|
|
}
|
|
var valid_layout_exports = new Set([
|
|
"load",
|
|
"prerender",
|
|
"csr",
|
|
"ssr",
|
|
"trailingSlash",
|
|
"config"
|
|
]);
|
|
var valid_page_exports = new Set([...valid_layout_exports, "entries"]);
|
|
var valid_layout_server_exports = new Set([...valid_layout_exports]);
|
|
var valid_page_server_exports = new Set([
|
|
...valid_layout_server_exports,
|
|
"actions",
|
|
"entries"
|
|
]);
|
|
var valid_server_exports = new Set([
|
|
"GET",
|
|
"POST",
|
|
"PATCH",
|
|
"PUT",
|
|
"DELETE",
|
|
"OPTIONS",
|
|
"HEAD",
|
|
"fallback",
|
|
"prerender",
|
|
"trailingSlash",
|
|
"config",
|
|
"entries"
|
|
]);
|
|
var validate_layout_exports = validator(valid_layout_exports);
|
|
var validate_page_exports = validator(valid_page_exports);
|
|
var validate_layout_server_exports = validator(valid_layout_server_exports);
|
|
var validate_page_server_exports = validator(valid_page_server_exports);
|
|
var validate_server_exports = validator(valid_server_exports);
|
|
//#endregion
|
|
export { has_data_suffix as _, validate_server_exports as a, strip_resolution_suffix as b, SCHEME as c, make_trackable as d, normalize_path as f, add_resolution_suffix as g, add_data_suffix as h, validate_page_server_exports as i, decode_pathname as l, noop_span as m, validate_layout_server_exports as n, find_route as o, resolve as p, validate_page_exports as r, hash as s, validate_layout_exports as t, disable_search as u, has_resolution_suffix as v, compact as x, strip_data_suffix as y };
|