diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8a2ed0b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +node_modules +.git +.svelte-kit +build +dist +.env +.env.* +!.env.example +.vscode diff --git a/.gitignore b/.gitignore index 3b462cb..7f2dbf3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ Thumbs.db # Vite vite.config.js.timestamp-* vite.config.ts.timestamp-* +pb_data/ diff --git a/AGENTS.md b/AGENTS.md index c708570..e7073f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,7 +9,7 @@ # FamChore v2 — AI Agent Reference ## Stack -- SvelteKit (SSR frontend) + Hono proxy (same container, port :3001) +- SvelteKit (SSR frontend, internal :2080) + Hono proxy (internal :3456) + nginx (container :3001) - PocketBase (separate Coolify service at `pb.chores.app.com`, :8090) - Stripe one-time donations - Coolify CRON → `GET /api/weekly-cron` @@ -61,9 +61,15 @@ - Every collection query includes `famId = @request.auth.famId` filter - Super admin bypasses famId filter (access via PB admin API) - `deviceToken` stored as SHA-256 hash; never log raw tokens -- Environment: `PB_URL`, `PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD`, `STRIPE_SECRET_KEY`, `DONATION_MODAL_INTERVAL` +- `config.ts` at root for dev/build-time shared config (e.g. `PROXY_PORT`); runtime config via env vars +- `.env` at root tracks port values (`PROXY_PORT`, `PORT`); `.env.example` committed as template +- Docker: `docker/Dockerfile` (prod, multi-stage + nginx) + `docker/Dockerfile.dev` (PocketBase) +- Nginx routes in prod: `/api/*` → Hono (`:3456`), `/*` → SvelteKit (`:2080`) +- Ports: frontend `2080`, proxy `3456`, container ext `3001` (port `3000` is reserved) +- Environment: `FRONTEND_PORT`, `PROXY_PORT`, `PB_URL`, `PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD`, `STRIPE_SECRET_KEY`, `DONATION_MODAL_INTERVAL` - Seed via JSON dump (portable for dev) -- Monorepo: SvelteKit in `/src`, Hono in `/proxy`, two Dockerfiles +- Monorepo: SvelteKit in `frontend/`, Hono in `proxy/`, two Dockerfiles +- Decisions tracked in `MEMORY.md` ## Build Phases (must validate each before next) diff --git a/MEMORY.md b/MEMORY.md new file mode 100644 index 0000000..acc9c9d --- /dev/null +++ b/MEMORY.md @@ -0,0 +1,12 @@ +# FamChore v2 — Development Memory + +## Architecture Decisions + +### 2026-06-23 — Monorepo & Docker Setup + +- **Ports**: Frontend = `2080`, Proxy = `3456`, Container ext = `3001`. Port `3000` reserved/conflict. +- **Shared config**: `config.ts` at root for dev/build-time values (e.g. `PROXY_PORT`). Runtime config via env vars. `.env` tracks ports, `.env.example` committed. +- **Docker**: 2 Dockerfiles — `Dockerfile` (prod, multi-stage with nginx) and `Dockerfile.dev` (PocketBase for dev). +- **Nginx**: Prod container uses nginx to route `/api/*` → Hono (`:3456`), `/*` → SvelteKit (`:2080`). +- **Proxy runtime**: Uses `process.env.PROXY_PORT` instead of importing `config.ts` (avoids `rootDir` issues in `tsc`). +- **Dev workflow**: `pnpm dev` at root runs SvelteKit + Hono in parallel. PocketBase via `Dockerfile.dev`. diff --git a/README.md b/README.md index 02db6ff..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,42 +0,0 @@ -# sv - -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```sh -# create a new project -npx sv create my-app -``` - -To recreate this project with the same configuration: - -```sh -# recreate this project -pnpm dlx sv@0.16.1 create --template minimal --types ts --add prettier tailwindcss="plugins:none" sveltekit-adapter="adapter:node" experimental="versions:kit+features:async,remoteFunctions,explicitEnvironmentVariables,handleRenderingErrors" --install pnpm . -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```sh -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```sh -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/RULES.md b/RULES.md new file mode 100644 index 0000000..4e35f49 --- /dev/null +++ b/RULES.md @@ -0,0 +1,34 @@ +# FamChore v2 — Rules + +## Auth +- Every collection query includes `famId = @request.auth.famId` filter +- Super admin bypasses famId filter (access via PB admin API) +- `deviceToken` stored as SHA-256 hash; never log raw tokens + +## Config +- Use `.env` at root for runtime config values (ports, secrets). `.env.example` committed as template. +- `config.ts` at root for dev/build-time shared config (e.g. `PROXY_PORT`), reads from env with fallback defaults. +- Never commit `.env` files (already in `.gitignore`). + +## Ports +- Frontend: `2080` +- Proxy: `3456` +- Container external: `3001` (port `3000` is reserved) +- Must not use port `3000` for anything. + +## Docker +- Prod: `docker/Dockerfile` (multi-stage + nginx) +- Dev: `docker/Dockerfile.dev` (PocketBase) +- Nginx routes: `/api/*` → Hono (`:3456`), `/*` → SvelteKit (`:2080`) + +## Monorepo +- SvelteKit in `frontend/`, Hono in `proxy/` +- `pnpm dev` / `pnpm build` at root runs both in parallel +- Decisions tracked in `MEMORY.md` + +## Environment Variables +- `FRONTEND_PORT` — frontend server port +- `PROXY_PORT` — Hono proxy port +- `PB_URL`, `PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD` — PocketBase admin +- `STRIPE_SECRET_KEY` — Stripe +- `DONATION_MODAL_INTERVAL` — donation modal frequency diff --git a/config.ts b/config.ts index e244dbf..696e661 100644 --- a/config.ts +++ b/config.ts @@ -1 +1,7 @@ -export const PROXY_PORT = 3456; +export const FRONTEND_PORT = "2080"; +export const PROXY_PORT = "3456"; +export const SERVER_IP = "192.168.1.225"; +export const PB_PORT = "8090"; +export const PB_EMAIL = "temp@pb.com"; +export const PB_PASSWORD = "adminadmin"; +export const DEBUG_RECORD_ID = "0747qjl16m6o529"; diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..62ed052 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,22 @@ +FROM node:22-alpine AS builder +RUN corepack enable +WORKDIR /app +COPY . . +RUN pnpm install --frozen-lockfile +RUN pnpm --filter frontend build +RUN pnpm --filter proxy build + +FROM node:22-alpine +RUN corepack enable && apk add --no-cache nginx +WORKDIR /app +COPY --from=builder /app/frontend/build ./frontend/build +COPY --from=builder /app/proxy/dist ./proxy/dist +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/pnpm-lock.yaml ./ +COPY docker/nginx.conf /etc/nginx/http.d/default.conf +COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENV FRONTEND_PORT=2080 +ENV PROXY_PORT=3456 +EXPOSE 3001 +CMD ["/entrypoint.sh"] diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev new file mode 100644 index 0000000..fba82cf --- /dev/null +++ b/docker/Dockerfile.dev @@ -0,0 +1,8 @@ +FROM alpine:latest +RUN apk add --no-cache curl unzip && \ + curl -L -o /tmp/pb.zip https://github.com/pocketbase/pocketbase/releases/download/v0.25.8/pocketbase_0.25.8_linux_amd64.zip && \ + unzip /tmp/pb.zip -d /usr/local/bin/ && \ + rm /tmp/pb.zip && \ + apk del curl unzip +EXPOSE 8090 +CMD ["pocketbase", "serve", "--http=0.0.0.0:8090"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..1119021 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +PORT=${FRONTEND_PORT:-2080} node /app/frontend/build/index.js & +PROXY_PORT=${PROXY_PORT:-3456} node /app/proxy/dist/index.js & + +nginx -g 'daemon off;' diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..a3be060 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 3001; + server_name _; + + location / { + proxy_pass http://127.0.0.1:2080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + location /api/ { + proxy_pass http://127.0.0.1:3456; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/frontend/.svelte-kit/adapter-node/.vite/manifest.json b/frontend/.svelte-kit/adapter-node/.vite/manifest.json new file mode 100644 index 0000000..089f458 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/.vite/manifest.json @@ -0,0 +1,142 @@ +{ + "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js": { + "file": "remote-entry.js", + "name": "remote-entry", + "src": "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js", + "isEntry": true, + "imports": [ + "_utils.js", + "_internal2.js", + "_shared.js" + ] + }, + "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/components/error.svelte": { + "file": "entries/fallbacks/error.svelte.js", + "name": "entries/fallbacks/error.svelte", + "src": "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/components/error.svelte", + "isEntry": true, + "imports": [ + "_internal.js", + "_internal2.js", + "_exports.js", + "_shared.js", + "_async.js" + ] + }, + "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/server/index.js": { + "file": "index.js", + "name": "index", + "src": "../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/server/index.js", + "isEntry": true, + "imports": [ + "_internal.js", + "_utils.js", + "_internal2.js", + "_exports.js", + "_shared.js", + "_async.js", + "_uneval.js" + ] + }, + ".svelte-kit/generated/server/internal.js": { + "file": "internal.js", + "name": "internal", + "src": ".svelte-kit/generated/server/internal.js", + "isEntry": true, + "imports": [ + "_internal.js", + "_internal2.js" + ] + }, + "_async.js": { + "file": "chunks/async.js", + "name": "async", + "imports": [ + "_uneval.js" + ] + }, + "_exports.js": { + "file": "chunks/exports.js", + "name": "exports", + "imports": [ + "_async.js" + ] + }, + "_internal.js": { + "file": "chunks/internal.js", + "name": "internal", + "imports": [ + "_internal2.js", + "_async.js", + "_uneval.js" + ] + }, + "_internal2.js": { + "file": "chunks/internal2.js", + "name": "internal" + }, + "_shared.js": { + "file": "chunks/shared.js", + "name": "shared", + "imports": [ + "_uneval.js" + ] + }, + "_uneval.js": { + "file": "chunks/uneval.js", + "name": "uneval" + }, + "_utils.js": { + "file": "chunks/utils.js", + "name": "utils", + "imports": [ + "_shared.js", + "_uneval.js" + ] + }, + "src/routes/+layout.svelte": { + "file": "entries/pages/_layout.svelte.js", + "name": "entries/pages/_layout.svelte", + "src": "src/routes/+layout.svelte", + "isEntry": true, + "imports": [ + "_async.js" + ], + "css": [ + "_app/immutable/assets/_layout.DZVyIXY0.css" + ] + }, + "src/routes/+page.svelte": { + "file": "entries/pages/_page.svelte.js", + "name": "entries/pages/_page.svelte", + "src": "src/routes/+page.svelte", + "isEntry": true, + "imports": [ + "_async.js" + ] + }, + "src/routes/app/debug/increment-svelte/+server.ts": { + "file": "entries/endpoints/app/debug/increment-svelte/_server.ts.js", + "name": "entries/endpoints/app/debug/increment-svelte/_server.ts", + "src": "src/routes/app/debug/increment-svelte/+server.ts", + "isEntry": true + }, + "src/routes/debug/+page.server.ts": { + "file": "entries/pages/debug/_page.server.ts.js", + "name": "entries/pages/debug/_page.server.ts", + "src": "src/routes/debug/+page.server.ts", + "isEntry": true + }, + "src/routes/debug/+page.svelte": { + "file": "entries/pages/debug/_page.svelte.js", + "name": "entries/pages/debug/_page.svelte", + "src": "src/routes/debug/+page.svelte", + "isEntry": true, + "imports": [ + "_async.js" + ], + "css": [ + "_app/immutable/assets/_page.mtd_lTPT.css" + ] + } +} \ No newline at end of file diff --git a/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_layout.DZVyIXY0.css b/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_layout.DZVyIXY0.css new file mode 100644 index 0000000..cd0e88e --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_layout.DZVyIXY0.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.relative{position:relative}.static{position:static}.block{display:block}.contents{display:contents}.hidden{display:none}.inline{display:inline}.table{display:table}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.lowercase{text-transform:lowercase}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false} diff --git a/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.mtd_lTPT.css b/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.mtd_lTPT.css new file mode 100644 index 0000000..0a89649 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.mtd_lTPT.css @@ -0,0 +1 @@ +h1.svelte-1cmtigg{text-align:center;margin:2rem 0}.counters.svelte-1cmtigg{justify-content:center;gap:2rem;display:flex}.card.svelte-1cmtigg{text-align:center;border:1px solid #ccc;border-radius:8px;min-width:200px;padding:2rem}.value.svelte-1cmtigg{margin:1rem 0;font-size:3rem;font-weight:700}button.svelte-1cmtigg{cursor:pointer;padding:.5rem 1.5rem;font-size:1rem} diff --git a/frontend/.svelte-kit/adapter-node/chunks/async.js b/frontend/.svelte-kit/adapter-node/chunks/async.js new file mode 100644 index 0000000..ffa8635 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/async.js @@ -0,0 +1,4095 @@ +import { t as uneval } from "./uneval.js"; +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/shared/utils.js +var is_array = Array.isArray; +var index_of = Array.prototype.indexOf; +var includes = Array.prototype.includes; +var array_from = Array.from; +var define_property = Object.defineProperty; +var get_descriptor = Object.getOwnPropertyDescriptor; +var object_prototype = Object.prototype; +var array_prototype = Array.prototype; +var get_prototype_of = Object.getPrototypeOf; +var is_extensible = Object.isExtensible; +var has_own_property = Object.prototype.hasOwnProperty; +var noop = () => {}; +/** @param {Function} fn */ +function run(fn) { + return fn(); +} +/** @param {Array<() => void>} arr */ +function run_all(arr) { + for (var i = 0; i < arr.length; i++) arr[i](); +} +/** +* TODO replace with Promise.withResolvers once supported widely enough +* @template [T=void] +*/ +function deferred() { + /** @type {(value: T) => void} */ + var resolve; + /** @type {(reason: any) => void} */ + var reject; + return { + promise: new Promise((res, rej) => { + resolve = res; + reject = rej; + }), + resolve, + reject + }; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/equality.js +/** @import { Equals } from '#client' */ +/** @type {Equals} */ +function equals(value) { + return value === this.v; +} +/** +* @param {unknown} a +* @param {unknown} b +* @returns {boolean} +*/ +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function"; +} +/** @type {Equals} */ +function safe_equals(value) { + return !safe_not_equal(value, this.v); +} +var CLEAN = 1024; +var DIRTY = 2048; +var MAYBE_DIRTY = 4096; +var INERT = 8192; +var DESTROYED = 16384; +/** Set once a reaction has run for the first time */ +var REACTION_RAN = 32768; +/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */ +var DESTROYING = 1 << 25; +/** +* 'Transparent' effects do not create a transition boundary. +* This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned +*/ +var EFFECT_TRANSPARENT = 65536; +var EFFECT_PRESERVED = 1 << 19; +var USER_EFFECT = 1 << 20; +/** +* Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase. +* Will be lifted during execution of the derived and during checking its dirty state (both are necessary +* because a derived might be checked but not executed). This is a pure performance optimization flag and +* should not be used for any other purpose! +*/ +var WAS_MARKED = 65536; +var REACTION_IS_UPDATING = 1 << 21; +var ERROR_VALUE = 1 << 23; +var STATE_SYMBOL = Symbol("$state"); +var LEGACY_PROPS = Symbol("legacy props"); +var ATTRIBUTES_CACHE = Symbol("attributes"); +var CLASS_CACHE = Symbol("class"); +var STYLE_CACHE = Symbol("style"); +var TEXT_CACHE = Symbol("text"); +/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */ +var STALE_REACTION = new class StaleReactionError extends Error { + name = "StaleReactionError"; + message = "The reaction that called `getAbortSignal()` was re-run or destroyed"; +}(); +globalThis.document?.contentType; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/shared/errors.js +/** +* Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true` +* @param {string} name +* @returns {never} +*/ +function experimental_async_required(name) { + throw new Error(`https://svelte.dev/e/experimental_async_required`); +} +/** +* `%name%(...)` can only be used during component initialisation +* @param {string} name +* @returns {never} +*/ +function lifecycle_outside_component(name) { + throw new Error(`https://svelte.dev/e/lifecycle_outside_component`); +} +/** +* Context was not set in a parent component +* @returns {never} +*/ +function missing_context() { + throw new Error(`https://svelte.dev/e/missing_context`); +} +/** +* Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state +* @returns {never} +*/ +function effect_update_depth_exceeded() { + throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`); +} +/** +* Failed to hydrate the application +* @returns {never} +*/ +function hydration_failed() { + throw new Error(`https://svelte.dev/e/hydration_failed`); +} +/** +* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`. +* @returns {never} +*/ +function state_descriptors_fixed() { + throw new Error(`https://svelte.dev/e/state_descriptors_fixed`); +} +/** +* Cannot set prototype of `$state` object +* @returns {never} +*/ +function state_prototype_fixed() { + throw new Error(`https://svelte.dev/e/state_prototype_fixed`); +} +/** +* Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state` +* @returns {never} +*/ +function state_unsafe_mutation() { + throw new Error(`https://svelte.dev/e/state_unsafe_mutation`); +} +/** +* A `` `reset` function cannot be called while an error is still being handled +* @returns {never} +*/ +function svelte_boundary_reset_onerror() { + throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/constants.js +var HYDRATION_ERROR = {}; +var UNINITIALIZED = Symbol("uninitialized"); +/** +* Reading a derived belonging to a now-destroyed effect may result in stale values +*/ +function derived_inert() { + console.warn(`https://svelte.dev/e/derived_inert`); +} +/** +* Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location% +* @param {string | undefined | null} [location] +*/ +function hydration_mismatch(location) { + console.warn(`https://svelte.dev/e/hydration_mismatch`); +} +/** +* Tried to unmount a component that was not mounted +*/ +function lifecycle_double_unmount() { + console.warn(`https://svelte.dev/e/lifecycle_double_unmount`); +} +/** +* Tried to unmount a state proxy, rather than a component +*/ +function state_proxy_unmount() { + console.warn(`https://svelte.dev/e/state_proxy_unmount`); +} +/** +* A `` `reset` function only resets the boundary the first time it is called +*/ +function svelte_boundary_reset_noop() { + console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/hydration.js +/** @import { TemplateNode } from '#client' */ +/** +* Use this variable to guard everything related to hydration code so it can be treeshaken out +* if the user doesn't use the `hydrate` method and these code paths are therefore not needed. +*/ +var hydrating = false; +/** @param {boolean} value */ +function set_hydrating(value) { + hydrating = value; +} +/** +* The node that is currently being hydrated. This starts out as the first node inside the opening +* comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`. +* When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the +* time we leave the block it is the closing comment, which serves as the block's anchor. +* @type {TemplateNode} +*/ +var hydrate_node; +/** @param {TemplateNode | null} node */ +function set_hydrate_node(node) { + if (node === null) { + hydration_mismatch(); + throw HYDRATION_ERROR; + } + return hydrate_node = node; +} +function hydrate_next() { + return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node)); +} +function next(count = 1) { + if (hydrating) { + var i = count; + var node = hydrate_node; + while (i--) node = /* @__PURE__ */ get_next_sibling(node); + hydrate_node = node; + } +} +/** +* Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment +* @param {boolean} remove +*/ +function skip_nodes(remove = true) { + var depth = 0; + var node = hydrate_node; + while (true) { + if (node.nodeType === 8) { + var data = node.data; + if (data === "]") { + if (depth === 0) return node; + depth -= 1; + } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1; + } + var next = /* @__PURE__ */ get_next_sibling(node); + if (remove) node.remove(); + node = next; + } +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/flags/index.js +/** True if experimental.async=true */ +var async_mode_flag = false; +/** True if we're not certain that we only have Svelte 5 code in the compilation */ +var legacy_mode_flag = false; +function enable_async_mode_flag() { + async_mode_flag = true; +} +/** +* @returns {string[]} +*/ +function get_stack() { + const limit = Error.stackTraceLimit; + Error.stackTraceLimit = Infinity; + const stack = (/* @__PURE__ */ new Error()).stack; + Error.stackTraceLimit = limit; + if (!stack) return []; + const lines = stack.split("\n"); + const new_lines = []; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const posixified = line.replaceAll("\\", "/"); + if (line.trim() === "Error") continue; + if (line.includes("validate_each_keys")) return []; + if (posixified.includes("svelte/src/internal") || posixified.includes("node_modules/.vite")) continue; + new_lines.push(line); + } + return new_lines; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/context.js +/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */ +/** @type {ComponentContext | null} */ +var component_context = null; +/** @param {ComponentContext | null} context */ +function set_component_context(context) { + component_context = context; +} +/** +* @param {Record} props +* @param {any} runes +* @param {Function} [fn] +* @returns {void} +*/ +function push$1(props, runes = false, fn) { + component_context = { + p: component_context, + i: false, + c: null, + e: null, + s: props, + x: null, + r: active_effect, + l: legacy_mode_flag && !runes ? { + s: null, + u: null, + $: [] + } : null + }; +} +/** +* @template {Record} T +* @param {T} [component] +* @returns {T} +*/ +function pop$1(component) { + var context = component_context; + var effects = context.e; + if (effects !== null) { + context.e = null; + for (var fn of effects) create_user_effect(fn); + } + if (component !== void 0) context.x = component; + context.i = true; + component_context = context.p; + return component ?? {}; +} +/** @returns {boolean} */ +function is_runes() { + return !legacy_mode_flag || component_context !== null && component_context.l === null; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/task.js +/** @type {Array<() => void>} */ +var micro_tasks = []; +function run_micro_tasks() { + var tasks = micro_tasks; + micro_tasks = []; + run_all(tasks); +} +/** +* @param {() => void} fn +*/ +function queue_micro_task(fn) { + if (micro_tasks.length === 0 && !is_flushing_sync) { + var tasks = micro_tasks; + queueMicrotask(() => { + if (tasks === micro_tasks) run_micro_tasks(); + }); + } + micro_tasks.push(fn); +} +/** +* Synchronously run any queued tasks. +*/ +function flush_tasks() { + while (micro_tasks.length > 0) run_micro_tasks(); +} +/** +* @param {unknown} error +*/ +function handle_error(error) { + var effect = active_effect; + if (effect === null) { + /** @type {Derived} */ active_reaction.f |= ERROR_VALUE; + return error; + } + if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error; + invoke_error_boundary(error, effect); +} +/** +* @param {unknown} error +* @param {Effect | null} effect +*/ +function invoke_error_boundary(error, effect) { + if (effect !== null && (effect.f & 16384) !== 0) return; + while (effect !== null) { + if ((effect.f & 128) !== 0) { + if ((effect.f & 32768) === 0) throw error; + try { + /** @type {Boundary} */ effect.b.error(error); + return; + } catch (e) { + error = e; + } + } + effect = effect.parent; + } + throw error; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/status.js +/** @import { Derived, Signal } from '#client' */ +var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN); +/** +* @param {Signal} signal +* @param {number} status +*/ +function set_signal_status(signal, status) { + signal.f = signal.f & STATUS_MASK | status; +} +/** +* Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state. +* @param {Derived} derived +*/ +function update_derived_status(derived) { + if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN); + else set_signal_status(derived, MAYBE_DIRTY); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/utils.js +/** @import { Derived, Effect, Value } from '#client' */ +/** +* @param {Value[] | null} deps +*/ +function clear_marked(deps) { + if (deps === null) return; + for (const dep of deps) { + if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue; + dep.f ^= WAS_MARKED; + clear_marked( + /** @type {Derived} */ + dep.deps + ); + } +} +/** +* @param {Effect} effect +* @param {Set} dirty_effects +* @param {Set} maybe_dirty_effects +*/ +function defer_effect(effect, dirty_effects, maybe_dirty_effects) { + if ((effect.f & 2048) !== 0) dirty_effects.add(effect); + else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect); + clear_marked(effect.deps); + set_signal_status(effect, CLEAN); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/store.js +/** +* We set this to `true` when updating a store so that we correctly +* schedule effects if the update takes place inside a `$:` effect +*/ +var legacy_is_updating_store = false; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/reactivity/create-subscriber.js +/** +* Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity. +* It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`. +* +* If `subscribe` is called inside an effect (including indirectly, for example inside a getter), +* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs. +* +* If `start` returns a cleanup function, it will be called when the effect is destroyed. +* +* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects +* are active, and the returned teardown function will only be called when all effects are destroyed. +* +* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery): +* +* ```js +* import { createSubscriber } from 'svelte/reactivity'; +* import { on } from 'svelte/events'; +* +* export class MediaQuery { +* #query; +* #subscribe; +* +* constructor(query) { +* this.#query = window.matchMedia(`(${query})`); +* +* this.#subscribe = createSubscriber((update) => { +* // when the `change` event occurs, re-run any effects that read `this.current` +* const off = on(this.#query, 'change', update); +* +* // stop listening when all the effects are destroyed +* return () => off(); +* }); +* } +* +* get current() { +* // This makes the getter reactive, if read in an effect +* this.#subscribe(); +* +* // Return the current state of the query, whether or not we're in an effect +* return this.#query.matches; +* } +* } +* ``` +* @param {(update: () => void) => (() => void) | void} start +* @since 5.7.0 +*/ +function createSubscriber(start) { + let subscribers = 0; + let version = source(0); + /** @type {(() => void) | void} */ + let stop; + return () => { + if (effect_tracking()) { + get(version); + render_effect(() => { + if (subscribers === 0) stop = untrack(() => start(() => increment(version))); + subscribers += 1; + return () => { + queue_micro_task(() => { + subscribers -= 1; + if (subscribers === 0) { + stop?.(); + stop = void 0; + increment(version); + } + }); + }; + }); + } + }; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/blocks/boundary.js +/** @import { Effect, Source, TemplateNode, } from '#client' */ +/** +* @typedef {{ +* onerror?: ((error: unknown, reset: () => void) => void) | null; +* failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null; +* pending?: ((anchor: Node) => void) | null; +* }} BoundaryProps +*/ +var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED; +/** +* @param {TemplateNode} node +* @param {BoundaryProps} props +* @param {((anchor: Node) => void)} children +* @param {((error: unknown) => unknown) | undefined} [transform_error] +* @returns {void} +*/ +function boundary(node, props, children, transform_error) { + new Boundary(node, props, children, transform_error); +} +var Boundary = class { + /** @type {Boundary | null} */ + parent; + is_pending = false; + /** + * API-level transformError transform function. Transforms errors before they reach the `failed` snippet. + * Inherited from parent boundary, or defaults to identity. + * @type {(error: unknown) => unknown} + */ + transform_error; + /** @type {TemplateNode} */ + #anchor; + /** @type {TemplateNode | null} */ + #hydrate_open = hydrating ? hydrate_node : null; + /** @type {BoundaryProps} */ + #props; + /** @type {((anchor: Node) => void)} */ + #children; + /** @type {Effect} */ + #effect; + /** @type {Effect | null} */ + #main_effect = null; + /** @type {Effect | null} */ + #pending_effect = null; + /** @type {Effect | null} */ + #failed_effect = null; + /** @type {DocumentFragment | null} */ + #offscreen_fragment = null; + #local_pending_count = 0; + #pending_count = 0; + #pending_count_update_queued = false; + /** @type {Set} */ + #dirty_effects = /* @__PURE__ */ new Set(); + /** @type {Set} */ + #maybe_dirty_effects = /* @__PURE__ */ new Set(); + /** + * A source containing the number of pending async deriveds/expressions. + * Only created if `$effect.pending()` is used inside the boundary, + * otherwise updating the source results in needless `Batch.ensure()` + * calls followed by no-op flushes + * @type {Source | null} + */ + #effect_pending = null; + #effect_pending_subscriber = createSubscriber(() => { + this.#effect_pending = source(this.#local_pending_count); + return () => { + this.#effect_pending = null; + }; + }); + /** + * @param {TemplateNode} node + * @param {BoundaryProps} props + * @param {((anchor: Node) => void)} children + * @param {((error: unknown) => unknown) | undefined} [transform_error] + */ + constructor(node, props, children, transform_error) { + this.#anchor = node; + this.#props = props; + this.#children = (anchor) => { + var effect = active_effect; + effect.b = this; + effect.f |= 128; + children(anchor); + }; + this.parent = active_effect.b; + this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e); + this.#effect = block(() => { + if (hydrating) { + const comment = this.#hydrate_open; + hydrate_next(); + const server_rendered_pending = comment.data === "[!"; + if (comment.data.startsWith("[?")) { + const serialized_error = JSON.parse(comment.data.slice(2)); + this.#hydrate_failed_content(serialized_error); + } else if (server_rendered_pending) this.#hydrate_pending_content(); + else this.#hydrate_resolved_content(); + } else this.#render(); + }, flags); + if (hydrating) this.#anchor = hydrate_node; + } + #hydrate_resolved_content() { + try { + this.#main_effect = branch(() => this.#children(this.#anchor)); + } catch (error) { + this.error(error); + } + } + /** + * @param {unknown} error The deserialized error from the server's hydration comment + */ + #hydrate_failed_content(error) { + const failed = this.#props.failed; + if (!failed) return; + this.#failed_effect = branch(() => { + failed(this.#anchor, () => error, () => () => {}); + }); + } + #hydrate_pending_content() { + const pending = this.#props.pending; + if (!pending) return; + this.is_pending = true; + this.#pending_effect = branch(() => pending(this.#anchor)); + queue_micro_task(() => { + var fragment = this.#offscreen_fragment = document.createDocumentFragment(); + var anchor = create_text(); + fragment.append(anchor); + this.#main_effect = this.#run(() => { + return branch(() => this.#children(anchor)); + }); + if (this.#pending_count === 0) { + this.#anchor.before(fragment); + this.#offscreen_fragment = null; + pause_effect(this.#pending_effect, () => { + this.#pending_effect = null; + }); + this.#resolve(current_batch); + } + }); + } + #render() { + try { + this.is_pending = this.has_pending_snippet(); + this.#pending_count = 0; + this.#local_pending_count = 0; + this.#main_effect = branch(() => { + this.#children(this.#anchor); + }); + if (this.#pending_count > 0) { + var fragment = this.#offscreen_fragment = document.createDocumentFragment(); + move_effect(this.#main_effect, fragment); + const pending = this.#props.pending; + this.#pending_effect = branch(() => pending(this.#anchor)); + } else this.#resolve(current_batch); + } catch (error) { + this.error(error); + } + } + /** + * @param {Batch} batch + */ + #resolve(batch) { + this.is_pending = false; + batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects); + } + /** + * Defer an effect inside a pending boundary until the boundary resolves + * @param {Effect} effect + */ + defer_effect(effect) { + defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects); + } + /** + * Returns `false` if the effect exists inside a boundary whose pending snippet is shown + * @returns {boolean} + */ + is_rendered() { + return !this.is_pending && (!this.parent || this.parent.is_rendered()); + } + has_pending_snippet() { + return !!this.#props.pending; + } + /** + * @template T + * @param {() => T} fn + */ + #run(fn) { + var previous_effect = active_effect; + var previous_reaction = active_reaction; + var previous_ctx = component_context; + set_active_effect(this.#effect); + set_active_reaction(this.#effect); + set_component_context(this.#effect.ctx); + try { + Batch.ensure(); + return fn(); + } catch (e) { + handle_error(e); + return null; + } finally { + set_active_effect(previous_effect); + set_active_reaction(previous_reaction); + set_component_context(previous_ctx); + } + } + /** + * Updates the pending count associated with the currently visible pending snippet, + * if any, such that we can replace the snippet with content once work is done + * @param {1 | -1} d + * @param {Batch} batch + */ + #update_pending_count(d, batch) { + if (!this.has_pending_snippet()) { + if (this.parent) this.parent.#update_pending_count(d, batch); + return; + } + this.#pending_count += d; + if (this.#pending_count === 0) { + this.#resolve(batch); + if (this.#pending_effect) pause_effect(this.#pending_effect, () => { + this.#pending_effect = null; + }); + if (this.#offscreen_fragment) { + this.#anchor.before(this.#offscreen_fragment); + this.#offscreen_fragment = null; + } + } + } + /** + * Update the source that powers `$effect.pending()` inside this boundary, + * and controls when the current `pending` snippet (if any) is removed. + * Do not call from inside the class + * @param {1 | -1} d + * @param {Batch} batch + */ + update_pending_count(d, batch) { + this.#update_pending_count(d, batch); + this.#local_pending_count += d; + if (!this.#effect_pending || this.#pending_count_update_queued) return; + this.#pending_count_update_queued = true; + queue_micro_task(() => { + this.#pending_count_update_queued = false; + if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count); + }); + } + get_effect_pending() { + this.#effect_pending_subscriber(); + return get(this.#effect_pending); + } + /** @param {unknown} error */ + error(error) { + if (!this.#props.onerror && !this.#props.failed) throw error; + if (current_batch?.is_fork) { + if (this.#main_effect) current_batch.skip_effect(this.#main_effect); + if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect); + if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect); + current_batch.oncommit(() => { + this.#handle_error(error); + }); + } else this.#handle_error(error); + } + /** + * @param {unknown} error + */ + #handle_error(error) { + if (this.#main_effect) { + destroy_effect(this.#main_effect); + this.#main_effect = null; + } + if (this.#pending_effect) { + destroy_effect(this.#pending_effect); + this.#pending_effect = null; + } + if (this.#failed_effect) { + destroy_effect(this.#failed_effect); + this.#failed_effect = null; + } + if (hydrating) { + set_hydrate_node(this.#hydrate_open); + next(); + set_hydrate_node(skip_nodes()); + } + var onerror = this.#props.onerror; + let failed = this.#props.failed; + var did_reset = false; + var calling_on_error = false; + const reset = () => { + if (did_reset) { + svelte_boundary_reset_noop(); + return; + } + did_reset = true; + if (calling_on_error) svelte_boundary_reset_onerror(); + if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => { + this.#failed_effect = null; + }); + this.#run(() => { + this.#render(); + }); + }; + /** @param {unknown} transformed_error */ + const handle_error_result = (transformed_error) => { + try { + calling_on_error = true; + onerror?.(transformed_error, reset); + calling_on_error = false; + } catch (error) { + invoke_error_boundary(error, this.#effect && this.#effect.parent); + } + if (failed) this.#failed_effect = this.#run(() => { + try { + return branch(() => { + var effect = active_effect; + effect.b = this; + effect.f |= 128; + failed(this.#anchor, () => transformed_error, () => reset); + }); + } catch (error) { + invoke_error_boundary(error, this.#effect.parent); + return null; + } + }); + }; + queue_micro_task(() => { + /** @type {unknown} */ + var result; + try { + result = this.transform_error(error); + } catch (e) { + invoke_error_boundary(e, this.#effect && this.#effect.parent); + return; + } + if (result !== null && typeof result === "object" && typeof result.then === "function") + /** @type {any} */ result.then( + handle_error_result, + /** @param {unknown} e */ + (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent) + ); + else handle_error_result(result); + }); + } +}; +var OBSOLETE = Symbol("obsolete"); +/** +* @param {Derived} derived +* @returns {void} +*/ +function destroy_derived_effects(derived) { + var effects = derived.effects; + if (effects !== null) { + derived.effects = null; + for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]); + } +} +/** +* @template T +* @param {Derived} derived +* @returns {T} +*/ +function execute_derived(derived) { + var value; + var prev_active_effect = active_effect; + var parent = derived.parent; + if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) { + derived_inert(); + return derived.v; + } + set_active_effect(parent); + try { + derived.f &= ~WAS_MARKED; + destroy_derived_effects(derived); + value = update_reaction(derived); + } finally { + set_active_effect(prev_active_effect); + } + return value; +} +/** +* @param {Derived} derived +* @returns {void} +*/ +function update_derived(derived) { + var value = execute_derived(derived); + if (!derived.equals(value)) { + derived.wv = increment_write_version(); + if (!current_batch?.is_fork || derived.deps === null) { + if (current_batch !== null) { + current_batch.capture(derived, value, true); + previous_batch?.capture(derived, value, true); + } else derived.v = value; + if (derived.deps === null) { + set_signal_status(derived, CLEAN); + return; + } + } + } + if (is_destroying_effect) return; + if (batch_values !== null) { + if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value); + } else update_derived_status(derived); +} +/** +* @param {Derived} derived +*/ +function freeze_derived_effects(derived) { + if (derived.effects === null) return; + for (const e of derived.effects) if (e.teardown || e.ac) { + e.teardown?.(); + e.ac?.abort(STALE_REACTION); + if (e.fn !== null) e.teardown = noop; + e.ac = null; + remove_reactions(e, 0); + destroy_effect_children(e); + } +} +/** +* @param {Derived} derived +*/ +function unfreeze_derived_effects(derived) { + if (derived.effects === null) return; + for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/batch.js +/** @import { Fork } from 'svelte' */ +/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */ +/** @type {Batch | null} */ +var first_batch = null; +/** @type {Batch | null} */ +var last_batch = null; +/** @type {Batch | null} */ +var current_batch = null; +/** +* This is needed to avoid overwriting inputs +* @type {Batch | null} +*/ +var previous_batch = null; +/** +* When time travelling (i.e. working in one batch, while other batches +* still have ongoing work), we ignore the real values of affected +* signals in favour of their values within the batch +* @type {Map | null} +*/ +var batch_values = null; +/** @type {Effect | null} */ +var last_scheduled_effect = null; +var is_flushing_sync = false; +var is_processing = false; +/** +* During traversal, this is an array. Newly created effects are (if not immediately +* executed) pushed to this array, rather than going through the scheduling +* rigamarole that would cause another turn of the flush loop. +* @type {Effect[] | null} +*/ +var collected_effects = null; +/** +* An array of effects that are marked during traversal as a result of a `set` +* (not `internal_set`) call. These will be added to the next batch and +* trigger another `batch.process()` +* @type {Effect[] | null} +* @deprecated when we get rid of legacy mode and stores, we can get rid of this +*/ +var legacy_updates = null; +var flush_count = 0; +var uid = 1; +var Batch = class Batch { + id = uid++; + /** True as soon as `#process` was called */ + #started = false; + linked = true; + /** @type {Batch | null} */ + #prev = null; + /** @type {Batch | null} */ + #next = null; + /** @type {Map>>} */ + async_deriveds = /* @__PURE__ */ new Map(); + /** + * The current values of any signals that are updated in this batch. + * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment) + * They keys of this map are identical to `this.#previous` + * @type {Map} + */ + current = /* @__PURE__ */ new Map(); + /** + * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place. + * They keys of this map are identical to `this.#current` + * @type {Map} + */ + previous = /* @__PURE__ */ new Map(); + /** + * When the batch is committed (and the DOM is updated), we need to remove old branches + * and append new ones by calling the functions added inside (if/each/key/etc) blocks + * @type {Set<(batch: Batch) => void>} + */ + #commit_callbacks = /* @__PURE__ */ new Set(); + /** + * If a fork is discarded, we need to destroy any effects that are no longer needed + * @type {Set<(batch: Batch) => void>} + */ + #discard_callbacks = /* @__PURE__ */ new Set(); + /** + * The number of async effects that are currently in flight + */ + #pending = 0; + /** + * Async effects that are currently in flight, _not_ inside a pending boundary + * @type {Map} + */ + #blocking_pending = /* @__PURE__ */ new Map(); + /** + * A deferred that resolves when the batch is committed, used with `settled()` + * TODO replace with Promise.withResolvers once supported widely enough + * @type {{ promise: Promise, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null} + */ + #deferred = null; + /** + * The root effects that need to be flushed + * @type {Effect[]} + */ + #roots = []; + /** + * Effects created while this batch was active. + * @type {Effect[]} + */ + #new_effects = []; + /** + * Deferred effects (which run after async work has completed) that are DIRTY + * @type {Set} + */ + #dirty_effects = /* @__PURE__ */ new Set(); + /** + * Deferred effects that are MAYBE_DIRTY + * @type {Set} + */ + #maybe_dirty_effects = /* @__PURE__ */ new Set(); + /** + * A map of branches that still exist, but will be destroyed when this batch + * is committed — we skip over these during `process`. + * The value contains child effects that were dirty/maybe_dirty before being reset, + * so they can be rescheduled if the branch survives. + * @type {Map} + */ + #skipped_branches = /* @__PURE__ */ new Map(); + /** + * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing + * @type {Set} + */ + #unskipped_branches = /* @__PURE__ */ new Set(); + is_fork = false; + #decrement_queued = false; + constructor() { + if (last_batch === null) first_batch = last_batch = this; + else { + last_batch.#next = this; + this.#prev = last_batch; + } + last_batch = this; + } + #is_deferred() { + if (this.is_fork) return true; + for (const effect of this.#blocking_pending.keys()) { + var e = effect; + var skipped = false; + while (e.parent !== null) { + if (this.#skipped_branches.has(e)) { + skipped = true; + break; + } + e = e.parent; + } + if (!skipped) return true; + } + return false; + } + /** + * Add an effect to the #skipped_branches map and reset its children + * @param {Effect} effect + */ + skip_effect(effect) { + if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, { + d: [], + m: [] + }); + this.#unskipped_branches.delete(effect); + } + /** + * Remove an effect from the #skipped_branches map and reschedule + * any tracked dirty/maybe_dirty child effects + * @param {Effect} effect + * @param {(e: Effect) => void} callback + */ + unskip_effect(effect, callback = (e) => this.schedule(e)) { + var tracked = this.#skipped_branches.get(effect); + if (tracked) { + this.#skipped_branches.delete(effect); + for (var e of tracked.d) { + set_signal_status(e, DIRTY); + callback(e); + } + for (e of tracked.m) { + set_signal_status(e, MAYBE_DIRTY); + callback(e); + } + } + this.#unskipped_branches.add(effect); + } + #process() { + this.#started = true; + if (flush_count++ > 1e3) { + this.#unlink(); + infinite_loop_guard(); + } + for (const e of this.#dirty_effects) { + this.#maybe_dirty_effects.delete(e); + set_signal_status(e, DIRTY); + this.schedule(e); + } + for (const e of this.#maybe_dirty_effects) { + set_signal_status(e, MAYBE_DIRTY); + this.schedule(e); + } + const roots = this.#roots; + this.#roots = []; + this.apply(); + /** @type {Effect[]} */ + var effects = collected_effects = []; + /** @type {Effect[]} */ + var render_effects = []; + /** + * @type {Effect[]} + * @deprecated when we get rid of legacy mode and stores, we can get rid of this + */ + var updates = legacy_updates = []; + for (const root of roots) try { + this.#traverse(root, effects, render_effects); + } catch (e) { + reset_all(root); + if (!this.#is_deferred()) this.discard(); + throw e; + } + current_batch = null; + if (updates.length > 0) { + var batch = Batch.ensure(); + for (const e of updates) batch.schedule(e); + } + collected_effects = null; + legacy_updates = null; + if (this.#is_deferred()) { + this.#defer_effects(render_effects); + this.#defer_effects(effects); + for (const [e, t] of this.#skipped_branches) reset_branch(e, t); + if (updates.length > 0) + /** @type {Batch} */ current_batch.#process(); + return; + } + const earlier_batch = this.#find_earlier_batch(); + if (earlier_batch) { + this.#defer_effects(render_effects); + this.#defer_effects(effects); + earlier_batch.#merge(this); + return; + } + this.#dirty_effects.clear(); + this.#maybe_dirty_effects.clear(); + for (const fn of this.#commit_callbacks) fn(this); + this.#commit_callbacks.clear(); + previous_batch = this; + flush_queued_effects(render_effects); + flush_queued_effects(effects); + previous_batch = null; + this.#deferred?.resolve(); + var next_batch = current_batch; + if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) { + this.#unlink(); + if (async_mode_flag) { + this.#commit(); + current_batch = next_batch; + } + } + if (this.#roots.length > 0) if (next_batch !== null) { + const batch = next_batch; + batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r))); + } else next_batch = this; + if (next_batch !== null) next_batch.#process(); + } + /** + * Traverse the effect tree, executing effects or stashing + * them for later execution as appropriate + * @param {Effect} root + * @param {Effect[]} effects + * @param {Effect[]} render_effects + */ + #traverse(root, effects, render_effects) { + root.f ^= CLEAN; + var effect = root.first; + while (effect !== null) { + var flags = effect.f; + var is_branch = (flags & 96) !== 0; + if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) { + if (is_branch) effect.f ^= CLEAN; + else if ((flags & 4) !== 0) effects.push(effect); + else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect); + else if (is_dirty(effect)) { + if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect); + update_effect(effect); + } + var child = effect.first; + if (child !== null) { + effect = child; + continue; + } + } + while (effect !== null) { + var next = effect.next; + if (next !== null) { + effect = next; + break; + } + effect = effect.parent; + } + } + } + #find_earlier_batch() { + var batch = this.#prev; + while (batch !== null) { + if (!batch.is_fork) { + for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch; + } + batch = batch.#prev; + } + return null; + } + /** + * @param {Batch} batch + */ + #merge(batch) { + for (const [source, value] of batch.current) { + if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source)); + this.current.set(source, value); + } + for (const [effect, deferred] of batch.async_deriveds) { + const d = this.async_deriveds.get(effect); + if (d) deferred.promise.then(d.resolve).catch(d.reject); + } + batch.async_deriveds.clear(); + this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects); + /** + * mark all effects that depend on `batch.current`, except the + * async effects that we just resolved (TODO unless they depend + * on values in this batch that are NOT in the later batch?). + * Through this we also will populate the correct #skipped_branches, + * oncommit callbacks etc, so we don't need to merge them separately. + * @param {Value} value + */ + const mark = (value) => { + var reactions = value.reactions; + if (reactions === null) return; + for (const reaction of reactions) { + var flags = reaction.f; + if ((flags & 2) !== 0) mark(reaction); + else { + var effect = reaction; + if (flags & 4194320 && !this.async_deriveds.has(effect)) { + this.#maybe_dirty_effects.delete(effect); + set_signal_status(effect, DIRTY); + this.schedule(effect); + } + } + } + }; + for (const source of this.current.keys()) mark(source); + this.oncommit(() => batch.discard()); + batch.#unlink(); + current_batch = this; + this.#process(); + } + /** + * @param {Effect[]} effects + */ + #defer_effects(effects) { + for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects); + } + /** + * Associate a change to a given source with the current + * batch, noting its previous and current values + * @param {Value} source + * @param {any} value + * @param {boolean} [is_derived] + */ + capture(source, value, is_derived = false) { + if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v); + if ((source.f & 8388608) === 0) { + this.current.set(source, [value, is_derived]); + batch_values?.set(source, value); + } + if (!this.is_fork) source.v = value; + } + activate() { + current_batch = this; + } + deactivate() { + current_batch = null; + batch_values = null; + } + flush() { + try { + is_processing = true; + current_batch = this; + this.#process(); + } finally { + flush_count = 0; + last_scheduled_effect = null; + collected_effects = null; + legacy_updates = null; + is_processing = false; + current_batch = null; + batch_values = null; + old_values.clear(); + } + } + discard() { + for (const fn of this.#discard_callbacks) fn(this); + this.#discard_callbacks.clear(); + for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE); + this.#unlink(); + this.#deferred?.resolve(); + } + /** + * @param {Effect} effect + */ + register_created_effect(effect) { + this.#new_effects.push(effect); + } + #commit() { + for (let batch = first_batch; batch !== null; batch = batch.#next) { + var is_earlier = batch.id < this.id; + /** @type {Source[]} */ + var sources = []; + for (const [source, [value, is_derived]] of this.current) { + if (batch.current.has(source)) { + var batch_value = batch.current.get(source)[0]; + if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]); + else continue; + } + sources.push(source); + } + if (is_earlier) for (const [effect, deferred] of this.async_deriveds) { + const d = batch.async_deriveds.get(effect); + if (d) deferred.promise.then(d.resolve).catch(d.reject); + } + var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]); + if (!batch.#started || current.length === 0) continue; + var others = current.filter((source) => !this.current.has(source)); + if (others.length === 0) { + if (is_earlier) batch.discard(); + } else if (sources.length > 0) { + if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => { + if ((e.f & 4194320) !== 0) batch.schedule(e); + else batch.#defer_effects([e]); + }); + batch.activate(); + /** @type {Set} */ + var marked = /* @__PURE__ */ new Set(); + /** @type {Map} */ + var checked = /* @__PURE__ */ new Map(); + for (var source of sources) mark_effects(source, others, marked, checked); + checked = /* @__PURE__ */ new Map(); + var current_unequal = [...batch.current].filter(([c, v1]) => { + const v2 = this.current.get(c); + if (!v2) return true; + return v2[0] !== v1[0] || v2[1] !== v1[1]; + }).map(([c]) => c); + if (current_unequal.length > 0) { + for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) { + set_signal_status(effect, DIRTY); + batch.schedule(effect); + } else batch.#dirty_effects.add(effect); + } + if (batch.#roots.length > 0 && !batch.#decrement_queued) { + batch.apply(); + for (var root of batch.#roots) batch.#traverse(root, [], []); + batch.#roots = []; + } + batch.deactivate(); + } + } + } + /** + * @param {boolean} blocking + * @param {Effect} effect + */ + increment(blocking, effect) { + this.#pending += 1; + if (blocking) { + let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0; + this.#blocking_pending.set(effect, blocking_pending_count + 1); + } + } + /** + * @param {boolean} blocking + * @param {Effect} effect + */ + decrement(blocking, effect) { + this.#pending -= 1; + if (blocking) { + let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0; + if (blocking_pending_count === 1) this.#blocking_pending.delete(effect); + else this.#blocking_pending.set(effect, blocking_pending_count - 1); + } + if (this.#decrement_queued) return; + this.#decrement_queued = true; + queue_micro_task(() => { + this.#decrement_queued = false; + if (this.linked) this.flush(); + }); + } + /** + * @param {Set} dirty_effects + * @param {Set} maybe_dirty_effects + */ + transfer_effects(dirty_effects, maybe_dirty_effects) { + for (const e of dirty_effects) this.#dirty_effects.add(e); + for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e); + dirty_effects.clear(); + maybe_dirty_effects.clear(); + } + /** @param {(batch: Batch) => void} fn */ + oncommit(fn) { + this.#commit_callbacks.add(fn); + } + /** @param {(batch: Batch) => void} fn */ + ondiscard(fn) { + this.#discard_callbacks.add(fn); + } + settled() { + return (this.#deferred ??= deferred()).promise; + } + static ensure() { + if (current_batch === null) { + const batch = current_batch = new Batch(); + if (!is_processing && !is_flushing_sync) queue_micro_task(() => { + if (!batch.#started) batch.flush(); + }); + } + return current_batch; + } + apply() { + if (!async_mode_flag || !this.is_fork && this.#prev === null && this.#next === null) { + batch_values = null; + return; + } + batch_values = /* @__PURE__ */ new Map(); + for (const [source, [value]] of this.current) batch_values.set(source, value); + for (let batch = first_batch; batch !== null; batch = batch.#next) { + if (batch === this || batch.is_fork) continue; + var intersects = false; + if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) { + if (is_derived) continue; + if (this.current.has(source)) { + intersects = true; + break; + } + } + if (!intersects) { + for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous); + } + } + } + /** + * + * @param {Effect} effect + */ + schedule(effect) { + last_scheduled_effect = effect; + if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) { + effect.b.defer_effect(effect); + return; + } + var e = effect; + while (e.parent !== null) { + e = e.parent; + var flags = e.f; + if (collected_effects !== null && e === active_effect) { + if (async_mode_flag) return; + if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return; + } + if ((flags & 96) !== 0) { + if ((flags & 1024) === 0) return; + e.f ^= CLEAN; + } + } + this.#roots.push(e); + } + #unlink() { + if (!this.linked) return; + var prev = this.#prev; + var next = this.#next; + if (prev === null) first_batch = next; + else prev.#next = next; + if (next === null) last_batch = prev; + else next.#prev = prev; + this.linked = false; + } +}; +/** +* Synchronously flush any pending updates. +* Returns void if no callback is provided, otherwise returns the result of calling the callback. +* @template [T=void] +* @param {(() => T) | undefined} [fn] +* @returns {T} +*/ +function flushSync(fn) { + var was_flushing_sync = is_flushing_sync; + is_flushing_sync = true; + try { + var result; + if (fn) { + if (current_batch !== null && !current_batch.is_fork) current_batch.flush(); + result = fn(); + } + while (true) { + flush_tasks(); + if (current_batch === null) return result; + current_batch.flush(); + } + } finally { + is_flushing_sync = was_flushing_sync; + } +} +function infinite_loop_guard() { + try { + effect_update_depth_exceeded(); + } catch (error) { + invoke_error_boundary(error, last_scheduled_effect); + } +} +/** @type {Set | null} */ +var eager_block_effects = null; +/** +* @param {Array} effects +* @returns {void} +*/ +function flush_queued_effects(effects) { + var length = effects.length; + if (length === 0) return; + var i = 0; + while (i < length) { + var effect = effects[i++]; + if ((effect.f & 24576) === 0 && is_dirty(effect)) { + eager_block_effects = /* @__PURE__ */ new Set(); + update_effect(effect); + if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect); + if (eager_block_effects?.size > 0) { + old_values.clear(); + for (const e of eager_block_effects) { + if ((e.f & 24576) !== 0) continue; + /** @type {Effect[]} */ + const ordered_effects = [e]; + let ancestor = e.parent; + while (ancestor !== null) { + if (eager_block_effects.has(ancestor)) { + eager_block_effects.delete(ancestor); + ordered_effects.push(ancestor); + } + ancestor = ancestor.parent; + } + for (let j = ordered_effects.length - 1; j >= 0; j--) { + const e = ordered_effects[j]; + if ((e.f & 24576) !== 0) continue; + update_effect(e); + } + } + eager_block_effects.clear(); + } + } + } + eager_block_effects = null; +} +/** +* This is similar to `mark_reactions`, but it only marks async/block effects +* depending on `value` and at least one of the other `sources`, so that +* these effects can re-run after another batch has been committed +* @param {Value} value +* @param {Source[]} sources +* @param {Set} marked +* @param {Map} checked +*/ +function mark_effects(value, sources, marked, checked) { + if (marked.has(value)) return; + marked.add(value); + if (value.reactions !== null) for (const reaction of value.reactions) { + const flags = reaction.f; + if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked); + else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) { + set_signal_status(reaction, DIRTY); + schedule_effect(reaction); + } + } +} +/** +* @param {Reaction} reaction +* @param {Source[]} sources +* @param {Map} checked +*/ +function depends_on(reaction, sources, checked) { + const depends = checked.get(reaction); + if (depends !== void 0) return depends; + if (reaction.deps !== null) for (const dep of reaction.deps) { + if (includes.call(sources, dep)) return true; + if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) { + checked.set(dep, true); + return true; + } + } + checked.set(reaction, false); + return false; +} +/** +* @param {Effect} effect +* @returns {void} +*/ +function schedule_effect(effect) { + /** @type {Batch} */ current_batch.schedule(effect); +} +/** +* Mark all the effects inside a skipped branch CLEAN, so that +* they can be correctly rescheduled later. Tracks dirty and maybe_dirty +* effects so they can be rescheduled if the branch survives. +* @param {Effect} effect +* @param {{ d: Effect[], m: Effect[] }} tracked +*/ +function reset_branch(effect, tracked) { + if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return; + if ((effect.f & 2048) !== 0) tracked.d.push(effect); + else if ((effect.f & 4096) !== 0) tracked.m.push(effect); + set_signal_status(effect, CLEAN); + var e = effect.first; + while (e !== null) { + reset_branch(e, tracked); + e = e.next; + } +} +/** +* Mark an entire effect tree clean following an error +* @param {Effect} effect +*/ +function reset_all(effect) { + set_signal_status(effect, CLEAN); + var e = effect.first; + while (e !== null) { + reset_all(e); + e = e.next; + } +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/sources.js +/** @import { Derived, Effect, Source, Value } from '#client' */ +/** @type {Set} */ +var eager_effects = /* @__PURE__ */ new Set(); +/** @type {Map} */ +var old_values = /* @__PURE__ */ new Map(); +var eager_effects_deferred = false; +/** +* @template V +* @param {V} v +* @param {Error | null} [stack] +* @returns {Source} +*/ +function source(v, stack) { + return { + f: 0, + v, + reactions: null, + equals, + rv: 0, + wv: 0 + }; +} +/** +* @template V +* @param {V} v +* @param {Error | null} [stack] +*/ +/*#__NO_SIDE_EFFECTS__*/ +function state(v, stack) { + const s = source(v, stack); + push_reaction_value(s); + return s; +} +/** +* @template V +* @param {V} initial_value +* @param {boolean} [immutable] +* @returns {Source} +*/ +/*#__NO_SIDE_EFFECTS__*/ +function mutable_source(initial_value, immutable = false, trackable = true) { + const s = source(initial_value); + if (!immutable) s.equals = safe_equals; + if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s); + return s; +} +/** +* @template V +* @param {Source} source +* @param {V} value +* @param {boolean} [should_proxy] +* @returns {V} +*/ +function set(source, value, should_proxy = false) { + if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation(); + return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates); +} +/** +* @template V +* @param {Source} source +* @param {V} value +* @param {Effect[] | null} [updated_during_traversal] +* @returns {V} +*/ +function internal_set(source, value, updated_during_traversal = null) { + if (!source.equals(value)) { + old_values.set(source, is_destroying_effect ? value : source.v); + var batch = Batch.ensure(); + batch.capture(source, value); + if ((source.f & 2) !== 0) { + const derived = source; + if ((source.f & 2048) !== 0) execute_derived(derived); + if (batch_values === null) update_derived_status(derived); + } + source.wv = increment_write_version(); + mark_reactions(source, DIRTY, updated_during_traversal); + if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]); + else untracked_writes.push(source); + if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects(); + } + return value; +} +function flush_eager_effects() { + eager_effects_deferred = false; + for (const effect of eager_effects) { + if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY); + let dirty; + try { + dirty = is_dirty(effect); + } catch { + dirty = true; + } + if (dirty) update_effect(effect); + } + eager_effects.clear(); +} +/** +* Silently (without using `get`) increment a source +* @param {Source} source +*/ +function increment(source) { + set(source, source.v + 1); +} +/** +* @param {Value} signal +* @param {number} status should be DIRTY or MAYBE_DIRTY +* @param {Effect[] | null} updated_during_traversal +* @returns {void} +*/ +function mark_reactions(signal, status, updated_during_traversal) { + var reactions = signal.reactions; + if (reactions === null) return; + var runes = is_runes(); + var length = reactions.length; + for (var i = 0; i < length; i++) { + var reaction = reactions[i]; + var flags = reaction.f; + if (!runes && reaction === active_effect) continue; + var not_dirty = (flags & DIRTY) === 0; + if (not_dirty) set_signal_status(reaction, status); + if ((flags & 131072) !== 0) eager_effects.add(reaction); + else if ((flags & 2) !== 0) { + var derived = reaction; + batch_values?.delete(derived); + if ((flags & 65536) === 0) { + if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED; + mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal); + } + } else if (not_dirty) { + var effect = reaction; + if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect); + if (updated_during_traversal !== null) updated_during_traversal.push(effect); + else schedule_effect(effect); + } + } +} +/** +* @template T +* @param {T} value +* @returns {T} +*/ +function proxy(value) { + if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value; + const prototype = get_prototype_of(value); + if (prototype !== object_prototype && prototype !== array_prototype) return value; + /** @type {Map>} */ + var sources = /* @__PURE__ */ new Map(); + var is_proxied_array = is_array(value); + var version = /* @__PURE__ */ state(0); + var stack = null; + var parent_version = update_version; + /** + * Executes the proxy in the context of the reaction it was originally created in, if any + * @template T + * @param {() => T} fn + */ + var with_parent = (fn) => { + if (update_version === parent_version) return fn(); + var reaction = active_reaction; + var version = update_version; + set_active_reaction(null); + set_update_version(parent_version); + var result = fn(); + set_active_reaction(reaction); + set_update_version(version); + return result; + }; + if (is_proxied_array) sources.set("length", /* @__PURE__ */ state( + /** @type {any[]} */ + value.length, + stack + )); + return new Proxy(value, { + defineProperty(_, prop, descriptor) { + if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed(); + var s = sources.get(prop); + if (s === void 0) with_parent(() => { + var s = /* @__PURE__ */ state(descriptor.value, stack); + sources.set(prop, s); + return s; + }); + else set(s, descriptor.value, true); + return true; + }, + deleteProperty(target, prop) { + var s = sources.get(prop); + if (s === void 0) { + if (prop in target) { + const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack)); + sources.set(prop, s); + increment(version); + } + } else { + set(s, UNINITIALIZED); + increment(version); + } + return true; + }, + get(target, prop, receiver) { + if (prop === STATE_SYMBOL) return value; + var s = sources.get(prop); + var exists = prop in target; + if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) { + s = with_parent(() => { + return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack); + }); + sources.set(prop, s); + } + if (s !== void 0) { + var v = get(s); + return v === UNINITIALIZED ? void 0 : v; + } + return Reflect.get(target, prop, receiver); + }, + getOwnPropertyDescriptor(target, prop) { + var descriptor = Reflect.getOwnPropertyDescriptor(target, prop); + if (descriptor && "value" in descriptor) { + var s = sources.get(prop); + if (s) descriptor.value = get(s); + } else if (descriptor === void 0) { + var source = sources.get(prop); + var value = source?.v; + if (source !== void 0 && value !== UNINITIALIZED) return { + enumerable: true, + configurable: true, + value, + writable: true + }; + } + return descriptor; + }, + has(target, prop) { + if (prop === STATE_SYMBOL) return true; + var s = sources.get(prop); + var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop); + if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) { + if (s === void 0) { + s = with_parent(() => { + return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack); + }); + sources.set(prop, s); + } + if (get(s) === UNINITIALIZED) return false; + } + return has; + }, + set(target, prop, value, receiver) { + var s = sources.get(prop); + var has = prop in target; + if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) { + var other_s = sources.get(i + ""); + if (other_s !== void 0) set(other_s, UNINITIALIZED); + else if (i in target) { + other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack)); + sources.set(i + "", other_s); + } + } + if (s === void 0) { + if (!has || get_descriptor(target, prop)?.writable) { + s = with_parent(() => /* @__PURE__ */ state(void 0, stack)); + set(s, proxy(value)); + sources.set(prop, s); + } + } else { + has = s.v !== UNINITIALIZED; + var p = with_parent(() => proxy(value)); + set(s, p); + } + var descriptor = Reflect.getOwnPropertyDescriptor(target, prop); + if (descriptor?.set) descriptor.set.call(receiver, value); + if (!has) { + if (is_proxied_array && typeof prop === "string") { + var ls = sources.get("length"); + var n = Number(prop); + if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1); + } + increment(version); + } + return true; + }, + ownKeys(target) { + get(version); + var own_keys = Reflect.ownKeys(target).filter((key) => { + var source = sources.get(key); + return source === void 0 || source.v !== UNINITIALIZED; + }); + for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key); + return own_keys; + }, + setPrototypeOf() { + state_prototype_fixed(); + } + }); +} +new Set([ + "copyWithin", + "fill", + "pop", + "push", + "reverse", + "shift", + "sort", + "splice", + "unshift" +]); +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/operations.js +/** @type {Window} */ +var $window; +/** @type {() => Node | null} */ +var first_child_getter; +/** @type {() => Node | null} */ +var next_sibling_getter; +/** +* Initialize these lazily to avoid issues when using the runtime in a server context +* where these globals are not available while avoiding a separate server entry point +*/ +function init_operations() { + if ($window !== void 0) return; + $window = window; + /Firefox/.test(navigator.userAgent); + var element_prototype = Element.prototype; + var node_prototype = Node.prototype; + var text_prototype = Text.prototype; + first_child_getter = get_descriptor(node_prototype, "firstChild").get; + next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get; + if (is_extensible(element_prototype)) { + /** @type {any} */ element_prototype[CLASS_CACHE] = void 0; + /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null; + /** @type {any} */ element_prototype[STYLE_CACHE] = void 0; + element_prototype.__e = void 0; + } + if (is_extensible(text_prototype)) + /** @type {any} */ text_prototype[TEXT_CACHE] = void 0; +} +/** +* @param {string} value +* @returns {Text} +*/ +function create_text(value = "") { + return document.createTextNode(value); +} +/** +* @template {Node} N +* @param {N} node +*/ +/*@__NO_SIDE_EFFECTS__*/ +function get_first_child(node) { + return first_child_getter.call(node); +} +/** +* @template {Node} N +* @param {N} node +*/ +/*@__NO_SIDE_EFFECTS__*/ +function get_next_sibling(node) { + return next_sibling_getter.call(node); +} +/** +* @template {Node} N +* @param {N} node +* @returns {void} +*/ +function clear_text_content(node) { + node.textContent = ""; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js +/** +* @template T +* @param {() => T} fn +*/ +function without_reactive_context(fn) { + var previous_reaction = active_reaction; + var previous_effect = active_effect; + set_active_reaction(null); + set_active_effect(null); + try { + return fn(); + } finally { + set_active_reaction(previous_reaction); + set_active_effect(previous_effect); + } +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/reactivity/effects.js +/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */ +/** +* @param {Effect} effect +* @param {Effect} parent_effect +*/ +function push_effect(effect, parent_effect) { + var parent_last = parent_effect.last; + if (parent_last === null) parent_effect.last = parent_effect.first = effect; + else { + parent_last.next = effect; + effect.prev = parent_last; + parent_effect.last = effect; + } +} +/** +* @param {number} type +* @param {null | (() => void | (() => void))} fn +* @returns {Effect} +*/ +function create_effect(type, fn) { + var parent = active_effect; + if (parent !== null && (parent.f & 8192) !== 0) type |= INERT; + /** @type {Effect} */ + var effect = { + ctx: component_context, + deps: null, + nodes: null, + f: type | DIRTY | 512, + first: null, + fn, + last: null, + next: null, + parent, + b: parent && parent.b, + prev: null, + teardown: null, + wv: 0, + ac: null + }; + current_batch?.register_created_effect(effect); + /** @type {Effect | null} */ + var e = effect; + if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect); + else Batch.ensure().schedule(effect); + else if (fn !== null) { + try { + update_effect(effect); + } catch (e) { + destroy_effect(effect); + throw e; + } + if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) { + e = e.first; + if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT; + } + } + if (e !== null) { + e.parent = parent; + if (parent !== null) push_effect(e, parent); + if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) { + var derived = active_reaction; + (derived.effects ??= []).push(e); + } + } + return effect; +} +/** +* Internal representation of `$effect.tracking()` +* @returns {boolean} +*/ +function effect_tracking() { + return active_reaction !== null && !untracking; +} +/** +* @param {() => void | (() => void)} fn +*/ +function create_user_effect(fn) { + return create_effect(4 | USER_EFFECT, fn); +} +/** +* An effect root whose children can transition out +* @param {() => void} fn +* @returns {(options?: { outro?: boolean }) => Promise} +*/ +function component_root(fn) { + Batch.ensure(); + const effect = create_effect(64 | EFFECT_PRESERVED, fn); + return (options = {}) => { + return new Promise((fulfil) => { + if (options.outro) pause_effect(effect, () => { + destroy_effect(effect); + fulfil(void 0); + }); + else { + destroy_effect(effect); + fulfil(void 0); + } + }); + }; +} +/** +* @param {() => void | (() => void)} fn +* @returns {Effect} +*/ +function render_effect(fn, flags = 0) { + return create_effect(8 | flags, fn); +} +/** +* @param {(() => void)} fn +* @param {number} flags +*/ +function block(fn, flags = 0) { + return create_effect(16 | flags, fn); +} +/** +* @param {(() => void)} fn +*/ +function branch(fn) { + return create_effect(32 | EFFECT_PRESERVED, fn); +} +/** +* @param {Effect} effect +*/ +function execute_effect_teardown(effect) { + var teardown = effect.teardown; + if (teardown !== null) { + const previously_destroying_effect = is_destroying_effect; + const previous_reaction = active_reaction; + set_is_destroying_effect(true); + set_active_reaction(null); + try { + teardown.call(null); + } finally { + set_is_destroying_effect(previously_destroying_effect); + set_active_reaction(previous_reaction); + } + } +} +/** +* @param {Effect} signal +* @param {boolean} remove_dom +* @returns {void} +*/ +function destroy_effect_children(signal, remove_dom = false) { + var effect = signal.first; + signal.first = signal.last = null; + while (effect !== null) { + const controller = effect.ac; + if (controller !== null) without_reactive_context(() => { + controller.abort(STALE_REACTION); + }); + var next = effect.next; + if ((effect.f & 64) !== 0) effect.parent = null; + else destroy_effect(effect, remove_dom); + effect = next; + } +} +/** +* @param {Effect} signal +* @returns {void} +*/ +function destroy_block_effect_children(signal) { + var effect = signal.first; + while (effect !== null) { + var next = effect.next; + if ((effect.f & 32) === 0) destroy_effect(effect); + effect = next; + } +} +/** +* @param {Effect} effect +* @param {boolean} [remove_dom] +* @returns {void} +*/ +function destroy_effect(effect, remove_dom = true) { + var removed = false; + if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) { + remove_effect_dom(effect.nodes.start, effect.nodes.end); + removed = true; + } + effect.f |= DESTROYING; + destroy_effect_children(effect, remove_dom && !removed); + remove_reactions(effect, 0); + var transitions = effect.nodes && effect.nodes.t; + if (transitions !== null) for (const transition of transitions) transition.stop(); + execute_effect_teardown(effect); + effect.f ^= DESTROYING; + effect.f |= DESTROYED; + var parent = effect.parent; + if (parent !== null && parent.first !== null) unlink_effect(effect); + effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null; +} +/** +* +* @param {TemplateNode | null} node +* @param {TemplateNode} end +*/ +function remove_effect_dom(node, end) { + while (node !== null) { + /** @type {TemplateNode | null} */ + var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node); + node.remove(); + node = next; + } +} +/** +* Detach an effect from the effect tree, freeing up memory and +* reducing the amount of work that happens on subsequent traversals +* @param {Effect} effect +*/ +function unlink_effect(effect) { + var parent = effect.parent; + var prev = effect.prev; + var next = effect.next; + if (prev !== null) prev.next = next; + if (next !== null) next.prev = prev; + if (parent !== null) { + if (parent.first === effect) parent.first = next; + if (parent.last === effect) parent.last = prev; + } +} +/** +* When a block effect is removed, we don't immediately destroy it or yank it +* out of the DOM, because it might have transitions. Instead, we 'pause' it. +* It stays around (in memory, and in the DOM) until outro transitions have +* completed, and if the state change is reversed then we _resume_ it. +* A paused effect does not update, and the DOM subtree becomes inert. +* @param {Effect} effect +* @param {() => void} [callback] +* @param {boolean} [destroy] +*/ +function pause_effect(effect, callback, destroy = true) { + /** @type {TransitionManager[]} */ + var transitions = []; + pause_children(effect, transitions, true); + var fn = () => { + if (destroy) destroy_effect(effect); + if (callback) callback(); + }; + var remaining = transitions.length; + if (remaining > 0) { + var check = () => --remaining || fn(); + for (var transition of transitions) transition.out(check); + } else fn(); +} +/** +* @param {Effect} effect +* @param {TransitionManager[]} transitions +* @param {boolean} local +*/ +function pause_children(effect, transitions, local) { + if ((effect.f & 8192) !== 0) return; + effect.f ^= INERT; + var t = effect.nodes && effect.nodes.t; + if (t !== null) { + for (const transition of t) if (transition.is_global || local) transitions.push(transition); + } + var child = effect.first; + while (child !== null) { + var sibling = child.next; + if ((child.f & 64) === 0) { + var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0; + pause_children(child, transitions, transparent ? local : false); + } + child = sibling; + } +} +/** +* @param {Effect} effect +* @param {DocumentFragment} fragment +*/ +function move_effect(effect, fragment) { + if (!effect.nodes) return; + /** @type {TemplateNode | null} */ + var node = effect.nodes.start; + var end = effect.nodes.end; + while (node !== null) { + /** @type {TemplateNode | null} */ + var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node); + fragment.append(node); + node = next; + } +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/legacy.js +/** +* @type {Set | null} +* @deprecated +*/ +var captured_signals = null; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/runtime.js +/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */ +var is_updating_effect = false; +var is_destroying_effect = false; +/** @param {boolean} value */ +function set_is_destroying_effect(value) { + is_destroying_effect = value; +} +/** @type {null | Reaction} */ +var active_reaction = null; +var untracking = false; +/** @param {null | Reaction} reaction */ +function set_active_reaction(reaction) { + active_reaction = reaction; +} +/** @type {null | Effect} */ +var active_effect = null; +/** @param {null | Effect} effect */ +function set_active_effect(effect) { + active_effect = effect; +} +/** +* When sources are created within a reaction, reading and writing +* them within that reaction should not cause a re-run +* @type {null | Set} +*/ +var current_sources = null; +/** @param {Value} value */ +function push_reaction_value(value) { + if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ??= /* @__PURE__ */ new Set()).add(value); +} +/** +* The dependencies of the reaction that is currently being executed. In many cases, +* the dependencies are unchanged between runs, and so this will be `null` unless +* and until a new dependency is accessed — we track this via `skipped_deps` +* @type {null | Value[]} +*/ +var new_deps = null; +var skipped_deps = 0; +/** +* Tracks writes that the effect it's executed in doesn't listen to yet, +* so that the dependency can be added to the effect later on if it then reads it +* @type {null | Source[]} +*/ +var untracked_writes = null; +/** @param {null | Source[]} value */ +function set_untracked_writes(value) { + untracked_writes = value; +} +/** +* @type {number} Used by sources and deriveds for handling updates. +* Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing +**/ +var write_version = 1; +/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */ +var read_version = 0; +var update_version = read_version; +/** @param {number} value */ +function set_update_version(value) { + update_version = value; +} +function increment_write_version() { + return ++write_version; +} +/** +* Determines whether a derived or effect is dirty. +* If it is MAYBE_DIRTY, will set the status to CLEAN +* @param {Reaction} reaction +* @returns {boolean} +*/ +function is_dirty(reaction) { + var flags = reaction.f; + if ((flags & 2048) !== 0) return true; + if (flags & 2) reaction.f &= ~WAS_MARKED; + if ((flags & 4096) !== 0) { + var dependencies = reaction.deps; + var length = dependencies.length; + for (var i = 0; i < length; i++) { + var dependency = dependencies[i]; + if (is_dirty(dependency)) update_derived(dependency); + if (dependency.wv > reaction.wv) return true; + } + if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN); + } + return false; +} +/** +* @param {Value} signal +* @param {Effect} effect +* @param {boolean} [root] +*/ +function schedule_possible_effect_self_invalidation(signal, effect, root = true) { + var reactions = signal.reactions; + if (reactions === null) return; + if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return; + for (var i = 0; i < reactions.length; i++) { + var reaction = reactions[i]; + if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false); + else if (effect === reaction) { + if (root) set_signal_status(reaction, DIRTY); + else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY); + schedule_effect(reaction); + } + } +} +/** @param {Reaction} reaction */ +function update_reaction(reaction) { + var previous_deps = new_deps; + var previous_skipped_deps = skipped_deps; + var previous_untracked_writes = untracked_writes; + var previous_reaction = active_reaction; + var previous_sources = current_sources; + var previous_component_context = component_context; + var previous_untracking = untracking; + var previous_update_version = update_version; + var flags = reaction.f; + new_deps = null; + skipped_deps = 0; + untracked_writes = null; + active_reaction = (flags & 96) === 0 ? reaction : null; + current_sources = null; + set_component_context(reaction.ctx); + untracking = false; + update_version = ++read_version; + if (reaction.ac !== null) { + without_reactive_context(() => { + /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION); + }); + reaction.ac = null; + } + try { + reaction.f |= REACTION_IS_UPDATING; + var fn = reaction.fn; + var result = fn(); + reaction.f |= REACTION_RAN; + var deps = reaction.deps; + var is_fork = current_batch?.is_fork; + if (new_deps !== null) { + var i; + if (!is_fork) remove_reactions(reaction, skipped_deps); + if (deps !== null && skipped_deps > 0) { + deps.length = skipped_deps + new_deps.length; + for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i]; + } else reaction.deps = deps = new_deps; + if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction); + } else if (!is_fork && deps !== null && skipped_deps < deps.length) { + remove_reactions(reaction, skipped_deps); + deps.length = skipped_deps; + } + if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction); + if (previous_reaction !== null && previous_reaction !== reaction) { + read_version++; + if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version; + if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version; + if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes; + else previous_untracked_writes.push(...untracked_writes); + } + if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE; + return result; + } catch (error) { + return handle_error(error); + } finally { + reaction.f ^= REACTION_IS_UPDATING; + new_deps = previous_deps; + skipped_deps = previous_skipped_deps; + untracked_writes = previous_untracked_writes; + active_reaction = previous_reaction; + current_sources = previous_sources; + set_component_context(previous_component_context); + untracking = previous_untracking; + update_version = previous_update_version; + } +} +/** +* @template V +* @param {Reaction} signal +* @param {Value} dependency +* @returns {void} +*/ +function remove_reaction(signal, dependency) { + let reactions = dependency.reactions; + if (reactions !== null) { + var index = index_of.call(reactions, signal); + if (index !== -1) { + var new_length = reactions.length - 1; + if (new_length === 0) reactions = dependency.reactions = null; + else { + reactions[index] = reactions[new_length]; + reactions.pop(); + } + } + } + if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) { + var derived = dependency; + if ((derived.f & 512) !== 0) { + derived.f ^= 512; + derived.f &= ~WAS_MARKED; + } + if (derived.v !== UNINITIALIZED) update_derived_status(derived); + freeze_derived_effects(derived); + remove_reactions(derived, 0); + } +} +/** +* @param {Reaction} signal +* @param {number} start_index +* @returns {void} +*/ +function remove_reactions(signal, start_index) { + var dependencies = signal.deps; + if (dependencies === null) return; + for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]); +} +/** +* @param {Effect} effect +* @returns {void} +*/ +function update_effect(effect) { + var flags = effect.f; + if ((flags & 16384) !== 0) return; + set_signal_status(effect, CLEAN); + var previous_effect = active_effect; + var was_updating_effect = is_updating_effect; + active_effect = effect; + is_updating_effect = true; + try { + if ((flags & 16777232) !== 0) destroy_block_effect_children(effect); + else destroy_effect_children(effect); + execute_effect_teardown(effect); + var teardown = update_reaction(effect); + effect.teardown = typeof teardown === "function" ? teardown : null; + effect.wv = write_version; + } finally { + is_updating_effect = was_updating_effect; + active_effect = previous_effect; + } +} +/** +* @template V +* @param {Value} signal +* @returns {V} +*/ +function get(signal) { + var is_derived = (signal.f & 2) !== 0; + captured_signals?.add(signal); + if (active_reaction !== null && !untracking) { + if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) { + var deps = active_reaction.deps; + if ((active_reaction.f & 2097152) !== 0) { + if (signal.rv < read_version) { + signal.rv = read_version; + if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++; + else if (new_deps === null) new_deps = [signal]; + else new_deps.push(signal); + } + } else { + active_reaction.deps ??= []; + if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal); + var reactions = signal.reactions; + if (reactions === null) signal.reactions = [active_reaction]; + else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction); + } + } + } + if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal); + if (is_derived) { + var derived = signal; + if (is_destroying_effect) { + var value = derived.v; + if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived); + old_values.set(derived, value); + return value; + } + var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0); + var is_new = (derived.f & REACTION_RAN) === 0; + if (is_dirty(derived)) { + if (should_connect) derived.f |= 512; + update_derived(derived); + } + if (should_connect && !is_new) { + unfreeze_derived_effects(derived); + reconnect(derived); + } + } + if (batch_values?.has(signal)) return batch_values.get(signal); + if ((signal.f & 8388608) !== 0) throw signal.v; + return signal.v; +} +/** +* (Re)connect a disconnected derived, so that it is notified +* of changes in `mark_reactions` +* @param {Derived} derived +*/ +function reconnect(derived) { + derived.f |= 512; + if (derived.deps === null) return; + for (const dep of derived.deps) { + (dep.reactions ??= []).push(derived); + if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) { + unfreeze_derived_effects(dep); + reconnect(dep); + } + } +} +/** @param {Derived} derived */ +function depends_on_old_values(derived) { + if (derived.v === UNINITIALIZED) return true; + if (derived.deps === null) return false; + for (const dep of derived.deps) { + if (old_values.has(dep)) return true; + if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true; + } + return false; +} +/** +* When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect), +* any state read inside `fn` will not be treated as a dependency. +* +* ```ts +* $effect(() => { +* // this will run when `data` changes, but not when `time` changes +* save(data, { +* timestamp: untrack(() => time) +* }); +* }); +* ``` +* @template T +* @param {() => T} fn +* @returns {T} +*/ +function untrack(fn) { + var previous_untracking = untracking; + try { + untracking = true; + return fn(); + } finally { + untracking = previous_untracking; + } +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/store/shared/index.js +/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */ +/** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */ +/** +* @type {Array | any>} +*/ +var subscriber_queue = []; +/** +* Creates a `Readable` store that allows reading by subscription. +* +* @template T +* @param {T} [value] initial value +* @param {StartStopNotifier} [start] +* @returns {Readable} +*/ +function readable(value, start) { + return { subscribe: writable(value, start).subscribe }; +} +/** +* Create a `Writable` store that allows both updating and reading by subscription. +* +* @template T +* @param {T} [value] initial value +* @param {StartStopNotifier} [start] +* @returns {Writable} +*/ +function writable(value, start = noop) { + /** @type {Unsubscriber | null} */ + let stop = null; + /** @type {Set>} */ + const subscribers = /* @__PURE__ */ new Set(); + /** + * @param {T} new_value + * @returns {void} + */ + 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; + } + } + } + } + /** + * @param {Updater} fn + * @returns {void} + */ + function update(fn) { + set(fn(value)); + } + /** + * @param {Subscriber} run + * @param {() => void} [invalidate] + * @returns {Unsubscriber} + */ + function subscribe(run, invalidate = noop) { + /** @type {SubscribeInvalidateTuple} */ + const subscriber = [run, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) stop = start(set, update) || noop; + run(value); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0 && stop) { + stop(); + stop = null; + } + }; + } + return { + set, + update, + subscribe + }; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/utils.js +/** +* Attributes that are boolean, i.e. they are present or not present. +*/ +var DOM_BOOLEAN_ATTRIBUTES = [ + "allowfullscreen", + "async", + "autofocus", + "autoplay", + "checked", + "controls", + "default", + "disabled", + "formnovalidate", + "indeterminate", + "inert", + "ismap", + "loop", + "multiple", + "muted", + "nomodule", + "novalidate", + "open", + "playsinline", + "readonly", + "required", + "reversed", + "seamless", + "selected", + "webkitdirectory", + "defer", + "disablepictureinpicture", + "disableremoteplayback" +]; +/** +* Returns `true` if `name` is a boolean attribute +* @param {string} name +*/ +function is_boolean_attribute(name) { + return DOM_BOOLEAN_ATTRIBUTES.includes(name); +} +[...DOM_BOOLEAN_ATTRIBUTES]; +/** +* Subset of delegated events which should be passive by default. +* These two are already passive via browser defaults on window, document and body. +* But since +* - we're delegating them +* - they happen often +* - they apply to mobile which is generally less performant +* we're marking them as passive by default for other elements, too. +*/ +var PASSIVE_EVENTS = ["touchstart", "touchmove"]; +/** +* Returns `true` if `name` is a passive event +* @param {string} name +*/ +function is_passive_event(name) { + return PASSIVE_EVENTS.includes(name); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/escaping.js +var ATTR_REGEX = /[&"<]/g; +var CONTENT_REGEX = /[&<]/g; +/** +* @template V +* @param {V} value +* @param {boolean} [is_attr] +*/ +function escape_html(value, is_attr) { + const str = String(value ?? ""); + const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX; + pattern.lastIndex = 0; + let escaped = ""; + let last = 0; + while (pattern.test(str)) { + const i = pattern.lastIndex - 1; + const ch = str[i]; + escaped += str.substring(last, i) + (ch === "&" ? "&" : ch === "\"" ? """ : "<"); + last = i + 1; + } + return escaped + str.substring(last); +} +//#endregion +//#region ../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs +function r(e) { + var t, f, n = ""; + if ("string" == typeof e || "number" == typeof e) n += e; + else if ("object" == typeof e) if (Array.isArray(e)) { + var o = e.length; + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); + } else for (f in e) e[f] && (n && (n += " "), n += f); + return n; +} +function clsx$1() { + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); + return n; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/shared/attributes.js +/** +* `
` should be rendered as `
` and _not_ +* `
`, which is equivalent to `
`. There +* may be other odd cases that need to be added to this list in future +* @type {Record>} +*/ +var replacements = { translate: new Map([[true, "yes"], [false, "no"]]) }; +/** +* @template V +* @param {string} name +* @param {V} value +* @param {boolean} [is_boolean] +* @returns {string} +*/ +function attr(name, value, is_boolean = false) { + if (name === "hidden" && value !== "until-found") is_boolean = true; + if (value == null || !value && is_boolean) return ""; + const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value; + return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`; +} +/** +* Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values. +* TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does) +* @param {any} value +*/ +function clsx(value) { + if (typeof value === "object") return clsx$1(value); + else return value ?? ""; +} +var whitespace = [..." \n\r\f\xA0\v"]; +/** +* @param {any} value +* @param {string | null} [hash] +* @param {Record} [directives] +* @returns {string | null} +*/ +function to_class(value, hash, directives) { + var classname = value == null ? "" : "" + value; + if (hash) classname = classname ? classname + " " + hash : hash; + if (directives) { + for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key; + else if (classname.length) { + var len = key.length; + var a = 0; + while ((a = classname.indexOf(key, a)) >= 0) { + var b = a + len; + if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1); + else a = b; + } + } + } + return classname === "" ? null : classname; +} +/** +* +* @param {Record} styles +* @param {boolean} important +*/ +function append_styles(styles, important = false) { + var separator = important ? " !important;" : ";"; + var css = ""; + for (var key of Object.keys(styles)) { + var value = styles[key]; + if (value != null && value !== "") css += " " + key + ": " + value + separator; + } + return css; +} +/** +* @param {string} name +* @returns {string} +*/ +function to_css_name(name) { + if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase(); + return name; +} +/** +* @param {any} value +* @param {Record | [Record, Record]} [styles] +* @returns {string | null} +*/ +function to_style(value, styles) { + if (styles) { + var new_style = ""; + /** @type {Record | undefined} */ + var normal_styles; + /** @type {Record | undefined} */ + var important_styles; + if (Array.isArray(styles)) { + normal_styles = styles[0]; + important_styles = styles[1]; + } else normal_styles = styles; + if (value) { + value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim(); + /** @type {boolean | '"' | "'"} */ + var in_str = false; + var in_apo = 0; + var in_comment = false; + var reserved_names = []; + if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name)); + if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name)); + var start_index = 0; + var name_index = -1; + const len = value.length; + for (var i = 0; i < len; i++) { + var c = value[i]; + if (in_comment) { + if (c === "/" && value[i - 1] === "*") in_comment = false; + } else if (in_str) { + if (in_str === c) in_str = false; + } else if (c === "/" && value[i + 1] === "*") in_comment = true; + else if (c === "\"" || c === "'") in_str = c; + else if (c === "(") in_apo++; + else if (c === ")") in_apo--; + if (!in_comment && in_str === false && in_apo === 0) { + if (c === ":" && name_index === -1) name_index = i; + else if (c === ";" || i === len - 1) { + if (name_index !== -1) { + var name = to_css_name(value.substring(start_index, name_index).trim()); + if (!reserved_names.includes(name)) { + if (c !== ";") i++; + var property = value.substring(start_index, i).trim(); + new_style += " " + property + ";"; + } + } + start_index = i + 1; + name_index = -1; + } + } + } + } + if (normal_styles) new_style += append_styles(normal_styles); + if (important_styles) new_style += append_styles(important_styles, true); + new_style = new_style.trim(); + return new_style === "" ? null : new_style; + } + return value == null ? null : String(value); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/hydration.js +var BLOCK_OPEN = ``; +var BLOCK_CLOSE = ``; +var EMPTY_COMMENT = ``; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/abort-signal.js +/** @type {AbortController | null} */ +var controller = null; +function abort() { + controller?.abort(STALE_REACTION); + controller = null; +} +function getAbortSignal() { + return (controller ??= new AbortController()).signal; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/errors.js +/** +* The node API `AsyncLocalStorage` is not available, but is required to use async server rendering. +* @returns {never} +*/ +function async_local_storage_unavailable() { + const error = /* @__PURE__ */ new Error(`async_local_storage_unavailable\nThe node API \`AsyncLocalStorage\` is not available, but is required to use async server rendering.\nhttps://svelte.dev/e/async_local_storage_unavailable`); + error.name = "Svelte error"; + throw error; +} +/** +* Encountered asynchronous work while rendering synchronously. +* @returns {never} +*/ +function await_invalid() { + const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`); + error.name = "Svelte error"; + throw error; +} +/** +* The `html` property of server render results has been deprecated. Use `body` instead. +* @returns {never} +*/ +function html_deprecated() { + const error = /* @__PURE__ */ new Error(`html_deprecated\nThe \`html\` property of server render results has been deprecated. Use \`body\` instead.\nhttps://svelte.dev/e/html_deprecated`); + error.name = "Svelte error"; + throw error; +} +/** +* Attempted to set `hydratable` with key `%key%` twice with different values. +* +* %stack% +* @param {string} key +* @param {string} stack +* @returns {never} +*/ +function hydratable_clobbering(key, stack) { + const error = /* @__PURE__ */ new Error(`hydratable_clobbering\nAttempted to set \`hydratable\` with key \`${key}\` twice with different values. + +${stack}\nhttps://svelte.dev/e/hydratable_clobbering`); + error.name = "Svelte error"; + throw error; +} +/** +* Failed to serialize `hydratable` data for key `%key%`. +* +* `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises. +* +* Cause: +* %stack% +* @param {string} key +* @param {string} stack +* @returns {never} +*/ +function hydratable_serialization_failed(key, stack) { + const error = /* @__PURE__ */ new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data for key \`${key}\`. + +\`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises. + +Cause: +${stack}\nhttps://svelte.dev/e/hydratable_serialization_failed`); + error.name = "Svelte error"; + throw error; +} +/** +* `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously. +* @returns {never} +*/ +function invalid_csp() { + const error = /* @__PURE__ */ new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`); + error.name = "Svelte error"; + throw error; +} +/** +* The `idPrefix` option cannot include `--`. +* @returns {never} +*/ +function invalid_id_prefix() { + const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`); + error.name = "Svelte error"; + throw error; +} +/** +* `%name%(...)` is not available on the server +* @param {string} name +* @returns {never} +*/ +function lifecycle_function_unavailable(name) { + const error = /* @__PURE__ */ new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`); + error.name = "Svelte error"; + throw error; +} +/** +* Could not resolve `render` context. +* @returns {never} +*/ +function server_context_required() { + const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`); + error.name = "Svelte error"; + throw error; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/context.js +/** @import { SSRContext } from '#server' */ +/** @type {SSRContext | null} */ +var ssr_context = null; +/** @param {SSRContext | null} v */ +function set_ssr_context(v) { + ssr_context = v; +} +/** +* @template T +* @returns {[() => T, (context: T) => T]} +* @since 5.40.0 +*/ +function createContext() { + const key = {}; + return [() => { + if (!hasContext(key)) missing_context(); + return getContext(key); + }, (context) => setContext(key, context)]; +} +/** +* @template T +* @param {any} key +* @returns {T} +*/ +function getContext(key) { + return get_or_init_context_map("getContext").get(key); +} +/** +* @template T +* @param {any} key +* @param {T} context +* @returns {T} +*/ +function setContext(key, context) { + get_or_init_context_map("setContext").set(key, context); + return context; +} +/** +* @param {any} key +* @returns {boolean} +*/ +function hasContext(key) { + return get_or_init_context_map("hasContext").has(key); +} +/** @returns {Map} */ +function getAllContexts() { + return get_or_init_context_map("getAllContexts"); +} +/** +* @param {string} name +* @returns {Map} +*/ +function get_or_init_context_map(name) { + if (ssr_context === null) lifecycle_outside_component(name); + return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0); +} +/** +* @param {Function} [fn] +*/ +function push(fn) { + ssr_context = { + p: ssr_context, + c: null, + r: null + }; +} +function pop() { + ssr_context = ssr_context.p; +} +/** +* @param {SSRContext} ssr_context +* @returns {Map | null} +*/ +function get_parent_context(ssr_context) { + let parent = ssr_context.p; + while (parent !== null) { + const context_map = parent.c; + if (context_map !== null) return context_map; + parent = parent.p; + } + return null; +} +/** +* A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render. +* +* The `hydratable` was initialized in: +* %stack% +* @param {string} key +* @param {string} stack +*/ +function unresolved_hydratable(key, stack) { + console.warn(`https://svelte.dev/e/unresolved_hydratable`); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/render-context.js +/** @import { AsyncLocalStorage } from 'node:async_hooks' */ +/** @import { RenderContext } from '#server' */ +/** @type {Promise | null} */ +var current_render = null; +/** @type {RenderContext | null} */ +var context = null; +/** @returns {RenderContext} */ +function get_render_context() { + const store = context ?? als?.getStore(); + if (!store) server_context_required(); + return store; +} +/** +* @template T +* @param {() => Promise} fn +* @returns {Promise} +*/ +async function with_render_context(fn) { + context = { hydratable: { + lookup: /* @__PURE__ */ new Map(), + comparisons: [], + unresolved_promises: /* @__PURE__ */ new Map() + } }; + if (in_webcontainer()) { + const { promise, resolve } = deferred(); + const previous_render = current_render; + current_render = promise; + await previous_render; + return fn().finally(resolve); + } + try { + if (als === null) async_local_storage_unavailable(); + return als.run(context, fn); + } finally { + context = null; + } +} +/** @type {AsyncLocalStorage | null} */ +var als = null; +/** @type {Promise | null} */ +var als_import = null; +/** +* +* @returns {Promise} +*/ +function init_render_context() { + als_import ??= import("node:async_hooks").then((hooks) => { + als = new hooks.AsyncLocalStorage(); + }).then(noop, noop); + return als_import; +} +function in_webcontainer() { + return !!globalThis.process?.versions?.webcontainer; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/crypto.js +var text_encoder; +var crypto; +/** @param {string} module_name */ +var obfuscated_import = (module_name) => import( + /* @vite-ignore */ + module_name +); +/** @param {string} data */ +async function sha256(data) { + text_encoder ??= new TextEncoder(); + crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto; + return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data))); +} +/** +* @param {Uint8Array} bytes +* @returns {string} +*/ +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); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/renderer.js +/** @import { Component } from 'svelte' */ +/** @import { Csp, HydratableContext, RenderOutput, SSRContext, SyncRenderOutput, Sha256Source } from './types.js' */ +/** @import { MaybePromise } from '#shared' */ +/** @typedef {'head' | 'body'} RendererType */ +/** @typedef {{ [key in RendererType]: string }} AccumulatedContent */ +/** +* @typedef {string | Renderer} RendererItem +*/ +/** +* Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents +* work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the +* content from itself and all of its children, but this will throw if any of the children are +* performing asynchronous work. To asynchronously collect a renderer, just `await` it. +* +* The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types, +* call {@link child} with a different `type` argument. +*/ +var Renderer = class Renderer { + /** + * The contents of the renderer. + * @type {RendererItem[]} + */ + #out = []; + /** + * Any `onDestroy` callbacks registered during execution of this renderer. + * @type {(() => void)[] | undefined} + */ + #on_destroy = void 0; + /** + * Whether this renderer is a component body. + * @type {boolean} + */ + #is_component_body = false; + /** + * If set, this renderer is an error boundary. When async collection + * of the children fails, the failed snippet is rendered instead. + * @type {{ + * failed: (renderer: Renderer, error: unknown, reset: () => void) => void; + * transformError: (error: unknown) => unknown; + * context: SSRContext | null; + * } | null} + */ + #boundary = null; + /** + * The type of string content that this renderer is accumulating. + * @type {RendererType} + */ + type; + /** @type {Renderer | undefined} */ + #parent; + /** + * Asynchronous work associated with this renderer + * @type {Promise | undefined} + */ + promise = void 0; + /** + * State which is associated with the content tree as a whole. + * It will be re-exposed, uncopied, on all children. + * @type {SSRState} + * @readonly + */ + global; + /** + * State that is local to the branch it is declared in. + * It will be shallow-copied to all children. + * + * @type {{ select_value: string | undefined }} + */ + local; + /** + * @param {SSRState} global + * @param {Renderer | undefined} [parent] + */ + constructor(global, parent) { + this.#parent = parent; + this.global = global; + this.local = parent ? { ...parent.local } : { select_value: void 0 }; + this.type = parent ? parent.type : "body"; + } + /** + * @param {(renderer: Renderer) => void} fn + */ + head(fn) { + const head = new Renderer(this.global, this); + head.type = "head"; + this.#out.push(head); + head.child(fn); + } + /** + * @param {Array>} blockers + * @param {(renderer: Renderer) => void} fn + */ + async_block(blockers, fn) { + this.#out.push(BLOCK_OPEN); + this.async(blockers, fn); + this.#out.push(BLOCK_CLOSE); + } + /** + * @param {Array>} blockers + * @param {(renderer: Renderer) => void} fn + */ + async(blockers, fn) { + let callback = fn; + if (blockers.length > 0) { + const context = ssr_context; + callback = (renderer) => { + return Promise.all(blockers).then(() => { + const previous_context = ssr_context; + try { + set_ssr_context(context); + return fn(renderer); + } finally { + set_ssr_context(previous_context); + } + }); + }; + } + this.child(callback); + } + /** + * @param {Array<() => void>} thunks + */ + run(thunks) { + const context = ssr_context; + let promise = Promise.resolve(thunks[0]()); + const promises = [promise]; + for (const fn of thunks.slice(1)) { + promise = promise.then(() => { + const previous_context = ssr_context; + set_ssr_context(context); + try { + return fn(); + } finally { + set_ssr_context(previous_context); + } + }); + promises.push(promise); + } + promise.catch(noop); + this.promise = promise; + return promises; + } + /** + * @param {(renderer: Renderer) => MaybePromise} fn + */ + child_block(fn) { + this.#out.push(BLOCK_OPEN); + this.child(fn); + this.#out.push(BLOCK_CLOSE); + } + /** + * Create a child renderer. The child renderer inherits the state from the parent, + * but has its own content. + * @param {(renderer: Renderer) => MaybePromise} fn + */ + child(fn) { + const child = new Renderer(this.global, this); + this.#out.push(child); + const parent = ssr_context; + set_ssr_context({ + ...ssr_context, + p: parent, + c: null, + r: child + }); + const result = fn(child); + set_ssr_context(parent); + if (result instanceof Promise) { + result.catch(noop); + result.finally(() => set_ssr_context(null)).catch(noop); + if (child.global.mode === "sync") await_invalid(); + child.promise = result; + } + return child; + } + /** + * Render children inside an error boundary. If the children throw and the API-level + * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is + * rendered instead. Otherwise the error propagates. + * + * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props + * @param {(renderer: Renderer) => MaybePromise} children_fn + */ + boundary(props, children_fn) { + const child = new Renderer(this.global, this); + this.#out.push(child); + const parent_context = ssr_context; + if (props.failed) child.#boundary = { + failed: props.failed, + transformError: this.global.transformError, + context: parent_context + }; + set_ssr_context({ + ...ssr_context, + p: parent_context, + c: null, + r: child + }); + try { + const result = children_fn(child); + set_ssr_context(parent_context); + if (result instanceof Promise) { + if (child.global.mode === "sync") await_invalid(); + result.catch(noop); + child.promise = result; + } + } catch (error) { + set_ssr_context(parent_context); + const failed_snippet = props.failed; + if (!failed_snippet) throw error; + const result = this.global.transformError(error); + child.#out.length = 0; + child.#boundary = null; + if (result instanceof Promise) { + if (this.global.mode === "sync") await_invalid(); + child.promise = result.then((transformed) => { + set_ssr_context(parent_context); + child.#out.push(Renderer.#serialize_failed_boundary(transformed)); + failed_snippet(child, transformed, noop); + child.#out.push(BLOCK_CLOSE); + }); + child.promise.catch(noop); + } else { + child.#out.push(Renderer.#serialize_failed_boundary(result)); + failed_snippet(child, result, noop); + child.#out.push(BLOCK_CLOSE); + } + } + } + /** + * Create a component renderer. The component renderer inherits the state from the parent, + * but has its own content. It is treated as an ordering boundary for ondestroy callbacks. + * @param {(renderer: Renderer) => MaybePromise} fn + * @param {Function} [component_fn] + * @returns {void} + */ + component(fn, component_fn) { + push(component_fn); + const child = this.child(fn); + child.#is_component_body = true; + pop(); + } + /** + * @param {Record} attrs + * @param {(renderer: Renderer) => void} fn + * @param {string | undefined} [css_hash] + * @param {Record | undefined} [classes] + * @param {Record | undefined} [styles] + * @param {number | undefined} [flags] + * @param {boolean | undefined} [is_rich] + * @returns {void} + */ + select(attrs, fn, css_hash, classes, styles, flags, is_rich) { + const { value, ...select_attrs } = attrs; + this.push(``); + this.child((renderer) => { + renderer.local.select_value = value; + fn(renderer); + }); + this.push(`${is_rich ? "" : ""}`); + } + /** + * @param {Record} attrs + * @param {string | number | boolean | ((renderer: Renderer) => void)} body + * @param {string | undefined} [css_hash] + * @param {Record | undefined} [classes] + * @param {Record | undefined} [styles] + * @param {number | undefined} [flags] + * @param {boolean | undefined} [is_rich] + */ + option(attrs, body, css_hash, classes, styles, flags, is_rich) { + this.#out.push(` { + if (has_own_property.call(attrs, "value")) value = attrs.value; + if (value === this.local.select_value) renderer.#out.push(" selected=\"\""); + renderer.#out.push(`>${body}${is_rich ? "" : ""}`); + if (head) renderer.head((child) => child.push(head)); + }; + if (typeof body === "function") this.child((renderer) => { + const r = new Renderer(this.global, this); + body(r); + if (this.global.mode === "async") return r.#collect_content_async().then((content) => { + close(renderer, content.body.replaceAll("", ""), content); + }); + else { + const content = r.#collect_content(); + close(renderer, content.body.replaceAll("", ""), content); + } + }); + else close(this, body, { body: escape_html(body) }); + } + /** + * @param {(renderer: Renderer) => void} fn + */ + title(fn) { + const path = this.get_path(); + /** @param {string} head */ + const close = (head) => { + this.global.set_title(head, path); + }; + this.child((renderer) => { + const r = new Renderer(renderer.global, renderer); + fn(r); + if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => { + close(content.head); + }); + else close(r.#collect_content().head); + }); + } + /** + * @param {string | (() => Promise)} content + */ + push(content) { + if (typeof content === "function") this.child(async (renderer) => renderer.push(await content())); + else this.#out.push(content); + } + /** + * @param {() => void} fn + */ + on_destroy(fn) { + (this.#on_destroy ??= []).push(fn); + } + /** + * @returns {number[]} + */ + get_path() { + return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : []; + } + /** + * @deprecated this is needed for legacy component bindings + */ + copy() { + const copy = new Renderer(this.global, this.#parent); + copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item); + copy.promise = this.promise; + return copy; + } + /** + * @param {Renderer} other + * @deprecated this is needed for legacy component bindings + */ + subsume(other) { + if (this.global.mode !== other.global.mode) throw new Error("invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"); + this.local = other.local; + this.#out = other.#out.map((item, i) => { + const current = this.#out[i]; + if (current instanceof Renderer && item instanceof Renderer) { + current.subsume(item); + return current; + } + return item; + }); + this.promise = other.promise; + this.type = other.type; + } + get length() { + return this.#out.length; + } + /** + * Creates the hydration comment that marks the start of a failed boundary. + * The error is JSON-serialized and embedded inside an HTML comment for the client + * to parse during hydration. The JSON is escaped to prevent `-->` or ``; + } + /** + * Only available on the server and when compiling with the `server` option. + * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app. + * @template {Record} Props + * @param {Component} component + * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp }} [options] + * @returns {RenderOutput} + */ + static render(component, options = {}) { + /** @type {AccumulatedContent | undefined} */ + let sync; + /** @type {Promise | undefined} */ + let async; + const result = {}; + Object.defineProperties(result, { + html: { get: () => { + return (sync ??= Renderer.#render(component, options)).body; + } }, + head: { get: () => { + return (sync ??= Renderer.#render(component, options)).head; + } }, + body: { get: () => { + return (sync ??= Renderer.#render(component, options)).body; + } }, + hashes: { value: { script: "" } }, + then: { value: (onfulfilled, onrejected) => { + if (!async_mode_flag) { + const result = sync ??= Renderer.#render(component, options); + const user_result = onfulfilled({ + head: result.head, + body: result.body, + html: result.body, + hashes: { script: [] } + }); + return Promise.resolve(user_result); + } + async ??= init_render_context().then(() => with_render_context(() => Renderer.#render_async(component, options))); + return async.then((result) => { + Object.defineProperty(result, "html", { get: () => { + html_deprecated(); + } }); + return onfulfilled(result); + }, onrejected); + } } + }); + return result; + } + /** + * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call + * after awaiting `collect_async`. + * + * Child renderers are "porous" and don't affect execution order, but component body renderers + * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary. + * @returns {Iterable<() => void>} + */ + *#collect_on_destroy() { + for (const component of this.#traverse_components()) yield* component.#collect_ondestroy(); + } + /** + * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree. + * @returns {Iterable} + */ + *#traverse_components() { + for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components(); + if (this.#is_component_body) yield this; + } + /** + * @returns {Iterable<() => void>} + */ + *#collect_ondestroy() { + if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn; + for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy(); + } + /** + * Render a component. Throws if any of the children are performing asynchronous work. + * + * @template {Record} Props + * @param {Component} component + * @param {{ props?: Omit; context?: Map; idPrefix?: string }} options + * @returns {AccumulatedContent} + */ + static #render(component, options) { + var previous_context = ssr_context; + try { + const renderer = Renderer.#open_render("sync", component, options); + const content = renderer.#collect_content(); + return Renderer.#close_render(content, renderer); + } finally { + abort(); + set_ssr_context(previous_context); + } + } + /** + * Render a component. + * + * @template {Record} Props + * @param {Component} component + * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp }} options + * @returns {Promise} + */ + static async #render_async(component, options) { + const previous_context = ssr_context; + try { + const renderer = Renderer.#open_render("async", component, options); + const content = await renderer.#collect_content_async(); + const hydratables = await renderer.#collect_hydratables(); + if (hydratables !== null) content.head = hydratables + content.head; + return Renderer.#close_render(content, renderer); + } finally { + set_ssr_context(previous_context); + abort(); + } + } + /** + * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string. + * @param {AccumulatedContent} content + * @returns {AccumulatedContent} + */ + #collect_content(content = { + head: "", + body: "" + }) { + for (const item of this.#out) if (typeof item === "string") content[this.type] += item; + else if (item instanceof Renderer) item.#collect_content(content); + return content; + } + /** + * Collect all of the code from the `out` array and return it as a string. + * @param {AccumulatedContent} content + * @returns {Promise} + */ + async #collect_content_async(content = { + head: "", + body: "" + }) { + await this.promise; + for (const item of this.#out) if (typeof item === "string") content[this.type] += item; + else if (item instanceof Renderer) if (item.#boundary) { + /** @type {AccumulatedContent} */ + const boundary_content = { + head: "", + body: "" + }; + try { + await item.#collect_content_async(boundary_content); + content.head += boundary_content.head; + content.body += boundary_content.body; + } catch (error) { + const { context, failed, transformError } = item.#boundary; + set_ssr_context(context); + let promise = transformError(error); + set_ssr_context(null); + let transformed = await promise; + set_ssr_context(context); + const failed_renderer = new Renderer(item.global, item); + failed_renderer.type = item.type; + failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed)); + failed(failed_renderer, transformed, noop); + failed_renderer.#out.push(BLOCK_CLOSE); + await failed_renderer.#collect_content_async(content); + } + } else await item.#collect_content_async(content); + return content; + } + async #collect_hydratables() { + const ctx = get_render_context().hydratable; + for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? ""); + for (const comparison of ctx.comparisons) await comparison; + return await this.#hydratable_block(ctx); + } + /** + * @template {Record} Props + * @param {'sync' | 'async'} mode + * @param {import('svelte').Component} component + * @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options + * @returns {Renderer} + */ + static #open_render(mode, component, options) { + if (options.idPrefix?.includes("--")) invalid_id_prefix(); + var previous_context = ssr_context; + try { + const renderer = new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError)); + set_ssr_context({ + p: null, + c: options.context ?? null, + r: renderer + }); + renderer.push(BLOCK_OPEN); + component(renderer, options.props ?? {}); + renderer.push(BLOCK_CLOSE); + return renderer; + } finally { + set_ssr_context(previous_context); + } + } + /** + * @param {AccumulatedContent} content + * @param {Renderer} renderer + * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }} + */ + static #close_render(content, renderer) { + for (const cleanup of renderer.#collect_on_destroy()) cleanup(); + let head = content.head + renderer.global.get_title(); + let body = content.body; + for (const { hash, code } of renderer.global.css) head += ``; + return { + head, + body, + hashes: { script: renderer.global.csp.script_hashes } + }; + } + /** + * @param {HydratableContext} ctx + */ + async #hydratable_block(ctx) { + if (ctx.lookup.size === 0) return null; + let entries = []; + let has_promises = false; + for (const [k, v] of ctx.lookup) { + if (v.promises) { + has_promises = true; + for (const p of v.promises) await p; + } + entries.push(`[${uneval(k)},${v.serialized}]`); + } + let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`; + if (has_promises) prelude = `const r = (v) => Promise.resolve(v); + ${prelude}`; + const body = ` + { + ${prelude} + + for (const [k, v] of [ + ${entries.join(",\n ")} + ]) { + h.set(k, v); + } + } + `; + let csp_attr = ""; + if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`; + else if (this.global.csp.hash) { + const hash = await sha256(body); + this.global.csp.script_hashes.push(`sha256-${hash}`); + } + return `\n\t\t${body}<\/script>`; + } +}; +var SSRState = class { + /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */ + csp; + /** @readonly @type {'sync' | 'async'} */ + mode; + /** @readonly @type {() => string} */ + uid; + /** @readonly @type {Set<{ hash: string; code: string }>} */ + css = /* @__PURE__ */ new Set(); + /** + * `transformError` passed to `render`. Called when an error boundary catches an error. + * Throws by default if unset in `render`. + * @type {(error: unknown) => unknown} + */ + transformError; + /** @type {{ path: number[], value: string }} */ + #title = { + path: [], + value: "" + }; + /** + * @param {'sync' | 'async'} mode + * @param {string} id_prefix + * @param {Csp} csp + * @param {((error: unknown) => unknown) | undefined} [transformError] + */ + constructor(mode, id_prefix = "", csp = { hash: false }, transformError) { + this.mode = mode; + this.csp = { + ...csp, + script_hashes: [] + }; + this.transformError = transformError ?? ((error) => { + throw error; + }); + let uid = 1; + this.uid = () => `${id_prefix}s${uid++}`; + } + get_title() { + return this.#title.value; + } + /** + * Performs a depth-first (lexicographic) comparison using the path. Rejects sets + * from earlier than or equal to the current value. + * @param {string} value + * @param {number[]} path + */ + set_title(value, path) { + const current = this.#title.path; + let i = 0; + let l = Math.min(path.length, current.length); + while (i < l && path[i] === current[i]) i += 1; + if (path[i] === void 0) return; + if (current[i] === void 0 || path[i] > current[i]) { + this.#title.path = path; + this.#title.value = value; + } + } +}; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/dev.js +function get_user_code_location() { + return get_stack().filter((line) => line.trim().startsWith("at ")).map((line) => line.replace(/\((.*):\d+:\d+\)$/, (_, file) => `(${file})`)).join("\n"); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/index.js +var INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u; +/** +* Only available on the server and when compiling with the `server` option. +* Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app. +* @template {Record} Props +* @param {Component | ComponentType>} component +* @param {{ props?: Omit; context?: Map; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options] +* @returns {RenderOutput} +*/ +function render(component, options = {}) { + if (options.csp?.hash && options.csp.nonce) invalid_csp(); + return Renderer.render(component, options); +} +/** +* @param {string} hash +* @param {Renderer} renderer +* @param {(renderer: Renderer) => Promise | void} fn +* @returns {void} +*/ +function head(hash, renderer, fn) { + renderer.head((renderer) => { + renderer.push(``); + renderer.child(fn); + renderer.push(EMPTY_COMMENT); + }); +} +/** +* @param {Record} attrs +* @param {string} [css_hash] +* @param {Record} [classes] +* @param {Record} [styles] +* @param {number} [flags] +* @returns {string} +*/ +function attributes(attrs, css_hash, classes, styles, flags = 0) { + if (styles) attrs.style = to_style(attrs.style, styles); + if (attrs.class) attrs.class = clsx(attrs.class); + if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes); + let attr_str = ""; + let name; + const is_html = (flags & 1) === 0; + const lowercase = (flags & 2) === 0; + const is_input = (flags & 4) !== 0; + for (name of Object.keys(attrs)) { + if (typeof attrs[name] === "function") continue; + if (name[0] === "$" && name[1] === "$") continue; + if (name === "" || INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue; + var value = attrs[name]; + var lower = name.toLowerCase(); + if (lowercase) name = lower; + if (lower.length > 2 && lower.startsWith("on")) continue; + if (is_input) { + if (name === "defaultvalue" || name === "defaultchecked") { + name = name === "defaultvalue" ? "value" : "checked"; + if (attrs[name]) continue; + } + } + attr_str += attr(name, value, is_html && is_boolean_attribute(name)); + } + return attr_str; +} +/** +* @template V +* @param {() => V} get_value +*/ +function once(get_value) { + let value = UNINITIALIZED; + return () => { + if (value === UNINITIALIZED) value = get_value(); + return value; + }; +} +/** +* @template T +* @param {()=>T} fn +* @returns {(new_value?: T) => (T | void)} +*/ +function derived(fn) { + const get_value = ssr_context === null ? fn : once(fn); + /** @type {T | undefined} */ + let updated_value; + return function(new_value) { + if (arguments.length === 0) return updated_value ?? get_value(); + updated_value = new_value; + return updated_value; + }; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/flags/async.js +enable_async_mode_flag(); +//#endregion +export { define_property as $, get_next_sibling as A, hydrate_node as B, get as C, clear_text_content as D, component_root as E, boundary as F, lifecycle_double_unmount as G, set_hydrate_node as H, component_context as I, hydration_failed as J, state_proxy_unmount as K, pop$1 as L, mutable_source as M, set as N, create_text as O, flushSync as P, array_from as Q, push$1 as R, active_reaction as S, set_active_reaction as T, set_hydrating as U, hydrating as V, hydration_mismatch as W, LEGACY_PROPS as X, experimental_async_required as Y, STATE_SYMBOL as Z, escape_html as _, get_render_context as a, writable as b, getContext as c, ssr_context as d, noop as et, hydratable_clobbering as f, attr as g, getAbortSignal as h, get_user_code_location as i, init_operations as j, get_first_child as k, hasContext as l, lifecycle_function_unavailable as m, head as n, createContext as o, hydratable_serialization_failed as p, HYDRATION_ERROR as q, render as r, getAllContexts as s, derived as t, run as tt, setContext as u, is_passive_event as v, set_active_effect as w, active_effect as x, readable as y, async_mode_flag as z }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/exports.js b/frontend/.svelte-kit/adapter-node/chunks/exports.js new file mode 100644 index 0000000..694e3b0 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/exports.js @@ -0,0 +1,370 @@ +import "./async.js"; +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/array.js +/** +* Removes nullish values from an array. +* +* @template T +* @param {Array} arr +*/ +function compact(arr) { + return arr.filter( + /** @returns {val is NonNullable} */ + (val) => val != null + ); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/pathname.js +var DATA_SUFFIX = "/__data.json"; +var HTML_DATA_SUFFIX = ".html__data.json"; +/** @param {string} pathname */ +function has_data_suffix(pathname) { + return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX); +} +/** @param {string} pathname */ +function add_data_suffix(pathname) { + if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX); + return pathname.replace(/\/$/, "") + DATA_SUFFIX; +} +/** @param {string} pathname */ +function strip_data_suffix(pathname) { + if (pathname.endsWith(HTML_DATA_SUFFIX)) return pathname.slice(0, -16) + ".html"; + return pathname.slice(0, -12); +} +var ROUTE_SUFFIX = "/__route.js"; +/** +* @param {string} pathname +* @returns {boolean} +*/ +function has_resolution_suffix(pathname) { + return pathname.endsWith(ROUTE_SUFFIX); +} +/** +* Convert a regular URL to a route to send to SvelteKit's server-side route resolution endpoint +* @param {string} pathname +* @returns {string} +*/ +function add_resolution_suffix(pathname) { + return pathname.replace(/\/$/, "") + ROUTE_SUFFIX; +} +/** +* @param {string} pathname +* @returns {string} +*/ +function strip_resolution_suffix(pathname) { + return pathname.slice(0, -11); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/telemetry/noop.js +/** +* @type {Span} +*/ +var noop_span = { + spanContext() { + return noop_span_context; + }, + setAttribute() { + return this; + }, + setAttributes() { + return this; + }, + addEvent() { + return this; + }, + setStatus() { + return this; + }, + updateName() { + return this; + }, + end() { + return this; + }, + isRecording() { + return false; + }, + recordException() { + return this; + }, + addLink() { + return this; + }, + addLinks() { + return this; + } +}; +/** +* @type {SpanContext} +*/ +var noop_span_context = { + traceId: "", + spanId: "", + traceFlags: 0 +}; +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/url.js +/** +* Matches a URI scheme. See https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +* @type {RegExp} +*/ +var SCHEME = /^[a-z][a-z\d+\-.]+:/i; +var internal = new URL("a://"); +/** +* @param {string} base +* @param {string} path +*/ +function resolve(base, path) { + if (path[0] === "/" && path[1] === "/") return path; + let url = new URL(base, internal); + url = new URL(path, url); + return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href; +} +/** +* @param {string} path +* @param {import('types').TrailingSlash} trailing_slash +*/ +function normalize_path(path, trailing_slash) { + if (path === "/" || trailing_slash === "ignore") return path; + if (trailing_slash === "never") return path.endsWith("/") ? path.slice(0, -1) : path; + else if (trailing_slash === "always" && !path.endsWith("/")) return path + "/"; + return path; +} +/** +* Decode pathname excluding %25 to prevent further double decoding of params +* @param {string} pathname +*/ +function decode_pathname(pathname) { + return pathname.split("%25").map(decodeURI).join("%25"); +} +/** @param {Record} params */ +function decode_params(params) { + for (const key in params) params[key] = decodeURIComponent(params[key]); + return params; +} +/** +* @param {URL} url +* @param {() => void} callback +* @param {(search_param: string) => void} search_params_callback +* @param {boolean} [allow_hash] +*/ +function make_trackable(url, callback, search_params_callback, allow_hash = false) { + const tracked = new URL(url); + Object.defineProperty(tracked, "searchParams", { + value: new Proxy(tracked.searchParams, { get(obj, key) { + if (key === "get" || key === "getAll" || key === "has") return (param, ...rest) => { + search_params_callback(param); + return obj[key](param, ...rest); + }; + callback(); + const value = Reflect.get(obj, key); + return typeof value === "function" ? value.bind(obj) : value; + } }), + enumerable: true, + configurable: true + }); + /** + * URL properties that could change during the lifetime of the page, + * which excludes things like `origin` + */ + const tracked_url_properties = [ + "href", + "pathname", + "search", + "toString", + "toJSON" + ]; + if (allow_hash) tracked_url_properties.push("hash"); + for (const property of tracked_url_properties) Object.defineProperty(tracked, property, { + get() { + callback(); + return url[property]; + }, + enumerable: true, + configurable: true + }); + tracked[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => { + return inspect(url, opts); + }; + tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => { + return inspect(url.searchParams, opts); + }; + if (!allow_hash) disable_hash(tracked); + return tracked; +} +/** +* Disallow access to `url.hash` on the server and in `load` +* @param {URL} url +*/ +function disable_hash(url) { + allow_nodejs_console_log(url); + Object.defineProperty(url, "hash", { get() { + throw new Error("Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead"); + } }); +} +/** +* Disallow access to `url.search` and `url.searchParams` during prerendering +* @param {URL} url +*/ +function disable_search(url) { + allow_nodejs_console_log(url); + for (const property of ["search", "searchParams"]) Object.defineProperty(url, property, { get() { + throw new Error(`Cannot access url.${property} on a page with prerendering enabled`); + } }); +} +/** +* Allow URL to be console logged, bypassing disabled properties. +* @param {URL} url +*/ +function allow_nodejs_console_log(url) { + url[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => { + return inspect(new URL(url), opts); + }; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/hash.js +/** +* Hash using djb2 +* @param {import('types').StrictBody[]} values +*/ +function hash(...values) { + let hash = 5381; + for (const value of values) if (typeof value === "string") { + let i = value.length; + while (i) hash = hash * 33 ^ value.charCodeAt(--i); + } else if (ArrayBuffer.isView(value)) { + const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength); + let i = buffer.length; + while (i) hash = hash * 33 ^ buffer[--i]; + } else throw new TypeError("value must be a string or TypedArray"); + return (hash >>> 0).toString(36); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/routing.js +/** +* @param {RegExpMatchArray} match +* @param {import('types').RouteParam[]} params +* @param {Record} matchers +*/ +function exec(match, params, matchers) { + /** @type {Record} */ + const result = {}; + const values = match.slice(1); + const values_needing_match = values.filter((value) => value !== void 0); + let buffered = 0; + for (let i = 0; i < params.length; i += 1) { + const param = params[i]; + let value = values[i - buffered]; + if (param.chained && param.rest && buffered) { + value = values.slice(i - buffered, i + 1).filter((s) => s).join("/"); + buffered = 0; + } + if (value === void 0) if (param.rest) value = ""; + else continue; + if (!param.matcher || matchers[param.matcher](value)) { + result[param.name] = value; + const next_param = params[i + 1]; + const next_value = values[i + 1]; + if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0; + if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0; + continue; + } + if (param.optional && param.chained) { + buffered++; + continue; + } + return; + } + if (buffered) return; + return result; +} +/** +* Find the first route that matches the given path +* @template {{pattern: RegExp, params: import('types').RouteParam[]}} Route +* @param {string} path - The decoded pathname to match +* @param {Route[]} routes +* @param {Record} matchers +* @returns {{ route: Route, params: Record } | null} +*/ +function find_route(path, routes, matchers) { + for (const route of routes) { + const match = route.pattern.exec(path); + if (!match) continue; + const matched = exec(match, route.params, matchers); + if (matched) return { + route, + params: decode_params(matched) + }; + } + return null; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/exports.js +/** +* @param {Set} expected +*/ +function validator(expected) { + /** + * @param {any} module + * @param {string} [file] + */ + function validate(module, file) { + if (!module) return; + for (const key in module) { + if (key[0] === "_" || expected.has(key)) continue; + const values = [...expected.values()]; + const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`; + throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`); + } + } + return validate; +} +/** +* @param {string} key +* @param {string} ext +* @returns {string | void} +*/ +function hint_for_supported_files(key, ext = ".js") { + const supported_files = []; + if (valid_layout_exports.has(key)) supported_files.push(`+layout${ext}`); + if (valid_page_exports.has(key)) supported_files.push(`+page${ext}`); + if (valid_layout_server_exports.has(key)) supported_files.push(`+layout.server${ext}`); + if (valid_page_server_exports.has(key)) supported_files.push(`+page.server${ext}`); + if (valid_server_exports.has(key)) supported_files.push(`+server${ext}`); + if (supported_files.length > 0) return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`; +} +var valid_layout_exports = new Set([ + "load", + "prerender", + "csr", + "ssr", + "trailingSlash", + "config" +]); +var valid_page_exports = new Set([...valid_layout_exports, "entries"]); +var valid_layout_server_exports = new Set([...valid_layout_exports]); +var valid_page_server_exports = new Set([ + ...valid_layout_server_exports, + "actions", + "entries" +]); +var valid_server_exports = new Set([ + "GET", + "POST", + "PATCH", + "PUT", + "DELETE", + "OPTIONS", + "HEAD", + "fallback", + "prerender", + "trailingSlash", + "config", + "entries" +]); +var validate_layout_exports = validator(valid_layout_exports); +var validate_page_exports = validator(valid_page_exports); +var validate_layout_server_exports = validator(valid_layout_server_exports); +var validate_page_server_exports = validator(valid_page_server_exports); +var validate_server_exports = validator(valid_server_exports); +//#endregion +export { has_data_suffix as _, validate_server_exports as a, strip_resolution_suffix as b, SCHEME as c, make_trackable as d, normalize_path as f, add_resolution_suffix as g, add_data_suffix as h, validate_page_server_exports as i, decode_pathname as l, noop_span as m, validate_layout_server_exports as n, find_route as o, resolve as p, validate_page_exports as r, hash as s, validate_layout_exports as t, disable_search as u, has_resolution_suffix as v, compact as x, strip_data_suffix as y }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/internal.js b/frontend/.svelte-kit/adapter-node/chunks/internal.js new file mode 100644 index 0000000..390f72e --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/internal.js @@ -0,0 +1,749 @@ +import "./internal2.js"; +import { t as uneval } from "./uneval.js"; +import { $ as define_property, A as get_next_sibling, B as hydrate_node, C as get, D as clear_text_content, E as component_root, F as boundary, H as set_hydrate_node, I as component_context, J as hydration_failed, L as pop, M as mutable_source, N as set, O as create_text, P as flushSync, Q as array_from, R as push, S as active_reaction, T as set_active_reaction, U as set_hydrating, V as hydrating, W as hydration_mismatch, X as LEGACY_PROPS, Y as experimental_async_required, a as get_render_context, c as getContext, d as ssr_context, et as noop, h as getAbortSignal, j as init_operations, k as get_first_child, l as hasContext, m as lifecycle_function_unavailable, o as createContext, p as hydratable_serialization_failed, q as HYDRATION_ERROR, r as render, s as getAllContexts, t as derived, tt as run, u as setContext, v as is_passive_event, w as set_active_effect, x as active_effect, z as async_mode_flag } from "./async.js"; +//#region \0rolldown/runtime.js +var __defProp = Object.defineProperty; +var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); +var __exportAll = (all, no_symbols) => { + let target = {}; + for (var name in all) __defProp(target, name, { + get: all[name], + enumerable: true + }); + if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); + return target; +}; +//#endregion +//#region \0virtual:__sveltekit/env +var explicit_public_env = {}; +var rendered_env = {}; +function set_env(env) {} +//#endregion +//#region \0virtual:__sveltekit/server +var read_implementation = null; +function set_read_implementation(fn) { + read_implementation = fn; +} +function set_manifest(_) {} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/elements/events.js +/** +* Used on elements, as a map of event type -> event handler, +* and on events themselves to track which element handled an event +*/ +var event_symbol = Symbol("events"); +/** @type {Set} */ +var all_registered_events = /* @__PURE__ */ new Set(); +/** @type {Set<(events: Array) => void>} */ +var root_event_handles = /* @__PURE__ */ new Set(); +var last_propagated_event = null; +/** +* @this {EventTarget} +* @param {Event} event +* @returns {void} +*/ +function handle_event_propagation(event) { + var handler_element = this; + var owner_document = handler_element.ownerDocument; + var event_name = event.type; + var path = event.composedPath?.() || []; + var current_target = path[0] || event.target; + last_propagated_event = event; + var path_idx = 0; + var handled_at = last_propagated_event === event && event[event_symbol]; + if (handled_at) { + var at_idx = path.indexOf(handled_at); + if (at_idx !== -1 && (handler_element === document || handler_element === window)) { + event[event_symbol] = handler_element; + return; + } + var handler_idx = path.indexOf(handler_element); + if (handler_idx === -1) return; + if (at_idx <= handler_idx) path_idx = at_idx; + } + current_target = path[path_idx] || event.target; + if (current_target === handler_element) return; + define_property(event, "currentTarget", { + configurable: true, + get() { + return current_target || owner_document; + } + }); + var previous_reaction = active_reaction; + var previous_effect = active_effect; + set_active_reaction(null); + set_active_effect(null); + try { + /** + * @type {unknown} + */ + var throw_error; + /** + * @type {unknown[]} + */ + var other_errors = []; + while (current_target !== null) { + if (current_target === handler_element) break; + try { + var delegated = current_target[event_symbol]?.[event_name]; + if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event); + } catch (error) { + if (throw_error) other_errors.push(error); + else throw_error = error; + } + if (event.cancelBubble) break; + path_idx++; + current_target = path_idx < path.length ? path[path_idx] : null; + } + if (throw_error) { + for (let error of other_errors) queueMicrotask(() => { + throw error; + }); + throw throw_error; + } + } finally { + event[event_symbol] = handler_element; + delete event.currentTarget; + set_active_reaction(previous_reaction); + set_active_effect(previous_effect); + } +} +globalThis?.window?.trustedTypes; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/client/dom/template.js +/** +* @param {TemplateNode} start +* @param {TemplateNode | null} end +*/ +function assign_nodes(start, end) { + var effect = active_effect; + if (effect.nodes === null) effect.nodes = { + start, + end, + a: null, + t: null + }; +} +/** +* Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component. +* Transitions will play during the initial render unless the `intro` option is set to `false`. +* +* @template {Record} Props +* @template {Record} Exports +* @param {ComponentType> | Component} component +* @param {MountOptions} options +* @returns {Exports} +*/ +function mount$1(component, options) { + return _mount(component, options); +} +/** +* Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component +* +* @template {Record} Props +* @template {Record} Exports +* @param {ComponentType> | Component} component +* @param {{} extends Props ? { +* target: Document | Element | ShadowRoot; +* props?: Props; +* events?: Record any>; +* context?: Map; +* intro?: boolean; +* recover?: boolean; +* transformError?: (error: unknown) => unknown; +* } : { +* target: Document | Element | ShadowRoot; +* props: Props; +* events?: Record any>; +* context?: Map; +* intro?: boolean; +* recover?: boolean; +* transformError?: (error: unknown) => unknown; +* }} options +* @returns {Exports} +*/ +function hydrate$1(component, options) { + init_operations(); + options.intro = options.intro ?? false; + const target = options.target; + const was_hydrating = hydrating; + const previous_hydrate_node = hydrate_node; + try { + var anchor = /* @__PURE__ */ get_first_child(target); + while (anchor && (anchor.nodeType !== 8 || anchor.data !== "[")) anchor = /* @__PURE__ */ get_next_sibling(anchor); + if (!anchor) throw HYDRATION_ERROR; + set_hydrating(true); + set_hydrate_node(anchor); + const instance = _mount(component, { + ...options, + anchor + }); + set_hydrating(false); + return instance; + } catch (error) { + if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) throw error; + if (error !== HYDRATION_ERROR) console.warn("Failed to hydrate: ", error); + if (options.recover === false) hydration_failed(); + init_operations(); + clear_text_content(target); + set_hydrating(false); + return mount$1(component, options); + } finally { + set_hydrating(was_hydrating); + set_hydrate_node(previous_hydrate_node); + } +} +/** @type {Map>} */ +var listeners = /* @__PURE__ */ new Map(); +/** +* @template {Record} Exports +* @param {ComponentType> | Component} Component +* @param {MountOptions} options +* @returns {Exports} +*/ +function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) { + init_operations(); + /** @type {Exports} */ + var component = void 0; + var unmount = component_root(() => { + var anchor_node = anchor ?? target.appendChild(create_text()); + boundary(anchor_node, { pending: () => {} }, (anchor_node) => { + push({}); + var ctx = component_context; + if (context) ctx.c = context; + if (events) + /** @type {any} */ props.$$events = events; + if (hydrating) assign_nodes(anchor_node, null); + component = Component(anchor_node, props) || {}; + if (hydrating) { + /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node; + if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") { + hydration_mismatch(); + throw HYDRATION_ERROR; + } + } + pop(); + }, transformError); + /** @type {Set} */ + var registered_events = /* @__PURE__ */ new Set(); + /** @param {Array} events */ + var event_handle = (events) => { + for (var i = 0; i < events.length; i++) { + var event_name = events[i]; + if (registered_events.has(event_name)) continue; + registered_events.add(event_name); + var passive = is_passive_event(event_name); + for (const node of [target, document]) { + var counts = listeners.get(node); + if (counts === void 0) { + counts = /* @__PURE__ */ new Map(); + listeners.set(node, counts); + } + var count = counts.get(event_name); + if (count === void 0) { + node.addEventListener(event_name, handle_event_propagation, { passive }); + counts.set(event_name, 1); + } else counts.set(event_name, count + 1); + } + } + }; + event_handle(array_from(all_registered_events)); + root_event_handles.add(event_handle); + return () => { + for (var event_name of registered_events) for (const node of [target, document]) { + var counts = listeners.get(node); + var count = counts.get(event_name); + if (--count == 0) { + node.removeEventListener(event_name, handle_event_propagation); + counts.delete(event_name); + if (counts.size === 0) listeners.delete(node); + } else counts.set(event_name, count); + } + root_event_handles.delete(event_handle); + if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node); + }; + }); + mounted_components.set(component, unmount); + return component; +} +/** +* References of the components that were mounted or hydrated. +* Uses a `WeakMap` to avoid memory leaks. +*/ +var mounted_components = /* @__PURE__ */ new WeakMap(); +/** +* Unmounts a component that was previously mounted using `mount` or `hydrate`. +* +* Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM. +* +* Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`). +* +* ```js +* import { mount, unmount } from 'svelte'; +* import App from './App.svelte'; +* +* const app = mount(App, { target: document.body }); +* +* // later... +* unmount(app, { outro: true }); +* ``` +* @param {Record} component +* @param {{ outro?: boolean }} [options] +* @returns {Promise} +*/ +function unmount$1(component, options) { + const fn = mounted_components.get(component); + if (fn) { + mounted_components.delete(component); + return fn(options); + } + return Promise.resolve(); +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/legacy/legacy-client.js +/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */ +/** +* Takes the component function and returns a Svelte 4 compatible component constructor. +* +* @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5. +* +* @template {Record} Props +* @template {Record} Exports +* @template {Record} Events +* @template {Record} Slots +* +* @param {SvelteComponent | Component} component +* @returns {ComponentType & Exports>} +*/ +function asClassComponent$1(component) { + return class extends Svelte4Component { + /** @param {any} options */ + constructor(options) { + super({ + component, + ...options + }); + } + }; +} +/** +* Support using the component as both a class and function during the transition period +* @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters>>): ReturnType, Record>>;}} LegacyComponentType +*/ +var Svelte4Component = class { + /** @type {any} */ + #events; + /** @type {Record} */ + #instance; + /** + * @param {ComponentConstructorOptions & { + * component: any; + * }} options + */ + constructor(options) { + var sources = /* @__PURE__ */ new Map(); + /** + * @param {string | symbol} key + * @param {unknown} value + */ + var add_source = (key, value) => { + var s = /* @__PURE__ */ mutable_source(value, false, false); + sources.set(key, s); + return s; + }; + const props = new Proxy({ + ...options.props || {}, + $$events: {} + }, { + get(target, prop) { + return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop))); + }, + has(target, prop) { + if (prop === LEGACY_PROPS) return true; + get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop))); + return Reflect.has(target, prop); + }, + set(target, prop, value) { + set(sources.get(prop) ?? add_source(prop, value), value); + return Reflect.set(target, prop, value); + } + }); + this.#instance = (options.hydrate ? hydrate$1 : mount$1)(options.component, { + target: options.target, + anchor: options.anchor, + props, + context: options.context, + intro: options.intro ?? false, + recover: options.recover, + transformError: options.transformError + }); + if (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) flushSync(); + this.#events = props.$$events; + for (const key of Object.keys(this.#instance)) { + if (key === "$set" || key === "$destroy" || key === "$on") continue; + define_property(this, key, { + get() { + return this.#instance[key]; + }, + /** @param {any} value */ + set(value) { + this.#instance[key] = value; + }, + enumerable: true + }); + } + this.#instance.$set = (next) => { + Object.assign(props, next); + }; + this.#instance.$destroy = () => { + unmount$1(this.#instance); + }; + } + /** @param {Record} props */ + $set(props) { + this.#instance.$set(props); + } + /** + * @param {string} event + * @param {(...args: any[]) => any} callback + * @returns {any} + */ + $on(event, callback) { + this.#events[event] = this.#events[event] || []; + /** @param {any[]} args */ + const cb = (...args) => callback.call(this, ...args); + this.#events[event].push(cb); + return () => { + this.#events[event] = this.#events[event].filter( + /** @param {any} fn */ + (fn) => fn !== cb + ); + }; + } + $destroy() { + this.#instance.$destroy(); + } +}; +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/legacy/legacy-server.js +/** @import { SvelteComponent } from '../index.js' */ +/** @import { Csp } from '#server' */ +/** @typedef {{ head: string, html: string, css: { code: string, map: null }; hashes?: { script: `sha256-${string}`[] } }} LegacyRenderResult */ +/** +* Takes a Svelte 5 component and returns a Svelte 4 compatible component constructor. +* +* @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5. +* +* @template {Record} Props +* @template {Record} Exports +* @template {Record} Events +* @template {Record} Slots +* +* @param {SvelteComponent} component +* @returns {typeof SvelteComponent & Exports} +*/ +function asClassComponent(component) { + const component_constructor = asClassComponent$1(component); + /** @type {(props?: {}, opts?: { $$slots?: {}; context?: Map; csp?: Csp; transformError?: (error: unknown) => unknown }) => LegacyRenderResult & PromiseLike } */ + const _render = (props, { context, csp, transformError } = {}) => { + const result = render(component, { + props, + context, + csp, + transformError + }); + const munged = Object.defineProperties({}, { + css: { value: { + code: "", + map: null + } }, + head: { get: () => result.head }, + html: { get: () => result.body }, + then: { + /** + * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function. + * + * @template TResult1 + * @template [TResult2=never] + * @param { (value: LegacyRenderResult) => TResult1 } onfulfilled + * @param { (reason: unknown) => TResult2 } onrejected + */ +value: (onfulfilled, onrejected) => { + if (!async_mode_flag) { + const user_result = onfulfilled({ + css: munged.css, + head: munged.head, + html: munged.html + }); + return Promise.resolve(user_result); + } + return result.then((result) => { + return onfulfilled({ + css: munged.css, + head: result.head, + html: result.body, + hashes: result.hashes + }); + }, onrejected); + } } + }); + return munged; + }; + component_constructor.render = _render; + return component_constructor; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/hydratable.js +/** @import { HydratableLookupEntry } from '#server' */ +/** +* @template T +* @param {string} key +* @param {() => T} fn +* @returns {T} +*/ +function hydratable(key, fn) { + if (!async_mode_flag) experimental_async_required("hydratable"); + const { hydratable } = get_render_context(); + let entry = hydratable.lookup.get(key); + if (entry !== void 0) return entry.value; + const value = fn(); + entry = encode(key, value, hydratable.unresolved_promises); + hydratable.lookup.set(key, entry); + return value; +} +/** +* @param {string} key +* @param {any} value +* @param {Map, string>} [unresolved] +*/ +function encode(key, value, unresolved) { + /** @type {HydratableLookupEntry} */ + const entry = { + value, + serialized: "" + }; + let uid = 1; + entry.serialized = uneval(entry.value, (value, uneval) => { + if (is_promise(value)) { + const placeholder = `"${uid++}"`; + const p = value.then((v) => { + entry.serialized = entry.serialized.replace(placeholder, () => `r(${uneval(v)})`); + }).catch((devalue_error) => hydratable_serialization_failed(key, serialization_stack(entry.stack, devalue_error?.stack))); + unresolved?.set(p, key); + p.catch(() => {}).finally(() => unresolved?.delete(p)); + (entry.promises ??= []).push(p); + return placeholder; + } + }); + return entry; +} +/** +* @param {any} value +* @returns {value is Promise} +*/ +function is_promise(value) { + return Object.prototype.toString.call(value) === "[object Promise]"; +} +/** +* @param {string | undefined} root_stack +* @param {string | undefined} uneval_stack +*/ +function serialization_stack(root_stack, uneval_stack) { + let out = ""; + if (root_stack) out += root_stack + "\n"; + if (uneval_stack) out += "Caused by:\n" + uneval_stack + "\n"; + return out || ""; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/internal/server/blocks/snippet.js +/** @import { Snippet } from 'svelte' */ +/** @import { Renderer } from '../renderer' */ +/** @import { Getters } from '#shared' */ +/** +* Create a snippet programmatically +* @template {unknown[]} Params +* @param {(...params: Getters) => { +* render: () => string +* setup?: (element: Element) => void | (() => void) +* }} fn +* @returns {Snippet} +*/ +function createRawSnippet(fn) { + return (renderer, ...args) => { + var getters = args.map((value) => () => value); + renderer.push(fn(...getters).render().trim()); + }; +} +//#endregion +//#region ../node_modules/.pnpm/svelte@5.56.3/node_modules/svelte/src/index-server.js +/** @import { SSRContext } from '#server' */ +/** @import { Renderer } from './internal/server/renderer.js' */ +var index_server_exports = /* @__PURE__ */ __exportAll({ + afterUpdate: () => noop, + beforeUpdate: () => noop, + createContext: () => createContext, + createEventDispatcher: () => createEventDispatcher, + createRawSnippet: () => createRawSnippet, + flushSync: () => noop, + fork: () => fork, + getAbortSignal: () => getAbortSignal, + getAllContexts: () => getAllContexts, + getContext: () => getContext, + hasContext: () => hasContext, + hydratable: () => hydratable, + hydrate: () => hydrate, + mount: () => mount, + onDestroy: () => onDestroy, + onMount: () => noop, + setContext: () => setContext, + settled: () => settled, + tick: () => tick, + unmount: () => unmount, + untrack: () => run +}); +/** @param {() => void} fn */ +function onDestroy(fn) { + /** @type {Renderer} */ ssr_context.r.on_destroy(fn); +} +function createEventDispatcher() { + return noop; +} +function mount() { + lifecycle_function_unavailable("mount"); +} +function hydrate() { + lifecycle_function_unavailable("hydrate"); +} +function unmount() { + lifecycle_function_unavailable("unmount"); +} +function fork() { + lifecycle_function_unavailable("fork"); +} +async function tick() {} +async function settled() {} +//#endregion +//#region .svelte-kit/generated/root.svelte +function Root($$renderer, $$props) { + $$renderer.component(($$renderer) => { + let { stores, page, constructors, components = [], form, errors = [], error, data_0 = null, data_1 = null } = $$props; + let data = derived(() => ({ + "0": data_0, + "1": data_1 + })); + setContext("__svelte__", stores); + stores.page.set(page); + derived(() => constructors[1]); + function pyramid($$renderer, depth) { + const Pyramid = constructors[depth]; + function failed($$renderer, error) { + const ErrorPage = errors[depth]; + if (ErrorPage) { + $$renderer.push(""); + ErrorPage($$renderer, { error }); + $$renderer.push(""); + } else { + $$renderer.push(""); + $$renderer.push(""); + } + } + $$renderer.boundary({ failed: errors[depth] ? failed : void 0 }, ($$renderer) => { + $$renderer.push(``); + if (constructors[depth + 1]) { + $$renderer.push(""); + const d = data()[depth]; + if (Pyramid) { + $$renderer.push(""); + Pyramid($$renderer, { + data: d, + form, + params: page.params, + children: ($$renderer) => { + pyramid($$renderer, depth + 1); + }, + $$slots: { default: true } + }); + $$renderer.push(""); + } else { + $$renderer.push(""); + $$renderer.push(""); + } + } else { + $$renderer.push(""); + const d = data()[depth]; + if (Pyramid) { + $$renderer.push(""); + Pyramid($$renderer, { + data: d, + form, + params: page.params, + error + }); + $$renderer.push(""); + } else { + $$renderer.push(""); + $$renderer.push(""); + } + } + $$renderer.push(``); + $$renderer.push(``); + }); + } + pyramid($$renderer, 0); + $$renderer.push(` `); + $$renderer.push(""); + $$renderer.push(``); + }); +} +//#endregion +//#region .svelte-kit/generated/server/internal.js +var options = { + app_template_contains_nonce: false, + async: true, + 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, + hash_routing: false, + hooks: null, + link_header_preload: false, + root: asClassComponent(Root), + service_worker: false, + service_worker_options: void 0, + server_error_boundaries: true, + templates: { + app: ({ head, body, assets, nonce, env }) => "\n\n \n \n \n \n " + head + "\n \n \n
" + body + "
\n \n\n", + error: ({ status, message }) => "\n\n \n \n " + message + "\n\n \n \n \n
\n " + status + "\n
\n

" + message + "

\n
\n
\n \n\n" + }, + version_hash: "1d1q9qt" +}; +async function get_hooks() { + let handle; + let handleFetch; + let handleError; + let handleValidationError; + let init; + let reroute; + let transport; + return { + handle, + handleFetch, + handleError, + handleValidationError, + init, + reroute, + transport + }; +} +//#endregion +export { set_manifest as a, rendered_env as c, read_implementation as i, set_env as l, options as n, set_read_implementation as o, index_server_exports as r, explicit_public_env as s, get_hooks as t, __commonJSMin as u }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/internal2.js b/frontend/.svelte-kit/adapter-node/chunks/internal2.js new file mode 100644 index 0000000..e9d3448 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/internal2.js @@ -0,0 +1,34 @@ +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/app/paths/internal/server.js +var base = ""; +var assets = base; +var app_dir = "_app"; +var initial = { + base, + assets +}; +initial.base; +/** +* @param {{ base: string, assets: string }} paths +*/ +function override(paths) { + base = paths.base; + assets = paths.assets; +} +function reset() { + base = initial.base; + assets = initial.assets; +} +/** @param {string} path */ +function set_assets(path) { + assets = initial.assets = path; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/app/env/internal.js +var version = "1782220703091"; +var prerendering = false; +function set_building() {} +function set_prerendering() { + prerendering = true; +} +//#endregion +export { app_dir as a, override as c, version as i, reset as l, set_building as n, assets as o, set_prerendering as r, base as s, prerendering as t, set_assets as u }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/shared.js b/frontend/.svelte-kit/adapter-node/chunks/shared.js new file mode 100644 index 0000000..2815bd6 --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/shared.js @@ -0,0 +1,714 @@ +import { a as is_plain_object$1, c as is_valid_array_len, d as valid_array_indices, f as MAX_ARRAY_INDEX, i as get_type, l as stringify_key, n as DevalueError, o as is_primitive, r as enumerable_symbols, s as is_valid_array_index, u as stringify_string } from "./uneval.js"; +import { HttpError, SvelteKitError } from "@sveltejs/kit/internal"; +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/functions.js +function noop() {} +/** +* @template T +* @param {() => T} fn +*/ +function once(fn) { + let done = false; + /** @type T */ + let result; + return () => { + if (done) return result; + done = true; + return result = fn(); + }; +} +//#endregion +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/base64.js +/** @type {(array_buffer: ArrayBuffer) => string} */ +function encode_native(array_buffer) { + return new Uint8Array(array_buffer).toBase64(); +} +/** @type {(base64: string) => ArrayBuffer} */ +function decode_native(base64) { + return Uint8Array.fromBase64(base64).buffer; +} +/** @type {(array_buffer: ArrayBuffer) => string} */ +function encode_buffer(array_buffer) { + return Buffer.from(array_buffer).toString("base64"); +} +/** @type {(base64: string) => ArrayBuffer} */ +function decode_buffer(base64) { + return Uint8Array.from(Buffer.from(base64, "base64")).buffer; +} +/** @type {(array_buffer: ArrayBuffer) => string} */ +function encode_legacy(array_buffer) { + const array = new Uint8Array(array_buffer); + let binary = ""; + const chunk_size = 32768; + for (let i = 0; i < array.length; i += chunk_size) { + const chunk = array.subarray(i, i + chunk_size); + binary += String.fromCharCode.apply(null, chunk); + } + return btoa(binary); +} +/** @type {(base64: string) => ArrayBuffer} */ +function decode_legacy(base64) { + const binary_string = atob(base64); + const len = binary_string.length; + const array = new Uint8Array(len); + for (let i = 0; i < len; i++) array[i] = binary_string.charCodeAt(i); + return array.buffer; +} +var native = typeof Uint8Array.fromBase64 === "function"; +var buffer = typeof process === "object" && process.versions?.node !== void 0; +var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy; +var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy; +//#endregion +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/parse.js +/** +* Revive a value serialized with `devalue.stringify` +* @param {string} serialized +* @param {Record any>} [revivers] +*/ +function parse(serialized, revivers) { + return unflatten(JSON.parse(serialized), revivers); +} +/** +* Revive a value flattened with `devalue.stringify` +* @param {number | any[]} parsed +* @param {Record any>} [revivers] +*/ +function unflatten(parsed, revivers) { + if (typeof parsed === "number") return hydrate(parsed, true); + if (!Array.isArray(parsed) || parsed.length === 0) throw new Error("Invalid input"); + const values = parsed; + const hydrated = Array(values.length); + /** + * A set of values currently being hydrated with custom revivers, + * used to detect invalid cyclical dependencies + * @type {Set | null} + */ + let hydrating = null; + /** + * @param {number} index + * @returns {any} + */ + function hydrate(index, standalone = false) { + if (index === -1) return void 0; + if (index === -3) return NaN; + if (index === -4) return Infinity; + if (index === -5) return -Infinity; + if (index === -6) return -0; + if (standalone || typeof index !== "number") throw new Error(`Invalid input`); + if (index in hydrated) return hydrated[index]; + const value = values[index]; + if (!value || typeof value !== "object") hydrated[index] = value; + else if (Array.isArray(value)) if (typeof value[0] === "string") { + const type = value[0]; + const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0; + if (reviver) { + let i = value[1]; + if (typeof i !== "number") i = values.push(value[1]) - 1; + hydrating ??= /* @__PURE__ */ new Set(); + if (hydrating.has(i)) throw new Error("Invalid circular reference"); + hydrating.add(i); + hydrated[index] = reviver(hydrate(i)); + hydrating.delete(i); + return hydrated[index]; + } + switch (type) { + case "Date": + hydrated[index] = new Date(value[1]); + break; + case "Set": + const set = /* @__PURE__ */ new Set(); + hydrated[index] = set; + for (let i = 1; i < value.length; i += 1) set.add(hydrate(value[i])); + break; + case "Map": + const map = /* @__PURE__ */ new Map(); + hydrated[index] = map; + for (let i = 1; i < value.length; i += 2) map.set(hydrate(value[i]), hydrate(value[i + 1])); + break; + case "RegExp": + hydrated[index] = new RegExp(value[1], value[2]); + break; + case "Object": { + const wrapped_index = value[1]; + if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") throw new Error("Invalid input"); + hydrated[index] = Object(hydrate(wrapped_index)); + break; + } + case "BigInt": + hydrated[index] = BigInt(value[1]); + break; + case "null": + const obj = Object.create(null); + hydrated[index] = obj; + for (let i = 1; i < value.length; i += 2) { + if (value[i] === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property"); + obj[value[i]] = hydrate(value[i + 1]); + } + break; + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Float16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": + case "DataView": { + if (values[value[1]][0] !== "ArrayBuffer") throw new Error("Invalid data"); + const TypedArrayConstructor = globalThis[type]; + const buffer = hydrate(value[1]); + hydrated[index] = value[2] !== void 0 ? new TypedArrayConstructor(buffer, value[2], value[3]) : new TypedArrayConstructor(buffer); + break; + } + case "ArrayBuffer": { + const base64 = value[1]; + if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding"); + hydrated[index] = decode64(base64); + break; + } + case "Temporal.Duration": + case "Temporal.Instant": + case "Temporal.PlainDate": + case "Temporal.PlainTime": + case "Temporal.PlainDateTime": + case "Temporal.PlainMonthDay": + case "Temporal.PlainYearMonth": + case "Temporal.ZonedDateTime": { + const temporalName = type.slice(9); + hydrated[index] = Temporal[temporalName].from(value[1]); + break; + } + case "URL": + hydrated[index] = new URL(value[1]); + break; + case "URLSearchParams": + hydrated[index] = new URLSearchParams(value[1]); + break; + default: throw new Error(`Unknown type ${type}`); + } + } else if (value[0] === -7) { + const len = value[1]; + if (!is_valid_array_len(len)) throw new Error("Invalid input"); + /** @type {any[]} */ + const array = []; + hydrated[index] = array; + array[MAX_ARRAY_INDEX] = void 0; + delete array[MAX_ARRAY_INDEX]; + for (let i = 2; i < value.length; i += 2) { + const idx = value[i]; + if (!is_valid_array_index(idx) || idx >= len) throw new Error("Invalid input"); + array[idx] = hydrate(value[i + 1]); + } + array.length = len; + } else { + const array = new Array(value.length); + hydrated[index] = array; + for (let i = 0; i < value.length; i += 1) { + const n = value[i]; + if (n === -2) continue; + array[i] = hydrate(n); + } + } + else { + /** @type {Record} */ + const object = {}; + hydrated[index] = object; + for (const key of Object.keys(value)) { + if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property"); + const n = value[key]; + object[key] = hydrate(n); + } + } + return hydrated[index]; + } + return hydrate(0); +} +//#endregion +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/stringify.js +/** +* Turn a value into a JSON string that can be parsed with `devalue.parse` +* @param {any} value +* @param {Record any>} [reducers] +*/ +function stringify$1(value, reducers) { + const stringified = run(false, value, reducers); + return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`; +} +/** +* @param {boolean} async +* @param {any} value +* @param {Record any>} [reducers] +*/ +function run(async, value, reducers) { + /** @type {any[]} */ + const stringified = []; + /** @type {Map} */ + const indexes = /* @__PURE__ */ new Map(); + /** @type {Array<{ key: string, fn: (value: any) => any }>} */ + const custom = []; + if (reducers) for (const key of Object.getOwnPropertyNames(reducers)) custom.push({ + key, + fn: reducers[key] + }); + /** @type {string[]} */ + const keys = []; + let p = 0; + /** + * @param {any} thing + * @param {number} [index] + */ + function flatten(thing, index) { + if (thing === void 0) return -1; + if (Number.isNaN(thing)) return -3; + if (thing === Infinity) return -4; + if (thing === -Infinity) return -5; + if (thing === 0 && 1 / thing < 0) return -6; + if (indexes.has(thing)) return indexes.get(thing); + index ??= p++; + indexes.set(thing, index); + for (const { key, fn } of custom) { + const value = fn(thing); + if (value) { + stringified[index] = `["${key}",${flatten(value)}]`; + return index; + } + } + if (typeof thing === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value); + else if (typeof thing === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value); + /** @type {string | Promise} */ + let str = ""; + if (is_primitive(thing)) str = stringify_primitive(thing); + else if (typeof thing.then === "function") { + if (!async) throw new DevalueError(`Cannot stringify a Promise or thenable — use stringifyAsync instead`, keys, thing, value); + str = Promise.resolve(thing).then((value) => { + const i = flatten(value, index); + if (i < 0) stringified[index] = i; + }); + } else { + const type = get_type(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + case "BigInt": + str = `["Object",${flatten(thing.valueOf())}]`; + break; + case "Date": + str = `["Date","${!isNaN(thing.getDate()) ? thing.toISOString() : ""}"]`; + break; + case "URL": + str = `["URL",${stringify_string(thing.toString())}]`; + break; + case "URLSearchParams": + str = `["URLSearchParams",${stringify_string(thing.toString())}]`; + break; + case "RegExp": + const { source, flags } = thing; + str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`; + break; + case "Array": { + let mostly_dense = false; + str = "["; + for (let i = 0; i < thing.length; i += 1) { + if (i > 0) str += ","; + if (Object.hasOwn(thing, i)) { + keys.push(`[${i}]`); + str += flatten(thing[i]); + keys.pop(); + } else if (mostly_dense) str += -2; + else { + const populated_keys = valid_array_indices(thing); + const population = populated_keys.length; + const d = String(thing.length).length; + if ((thing.length - population) * 3 > 4 + d + population * (d + 1)) { + str = "[-7," + thing.length; + for (let j = 0; j < populated_keys.length; j++) { + const key = populated_keys[j]; + keys.push(`[${key}]`); + str += "," + key + "," + flatten(thing[key]); + keys.pop(); + } + break; + } else { + mostly_dense = true; + str += -2; + } + } + } + str += "]"; + break; + } + case "Set": + str = "[\"Set\""; + for (const value of thing) str += `,${flatten(value)}`; + str += "]"; + break; + case "Map": + str = "[\"Map\""; + for (const [key, value] of thing) { + keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`); + str += `,${flatten(key)},${flatten(value)}`; + keys.pop(); + } + str += "]"; + break; + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Float16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": + case "DataView": { + /** @type {import("./types.js").TypedArray} */ + const typedArray = thing; + str = "[\"" + type + "\"," + flatten(typedArray.buffer); + if (typedArray.byteLength !== typedArray.buffer.byteLength) str += `,${typedArray.byteOffset},${typedArray.length}`; + str += "]"; + break; + } + case "ArrayBuffer": + str = `["ArrayBuffer","${encode64(thing)}"]`; + break; + case "Temporal.Duration": + case "Temporal.Instant": + case "Temporal.PlainDate": + case "Temporal.PlainTime": + case "Temporal.PlainDateTime": + case "Temporal.PlainMonthDay": + case "Temporal.PlainYearMonth": + case "Temporal.ZonedDateTime": + str = `["${type}",${stringify_string(thing.toString())}]`; + break; + default: + if (!is_plain_object$1(thing)) throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value); + if (enumerable_symbols(thing).length > 0) throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value); + if (Object.getPrototypeOf(thing) === null) { + str = "[\"null\""; + for (const key of Object.keys(thing)) { + if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value); + keys.push(stringify_key(key)); + str += `,${stringify_string(key)},${flatten(thing[key])}`; + keys.pop(); + } + str += "]"; + } else { + str = "{"; + let started = false; + for (const key of Object.keys(thing)) { + if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value); + if (started) str += ","; + started = true; + keys.push(stringify_key(key)); + str += `${stringify_string(key)}:${flatten(thing[key])}`; + keys.pop(); + } + str += "}"; + } + } + } + stringified[index] = str; + return index; + } + const index = flatten(value); + if (index < 0) return `${index}`; + return stringified; +} +/** +* @param {any} thing +* @returns {string} +*/ +function stringify_primitive(thing) { + const type = typeof thing; + if (type === "string") return stringify_string(thing); + if (thing === void 0) return (-1).toString(); + if (thing === 0 && 1 / thing < 0) return (-6).toString(); + if (type === "bigint") return `["BigInt","${thing}"]`; + return String(thing); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/utils.js +var text_encoder = new TextEncoder(); +/** +* Like node's path.relative, but without using node +* @param {string} from +* @param {string} to +*/ +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("/"); +} +/** +* @param {Uint8Array} bytes +* @returns {string} +*/ +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); +} +/** +* @param {string} encoded +* @returns {Uint8Array} +*/ +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; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/error.js +/** +* @param {unknown} err +* @return {Error} +*/ +function coalesce_to_error(err) { + return err instanceof Error || err && err.name && err.message ? err : new Error(JSON.stringify(err)); +} +/** +* This is an identity function that exists to make TypeScript less +* paranoid about people throwing things that aren't errors, which +* frankly is not something we should care about +* @param {unknown} error +*/ +function normalize_error(error) { + return error; +} +/** +* @param {unknown} error +*/ +function get_status(error) { + return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500; +} +/** +* @param {unknown} error +*/ +function get_message(error) { + return error instanceof SvelteKitError ? error.text : "Internal Error"; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/shared.js +/** @import { Transport } from '@sveltejs/kit' */ +/** +* @param {string} route_id +* @param {string} dep +*/ +function validate_depends(route_id, dep) { + const match = /^(moz-icon|view-source|jar):/.exec(dep); + if (match) console.warn(`${route_id}: Calling \`depends('${dep}')\` will throw an error in Firefox because \`${match[1]}\` is a special URI scheme`); +} +var INVALIDATED_PARAM = "x-sveltekit-invalidated"; +var TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash"; +/** +* @param {any} data +* @param {string} [location_description] +*/ +function validate_load_response(data, location_description) { + if (data != null && Object.getPrototypeOf(data) !== Object.prototype) throw new Error(`a load function ${location_description} returned ${typeof data !== "object" ? `a ${typeof data}` : data instanceof Response ? "a Response object" : Array.isArray(data) ? "an array" : "a non-plain object"}, but must return a plain object at the top level (i.e. \`return {...}\`)`); +} +/** +* Try to `devalue.stringify` the data object using the provided transport encoders. +* @param {any} data +* @param {Transport} transport +*/ +function stringify(data, transport) { + return stringify$1(data, Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]))); +} +var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); +/** +* @param {unknown} thing +* @returns {thing is Record} +*/ +function is_plain_object(thing) { + if (typeof thing !== "object" || thing === null) return false; + const proto = Object.getPrototypeOf(thing); + return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names; +} +/** +* @param {Record} value +* @param {Map} clones +*/ +function to_sorted(value, clones) { + const clone = Object.getPrototypeOf(value) === null ? Object.create(null) : {}; + clones.set(value, clone); + Object.defineProperty(clone, remote_arg_marker, { value: true }); + for (const key of Object.keys(value).sort()) { + const property = value[key]; + Object.defineProperty(clone, key, { + value: clones.get(property) ?? property, + enumerable: true, + configurable: true, + writable: true + }); + } + return clone; +} +var remote_object = "__skrao"; +var remote_map = "__skram"; +var remote_set = "__skras"; +var remote_file = "__skraf"; +var remote_regex_guard = "__skrag"; +var remote_arg_marker = Symbol(remote_object); +/** +* @param {Transport} transport +* @param {boolean} sort +* @param {Map} remote_arg_clones +*/ +function create_remote_arg_reducers(transport, sort, remote_arg_clones) { + /** @type {Record unknown>} */ + const remote_fns_reducers = { + /** @param {unknown} value */ +[remote_regex_guard]: (value) => { + if (value instanceof RegExp) throw new Error("Regular expressions are not valid remote function arguments"); + } }; + if (sort) { + /** @type {(value: unknown) => Array<[unknown, unknown]> | undefined} */ + remote_fns_reducers[remote_map] = (value) => { + if (!(value instanceof Map)) return; + /** @type {Array<[string, string]>} */ + const entries = []; + for (const [key, val] of value) entries.push([stringify(key), stringify(val)]); + return entries.sort(([a1, a2], [b1, b2]) => { + if (a1 < b1) return -1; + if (a1 > b1) return 1; + if (a2 < b2) return -1; + if (a2 > b2) return 1; + return 0; + }); + }; + /** @type {(value: unknown) => unknown[] | undefined} */ + remote_fns_reducers[remote_set] = (value) => { + if (!(value instanceof Set)) return; + /** @type {string[]} */ + const items = []; + for (const item of value) items.push(stringify(item)); + items.sort(); + return items; + }; + /** @type {(value: unknown) => Record | undefined} */ + remote_fns_reducers[remote_object] = (value) => { + if (!is_plain_object(value)) return; + if (Object.hasOwn(value, remote_arg_marker)) return; + if (remote_arg_clones.has(value)) return remote_arg_clones.get(value); + return to_sorted(value, remote_arg_clones); + }; + } + const all_reducers = { + ...Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode])), + ...remote_fns_reducers + }; + /** @type {(value: unknown) => string} */ + const stringify = (value) => stringify$1(value, all_reducers); + return all_reducers; +} +/** @param {Transport} transport */ +function create_remote_arg_revivers(transport) { + const remote_fns_revivers = { + /** @type {(value: unknown) => unknown} */ + [remote_object]: (value) => value, + /** @type {(value: unknown) => Map} */ + [remote_map]: (value) => { + if (!Array.isArray(value)) throw new Error("Invalid data for Map reviver"); + const map = /* @__PURE__ */ new Map(); + for (const item of value) { + if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") throw new Error("Invalid data for Map reviver"); + const [key, val] = item; + map.set(parse$1(key), parse$1(val)); + } + return map; + }, + /** @type {(value: unknown) => Set} */ + [remote_set]: (value) => { + if (!Array.isArray(value)) throw new Error("Invalid data for Set reviver"); + const set = /* @__PURE__ */ new Set(); + for (const item of value) { + if (typeof item !== "string") throw new Error("Invalid data for Set reviver"); + set.add(parse$1(item)); + } + return set; + }, + /** @type {(value: any) => File} */ + [remote_file]: (value) => { + if (!value || typeof value !== "object" || typeof value.name !== "string" || typeof value.type !== "string" || typeof value.size !== "number" || typeof value.lastModified !== "number" || !(value.data instanceof ArrayBuffer)) throw new Error("Invalid data for File reviver"); + const { data, name, ...meta } = value; + return new File([data], name, meta); + } + }; + const all_revivers = { + ...Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode])), + ...remote_fns_revivers + }; + /** @type {(data: string) => unknown} */ + const parse$1 = (data) => parse(data, all_revivers); + return all_revivers; +} +/** +* Stringifies the argument (if any) for a remote function in such a way that +* it is both a valid URL and a valid file name (necessary for prerendering). +* @param {any} value +* @param {Transport} transport +*/ +function stringify_remote_arg(value, transport) { + if (value === void 0) return ""; + return url_friendly_base64_encode(stringify$1(value, create_remote_arg_reducers(transport, true, /* @__PURE__ */ new Map()))); +} +/** +* Base64-encodes `string` in such a way that the result is safe to use +* as both a URI component and a filename +* @param {string} string +*/ +function url_friendly_base64_encode(string) { + return base64_encode(text_encoder.encode(string)).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_"); +} +/** +* Parses the argument (if any) for a remote function +* @param {string} string +* @param {Transport} transport +*/ +function parse_remote_arg(string, transport) { + if (!string) return void 0; + return parse(new TextDecoder().decode(base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))), create_remote_arg_revivers(transport)); +} +/** +* @param {string} id +* @param {string} payload +*/ +function create_remote_key(id, payload) { + return id + "/" + payload; +} +/** +* @param {string} key +* @returns {{ id: string; payload: string }} +*/ +function split_remote_key(key) { + const i = key.lastIndexOf("/"); + if (i === -1) throw new Error(`Invalid remote key: ${key}`); + return { + id: key.slice(0, i), + payload: key.slice(i + 1) + }; +} +//#endregion +export { stringify$1 as _, split_remote_key as a, once as b, validate_depends as c, get_message as d, get_status as f, text_encoder as g, get_relative_path as h, parse_remote_arg as i, validate_load_response as l, base64_encode as m, TRAILING_SLASH_PARAM as n, stringify as o, normalize_error as p, create_remote_key as r, stringify_remote_arg as s, INVALIDATED_PARAM as t, coalesce_to_error as u, parse as v, noop as y }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/uneval.js b/frontend/.svelte-kit/adapter-node/chunks/uneval.js new file mode 100644 index 0000000..0265a1c --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/uneval.js @@ -0,0 +1,450 @@ +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/constants.js +var MAX_ARRAY_LEN = 2 ** 32 - 1; +var MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1; +//#endregion +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/utils.js +/** @type {Record} */ +var escaped = { + "<": "\\u003C", + "\\": "\\\\", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + " ": "\\t", + "\u2028": "\\u2028", + "\u2029": "\\u2029" +}; +var DevalueError = class extends Error { + /** + * @param {string} message + * @param {string[]} keys + * @param {any} [value] - The value that failed to be serialized + * @param {any} [root] - The root value being serialized + */ + constructor(message, keys, value, root) { + super(message); + this.name = "DevalueError"; + this.path = keys.join(""); + this.value = value; + this.root = root; + } +}; +/** @param {any} thing */ +function is_primitive(thing) { + return thing === null || typeof thing !== "object" && typeof thing !== "function"; +} +var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); +/** @param {any} thing */ +function is_plain_object(thing) { + const proto = Object.getPrototypeOf(thing); + return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names; +} +/** @param {any} thing */ +function get_type(thing) { + return Object.prototype.toString.call(thing).slice(8, -1); +} +/** @param {string} char */ +function get_escaped_char(char) { + switch (char) { + case "\"": return "\\\""; + case "<": return "\\u003C"; + case "\\": return "\\\\"; + case "\n": return "\\n"; + case "\r": return "\\r"; + case " ": return "\\t"; + case "\b": return "\\b"; + case "\f": return "\\f"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + default: return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : ""; + } +} +/** @param {string} str */ +function stringify_string(str) { + let result = ""; + let last_pos = 0; + const len = str.length; + for (let i = 0; i < len; i += 1) { + const char = str[i]; + const replacement = get_escaped_char(char); + if (replacement) { + result += str.slice(last_pos, i) + replacement; + last_pos = i + 1; + } + } + return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`; +} +/** @param {Record} object */ +function enumerable_symbols(object) { + return Object.getOwnPropertySymbols(object).filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable); +} +var is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/; +/** @param {string} key */ +function stringify_key(key) { + return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]"; +} +/** @param {number} n */ +function is_valid_array_index(n) { + if (!Number.isInteger(n)) return false; + if (n < 0) return false; + if (n > MAX_ARRAY_INDEX) return false; + return true; +} +/** @param {number} n */ +function is_valid_array_len(n) { + if (!Number.isInteger(n)) return false; + if (n < 0) return false; + if (n > MAX_ARRAY_LEN) return false; + return true; +} +/** @param {string} s */ +function is_valid_array_index_string(s) { + if (s.length === 0) return false; + if (s.length > 1 && s.charCodeAt(0) === 48) return false; + for (let i = 0; i < s.length; i++) { + const c = s.charCodeAt(i); + if (c < 48 || c > 57) return false; + } + return is_valid_array_index(+s); +} +/** +* Finds the populated indices of an array. +* @param {unknown[]} array +*/ +function valid_array_indices(array) { + const keys = Object.keys(array); + for (var i = keys.length - 1; i >= 0; i--) if (is_valid_array_index_string(keys[i])) break; + keys.length = i + 1; + return keys; +} +//#endregion +//#region ../node_modules/.pnpm/devalue@5.8.1/node_modules/devalue/src/uneval.js +var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$"; +var unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g; +var reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/; +/** +* Turn a value into the JavaScript that creates an equivalent value +* @param {any} value +* @param {(value: any, uneval: (value: any) => string) => string | void} [replacer] +*/ +function uneval(value, replacer) { + const counts = /* @__PURE__ */ new Map(); + /** @type {string[]} */ + const keys = []; + const custom = /* @__PURE__ */ new Map(); + /** @param {any} thing */ + function walk(thing) { + if (!is_primitive(thing)) { + if (counts.has(thing)) { + counts.set(thing, counts.get(thing) + 1); + return; + } + counts.set(thing, 1); + if (replacer) { + const str = replacer(thing, (value) => uneval(value, replacer)); + if (typeof str === "string") { + custom.set(thing, str); + return; + } + } + if (typeof thing === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value); + switch (get_type(thing)) { + case "Number": + case "BigInt": + case "String": + case "Boolean": + case "Date": + case "RegExp": + case "URL": + case "URLSearchParams": return; + case "Array": + /** @type {any[]} */ thing.forEach((value, i) => { + keys.push(`[${i}]`); + walk(value); + keys.pop(); + }); + break; + case "Set": + Array.from(thing).forEach(walk); + break; + case "Map": + for (const [key, value] of thing) { + keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`); + walk(value); + keys.pop(); + } + break; + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Float16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": + case "DataView": + walk(thing.buffer); + return; + case "ArrayBuffer": return; + case "Temporal.Duration": + case "Temporal.Instant": + case "Temporal.PlainDate": + case "Temporal.PlainTime": + case "Temporal.PlainDateTime": + case "Temporal.PlainMonthDay": + case "Temporal.PlainYearMonth": + case "Temporal.ZonedDateTime": return; + default: + if (!is_plain_object(thing)) throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value); + if (enumerable_symbols(thing).length > 0) throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value); + for (const key of Object.keys(thing)) { + if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value); + keys.push(stringify_key(key)); + walk(thing[key]); + keys.pop(); + } + } + } else if (typeof thing === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value); + } + walk(value); + const names = /* @__PURE__ */ new Map(); + Array.from(counts).filter((entry) => entry[1] > 1).sort((a, b) => b[1] - a[1]).forEach((entry, i) => { + names.set(entry[0], get_name(i)); + }); + /** + * @param {any} thing + * @returns {string} + */ + function stringify(thing) { + if (names.has(thing)) return names.get(thing); + if (is_primitive(thing)) return stringify_primitive(thing); + if (custom.has(thing)) return custom.get(thing); + const type = get_type(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + case "BigInt": return `Object(${stringify(thing.valueOf())})`; + case "RegExp": + const { source, flags } = thing; + return flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`; + case "Date": return `new Date(${thing.getTime()})`; + case "URL": return `new URL(${stringify_string(thing.toString())})`; + case "URLSearchParams": return `new URLSearchParams(${stringify_string(thing.toString())})`; + case "Array": { + let has_holes = false; + let result = "["; + for (let i = 0; i < thing.length; i += 1) { + if (i > 0) result += ","; + if (Object.hasOwn(thing, i)) result += stringify(thing[i]); + else if (!has_holes) { + const populated_keys = valid_array_indices(thing); + const population = populated_keys.length; + const d = String(thing.length).length; + if (thing.length + 2 > 25 + d + population * (d + 2)) { + const entries = populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(","); + return `Object.assign(Array(${thing.length}),{${entries}})`; + } + has_holes = true; + i -= 1; + } + } + const tail = thing.length === 0 || thing.length - 1 in thing ? "" : ","; + return result + tail + "]"; + } + case "Set": + case "Map": return `new ${type}([${Array.from(thing).map(stringify).join(",")}])`; + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Float16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": { + let str = `new ${type}`; + if (!names.has(thing.buffer)) { + const array = new thing.constructor(thing.buffer); + str += `([${array}])`; + } else str += `(${stringify(thing.buffer)})`; + if (thing.byteLength !== thing.buffer.byteLength) { + const start = thing.byteOffset / thing.BYTES_PER_ELEMENT; + const end = start + thing.length; + str += `.subarray(${start},${end})`; + } + return str; + } + case "DataView": { + let str = `new DataView`; + if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`; + else str += `(${stringify(thing.buffer)}`; + if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.startOffset},${thing.byteLength}`; + return str + ")"; + } + case "ArrayBuffer": return `new Uint8Array([${new Uint8Array(thing).toString()}]).buffer`; + case "Temporal.Duration": + case "Temporal.Instant": + case "Temporal.PlainDate": + case "Temporal.PlainTime": + case "Temporal.PlainDateTime": + case "Temporal.PlainMonthDay": + case "Temporal.PlainYearMonth": + case "Temporal.ZonedDateTime": return `${type}.from(${stringify_string(thing.toString())})`; + default: + const keys = Object.keys(thing); + const obj = keys.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(","); + if (Object.getPrototypeOf(thing) === null) return keys.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`; + return `{${obj}}`; + } + } + const str = stringify(value); + if (names.size) { + /** @type {string[]} */ + const params = []; + /** @type {string[]} */ + const statements = []; + /** @type {string[]} */ + const values = []; + names.forEach((name, thing) => { + params.push(name); + if (custom.has(thing)) { + values.push(custom.get(thing)); + return; + } + if (is_primitive(thing)) { + values.push(stringify_primitive(thing)); + return; + } + const type = get_type(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + case "BigInt": + values.push(`Object(${stringify(thing.valueOf())})`); + break; + case "RegExp": + const { source, flags } = thing; + const regexp = flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`; + values.push(regexp); + break; + case "Date": + values.push(`new Date(${thing.getTime()})`); + break; + case "URL": + values.push(`new URL(${stringify_string(thing.toString())})`); + break; + case "URLSearchParams": + values.push(`new URLSearchParams(${stringify_string(thing.toString())})`); + break; + case "Array": + values.push(`Array(${thing.length})`); + /** @type {any[]} */ thing.forEach((v, i) => { + statements.push(`${name}[${i}]=${stringify(v)}`); + }); + break; + case "Set": + values.push(`new Set`); + statements.push(`${name}.${Array.from(thing).map((v) => `add(${stringify(v)})`).join(".")}`); + break; + case "Map": + values.push(`new Map`); + statements.push(`${name}.${Array.from(thing).map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`).join(".")}`); + break; + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Float16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": { + let str = `new ${type}`; + if (!names.has(thing.buffer)) { + const array = new thing.constructor(thing.buffer); + str += `([${array}])`; + } else str += `(${stringify(thing.buffer)})`; + if (thing.byteLength !== thing.buffer.byteLength) { + const start = thing.byteOffset / thing.BYTES_PER_ELEMENT; + const end = start + thing.length; + str += `.subarray(${start},${end})`; + } + values.push(`{}`); + statements.push(`${name}=${str}`); + break; + } + case "DataView": { + let str = `new DataView`; + if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`; + else str += `(${stringify(thing.buffer)}`; + if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.byteOffset},${thing.byteLength}`; + str += ")"; + values.push(`{}`); + statements.push(`${name}=${str}`); + break; + } + case "ArrayBuffer": + values.push(`new Uint8Array([${new Uint8Array(thing)}]).buffer`); + break; + default: + values.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}"); + Object.keys(thing).forEach((key) => { + statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`); + }); + } + }); + statements.push(`return ${str}`); + return `(function(${params.join(",")}){${statements.join(";")}}(${values.join(",")}))`; + } else return str; +} +/** @param {number} num */ +function get_name(num) { + let name = ""; + do { + name = chars[num % 54] + name; + num = ~~(num / 54) - 1; + } while (num >= 0); + return reserved.test(name) ? `${name}0` : name; +} +/** @param {string} c */ +function escape_unsafe_char(c) { + return escaped[c] || c; +} +/** @param {string} str */ +function escape_unsafe_chars(str) { + return str.replace(unsafe_chars, escape_unsafe_char); +} +/** @param {string} key */ +function safe_key(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key)); +} +/** @param {string} key */ +function safe_prop(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`; +} +/** @param {any} thing */ +function stringify_primitive(thing) { + const type = typeof thing; + if (type === "string") return stringify_string(thing); + if (thing === void 0) return "void 0"; + if (thing === 0 && 1 / thing < 0) return "-0"; + const str = String(thing); + if (type === "number") return str.replace(/^(-)?0\./, "$1."); + if (type === "bigint") return thing + "n"; + return str; +} +//#endregion +export { is_plain_object as a, is_valid_array_len as c, valid_array_indices as d, MAX_ARRAY_INDEX as f, get_type as i, stringify_key as l, DevalueError as n, is_primitive as o, enumerable_symbols as r, is_valid_array_index as s, uneval as t, stringify_string as u }; diff --git a/frontend/.svelte-kit/adapter-node/chunks/utils.js b/frontend/.svelte-kit/adapter-node/chunks/utils.js new file mode 100644 index 0000000..fcfb7cd --- /dev/null +++ b/frontend/.svelte-kit/adapter-node/chunks/utils.js @@ -0,0 +1,843 @@ +import { d as get_message, f as get_status, u as coalesce_to_error, v as parse } from "./shared.js"; +import { t as uneval } from "./uneval.js"; +import { json, text } from "@sveltejs/kit"; +import { HttpError, SvelteKitError } from "@sveltejs/kit/internal"; +import { with_request_store } from "@sveltejs/kit/internal/server"; +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/constants.js +/** +* A fake asset path used in `vite dev` and `vite preview`, so that we can +* serve local assets while verifying that requests are correctly prefixed +*/ +var SVELTE_KIT_ASSETS = "/_svelte_kit_assets"; +var ENDPOINT_METHODS = [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE", + "OPTIONS", + "HEAD" +]; +var MUTATIVE_METHODS = [ + "POST", + "PUT", + "PATCH", + "DELETE" +]; +var PAGE_METHODS = [ + "GET", + "POST", + "HEAD" +]; +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/form-utils.js +/** @import { BinaryFormMeta, InternalRemoteFormIssue } from 'types' */ +/** @import { StandardSchemaV1 } from '@standard-schema/spec' */ +var decoder = new TextDecoder(); +/** +* Sets a value in a nested object using a path string, mutating the original object +* @param {Record} object +* @param {string} path_string +* @param {any} value +*/ +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); +} +/** +* Convert `FormData` into a POJO +* @param {FormData} data +*/ +function convert_formdata(data) { + /** @type {Record} */ + const result = {}; + for (let key of data.keys()) { + const is_array = key.endsWith("[]"); + /** @type {any[]} */ + 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(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; +} +var BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata"; +var BINARY_FORM_VERSION = 0; +var HEADER_BYTES = 7; +/** +* @param {Request} request +* @returns {Promise<{ data: Record; meta: BinaryFormMeta; form_data: FormData | null }>} +*/ +async function deserialize_binary_form(request) { + if (request.headers.get("content-type") !== "application/x-sveltekit-formdata") { + const form_data = await request.formData(); + return { + data: convert_formdata(form_data), + meta: {}, + form_data + }; + } + if (!request.body) throw deserialize_error("no body"); + const reader = request.body.getReader(); + /** @type {Array | undefined>>} */ + const chunks = []; + /** + * @param {number} index + * @returns {Promise | undefined>} + */ + 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]; + } + /** + * @param {number} offset + * @param {number} length + * @returns {Promise} + */ + async function get_buffer(offset, length) { + /** @type {Uint8Array} */ + let start_chunk; + let chunk_start = 0; + /** @type {number} */ + 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 chunks = [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); + chunks.push(chunk); + cursor += chunk.byteLength; + } + const buffer = new Uint8Array(length); + cursor = 0; + for (const chunk of chunks) { + 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); + const file_offsets_length = header_view.getUint16(5, true); + const data_buffer = await get_buffer(HEADER_BYTES, data_length); + if (!data_buffer) throw deserialize_error("data too short"); + /** @type {Array} */ + let file_offsets; + /** @type {number} */ + 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"); + const parsed_offsets = JSON.parse(decoder.decode(file_offsets_buffer)); + if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) throw deserialize_error("invalid file offset table"); + file_offsets = parsed_offsets; + files_start_offset = HEADER_BYTES + data_length + file_offsets_length; + } + /** @type {Array<{ offset: number, size: number }>} */ + const file_spans = []; + const [data, meta] = parse(decoder.decode(data_buffer), { File: ([name, type, size, last_modified, index]) => { + if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") throw deserialize_error("invalid file metadata"); + let offset = file_offsets[index]; + if (offset === void 0) throw deserialize_error("duplicate file offset table index"); + file_offsets[index] = void 0; + offset += files_start_offset; + file_spans.push({ + offset, + size + }); + return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), { getPrototypeOf() { + return File.prototype; + } }); + } }); + file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size); + for (let i = 1; i < file_spans.length; i++) { + const previous = file_spans[i - 1]; + const current = file_spans[i]; + const previous_end = previous.offset + previous.size; + if (previous_end < current.offset) throw deserialize_error("gaps in file data"); + if (previous_end > current.offset) throw deserialize_error("overlapping file data"); + } + (async () => { + let has_more = true; + while (has_more) has_more = !!await get_chunk(chunks.length); + })(); + return { + data, + meta, + form_data: null + }; +} +/** +* @param {string} message +*/ +function deserialize_error(message) { + return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`); +} +/** @implements {File} */ +var LazyFile = class LazyFile { + /** @type {(index: number) => Promise | undefined>} */ + #get_chunk; + /** @type {number} */ + #offset; + /** + * @param {string} name + * @param {string} type + * @param {number} size + * @param {number} last_modified + * @param {(index: number) => Promise | 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); + return new LazyFile(this.name, contentType, size, this.lastModified, this.#get_chunk, this.#offset + start); + } + stream() { + let cursor = 0; + let chunk_index = 0; + return new ReadableStream({ + start: async (controller) => { + let chunk_start = 0; + /** @type {Uint8Array} */ + let start_chunk; + 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 decoder.decode(await this.arrayBuffer()); + } +}; +var path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/; +/** +* @param {string} path +*/ +function split_path(path) { + if (!path_regex.test(path)) throw new Error(`Invalid path ${path}`); + return path.split(/\.|\[|\]/).filter(Boolean); +} +/** +* Check if a property key is dangerous and could lead to prototype pollution +* @param {string} key +*/ +function check_prototype_pollution(key) { + if (key === "__proto__" || key === "constructor" || key === "prototype") throw new Error(`Invalid key "${key}"`); +} +/** +* Sets a value in a nested object using an array of keys, mutating the original object. +* @param {Record} object +* @param {string[]} keys +* @param {any} value +*/ +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 inner = Object.hasOwn(current, key) ? current[key] : void 0; + const exists = inner != null; + 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; +} +/** +* @param {StandardSchemaV1.Issue} issue +* @param {boolean} server Whether this issue came from server validation +*/ +function normalize_issue(issue, server = false) { + /** @type {InternalRemoteFormIssue} */ + const normalized = { + name: "", + path: [], + message: issue.message, + server + }; + if (issue.path !== void 0) { + let name = ""; + for (const segment of issue.path) { + const key = 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; +} +/** +* @param {InternalRemoteFormIssue[]} issues +*/ +function flatten_issues(issues) { + /** @type {Record} */ + 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; +} +/** +* Gets a nested value from an object using a path array +* @param {Record} object +* @param {(string | number)[]} path +* @returns {any} +*/ +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; +} +/** +* +* @param {string} field_type +* @param {boolean} is_array +* @param {unknown} input_value +*/ +function get_type_prefix(field_type, is_array, input_value) { + if (field_type === "number" || field_type === "range") return "n:"; + if (field_type === "checkbox" && !is_array) return "b:"; + if (field_type === "hidden" || field_type === "submit") { + const input_type = typeof input_value; + if (input_type === "number") return "n:"; + if (input_type === "boolean") return "b:"; + } + return ""; +} +/** +* Creates a proxy-based field accessor for form data +* @param {any} target - Function or empty POJO +* @param {() => Record} get_input - Function to get current input data +* @param {(path: (string | number)[], value: any) => void} set_input - Function to set input data +* @param {(path?: (string | number)[], all?: boolean) => Record} get_issues - Function to get current issues +* @param {(string | number)[]} path - Current access path +* @returns {any} Proxy object with name(), value(), and issues() methods +*/ +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(target, prop) { + if (typeof prop === "symbol") return target[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(path, prop === "allIssues")[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") { + /** + * @param {string} type + * @param {unknown} [input_value] + */ + const as_func = (type, input_value) => { + const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string"; + /** @type {Record} */ + const base_props = { + name: get_type_prefix(type, is_array, input_value) + key + (is_array ? "[]" : ""), + get "aria-invalid"() { + return key in get_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: typeof input_value === "boolean" ? input_value ? "on" : "off" : 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() ?? input_value; + } + } + }); + if (type === "checkbox" || type === "radio") { + if (type === "checkbox" && !is_array) return Object.defineProperties(base_props, { + defaultChecked: { + enumerable: true, + get() { + return input_value; + } + }, + checked: { + enumerable: true, + get() { + return get_value() ?? input_value; + } + } + }); + 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; + return (value ?? []).includes(input_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; + } + /** @type {any} */ + const fileListLike = { length: value.length }; + value.forEach((file, index) => { + fileListLike[index] = file; + }); + return fileListLike; + } + return null; + } + } + }); + return Object.defineProperties(base_props, { + defaultValue: { + enumerable: true, + get() { + return input_value; + } + }, + value: { + enumerable: true, + get() { + const value = get_value() ?? input_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]); + } }); +} +/** +* Builds a path string from an array of path segments +* @param {(string | number)[]} path +* @returns {string} +*/ +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; +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/http.js +/** +* Given an Accept header and a list of possible content types, pick +* the most suitable one to respond with +* @param {string} accept +* @param {string[]} types +*/ +function negotiate(accept, types) { + /** @type {Array<{ type: string, subtype: string, q: number, i: number }>} */ + 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; +} +/** +* Returns `true` if the request contains a `content-type` header with the given type +* @param {Request} request +* @param {...string} types +*/ +function is_content_type(request, ...types) { + const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? ""; + return types.includes(type.toLowerCase()); +} +/** +* @param {Request} request +*/ +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); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/misc.js +var s = JSON.stringify; +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/utils/escape.js +/** +* When inside a double-quoted attribute value, only `&` and `"` hold special meaning. +* @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(double-quoted)-state +* @type {Record} +*/ +var escape_html_attr_dict = { + "&": "&", + "\"": """ +}; +/** +* @type {Record} +*/ +var escape_html_dict = { + "&": "&", + "<": "<" +}; +var escape_html_attr_regex = new RegExp(`[${Object.keys(escape_html_attr_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g"); +var escape_html_regex = new RegExp(`[${Object.keys(escape_html_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g"); +/** +* Escapes unpaired surrogates (which are allowed in js strings but invalid in HTML) and +* escapes characters that are special. +* +* @param {string} str +* @param {boolean} [is_attr] +* @returns {string} escaped string +* @example const html = `...`; +*/ +function escape_html(str, is_attr) { + const dict = is_attr ? escape_html_attr_dict : escape_html_dict; + return str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => { + if (match.length === 2) return match; + return dict[match] ?? `&#${match.charCodeAt(0)};`; + }); +} +//#endregion +//#region ../node_modules/.pnpm/@sveltejs+kit@3.0.0-next.4_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_vite@8.0.16_831df308509456bf75377b19fdb5b8d4/node_modules/@sveltejs/kit/src/runtime/server/utils.js +/** @import { ServerHooks } from 'types' */ +/** +* @param {Partial>} mod +* @param {import('types').HttpMethod} method +*/ +function method_not_allowed(mod, method) { + return text(`${method} method not allowed`, { + status: 405, + headers: { allow: allowed_methods(mod).join(", ") } + }); +} +/** @param {Partial>} mod */ +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; +} +/** +* @param {import('types').SSROptions} options +*/ +function get_global_name(options) { + return `__sveltekit_${options.version_hash}`; +} +/** +* Return as a response that renders the error.html +* +* @param {import('types').SSROptions} options +* @param {number} status +* @param {string} message +*/ +function static_error_page(options, status, message) { + return text(options.templates.error({ + status, + message: escape_html(message) + }), { + headers: { "content-type": "text/html; charset=utf-8" }, + status + }); +} +/** +* @param {import('@sveltejs/kit').RequestEvent} event +* @param {import('types').RequestState} state +* @param {import('types').SSROptions} options +* @param {unknown} error +*/ +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); +} +/** +* @param {import('@sveltejs/kit').RequestEvent} event +* @param {import('types').RequestState} state +* @param {import('types').SSROptions} options +* @param {any} error +* @returns {Promise} +*/ +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 }; +} +/** +* @param {number} status +* @param {string} location +*/ +function redirect_response(status, location) { + return new Response(void 0, { + status, + headers: { location } + }); +} +/** +* @param {import('@sveltejs/kit').RequestEvent} event +* @param {Error & { path: string }} error +*/ +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; +} +/** +* @param {import('types').ServerDataNode} node +*/ +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; +} +/** +* Returns `true` if the given path was prerendered +* @param {import('@sveltejs/kit').SSRManifest} manifest +* @param {string} pathname Should include the base and be decoded +*/ +function has_prerendered_path(manifest, pathname) { + return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1)); +} +/** +* Formats the error into a nice message with sanitized stack trace +* @param {number} status +* @param {Error} error +* @param {import('@sveltejs/kit').RequestEvent} event +*/ +function format_server_error(status, error, event) { + const formatted_text = `\n\x1b[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1b[0m`; + if (status === 404) return formatted_text; + return `${formatted_text}\n${error.stack}`; +} +/** +* Returns the filename without the extension. e.g., `+page.server`, `+page`, etc. +* @param {string | undefined} node_id +* @returns {string} +*/ +function get_node_type(node_id) { + const filename = (node_id?.split("/"))?.at(-1); + if (!filename) return "unknown"; + return filename.split(".").slice(0, -1).join("."); +} +/** +* Counts HTML comments that are not SSI directives (which start with ` +* + +

Debug Dashboard

+ +
+
+

Hono

+ {#if records} +

{records.hono_count}

+ {/if} + +
+ + +
+ + diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index e0eaefb..c289082 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,29 +1,38 @@ import tailwindcss from '@tailwindcss/vite'; +import { defineConfig } from 'vite'; import adapter from '@sveltejs/adapter-node'; import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; -import { PROXY_PORT } from '../config'; +import { SERVER_IP, FRONTEND_PORT, PROXY_PORT } from '../config.ts'; -export default defineConfig({ - plugins: [ - tailwindcss(), - sveltekit({ - compilerOptions: { - // Force runes mode for the project, except for libraries. Can be removed in svelte 6. - runes: ({ filename }) => - filename.split(/[/\\]/).includes('node_modules') ? undefined : true, - experimental: { async: true } +export default defineConfig(() => { + return { + plugins: [ + tailwindcss(), + sveltekit({ + compilerOptions: { + runes: ({ filename }) => + filename.split(/[/\\]/).includes('node_modules') ? undefined : true, + experimental: { async: true } + }, + adapter: adapter(), + experimental: { remoteFunctions: true, handleRenderingErrors: true }, + csrf: { + trustedOrigins: ['*'] + } + }) + ], + server: { + fs: { + allow: ['.', './node_modules', '../node_modules'] }, - adapter: adapter(), - experimental: { remoteFunctions: true, handleRenderingErrors: true } - }) - ], - server: { - proxy: { - '/api': { - target: `http://localhost:${PROXY_PORT}`, - changeOrigin: true + allowedHosts: [SERVER_IP], + port: FRONTEND_PORT, + proxy: { + '/api': { + target: `http://${SERVER_IP}:${PROXY_PORT}`, + changeOrigin: true + } } } - } + }; }); diff --git a/package.json b/package.json new file mode 100644 index 0000000..7262d9a --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "famchamp-monorepo", + "private": true, + "scripts": { + "dev": "pnpm -r --parallel dev", + "build": "pnpm -r build" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d25f5fb..a8d7044 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,20 +6,29 @@ settings: importers: + .: {} + frontend: + dependencies: + '@sveltejs/enhanced-img': + specifier: ^0.11.0 + version: 0.11.0(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) + pocketbase: + specifier: ^0.27.0 + version: 0.27.0 devDependencies: '@sveltejs/adapter-node': specifier: next - version: 6.0.0-next.0(@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0))) + version: 6.0.0-next.0(@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4))) '@sveltejs/kit': specifier: next - version: 3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + version: 3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) '@sveltejs/vite-plugin-svelte': specifier: ^7.1.2 - version: 7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + version: 7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) '@tailwindcss/vite': specifier: ^4.3.0 - version: 4.3.1(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + version: 4.3.1(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) '@types/node': specifier: ^26.0.0 version: 26.0.0 @@ -46,7 +55,26 @@ importers: version: 6.0.3 vite: specifier: ^8.0.16 - version: 8.0.16(@types/node@26.0.0)(jiti@2.7.0) + version: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) + + proxy: + dependencies: + '@hono/node-server': + specifier: ^1.13.0 + version: 1.19.14(hono@4.12.27) + hono: + specifier: ^4.7.0 + version: 4.12.27 + devDependencies: + '@types/node': + specifier: ^26.0.0 + version: 26.0.0 + tsx: + specifier: ^4.19.0 + version: 4.22.4 + typescript: + specifier: ^5.7.0 + version: 5.9.3 packages: @@ -68,6 +96,321 @@ packages: '@emnapi/wasi-threads@1.2.2': resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} + '@esbuild/aix-ppc64@0.28.1': + resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.1': + resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.1': + resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.1': + resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.1': + resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.1': + resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.1': + resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.1': + resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.1': + resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.1': + resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.1': + resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.1': + resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.1': + resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.1': + resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.1': + resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.1': + resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.1': + resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.1': + resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.1': + resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.1': + resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.1': + resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.1': + resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.1': + resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.1': + resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.1': + resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.1': + resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@hono/node-server@1.19.14': + resolution: {integrity: sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw==} + engines: {node: '>=18.14.1'} + peerDependencies: + hono: ^4 + + '@img/colour@1.1.0': + resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} + engines: {node: '>=18'} + + '@img/sharp-darwin-arm64@0.34.5': + resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [darwin] + + '@img/sharp-darwin-x64@0.34.5': + resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-darwin-arm64@1.2.4': + resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==} + cpu: [arm64] + os: [darwin] + + '@img/sharp-libvips-darwin-x64@1.2.4': + resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-linux-arm64@1.2.4': + resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-arm@1.2.4': + resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-ppc64@1.2.4': + resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-riscv64@1.2.4': + resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-s390x@1.2.4': + resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-x64@1.2.4': + resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linuxmusl-arm64@1.2.4': + resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@img/sharp-libvips-linuxmusl-x64@1.2.4': + resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@img/sharp-linux-arm64@0.34.5': + resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-arm@0.34.5': + resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-ppc64@0.34.5': + resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-riscv64@0.34.5': + resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-s390x@0.34.5': + resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-x64@0.34.5': + resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@img/sharp-linuxmusl-arm64@0.34.5': + resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@img/sharp-linuxmusl-x64@0.34.5': + resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@img/sharp-wasm32@0.34.5': + resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [wasm32] + + '@img/sharp-win32-arm64@0.34.5': + resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [arm64] + os: [win32] + + '@img/sharp-win32-ia32@0.34.5': + resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [ia32] + os: [win32] + + '@img/sharp-win32-x64@0.34.5': + resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + cpu: [x64] + os: [win32] + '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} @@ -292,6 +635,15 @@ packages: '@rolldown/pluginutils@1.0.1': resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + '@rollup/pluginutils@5.4.0': + resolution: {integrity: sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -305,6 +657,13 @@ packages: peerDependencies: '@sveltejs/kit': ^3.0.0 + '@sveltejs/enhanced-img@0.11.0': + resolution: {integrity: sha512-TN7VzGoqwFqvA4Faj1brUPHLtcEkyFa08nrn9bfm98yVrzr0g4bOZHjlBoPYHHX+sZNGE+cxznhTVgarECPQsA==} + peerDependencies: + '@sveltejs/vite-plugin-svelte': ^6.0.0 || ^7.0.0 + svelte: ^5.0.0 + vite: ^6.3.0 || >=7.0.0 + '@sveltejs/kit@3.0.0-next.4': resolution: {integrity: sha512-AN9QgXeSdmzkdTo9FOhbBR9lPMHU8CUjkIBb889zsglL6guTNJjFnutkq7TqCzJK1PMWDJPvyeKdOI6ILH6ToA==} engines: {node: '>=22'} @@ -478,6 +837,11 @@ packages: resolution: {integrity: sha512-aNnGCvbJ/RIyWo1IuhNdVjnNF+EjH9wpzpNHt+ci/m9He9LJvUN8wrCcXjp9cWsGNAuvSpVFTx/vraAFQ8qGjQ==} engines: {node: '>=10.13.0'} + esbuild@0.28.1: + resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==} + engines: {node: '>=18'} + hasBin: true + esm-env@1.2.2: resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==} @@ -489,6 +853,9 @@ packages: '@typescript-eslint/types': optional: true + estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -506,6 +873,14 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + hono@4.12.27: + resolution: {integrity: sha512-1yrb/+w6HWQJrUCLkJ2IF5jNIPvvFkblV5RNOYl6bV+OA6p9GLcMpHFFGTosSvHvcAUibuUukRqhlYI4z32C7Q==} + engines: {node: '>=16.9.0'} + + imagetools-core@9.1.0: + resolution: {integrity: sha512-xQjs+2vrxLnAjCq+omuNkd5UQTld9/bP8+YT0LyYTlKfuSQtgUBvqhUwGugzSAh6sCdN+LnROMuLswn5hZ9Fhg==} + engines: {node: '>=20.0.0'} + is-reference@3.0.3: resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==} @@ -617,6 +992,9 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} + pocketbase@0.27.0: + resolution: {integrity: sha512-K5N6d93UP/BNMbMnlZ6BUfy9VPCIvLyqhJFOsNI8OsZwzvKWEAfyD36boi5K4ECIOl5HMlo0TzuaeGdKpMwizQ==} + postcss@8.5.15: resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==} engines: {node: ^10 || ^12 || >=14} @@ -706,6 +1084,15 @@ packages: resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} engines: {node: '>=6'} + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} + engines: {node: '>=10'} + hasBin: true + + sharp@0.34.5: + resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==} + engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + sirv@3.0.2: resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} engines: {node: '>=18'} @@ -722,6 +1109,11 @@ packages: svelte: ^4.0.0 || ^5.0.0-next.0 typescript: '>=5.0.0' + svelte-parse-markup@0.1.5: + resolution: {integrity: sha512-T6mqZrySltPCDwfKXWQ6zehipVLk4GWfH1zCMGgRtLlOIFPuw58ZxVYxVvotMJgJaurKi1i14viB2GIRKXeJTQ==} + peerDependencies: + svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.1 + svelte@5.56.3: resolution: {integrity: sha512-w7JvrM5IFl5cmfbY0TLik9o7mjRUJmRMhOR51tBPu708Gr/MjbGs7VnJnr/B0CaXeI4vtnOh7RKxDr0cwhMdDA==} engines: {node: '>=18'} @@ -744,6 +1136,16 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsx@4.22.4: + resolution: {integrity: sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==} + engines: {node: '>=18.0.0'} + hasBin: true + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + typescript@6.0.3: resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} engines: {node: '>=14.17'} @@ -752,6 +1154,10 @@ packages: undici-types@8.3.0: resolution: {integrity: sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==} + vite-imagetools@9.0.3: + resolution: {integrity: sha512-FwjApRNZyN+RucPW9Z9kf0dyzyi3r3zlDfrTnzHXNaYpmT3pZ5w//d6QkApy1iypbDm+3fq+Gwfv+PYA4j4uYw==} + engines: {node: '>=20.0.0'} + vite@8.0.16: resolution: {integrity: sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -840,6 +1246,184 @@ snapshots: tslib: 2.8.1 optional: true + '@esbuild/aix-ppc64@0.28.1': + optional: true + + '@esbuild/android-arm64@0.28.1': + optional: true + + '@esbuild/android-arm@0.28.1': + optional: true + + '@esbuild/android-x64@0.28.1': + optional: true + + '@esbuild/darwin-arm64@0.28.1': + optional: true + + '@esbuild/darwin-x64@0.28.1': + optional: true + + '@esbuild/freebsd-arm64@0.28.1': + optional: true + + '@esbuild/freebsd-x64@0.28.1': + optional: true + + '@esbuild/linux-arm64@0.28.1': + optional: true + + '@esbuild/linux-arm@0.28.1': + optional: true + + '@esbuild/linux-ia32@0.28.1': + optional: true + + '@esbuild/linux-loong64@0.28.1': + optional: true + + '@esbuild/linux-mips64el@0.28.1': + optional: true + + '@esbuild/linux-ppc64@0.28.1': + optional: true + + '@esbuild/linux-riscv64@0.28.1': + optional: true + + '@esbuild/linux-s390x@0.28.1': + optional: true + + '@esbuild/linux-x64@0.28.1': + optional: true + + '@esbuild/netbsd-arm64@0.28.1': + optional: true + + '@esbuild/netbsd-x64@0.28.1': + optional: true + + '@esbuild/openbsd-arm64@0.28.1': + optional: true + + '@esbuild/openbsd-x64@0.28.1': + optional: true + + '@esbuild/openharmony-arm64@0.28.1': + optional: true + + '@esbuild/sunos-x64@0.28.1': + optional: true + + '@esbuild/win32-arm64@0.28.1': + optional: true + + '@esbuild/win32-ia32@0.28.1': + optional: true + + '@esbuild/win32-x64@0.28.1': + optional: true + + '@hono/node-server@1.19.14(hono@4.12.27)': + dependencies: + hono: 4.12.27 + + '@img/colour@1.1.0': {} + + '@img/sharp-darwin-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-darwin-arm64': 1.2.4 + optional: true + + '@img/sharp-darwin-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-darwin-x64': 1.2.4 + optional: true + + '@img/sharp-libvips-darwin-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-darwin-x64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-arm@1.2.4': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.2.4': + optional: true + + '@img/sharp-libvips-linux-s390x@1.2.4': + optional: true + + '@img/sharp-libvips-linux-x64@1.2.4': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.2.4': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.2.4': + optional: true + + '@img/sharp-linux-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.2.4 + optional: true + + '@img/sharp-linux-arm@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.2.4 + optional: true + + '@img/sharp-linux-ppc64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.2.4 + optional: true + + '@img/sharp-linux-riscv64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.2.4 + optional: true + + '@img/sharp-linux-s390x@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.2.4 + optional: true + + '@img/sharp-linux-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.2.4 + optional: true + + '@img/sharp-linuxmusl-arm64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 + optional: true + + '@img/sharp-linuxmusl-x64@0.34.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-x64': 1.2.4 + optional: true + + '@img/sharp-wasm32@0.34.5': + dependencies: + '@emnapi/runtime': 1.11.1 + optional: true + + '@img/sharp-win32-arm64@0.34.5': + optional: true + + '@img/sharp-win32-ia32@0.34.5': + optional: true + + '@img/sharp-win32-x64@0.34.5': + optional: true + '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -979,22 +1563,41 @@ snapshots: '@rolldown/pluginutils@1.0.1': {} + '@rollup/pluginutils@5.4.0': + dependencies: + '@types/estree': 1.0.9 + estree-walker: 2.0.2 + picomatch: 4.0.4 + '@standard-schema/spec@1.1.0': {} '@sveltejs/acorn-typescript@1.0.10(acorn@8.17.0)': dependencies: acorn: 8.17.0 - '@sveltejs/adapter-node@6.0.0-next.0(@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))': + '@sveltejs/adapter-node@6.0.0-next.0(@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))': dependencies: - '@sveltejs/kit': 3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + '@sveltejs/kit': 3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) rolldown: 1.1.2 - '@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0))': + '@sveltejs/enhanced-img@0.11.0(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4))': + dependencies: + '@sveltejs/vite-plugin-svelte': 7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) + magic-string: 0.30.21 + sharp: 0.34.5 + svelte: 5.56.3 + svelte-parse-markup: 0.1.5(svelte@5.56.3) + vite: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) + vite-imagetools: 9.0.3 + zimmerframe: 1.1.4 + transitivePeerDependencies: + - rollup + + '@sveltejs/kit@3.0.0-next.4(@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)))(svelte@5.56.3)(typescript@6.0.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4))': dependencies: '@standard-schema/spec': 1.1.0 '@sveltejs/acorn-typescript': 1.0.10(acorn@8.17.0) - '@sveltejs/vite-plugin-svelte': 7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + '@sveltejs/vite-plugin-svelte': 7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) acorn: 8.17.0 cookie: 1.1.1 devalue: 5.8.1 @@ -1003,20 +1606,20 @@ snapshots: mrmime: 2.0.1 sirv: 3.0.2 svelte: 5.56.3 - vite: 8.0.16(@types/node@26.0.0)(jiti@2.7.0) + vite: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) optionalDependencies: typescript: 6.0.3 '@sveltejs/load-config@0.1.1': {} - '@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0))': + '@sveltejs/vite-plugin-svelte@7.1.2(svelte@5.56.3)(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4))': dependencies: deepmerge: 4.3.1 magic-string: 0.30.21 obug: 2.1.3 svelte: 5.56.3 - vite: 8.0.16(@types/node@26.0.0)(jiti@2.7.0) - vitefu: 1.1.3(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)) + vite: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) + vitefu: 1.1.3(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)) '@tailwindcss/node@4.3.1': dependencies: @@ -1079,12 +1682,12 @@ snapshots: '@tailwindcss/oxide-win32-arm64-msvc': 4.3.1 '@tailwindcss/oxide-win32-x64-msvc': 4.3.1 - '@tailwindcss/vite@4.3.1(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0))': + '@tailwindcss/vite@4.3.1(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4))': dependencies: '@tailwindcss/node': 4.3.1 '@tailwindcss/oxide': 4.3.1 tailwindcss: 4.3.1 - vite: 8.0.16(@types/node@26.0.0)(jiti@2.7.0) + vite: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) '@tybys/wasm-util@0.10.3': dependencies: @@ -1124,12 +1727,43 @@ snapshots: graceful-fs: 4.2.11 tapable: 2.3.3 + esbuild@0.28.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.1 + '@esbuild/android-arm': 0.28.1 + '@esbuild/android-arm64': 0.28.1 + '@esbuild/android-x64': 0.28.1 + '@esbuild/darwin-arm64': 0.28.1 + '@esbuild/darwin-x64': 0.28.1 + '@esbuild/freebsd-arm64': 0.28.1 + '@esbuild/freebsd-x64': 0.28.1 + '@esbuild/linux-arm': 0.28.1 + '@esbuild/linux-arm64': 0.28.1 + '@esbuild/linux-ia32': 0.28.1 + '@esbuild/linux-loong64': 0.28.1 + '@esbuild/linux-mips64el': 0.28.1 + '@esbuild/linux-ppc64': 0.28.1 + '@esbuild/linux-riscv64': 0.28.1 + '@esbuild/linux-s390x': 0.28.1 + '@esbuild/linux-x64': 0.28.1 + '@esbuild/netbsd-arm64': 0.28.1 + '@esbuild/netbsd-x64': 0.28.1 + '@esbuild/openbsd-arm64': 0.28.1 + '@esbuild/openbsd-x64': 0.28.1 + '@esbuild/openharmony-arm64': 0.28.1 + '@esbuild/sunos-x64': 0.28.1 + '@esbuild/win32-arm64': 0.28.1 + '@esbuild/win32-ia32': 0.28.1 + '@esbuild/win32-x64': 0.28.1 + esm-env@1.2.2: {} esrap@2.2.12: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + estree-walker@2.0.2: {} + fdir@6.5.0(picomatch@4.0.4): optionalDependencies: picomatch: 4.0.4 @@ -1139,6 +1773,10 @@ snapshots: graceful-fs@4.2.11: {} + hono@4.12.27: {} + + imagetools-core@9.1.0: {} + is-reference@3.0.3: dependencies: '@types/estree': 1.0.9 @@ -1212,6 +1850,8 @@ snapshots: picomatch@4.0.4: {} + pocketbase@0.27.0: {} + postcss@8.5.15: dependencies: nanoid: 3.3.15 @@ -1279,6 +1919,39 @@ snapshots: dependencies: mri: 1.2.0 + semver@7.8.5: {} + + sharp@0.34.5: + dependencies: + '@img/colour': 1.1.0 + detect-libc: 2.1.2 + semver: 7.8.5 + optionalDependencies: + '@img/sharp-darwin-arm64': 0.34.5 + '@img/sharp-darwin-x64': 0.34.5 + '@img/sharp-libvips-darwin-arm64': 1.2.4 + '@img/sharp-libvips-darwin-x64': 1.2.4 + '@img/sharp-libvips-linux-arm': 1.2.4 + '@img/sharp-libvips-linux-arm64': 1.2.4 + '@img/sharp-libvips-linux-ppc64': 1.2.4 + '@img/sharp-libvips-linux-riscv64': 1.2.4 + '@img/sharp-libvips-linux-s390x': 1.2.4 + '@img/sharp-libvips-linux-x64': 1.2.4 + '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 + '@img/sharp-libvips-linuxmusl-x64': 1.2.4 + '@img/sharp-linux-arm': 0.34.5 + '@img/sharp-linux-arm64': 0.34.5 + '@img/sharp-linux-ppc64': 0.34.5 + '@img/sharp-linux-riscv64': 0.34.5 + '@img/sharp-linux-s390x': 0.34.5 + '@img/sharp-linux-x64': 0.34.5 + '@img/sharp-linuxmusl-arm64': 0.34.5 + '@img/sharp-linuxmusl-x64': 0.34.5 + '@img/sharp-wasm32': 0.34.5 + '@img/sharp-win32-arm64': 0.34.5 + '@img/sharp-win32-ia32': 0.34.5 + '@img/sharp-win32-x64': 0.34.5 + sirv@3.0.2: dependencies: '@polka/url': 1.0.0-next.29 @@ -1300,6 +1973,10 @@ snapshots: transitivePeerDependencies: - picomatch + svelte-parse-markup@0.1.5(svelte@5.56.3): + dependencies: + svelte: 5.56.3 + svelte@5.56.3: dependencies: '@jridgewell/remapping': 2.3.5 @@ -1335,11 +2012,27 @@ snapshots: tslib@2.8.1: optional: true + tsx@4.22.4: + dependencies: + esbuild: 0.28.1 + optionalDependencies: + fsevents: 2.3.3 + + typescript@5.9.3: {} + typescript@6.0.3: {} undici-types@8.3.0: {} - vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0): + vite-imagetools@9.0.3: + dependencies: + '@rollup/pluginutils': 5.4.0 + imagetools-core: 9.1.0 + sharp: 0.34.5 + transitivePeerDependencies: + - rollup + + vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4): dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 @@ -1348,11 +2041,13 @@ snapshots: tinyglobby: 0.2.17 optionalDependencies: '@types/node': 26.0.0 + esbuild: 0.28.1 fsevents: 2.3.3 jiti: 2.7.0 + tsx: 4.22.4 - vitefu@1.1.3(vite@8.0.16(@types/node@26.0.0)(jiti@2.7.0)): + vitefu@1.1.3(vite@8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)): optionalDependencies: - vite: 8.0.16(@types/node@26.0.0)(jiti@2.7.0) + vite: 8.0.16(@types/node@26.0.0)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4) zimmerframe@1.1.4: {} diff --git a/proxy/dist/index.d.ts b/proxy/dist/index.d.ts new file mode 100644 index 0000000..e26a57a --- /dev/null +++ b/proxy/dist/index.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/proxy/dist/index.d.ts.map b/proxy/dist/index.d.ts.map new file mode 100644 index 0000000..535b86d --- /dev/null +++ b/proxy/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/proxy/dist/index.js b/proxy/dist/index.js new file mode 100644 index 0000000..cbecddd --- /dev/null +++ b/proxy/dist/index.js @@ -0,0 +1,35 @@ +import { serve } from '@hono/node-server'; +import { Hono } from 'hono'; +const PB_URL = process.env.PB_URL || 'http://127.0.0.1:8090'; +const PB_EMAIL = process.env.PB_SUPERUSER_EMAIL || ''; +const PB_PASSWORD = process.env.PB_SUPERUSER_PASSWORD || ''; +const DEBUG_RECORD_ID = process.env.DEBUG_RECORD_ID || ''; +const app = new Hono(); +app.get('/api/health', (c) => c.json({ status: 'ok' })); +app.post('/api/debug/increment-hono', async (c) => { + const auth = await fetch(`${PB_URL}/api/collections/_superusers/auth-with-password`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ identity: PB_EMAIL, password: PB_PASSWORD }) + }); + const { token } = await auth.json(); + const record = await fetch(`${PB_URL}/api/collections/debug/records/${DEBUG_RECORD_ID}`, { + headers: { Authorization: `Bearer ${token}` } + }); + const data = await record.json(); + const current = data.hono_count || 0; + await fetch(`${PB_URL}/api/collections/debug/records/${DEBUG_RECORD_ID}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + }, + body: JSON.stringify({ hono_count: current + 1 }) + }); + return c.json({ ok: true }); +}); +const port = parseInt(process.env.PROXY_PORT || '3456', 10); +serve({ fetch: app.fetch, port }, (info) => { + console.log(`Hono proxy listening on http://localhost:${info.port}`); +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/proxy/dist/index.js.map b/proxy/dist/index.js.map new file mode 100644 index 0000000..36de1d6 --- /dev/null +++ b/proxy/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,uBAAuB,CAAC;AAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC;AAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;AAE1D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AAEvB,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAExD,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,iDAAiD,EAAE;QACpF,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;KACnE,CAAC,CAAC;IACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAEpC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,kCAAkC,eAAe,EAAE,EAAE;QACxF,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;KAC7C,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;IAErC,MAAM,KAAK,CAAC,GAAG,MAAM,kCAAkC,eAAe,EAAE,EAAE;QACzE,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,KAAK,EAAE;SAChC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,OAAO,GAAG,CAAC,EAAE,CAAC;KACjD,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AAE5D,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;IAC1C,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/proxy/package.json b/proxy/package.json new file mode 100644 index 0000000..19da01e --- /dev/null +++ b/proxy/package.json @@ -0,0 +1,19 @@ +{ + "name": "proxy", + "private": true, + "type": "module", + "scripts": { + "dev": "tsx watch src/index.ts", + "build": "tsc", + "start": "node dist/index.js" + }, + "dependencies": { + "@hono/node-server": "^1.13.0", + "hono": "^4.7.0" + }, + "devDependencies": { + "@types/node": "^26.0.0", + "tsx": "^4.19.0", + "typescript": "^5.7.0" + } +} diff --git a/proxy/src/index.ts b/proxy/src/index.ts new file mode 100644 index 0000000..3c9be44 --- /dev/null +++ b/proxy/src/index.ts @@ -0,0 +1,61 @@ +import { serve } from "@hono/node-server"; +import { Hono } from "hono"; + +// const PB_URL = process.env.PB_URL || 'http://127.0.0.1:8090'; +// const PB_EMAIL = process.env.PB_SUPERUSER_EMAIL || ''; +// const PB_PASSWORD = process.env.PB_SUPERUSER_PASSWORD || ''; +// const DEBUG_RECORD_ID = process.env.DEBUG_RECORD_ID || ''; + +import { + SERVER_IP, + PB_PORT, + PB_EMAIL, + PB_PASSWORD, + DEBUG_RECORD_ID, +} from "../../config.ts"; + +const app = new Hono(); +const PB_ENDPOINT = `http://${SERVER_IP}:${PB_PORT}`; + +app.get("/api/health", (c) => c.json({ status: "ok" })); + +app.post("/api/increment-hono", async (c) => { + const auth = await fetch( + `${PB_ENDPOINT}/api/collections/_superusers/auth-with-password`, + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ identity: PB_EMAIL, password: PB_PASSWORD }), + }, + ); + const { token } = await auth.json(); + + const record = await fetch( + `${PB_ENDPOINT}/api/collections/debug/records/${DEBUG_RECORD_ID}`, + { + headers: { Authorization: `Bearer ${token}` }, + }, + ); + const data = await record.json(); + const current = data.hono_count || 0; + + await fetch( + `${PB_ENDPOINT}/api/collections/debug/records/${DEBUG_RECORD_ID}`, + { + method: "PATCH", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + body: JSON.stringify({ hono_count: current + 1 }), + }, + ); + + return c.json({ ok: true }); +}); + +const port = parseInt(process.env.PROXY_PORT || "3456", 10); + +serve({ fetch: app.fetch, port }, (info) => { + console.log(`Hono proxy listening on ${SERVER_IP}:${info.port}`); +}); diff --git a/proxy/tsconfig.json b/proxy/tsconfig.json new file mode 100644 index 0000000..c2a36bf --- /dev/null +++ b/proxy/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src/**/*"] +}