Update dependencies and switch to @sveltejs/adapter-node for SvelteKit project
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
{
|
||||
".svelte-kit/generated/server/internal.js": {
|
||||
"file": "internal.js",
|
||||
"name": "internal",
|
||||
"src": ".svelte-kit/generated/server/internal.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_root.js",
|
||||
"_environment.js",
|
||||
"_internal.js"
|
||||
]
|
||||
},
|
||||
"_environment.js": {
|
||||
"file": "chunks/environment.js",
|
||||
"name": "environment"
|
||||
},
|
||||
"_exports.js": {
|
||||
"file": "chunks/exports.js",
|
||||
"name": "exports",
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_root.js"
|
||||
]
|
||||
},
|
||||
"_false.js": {
|
||||
"file": "chunks/false.js",
|
||||
"name": "false"
|
||||
},
|
||||
"_index.js": {
|
||||
"file": "chunks/index.js",
|
||||
"name": "index"
|
||||
},
|
||||
"_internal.js": {
|
||||
"file": "chunks/internal.js",
|
||||
"name": "internal",
|
||||
"imports": [
|
||||
"_root.js",
|
||||
"_environment.js"
|
||||
],
|
||||
"dynamicImports": [
|
||||
"src/hooks.server.ts"
|
||||
]
|
||||
},
|
||||
"_root.js": {
|
||||
"file": "chunks/root.js",
|
||||
"name": "root",
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_false.js"
|
||||
]
|
||||
},
|
||||
"_shared.js": {
|
||||
"file": "chunks/shared.js",
|
||||
"name": "shared",
|
||||
"imports": [
|
||||
"_utils.js"
|
||||
]
|
||||
},
|
||||
"_utils.js": {
|
||||
"file": "chunks/utils.js",
|
||||
"name": "utils"
|
||||
},
|
||||
"_utils2.js": {
|
||||
"file": "chunks/utils2.js",
|
||||
"name": "utils"
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js": {
|
||||
"file": "remote-entry.js",
|
||||
"name": "remote-entry",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_shared.js",
|
||||
"_false.js",
|
||||
"_environment.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte": {
|
||||
"file": "entries/fallbacks/error.svelte.js",
|
||||
"name": "entries/fallbacks/error.svelte",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_exports.js",
|
||||
"_root.js",
|
||||
"_utils.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/server/index.js": {
|
||||
"file": "index.js",
|
||||
"name": "index",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/server/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_false.js",
|
||||
"_environment.js",
|
||||
"_shared.js",
|
||||
"_exports.js",
|
||||
"_utils.js",
|
||||
"_internal.js"
|
||||
]
|
||||
},
|
||||
"src/hooks.server.ts": {
|
||||
"file": "entries/hooks.server.js",
|
||||
"name": "entries/hooks.server",
|
||||
"src": "src/hooks.server.ts",
|
||||
"isEntry": true,
|
||||
"isDynamicEntry": true
|
||||
},
|
||||
"src/routes/+layout.svelte": {
|
||||
"file": "entries/pages/_layout.svelte.js",
|
||||
"name": "entries/pages/_layout.svelte",
|
||||
"src": "src/routes/+layout.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js"
|
||||
],
|
||||
"css": [
|
||||
"_app/immutable/assets/_layout.B9GiBwVB.css"
|
||||
]
|
||||
},
|
||||
"src/routes/+layout.ts": {
|
||||
"file": "entries/pages/_layout.ts.js",
|
||||
"name": "entries/pages/_layout.ts",
|
||||
"src": "src/routes/+layout.ts",
|
||||
"isEntry": true
|
||||
},
|
||||
"src/routes/+page.svelte": {
|
||||
"file": "entries/pages/_page.svelte.js",
|
||||
"name": "entries/pages/_page.svelte",
|
||||
"src": "src/routes/+page.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_utils2.js"
|
||||
]
|
||||
},
|
||||
"src/routes/items/+page.server.ts": {
|
||||
"file": "entries/pages/items/_page.server.ts.js",
|
||||
"name": "entries/pages/items/_page.server.ts",
|
||||
"src": "src/routes/items/+page.server.ts",
|
||||
"isEntry": true
|
||||
},
|
||||
"src/routes/items/+page.svelte": {
|
||||
"file": "entries/pages/items/_page.svelte.js",
|
||||
"name": "entries/pages/items/_page.svelte",
|
||||
"src": "src/routes/items/+page.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_utils2.js"
|
||||
]
|
||||
},
|
||||
"src/routes/login/+page.server.ts": {
|
||||
"file": "entries/pages/login/_page.server.ts.js",
|
||||
"name": "entries/pages/login/_page.server.ts",
|
||||
"src": "src/routes/login/+page.server.ts",
|
||||
"isEntry": true
|
||||
},
|
||||
"src/routes/login/+page.svelte": {
|
||||
"file": "entries/pages/login/_page.svelte.js",
|
||||
"name": "entries/pages/login/_page.svelte",
|
||||
"src": "src/routes/login/+page.svelte",
|
||||
"isEntry": true
|
||||
},
|
||||
"src/routes/logout/+page.server.ts": {
|
||||
"file": "entries/pages/logout/_page.server.ts.js",
|
||||
"name": "entries/pages/logout/_page.server.ts",
|
||||
"src": "src/routes/logout/+page.server.ts",
|
||||
"isEntry": true
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
||||
let base = "";
|
||||
let assets = base;
|
||||
const app_dir = "_app";
|
||||
const relative = true;
|
||||
const initial = { base, assets };
|
||||
function override(paths) {
|
||||
base = paths.base;
|
||||
assets = paths.assets;
|
||||
}
|
||||
function reset() {
|
||||
base = initial.base;
|
||||
assets = initial.assets;
|
||||
}
|
||||
function set_assets(path) {
|
||||
assets = initial.assets = path;
|
||||
}
|
||||
let prerendering = false;
|
||||
function set_building() {
|
||||
}
|
||||
function set_prerendering() {
|
||||
prerendering = true;
|
||||
}
|
||||
export {
|
||||
set_building as a,
|
||||
set_prerendering as b,
|
||||
base as c,
|
||||
app_dir as d,
|
||||
assets as e,
|
||||
reset as f,
|
||||
override as o,
|
||||
prerendering as p,
|
||||
relative as r,
|
||||
set_assets as s
|
||||
};
|
||||
@@ -0,0 +1,232 @@
|
||||
import { n as noop } from "./index.js";
|
||||
import { s as safe_not_equal } from "./root.js";
|
||||
import "clsx";
|
||||
const SCHEME = /^[a-z][a-z\d+\-.]+:/i;
|
||||
const internal = new URL("sveltekit-internal://");
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
function decode_pathname(pathname) {
|
||||
return pathname.split("%25").map(decodeURI).join("%25");
|
||||
}
|
||||
function decode_params(params) {
|
||||
for (const key in params) {
|
||||
params[key] = decodeURIComponent(params[key]);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
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
|
||||
});
|
||||
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;
|
||||
}
|
||||
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"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
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`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function allow_nodejs_console_log(url) {
|
||||
{
|
||||
url[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(new URL(url), opts);
|
||||
};
|
||||
}
|
||||
}
|
||||
const subscriber_queue = [];
|
||||
function readable(value, start) {
|
||||
return {
|
||||
subscribe: writable(value, start).subscribe
|
||||
};
|
||||
}
|
||||
function writable(value, start = noop) {
|
||||
let stop = null;
|
||||
const subscribers = /* @__PURE__ */ new Set();
|
||||
function set(new_value) {
|
||||
if (safe_not_equal(value, new_value)) {
|
||||
value = new_value;
|
||||
if (stop) {
|
||||
const run_queue = !subscriber_queue.length;
|
||||
for (const subscriber of subscribers) {
|
||||
subscriber[1]();
|
||||
subscriber_queue.push(subscriber, value);
|
||||
}
|
||||
if (run_queue) {
|
||||
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
||||
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
||||
}
|
||||
subscriber_queue.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function update(fn) {
|
||||
set(fn(
|
||||
/** @type {T} */
|
||||
value
|
||||
));
|
||||
}
|
||||
function subscribe(run, invalidate = noop) {
|
||||
const subscriber = [run, invalidate];
|
||||
subscribers.add(subscriber);
|
||||
if (subscribers.size === 1) {
|
||||
stop = start(set, update) || noop;
|
||||
}
|
||||
run(
|
||||
/** @type {T} */
|
||||
value
|
||||
);
|
||||
return () => {
|
||||
subscribers.delete(subscriber);
|
||||
if (subscribers.size === 0 && stop) {
|
||||
stop();
|
||||
stop = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return { set, update, subscribe };
|
||||
}
|
||||
function validator(expected) {
|
||||
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;
|
||||
}
|
||||
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)}`;
|
||||
}
|
||||
}
|
||||
const valid_layout_exports = /* @__PURE__ */ new Set([
|
||||
"load",
|
||||
"prerender",
|
||||
"csr",
|
||||
"ssr",
|
||||
"trailingSlash",
|
||||
"config"
|
||||
]);
|
||||
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
|
||||
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
|
||||
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
|
||||
const valid_server_exports = /* @__PURE__ */ new Set([
|
||||
"GET",
|
||||
"POST",
|
||||
"PATCH",
|
||||
"PUT",
|
||||
"DELETE",
|
||||
"OPTIONS",
|
||||
"HEAD",
|
||||
"fallback",
|
||||
"prerender",
|
||||
"trailingSlash",
|
||||
"config",
|
||||
"entries"
|
||||
]);
|
||||
const validate_layout_exports = validator(valid_layout_exports);
|
||||
const validate_page_exports = validator(valid_page_exports);
|
||||
const validate_layout_server_exports = validator(valid_layout_server_exports);
|
||||
const validate_page_server_exports = validator(valid_page_server_exports);
|
||||
const validate_server_exports = validator(valid_server_exports);
|
||||
export {
|
||||
SCHEME as S,
|
||||
decode_params as a,
|
||||
validate_layout_exports as b,
|
||||
validate_page_server_exports as c,
|
||||
disable_search as d,
|
||||
validate_page_exports as e,
|
||||
resolve as f,
|
||||
decode_pathname as g,
|
||||
validate_server_exports as h,
|
||||
make_trackable as m,
|
||||
normalize_path as n,
|
||||
readable as r,
|
||||
validate_layout_server_exports as v,
|
||||
writable as w
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
const DEV = false;
|
||||
export {
|
||||
DEV as D
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,134 @@
|
||||
import { r as root } from "./root.js";
|
||||
import "./environment.js";
|
||||
let public_env = {};
|
||||
function set_private_env(environment) {
|
||||
}
|
||||
function set_public_env(environment) {
|
||||
public_env = environment;
|
||||
}
|
||||
let read_implementation = null;
|
||||
function set_read_implementation(fn) {
|
||||
read_implementation = fn;
|
||||
}
|
||||
function set_manifest(_) {
|
||||
}
|
||||
const options = {
|
||||
app_template_contains_nonce: false,
|
||||
async: false,
|
||||
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
|
||||
csrf_check_origin: true,
|
||||
csrf_trusted_origins: [],
|
||||
embedded: false,
|
||||
env_public_prefix: "PUBLIC_",
|
||||
env_private_prefix: "",
|
||||
hash_routing: false,
|
||||
hooks: null,
|
||||
// added lazily, via `get_hooks`
|
||||
preload_strategy: "modulepreload",
|
||||
root,
|
||||
service_worker: false,
|
||||
service_worker_options: void 0,
|
||||
templates: {
|
||||
app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets + '/favicon.png" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
|
||||
error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
--bg: white;
|
||||
--fg: #222;
|
||||
--divider: #ccc;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Open Sans',
|
||||
'Helvetica Neue',
|
||||
sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 32rem;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-weight: 200;
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
top: -0.05rem;
|
||||
}
|
||||
|
||||
.message {
|
||||
border-left: 1px solid var(--divider);
|
||||
padding: 0 0 0 1rem;
|
||||
margin: 0 0 0 1rem;
|
||||
min-height: 2.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.message h1 {
|
||||
font-weight: 400;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
--bg: #222;
|
||||
--fg: #ddd;
|
||||
--divider: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error">
|
||||
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "e8kpas"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
let handleFetch;
|
||||
let handleError;
|
||||
let handleValidationError;
|
||||
let init;
|
||||
({ handle, handleFetch, handleError, handleValidationError, init } = await import("../entries/hooks.server.js"));
|
||||
let reroute;
|
||||
let transport;
|
||||
return {
|
||||
handle,
|
||||
handleFetch,
|
||||
handleError,
|
||||
handleValidationError,
|
||||
init,
|
||||
reroute,
|
||||
transport
|
||||
};
|
||||
}
|
||||
export {
|
||||
set_public_env as a,
|
||||
set_read_implementation as b,
|
||||
set_manifest as c,
|
||||
get_hooks as g,
|
||||
options as o,
|
||||
public_env as p,
|
||||
read_implementation as r,
|
||||
set_private_env as s
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,770 @@
|
||||
import { json, text } from "@sveltejs/kit";
|
||||
import { SvelteKitError, HttpError } from "@sveltejs/kit/internal";
|
||||
import { with_request_store } from "@sveltejs/kit/internal/server";
|
||||
import * as devalue from "devalue";
|
||||
import { t as text_decoder, b as base64_encode, a as base64_decode } from "./utils.js";
|
||||
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
||||
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
||||
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
||||
function set_nested_value(object, path_string, value) {
|
||||
if (path_string.startsWith("n:")) {
|
||||
path_string = path_string.slice(2);
|
||||
value = value === "" ? void 0 : parseFloat(value);
|
||||
} else if (path_string.startsWith("b:")) {
|
||||
path_string = path_string.slice(2);
|
||||
value = value === "on";
|
||||
}
|
||||
deep_set(object, split_path(path_string), value);
|
||||
}
|
||||
function convert_formdata(data) {
|
||||
const result = {};
|
||||
for (let key of data.keys()) {
|
||||
const is_array = key.endsWith("[]");
|
||||
let values = data.getAll(key);
|
||||
if (is_array) key = key.slice(0, -2);
|
||||
if (values.length > 1 && !is_array) {
|
||||
throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
|
||||
}
|
||||
values = values.filter(
|
||||
(entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0
|
||||
);
|
||||
if (key.startsWith("n:")) {
|
||||
key = key.slice(2);
|
||||
values = values.map((v) => v === "" ? void 0 : parseFloat(
|
||||
/** @type {string} */
|
||||
v
|
||||
));
|
||||
} else if (key.startsWith("b:")) {
|
||||
key = key.slice(2);
|
||||
values = values.map((v) => v === "on");
|
||||
}
|
||||
set_nested_value(result, key, is_array ? values : values[0]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
||||
const BINARY_FORM_VERSION = 0;
|
||||
const HEADER_BYTES = 1 + 4 + 2;
|
||||
async function deserialize_binary_form(request) {
|
||||
if (request.headers.get("content-type") !== BINARY_FORM_CONTENT_TYPE) {
|
||||
const form_data = await request.formData();
|
||||
return { data: convert_formdata(form_data), meta: {}, form_data };
|
||||
}
|
||||
if (!request.body) {
|
||||
throw deserialize_error("no body");
|
||||
}
|
||||
const content_length = parseInt(request.headers.get("content-length") ?? "");
|
||||
if (Number.isNaN(content_length)) {
|
||||
throw deserialize_error("invalid Content-Length header");
|
||||
}
|
||||
const reader = request.body.getReader();
|
||||
const chunks = [];
|
||||
function get_chunk(index) {
|
||||
if (index in chunks) return chunks[index];
|
||||
let i = chunks.length;
|
||||
while (i <= index) {
|
||||
chunks[i] = reader.read().then((chunk) => chunk.value);
|
||||
i++;
|
||||
}
|
||||
return chunks[index];
|
||||
}
|
||||
async function get_buffer(offset, length) {
|
||||
let start_chunk;
|
||||
let chunk_start = 0;
|
||||
let chunk_index;
|
||||
for (chunk_index = 0; ; chunk_index++) {
|
||||
const chunk = await get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
const chunk_end = chunk_start + chunk.byteLength;
|
||||
if (offset >= chunk_start && offset < chunk_end) {
|
||||
start_chunk = chunk;
|
||||
break;
|
||||
}
|
||||
chunk_start = chunk_end;
|
||||
}
|
||||
if (offset + length <= chunk_start + start_chunk.byteLength) {
|
||||
return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
|
||||
}
|
||||
const chunks2 = [start_chunk.subarray(offset - chunk_start)];
|
||||
let cursor = start_chunk.byteLength - offset + chunk_start;
|
||||
while (cursor < length) {
|
||||
chunk_index++;
|
||||
let chunk = await get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
if (chunk.byteLength > length - cursor) {
|
||||
chunk = chunk.subarray(0, length - cursor);
|
||||
}
|
||||
chunks2.push(chunk);
|
||||
cursor += chunk.byteLength;
|
||||
}
|
||||
const buffer = new Uint8Array(length);
|
||||
cursor = 0;
|
||||
for (const chunk of chunks2) {
|
||||
buffer.set(chunk, cursor);
|
||||
cursor += chunk.byteLength;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
const header = await get_buffer(0, HEADER_BYTES);
|
||||
if (!header) throw deserialize_error("too short");
|
||||
if (header[0] !== BINARY_FORM_VERSION) {
|
||||
throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
||||
}
|
||||
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
||||
const data_length = header_view.getUint32(1, true);
|
||||
if (HEADER_BYTES + data_length > content_length) {
|
||||
throw deserialize_error("data overflow");
|
||||
}
|
||||
const file_offsets_length = header_view.getUint16(5, true);
|
||||
if (HEADER_BYTES + data_length + file_offsets_length > content_length) {
|
||||
throw deserialize_error("file offset table overflow");
|
||||
}
|
||||
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
||||
if (!data_buffer) throw deserialize_error("data too short");
|
||||
let file_offsets;
|
||||
let files_start_offset;
|
||||
if (file_offsets_length > 0) {
|
||||
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
||||
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
||||
file_offsets = /** @type {Array<number>} */
|
||||
JSON.parse(text_decoder.decode(file_offsets_buffer));
|
||||
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
||||
}
|
||||
const [data, meta] = devalue.parse(text_decoder.decode(data_buffer), {
|
||||
File: ([name, type, size, last_modified, index]) => {
|
||||
if (files_start_offset + file_offsets[index] + size > content_length) {
|
||||
throw deserialize_error("file data overflow");
|
||||
}
|
||||
return new Proxy(
|
||||
new LazyFile(
|
||||
name,
|
||||
type,
|
||||
size,
|
||||
last_modified,
|
||||
get_chunk,
|
||||
files_start_offset + file_offsets[index]
|
||||
),
|
||||
{
|
||||
getPrototypeOf() {
|
||||
return File.prototype;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
void (async () => {
|
||||
let has_more = true;
|
||||
while (has_more) {
|
||||
const chunk = await get_chunk(chunks.length);
|
||||
has_more = !!chunk;
|
||||
}
|
||||
})();
|
||||
return { data, meta, form_data: null };
|
||||
}
|
||||
function deserialize_error(message) {
|
||||
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
||||
}
|
||||
class LazyFile {
|
||||
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
||||
#get_chunk;
|
||||
/** @type {number} */
|
||||
#offset;
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} type
|
||||
* @param {number} size
|
||||
* @param {number} last_modified
|
||||
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
||||
* @param {number} offset
|
||||
*/
|
||||
constructor(name, type, size, last_modified, get_chunk, offset) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.size = size;
|
||||
this.lastModified = last_modified;
|
||||
this.webkitRelativePath = "";
|
||||
this.#get_chunk = get_chunk;
|
||||
this.#offset = offset;
|
||||
this.arrayBuffer = this.arrayBuffer.bind(this);
|
||||
this.bytes = this.bytes.bind(this);
|
||||
this.slice = this.slice.bind(this);
|
||||
this.stream = this.stream.bind(this);
|
||||
this.text = this.text.bind(this);
|
||||
}
|
||||
/** @type {ArrayBuffer | undefined} */
|
||||
#buffer;
|
||||
async arrayBuffer() {
|
||||
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
||||
return this.#buffer;
|
||||
}
|
||||
async bytes() {
|
||||
return new Uint8Array(await this.arrayBuffer());
|
||||
}
|
||||
/**
|
||||
* @param {number=} start
|
||||
* @param {number=} end
|
||||
* @param {string=} contentType
|
||||
*/
|
||||
slice(start = 0, end = this.size, contentType = this.type) {
|
||||
if (start < 0) {
|
||||
start = Math.max(this.size + start, 0);
|
||||
} else {
|
||||
start = Math.min(start, this.size);
|
||||
}
|
||||
if (end < 0) {
|
||||
end = Math.max(this.size + end, 0);
|
||||
} else {
|
||||
end = Math.min(end, this.size);
|
||||
}
|
||||
const size = Math.max(end - start, 0);
|
||||
const file = new LazyFile(
|
||||
this.name,
|
||||
contentType,
|
||||
size,
|
||||
this.lastModified,
|
||||
this.#get_chunk,
|
||||
this.#offset + start
|
||||
);
|
||||
return file;
|
||||
}
|
||||
stream() {
|
||||
let cursor = 0;
|
||||
let chunk_index = 0;
|
||||
return new ReadableStream({
|
||||
start: async (controller) => {
|
||||
let chunk_start = 0;
|
||||
let start_chunk = null;
|
||||
for (chunk_index = 0; ; chunk_index++) {
|
||||
const chunk = await this.#get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
const chunk_end = chunk_start + chunk.byteLength;
|
||||
if (this.#offset >= chunk_start && this.#offset < chunk_end) {
|
||||
start_chunk = chunk;
|
||||
break;
|
||||
}
|
||||
chunk_start = chunk_end;
|
||||
}
|
||||
if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
|
||||
controller.enqueue(
|
||||
start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start)
|
||||
);
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
|
||||
cursor = start_chunk.byteLength - this.#offset + chunk_start;
|
||||
}
|
||||
},
|
||||
pull: async (controller) => {
|
||||
chunk_index++;
|
||||
let chunk = await this.#get_chunk(chunk_index);
|
||||
if (!chunk) {
|
||||
controller.error("incomplete file data");
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
if (chunk.byteLength > this.size - cursor) {
|
||||
chunk = chunk.subarray(0, this.size - cursor);
|
||||
}
|
||||
controller.enqueue(chunk);
|
||||
cursor += chunk.byteLength;
|
||||
if (cursor >= this.size) {
|
||||
controller.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async text() {
|
||||
return text_decoder.decode(await this.arrayBuffer());
|
||||
}
|
||||
}
|
||||
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
|
||||
function split_path(path) {
|
||||
if (!path_regex.test(path)) {
|
||||
throw new Error(`Invalid path ${path}`);
|
||||
}
|
||||
return path.split(/\.|\[|\]/).filter(Boolean);
|
||||
}
|
||||
function check_prototype_pollution(key) {
|
||||
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
||||
throw new Error(
|
||||
`Invalid key "${key}"`
|
||||
);
|
||||
}
|
||||
}
|
||||
function deep_set(object, keys, value) {
|
||||
let current = object;
|
||||
for (let i = 0; i < keys.length - 1; i += 1) {
|
||||
const key = keys[i];
|
||||
check_prototype_pollution(key);
|
||||
const is_array = /^\d+$/.test(keys[i + 1]);
|
||||
const exists = Object.hasOwn(current, key);
|
||||
const inner = current[key];
|
||||
if (exists && is_array !== Array.isArray(inner)) {
|
||||
throw new Error(`Invalid array key ${keys[i + 1]}`);
|
||||
}
|
||||
if (!exists) {
|
||||
current[key] = is_array ? [] : {};
|
||||
}
|
||||
current = current[key];
|
||||
}
|
||||
const final_key = keys[keys.length - 1];
|
||||
check_prototype_pollution(final_key);
|
||||
current[final_key] = value;
|
||||
}
|
||||
function normalize_issue(issue, server = false) {
|
||||
const normalized = { name: "", path: [], message: issue.message, server };
|
||||
if (issue.path !== void 0) {
|
||||
let name = "";
|
||||
for (const segment of issue.path) {
|
||||
const key = (
|
||||
/** @type {string | number} */
|
||||
typeof segment === "object" ? segment.key : segment
|
||||
);
|
||||
normalized.path.push(key);
|
||||
if (typeof key === "number") {
|
||||
name += `[${key}]`;
|
||||
} else if (typeof key === "string") {
|
||||
name += name === "" ? key : "." + key;
|
||||
}
|
||||
}
|
||||
normalized.name = name;
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
function flatten_issues(issues) {
|
||||
const result = {};
|
||||
for (const issue of issues) {
|
||||
(result.$ ??= []).push(issue);
|
||||
let name = "";
|
||||
if (issue.path !== void 0) {
|
||||
for (const key of issue.path) {
|
||||
if (typeof key === "number") {
|
||||
name += `[${key}]`;
|
||||
} else if (typeof key === "string") {
|
||||
name += name === "" ? key : "." + key;
|
||||
}
|
||||
(result[name] ??= []).push(issue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deep_get(object, path) {
|
||||
let current = object;
|
||||
for (const key of path) {
|
||||
if (current == null || typeof current !== "object") {
|
||||
return current;
|
||||
}
|
||||
current = current[key];
|
||||
}
|
||||
return current;
|
||||
}
|
||||
function create_field_proxy(target, get_input, set_input, get_issues, path = []) {
|
||||
const get_value = () => {
|
||||
return deep_get(get_input(), path);
|
||||
};
|
||||
return new Proxy(target, {
|
||||
get(target2, prop) {
|
||||
if (typeof prop === "symbol") return target2[prop];
|
||||
if (/^\d+$/.test(prop)) {
|
||||
return create_field_proxy({}, get_input, set_input, get_issues, [
|
||||
...path,
|
||||
parseInt(prop, 10)
|
||||
]);
|
||||
}
|
||||
const key = build_path_string(path);
|
||||
if (prop === "set") {
|
||||
const set_func = function(newValue) {
|
||||
set_input(path, newValue);
|
||||
return newValue;
|
||||
};
|
||||
return create_field_proxy(set_func, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "value") {
|
||||
return create_field_proxy(get_value, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "issues" || prop === "allIssues") {
|
||||
const issues_func = () => {
|
||||
const all_issues = get_issues()[key === "" ? "$" : key];
|
||||
if (prop === "allIssues") {
|
||||
return all_issues?.map((issue) => ({
|
||||
path: issue.path,
|
||||
message: issue.message
|
||||
}));
|
||||
}
|
||||
return all_issues?.filter((issue) => issue.name === key)?.map((issue) => ({
|
||||
path: issue.path,
|
||||
message: issue.message
|
||||
}));
|
||||
};
|
||||
return create_field_proxy(issues_func, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "as") {
|
||||
const as_func = (type, input_value) => {
|
||||
const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string";
|
||||
const prefix = type === "number" || type === "range" ? "n:" : type === "checkbox" && !is_array ? "b:" : "";
|
||||
const base_props = {
|
||||
name: prefix + key + (is_array ? "[]" : ""),
|
||||
get "aria-invalid"() {
|
||||
const issues = get_issues();
|
||||
return key in issues ? "true" : void 0;
|
||||
}
|
||||
};
|
||||
if (type !== "text" && type !== "select" && type !== "select multiple") {
|
||||
base_props.type = type === "file multiple" ? "file" : type;
|
||||
}
|
||||
if (type === "submit" || type === "hidden") {
|
||||
return Object.defineProperties(base_props, {
|
||||
value: { value: input_value, enumerable: true }
|
||||
});
|
||||
}
|
||||
if (type === "select" || type === "select multiple") {
|
||||
return Object.defineProperties(base_props, {
|
||||
multiple: { value: is_array, enumerable: true },
|
||||
value: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return get_value();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === "checkbox" || type === "radio") {
|
||||
return Object.defineProperties(base_props, {
|
||||
value: { value: input_value ?? "on", enumerable: true },
|
||||
checked: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
if (type === "radio") {
|
||||
return value === input_value;
|
||||
}
|
||||
if (is_array) {
|
||||
return (value ?? []).includes(input_value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === "file" || type === "file multiple") {
|
||||
return Object.defineProperties(base_props, {
|
||||
multiple: { value: is_array, enumerable: true },
|
||||
files: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
if (value instanceof File) {
|
||||
if (typeof DataTransfer !== "undefined") {
|
||||
const fileList = new DataTransfer();
|
||||
fileList.items.add(value);
|
||||
return fileList.files;
|
||||
}
|
||||
return { 0: value, length: 1 };
|
||||
}
|
||||
if (Array.isArray(value) && value.every((f) => f instanceof File)) {
|
||||
if (typeof DataTransfer !== "undefined") {
|
||||
const fileList = new DataTransfer();
|
||||
value.forEach((file) => fileList.items.add(file));
|
||||
return fileList.files;
|
||||
}
|
||||
const fileListLike = { length: value.length };
|
||||
value.forEach((file, index) => {
|
||||
fileListLike[index] = file;
|
||||
});
|
||||
return fileListLike;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return Object.defineProperties(base_props, {
|
||||
value: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
return value != null ? String(value) : "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return create_field_proxy(as_func, get_input, set_input, get_issues, [...path, "as"]);
|
||||
}
|
||||
return create_field_proxy({}, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
});
|
||||
}
|
||||
function build_path_string(path) {
|
||||
let result = "";
|
||||
for (const segment of path) {
|
||||
if (typeof segment === "number") {
|
||||
result += `[${segment}]`;
|
||||
} else {
|
||||
result += result === "" ? segment : "." + segment;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function negotiate(accept, types) {
|
||||
const parts = [];
|
||||
accept.split(",").forEach((str, i) => {
|
||||
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
||||
if (match) {
|
||||
const [, type, subtype, q = "1"] = match;
|
||||
parts.push({ type, subtype, q: +q, i });
|
||||
}
|
||||
});
|
||||
parts.sort((a, b) => {
|
||||
if (a.q !== b.q) {
|
||||
return b.q - a.q;
|
||||
}
|
||||
if (a.subtype === "*" !== (b.subtype === "*")) {
|
||||
return a.subtype === "*" ? 1 : -1;
|
||||
}
|
||||
if (a.type === "*" !== (b.type === "*")) {
|
||||
return a.type === "*" ? 1 : -1;
|
||||
}
|
||||
return a.i - b.i;
|
||||
});
|
||||
let accepted;
|
||||
let min_priority = Infinity;
|
||||
for (const mimetype of types) {
|
||||
const [type, subtype] = mimetype.split("/");
|
||||
const priority = parts.findIndex(
|
||||
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
||||
);
|
||||
if (priority !== -1 && priority < min_priority) {
|
||||
accepted = mimetype;
|
||||
min_priority = priority;
|
||||
}
|
||||
}
|
||||
return accepted;
|
||||
}
|
||||
function is_content_type(request, ...types) {
|
||||
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
||||
return types.includes(type.toLowerCase());
|
||||
}
|
||||
function is_form_content_type(request) {
|
||||
return is_content_type(
|
||||
request,
|
||||
"application/x-www-form-urlencoded",
|
||||
"multipart/form-data",
|
||||
"text/plain",
|
||||
BINARY_FORM_CONTENT_TYPE
|
||||
);
|
||||
}
|
||||
function coalesce_to_error(err) {
|
||||
return err instanceof Error || err && /** @type {any} */
|
||||
err.name && /** @type {any} */
|
||||
err.message ? (
|
||||
/** @type {Error} */
|
||||
err
|
||||
) : new Error(JSON.stringify(err));
|
||||
}
|
||||
function normalize_error(error) {
|
||||
return (
|
||||
/** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
|
||||
error
|
||||
);
|
||||
}
|
||||
function get_status(error) {
|
||||
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
||||
}
|
||||
function get_message(error) {
|
||||
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
||||
}
|
||||
const escape_html_attr_dict = {
|
||||
"&": "&",
|
||||
'"': """
|
||||
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
||||
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
||||
// However, that doesn't apply in SvelteKit
|
||||
};
|
||||
const escape_html_dict = {
|
||||
"&": "&",
|
||||
"<": "<"
|
||||
};
|
||||
const surrogates = (
|
||||
// high surrogate without paired low surrogate
|
||||
"[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
|
||||
);
|
||||
const escape_html_attr_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
const escape_html_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
function escape_html(str, is_attr) {
|
||||
const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
|
||||
const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
|
||||
if (match.length === 2) {
|
||||
return match;
|
||||
}
|
||||
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
||||
});
|
||||
return escaped_str;
|
||||
}
|
||||
function method_not_allowed(mod, method) {
|
||||
return text(`${method} method not allowed`, {
|
||||
status: 405,
|
||||
headers: {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
||||
// "The server must generate an Allow header field in a 405 status code response"
|
||||
allow: allowed_methods(mod).join(", ")
|
||||
}
|
||||
});
|
||||
}
|
||||
function allowed_methods(mod) {
|
||||
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
||||
if ("GET" in mod && !("HEAD" in mod)) {
|
||||
allowed.push("HEAD");
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
function get_global_name(options) {
|
||||
return `__sveltekit_${options.version_hash}`;
|
||||
}
|
||||
function static_error_page(options, status, message) {
|
||||
let page = options.templates.error({ status, message: escape_html(message) });
|
||||
return text(page, {
|
||||
headers: { "content-type": "text/html; charset=utf-8" },
|
||||
status
|
||||
});
|
||||
}
|
||||
async function handle_fatal_error(event, state, options, error) {
|
||||
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
||||
const status = get_status(error);
|
||||
const body = await handle_error_and_jsonify(event, state, options, error);
|
||||
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
||||
"application/json",
|
||||
"text/html"
|
||||
]);
|
||||
if (event.isDataRequest || type === "application/json") {
|
||||
return json(body, {
|
||||
status
|
||||
});
|
||||
}
|
||||
return static_error_page(options, status, body.message);
|
||||
}
|
||||
async function handle_error_and_jsonify(event, state, options, error) {
|
||||
if (error instanceof HttpError) {
|
||||
return { message: "Unknown Error", ...error.body };
|
||||
}
|
||||
const status = get_status(error);
|
||||
const message = get_message(error);
|
||||
return await with_request_store(
|
||||
{ event, state },
|
||||
() => options.hooks.handleError({ error, event, status, message })
|
||||
) ?? { message };
|
||||
}
|
||||
function redirect_response(status, location) {
|
||||
const response = new Response(void 0, {
|
||||
status,
|
||||
headers: { location }
|
||||
});
|
||||
return response;
|
||||
}
|
||||
function clarify_devalue_error(event, error) {
|
||||
if (error.path) {
|
||||
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.`;
|
||||
}
|
||||
if (error.path === "") {
|
||||
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
||||
}
|
||||
return error.message;
|
||||
}
|
||||
function serialize_uses(node) {
|
||||
const uses = {};
|
||||
if (node.uses && node.uses.dependencies.size > 0) {
|
||||
uses.dependencies = Array.from(node.uses.dependencies);
|
||||
}
|
||||
if (node.uses && node.uses.search_params.size > 0) {
|
||||
uses.search_params = Array.from(node.uses.search_params);
|
||||
}
|
||||
if (node.uses && node.uses.params.size > 0) {
|
||||
uses.params = Array.from(node.uses.params);
|
||||
}
|
||||
if (node.uses?.parent) uses.parent = 1;
|
||||
if (node.uses?.route) uses.route = 1;
|
||||
if (node.uses?.url) uses.url = 1;
|
||||
return uses;
|
||||
}
|
||||
function has_prerendered_path(manifest, pathname) {
|
||||
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
||||
}
|
||||
function format_server_error(status, error, event) {
|
||||
const formatted_text = `
|
||||
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
|
||||
if (status === 404) {
|
||||
return formatted_text;
|
||||
}
|
||||
return `${formatted_text}
|
||||
${error.stack}`;
|
||||
}
|
||||
function get_node_type(node_id) {
|
||||
const parts = node_id?.split("/");
|
||||
const filename = parts?.at(-1);
|
||||
if (!filename) return "unknown";
|
||||
const dot_parts = filename.split(".");
|
||||
return dot_parts.slice(0, -1).join(".");
|
||||
}
|
||||
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
||||
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
||||
function stringify(data, transport) {
|
||||
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
||||
return devalue.stringify(data, encoders);
|
||||
}
|
||||
function stringify_remote_arg(value, transport) {
|
||||
if (value === void 0) return "";
|
||||
const json_string = stringify(value, transport);
|
||||
const bytes = new TextEncoder().encode(json_string);
|
||||
return base64_encode(bytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
|
||||
}
|
||||
function parse_remote_arg(string, transport) {
|
||||
if (!string) return void 0;
|
||||
const json_string = text_decoder.decode(
|
||||
// no need to add back `=` characters, atob can handle it
|
||||
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
||||
);
|
||||
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
||||
return devalue.parse(json_string, decoders);
|
||||
}
|
||||
function create_remote_key(id, payload) {
|
||||
return id + "/" + payload;
|
||||
}
|
||||
export {
|
||||
ENDPOINT_METHODS as E,
|
||||
INVALIDATED_PARAM as I,
|
||||
PAGE_METHODS as P,
|
||||
SVELTE_KIT_ASSETS as S,
|
||||
TRAILING_SLASH_PARAM as T,
|
||||
set_nested_value as a,
|
||||
stringify as b,
|
||||
create_field_proxy as c,
|
||||
deep_set as d,
|
||||
create_remote_key as e,
|
||||
flatten_issues as f,
|
||||
negotiate as g,
|
||||
handle_error_and_jsonify as h,
|
||||
get_status as i,
|
||||
is_form_content_type as j,
|
||||
normalize_error as k,
|
||||
get_global_name as l,
|
||||
method_not_allowed as m,
|
||||
normalize_issue as n,
|
||||
serialize_uses as o,
|
||||
clarify_devalue_error as p,
|
||||
get_node_type as q,
|
||||
escape_html as r,
|
||||
stringify_remote_arg as s,
|
||||
static_error_page as t,
|
||||
redirect_response as u,
|
||||
parse_remote_arg as v,
|
||||
deserialize_binary_form as w,
|
||||
has_prerendered_path as x,
|
||||
handle_fatal_error as y,
|
||||
format_server_error as z
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
const text_encoder = new TextEncoder();
|
||||
const text_decoder = new TextDecoder();
|
||||
function get_relative_path(from, to) {
|
||||
const from_parts = from.split(/[/\\]/);
|
||||
const to_parts = to.split(/[/\\]/);
|
||||
from_parts.pop();
|
||||
while (from_parts[0] === to_parts[0]) {
|
||||
from_parts.shift();
|
||||
to_parts.shift();
|
||||
}
|
||||
let i = from_parts.length;
|
||||
while (i--) from_parts[i] = "..";
|
||||
return from_parts.concat(to_parts).join("/");
|
||||
}
|
||||
function base64_encode(bytes) {
|
||||
if (globalThis.Buffer) {
|
||||
return globalThis.Buffer.from(bytes).toString("base64");
|
||||
}
|
||||
let binary = "";
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return btoa(binary);
|
||||
}
|
||||
function base64_decode(encoded) {
|
||||
if (globalThis.Buffer) {
|
||||
const buffer = globalThis.Buffer.from(encoded, "base64");
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
const binary = atob(encoded);
|
||||
const bytes = new Uint8Array(binary.length);
|
||||
for (let i = 0; i < binary.length; i++) {
|
||||
bytes[i] = binary.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
export {
|
||||
base64_decode as a,
|
||||
base64_encode as b,
|
||||
text_encoder as c,
|
||||
get_relative_path as g,
|
||||
text_decoder as t
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
function cn(...inputs) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
export {
|
||||
cn as c
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
import { n as noop, g as getContext, e as escape_html } from "../../chunks/index.js";
|
||||
import "clsx";
|
||||
import { w as writable } from "../../chunks/exports.js";
|
||||
import "@sveltejs/kit/internal/server";
|
||||
import "../../chunks/root.js";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../chunks/utils.js";
|
||||
function create_updated_store() {
|
||||
const { set, subscribe } = writable(false);
|
||||
{
|
||||
return {
|
||||
subscribe,
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
check: async () => false
|
||||
};
|
||||
}
|
||||
}
|
||||
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
||||
if (is_legacy) {
|
||||
({
|
||||
data: {},
|
||||
form: null,
|
||||
error: null,
|
||||
params: {},
|
||||
route: { id: null },
|
||||
state: {},
|
||||
status: -1,
|
||||
url: new URL("https://example.com")
|
||||
});
|
||||
}
|
||||
const stores = {
|
||||
updated: /* @__PURE__ */ create_updated_store()
|
||||
};
|
||||
({
|
||||
check: stores.updated.check
|
||||
});
|
||||
function context() {
|
||||
return getContext("__request__");
|
||||
}
|
||||
const page$1 = {
|
||||
get error() {
|
||||
return context().page.error;
|
||||
},
|
||||
get status() {
|
||||
return context().page.status;
|
||||
}
|
||||
};
|
||||
const page = page$1;
|
||||
function Error$1($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
$$renderer2.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
Error$1 as default
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
import PocketBase from "pocketbase";
|
||||
const POCKETBASE_URL = "https://pocketbase.ccllc.pro";
|
||||
const LOGIN_PATH = "/login";
|
||||
const LOGOUT_PATH = "/logout";
|
||||
function isPublicRoute(pathname) {
|
||||
return pathname === LOGIN_PATH || pathname.startsWith(LOGIN_PATH + "/") || pathname === LOGOUT_PATH;
|
||||
}
|
||||
const handle = async ({ event, resolve }) => {
|
||||
event.locals.pb = new PocketBase(POCKETBASE_URL);
|
||||
event.locals.pb.authStore.loadFromCookie(event.request.headers.get("cookie") || "");
|
||||
try {
|
||||
if (event.locals.pb.authStore.isValid) {
|
||||
await event.locals.pb.collection("users").authRefresh();
|
||||
}
|
||||
} catch {
|
||||
event.locals.pb.authStore.clear();
|
||||
}
|
||||
event.locals.user = event.locals.pb.authStore.record ?? null;
|
||||
if (!event.locals.user && !isPublicRoute(event.url.pathname)) {
|
||||
const redirectTo = event.url.pathname + event.url.search;
|
||||
const loginUrl = redirectTo && redirectTo !== "/" ? `${LOGIN_PATH}?redirectTo=${encodeURIComponent(redirectTo)}` : LOGIN_PATH;
|
||||
throw redirect(303, loginUrl);
|
||||
}
|
||||
const response = await resolve(event);
|
||||
response.headers.append(
|
||||
"set-cookie",
|
||||
event.locals.pb.authStore.exportToCookie({ httpOnly: false, sameSite: "Lax" })
|
||||
);
|
||||
return response;
|
||||
};
|
||||
export {
|
||||
handle
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { s as slot } from "../../chunks/index.js";
|
||||
function _layout($$renderer, $$props) {
|
||||
$$renderer.push(`<!--[-->`);
|
||||
slot($$renderer, $$props, "default", {});
|
||||
$$renderer.push(`<!--]-->`);
|
||||
}
|
||||
export {
|
||||
_layout as default
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import "clsx";
|
||||
import { a as attributes, c as clsx, b as bind_props } from "../../chunks/index.js";
|
||||
import { c as cn } from "../../chunks/utils2.js";
|
||||
import { tv } from "tailwind-variants";
|
||||
const buttonVariants = tv({
|
||||
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs",
|
||||
destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs",
|
||||
outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
|
||||
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs",
|
||||
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline"
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10"
|
||||
}
|
||||
},
|
||||
defaultVariants: { variant: "default", size: "default" }
|
||||
});
|
||||
function Button($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
class: className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
ref = null,
|
||||
href = void 0,
|
||||
type = "button",
|
||||
disabled,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
if (href) {
|
||||
$$renderer2.push("<!--[-->");
|
||||
$$renderer2.push(`<a${attributes({
|
||||
"data-slot": "button",
|
||||
class: clsx(cn(buttonVariants({ variant, size }), className)),
|
||||
href: disabled ? void 0 : href,
|
||||
"aria-disabled": disabled,
|
||||
role: disabled ? "link" : void 0,
|
||||
tabindex: disabled ? -1 : void 0,
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></a>`);
|
||||
} else {
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<button${attributes({
|
||||
"data-slot": "button",
|
||||
class: clsx(cn(buttonVariants({ variant, size }), className)),
|
||||
type,
|
||||
disabled,
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></button>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]-->`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function _page($$renderer) {
|
||||
$$renderer.push(`<main class="flex min-h-screen flex-col items-center justify-center gap-4 p-8"><h1 class="text-2xl font-semibold">Stackq</h1> <p class="text-muted-foreground">Svelte 5 + shadcn-svelte + PocketBase</p> <div class="flex gap-2"><a href="/items">`);
|
||||
Button($$renderer, {
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Items table`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/logout">`);
|
||||
Button($$renderer, {
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Log out`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a></div></main>`);
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
import { fail } from "@sveltejs/kit";
|
||||
const COLLECTION = "Stackq_Items";
|
||||
function parseNum(val) {
|
||||
if (val === "" || val === null || val === void 0) return void 0;
|
||||
const n = Number(val);
|
||||
return Number.isFinite(n) ? n : void 0;
|
||||
}
|
||||
function parseBool(val) {
|
||||
return val === "on" || val === "true" || val === true;
|
||||
}
|
||||
const load = async ({ locals }) => {
|
||||
const list = await locals.pb.collection(COLLECTION).getFullList({
|
||||
sort: "-created",
|
||||
expand: "Parent"
|
||||
}).catch((err) => {
|
||||
console.error(COLLECTION, err);
|
||||
return [];
|
||||
});
|
||||
const itemsForParent = list.map((i) => ({ id: i.id, Item: i.Item, SKU: i.SKU }));
|
||||
return { items: list, itemsForParent };
|
||||
};
|
||||
const actions = {
|
||||
create: async ({ request, locals }) => {
|
||||
const form = await request.formData();
|
||||
const Item = form.get("Item")?.trim() ?? "";
|
||||
const SKU = form.get("SKU")?.trim() ?? "";
|
||||
const Description = form.get("Description")?.trim() ?? "";
|
||||
const UOM = form.get("UOM")?.trim() ?? "";
|
||||
const Cost = parseNum(form.get("Cost"));
|
||||
const Vendor = form.get("Vendor")?.trim() ?? "";
|
||||
const Catagory = form.get("Catagory")?.trim() ?? "";
|
||||
const Sub_Catagory = form.get("Sub_Catagory")?.trim() ?? "";
|
||||
const Has_Parent = parseBool(form.get("Has_Parent"));
|
||||
const Parent = form.get("Parent")?.trim() ?? "";
|
||||
const Stock = parseBool(form.get("Stock"));
|
||||
if (!Item) return fail(400, { error: "Item name is required", form: "create" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).create({
|
||||
Item,
|
||||
SKU,
|
||||
Description,
|
||||
UOM: UOM || void 0,
|
||||
Cost: Cost ?? 0,
|
||||
Vendor,
|
||||
Catagory: Catagory || void 0,
|
||||
Sub_Catagory: Sub_Catagory || void 0,
|
||||
Has_Parent: !!Has_Parent,
|
||||
Parent: Parent || null,
|
||||
Stock: !!Stock
|
||||
});
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Create failed";
|
||||
return fail(500, { error: message, form: "create" });
|
||||
}
|
||||
return { success: true };
|
||||
},
|
||||
update: async ({ request, locals }) => {
|
||||
const form = await request.formData();
|
||||
const id = form.get("id")?.trim();
|
||||
if (!id) return fail(400, { error: "Missing id", form: "update" });
|
||||
const Item = form.get("Item")?.trim() ?? "";
|
||||
const SKU = form.get("SKU")?.trim() ?? "";
|
||||
const Description = form.get("Description")?.trim() ?? "";
|
||||
const UOM = form.get("UOM")?.trim() ?? "";
|
||||
const Cost = parseNum(form.get("Cost"));
|
||||
const Vendor = form.get("Vendor")?.trim() ?? "";
|
||||
const Catagory = form.get("Catagory")?.trim() ?? "";
|
||||
const Sub_Catagory = form.get("Sub_Catagory")?.trim() ?? "";
|
||||
const Has_Parent = parseBool(form.get("Has_Parent"));
|
||||
const Parent = form.get("Parent")?.trim() ?? "";
|
||||
const Stock = parseBool(form.get("Stock"));
|
||||
if (!Item) return fail(400, { error: "Item name is required", form: "update" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).update(id, {
|
||||
Item,
|
||||
SKU,
|
||||
Description,
|
||||
UOM: UOM || void 0,
|
||||
Cost: Cost ?? 0,
|
||||
Vendor,
|
||||
Catagory: Catagory || void 0,
|
||||
Sub_Catagory: Sub_Catagory || void 0,
|
||||
Has_Parent: !!Has_Parent,
|
||||
Parent: Parent || null,
|
||||
Stock: !!Stock
|
||||
});
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Update failed";
|
||||
return fail(500, { error: message, form: "update" });
|
||||
}
|
||||
return { success: true };
|
||||
},
|
||||
delete: async ({ request, locals }) => {
|
||||
const form = await request.formData();
|
||||
const id = form.get("id")?.trim();
|
||||
if (!id) return fail(400, { error: "Missing id", form: "delete" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).delete(id);
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Delete failed";
|
||||
return fail(500, { error: message, form: "delete" });
|
||||
}
|
||||
return { success: true };
|
||||
}
|
||||
};
|
||||
export {
|
||||
actions,
|
||||
load
|
||||
};
|
||||
@@ -0,0 +1,670 @@
|
||||
import { a as attributes, c as clsx, b as bind_props, d as element, h as head, e as escape_html, f as ensure_array_like } from "../../../chunks/index.js";
|
||||
import { c as cn } from "../../../chunks/utils2.js";
|
||||
import "clsx";
|
||||
import { tv } from "tailwind-variants";
|
||||
function Table($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div data-slot="table-container" class="relative w-full overflow-x-auto"><table${attributes({
|
||||
"data-slot": "table",
|
||||
class: clsx(cn("w-full caption-bottom text-sm", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></table></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_body($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<tbody${attributes({
|
||||
"data-slot": "table-body",
|
||||
class: clsx(cn("[&_tr:last-child]:border-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></tbody>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_cell($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<td${attributes({
|
||||
"data-slot": "table-cell",
|
||||
class: clsx(cn("bg-clip-padding p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></td>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_head($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<th${attributes({
|
||||
"data-slot": "table-head",
|
||||
class: clsx(cn("text-foreground h-10 bg-clip-padding px-2 text-start align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pe-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></th>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_header($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<thead${attributes({
|
||||
"data-slot": "table-header",
|
||||
class: clsx(cn("[&_tr]:border-b", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></thead>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_row($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<tr${attributes({
|
||||
"data-slot": "table-row",
|
||||
class: clsx(cn("hover:[&,&>svelte-css-wrapper]:[&>th,td]:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></tr>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
const badgeVariants = tv({
|
||||
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",
|
||||
secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",
|
||||
destructive: "bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white",
|
||||
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
||||
}
|
||||
},
|
||||
defaultVariants: { variant: "default" }
|
||||
});
|
||||
function Badge($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
href,
|
||||
class: className,
|
||||
variant = "default",
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
element(
|
||||
$$renderer2,
|
||||
href ? "a" : "span",
|
||||
() => {
|
||||
$$renderer2.push(`${attributes({
|
||||
"data-slot": "badge",
|
||||
href,
|
||||
class: clsx(cn(badgeVariants({ variant }), className)),
|
||||
...restProps
|
||||
})}`);
|
||||
},
|
||||
() => {
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!---->`);
|
||||
}
|
||||
);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card",
|
||||
class: clsx(cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card_content($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card-content",
|
||||
class: clsx(cn("px-6", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card_header($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card-header",
|
||||
class: clsx(cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card_title($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card-title",
|
||||
class: clsx(cn("leading-none font-semibold", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let { data } = $$props;
|
||||
function asList(val) {
|
||||
if (val == null) return [];
|
||||
return Array.isArray(val) ? val : [val];
|
||||
}
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString(void 0, { dateStyle: "short", timeStyle: "short" });
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
const items = data?.items ?? [];
|
||||
head("rk8na7", $$renderer2, ($$renderer3) => {
|
||||
$$renderer3.title(($$renderer4) => {
|
||||
$$renderer4.push(`<title>Items – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
{
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<main class="container mx-auto flex flex-col gap-6 py-8"><div class="flex items-center justify-between"><h1 class="text-2xl font-semibold">Stackq Items</h1> <span class="text-muted-foreground text-sm">${escape_html(items.length)} items</span></div> `);
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_header($$renderer3, {
|
||||
children: ($$renderer4) => {
|
||||
Card_title($$renderer4, {
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->Stackq_Items`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!----> <p class="text-muted-foreground text-sm">PocketBase collection. Enable JS for create/edit/delete.</p>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----> `);
|
||||
Card_content($$renderer3, {
|
||||
class: "p-0",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push("<!---->");
|
||||
Table?.($$renderer4, {
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push("<!---->");
|
||||
Table_header?.($$renderer5, {
|
||||
children: ($$renderer6) => {
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Item`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->SKU`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "max-w-[200px]",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Description`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->UOM`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-right",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Cost`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Vendor`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Catagory`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Sub_Catagory`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Has Parent`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Parent`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Stock`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->created`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->updated`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer5.push(`<!----> `);
|
||||
$$renderer5.push("<!---->");
|
||||
Table_body?.($$renderer5, {
|
||||
children: ($$renderer6) => {
|
||||
if (items.length === 0) {
|
||||
$$renderer6.push("<!--[-->");
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
colspan: "13",
|
||||
class: "h-24 text-center text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->No items.`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
} else {
|
||||
$$renderer6.push("<!--[!-->");
|
||||
$$renderer6.push(`<!--[-->`);
|
||||
const each_array = ensure_array_like(items);
|
||||
for (let $$index_2 = 0, $$length = each_array.length; $$index_2 < $$length; $$index_2++) {
|
||||
let item = each_array[$$index_2];
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "font-medium",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Item ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "font-mono text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.SKU ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "max-w-[200px] truncate",
|
||||
title: item.Description ?? "",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Description ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
Badge($$renderer8, {
|
||||
variant: "outline",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(item.UOM ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-right tabular-nums",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Cost != null ? Number(item.Cost).toLocaleString() : "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Vendor ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!--[-->`);
|
||||
const each_array_1 = ensure_array_like(asList(item.Catagory));
|
||||
for (let $$index = 0, $$length2 = each_array_1.length; $$index < $$length2; $$index++) {
|
||||
let cat = each_array_1[$$index];
|
||||
Badge($$renderer8, {
|
||||
variant: "secondary",
|
||||
class: "mr-1 text-xs",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(cat)}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
||||
$$renderer8.push(`<!--]--> `);
|
||||
if (asList(item.Catagory).length === 0) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!--[-->`);
|
||||
const each_array_2 = ensure_array_like(asList(item.Sub_Catagory));
|
||||
for (let $$index_1 = 0, $$length2 = each_array_2.length; $$index_1 < $$length2; $$index_1++) {
|
||||
let sub = each_array_2[$$index_1];
|
||||
Badge($$renderer8, {
|
||||
variant: "outline",
|
||||
class: "mr-1 text-xs",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(sub)}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
||||
$$renderer8.push(`<!--]--> `);
|
||||
if (asList(item.Sub_Catagory).length === 0) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
if (item.Has_Parent) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
Badge($$renderer8, {
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->Yes`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">No</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
if (item.expand?.Parent) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`${escape_html(item.expand.Parent.Item ?? item.expand.Parent.SKU ?? item.Parent)}`);
|
||||
} else if (item.Parent) {
|
||||
$$renderer8.push("<!--[1-->");
|
||||
$$renderer8.push(`<span class="font-mono text-xs">${escape_html(item.Parent)}</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`—`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
if (item.Stock) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
Badge($$renderer8, {
|
||||
variant: "default",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->Stock`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(formatDate(item.created))}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(formatDate(item.updated))}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
}
|
||||
$$renderer6.push(`<!--]-->`);
|
||||
}
|
||||
$$renderer6.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer5.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer2.push(`<!----></main>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]-->`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { fail, redirect } from "@sveltejs/kit";
|
||||
function safeRedirectTo(searchParams) {
|
||||
const to = searchParams.get("redirectTo");
|
||||
if (!to || typeof to !== "string") return "/";
|
||||
if (!to.startsWith("/") || to.startsWith("//")) return "/";
|
||||
return to;
|
||||
}
|
||||
const load = ({ url, locals }) => {
|
||||
if (locals.user) {
|
||||
throw redirect(303, safeRedirectTo(url.searchParams));
|
||||
}
|
||||
};
|
||||
const actions = {
|
||||
login: async ({ request, locals, url }) => {
|
||||
const data = await request.formData();
|
||||
const email = data.get("email")?.trim() ?? "";
|
||||
const password = data.get("password") ?? "";
|
||||
if (!email || !password) {
|
||||
return fail(400, { error: "Email and password are required.", email });
|
||||
}
|
||||
try {
|
||||
await locals.pb.collection("users").authWithPassword(email, password);
|
||||
} catch (err) {
|
||||
const message = err && typeof err === "object" && "message" in err ? String(err.message) : "Invalid email or password.";
|
||||
return fail(401, { error: message, email });
|
||||
}
|
||||
const redirectTo = safeRedirectTo(url.searchParams);
|
||||
throw redirect(303, redirectTo);
|
||||
}
|
||||
};
|
||||
export {
|
||||
actions,
|
||||
load
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import "clsx";
|
||||
function _page($$renderer, $$props) {
|
||||
let { data } = $$props;
|
||||
$$renderer.push(`<main class="flex min-h-screen flex-col items-center justify-center p-4">`);
|
||||
{
|
||||
$$renderer.push("<!--[!-->");
|
||||
$$renderer.push(`<div class="w-full max-w-sm space-y-4 rounded-xl border bg-card p-6 shadow-sm"><div class="space-y-1"><h1 class="text-lg font-semibold">Login</h1> <p class="text-muted-foreground text-sm">Enter your email and password to sign in.</p></div> <p class="text-muted-foreground text-sm">Loading form…</p></div>`);
|
||||
}
|
||||
$$renderer.push(`<!--]--></main>`);
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
const load = ({ locals }) => {
|
||||
locals.pb.authStore.clear();
|
||||
throw redirect(303, "/login");
|
||||
};
|
||||
export {
|
||||
load
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
import "./chunks/root.js";
|
||||
import { s, a, b } from "./chunks/environment.js";
|
||||
import { g, o, c, s as s2, a as a2, b as b2 } from "./chunks/internal.js";
|
||||
export {
|
||||
g as get_hooks,
|
||||
o as options,
|
||||
s as set_assets,
|
||||
a as set_building,
|
||||
c as set_manifest,
|
||||
b as set_prerendering,
|
||||
s2 as set_private_env,
|
||||
a2 as set_public_env,
|
||||
b2 as set_read_implementation
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.C_SQrpA0.js",app:"_app/immutable/entry/app.DE4HKxpj.js",imports:["_app/immutable/entry/start.C_SQrpA0.js","_app/immutable/chunks/D6EhJnz8.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.DE4HKxpj.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js')),
|
||||
__memo(() => import('./nodes/3.js')),
|
||||
__memo(() => import('./nodes/4.js')),
|
||||
__memo(() => import('./nodes/5.js'))
|
||||
],
|
||||
remotes: {
|
||||
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/items",
|
||||
pattern: /^\/items\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 4 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/login",
|
||||
pattern: /^\/login\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 5 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/logout",
|
||||
pattern: /^\/logout\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 3 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,67 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.C_SQrpA0.js",app:"_app/immutable/entry/app.DE4HKxpj.js",imports:["_app/immutable/entry/start.C_SQrpA0.js","_app/immutable/chunks/D6EhJnz8.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.DE4HKxpj.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js')),
|
||||
__memo(() => import('./nodes/3.js')),
|
||||
__memo(() => import('./nodes/4.js')),
|
||||
__memo(() => import('./nodes/5.js'))
|
||||
],
|
||||
remotes: {
|
||||
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/items",
|
||||
pattern: /^\/items\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 4 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/login",
|
||||
pattern: /^\/login\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 5 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/logout",
|
||||
pattern: /^\/logout\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 3 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
export const prerendered = new Set([]);
|
||||
|
||||
export const base = "";
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as universal from '../entries/pages/_layout.ts.js';
|
||||
|
||||
export const index = 0;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
|
||||
export { universal };
|
||||
export const universal_id = "src/routes/+layout.ts";
|
||||
export const imports = ["_app/immutable/nodes/0.BWGINVoR.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BrBXfa46.js","_app/immutable/chunks/m2dceAnU.js"];
|
||||
export const stylesheets = ["_app/immutable/assets/0.C7J2EIJ7.css"];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 1;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/1.BwpnmtAp.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BrBXfa46.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/D6EhJnz8.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 2;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/2.W3CLiCpj.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BrBXfa46.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/D4Z6sX8n.js","_app/immutable/chunks/BtiMKAzw.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/CvosxF64.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as server from '../entries/pages/logout/_page.server.ts.js';
|
||||
|
||||
export const index = 3;
|
||||
export { server };
|
||||
export const server_id = "src/routes/logout/+page.server.ts";
|
||||
export const imports = [];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as server from '../entries/pages/items/_page.server.ts.js';
|
||||
|
||||
export const index = 4;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/items/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/items/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/4.DSwQNsv9.js","_app/immutable/chunks/D0oS5fvi.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js","_app/immutable/chunks/BtiMKAzw.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/CvosxF64.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as server from '../entries/pages/login/_page.server.ts.js';
|
||||
|
||||
export const index = 5;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/login/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/login/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/5.Y48nEW8J.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,557 @@
|
||||
import { get_request_store, with_request_store } from "@sveltejs/kit/internal/server";
|
||||
import { parse } from "devalue";
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { s as stringify_remote_arg, f as flatten_issues, c as create_field_proxy, n as normalize_issue, a as set_nested_value, d as deep_set, b as stringify, e as create_remote_key, h as handle_error_and_jsonify } from "./chunks/shared.js";
|
||||
import { ValidationError, HttpError, SvelteKitError } from "@sveltejs/kit/internal";
|
||||
import { D as DEV } from "./chunks/false.js";
|
||||
import { c as base, d as app_dir, p as prerendering } from "./chunks/environment.js";
|
||||
function create_validator(validate_or_fn, maybe_fn) {
|
||||
if (!maybe_fn) {
|
||||
return (arg) => {
|
||||
if (arg !== void 0) {
|
||||
error(400, "Bad Request");
|
||||
}
|
||||
};
|
||||
}
|
||||
if (validate_or_fn === "unchecked") {
|
||||
return (arg) => arg;
|
||||
}
|
||||
if ("~standard" in validate_or_fn) {
|
||||
return async (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
const result = await validate_or_fn["~standard"].validate(arg);
|
||||
if (result.issues) {
|
||||
error(
|
||||
400,
|
||||
await state.handleValidationError({
|
||||
issues: result.issues,
|
||||
event
|
||||
})
|
||||
);
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
}
|
||||
throw new Error(
|
||||
'Invalid validator passed to remote function. Expected "unchecked" or a Standard Schema (https://standardschema.dev)'
|
||||
);
|
||||
}
|
||||
async function get_response(info, arg, state, get_result) {
|
||||
await 0;
|
||||
const cache = get_cache(info, state);
|
||||
return cache[stringify_remote_arg(arg, state.transport)] ??= get_result();
|
||||
}
|
||||
function parse_remote_response(data, transport) {
|
||||
const revivers = {};
|
||||
for (const key in transport) {
|
||||
revivers[key] = transport[key].decode;
|
||||
}
|
||||
return parse(data, revivers);
|
||||
}
|
||||
async function run_remote_function(event, state, allow_cookies, get_input, fn) {
|
||||
const store = {
|
||||
event: {
|
||||
...event,
|
||||
setHeaders: () => {
|
||||
throw new Error("setHeaders is not allowed in remote functions");
|
||||
},
|
||||
cookies: {
|
||||
...event.cookies,
|
||||
set: (name, value, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot set cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies set in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.set(name, value, opts);
|
||||
},
|
||||
delete: (name, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot delete cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies deleted in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.delete(name, opts);
|
||||
}
|
||||
}
|
||||
},
|
||||
state: {
|
||||
...state,
|
||||
is_in_remote_function: true
|
||||
}
|
||||
};
|
||||
const input = await with_request_store(store, get_input);
|
||||
return with_request_store(store, () => fn(input));
|
||||
}
|
||||
function get_cache(info, state = get_request_store().state) {
|
||||
let cache = state.remote_data?.get(info);
|
||||
if (cache === void 0) {
|
||||
cache = {};
|
||||
(state.remote_data ??= /* @__PURE__ */ new Map()).set(info, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function command(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "command", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
if (state.is_endpoint_request) {
|
||||
if (!["POST", "PUT", "PATCH", "DELETE"].includes(event.request.method)) {
|
||||
throw new Error(
|
||||
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) from a ${event.request.method} handler`
|
||||
);
|
||||
}
|
||||
} else if (!event.isRemoteRequest) {
|
||||
throw new Error(
|
||||
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) during server-side rendering`
|
||||
);
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const promise = Promise.resolve(
|
||||
run_remote_function(event, state, true, () => validate(arg), fn)
|
||||
);
|
||||
promise.updates = () => {
|
||||
throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {ReturnType<RemoteCommand<Input, Output>>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
Object.defineProperty(wrapper, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function form(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : (
|
||||
/** @type {any} */
|
||||
validate_or_fn
|
||||
);
|
||||
function create_instance(key) {
|
||||
const instance = {};
|
||||
instance.method = "POST";
|
||||
Object.defineProperty(instance, "enhance", {
|
||||
value: () => {
|
||||
return { action: instance.action, method: instance.method };
|
||||
}
|
||||
});
|
||||
const __ = {
|
||||
type: "form",
|
||||
name: "",
|
||||
id: "",
|
||||
fn: async (data, meta, form_data) => {
|
||||
const output = {};
|
||||
output.submission = true;
|
||||
const { event, state } = get_request_store();
|
||||
const validated = await schema?.["~standard"].validate(data);
|
||||
if (meta.validate_only) {
|
||||
return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
|
||||
}
|
||||
if (validated?.issues !== void 0) {
|
||||
handle_issues(output, validated.issues, form_data);
|
||||
} else {
|
||||
if (validated !== void 0) {
|
||||
data = validated.value;
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const issue = create_issues();
|
||||
try {
|
||||
output.result = await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
true,
|
||||
() => data,
|
||||
(data2) => !maybe_fn ? fn() : fn(data2, issue)
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof ValidationError) {
|
||||
handle_issues(output, e.issues, form_data);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!event.isRemoteRequest) {
|
||||
get_cache(__, state)[""] ??= output;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
Object.defineProperty(instance, "__", { value: __ });
|
||||
Object.defineProperty(instance, "action", {
|
||||
get: () => `?/remote=${__.id}`,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(instance, "fields", {
|
||||
get() {
|
||||
const data = get_cache(__)?.[""];
|
||||
const issues = flatten_issues(data?.issues ?? []);
|
||||
return create_field_proxy(
|
||||
{},
|
||||
() => data?.input ?? {},
|
||||
(path, value) => {
|
||||
if (data?.submission) {
|
||||
return;
|
||||
}
|
||||
const input = path.length === 0 ? value : deep_set(data?.input ?? {}, path.map(String), value);
|
||||
(get_cache(__)[""] ??= {}).input = input;
|
||||
},
|
||||
() => issues
|
||||
);
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "result", {
|
||||
get() {
|
||||
try {
|
||||
return get_cache(__)?.[""]?.result;
|
||||
} catch {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
Object.defineProperty(instance, "preflight", {
|
||||
// preflight is a noop on the server
|
||||
value: () => instance
|
||||
});
|
||||
Object.defineProperty(instance, "validate", {
|
||||
value: () => {
|
||||
throw new Error("Cannot call validate() on the server");
|
||||
}
|
||||
});
|
||||
if (key == void 0) {
|
||||
Object.defineProperty(instance, "for", {
|
||||
/** @type {RemoteForm<any, any>['for']} */
|
||||
value: (key2) => {
|
||||
const { state } = get_request_store();
|
||||
const cache_key = __.id + "|" + JSON.stringify(key2);
|
||||
let instance2 = (state.form_instances ??= /* @__PURE__ */ new Map()).get(cache_key);
|
||||
if (!instance2) {
|
||||
instance2 = create_instance(key2);
|
||||
instance2.__.id = `${__.id}/${encodeURIComponent(JSON.stringify(key2))}`;
|
||||
instance2.__.name = __.name;
|
||||
state.form_instances.set(cache_key, instance2);
|
||||
}
|
||||
return instance2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
return create_instance();
|
||||
}
|
||||
function handle_issues(output, issues, form_data) {
|
||||
output.issues = issues.map((issue) => normalize_issue(issue, true));
|
||||
if (form_data) {
|
||||
output.input = {};
|
||||
for (let key of form_data.keys()) {
|
||||
if (/^[.\]]?_/.test(key)) continue;
|
||||
const is_array = key.endsWith("[]");
|
||||
const values = form_data.getAll(key).filter((value) => typeof value === "string");
|
||||
if (is_array) key = key.slice(0, -2);
|
||||
set_nested_value(
|
||||
/** @type {Record<string, any>} */
|
||||
output.input,
|
||||
key,
|
||||
is_array ? values : values[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function create_issues() {
|
||||
return (
|
||||
/** @type {InvalidField<any>} */
|
||||
new Proxy(
|
||||
/** @param {string} message */
|
||||
(message) => {
|
||||
if (typeof message !== "string") {
|
||||
throw new Error(
|
||||
"`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. For more info see https://github.com/sveltejs/kit/pulls/14768"
|
||||
);
|
||||
}
|
||||
return create_issue(message);
|
||||
},
|
||||
{
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
return create_issue_proxy(prop, []);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
function create_issue(message, path = []) {
|
||||
return {
|
||||
message,
|
||||
path
|
||||
};
|
||||
}
|
||||
function create_issue_proxy(key, path) {
|
||||
const new_path = [...path, key];
|
||||
const issue_func = (message) => create_issue(message, new_path);
|
||||
return new Proxy(issue_func, {
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
if (/^\d+$/.test(prop)) {
|
||||
return create_issue_proxy(parseInt(prop, 10), new_path);
|
||||
}
|
||||
return create_issue_proxy(prop, new_path);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function prerender(validate_or_fn, fn_or_options, maybe_options) {
|
||||
const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
|
||||
const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "prerender",
|
||||
id: "",
|
||||
name: "",
|
||||
has_arg: !!maybe_fn,
|
||||
inputs: options?.inputs,
|
||||
dynamic: options?.dynamic
|
||||
};
|
||||
const wrapper = (arg) => {
|
||||
const promise = (async () => {
|
||||
const { event, state } = get_request_store();
|
||||
const payload = stringify_remote_arg(arg, state.transport);
|
||||
const id = __.id;
|
||||
const url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
|
||||
if (!state.prerendering && !DEV && !event.isRemoteRequest) {
|
||||
try {
|
||||
return await get_response(__, arg, state, async () => {
|
||||
const key = stringify_remote_arg(arg, state.transport);
|
||||
const cache = get_cache(__, state);
|
||||
const promise3 = cache[key] ??= fetch(new URL(url, event.url.origin).href).then(
|
||||
async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Prerendered response not found");
|
||||
}
|
||||
const prerendered = await response.json();
|
||||
if (prerendered.type === "error") {
|
||||
error(prerendered.status, prerendered.error);
|
||||
}
|
||||
return prerendered.result;
|
||||
}
|
||||
);
|
||||
return parse_remote_response(await promise3, state.transport);
|
||||
});
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
if (state.prerendering?.remote_responses.has(url)) {
|
||||
return (
|
||||
/** @type {Promise<any>} */
|
||||
state.prerendering.remote_responses.get(url)
|
||||
);
|
||||
}
|
||||
const promise2 = get_response(
|
||||
__,
|
||||
arg,
|
||||
state,
|
||||
() => run_remote_function(event, state, false, () => validate(arg), fn)
|
||||
);
|
||||
if (state.prerendering) {
|
||||
state.prerendering.remote_responses.set(url, promise2);
|
||||
}
|
||||
const result = await promise2;
|
||||
if (state.prerendering) {
|
||||
const body = { type: "result", result: stringify(result, state.transport) };
|
||||
state.prerendering.dependencies.set(url, {
|
||||
body: JSON.stringify(body),
|
||||
response: json(body)
|
||||
});
|
||||
}
|
||||
return result;
|
||||
})();
|
||||
promise.catch(() => {
|
||||
});
|
||||
return (
|
||||
/** @type {RemoteResource<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function query(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "query", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => run_remote_function(event, state, false, () => validate(arg), fn);
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function batch(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "query_batch",
|
||||
id: "",
|
||||
name: "",
|
||||
run: async (args, options) => {
|
||||
const { event, state } = get_request_store();
|
||||
return run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
return Promise.all(
|
||||
input.map(async (arg, i) => {
|
||||
try {
|
||||
return { type: "result", data: get_result(arg, i) };
|
||||
} catch (error2) {
|
||||
return {
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, state, options, error2),
|
||||
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
let batching = { args: [], resolvers: [] };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query.batch '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
batching.args.push(arg);
|
||||
batching.resolvers.push({ resolve, reject });
|
||||
if (batching.args.length > 1) return;
|
||||
setTimeout(async () => {
|
||||
const batched = batching;
|
||||
batching = { args: [], resolvers: [] };
|
||||
try {
|
||||
return await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(batched.args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
for (let i = 0; i < batched.resolvers.length; i++) {
|
||||
try {
|
||||
batched.resolvers[i].resolve(get_result(input[i], i));
|
||||
} catch (error2) {
|
||||
batched.resolvers[i].reject(error2);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (error2) {
|
||||
for (const resolver of batched.resolvers) {
|
||||
resolver.reject(error2);
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
};
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
Object.defineProperty(query, "batch", { value: batch, enumerable: true });
|
||||
function get_refresh_context(__, action, arg) {
|
||||
const { state } = get_request_store();
|
||||
const { refreshes } = state;
|
||||
if (!refreshes) {
|
||||
const name = __.type === "query_batch" ? `query.batch '${__.name}'` : `query '${__.name}'`;
|
||||
throw new Error(
|
||||
`Cannot call ${action} on ${name} because it is not executed in the context of a command/form remote function`
|
||||
);
|
||||
}
|
||||
const cache = get_cache(__, state);
|
||||
const cache_key = stringify_remote_arg(arg, state.transport);
|
||||
const refreshes_key = create_remote_key(__.id, cache_key);
|
||||
return { __, state, refreshes, refreshes_key, cache, cache_key };
|
||||
}
|
||||
function update_refresh_value({ __, refreshes, refreshes_key, cache, cache_key }, value, is_immediate_refresh = false) {
|
||||
const promise = Promise.resolve(value);
|
||||
if (!is_immediate_refresh) {
|
||||
cache[cache_key] = promise;
|
||||
}
|
||||
if (__.id) {
|
||||
refreshes[refreshes_key] = promise;
|
||||
}
|
||||
return promise.then(() => {
|
||||
});
|
||||
}
|
||||
export {
|
||||
command,
|
||||
form,
|
||||
prerender,
|
||||
query
|
||||
};
|
||||
@@ -24,7 +24,7 @@ export const options = {
|
||||
app: ({ head, body, assets, nonce, env }) => "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n " + head + "\n </head>\n <body data-sveltekit-preload-data=\"hover\">\n <div style=\"display: contents\">" + body + "</div>\n </body>\n</html>\n",
|
||||
error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
|
||||
},
|
||||
version_hash: "1e50mid"
|
||||
version_hash: "e8kpas"
|
||||
};
|
||||
|
||||
export async function get_hooks() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
".svelte-kit/generated/client-optimized/app.js": {
|
||||
"file": "_app/immutable/entry/app.BaRtR_VV.js",
|
||||
"file": "_app/immutable/entry/app.DE4HKxpj.js",
|
||||
"name": "entry/app",
|
||||
"src": ".svelte-kit/generated/client-optimized/app.js",
|
||||
"isEntry": true,
|
||||
@@ -37,7 +37,7 @@
|
||||
]
|
||||
},
|
||||
".svelte-kit/generated/client-optimized/nodes/1.js": {
|
||||
"file": "_app/immutable/nodes/1.CEGpjm-A.js",
|
||||
"file": "_app/immutable/nodes/1.BwpnmtAp.js",
|
||||
"name": "nodes/1",
|
||||
"src": ".svelte-kit/generated/client-optimized/nodes/1.js",
|
||||
"isEntry": true,
|
||||
@@ -47,7 +47,7 @@
|
||||
"_BrBXfa46.js",
|
||||
"_m2dceAnU.js",
|
||||
"_Db3dOJqt.js",
|
||||
"_DH791y0n.js"
|
||||
"_D6EhJnz8.js"
|
||||
]
|
||||
},
|
||||
".svelte-kit/generated/client-optimized/nodes/2.js": {
|
||||
@@ -64,16 +64,16 @@
|
||||
]
|
||||
},
|
||||
".svelte-kit/generated/client-optimized/nodes/4.js": {
|
||||
"file": "_app/immutable/nodes/4.B8D3vRQS.js",
|
||||
"file": "_app/immutable/nodes/4.DSwQNsv9.js",
|
||||
"name": "nodes/4",
|
||||
"src": ".svelte-kit/generated/client-optimized/nodes/4.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_CM9au6ec.js"
|
||||
"_D0oS5fvi.js"
|
||||
]
|
||||
},
|
||||
".svelte-kit/generated/client-optimized/nodes/5.js": {
|
||||
"file": "_app/immutable/nodes/5.NGnDqIo2.js",
|
||||
"file": "_app/immutable/nodes/5.Y48nEW8J.js",
|
||||
"name": "nodes/5",
|
||||
"src": ".svelte-kit/generated/client-optimized/nodes/5.js",
|
||||
"isEntry": true,
|
||||
@@ -117,24 +117,6 @@
|
||||
"file": "_app/immutable/chunks/Bzak7iHL.js",
|
||||
"name": "disclose-version"
|
||||
},
|
||||
"_CM9au6ec.js": {
|
||||
"file": "_app/immutable/chunks/CM9au6ec.js",
|
||||
"name": "4",
|
||||
"isDynamicEntry": true,
|
||||
"imports": [
|
||||
"_CS4xyx6M.js",
|
||||
"_Bzak7iHL.js",
|
||||
"_m2dceAnU.js",
|
||||
"_BMcrRaS1.js",
|
||||
"_DcegSV8N.js",
|
||||
"_BtiMKAzw.js",
|
||||
"_DKU_2deH.js",
|
||||
"_CvosxF64.js"
|
||||
],
|
||||
"dynamicImports": [
|
||||
"src/routes/items/ItemsCrud.svelte"
|
||||
]
|
||||
},
|
||||
"_CS4xyx6M.js": {
|
||||
"file": "_app/immutable/chunks/CS4xyx6M.js",
|
||||
"name": "3",
|
||||
@@ -151,6 +133,24 @@
|
||||
"_m2dceAnU.js"
|
||||
]
|
||||
},
|
||||
"_D0oS5fvi.js": {
|
||||
"file": "_app/immutable/chunks/D0oS5fvi.js",
|
||||
"name": "4",
|
||||
"isDynamicEntry": true,
|
||||
"imports": [
|
||||
"_CS4xyx6M.js",
|
||||
"_Bzak7iHL.js",
|
||||
"_m2dceAnU.js",
|
||||
"_BMcrRaS1.js",
|
||||
"_DcegSV8N.js",
|
||||
"_BtiMKAzw.js",
|
||||
"_DKU_2deH.js",
|
||||
"_CvosxF64.js"
|
||||
],
|
||||
"dynamicImports": [
|
||||
"src/routes/items/ItemsCrud.svelte"
|
||||
]
|
||||
},
|
||||
"_D4Z6sX8n.js": {
|
||||
"file": "_app/immutable/chunks/D4Z6sX8n.js",
|
||||
"name": "button",
|
||||
@@ -162,8 +162,8 @@
|
||||
"_CvosxF64.js"
|
||||
]
|
||||
},
|
||||
"_DH791y0n.js": {
|
||||
"file": "_app/immutable/chunks/DH791y0n.js",
|
||||
"_D6EhJnz8.js": {
|
||||
"file": "_app/immutable/chunks/D6EhJnz8.js",
|
||||
"name": "entry",
|
||||
"imports": [
|
||||
"_Db3dOJqt.js",
|
||||
@@ -192,15 +192,15 @@
|
||||
"_m2dceAnU.js"
|
||||
]
|
||||
},
|
||||
"_OSRdxUzr.js": {
|
||||
"file": "_app/immutable/chunks/OSRdxUzr.js",
|
||||
"_Djw4YAFw.js": {
|
||||
"file": "_app/immutable/chunks/Djw4YAFw.js",
|
||||
"name": "label",
|
||||
"imports": [
|
||||
"_m2dceAnU.js",
|
||||
"_Bzak7iHL.js",
|
||||
"_BtiMKAzw.js",
|
||||
"_CvosxF64.js",
|
||||
"_DH791y0n.js",
|
||||
"_D6EhJnz8.js",
|
||||
"_DcegSV8N.js",
|
||||
"_CS4xyx6M.js"
|
||||
]
|
||||
@@ -210,16 +210,16 @@
|
||||
"name": "template"
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/client/entry.js": {
|
||||
"file": "_app/immutable/entry/start.CdONOS6-.js",
|
||||
"file": "_app/immutable/entry/start.C_SQrpA0.js",
|
||||
"name": "entry/start",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/client/entry.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_DH791y0n.js"
|
||||
"_D6EhJnz8.js"
|
||||
]
|
||||
},
|
||||
"src/routes/items/ItemsCrud.svelte": {
|
||||
"file": "_app/immutable/chunks/B-nxqYk-.js",
|
||||
"file": "_app/immutable/chunks/Bac5Y1lX.js",
|
||||
"name": "ItemsCrud",
|
||||
"src": "src/routes/items/ItemsCrud.svelte",
|
||||
"isDynamicEntry": true,
|
||||
@@ -229,8 +229,8 @@
|
||||
"_Db3dOJqt.js",
|
||||
"_DcegSV8N.js",
|
||||
"_CS4xyx6M.js",
|
||||
"_CM9au6ec.js",
|
||||
"_OSRdxUzr.js",
|
||||
"_D0oS5fvi.js",
|
||||
"_Djw4YAFw.js",
|
||||
"_BtiMKAzw.js",
|
||||
"_CvosxF64.js",
|
||||
"_D4Z6sX8n.js",
|
||||
@@ -238,7 +238,7 @@
|
||||
]
|
||||
},
|
||||
"src/routes/login/LoginForm.svelte": {
|
||||
"file": "_app/immutable/chunks/CnbhzkKJ.js",
|
||||
"file": "_app/immutable/chunks/DvQsdWht.js",
|
||||
"name": "LoginForm",
|
||||
"src": "src/routes/login/LoginForm.svelte",
|
||||
"isDynamicEntry": true,
|
||||
@@ -248,7 +248,7 @@
|
||||
"_Db3dOJqt.js",
|
||||
"_DcegSV8N.js",
|
||||
"_CS4xyx6M.js",
|
||||
"_OSRdxUzr.js",
|
||||
"_Djw4YAFw.js",
|
||||
"_BtiMKAzw.js",
|
||||
"_CvosxF64.js",
|
||||
"_D4Z6sX8n.js"
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B-nxqYk-.js","./Bzak7iHL.js","./m2dceAnU.js","./Db3dOJqt.js","./DKU_2deH.js","./DcegSV8N.js","./CS4xyx6M.js","./OSRdxUzr.js","./BtiMKAzw.js","./CvosxF64.js","./DH791y0n.js","./D4Z6sX8n.js"])))=>i.map(i=>d[i]);
|
||||
import{c as P,_ as B}from"./CS4xyx6M.js";import"./Bzak7iHL.js";import{h as t,i as w,N as y,ap as L,k as N,Q as O,aq as S,ar as V,as as R,at as A,L as D,p as h,m as _,Z as q,au as j,av as z,aw as G,ax as k,D as F,b as p,d as b,F as H,a as c,E as I,$ as Q,ay as Z,g as E,u as C,f as J}from"./m2dceAnU.js";import{a as K}from"./BMcrRaS1.js";import{B as U,i as W}from"./DcegSV8N.js";import{t as X,a as Y,c as $,s as ee}from"./BtiMKAzw.js";import{i as ae}from"./DKU_2deH.js";import{p as T,b as re,r as te}from"./CvosxF64.js";function ne(f,r,n,o,u,e){let d=t;t&&w();var a=null;t&&y.nodeType===L&&(a=y,w());var l=t?y:f,i=new U(l,!1);N(()=>{const s=r()||null;var v=n||s==="svg"?V:void 0;if(s===null){i.ensure(null,null);return}return i.ensure(s,m=>{if(s){if(a=t?a:S(s,v),R(a,a),o){t&&ae(s)&&a.append(document.createComment(""));var g=t?A(a):a.appendChild(D());t&&(g===null?h(!1):_(g)),o(a,g)}q.nodes.end=a,m.before(a)}t&&_(m)}),()=>{}},O),j(()=>{}),d&&(h(!0),_(l))}function se(f,r){let n=null,o=t;var u;if(t){n=y;for(var e=A(document.head);e!==null&&(e.nodeType!==G||e.data!==f);)e=k(e);if(e===null)h(!1);else{var d=k(e);e.remove(),_(d)}}t||(u=document.head.appendChild(D()));try{N(()=>r(u),z)}finally{o&&(h(!0),_(n))}}const ie=X({base:"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function _e(f,r){F(r,!0);let n=T(r,"ref",15,null),o=T(r,"variant",3,"default"),u=te(r,["$$slots","$$events","$$legacy","ref","href","class","variant","children"]);var e=p(),d=b(e);ne(d,()=>r.href?"a":"span",!1,(a,l)=>{re(a,v=>n(v),()=>n()),Y(a,v=>({"data-slot":"badge",href:r.href,class:v,...u}),[()=>$(ie({variant:o()}),r.class)]);var i=p(),s=b(i);ee(s,()=>r.children??H),c(l,i)}),c(f,e),I()}var oe=J('<main class="container mx-auto flex flex-col gap-6 py-8"><p class="text-muted-foreground">Loading…</p></main>');function pe(f,r){F(r,!0);var n=p();se("rk8na7",e=>{Q(()=>{Z.title="Items – Stackq"})});var o=b(n);{var u=e=>{var d=p(),a=b(d);K(a,()=>B(()=>import("./B-nxqYk-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),l=>{var i=oe();c(l,i)},(l,i)=>{var s=C(()=>{var{default:x}=E(i);return{ItemsCrud:x}}),v=C(()=>E(s).ItemsCrud),m=p(),g=b(m);P(g,()=>E(v),(x,M)=>{M(x,{get data(){return r.data}})}),c(l,m)}),c(e,d)};W(o,e=>{e(u)})}c(f,n),I()}export{_e as B,pe as _,ne as e,se as h};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bac5Y1lX.js","./Bzak7iHL.js","./m2dceAnU.js","./Db3dOJqt.js","./DKU_2deH.js","./DcegSV8N.js","./CS4xyx6M.js","./Djw4YAFw.js","./BtiMKAzw.js","./CvosxF64.js","./D6EhJnz8.js","./D4Z6sX8n.js"])))=>i.map(i=>d[i]);
|
||||
import{c as P,_ as B}from"./CS4xyx6M.js";import"./Bzak7iHL.js";import{h as t,i as w,N as y,ap as L,k as N,Q as O,aq as S,ar as V,as as R,at as A,L as D,p as h,m as _,Z as q,au as j,av as z,aw as G,ax as k,D as F,b as p,d as b,F as H,a as c,E as I,$ as Q,ay as Z,g as E,u as C,f as J}from"./m2dceAnU.js";import{a as K}from"./BMcrRaS1.js";import{B as U,i as W}from"./DcegSV8N.js";import{t as X,a as Y,c as $,s as ee}from"./BtiMKAzw.js";import{i as ae}from"./DKU_2deH.js";import{p as T,b as re,r as te}from"./CvosxF64.js";function ne(f,r,n,o,u,e){let d=t;t&&w();var a=null;t&&y.nodeType===L&&(a=y,w());var l=t?y:f,i=new U(l,!1);N(()=>{const s=r()||null;var v=n||s==="svg"?V:void 0;if(s===null){i.ensure(null,null);return}return i.ensure(s,m=>{if(s){if(a=t?a:S(s,v),R(a,a),o){t&&ae(s)&&a.append(document.createComment(""));var g=t?A(a):a.appendChild(D());t&&(g===null?h(!1):_(g)),o(a,g)}q.nodes.end=a,m.before(a)}t&&_(m)}),()=>{}},O),j(()=>{}),d&&(h(!0),_(l))}function se(f,r){let n=null,o=t;var u;if(t){n=y;for(var e=A(document.head);e!==null&&(e.nodeType!==G||e.data!==f);)e=k(e);if(e===null)h(!1);else{var d=k(e);e.remove(),_(d)}}t||(u=document.head.appendChild(D()));try{N(()=>r(u),z)}finally{o&&(h(!0),_(n))}}const ie=X({base:"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function _e(f,r){F(r,!0);let n=T(r,"ref",15,null),o=T(r,"variant",3,"default"),u=te(r,["$$slots","$$events","$$legacy","ref","href","class","variant","children"]);var e=p(),d=b(e);ne(d,()=>r.href?"a":"span",!1,(a,l)=>{re(a,v=>n(v),()=>n()),Y(a,v=>({"data-slot":"badge",href:r.href,class:v,...u}),[()=>$(ie({variant:o()}),r.class)]);var i=p(),s=b(i);ee(s,()=>r.children??H),c(l,i)}),c(f,e),I()}var oe=J('<main class="container mx-auto flex flex-col gap-6 py-8"><p class="text-muted-foreground">Loading…</p></main>');function pe(f,r){F(r,!0);var n=p();se("rk8na7",e=>{Q(()=>{Z.title="Items – Stackq"})});var o=b(n);{var u=e=>{var d=p(),a=b(d);K(a,()=>B(()=>import("./Bac5Y1lX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),l=>{var i=oe();c(l,i)},(l,i)=>{var s=C(()=>{var{default:x}=E(i);return{ItemsCrud:x}}),v=C(()=>E(s).ItemsCrud),m=p(),g=b(m);P(g,()=>E(v),(x,M)=>{M(x,{get data(){return r.data}})}),c(l,m)}),c(e,d)};W(o,e=>{e(u)})}c(f,n),I()}export{_e as B,pe as _,ne as e,se as h};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,4 +1,4 @@
|
||||
var gt=Object.defineProperty;var at=t=>{throw TypeError(t)};var Et=(t,e,r)=>e in t?gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var H=(t,e,r)=>Et(t,typeof e!="symbol"?e+"":e,r),it=(t,e,r)=>e.has(t)||at("Cannot "+r);var k=(t,e,r)=>(it(t,e,"read from private field"),r?r.call(t):e.get(t)),V=(t,e,r)=>e.has(t)?at("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),z=(t,e,r,o)=>(it(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);import{b6 as wt,$ as xt,a1 as G,a0 as et,ao as At,be as _t,bf as dt,h as mt,G as L,aW as St,bg as Tt,D as A,c as C,F,r as W,a as g,E as _,f as S,g as I,u as X,b0 as kt,a6 as Pt,a7 as pt,bh as It,b as U,d as D}from"./m2dceAnU.js";import"./Bzak7iHL.js";import{a as w,c as x,s as O,b as K}from"./BtiMKAzw.js";import{p as y,b as R,r as T,s as Ot}from"./CvosxF64.js";import{i as Rt,a as Lt,b as jt,c as Mt}from"./DH791y0n.js";import{i as bt}from"./DcegSV8N.js";import{c as Nt}from"./CS4xyx6M.js";function Ct(){return Symbol(wt)}function He(t,e,r){xt(()=>{var o=G(()=>e(t,r==null?void 0:r())||{});if(r&&(o!=null&&o.update)){var n=!1,i={};et(()=>{var a=r();At(a),n&&_t(i,a)&&(i=a,o.update(a))}),n=!0}if(o!=null&&o.destroy)return()=>o.destroy()})}function st(t,e,r=e){var o=new WeakSet;dt(t,"input",async n=>{var i=n?t.defaultValue:t.value;if(i=q(t)?J(i):i,r(i),L!==null&&o.add(L),await St(),i!==(i=e())){var a=t.selectionStart,l=t.selectionEnd,d=t.value.length;if(t.value=i??"",l!==null){var m=t.value.length;a===l&&l===d&&m>d?(t.selectionStart=m,t.selectionEnd=m):(t.selectionStart=a,t.selectionEnd=Math.min(l,m))}}}),(mt&&t.defaultValue!==t.value||G(e)==null&&t.value)&&(r(q(t)?J(t.value):t.value),L!==null&&o.add(L)),et(()=>{var n=e();if(t===document.activeElement){var i=Tt??L;if(o.has(i))return}q(t)&&n===J(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n??"")})}function q(t){var e=t.type;return e==="number"||e==="range"}function J(t){return t===""?null:+t}function Ft(t,e,r=e){dt(t,"change",()=>{r(t.files)}),mt&&t.files&&r(t.files),et(()=>{t.files=e()})}var Wt=S("<div><!></div>");function Ve(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Wt();w(n,a=>({"data-slot":"card",class:a,...o}),[()=>x("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Ht=S("<div><!></div>");function Be(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Ht();w(n,a=>({"data-slot":"card-content",class:a,...o}),[()=>x("px-6",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Vt=S("<div><!></div>");function Ge(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Vt();w(n,a=>({"data-slot":"card-header",class:a,...o}),[()=>x("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Bt=S("<div><!></div>");function Ue(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Bt();w(n,a=>({"data-slot":"card-title",class:a,...o}),[()=>x("leading-none font-semibold",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}function Gt(t){return typeof t=="function"}function Ut(t){return t!==null&&typeof t=="object"}const Dt=["string","number","bigint","boolean"];function Q(t){return t==null||Dt.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>Q(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const j=Symbol("box"),rt=Symbol("is-writable");function $(t,e){const r=X(t);return e?{[j]:!0,[rt]:!0,get current(){return I(r)},set current(o){e(o)}}:{[j]:!0,get current(){return t()}}}function Y(t){return Ut(t)&&j in t}function vt(t){return Y(t)&&rt in t}function De(t){return Y(t)?t:Gt(t)?$(t):Xt(t)}function Xe(t){return Object.entries(t).reduce((e,[r,o])=>Y(o)?(vt(o)?Object.defineProperty(e,r,{get(){return o.current},set(n){o.current=n}}):Object.defineProperty(e,r,{get(){return o.current}}),e):Object.assign(e,{[r]:o}),{})}function Ye(t){return vt(t)?{[j]:!0,get current(){return t.current}}:t}function Xt(t){let e=kt(Pt(t));return{[j]:!0,[rt]:!0,get current(){return I(e)},set current(r){pt(e,r,!0)}}}function Yt(...t){return function(e){var r;for(const o of t)if(o){if(e.defaultPrevented)return;typeof o=="function"?o.call(this,e):(r=o.current)==null||r.call(this,e)}}}var ct=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,zt=/\n/g,Kt=/^\s*/,qt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Jt=/^:\s*/,Zt=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qt=/^[;\s]*/,$t=/^\s+|\s+$/g,te=`
|
||||
var gt=Object.defineProperty;var at=t=>{throw TypeError(t)};var Et=(t,e,r)=>e in t?gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var H=(t,e,r)=>Et(t,typeof e!="symbol"?e+"":e,r),it=(t,e,r)=>e.has(t)||at("Cannot "+r);var k=(t,e,r)=>(it(t,e,"read from private field"),r?r.call(t):e.get(t)),V=(t,e,r)=>e.has(t)?at("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),z=(t,e,r,o)=>(it(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);import{b6 as wt,$ as xt,a1 as G,a0 as et,ao as At,be as _t,bf as dt,h as mt,G as L,aW as St,bg as Tt,D as A,c as C,F,r as W,a as g,E as _,f as S,g as I,u as X,b0 as kt,a6 as Pt,a7 as pt,bh as It,b as U,d as D}from"./m2dceAnU.js";import"./Bzak7iHL.js";import{a as w,c as x,s as O,b as K}from"./BtiMKAzw.js";import{p as y,b as R,r as T,s as Ot}from"./CvosxF64.js";import{i as Rt,a as Lt,b as jt,c as Mt}from"./D6EhJnz8.js";import{i as bt}from"./DcegSV8N.js";import{c as Nt}from"./CS4xyx6M.js";function Ct(){return Symbol(wt)}function He(t,e,r){xt(()=>{var o=G(()=>e(t,r==null?void 0:r())||{});if(r&&(o!=null&&o.update)){var n=!1,i={};et(()=>{var a=r();At(a),n&&_t(i,a)&&(i=a,o.update(a))}),n=!0}if(o!=null&&o.destroy)return()=>o.destroy()})}function st(t,e,r=e){var o=new WeakSet;dt(t,"input",async n=>{var i=n?t.defaultValue:t.value;if(i=q(t)?J(i):i,r(i),L!==null&&o.add(L),await St(),i!==(i=e())){var a=t.selectionStart,l=t.selectionEnd,d=t.value.length;if(t.value=i??"",l!==null){var m=t.value.length;a===l&&l===d&&m>d?(t.selectionStart=m,t.selectionEnd=m):(t.selectionStart=a,t.selectionEnd=Math.min(l,m))}}}),(mt&&t.defaultValue!==t.value||G(e)==null&&t.value)&&(r(q(t)?J(t.value):t.value),L!==null&&o.add(L)),et(()=>{var n=e();if(t===document.activeElement){var i=Tt??L;if(o.has(i))return}q(t)&&n===J(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n??"")})}function q(t){var e=t.type;return e==="number"||e==="range"}function J(t){return t===""?null:+t}function Ft(t,e,r=e){dt(t,"change",()=>{r(t.files)}),mt&&t.files&&r(t.files),et(()=>{t.files=e()})}var Wt=S("<div><!></div>");function Ve(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Wt();w(n,a=>({"data-slot":"card",class:a,...o}),[()=>x("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Ht=S("<div><!></div>");function Be(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Ht();w(n,a=>({"data-slot":"card-content",class:a,...o}),[()=>x("px-6",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Vt=S("<div><!></div>");function Ge(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Vt();w(n,a=>({"data-slot":"card-header",class:a,...o}),[()=>x("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}var Bt=S("<div><!></div>");function Ue(t,e){A(e,!0);let r=y(e,"ref",15,null),o=T(e,["$$slots","$$events","$$legacy","ref","class","children"]);var n=Bt();w(n,a=>({"data-slot":"card-title",class:a,...o}),[()=>x("leading-none font-semibold",e.class)]);var i=C(n);O(i,()=>e.children??F),W(n),R(n,a=>r(a),()=>r()),g(t,n),_()}function Gt(t){return typeof t=="function"}function Ut(t){return t!==null&&typeof t=="object"}const Dt=["string","number","bigint","boolean"];function Q(t){return t==null||Dt.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>Q(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const j=Symbol("box"),rt=Symbol("is-writable");function $(t,e){const r=X(t);return e?{[j]:!0,[rt]:!0,get current(){return I(r)},set current(o){e(o)}}:{[j]:!0,get current(){return t()}}}function Y(t){return Ut(t)&&j in t}function vt(t){return Y(t)&&rt in t}function De(t){return Y(t)?t:Gt(t)?$(t):Xt(t)}function Xe(t){return Object.entries(t).reduce((e,[r,o])=>Y(o)?(vt(o)?Object.defineProperty(e,r,{get(){return o.current},set(n){o.current=n}}):Object.defineProperty(e,r,{get(){return o.current}}),e):Object.assign(e,{[r]:o}),{})}function Ye(t){return vt(t)?{[j]:!0,get current(){return t.current}}:t}function Xt(t){let e=kt(Pt(t));return{[j]:!0,[rt]:!0,get current(){return I(e)},set current(r){pt(e,r,!0)}}}function Yt(...t){return function(e){var r;for(const o of t)if(o){if(e.defaultPrevented)return;typeof o=="function"?o.call(this,e):(r=o.current)==null||r.call(this,e)}}}var ct=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,zt=/\n/g,Kt=/^\s*/,qt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Jt=/^:\s*/,Zt=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qt=/^[;\s]*/,$t=/^\s+|\s+$/g,te=`
|
||||
`,lt="/",ut="*",E="",ee="comment",re="declaration";function ne(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var r=1,o=1;function n(c){var s=c.match(zt);s&&(r+=s.length);var h=c.lastIndexOf(te);o=~h?c.length-h:o+c.length}function i(){var c={line:r,column:o};return function(s){return s.position=new a(c),m(),s}}function a(c){this.start=c,this.end={line:r,column:o},this.source=e.source}a.prototype.content=t;function l(c){var s=new Error(e.source+":"+r+":"+o+": "+c);if(s.reason=c,s.filename=e.source,s.line=r,s.column=o,s.source=t,!e.silent)throw s}function d(c){var s=c.exec(t);if(s){var h=s[0];return n(h),t=t.slice(h.length),s}}function m(){d(Kt)}function p(c){var s;for(c=c||[];s=b();)s!==!1&&c.push(s);return c}function b(){var c=i();if(!(lt!=t.charAt(0)||ut!=t.charAt(1))){for(var s=2;E!=t.charAt(s)&&(ut!=t.charAt(s)||lt!=t.charAt(s+1));)++s;if(s+=2,E===t.charAt(s-1))return l("End of comment missing");var h=t.slice(2,s-2);return o+=2,n(h),t=t.slice(s),o+=2,c({type:ee,comment:h})}}function f(){var c=i(),s=d(qt);if(s){if(b(),!d(Jt))return l("property missing ':'");var h=d(Zt),v=c({type:re,property:ft(s[0].replace(ct,E)),value:h?ft(h[0].replace(ct,E)):E});return d(Qt),v}}function u(){var c=[];p(c);for(var s;s=f();)s!==!1&&(c.push(s),p(c));return c}return m(),u()}function ft(t){return t?t.replace($t,E):E}function oe(t,e){let r=null;if(!t||typeof t!="string")return r;const o=ne(t),n=typeof e=="function";return o.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:l}=i;n?e(a,l,i):l&&(r=r||{},r[a]=l)}),r}const ae=/\d/,ie=["-","_","/","."];function se(t=""){if(!ae.test(t))return t!==t.toLowerCase()}function ce(t){const e=[];let r="",o,n;for(const i of t){const a=ie.includes(i);if(a===!0){e.push(r),r="",o=void 0;continue}const l=se(i);if(n===!1){if(o===!1&&l===!0){e.push(r),r=i,o=l;continue}if(o===!0&&l===!1&&r.length>1){const d=r.at(-1);e.push(r.slice(0,Math.max(0,r.length-1))),r=d+i,o=l;continue}}r+=i,o=l,n=a}return e.push(r),e}function ht(t){return t?ce(t).map(e=>ue(e)).join(""):""}function le(t){return fe(ht(t||""))}function ue(t){return t?t[0].toUpperCase()+t.slice(1):""}function fe(t){return t?t[0].toLowerCase()+t.slice(1):""}function B(t){if(!t)return{};const e={};function r(o,n){if(o.startsWith("-moz-")||o.startsWith("-webkit-")||o.startsWith("-ms-")||o.startsWith("-o-")){e[ht(o)]=n;return}if(o.startsWith("--")){e[o]=n;return}e[le(o)]=n}return oe(t,r),e}function de(...t){return(...e)=>{for(const r of t)typeof r=="function"&&r(...e)}}function me(t,e){const r=RegExp(t,"g");return o=>{if(typeof o!="string")throw new TypeError(`expected an argument of type string, but got ${typeof o}`);return o.match(r)?o.replace(r,e):o}}const pe=me(/[A-Z]/,t=>`-${t.toLowerCase()}`);function be(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected an argument of type object, but got ${typeof t}`);return Object.keys(t).map(e=>`${pe(e)}: ${t[e]};`).join(`
|
||||
`)}function ve(t={}){return be(t).replace(`
|
||||
`," ")}const he=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],ye=new Set(he);function ge(t){return ye.has(t)}function Ee(...t){const e={...t[0]};for(let r=1;r<t.length;r++){const o=t[r];if(o){for(const n of Object.keys(o)){const i=e[n],a=o[n],l=typeof i=="function",d=typeof a=="function";if(l&&ge(n)){const m=i,p=a;e[n]=Yt(m,p)}else if(l&&d)e[n]=de(i,a);else if(n==="class"){const m=Q(i),p=Q(a);m&&p?e[n]=K(i,a):m?e[n]=K(i):p&&(e[n]=K(a))}else if(n==="style"){const m=typeof i=="object",p=typeof a=="object",b=typeof i=="string",f=typeof a=="string";if(m&&p)e[n]={...i,...a};else if(m&&f){const u=B(a);e[n]={...i,...u}}else if(b&&p){const u=B(i);e[n]={...u,...a}}else if(b&&f){const u=B(i),c=B(a);e[n]={...u,...c}}else m?e[n]=i:p?e[n]=a:b?e[n]=i:f&&(e[n]=a)}else e[n]=a!==void 0?a:i}for(const n of Object.getOwnPropertySymbols(o)){const i=e[n],a=o[n];e[n]=a!==void 0?a:i}}}return typeof e.style=="object"&&(e.style=ve(e.style).replaceAll(`
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import"./Bzak7iHL.js";import{D,c as u,F as H,r as f,a as t,E as O,f as g,b as J,d as q,n as m,t as h,s as n,g as K,u as M,T as N}from"./m2dceAnU.js";import{s as Q}from"./Db3dOJqt.js";import{i as R}from"./DcegSV8N.js";import{c as x}from"./CS4xyx6M.js";import{C as U,a as V,b as W,L as j,I as k,c as X,d as Y,e as Z}from"./OSRdxUzr.js";import{a as ee,c as re,s as te}from"./BtiMKAzw.js";import{p as ae,b as se,r as oe}from"./CvosxF64.js";import{B as de}from"./D4Z6sX8n.js";var le=g("<p><!></p>");function ie(y,a){D(a,!0);let p=ae(a,"ref",15,null),P=oe(a,["$$slots","$$events","$$legacy","ref","class","children"]);var o=le();ee(o,v=>({"data-slot":"card-description",class:v,...P}),[()=>re("text-muted-foreground text-sm",a.class)]);var b=u(o);te(b,()=>a.children??H),f(o),se(o,v=>p(v),()=>p()),t(y,o),O()}var ne=g("<!> <!>",1),ce=g('<p class="text-destructive text-sm"> </p>'),me=g('<form method="POST" action="?/login" class="space-y-4"><div class="space-y-2"><!> <!></div> <div class="space-y-2"><div class="flex items-center justify-between"><!> <a href="/forgot-password" class="text-muted-foreground text-sm underline hover:text-foreground">Forgot your password?</a></div> <!></div> <!> <!></form>'),ue=g("<!> <!>",1);function Pe(y,a){D(a,!0);var p=J(),P=q(p);x(P,()=>Y,(o,b)=>{b(o,{class:"w-full max-w-sm",children:(v,fe)=>{var B=ue(),I=q(B);x(I,()=>U,(C,L)=>{L(C,{children:(E,z)=>{var d=ne(),c=q(d);x(c,()=>V,(_,l)=>{l(_,{children:(i,F)=>{m();var $=h("Login");t(i,$)},$$slots:{default:!0}})});var w=n(c,2);x(w,()=>ie,(_,l)=>{l(_,{children:(i,F)=>{m();var $=h("Enter your email and password to sign in.");t(i,$)},$$slots:{default:!0}})}),t(E,d)},$$slots:{default:!0}})});var S=n(I,2);x(S,()=>W,(C,L)=>{L(C,{children:(E,z)=>{var d=me(),c=u(d),w=u(c);j(w,{for:"email",children:(e,r)=>{m();var s=h("Email");t(e,s)},$$slots:{default:!0}});var _=n(w,2);{let e=M(()=>{var r;return((r=a.data)==null?void 0:r.email)??""});k(_,{id:"email",name:"email",type:"email",placeholder:"you@example.com",autocomplete:"email",get value(){return K(e)},required:!0})}f(c);var l=n(c,2),i=u(l),F=u(i);j(F,{for:"password",children:(e,r)=>{m();var s=h("Password");t(e,s)},$$slots:{default:!0}}),m(2),f(i);var $=n(i,2);k($,{id:"password",name:"password",type:"password",autocomplete:"current-password",required:!0}),f(l);var T=n(l,2);{var A=e=>{var r=ce(),s=u(r,!0);f(r),N(()=>Q(s,a.data.error)),t(e,r)};R(T,e=>{var r;(r=a.data)!=null&&r.error&&e(A)})}var G=n(T,2);de(G,{type:"submit",class:"w-full",children:(e,r)=>{m();var s=h("Login");t(e,s)},$$slots:{default:!0}}),f(d),X(d,(e,r)=>{var s;return(s=Z)==null?void 0:s(e,r)},()=>()=>async({update:e})=>{await e()}),t(E,d)},$$slots:{default:!0}})}),t(v,B)},$$slots:{default:!0}})}),t(y,p),O()}export{Pe as default};
|
||||
import"./Bzak7iHL.js";import{D,c as u,F as H,r as f,a as t,E as O,f as g,b as J,d as q,n as m,t as h,s as n,g as K,u as M,T as N}from"./m2dceAnU.js";import{s as Q}from"./Db3dOJqt.js";import{i as R}from"./DcegSV8N.js";import{c as x}from"./CS4xyx6M.js";import{C as U,a as V,b as W,L as j,I as k,c as X,d as Y,e as Z}from"./Djw4YAFw.js";import{a as ee,c as re,s as te}from"./BtiMKAzw.js";import{p as ae,b as se,r as oe}from"./CvosxF64.js";import{B as de}from"./D4Z6sX8n.js";var le=g("<p><!></p>");function ie(y,a){D(a,!0);let p=ae(a,"ref",15,null),P=oe(a,["$$slots","$$events","$$legacy","ref","class","children"]);var o=le();ee(o,v=>({"data-slot":"card-description",class:v,...P}),[()=>re("text-muted-foreground text-sm",a.class)]);var b=u(o);te(b,()=>a.children??H),f(o),se(o,v=>p(v),()=>p()),t(y,o),O()}var ne=g("<!> <!>",1),ce=g('<p class="text-destructive text-sm"> </p>'),me=g('<form method="POST" action="?/login" class="space-y-4"><div class="space-y-2"><!> <!></div> <div class="space-y-2"><div class="flex items-center justify-between"><!> <a href="/forgot-password" class="text-muted-foreground text-sm underline hover:text-foreground">Forgot your password?</a></div> <!></div> <!> <!></form>'),ue=g("<!> <!>",1);function Pe(y,a){D(a,!0);var p=J(),P=q(p);x(P,()=>Y,(o,b)=>{b(o,{class:"w-full max-w-sm",children:(v,fe)=>{var B=ue(),I=q(B);x(I,()=>U,(C,L)=>{L(C,{children:(E,z)=>{var d=ne(),c=q(d);x(c,()=>V,(_,l)=>{l(_,{children:(i,F)=>{m();var $=h("Login");t(i,$)},$$slots:{default:!0}})});var w=n(c,2);x(w,()=>ie,(_,l)=>{l(_,{children:(i,F)=>{m();var $=h("Enter your email and password to sign in.");t(i,$)},$$slots:{default:!0}})}),t(E,d)},$$slots:{default:!0}})});var S=n(I,2);x(S,()=>W,(C,L)=>{L(C,{children:(E,z)=>{var d=me(),c=u(d),w=u(c);j(w,{for:"email",children:(e,r)=>{m();var s=h("Email");t(e,s)},$$slots:{default:!0}});var _=n(w,2);{let e=M(()=>{var r;return((r=a.data)==null?void 0:r.email)??""});k(_,{id:"email",name:"email",type:"email",placeholder:"you@example.com",autocomplete:"email",get value(){return K(e)},required:!0})}f(c);var l=n(c,2),i=u(l),F=u(i);j(F,{for:"password",children:(e,r)=>{m();var s=h("Password");t(e,s)},$$slots:{default:!0}}),m(2),f(i);var $=n(i,2);k($,{id:"password",name:"password",type:"password",autocomplete:"current-password",required:!0}),f(l);var T=n(l,2);{var A=e=>{var r=ce(),s=u(r,!0);f(r),N(()=>Q(s,a.data.error)),t(e,r)};R(T,e=>{var r;(r=a.data)!=null&&r.error&&e(A)})}var G=n(T,2);de(G,{type:"submit",class:"w-full",children:(e,r)=>{m();var s=h("Login");t(e,s)},$$slots:{default:!0}}),f(d),X(d,(e,r)=>{var s;return(s=Z)==null?void 0:s(e,r)},()=>()=>async({update:e})=>{await e()}),t(E,d)},$$slots:{default:!0}})}),t(v,B)},$$slots:{default:!0}})}),t(y,p),O()}export{Pe as default};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.BWGINVoR.js","../chunks/Bzak7iHL.js","../chunks/BrBXfa46.js","../chunks/m2dceAnU.js","../assets/0.C7J2EIJ7.css","../nodes/1.CEGpjm-A.js","../chunks/Db3dOJqt.js","../chunks/DKU_2deH.js","../chunks/DH791y0n.js","../nodes/2.W3CLiCpj.js","../chunks/D4Z6sX8n.js","../chunks/BtiMKAzw.js","../chunks/DcegSV8N.js","../chunks/CvosxF64.js","../chunks/CS4xyx6M.js","../nodes/4.B8D3vRQS.js","../chunks/CM9au6ec.js","../chunks/BMcrRaS1.js","../nodes/5.NGnDqIo2.js"])))=>i.map(i=>d[i]);
|
||||
var M=e=>{throw TypeError(e)};var G=(e,t,r)=>t.has(e)||M("Cannot "+r);var o=(e,t,r)=>(G(e,t,"read from private field"),r?r.call(e):t.get(e)),A=(e,t,r)=>t.has(e)?M("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,n)=>(G(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{c as L,_ as y}from"../chunks/CS4xyx6M.js";import{a7 as x,ah as N,g as l,y as Q,V as U,A as X,D as Z,ak as $,al as tt,aW as et,d as R,s as rt,a as E,E as at,b0 as T,b as V,c as st,r as ot,f as W,t as nt,T as it,u as j}from"../chunks/m2dceAnU.js";import{h as ct,m as ut,u as mt,o as lt,s as dt}from"../chunks/Db3dOJqt.js";import"../chunks/Bzak7iHL.js";import{i as k}from"../chunks/DcegSV8N.js";import{p as w,b as I}from"../chunks/CvosxF64.js";function _t(e){return class extends ft{constructor(t){super({component:e,...t})}}}var d,c;class ft{constructor(t){A(this,d);A(this,c);var v;var r=new Map,n=(a,s)=>{var _=X(s,!1,!1);return r.set(a,_),_};const m=new Proxy({...t.props||{},$$events:{}},{get(a,s){return l(r.get(s)??n(s,Reflect.get(a,s)))},has(a,s){return s===N?!0:(l(r.get(s)??n(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,_){return x(r.get(s)??n(s,_),_),Reflect.set(a,s,_)}});D(this,c,(t.hydrate?ct:ut)(t.component,{target:t.target,anchor:t.anchor,props:m,context:t.context,intro:t.intro??!1,recover:t.recover})),(!((v=t==null?void 0:t.props)!=null&&v.$$host)||t.sync===!1)&&Q(),D(this,d,m.$$events);for(const a of Object.keys(o(this,c)))a==="$set"||a==="$destroy"||a==="$on"||U(this,a,{get(){return o(this,c)[a]},set(s){o(this,c)[a]=s},enumerable:!0});o(this,c).$set=a=>{Object.assign(m,a)},o(this,c).$destroy=()=>{mt(o(this,c))}}$set(t){o(this,c).$set(t)}$on(t,r){o(this,d)[t]=o(this,d)[t]||[];const n=(...m)=>r.call(this,...m);return o(this,d)[t].push(n),()=>{o(this,d)[t]=o(this,d)[t].filter(m=>m!==n)}}$destroy(){o(this,c).$destroy()}}d=new WeakMap,c=new WeakMap;const Lt={};var ht=W('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),gt=W("<!> <!>",1);function vt(e,t){Z(t,!0);let r=w(t,"components",23,()=>[]),n=w(t,"data_0",3,null),m=w(t,"data_1",3,null);$(()=>t.stores.page.set(t.page)),tt(()=>{t.stores,t.page,t.constructors,r(),t.form,n(),m(),t.stores.page.notify()});let v=T(!1),a=T(!1),s=T(null);lt(()=>{const i=t.stores.page.subscribe(()=>{l(v)&&(x(a,!0),et().then(()=>{x(s,document.title||"untitled page",!0)}))});return x(v,!0),i});const _=j(()=>t.constructors[1]);var p=gt(),C=R(p);{var q=i=>{const f=j(()=>t.constructors[0]);var h=V(),P=R(h);L(P,()=>l(f),(g,b)=>{I(b(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(u,yt)=>{var S=V(),H=R(S);L(H,()=>l(_),(J,K)=>{I(K(J,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),O=>r()[1]=O,()=>{var O;return(O=r())==null?void 0:O[1]})}),E(u,S)},$$slots:{default:!0}}),u=>r()[0]=u,()=>{var u;return(u=r())==null?void 0:u[0]})}),E(i,h)},z=i=>{const f=j(()=>t.constructors[0]);var h=V(),P=R(h);L(P,()=>l(f),(g,b)=>{I(b(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),u=>r()[0]=u,()=>{var u;return(u=r())==null?void 0:u[0]})}),E(i,h)};k(C,i=>{t.constructors[1]?i(q):i(z,!1)})}var B=rt(C,2);{var F=i=>{var f=ht(),h=st(f);{var P=g=>{var b=nt();it(()=>dt(b,l(s))),E(g,b)};k(h,g=>{l(a)&&g(P)})}ot(f),E(i,f)};k(B,i=>{l(v)&&i(F)})}E(e,p),at()}const Tt=_t(vt),Vt=[()=>y(()=>import("../nodes/0.BWGINVoR.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>y(()=>import("../nodes/1.CEGpjm-A.js"),__vite__mapDeps([5,1,2,3,6,7,8]),import.meta.url),()=>y(()=>import("../nodes/2.W3CLiCpj.js"),__vite__mapDeps([9,1,2,3,10,11,12,7,13]),import.meta.url),()=>y(()=>import("../chunks/CS4xyx6M.js").then(e=>e.a),__vite__mapDeps([14,3,12]),import.meta.url),()=>y(()=>import("../nodes/4.B8D3vRQS.js"),__vite__mapDeps([15,16,14,3,12,1,17,11,7,13]),import.meta.url),()=>y(()=>import("../nodes/5.NGnDqIo2.js"),__vite__mapDeps([18,14,3,12,1,17]),import.meta.url)],jt=[],kt={"/":[2],"/items":[-5],"/login":[-6],"/logout":[-4]},Y={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},bt=Object.fromEntries(Object.entries(Y.transport).map(([e,t])=>[e,t.decode])),wt=Object.fromEntries(Object.entries(Y.transport).map(([e,t])=>[e,t.encode])),It=!1,pt=(e,t)=>bt[e](t);export{pt as decode,bt as decoders,kt as dictionary,wt as encoders,It as hash,Y as hooks,Lt as matchers,Vt as nodes,Tt as root,jt as server_loads};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.BWGINVoR.js","../chunks/Bzak7iHL.js","../chunks/BrBXfa46.js","../chunks/m2dceAnU.js","../assets/0.C7J2EIJ7.css","../nodes/1.BwpnmtAp.js","../chunks/Db3dOJqt.js","../chunks/DKU_2deH.js","../chunks/D6EhJnz8.js","../nodes/2.W3CLiCpj.js","../chunks/D4Z6sX8n.js","../chunks/BtiMKAzw.js","../chunks/DcegSV8N.js","../chunks/CvosxF64.js","../chunks/CS4xyx6M.js","../nodes/4.DSwQNsv9.js","../chunks/D0oS5fvi.js","../chunks/BMcrRaS1.js","../nodes/5.Y48nEW8J.js"])))=>i.map(i=>d[i]);
|
||||
var M=e=>{throw TypeError(e)};var G=(e,t,r)=>t.has(e)||M("Cannot "+r);var o=(e,t,r)=>(G(e,t,"read from private field"),r?r.call(e):t.get(e)),A=(e,t,r)=>t.has(e)?M("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,n)=>(G(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{c as L,_ as y}from"../chunks/CS4xyx6M.js";import{a7 as x,ah as N,g as l,y as Q,V as U,A as X,D as Z,ak as $,al as tt,aW as et,d as R,s as rt,a as E,E as at,b0 as T,b as V,c as st,r as ot,f as W,t as nt,T as it,u as j}from"../chunks/m2dceAnU.js";import{h as ct,m as ut,u as mt,o as lt,s as dt}from"../chunks/Db3dOJqt.js";import"../chunks/Bzak7iHL.js";import{i as k}from"../chunks/DcegSV8N.js";import{p as w,b as I}from"../chunks/CvosxF64.js";function _t(e){return class extends ft{constructor(t){super({component:e,...t})}}}var d,c;class ft{constructor(t){A(this,d);A(this,c);var v;var r=new Map,n=(a,s)=>{var _=X(s,!1,!1);return r.set(a,_),_};const m=new Proxy({...t.props||{},$$events:{}},{get(a,s){return l(r.get(s)??n(s,Reflect.get(a,s)))},has(a,s){return s===N?!0:(l(r.get(s)??n(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,_){return x(r.get(s)??n(s,_),_),Reflect.set(a,s,_)}});D(this,c,(t.hydrate?ct:ut)(t.component,{target:t.target,anchor:t.anchor,props:m,context:t.context,intro:t.intro??!1,recover:t.recover})),(!((v=t==null?void 0:t.props)!=null&&v.$$host)||t.sync===!1)&&Q(),D(this,d,m.$$events);for(const a of Object.keys(o(this,c)))a==="$set"||a==="$destroy"||a==="$on"||U(this,a,{get(){return o(this,c)[a]},set(s){o(this,c)[a]=s},enumerable:!0});o(this,c).$set=a=>{Object.assign(m,a)},o(this,c).$destroy=()=>{mt(o(this,c))}}$set(t){o(this,c).$set(t)}$on(t,r){o(this,d)[t]=o(this,d)[t]||[];const n=(...m)=>r.call(this,...m);return o(this,d)[t].push(n),()=>{o(this,d)[t]=o(this,d)[t].filter(m=>m!==n)}}$destroy(){o(this,c).$destroy()}}d=new WeakMap,c=new WeakMap;const Lt={};var ht=W('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),gt=W("<!> <!>",1);function vt(e,t){Z(t,!0);let r=w(t,"components",23,()=>[]),n=w(t,"data_0",3,null),m=w(t,"data_1",3,null);$(()=>t.stores.page.set(t.page)),tt(()=>{t.stores,t.page,t.constructors,r(),t.form,n(),m(),t.stores.page.notify()});let v=T(!1),a=T(!1),s=T(null);lt(()=>{const i=t.stores.page.subscribe(()=>{l(v)&&(x(a,!0),et().then(()=>{x(s,document.title||"untitled page",!0)}))});return x(v,!0),i});const _=j(()=>t.constructors[1]);var p=gt(),C=R(p);{var q=i=>{const f=j(()=>t.constructors[0]);var h=V(),P=R(h);L(P,()=>l(f),(g,b)=>{I(b(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(u,yt)=>{var S=V(),H=R(S);L(H,()=>l(_),(J,K)=>{I(K(J,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),O=>r()[1]=O,()=>{var O;return(O=r())==null?void 0:O[1]})}),E(u,S)},$$slots:{default:!0}}),u=>r()[0]=u,()=>{var u;return(u=r())==null?void 0:u[0]})}),E(i,h)},z=i=>{const f=j(()=>t.constructors[0]);var h=V(),P=R(h);L(P,()=>l(f),(g,b)=>{I(b(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),u=>r()[0]=u,()=>{var u;return(u=r())==null?void 0:u[0]})}),E(i,h)};k(C,i=>{t.constructors[1]?i(q):i(z,!1)})}var B=rt(C,2);{var F=i=>{var f=ht(),h=st(f);{var P=g=>{var b=nt();it(()=>dt(b,l(s))),E(g,b)};k(h,g=>{l(a)&&g(P)})}ot(f),E(i,f)};k(B,i=>{l(v)&&i(F)})}E(e,p),at()}const Tt=_t(vt),Vt=[()=>y(()=>import("../nodes/0.BWGINVoR.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>y(()=>import("../nodes/1.BwpnmtAp.js"),__vite__mapDeps([5,1,2,3,6,7,8]),import.meta.url),()=>y(()=>import("../nodes/2.W3CLiCpj.js"),__vite__mapDeps([9,1,2,3,10,11,12,7,13]),import.meta.url),()=>y(()=>import("../chunks/CS4xyx6M.js").then(e=>e.a),__vite__mapDeps([14,3,12]),import.meta.url),()=>y(()=>import("../nodes/4.DSwQNsv9.js"),__vite__mapDeps([15,16,14,3,12,1,17,11,7,13]),import.meta.url),()=>y(()=>import("../nodes/5.Y48nEW8J.js"),__vite__mapDeps([18,14,3,12,1,17]),import.meta.url)],jt=[],kt={"/":[2],"/items":[-5],"/login":[-6],"/logout":[-4]},Y={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},bt=Object.fromEntries(Object.entries(Y.transport).map(([e,t])=>[e,t.decode])),wt=Object.fromEntries(Object.entries(Y.transport).map(([e,t])=>[e,t.encode])),It=!1,pt=(e,t)=>bt[e](t);export{pt as decode,bt as decoders,kt as dictionary,wt as encoders,It as hash,Y as hooks,Lt as matchers,Vt as nodes,Tt as root,jt as server_loads};
|
||||
@@ -0,0 +1 @@
|
||||
import{l as o,d as r}from"../chunks/D6EhJnz8.js";export{o as load_css,r as start};
|
||||
@@ -1 +0,0 @@
|
||||
import{l as o,d as r}from"../chunks/DH791y0n.js";export{o as load_css,r as start};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import"../chunks/Bzak7iHL.js";import"../chunks/BrBXfa46.js";import{aj as k,ak as b,al as i,a1 as x,am as l,an as $,g as v,ao as y,ad as E,D as j,d as D,T,a as q,E as w,f as z,c as u,r as m,s as A}from"../chunks/m2dceAnU.js";import{s as g}from"../chunks/Db3dOJqt.js";import{s as B,p as d}from"../chunks/DH791y0n.js";function C(r=!1){const e=k,t=e.l.u;if(!t)return;let a=()=>y(e.s);if(r){let o=0,s={};const c=E(()=>{let n=!1;const p=e.s;for(const f in p)p[f]!==s[f]&&(s[f]=p[f],n=!0);return n&&o++,o});a=()=>v(c)}t.b.length&&b(()=>{_(e,a),l(t.b)}),i(()=>{const o=x(()=>t.m.map($));return()=>{for(const s of o)typeof s=="function"&&s()}}),t.a.length&&i(()=>{_(e,a),l(t.a)})}function _(r,e){if(r.l.s)for(const t of r.l.s)v(t);e()}const F={get error(){return d.error},get status(){return d.status}};B.updated.check;const h=F;var G=z("<h1> </h1> <p> </p>",1);function M(r,e){j(e,!1),C();var t=G(),a=D(t),o=u(a,!0);m(a);var s=A(a,2),c=u(s,!0);m(s),T(()=>{var n;g(o,h.status),g(c,(n=h.error)==null?void 0:n.message)}),q(r,t),w()}export{M as component};
|
||||
import"../chunks/Bzak7iHL.js";import"../chunks/BrBXfa46.js";import{aj as k,ak as b,al as i,a1 as x,am as l,an as $,g as v,ao as y,ad as E,D as j,d as D,T,a as q,E as w,f as z,c as u,r as m,s as A}from"../chunks/m2dceAnU.js";import{s as g}from"../chunks/Db3dOJqt.js";import{s as B,p as d}from"../chunks/D6EhJnz8.js";function C(r=!1){const e=k,t=e.l.u;if(!t)return;let a=()=>y(e.s);if(r){let o=0,s={};const c=E(()=>{let n=!1;const p=e.s;for(const f in p)p[f]!==s[f]&&(s[f]=p[f],n=!0);return n&&o++,o});a=()=>v(c)}t.b.length&&b(()=>{_(e,a),l(t.b)}),i(()=>{const o=x(()=>t.m.map($));return()=>{for(const s of o)typeof s=="function"&&s()}}),t.a.length&&i(()=>{_(e,a),l(t.a)})}function _(r,e){if(r.l.s)for(const t of r.l.s)v(t);e()}const F={get error(){return d.error},get status(){return d.status}};B.updated.check;const h=F;var G=z("<h1> </h1> <p> </p>",1);function M(r,e){j(e,!1),C();var t=G(),a=D(t),o=u(a,!0);m(a);var s=A(a,2),c=u(s,!0);m(s),T(()=>{var n;g(o,h.status),g(c,(n=h.error)==null?void 0:n.message)}),q(r,t),w()}export{M as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{_ as m}from"../chunks/CM9au6ec.js";export{m as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as m}from"../chunks/D0oS5fvi.js";export{m as component};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/CnbhzkKJ.js","../chunks/Bzak7iHL.js","../chunks/m2dceAnU.js","../chunks/Db3dOJqt.js","../chunks/DKU_2deH.js","../chunks/DcegSV8N.js","../chunks/CS4xyx6M.js","../chunks/OSRdxUzr.js","../chunks/BtiMKAzw.js","../chunks/CvosxF64.js","../chunks/DH791y0n.js","../chunks/D4Z6sX8n.js"])))=>i.map(i=>d[i]);
|
||||
import{c as F,_ as k}from"../chunks/CS4xyx6M.js";import"../chunks/Bzak7iHL.js";import{a as r,f as v,c as E,r as P,b as _,d,g as i,u as p}from"../chunks/m2dceAnU.js";import{a as $}from"../chunks/BMcrRaS1.js";import{i as j}from"../chunks/DcegSV8N.js";var w=v('<p class="text-muted-foreground">Loading…</p>'),y=v('<main class="flex min-h-screen flex-col items-center justify-center p-4"><!></main>');function T(c,f){var a=y(),l=E(a);{var u=o=>{var n=_(),g=d(n);$(g,()=>k(()=>import("../chunks/CnbhzkKJ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),e=>{var t=w();r(e,t)},(e,t)=>{var L=p(()=>{var{default:m}=i(t);return{LoginForm:m}}),h=p(()=>i(L).LoginForm),s=_(),x=d(s);F(x,()=>i(h),(m,b)=>{b(m,{get data(){return f.data}})}),r(e,s)}),r(o,n)};j(l,o=>{o(u)})}P(a),r(c,a)}export{T as component};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DvQsdWht.js","../chunks/Bzak7iHL.js","../chunks/m2dceAnU.js","../chunks/Db3dOJqt.js","../chunks/DKU_2deH.js","../chunks/DcegSV8N.js","../chunks/CS4xyx6M.js","../chunks/Djw4YAFw.js","../chunks/BtiMKAzw.js","../chunks/CvosxF64.js","../chunks/D6EhJnz8.js","../chunks/D4Z6sX8n.js"])))=>i.map(i=>d[i]);
|
||||
import{c as F,_ as k}from"../chunks/CS4xyx6M.js";import"../chunks/Bzak7iHL.js";import{a as r,f as v,c as E,r as P,b as _,d,g as i,u as p}from"../chunks/m2dceAnU.js";import{a as $}from"../chunks/BMcrRaS1.js";import{i as j}from"../chunks/DcegSV8N.js";var w=v('<p class="text-muted-foreground">Loading…</p>'),y=v('<main class="flex min-h-screen flex-col items-center justify-center p-4"><!></main>');function T(c,f){var a=y(),l=E(a);{var u=o=>{var n=_(),g=d(n);$(g,()=>k(()=>import("../chunks/DvQsdWht.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),e=>{var t=w();r(e,t)},(e,t)=>{var L=p(()=>{var{default:m}=i(t);return{LoginForm:m}}),h=p(()=>i(L).LoginForm),s=_(),x=d(s);F(x,()=>i(h),(m,b)=>{b(m,{get data(){return f.data}})}),r(e,s)}),r(o,n)};j(l,o=>{o(u)})}P(a),r(c,a)}export{T as component};
|
||||
@@ -1 +1 @@
|
||||
{"version":"1771358834427"}
|
||||
{"version":"1771359113739"}
|
||||
@@ -101,7 +101,7 @@ const options = {
|
||||
<div class="error">
|
||||
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "1e50mid"
|
||||
version_hash: "e8kpas"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3182,7 +3182,7 @@ async function internal_respond(request, options2, manifest, state) {
|
||||
fetch: null,
|
||||
getClientAddress: state.getClientAddress || (() => {
|
||||
throw new Error(
|
||||
`${"@sveltejs/adapter-auto"} does not specify getClientAddress. Please raise an issue`
|
||||
`${"@sveltejs/adapter-node"} does not specify getClientAddress. Please raise an issue`
|
||||
);
|
||||
}),
|
||||
locals: {},
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import "./chunks/root.js";
|
||||
import { s, a, b } from "./chunks/environment.js";
|
||||
import { g, o, c, s as s2, a as a2, b as b2 } from "./chunks/internal.js";
|
||||
export {
|
||||
g as get_hooks,
|
||||
o as options,
|
||||
s as set_assets,
|
||||
a as set_building,
|
||||
c as set_manifest,
|
||||
b as set_prerendering,
|
||||
s2 as set_private_env,
|
||||
a2 as set_public_env,
|
||||
b2 as set_read_implementation
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.CdONOS6-.js",app:"_app/immutable/entry/app.BaRtR_VV.js",imports:["_app/immutable/entry/start.CdONOS6-.js","_app/immutable/chunks/DH791y0n.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.BaRtR_VV.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js')),
|
||||
__memo(() => import('./nodes/3.js')),
|
||||
__memo(() => import('./nodes/4.js')),
|
||||
__memo(() => import('./nodes/5.js'))
|
||||
],
|
||||
remotes: {
|
||||
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/items",
|
||||
pattern: /^\/items\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 4 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/login",
|
||||
pattern: /^\/login\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 5 },
|
||||
endpoint: null
|
||||
},
|
||||
{
|
||||
id: "/logout",
|
||||
pattern: /^\/logout\/?$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 3 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -10,7 +10,7 @@ return {
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.CdONOS6-.js",app:"_app/immutable/entry/app.BaRtR_VV.js",imports:["_app/immutable/entry/start.CdONOS6-.js","_app/immutable/chunks/DH791y0n.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.BaRtR_VV.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
client: {start:"_app/immutable/entry/start.C_SQrpA0.js",app:"_app/immutable/entry/app.DE4HKxpj.js",imports:["_app/immutable/entry/start.C_SQrpA0.js","_app/immutable/chunks/D6EhJnz8.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.DE4HKxpj.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
|
||||
@@ -10,7 +10,7 @@ return {
|
||||
assets: new Set([]),
|
||||
mimeTypes: {},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.CdONOS6-.js",app:"_app/immutable/entry/app.BaRtR_VV.js",imports:["_app/immutable/entry/start.CdONOS6-.js","_app/immutable/chunks/DH791y0n.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.BaRtR_VV.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
client: {start:"_app/immutable/entry/start.C_SQrpA0.js",app:"_app/immutable/entry/app.DE4HKxpj.js",imports:["_app/immutable/entry/start.C_SQrpA0.js","_app/immutable/chunks/D6EhJnz8.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/entry/app.DE4HKxpj.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/CvosxF64.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
export const index = 1;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/1.CEGpjm-A.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BrBXfa46.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/DH791y0n.js"];
|
||||
export const imports = ["_app/immutable/nodes/1.BwpnmtAp.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BrBXfa46.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/Db3dOJqt.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/D6EhJnz8.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -5,6 +5,6 @@ let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/items/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/items/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/4.B8D3vRQS.js","_app/immutable/chunks/CM9au6ec.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js","_app/immutable/chunks/BtiMKAzw.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/CvosxF64.js"];
|
||||
export const imports = ["_app/immutable/nodes/4.DSwQNsv9.js","_app/immutable/chunks/D0oS5fvi.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js","_app/immutable/chunks/BtiMKAzw.js","_app/immutable/chunks/DKU_2deH.js","_app/immutable/chunks/CvosxF64.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -5,6 +5,6 @@ let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/login/_page.svelte.js')).default;
|
||||
export { server };
|
||||
export const server_id = "src/routes/login/+page.server.ts";
|
||||
export const imports = ["_app/immutable/nodes/5.NGnDqIo2.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js"];
|
||||
export const imports = ["_app/immutable/nodes/5.Y48nEW8J.js","_app/immutable/chunks/CS4xyx6M.js","_app/immutable/chunks/m2dceAnU.js","_app/immutable/chunks/DcegSV8N.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BMcrRaS1.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
|
||||
@@ -0,0 +1,557 @@
|
||||
import { get_request_store, with_request_store } from "@sveltejs/kit/internal/server";
|
||||
import { parse } from "devalue";
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { s as stringify_remote_arg, f as flatten_issues, c as create_field_proxy, n as normalize_issue, a as set_nested_value, d as deep_set, b as stringify, e as create_remote_key, h as handle_error_and_jsonify } from "./chunks/shared.js";
|
||||
import { ValidationError, HttpError, SvelteKitError } from "@sveltejs/kit/internal";
|
||||
import { D as DEV } from "./chunks/false.js";
|
||||
import { c as base, d as app_dir, p as prerendering } from "./chunks/environment.js";
|
||||
function create_validator(validate_or_fn, maybe_fn) {
|
||||
if (!maybe_fn) {
|
||||
return (arg) => {
|
||||
if (arg !== void 0) {
|
||||
error(400, "Bad Request");
|
||||
}
|
||||
};
|
||||
}
|
||||
if (validate_or_fn === "unchecked") {
|
||||
return (arg) => arg;
|
||||
}
|
||||
if ("~standard" in validate_or_fn) {
|
||||
return async (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
const result = await validate_or_fn["~standard"].validate(arg);
|
||||
if (result.issues) {
|
||||
error(
|
||||
400,
|
||||
await state.handleValidationError({
|
||||
issues: result.issues,
|
||||
event
|
||||
})
|
||||
);
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
}
|
||||
throw new Error(
|
||||
'Invalid validator passed to remote function. Expected "unchecked" or a Standard Schema (https://standardschema.dev)'
|
||||
);
|
||||
}
|
||||
async function get_response(info, arg, state, get_result) {
|
||||
await 0;
|
||||
const cache = get_cache(info, state);
|
||||
return cache[stringify_remote_arg(arg, state.transport)] ??= get_result();
|
||||
}
|
||||
function parse_remote_response(data, transport) {
|
||||
const revivers = {};
|
||||
for (const key in transport) {
|
||||
revivers[key] = transport[key].decode;
|
||||
}
|
||||
return parse(data, revivers);
|
||||
}
|
||||
async function run_remote_function(event, state, allow_cookies, get_input, fn) {
|
||||
const store = {
|
||||
event: {
|
||||
...event,
|
||||
setHeaders: () => {
|
||||
throw new Error("setHeaders is not allowed in remote functions");
|
||||
},
|
||||
cookies: {
|
||||
...event.cookies,
|
||||
set: (name, value, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot set cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies set in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.set(name, value, opts);
|
||||
},
|
||||
delete: (name, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot delete cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies deleted in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.delete(name, opts);
|
||||
}
|
||||
}
|
||||
},
|
||||
state: {
|
||||
...state,
|
||||
is_in_remote_function: true
|
||||
}
|
||||
};
|
||||
const input = await with_request_store(store, get_input);
|
||||
return with_request_store(store, () => fn(input));
|
||||
}
|
||||
function get_cache(info, state = get_request_store().state) {
|
||||
let cache = state.remote_data?.get(info);
|
||||
if (cache === void 0) {
|
||||
cache = {};
|
||||
(state.remote_data ??= /* @__PURE__ */ new Map()).set(info, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function command(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "command", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
if (state.is_endpoint_request) {
|
||||
if (!["POST", "PUT", "PATCH", "DELETE"].includes(event.request.method)) {
|
||||
throw new Error(
|
||||
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) from a ${event.request.method} handler`
|
||||
);
|
||||
}
|
||||
} else if (!event.isRemoteRequest) {
|
||||
throw new Error(
|
||||
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) during server-side rendering`
|
||||
);
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const promise = Promise.resolve(
|
||||
run_remote_function(event, state, true, () => validate(arg), fn)
|
||||
);
|
||||
promise.updates = () => {
|
||||
throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {ReturnType<RemoteCommand<Input, Output>>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
Object.defineProperty(wrapper, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function form(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : (
|
||||
/** @type {any} */
|
||||
validate_or_fn
|
||||
);
|
||||
function create_instance(key) {
|
||||
const instance = {};
|
||||
instance.method = "POST";
|
||||
Object.defineProperty(instance, "enhance", {
|
||||
value: () => {
|
||||
return { action: instance.action, method: instance.method };
|
||||
}
|
||||
});
|
||||
const __ = {
|
||||
type: "form",
|
||||
name: "",
|
||||
id: "",
|
||||
fn: async (data, meta, form_data) => {
|
||||
const output = {};
|
||||
output.submission = true;
|
||||
const { event, state } = get_request_store();
|
||||
const validated = await schema?.["~standard"].validate(data);
|
||||
if (meta.validate_only) {
|
||||
return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
|
||||
}
|
||||
if (validated?.issues !== void 0) {
|
||||
handle_issues(output, validated.issues, form_data);
|
||||
} else {
|
||||
if (validated !== void 0) {
|
||||
data = validated.value;
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const issue = create_issues();
|
||||
try {
|
||||
output.result = await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
true,
|
||||
() => data,
|
||||
(data2) => !maybe_fn ? fn() : fn(data2, issue)
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof ValidationError) {
|
||||
handle_issues(output, e.issues, form_data);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!event.isRemoteRequest) {
|
||||
get_cache(__, state)[""] ??= output;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
Object.defineProperty(instance, "__", { value: __ });
|
||||
Object.defineProperty(instance, "action", {
|
||||
get: () => `?/remote=${__.id}`,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(instance, "fields", {
|
||||
get() {
|
||||
const data = get_cache(__)?.[""];
|
||||
const issues = flatten_issues(data?.issues ?? []);
|
||||
return create_field_proxy(
|
||||
{},
|
||||
() => data?.input ?? {},
|
||||
(path, value) => {
|
||||
if (data?.submission) {
|
||||
return;
|
||||
}
|
||||
const input = path.length === 0 ? value : deep_set(data?.input ?? {}, path.map(String), value);
|
||||
(get_cache(__)[""] ??= {}).input = input;
|
||||
},
|
||||
() => issues
|
||||
);
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "result", {
|
||||
get() {
|
||||
try {
|
||||
return get_cache(__)?.[""]?.result;
|
||||
} catch {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
Object.defineProperty(instance, "preflight", {
|
||||
// preflight is a noop on the server
|
||||
value: () => instance
|
||||
});
|
||||
Object.defineProperty(instance, "validate", {
|
||||
value: () => {
|
||||
throw new Error("Cannot call validate() on the server");
|
||||
}
|
||||
});
|
||||
if (key == void 0) {
|
||||
Object.defineProperty(instance, "for", {
|
||||
/** @type {RemoteForm<any, any>['for']} */
|
||||
value: (key2) => {
|
||||
const { state } = get_request_store();
|
||||
const cache_key = __.id + "|" + JSON.stringify(key2);
|
||||
let instance2 = (state.form_instances ??= /* @__PURE__ */ new Map()).get(cache_key);
|
||||
if (!instance2) {
|
||||
instance2 = create_instance(key2);
|
||||
instance2.__.id = `${__.id}/${encodeURIComponent(JSON.stringify(key2))}`;
|
||||
instance2.__.name = __.name;
|
||||
state.form_instances.set(cache_key, instance2);
|
||||
}
|
||||
return instance2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
return create_instance();
|
||||
}
|
||||
function handle_issues(output, issues, form_data) {
|
||||
output.issues = issues.map((issue) => normalize_issue(issue, true));
|
||||
if (form_data) {
|
||||
output.input = {};
|
||||
for (let key of form_data.keys()) {
|
||||
if (/^[.\]]?_/.test(key)) continue;
|
||||
const is_array = key.endsWith("[]");
|
||||
const values = form_data.getAll(key).filter((value) => typeof value === "string");
|
||||
if (is_array) key = key.slice(0, -2);
|
||||
set_nested_value(
|
||||
/** @type {Record<string, any>} */
|
||||
output.input,
|
||||
key,
|
||||
is_array ? values : values[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function create_issues() {
|
||||
return (
|
||||
/** @type {InvalidField<any>} */
|
||||
new Proxy(
|
||||
/** @param {string} message */
|
||||
(message) => {
|
||||
if (typeof message !== "string") {
|
||||
throw new Error(
|
||||
"`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. For more info see https://github.com/sveltejs/kit/pulls/14768"
|
||||
);
|
||||
}
|
||||
return create_issue(message);
|
||||
},
|
||||
{
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
return create_issue_proxy(prop, []);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
function create_issue(message, path = []) {
|
||||
return {
|
||||
message,
|
||||
path
|
||||
};
|
||||
}
|
||||
function create_issue_proxy(key, path) {
|
||||
const new_path = [...path, key];
|
||||
const issue_func = (message) => create_issue(message, new_path);
|
||||
return new Proxy(issue_func, {
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
if (/^\d+$/.test(prop)) {
|
||||
return create_issue_proxy(parseInt(prop, 10), new_path);
|
||||
}
|
||||
return create_issue_proxy(prop, new_path);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function prerender(validate_or_fn, fn_or_options, maybe_options) {
|
||||
const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
|
||||
const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "prerender",
|
||||
id: "",
|
||||
name: "",
|
||||
has_arg: !!maybe_fn,
|
||||
inputs: options?.inputs,
|
||||
dynamic: options?.dynamic
|
||||
};
|
||||
const wrapper = (arg) => {
|
||||
const promise = (async () => {
|
||||
const { event, state } = get_request_store();
|
||||
const payload = stringify_remote_arg(arg, state.transport);
|
||||
const id = __.id;
|
||||
const url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
|
||||
if (!state.prerendering && !DEV && !event.isRemoteRequest) {
|
||||
try {
|
||||
return await get_response(__, arg, state, async () => {
|
||||
const key = stringify_remote_arg(arg, state.transport);
|
||||
const cache = get_cache(__, state);
|
||||
const promise3 = cache[key] ??= fetch(new URL(url, event.url.origin).href).then(
|
||||
async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Prerendered response not found");
|
||||
}
|
||||
const prerendered = await response.json();
|
||||
if (prerendered.type === "error") {
|
||||
error(prerendered.status, prerendered.error);
|
||||
}
|
||||
return prerendered.result;
|
||||
}
|
||||
);
|
||||
return parse_remote_response(await promise3, state.transport);
|
||||
});
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
if (state.prerendering?.remote_responses.has(url)) {
|
||||
return (
|
||||
/** @type {Promise<any>} */
|
||||
state.prerendering.remote_responses.get(url)
|
||||
);
|
||||
}
|
||||
const promise2 = get_response(
|
||||
__,
|
||||
arg,
|
||||
state,
|
||||
() => run_remote_function(event, state, false, () => validate(arg), fn)
|
||||
);
|
||||
if (state.prerendering) {
|
||||
state.prerendering.remote_responses.set(url, promise2);
|
||||
}
|
||||
const result = await promise2;
|
||||
if (state.prerendering) {
|
||||
const body = { type: "result", result: stringify(result, state.transport) };
|
||||
state.prerendering.dependencies.set(url, {
|
||||
body: JSON.stringify(body),
|
||||
response: json(body)
|
||||
});
|
||||
}
|
||||
return result;
|
||||
})();
|
||||
promise.catch(() => {
|
||||
});
|
||||
return (
|
||||
/** @type {RemoteResource<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function query(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "query", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => run_remote_function(event, state, false, () => validate(arg), fn);
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function batch(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "query_batch",
|
||||
id: "",
|
||||
name: "",
|
||||
run: async (args, options) => {
|
||||
const { event, state } = get_request_store();
|
||||
return run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
return Promise.all(
|
||||
input.map(async (arg, i) => {
|
||||
try {
|
||||
return { type: "result", data: get_result(arg, i) };
|
||||
} catch (error2) {
|
||||
return {
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, state, options, error2),
|
||||
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
let batching = { args: [], resolvers: [] };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query.batch '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
batching.args.push(arg);
|
||||
batching.resolvers.push({ resolve, reject });
|
||||
if (batching.args.length > 1) return;
|
||||
setTimeout(async () => {
|
||||
const batched = batching;
|
||||
batching = { args: [], resolvers: [] };
|
||||
try {
|
||||
return await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(batched.args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
for (let i = 0; i < batched.resolvers.length; i++) {
|
||||
try {
|
||||
batched.resolvers[i].resolve(get_result(input[i], i));
|
||||
} catch (error2) {
|
||||
batched.resolvers[i].reject(error2);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (error2) {
|
||||
for (const resolver of batched.resolvers) {
|
||||
resolver.reject(error2);
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
};
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
Object.defineProperty(query, "batch", { value: batch, enumerable: true });
|
||||
function get_refresh_context(__, action, arg) {
|
||||
const { state } = get_request_store();
|
||||
const { refreshes } = state;
|
||||
if (!refreshes) {
|
||||
const name = __.type === "query_batch" ? `query.batch '${__.name}'` : `query '${__.name}'`;
|
||||
throw new Error(
|
||||
`Cannot call ${action} on ${name} because it is not executed in the context of a command/form remote function`
|
||||
);
|
||||
}
|
||||
const cache = get_cache(__, state);
|
||||
const cache_key = stringify_remote_arg(arg, state.transport);
|
||||
const refreshes_key = create_remote_key(__.id, cache_key);
|
||||
return { __, state, refreshes, refreshes_key, cache, cache_key };
|
||||
}
|
||||
function update_refresh_value({ __, refreshes, refreshes_key, cache, cache_key }, value, is_immediate_refresh = false) {
|
||||
const promise = Promise.resolve(value);
|
||||
if (!is_immediate_refresh) {
|
||||
cache[cache_key] = promise;
|
||||
}
|
||||
if (__.id) {
|
||||
refreshes[refreshes_key] = promise;
|
||||
}
|
||||
return promise.then(() => {
|
||||
});
|
||||
}
|
||||
export {
|
||||
command,
|
||||
form,
|
||||
prerender,
|
||||
query
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"/": [
|
||||
"src/routes/+layout.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/items": [
|
||||
"src/routes/items/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/login": [
|
||||
"src/routes/login/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/logout": [
|
||||
"src/routes/logout/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"/": [
|
||||
"src/routes/+layout.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/items": [
|
||||
"src/routes/items/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/login": [
|
||||
"src/routes/login/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
],
|
||||
"/logout": [
|
||||
"src/routes/logout/+page.server.ts",
|
||||
"src/routes/+layout.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user